@remnic/core 9.45.5 → 9.46.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/dist/access-admin-ops-surface.d.ts +10 -10
- package/dist/access-admin-ops-surface.js +24 -24
- package/dist/access-authorization-probe.d.ts +10 -10
- package/dist/access-authorization-probe.js +25 -25
- package/dist/access-boundary.d.ts +10 -10
- package/dist/access-boundary.js +24 -24
- package/dist/access-cli.js +73 -71
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.d.ts +1 -1
- package/dist/access-extraction-force-flush.d.ts +10 -10
- package/dist/access-extraction-force-flush.js +24 -24
- package/dist/access-health-types.d.ts +1 -1
- package/dist/access-http-lcm-compaction.d.ts +10 -10
- package/dist/access-http-lifecycle-flush.d.ts +10 -10
- package/dist/access-http-offline-stream.d.ts +10 -10
- package/dist/access-http-query.js +24 -24
- package/dist/access-http.d.ts +10 -10
- package/dist/access-http.js +31 -31
- package/dist/access-identity-continuity-surface.d.ts +8 -8
- package/dist/access-identity-continuity-surface.js +24 -24
- package/dist/access-lcm-surface.d.ts +10 -10
- package/dist/access-lcm-surface.js +24 -24
- package/dist/access-mcp.d.ts +10 -10
- package/dist/access-mcp.js +28 -28
- package/dist/access-memory-search-fanout.d.ts +2 -2
- package/dist/{access-namespace-preflight-CWUDwB4M.d.ts → access-namespace-preflight--H6HwN85.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +3 -3
- package/dist/access-namespace-preflight.js +24 -24
- package/dist/access-observe-write-surface.d.ts +10 -10
- package/dist/access-observe-write-surface.js +24 -24
- package/dist/access-offline-manifest.d.ts +8 -8
- package/dist/access-operations-batch.js +25 -25
- package/dist/access-operations.d.ts +10 -10
- package/dist/access-operations.js +27 -27
- package/dist/access-recall-concurrency.d.ts +10 -10
- package/dist/access-recall-concurrency.js +24 -24
- package/dist/access-recall-response.d.ts +10 -10
- package/dist/access-recall-response.js +24 -24
- package/dist/access-recall-surface.d.ts +10 -10
- package/dist/access-recall-surface.js +24 -24
- package/dist/access-service-helpers.d.ts +10 -10
- package/dist/{access-service-CNN89xyn.d.ts → access-service-loJadYd7.d.ts} +7 -7
- package/dist/access-service.d.ts +10 -10
- package/dist/access-service.js +24 -24
- package/dist/access-surface-catalog.d.ts +10 -10
- package/dist/access-wearables-meetings-surface.d.ts +3 -3
- package/dist/action-confidence.d.ts +1 -1
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-recall.d.ts +1 -1
- package/dist/ambient-provenance.d.ts +109 -0
- package/dist/ambient-provenance.js +22 -0
- package/dist/ambient-provenance.js.map +1 -0
- package/dist/{auto-sync-UPTUVE4X.js → auto-sync-7O6RP2RT.js} +3 -2
- package/dist/{auto-sync-UPTUVE4X.js.map → auto-sync-7O6RP2RT.js.map} +1 -1
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +8 -8
- package/dist/briefing.d.ts +2 -2
- package/dist/briefing.js +5 -5
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer-turn-helpers.d.ts +1 -1
- package/dist/buffer-turn-helpers.js +1 -1
- package/dist/buffer.d.ts +2 -2
- package/dist/buffer.js +2 -2
- package/dist/bulk-import/index.d.ts +3 -3
- package/dist/calibration.d.ts +1 -1
- package/dist/capabilities.d.ts +1 -1
- package/dist/{catalog-bctMURhN.d.ts → catalog-Iwbk9h5E.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +6 -6
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/{chunk-LEPOP46W.js → chunk-227UFSEQ.js} +4 -4
- package/dist/{chunk-ER7W6H4T.js → chunk-2AD5SXO4.js} +5 -2
- package/dist/chunk-2AD5SXO4.js.map +1 -0
- package/dist/{chunk-CX4ZUMC6.js → chunk-2DSUT7DZ.js} +9 -9
- package/dist/{chunk-DZPFMQZ7.js → chunk-3S63QIFQ.js} +1 -1
- package/dist/chunk-3S63QIFQ.js.map +1 -0
- package/dist/{chunk-DAJPRXBR.js → chunk-47J4EDGR.js} +5 -5
- package/dist/{chunk-QVJPH7SH.js → chunk-5LRDM4R7.js} +40 -40
- package/dist/{chunk-XAGYS7X6.js → chunk-5R6S4DJZ.js} +7 -7
- package/dist/{chunk-QR6G5KF4.js → chunk-5VQPZ4GV.js} +3 -3
- package/dist/{chunk-E5XQIWAL.js → chunk-64BHFFKZ.js} +2 -2
- package/dist/{chunk-GRUYA45P.js → chunk-6H744ZBH.js} +3 -3
- package/dist/{chunk-6ISC4AVB.js → chunk-BDNL34CT.js} +2 -2
- package/dist/{chunk-GQL52GQ5.js → chunk-CDKHKZL5.js} +15 -12
- package/dist/chunk-CDKHKZL5.js.map +1 -0
- package/dist/{chunk-AC5OWJLV.js → chunk-E4FOAENZ.js} +4 -4
- package/dist/{chunk-UW66OZTD.js → chunk-FULKGK7P.js} +2 -2
- package/dist/{chunk-V2TNYF6Q.js → chunk-HJ3SVHUW.js} +3 -3
- package/dist/{chunk-A4IJCD2Z.js → chunk-HXXTXLKA.js} +2 -2
- package/dist/{chunk-FUCYDRE5.js → chunk-IDE5AR5W.js} +11 -11
- package/dist/{chunk-2FSTB6BJ.js → chunk-ILBLZ5Y5.js} +2 -2
- package/dist/chunk-J7T4MX7P.js +131 -0
- package/dist/chunk-J7T4MX7P.js.map +1 -0
- package/dist/{chunk-WZ3TOIDW.js → chunk-JFO5QZ7N.js} +2 -2
- package/dist/{chunk-FR27HBBA.js → chunk-KA47C7BF.js} +2 -2
- package/dist/{chunk-JZH4LWHB.js → chunk-KMWYZTIE.js} +2 -2
- package/dist/{chunk-LPYDOLSM.js → chunk-L7G72WY4.js} +2 -2
- package/dist/{chunk-AMAUBUKY.js → chunk-LI7OE7G6.js} +2 -2
- package/dist/{chunk-MO4HSXHZ.js → chunk-M2INOSTA.js} +2 -2
- package/dist/{chunk-GODSPTOT.js → chunk-M32URQXV.js} +652 -601
- package/dist/chunk-M32URQXV.js.map +1 -0
- package/dist/{chunk-HFPASSFV.js → chunk-P2OTGMTR.js} +2 -2
- package/dist/{chunk-W2V7UESE.js → chunk-PFJXPOD4.js} +2 -2
- package/dist/{chunk-R3KHKU7M.js → chunk-PKCLQ7KM.js} +43 -143
- package/dist/chunk-PKCLQ7KM.js.map +1 -0
- package/dist/chunk-QW27DOHG.js +84 -0
- package/dist/chunk-QW27DOHG.js.map +1 -0
- package/dist/{chunk-QUENPGWZ.js → chunk-RCU25Z66.js} +24 -24
- package/dist/{chunk-QUENPGWZ.js.map → chunk-RCU25Z66.js.map} +1 -1
- package/dist/{chunk-NEF7LR5J.js → chunk-RVPTS4U5.js} +2 -2
- package/dist/{chunk-W3IC7QOY.js → chunk-RVYVMQK4.js} +3 -3
- package/dist/{chunk-GUAL4PQH.js → chunk-ST5IEK3H.js} +2 -2
- package/dist/{chunk-O4KMGRXE.js → chunk-SXWHN7GC.js} +2 -2
- package/dist/{chunk-RNHVVMFN.js → chunk-T6JRMVOV.js} +2 -2
- package/dist/{chunk-5QJQHBLE.js → chunk-U6JGQ37L.js} +2 -2
- package/dist/{chunk-UV72DEZD.js → chunk-UYUYZ4WY.js} +36 -10
- package/dist/chunk-UYUYZ4WY.js.map +1 -0
- package/dist/{chunk-HC3PBX23.js → chunk-V5FE3UAI.js} +2 -2
- package/dist/{chunk-ERZ2R42X.js → chunk-W2ZSNIBP.js} +2 -2
- package/dist/{chunk-3COYXTGM.js → chunk-WHWDBTCJ.js} +2 -2
- package/dist/{chunk-FIK3CQNA.js → chunk-WOC6DXP5.js} +3 -3
- package/dist/{chunk-4FBVAGV3.js → chunk-XBMJ35IP.js} +2 -2
- package/dist/{chunk-GFCVUY6G.js → chunk-YWCOJOUI.js} +2 -2
- package/dist/{chunk-2X2T2UVE.js → chunk-ZDAYWJV6.js} +1 -1
- package/dist/chunk-ZDAYWJV6.js.map +1 -0
- package/dist/{cli-BHBswmUa.d.ts → cli-D_RcqXfZ.d.ts} +5 -5
- package/dist/cli.d.ts +12 -12
- package/dist/cli.js +50 -50
- package/dist/compat/checks.js +1 -1
- package/dist/compounding/engine.d.ts +2 -2
- package/dist/compounding/engine.js +5 -5
- package/dist/compounding/preference-consolidator.d.ts +1 -1
- package/dist/compression-optimizer.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +5 -5
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +5 -5
- package/dist/consolidation-provenance-check.d.ts +2 -2
- package/dist/consolidation-undo.d.ts +2 -2
- package/dist/contradiction/index.d.ts +2 -2
- package/dist/converge-config.d.ts +1 -1
- package/dist/convergence-refresh.d.ts +2 -2
- package/dist/convergence-refresh.js +7 -7
- package/dist/conversation-index/backend.d.ts +1 -1
- package/dist/conversation-index/backend.js +2 -2
- package/dist/conversation-index/chunker.d.ts +1 -1
- package/dist/conversation-index/faiss-adapter.d.ts +1 -1
- package/dist/conversation-index/indexer.d.ts +1 -1
- package/dist/conversation-index/search.d.ts +1 -1
- package/dist/corpus-watermark.d.ts +1 -1
- package/dist/corpus-watermark.js +13 -13
- package/dist/day-summary.d.ts +1 -1
- package/dist/delinearize.d.ts +1 -1
- package/dist/direct-answer-wiring.d.ts +1 -1
- package/dist/direct-answer.d.ts +1 -1
- package/dist/embedding-fallback.d.ts +1 -1
- package/dist/enrichment/index.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +2 -2
- package/dist/entity-retrieval.js +5 -5
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +8 -8
- package/dist/external-wiki-access.d.ts +10 -10
- package/dist/external-wiki-access.js +25 -25
- package/dist/external-wiki-collection-registration.d.ts +1 -1
- package/dist/external-wiki-collection.d.ts +1 -1
- package/dist/external-wiki-mcp-tools.d.ts +10 -10
- package/dist/extraction-error-classification.d.ts +1 -1
- package/dist/extraction-faithfulness.d.ts +1 -1
- package/dist/extraction-judge-telemetry.d.ts +1 -1
- package/dist/extraction-judge-training.d.ts +1 -1
- package/dist/extraction-judge.d.ts +1 -1
- package/dist/extraction-liveness.d.ts +1 -1
- package/dist/extraction-prompt.d.ts +36 -0
- package/dist/extraction-prompt.js +16 -0
- package/dist/extraction-prompt.js.map +1 -0
- package/dist/extraction-source-grounding-rules.d.ts +1 -1
- package/dist/extraction-source-grounding.d.ts +1 -1
- package/dist/extraction.d.ts +6 -14
- package/dist/extraction.js +9 -7
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/graph-dashboard-diff.d.ts +1 -1
- package/dist/graph-dashboard-key.d.ts +1 -1
- package/dist/graph-dashboard-parser.d.ts +1 -1
- package/dist/graph-edge-reinforcement.d.ts +1 -1
- package/dist/graph-snapshot.d.ts +1 -1
- package/dist/graph.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/importers/index.d.ts +1 -1
- package/dist/in-flight-reads.d.ts +1 -1
- package/dist/index.d.ts +23 -20
- package/dist/index.js +124 -122
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/tools.d.ts +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/local-llm.d.ts +1 -1
- package/dist/local-model-endpoint.d.ts +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +5 -5
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +5 -5
- package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-projection.js +6 -6
- package/dist/{maintenance-CoRikzIt.d.ts → maintenance-DQrL93Uu.d.ts} +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +10 -10
- package/dist/memory-action-policy.d.ts +1 -1
- package/dist/memory-cache.d.ts +1 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
- package/dist/memory-projection-store.d.ts +1 -1
- package/dist/memory-provenance.d.ts +1 -1
- package/dist/memory-snapshot.d.ts +1 -1
- package/dist/memory-worth-outcomes.d.ts +2 -2
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +3 -3
- package/dist/namespaces/migrate.js +12 -12
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/search.js +6 -6
- package/dist/namespaces/storage.d.ts +3 -3
- package/dist/namespaces/storage.js +5 -5
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/offline-sync-impression-drain.d.ts +1 -1
- package/dist/operator-doctor-corpus.d.ts +1 -1
- package/dist/operator-doctor-corpus.js +14 -14
- package/dist/operator-doctor-replica.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +3 -3
- package/dist/operator-toolkit.js +18 -18
- package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
- package/dist/orchestration/maintenance.d.ts +4 -4
- package/dist/orchestration/maintenance.js +10 -10
- package/dist/{orchestrator-BJeq7Pw1.d.ts → orchestrator-LPGegii3.d.ts} +8 -8
- package/dist/orchestrator.d.ts +8 -8
- package/dist/orchestrator.js +73 -71
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/{pipeline-CNjY4wk3.d.ts → pipeline-1h2GpiHP.d.ts} +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/proactive-contention.d.ts +1 -1
- package/dist/provenance.d.ts +1 -1
- package/dist/{qmd-C0UDZidt.d.ts → qmd-UdwoF71D.d.ts} +1 -1
- package/dist/qmd-preflight.d.ts +2 -2
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +2 -2
- package/dist/recall-concurrency-config.d.ts +1 -1
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +1 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-memory-map.d.ts +1 -1
- package/dist/recall-planner-llm.d.ts +1 -1
- package/dist/recall-state.d.ts +1 -1
- package/dist/recall-tag-filter.d.ts +1 -1
- package/dist/recall-timings.d.ts +1 -1
- package/dist/recall-xray-cli.d.ts +1 -1
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +1 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +1 -1
- package/dist/recall-xray.js +2 -2
- package/dist/reconcile/cursor.d.ts +1 -1
- package/dist/reconcile/manifest.d.ts +1 -1
- package/dist/reconcile/plan.d.ts +1 -1
- package/dist/replay/normalizers/chatgpt.d.ts +1 -1
- package/dist/replay/normalizers/claude.d.ts +1 -1
- package/dist/replay/normalizers/openclaw.d.ts +1 -1
- package/dist/replay/normalizers/shared.d.ts +1 -1
- package/dist/replay/runner.d.ts +1 -1
- package/dist/replay/types.d.ts +1 -1
- package/dist/replica-divergence.d.ts +1 -1
- package/dist/replica-peers-config.d.ts +1 -1
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/retrieval-agents.d.ts +2 -2
- package/dist/retrieval-tiers.d.ts +1 -1
- package/dist/routing/engine.d.ts +1 -1
- package/dist/routing/store.d.ts +1 -1
- package/dist/salvage-envelope.d.ts +1 -1
- package/dist/{scope-profiles-BJzp2F5A.d.ts → scope-profiles-APjhSe-w.d.ts} +1 -1
- package/dist/sdk-compat.js.map +1 -1
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/factory.js +5 -5
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +9 -9
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/port.d.ts +1 -1
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/{semantic-consolidation-D4KAZO2G.d.ts → semantic-consolidation-CrySDbk3.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +6 -6
- package/dist/semantic-rule-promotion.js +5 -5
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +5 -5
- package/dist/{service-DWC4tq7p.d.ts → service-DJ0LDyuN.d.ts} +2 -2
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- package/dist/shared-context/manager.d.ts +1 -1
- package/dist/signal.d.ts +1 -1
- package/dist/source-agent-qualifier.d.ts +4 -1
- package/dist/source-agent-qualifier.js +6 -6
- package/dist/{storage-DPGjB-8e.d.ts → storage-y340tYKb.d.ts} +1 -1
- package/dist/storage.d.ts +2 -2
- package/dist/storage.js +4 -4
- package/dist/summarizer.d.ts +1 -1
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/temporal-supersession.d.ts +2 -2
- package/dist/temporal-timeline-recall.d.ts +1 -1
- package/dist/temporal-validity.d.ts +1 -1
- package/dist/threading.d.ts +1 -1
- package/dist/tier-migration.d.ts +2 -2
- package/dist/tier-routing.d.ts +1 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-yX_FwERf.d.ts → types-D_Au9qJO.d.ts} +13 -2
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.js +5 -5
- package/dist/write-envelope.d.ts +1 -1
- package/package.json +2 -12
- package/src/ambient-provenance.test.ts +510 -0
- package/src/ambient-provenance.ts +229 -0
- package/src/buffer-turn-helpers.ts +17 -1
- package/src/compat/checks.test.ts +45 -1
- package/src/compat/checks.ts +16 -16
- package/src/extraction-prompt.ts +142 -0
- package/src/extraction.ts +37 -148
- package/src/meetings/memory-gen.test.ts +51 -0
- package/src/meetings/memory-gen.ts +36 -8
- package/src/meetings/summary-extractor.ts +4 -2
- package/src/orchestration/recall-internal.ts +5 -148
- package/src/orchestration/recall-profile-storage.ts +194 -0
- package/src/orchestration/recall-search-pipeline.ts +13 -182
- package/src/orchestration/recall-search-prefilter.ts +254 -0
- package/src/orchestration/session-context.ts +1 -1
- package/src/orchestrator.ts +1 -1
- package/src/sdk-compat.ts +2 -4
- package/src/source-agent-qualifier.ts +3 -0
- package/src/testing/subjects/recall-profile-storage.test.ts +362 -0
- package/src/testing/subjects/recall-search-prefilter.test.ts +365 -0
- package/src/types.ts +2 -2
- package/src/wearables/memory-gen.test.ts +82 -0
- package/src/wearables/memory-gen.ts +54 -5
- package/src/wearables/trust.ts +19 -2
- package/dist/chunk-2X2T2UVE.js.map +0 -1
- package/dist/chunk-DZPFMQZ7.js.map +0 -1
- package/dist/chunk-ER7W6H4T.js.map +0 -1
- package/dist/chunk-GODSPTOT.js.map +0 -1
- package/dist/chunk-GQL52GQ5.js.map +0 -1
- package/dist/chunk-R3KHKU7M.js.map +0 -1
- package/dist/chunk-UV72DEZD.js.map +0 -1
- package/dist/legacy-hook-compat.d.ts +0 -3
- package/dist/legacy-hook-compat.js +0 -36
- package/dist/legacy-hook-compat.js.map +0 -1
- package/src/legacy-hook-compat.test.ts +0 -20
- package/src/legacy-hook-compat.ts +0 -45
- /package/dist/{chunk-LEPOP46W.js.map → chunk-227UFSEQ.js.map} +0 -0
- /package/dist/{chunk-CX4ZUMC6.js.map → chunk-2DSUT7DZ.js.map} +0 -0
- /package/dist/{chunk-DAJPRXBR.js.map → chunk-47J4EDGR.js.map} +0 -0
- /package/dist/{chunk-QVJPH7SH.js.map → chunk-5LRDM4R7.js.map} +0 -0
- /package/dist/{chunk-XAGYS7X6.js.map → chunk-5R6S4DJZ.js.map} +0 -0
- /package/dist/{chunk-QR6G5KF4.js.map → chunk-5VQPZ4GV.js.map} +0 -0
- /package/dist/{chunk-E5XQIWAL.js.map → chunk-64BHFFKZ.js.map} +0 -0
- /package/dist/{chunk-GRUYA45P.js.map → chunk-6H744ZBH.js.map} +0 -0
- /package/dist/{chunk-6ISC4AVB.js.map → chunk-BDNL34CT.js.map} +0 -0
- /package/dist/{chunk-AC5OWJLV.js.map → chunk-E4FOAENZ.js.map} +0 -0
- /package/dist/{chunk-UW66OZTD.js.map → chunk-FULKGK7P.js.map} +0 -0
- /package/dist/{chunk-V2TNYF6Q.js.map → chunk-HJ3SVHUW.js.map} +0 -0
- /package/dist/{chunk-A4IJCD2Z.js.map → chunk-HXXTXLKA.js.map} +0 -0
- /package/dist/{chunk-FUCYDRE5.js.map → chunk-IDE5AR5W.js.map} +0 -0
- /package/dist/{chunk-2FSTB6BJ.js.map → chunk-ILBLZ5Y5.js.map} +0 -0
- /package/dist/{chunk-WZ3TOIDW.js.map → chunk-JFO5QZ7N.js.map} +0 -0
- /package/dist/{chunk-FR27HBBA.js.map → chunk-KA47C7BF.js.map} +0 -0
- /package/dist/{chunk-JZH4LWHB.js.map → chunk-KMWYZTIE.js.map} +0 -0
- /package/dist/{chunk-LPYDOLSM.js.map → chunk-L7G72WY4.js.map} +0 -0
- /package/dist/{chunk-AMAUBUKY.js.map → chunk-LI7OE7G6.js.map} +0 -0
- /package/dist/{chunk-MO4HSXHZ.js.map → chunk-M2INOSTA.js.map} +0 -0
- /package/dist/{chunk-HFPASSFV.js.map → chunk-P2OTGMTR.js.map} +0 -0
- /package/dist/{chunk-W2V7UESE.js.map → chunk-PFJXPOD4.js.map} +0 -0
- /package/dist/{chunk-NEF7LR5J.js.map → chunk-RVPTS4U5.js.map} +0 -0
- /package/dist/{chunk-W3IC7QOY.js.map → chunk-RVYVMQK4.js.map} +0 -0
- /package/dist/{chunk-GUAL4PQH.js.map → chunk-ST5IEK3H.js.map} +0 -0
- /package/dist/{chunk-O4KMGRXE.js.map → chunk-SXWHN7GC.js.map} +0 -0
- /package/dist/{chunk-RNHVVMFN.js.map → chunk-T6JRMVOV.js.map} +0 -0
- /package/dist/{chunk-5QJQHBLE.js.map → chunk-U6JGQ37L.js.map} +0 -0
- /package/dist/{chunk-HC3PBX23.js.map → chunk-V5FE3UAI.js.map} +0 -0
- /package/dist/{chunk-ERZ2R42X.js.map → chunk-W2ZSNIBP.js.map} +0 -0
- /package/dist/{chunk-3COYXTGM.js.map → chunk-WHWDBTCJ.js.map} +0 -0
- /package/dist/{chunk-FIK3CQNA.js.map → chunk-WOC6DXP5.js.map} +0 -0
- /package/dist/{chunk-4FBVAGV3.js.map → chunk-XBMJ35IP.js.map} +0 -0
- /package/dist/{chunk-GFCVUY6G.js.map → chunk-YWCOJOUI.js.map} +0 -0
|
@@ -102,6 +102,7 @@ import {
|
|
|
102
102
|
type RecallResultPartitionSink,
|
|
103
103
|
} from "./recall-rerank-coordinator.js";
|
|
104
104
|
import type { RecallInternalDeps } from "./recall-internal-deps.js";
|
|
105
|
+
import { resolveCompositeProfileStorage } from "./recall-profile-storage.js";
|
|
105
106
|
|
|
106
107
|
export class RecallInternalCoordinator {
|
|
107
108
|
constructor(
|
|
@@ -686,154 +687,10 @@ export class RecallInternalCoordinator {
|
|
|
686
687
|
const profileStorages = await Promise.all(
|
|
687
688
|
profileStorageNamespaces.map((namespace) => this.deps.storageRouter.storageFor(namespace)),
|
|
688
689
|
);
|
|
689
|
-
const
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
if (prop in target) return target[prop];
|
|
694
|
-
if (prop === "readProfile") return async () => "";
|
|
695
|
-
if (
|
|
696
|
-
prop === "readQuestions" ||
|
|
697
|
-
prop === "listEntityNames" ||
|
|
698
|
-
prop === "readContinuityIncidents"
|
|
699
|
-
)
|
|
700
|
-
return async () => [];
|
|
701
|
-
if (
|
|
702
|
-
prop === "readIdentityAnchor" ||
|
|
703
|
-
prop === "readIdentityImprovementLoops"
|
|
704
|
-
)
|
|
705
|
-
return async () => "";
|
|
706
|
-
if (prop === "readEntity" || prop === "readMemoryByPath")
|
|
707
|
-
return async () => null;
|
|
708
|
-
return async () => [];
|
|
709
|
-
},
|
|
710
|
-
},
|
|
711
|
-
);
|
|
712
|
-
const profileStorage =
|
|
713
|
-
profileStorages.length <= 1
|
|
714
|
-
? profileStorages[0] ?? emptyProfileStorage
|
|
715
|
-
: new Proxy(profileStorages[0] as any, {
|
|
716
|
-
get(target, prop: string | symbol) {
|
|
717
|
-
if (prop === "readProfile") {
|
|
718
|
-
return async () => {
|
|
719
|
-
for (const storage of profileStorages) {
|
|
720
|
-
const profile = await storage.readProfile();
|
|
721
|
-
if (profile.trim().length > 0) return profile;
|
|
722
|
-
}
|
|
723
|
-
return "";
|
|
724
|
-
};
|
|
725
|
-
}
|
|
726
|
-
if (prop === "readQuestions") {
|
|
727
|
-
return async (...args: any[]) => {
|
|
728
|
-
const merged: any[] = [];
|
|
729
|
-
const seen = new Set<string>();
|
|
730
|
-
const priorityOf = (question: any): number => {
|
|
731
|
-
const priority = Number(question?.priority ?? 0);
|
|
732
|
-
return Number.isFinite(priority) ? priority : 0;
|
|
733
|
-
};
|
|
734
|
-
for (const storage of profileStorages) {
|
|
735
|
-
const questions = await (storage.readQuestions as any)(...args);
|
|
736
|
-
for (const question of questions) {
|
|
737
|
-
const key = typeof question === "string" ? question : JSON.stringify(question);
|
|
738
|
-
if (seen.has(key)) continue;
|
|
739
|
-
seen.add(key);
|
|
740
|
-
merged.push(question);
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
return merged.sort(
|
|
744
|
-
(left, right) =>
|
|
745
|
-
priorityOf(right) - priorityOf(left) ||
|
|
746
|
-
String(left?.id ?? "").localeCompare(String(right?.id ?? "")),
|
|
747
|
-
);
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
|
-
if (prop === "readIdentityAnchor") {
|
|
751
|
-
return async () => {
|
|
752
|
-
for (const storage of profileStorages) {
|
|
753
|
-
const anchor = (await storage.readIdentityAnchor()) ?? "";
|
|
754
|
-
if (anchor.trim().length > 0) return anchor;
|
|
755
|
-
}
|
|
756
|
-
return "";
|
|
757
|
-
};
|
|
758
|
-
}
|
|
759
|
-
if (prop === "readIdentityImprovementLoops") {
|
|
760
|
-
return async () => {
|
|
761
|
-
const sections: string[] = [];
|
|
762
|
-
const seen = new Set<string>();
|
|
763
|
-
for (const storage of profileStorages) {
|
|
764
|
-
const loops = ((await storage.readIdentityImprovementLoops()) ?? "").trim();
|
|
765
|
-
if (!loops || seen.has(loops)) continue;
|
|
766
|
-
seen.add(loops);
|
|
767
|
-
sections.push(loops);
|
|
768
|
-
}
|
|
769
|
-
return sections.join("\n\n");
|
|
770
|
-
};
|
|
771
|
-
}
|
|
772
|
-
if (prop === "readContinuityIncidents") {
|
|
773
|
-
return async (...args: any[]) => {
|
|
774
|
-
const limit = typeof args[0] === "number" && Number.isFinite(args[0]) ? Math.max(0, args[0]) : undefined;
|
|
775
|
-
const incidents: any[] = [];
|
|
776
|
-
const seen = new Set<string>();
|
|
777
|
-
const incidentTime = (incident: any): number => {
|
|
778
|
-
const raw = incident?.updatedAt ?? incident?.openedAt ?? incident?.createdAt;
|
|
779
|
-
const parsed = typeof raw === "string" ? Date.parse(raw) : Number.NaN;
|
|
780
|
-
return Number.isFinite(parsed) ? parsed : 0;
|
|
781
|
-
};
|
|
782
|
-
for (const storage of profileStorages) {
|
|
783
|
-
for (const incident of await (storage.readContinuityIncidents as any)(...args)) {
|
|
784
|
-
const key = JSON.stringify(incident);
|
|
785
|
-
if (seen.has(key)) continue;
|
|
786
|
-
seen.add(key);
|
|
787
|
-
incidents.push(incident);
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
incidents.sort(
|
|
791
|
-
(left, right) =>
|
|
792
|
-
incidentTime(right) - incidentTime(left) ||
|
|
793
|
-
String(left?.id ?? "").localeCompare(String(right?.id ?? "")),
|
|
794
|
-
);
|
|
795
|
-
return limit === undefined ? incidents : incidents.slice(0, limit);
|
|
796
|
-
};
|
|
797
|
-
}
|
|
798
|
-
if (prop === "listEntityNames") {
|
|
799
|
-
return async (...args: any[]) => {
|
|
800
|
-
const names = new Set<string>();
|
|
801
|
-
for (const storage of profileStorages) {
|
|
802
|
-
for (const name of await (storage.listEntityNames as any)(...args)) names.add(name);
|
|
803
|
-
}
|
|
804
|
-
return [...names];
|
|
805
|
-
};
|
|
806
|
-
}
|
|
807
|
-
if (prop === "readEntity" || prop === "readMemoryByPath") {
|
|
808
|
-
return async (...args: any[]) => {
|
|
809
|
-
for (const storage of profileStorages) {
|
|
810
|
-
const value = await (storage as any)[prop](...args);
|
|
811
|
-
if (value) return value;
|
|
812
|
-
}
|
|
813
|
-
return null;
|
|
814
|
-
};
|
|
815
|
-
}
|
|
816
|
-
if (prop === "readAllMemories") {
|
|
817
|
-
return async (...args: any[]) => {
|
|
818
|
-
const memories: any[] = [];
|
|
819
|
-
const seen = new Set<string>();
|
|
820
|
-
for (const storage of profileStorages) {
|
|
821
|
-
for (const memory of await (storage.readAllMemories as any)(...args)) {
|
|
822
|
-
const key = String(memory?.path ?? memory?.frontmatter?.id ?? JSON.stringify(memory));
|
|
823
|
-
if (seen.has(key)) continue;
|
|
824
|
-
seen.add(key);
|
|
825
|
-
memories.push(memory);
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
return memories;
|
|
829
|
-
};
|
|
830
|
-
}
|
|
831
|
-
return target[prop];
|
|
832
|
-
},
|
|
833
|
-
});
|
|
834
|
-
const profileStorageDirs = Array.from(
|
|
835
|
-
new Set(profileStorages.map((storage) => storage.dir).filter((dir): dir is string => typeof dir === "string" && dir.length > 0)),
|
|
836
|
-
);
|
|
690
|
+
const { profileStorage, profileStorageDirs } = resolveCompositeProfileStorage({
|
|
691
|
+
profileStorages,
|
|
692
|
+
memoryDir: this.deps.config.memoryDir,
|
|
693
|
+
});
|
|
837
694
|
|
|
838
695
|
// --- Phase 1: Launch ALL independent data fetches in parallel ---
|
|
839
696
|
throwIfRecallAborted(options.abortSignal);
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composite profile storage proxy for recall orchestration — extracted from
|
|
3
|
+
* recall-internal.ts (issue #1526, seam 18).
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import type { StorageManager } from "../index.js";
|
|
8
|
+
|
|
9
|
+
export interface CompositeProfileStorageOptions {
|
|
10
|
+
profileStorages: StorageManager[];
|
|
11
|
+
memoryDir: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface CompositeProfileStorageResult {
|
|
15
|
+
profileStorage: StorageManager;
|
|
16
|
+
profileStorageDirs: string[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Creates a composite profile storage proxy over multiple namespace storage instances.
|
|
21
|
+
* When multiple storages exist, methods aggregate results across all instances.
|
|
22
|
+
* When storages is empty, returns a safe empty fallback storage.
|
|
23
|
+
*/
|
|
24
|
+
export function resolveCompositeProfileStorage(
|
|
25
|
+
options: CompositeProfileStorageOptions,
|
|
26
|
+
): CompositeProfileStorageResult {
|
|
27
|
+
const { profileStorages, memoryDir } = options;
|
|
28
|
+
|
|
29
|
+
const emptyProfileStorage = new Proxy(
|
|
30
|
+
{ dir: path.join(memoryDir, ".empty-scope-profile") } as unknown as StorageManager,
|
|
31
|
+
{
|
|
32
|
+
get(target, prop: string | symbol) {
|
|
33
|
+
if (prop in target) return Reflect.get(target, prop);
|
|
34
|
+
if (prop === "readProfile") return async () => "";
|
|
35
|
+
if (
|
|
36
|
+
prop === "readQuestions" ||
|
|
37
|
+
prop === "listEntityNames" ||
|
|
38
|
+
prop === "readContinuityIncidents"
|
|
39
|
+
)
|
|
40
|
+
return async () => [];
|
|
41
|
+
if (
|
|
42
|
+
prop === "readIdentityAnchor" ||
|
|
43
|
+
prop === "readIdentityImprovementLoops"
|
|
44
|
+
)
|
|
45
|
+
return async () => "";
|
|
46
|
+
if (prop === "readEntity" || prop === "readMemoryByPath")
|
|
47
|
+
return async () => null;
|
|
48
|
+
return async () => [];
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const profileStorage =
|
|
54
|
+
profileStorages.length <= 1
|
|
55
|
+
? profileStorages[0] ?? emptyProfileStorage
|
|
56
|
+
: new Proxy(profileStorages[0] as StorageManager, {
|
|
57
|
+
get(target, prop: string | symbol) {
|
|
58
|
+
if (prop === "readProfile") {
|
|
59
|
+
return async () => {
|
|
60
|
+
for (const storage of profileStorages) {
|
|
61
|
+
const profile = await storage.readProfile();
|
|
62
|
+
if (profile.trim().length > 0) return profile;
|
|
63
|
+
}
|
|
64
|
+
return "";
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
if (prop === "readQuestions") {
|
|
68
|
+
return async (...args: unknown[]) => {
|
|
69
|
+
const merged: unknown[] = [];
|
|
70
|
+
const seen = new Set<string>();
|
|
71
|
+
const priorityOf = (question: unknown): number => {
|
|
72
|
+
const priority = Number((question as Record<string, unknown>)?.priority ?? 0);
|
|
73
|
+
return Number.isFinite(priority) ? priority : 0;
|
|
74
|
+
};
|
|
75
|
+
for (const storage of profileStorages) {
|
|
76
|
+
const readFn = (storage as unknown as Record<string, (...a: unknown[]) => Promise<unknown[]>>).readQuestions;
|
|
77
|
+
const questions = await readFn.call(storage, ...args);
|
|
78
|
+
for (const question of questions) {
|
|
79
|
+
const key = typeof question === "string" ? question : JSON.stringify(question);
|
|
80
|
+
if (seen.has(key)) continue;
|
|
81
|
+
seen.add(key);
|
|
82
|
+
merged.push(question);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return merged.sort(
|
|
86
|
+
(left, right) =>
|
|
87
|
+
priorityOf(right) - priorityOf(left) ||
|
|
88
|
+
String((left as Record<string, unknown>)?.id ?? "").localeCompare(String((right as Record<string, unknown>)?.id ?? "")),
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
if (prop === "readIdentityAnchor") {
|
|
93
|
+
return async () => {
|
|
94
|
+
for (const storage of profileStorages) {
|
|
95
|
+
const anchor = (await storage.readIdentityAnchor()) ?? "";
|
|
96
|
+
if (anchor.trim().length > 0) return anchor;
|
|
97
|
+
}
|
|
98
|
+
return "";
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if (prop === "readIdentityImprovementLoops") {
|
|
102
|
+
return async () => {
|
|
103
|
+
const sections: string[] = [];
|
|
104
|
+
const seen = new Set<string>();
|
|
105
|
+
for (const storage of profileStorages) {
|
|
106
|
+
const loops = ((await storage.readIdentityImprovementLoops()) ?? "").trim();
|
|
107
|
+
if (!loops || seen.has(loops)) continue;
|
|
108
|
+
seen.add(loops);
|
|
109
|
+
sections.push(loops);
|
|
110
|
+
}
|
|
111
|
+
return sections.join("\n\n");
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
if (prop === "readContinuityIncidents") {
|
|
115
|
+
return async (...args: unknown[]) => {
|
|
116
|
+
const limit = typeof args[0] === "number" && Number.isFinite(args[0]) ? Math.max(0, args[0]) : undefined;
|
|
117
|
+
const incidents: unknown[] = [];
|
|
118
|
+
const seen = new Set<string>();
|
|
119
|
+
const incidentTime = (incident: unknown): number => {
|
|
120
|
+
const incObj = incident as Record<string, unknown>;
|
|
121
|
+
const raw = incObj?.updatedAt ?? incObj?.openedAt ?? incObj?.createdAt;
|
|
122
|
+
const parsed = typeof raw === "string" ? Date.parse(raw) : Number.NaN;
|
|
123
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
124
|
+
};
|
|
125
|
+
for (const storage of profileStorages) {
|
|
126
|
+
const readFn = (storage as unknown as Record<string, (...a: unknown[]) => Promise<unknown[]>>).readContinuityIncidents;
|
|
127
|
+
for (const incident of await readFn.call(storage, ...args)) {
|
|
128
|
+
const key = JSON.stringify(incident);
|
|
129
|
+
if (seen.has(key)) continue;
|
|
130
|
+
seen.add(key);
|
|
131
|
+
incidents.push(incident);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
incidents.sort(
|
|
135
|
+
(left, right) =>
|
|
136
|
+
incidentTime(right) - incidentTime(left) ||
|
|
137
|
+
String((left as Record<string, unknown>)?.id ?? "").localeCompare(String((right as Record<string, unknown>)?.id ?? "")),
|
|
138
|
+
);
|
|
139
|
+
return limit === undefined ? incidents : incidents.slice(0, limit);
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
if (prop === "listEntityNames") {
|
|
143
|
+
return async (...args: unknown[]) => {
|
|
144
|
+
const names = new Set<string>();
|
|
145
|
+
for (const storage of profileStorages) {
|
|
146
|
+
const listFn = (storage as unknown as Record<string, (...a: unknown[]) => Promise<string[]>>).listEntityNames;
|
|
147
|
+
for (const name of await listFn.call(storage, ...args)) names.add(name);
|
|
148
|
+
}
|
|
149
|
+
return [...names];
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
if (prop === "readEntity" || prop === "readMemoryByPath") {
|
|
153
|
+
return async (...args: unknown[]) => {
|
|
154
|
+
for (const storage of profileStorages) {
|
|
155
|
+
const methodFn = (storage as unknown as Record<string, (...a: unknown[]) => Promise<unknown>>)[prop as string];
|
|
156
|
+
if (methodFn) {
|
|
157
|
+
const value = await methodFn.call(storage, ...args);
|
|
158
|
+
if (value) return value;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
if (prop === "readAllMemories") {
|
|
165
|
+
return async (...args: unknown[]) => {
|
|
166
|
+
const memories: unknown[] = [];
|
|
167
|
+
const seen = new Set<string>();
|
|
168
|
+
for (const storage of profileStorages) {
|
|
169
|
+
const readFn = (storage as unknown as Record<string, (...a: unknown[]) => Promise<unknown[]>>).readAllMemories;
|
|
170
|
+
for (const memory of await readFn.call(storage, ...args)) {
|
|
171
|
+
const memObj = memory as Record<string, unknown>;
|
|
172
|
+
const key = String(memObj?.path ?? (memObj?.frontmatter as Record<string, unknown>)?.id ?? JSON.stringify(memory));
|
|
173
|
+
if (seen.has(key)) continue;
|
|
174
|
+
seen.add(key);
|
|
175
|
+
memories.push(memory);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return memories;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
return Reflect.get(target, prop);
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
const profileStorageDirs = Array.from(
|
|
186
|
+
new Set(
|
|
187
|
+
profileStorages
|
|
188
|
+
.map((storage) => storage.dir)
|
|
189
|
+
.filter((dir): dir is string => typeof dir === "string" && dir.length > 0),
|
|
190
|
+
),
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
return { profileStorage, profileStorageDirs };
|
|
194
|
+
}
|
|
@@ -34,7 +34,13 @@ import { RerankCache, rerankLocalOrNoop, reorderByRankedKeys } from "../rerank.j
|
|
|
34
34
|
import type { SearchBackend, SearchDegradation, SearchExecutionOptions, SearchQueryOptions } from "../search/port.js";
|
|
35
35
|
import { SecureStoreLockedError } from "../secure-store/index.js";
|
|
36
36
|
import { isPathInsideStorageRoot } from "../storage-paths.js";
|
|
37
|
-
import { extractTagsFromPrompt, isTemporalQuery, queryByDateRangeAsync, queryByTagsAsync, readIndexSnapshotAsync, recencyWindowFromPrompt
|
|
37
|
+
import { extractTagsFromPrompt, isTemporalQuery, queryByDateRangeAsync, queryByTagsAsync, readIndexSnapshotAsync, recencyWindowFromPrompt } from "../temporal-index.js";
|
|
38
|
+
import {
|
|
39
|
+
buildQueryAwarePrefilter as buildQueryAwarePrefilterHelper,
|
|
40
|
+
fetchActiveArtifactsForNamespace as fetchActiveArtifactsForNamespaceHelper,
|
|
41
|
+
searchEmbeddingFallback as searchEmbeddingFallbackHelper,
|
|
42
|
+
searchQueryAwareFallback as searchQueryAwareFallbackHelper,
|
|
43
|
+
} from "./recall-search-prefilter.js";
|
|
38
44
|
import { shouldFilterSupersededFromRecall } from "../temporal-supersession.js";
|
|
39
45
|
import { isValidAsOf, isValidityExpiredNow } from "../temporal-validity.js";
|
|
40
46
|
import type { TrustStageResultItem } from "../trust-score-stage.js";
|
|
@@ -49,7 +55,6 @@ import {
|
|
|
49
55
|
} from "../recall-memory-map.js";
|
|
50
56
|
import { type UtilityRuntimeValues, applyUtilityRankingRuntimeDelta } from "../utility-runtime.js";
|
|
51
57
|
import {
|
|
52
|
-
computeArtifactCandidateFetchLimit,
|
|
53
58
|
lifecycleRecallScoreAdjustment,
|
|
54
59
|
shouldFilterLifecycleRecallCandidate,
|
|
55
60
|
computeQmdHybridFetchLimit,
|
|
@@ -247,158 +252,17 @@ export class RecallSearchPipelineCoordinator {
|
|
|
247
252
|
prompt: string,
|
|
248
253
|
targetCount: number,
|
|
249
254
|
): Promise<MemoryFile[]> {
|
|
250
|
-
|
|
251
|
-
let fetchLimit = computeArtifactCandidateFetchLimit(targetCount);
|
|
252
|
-
const maxFetchLimit = Math.min(800, Math.max(fetchLimit, targetCount * 8));
|
|
253
|
-
const MAX_ATTEMPTS = 4;
|
|
254
|
-
let bestFiltered: MemoryFile[] = [];
|
|
255
|
-
|
|
256
|
-
for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt += 1) {
|
|
257
|
-
const rawResults = await storage.searchArtifacts(prompt, fetchLimit);
|
|
258
|
-
const sourceIds = Array.from(
|
|
259
|
-
new Set(
|
|
260
|
-
rawResults
|
|
261
|
-
.map((a) => a.frontmatter.sourceMemoryId)
|
|
262
|
-
.filter(
|
|
263
|
-
(id): id is string => typeof id === "string" && id.length > 0,
|
|
264
|
-
),
|
|
265
|
-
),
|
|
266
|
-
);
|
|
267
|
-
const sourceStatus =
|
|
268
|
-
sourceIds.length > 0
|
|
269
|
-
? await this.deps.resolveArtifactSourceStatuses(storage, sourceIds)
|
|
270
|
-
: new Map<string, "active" | "superseded" | "archived" | "missing">();
|
|
271
|
-
|
|
272
|
-
const filtered: MemoryFile[] = [];
|
|
273
|
-
for (const artifact of rawResults) {
|
|
274
|
-
const sourceId = artifact.frontmatter.sourceMemoryId;
|
|
275
|
-
if (!sourceId) {
|
|
276
|
-
filtered.push(artifact);
|
|
277
|
-
if (filtered.length >= targetCount) break;
|
|
278
|
-
continue;
|
|
279
|
-
}
|
|
280
|
-
const status = sourceStatus.get(sourceId) ?? "missing";
|
|
281
|
-
if (status !== "active") continue;
|
|
282
|
-
filtered.push(artifact);
|
|
283
|
-
if (filtered.length >= targetCount) break;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
if (filtered.length >= targetCount) return filtered.slice(0, targetCount);
|
|
287
|
-
if (filtered.length > bestFiltered.length) {
|
|
288
|
-
bestFiltered = filtered;
|
|
289
|
-
}
|
|
290
|
-
if (rawResults.length === 0) return filtered;
|
|
291
|
-
if (rawResults.length < fetchLimit && filtered.length > 0)
|
|
292
|
-
return filtered;
|
|
293
|
-
if (fetchLimit >= maxFetchLimit) return filtered;
|
|
294
|
-
|
|
295
|
-
const growth = Math.max(targetCount * 2, 12);
|
|
296
|
-
fetchLimit = Math.min(maxFetchLimit, fetchLimit + growth);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
return bestFiltered;
|
|
255
|
+
return fetchActiveArtifactsForNamespaceHelper(this.deps, namespace, prompt, targetCount);
|
|
300
256
|
}
|
|
301
257
|
|
|
302
258
|
async buildQueryAwarePrefilter(
|
|
303
259
|
prompt: string,
|
|
304
260
|
recallNamespaces: string[],
|
|
305
261
|
): Promise<QueryAwarePrefilter> {
|
|
306
|
-
|
|
307
|
-
return {
|
|
308
|
-
candidatePaths: null,
|
|
309
|
-
temporalFromDate: null,
|
|
310
|
-
matchedTags: [],
|
|
311
|
-
expandedTags: [],
|
|
312
|
-
combination: "none",
|
|
313
|
-
filteredToFullSearch: false,
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
const temporalFromDate = isTemporalQuery(prompt)
|
|
318
|
-
? recencyWindowFromPrompt(prompt, Date.now())
|
|
319
|
-
: null;
|
|
320
|
-
// Read the temporal + tag prefilter indexes as ONE consistent snapshot
|
|
321
|
-
// (issue #1911, Codex Medium) so a concurrent async index mutation can't be
|
|
322
|
-
// observed half-applied (new temporal row, tag membership not yet written),
|
|
323
|
-
// which would drop the current memory from the tag prefilter.
|
|
324
|
-
const [rawTemporal, tagSignals] = await readIndexSnapshotAsync(
|
|
325
|
-
this.deps.config.memoryDir,
|
|
326
|
-
() =>
|
|
327
|
-
Promise.all([
|
|
328
|
-
temporalFromDate
|
|
329
|
-
? queryByDateRangeAsync(this.deps.config.memoryDir, temporalFromDate)
|
|
330
|
-
: Promise.resolve<Set<string> | null>(null),
|
|
331
|
-
resolvePromptTagPrefilterAsync(this.deps.config.memoryDir, prompt).catch(
|
|
332
|
-
() => ({
|
|
333
|
-
matchedTags: extractTagsFromPrompt(prompt),
|
|
334
|
-
expandedTags: extractTagsFromPrompt(prompt),
|
|
335
|
-
paths: null,
|
|
336
|
-
}),
|
|
337
|
-
),
|
|
338
|
-
]),
|
|
339
|
-
);
|
|
340
|
-
|
|
341
|
-
const temporalCandidates = this.deps.scopeQueryAwarePaths(
|
|
342
|
-
rawTemporal,
|
|
343
|
-
recallNamespaces,
|
|
344
|
-
);
|
|
345
|
-
const tagCandidates = this.deps.scopeQueryAwarePaths(
|
|
346
|
-
tagSignals.paths,
|
|
347
|
-
recallNamespaces,
|
|
348
|
-
);
|
|
349
|
-
const maxCandidates = this.deps.config.queryAwareIndexingMaxCandidates;
|
|
350
|
-
|
|
351
|
-
let candidatePaths: Set<string> | null = null;
|
|
352
|
-
let combination: QueryAwarePrefilter["combination"] = "none";
|
|
353
|
-
let filteredToFullSearch = false;
|
|
354
|
-
|
|
355
|
-
if (
|
|
356
|
-
tagSignals.matchedTags.length > 0 &&
|
|
357
|
-
tagCandidates !== null &&
|
|
358
|
-
tagCandidates.size === 0
|
|
359
|
-
) {
|
|
360
|
-
candidatePaths = tagCandidates;
|
|
361
|
-
combination = "tag";
|
|
362
|
-
} else if (temporalCandidates !== null && tagCandidates !== null) {
|
|
363
|
-
const intersection = new Set(
|
|
364
|
-
Array.from(temporalCandidates).filter((memoryPath) =>
|
|
365
|
-
tagCandidates.has(memoryPath),
|
|
366
|
-
),
|
|
367
|
-
);
|
|
368
|
-
if (intersection.size > 0) {
|
|
369
|
-
candidatePaths = intersection;
|
|
370
|
-
combination = "intersection";
|
|
371
|
-
} else {
|
|
372
|
-
candidatePaths = new Set([...temporalCandidates, ...tagCandidates]);
|
|
373
|
-
combination = "union";
|
|
374
|
-
}
|
|
375
|
-
} else if (temporalCandidates !== null) {
|
|
376
|
-
candidatePaths = temporalCandidates;
|
|
377
|
-
combination = "temporal";
|
|
378
|
-
} else if (tagCandidates !== null) {
|
|
379
|
-
candidatePaths = tagCandidates;
|
|
380
|
-
combination = "tag";
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
if (
|
|
384
|
-
candidatePaths &&
|
|
385
|
-
maxCandidates > 0 &&
|
|
386
|
-
candidatePaths.size > maxCandidates
|
|
387
|
-
) {
|
|
388
|
-
filteredToFullSearch = true;
|
|
389
|
-
candidatePaths = null;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
return {
|
|
393
|
-
candidatePaths,
|
|
394
|
-
temporalFromDate,
|
|
395
|
-
matchedTags: tagSignals.matchedTags,
|
|
396
|
-
expandedTags: tagSignals.expandedTags,
|
|
397
|
-
combination,
|
|
398
|
-
filteredToFullSearch,
|
|
399
|
-
};
|
|
262
|
+
return buildQueryAwarePrefilterHelper(this.deps, prompt, recallNamespaces);
|
|
400
263
|
}
|
|
401
264
|
|
|
265
|
+
|
|
402
266
|
async fetchQmdMemoryResultsWithArtifactTopUp(
|
|
403
267
|
prompt: string,
|
|
404
268
|
qmdFetchLimit: number,
|
|
@@ -654,26 +518,7 @@ export class RecallSearchPipelineCoordinator {
|
|
|
654
518
|
query: string,
|
|
655
519
|
limit: number,
|
|
656
520
|
): Promise<QmdSearchResult[]> {
|
|
657
|
-
|
|
658
|
-
if (!(await this.deps.embeddingFallback.isAvailable())) return [];
|
|
659
|
-
const hits = await this.deps.embeddingFallback.search(query, limit);
|
|
660
|
-
if (hits.length === 0) return [];
|
|
661
|
-
|
|
662
|
-
const results: QmdSearchResult[] = [];
|
|
663
|
-
for (const hit of hits) {
|
|
664
|
-
const fullPath = path.isAbsolute(hit.path)
|
|
665
|
-
? hit.path
|
|
666
|
-
: path.join(this.deps.config.memoryDir, hit.path);
|
|
667
|
-
const memory = await this.deps.storage.readMemoryByPath(fullPath);
|
|
668
|
-
if (!memory) continue;
|
|
669
|
-
results.push({
|
|
670
|
-
docid: hit.id,
|
|
671
|
-
path: fullPath,
|
|
672
|
-
score: hit.score,
|
|
673
|
-
snippet: memory.content.slice(0, 400).replace(/\n/g, " "),
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
return results;
|
|
521
|
+
return searchEmbeddingFallbackHelper(this.deps, query, limit);
|
|
677
522
|
}
|
|
678
523
|
|
|
679
524
|
/**
|
|
@@ -686,24 +531,10 @@ export class RecallSearchPipelineCoordinator {
|
|
|
686
531
|
queryAwarePrefilter?: QueryAwarePrefilter,
|
|
687
532
|
abortSignal?: AbortSignal,
|
|
688
533
|
): Promise<QmdSearchResult[]> {
|
|
689
|
-
|
|
690
|
-
const cappedLimit = Math.max(0, limit);
|
|
691
|
-
if (cappedLimit === 0 || queryAwarePrefilter?.candidatePaths?.size === 0) return [];
|
|
692
|
-
|
|
693
|
-
const candidatePaths = queryAwarePrefilter?.candidatePaths;
|
|
694
|
-
const scopedSeedResults = (
|
|
695
|
-
candidatePaths?.size
|
|
696
|
-
? await this.deps.searchScopedMemoryCandidates(
|
|
697
|
-
candidatePaths,
|
|
698
|
-
prompt,
|
|
699
|
-
candidatePaths.size,
|
|
700
|
-
{ allowArchived: true },
|
|
701
|
-
)
|
|
702
|
-
: []
|
|
703
|
-
).filter((result) => !isGenericRecallExcludedPath(result.path, this.deps.config, "qmd"));
|
|
704
|
-
return scopedSeedResults.slice(0, cappedLimit);
|
|
534
|
+
return searchQueryAwareFallbackHelper(this.deps, prompt, limit, queryAwarePrefilter, abortSignal);
|
|
705
535
|
}
|
|
706
536
|
|
|
537
|
+
|
|
707
538
|
async applyColdFallbackPipeline(options: {
|
|
708
539
|
prompt: string;
|
|
709
540
|
recallNamespaces: string[];
|