@fgv/ts-agent-memory 5.1.0-47 → 5.1.0-49
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/dist/packlets/ingest/orchestrator.js +11 -1
- package/dist/packlets/ingest/orchestrator.js.map +1 -1
- package/dist/packlets/observe/memoryObservationStore.js +6 -0
- package/dist/packlets/observe/memoryObservationStore.js.map +1 -1
- package/dist/packlets/observe/observer.js.map +1 -1
- package/dist/packlets/retrieve/linkTraversalRetriever.js +1 -1
- package/dist/packlets/retrieve/linkTraversalRetriever.js.map +1 -1
- package/dist/packlets/retrieve/recencyRetriever.js +1 -1
- package/dist/packlets/retrieve/recencyRetriever.js.map +1 -1
- package/dist/packlets/retrieve/retriever.js +11 -5
- package/dist/packlets/retrieve/retriever.js.map +1 -1
- package/dist/packlets/retrieve/structuredFilterRetriever.js +27 -5
- package/dist/packlets/retrieve/structuredFilterRetriever.js.map +1 -1
- package/dist/packlets/retrieve/tagRetriever.js +1 -1
- package/dist/packlets/retrieve/tagRetriever.js.map +1 -1
- package/dist/packlets/retrieve/temporalRetrievers.js +1 -1
- package/dist/packlets/retrieve/temporalRetrievers.js.map +1 -1
- package/dist/packlets/store/fileTreeMemoryStore.js +152 -132
- package/dist/packlets/store/fileTreeMemoryStore.js.map +1 -1
- package/dist/packlets/store/vectorMaintenance.js +251 -0
- package/dist/packlets/store/vectorMaintenance.js.map +1 -0
- package/dist/packlets/types/envelope.js.map +1 -1
- package/dist/packlets/vector/inMemoryCosineIndex.js +81 -18
- package/dist/packlets/vector/inMemoryCosineIndex.js.map +1 -1
- package/dist/packlets/vector/inMemoryFragmentCosineIndex.js +7 -0
- package/dist/packlets/vector/inMemoryFragmentCosineIndex.js.map +1 -1
- package/dist/packlets/vector/vectorIndex.js.map +1 -1
- package/dist/ts-agent-memory.d.ts +431 -79
- package/lib/packlets/ingest/orchestrator.d.ts.map +1 -1
- package/lib/packlets/ingest/orchestrator.js +11 -1
- package/lib/packlets/ingest/orchestrator.js.map +1 -1
- package/lib/packlets/observe/memoryObservationStore.d.ts.map +1 -1
- package/lib/packlets/observe/memoryObservationStore.js +6 -0
- package/lib/packlets/observe/memoryObservationStore.js.map +1 -1
- package/lib/packlets/observe/observer.d.ts +61 -0
- package/lib/packlets/observe/observer.d.ts.map +1 -1
- package/lib/packlets/observe/observer.js.map +1 -1
- package/lib/packlets/retrieve/linkTraversalRetriever.d.ts +1 -1
- package/lib/packlets/retrieve/linkTraversalRetriever.js +1 -1
- package/lib/packlets/retrieve/linkTraversalRetriever.js.map +1 -1
- package/lib/packlets/retrieve/recencyRetriever.d.ts +1 -1
- package/lib/packlets/retrieve/recencyRetriever.js +1 -1
- package/lib/packlets/retrieve/recencyRetriever.js.map +1 -1
- package/lib/packlets/retrieve/retriever.d.ts +26 -7
- package/lib/packlets/retrieve/retriever.d.ts.map +1 -1
- package/lib/packlets/retrieve/retriever.js +11 -5
- package/lib/packlets/retrieve/retriever.js.map +1 -1
- package/lib/packlets/retrieve/structuredFilterRetriever.d.ts +26 -4
- package/lib/packlets/retrieve/structuredFilterRetriever.d.ts.map +1 -1
- package/lib/packlets/retrieve/structuredFilterRetriever.js +27 -5
- package/lib/packlets/retrieve/structuredFilterRetriever.js.map +1 -1
- package/lib/packlets/retrieve/tagRetriever.d.ts +1 -1
- package/lib/packlets/retrieve/tagRetriever.js +1 -1
- package/lib/packlets/retrieve/tagRetriever.js.map +1 -1
- package/lib/packlets/retrieve/temporalRetrievers.js +1 -1
- package/lib/packlets/retrieve/temporalRetrievers.js.map +1 -1
- package/lib/packlets/store/fileTreeMemoryStore.d.ts +135 -59
- package/lib/packlets/store/fileTreeMemoryStore.d.ts.map +1 -1
- package/lib/packlets/store/fileTreeMemoryStore.js +151 -131
- package/lib/packlets/store/fileTreeMemoryStore.js.map +1 -1
- package/lib/packlets/store/vectorMaintenance.d.ts +149 -0
- package/lib/packlets/store/vectorMaintenance.d.ts.map +1 -0
- package/lib/packlets/store/vectorMaintenance.js +255 -0
- package/lib/packlets/store/vectorMaintenance.js.map +1 -0
- package/lib/packlets/types/envelope.d.ts +11 -0
- package/lib/packlets/types/envelope.d.ts.map +1 -1
- package/lib/packlets/types/envelope.js.map +1 -1
- package/lib/packlets/vector/inMemoryCosineIndex.d.ts +30 -7
- package/lib/packlets/vector/inMemoryCosineIndex.d.ts.map +1 -1
- package/lib/packlets/vector/inMemoryCosineIndex.js +80 -17
- package/lib/packlets/vector/inMemoryCosineIndex.js.map +1 -1
- package/lib/packlets/vector/inMemoryFragmentCosineIndex.d.ts +7 -0
- package/lib/packlets/vector/inMemoryFragmentCosineIndex.d.ts.map +1 -1
- package/lib/packlets/vector/inMemoryFragmentCosineIndex.js +7 -0
- package/lib/packlets/vector/inMemoryFragmentCosineIndex.js.map +1 -1
- package/lib/packlets/vector/vectorIndex.d.ts +129 -1
- package/lib/packlets/vector/vectorIndex.d.ts.map +1 -1
- package/lib/packlets/vector/vectorIndex.js.map +1 -1
- package/package.json +17 -7
- package/.rush/temp/5667e36f1c0cc503a5c20a3ebff76e7b9a702d41.tar.log +0 -468
- package/.rush/temp/chunked-rush-logs/ts-agent-memory.build.chunks.jsonl +0 -9
- package/.rush/temp/operation/build/all.log +0 -9
- package/.rush/temp/operation/build/log-chunks.jsonl +0 -9
- package/.rush/temp/operation/build/state.json +0 -3
- package/.rush/temp/shrinkwrap-deps.json +0 -689
- package/config/api-extractor.json +0 -343
- package/config/jest.config.json +0 -14
- package/config/rig.json +0 -4
- package/dist/test/unit/converters/antagonistRoundTrip.test.js +0 -95
- package/dist/test/unit/converters/antagonistRoundTrip.test.js.map +0 -1
- package/dist/test/unit/converters/bodyConverterRegistry.test.js +0 -72
- package/dist/test/unit/converters/bodyConverterRegistry.test.js.map +0 -1
- package/dist/test/unit/converters/envelopeConverter.test.js +0 -313
- package/dist/test/unit/converters/envelopeConverter.test.js.map +0 -1
- package/dist/test/unit/index/memoryIndex.test.js +0 -214
- package/dist/test/unit/index/memoryIndex.test.js.map +0 -1
- package/dist/test/unit/ingest/antagonistCycleAndParity.test.js +0 -277
- package/dist/test/unit/ingest/antagonistCycleAndParity.test.js.map +0 -1
- package/dist/test/unit/ingest/cycleGuard.test.js +0 -81
- package/dist/test/unit/ingest/cycleGuard.test.js.map +0 -1
- package/dist/test/unit/ingest/dedupScope.test.js +0 -434
- package/dist/test/unit/ingest/dedupScope.test.js.map +0 -1
- package/dist/test/unit/ingest/orchestrator.test.js +0 -1058
- package/dist/test/unit/ingest/orchestrator.test.js.map +0 -1
- package/dist/test/unit/observe/memoryObservationStore.test.js +0 -118
- package/dist/test/unit/observe/memoryObservationStore.test.js.map +0 -1
- package/dist/test/unit/retrieve/fragmentSemanticRetriever.test.js +0 -116
- package/dist/test/unit/retrieve/fragmentSemanticRetriever.test.js.map +0 -1
- package/dist/test/unit/retrieve/linkTraversalRetriever.test.js +0 -257
- package/dist/test/unit/retrieve/linkTraversalRetriever.test.js.map +0 -1
- package/dist/test/unit/retrieve/retrievers.test.js +0 -768
- package/dist/test/unit/retrieve/retrievers.test.js.map +0 -1
- package/dist/test/unit/retrieve/temporalRetrievers.test.js +0 -182
- package/dist/test/unit/retrieve/temporalRetrievers.test.js.map +0 -1
- package/dist/test/unit/store/antagonistTemporalBoundary.test.js +0 -120
- package/dist/test/unit/store/antagonistTemporalBoundary.test.js.map +0 -1
- package/dist/test/unit/store/embedOnWrite.test.js +0 -317
- package/dist/test/unit/store/embedOnWrite.test.js.map +0 -1
- package/dist/test/unit/store/fileTreeMemoryStore.test.js +0 -778
- package/dist/test/unit/store/fileTreeMemoryStore.test.js.map +0 -1
- package/dist/test/unit/store/fragmentEmbedOnWrite.test.js +0 -255
- package/dist/test/unit/store/fragmentEmbedOnWrite.test.js.map +0 -1
- package/dist/test/unit/store/indexInjection.test.js +0 -432
- package/dist/test/unit/store/indexInjection.test.js.map +0 -1
- package/dist/test/unit/store/lenientOpen.test.js +0 -248
- package/dist/test/unit/store/lenientOpen.test.js.map +0 -1
- package/dist/test/unit/store/listScoped.test.js +0 -109
- package/dist/test/unit/store/listScoped.test.js.map +0 -1
- package/dist/test/unit/store/observations.test.js +0 -239
- package/dist/test/unit/store/observations.test.js.map +0 -1
- package/dist/test/unit/store/rankAxis.test.js +0 -254
- package/dist/test/unit/store/rankAxis.test.js.map +0 -1
- package/dist/test/unit/store/scopeEncoding.test.js +0 -24
- package/dist/test/unit/store/scopeEncoding.test.js.map +0 -1
- package/dist/test/unit/store/temporalStore.test.js +0 -398
- package/dist/test/unit/store/temporalStore.test.js.map +0 -1
- package/dist/test/unit/tools/memoryTools.test.js +0 -842
- package/dist/test/unit/tools/memoryTools.test.js.map +0 -1
- package/dist/test/unit/types/identityCodec.test.js +0 -187
- package/dist/test/unit/types/identityCodec.test.js.map +0 -1
- package/dist/test/unit/types/ids.test.js +0 -84
- package/dist/test/unit/types/ids.test.js.map +0 -1
- package/dist/test/unit/types/temporalCodec.test.js +0 -203
- package/dist/test/unit/types/temporalCodec.test.js.map +0 -1
- package/dist/test/unit/types/temporalPolicy.test.js +0 -83
- package/dist/test/unit/types/temporalPolicy.test.js.map +0 -1
- package/dist/test/unit/types/writePolicy.test.js +0 -331
- package/dist/test/unit/types/writePolicy.test.js.map +0 -1
- package/dist/test/unit/vector/fragmentConverters.test.js +0 -58
- package/dist/test/unit/vector/fragmentConverters.test.js.map +0 -1
- package/dist/test/unit/vector/inMemoryCosineIndex.test.js +0 -252
- package/dist/test/unit/vector/inMemoryCosineIndex.test.js.map +0 -1
- package/dist/test/unit/vector/inMemoryFragmentCosineIndex.test.js +0 -362
- package/dist/test/unit/vector/inMemoryFragmentCosineIndex.test.js.map +0 -1
- package/dist/test/unit/vector/vectorIndex.test.js +0 -51
- package/dist/test/unit/vector/vectorIndex.test.js.map +0 -1
- package/eslint.config.js +0 -15
- package/etc/ts-agent-memory.api.md +0 -940
- package/lib/test/unit/converters/antagonistRoundTrip.test.d.ts +0 -10
- package/lib/test/unit/converters/antagonistRoundTrip.test.d.ts.map +0 -1
- package/lib/test/unit/converters/antagonistRoundTrip.test.js +0 -97
- package/lib/test/unit/converters/antagonistRoundTrip.test.js.map +0 -1
- package/lib/test/unit/converters/bodyConverterRegistry.test.d.ts +0 -2
- package/lib/test/unit/converters/bodyConverterRegistry.test.d.ts.map +0 -1
- package/lib/test/unit/converters/bodyConverterRegistry.test.js +0 -74
- package/lib/test/unit/converters/bodyConverterRegistry.test.js.map +0 -1
- package/lib/test/unit/converters/envelopeConverter.test.d.ts +0 -2
- package/lib/test/unit/converters/envelopeConverter.test.d.ts.map +0 -1
- package/lib/test/unit/converters/envelopeConverter.test.js +0 -315
- package/lib/test/unit/converters/envelopeConverter.test.js.map +0 -1
- package/lib/test/unit/index/memoryIndex.test.d.ts +0 -2
- package/lib/test/unit/index/memoryIndex.test.d.ts.map +0 -1
- package/lib/test/unit/index/memoryIndex.test.js +0 -216
- package/lib/test/unit/index/memoryIndex.test.js.map +0 -1
- package/lib/test/unit/ingest/antagonistCycleAndParity.test.d.ts +0 -9
- package/lib/test/unit/ingest/antagonistCycleAndParity.test.d.ts.map +0 -1
- package/lib/test/unit/ingest/antagonistCycleAndParity.test.js +0 -279
- package/lib/test/unit/ingest/antagonistCycleAndParity.test.js.map +0 -1
- package/lib/test/unit/ingest/cycleGuard.test.d.ts +0 -2
- package/lib/test/unit/ingest/cycleGuard.test.d.ts.map +0 -1
- package/lib/test/unit/ingest/cycleGuard.test.js +0 -83
- package/lib/test/unit/ingest/cycleGuard.test.js.map +0 -1
- package/lib/test/unit/ingest/dedupScope.test.d.ts +0 -2
- package/lib/test/unit/ingest/dedupScope.test.d.ts.map +0 -1
- package/lib/test/unit/ingest/dedupScope.test.js +0 -436
- package/lib/test/unit/ingest/dedupScope.test.js.map +0 -1
- package/lib/test/unit/ingest/orchestrator.test.d.ts +0 -2
- package/lib/test/unit/ingest/orchestrator.test.d.ts.map +0 -1
- package/lib/test/unit/ingest/orchestrator.test.js +0 -1060
- package/lib/test/unit/ingest/orchestrator.test.js.map +0 -1
- package/lib/test/unit/observe/memoryObservationStore.test.d.ts +0 -2
- package/lib/test/unit/observe/memoryObservationStore.test.d.ts.map +0 -1
- package/lib/test/unit/observe/memoryObservationStore.test.js +0 -120
- package/lib/test/unit/observe/memoryObservationStore.test.js.map +0 -1
- package/lib/test/unit/retrieve/fragmentSemanticRetriever.test.d.ts +0 -2
- package/lib/test/unit/retrieve/fragmentSemanticRetriever.test.d.ts.map +0 -1
- package/lib/test/unit/retrieve/fragmentSemanticRetriever.test.js +0 -118
- package/lib/test/unit/retrieve/fragmentSemanticRetriever.test.js.map +0 -1
- package/lib/test/unit/retrieve/linkTraversalRetriever.test.d.ts +0 -2
- package/lib/test/unit/retrieve/linkTraversalRetriever.test.d.ts.map +0 -1
- package/lib/test/unit/retrieve/linkTraversalRetriever.test.js +0 -259
- package/lib/test/unit/retrieve/linkTraversalRetriever.test.js.map +0 -1
- package/lib/test/unit/retrieve/retrievers.test.d.ts +0 -2
- package/lib/test/unit/retrieve/retrievers.test.d.ts.map +0 -1
- package/lib/test/unit/retrieve/retrievers.test.js +0 -770
- package/lib/test/unit/retrieve/retrievers.test.js.map +0 -1
- package/lib/test/unit/retrieve/temporalRetrievers.test.d.ts +0 -2
- package/lib/test/unit/retrieve/temporalRetrievers.test.d.ts.map +0 -1
- package/lib/test/unit/retrieve/temporalRetrievers.test.js +0 -184
- package/lib/test/unit/retrieve/temporalRetrievers.test.js.map +0 -1
- package/lib/test/unit/store/antagonistTemporalBoundary.test.d.ts +0 -9
- package/lib/test/unit/store/antagonistTemporalBoundary.test.d.ts.map +0 -1
- package/lib/test/unit/store/antagonistTemporalBoundary.test.js +0 -122
- package/lib/test/unit/store/antagonistTemporalBoundary.test.js.map +0 -1
- package/lib/test/unit/store/embedOnWrite.test.d.ts +0 -2
- package/lib/test/unit/store/embedOnWrite.test.d.ts.map +0 -1
- package/lib/test/unit/store/embedOnWrite.test.js +0 -319
- package/lib/test/unit/store/embedOnWrite.test.js.map +0 -1
- package/lib/test/unit/store/fileTreeMemoryStore.test.d.ts +0 -2
- package/lib/test/unit/store/fileTreeMemoryStore.test.d.ts.map +0 -1
- package/lib/test/unit/store/fileTreeMemoryStore.test.js +0 -780
- package/lib/test/unit/store/fileTreeMemoryStore.test.js.map +0 -1
- package/lib/test/unit/store/fragmentEmbedOnWrite.test.d.ts +0 -2
- package/lib/test/unit/store/fragmentEmbedOnWrite.test.d.ts.map +0 -1
- package/lib/test/unit/store/fragmentEmbedOnWrite.test.js +0 -257
- package/lib/test/unit/store/fragmentEmbedOnWrite.test.js.map +0 -1
- package/lib/test/unit/store/indexInjection.test.d.ts +0 -2
- package/lib/test/unit/store/indexInjection.test.d.ts.map +0 -1
- package/lib/test/unit/store/indexInjection.test.js +0 -434
- package/lib/test/unit/store/indexInjection.test.js.map +0 -1
- package/lib/test/unit/store/lenientOpen.test.d.ts +0 -2
- package/lib/test/unit/store/lenientOpen.test.d.ts.map +0 -1
- package/lib/test/unit/store/lenientOpen.test.js +0 -250
- package/lib/test/unit/store/lenientOpen.test.js.map +0 -1
- package/lib/test/unit/store/listScoped.test.d.ts +0 -2
- package/lib/test/unit/store/listScoped.test.d.ts.map +0 -1
- package/lib/test/unit/store/listScoped.test.js +0 -111
- package/lib/test/unit/store/listScoped.test.js.map +0 -1
- package/lib/test/unit/store/observations.test.d.ts +0 -2
- package/lib/test/unit/store/observations.test.d.ts.map +0 -1
- package/lib/test/unit/store/observations.test.js +0 -241
- package/lib/test/unit/store/observations.test.js.map +0 -1
- package/lib/test/unit/store/rankAxis.test.d.ts +0 -2
- package/lib/test/unit/store/rankAxis.test.d.ts.map +0 -1
- package/lib/test/unit/store/rankAxis.test.js +0 -256
- package/lib/test/unit/store/rankAxis.test.js.map +0 -1
- package/lib/test/unit/store/scopeEncoding.test.d.ts +0 -2
- package/lib/test/unit/store/scopeEncoding.test.d.ts.map +0 -1
- package/lib/test/unit/store/scopeEncoding.test.js +0 -26
- package/lib/test/unit/store/scopeEncoding.test.js.map +0 -1
- package/lib/test/unit/store/temporalStore.test.d.ts +0 -2
- package/lib/test/unit/store/temporalStore.test.d.ts.map +0 -1
- package/lib/test/unit/store/temporalStore.test.js +0 -400
- package/lib/test/unit/store/temporalStore.test.js.map +0 -1
- package/lib/test/unit/tools/memoryTools.test.d.ts +0 -2
- package/lib/test/unit/tools/memoryTools.test.d.ts.map +0 -1
- package/lib/test/unit/tools/memoryTools.test.js +0 -844
- package/lib/test/unit/tools/memoryTools.test.js.map +0 -1
- package/lib/test/unit/types/identityCodec.test.d.ts +0 -2
- package/lib/test/unit/types/identityCodec.test.d.ts.map +0 -1
- package/lib/test/unit/types/identityCodec.test.js +0 -189
- package/lib/test/unit/types/identityCodec.test.js.map +0 -1
- package/lib/test/unit/types/ids.test.d.ts +0 -2
- package/lib/test/unit/types/ids.test.d.ts.map +0 -1
- package/lib/test/unit/types/ids.test.js +0 -86
- package/lib/test/unit/types/ids.test.js.map +0 -1
- package/lib/test/unit/types/temporalCodec.test.d.ts +0 -2
- package/lib/test/unit/types/temporalCodec.test.d.ts.map +0 -1
- package/lib/test/unit/types/temporalCodec.test.js +0 -205
- package/lib/test/unit/types/temporalCodec.test.js.map +0 -1
- package/lib/test/unit/types/temporalPolicy.test.d.ts +0 -2
- package/lib/test/unit/types/temporalPolicy.test.d.ts.map +0 -1
- package/lib/test/unit/types/temporalPolicy.test.js +0 -85
- package/lib/test/unit/types/temporalPolicy.test.js.map +0 -1
- package/lib/test/unit/types/writePolicy.test.d.ts +0 -2
- package/lib/test/unit/types/writePolicy.test.d.ts.map +0 -1
- package/lib/test/unit/types/writePolicy.test.js +0 -333
- package/lib/test/unit/types/writePolicy.test.js.map +0 -1
- package/lib/test/unit/vector/fragmentConverters.test.d.ts +0 -2
- package/lib/test/unit/vector/fragmentConverters.test.d.ts.map +0 -1
- package/lib/test/unit/vector/fragmentConverters.test.js +0 -60
- package/lib/test/unit/vector/fragmentConverters.test.js.map +0 -1
- package/lib/test/unit/vector/inMemoryCosineIndex.test.d.ts +0 -2
- package/lib/test/unit/vector/inMemoryCosineIndex.test.d.ts.map +0 -1
- package/lib/test/unit/vector/inMemoryCosineIndex.test.js +0 -254
- package/lib/test/unit/vector/inMemoryCosineIndex.test.js.map +0 -1
- package/lib/test/unit/vector/inMemoryFragmentCosineIndex.test.d.ts +0 -2
- package/lib/test/unit/vector/inMemoryFragmentCosineIndex.test.d.ts.map +0 -1
- package/lib/test/unit/vector/inMemoryFragmentCosineIndex.test.js +0 -364
- package/lib/test/unit/vector/inMemoryFragmentCosineIndex.test.js.map +0 -1
- package/lib/test/unit/vector/vectorIndex.test.d.ts +0 -2
- package/lib/test/unit/vector/vectorIndex.test.d.ts.map +0 -1
- package/lib/test/unit/vector/vectorIndex.test.js +0 -53
- package/lib/test/unit/vector/vectorIndex.test.js.map +0 -1
- package/rush-logs/ts-agent-memory.build.cache.log +0 -3
- package/rush-logs/ts-agent-memory.build.log +0 -9
- package/src/index.ts +0 -14
- package/src/packlets/converters/bodyConverterRegistry.ts +0 -105
- package/src/packlets/converters/envelopeConverter.ts +0 -233
- package/src/packlets/converters/index.ts +0 -7
- package/src/packlets/index/index.ts +0 -6
- package/src/packlets/index/memoryIndex.ts +0 -332
- package/src/packlets/ingest/cycleGuard.ts +0 -153
- package/src/packlets/ingest/hostStages.ts +0 -111
- package/src/packlets/ingest/index.ts +0 -9
- package/src/packlets/ingest/model.ts +0 -195
- package/src/packlets/ingest/orchestrator.ts +0 -968
- package/src/packlets/observe/index.ts +0 -7
- package/src/packlets/observe/memoryObservationStore.ts +0 -153
- package/src/packlets/observe/observer.ts +0 -119
- package/src/packlets/retrieve/fragmentSemanticRetriever.ts +0 -138
- package/src/packlets/retrieve/hybridRetriever.ts +0 -194
- package/src/packlets/retrieve/index.ts +0 -14
- package/src/packlets/retrieve/linkTraversalRetriever.ts +0 -158
- package/src/packlets/retrieve/recencyRetriever.ts +0 -54
- package/src/packlets/retrieve/retriever.ts +0 -291
- package/src/packlets/retrieve/semanticRetriever.ts +0 -152
- package/src/packlets/retrieve/structuredFilterRetriever.ts +0 -58
- package/src/packlets/retrieve/tagRetriever.ts +0 -58
- package/src/packlets/retrieve/temporalRetrievers.ts +0 -210
- package/src/packlets/store/fileTreeMemoryStore.ts +0 -1872
- package/src/packlets/store/index.ts +0 -7
- package/src/packlets/store/scopeEncoding.ts +0 -36
- package/src/packlets/tools/index.ts +0 -6
- package/src/packlets/tools/memoryTools.ts +0 -706
- package/src/packlets/types/envelope.ts +0 -196
- package/src/packlets/types/filenameSafety.ts +0 -57
- package/src/packlets/types/identityCodec.ts +0 -447
- package/src/packlets/types/ids.ts +0 -124
- package/src/packlets/types/index.ts +0 -11
- package/src/packlets/types/temporal.ts +0 -96
- package/src/packlets/types/writePolicy.ts +0 -612
- package/src/packlets/vector/fragmentConverters.ts +0 -55
- package/src/packlets/vector/inMemoryCosineIndex.ts +0 -196
- package/src/packlets/vector/inMemoryFragmentCosineIndex.ts +0 -289
- package/src/packlets/vector/index.ts +0 -9
- package/src/packlets/vector/vectorIndex.ts +0 -273
- package/src/test/unit/converters/antagonistRoundTrip.test.ts +0 -110
- package/src/test/unit/converters/bodyConverterRegistry.test.ts +0 -89
- package/src/test/unit/converters/envelopeConverter.test.ts +0 -418
- package/src/test/unit/index/memoryIndex.test.ts +0 -272
- package/src/test/unit/ingest/antagonistCycleAndParity.test.ts +0 -367
- package/src/test/unit/ingest/cycleGuard.test.ts +0 -110
- package/src/test/unit/ingest/dedupScope.test.ts +0 -542
- package/src/test/unit/ingest/orchestrator.test.ts +0 -1355
- package/src/test/unit/observe/memoryObservationStore.test.ts +0 -158
- package/src/test/unit/retrieve/fragmentSemanticRetriever.test.ts +0 -163
- package/src/test/unit/retrieve/linkTraversalRetriever.test.ts +0 -329
- package/src/test/unit/retrieve/retrievers.test.ts +0 -1018
- package/src/test/unit/retrieve/temporalRetrievers.test.ts +0 -226
- package/src/test/unit/store/antagonistTemporalBoundary.test.ts +0 -158
- package/src/test/unit/store/embedOnWrite.test.ts +0 -418
- package/src/test/unit/store/fileTreeMemoryStore.test.ts +0 -1041
- package/src/test/unit/store/fragmentEmbedOnWrite.test.ts +0 -349
- package/src/test/unit/store/indexInjection.test.ts +0 -550
- package/src/test/unit/store/lenientOpen.test.ts +0 -292
- package/src/test/unit/store/listScoped.test.ts +0 -138
- package/src/test/unit/store/observations.test.ts +0 -290
- package/src/test/unit/store/rankAxis.test.ts +0 -349
- package/src/test/unit/store/scopeEncoding.test.ts +0 -37
- package/src/test/unit/store/temporalStore.test.ts +0 -469
- package/src/test/unit/tools/memoryTools.test.ts +0 -1121
- package/src/test/unit/types/identityCodec.test.ts +0 -266
- package/src/test/unit/types/ids.test.ts +0 -94
- package/src/test/unit/types/temporalCodec.test.ts +0 -259
- package/src/test/unit/types/temporalPolicy.test.ts +0 -124
- package/src/test/unit/types/writePolicy.test.ts +0 -446
- package/src/test/unit/vector/fragmentConverters.test.ts +0 -80
- package/src/test/unit/vector/inMemoryCosineIndex.test.ts +0 -318
- package/src/test/unit/vector/inMemoryFragmentCosineIndex.test.ts +0 -477
- package/src/test/unit/vector/vectorIndex.test.ts +0 -64
- package/temp/build/lint/_eslint-5eVG3S6w.json +0 -306
- package/temp/build/typescript/ts_8nwakTlr.json +0 -1
- package/temp/ts-agent-memory.api.json +0 -21030
- package/temp/ts-agent-memory.api.md +0 -940
- package/tsconfig.json +0 -8
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2026 Erik Fortune
|
|
3
|
-
* SPDX-License-Identifier: MIT
|
|
4
|
-
*/
|
|
5
|
-
import '@fgv/ts-utils-jest';
|
|
6
|
-
import { LinkTraversalRetriever, LINK_TRAVERSAL_NO_SEED_MESSAGE, LINK_TRAVERSAL_UNWIRED_MESSAGE, MemoryIndex, envelopeConverter } from '../../../index';
|
|
7
|
-
const DEFAULT_SCOPE = 'experience';
|
|
8
|
-
/** A scope-qualified traversal seed (defaults to the fixture's default scope). */
|
|
9
|
-
function seed(id, scope = DEFAULT_SCOPE) {
|
|
10
|
-
return { scope: scope, id: id };
|
|
11
|
-
}
|
|
12
|
-
function makeEntry(spec) {
|
|
13
|
-
var _a, _b, _c, _d, _e, _f;
|
|
14
|
-
const scope = (_a = spec.scope) !== null && _a !== void 0 ? _a : DEFAULT_SCOPE;
|
|
15
|
-
const record = {
|
|
16
|
-
envelope: envelopeConverter
|
|
17
|
-
.convert(Object.assign(Object.assign({ id: spec.id, entityId: spec.id, kind: (_b = spec.kind) !== null && _b !== void 0 ? _b : 'experience', tags: (_c = spec.tags) !== null && _c !== void 0 ? _c : [],
|
|
18
|
-
// A bare link id defaults its target scope to the source record's own
|
|
19
|
-
// scope (the same-conversation case); an object carries an explicit scope.
|
|
20
|
-
links: ((_d = spec.links) !== null && _d !== void 0 ? _d : []).map((l) => typeof l === 'string'
|
|
21
|
-
? { type: 'rel', target: { scope, id: l } }
|
|
22
|
-
: { type: 'rel', target: { scope: l.scope, id: l.id } }), created: 0, updated: (_e = spec.updated) !== null && _e !== void 0 ? _e : 0, seq: (_f = spec.seq) !== null && _f !== void 0 ? _f : 0, contentHash: 'h' }, (spec.rank !== undefined ? { rank: spec.rank } : {})), { provenance: { source: 'agent' } }))
|
|
23
|
-
.orThrow(),
|
|
24
|
-
body: `body-${spec.id}`
|
|
25
|
-
};
|
|
26
|
-
return { scope: scope, record };
|
|
27
|
-
}
|
|
28
|
-
function buildIndex(specs) {
|
|
29
|
-
const index = MemoryIndex.create().orThrow();
|
|
30
|
-
index.rebuild(specs.map(makeEntry)).orThrow();
|
|
31
|
-
return index;
|
|
32
|
-
}
|
|
33
|
-
function ids(records) {
|
|
34
|
-
return records.map((r) => r.envelope.id);
|
|
35
|
-
}
|
|
36
|
-
describe('LinkTraversalRetriever', () => {
|
|
37
|
-
test('reports the link-traversal capability', () => {
|
|
38
|
-
const index = buildIndex([]);
|
|
39
|
-
const retriever = LinkTraversalRetriever.create(index).orThrow();
|
|
40
|
-
expect(retriever.capabilities).toEqual({
|
|
41
|
-
supportsSemanticRecall: false,
|
|
42
|
-
supportsTemporalQuery: false,
|
|
43
|
-
supportsLinkTraversal: true
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
describe('outbound traversal (linkedFrom)', () => {
|
|
47
|
-
test('returns the direct outbound neighbors at the default single hop', async () => {
|
|
48
|
-
const index = buildIndex([
|
|
49
|
-
{ id: 'a', links: ['b', 'c'] },
|
|
50
|
-
{ id: 'b', updated: 20 },
|
|
51
|
-
{ id: 'c', updated: 10 }
|
|
52
|
-
]);
|
|
53
|
-
const retriever = LinkTraversalRetriever.create(index).orThrow();
|
|
54
|
-
expect(await retriever.retrieve({ linkedFrom: seed('a') })).toSucceedAndSatisfy((records) => {
|
|
55
|
-
// Recency-ordered: b (updated 20) before c (updated 10). 'a' (the seed) excluded.
|
|
56
|
-
expect(ids(records)).toEqual(['b', 'c']);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
test('stops at the default single hop (does not reach 2-hop neighbors)', async () => {
|
|
60
|
-
const index = buildIndex([{ id: 'a', links: ['b'] }, { id: 'b', links: ['c'] }, { id: 'c' }]);
|
|
61
|
-
const retriever = LinkTraversalRetriever.create(index).orThrow();
|
|
62
|
-
expect(await retriever.retrieve({ linkedFrom: seed('a') })).toSucceedAndSatisfy((records) => {
|
|
63
|
-
expect(ids(records)).toEqual(['b']);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
test('follows multiple hops when hops is raised', async () => {
|
|
67
|
-
const index = buildIndex([{ id: 'a', links: ['b'] }, { id: 'b', links: ['c'] }, { id: 'c' }]);
|
|
68
|
-
const retriever = LinkTraversalRetriever.create(index).orThrow();
|
|
69
|
-
expect(await retriever.retrieve({ linkedFrom: seed('a'), hops: 2 })).toSucceedAndSatisfy((records) => {
|
|
70
|
-
expect(ids(records).sort()).toEqual(['b', 'c']);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
describe('orderBy axis', () => {
|
|
75
|
-
function seedIndex() {
|
|
76
|
-
// Seed 'a' links to three ranked neighbors. `rank` and `updated` are
|
|
77
|
-
// deliberately INVERTED so the rank order (n3,n2,n1) is the exact reverse of
|
|
78
|
-
// the recency order (n1,n2,n3) — proving orderBy actually re-sorts.
|
|
79
|
-
return buildIndex([
|
|
80
|
-
{ id: 'a', links: ['n1', 'n3', 'n2'] },
|
|
81
|
-
{ id: 'n1', rank: 1, updated: 300, seq: 1 },
|
|
82
|
-
{ id: 'n3', rank: 3, updated: 100, seq: 3 },
|
|
83
|
-
{ id: 'n2', rank: 2, updated: 200, seq: 2 }
|
|
84
|
-
]);
|
|
85
|
-
}
|
|
86
|
-
test("orderBy 'rank' orders reached records by rank descending", async () => {
|
|
87
|
-
const retriever = LinkTraversalRetriever.create(seedIndex()).orThrow();
|
|
88
|
-
expect(await retriever.retrieve({ linkedFrom: seed('a'), orderBy: 'rank' })).toSucceedAndSatisfy((records) => {
|
|
89
|
-
expect(ids(records)).toEqual(['n3', 'n2', 'n1']);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
test('orderBy absent is unchanged recency order', async () => {
|
|
93
|
-
const retriever = LinkTraversalRetriever.create(seedIndex()).orThrow();
|
|
94
|
-
expect(await retriever.retrieve({ linkedFrom: seed('a') })).toSucceedAndSatisfy((records) => {
|
|
95
|
-
// Recency: most-recently-updated first → n1(300), n2(200), n3(100).
|
|
96
|
-
expect(ids(records)).toEqual(['n1', 'n2', 'n3']);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
test("orderBy 'rank' composes with { limit, offset }", async () => {
|
|
100
|
-
const retriever = LinkTraversalRetriever.create(seedIndex()).orThrow();
|
|
101
|
-
expect(await retriever.retrieve({ linkedFrom: seed('a'), orderBy: 'rank', limit: 1, offset: 1 })).toSucceedAndSatisfy((records) => {
|
|
102
|
-
expect(ids(records)).toEqual(['n2']);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
describe('inbound traversal (linkedTo)', () => {
|
|
107
|
-
test('returns the records whose edges point at the seed (backlinks)', async () => {
|
|
108
|
-
const index = buildIndex([
|
|
109
|
-
{ id: 'a', links: ['target'], updated: 30 },
|
|
110
|
-
{ id: 'b', links: ['target'], updated: 10 },
|
|
111
|
-
{ id: 'target' }
|
|
112
|
-
]);
|
|
113
|
-
const retriever = LinkTraversalRetriever.create(index).orThrow();
|
|
114
|
-
expect(await retriever.retrieve({ linkedTo: seed('target') })).toSucceedAndSatisfy((records) => {
|
|
115
|
-
expect(ids(records)).toEqual(['a', 'b']);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
test('reaches ONLY the same-scope inbound source when a TARGET stem is reused across scopes', async () => {
|
|
119
|
-
// 'shared' exists in scope a and scope b; src-a@a links {a, shared} and
|
|
120
|
-
// src-b@b links {b, shared}. Seeding linkedTo {a, shared} must reach ONLY
|
|
121
|
-
// src-a — backlinks disambiguate on the target's (scope, id), not a bare id.
|
|
122
|
-
const index = buildIndex([
|
|
123
|
-
{ id: 'src-a', scope: 'a', links: ['shared'], tags: ['src-a'] },
|
|
124
|
-
{ id: 'src-b', scope: 'b', links: ['shared'], tags: ['src-b'] },
|
|
125
|
-
{ id: 'shared', scope: 'a' },
|
|
126
|
-
{ id: 'shared', scope: 'b' }
|
|
127
|
-
]);
|
|
128
|
-
const retriever = LinkTraversalRetriever.create(index).orThrow();
|
|
129
|
-
expect(await retriever.retrieve({ linkedTo: seed('shared', 'a') })).toSucceedAndSatisfy((records) => {
|
|
130
|
-
expect(records).toHaveLength(1);
|
|
131
|
-
expect(records[0].envelope.tags).toEqual(['src-a']);
|
|
132
|
-
});
|
|
133
|
-
// Symmetric: seeding the b-scope target reaches only src-b.
|
|
134
|
-
expect(await retriever.retrieve({ linkedTo: seed('shared', 'b') })).toSucceedAndSatisfy((records) => {
|
|
135
|
-
expect(records).toHaveLength(1);
|
|
136
|
-
expect(records[0].envelope.tags).toEqual(['src-b']);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
describe('cycle safety', () => {
|
|
141
|
-
test('terminates on a self-loop and excludes the seed', async () => {
|
|
142
|
-
const index = buildIndex([{ id: 'a', links: ['a'] }]);
|
|
143
|
-
const retriever = LinkTraversalRetriever.create(index).orThrow();
|
|
144
|
-
expect(await retriever.retrieve({ linkedFrom: seed('a'), hops: 5 })).toSucceedAndSatisfy((records) => {
|
|
145
|
-
expect(records).toHaveLength(0);
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
test('terminates on a multi-hop cycle without revisiting', async () => {
|
|
149
|
-
const index = buildIndex([
|
|
150
|
-
{ id: 'a', links: ['b'] },
|
|
151
|
-
{ id: 'b', links: ['c'] },
|
|
152
|
-
{ id: 'c', links: ['a'] }
|
|
153
|
-
]);
|
|
154
|
-
const retriever = LinkTraversalRetriever.create(index).orThrow();
|
|
155
|
-
expect(await retriever.retrieve({ linkedFrom: seed('a'), hops: 10 })).toSucceedAndSatisfy((records) => {
|
|
156
|
-
// a→b→c→a: reaches b and c, then the edge back to the seed is pruned.
|
|
157
|
-
expect(ids(records).sort()).toEqual(['b', 'c']);
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
test('traverses a cross-kind edge (experience derivedFrom a knowledge doc)', async () => {
|
|
162
|
-
const index = buildIndex([
|
|
163
|
-
{
|
|
164
|
-
id: 'turn-5',
|
|
165
|
-
scope: 'conversations/conv-1',
|
|
166
|
-
kind: 'summarized-turn',
|
|
167
|
-
links: [{ id: 'doc-1', scope: 'knowledge' }]
|
|
168
|
-
},
|
|
169
|
-
{ id: 'doc-1', scope: 'knowledge', kind: 'knowledge' }
|
|
170
|
-
]);
|
|
171
|
-
const retriever = LinkTraversalRetriever.create(index).orThrow();
|
|
172
|
-
expect(await retriever.retrieve({ linkedFrom: seed('turn-5', 'conversations/conv-1') })).toSucceedAndSatisfy((records) => {
|
|
173
|
-
expect(ids(records)).toEqual(['doc-1']);
|
|
174
|
-
expect(records[0].envelope.kind).toBe('knowledge');
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
describe('post-filtering and bounds', () => {
|
|
178
|
-
test('applies the kind pre-filter to the reached records', async () => {
|
|
179
|
-
const index = buildIndex([
|
|
180
|
-
{ id: 'a', links: ['b', 'c'] },
|
|
181
|
-
{ id: 'b', kind: 'keep' },
|
|
182
|
-
{ id: 'c', kind: 'drop' }
|
|
183
|
-
]);
|
|
184
|
-
const retriever = LinkTraversalRetriever.create(index).orThrow();
|
|
185
|
-
expect(await retriever.retrieve({ linkedFrom: seed('a'), kind: 'keep' })).toSucceedAndSatisfy((records) => {
|
|
186
|
-
expect(ids(records)).toEqual(['b']);
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
test('applies the limit after ordering', async () => {
|
|
190
|
-
const index = buildIndex([
|
|
191
|
-
{ id: 'a', links: ['b', 'c', 'd'] },
|
|
192
|
-
{ id: 'b', updated: 30 },
|
|
193
|
-
{ id: 'c', updated: 20 },
|
|
194
|
-
{ id: 'd', updated: 10 }
|
|
195
|
-
]);
|
|
196
|
-
const retriever = LinkTraversalRetriever.create(index).orThrow();
|
|
197
|
-
expect(await retriever.retrieve({ linkedFrom: seed('a'), limit: 2 })).toSucceedAndSatisfy((records) => {
|
|
198
|
-
expect(ids(records)).toEqual(['b', 'c']);
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
test('returns empty when the seed is not in the index', async () => {
|
|
202
|
-
const index = buildIndex([{ id: 'a', links: ['b'] }, { id: 'b' }]);
|
|
203
|
-
const retriever = LinkTraversalRetriever.create(index).orThrow();
|
|
204
|
-
expect(await retriever.retrieve({ linkedFrom: seed('missing') })).toSucceedWith([]);
|
|
205
|
-
});
|
|
206
|
-
test('reaches ONLY the same-scope target when an id is reused across scopes', async () => {
|
|
207
|
-
// 'seed' (scope a) links a bare 'dup' → the edge target is {scope a, id dup}.
|
|
208
|
-
// Two records share the stem 'dup' (scopes a and b); the scoped edge must
|
|
209
|
-
// reach ONLY dup@a, never dup@b — the whole point of scope-qualified targets.
|
|
210
|
-
const index = buildIndex([
|
|
211
|
-
{ id: 'seed', scope: 'a', links: ['dup'] },
|
|
212
|
-
{ id: 'dup', scope: 'a', tags: ['in-a'] },
|
|
213
|
-
{ id: 'dup', scope: 'b', tags: ['in-b'] }
|
|
214
|
-
]);
|
|
215
|
-
const retriever = LinkTraversalRetriever.create(index).orThrow();
|
|
216
|
-
expect(await retriever.retrieve({ linkedFrom: seed('seed', 'a') })).toSucceedAndSatisfy((records) => {
|
|
217
|
-
expect(records).toHaveLength(1);
|
|
218
|
-
expect(records[0].envelope.tags).toEqual(['in-a']);
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
test('an explicit cross-scope edge reaches the other scope', async () => {
|
|
222
|
-
// The same fixture, but the edge names dup@b explicitly → traversal follows
|
|
223
|
-
// it to the b-scope record, proving explicit scope is honored verbatim.
|
|
224
|
-
const index = buildIndex([
|
|
225
|
-
{ id: 'seed', scope: 'a', links: [{ id: 'dup', scope: 'b' }] },
|
|
226
|
-
{ id: 'dup', scope: 'a', tags: ['in-a'] },
|
|
227
|
-
{ id: 'dup', scope: 'b', tags: ['in-b'] }
|
|
228
|
-
]);
|
|
229
|
-
const retriever = LinkTraversalRetriever.create(index).orThrow();
|
|
230
|
-
expect(await retriever.retrieve({ linkedFrom: seed('seed', 'a') })).toSucceedAndSatisfy((records) => {
|
|
231
|
-
expect(records).toHaveLength(1);
|
|
232
|
-
expect(records[0].envelope.tags).toEqual(['in-b']);
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
describe('loud degradation', () => {
|
|
237
|
-
test('fails when no seed (linkedFrom / linkedTo) is supplied', async () => {
|
|
238
|
-
const index = buildIndex([{ id: 'a' }]);
|
|
239
|
-
const retriever = LinkTraversalRetriever.create(index).orThrow();
|
|
240
|
-
expect(await retriever.retrieve({ hops: 2 })).toFailWith(LINK_TRAVERSAL_NO_SEED_MESSAGE);
|
|
241
|
-
});
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
describe('LINK_TRAVERSAL_UNWIRED_MESSAGE constant', () => {
|
|
245
|
-
test('has the stable public message non-link retrievers use to degrade loudly', () => {
|
|
246
|
-
// The link-traversal retriever supports the axis, so it never emits this
|
|
247
|
-
// message; the constant is the shared one the non-link v1 retrievers raise
|
|
248
|
-
// (asserted here to keep the public string stable).
|
|
249
|
-
expect(LINK_TRAVERSAL_UNWIRED_MESSAGE).toMatch(/link traversal requires a backlink index/i);
|
|
250
|
-
});
|
|
251
|
-
test('a link query against the link-capable retriever still succeeds', async () => {
|
|
252
|
-
const index = buildIndex([{ id: 'a', links: ['b'] }, { id: 'b' }]);
|
|
253
|
-
const retriever = LinkTraversalRetriever.create(index).orThrow();
|
|
254
|
-
expect(await retriever.retrieve({ linkedFrom: seed('a') })).toSucceed();
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
//# sourceMappingURL=linkTraversalRetriever.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"linkTraversalRetriever.test.js","sourceRoot":"","sources":["../../../../src/test/unit/retrieve/linkTraversalRetriever.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAKL,sBAAsB,EACtB,8BAA8B,EAC9B,8BAA8B,EAE9B,WAAW,EAEX,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAExB,MAAM,aAAa,GAAW,YAAY,CAAC;AAgB3C,kFAAkF;AAClF,SAAS,IAAI,CAAC,EAAU,EAAE,QAAgB,aAAa;IACrD,OAAO,EAAE,KAAK,EAAE,KAAuB,EAAE,EAAE,EAAE,EAAc,EAAE,CAAC;AAChE,CAAC;AAED,SAAS,SAAS,CAAC,IAAgB;;IACjC,MAAM,KAAK,GAAW,MAAA,IAAI,CAAC,KAAK,mCAAI,aAAa,CAAC;IAClD,MAAM,MAAM,GAA2B;QACrC,QAAQ,EAAE,iBAAiB;aACxB,OAAO,+BACN,EAA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\n IMemoryRecord,\n Kind,\n LinkTraversalRetriever,\n LINK_TRAVERSAL_NO_SEED_MESSAGE,\n LINK_TRAVERSAL_UNWIRED_MESSAGE,\n MemoryId,\n MemoryIndex,\n MemoryScopeKey,\n envelopeConverter\n} from '../../../index';\n\nconst DEFAULT_SCOPE: string = 'experience';\n\n/** A link target authored either as a bare id (same-scope) or an explicit `(scope, id)`. */\ntype LinkSpec = string | { readonly id: string; readonly scope: string };\n\ninterface IEntrySpec {\n readonly id: string;\n readonly scope?: string;\n readonly kind?: string;\n readonly tags?: ReadonlyArray<string>;\n readonly updated?: number;\n readonly seq?: number;\n readonly links?: ReadonlyArray<LinkSpec>;\n readonly rank?: number;\n}\n\n/** A scope-qualified traversal seed (defaults to the fixture's default scope). */\nfunction seed(id: string, scope: string = DEFAULT_SCOPE): IEdgeTarget {\n return { scope: scope as MemoryScopeKey, id: id as MemoryId };\n}\n\nfunction makeEntry(spec: IEntrySpec): IIndexedMemoryRecord {\n const scope: string = spec.scope ?? DEFAULT_SCOPE;\n const record: IMemoryRecord<unknown> = {\n envelope: envelopeConverter\n .convert({\n id: spec.id,\n entityId: spec.id,\n kind: spec.kind ?? 'experience',\n tags: spec.tags ?? [],\n // A bare link id defaults its target scope to the source record's own\n // scope (the same-conversation case); an object carries an explicit scope.\n links: (spec.links ?? []).map((l) =>\n typeof l === 'string'\n ? { type: 'rel', target: { scope, id: l } }\n : { type: 'rel', target: { scope: l.scope, id: l.id } }\n ),\n created: 0,\n updated: spec.updated ?? 0,\n seq: spec.seq ?? 0,\n contentHash: 'h',\n ...(spec.rank !== undefined ? { rank: spec.rank } : {}),\n provenance: { source: 'agent' }\n })\n .orThrow(),\n body: `body-${spec.id}`\n };\n return { scope: scope as MemoryScopeKey, record };\n}\n\nfunction buildIndex(specs: ReadonlyArray<IEntrySpec>): MemoryIndex {\n const index = MemoryIndex.create().orThrow();\n index.rebuild(specs.map(makeEntry)).orThrow();\n return index;\n}\n\nfunction ids(records: ReadonlyArray<IMemoryRecord<unknown>>): string[] {\n return records.map((r) => r.envelope.id as string);\n}\n\ndescribe('LinkTraversalRetriever', () => {\n test('reports the link-traversal capability', () => {\n const index = buildIndex([]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(retriever.capabilities).toEqual({\n supportsSemanticRecall: false,\n supportsTemporalQuery: false,\n supportsLinkTraversal: true\n });\n });\n\n describe('outbound traversal (linkedFrom)', () => {\n test('returns the direct outbound neighbors at the default single hop', async () => {\n const index = buildIndex([\n { id: 'a', links: ['b', 'c'] },\n { id: 'b', updated: 20 },\n { id: 'c', updated: 10 }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a') })).toSucceedAndSatisfy((records) => {\n // Recency-ordered: b (updated 20) before c (updated 10). 'a' (the seed) excluded.\n expect(ids(records)).toEqual(['b', 'c']);\n });\n });\n\n test('stops at the default single hop (does not reach 2-hop neighbors)', async () => {\n const index = buildIndex([{ id: 'a', links: ['b'] }, { id: 'b', links: ['c'] }, { id: 'c' }]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a') })).toSucceedAndSatisfy((records) => {\n expect(ids(records)).toEqual(['b']);\n });\n });\n\n test('follows multiple hops when hops is raised', async () => {\n const index = buildIndex([{ id: 'a', links: ['b'] }, { id: 'b', links: ['c'] }, { id: 'c' }]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a'), hops: 2 })).toSucceedAndSatisfy((records) => {\n expect(ids(records).sort()).toEqual(['b', 'c']);\n });\n });\n });\n\n describe('orderBy axis', () => {\n function seedIndex(): MemoryIndex {\n // Seed 'a' links to three ranked neighbors. `rank` and `updated` are\n // deliberately INVERTED so the rank order (n3,n2,n1) is the exact reverse of\n // the recency order (n1,n2,n3) — proving orderBy actually re-sorts.\n return buildIndex([\n { id: 'a', links: ['n1', 'n3', 'n2'] },\n { id: 'n1', rank: 1, updated: 300, seq: 1 },\n { id: 'n3', rank: 3, updated: 100, seq: 3 },\n { id: 'n2', rank: 2, updated: 200, seq: 2 }\n ]);\n }\n\n test(\"orderBy 'rank' orders reached records by rank descending\", async () => {\n const retriever = LinkTraversalRetriever.create(seedIndex()).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a'), orderBy: 'rank' })).toSucceedAndSatisfy(\n (records) => {\n expect(ids(records)).toEqual(['n3', 'n2', 'n1']);\n }\n );\n });\n\n test('orderBy absent is unchanged recency order', async () => {\n const retriever = LinkTraversalRetriever.create(seedIndex()).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a') })).toSucceedAndSatisfy((records) => {\n // Recency: most-recently-updated first → n1(300), n2(200), n3(100).\n expect(ids(records)).toEqual(['n1', 'n2', 'n3']);\n });\n });\n\n test(\"orderBy 'rank' composes with { limit, offset }\", async () => {\n const retriever = LinkTraversalRetriever.create(seedIndex()).orThrow();\n expect(\n await retriever.retrieve({ linkedFrom: seed('a'), orderBy: 'rank', limit: 1, offset: 1 })\n ).toSucceedAndSatisfy((records) => {\n expect(ids(records)).toEqual(['n2']);\n });\n });\n });\n\n describe('inbound traversal (linkedTo)', () => {\n test('returns the records whose edges point at the seed (backlinks)', async () => {\n const index = buildIndex([\n { id: 'a', links: ['target'], updated: 30 },\n { id: 'b', links: ['target'], updated: 10 },\n { id: 'target' }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedTo: seed('target') })).toSucceedAndSatisfy((records) => {\n expect(ids(records)).toEqual(['a', 'b']);\n });\n });\n\n test('reaches ONLY the same-scope inbound source when a TARGET stem is reused across scopes', async () => {\n // 'shared' exists in scope a and scope b; src-a@a links {a, shared} and\n // src-b@b links {b, shared}. Seeding linkedTo {a, shared} must reach ONLY\n // src-a — backlinks disambiguate on the target's (scope, id), not a bare id.\n const index = buildIndex([\n { id: 'src-a', scope: 'a', links: ['shared'], tags: ['src-a'] },\n { id: 'src-b', scope: 'b', links: ['shared'], tags: ['src-b'] },\n { id: 'shared', scope: 'a' },\n { id: 'shared', scope: 'b' }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedTo: seed('shared', 'a') })).toSucceedAndSatisfy((records) => {\n expect(records).toHaveLength(1);\n expect(records[0].envelope.tags).toEqual(['src-a']);\n });\n // Symmetric: seeding the b-scope target reaches only src-b.\n expect(await retriever.retrieve({ linkedTo: seed('shared', 'b') })).toSucceedAndSatisfy((records) => {\n expect(records).toHaveLength(1);\n expect(records[0].envelope.tags).toEqual(['src-b']);\n });\n });\n });\n\n describe('cycle safety', () => {\n test('terminates on a self-loop and excludes the seed', async () => {\n const index = buildIndex([{ id: 'a', links: ['a'] }]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a'), hops: 5 })).toSucceedAndSatisfy((records) => {\n expect(records).toHaveLength(0);\n });\n });\n\n test('terminates on a multi-hop cycle without revisiting', async () => {\n const index = buildIndex([\n { id: 'a', links: ['b'] },\n { id: 'b', links: ['c'] },\n { id: 'c', links: ['a'] }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a'), hops: 10 })).toSucceedAndSatisfy((records) => {\n // a→b→c→a: reaches b and c, then the edge back to the seed is pruned.\n expect(ids(records).sort()).toEqual(['b', 'c']);\n });\n });\n });\n\n test('traverses a cross-kind edge (experience derivedFrom a knowledge doc)', async () => {\n const index = buildIndex([\n {\n id: 'turn-5',\n scope: 'conversations/conv-1',\n kind: 'summarized-turn',\n links: [{ id: 'doc-1', scope: 'knowledge' }]\n },\n { id: 'doc-1', scope: 'knowledge', kind: 'knowledge' }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(\n await retriever.retrieve({ linkedFrom: seed('turn-5', 'conversations/conv-1') })\n ).toSucceedAndSatisfy((records) => {\n expect(ids(records)).toEqual(['doc-1']);\n expect(records[0].envelope.kind).toBe('knowledge');\n });\n });\n\n describe('post-filtering and bounds', () => {\n test('applies the kind pre-filter to the reached records', async () => {\n const index = buildIndex([\n { id: 'a', links: ['b', 'c'] },\n { id: 'b', kind: 'keep' },\n { id: 'c', kind: 'drop' }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(\n await retriever.retrieve({ linkedFrom: seed('a'), kind: 'keep' as unknown as Kind })\n ).toSucceedAndSatisfy((records) => {\n expect(ids(records)).toEqual(['b']);\n });\n });\n\n test('applies the limit after ordering', async () => {\n const index = buildIndex([\n { id: 'a', links: ['b', 'c', 'd'] },\n { id: 'b', updated: 30 },\n { id: 'c', updated: 20 },\n { id: 'd', updated: 10 }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a'), limit: 2 })).toSucceedAndSatisfy((records) => {\n expect(ids(records)).toEqual(['b', 'c']);\n });\n });\n\n test('returns empty when the seed is not in the index', async () => {\n const index = buildIndex([{ id: 'a', links: ['b'] }, { id: 'b' }]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('missing') })).toSucceedWith([]);\n });\n\n test('reaches ONLY the same-scope target when an id is reused across scopes', async () => {\n // 'seed' (scope a) links a bare 'dup' → the edge target is {scope a, id dup}.\n // Two records share the stem 'dup' (scopes a and b); the scoped edge must\n // reach ONLY dup@a, never dup@b — the whole point of scope-qualified targets.\n const index = buildIndex([\n { id: 'seed', scope: 'a', links: ['dup'] },\n { id: 'dup', scope: 'a', tags: ['in-a'] },\n { id: 'dup', scope: 'b', tags: ['in-b'] }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('seed', 'a') })).toSucceedAndSatisfy((records) => {\n expect(records).toHaveLength(1);\n expect(records[0].envelope.tags).toEqual(['in-a']);\n });\n });\n\n test('an explicit cross-scope edge reaches the other scope', async () => {\n // The same fixture, but the edge names dup@b explicitly → traversal follows\n // it to the b-scope record, proving explicit scope is honored verbatim.\n const index = buildIndex([\n { id: 'seed', scope: 'a', links: [{ id: 'dup', scope: 'b' }] },\n { id: 'dup', scope: 'a', tags: ['in-a'] },\n { id: 'dup', scope: 'b', tags: ['in-b'] }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('seed', 'a') })).toSucceedAndSatisfy((records) => {\n expect(records).toHaveLength(1);\n expect(records[0].envelope.tags).toEqual(['in-b']);\n });\n });\n });\n\n describe('loud degradation', () => {\n test('fails when no seed (linkedFrom / linkedTo) is supplied', async () => {\n const index = buildIndex([{ id: 'a' }]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ hops: 2 })).toFailWith(LINK_TRAVERSAL_NO_SEED_MESSAGE);\n });\n });\n});\n\ndescribe('LINK_TRAVERSAL_UNWIRED_MESSAGE constant', () => {\n test('has the stable public message non-link retrievers use to degrade loudly', () => {\n // The link-traversal retriever supports the axis, so it never emits this\n // message; the constant is the shared one the non-link v1 retrievers raise\n // (asserted here to keep the public string stable).\n expect(LINK_TRAVERSAL_UNWIRED_MESSAGE).toMatch(/link traversal requires a backlink index/i);\n });\n\n test('a link query against the link-capable retriever still succeeds', async () => {\n const index = buildIndex([{ id: 'a', links: ['b'] }, { id: 'b' }]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a') })).toSucceed();\n });\n});\n"]}
|