@atomicmemory/core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/LICENSE +201 -0
- package/README.md +314 -0
- package/dist/app/bind-ephemeral.d.ts +18 -0
- package/dist/app/bind-ephemeral.js +22 -0
- package/dist/app/cors-headers.d.ts +12 -0
- package/dist/app/cors-headers.js +18 -0
- package/dist/app/create-app.d.ts +25 -0
- package/dist/app/create-app.js +156 -0
- package/dist/app/runtime-config-route-snapshot.d.ts +27 -0
- package/dist/app/runtime-config-route-snapshot.js +27 -0
- package/dist/app/runtime-container.d.ts +281 -0
- package/dist/app/runtime-container.js +297 -0
- package/dist/app/startup-checks.d.ts +28 -0
- package/dist/app/startup-checks.js +45 -0
- package/dist/bin.d.ts +17 -0
- package/dist/bin.js +128 -0
- package/dist/config.d.ts +680 -0
- package/dist/config.js +808 -0
- package/dist/db/agent-trust-repository.d.ts +49 -0
- package/dist/db/agent-trust-repository.js +66 -0
- package/dist/db/belief-edges-repository.d.ts +68 -0
- package/dist/db/belief-edges-repository.js +124 -0
- package/dist/db/claim-repository.d.ts +6 -0
- package/dist/db/claim-repository.js +4 -0
- package/dist/db/contradictions-repository.d.ts +56 -0
- package/dist/db/contradictions-repository.js +88 -0
- package/dist/db/document-chunk-repository.d.ts +48 -0
- package/dist/db/document-chunk-repository.js +145 -0
- package/dist/db/document-chunk-types.d.ts +35 -0
- package/dist/db/document-chunk-types.js +9 -0
- package/dist/db/document-list-cursor.d.ts +45 -0
- package/dist/db/document-list-cursor.js +111 -0
- package/dist/db/document-list-repository.d.ts +103 -0
- package/dist/db/document-list-repository.js +204 -0
- package/dist/db/entity-cards-repository.d.ts +37 -0
- package/dist/db/entity-cards-repository.js +46 -0
- package/dist/db/entity-values-repository.d.ts +26 -0
- package/dist/db/entity-values-repository.js +57 -0
- package/dist/db/link-repository.d.ts +30 -0
- package/dist/db/link-repository.js +54 -0
- package/dist/db/memory-repository.d.ts +163 -0
- package/dist/db/memory-repository.js +232 -0
- package/dist/db/migrate.d.ts +6 -0
- package/dist/db/migrate.js +36 -0
- package/dist/db/mmr.d.ts +14 -0
- package/dist/db/mmr.js +57 -0
- package/dist/db/passport-feed-repository.d.ts +91 -0
- package/dist/db/passport-feed-repository.js +198 -0
- package/dist/db/pg-episode-store.d.ts +19 -0
- package/dist/db/pg-episode-store.js +17 -0
- package/dist/db/pg-link-store.d.ts +17 -0
- package/dist/db/pg-link-store.js +14 -0
- package/dist/db/pg-memory-store.d.ts +68 -0
- package/dist/db/pg-memory-store.js +53 -0
- package/dist/db/pg-recap-store.d.ts +13 -0
- package/dist/db/pg-recap-store.js +19 -0
- package/dist/db/pg-representation-store.d.ts +17 -0
- package/dist/db/pg-representation-store.js +17 -0
- package/dist/db/pg-search-store.d.ts +29 -0
- package/dist/db/pg-search-store.js +47 -0
- package/dist/db/pool.d.ts +5 -0
- package/dist/db/pool.js +21 -0
- package/dist/db/ppr.d.ts +56 -0
- package/dist/db/ppr.js +178 -0
- package/dist/db/query-helpers.d.ts +44 -0
- package/dist/db/query-helpers.js +60 -0
- package/dist/db/raw-doc-artifact-sync.d.ts +128 -0
- package/dist/db/raw-doc-artifact-sync.js +259 -0
- package/dist/db/raw-document-blob-repository.d.ts +148 -0
- package/dist/db/raw-document-blob-repository.js +300 -0
- package/dist/db/raw-document-repository.d.ts +104 -0
- package/dist/db/raw-document-repository.js +410 -0
- package/dist/db/raw-document-status-repository.d.ts +122 -0
- package/dist/db/raw-document-status-repository.js +183 -0
- package/dist/db/raw-document-types.d.ts +236 -0
- package/dist/db/raw-document-types.js +10 -0
- package/dist/db/raw-storage-reconciliation-repository.d.ts +110 -0
- package/dist/db/raw-storage-reconciliation-repository.js +200 -0
- package/dist/db/reflection-jobs-repository.d.ts +33 -0
- package/dist/db/reflection-jobs-repository.js +48 -0
- package/dist/db/reflections-repository.d.ts +41 -0
- package/dist/db/reflections-repository.js +83 -0
- package/dist/db/repository-claims.d.ts +141 -0
- package/dist/db/repository-claims.js +376 -0
- package/dist/db/repository-deferred-audn.d.ts +33 -0
- package/dist/db/repository-deferred-audn.js +69 -0
- package/dist/db/repository-document-delete.d.ts +53 -0
- package/dist/db/repository-document-delete.js +156 -0
- package/dist/db/repository-entities.d.ts +114 -0
- package/dist/db/repository-entities.js +317 -0
- package/dist/db/repository-entity-attributes.d.ts +41 -0
- package/dist/db/repository-entity-attributes.js +65 -0
- package/dist/db/repository-entity-graph.d.ts +32 -0
- package/dist/db/repository-entity-graph.js +87 -0
- package/dist/db/repository-first-mentions.d.ts +41 -0
- package/dist/db/repository-first-mentions.js +79 -0
- package/dist/db/repository-lessons.d.ts +51 -0
- package/dist/db/repository-lessons.js +90 -0
- package/dist/db/repository-links.d.ts +26 -0
- package/dist/db/repository-links.js +105 -0
- package/dist/db/repository-observation.d.ts +26 -0
- package/dist/db/repository-observation.js +51 -0
- package/dist/db/repository-read.d.ts +56 -0
- package/dist/db/repository-read.js +271 -0
- package/dist/db/repository-recaps.d.ts +59 -0
- package/dist/db/repository-recaps.js +158 -0
- package/dist/db/repository-representations.d.ts +48 -0
- package/dist/db/repository-representations.js +162 -0
- package/dist/db/repository-temporal-state.d.ts +35 -0
- package/dist/db/repository-temporal-state.js +46 -0
- package/dist/db/repository-tll.d.ts +88 -0
- package/dist/db/repository-tll.js +179 -0
- package/dist/db/repository-types.d.ts +313 -0
- package/dist/db/repository-types.js +142 -0
- package/dist/db/repository-user-profiles.d.ts +17 -0
- package/dist/db/repository-user-profiles.js +28 -0
- package/dist/db/repository-vector-search.d.ts +33 -0
- package/dist/db/repository-vector-search.js +373 -0
- package/dist/db/repository-wipe.d.ts +34 -0
- package/dist/db/repository-wipe.js +94 -0
- package/dist/db/repository-write.d.ts +61 -0
- package/dist/db/repository-write.js +279 -0
- package/dist/db/schema.sql +1355 -0
- package/dist/db/storage-artifact-delete-tx.d.ts +56 -0
- package/dist/db/storage-artifact-delete-tx.js +123 -0
- package/dist/db/storage-artifact-providers.d.ts +21 -0
- package/dist/db/storage-artifact-providers.js +21 -0
- package/dist/db/storage-artifact-recovery-repository.d.ts +66 -0
- package/dist/db/storage-artifact-recovery-repository.js +58 -0
- package/dist/db/storage-artifact-repository.d.ts +329 -0
- package/dist/db/storage-artifact-repository.js +497 -0
- package/dist/db/stores.d.ts +220 -0
- package/dist/db/stores.js +12 -0
- package/dist/db/summaries-repository.d.ts +74 -0
- package/dist/db/summaries-repository.js +125 -0
- package/dist/eval/beam-10m-loader.d.ts +98 -0
- package/dist/eval/beam-10m-loader.js +128 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +17 -0
- package/dist/middleware/require-bearer.d.ts +27 -0
- package/dist/middleware/require-bearer.js +60 -0
- package/dist/middleware/validate-response.d.ts +33 -0
- package/dist/middleware/validate-response.js +55 -0
- package/dist/middleware/validate.d.ts +43 -0
- package/dist/middleware/validate.js +85 -0
- package/dist/routes/agents.d.ts +13 -0
- package/dist/routes/agents.js +89 -0
- package/dist/routes/document-response-formatters.d.ts +98 -0
- package/dist/routes/document-response-formatters.js +243 -0
- package/dist/routes/documents.d.ts +74 -0
- package/dist/routes/documents.js +425 -0
- package/dist/routes/memories.d.ts +29 -0
- package/dist/routes/memories.js +725 -0
- package/dist/routes/memory-response-formatters.d.ts +179 -0
- package/dist/routes/memory-response-formatters.js +210 -0
- package/dist/routes/public-raw-storage-metadata.d.ts +54 -0
- package/dist/routes/public-raw-storage-metadata.js +56 -0
- package/dist/routes/reflect.d.ts +14 -0
- package/dist/routes/reflect.js +19 -0
- package/dist/routes/response-schema-map.d.ts +14 -0
- package/dist/routes/response-schema-map.js +69 -0
- package/dist/routes/route-errors.d.ts +12 -0
- package/dist/routes/route-errors.js +30 -0
- package/dist/routes/storage-error-handlers.d.ts +34 -0
- package/dist/routes/storage-error-handlers.js +185 -0
- package/dist/routes/storage-response-formatters.d.ts +44 -0
- package/dist/routes/storage-response-formatters.js +155 -0
- package/dist/routes/storage.d.ts +38 -0
- package/dist/routes/storage.js +369 -0
- package/dist/routes/upstream-provider-errors.d.ts +19 -0
- package/dist/routes/upstream-provider-errors.js +95 -0
- package/dist/schemas/agents.d.ts +79 -0
- package/dist/schemas/agents.js +126 -0
- package/dist/schemas/common.d.ts +110 -0
- package/dist/schemas/common.js +190 -0
- package/dist/schemas/document-list-responses.d.ts +102 -0
- package/dist/schemas/document-list-responses.js +87 -0
- package/dist/schemas/document-list-schemas.d.ts +123 -0
- package/dist/schemas/document-list-schemas.js +174 -0
- package/dist/schemas/document-response-schemas.d.ts +610 -0
- package/dist/schemas/document-response-schemas.js +264 -0
- package/dist/schemas/document-status-envelope.d.ts +48 -0
- package/dist/schemas/document-status-envelope.js +54 -0
- package/dist/schemas/documents.d.ts +292 -0
- package/dist/schemas/documents.js +449 -0
- package/dist/schemas/errors.d.ts +75 -0
- package/dist/schemas/errors.js +105 -0
- package/dist/schemas/memories.d.ts +378 -0
- package/dist/schemas/memories.js +542 -0
- package/dist/schemas/openapi.d.ts +24 -0
- package/dist/schemas/openapi.js +1038 -0
- package/dist/schemas/response-scalars.d.ts +10 -0
- package/dist/schemas/response-scalars.js +10 -0
- package/dist/schemas/responses.d.ts +536 -0
- package/dist/schemas/responses.js +350 -0
- package/dist/schemas/search-response-parts.d.ts +97 -0
- package/dist/schemas/search-response-parts.js +103 -0
- package/dist/schemas/storage-schemas.d.ts +175 -0
- package/dist/schemas/storage-schemas.js +277 -0
- package/dist/schemas/zod-setup.d.ts +15 -0
- package/dist/schemas/zod-setup.js +17 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.js +57 -0
- package/dist/services/abstract-query-policy.d.ts +13 -0
- package/dist/services/abstract-query-policy.js +50 -0
- package/dist/services/affinity-clustering.d.ts +66 -0
- package/dist/services/affinity-clustering.js +125 -0
- package/dist/services/agentic-retrieval.d.ts +38 -0
- package/dist/services/agentic-retrieval.js +126 -0
- package/dist/services/answer-format.d.ts +56 -0
- package/dist/services/answer-format.js +118 -0
- package/dist/services/answer-rescue.d.ts +72 -0
- package/dist/services/answer-rescue.js +177 -0
- package/dist/services/answer-verifier.d.ts +24 -0
- package/dist/services/answer-verifier.js +73 -0
- package/dist/services/api-retry.d.ts +6 -0
- package/dist/services/api-retry.js +41 -0
- package/dist/services/assistant-turn-filter.d.ts +20 -0
- package/dist/services/assistant-turn-filter.js +69 -0
- package/dist/services/atomicmem-uri.d.ts +33 -0
- package/dist/services/atomicmem-uri.js +86 -0
- package/dist/services/audit-events.d.ts +54 -0
- package/dist/services/audit-events.js +56 -0
- package/dist/services/chunked-extraction.d.ts +21 -0
- package/dist/services/chunked-extraction.js +108 -0
- package/dist/services/claim-slotting.d.ts +27 -0
- package/dist/services/claim-slotting.js +38 -0
- package/dist/services/claude-code-llm.d.ts +19 -0
- package/dist/services/claude-code-llm.js +96 -0
- package/dist/services/composite-dedup.d.ts +50 -0
- package/dist/services/composite-dedup.js +153 -0
- package/dist/services/composite-grouping.d.ts +41 -0
- package/dist/services/composite-grouping.js +111 -0
- package/dist/services/composite-staleness.d.ts +20 -0
- package/dist/services/composite-staleness.js +50 -0
- package/dist/services/conciseness-preference.d.ts +14 -0
- package/dist/services/conciseness-preference.js +42 -0
- package/dist/services/conflict-policy.d.ts +20 -0
- package/dist/services/conflict-policy.js +335 -0
- package/dist/services/consensus-extraction.d.ts +39 -0
- package/dist/services/consensus-extraction.js +147 -0
- package/dist/services/consensus-validation.d.ts +52 -0
- package/dist/services/consensus-validation.js +206 -0
- package/dist/services/consolidation-service.d.ts +60 -0
- package/dist/services/consolidation-service.js +171 -0
- package/dist/services/content-detection.d.ts +18 -0
- package/dist/services/content-detection.js +25 -0
- package/dist/services/contradiction-surfacing.d.ts +62 -0
- package/dist/services/contradiction-surfacing.js +111 -0
- package/dist/services/cost-telemetry.d.ts +39 -0
- package/dist/services/cost-telemetry.js +58 -0
- package/dist/services/counter-evidence.d.ts +34 -0
- package/dist/services/counter-evidence.js +92 -0
- package/dist/services/current-state-ranking.d.ts +21 -0
- package/dist/services/current-state-ranking.js +152 -0
- package/dist/services/deferred-audn.d.ts +47 -0
- package/dist/services/deferred-audn.js +162 -0
- package/dist/services/document-chunker.d.ts +50 -0
- package/dist/services/document-chunker.js +153 -0
- package/dist/services/document-failure-markers.d.ts +91 -0
- package/dist/services/document-failure-markers.js +305 -0
- package/dist/services/document-indexer.d.ts +122 -0
- package/dist/services/document-indexer.js +405 -0
- package/dist/services/document-service.d.ts +245 -0
- package/dist/services/document-service.js +325 -0
- package/dist/services/document-upload-artifact-sync.d.ts +80 -0
- package/dist/services/document-upload-artifact-sync.js +162 -0
- package/dist/services/document-upload-beta2-recovery.d.ts +72 -0
- package/dist/services/document-upload-beta2-recovery.js +94 -0
- package/dist/services/document-upload.d.ts +44 -0
- package/dist/services/document-upload.js +353 -0
- package/dist/services/embedding.d.ts +57 -0
- package/dist/services/embedding.js +416 -0
- package/dist/services/entity-attribute-extractor.d.ts +34 -0
- package/dist/services/entity-attribute-extractor.js +117 -0
- package/dist/services/entity-card-synthesis.d.ts +54 -0
- package/dist/services/entity-card-synthesis.js +92 -0
- package/dist/services/entity-dedup.d.ts +9 -0
- package/dist/services/entity-dedup.js +14 -0
- package/dist/services/entity-graph.d.ts +17 -0
- package/dist/services/entity-graph.js +135 -0
- package/dist/services/entropy-gate.d.ts +52 -0
- package/dist/services/entropy-gate.js +56 -0
- package/dist/services/episode-fetcher.d.ts +47 -0
- package/dist/services/episode-fetcher.js +128 -0
- package/dist/services/event-anchor-facts.d.ts +8 -0
- package/dist/services/event-anchor-facts.js +205 -0
- package/dist/services/event-chain-detector.d.ts +52 -0
- package/dist/services/event-chain-detector.js +83 -0
- package/dist/services/extraction-cache.d.ts +9 -0
- package/dist/services/extraction-cache.js +54 -0
- package/dist/services/extraction-enrichment.d.ts +9 -0
- package/dist/services/extraction-enrichment.js +223 -0
- package/dist/services/extraction.d.ts +69 -0
- package/dist/services/extraction.js +596 -0
- package/dist/services/fact-normalization.d.ts +12 -0
- package/dist/services/fact-normalization.js +248 -0
- package/dist/services/filecoin-observability.d.ts +127 -0
- package/dist/services/filecoin-observability.js +200 -0
- package/dist/services/first-mention-service.d.ts +76 -0
- package/dist/services/first-mention-service.js +186 -0
- package/dist/services/hierarchical-retrieval.d.ts +49 -0
- package/dist/services/hierarchical-retrieval.js +50 -0
- package/dist/services/ingest-fact-pipeline.d.ts +32 -0
- package/dist/services/ingest-fact-pipeline.js +212 -0
- package/dist/services/ingest-post-write.d.ts +50 -0
- package/dist/services/ingest-post-write.js +117 -0
- package/dist/services/ingest-trace.d.ts +32 -0
- package/dist/services/ingest-trace.js +60 -0
- package/dist/services/input-sanitizer.d.ts +41 -0
- package/dist/services/input-sanitizer.js +135 -0
- package/dist/services/iterative-retrieval.d.ts +26 -0
- package/dist/services/iterative-retrieval.js +139 -0
- package/dist/services/keyword-expansion.d.ts +10 -0
- package/dist/services/keyword-expansion.js +26 -0
- package/dist/services/lesson-service.d.ts +68 -0
- package/dist/services/lesson-service.js +178 -0
- package/dist/services/literal-extractor.d.ts +16 -0
- package/dist/services/literal-extractor.js +74 -0
- package/dist/services/literal-list-protection.d.ts +17 -0
- package/dist/services/literal-list-protection.js +134 -0
- package/dist/services/literal-query-expansion.d.ts +20 -0
- package/dist/services/literal-query-expansion.js +181 -0
- package/dist/services/llm.d.ts +61 -0
- package/dist/services/llm.js +265 -0
- package/dist/services/memcell-projection.d.ts +17 -0
- package/dist/services/memcell-projection.js +41 -0
- package/dist/services/memory-audn.d.ts +43 -0
- package/dist/services/memory-audn.js +419 -0
- package/dist/services/memory-crud.d.ts +93 -0
- package/dist/services/memory-crud.js +255 -0
- package/dist/services/memory-ingest.d.ts +21 -0
- package/dist/services/memory-ingest.js +249 -0
- package/dist/services/memory-lifecycle.d.ts +75 -0
- package/dist/services/memory-lifecycle.js +108 -0
- package/dist/services/memory-lineage.d.ts +181 -0
- package/dist/services/memory-lineage.js +232 -0
- package/dist/services/memory-network.d.ts +40 -0
- package/dist/services/memory-network.js +75 -0
- package/dist/services/memory-search-types.d.ts +25 -0
- package/dist/services/memory-search-types.js +10 -0
- package/dist/services/memory-search.d.ts +48 -0
- package/dist/services/memory-search.js +505 -0
- package/dist/services/memory-service-types.d.ts +371 -0
- package/dist/services/memory-service-types.js +8 -0
- package/dist/services/memory-service.d.ts +152 -0
- package/dist/services/memory-service.js +225 -0
- package/dist/services/memory-storage.d.ts +33 -0
- package/dist/services/memory-storage.js +328 -0
- package/dist/services/msr-aggregator.d.ts +38 -0
- package/dist/services/msr-aggregator.js +97 -0
- package/dist/services/msr-detector.d.ts +35 -0
- package/dist/services/msr-detector.js +65 -0
- package/dist/services/namespace-retrieval.d.ts +60 -0
- package/dist/services/namespace-retrieval.js +180 -0
- package/dist/services/observation-date-extraction.d.ts +12 -0
- package/dist/services/observation-date-extraction.js +50 -0
- package/dist/services/observation-service.d.ts +27 -0
- package/dist/services/observation-service.js +84 -0
- package/dist/services/packaging-observability.d.ts +29 -0
- package/dist/services/packaging-observability.js +146 -0
- package/dist/services/query-expansion.d.ts +83 -0
- package/dist/services/query-expansion.js +242 -0
- package/dist/services/query-keyword-matches.d.ts +6 -0
- package/dist/services/query-keyword-matches.js +56 -0
- package/dist/services/query-term-visibility.d.ts +28 -0
- package/dist/services/query-term-visibility.js +100 -0
- package/dist/services/quick-extraction.d.ts +25 -0
- package/dist/services/quick-extraction.js +431 -0
- package/dist/services/quoted-entity-extraction.d.ts +10 -0
- package/dist/services/quoted-entity-extraction.js +161 -0
- package/dist/services/raw-storage-reconciler-backoff.d.ts +8 -0
- package/dist/services/raw-storage-reconciler-backoff.js +14 -0
- package/dist/services/raw-storage-reconciler-scheduler.d.ts +29 -0
- package/dist/services/raw-storage-reconciler-scheduler.js +43 -0
- package/dist/services/raw-storage-reconciler.d.ts +71 -0
- package/dist/services/raw-storage-reconciler.js +278 -0
- package/dist/services/recap-builder.d.ts +49 -0
- package/dist/services/recap-builder.js +157 -0
- package/dist/services/reflect-jobs.d.ts +23 -0
- package/dist/services/reflect-jobs.js +36 -0
- package/dist/services/reflect-prompts.d.ts +71 -0
- package/dist/services/reflect-prompts.js +99 -0
- package/dist/services/reflect-retrieval.d.ts +33 -0
- package/dist/services/reflect-retrieval.js +30 -0
- package/dist/services/reflect.d.ts +49 -0
- package/dist/services/reflect.js +84 -0
- package/dist/services/relative-temporal.d.ts +14 -0
- package/dist/services/relative-temporal.js +163 -0
- package/dist/services/relevance-policy.d.ts +37 -0
- package/dist/services/relevance-policy.js +109 -0
- package/dist/services/rerank.d.ts +32 -0
- package/dist/services/rerank.js +118 -0
- package/dist/services/reranker.d.ts +20 -0
- package/dist/services/reranker.js +99 -0
- package/dist/services/retrieval-channel-rules.d.ts +34 -0
- package/dist/services/retrieval-channel-rules.js +41 -0
- package/dist/services/retrieval-config-overlay.d.ts +36 -0
- package/dist/services/retrieval-config-overlay.js +44 -0
- package/dist/services/retrieval-format.d.ts +119 -0
- package/dist/services/retrieval-format.js +559 -0
- package/dist/services/retrieval-policy.d.ts +69 -0
- package/dist/services/retrieval-policy.js +275 -0
- package/dist/services/retrieval-profiles.d.ts +37 -0
- package/dist/services/retrieval-profiles.js +90 -0
- package/dist/services/retrieval-side-effects.d.ts +14 -0
- package/dist/services/retrieval-side-effects.js +26 -0
- package/dist/services/retrieval-trace.d.ts +108 -0
- package/dist/services/retrieval-trace.js +147 -0
- package/dist/services/rrf-fusion.d.ts +18 -0
- package/dist/services/rrf-fusion.js +34 -0
- package/dist/services/search-pipeline.d.ts +71 -0
- package/dist/services/search-pipeline.js +788 -0
- package/dist/services/session-date.d.ts +20 -0
- package/dist/services/session-date.js +61 -0
- package/dist/services/session-packaging.d.ts +53 -0
- package/dist/services/session-packaging.js +182 -0
- package/dist/services/session-summary-generator.d.ts +53 -0
- package/dist/services/session-summary-generator.js +134 -0
- package/dist/services/specialists/cr-specialist.d.ts +52 -0
- package/dist/services/specialists/cr-specialist.js +121 -0
- package/dist/services/specialists/dispatch.d.ts +53 -0
- package/dist/services/specialists/dispatch.js +102 -0
- package/dist/services/specialists/ie-ku-specialist.d.ts +37 -0
- package/dist/services/specialists/ie-ku-specialist.js +63 -0
- package/dist/services/specialists/msr-specialist.d.ts +61 -0
- package/dist/services/specialists/msr-specialist.js +162 -0
- package/dist/services/specialists/tr-specialist.d.ts +37 -0
- package/dist/services/specialists/tr-specialist.js +146 -0
- package/dist/services/storage-key-prefix.d.ts +42 -0
- package/dist/services/storage-key-prefix.js +45 -0
- package/dist/services/storage-put-recovery.d.ts +71 -0
- package/dist/services/storage-put-recovery.js +269 -0
- package/dist/services/storage-service-errors.d.ts +124 -0
- package/dist/services/storage-service-errors.js +189 -0
- package/dist/services/storage-service.d.ts +176 -0
- package/dist/services/storage-service.js +423 -0
- package/dist/services/subject-aware-ranking.d.ts +19 -0
- package/dist/services/subject-aware-ranking.js +161 -0
- package/dist/services/supplemental-extraction.d.ts +7 -0
- package/dist/services/supplemental-extraction.js +116 -0
- package/dist/services/tbc-execution.d.ts +49 -0
- package/dist/services/tbc-execution.js +284 -0
- package/dist/services/temporal-classifier.d.ts +56 -0
- package/dist/services/temporal-classifier.js +94 -0
- package/dist/services/temporal-endpoint-evidence.d.ts +12 -0
- package/dist/services/temporal-endpoint-evidence.js +313 -0
- package/dist/services/temporal-fingerprint.d.ts +6 -0
- package/dist/services/temporal-fingerprint.js +12 -0
- package/dist/services/temporal-format.d.ts +9 -0
- package/dist/services/temporal-format.js +21 -0
- package/dist/services/temporal-intent.d.ts +39 -0
- package/dist/services/temporal-intent.js +78 -0
- package/dist/services/temporal-query-constraints.d.ts +16 -0
- package/dist/services/temporal-query-constraints.js +107 -0
- package/dist/services/temporal-query-expansion.d.ts +14 -0
- package/dist/services/temporal-query-expansion.js +131 -0
- package/dist/services/temporal-rerank.d.ts +22 -0
- package/dist/services/temporal-rerank.js +47 -0
- package/dist/services/temporal-result-protection.d.ts +7 -0
- package/dist/services/temporal-result-protection.js +60 -0
- package/dist/services/temporal-state-write.d.ts +57 -0
- package/dist/services/temporal-state-write.js +45 -0
- package/dist/services/tiered-context.d.ts +87 -0
- package/dist/services/tiered-context.js +214 -0
- package/dist/services/tiered-loading.d.ts +88 -0
- package/dist/services/tiered-loading.js +263 -0
- package/dist/services/timeline-pack.d.ts +36 -0
- package/dist/services/timeline-pack.js +50 -0
- package/dist/services/timing.d.ts +13 -0
- package/dist/services/timing.js +72 -0
- package/dist/services/tll-augmentation.d.ts +20 -0
- package/dist/services/tll-augmentation.js +125 -0
- package/dist/services/tll-retrieval.d.ts +55 -0
- package/dist/services/tll-retrieval.js +101 -0
- package/dist/services/topic-abstraction.d.ts +36 -0
- package/dist/services/topic-abstraction.js +105 -0
- package/dist/services/trust-scoring.d.ts +43 -0
- package/dist/services/trust-scoring.js +89 -0
- package/dist/services/typed-belief-calculus.d.ts +126 -0
- package/dist/services/typed-belief-calculus.js +204 -0
- package/dist/services/upload-config.d.ts +34 -0
- package/dist/services/upload-config.js +23 -0
- package/dist/services/upload-decision.d.ts +65 -0
- package/dist/services/upload-decision.js +98 -0
- package/dist/services/upload-helpers.d.ts +107 -0
- package/dist/services/upload-helpers.js +148 -0
- package/dist/services/user-profile-builder.d.ts +22 -0
- package/dist/services/user-profile-builder.js +109 -0
- package/dist/services/voyage-embedding.d.ts +22 -0
- package/dist/services/voyage-embedding.js +77 -0
- package/dist/services/write-security.d.ts +31 -0
- package/dist/services/write-security.js +64 -0
- package/dist/storage/artifact-public-redaction.d.ts +34 -0
- package/dist/storage/artifact-public-redaction.js +83 -0
- package/dist/storage/cleanup.d.ts +103 -0
- package/dist/storage/cleanup.js +138 -0
- package/dist/storage/codec-factory.d.ts +17 -0
- package/dist/storage/codec-factory.js +33 -0
- package/dist/storage/codecs/aes-gcm-codec.d.ts +44 -0
- package/dist/storage/codecs/aes-gcm-codec.js +108 -0
- package/dist/storage/codecs/noop-codec.d.ts +16 -0
- package/dist/storage/codecs/noop-codec.js +23 -0
- package/dist/storage/factory.d.ts +44 -0
- package/dist/storage/factory.js +99 -0
- package/dist/storage/filecoin-cid-validation.d.ts +82 -0
- package/dist/storage/filecoin-cid-validation.js +122 -0
- package/dist/storage/filecoin-public-metadata.d.ts +73 -0
- package/dist/storage/filecoin-public-metadata.js +110 -0
- package/dist/storage/local-fs-store.d.ts +39 -0
- package/dist/storage/local-fs-store.js +145 -0
- package/dist/storage/pointer-uri-allowlist.d.ts +38 -0
- package/dist/storage/pointer-uri-allowlist.js +70 -0
- package/dist/storage/provider-metadata-projection.d.ts +27 -0
- package/dist/storage/provider-metadata-projection.js +68 -0
- package/dist/storage/providers/filecoin/backend.d.ts +42 -0
- package/dist/storage/providers/filecoin/backend.js +250 -0
- package/dist/storage/providers/filecoin/config.d.ts +70 -0
- package/dist/storage/providers/filecoin/config.js +275 -0
- package/dist/storage/providers/filecoin/errors.d.ts +45 -0
- package/dist/storage/providers/filecoin/errors.js +56 -0
- package/dist/storage/providers/filecoin/filecoin-pin-car.d.ts +78 -0
- package/dist/storage/providers/filecoin/filecoin-pin-car.js +155 -0
- package/dist/storage/providers/filecoin/filecoin-pin-client.d.ts +92 -0
- package/dist/storage/providers/filecoin/filecoin-pin-client.js +199 -0
- package/dist/storage/providers/filecoin/filecoin-pin-mapping.d.ts +58 -0
- package/dist/storage/providers/filecoin/filecoin-pin-mapping.js +103 -0
- package/dist/storage/providers/filecoin/filecoin-pin-timeout.d.ts +30 -0
- package/dist/storage/providers/filecoin/filecoin-pin-timeout.js +53 -0
- package/dist/storage/providers/filecoin/filecoin-pin-vendor.d.ts +111 -0
- package/dist/storage/providers/filecoin/filecoin-pin-vendor.js +87 -0
- package/dist/storage/providers/filecoin/hints.d.ts +71 -0
- package/dist/storage/providers/filecoin/hints.js +123 -0
- package/dist/storage/providers/filecoin/index.d.ts +51 -0
- package/dist/storage/providers/filecoin/index.js +103 -0
- package/dist/storage/providers/filecoin/ipfs-cid.d.ts +50 -0
- package/dist/storage/providers/filecoin/ipfs-cid.js +64 -0
- package/dist/storage/providers/filecoin/metadata.d.ts +72 -0
- package/dist/storage/providers/filecoin/metadata.js +137 -0
- package/dist/storage/providers/filecoin/piece-cid.d.ts +48 -0
- package/dist/storage/providers/filecoin/piece-cid.js +57 -0
- package/dist/storage/providers/filecoin/provider-client.d.ts +234 -0
- package/dist/storage/providers/filecoin/provider-client.js +27 -0
- package/dist/storage/providers/filecoin/readiness.d.ts +62 -0
- package/dist/storage/providers/filecoin/readiness.js +85 -0
- package/dist/storage/providers/filecoin/retriever.d.ts +82 -0
- package/dist/storage/providers/filecoin/retriever.js +63 -0
- package/dist/storage/providers/filecoin/skeleton-client.d.ts +36 -0
- package/dist/storage/providers/filecoin/skeleton-client.js +55 -0
- package/dist/storage/providers/filecoin/synapse-client.d.ts +169 -0
- package/dist/storage/providers/filecoin/synapse-client.js +343 -0
- package/dist/storage/providers/filecoin/synapse-construction.d.ts +26 -0
- package/dist/storage/providers/filecoin/synapse-construction.js +47 -0
- package/dist/storage/providers/filecoin/synapse-error-mapping.d.ts +23 -0
- package/dist/storage/providers/filecoin/synapse-error-mapping.js +49 -0
- package/dist/storage/providers/filecoin/synapse-readiness.d.ts +37 -0
- package/dist/storage/providers/filecoin/synapse-readiness.js +231 -0
- package/dist/storage/providers/filecoin/uri.d.ts +49 -0
- package/dist/storage/providers/filecoin/uri.js +84 -0
- package/dist/storage/providers/filecoin/verified-fetch-lifecycle.d.ts +77 -0
- package/dist/storage/providers/filecoin/verified-fetch-lifecycle.js +196 -0
- package/dist/storage/providers/filecoin/verified-fetch-retriever.d.ts +54 -0
- package/dist/storage/providers/filecoin/verified-fetch-retriever.js +81 -0
- package/dist/storage/providers/filecoin/verified-fetch-vendor.d.ts +71 -0
- package/dist/storage/providers/filecoin/verified-fetch-vendor.js +94 -0
- package/dist/storage/raw-content-codec.d.ts +89 -0
- package/dist/storage/raw-content-codec.js +47 -0
- package/dist/storage/raw-content-store-backend-adapter.d.ts +28 -0
- package/dist/storage/raw-content-store-backend-adapter.js +67 -0
- package/dist/storage/raw-content-store.d.ts +228 -0
- package/dist/storage/raw-content-store.js +27 -0
- package/dist/storage/s3-store.d.ts +42 -0
- package/dist/storage/s3-store.js +181 -0
- package/dist/storage/storage-backend-registry.d.ts +58 -0
- package/dist/storage/storage-backend-registry.js +56 -0
- package/dist/storage/storage-backend.d.ts +82 -0
- package/dist/storage/storage-backend.js +14 -0
- package/dist/storage/storage-capabilities.d.ts +56 -0
- package/dist/storage/storage-capabilities.js +170 -0
- package/dist/storage/store-registry.d.ts +67 -0
- package/dist/storage/store-registry.js +77 -0
- package/dist/vector-math.d.ts +15 -0
- package/dist/vector-math.js +31 -0
- package/dist/xml-escape.d.ts +5 -0
- package/dist/xml-escape.js +7 -0
- package/openapi.json +15395 -0
- package/openapi.yaml +10794 -0
- package/package.json +119 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* First-mention extraction service — produces a chronological list of
|
|
3
|
+
* topic-introduction events from a conversation transcript.
|
|
4
|
+
*
|
|
5
|
+
* One LLM call scans the full transcript and outputs a JSON array of
|
|
6
|
+
* `{topic, turn_id, session_id, anchor_date}` records. The service
|
|
7
|
+
* maps those onto core's stricter `FirstMentionEvent` shape (joining
|
|
8
|
+
* turn_id to memory_id via a caller-supplied map) and persists via
|
|
9
|
+
* `FirstMentionRepository.store`.
|
|
10
|
+
*
|
|
11
|
+
* Best-effort: extraction failures are logged to stderr and produce an
|
|
12
|
+
* empty array. Storage errors are propagated (no silent swallow).
|
|
13
|
+
*
|
|
14
|
+
* Prompts and salvage parser were ported verbatim from the BEAM harness
|
|
15
|
+
* (`atomicmemory-benchmarks/data/exp-stage7-beam-dryrun/lib.ts`) so the
|
|
16
|
+
* core implementation matches the validated extraction behaviour.
|
|
17
|
+
*/
|
|
18
|
+
const FIRST_MENTIONS_MAX_TOKENS = 8000;
|
|
19
|
+
const FIRST_MENTIONS_SYSTEM = 'You scan a conversation chronologically and identify FIRST-MENTION events: ' +
|
|
20
|
+
'the moment when a NEW major topic is introduced for the first time. ' +
|
|
21
|
+
'A "topic" is a specific aspect, feature, tech decision, problem, milestone, ' +
|
|
22
|
+
'or planning item — NOT a sub-aspect of a previously-introduced topic and ' +
|
|
23
|
+
'NOT a generic concept. Use SPECIFIC TECHNICAL PHRASES from the conversation ' +
|
|
24
|
+
'verbatim (version numbers, library names, config flags, named operations). ' +
|
|
25
|
+
'Order strictly by turn appearance. Output ONLY a JSON array.';
|
|
26
|
+
function buildFirstMentionsUser(turnsText) {
|
|
27
|
+
return (`Conversation turns (in chronological order, with turn_id and session_id markers):\n\n` +
|
|
28
|
+
turnsText +
|
|
29
|
+
`\n\nWalk through the turns sequentially. For each turn that introduces ` +
|
|
30
|
+
`a NEW major topic (not discussed in any earlier turn), record one event:\n` +
|
|
31
|
+
` {"topic": "<COMPACT specific topic phrase, 5-12 words MAX>", "turn_id": <int>, ` +
|
|
32
|
+
`"session_id": <int>, "anchor_date": "<time_anchor or null>"}\n\n` +
|
|
33
|
+
`Output ONLY a valid JSON array (no markdown fences, no preamble). ` +
|
|
34
|
+
`Aim for 15-30 first-mentions across the whole conversation, covering ` +
|
|
35
|
+
`distinct major aspects spanning all sessions. ` +
|
|
36
|
+
`Each topic phrase MUST be SHORT (5-12 words). Use verbatim tech tokens ` +
|
|
37
|
+
`(version numbers, library names) inside the short phrase. ` +
|
|
38
|
+
`Skip generic chatter, sub-aspects of already-listed topics, and assistant ` +
|
|
39
|
+
`explanatory content. Close the JSON array with ] before any other output.`);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Salvage parser: if the model truncated mid-array (no closing ]),
|
|
43
|
+
* find the last complete object and synthesize a closing bracket.
|
|
44
|
+
*/
|
|
45
|
+
function salvageJsonArray(text) {
|
|
46
|
+
const start = text.indexOf('[');
|
|
47
|
+
if (start < 0)
|
|
48
|
+
return null;
|
|
49
|
+
const lastBrace = text.lastIndexOf('}');
|
|
50
|
+
if (lastBrace < start)
|
|
51
|
+
return null;
|
|
52
|
+
return text.slice(start, lastBrace + 1) + ']';
|
|
53
|
+
}
|
|
54
|
+
function isRawFirstMention(value) {
|
|
55
|
+
if (typeof value !== 'object' || value === null)
|
|
56
|
+
return false;
|
|
57
|
+
const v = value;
|
|
58
|
+
return typeof v.topic === 'string' && typeof v.turn_id === 'number';
|
|
59
|
+
}
|
|
60
|
+
function parseAnchorDate(raw) {
|
|
61
|
+
if (typeof raw !== 'string' || raw.length === 0)
|
|
62
|
+
return null;
|
|
63
|
+
const ms = Date.parse(raw);
|
|
64
|
+
if (Number.isNaN(ms))
|
|
65
|
+
return null;
|
|
66
|
+
return new Date(ms);
|
|
67
|
+
}
|
|
68
|
+
/** Extract a JSON array from raw LLM text, salvaging truncated output. */
|
|
69
|
+
function extractJsonArray(text) {
|
|
70
|
+
const trimmed = text.trim();
|
|
71
|
+
const start = trimmed.indexOf('[');
|
|
72
|
+
if (start < 0) {
|
|
73
|
+
console.error(`[first-mention-llm-failed] no opening [ in response (text len=${trimmed.length})`);
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
const end = trimmed.lastIndexOf(']');
|
|
77
|
+
let jsonSlice;
|
|
78
|
+
if (end <= start) {
|
|
79
|
+
const salvaged = salvageJsonArray(trimmed);
|
|
80
|
+
if (!salvaged)
|
|
81
|
+
return null;
|
|
82
|
+
console.warn(`[first-mention-llm-salvaged] response truncated; salvaged ${salvaged.length} chars`);
|
|
83
|
+
jsonSlice = salvaged;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
jsonSlice = trimmed.slice(start, end + 1);
|
|
87
|
+
}
|
|
88
|
+
const parsed = JSON.parse(jsonSlice);
|
|
89
|
+
if (!Array.isArray(parsed)) {
|
|
90
|
+
console.error(`[first-mention-llm-failed] parsed JSON is not an array (type=${typeof parsed})`);
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return parsed;
|
|
94
|
+
}
|
|
95
|
+
export class FirstMentionService {
|
|
96
|
+
repo;
|
|
97
|
+
chatFn;
|
|
98
|
+
constructor(repo, chatFn) {
|
|
99
|
+
this.repo = repo;
|
|
100
|
+
this.chatFn = chatFn;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Extract first-mention events from a conversation transcript and
|
|
104
|
+
* persist them. Returns the parsed events (post-mapping). Best-effort:
|
|
105
|
+
* if the LLM call fails or returns unparseable output the method
|
|
106
|
+
* logs to stderr and returns `[]` without throwing.
|
|
107
|
+
*
|
|
108
|
+
* `memoryIdsByTurnId` provides the mapping the LLM cannot produce —
|
|
109
|
+
* any event whose `turn_id` is not present in the map is dropped.
|
|
110
|
+
*/
|
|
111
|
+
async extractAndStore(userId, conversationText, sourceSite, memoryIdsByTurnId) {
|
|
112
|
+
const raw = await this.invokeLlm(conversationText);
|
|
113
|
+
if (raw === null)
|
|
114
|
+
return [];
|
|
115
|
+
const events = this.mapToEvents(raw, memoryIdsByTurnId);
|
|
116
|
+
if (events.length > 0) {
|
|
117
|
+
await this.repo.store(userId, sourceSite, events);
|
|
118
|
+
}
|
|
119
|
+
return events;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Run the extraction LLM call; return parsed array or null on failure.
|
|
123
|
+
*
|
|
124
|
+
* Fail-open by design: a flaky upstream LLM call should not crash the
|
|
125
|
+
* caller's `extractAndStore` invocation; the EO read path treats a
|
|
126
|
+
* missing first-mention list as "no signal" rather than a hard
|
|
127
|
+
* failure. The deliberate fallback is a structured
|
|
128
|
+
* `[first-mention-llm-failed]` log line plus null return so the
|
|
129
|
+
* failure is observable.
|
|
130
|
+
*/
|
|
131
|
+
async invokeLlm(conversationText) {
|
|
132
|
+
let rawText = '';
|
|
133
|
+
try {
|
|
134
|
+
const res = await this.chatFn(FIRST_MENTIONS_SYSTEM, buildFirstMentionsUser(conversationText), FIRST_MENTIONS_MAX_TOKENS);
|
|
135
|
+
rawText = res.text;
|
|
136
|
+
return extractJsonArray(rawText);
|
|
137
|
+
}
|
|
138
|
+
catch (err) {
|
|
139
|
+
const msg = err instanceof Error ? err.message.slice(0, 200) : String(err);
|
|
140
|
+
console.error(`[first-mention-llm-failed] ${msg}`);
|
|
141
|
+
if (rawText) {
|
|
142
|
+
console.error(`[first-mention-llm-failed] raw response (first 500 chars): ${rawText.slice(0, 500).replace(/\n/g, ' ')}`);
|
|
143
|
+
}
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Map LLM output records onto core's `FirstMentionEvent` shape.
|
|
149
|
+
*
|
|
150
|
+
* `positionInConversation` is the 0-based index in the FINAL turn-id-
|
|
151
|
+
* sorted output, NOT `turn_id` itself. This makes the mapping stable
|
|
152
|
+
* across re-runs even when the LLM emits a slightly different
|
|
153
|
+
* `turn_id` for the same logical topic on a second pass — the
|
|
154
|
+
* `(user_id, memory_id)` UNIQUE constraint in `first_mention_events`
|
|
155
|
+
* skips the duplicate insert, but if `position_in_conversation`
|
|
156
|
+
* tracked `turn_id` directly, an unrelated drift in the second run's
|
|
157
|
+
* turn assignment would mean callers reading the row see whichever
|
|
158
|
+
* turn_id was first written. Encoding position by post-sort index
|
|
159
|
+
* eliminates that variability — read-side ordering is now a stable
|
|
160
|
+
* sequence (0, 1, 2, ...) regardless of which LLM run produced it.
|
|
161
|
+
*/
|
|
162
|
+
mapToEvents(raw, memoryIdsByTurnId) {
|
|
163
|
+
const filtered = raw.filter(isRawFirstMention);
|
|
164
|
+
const candidates = [];
|
|
165
|
+
for (const m of filtered) {
|
|
166
|
+
const memoryId = memoryIdsByTurnId.get(m.turn_id);
|
|
167
|
+
if (!memoryId)
|
|
168
|
+
continue;
|
|
169
|
+
candidates.push({
|
|
170
|
+
topic: m.topic,
|
|
171
|
+
turnId: m.turn_id,
|
|
172
|
+
memoryId,
|
|
173
|
+
anchorDate: parseAnchorDate(m.anchor_date),
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
candidates.sort((a, b) => a.turnId - b.turnId);
|
|
177
|
+
const events = candidates.map((c, index) => ({
|
|
178
|
+
...c,
|
|
179
|
+
positionInConversation: index,
|
|
180
|
+
}));
|
|
181
|
+
if (events.length === 0 && filtered.length > 0) {
|
|
182
|
+
console.warn(`[first-mention-mapping] ${filtered.length} parsed entries had no matching memory_id`);
|
|
183
|
+
}
|
|
184
|
+
return events;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hierarchical retrieval — the 5th RRF arm (T2.3 scaffold).
|
|
3
|
+
*
|
|
4
|
+
* Three-stage pipeline for BEAM-10M scale:
|
|
5
|
+
* stage 1: top-K conv_summaries by query-embedding cosine
|
|
6
|
+
* stage 2: top-K session_summaries within those conversations
|
|
7
|
+
* stage 3: expand to atomic-fact ids (memories.id) for the matched sessions
|
|
8
|
+
*
|
|
9
|
+
* Output ids are handed to the existing search-pipeline's RRF fusion as a 5th
|
|
10
|
+
* arm. Full pipeline integration lives in T2.4 (memory-search.ts wiring); this
|
|
11
|
+
* module exposes the arm as a stand-alone callable so it can be tested
|
|
12
|
+
* independently and unit-mocked.
|
|
13
|
+
*
|
|
14
|
+
* Gated by `hierarchicalRetrievalEnabled`. With the flag off, the function
|
|
15
|
+
* short-circuits and returns an empty result with zero work done — preserves
|
|
16
|
+
* byte-for-byte behavior on existing deployments.
|
|
17
|
+
*/
|
|
18
|
+
import type { SummariesRepository } from '../db/summaries-repository.js';
|
|
19
|
+
/** Result of one hierarchical retrieval pass. */
|
|
20
|
+
export interface HierarchicalArmResult {
|
|
21
|
+
/** Atomic memory ids surfaced by the arm. Empty when flag off / no data. */
|
|
22
|
+
memoryIds: string[];
|
|
23
|
+
/** Conversation ids matched at stage 1 (for trace observability). */
|
|
24
|
+
matchedConvs: string[];
|
|
25
|
+
/** Session ids matched at stage 2 (for trace observability). */
|
|
26
|
+
matchedSessions: string[];
|
|
27
|
+
/** LLM cost incurred by this arm. Always 0 today — only embedding ops. */
|
|
28
|
+
cost: number;
|
|
29
|
+
}
|
|
30
|
+
export interface HierarchicalArmDeps {
|
|
31
|
+
config: {
|
|
32
|
+
hierarchicalRetrievalEnabled: boolean;
|
|
33
|
+
};
|
|
34
|
+
summariesRepo: SummariesRepository;
|
|
35
|
+
}
|
|
36
|
+
export interface HierarchicalArmOptions {
|
|
37
|
+
/** Stage 1: how many conversations to surface. Default 3. */
|
|
38
|
+
topConvs?: number;
|
|
39
|
+
/** Stage 2: how many sessions to surface across selected convs. Default 10. */
|
|
40
|
+
topSessions?: number;
|
|
41
|
+
/** Stage 3: how many atomic facts to return. Default 50. */
|
|
42
|
+
factLimit?: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Run the hierarchical arm. Caller is responsible for embedding the query
|
|
46
|
+
* (we keep this function pure — it doesn't call an embedding provider so
|
|
47
|
+
* tests don't need to mock one).
|
|
48
|
+
*/
|
|
49
|
+
export declare function runHierarchicalArm(deps: HierarchicalArmDeps, userId: string, queryEmbedding: number[], opts?: HierarchicalArmOptions): Promise<HierarchicalArmResult>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hierarchical retrieval — the 5th RRF arm (T2.3 scaffold).
|
|
3
|
+
*
|
|
4
|
+
* Three-stage pipeline for BEAM-10M scale:
|
|
5
|
+
* stage 1: top-K conv_summaries by query-embedding cosine
|
|
6
|
+
* stage 2: top-K session_summaries within those conversations
|
|
7
|
+
* stage 3: expand to atomic-fact ids (memories.id) for the matched sessions
|
|
8
|
+
*
|
|
9
|
+
* Output ids are handed to the existing search-pipeline's RRF fusion as a 5th
|
|
10
|
+
* arm. Full pipeline integration lives in T2.4 (memory-search.ts wiring); this
|
|
11
|
+
* module exposes the arm as a stand-alone callable so it can be tested
|
|
12
|
+
* independently and unit-mocked.
|
|
13
|
+
*
|
|
14
|
+
* Gated by `hierarchicalRetrievalEnabled`. With the flag off, the function
|
|
15
|
+
* short-circuits and returns an empty result with zero work done — preserves
|
|
16
|
+
* byte-for-byte behavior on existing deployments.
|
|
17
|
+
*/
|
|
18
|
+
const EMPTY = {
|
|
19
|
+
memoryIds: [],
|
|
20
|
+
matchedConvs: [],
|
|
21
|
+
matchedSessions: [],
|
|
22
|
+
cost: 0,
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Run the hierarchical arm. Caller is responsible for embedding the query
|
|
26
|
+
* (we keep this function pure — it doesn't call an embedding provider so
|
|
27
|
+
* tests don't need to mock one).
|
|
28
|
+
*/
|
|
29
|
+
export async function runHierarchicalArm(deps, userId, queryEmbedding, opts = {}) {
|
|
30
|
+
if (!deps.config.hierarchicalRetrievalEnabled) {
|
|
31
|
+
return EMPTY;
|
|
32
|
+
}
|
|
33
|
+
const topConvs = opts.topConvs ?? 3;
|
|
34
|
+
const topSessions = opts.topSessions ?? 10;
|
|
35
|
+
const factLimit = opts.factLimit ?? 50;
|
|
36
|
+
// Stage 1
|
|
37
|
+
const convHits = await deps.summariesRepo.searchTopConvSummaries(userId, queryEmbedding, topConvs);
|
|
38
|
+
if (convHits.length === 0)
|
|
39
|
+
return EMPTY;
|
|
40
|
+
// Stage 2
|
|
41
|
+
const matchedConvs = convHits.map((h) => h.conversationId);
|
|
42
|
+
const sessionHits = await deps.summariesRepo.searchTopSessionSummaries(userId, matchedConvs, queryEmbedding, topSessions);
|
|
43
|
+
if (sessionHits.length === 0) {
|
|
44
|
+
return { memoryIds: [], matchedConvs, matchedSessions: [], cost: 0 };
|
|
45
|
+
}
|
|
46
|
+
// Stage 3
|
|
47
|
+
const matchedSessions = sessionHits.map((h) => h.sessionId);
|
|
48
|
+
const memoryIds = await deps.summariesRepo.getMemoryIdsForSessions(userId, matchedSessions, factLimit);
|
|
49
|
+
return { memoryIds, matchedConvs, matchedSessions, cost: 0 };
|
|
50
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-fact ingest pipeline: embed, gate, find candidates, decide, store.
|
|
3
|
+
*
|
|
4
|
+
* Unifies the three per-fact paths (full, quick, workspace) behind a single
|
|
5
|
+
* parameterized function. Each path is a different combination of options
|
|
6
|
+
* rather than a separate code path.
|
|
7
|
+
*/
|
|
8
|
+
import type { WorkspaceContext } from '../db/repository-types.js';
|
|
9
|
+
import type { EntropyContext, FactInput, FactResult, IngestFactTrace, MemoryServiceDeps } from './memory-service-types.js';
|
|
10
|
+
/** Controls which stages of the per-fact pipeline are active. */
|
|
11
|
+
export interface FactPipelineOptions {
|
|
12
|
+
/** When set, scopes candidate finding and storage to this workspace. */
|
|
13
|
+
workspace?: WorkspaceContext;
|
|
14
|
+
/** Run the entropy gate before candidate search (off for quick-ingest). */
|
|
15
|
+
entropyGate: boolean;
|
|
16
|
+
/** Run the full AUDN path (fast + deferred + LLM). When false, uses quick duplicate threshold only. */
|
|
17
|
+
fullAudn: boolean;
|
|
18
|
+
/** Mutable set of superseded target IDs, shared across a batch. */
|
|
19
|
+
supersededTargets: Set<string>;
|
|
20
|
+
/** Mutable entropy context, shared across a batch. */
|
|
21
|
+
entropyCtx: EntropyContext;
|
|
22
|
+
/** Optional logical timestamp for backdating. */
|
|
23
|
+
logicalTimestamp?: Date;
|
|
24
|
+
/** Timing label prefix for timed() wrappers. */
|
|
25
|
+
timingPrefix: string;
|
|
26
|
+
/** Optional per-request trace collector. */
|
|
27
|
+
traceCollector?: {
|
|
28
|
+
record(trace: IngestFactTrace): void;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** Process a single extracted fact through the ingest pipeline. */
|
|
32
|
+
export declare function processFactThroughPipeline(deps: MemoryServiceDeps, userId: string, fact: FactInput, sourceSite: string, sourceUrl: string, episodeId: string, options: FactPipelineOptions): Promise<FactResult>;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-fact ingest pipeline: embed, gate, find candidates, decide, store.
|
|
3
|
+
*
|
|
4
|
+
* Unifies the three per-fact paths (full, quick, workspace) behind a single
|
|
5
|
+
* parameterized function. Each path is a different combination of options
|
|
6
|
+
* rather than a separate code path.
|
|
7
|
+
*/
|
|
8
|
+
import { embedText } from './embedding.js';
|
|
9
|
+
import { mergeCandidates } from './conflict-policy.js';
|
|
10
|
+
import { computeEntropyScore } from './entropy-gate.js';
|
|
11
|
+
import { assessWriteSecurity, recordRejectedWrite } from './write-security.js';
|
|
12
|
+
import { previewContent } from './ingest-trace.js';
|
|
13
|
+
import { timed } from './timing.js';
|
|
14
|
+
import { storeCanonicalFact, resolveDeterministicClaimSlot, findSlotConflictCandidates } from './memory-storage.js';
|
|
15
|
+
import { findFilteredCandidates, resolveAndExecuteAudn } from './memory-audn.js';
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Main pipeline function
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
/** Process a single extracted fact through the ingest pipeline. */
|
|
20
|
+
export async function processFactThroughPipeline(deps, userId, fact, sourceSite, sourceUrl, episodeId, options) {
|
|
21
|
+
if (options.workspace) {
|
|
22
|
+
return processWorkspaceFact(deps, userId, fact, sourceSite, sourceUrl, episodeId, options);
|
|
23
|
+
}
|
|
24
|
+
if (options.fullAudn) {
|
|
25
|
+
return processFullAudnFact(deps, userId, fact, sourceSite, sourceUrl, episodeId, options);
|
|
26
|
+
}
|
|
27
|
+
return processQuickFact(deps, userId, fact, sourceSite, sourceUrl, episodeId, options);
|
|
28
|
+
}
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
// Full AUDN path (performIngest)
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
async function processFullAudnFact(deps, userId, fact, sourceSite, sourceUrl, episodeId, options) {
|
|
33
|
+
const embedding = await timed(`${options.timingPrefix}.fact.embed`, () => embedText(fact.fact));
|
|
34
|
+
const writeSecurity = assessWriteSecurity(fact.fact, sourceSite, deps.config);
|
|
35
|
+
if (!writeSecurity.allowed) {
|
|
36
|
+
await recordRejectedWrite(userId, fact.fact, sourceSite, writeSecurity, deps.config, deps.stores.lesson);
|
|
37
|
+
return blockedResult(options, fact, writeSecurity, undefined, blockedReasonCode(writeSecurity.blockedBy));
|
|
38
|
+
}
|
|
39
|
+
const entropyResult = options.entropyGate
|
|
40
|
+
? assessEntropyGate(fact, embedding, options.entropyCtx, deps.config)
|
|
41
|
+
: null;
|
|
42
|
+
if (entropyResult && !entropyResult.accepted) {
|
|
43
|
+
return blockedResult(options, fact, writeSecurity, entropyResult, 'entropy-gate');
|
|
44
|
+
}
|
|
45
|
+
const claimSlot = await resolveDeterministicClaimSlot(deps, userId, fact);
|
|
46
|
+
const filteredCandidates = await findFilteredCandidates(deps, userId, fact, embedding, claimSlot, options.supersededTargets);
|
|
47
|
+
const candidates = toTraceCandidates(filteredCandidates);
|
|
48
|
+
const ctx = {
|
|
49
|
+
userId, fact, embedding, sourceSite, sourceUrl, episodeId,
|
|
50
|
+
trustScore: writeSecurity.trust.score, claimSlot, logicalTimestamp: options.logicalTimestamp,
|
|
51
|
+
};
|
|
52
|
+
if (filteredCandidates.length === 0) {
|
|
53
|
+
const result = await storeCanonicalFact(deps, ctx);
|
|
54
|
+
return storedDirectResult(options, result, embedding, fact, writeSecurity, candidates, entropyResult, 'direct-store-no-candidates');
|
|
55
|
+
}
|
|
56
|
+
return tracedResult(options, await resolveAndExecuteAudn(deps, userId, fact, embedding, sourceSite, sourceUrl, episodeId, writeSecurity.trust.score, claimSlot, options.logicalTimestamp, filteredCandidates, options.supersededTargets, undefined, {
|
|
57
|
+
fact,
|
|
58
|
+
logicalTimestamp: options.logicalTimestamp,
|
|
59
|
+
writeSecurity,
|
|
60
|
+
entropyResult,
|
|
61
|
+
candidates,
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
// Quick path (performQuickIngest)
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
async function processQuickFact(deps, userId, fact, sourceSite, sourceUrl, episodeId, options) {
|
|
68
|
+
const embedding = await timed(`${options.timingPrefix}.fact.embed`, () => embedText(fact.fact));
|
|
69
|
+
const writeSecurity = assessWriteSecurity(fact.fact, sourceSite, deps.config);
|
|
70
|
+
if (!writeSecurity.allowed) {
|
|
71
|
+
return blockedResult(options, fact, writeSecurity, undefined, blockedReasonCode(writeSecurity.blockedBy));
|
|
72
|
+
}
|
|
73
|
+
const claimSlot = await resolveDeterministicClaimSlot(deps, userId, fact);
|
|
74
|
+
const [vectorCandidates, slotCandidates] = await timed(`${options.timingPrefix}.fact.find-dupes`, async () => Promise.all([
|
|
75
|
+
deps.stores.search.findNearDuplicates(userId, embedding, deps.config.audnCandidateThreshold),
|
|
76
|
+
findSlotConflictCandidates(deps, userId, claimSlot),
|
|
77
|
+
]));
|
|
78
|
+
const candidates = mergeCandidates(vectorCandidates, slotCandidates);
|
|
79
|
+
const traceCandidates = toTraceCandidates(candidates);
|
|
80
|
+
if (candidates.length > 0) {
|
|
81
|
+
const topCandidate = candidates.reduce((a, b) => a.similarity > b.similarity ? a : b);
|
|
82
|
+
if (topCandidate.similarity >= deps.config.fastAudnDuplicateThreshold) {
|
|
83
|
+
return tracedResult(options, {
|
|
84
|
+
outcome: 'skipped',
|
|
85
|
+
memoryId: topCandidate.id,
|
|
86
|
+
trace: buildFactTrace(fact, options.logicalTimestamp, {
|
|
87
|
+
writeSecurity,
|
|
88
|
+
candidates: traceCandidates,
|
|
89
|
+
decision: makeDecision('quick-dedup', 'NOOP', 'quick-duplicate-noop', topCandidate.id, ['raw-near-duplicate']),
|
|
90
|
+
}, 'skipped', topCandidate.id),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const ctx = { userId, fact, embedding, sourceSite, sourceUrl, episodeId, trustScore: writeSecurity.trust.score, claimSlot, logicalTimestamp: options.logicalTimestamp };
|
|
95
|
+
const result = await storeCanonicalFact(deps, ctx);
|
|
96
|
+
return storedDirectResult(options, result, embedding, fact, writeSecurity, traceCandidates, undefined, 'direct-store-no-candidates');
|
|
97
|
+
}
|
|
98
|
+
// ---------------------------------------------------------------------------
|
|
99
|
+
// Workspace path (performWorkspaceIngest)
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
async function processWorkspaceFact(deps, userId, fact, sourceSite, sourceUrl, episodeId, options) {
|
|
102
|
+
const embedding = await timed(`${options.timingPrefix}.fact.embed`, () => embedText(fact.fact));
|
|
103
|
+
const writeSecurity = assessWriteSecurity(fact.fact, sourceSite, deps.config);
|
|
104
|
+
if (!writeSecurity.allowed) {
|
|
105
|
+
await recordRejectedWrite(userId, fact.fact, sourceSite, writeSecurity, deps.config);
|
|
106
|
+
return blockedResult(options, fact, writeSecurity, undefined, blockedReasonCode(writeSecurity.blockedBy));
|
|
107
|
+
}
|
|
108
|
+
const candidates = await deps.stores.search.findNearDuplicatesInWorkspace(options.workspace.workspaceId, embedding, deps.config.audnCandidateThreshold, 10, 'all', options.workspace.agentId);
|
|
109
|
+
const traceCandidates = toTraceCandidates(candidates);
|
|
110
|
+
const ctx = {
|
|
111
|
+
userId, fact, embedding, sourceSite, sourceUrl, episodeId,
|
|
112
|
+
trustScore: writeSecurity.trust.score, workspace: options.workspace,
|
|
113
|
+
};
|
|
114
|
+
if (candidates.length === 0) {
|
|
115
|
+
const result = await storeCanonicalFact(deps, ctx);
|
|
116
|
+
return storedDirectResult(options, result, embedding, fact, writeSecurity, traceCandidates, undefined, 'workspace-direct-store');
|
|
117
|
+
}
|
|
118
|
+
return tracedResult(options, await resolveAndExecuteAudn(deps, userId, fact, embedding, sourceSite, sourceUrl, episodeId, writeSecurity.trust.score, null, undefined, candidates.map((c) => ({ ...c, content: c.content ?? '' })), options.supersededTargets, options.workspace, {
|
|
119
|
+
fact,
|
|
120
|
+
logicalTimestamp: options.logicalTimestamp,
|
|
121
|
+
writeSecurity,
|
|
122
|
+
candidates: traceCandidates,
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
// ---------------------------------------------------------------------------
|
|
126
|
+
// Helpers
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
/** Check entropy gate; returns false if the fact should be skipped. */
|
|
129
|
+
function assessEntropyGate(fact, embedding, entropyCtx, runtimeConfig) {
|
|
130
|
+
if (!runtimeConfig.entropyGateEnabled)
|
|
131
|
+
return null;
|
|
132
|
+
const entropyResult = computeEntropyScore({
|
|
133
|
+
windowEntities: fact.keywords,
|
|
134
|
+
existingEntities: entropyCtx.seenEntities,
|
|
135
|
+
windowEmbedding: embedding,
|
|
136
|
+
previousEmbedding: entropyCtx.previousEmbedding,
|
|
137
|
+
}, { threshold: runtimeConfig.entropyGateThreshold, alpha: runtimeConfig.entropyGateAlpha });
|
|
138
|
+
entropyCtx.previousEmbedding = embedding;
|
|
139
|
+
for (const kw of fact.keywords)
|
|
140
|
+
entropyCtx.seenEntities.add(kw);
|
|
141
|
+
return entropyResult;
|
|
142
|
+
}
|
|
143
|
+
function buildFactTrace(fact, logicalTimestamp, details, outcome, memoryId) {
|
|
144
|
+
return {
|
|
145
|
+
factText: fact.fact,
|
|
146
|
+
headline: fact.headline,
|
|
147
|
+
factType: fact.type,
|
|
148
|
+
importance: fact.importance,
|
|
149
|
+
...(logicalTimestamp ? { logicalTimestamp: logicalTimestamp.toISOString() } : {}),
|
|
150
|
+
...(details.writeSecurity ? {
|
|
151
|
+
writeSecurity: {
|
|
152
|
+
allowed: details.writeSecurity.allowed,
|
|
153
|
+
blockedBy: details.writeSecurity.blockedBy,
|
|
154
|
+
trustScore: details.writeSecurity.trust.score,
|
|
155
|
+
},
|
|
156
|
+
} : {}),
|
|
157
|
+
...(details.entropyGate ? { entropyGate: details.entropyGate } : {}),
|
|
158
|
+
...(details.candidates ? { candidates: details.candidates } : {}),
|
|
159
|
+
decision: details.decision,
|
|
160
|
+
outcome,
|
|
161
|
+
memoryId,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function makeDecision(source, action, reasonCode, targetMemoryId, rawAction) {
|
|
165
|
+
return {
|
|
166
|
+
source,
|
|
167
|
+
action,
|
|
168
|
+
reasonCode,
|
|
169
|
+
targetMemoryId,
|
|
170
|
+
...(rawAction?.[0] ? { rawAction: rawAction[0] } : {}),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function toTraceCandidates(candidates) {
|
|
174
|
+
return candidates.map((candidate) => ({
|
|
175
|
+
id: candidate.id,
|
|
176
|
+
similarity: Math.round(candidate.similarity * 10000) / 10000,
|
|
177
|
+
contentPreview: previewContent(candidate.content),
|
|
178
|
+
}));
|
|
179
|
+
}
|
|
180
|
+
function blockedReasonCode(blockedBy) {
|
|
181
|
+
return blockedBy === 'sanitization'
|
|
182
|
+
? 'write-security-sanitization'
|
|
183
|
+
: 'write-security-trust';
|
|
184
|
+
}
|
|
185
|
+
function tracedResult(options, result) {
|
|
186
|
+
if (result.trace)
|
|
187
|
+
options.traceCollector?.record(result.trace);
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
function blockedResult(options, fact, writeSecurity, entropyResult, reasonCode) {
|
|
191
|
+
return tracedResult(options, {
|
|
192
|
+
outcome: 'skipped',
|
|
193
|
+
memoryId: null,
|
|
194
|
+
trace: buildFactTrace(fact, options.logicalTimestamp, {
|
|
195
|
+
writeSecurity,
|
|
196
|
+
entropyGate: entropyResult,
|
|
197
|
+
decision: makeDecision(reasonCode === 'entropy-gate' ? 'entropy-gate' : 'write-security', 'SKIP', reasonCode, null),
|
|
198
|
+
}, 'skipped', null),
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
function storedDirectResult(options, result, embedding, fact, writeSecurity, candidates, entropyResult, reasonCode) {
|
|
202
|
+
return tracedResult(options, {
|
|
203
|
+
...result,
|
|
204
|
+
embedding,
|
|
205
|
+
trace: buildFactTrace(fact, options.logicalTimestamp, {
|
|
206
|
+
writeSecurity,
|
|
207
|
+
entropyGate: entropyResult,
|
|
208
|
+
candidates,
|
|
209
|
+
decision: makeDecision('direct-store', 'ADD', reasonCode, null),
|
|
210
|
+
}, result.outcome, result.memoryId),
|
|
211
|
+
});
|
|
212
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-write processors for the ingest pipeline.
|
|
3
|
+
*
|
|
4
|
+
* Runs after the per-fact loop completes: backdates memories to a session
|
|
5
|
+
* timestamp, generates inter-memory links, and clusters related facts
|
|
6
|
+
* into composite memories. Each processor is independently skippable via
|
|
7
|
+
* the batch context.
|
|
8
|
+
*
|
|
9
|
+
* Composite generation is full-ingest-only. The caller controls this via
|
|
10
|
+
* the `compositesEnabled` field — only `performIngest` sets it to true.
|
|
11
|
+
*/
|
|
12
|
+
import type { FactInput, MemoryServiceDeps } from './memory-service-types.js';
|
|
13
|
+
/** Everything the post-write processors need from the completed fact loop. */
|
|
14
|
+
export interface PostWriteBatchContext {
|
|
15
|
+
episodeId: string;
|
|
16
|
+
sourceSite: string;
|
|
17
|
+
sourceUrl: string;
|
|
18
|
+
/** Facts that were actually stored (with their memoryIds). Only populated by performIngest. */
|
|
19
|
+
storedFacts: Array<{
|
|
20
|
+
memoryId: string;
|
|
21
|
+
fact: FactInput;
|
|
22
|
+
}>;
|
|
23
|
+
/** All memory IDs produced by the fact loop (stored + updated). */
|
|
24
|
+
memoryIds: string[];
|
|
25
|
+
/** Embedding cache keyed by memoryId, populated during the fact loop. */
|
|
26
|
+
embeddingCache: Map<string, number[]>;
|
|
27
|
+
/** When set, memories are backdated to this timestamp. */
|
|
28
|
+
sessionTimestamp?: Date;
|
|
29
|
+
/** Caller controls this. Only performIngest sets true. */
|
|
30
|
+
compositesEnabled: boolean;
|
|
31
|
+
/** Timing label prefix for timed() wrappers. */
|
|
32
|
+
timingPrefix: string;
|
|
33
|
+
/**
|
|
34
|
+
* Original conversation chunk text. Required when topicAbstractionEnabled
|
|
35
|
+
* is true; the topic-abstraction processor extracts a conceptual topic from
|
|
36
|
+
* the full chunk (one LLM call per chunk, not per fact) and tags every
|
|
37
|
+
* stored memory from this chunk with the same topic + topic_embedding.
|
|
38
|
+
*/
|
|
39
|
+
chunkText?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface PostWriteResult {
|
|
42
|
+
linksCreated: number;
|
|
43
|
+
compositesCreated: number;
|
|
44
|
+
topicAbstractionApplied: boolean;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Run all post-write processors for a completed ingest batch.
|
|
48
|
+
* Order: backdate → links → composites (if caller-enabled).
|
|
49
|
+
*/
|
|
50
|
+
export declare function runPostWriteProcessors(deps: MemoryServiceDeps, userId: string, ctx: PostWriteBatchContext): Promise<PostWriteResult>;
|