@graphrefly/graphrefly 0.45.0 → 0.47.0
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 +1 -2
- package/dist/_internal-B23BagFd.d.cts +33 -0
- package/dist/_internal-B23BagFd.d.ts +33 -0
- package/dist/adaptive-rate-limiter-Dch_xYIi.d.cts +111 -0
- package/dist/adaptive-rate-limiter-Dch_xYIi.d.ts +111 -0
- package/dist/agents-C0Ji9ldU.d.cts +629 -0
- package/dist/agents-C9zexT7I.d.ts +629 -0
- package/dist/audit-BAXb3VOg.d.ts +246 -0
- package/dist/audit-C_bPfkqS.d.cts +246 -0
- package/dist/backoff-7KIK3WQW.js +24 -0
- package/dist/backoff-7KIK3WQW.js.map +1 -0
- package/dist/backoff-Bnb9OoPh.d.cts +6 -0
- package/dist/backoff-Bnb9OoPh.d.ts +6 -0
- package/dist/base/composition/index.cjs +865 -0
- package/dist/base/composition/index.cjs.map +1 -0
- package/dist/base/composition/index.d.cts +468 -0
- package/dist/base/composition/index.d.ts +468 -0
- package/dist/base/composition/index.js +40 -0
- package/dist/base/composition/index.js.map +1 -0
- package/dist/base/index.cjs +6390 -0
- package/dist/base/index.cjs.map +1 -0
- package/dist/base/index.d.cts +21 -0
- package/dist/base/index.d.ts +21 -0
- package/dist/base/index.js +259 -0
- package/dist/base/index.js.map +1 -0
- package/dist/base/io/index.cjs +3270 -0
- package/dist/base/io/index.cjs.map +1 -0
- package/dist/base/io/index.d.cts +2245 -0
- package/dist/base/io/index.d.ts +2245 -0
- package/dist/base/io/index.js +117 -0
- package/dist/base/io/index.js.map +1 -0
- package/dist/base/meta/index.cjs +43 -0
- package/dist/base/meta/index.cjs.map +1 -0
- package/dist/base/meta/index.d.cts +45 -0
- package/dist/base/meta/index.d.ts +45 -0
- package/dist/base/meta/index.js +13 -0
- package/dist/base/meta/index.js.map +1 -0
- package/dist/base/mutation/index.cjs +200 -0
- package/dist/base/mutation/index.cjs.map +1 -0
- package/dist/base/mutation/index.d.cts +177 -0
- package/dist/base/mutation/index.d.ts +177 -0
- package/dist/base/mutation/index.js +22 -0
- package/dist/base/mutation/index.js.map +1 -0
- package/dist/base/render/index.cjs +1120 -0
- package/dist/base/render/index.cjs.map +1 -0
- package/dist/base/render/index.d.cts +227 -0
- package/dist/base/render/index.d.ts +227 -0
- package/dist/base/render/index.js +24 -0
- package/dist/base/render/index.js.map +1 -0
- package/dist/base/sources/browser/index.cjs +172 -0
- package/dist/base/sources/browser/index.cjs.map +1 -0
- package/dist/base/sources/browser/index.d.cts +84 -0
- package/dist/base/sources/browser/index.d.ts +84 -0
- package/dist/base/sources/browser/index.js +151 -0
- package/dist/base/sources/browser/index.js.map +1 -0
- package/dist/base/sources/event/index.cjs +98 -0
- package/dist/base/sources/event/index.cjs.map +1 -0
- package/dist/base/sources/event/index.d.cts +91 -0
- package/dist/base/sources/event/index.d.ts +91 -0
- package/dist/base/sources/event/index.js +13 -0
- package/dist/base/sources/event/index.js.map +1 -0
- package/dist/base/sources/index.cjs +755 -0
- package/dist/base/sources/index.cjs.map +1 -0
- package/dist/base/sources/index.d.cts +357 -0
- package/dist/base/sources/index.d.ts +357 -0
- package/dist/base/sources/index.js +42 -0
- package/dist/base/sources/index.js.map +1 -0
- package/dist/base/sources/node/index.cjs +320 -0
- package/dist/base/sources/node/index.cjs.map +1 -0
- package/dist/base/sources/node/index.d.cts +185 -0
- package/dist/base/sources/node/index.d.ts +185 -0
- package/dist/base/sources/node/index.js +306 -0
- package/dist/base/sources/node/index.js.map +1 -0
- package/dist/base/utils/index.cjs +37 -0
- package/dist/base/utils/index.cjs.map +1 -0
- package/dist/base/utils/index.d.cts +37 -0
- package/dist/base/utils/index.d.ts +37 -0
- package/dist/base/utils/index.js +11 -0
- package/dist/base/utils/index.js.map +1 -0
- package/dist/base/worker/index.cjs +548 -0
- package/dist/base/worker/index.cjs.map +1 -0
- package/dist/base/worker/index.d.cts +207 -0
- package/dist/base/worker/index.d.ts +207 -0
- package/dist/base/worker/index.js +20 -0
- package/dist/base/worker/index.js.map +1 -0
- package/dist/breaker-C9skL3d8.d.ts +175 -0
- package/dist/breaker-ugSdq54q.d.cts +175 -0
- package/dist/cascading-CSSbKGrJ.d.ts +199 -0
- package/dist/cascading-baGkiihI.d.cts +199 -0
- package/dist/chunk-22SG74BD.js +207 -0
- package/dist/chunk-22SG74BD.js.map +1 -0
- package/dist/chunk-255UCBG4.js +58 -0
- package/dist/chunk-255UCBG4.js.map +1 -0
- package/dist/chunk-2LO3EL4W.js +1 -0
- package/dist/chunk-2LO3EL4W.js.map +1 -0
- package/dist/chunk-2OB3CEJS.js +1065 -0
- package/dist/chunk-2OB3CEJS.js.map +1 -0
- package/dist/chunk-36NMM65U.js +144 -0
- package/dist/chunk-36NMM65U.js.map +1 -0
- package/dist/chunk-3CEXCBN6.js +1 -0
- package/dist/chunk-3CEXCBN6.js.map +1 -0
- package/dist/chunk-3MUSLI6E.js +105 -0
- package/dist/chunk-3MUSLI6E.js.map +1 -0
- package/dist/chunk-3PSLNJDU.js +884 -0
- package/dist/chunk-3PSLNJDU.js.map +1 -0
- package/dist/chunk-42FQ27MQ.js +594 -0
- package/dist/chunk-42FQ27MQ.js.map +1 -0
- package/dist/chunk-4GYMCUDZ.js +1085 -0
- package/dist/chunk-4GYMCUDZ.js.map +1 -0
- package/dist/chunk-4S53H2KR.js +382 -0
- package/dist/chunk-4S53H2KR.js.map +1 -0
- package/dist/chunk-4XCHZRUJ.js +128 -0
- package/dist/chunk-4XCHZRUJ.js.map +1 -0
- package/dist/chunk-5IMMNARC.js +1153 -0
- package/dist/chunk-5IMMNARC.js.map +1 -0
- package/dist/chunk-6XZYT4SW.js +256 -0
- package/dist/chunk-6XZYT4SW.js.map +1 -0
- package/dist/chunk-7EGRP2VX.js +76 -0
- package/dist/chunk-7EGRP2VX.js.map +1 -0
- package/dist/chunk-A7KV5UK4.js +150 -0
- package/dist/chunk-A7KV5UK4.js.map +1 -0
- package/dist/chunk-APY2SS5X.js +156 -0
- package/dist/chunk-APY2SS5X.js.map +1 -0
- package/dist/chunk-AZDQPQ3V.js +66 -0
- package/dist/chunk-AZDQPQ3V.js.map +1 -0
- package/dist/chunk-BU3SEFA5.js +90 -0
- package/dist/chunk-BU3SEFA5.js.map +1 -0
- package/dist/chunk-BXGZFGZ4.js +189 -0
- package/dist/chunk-BXGZFGZ4.js.map +1 -0
- package/dist/chunk-CGHORL6G.js +579 -0
- package/dist/chunk-CGHORL6G.js.map +1 -0
- package/dist/chunk-CXANAIZU.js +530 -0
- package/dist/chunk-CXANAIZU.js.map +1 -0
- package/dist/chunk-CZQHCKKG.js +1 -0
- package/dist/chunk-CZQHCKKG.js.map +1 -0
- package/dist/chunk-DKNHAICT.js +133 -0
- package/dist/chunk-DKNHAICT.js.map +1 -0
- package/dist/chunk-DM4OMPWK.js +584 -0
- package/dist/chunk-DM4OMPWK.js.map +1 -0
- package/dist/chunk-DMSNO6ZB.js +452 -0
- package/dist/chunk-DMSNO6ZB.js.map +1 -0
- package/dist/chunk-E5OZPDIW.js +229 -0
- package/dist/chunk-E5OZPDIW.js.map +1 -0
- package/dist/chunk-EHRRQ4IC.js +211 -0
- package/dist/chunk-EHRRQ4IC.js.map +1 -0
- package/dist/chunk-EVYY4X5A.js +509 -0
- package/dist/chunk-EVYY4X5A.js.map +1 -0
- package/dist/chunk-FDFD67UO.js +1 -0
- package/dist/chunk-FDFD67UO.js.map +1 -0
- package/dist/chunk-FMPF42Q4.js +13 -0
- package/dist/chunk-FMPF42Q4.js.map +1 -0
- package/dist/chunk-FW23JYNQ.js +454 -0
- package/dist/chunk-FW23JYNQ.js.map +1 -0
- package/dist/chunk-GWRNLJNW.js +2508 -0
- package/dist/chunk-GWRNLJNW.js.map +1 -0
- package/dist/chunk-HL7HUJIX.js +1 -0
- package/dist/chunk-HL7HUJIX.js.map +1 -0
- package/dist/chunk-IHTWQEDR.js +169 -0
- package/dist/chunk-IHTWQEDR.js.map +1 -0
- package/dist/chunk-IJRR6YAI.js +128 -0
- package/dist/chunk-IJRR6YAI.js.map +1 -0
- package/dist/chunk-JGFRAFDL.js +221 -0
- package/dist/chunk-JGFRAFDL.js.map +1 -0
- package/dist/chunk-JKTC747G.js +725 -0
- package/dist/chunk-JKTC747G.js.map +1 -0
- package/dist/chunk-KN3H5CNT.js +11 -0
- package/dist/chunk-KN3H5CNT.js.map +1 -0
- package/dist/chunk-KPG3DGLA.js +1 -0
- package/dist/chunk-KPG3DGLA.js.map +1 -0
- package/dist/chunk-KRNQ6RGQ.js +1 -0
- package/dist/chunk-KRNQ6RGQ.js.map +1 -0
- package/dist/chunk-MLTPJMH6.js +417 -0
- package/dist/chunk-MLTPJMH6.js.map +1 -0
- package/dist/chunk-N3SZ7BMH.js +95 -0
- package/dist/chunk-N3SZ7BMH.js.map +1 -0
- package/dist/chunk-NDUD3IMO.js +540 -0
- package/dist/chunk-NDUD3IMO.js.map +1 -0
- package/dist/chunk-NY2PYHNC.js +873 -0
- package/dist/chunk-NY2PYHNC.js.map +1 -0
- package/dist/chunk-O3MT7DYI.js +225 -0
- package/dist/chunk-O3MT7DYI.js.map +1 -0
- package/dist/chunk-OCUDSN63.js +2386 -0
- package/dist/chunk-OCUDSN63.js.map +1 -0
- package/dist/chunk-OIWU3NYV.js +199 -0
- package/dist/chunk-OIWU3NYV.js.map +1 -0
- package/dist/chunk-OQUIJT7A.js +1 -0
- package/dist/chunk-OQUIJT7A.js.map +1 -0
- package/dist/chunk-P5LBT622.js +105 -0
- package/dist/chunk-P5LBT622.js.map +1 -0
- package/dist/chunk-PKGQG5QQ.js +519 -0
- package/dist/chunk-PKGQG5QQ.js.map +1 -0
- package/dist/chunk-PKPO3JTZ.js +561 -0
- package/dist/chunk-PKPO3JTZ.js.map +1 -0
- package/dist/chunk-PL5UDIQ5.js +118 -0
- package/dist/chunk-PL5UDIQ5.js.map +1 -0
- package/dist/chunk-PZWISPIQ.js +432 -0
- package/dist/chunk-PZWISPIQ.js.map +1 -0
- package/dist/chunk-Q3EYOCZB.js +510 -0
- package/dist/chunk-Q3EYOCZB.js.map +1 -0
- package/dist/chunk-QMBYUVRL.js +15 -0
- package/dist/chunk-QMBYUVRL.js.map +1 -0
- package/dist/chunk-RAGGHLCV.js +200 -0
- package/dist/chunk-RAGGHLCV.js.map +1 -0
- package/dist/chunk-RJOG4IJU.js +1039 -0
- package/dist/chunk-RJOG4IJU.js.map +1 -0
- package/dist/chunk-SOOKUYVM.js +403 -0
- package/dist/chunk-SOOKUYVM.js.map +1 -0
- package/dist/chunk-T5BN5KG7.js +1 -0
- package/dist/chunk-T5BN5KG7.js.map +1 -0
- package/dist/chunk-TNX5ZGDJ.js +574 -0
- package/dist/chunk-TNX5ZGDJ.js.map +1 -0
- package/dist/chunk-TP7244Y6.js +207 -0
- package/dist/chunk-TP7244Y6.js.map +1 -0
- package/dist/chunk-TSBFTJKM.js +57 -0
- package/dist/chunk-TSBFTJKM.js.map +1 -0
- package/dist/chunk-URQ2CBBF.js +143 -0
- package/dist/chunk-URQ2CBBF.js.map +1 -0
- package/dist/chunk-VLAGJZSL.js +1079 -0
- package/dist/chunk-VLAGJZSL.js.map +1 -0
- package/dist/chunk-W2BOPXTI.js +1 -0
- package/dist/chunk-W2BOPXTI.js.map +1 -0
- package/dist/chunk-Y52CS6YA.js +88 -0
- package/dist/chunk-Y52CS6YA.js.map +1 -0
- package/dist/chunk-YCBUWK77.js +92 -0
- package/dist/chunk-YCBUWK77.js.map +1 -0
- package/dist/chunk-YJ4U2D2C.js +314 -0
- package/dist/chunk-YJ4U2D2C.js.map +1 -0
- package/dist/chunk-Z4YXAUDN.js +239 -0
- package/dist/chunk-Z4YXAUDN.js.map +1 -0
- package/dist/chunk-Z65DVDEQ.js +146 -0
- package/dist/chunk-Z65DVDEQ.js.map +1 -0
- package/dist/chunk-Z6EGP5D7.js +92 -0
- package/dist/chunk-Z6EGP5D7.js.map +1 -0
- package/dist/chunk-ZT4WMQW4.js +1575 -0
- package/dist/chunk-ZT4WMQW4.js.map +1 -0
- package/dist/chunk-ZVXXDWIB.js +1282 -0
- package/dist/chunk-ZVXXDWIB.js.map +1 -0
- package/dist/compat/index.cjs +3150 -6
- package/dist/compat/index.cjs.map +1 -1
- package/dist/compat/index.d.cts +116 -1
- package/dist/compat/index.d.ts +116 -1
- package/dist/compat/index.js +175 -2
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/jotai/index.cjs +130 -2
- package/dist/compat/jotai/index.cjs.map +1 -1
- package/dist/compat/jotai/index.d.cts +2 -1
- package/dist/compat/jotai/index.d.ts +2 -1
- package/dist/compat/jotai/index.js +7 -2
- package/dist/compat/jotai/index.js.map +1 -1
- package/dist/compat/nanostores/index.cjs +186 -2
- package/dist/compat/nanostores/index.cjs.map +1 -1
- package/dist/compat/nanostores/index.d.cts +2 -1
- package/dist/compat/nanostores/index.d.ts +2 -1
- package/dist/compat/nanostores/index.js +21 -2
- package/dist/compat/nanostores/index.js.map +1 -1
- package/dist/compat/nestjs/index.cjs +2291 -6
- package/dist/compat/nestjs/index.cjs.map +1 -1
- package/dist/compat/nestjs/index.d.cts +10 -1
- package/dist/compat/nestjs/index.d.ts +10 -1
- package/dist/compat/nestjs/index.js +76 -2
- package/dist/compat/nestjs/index.js.map +1 -1
- package/dist/compat/react/index.cjs +95 -2
- package/dist/compat/react/index.cjs.map +1 -1
- package/dist/compat/react/index.d.cts +2 -1
- package/dist/compat/react/index.d.ts +2 -1
- package/dist/compat/react/index.js +11 -2
- package/dist/compat/react/index.js.map +1 -1
- package/dist/compat/solid/index.cjs +82 -2
- package/dist/compat/solid/index.cjs.map +1 -1
- package/dist/compat/solid/index.d.cts +2 -1
- package/dist/compat/solid/index.d.ts +2 -1
- package/dist/compat/solid/index.js +11 -2
- package/dist/compat/solid/index.js.map +1 -1
- package/dist/compat/svelte/index.cjs +85 -2
- package/dist/compat/svelte/index.cjs.map +1 -1
- package/dist/compat/svelte/index.d.cts +2 -1
- package/dist/compat/svelte/index.d.ts +2 -1
- package/dist/compat/svelte/index.js +11 -2
- package/dist/compat/svelte/index.js.map +1 -1
- package/dist/compat/vue/index.cjs +100 -2
- package/dist/compat/vue/index.cjs.map +1 -1
- package/dist/compat/vue/index.d.cts +3 -1
- package/dist/compat/vue/index.d.ts +3 -1
- package/dist/compat/vue/index.js +11 -2
- package/dist/compat/vue/index.js.map +1 -1
- package/dist/compat/zustand/index.cjs +50 -2
- package/dist/compat/zustand/index.cjs.map +1 -1
- package/dist/compat/zustand/index.d.cts +2 -1
- package/dist/compat/zustand/index.d.ts +2 -1
- package/dist/compat/zustand/index.js +7 -2
- package/dist/compat/zustand/index.js.map +1 -1
- package/dist/distill-De6Rnn15.d.cts +48 -0
- package/dist/distill-De6Rnn15.d.ts +48 -0
- package/dist/external-register-CWyroXb_.d.cts +138 -0
- package/dist/external-register-CWyroXb_.d.ts +138 -0
- package/dist/fallback-Bx46zqky.d.cts +243 -0
- package/dist/fallback-pIWW8A2d.d.ts +243 -0
- package/dist/guarded-execution-BcdtxeBk.d.ts +207 -0
- package/dist/guarded-execution-C-3hnP6A.d.cts +207 -0
- package/dist/index-B6pxYJzO.d.cts +36 -0
- package/dist/index-B6pxYJzO.d.ts +36 -0
- package/dist/index-BFsng6v1.d.cts +44 -0
- package/dist/index-BFsng6v1.d.ts +44 -0
- package/dist/index-B_p8tnvf.d.cts +770 -0
- package/dist/index-Bg-LwEt-.d.cts +45 -0
- package/dist/index-Bg-LwEt-.d.ts +45 -0
- package/dist/index-Brp888t0.d.cts +127 -0
- package/dist/index-Brp888t0.d.ts +127 -0
- package/dist/index-CDfk6jHN.d.cts +37 -0
- package/dist/index-CDfk6jHN.d.ts +37 -0
- package/dist/index-DLAxYaN5.d.cts +169 -0
- package/dist/index-DLAxYaN5.d.ts +169 -0
- package/dist/index-DeWbQzMe.d.cts +34 -0
- package/dist/index-DeWbQzMe.d.ts +34 -0
- package/dist/index-_HDSmPyp.d.ts +770 -0
- package/dist/index-dX9IzPqj.d.cts +86 -0
- package/dist/index-dX9IzPqj.d.ts +86 -0
- package/dist/index.cjs +26009 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -42
- package/dist/index.d.ts +55 -42
- package/dist/index.js +849 -0
- package/dist/index.js.map +1 -1
- package/dist/layout-types-B5aiHYgk.d.cts +72 -0
- package/dist/layout-types-B5aiHYgk.d.ts +72 -0
- package/dist/memory-composers-BryDrRBX.d.cts +529 -0
- package/dist/memory-composers-CVQqPYEV.d.ts +529 -0
- package/dist/observable-B25XqCbZ.d.cts +59 -0
- package/dist/observable-B25XqCbZ.d.ts +59 -0
- package/dist/pipeline-graph-Ce47CB6Y.d.cts +145 -0
- package/dist/pipeline-graph-DXCwY9vG.d.ts +145 -0
- package/dist/presets/ai/index.cjs +4377 -0
- package/dist/presets/ai/index.cjs.map +1 -0
- package/dist/presets/ai/index.d.cts +98 -0
- package/dist/presets/ai/index.d.ts +98 -0
- package/dist/presets/ai/index.js +54 -0
- package/dist/presets/ai/index.js.map +1 -0
- package/dist/presets/harness/index.cjs +5929 -0
- package/dist/presets/harness/index.cjs.map +1 -0
- package/dist/presets/harness/index.d.cts +566 -0
- package/dist/presets/harness/index.d.ts +566 -0
- package/dist/presets/harness/index.js +71 -0
- package/dist/presets/harness/index.js.map +1 -0
- package/dist/presets/index.cjs +9782 -0
- package/dist/presets/index.cjs.map +1 -0
- package/dist/presets/index.d.cts +28 -0
- package/dist/presets/index.d.ts +28 -0
- package/dist/presets/index.js +129 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/presets/inspect/index.cjs +1087 -0
- package/dist/presets/inspect/index.cjs.map +1 -0
- package/dist/presets/inspect/index.d.cts +172 -0
- package/dist/presets/inspect/index.d.ts +172 -0
- package/dist/presets/inspect/index.js +21 -0
- package/dist/presets/inspect/index.js.map +1 -0
- package/dist/presets/resilience/index.cjs +1593 -0
- package/dist/presets/resilience/index.cjs.map +1 -0
- package/dist/presets/resilience/index.d.cts +205 -0
- package/dist/presets/resilience/index.d.ts +205 -0
- package/dist/presets/resilience/index.js +18 -0
- package/dist/presets/resilience/index.js.map +1 -0
- package/dist/rate-limiter-CEALq4N1.d.ts +559 -0
- package/dist/rate-limiter-DpVbSYdH.d.cts +559 -0
- package/dist/reactive-layout-fswlBUvX.d.cts +195 -0
- package/dist/reactive-layout-fswlBUvX.d.ts +195 -0
- package/dist/retry-BDbRZ_gx.d.ts +125 -0
- package/dist/retry-DWuhjvsA.d.cts +125 -0
- package/dist/solutions/index.cjs +8200 -0
- package/dist/solutions/index.cjs.map +1 -0
- package/dist/solutions/index.d.cts +23 -0
- package/dist/solutions/index.d.ts +23 -0
- package/dist/solutions/index.js +55 -0
- package/dist/solutions/index.js.map +1 -0
- package/dist/spawnable-5mDY501F.d.cts +746 -0
- package/dist/spawnable-D3lR0oQu.d.ts +746 -0
- package/dist/status-U-rUI79b.d.cts +84 -0
- package/dist/status-U-rUI79b.d.ts +84 -0
- package/dist/timeout-U5O4ESK3.js +12 -0
- package/dist/timeout-U5O4ESK3.js.map +1 -0
- package/dist/types-BB5Lw-pB.d.cts +442 -0
- package/dist/types-BB5Lw-pB.d.ts +442 -0
- package/dist/types-CJWIMJiZ.d.ts +548 -0
- package/dist/types-vCq7ShIm.d.cts +548 -0
- package/dist/utils/ai/browser.cjs +2169 -0
- package/dist/utils/ai/browser.cjs.map +1 -0
- package/dist/utils/ai/browser.d.cts +129 -0
- package/dist/utils/ai/browser.d.ts +129 -0
- package/dist/utils/ai/browser.js +255 -0
- package/dist/utils/ai/browser.js.map +1 -0
- package/dist/utils/ai/index.cjs +8468 -0
- package/dist/utils/ai/index.cjs.map +1 -0
- package/dist/utils/ai/index.d.cts +1777 -0
- package/dist/utils/ai/index.d.ts +1777 -0
- package/dist/utils/ai/index.js +173 -0
- package/dist/utils/ai/index.js.map +1 -0
- package/dist/utils/ai/node.cjs +648 -0
- package/dist/utils/ai/node.cjs.map +1 -0
- package/dist/utils/ai/node.d.cts +57 -0
- package/dist/utils/ai/node.d.ts +57 -0
- package/dist/utils/ai/node.js +84 -0
- package/dist/utils/ai/node.js.map +1 -0
- package/dist/utils/cqrs/index.cjs +1036 -0
- package/dist/utils/cqrs/index.cjs.map +1 -0
- package/dist/utils/cqrs/index.d.cts +438 -0
- package/dist/utils/cqrs/index.d.ts +438 -0
- package/dist/utils/cqrs/index.js +18 -0
- package/dist/utils/cqrs/index.js.map +1 -0
- package/dist/utils/demo-shell/index.cjs +865 -0
- package/dist/utils/demo-shell/index.cjs.map +1 -0
- package/dist/utils/demo-shell/index.d.cts +90 -0
- package/dist/utils/demo-shell/index.d.ts +90 -0
- package/dist/utils/demo-shell/index.js +13 -0
- package/dist/utils/demo-shell/index.js.map +1 -0
- package/dist/utils/domain-templates/index.cjs +732 -0
- package/dist/utils/domain-templates/index.cjs.map +1 -0
- package/dist/utils/domain-templates/index.d.cts +214 -0
- package/dist/utils/domain-templates/index.d.ts +214 -0
- package/dist/utils/domain-templates/index.js +17 -0
- package/dist/utils/domain-templates/index.js.map +1 -0
- package/dist/utils/graphspec/index.cjs +1174 -0
- package/dist/utils/graphspec/index.cjs.map +1 -0
- package/dist/utils/graphspec/index.d.cts +449 -0
- package/dist/utils/graphspec/index.d.ts +449 -0
- package/dist/utils/graphspec/index.js +35 -0
- package/dist/utils/graphspec/index.js.map +1 -0
- package/dist/utils/harness/index.cjs +656 -0
- package/dist/utils/harness/index.cjs.map +1 -0
- package/dist/utils/harness/index.d.cts +542 -0
- package/dist/utils/harness/index.d.ts +542 -0
- package/dist/utils/harness/index.js +56 -0
- package/dist/utils/harness/index.js.map +1 -0
- package/dist/utils/index.cjs +17614 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +96 -0
- package/dist/utils/index.d.ts +96 -0
- package/dist/utils/index.js +514 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/inspect/index.cjs +807 -0
- package/dist/utils/inspect/index.cjs.map +1 -0
- package/dist/utils/inspect/index.d.cts +123 -0
- package/dist/utils/inspect/index.d.ts +123 -0
- package/dist/utils/inspect/index.js +30 -0
- package/dist/utils/inspect/index.js.map +1 -0
- package/dist/utils/job-queue/index.cjs +717 -0
- package/dist/utils/job-queue/index.cjs.map +1 -0
- package/dist/utils/job-queue/index.d.cts +200 -0
- package/dist/utils/job-queue/index.d.ts +200 -0
- package/dist/utils/job-queue/index.js +18 -0
- package/dist/utils/job-queue/index.js.map +1 -0
- package/dist/utils/memory/index.cjs +1456 -0
- package/dist/utils/memory/index.cjs.map +1 -0
- package/dist/utils/memory/index.d.cts +660 -0
- package/dist/utils/memory/index.d.ts +660 -0
- package/dist/utils/memory/index.js +19 -0
- package/dist/utils/memory/index.js.map +1 -0
- package/dist/utils/messaging/index.cjs +666 -0
- package/dist/utils/messaging/index.cjs.map +1 -0
- package/dist/utils/messaging/index.d.cts +562 -0
- package/dist/utils/messaging/index.d.ts +562 -0
- package/dist/utils/messaging/index.js +50 -0
- package/dist/utils/messaging/index.js.map +1 -0
- package/dist/utils/orchestration/index.cjs +876 -0
- package/dist/utils/orchestration/index.cjs.map +1 -0
- package/dist/utils/orchestration/index.d.cts +233 -0
- package/dist/utils/orchestration/index.d.ts +233 -0
- package/dist/utils/orchestration/index.js +19 -0
- package/dist/utils/orchestration/index.js.map +1 -0
- package/dist/utils/process/index.cjs +743 -0
- package/dist/utils/process/index.cjs.map +1 -0
- package/dist/utils/process/index.d.cts +411 -0
- package/dist/utils/process/index.d.ts +411 -0
- package/dist/utils/process/index.js +14 -0
- package/dist/utils/process/index.js.map +1 -0
- package/dist/utils/reactive-layout/index.cjs +1607 -0
- package/dist/utils/reactive-layout/index.cjs.map +1 -0
- package/dist/utils/reactive-layout/index.d.cts +492 -0
- package/dist/utils/reactive-layout/index.d.ts +492 -0
- package/dist/utils/reactive-layout/index.js +52 -0
- package/dist/utils/reactive-layout/index.js.map +1 -0
- package/dist/utils/reduction/index.cjs +203 -0
- package/dist/utils/reduction/index.cjs.map +1 -0
- package/dist/utils/reduction/index.d.cts +102 -0
- package/dist/utils/reduction/index.d.ts +102 -0
- package/dist/utils/reduction/index.js +14 -0
- package/dist/utils/reduction/index.js.map +1 -0
- package/dist/utils/resilience/index.cjs +1617 -0
- package/dist/utils/resilience/index.cjs.map +1 -0
- package/dist/utils/resilience/index.d.cts +9 -0
- package/dist/utils/resilience/index.d.ts +9 -0
- package/dist/utils/resilience/index.js +44 -0
- package/dist/utils/resilience/index.js.map +1 -0
- package/dist/utils/surface/index.cjs +1070 -0
- package/dist/utils/surface/index.cjs.map +1 -0
- package/dist/utils/surface/index.d.cts +240 -0
- package/dist/utils/surface/index.d.ts +240 -0
- package/dist/utils/surface/index.js +30 -0
- package/dist/utils/surface/index.js.map +1 -0
- package/dist/utils/topology-view/index.cjs +620 -0
- package/dist/utils/topology-view/index.cjs.map +1 -0
- package/dist/utils/topology-view/index.d.cts +68 -0
- package/dist/utils/topology-view/index.d.ts +68 -0
- package/dist/utils/topology-view/index.js +11 -0
- package/dist/utils/topology-view/index.js.map +1 -0
- package/package.json +293 -241
- package/dist/core/index.cjs +0 -21
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.d.cts +0 -1
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +0 -3
- package/dist/core/index.js.map +0 -1
- package/dist/extra/browser.cjs +0 -21
- package/dist/extra/browser.cjs.map +0 -1
- package/dist/extra/browser.d.cts +0 -1
- package/dist/extra/browser.d.ts +0 -1
- package/dist/extra/browser.js +0 -3
- package/dist/extra/browser.js.map +0 -1
- package/dist/extra/index.cjs +0 -21
- package/dist/extra/index.cjs.map +0 -1
- package/dist/extra/index.d.cts +0 -1
- package/dist/extra/index.d.ts +0 -1
- package/dist/extra/index.js +0 -3
- package/dist/extra/index.js.map +0 -1
- package/dist/extra/node.cjs +0 -21
- package/dist/extra/node.cjs.map +0 -1
- package/dist/extra/node.d.cts +0 -1
- package/dist/extra/node.d.ts +0 -1
- package/dist/extra/node.js +0 -3
- package/dist/extra/node.js.map +0 -1
- package/dist/extra/operators.cjs +0 -21
- package/dist/extra/operators.cjs.map +0 -1
- package/dist/extra/operators.d.cts +0 -1
- package/dist/extra/operators.d.ts +0 -1
- package/dist/extra/operators.js +0 -3
- package/dist/extra/operators.js.map +0 -1
- package/dist/extra/reactive.cjs +0 -21
- package/dist/extra/reactive.cjs.map +0 -1
- package/dist/extra/reactive.d.cts +0 -1
- package/dist/extra/reactive.d.ts +0 -1
- package/dist/extra/reactive.js +0 -3
- package/dist/extra/reactive.js.map +0 -1
- package/dist/extra/render/index.cjs +0 -21
- package/dist/extra/render/index.cjs.map +0 -1
- package/dist/extra/render/index.d.cts +0 -1
- package/dist/extra/render/index.d.ts +0 -1
- package/dist/extra/render/index.js +0 -3
- package/dist/extra/render/index.js.map +0 -1
- package/dist/extra/sources.cjs +0 -21
- package/dist/extra/sources.cjs.map +0 -1
- package/dist/extra/sources.d.cts +0 -1
- package/dist/extra/sources.d.ts +0 -1
- package/dist/extra/sources.js +0 -3
- package/dist/extra/sources.js.map +0 -1
- package/dist/extra/storage-browser.cjs +0 -21
- package/dist/extra/storage-browser.cjs.map +0 -1
- package/dist/extra/storage-browser.d.cts +0 -1
- package/dist/extra/storage-browser.d.ts +0 -1
- package/dist/extra/storage-browser.js +0 -3
- package/dist/extra/storage-browser.js.map +0 -1
- package/dist/extra/storage-core.cjs +0 -21
- package/dist/extra/storage-core.cjs.map +0 -1
- package/dist/extra/storage-core.d.cts +0 -1
- package/dist/extra/storage-core.d.ts +0 -1
- package/dist/extra/storage-core.js +0 -3
- package/dist/extra/storage-core.js.map +0 -1
- package/dist/extra/storage-node.cjs +0 -21
- package/dist/extra/storage-node.cjs.map +0 -1
- package/dist/extra/storage-node.d.cts +0 -1
- package/dist/extra/storage-node.d.ts +0 -1
- package/dist/extra/storage-node.js +0 -3
- package/dist/extra/storage-node.js.map +0 -1
- package/dist/extra/storage-tiers-browser.cjs +0 -21
- package/dist/extra/storage-tiers-browser.cjs.map +0 -1
- package/dist/extra/storage-tiers-browser.d.cts +0 -1
- package/dist/extra/storage-tiers-browser.d.ts +0 -1
- package/dist/extra/storage-tiers-browser.js +0 -3
- package/dist/extra/storage-tiers-browser.js.map +0 -1
- package/dist/extra/storage-tiers-node.cjs +0 -21
- package/dist/extra/storage-tiers-node.cjs.map +0 -1
- package/dist/extra/storage-tiers-node.d.cts +0 -1
- package/dist/extra/storage-tiers-node.d.ts +0 -1
- package/dist/extra/storage-tiers-node.js +0 -3
- package/dist/extra/storage-tiers-node.js.map +0 -1
- package/dist/extra/storage-tiers.cjs +0 -21
- package/dist/extra/storage-tiers.cjs.map +0 -1
- package/dist/extra/storage-tiers.d.cts +0 -1
- package/dist/extra/storage-tiers.d.ts +0 -1
- package/dist/extra/storage-tiers.js +0 -3
- package/dist/extra/storage-tiers.js.map +0 -1
- package/dist/extra/storage-wal.cjs +0 -21
- package/dist/extra/storage-wal.cjs.map +0 -1
- package/dist/extra/storage-wal.d.cts +0 -1
- package/dist/extra/storage-wal.d.ts +0 -1
- package/dist/extra/storage-wal.js +0 -3
- package/dist/extra/storage-wal.js.map +0 -1
- package/dist/graph/index.cjs +0 -21
- package/dist/graph/index.cjs.map +0 -1
- package/dist/graph/index.d.cts +0 -1
- package/dist/graph/index.d.ts +0 -1
- package/dist/graph/index.js +0 -3
- package/dist/graph/index.js.map +0 -1
- package/dist/patterns/ai/browser.cjs +0 -21
- package/dist/patterns/ai/browser.cjs.map +0 -1
- package/dist/patterns/ai/browser.d.cts +0 -1
- package/dist/patterns/ai/browser.d.ts +0 -1
- package/dist/patterns/ai/browser.js +0 -3
- package/dist/patterns/ai/browser.js.map +0 -1
- package/dist/patterns/ai/index.cjs +0 -21
- package/dist/patterns/ai/index.cjs.map +0 -1
- package/dist/patterns/ai/index.d.cts +0 -1
- package/dist/patterns/ai/index.d.ts +0 -1
- package/dist/patterns/ai/index.js +0 -3
- package/dist/patterns/ai/index.js.map +0 -1
- package/dist/patterns/ai/node.cjs +0 -21
- package/dist/patterns/ai/node.cjs.map +0 -1
- package/dist/patterns/ai/node.d.cts +0 -1
- package/dist/patterns/ai/node.d.ts +0 -1
- package/dist/patterns/ai/node.js +0 -3
- package/dist/patterns/ai/node.js.map +0 -1
- package/dist/patterns/cqrs/index.cjs +0 -21
- package/dist/patterns/cqrs/index.cjs.map +0 -1
- package/dist/patterns/cqrs/index.d.cts +0 -1
- package/dist/patterns/cqrs/index.d.ts +0 -1
- package/dist/patterns/cqrs/index.js +0 -3
- package/dist/patterns/cqrs/index.js.map +0 -1
- package/dist/patterns/demo-shell/index.cjs +0 -21
- package/dist/patterns/demo-shell/index.cjs.map +0 -1
- package/dist/patterns/demo-shell/index.d.cts +0 -1
- package/dist/patterns/demo-shell/index.d.ts +0 -1
- package/dist/patterns/demo-shell/index.js +0 -3
- package/dist/patterns/demo-shell/index.js.map +0 -1
- package/dist/patterns/domain-templates/index.cjs +0 -21
- package/dist/patterns/domain-templates/index.cjs.map +0 -1
- package/dist/patterns/domain-templates/index.d.cts +0 -1
- package/dist/patterns/domain-templates/index.d.ts +0 -1
- package/dist/patterns/domain-templates/index.js +0 -3
- package/dist/patterns/domain-templates/index.js.map +0 -1
- package/dist/patterns/graphspec/index.cjs +0 -21
- package/dist/patterns/graphspec/index.cjs.map +0 -1
- package/dist/patterns/graphspec/index.d.cts +0 -1
- package/dist/patterns/graphspec/index.d.ts +0 -1
- package/dist/patterns/graphspec/index.js +0 -3
- package/dist/patterns/graphspec/index.js.map +0 -1
- package/dist/patterns/harness/index.cjs +0 -21
- package/dist/patterns/harness/index.cjs.map +0 -1
- package/dist/patterns/harness/index.d.cts +0 -1
- package/dist/patterns/harness/index.d.ts +0 -1
- package/dist/patterns/harness/index.js +0 -3
- package/dist/patterns/harness/index.js.map +0 -1
- package/dist/patterns/inspect/index.cjs +0 -21
- package/dist/patterns/inspect/index.cjs.map +0 -1
- package/dist/patterns/inspect/index.d.cts +0 -1
- package/dist/patterns/inspect/index.d.ts +0 -1
- package/dist/patterns/inspect/index.js +0 -3
- package/dist/patterns/inspect/index.js.map +0 -1
- package/dist/patterns/job-queue/index.cjs +0 -21
- package/dist/patterns/job-queue/index.cjs.map +0 -1
- package/dist/patterns/job-queue/index.d.cts +0 -1
- package/dist/patterns/job-queue/index.d.ts +0 -1
- package/dist/patterns/job-queue/index.js +0 -3
- package/dist/patterns/job-queue/index.js.map +0 -1
- package/dist/patterns/memory/index.cjs +0 -21
- package/dist/patterns/memory/index.cjs.map +0 -1
- package/dist/patterns/memory/index.d.cts +0 -1
- package/dist/patterns/memory/index.d.ts +0 -1
- package/dist/patterns/memory/index.js +0 -3
- package/dist/patterns/memory/index.js.map +0 -1
- package/dist/patterns/messaging/index.cjs +0 -21
- package/dist/patterns/messaging/index.cjs.map +0 -1
- package/dist/patterns/messaging/index.d.cts +0 -1
- package/dist/patterns/messaging/index.d.ts +0 -1
- package/dist/patterns/messaging/index.js +0 -3
- package/dist/patterns/messaging/index.js.map +0 -1
- package/dist/patterns/orchestration/index.cjs +0 -21
- package/dist/patterns/orchestration/index.cjs.map +0 -1
- package/dist/patterns/orchestration/index.d.cts +0 -1
- package/dist/patterns/orchestration/index.d.ts +0 -1
- package/dist/patterns/orchestration/index.js +0 -3
- package/dist/patterns/orchestration/index.js.map +0 -1
- package/dist/patterns/process/index.cjs +0 -21
- package/dist/patterns/process/index.cjs.map +0 -1
- package/dist/patterns/process/index.d.cts +0 -1
- package/dist/patterns/process/index.d.ts +0 -1
- package/dist/patterns/process/index.js +0 -3
- package/dist/patterns/process/index.js.map +0 -1
- package/dist/patterns/reactive-layout/index.cjs +0 -21
- package/dist/patterns/reactive-layout/index.cjs.map +0 -1
- package/dist/patterns/reactive-layout/index.d.cts +0 -1
- package/dist/patterns/reactive-layout/index.d.ts +0 -1
- package/dist/patterns/reactive-layout/index.js +0 -3
- package/dist/patterns/reactive-layout/index.js.map +0 -1
- package/dist/patterns/reduction/index.cjs +0 -21
- package/dist/patterns/reduction/index.cjs.map +0 -1
- package/dist/patterns/reduction/index.d.cts +0 -1
- package/dist/patterns/reduction/index.d.ts +0 -1
- package/dist/patterns/reduction/index.js +0 -3
- package/dist/patterns/reduction/index.js.map +0 -1
- package/dist/patterns/surface/index.cjs +0 -21
- package/dist/patterns/surface/index.cjs.map +0 -1
- package/dist/patterns/surface/index.d.cts +0 -1
- package/dist/patterns/surface/index.d.ts +0 -1
- package/dist/patterns/surface/index.js +0 -3
- package/dist/patterns/surface/index.js.map +0 -1
- package/dist/patterns/topology-view/index.cjs +0 -21
- package/dist/patterns/topology-view/index.cjs.map +0 -1
- package/dist/patterns/topology-view/index.d.cts +0 -1
- package/dist/patterns/topology-view/index.d.ts +0 -1
- package/dist/patterns/topology-view/index.js +0 -3
- package/dist/patterns/topology-view/index.js.map +0 -1
- package/dist/testing/index.cjs +0 -21
- package/dist/testing/index.cjs.map +0 -1
- package/dist/testing/index.d.cts +0 -1
- package/dist/testing/index.d.ts +0 -1
- package/dist/testing/index.js +0 -3
- package/dist/testing/index.js.map +0 -1
|
@@ -0,0 +1,660 @@
|
|
|
1
|
+
import { Node } from '@graphrefly/pure-ts/core';
|
|
2
|
+
import { ReactiveLogBundle } from '@graphrefly/pure-ts/extra';
|
|
3
|
+
import { Graph } from '@graphrefly/pure-ts/graph';
|
|
4
|
+
import { BaseAuditRecord } from '../../base/mutation/index.cjs';
|
|
5
|
+
import { N as NodeOrValue } from '../../_internal-B23BagFd.cjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* DS-14.7 — Reactive Fact Store / Live Knowledge Graph (locked 2026-05-13).
|
|
9
|
+
*
|
|
10
|
+
* Static-topology agent-memory substrate that satisfies MEME L2 (cascade
|
|
11
|
+
* invalidation) and L3 (obsolescence reasoning) plus Hassabis's
|
|
12
|
+
* filter/consolidate/continual-learning frame, **without** materializing one
|
|
13
|
+
* reactive node per fact. ~12 fixed operator nodes never grow regardless of how
|
|
14
|
+
* many facts the store holds; facts live as columnar DATA inside an indexed
|
|
15
|
+
* `state<FactStore>` (optionally sharded), and cascade is implemented as
|
|
16
|
+
* bounded recursive message emission. Termination rests on a per-root
|
|
17
|
+
* semantic contract — a fact only drives the cascade when it transitions to
|
|
18
|
+
* obsolete (`validTo` set), and each obsolete root emits its cascade exactly
|
|
19
|
+
* once across all waves — plus an empty-array fixpoint short-circuit. The
|
|
20
|
+
* cascade is modeled as DATA arrays (NOT INVALIDATE messages), so spec §1.4's
|
|
21
|
+
* idempotent-within-a-wave INVALIDATE guarantee does NOT govern this loop;
|
|
22
|
+
* convergence is the per-root contract, not a spec §1.4 diamond-merge.
|
|
23
|
+
*
|
|
24
|
+
* Canonical design: `archive/docs/SESSION-DS-14.7-reactive-fact-store.md`
|
|
25
|
+
* (9Q walk complete; Q9-open items 1–9 all resolved).
|
|
26
|
+
*
|
|
27
|
+
* Locked decisions baked in here:
|
|
28
|
+
* - `cascadeMaxIterations` default **8**; overflow emits a per-batch summary
|
|
29
|
+
* `{ droppedCount, sample, rootFactId }` to `cascadeOverflow` (Q9-open-4).
|
|
30
|
+
* The overflow `sample` is capped at `OVERFLOW_SAMPLE_SIZE` (8),
|
|
31
|
+
* independent of `cascadeMaxIterations`.
|
|
32
|
+
* - `shardBy` default hash-mod **4**; caller override; `dependentsIndex`
|
|
33
|
+
* unsharded for v1 (Q9-open-1).
|
|
34
|
+
* - `MemoryFragment` adds `embedding? / parent_fragment_id? / provenance?`
|
|
35
|
+
* (Q9-open-3).
|
|
36
|
+
* - `dependentsIndex` updates synchronous + atomic with `factStore` commit
|
|
37
|
+
* (Q9-open-2).
|
|
38
|
+
* - Scoring contract `(fragment, storeReadHandle) => number` — read-only
|
|
39
|
+
* handle, no mutation exposure (Q9-open-5).
|
|
40
|
+
* - Consolidator emits to a dedicated `consolidated` topic that the pattern
|
|
41
|
+
* default-wires back to `ingest`; caller can intercept (Q9-open-6).
|
|
42
|
+
* - Query surface = structured `MemoryQuery` via the `query` topic (default);
|
|
43
|
+
* function-shaped is caller-side `derived` over `factStore` (Q9-open-7).
|
|
44
|
+
* - Bi-temporal is pattern-layer only — no DS-14 envelope shape change
|
|
45
|
+
* (Q9-open-9); `simpleFactStore()` deferred to v1.1 (Q9-open-8 — NOT built).
|
|
46
|
+
*
|
|
47
|
+
* **Cascade cycle visibility.** `cascadeProcessor` stays synchronous (preserves
|
|
48
|
+
* spec §1.4 batch-dedupe — LLM-driven dependency extraction lives UPSTREAM of
|
|
49
|
+
* the cascade topic, never inside the recursion). Every cascade message carries
|
|
50
|
+
* a `causalReason` field and the cycle nodes are tagged `meta.cycle:"cascade"`
|
|
51
|
+
* so `describe()` / `explain()` surface the otherwise-invisible
|
|
52
|
+
* `dependentsIndex` fn-body lookup.
|
|
53
|
+
*
|
|
54
|
+
* @module
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
/** Stable identity for a stored fact. */
|
|
58
|
+
type FactId = string;
|
|
59
|
+
/** Shard partition key (string | number — any hashable scalar). */
|
|
60
|
+
type ShardKey = string | number;
|
|
61
|
+
/**
|
|
62
|
+
* A single stored memory fact. Pattern convention only — NOT a spec primitive
|
|
63
|
+
* and NOT a DS-14 envelope field (bi-temporal stays pattern-layer per
|
|
64
|
+
* Q9-open-9). Each field is a reactive lever (see design PART 2.3):
|
|
65
|
+
* `validTo` set → cascade fires; `confidence < θ` → review; `sources` →
|
|
66
|
+
* `dependentsIndex` edges feeding cascade.
|
|
67
|
+
*/
|
|
68
|
+
interface MemoryFragment<T> {
|
|
69
|
+
readonly id: FactId;
|
|
70
|
+
readonly payload: T;
|
|
71
|
+
/** Transaction time (when learned). `bigint` ns (e.g. `BigInt(monotonicNs())`). */
|
|
72
|
+
readonly t_ns: bigint;
|
|
73
|
+
/** Valid-time start. `undefined` = unbounded past. */
|
|
74
|
+
readonly validFrom?: bigint;
|
|
75
|
+
/** Valid-time end. Setting this is the MEME L3 obsolescence lever. */
|
|
76
|
+
readonly validTo?: bigint;
|
|
77
|
+
/** Confidence 0..1. Dropping below the review threshold emits a review. */
|
|
78
|
+
readonly confidence: number;
|
|
79
|
+
readonly tags: readonly string[];
|
|
80
|
+
/** Dependency edges — fact IDs this fact is derived from / depends on. */
|
|
81
|
+
readonly sources: readonly FactId[];
|
|
82
|
+
/** Optional dense embedding (recipes use it for retrieval). */
|
|
83
|
+
readonly embedding?: readonly number[];
|
|
84
|
+
/** Version-chain pointer — consolidator emits successor fragments. */
|
|
85
|
+
readonly parent_fragment_id?: FactId;
|
|
86
|
+
/** Free-form provenance string for audit. */
|
|
87
|
+
readonly provenance?: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Columnar in-memory store. Held as DATA inside a `state<FactStore<T>>` node
|
|
91
|
+
* (one per shard). `byId` is the authoritative map; the typed companions are
|
|
92
|
+
* kept for the recipe layer (`bitemporal-query`, `influence-analysis`) — v1
|
|
93
|
+
* stores fragments directly and lazily projects columns on demand.
|
|
94
|
+
*/
|
|
95
|
+
interface FactStore<T> {
|
|
96
|
+
readonly byId: ReadonlyMap<FactId, MemoryFragment<T>>;
|
|
97
|
+
}
|
|
98
|
+
/** Reverse dependency index: fact → IDs that depend on it. Unsharded (v1). */
|
|
99
|
+
type DependentsIndex = ReadonlyMap<FactId, readonly FactId[]>;
|
|
100
|
+
/** Read-only projection passed to scoring policies (no mutation surface). */
|
|
101
|
+
interface StoreReadHandle<T> {
|
|
102
|
+
get(id: FactId): MemoryFragment<T> | undefined;
|
|
103
|
+
has(id: FactId): boolean;
|
|
104
|
+
readonly size: number;
|
|
105
|
+
values(): IterableIterator<MemoryFragment<T>>;
|
|
106
|
+
}
|
|
107
|
+
type ScoringPolicy<T> = (fragment: MemoryFragment<T>, store: StoreReadHandle<T>) => number;
|
|
108
|
+
type DecayPolicy = (confidence: number, ageNs: bigint) => number;
|
|
109
|
+
type AdmissionFilter<T> = (fragment: MemoryFragment<T>) => boolean;
|
|
110
|
+
/** Outcome / RL signal — write-back lever for continual learning. */
|
|
111
|
+
interface OutcomeSignal {
|
|
112
|
+
readonly factId: FactId;
|
|
113
|
+
readonly reward: number;
|
|
114
|
+
}
|
|
115
|
+
/** Structured query (Q9-open-7 default surface). Serializable + inspectable. */
|
|
116
|
+
interface MemoryQuery {
|
|
117
|
+
/** Match any of these tags (OR). Omit for no tag filter. */
|
|
118
|
+
readonly tags?: readonly string[];
|
|
119
|
+
/** Bi-temporal "as of" — only facts valid at this instant. */
|
|
120
|
+
readonly asOf?: bigint;
|
|
121
|
+
/** Minimum confidence (inclusive). */
|
|
122
|
+
readonly minConfidence?: number;
|
|
123
|
+
/** Cap results (sorted by confidence desc, then t_ns desc). */
|
|
124
|
+
readonly limit?: number;
|
|
125
|
+
}
|
|
126
|
+
interface MemoryAnswer<T> {
|
|
127
|
+
readonly query: MemoryQuery;
|
|
128
|
+
readonly results: readonly MemoryFragment<T>[];
|
|
129
|
+
}
|
|
130
|
+
type CascadeReason = "cascade" | "obsolete" | "manual";
|
|
131
|
+
/** A single cascade invalidation message flowing through the cascade cycle. */
|
|
132
|
+
interface CascadeEvent {
|
|
133
|
+
readonly factId: FactId;
|
|
134
|
+
readonly rootFactId: FactId;
|
|
135
|
+
readonly reason: CascadeReason;
|
|
136
|
+
/**
|
|
137
|
+
* The triggering root fact's own `validTo`. Cascade-invalidated dependents
|
|
138
|
+
* inherit this (NOT a fresh wall-clock read), so the store is a
|
|
139
|
+
* deterministic rebuildable projection: replaying the same ingest stream
|
|
140
|
+
* yields byte-identical `validTo` on cascade-invalidated fragments. Each
|
|
141
|
+
* dependent inherits the `validTo` of the *nearest obsolete fact that
|
|
142
|
+
* drove its invalidation*: in a pure chain A→B→C where only A is
|
|
143
|
+
* explicitly obsoleted, B and C both inherit A's `validTo` (B has no own
|
|
144
|
+
* `validTo`, so when B becomes a cascade root the detector reads
|
|
145
|
+
* `B.validTo` === A's value). If an intermediate B is itself explicitly
|
|
146
|
+
* obsoleted with its *own* `validTo`, B's dependents inherit B's value,
|
|
147
|
+
* not A's — "stale from when its driving source was invalidated."
|
|
148
|
+
* Deterministic either way. Always defined: only obsolete facts
|
|
149
|
+
* (`validTo` set) drive the cascade as roots.
|
|
150
|
+
*/
|
|
151
|
+
readonly rootValidTo: bigint;
|
|
152
|
+
/** Cascade recursion depth (1 = first wave). Bounded by `cascadeMaxIterations`. */
|
|
153
|
+
readonly iteration: number;
|
|
154
|
+
/**
|
|
155
|
+
* Human-readable causal chain — makes the `dependentsIndex` fn-body lookup
|
|
156
|
+
* visible in `explain()` output even though it is not a topology edge
|
|
157
|
+
* (design Q3 / COMPOSITION-GUIDE §24 mitigation).
|
|
158
|
+
*/
|
|
159
|
+
readonly causalReason: string;
|
|
160
|
+
}
|
|
161
|
+
/** Per-batch overflow summary (Q9-open-4 — never per-message). */
|
|
162
|
+
interface CascadeOverflow {
|
|
163
|
+
readonly droppedCount: number;
|
|
164
|
+
readonly sample: readonly FactId[];
|
|
165
|
+
readonly rootFactId: FactId;
|
|
166
|
+
}
|
|
167
|
+
interface ReviewRequest {
|
|
168
|
+
readonly factId: FactId;
|
|
169
|
+
readonly confidence: number;
|
|
170
|
+
readonly threshold: number;
|
|
171
|
+
}
|
|
172
|
+
interface FactStoreAuditRecord extends BaseAuditRecord {
|
|
173
|
+
readonly action: "ingest" | "invalidate" | "outcome" | "consolidate" | "overflow";
|
|
174
|
+
readonly id?: FactId;
|
|
175
|
+
readonly reason?: CascadeReason;
|
|
176
|
+
}
|
|
177
|
+
interface ReactiveFactStoreConfig<T> {
|
|
178
|
+
readonly extractDependencies: (f: MemoryFragment<T>) => readonly FactId[];
|
|
179
|
+
/** Shard partition fn. Default: FNV-1a hash of `id` mod `shardCount`. */
|
|
180
|
+
readonly shardBy?: (f: MemoryFragment<T>) => ShardKey;
|
|
181
|
+
/** Shard count for the default hash-mod sharder. Default 4 (§3.2). */
|
|
182
|
+
readonly shardCount?: number;
|
|
183
|
+
readonly scoring?: Node<ScoringPolicy<T>>;
|
|
184
|
+
readonly decay?: Node<DecayPolicy>;
|
|
185
|
+
readonly admissionFilter?: Node<AdmissionFilter<T>>;
|
|
186
|
+
readonly ingest: Node<MemoryFragment<T>>;
|
|
187
|
+
readonly outcome?: Node<OutcomeSignal>;
|
|
188
|
+
readonly query?: Node<MemoryQuery>;
|
|
189
|
+
/**
|
|
190
|
+
* Consolidator trigger — a reactive timer/cron Node (e.g. `fromCron(...)`).
|
|
191
|
+
* When supplied, the `consolidated` node maps each tick to summarized
|
|
192
|
+
* fragments emitted on the `consolidated` topic and default-wired back to
|
|
193
|
+
* the internal ingest path.
|
|
194
|
+
*/
|
|
195
|
+
readonly consolidateTrigger?: Node<unknown>;
|
|
196
|
+
/**
|
|
197
|
+
* Consolidation summarizer. Reads a store snapshot, returns successor
|
|
198
|
+
* fragments (typically with `parent_fragment_id` set). Default: no-op
|
|
199
|
+
* (emits nothing) so the cron tick is observable without forcing a policy.
|
|
200
|
+
*/
|
|
201
|
+
readonly consolidate?: (store: StoreReadHandle<T>) => readonly MemoryFragment<T>[];
|
|
202
|
+
/** Cascade recursion cap (§3.1). Default 8. */
|
|
203
|
+
readonly cascadeMaxIterations?: number;
|
|
204
|
+
/** Confidence below which a {@link ReviewRequest} is emitted. Default 0.3. */
|
|
205
|
+
readonly reviewThreshold?: number;
|
|
206
|
+
/**
|
|
207
|
+
* Record every committed fragment (post-admission-filter, with full
|
|
208
|
+
* payload) into a replayable {@link ReactiveFactStoreGraph.ingestLog}.
|
|
209
|
+
* Default `false` (the log retains every fragment in memory — opt in only
|
|
210
|
+
* when you intend to persist + replay).
|
|
211
|
+
*
|
|
212
|
+
* Enables the canonical **rebuildable-projection** recipe: the store is a
|
|
213
|
+
* deterministic projection of its ingest stream (cascade `validTo` is
|
|
214
|
+
* derived from the triggering root, not wall-clock; consolidator successors
|
|
215
|
+
* are re-derived from replayed state, not logged — the projection is still
|
|
216
|
+
* deterministic), so persisting the ingest log and replaying it on restart
|
|
217
|
+
* reconstructs a byte-identical store. Pair with the BigInt-safe codec
|
|
218
|
+
* ({@link MemoryFragment} carries `bigint` time fields). The tier MUST be
|
|
219
|
+
* `mode:"append"` (the default) — `attachStorage` ships per-wave deltas, so
|
|
220
|
+
* an `"overwrite"` tier would truncate the log (and `attachStorage` now
|
|
221
|
+
* throws on one).
|
|
222
|
+
*
|
|
223
|
+
* **First run — persist:**
|
|
224
|
+
* ```ts
|
|
225
|
+
* import { reactiveFactStore } from "@graphrefly/graphrefly";
|
|
226
|
+
* import { appendLogStorage, bigintJsonCodecFor } from "@graphrefly/pure-ts/extra";
|
|
227
|
+
*
|
|
228
|
+
* const tier = appendLogStorage(backend, {
|
|
229
|
+
* name: "facts-ingest",
|
|
230
|
+
* codec: bigintJsonCodecFor<readonly MemoryFragment<Doc>[]>(),
|
|
231
|
+
* });
|
|
232
|
+
* const mem = reactiveFactStore<Doc>({ ingest, extractDependencies, recordIngest: true });
|
|
233
|
+
* mem.ingestLog!.attachStorage([tier]); // forwards every committed fragment
|
|
234
|
+
* ```
|
|
235
|
+
*
|
|
236
|
+
* **Restart — replay (rebuild the projection):** read the persisted entries
|
|
237
|
+
* and feed them through `config.ingest`. Replay is just the reactive input —
|
|
238
|
+
* there is no imperative restore primitive.
|
|
239
|
+
* ```ts
|
|
240
|
+
* const { entries } = await tier.loadEntries!();
|
|
241
|
+
* const mem = reactiveFactStore<Doc>({ ingest, extractDependencies });
|
|
242
|
+
* for (const f of entries) ingest.emit(f); // identical store rebuilt
|
|
243
|
+
* ```
|
|
244
|
+
*
|
|
245
|
+
* **Do NOT do both at once.** On restart, either replay through `ingest`
|
|
246
|
+
* (above) **or** rely on `attachStorage`'s auto-restore — never both:
|
|
247
|
+
* `attachStorage` restores the persisted entries into a fresh `ingestLog`,
|
|
248
|
+
* and a manual replay loop would then re-append + re-persist them (doubling
|
|
249
|
+
* the durable log every restart). If you want continued persistence on the
|
|
250
|
+
* rebuilt store, set `recordIngest:true` and call `attachStorage([tier])`
|
|
251
|
+
* **after** the replay loop completes (the log already holds the replayed
|
|
252
|
+
* fragments, so `attachStorage` ships no spurious deltas).
|
|
253
|
+
*
|
|
254
|
+
* **Memory:** the in-memory log is unbounded (every committed fragment is
|
|
255
|
+
* retained for the store's lifetime). For a long-lived high-volume store,
|
|
256
|
+
* `ingestLog.trimHead(n)` after a confirmed `tier.flush()` bounds it (the
|
|
257
|
+
* durable tier remains the full record).
|
|
258
|
+
*/
|
|
259
|
+
readonly recordIngest?: boolean;
|
|
260
|
+
}
|
|
261
|
+
interface ReactiveFactStoreGraph<T> extends Graph {
|
|
262
|
+
/** Per-shard `state<FactStore<T>>` nodes (length = shard count). */
|
|
263
|
+
readonly shards: readonly Node<FactStore<T>>[];
|
|
264
|
+
/** Unified read view across all shards (derived). */
|
|
265
|
+
readonly factStore: Node<FactStore<T>>;
|
|
266
|
+
readonly dependentsIndex: Node<DependentsIndex>;
|
|
267
|
+
readonly answer: Node<MemoryAnswer<T> | null>;
|
|
268
|
+
readonly cascade: Node<readonly CascadeEvent[]>;
|
|
269
|
+
readonly cascadeOverflow: Node<CascadeOverflow | null>;
|
|
270
|
+
readonly review: Node<ReviewRequest | null>;
|
|
271
|
+
readonly consolidated: Node<readonly MemoryFragment<T>[]>;
|
|
272
|
+
readonly events: ReactiveLogBundle<FactStoreAuditRecord>;
|
|
273
|
+
/**
|
|
274
|
+
* Payload-carrying, replayable log of every committed fragment. Present iff
|
|
275
|
+
* {@link ReactiveFactStoreConfig.recordIngest} is `true`. Unlike
|
|
276
|
+
* {@link ReactiveFactStoreGraph.events} (action-only audit), each entry is
|
|
277
|
+
* the full {@link MemoryFragment} — `attachStorage` it for a durable,
|
|
278
|
+
* replayable projection source (see `recordIngest` docs for the recipe).
|
|
279
|
+
*/
|
|
280
|
+
readonly ingestLog?: ReactiveLogBundle<MemoryFragment<T>>;
|
|
281
|
+
/** Reactive read: a single fact by id (SENTINEL until the fact exists). */
|
|
282
|
+
itemNode(id: FactId): Node<MemoryFragment<T> | undefined>;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Build a static-topology reactive fact store (DS-14.7 architecture C).
|
|
286
|
+
*
|
|
287
|
+
* Topology (~12 fixed nodes — never grows with fact count):
|
|
288
|
+
* - `shards[0..N]` — `state<FactStore<T>>` columnar stores (default 4 shards).
|
|
289
|
+
* - `factStore` — derived union read view across shards.
|
|
290
|
+
* - `dependentsIndex` — `state<DependentsIndex>` reverse-dep map, unsharded,
|
|
291
|
+
* updated synchronously + atomically with each commit (Q9-open-2).
|
|
292
|
+
* - `extractOp` — derived: ingest → admission-filtered fragment + dep edges.
|
|
293
|
+
* - `invalidationDetector` — derived: scans committed store for `validTo`-set
|
|
294
|
+
* / low-confidence facts, resolves dependents via `dependentsIndex`, emits
|
|
295
|
+
* cascade messages.
|
|
296
|
+
* - `cascade` — topic node carrying `CascadeEvent[]`.
|
|
297
|
+
* - `cascadeProcessor` — derived, **synchronous**, `meta.cycle:"cascade"`:
|
|
298
|
+
* dedupes by factId, writes invalidations back to shards, recurses until
|
|
299
|
+
* fixpoint OR `cascadeMaxIterations` → `cascadeOverflow`.
|
|
300
|
+
* - `cascadeOverflow` — per-batch overflow summary node.
|
|
301
|
+
* - `queryOp` / `answer` — structured `MemoryQuery` → results (SENTINEL-safe).
|
|
302
|
+
* - `outcomeProcessor` — outcome signal → confidence write-back.
|
|
303
|
+
* - `consolidated` — cron-tick → summarized fragments on the
|
|
304
|
+
* `consolidated` topic,
|
|
305
|
+
* default-wired back into the ingest path.
|
|
306
|
+
* - `review` — low-confidence proactive-verification requests.
|
|
307
|
+
*
|
|
308
|
+
* The cascade cycle (`invalidationDetector → cascade → cascadeProcessor →
|
|
309
|
+
* shards → invalidationDetector`) is a real, bounded reactive cycle. Both
|
|
310
|
+
* `invalidationDetector` and `cascadeProcessor` are tagged
|
|
311
|
+
* `meta.cycle:"cascade"` and every cascade message carries `causalReason`, so
|
|
312
|
+
* `describe()` / `explain()` surface the otherwise-invisible
|
|
313
|
+
* `dependentsIndex` lookup (COMPOSITION-GUIDE §24).
|
|
314
|
+
*
|
|
315
|
+
* @category memory
|
|
316
|
+
*/
|
|
317
|
+
declare function reactiveFactStore<T>(config: ReactiveFactStoreConfig<T>): ReactiveFactStoreGraph<T>;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Memory patterns (roadmap §4.3) — public-face Phase-4 primitives audited under
|
|
321
|
+
* `archive/docs/SESSION-public-face-blocks-review.md` (Wave A, locked 2026-04-25).
|
|
322
|
+
*
|
|
323
|
+
* Three primitives (the pure `decay` helper was promoted to `extra/utils/decay.ts`
|
|
324
|
+
* per Tier 2.2 and is no longer re-exported here; `lightCollection` was folded
|
|
325
|
+
* into `collection({ranked:false})` per Tier 2.3 and is no longer a separate
|
|
326
|
+
* factory):
|
|
327
|
+
* - {@link collection} / {@link CollectionGraph} — keyed memory store with
|
|
328
|
+
* optional decay-aware ranking. Pass `{ ranked: false }` for the previous
|
|
329
|
+
* `lightCollection` shape (Map + LRU + audit, no scoring).
|
|
330
|
+
* - {@link vectorIndex} / {@link VectorIndexGraph} — reactive vector store with
|
|
331
|
+
* optional HNSW backend, retention, and reactive {@link VectorIndexGraph.searchNode}.
|
|
332
|
+
* - {@link knowledgeGraph} / {@link KnowledgeGraph} — entities + typed edges with
|
|
333
|
+
* symmetric adjacency indexes and reactive {@link KnowledgeGraph.relatedNode}.
|
|
334
|
+
*
|
|
335
|
+
* **No imperative reads.** Per the API-style policy locked 2026-04-25, public-face
|
|
336
|
+
* primitives expose reactive reads only — `itemNode` / `hasNode` / `searchNode` /
|
|
337
|
+
* `relatedNode`. One-shot snapshots use `node.cache` after `awaitSettled`, or
|
|
338
|
+
* `firstValueFrom(node)`.
|
|
339
|
+
*
|
|
340
|
+
* **Audit logs.** Every imperative mutation (`upsert / remove / clear / link /
|
|
341
|
+
* unlink / rescore / reindex`) is wrapped via {@link mutate} and appends a
|
|
342
|
+
* typed record to a public `events` log on the bundle / graph.
|
|
343
|
+
*
|
|
344
|
+
* @module
|
|
345
|
+
*/
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Cosine similarity over `(a, b)`. When lengths differ, the shorter is
|
|
349
|
+
* implicitly zero-padded to the longer length. Returns `0` if either vector
|
|
350
|
+
* has zero norm. Public utility — used by {@link VectorIndexGraph.searchNode}
|
|
351
|
+
* and exposed for downstream consumers (e.g. `patterns/ai/memory/`) that need
|
|
352
|
+
* the same scoring at the boundary.
|
|
353
|
+
*
|
|
354
|
+
* **Numeric guards.** Returns `0` for non-finite results (overflow producing
|
|
355
|
+
* `Infinity`/`NaN` from very-large vectors, or `NaN` propagating from any
|
|
356
|
+
* `NaN`/`Infinity` component). Without this guard, downstream sort
|
|
357
|
+
* comparators would order NaN-scored rows arbitrarily.
|
|
358
|
+
*
|
|
359
|
+
* **Depth.** This is a per-call computation; no internal caching. For very
|
|
360
|
+
* large indexes (>10k) consider precomputing norms or using HNSW.
|
|
361
|
+
*
|
|
362
|
+
* @category memory
|
|
363
|
+
*/
|
|
364
|
+
declare function cosineSimilarity(a: readonly number[], b: readonly number[]): number;
|
|
365
|
+
|
|
366
|
+
type CollectionEntry<T> = {
|
|
367
|
+
readonly id: string;
|
|
368
|
+
readonly value: T;
|
|
369
|
+
readonly createdAtNs: number;
|
|
370
|
+
readonly lastAccessNs: number;
|
|
371
|
+
readonly baseScore: number;
|
|
372
|
+
};
|
|
373
|
+
type RankedCollectionEntry<T> = CollectionEntry<T> & {
|
|
374
|
+
readonly score: number;
|
|
375
|
+
};
|
|
376
|
+
type CollectionScoreFn<T> = (value: T) => number;
|
|
377
|
+
type CollectionOptions<T> = {
|
|
378
|
+
maxSize?: number;
|
|
379
|
+
/**
|
|
380
|
+
* Whether to expose a live decay-aware `ranked` node + `rescore` mutator.
|
|
381
|
+
* Default `true`. Pass `false` to fold in the previous `lightCollection`
|
|
382
|
+
* shape — entries are still keyed/audited/LRU-evicted, but the timer-driven
|
|
383
|
+
* `ranked` + scoring machinery is skipped. `ranked` then resolves to a
|
|
384
|
+
* static empty array Node and `rescore()` is a no-op (so callers writing
|
|
385
|
+
* type-generic code don't need to special-case the unranked path).
|
|
386
|
+
*/
|
|
387
|
+
ranked?: boolean;
|
|
388
|
+
/**
|
|
389
|
+
* Produces a base score at insert/update time. Static fn or a reactive
|
|
390
|
+
* `Node<(value: T) => number>` — when supplied as a Node, `ranked` re-derives
|
|
391
|
+
* whenever the score fn changes, but `baseScore` on each entry is only
|
|
392
|
+
* recomputed via {@link CollectionGraph.rescore}. Default `() => 1`.
|
|
393
|
+
*
|
|
394
|
+
* Ignored when `ranked: false` (entries record `baseScore: 0`).
|
|
395
|
+
*/
|
|
396
|
+
score?: CollectionScoreFn<T> | Node<CollectionScoreFn<T>>;
|
|
397
|
+
/**
|
|
398
|
+
* Exponential decay rate per second. `0` disables decay (default). When
|
|
399
|
+
* positive, `ranked` becomes fully reactive on time via a `fromTimer` source
|
|
400
|
+
* (cadence auto-derived from `decayRate` unless overridden via
|
|
401
|
+
* `refreshIntervalMs`). Half-life: `ratePerSecond = Math.LN2 / halfLifeSeconds`.
|
|
402
|
+
*
|
|
403
|
+
* Ignored when `ranked: false`.
|
|
404
|
+
*/
|
|
405
|
+
decayRate?: number;
|
|
406
|
+
/** Minimum score floor after decay. Default `0`. */
|
|
407
|
+
minScore?: number;
|
|
408
|
+
/**
|
|
409
|
+
* Override for the `ranked` refresh tick cadence (milliseconds). When
|
|
410
|
+
* unset and `decayRate > 0`, defaults to `1000 * Math.LN2 / (10 * decayRate)`
|
|
411
|
+
* — roughly one tick per 10% of the half-life (~10% staleness budget).
|
|
412
|
+
*/
|
|
413
|
+
refreshIntervalMs?: number;
|
|
414
|
+
};
|
|
415
|
+
interface CollectionAuditRecord extends BaseAuditRecord {
|
|
416
|
+
readonly action: "upsert" | "remove" | "clear" | "rescore";
|
|
417
|
+
readonly id?: string;
|
|
418
|
+
}
|
|
419
|
+
type CollectionGraph<T> = Graph & {
|
|
420
|
+
readonly events: ReactiveLogBundle<CollectionAuditRecord>;
|
|
421
|
+
readonly items: Node<ReadonlyMap<string, CollectionEntry<T>>>;
|
|
422
|
+
/**
|
|
423
|
+
* Live decay-aware ranking, sorted by score descending. When the
|
|
424
|
+
* collection was constructed with `ranked: false`, this is a static
|
|
425
|
+
* empty-array Node (kept for type uniformity).
|
|
426
|
+
*/
|
|
427
|
+
readonly ranked: Node<readonly RankedCollectionEntry<T>[]>;
|
|
428
|
+
readonly size: Node<number>;
|
|
429
|
+
upsert: (id: string, value: T, opts?: {
|
|
430
|
+
score?: number;
|
|
431
|
+
}) => void;
|
|
432
|
+
remove: (id: string) => void;
|
|
433
|
+
clear: () => void;
|
|
434
|
+
/**
|
|
435
|
+
* Recompute every entry's `baseScore` via the latest score fn. O(N). Useful
|
|
436
|
+
* when a reactive `score` Node has emitted a new fn and the caller wants
|
|
437
|
+
* existing entries re-scored without an explicit re-upsert.
|
|
438
|
+
*
|
|
439
|
+
* No-op (still records an audit entry) when constructed with
|
|
440
|
+
* `ranked: false`.
|
|
441
|
+
*/
|
|
442
|
+
rescore: () => void;
|
|
443
|
+
itemNode: (id: NodeOrValue<string>) => Node<CollectionEntry<T> | undefined>;
|
|
444
|
+
/** Reactive `true` once the entry exists; tracks upsert / remove. */
|
|
445
|
+
hasNode: (id: NodeOrValue<string>) => Node<boolean>;
|
|
446
|
+
};
|
|
447
|
+
/**
|
|
448
|
+
* Scored memory store with live decay-aware ranking.
|
|
449
|
+
*
|
|
450
|
+
* Topology (mounted on the returned graph):
|
|
451
|
+
* - `items` — `reactiveMap<id, CollectionEntry<T>>` (with `retention` configured
|
|
452
|
+
* for score-based eviction when `maxSize` is set).
|
|
453
|
+
* - `ranked` — `Node<readonly RankedCollectionEntry<T>[]>`, sorted by live
|
|
454
|
+
* decayed score. **Lazy** — does NOT compute until subscribed (no internal
|
|
455
|
+
* keepalive). Use `keepalive(coll.ranked)` for eager activation.
|
|
456
|
+
* - `size` — `Node<number>`, count of entries.
|
|
457
|
+
* - `_refreshTick` — `fromTimer`-driven `monotonicNs()` source, mounted only
|
|
458
|
+
* when `decayRate > 0`. Drives `ranked`'s time-dependent re-derivation.
|
|
459
|
+
* - `_seq` — sequence cursor for the audit log.
|
|
460
|
+
* - `events` — bounded reactive log of every mutation.
|
|
461
|
+
*
|
|
462
|
+
* **Time as a reactive dep.** When `decayRate > 0`, `ranked`'s deps are
|
|
463
|
+
* `[items, refreshTick]` — the tick payload IS `monotonicNs()`, so the fn is
|
|
464
|
+
* pure of deps and dry-run-reproducible with a mocked clock.
|
|
465
|
+
*
|
|
466
|
+
* **Lazy timer.** With no subscriber to `ranked`, the timer source does not
|
|
467
|
+
* fire — the activation chain is downstream-driven. To keep the timer warm
|
|
468
|
+
* without consuming results, register `graph.addDisposer(keepalive(coll.ranked))`.
|
|
469
|
+
*
|
|
470
|
+
* **Eviction at write-time.** Score-based retention runs on every successful
|
|
471
|
+
* `upsert / remove / clear` (it is mutation-driven, not tick-driven). The
|
|
472
|
+
* retention scorer reads `monotonicNs()` to compute decayed scores at eviction
|
|
473
|
+
* time — this is a deliberate impurity vs. `ReactiveMapRetention.score`'s
|
|
474
|
+
* "pure of `(key, value)`" docstring: write-time is the right moment to evict
|
|
475
|
+
* stale-by-decay entries.
|
|
476
|
+
*
|
|
477
|
+
* **No imperative reads.** Subscribe to `items` / `ranked` for live snapshots,
|
|
478
|
+
* or use `itemNode(id)` for single-key reactive reads.
|
|
479
|
+
*
|
|
480
|
+
* **`rescore` ordering caveat.** `rescore()` reads `items.entries.cache`
|
|
481
|
+
* (the post-emission snapshot) and writes via `setMany`. When called
|
|
482
|
+
* stand-alone it sees the latest committed state. When wrapped inside a
|
|
483
|
+
* user-level `batch(() => { coll.upsert(...); coll.rescore(); })`, the
|
|
484
|
+
* `cache` snapshot reflects state BEFORE the batch — so a just-staged
|
|
485
|
+
* upsert is invisible to the rescore scan. If you need rescore to include
|
|
486
|
+
* the staged upsert, either call `rescore()` after the batch settles or
|
|
487
|
+
* pass the new `baseScore` directly via `upsert(id, value, { score })`.
|
|
488
|
+
*
|
|
489
|
+
* **Audit no-op records.** Like `lightCollection`, mutations record audit
|
|
490
|
+
* entries even when the impl was a no-op (e.g., `rescore()` on an empty
|
|
491
|
+
* store). Intentional — the framework records attempts.
|
|
492
|
+
*
|
|
493
|
+
* @category memory
|
|
494
|
+
*/
|
|
495
|
+
declare function collection<T>(name: string, opts?: CollectionOptions<T>): CollectionGraph<T>;
|
|
496
|
+
type VectorBackend = "flat" | "hnsw";
|
|
497
|
+
type VectorRecord<TMeta> = {
|
|
498
|
+
readonly id: string;
|
|
499
|
+
readonly vector: readonly number[];
|
|
500
|
+
readonly meta?: TMeta;
|
|
501
|
+
/** Wall-clock-monotonic timestamp at last upsert; used for the default LRU retention. */
|
|
502
|
+
readonly upsertedAtNs: number;
|
|
503
|
+
};
|
|
504
|
+
type VectorSearchResult<TMeta> = {
|
|
505
|
+
readonly id: string;
|
|
506
|
+
readonly score: number;
|
|
507
|
+
readonly meta?: TMeta;
|
|
508
|
+
};
|
|
509
|
+
type HnswAdapter<TMeta> = {
|
|
510
|
+
upsert: (id: string, vector: readonly number[], meta?: TMeta) => void;
|
|
511
|
+
remove: (id: string) => void;
|
|
512
|
+
clear: () => void;
|
|
513
|
+
search: (query: readonly number[], k: number) => ReadonlyArray<VectorSearchResult<TMeta>>;
|
|
514
|
+
/** Optional adapter teardown. Called from `graph.destroy()` via `addDisposer`. */
|
|
515
|
+
dispose?: () => void;
|
|
516
|
+
};
|
|
517
|
+
type VectorIndexOptions<TMeta> = {
|
|
518
|
+
name?: string;
|
|
519
|
+
backend?: VectorBackend;
|
|
520
|
+
dimension?: number;
|
|
521
|
+
/**
|
|
522
|
+
* Strict-dimension default. When `true` (default) AND `dimension` is unset,
|
|
523
|
+
* mixed-length upserts throw `RangeError`. Set `false` to opt into the
|
|
524
|
+
* lenient zero-padding behavior of {@link VectorIndexGraph.searchNode}.
|
|
525
|
+
*/
|
|
526
|
+
strictDimension?: boolean;
|
|
527
|
+
/** Optional dependency seam for HNSW. */
|
|
528
|
+
hnswFactory?: () => HnswAdapter<TMeta>;
|
|
529
|
+
/** Maximum live entries (LRU-by-upsert-time when set; user-overridable via `retentionScore`). */
|
|
530
|
+
maxSize?: number;
|
|
531
|
+
/** Custom retention scorer. Higher score = kept. Defaults to `r => r.upsertedAtNs`. */
|
|
532
|
+
retentionScore?: (record: VectorRecord<TMeta>) => number;
|
|
533
|
+
};
|
|
534
|
+
interface VectorIndexAuditRecord extends BaseAuditRecord {
|
|
535
|
+
readonly action: "upsert" | "remove" | "clear" | "reindex" | "evict";
|
|
536
|
+
readonly id?: string;
|
|
537
|
+
}
|
|
538
|
+
type VectorIndexGraph<TMeta> = Graph & {
|
|
539
|
+
readonly backend: VectorBackend;
|
|
540
|
+
readonly events: ReactiveLogBundle<VectorIndexAuditRecord>;
|
|
541
|
+
readonly entries: Node<ReadonlyMap<string, VectorRecord<TMeta>>>;
|
|
542
|
+
upsert: (id: string, vector: readonly number[], meta?: TMeta) => void;
|
|
543
|
+
remove: (id: string) => void;
|
|
544
|
+
clear: () => void;
|
|
545
|
+
/** Re-push every live entry into the optional HNSW adapter. No-op for `flat`. */
|
|
546
|
+
reindex: () => void;
|
|
547
|
+
/**
|
|
548
|
+
* Reactive top-K search. Re-derives whenever entries / query / k change.
|
|
549
|
+
* Lazy. Use `firstValueFrom(searchNode(...))` for one-shot reads.
|
|
550
|
+
*/
|
|
551
|
+
searchNode: (query: Node<readonly number[]>, k?: NodeOrValue<number>) => Node<readonly VectorSearchResult<TMeta>[]>;
|
|
552
|
+
};
|
|
553
|
+
/**
|
|
554
|
+
* Reactive vector store with optional HNSW backend.
|
|
555
|
+
*
|
|
556
|
+
* **Storage on `reactiveMap`.** `entries` is a `reactiveMap<id, VectorRecord<TMeta>>`
|
|
557
|
+
* with optional score-based retention (`maxSize` + LRU-by-`upsertedAtNs` by
|
|
558
|
+
* default; user can supply a custom `retentionScore`). On retention eviction,
|
|
559
|
+
* the HNSW adapter (if configured) is also notified via `adapter.remove(id)`.
|
|
560
|
+
*
|
|
561
|
+
* **Reactive search.** `searchNode(queryNode, k)` returns a `Node<readonly
|
|
562
|
+
* VectorSearchResult<TMeta>[]>` that re-derives on entries / query / k change.
|
|
563
|
+
* Lazy — only computes when subscribed. Imperative `search()` is intentionally
|
|
564
|
+
* not exposed (no-imperative-reads policy). Use `firstValueFrom(searchNode(...))`
|
|
565
|
+
* for one-shot reads.
|
|
566
|
+
*
|
|
567
|
+
* **Strict dimension.** Default `strictDimension: true` — if `dimension` is
|
|
568
|
+
* unset and an upsert produces a vector of a different length than the first
|
|
569
|
+
* upserted, throws `RangeError`. Pass `strictDimension: false` to opt into
|
|
570
|
+
* the lenient zero-padding fallback (the previous default).
|
|
571
|
+
*
|
|
572
|
+
* **Adapter lifecycle.** When the HNSW adapter exposes a `dispose()` method,
|
|
573
|
+
* it is bound to the graph's teardown via `addDisposer`. When retention
|
|
574
|
+
* evicts an entry, `adapter.remove(id)` is invoked synchronously inside the
|
|
575
|
+
* retention `onArchive` callback.
|
|
576
|
+
*
|
|
577
|
+
* **Cosine zero-pad.** The flat backend uses cosine similarity over the
|
|
578
|
+
* pairwise max-length zero-pad. Mixing dimensions silently degrades scores
|
|
579
|
+
* unless strict mode catches it at upsert time. For embedding-model vectors,
|
|
580
|
+
* L2-normalize at the source — `vectorIndex` does not normalize.
|
|
581
|
+
*
|
|
582
|
+
* @category memory
|
|
583
|
+
*/
|
|
584
|
+
declare function vectorIndex<TMeta>(opts?: VectorIndexOptions<TMeta>): VectorIndexGraph<TMeta>;
|
|
585
|
+
type KnowledgeEdge<TRelation extends string = string> = {
|
|
586
|
+
readonly from: string;
|
|
587
|
+
readonly to: string;
|
|
588
|
+
readonly relation: TRelation;
|
|
589
|
+
readonly weight: number;
|
|
590
|
+
};
|
|
591
|
+
type KnowledgeGraphOptions = {
|
|
592
|
+
/** Cap on entity count (LRU-by-upsert-time when set). */
|
|
593
|
+
entitiesMaxSize?: number;
|
|
594
|
+
/** Cap on edge count (LRU-by-upsert-time when set). */
|
|
595
|
+
edgesMaxSize?: number;
|
|
596
|
+
/**
|
|
597
|
+
* Orphan-entity garbage collection. `"keep"` (default) leaves entities
|
|
598
|
+
* untouched when their last edge is unlinked; `"remove"` deletes the
|
|
599
|
+
* entity post-`unlink` if no edges reference it.
|
|
600
|
+
*/
|
|
601
|
+
orphanGC?: "keep" | "remove";
|
|
602
|
+
};
|
|
603
|
+
interface KnowledgeGraphAuditRecord extends BaseAuditRecord {
|
|
604
|
+
readonly action: "upsertEntity" | "removeEntity" | "link" | "unlink" | "orphanRemove";
|
|
605
|
+
readonly id?: string;
|
|
606
|
+
readonly from?: string;
|
|
607
|
+
readonly to?: string;
|
|
608
|
+
readonly relation?: string;
|
|
609
|
+
/** Edge weight at the time of the `link`. Omitted for non-edge actions. */
|
|
610
|
+
readonly weight?: number;
|
|
611
|
+
}
|
|
612
|
+
type KnowledgeGraph<TEntity, TRelation extends string = string> = Graph & {
|
|
613
|
+
readonly events: ReactiveLogBundle<KnowledgeGraphAuditRecord>;
|
|
614
|
+
readonly entities: Node<ReadonlyMap<string, TEntity>>;
|
|
615
|
+
readonly edges: Node<ReadonlyMap<string, KnowledgeEdge<TRelation>>>;
|
|
616
|
+
readonly adjacencyOut: Node<ReadonlyMap<string, readonly KnowledgeEdge<TRelation>[]>>;
|
|
617
|
+
readonly adjacencyIn: Node<ReadonlyMap<string, readonly KnowledgeEdge<TRelation>[]>>;
|
|
618
|
+
readonly entityCount: Node<number>;
|
|
619
|
+
readonly edgeCount: Node<number>;
|
|
620
|
+
upsertEntity: (id: string, value: TEntity) => void;
|
|
621
|
+
removeEntity: (id: string) => void;
|
|
622
|
+
link: (from: string, to: string, relation: TRelation, weight?: number) => void;
|
|
623
|
+
unlink: (from: string, to: string, relation?: TRelation) => void;
|
|
624
|
+
relatedNode: (id: NodeOrValue<string>, relation?: NodeOrValue<TRelation>) => Node<readonly KnowledgeEdge<TRelation>[]>;
|
|
625
|
+
};
|
|
626
|
+
/**
|
|
627
|
+
* Reactive knowledge graph: entities + typed edges + symmetric adjacency.
|
|
628
|
+
*
|
|
629
|
+
* Topology (mounted on the returned graph):
|
|
630
|
+
* - `entities` — `reactiveMap<id, TEntity>` (optional `entitiesMaxSize` LRU).
|
|
631
|
+
* - `edges` — `reactiveMap<tripleKey, KnowledgeEdge<TRelation>>` keyed by
|
|
632
|
+
* `${from}${to}${relation}` (optional `edgesMaxSize` LRU).
|
|
633
|
+
* Entity IDs / relations must NOT contain ``.
|
|
634
|
+
* - `adjacencyOut` — `Node<ReadonlyMap<from, readonly edge[]>>`. **Full O(E)
|
|
635
|
+
* rebuild on every `link` / `unlink` mutation.** (Prior JSDoc claim of
|
|
636
|
+
* "O(E) build" referred to a single rebuild — the per-mutation cost is
|
|
637
|
+
* O(E), not O(1) amortized. For very large graphs with frequent edge
|
|
638
|
+
* churn, consider batching via `reactiveMap.setMany`.)
|
|
639
|
+
* - `adjacencyIn` — `Node<ReadonlyMap<to, readonly edge[]>>`. Same O(E) per
|
|
640
|
+
* mutation rebuild characteristic.
|
|
641
|
+
* - `entityCount` / `edgeCount` — observability deriveds.
|
|
642
|
+
* - `events` — bounded reactive audit log.
|
|
643
|
+
*
|
|
644
|
+
* **`link()` semantics.** Calling `link(a, b, rel, w)` twice with different
|
|
645
|
+
* weights replaces the weight on the existing edge (keyed by the triple).
|
|
646
|
+
* `unlink` then `link` re-creates the edge (and bumps `lastUpsertNs` for
|
|
647
|
+
* retention purposes).
|
|
648
|
+
*
|
|
649
|
+
* **Edge weight convention.** Higher weight = stronger relation. Default `1`.
|
|
650
|
+
*
|
|
651
|
+
* **Orphan GC.** `orphanGC: "remove"` deletes an entity from `entities` after
|
|
652
|
+
* an `unlink` that empties its adjacency on both sides. Default `"keep"`.
|
|
653
|
+
*
|
|
654
|
+
* **No imperative reads.** Use `relatedNode(id, relation?)` for reactive reads.
|
|
655
|
+
*
|
|
656
|
+
* @category memory
|
|
657
|
+
*/
|
|
658
|
+
declare function knowledgeGraph<TEntity, TRelation extends string = string>(name: string, opts?: KnowledgeGraphOptions): KnowledgeGraph<TEntity, TRelation>;
|
|
659
|
+
|
|
660
|
+
export { type AdmissionFilter, type CascadeEvent, type CascadeOverflow, type CascadeReason, type CollectionAuditRecord, type CollectionEntry, type CollectionGraph, type CollectionOptions, type CollectionScoreFn, type DecayPolicy, type DependentsIndex, type FactId, type FactStore, type FactStoreAuditRecord, type HnswAdapter, type KnowledgeEdge, type KnowledgeGraph, type KnowledgeGraphAuditRecord, type KnowledgeGraphOptions, type MemoryAnswer, type MemoryFragment, type MemoryQuery, NodeOrValue, type OutcomeSignal, type RankedCollectionEntry, type ReactiveFactStoreConfig, type ReactiveFactStoreGraph, type ReviewRequest, type ScoringPolicy, type ShardKey, type StoreReadHandle, type VectorBackend, type VectorIndexAuditRecord, type VectorIndexGraph, type VectorIndexOptions, type VectorRecord, type VectorSearchResult, collection, cosineSimilarity, knowledgeGraph, reactiveFactStore, vectorIndex };
|