@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
|
@@ -329,6 +329,8 @@ export declare class FileTreeMemoryStore implements IMemoryStore {
|
|
|
329
329
|
private readonly _writePolicies;
|
|
330
330
|
private readonly _codecs;
|
|
331
331
|
private readonly _rankProjectors;
|
|
332
|
+
/** `undefined` = no declaration = every kind participates. */
|
|
333
|
+
private readonly _embedKinds;
|
|
332
334
|
private readonly _defaultCodec;
|
|
333
335
|
private readonly _defaultPolicy;
|
|
334
336
|
private readonly _scopeEncoding;
|
|
@@ -336,11 +338,9 @@ export declare class FileTreeMemoryStore implements IMemoryStore {
|
|
|
336
338
|
private readonly _index;
|
|
337
339
|
private readonly _hasher;
|
|
338
340
|
private readonly _observers;
|
|
341
|
+
/** Record- and fragment-vector maintenance; every operation is best-effort. */
|
|
342
|
+
private readonly _vectors;
|
|
339
343
|
private readonly _logger;
|
|
340
|
-
private readonly _vectorIndex;
|
|
341
|
-
private readonly _embed;
|
|
342
|
-
private readonly _fragmentIndex;
|
|
343
|
-
private readonly _fragmentEmbedder;
|
|
344
344
|
/**
|
|
345
345
|
* Records the initial walk could not load. Populated during `create()` in
|
|
346
346
|
* {@link MemoryRecordErrorMode | `'skip'` mode}; empty otherwise.
|
|
@@ -407,6 +407,8 @@ export declare class FileTreeMemoryStore implements IMemoryStore {
|
|
|
407
407
|
* contributes nothing.
|
|
408
408
|
*/
|
|
409
409
|
private static _projectAsOf;
|
|
410
|
+
/** {@inheritDoc IMemoryStore.reconcileRank} */
|
|
411
|
+
reconcileRank(kind: Kind): Promise<Result<number>>;
|
|
410
412
|
/** {@inheritDoc IMemoryStore.put} */
|
|
411
413
|
put(record: IMemoryRecord<unknown>): Promise<Result<IMemoryRecord<unknown>>>;
|
|
412
414
|
/** {@inheritDoc IMemoryStore.delete} */
|
|
@@ -457,39 +459,6 @@ export declare class FileTreeMemoryStore implements IMemoryStore {
|
|
|
457
459
|
* later eviction failure never loses data with nothing written in its place.
|
|
458
460
|
*/
|
|
459
461
|
private _admitWrite;
|
|
460
|
-
/**
|
|
461
|
-
* Best-effort embed-on-write. When a vector index AND an embedder are wired,
|
|
462
|
-
* embeds the built record, `add`s the vector (replace semantics handle a same-id
|
|
463
|
-
* re-embed — no explicit remove), and stamps the returned `embeddingRef`. A
|
|
464
|
-
* failure (returned `fail` OR a thrown/rejected hook) is logged and the
|
|
465
|
-
* unembedded record is returned unchanged — the put still persists, and the
|
|
466
|
-
* derived index is reconciled by a later `rebuild`. A pass-through no-op when
|
|
467
|
-
* unwired (byte-identical record).
|
|
468
|
-
*
|
|
469
|
-
* Always succeeds (`Result` is the chain's shape, never a vector-induced
|
|
470
|
-
* failure).
|
|
471
|
-
*/
|
|
472
|
-
private _embedOnWrite;
|
|
473
|
-
/**
|
|
474
|
-
* Best-effort fragment-embed-on-write. When a fragment index AND a fragment
|
|
475
|
-
* embedder are wired, chunks + embeds the built record and replaces its
|
|
476
|
-
* fragments in the index (`addFragments` is whole-record-replace, so a re-authored
|
|
477
|
-
* document never leaves stale fragments behind — no explicit remove needed). A
|
|
478
|
-
* failure (returned `fail` OR a thrown/rejected hook) is logged and the record is
|
|
479
|
-
* returned unchanged — the put still persists, and the fragment index is a derived
|
|
480
|
-
* view a later `rebuild` reconciles. Unlike {@link FileTreeMemoryStore._embedOnWrite}
|
|
481
|
-
* it stamps nothing on the record (fragments have no per-record `embeddingRef`
|
|
482
|
-
* analog). A pass-through no-op when unwired (byte-identical record).
|
|
483
|
-
*/
|
|
484
|
-
private _embedFragmentsOnWrite;
|
|
485
|
-
/**
|
|
486
|
-
* Best-effort fragment removal. A no-op unless the full fragment lifecycle is
|
|
487
|
-
* wired (both an index AND an embedder), so an unwired store does no fragment
|
|
488
|
-
* work and behaves byte-identically. Failures are logged, never surfaced — a
|
|
489
|
-
* committed delete/eviction must not fail because a derived fragment index could
|
|
490
|
-
* not be pruned.
|
|
491
|
-
*/
|
|
492
|
-
private _removeFragmentsBestEffort;
|
|
493
462
|
/**
|
|
494
463
|
* Evict the records named by a `cull-oldest` decision, best-effort. Runs only
|
|
495
464
|
* after the authoritative `_persist`, so a failed eviction is logged (never
|
|
@@ -498,26 +467,6 @@ export declare class FileTreeMemoryStore implements IMemoryStore {
|
|
|
498
467
|
* `accept` / `reject` decisions evict nothing.
|
|
499
468
|
*/
|
|
500
469
|
private _applyEvictions;
|
|
501
|
-
/**
|
|
502
|
-
* Best-effort vector removal for each evicted record (never fails the put).
|
|
503
|
-
* Every evicted record is in the same `scope` as the incoming write (the
|
|
504
|
-
* cull-oldest cohort is the incoming record's `(scope, kind)` cohort), so that
|
|
505
|
-
* scope qualifies each removal target.
|
|
506
|
-
*/
|
|
507
|
-
private _removeEvictedVectors;
|
|
508
|
-
/**
|
|
509
|
-
* Run a consumer-supplied vector hook, normalizing a thrown/rejected hook into a
|
|
510
|
-
* `Failure` and logging any failure at `warn`. Best-effort: the caller proceeds
|
|
511
|
-
* regardless, since the index is rebuildable.
|
|
512
|
-
*/
|
|
513
|
-
private _tryVectorOp;
|
|
514
|
-
/**
|
|
515
|
-
* Best-effort vector removal. A no-op unless the full vector lifecycle is wired
|
|
516
|
-
* (both an index AND an embedder), so an unwired store does no vector work and
|
|
517
|
-
* behaves byte-identically. Failures are logged, never surfaced — a committed
|
|
518
|
-
* delete/eviction must not fail because a derived index could not be pruned.
|
|
519
|
-
*/
|
|
520
|
-
private _removeVectorBestEffort;
|
|
521
470
|
/**
|
|
522
471
|
* Build the record to persist. On a first write the incoming envelope is the
|
|
523
472
|
* base (final content equals the incoming content, so the dedup `hash` is
|
|
@@ -634,6 +583,43 @@ export declare class FileTreeMemoryStore implements IMemoryStore {
|
|
|
634
583
|
*/
|
|
635
584
|
private _isMutableMetadataUnchanged;
|
|
636
585
|
private _contentHash;
|
|
586
|
+
/**
|
|
587
|
+
* The locked body of {@link FileTreeMemoryStore.reconcileRank}.
|
|
588
|
+
*
|
|
589
|
+
* @remarks
|
|
590
|
+
* Re-reads each record's file rather than trusting the in-memory index, for
|
|
591
|
+
* two reasons: the index holds converted bodies on some paths and raw ones on
|
|
592
|
+
* others, and re-serializing a *converted* body could change the bytes on disk
|
|
593
|
+
* — a reconcile of an ordering field has no business rewriting content.
|
|
594
|
+
* `splitFrontmatter` hands back the body text unconverted, so the round trip
|
|
595
|
+
* carries the authored characters through untouched and only the envelope
|
|
596
|
+
* moves. The parsed record is additionally put through `_verifyLoaded`, the
|
|
597
|
+
* same id-vs-filename and scope-derived-entityId check the load paths apply —
|
|
598
|
+
* without it, reconcile would be the one path that accepts and rewrites a file
|
|
599
|
+
* the store would refuse to load.
|
|
600
|
+
*
|
|
601
|
+
* "Untouched" is not quite "byte-identical", and the exception is line
|
|
602
|
+
* endings: `splitFrontmatter` strips a trailing `\r` per line and
|
|
603
|
+
* `joinFrontmatter` writes `\n` delimiters, so a CRLF-authored file comes back
|
|
604
|
+
* LF-normalized. That is **the store's behavior on every write path, not
|
|
605
|
+
* something reconcile introduces** — an ordinary `put` normalizes the same way
|
|
606
|
+
* — so reconcile does not rewrite content that a subsequent write would have
|
|
607
|
+
* left alone. The property being claimed here is the narrower and load-bearing
|
|
608
|
+
* one: no body is round-tripped through its registered Converter.
|
|
609
|
+
*
|
|
610
|
+
* The projector is fed an `IMemoryRecord<string>` carrying that raw body,
|
|
611
|
+
* which is exactly the shape {@link FileTreeMemoryStore._stampRank} hands it
|
|
612
|
+
* on the write path — so a projector cannot see one thing on a write and
|
|
613
|
+
* another on a reconcile. `_stampRank` itself is reused verbatim, which also
|
|
614
|
+
* inherits its throw semantics (logged at `warn`, `rank` cleared).
|
|
615
|
+
*/
|
|
616
|
+
private _reconcileRankLocked;
|
|
617
|
+
/**
|
|
618
|
+
* Re-apply the rank projector to one record on disk. Returns whether `rank`
|
|
619
|
+
* actually changed — an unchanged rank writes nothing, so a reconcile over an
|
|
620
|
+
* already-consistent store touches no files.
|
|
621
|
+
*/
|
|
622
|
+
private _restampOne;
|
|
637
623
|
/**
|
|
638
624
|
* Stamp the store-computed {@link IMemoryEnvelope.rank} onto a fully-built,
|
|
639
625
|
* fully-stamped record by running the kind's registered {@link RankProjector}.
|
|
@@ -651,6 +637,8 @@ export declare class FileTreeMemoryStore implements IMemoryStore {
|
|
|
651
637
|
private _policyFor;
|
|
652
638
|
/** {@inheritDoc IMemoryStore.dedupScopeFor} */
|
|
653
639
|
dedupScopeFor(kind: Kind): DedupScope;
|
|
640
|
+
/** {@inheritDoc IMemoryStore.embedsKind} */
|
|
641
|
+
embedsKind(kind: Kind): boolean;
|
|
654
642
|
/**
|
|
655
643
|
* Read and validate the record at `<scope>/<idStem>.md`, returning `undefined`
|
|
656
644
|
* when the scope directory or file is absent. Verifies the on-disk id ↔
|
|
@@ -1174,6 +1162,37 @@ export declare interface IFileTreeMemoryStoreCreateParams {
|
|
|
1174
1162
|
* guard-host-callbacks conventions).
|
|
1175
1163
|
*/
|
|
1176
1164
|
readonly rankProjectors?: ReadonlyMap<Kind, RankProjector>;
|
|
1165
|
+
/**
|
|
1166
|
+
* The kinds whose records participate in the **record-granular** vector index.
|
|
1167
|
+
*
|
|
1168
|
+
* @remarks
|
|
1169
|
+
* **Absent means every kind participates**, which is the pre-existing behavior —
|
|
1170
|
+
* so omitting this is byte-identical to before it existed. Supplying it makes the
|
|
1171
|
+
* set an allowlist: a kind outside it is never handed to the {@link MemoryEmbedder}
|
|
1172
|
+
* on write, and is omitted from {@link IMemoryStore.asRecordSource | asRecordSource},
|
|
1173
|
+
* so a rebuild driven from this store does not pay for it either.
|
|
1174
|
+
*
|
|
1175
|
+
* Two costs motivate it, and the second is the one that is easy to miss:
|
|
1176
|
+
*
|
|
1177
|
+
* - **Embedder work on the critical path.** Embed-on-write is synchronous with
|
|
1178
|
+
* the write. A bookkeeping row — a status, a counter, a lease — that no query
|
|
1179
|
+
* will ever return still pays a full embedding round trip, and on a
|
|
1180
|
+
* locally-hosted model the first call after a restart pays a cold model load
|
|
1181
|
+
* on top.
|
|
1182
|
+
* - **Un-queried kinds crowd the `topK` window.** `IVectorIndex.query` applies
|
|
1183
|
+
* `topK` *before* any kind filter the retriever adds, so vectors that can never
|
|
1184
|
+
* be returned still occupy candidate slots. Over-fetching to compensate hides
|
|
1185
|
+
* this until the un-queried kinds start scoring well — at which point recall is
|
|
1186
|
+
* silently lost. Restricting what is indexed fixes the recall problem, not just
|
|
1187
|
+
* the cost.
|
|
1188
|
+
*
|
|
1189
|
+
* Applies to the record-granular path only. The fragment path
|
|
1190
|
+
* ({@link IFileTreeMemoryStoreCreateParams.fragmentIndex | fragmentIndex} /
|
|
1191
|
+
* `fragmentEmbedder`) is independent and unaffected — a kind may legitimately be
|
|
1192
|
+
* fragment-embedded and not record-embedded, which is the right shape for a long
|
|
1193
|
+
* document whose whole body exceeds the model's context.
|
|
1194
|
+
*/
|
|
1195
|
+
readonly embedKinds?: ReadonlySet<Kind>;
|
|
1177
1196
|
/** Default codec for kinds without an explicit entry. */
|
|
1178
1197
|
readonly defaultCodec?: IIdentityCodec;
|
|
1179
1198
|
/**
|
|
@@ -1664,6 +1683,14 @@ export declare interface IMemoryEnvelope {
|
|
|
1664
1683
|
* Absent when the kind has no registered projector (or the projector threw on
|
|
1665
1684
|
* this record). Ordered retrieval (`orderBy: 'rank'`) and the index's rank view
|
|
1666
1685
|
* sort by this value descending, placing records with an absent `rank` last.
|
|
1686
|
+
*
|
|
1687
|
+
* **The projector runs on the write path only — registering one does not rank
|
|
1688
|
+
* records already in the store.** Because absent sorts last, those records land
|
|
1689
|
+
* below every subsequently-written one regardless of what the projector would
|
|
1690
|
+
* have scored them, so the result is not a partial ordering but one inverted
|
|
1691
|
+
* with respect to the projector's intent, with nothing failing to say so. Call
|
|
1692
|
+
* `IMemoryStore.reconcileRank` after registering a projector against a
|
|
1693
|
+
* populated store.
|
|
1667
1694
|
*/
|
|
1668
1695
|
readonly rank?: number;
|
|
1669
1696
|
/** Structured provenance (never a flat enum). */
|
|
@@ -1830,6 +1857,12 @@ export declare interface IMemoryObservationQuery {
|
|
|
1830
1857
|
readonly phase?: MemoryObservationPhase;
|
|
1831
1858
|
/** Only records with this outcome. */
|
|
1832
1859
|
readonly outcome?: MemoryObservationOutcome;
|
|
1860
|
+
/**
|
|
1861
|
+
* Only `'write'` records with this embed outcome. Records carrying no embed
|
|
1862
|
+
* outcome never match, so `embed: 'failed'` answers "which writes left the
|
|
1863
|
+
* index short?" without a full scan of every record's `embeddingRef`.
|
|
1864
|
+
*/
|
|
1865
|
+
readonly embed?: MemoryEmbedOutcome;
|
|
1833
1866
|
}
|
|
1834
1867
|
|
|
1835
1868
|
/**
|
|
@@ -1865,6 +1898,12 @@ export declare interface IMemoryObservationRecord {
|
|
|
1865
1898
|
readonly error?: string;
|
|
1866
1899
|
/** Structured provenance of the write, when the operation carried one. */
|
|
1867
1900
|
readonly provenance?: IProvenance;
|
|
1901
|
+
/**
|
|
1902
|
+
* For `'write'` observations: what the record-granular vector index did about
|
|
1903
|
+
* this record. Absent when the question does not apply — see
|
|
1904
|
+
* {@link MemoryEmbedOutcome}.
|
|
1905
|
+
*/
|
|
1906
|
+
readonly embed?: MemoryEmbedOutcome;
|
|
1868
1907
|
/**
|
|
1869
1908
|
* For `'retrieve'` observations: an opaque snapshot of the query that drove
|
|
1870
1909
|
* the retrieval. Carried verbatim; never interpreted by the store.
|
|
@@ -1924,6 +1963,23 @@ export declare interface IMemoryQuery {
|
|
|
1924
1963
|
readonly scope?: MemoryScopeKey;
|
|
1925
1964
|
/** Restrict to records carrying this tag (exact match). */
|
|
1926
1965
|
readonly tag?: Tag;
|
|
1966
|
+
/**
|
|
1967
|
+
* Restrict to records whose {@link IProvenance.source | provenance.source} is
|
|
1968
|
+
* exactly this value — the "show me everything this source produced" axis, for
|
|
1969
|
+
* review, attribution, and retraction after a bad ingest.
|
|
1970
|
+
*
|
|
1971
|
+
* @remarks
|
|
1972
|
+
* Exact match on `source` only, deliberately: not a subset match over the whole
|
|
1973
|
+
* {@link IProvenance} block, not a presence check, and not a match on `by` /
|
|
1974
|
+
* `model` / the consumer-owned extension keys. `source` is the only field of
|
|
1975
|
+
* that block the library assigns meaning to, and every record carries one
|
|
1976
|
+
* (`envelope.provenance` is required), so this axis is total — it partitions
|
|
1977
|
+
* the vault rather than filtering out records that merely omit a field.
|
|
1978
|
+
*
|
|
1979
|
+
* Applied in the shared pre-filter alongside `scope` / `kind` / `tag`, so every
|
|
1980
|
+
* retriever honours it and combining axes composes as AND.
|
|
1981
|
+
*/
|
|
1982
|
+
readonly provenanceSource?: ProvenanceSource;
|
|
1927
1983
|
/**
|
|
1928
1984
|
* Restrict to records of this kind — the single-kind shorthand for
|
|
1929
1985
|
* {@link IMemoryQuery.kinds | kinds}. When both are set they compose as AND
|
|
@@ -1984,7 +2040,7 @@ export declare interface IMemoryQuery {
|
|
|
1984
2040
|
* empty page, never a throw.
|
|
1985
2041
|
*/
|
|
1986
2042
|
readonly offset?: number;
|
|
1987
|
-
/** Arbitrary predicate applied after the scope / kind / tag pre-filter. */
|
|
2043
|
+
/** Arbitrary predicate applied after the scope / kind / tag / provenance-source pre-filter. */
|
|
1988
2044
|
readonly filter?: (record: IMemoryRecord<unknown>) => boolean;
|
|
1989
2045
|
}
|
|
1990
2046
|
|
|
@@ -2083,8 +2139,16 @@ export declare interface IMemoryStore {
|
|
|
2083
2139
|
/**
|
|
2084
2140
|
* Adapt this store to the {@link IMemoryRecordSource} seam so it can drive
|
|
2085
2141
|
* {@link IVectorIndex} rebuilds (e.g. `InMemoryCosineIndex.rebuild`). The
|
|
2086
|
-
* returned source's `list()` delegates to {@link IMemoryStore.listScoped}
|
|
2087
|
-
*
|
|
2142
|
+
* returned source's `list()` delegates to {@link IMemoryStore.listScoped},
|
|
2143
|
+
* **filtered to the kinds {@link IMemoryStore.embedsKind | embedsKind} reports** —
|
|
2144
|
+
* this source exists to feed the record vector index, so a kind excluded from
|
|
2145
|
+
* that index is excluded here too, and a reopen does not re-embed records the
|
|
2146
|
+
* index will never return. With no
|
|
2147
|
+
* {@link IFileTreeMemoryStoreCreateParams.embedKinds | embedKinds} declaration
|
|
2148
|
+
* every kind participates and the filter is the identity. `listScoped` itself is
|
|
2149
|
+
* **not** filtered and remains the whole-vault surface.
|
|
2150
|
+
*
|
|
2151
|
+
* The store cannot implement {@link IMemoryRecordSource} directly because its
|
|
2088
2152
|
* `list(filter?)` returns bare records (the ergonomic query surface) while the
|
|
2089
2153
|
* seam's `list()` returns scope-qualified records.
|
|
2090
2154
|
*/
|
|
@@ -2117,6 +2181,25 @@ export declare interface IMemoryStore {
|
|
|
2117
2181
|
* invoking admission or merge logic out of band.
|
|
2118
2182
|
*/
|
|
2119
2183
|
dedupScopeFor(kind: Kind): DedupScope;
|
|
2184
|
+
/**
|
|
2185
|
+
* Whether records of `kind` participate in the **record-granular** vector index.
|
|
2186
|
+
*
|
|
2187
|
+
* @remarks
|
|
2188
|
+
* A read accessor over the store's injected {@link IFileTreeMemoryStoreCreateParams.embedKinds | embedKinds}
|
|
2189
|
+
* declaration, in the same spirit as {@link IMemoryStore.dedupScopeFor} — one
|
|
2190
|
+
* place to ask, so the store's write path and any caller reasoning about index
|
|
2191
|
+
* coverage cannot disagree. `true` for every kind when no declaration was made.
|
|
2192
|
+
*
|
|
2193
|
+
* **This is distinct from a {@link MemoryEmbedder} decline, and the difference is
|
|
2194
|
+
* cost.** An embedder that returns `undefined` has already been called: the
|
|
2195
|
+
* round trip is paid, and on a locally-hosted model that round trip is the
|
|
2196
|
+
* expense. A kind excluded here is never handed to the embedder at all. The
|
|
2197
|
+
* decline makes the intent *expressible*; this makes it *free*.
|
|
2198
|
+
*
|
|
2199
|
+
* Deliberately synchronous, total, and NOT `Result`-returning: it reads
|
|
2200
|
+
* constructor-injected configuration, touches no I/O, and cannot fail.
|
|
2201
|
+
*/
|
|
2202
|
+
embedsKind(kind: Kind): boolean;
|
|
2120
2203
|
/**
|
|
2121
2204
|
* Write a record. Validates the body, computes a content hash, deduplicates
|
|
2122
2205
|
* (scope-wide, before policy), applies the kind's {@link IWritePolicy}, stamps
|
|
@@ -2125,6 +2208,36 @@ export declare interface IMemoryStore {
|
|
|
2125
2208
|
* existing record unchanged on a dedup no-op.
|
|
2126
2209
|
*/
|
|
2127
2210
|
put(record: IMemoryRecord<unknown>): Promise<Result<IMemoryRecord<unknown>>>;
|
|
2211
|
+
/**
|
|
2212
|
+
* Re-apply the kind's {@link RankProjector} to every record of `kind` already
|
|
2213
|
+
* in the store, restamping {@link IMemoryEnvelope.rank}. Returns the number of
|
|
2214
|
+
* records whose `rank` actually changed.
|
|
2215
|
+
*
|
|
2216
|
+
* @remarks
|
|
2217
|
+
* **This exists because `rank` is otherwise new-store-only, and fails in a way
|
|
2218
|
+
* that looks like it works.** The projector runs on the write path only, so
|
|
2219
|
+
* registering one against a populated store ranks nothing already written —
|
|
2220
|
+
* and because an absent `rank` sorts *last*, every pre-registration record
|
|
2221
|
+
* lands below every post-registration one no matter what the projector would
|
|
2222
|
+
* have scored it. The ordering is not merely partial; it is **inverted with
|
|
2223
|
+
* respect to the projector's own intent**, with no failure anywhere to say so.
|
|
2224
|
+
*
|
|
2225
|
+
* Deliberately **does not** touch `created` / `updated` / `seq`, and fires no
|
|
2226
|
+
* `'write'` observation. Routing a reconcile through {@link IMemoryStore.put}
|
|
2227
|
+
* would bump transaction time on every record — trading a wrong `rank` order
|
|
2228
|
+
* for a wrong recency order, and flooding any wired observer with writes that
|
|
2229
|
+
* are not writes. The body is re-serialized verbatim from the file's own
|
|
2230
|
+
* bytes; only the envelope's `rank` moves.
|
|
2231
|
+
*
|
|
2232
|
+
* Fails loudly if `kind` has no registered projector: asking to reconcile a
|
|
2233
|
+
* kind you never configured is a caller error, not a no-op.
|
|
2234
|
+
*
|
|
2235
|
+
* **Not atomic, and safe for it.** A failure part-way leaves earlier records
|
|
2236
|
+
* restamped. That is benign because restamping is idempotent — re-running
|
|
2237
|
+
* converges — which is also why no report shape is offered here. A count is
|
|
2238
|
+
* enough.
|
|
2239
|
+
*/
|
|
2240
|
+
reconcileRank(kind: Kind): Promise<Result<number>>;
|
|
2128
2241
|
/**
|
|
2129
2242
|
* Delete a record by `(kind, entityId)`. Non-temporal kinds physically delete
|
|
2130
2243
|
* the file and return the deleted record's {@link MemoryId}. Temporal
|
|
@@ -2204,9 +2317,10 @@ export declare interface IMergeStrategy {
|
|
|
2204
2317
|
}
|
|
2205
2318
|
|
|
2206
2319
|
/**
|
|
2207
|
-
* Whether an indexed entry satisfies a query's scope / kind / tag /
|
|
2208
|
-
* pre-filter (the axes shared by every v1
|
|
2209
|
-
* link axes are NOT applied here — those
|
|
2320
|
+
* Whether an indexed entry satisfies a query's scope / kind / tag /
|
|
2321
|
+
* provenance-source / predicate pre-filter (the axes shared by every v1
|
|
2322
|
+
* retriever). The `semantic` / `asOf` / link axes are NOT applied here — those
|
|
2323
|
+
* are each retriever's own concern.
|
|
2210
2324
|
* @public
|
|
2211
2325
|
*/
|
|
2212
2326
|
export declare function indexedRecordMatchesQuery(entry: IIndexedMemoryRecord, query: IMemoryQuery): boolean;
|
|
@@ -2269,17 +2383,40 @@ export declare class InMemoryCosineIndex implements IVectorIndex {
|
|
|
2269
2383
|
/**
|
|
2270
2384
|
* Re-embed every record from `source` and rebuild the index from scratch.
|
|
2271
2385
|
* Clears the current contents (and the established dimension) first, so a
|
|
2272
|
-
* re-embed with a different model is supported. Returns
|
|
2273
|
-
* indexed.
|
|
2386
|
+
* re-embed with a different model is supported. Returns an
|
|
2387
|
+
* {@link IVectorRebuildReport} describing what was indexed, declined and skipped.
|
|
2274
2388
|
*
|
|
2275
|
-
*
|
|
2276
|
-
*
|
|
2277
|
-
*
|
|
2389
|
+
* @remarks
|
|
2390
|
+
* **A failure to LIST is always fatal**, under either mode — and **leaves the
|
|
2391
|
+
* existing index untouched**: an unreadable source says nothing about which
|
|
2392
|
+
* records exist, so there is neither an honest partial to report nor any reason
|
|
2393
|
+
* to discard what is already held.
|
|
2394
|
+
*
|
|
2395
|
+
* Per-record embed/add failures are governed by
|
|
2396
|
+
* {@link IVectorRebuildOptions.onRecordError}, which defaults to `'fail'` —
|
|
2397
|
+
* **the historical all-or-nothing contract, unchanged**: the index is rolled back
|
|
2398
|
+
* to empty rather than left partially rebuilt, so a caller that retries a query
|
|
2399
|
+
* sees a clean empty index it can reason about.
|
|
2400
|
+
*
|
|
2401
|
+
* `'skip'` opts into the lenient shape the store's own open already uses: the
|
|
2402
|
+
* rebuild continues and every casualty is returned structurally on
|
|
2403
|
+
* {@link IVectorRebuildReport.skipped}. **It reports more, it does not report
|
|
2404
|
+
* less** — the point is to stop one bad record emptying an entire index, not to
|
|
2405
|
+
* make failures quieter. A caller that ignores `skipped` under `'skip'` has
|
|
2406
|
+
* chosen to, rather than been given no way to know.
|
|
2407
|
+
*
|
|
2408
|
+
* A {@link MemoryEmbedder} decline is not a failure under either mode: it is
|
|
2409
|
+
* counted on {@link IVectorRebuildReport.declined} and never appears in `skipped`.
|
|
2410
|
+
*
|
|
2411
|
+
* Both consumer-supplied hooks are capture-wrapped, so a `source` or `embed`
|
|
2412
|
+
* that throws or rejects becomes a `Failure` on the path above rather than an
|
|
2413
|
+
* exception escaping mid-rebuild — which would bypass the rollback entirely.
|
|
2278
2414
|
*
|
|
2279
2415
|
* @param source - The scope-qualified record source to re-embed.
|
|
2280
2416
|
* @param embed - The embedder applied to each record.
|
|
2417
|
+
* @param options - Rebuild options; omit for the historical `'fail'` behavior.
|
|
2281
2418
|
*/
|
|
2282
|
-
rebuild(source: IMemoryRecordSource, embed: MemoryEmbedder): Promise<Result<
|
|
2419
|
+
rebuild(source: IMemoryRecordSource, embed: MemoryEmbedder, options?: IVectorRebuildOptions): Promise<Result<IVectorRebuildReport>>;
|
|
2283
2420
|
/** Empty the index and forget the established dimension. */
|
|
2284
2421
|
private _reset;
|
|
2285
2422
|
/** The Euclidean magnitude (L2 norm) of a vector. */
|
|
@@ -2350,6 +2487,13 @@ export declare class InMemoryFragmentCosineIndex implements IFragmentVectorIndex
|
|
|
2350
2487
|
* On any failure (list, embed, or add) the index is rolled back to empty rather
|
|
2351
2488
|
* than left in a partially-rebuilt state.
|
|
2352
2489
|
*
|
|
2490
|
+
* @remarks
|
|
2491
|
+
* **Deliberately still returns a bare count**, unlike the record-granular
|
|
2492
|
+
* {@link InMemoryCosineIndex.rebuild}, which reports an
|
|
2493
|
+
* {@link IVectorRebuildReport}. The asymmetry is scope, not oversight: the
|
|
2494
|
+
* fragment path is tracked separately and gains the same treatment when the
|
|
2495
|
+
* `IVectorIndex`/`IFragmentVectorIndex` contracts are revisited together.
|
|
2496
|
+
*
|
|
2353
2497
|
* @param source - The scope-qualified record source to re-embed.
|
|
2354
2498
|
* @param embed - The fragment embedder applied to each record.
|
|
2355
2499
|
*/
|
|
@@ -2495,6 +2639,19 @@ export declare interface ISkippedRecord {
|
|
|
2495
2639
|
readonly error: string;
|
|
2496
2640
|
}
|
|
2497
2641
|
|
|
2642
|
+
/**
|
|
2643
|
+
* A record a rebuild could not index — because the embed failed or because the
|
|
2644
|
+
* subsequent add did — retained so a partial rebuild reports what it lost rather
|
|
2645
|
+
* than merely how much it kept.
|
|
2646
|
+
* @public
|
|
2647
|
+
*/
|
|
2648
|
+
export declare interface ISkippedVectorRecord {
|
|
2649
|
+
/** The scope-qualified address of the record that could not be indexed. */
|
|
2650
|
+
readonly target: IEdgeTarget;
|
|
2651
|
+
/** The failure message, from either the embed or the subsequent add. */
|
|
2652
|
+
readonly error: string;
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2498
2655
|
/**
|
|
2499
2656
|
* Narrow an {@link IIdentityCodec} to {@link ITemporalIdentityCodec} by probing
|
|
2500
2657
|
* for the versioned methods. Used by the store when an `encode` result reports
|
|
@@ -2612,6 +2769,45 @@ export declare interface IVectorIndex {
|
|
|
2612
2769
|
* Return the `topK` nearest records to `vector`, in descending score order.
|
|
2613
2770
|
*/
|
|
2614
2771
|
query(vector: Float32Array, topK: number): Promise<Result<ReadonlyArray<IVectorQueryHit>>>;
|
|
2772
|
+
/**
|
|
2773
|
+
* The number of vectors currently held.
|
|
2774
|
+
*
|
|
2775
|
+
* @remarks
|
|
2776
|
+
* On the contract because without it a caller cannot distinguish *"the index is
|
|
2777
|
+
* empty"* from *"nothing matched"*: {@link IVectorIndex.query} answers an empty
|
|
2778
|
+
* index with `succeed([])`, which is indistinguishable from a genuine miss. The
|
|
2779
|
+
* only other check available to a caller — "is a vector index wired?" — tests the
|
|
2780
|
+
* **wiring**, and that stays true while the index holds nothing.
|
|
2781
|
+
*
|
|
2782
|
+
* Note the narrow scope: this answers *how many vectors are held*, **not** how
|
|
2783
|
+
* many there ought to be. Full coverage — "is every record that should be indexed
|
|
2784
|
+
* actually indexed?" — still requires comparing against the record source and
|
|
2785
|
+
* {@link IMemoryStore.embedsKind}.
|
|
2786
|
+
*
|
|
2787
|
+
* Synchronous and non-`Result` because both shipped implementations can answer it
|
|
2788
|
+
* without I/O that can fail — the in-memory index reads a `Map`'s size, and the
|
|
2789
|
+
* SQLite-backed one a prepared `COUNT` against an open connection it already owns.
|
|
2790
|
+
*/
|
|
2791
|
+
readonly size: number;
|
|
2792
|
+
/**
|
|
2793
|
+
* Re-embed every record from `source` and rebuild the index from scratch — the
|
|
2794
|
+
* **backfill / reconcile** operation.
|
|
2795
|
+
*
|
|
2796
|
+
* @remarks
|
|
2797
|
+
* On the contract because a persisted index is unusable without it. Records
|
|
2798
|
+
* written while the index was unwired, a re-embed after a dimension change (where
|
|
2799
|
+
* the backend supports one — a `vec0`-backed table's dimension is fixed at
|
|
2800
|
+
* creation, so there it needs a drop-and-re-index instead), and reconciliation
|
|
2801
|
+
* after a swallowed embed-on-write failure are all unreachable otherwise — and the store's own docstring already promises *"the derived index
|
|
2802
|
+
* is reconciled by a later `rebuild`"*, a promise the contract could not keep for
|
|
2803
|
+
* any index but the bundled one. A caller moving from the bundled implementation
|
|
2804
|
+
* to a persistent one found the swap type-checked everywhere **except** the one
|
|
2805
|
+
* place it backfills, which is the place that mattered.
|
|
2806
|
+
*
|
|
2807
|
+
* See {@link IVectorRebuildReport} for what it reports and
|
|
2808
|
+
* {@link IVectorRebuildOptions} for the failure mode.
|
|
2809
|
+
*/
|
|
2810
|
+
rebuild(source: IMemoryRecordSource, embed: MemoryEmbedder, options?: IVectorRebuildOptions): Promise<Result<IVectorRebuildReport>>;
|
|
2615
2811
|
}
|
|
2616
2812
|
|
|
2617
2813
|
/**
|
|
@@ -2670,6 +2866,43 @@ export declare interface IVectorQueryHit {
|
|
|
2670
2866
|
readonly fragmentId?: string;
|
|
2671
2867
|
}
|
|
2672
2868
|
|
|
2869
|
+
/**
|
|
2870
|
+
* Options for a vector-index rebuild.
|
|
2871
|
+
* @public
|
|
2872
|
+
*/
|
|
2873
|
+
export declare interface IVectorRebuildOptions {
|
|
2874
|
+
/**
|
|
2875
|
+
* How to treat a record the rebuild cannot index — an embed failure OR an add
|
|
2876
|
+
* failure. Defaults to `'fail'` — the historical behavior, unchanged for every
|
|
2877
|
+
* existing caller.
|
|
2878
|
+
*/
|
|
2879
|
+
readonly onRecordError?: VectorRebuildErrorMode;
|
|
2880
|
+
}
|
|
2881
|
+
|
|
2882
|
+
/**
|
|
2883
|
+
* What a rebuild actually did — the structural answer to "is this index complete?".
|
|
2884
|
+
*
|
|
2885
|
+
* @remarks
|
|
2886
|
+
* A bare count cannot distinguish the three ways a record can be absent from the
|
|
2887
|
+
* index, and that distinction is the entire point: **`declined` was intentional,
|
|
2888
|
+
* `skipped` was a fault, and neither is the same as "never attempted"**. A caller
|
|
2889
|
+
* deriving coverage from a count alone cannot tell an embedder outage from a
|
|
2890
|
+
* deliberate policy, which is precisely the confusion this type exists to end.
|
|
2891
|
+
* @public
|
|
2892
|
+
*/
|
|
2893
|
+
export declare interface IVectorRebuildReport {
|
|
2894
|
+
/** Records embedded and added to the index. */
|
|
2895
|
+
readonly indexed: number;
|
|
2896
|
+
/** Records the embedder deliberately declined (resolved `undefined`). */
|
|
2897
|
+
readonly declined: number;
|
|
2898
|
+
/**
|
|
2899
|
+
* Records whose embedding or add FAILED and were skipped. Non-empty only under
|
|
2900
|
+
* {@link VectorRebuildErrorMode | `onRecordError: 'skip'`} — under `'fail'` the
|
|
2901
|
+
* first failure aborts the rebuild and no report is returned at all.
|
|
2902
|
+
*/
|
|
2903
|
+
readonly skipped: ReadonlyArray<ISkippedVectorRecord>;
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2673
2906
|
/**
|
|
2674
2907
|
* A per-kind write policy, injected at store construction. Invoked AFTER
|
|
2675
2908
|
* content-hash dedup (dedup is always pre-policy). The policy decides
|
|
@@ -2891,7 +3124,7 @@ export declare const LINK_TRAVERSAL_UNWIRED_MESSAGE: string;
|
|
|
2891
3124
|
* is the exact, collision-free cycle key — no structural hashing (e.g.
|
|
2892
3125
|
* `Crc32Normalizer`) is needed. A self-loop or any multi-hop cycle terminates
|
|
2893
3126
|
* because a revisited node is never re-expanded.
|
|
2894
|
-
* - **Post-filter.** The scope / kind / tag / predicate axes of the query are
|
|
3127
|
+
* - **Post-filter.** The scope / kind / tag / provenance-source / predicate axes of the query are
|
|
2895
3128
|
* applied to the reached records (the link axes are the traversal itself).
|
|
2896
3129
|
* @public
|
|
2897
3130
|
*/
|
|
@@ -3019,9 +3252,81 @@ export declare type MemoryDetailTier = 'gist' | 'full';
|
|
|
3019
3252
|
* Async and `Result`-returning, since a real embedder does a network call (cloud
|
|
3020
3253
|
* provider) or in-process model inference. The consumer wires this — the core
|
|
3021
3254
|
* package never calls an embedding provider directly, staying embedder-agnostic.
|
|
3255
|
+
*
|
|
3256
|
+
* @remarks
|
|
3257
|
+
* Resolving to `undefined` means **"intentionally not embedded"** — a deliberate
|
|
3258
|
+
* decline, not an error. The record is stored without an embedding reference, no
|
|
3259
|
+
* failure is reported, and **the decline itself logs nothing**. This is distinct
|
|
3260
|
+
* from a `Failure`, which means the embedder *tried and could not*.
|
|
3261
|
+
*
|
|
3262
|
+
* "Logs nothing" is a statement about the decline, not a promise of silence: a
|
|
3263
|
+
* decline on a record that was already embedded also prunes the vector that
|
|
3264
|
+
* reference named, and if that prune fails it is a genuine fault and warns like
|
|
3265
|
+
* any other. What a decline never does is warn merely for having happened.
|
|
3266
|
+
*
|
|
3267
|
+
* The distinction is load-bearing wherever the two are treated differently. On the
|
|
3268
|
+
* rebuild path a declined record is **excluded** from the index and counted on
|
|
3269
|
+
* {@link IVectorRebuildReport.declined}; a failed one is a genuine error and, under
|
|
3270
|
+
* `onRecordError: 'skip'`, is reported on {@link IVectorRebuildReport.skipped}. Collapsing "I chose not to" into `fail` would
|
|
3271
|
+
* make a deliberate policy indistinguishable from an embedder outage in the logs,
|
|
3272
|
+
* and would put a routine decision on whatever error path the caller has wired.
|
|
3273
|
+
*
|
|
3274
|
+
* The embedder receives the whole record, so the usual reason to decline is the
|
|
3275
|
+
* record's `kind` — a control or bookkeeping row that no query should ever return.
|
|
3276
|
+
*
|
|
3022
3277
|
* @public
|
|
3023
3278
|
*/
|
|
3024
|
-
export declare type MemoryEmbedder = (record: IMemoryRecord<unknown>) => Promise<Result<Float32Array>>;
|
|
3279
|
+
export declare type MemoryEmbedder = (record: IMemoryRecord<unknown>) => Promise<Result<Float32Array | undefined>>;
|
|
3280
|
+
|
|
3281
|
+
/**
|
|
3282
|
+
* What the record-granular vector index did about a written record.
|
|
3283
|
+
*
|
|
3284
|
+
* @remarks
|
|
3285
|
+
* This exists because **`embeddingRef` absence is three-ways ambiguous**: a
|
|
3286
|
+
* record with no reference may have been declined, excluded, or genuinely
|
|
3287
|
+
* failed to embed, and the `put`'s own `outcome` cannot tell you which — it is
|
|
3288
|
+
* `'success'` in all three, because embed-on-write is best-effort by design and
|
|
3289
|
+
* never fails a durable write. Deriving index coverage from the absent field
|
|
3290
|
+
* alone therefore cannot distinguish a policy decision from an outage.
|
|
3291
|
+
*
|
|
3292
|
+
* - `'embedded'` — embedded and added; the record carries an `embeddingRef`.
|
|
3293
|
+
* - `'declined'` — the {@link MemoryEmbedder} resolved `undefined`: deliberately
|
|
3294
|
+
* not embedded. Not a fault.
|
|
3295
|
+
* - `'excluded'` — the record's kind is outside the store's `embedKinds`
|
|
3296
|
+
* declaration, so the embedder was never called. Also not a fault, and the
|
|
3297
|
+
* cheaper of the two.
|
|
3298
|
+
* - `'failed'` — the embedder returned a `Failure` (or threw), **or** the index
|
|
3299
|
+
* `add` did. Both are faults, and what they leave behind depends on whether
|
|
3300
|
+
* the record had been embedded before: a **first** write ends up with no
|
|
3301
|
+
* `embeddingRef` and nothing in the index, while an **update** keeps the
|
|
3302
|
+
* reference and vector it already had — so the index goes on answering on the
|
|
3303
|
+
* record's **previous** content until a `rebuild` reconciles it. Stale, not
|
|
3304
|
+
* absent. The store's diagnostic logger names which fault it was, because the
|
|
3305
|
+
* remediation differs (an embedder outage versus an index outage) while the
|
|
3306
|
+
* coverage answer — "this record needs a re-embed" — does not.
|
|
3307
|
+
*
|
|
3308
|
+
* Absent on a write observation means **no outcome is being reported**, which
|
|
3309
|
+
* covers three cases:
|
|
3310
|
+
*
|
|
3311
|
+
* 1. no vector index / embedder is wired, so there is no index for the record to
|
|
3312
|
+
* be absent from;
|
|
3313
|
+
* 2. the `put` was a dedup no-op, which attempted nothing;
|
|
3314
|
+
* 3. the `put` **failed** (`outcome: 'failure'`). An embed step may well have run
|
|
3315
|
+
* before the failure — a record can even have been added to the index and then
|
|
3316
|
+
* lost its durable write, leaving an orphan vector that a later `rebuild`
|
|
3317
|
+
* reconciles. That is deliberately not reported here: the field answers
|
|
3318
|
+
* "is this *stored* record in the index?", and on a failed write there is no
|
|
3319
|
+
* stored record for it to be a statement about.
|
|
3320
|
+
*
|
|
3321
|
+
* So `embed` is a property of successful writes. Never present on `'read'` /
|
|
3322
|
+
* `'delete'` / `'retrieve'`.
|
|
3323
|
+
*
|
|
3324
|
+
* Record-granular only. The fragment path is independent and reports nothing
|
|
3325
|
+
* here — a record may be fragment-embedded while its record-level outcome is
|
|
3326
|
+
* `'excluded'`.
|
|
3327
|
+
* @public
|
|
3328
|
+
*/
|
|
3329
|
+
export declare type MemoryEmbedOutcome = 'embedded' | 'declined' | 'excluded' | 'failed';
|
|
3025
3330
|
|
|
3026
3331
|
/**
|
|
3027
3332
|
* Stable file-stem identifier for a memory record. Equals the codec-produced
|
|
@@ -3557,6 +3862,9 @@ export declare function rankCompare(a: IMemoryRecord<unknown>, b: IMemoryRecord<
|
|
|
3557
3862
|
* {@link IMemoryEnvelope.rank}. The store never interprets the body — the host
|
|
3558
3863
|
* owns what the number means. A projector that throws is treated as "no rank
|
|
3559
3864
|
* for this record" (logged at `warn`), never failing the write.
|
|
3865
|
+
*
|
|
3866
|
+
* Runs on writes only. To apply a newly-registered projector to records that
|
|
3867
|
+
* already exist, call `IMemoryStore.reconcileRank`.
|
|
3560
3868
|
* @public
|
|
3561
3869
|
*/
|
|
3562
3870
|
export declare type RankProjector = (record: IMemoryRecord<unknown>) => number;
|
|
@@ -3569,7 +3877,7 @@ export declare type RankProjector = (record: IMemoryRecord<unknown>) => number;
|
|
|
3569
3877
|
export declare function recencyCompare(a: IMemoryRecord<unknown>, b: IMemoryRecord<unknown>): number;
|
|
3570
3878
|
|
|
3571
3879
|
/**
|
|
3572
|
-
* Returns records matching the query's scope / kind / tag / predicate filters,
|
|
3880
|
+
* Returns records matching the query's scope / kind / tag / provenance-source / predicate filters,
|
|
3573
3881
|
* ordered most-recently-updated first. The universal v1 retriever — an empty
|
|
3574
3882
|
* query returns the whole vault in recency order.
|
|
3575
3883
|
* @public
|
|
@@ -3627,8 +3935,9 @@ export declare class ScoreUnionMergeStrategy implements IMergeStrategy {
|
|
|
3627
3935
|
}
|
|
3628
3936
|
|
|
3629
3937
|
/**
|
|
3630
|
-
* Apply the shared scope / kind / tag / predicate pre-filter
|
|
3631
|
-
* entries, returning the surviving records (unordered,
|
|
3938
|
+
* Apply the shared scope / kind / tag / provenance-source / predicate pre-filter
|
|
3939
|
+
* to a set of indexed entries, returning the surviving records (unordered,
|
|
3940
|
+
* unlimited).
|
|
3632
3941
|
* @public
|
|
3633
3942
|
*/
|
|
3634
3943
|
export declare function selectByQuery(entries: ReadonlyArray<IIndexedMemoryRecord>, query: IMemoryQuery): IMemoryRecord<unknown>[];
|
|
@@ -3711,10 +4020,32 @@ export declare function splitFrontmatter(raw: string): Result<IMemoryFileParts>;
|
|
|
3711
4020
|
export declare type StoreStampedEnvelopeField = 'id' | 'seq' | 'contentHash' | 'created' | 'updated';
|
|
3712
4021
|
|
|
3713
4022
|
/**
|
|
3714
|
-
* Returns records matching `query.filter`, narrowed
|
|
3715
|
-
* pre-filter and recency-ordered.
|
|
3716
|
-
*
|
|
3717
|
-
*
|
|
4023
|
+
* Returns records matching `query.filter` or `query.provenanceSource`, narrowed
|
|
4024
|
+
* by any scope / kind / tag / provenance-source pre-filter and recency-ordered.
|
|
4025
|
+
* Those two are this retriever's axes: a query carrying neither is not its
|
|
4026
|
+
* concern and yields an empty success (so it contributes nothing to a
|
|
4027
|
+
* {@link HybridRetriever}, rather than failing).
|
|
4028
|
+
*
|
|
4029
|
+
* Note `provenanceSource` appears on both sides of that sentence, and the
|
|
4030
|
+
* duplication is real rather than sloppy: it is one of this retriever's two
|
|
4031
|
+
* *dispatch* axes (it decides whether the query is this retriever's concern at
|
|
4032
|
+
* all) **and** a member of the shared *pre-filter* (it narrows the result set,
|
|
4033
|
+
* as it does for every other retriever). `filter` is likewise both.
|
|
4034
|
+
*
|
|
4035
|
+
* @remarks
|
|
4036
|
+
* `provenanceSource` is *applied* by the shared pre-filter, so every retriever
|
|
4037
|
+
* narrows by it. What this retriever adds is *answering* a query whose only axis
|
|
4038
|
+
* is `provenanceSource` — the "show me everything this source produced" request,
|
|
4039
|
+
* which would otherwise fall through the `filter`-absent guard and come back
|
|
4040
|
+
* empty.
|
|
4041
|
+
*
|
|
4042
|
+
* Consequently, inside a {@link HybridRetriever} composed with the universal
|
|
4043
|
+
* {@link RecencyRetriever}, a `provenanceSource`-only query is answered by both
|
|
4044
|
+
* children and every matching record scores twice under a score-union merge.
|
|
4045
|
+
* That is the established behavior for a dedicated-axis retriever composed with
|
|
4046
|
+
* the universal one — {@link TagRetriever} double-scores a `tag`-only query the
|
|
4047
|
+
* same way — and is intentional here, not an artifact of grafting a second axis
|
|
4048
|
+
* onto a retriever whose original concern was arbitrary predicates.
|
|
3718
4049
|
* @public
|
|
3719
4050
|
*/
|
|
3720
4051
|
export declare class StructuredFilterRetriever implements IMemoryRetriever {
|
|
@@ -3736,7 +4067,7 @@ export declare type Tag = Brand<string, 'Tag'>;
|
|
|
3736
4067
|
|
|
3737
4068
|
/**
|
|
3738
4069
|
* Returns records carrying `query.tag`, recency-ordered within the tag and
|
|
3739
|
-
* narrowed by any scope / kind / predicate filters. Tag is this retriever's
|
|
4070
|
+
* narrowed by any scope / kind / provenance-source / predicate filters. Tag is this retriever's
|
|
3740
4071
|
* axis: a query without a `tag` is not its concern and yields an empty success
|
|
3741
4072
|
* (so it contributes nothing to a {@link HybridRetriever}, rather than failing).
|
|
3742
4073
|
* @public
|
|
@@ -3870,4 +4201,25 @@ export declare class TemporalVersionedPolicy implements IWritePolicy {
|
|
|
3870
4201
|
private _rebuild;
|
|
3871
4202
|
}
|
|
3872
4203
|
|
|
4204
|
+
/**
|
|
4205
|
+
* How a vector-index rebuild treats a record it cannot index — whether the
|
|
4206
|
+
* **embedding** failed or the subsequent **add** did. Both are governed by this
|
|
4207
|
+
* one mode; neither is unconditionally fatal.
|
|
4208
|
+
*
|
|
4209
|
+
* @remarks
|
|
4210
|
+
* Deliberately mirrors the store's own open-time `onRecordError` mode, including
|
|
4211
|
+
* its default: `'fail'` preserves the historical all-or-nothing contract exactly,
|
|
4212
|
+
* and `'skip'` is opt-in. Defined here rather than imported from the store packlet
|
|
4213
|
+
* — the `vector` packlet does not depend on `store`, and the two modes describe
|
|
4214
|
+
* different domains that merely happen to share a shape.
|
|
4215
|
+
*
|
|
4216
|
+
* A **decline** (a {@link MemoryEmbedder} resolving `undefined`) is not an error
|
|
4217
|
+
* and is unaffected by this mode: it is always **excluded** from the index and
|
|
4218
|
+
* counted on {@link IVectorRebuildReport.declined}, **never** appearing in
|
|
4219
|
+
* {@link IVectorRebuildReport.skipped}. The word is worth being careful with here:
|
|
4220
|
+
* `skipped` is now a formal field meaning *a fault*, and a decline is the opposite.
|
|
4221
|
+
* @public
|
|
4222
|
+
*/
|
|
4223
|
+
export declare type VectorRebuildErrorMode = 'skip' | 'fail';
|
|
4224
|
+
|
|
3873
4225
|
export { }
|