@remnic/core 9.45.4 → 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 +30 -29
- package/dist/access-authorization-probe.d.ts +10 -10
- package/dist/access-authorization-probe.js +31 -30
- package/dist/access-boundary.d.ts +10 -10
- package/dist/access-boundary.js +30 -29
- package/dist/access-cli.js +91 -87
- 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 +30 -29
- 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-offline-stream.js +1 -1
- package/dist/access-http-query.js +30 -29
- package/dist/access-http.d.ts +10 -11
- package/dist/access-http.js +42 -41
- package/dist/access-identity-continuity-surface.d.ts +8 -8
- package/dist/access-identity-continuity-surface.js +30 -29
- package/dist/access-lcm-surface.d.ts +10 -10
- package/dist/access-lcm-surface.js +30 -29
- package/dist/access-mcp.d.ts +10 -10
- package/dist/access-mcp.js +36 -35
- 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 +30 -29
- package/dist/access-observe-write-surface.d.ts +10 -10
- package/dist/access-observe-write-surface.js +30 -29
- package/dist/access-offline-manifest.d.ts +8 -8
- package/dist/access-operations-batch.js +31 -30
- package/dist/access-operations.d.ts +13 -13
- package/dist/access-operations.js +35 -34
- package/dist/access-recall-concurrency.d.ts +10 -10
- package/dist/access-recall-concurrency.js +30 -29
- package/dist/access-recall-response.d.ts +10 -10
- package/dist/access-recall-response.js +30 -29
- package/dist/access-recall-surface.d.ts +10 -10
- package/dist/access-recall-surface.js +30 -29
- package/dist/access-schema.d.ts +84 -84
- package/dist/access-service-helpers.d.ts +10 -10
- package/dist/{access-service-CsU-ljFD.d.ts → access-service-loJadYd7.d.ts} +7 -7
- package/dist/access-service.d.ts +10 -10
- package/dist/access-service.js +30 -29
- 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/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- 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 +6 -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 +5 -5
- 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 +7 -6
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/{chunk-7RZJWZ46.js → chunk-227UFSEQ.js} +5 -5
- package/dist/{chunk-ER7W6H4T.js → chunk-2AD5SXO4.js} +5 -2
- package/dist/chunk-2AD5SXO4.js.map +1 -0
- package/dist/{chunk-XSFHWBQO.js → chunk-2DSUT7DZ.js} +10 -64
- package/dist/{chunk-XSFHWBQO.js.map → chunk-2DSUT7DZ.js.map} +1 -1
- package/dist/{chunk-DZPFMQZ7.js → chunk-3S63QIFQ.js} +1 -1
- package/dist/chunk-3S63QIFQ.js.map +1 -0
- package/dist/{chunk-UQWIKLQK.js → chunk-47J4EDGR.js} +9 -9
- package/dist/{chunk-5SNZSWWR.js → chunk-5LRDM4R7.js} +42 -42
- package/dist/{chunk-7YERSTN7.js → chunk-5R6S4DJZ.js} +7 -7
- package/dist/{chunk-C26TE27X.js → chunk-5VQPZ4GV.js} +3 -3
- package/dist/{chunk-U2VLVBBH.js → chunk-64BHFFKZ.js} +3 -3
- package/dist/{chunk-AJQ57VV3.js → chunk-6H744ZBH.js} +4 -4
- package/dist/chunk-6H744ZBH.js.map +1 -0
- package/dist/{chunk-7CITSYSH.js → chunk-7T4TOGMS.js} +2 -2
- package/dist/{chunk-ZMAYKGPN.js → chunk-7YQ6ESEA.js} +12 -41
- package/dist/chunk-7YQ6ESEA.js.map +1 -0
- package/dist/{chunk-YMAQDHQM.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-WGP57SR3.js → chunk-CK5KOVHW.js} +3 -2
- package/dist/{chunk-WGP57SR3.js.map → chunk-CK5KOVHW.js.map} +1 -1
- package/dist/{chunk-JH6BPLOP.js → chunk-E4FOAENZ.js} +4 -4
- package/dist/{chunk-ZFGZ6PZ2.js → chunk-FULKGK7P.js} +2 -2
- package/dist/{chunk-BGHFOD5A.js → chunk-HJ3SVHUW.js} +3 -3
- package/dist/{chunk-TYISDI6B.js → chunk-HXXTXLKA.js} +2 -2
- package/dist/{chunk-FZP32336.js → chunk-IDE5AR5W.js} +53 -31
- package/dist/chunk-IDE5AR5W.js.map +1 -0
- package/dist/{chunk-7SHJHPTY.js → chunk-ILBLZ5Y5.js} +2 -2
- package/dist/chunk-J7T4MX7P.js +131 -0
- package/dist/chunk-J7T4MX7P.js.map +1 -0
- package/dist/{chunk-DSUAAZZX.js → chunk-JFO5QZ7N.js} +2 -2
- package/dist/{chunk-EJHEWCGQ.js → chunk-KA47C7BF.js} +2 -2
- package/dist/{chunk-NUEQKLNB.js → chunk-KMWYZTIE.js} +2 -2
- package/dist/{chunk-TQ4GD737.js → chunk-L7G72WY4.js} +2 -2
- package/dist/{chunk-CLB32OHM.js → chunk-LI7OE7G6.js} +2 -2
- package/dist/{chunk-TN76AKO3.js → chunk-M2INOSTA.js} +2 -2
- package/dist/{chunk-DYVMXPCF.js → chunk-M32URQXV.js} +665 -614
- package/dist/chunk-M32URQXV.js.map +1 -0
- package/dist/{chunk-WQIHRA5F.js → chunk-N3LL5NEU.js} +2 -2
- package/dist/{chunk-HFPASSFV.js → chunk-P2OTGMTR.js} +2 -2
- package/dist/{chunk-Y7HRYCNW.js → chunk-PFJXPOD4.js} +2 -2
- package/dist/{chunk-MDISBSYA.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-ZI32MKDW.js → chunk-RCU25Z66.js} +32 -35
- package/dist/chunk-RCU25Z66.js.map +1 -0
- package/dist/{chunk-2QSZNTDO.js → chunk-RKNJBZ55.js} +4 -4
- package/dist/{chunk-QCECHYZL.js → chunk-RVO6TCTU.js} +6 -6
- package/dist/{chunk-D3I2MCN7.js → chunk-RVPTS4U5.js} +3 -3
- package/dist/{chunk-W3IC7QOY.js → chunk-RVYVMQK4.js} +3 -3
- package/dist/chunk-S2HLHAZ4.js +16 -0
- package/dist/chunk-S2HLHAZ4.js.map +1 -0
- package/dist/{chunk-2MRHJNWL.js → chunk-ST5IEK3H.js} +2 -2
- package/dist/{chunk-O4KMGRXE.js → chunk-SXWHN7GC.js} +2 -2
- package/dist/{chunk-KXEFRMCF.js → chunk-T6JRMVOV.js} +2 -2
- package/dist/{chunk-R5RFK3CB.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-EITZHSX6.js → chunk-V5FE3UAI.js} +2 -2
- package/dist/chunk-VL35ZFSZ.js +102 -0
- package/dist/chunk-VL35ZFSZ.js.map +1 -0
- package/dist/{chunk-NTOIP2E6.js → chunk-W2ZSNIBP.js} +2 -2
- package/dist/{chunk-QVSBTCVP.js → chunk-WHWDBTCJ.js} +2 -2
- package/dist/{chunk-5CEECY6P.js → chunk-WOC6DXP5.js} +3 -3
- package/dist/{chunk-XTAUXTDO.js → chunk-XBMJ35IP.js} +2 -2
- package/dist/{chunk-VOUOLGIP.js → chunk-YRFAYOFQ.js} +11 -13
- package/dist/chunk-YRFAYOFQ.js.map +1 -0
- package/dist/{chunk-P7NGM24P.js → chunk-YWCOJOUI.js} +2 -2
- package/dist/{chunk-6NNNURLK.js → chunk-Z54EM5YZ.js} +4 -4
- package/dist/{chunk-ULVR5KG7.js → chunk-ZDAYWJV6.js} +2 -2
- package/dist/chunk-ZDAYWJV6.js.map +1 -0
- package/dist/{cli-BBHDtG36.d.ts → cli-D_RcqXfZ.d.ts} +5 -5
- package/dist/cli.d.ts +12 -12
- package/dist/cli.js +61 -60
- package/dist/compat/checks.js +1 -1
- package/dist/compounding/engine.d.ts +2 -2
- package/dist/compounding/engine.js +6 -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 +6 -5
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +6 -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 +8 -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 +17 -16
- 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 +6 -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 +33 -32
- package/dist/external-wiki-cli.js +4 -90
- package/dist/external-wiki-cli.js.map +1 -1
- 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/external-wiki-search.js +2 -2
- package/dist/external-wiki.d.ts +1 -5
- package/dist/external-wiki.js +1 -3
- 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 +13 -10
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/{first-start-migration-F2QJD66E.js → first-start-migration-ZSHEFEI3.js} +10 -12
- package/dist/{first-start-migration-F2QJD66E.js.map → first-start-migration-ZSHEFEI3.js.map} +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 +701 -697
- package/dist/index.js +133 -128
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/index.js +2 -2
- 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 +6 -5
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +6 -5
- package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-projection.js +7 -6
- package/dist/{maintenance-D2mveyCd.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 +10 -0
- package/dist/memory-snapshot.js +8 -0
- package/dist/memory-snapshot.js.map +1 -0
- 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 +16 -15
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/search.js +9 -9
- package/dist/namespaces/storage.d.ts +3 -3
- package/dist/namespaces/storage.js +6 -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 +18 -17
- package/dist/operator-doctor-replica.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +3 -3
- package/dist/operator-toolkit.js +22 -21
- package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
- package/dist/orchestration/maintenance.d.ts +4 -4
- package/dist/orchestration/maintenance.js +11 -10
- package/dist/{orchestrator-DJYlwiUv.d.ts → orchestrator-LPGegii3.d.ts} +8 -8
- package/dist/orchestrator.d.ts +8 -8
- package/dist/orchestrator.js +93 -89
- 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/qmd.js +4 -4
- 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/schemas.d.ts +76 -76
- 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 +8 -8
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +14 -14
- 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 +7 -6
- package/dist/semantic-rule-promotion.js +6 -5
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +6 -5
- package/dist/{service-BeDxSqE-.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 +9 -9
- package/dist/signal.d.ts +1 -1
- package/dist/source-agent-qualifier.d.ts +4 -1
- package/dist/source-agent-qualifier.js +10 -9
- package/dist/{storage-DfjxusTE.d.ts → storage-y340tYKb.d.ts} +5 -2
- package/dist/storage.d.ts +2 -2
- package/dist/storage.js +5 -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-migration.js +1 -1
- package/dist/tier-routing.d.ts +1 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/transfer/types.d.ts +66 -66
- 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 +6 -5
- package/dist/write-envelope.d.ts +1 -1
- package/package.json +2 -12
- package/src/access-http-offline-stream.ts +1 -0
- package/src/access-http.ts +0 -57
- package/src/access-operations-batch.ts +1 -1
- package/src/access-service-observe-lcm-parity.test.ts +45 -20
- package/src/access-service.ts +3 -4
- 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/external-wiki-cli.ts +28 -20
- package/src/external-wiki-search.test.ts +68 -2
- package/src/external-wiki.ts +12 -38
- package/src/extraction-prompt.ts +142 -0
- package/src/extraction.ts +37 -148
- package/src/index.ts +1 -5
- package/src/maintenance/first-start-migration.ts +11 -11
- 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/memory-snapshot.ts +15 -0
- 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/storage-contract/cache-coherence.test.ts +99 -0
- package/src/storage-fact-hash-index-defer.test.ts +14 -7
- package/src/storage.ts +47 -48
- package/src/testing/subjects/first-start-tier-migration.test.ts +75 -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/tier-migration.ts +10 -12
- 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-AJQ57VV3.js.map +0 -1
- package/dist/chunk-DYVMXPCF.js.map +0 -1
- package/dist/chunk-DZPFMQZ7.js.map +0 -1
- package/dist/chunk-ER7W6H4T.js.map +0 -1
- package/dist/chunk-FZP32336.js.map +0 -1
- package/dist/chunk-GQL52GQ5.js.map +0 -1
- package/dist/chunk-MDISBSYA.js.map +0 -1
- package/dist/chunk-ULVR5KG7.js.map +0 -1
- package/dist/chunk-UV72DEZD.js.map +0 -1
- package/dist/chunk-VOUOLGIP.js.map +0 -1
- package/dist/chunk-ZI32MKDW.js.map +0 -1
- package/dist/chunk-ZMAYKGPN.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-7RZJWZ46.js.map → chunk-227UFSEQ.js.map} +0 -0
- /package/dist/{chunk-UQWIKLQK.js.map → chunk-47J4EDGR.js.map} +0 -0
- /package/dist/{chunk-5SNZSWWR.js.map → chunk-5LRDM4R7.js.map} +0 -0
- /package/dist/{chunk-7YERSTN7.js.map → chunk-5R6S4DJZ.js.map} +0 -0
- /package/dist/{chunk-C26TE27X.js.map → chunk-5VQPZ4GV.js.map} +0 -0
- /package/dist/{chunk-U2VLVBBH.js.map → chunk-64BHFFKZ.js.map} +0 -0
- /package/dist/{chunk-7CITSYSH.js.map → chunk-7T4TOGMS.js.map} +0 -0
- /package/dist/{chunk-YMAQDHQM.js.map → chunk-BDNL34CT.js.map} +0 -0
- /package/dist/{chunk-JH6BPLOP.js.map → chunk-E4FOAENZ.js.map} +0 -0
- /package/dist/{chunk-ZFGZ6PZ2.js.map → chunk-FULKGK7P.js.map} +0 -0
- /package/dist/{chunk-BGHFOD5A.js.map → chunk-HJ3SVHUW.js.map} +0 -0
- /package/dist/{chunk-TYISDI6B.js.map → chunk-HXXTXLKA.js.map} +0 -0
- /package/dist/{chunk-7SHJHPTY.js.map → chunk-ILBLZ5Y5.js.map} +0 -0
- /package/dist/{chunk-DSUAAZZX.js.map → chunk-JFO5QZ7N.js.map} +0 -0
- /package/dist/{chunk-EJHEWCGQ.js.map → chunk-KA47C7BF.js.map} +0 -0
- /package/dist/{chunk-NUEQKLNB.js.map → chunk-KMWYZTIE.js.map} +0 -0
- /package/dist/{chunk-TQ4GD737.js.map → chunk-L7G72WY4.js.map} +0 -0
- /package/dist/{chunk-CLB32OHM.js.map → chunk-LI7OE7G6.js.map} +0 -0
- /package/dist/{chunk-TN76AKO3.js.map → chunk-M2INOSTA.js.map} +0 -0
- /package/dist/{chunk-WQIHRA5F.js.map → chunk-N3LL5NEU.js.map} +0 -0
- /package/dist/{chunk-HFPASSFV.js.map → chunk-P2OTGMTR.js.map} +0 -0
- /package/dist/{chunk-Y7HRYCNW.js.map → chunk-PFJXPOD4.js.map} +0 -0
- /package/dist/{chunk-2QSZNTDO.js.map → chunk-RKNJBZ55.js.map} +0 -0
- /package/dist/{chunk-QCECHYZL.js.map → chunk-RVO6TCTU.js.map} +0 -0
- /package/dist/{chunk-D3I2MCN7.js.map → chunk-RVPTS4U5.js.map} +0 -0
- /package/dist/{chunk-W3IC7QOY.js.map → chunk-RVYVMQK4.js.map} +0 -0
- /package/dist/{chunk-2MRHJNWL.js.map → chunk-ST5IEK3H.js.map} +0 -0
- /package/dist/{chunk-O4KMGRXE.js.map → chunk-SXWHN7GC.js.map} +0 -0
- /package/dist/{chunk-KXEFRMCF.js.map → chunk-T6JRMVOV.js.map} +0 -0
- /package/dist/{chunk-R5RFK3CB.js.map → chunk-U6JGQ37L.js.map} +0 -0
- /package/dist/{chunk-EITZHSX6.js.map → chunk-V5FE3UAI.js.map} +0 -0
- /package/dist/{chunk-NTOIP2E6.js.map → chunk-W2ZSNIBP.js.map} +0 -0
- /package/dist/{chunk-QVSBTCVP.js.map → chunk-WHWDBTCJ.js.map} +0 -0
- /package/dist/{chunk-5CEECY6P.js.map → chunk-WOC6DXP5.js.map} +0 -0
- /package/dist/{chunk-XTAUXTDO.js.map → chunk-XBMJ35IP.js.map} +0 -0
- /package/dist/{chunk-P7NGM24P.js.map → chunk-YWCOJOUI.js.map} +0 -0
- /package/dist/{chunk-6NNNURLK.js.map → chunk-Z54EM5YZ.js.map} +0 -0
package/src/access-http.ts
CHANGED
|
@@ -3424,63 +3424,6 @@ export class EngramAccessHttpServer {
|
|
|
3424
3424
|
res.end(body);
|
|
3425
3425
|
}
|
|
3426
3426
|
|
|
3427
|
-
private async respondOfflineSnapshotStream(
|
|
3428
|
-
res: ServerResponse,
|
|
3429
|
-
snapshot: Awaited<ReturnType<EngramAccessService["offlineSyncSnapshotStream"]>>,
|
|
3430
|
-
): Promise<void> {
|
|
3431
|
-
res.statusCode = 200;
|
|
3432
|
-
res.setHeader("content-type", "application/x-ndjson; charset=utf-8");
|
|
3433
|
-
res.setHeader("cache-control", "no-store");
|
|
3434
|
-
const cid = correlationIdStore.getStore();
|
|
3435
|
-
if (cid) {
|
|
3436
|
-
res.setHeader("x-request-id", cid);
|
|
3437
|
-
}
|
|
3438
|
-
const waitForDrainOrClose = async (): Promise<boolean> => new Promise((resolve, reject) => {
|
|
3439
|
-
const cleanup = () => {
|
|
3440
|
-
res.off("drain", onDrain);
|
|
3441
|
-
res.off("close", onClose);
|
|
3442
|
-
res.off("error", onError);
|
|
3443
|
-
};
|
|
3444
|
-
const onDrain = () => {
|
|
3445
|
-
cleanup();
|
|
3446
|
-
resolve(true);
|
|
3447
|
-
};
|
|
3448
|
-
const onClose = () => {
|
|
3449
|
-
cleanup();
|
|
3450
|
-
resolve(false);
|
|
3451
|
-
};
|
|
3452
|
-
const onError = (error: Error) => {
|
|
3453
|
-
cleanup();
|
|
3454
|
-
reject(error);
|
|
3455
|
-
};
|
|
3456
|
-
res.once("drain", onDrain);
|
|
3457
|
-
res.once("close", onClose);
|
|
3458
|
-
res.once("error", onError);
|
|
3459
|
-
});
|
|
3460
|
-
const writeLine = async (payload: unknown): Promise<boolean> => {
|
|
3461
|
-
if (res.destroyed || res.writableEnded) return false;
|
|
3462
|
-
if (res.write(`${JSON.stringify(payload)}\n`)) return true;
|
|
3463
|
-
if (res.destroyed || res.writableEnded) return false;
|
|
3464
|
-
return waitForDrainOrClose();
|
|
3465
|
-
};
|
|
3466
|
-
if (!await writeLine({
|
|
3467
|
-
type: "snapshot",
|
|
3468
|
-
namespace: snapshot.namespace,
|
|
3469
|
-
format: snapshot.format,
|
|
3470
|
-
schemaVersion: snapshot.schemaVersion,
|
|
3471
|
-
createdAt: snapshot.createdAt,
|
|
3472
|
-
sourceId: snapshot.sourceId,
|
|
3473
|
-
includeTranscripts: snapshot.includeTranscripts,
|
|
3474
|
-
deletions: snapshot.deletions,
|
|
3475
|
-
})) return;
|
|
3476
|
-
for await (const file of snapshot.files) {
|
|
3477
|
-
if (!await writeLine({ type: "file", file })) return;
|
|
3478
|
-
}
|
|
3479
|
-
if (!res.destroyed && !res.writableEnded) {
|
|
3480
|
-
res.end();
|
|
3481
|
-
}
|
|
3482
|
-
}
|
|
3483
|
-
|
|
3484
3427
|
private respondBinary(
|
|
3485
3428
|
res: ServerResponse,
|
|
3486
3429
|
status: number,
|
|
@@ -163,7 +163,7 @@ defineOperation({ name: "chatgpt_memory_inspector", description: "Memory inspect
|
|
|
163
163
|
if (input.currentContextScopes !== undefined) ii.currentContextScopes = input.currentContextScopes as string[];
|
|
164
164
|
if (input.allowUnverifiedPreview !== undefined) ii.allowUnverifiedPreview = input.allowUnverifiedPreview as boolean;
|
|
165
165
|
const rsk = ii.sessionKey ?? (ctx.authenticatedPrincipal ? "remnic:chatgpt-memory-inspector:" + randomUUID() : undefined);
|
|
166
|
-
const xr = await ctx.service.recallXray({ query: ii.query, sessionKey: rsk, namespace: ii.namespace, currentContextScopes: ii.currentContextScopes, authenticatedPrincipal: ctx.authenticatedPrincipal, sourceConnector: ctx.sourceConnector, mode: "full", disclosure: "chunk", includeRecall: true, ...(ctx.abortSignal ? { abortSignal: ctx.abortSignal } : {}) });
|
|
166
|
+
const xr = await ctx.service.recallXray({ query: ii.query, sessionKey: rsk, namespace: ii.namespace, currentContextScopes: ii.currentContextScopes, authenticatedPrincipal: ctx.authenticatedPrincipal, ...(ctx.sourceConnector ? { sourceConnector: ctx.sourceConnector } : {}), mode: "full", disclosure: "chunk", includeRecall: true, ...(ctx.abortSignal ? { abortSignal: ctx.abortSignal } : {}) });
|
|
167
167
|
const x = xr.snapshotFound === true ? (xr.snapshot ?? null) : null;
|
|
168
168
|
const r = xr.recall ?? { query: ii.query, namespace: ii.namespace ?? x?.namespace ?? "global", context: "", count: 0, memoryIds: [], results: [], fallbackUsed: false, sourcesUsed: [], disclosure: "chunk" as const };
|
|
169
169
|
const ac = await ctx.service.actionConfidence(buildChatGptMemoryInspectorActionRequest(ii, r, x));
|
|
@@ -910,19 +910,28 @@ test("#2128: post-flush retained cleanup is best effort and receives lifecycle g
|
|
|
910
910
|
}]);
|
|
911
911
|
});
|
|
912
912
|
|
|
913
|
-
test("#2128: post-flush retained cleanup stops on abort or deadline", async () => {
|
|
913
|
+
test("#2128: post-flush retained cleanup stops on abort or deadline", async (t) => {
|
|
914
914
|
const probe = makeParityProbe(withSelfPolicyPrefix("pi-geek"));
|
|
915
|
-
(
|
|
916
|
-
|
|
917
|
-
|
|
915
|
+
let cleanupStarted: (() => void) | undefined;
|
|
916
|
+
const cleanupCalls: Array<{
|
|
917
|
+
sessionKey: string;
|
|
918
|
+
ownerPrincipal: string | undefined;
|
|
919
|
+
options: { abortSignal?: AbortSignal; deadlineMs?: number } | undefined;
|
|
920
|
+
}> = [];
|
|
921
|
+
Object.defineProperty(probe.orch, "buffer", {
|
|
922
|
+
configurable: true,
|
|
923
|
+
value: {
|
|
924
|
+
clearRetainedTurnsForSession: async (
|
|
918
925
|
sessionKey: string,
|
|
919
926
|
ownerPrincipal?: string,
|
|
920
927
|
options?: { abortSignal?: AbortSignal; deadlineMs?: number },
|
|
921
|
-
)
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
928
|
+
) => {
|
|
929
|
+
cleanupCalls.push({ sessionKey, ownerPrincipal, options });
|
|
930
|
+
cleanupStarted?.();
|
|
931
|
+
return new Promise<void>(() => {});
|
|
932
|
+
},
|
|
933
|
+
},
|
|
934
|
+
});
|
|
926
935
|
const service = new EngramAccessService(probe.orch);
|
|
927
936
|
const abortController = new AbortController();
|
|
928
937
|
setTimeout(() => abortController.abort(), 5).unref();
|
|
@@ -941,19 +950,35 @@ test("#2128: post-flush retained cleanup stops on abort or deadline", async () =
|
|
|
941
950
|
]),
|
|
942
951
|
/extraction force-flush aborted/,
|
|
943
952
|
);
|
|
953
|
+
assert.deepEqual(cleanupCalls[0], {
|
|
954
|
+
sessionKey: "pi-geek:cleanup-abort",
|
|
955
|
+
ownerPrincipal: "pi-geek",
|
|
956
|
+
options: { abortSignal: abortController.signal, deadlineMs: undefined },
|
|
957
|
+
});
|
|
944
958
|
|
|
959
|
+
const cleanupStartedPromise = new Promise<void>((resolve) => {
|
|
960
|
+
cleanupStarted = resolve;
|
|
961
|
+
});
|
|
962
|
+
t.mock.timers.enable({ apis: ["setTimeout", "Date"], now: 0 });
|
|
963
|
+
const deadlineFlush = service.extractionForceFlush({
|
|
964
|
+
sessionKey: "pi-geek:cleanup-deadline",
|
|
965
|
+
authenticatedPrincipal: "pi-geek",
|
|
966
|
+
deadlineMs: 5,
|
|
967
|
+
});
|
|
968
|
+
await Promise.race([
|
|
969
|
+
cleanupStartedPromise,
|
|
970
|
+
new Promise<never>((_resolve, reject) =>
|
|
971
|
+
setImmediate(() => reject(new Error("deadline cleanup did not start"))),
|
|
972
|
+
),
|
|
973
|
+
]);
|
|
974
|
+
assert.deepEqual(cleanupCalls[1], {
|
|
975
|
+
sessionKey: "pi-geek:cleanup-deadline",
|
|
976
|
+
ownerPrincipal: "pi-geek",
|
|
977
|
+
options: { abortSignal: undefined, deadlineMs: 5 },
|
|
978
|
+
});
|
|
979
|
+
t.mock.timers.tick(5);
|
|
945
980
|
await assert.rejects(
|
|
946
|
-
|
|
947
|
-
Promise.race([
|
|
948
|
-
service.extractionForceFlush({
|
|
949
|
-
sessionKey: "pi-geek:cleanup-deadline",
|
|
950
|
-
authenticatedPrincipal: "pi-geek",
|
|
951
|
-
deadlineMs: Date.now() + 5,
|
|
952
|
-
}),
|
|
953
|
-
new Promise<never>((_resolve, reject) =>
|
|
954
|
-
setTimeout(() => reject(new Error("deadline cleanup test timed out")), 100),
|
|
955
|
-
),
|
|
956
|
-
]),
|
|
981
|
+
deadlineFlush,
|
|
957
982
|
/replay extraction deadline exceeded \(retained_turn_cleanup\)/,
|
|
958
983
|
);
|
|
959
984
|
});
|
package/src/access-service.ts
CHANGED
|
@@ -2386,7 +2386,9 @@ export class EngramAccessService {
|
|
|
2386
2386
|
} else if (extraction.degradedReason?.includes("buffer unreadable")) {
|
|
2387
2387
|
scopedDegradedReason = "daemon extraction pipeline degraded; extraction buffer unreadable";
|
|
2388
2388
|
} else {
|
|
2389
|
-
scopedDegradedReason =
|
|
2389
|
+
scopedDegradedReason =
|
|
2390
|
+
`${extraction.bufferedSessionCount} buffered session(s), ` +
|
|
2391
|
+
`${extraction.pendingTurnCount} turn(s) pending extraction`;
|
|
2390
2392
|
}
|
|
2391
2393
|
}
|
|
2392
2394
|
const visibleExtraction =
|
|
@@ -2394,9 +2396,6 @@ export class EngramAccessService {
|
|
|
2394
2396
|
? {
|
|
2395
2397
|
...extraction,
|
|
2396
2398
|
lastExtractionAt: null,
|
|
2397
|
-
bufferedSessionCount: 0,
|
|
2398
|
-
pendingTurnCount: 0,
|
|
2399
|
-
oldestBufferedTurnAgeMs: null,
|
|
2400
2399
|
degradedReason: scopedDegradedReason,
|
|
2401
2400
|
}
|
|
2402
2401
|
: extraction;
|
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
AMBIENT_CAPTURE_PROMPT_RULE,
|
|
6
|
+
collectPersonEntityRefs,
|
|
7
|
+
SPECULATIVE_CONFIDENCE_CEILING,
|
|
8
|
+
clampAmbientCaptureConfidence,
|
|
9
|
+
isHighImpactPersonalFact,
|
|
10
|
+
} from "./ambient-provenance.js";
|
|
11
|
+
import { parseConfig } from "./config.js";
|
|
12
|
+
import { bufferTurnsEqual, copyBufferTurn } from "./buffer-turn-helpers.js";
|
|
13
|
+
import { ExtractionEngine } from "./extraction.js";
|
|
14
|
+
import { SUMMARY_SYSTEM_PROMPT } from "./meetings/summary-extractor.js";
|
|
15
|
+
import { emptySpeakerRegistry } from "./wearables/speakers.js";
|
|
16
|
+
import { buildExtractionTurns } from "./wearables/memory-gen.js";
|
|
17
|
+
import type { WearableConversation } from "./wearables/types.js";
|
|
18
|
+
import { decideSmart } from "./wearables/trust.js";
|
|
19
|
+
import type { BufferTurn, ExtractedFact, ExtractionResult, MemoryCategory } from "./types.js";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Ambient-capture contamination (issue #2294): a wearable records a TV show,
|
|
23
|
+
* a scripted line names a relative's birthday, and extraction emits it as a
|
|
24
|
+
* high-confidence personal fact that auto-promotes into recall.
|
|
25
|
+
*
|
|
26
|
+
* The fix has two halves and both are exercised here: the prompt section that
|
|
27
|
+
* tells the model to separate the user's speech from background media, and the
|
|
28
|
+
* deterministic clamp that holds high-impact personal facts at the speculative
|
|
29
|
+
* ceiling when the model ignores it. Every extraction path — local LLM, direct
|
|
30
|
+
* client, gateway fallback — must apply both.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
const AMBIENT_LINE = "Rachel's mother has a birthday on June 3rd.";
|
|
34
|
+
|
|
35
|
+
const AMBIENT_TURN: BufferTurn = {
|
|
36
|
+
role: "user",
|
|
37
|
+
content: `[Wearable transcript (fixture) — 2026-08-02]\nSpeaker 2: ${AMBIENT_LINE}`,
|
|
38
|
+
timestamp: "2026-08-02T12:00:00.000Z",
|
|
39
|
+
ambientCapture: true,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const TYPED_TURN: BufferTurn = {
|
|
43
|
+
role: "user",
|
|
44
|
+
content: AMBIENT_TURN.content,
|
|
45
|
+
timestamp: AMBIENT_TURN.timestamp,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const HIGH_IMPACT_EXTRACTION = {
|
|
49
|
+
facts: [
|
|
50
|
+
{
|
|
51
|
+
category: "fact",
|
|
52
|
+
content: AMBIENT_LINE,
|
|
53
|
+
confidence: 0.91,
|
|
54
|
+
tags: ["personal"],
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
profileUpdates: [],
|
|
58
|
+
entities: [],
|
|
59
|
+
questions: [],
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
type ChatMessage = { role: string; content: string };
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The mocks below mirror the production signatures exactly — `chatCompletion`
|
|
66
|
+
* takes an options object, `parseWithSchemaDetailed` takes a schema then
|
|
67
|
+
* options, and the direct client's `create` takes the full request body. A
|
|
68
|
+
* narrower mock would let the request contract drift underneath a green test.
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
const MODEL_REGISTRY_FIXTURE = {
|
|
72
|
+
calculateContextSizes: () => ({
|
|
73
|
+
maxInputChars: 8_000,
|
|
74
|
+
maxOutputTokens: 1_000,
|
|
75
|
+
description: "fixture",
|
|
76
|
+
}),
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/** Run the local-LLM path, returning the prompt the model saw + the result. */
|
|
80
|
+
async function runLocal(turns: BufferTurn[]): Promise<{ prompt: string; result: ExtractionResult }> {
|
|
81
|
+
const engine = new ExtractionEngine(
|
|
82
|
+
parseConfig({ localLlmEnabled: true, localLlmModel: "fixture-local", localLlmFallback: false }),
|
|
83
|
+
);
|
|
84
|
+
let prompt = "";
|
|
85
|
+
const localLlm = {
|
|
86
|
+
async chatCompletion(messages: ChatMessage[], _options: { signal?: AbortSignal } = {}) {
|
|
87
|
+
prompt = messages[1]?.content ?? "";
|
|
88
|
+
return { content: JSON.stringify(HIGH_IMPACT_EXTRACTION) };
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
assert.equal(Reflect.set(engine, "localLlm", localLlm), true);
|
|
92
|
+
assert.equal(Reflect.set(engine, "modelRegistry", MODEL_REGISTRY_FIXTURE), true);
|
|
93
|
+
return { result: await engine.extract(turns), prompt };
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Run the gateway-fallback path. */
|
|
97
|
+
async function runGateway(turns: BufferTurn[]): Promise<{ prompt: string; result: ExtractionResult }> {
|
|
98
|
+
const engine = new ExtractionEngine(parseConfig({ modelSource: "gateway" }));
|
|
99
|
+
let prompt = "";
|
|
100
|
+
const fallbackLlm = {
|
|
101
|
+
async parseWithSchemaDetailed(
|
|
102
|
+
messages: ChatMessage[],
|
|
103
|
+
_schema: { parse: (data: unknown) => unknown },
|
|
104
|
+
_options: { signal?: AbortSignal } = {},
|
|
105
|
+
) {
|
|
106
|
+
prompt = messages[0]?.content ?? "";
|
|
107
|
+
return { modelUsed: "fixture-gateway", result: HIGH_IMPACT_EXTRACTION };
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
assert.equal(Reflect.set(engine, "fallbackLlm", fallbackLlm), true);
|
|
111
|
+
return { result: await engine.extract(turns), prompt };
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Run the direct OpenAI-compatible client path. */
|
|
115
|
+
async function runDirect(turns: BufferTurn[]): Promise<{ prompt: string; result: ExtractionResult }> {
|
|
116
|
+
const engine = new ExtractionEngine(parseConfig({ openaiApiKey: "fixture-key" }));
|
|
117
|
+
let prompt = "";
|
|
118
|
+
const client = {
|
|
119
|
+
chat: {
|
|
120
|
+
completions: {
|
|
121
|
+
async create(
|
|
122
|
+
request: { model: string; messages: ChatMessage[] },
|
|
123
|
+
_requestOptions?: { signal?: AbortSignal },
|
|
124
|
+
) {
|
|
125
|
+
prompt = request.messages[0]?.content ?? "";
|
|
126
|
+
return { choices: [{ message: { content: JSON.stringify(HIGH_IMPACT_EXTRACTION) } }] };
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
assert.equal(Reflect.set(engine, "client", client), true);
|
|
132
|
+
return { result: await engine.extract(turns), prompt };
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const PATHS: Array<[string, (turns: BufferTurn[]) => Promise<{ prompt: string; result: ExtractionResult }>]> = [
|
|
136
|
+
["local LLM", runLocal],
|
|
137
|
+
["gateway fallback", runGateway],
|
|
138
|
+
["direct client", runDirect],
|
|
139
|
+
];
|
|
140
|
+
|
|
141
|
+
for (const [name, run] of PATHS) {
|
|
142
|
+
test(`${name}: ambient turns add the provenance warning to the prompt`, async () => {
|
|
143
|
+
const { prompt } = await run([AMBIENT_TURN]);
|
|
144
|
+
|
|
145
|
+
assert.match(prompt, /always-on capture/i);
|
|
146
|
+
assert.match(prompt, /television|TV/);
|
|
147
|
+
assert.match(prompt, /speculative tier \(0\.00-0\.39\)/i);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
test(`${name}: typed turns keep the prompt free of ambient-capture text`, async () => {
|
|
151
|
+
const { prompt } = await run([TYPED_TURN]);
|
|
152
|
+
|
|
153
|
+
assert.doesNotMatch(prompt, /always-on capture/i);
|
|
154
|
+
assert.doesNotMatch(prompt, /ambient/i);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test(`${name}: a high-impact personal fact from ambient audio is clamped to speculative`, async () => {
|
|
158
|
+
const { result } = await run([AMBIENT_TURN]);
|
|
159
|
+
|
|
160
|
+
assert.equal(result.facts.length, 1, "the fact survives extraction, downgraded rather than dropped");
|
|
161
|
+
assert.equal(result.facts[0]?.confidence, SPECULATIVE_CONFIDENCE_CEILING);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
test(`${name}: the same fact typed by the user keeps its confidence`, async () => {
|
|
165
|
+
const { result } = await run([TYPED_TURN]);
|
|
166
|
+
|
|
167
|
+
assert.equal(result.facts.length, 1);
|
|
168
|
+
assert.equal(result.facts[0]?.confidence, 0.91);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
test("an ambient turn marked context-only does not trigger the ambient prompt", async () => {
|
|
173
|
+
const { prompt } = await runGateway([
|
|
174
|
+
{ ...AMBIENT_TURN, extractionContextOnly: true },
|
|
175
|
+
TYPED_TURN,
|
|
176
|
+
]);
|
|
177
|
+
|
|
178
|
+
assert.doesNotMatch(prompt, /always-on capture/i);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
test("the proactive second pass carries the ambient warning into its own prompts", async () => {
|
|
182
|
+
// The proactive pass makes extra LLM calls on the same conversation and
|
|
183
|
+
// merges their additions. Without the flag those prompts had no media
|
|
184
|
+
// warning at all, so a background line could return as a confident fact.
|
|
185
|
+
const engine = new ExtractionEngine(
|
|
186
|
+
parseConfig({
|
|
187
|
+
modelSource: "gateway",
|
|
188
|
+
proactiveExtractionEnabled: true,
|
|
189
|
+
maxProactiveQuestionsPerExtraction: 2,
|
|
190
|
+
}),
|
|
191
|
+
);
|
|
192
|
+
const prompts: string[] = [];
|
|
193
|
+
const fallbackLlm = {
|
|
194
|
+
async parseWithSchemaDetailed(
|
|
195
|
+
messages: ChatMessage[],
|
|
196
|
+
_schema: { parse: (data: unknown) => unknown },
|
|
197
|
+
_options: { signal?: AbortSignal } = {},
|
|
198
|
+
) {
|
|
199
|
+
prompts.push(messages.map((m) => m.content).join("\n"));
|
|
200
|
+
return { modelUsed: "fixture-gateway", result: HIGH_IMPACT_EXTRACTION };
|
|
201
|
+
},
|
|
202
|
+
// Question generation goes through parseWithSchema, answering through
|
|
203
|
+
// parseWithSchemaDetailed — the mock must offer both or the pass aborts.
|
|
204
|
+
async parseWithSchema(
|
|
205
|
+
messages: ChatMessage[],
|
|
206
|
+
_schema: { parse: (data: unknown) => unknown },
|
|
207
|
+
_options: { signal?: AbortSignal } = {},
|
|
208
|
+
) {
|
|
209
|
+
prompts.push(messages.map((m) => m.content).join("\n"));
|
|
210
|
+
return { questions: [{ question: "What else was said?", context: "", priority: 0.9 }] };
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
assert.equal(Reflect.set(engine, "fallbackLlm", fallbackLlm), true);
|
|
214
|
+
|
|
215
|
+
await engine.extract([AMBIENT_TURN]);
|
|
216
|
+
|
|
217
|
+
assert.ok(prompts.length > 1, "the proactive pass issued at least one extra call");
|
|
218
|
+
for (const [index, prompt] of prompts.entries()) {
|
|
219
|
+
assert.match(prompt, /ambient|always-on capture/i, `prompt ${index} carries the media warning`);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
test("ordinary ambient facts keep their confidence — only high-impact classes clamp", async () => {
|
|
224
|
+
const engine = new ExtractionEngine(parseConfig({ modelSource: "gateway" }));
|
|
225
|
+
const line = "The team uses PostgreSQL for the primary store.";
|
|
226
|
+
const fallbackLlm = {
|
|
227
|
+
async parseWithSchemaDetailed(
|
|
228
|
+
_messages: ChatMessage[],
|
|
229
|
+
_schema: { parse: (data: unknown) => unknown },
|
|
230
|
+
_options: { signal?: AbortSignal } = {},
|
|
231
|
+
) {
|
|
232
|
+
return {
|
|
233
|
+
modelUsed: "fixture-gateway",
|
|
234
|
+
result: {
|
|
235
|
+
facts: [{ category: "fact", content: line, confidence: 0.88, tags: ["tools"] }],
|
|
236
|
+
profileUpdates: [],
|
|
237
|
+
entities: [],
|
|
238
|
+
questions: [],
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
assert.equal(Reflect.set(engine, "fallbackLlm", fallbackLlm), true);
|
|
244
|
+
|
|
245
|
+
const result = await engine.extract([
|
|
246
|
+
{ ...AMBIENT_TURN, content: `[Wearable transcript (fixture) — 2026-08-02]\nSpeaker 1: ${line}` },
|
|
247
|
+
]);
|
|
248
|
+
|
|
249
|
+
assert.equal(result.facts[0]?.confidence, 0.88);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
function claim(content: string, tags: string[] = [], category: MemoryCategory = "fact") {
|
|
253
|
+
return { category, content, tags };
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
test("isHighImpactPersonalFact flags family, milestone, and medical content", () => {
|
|
257
|
+
for (const content of [
|
|
258
|
+
"Rachel's mother has a birthday on June 3rd.",
|
|
259
|
+
"Their wedding anniversary is in October.",
|
|
260
|
+
"He was diagnosed with diabetes last spring.",
|
|
261
|
+
"Her surgery is scheduled for Tuesday.",
|
|
262
|
+
"The funeral is on Saturday.",
|
|
263
|
+
// The health wording an earlier term list missed (review round 1).
|
|
264
|
+
"The user is HIV-positive.",
|
|
265
|
+
"He has depression.",
|
|
266
|
+
"She suffered a heart attack in March.",
|
|
267
|
+
"He is in remission after chemotherapy.",
|
|
268
|
+
"Her blood pressure medication was changed.",
|
|
269
|
+
// Everyday wording an earlier expansion still missed (review round 3).
|
|
270
|
+
"Dana has COVID-19.",
|
|
271
|
+
"She caught the flu last week.",
|
|
272
|
+
]) {
|
|
273
|
+
assert.equal(isHighImpactPersonalFact(claim(content)), true, content);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
test("isHighImpactPersonalFact flags personal-claim-shaped categories with no matching word", () => {
|
|
278
|
+
assert.equal(isHighImpactPersonalFact(claim("Dana leads the Helsinki office.", [], "relationship")), true);
|
|
279
|
+
assert.equal(isHighImpactPersonalFact(claim("They closed on the new place.", [], "moment")), true);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
test("isHighImpactPersonalFact flags bodily harm by sentence shape, not by condition name", () => {
|
|
283
|
+
// No condition vocabulary can be complete, so the injury/contagion SHAPE is
|
|
284
|
+
// matched directly — a harm verb pointed at a person's possession.
|
|
285
|
+
for (const content of [
|
|
286
|
+
"Dana broke her leg.",
|
|
287
|
+
"He tore his ACL playing soccer.",
|
|
288
|
+
"She bruised her wrist on the stairs.",
|
|
289
|
+
"Their grandfather passed away in March.",
|
|
290
|
+
"He was rushed to the hospital.",
|
|
291
|
+
]) {
|
|
292
|
+
assert.equal(isHighImpactPersonalFact(claim(content)), true, content);
|
|
293
|
+
}
|
|
294
|
+
// Articles are excluded on purpose: a broken build is not a broken bone.
|
|
295
|
+
assert.equal(isHighImpactPersonalFact(claim("The build broke the deploy pipeline.", ["tools"])), false);
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
test("a claim attached to a person entity is high-impact whatever it says", () => {
|
|
299
|
+
// The lexicon-free catch-all: extraction normalizes people to `person-<name>`,
|
|
300
|
+
// so wording no list anticipates is still flagged when it is about a person.
|
|
301
|
+
assert.equal(
|
|
302
|
+
isHighImpactPersonalFact({ category: "fact", content: "Dana is deaf.", entityRef: "person-dana" }),
|
|
303
|
+
true,
|
|
304
|
+
);
|
|
305
|
+
assert.equal(
|
|
306
|
+
isHighImpactPersonalFact({ category: "fact", content: "Some wording no list anticipates.", entityRef: "person-dana" }),
|
|
307
|
+
true,
|
|
308
|
+
);
|
|
309
|
+
assert.equal(
|
|
310
|
+
isHighImpactPersonalFact({ category: "fact", content: "Ships on Fridays.", entityRef: "project-remnic" }),
|
|
311
|
+
false,
|
|
312
|
+
"non-person entities are unaffected",
|
|
313
|
+
);
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
test("isHighImpactPersonalFact flags disability and chronic-condition wording", () => {
|
|
317
|
+
for (const content of ["Dana is deaf.", "Dana is blind.", "Dana has multiple sclerosis.", "He is in a nursing home."]) {
|
|
318
|
+
assert.equal(isHighImpactPersonalFact(claim(content)), true, content);
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
test("isHighImpactPersonalFact flags high-impact tags even when the text is bland", () => {
|
|
323
|
+
assert.equal(
|
|
324
|
+
isHighImpactPersonalFact(claim("The date is June 3rd.", ["Family"])),
|
|
325
|
+
true,
|
|
326
|
+
"tag matching is case-insensitive",
|
|
327
|
+
);
|
|
328
|
+
assert.equal(isHighImpactPersonalFact(claim("The date is June 3rd.", [" medical "])), true);
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
test("isHighImpactPersonalFact leaves ordinary content alone", () => {
|
|
332
|
+
for (const content of [
|
|
333
|
+
"The team uses PostgreSQL for the primary store.",
|
|
334
|
+
"Deploys run every Thursday at 9am.",
|
|
335
|
+
"The build cache lives under the workspace root.",
|
|
336
|
+
// Technical and business speech an earlier term list mis-flagged
|
|
337
|
+
// (review round 1): bare kinship-adjacent words are not personal.
|
|
338
|
+
"The child process inherits the parent environment.",
|
|
339
|
+
"Render the sibling node before the parent component.",
|
|
340
|
+
"Customer engagement rose after the launch.",
|
|
341
|
+
"The partner integration ships next quarter.",
|
|
342
|
+
"This is one of a family of retry strategies.",
|
|
343
|
+
]) {
|
|
344
|
+
assert.equal(isHighImpactPersonalFact(claim(content, ["tools"])), false, content);
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
test("isHighImpactPersonalFact flags the same kinship words once someone possesses them", () => {
|
|
349
|
+
for (const content of [
|
|
350
|
+
"His child starts school in September.",
|
|
351
|
+
"Rachel's parents are visiting next week.",
|
|
352
|
+
"Their family moved to Lisbon.",
|
|
353
|
+
]) {
|
|
354
|
+
assert.equal(isHighImpactPersonalFact(claim(content)), true, content);
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
function factOf(content: string, confidence: number, tags: string[] = []): ExtractedFact {
|
|
359
|
+
return { category: "fact", content, confidence, tags };
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
test("clampAmbientCaptureConfidence lowers only high-impact facts above the ceiling", () => {
|
|
363
|
+
const result: ExtractionResult = {
|
|
364
|
+
facts: [
|
|
365
|
+
factOf("Rachel's mother has a birthday on June 3rd.", 0.95),
|
|
366
|
+
factOf("The team uses PostgreSQL.", 0.95, ["tools"]),
|
|
367
|
+
factOf("His diagnosis was confirmed.", 0.2),
|
|
368
|
+
],
|
|
369
|
+
profileUpdates: [],
|
|
370
|
+
entities: [],
|
|
371
|
+
questions: [],
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
const clamped = clampAmbientCaptureConfidence(result);
|
|
375
|
+
|
|
376
|
+
assert.equal(clamped.facts[0]?.confidence, SPECULATIVE_CONFIDENCE_CEILING);
|
|
377
|
+
assert.equal(clamped.facts[1]?.confidence, 0.95, "ordinary facts are untouched");
|
|
378
|
+
assert.equal(clamped.facts[2]?.confidence, 0.2, "already-speculative facts are not raised");
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
test("clampAmbientCaptureConfidence returns the input untouched when nothing qualifies", () => {
|
|
382
|
+
const result: ExtractionResult = {
|
|
383
|
+
facts: [factOf("The team uses PostgreSQL.", 0.95, ["tools"])],
|
|
384
|
+
profileUpdates: [],
|
|
385
|
+
entities: [],
|
|
386
|
+
questions: [],
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
assert.equal(clampAmbientCaptureConfidence(result), result, "no reallocation on the common path");
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Clamping extraction confidence is not enough on its own: at the default
|
|
394
|
+
* thresholds, 0.39 x 0.8 sourceTrust plus a judge accept (+0.15), cross-source
|
|
395
|
+
* corroboration (+0.15), and an existing supporting memory (+0.10) reaches
|
|
396
|
+
* 0.712 — past the 0.7 auto-approve line. Two devices in one room recording
|
|
397
|
+
* the same television program corroborate each other perfectly, so the wearable
|
|
398
|
+
* pass caps a high-impact ambient candidate at the review queue.
|
|
399
|
+
*/
|
|
400
|
+
const DEFAULT_THRESHOLDS = { autoApproveTrust: 0.7, reviewTrust: 0.45 };
|
|
401
|
+
|
|
402
|
+
test("a fully-boosted high-impact ambient candidate stops at review, never active", () => {
|
|
403
|
+
const boosted = 0.39 * 0.8 + 0.15 + 0.15 + 0.1;
|
|
404
|
+
assert.ok(boosted > DEFAULT_THRESHOLDS.autoApproveTrust, "the boosts do clear auto-approve");
|
|
405
|
+
|
|
406
|
+
const capped = decideSmart(boosted, "accept", DEFAULT_THRESHOLDS, { capAtReview: true });
|
|
407
|
+
|
|
408
|
+
assert.equal(capped.outcome, "review");
|
|
409
|
+
assert.equal(capped.reason, "ambient-high-impact");
|
|
410
|
+
// The auto-approve comparison is inclusive, so the threshold itself must cap.
|
|
411
|
+
assert.equal(
|
|
412
|
+
decideSmart(DEFAULT_THRESHOLDS.autoApproveTrust, "accept", DEFAULT_THRESHOLDS, { capAtReview: true }).reason,
|
|
413
|
+
"ambient-high-impact",
|
|
414
|
+
);
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
test("the cap changes nothing for ordinary candidates or for drop/defer verdicts", () => {
|
|
418
|
+
assert.equal(decideSmart(0.9, "accept", DEFAULT_THRESHOLDS).outcome, "active");
|
|
419
|
+
assert.equal(decideSmart(0.5, undefined, DEFAULT_THRESHOLDS, { capAtReview: true }).reason, "queued-for-review");
|
|
420
|
+
assert.equal(decideSmart(0.9, "reject", DEFAULT_THRESHOLDS, { capAtReview: true }).outcome, "drop");
|
|
421
|
+
assert.equal(decideSmart(0.9, "defer", DEFAULT_THRESHOLDS, { capAtReview: true }).reason, "judge-deferred");
|
|
422
|
+
assert.equal(decideSmart(0.2, undefined, DEFAULT_THRESHOLDS, { capAtReview: true }).outcome, "drop");
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
test("wearable extraction turns carry the ambient-capture flag", () => {
|
|
426
|
+
const conversation: WearableConversation = {
|
|
427
|
+
id: "conv-1",
|
|
428
|
+
source: "fixture",
|
|
429
|
+
startIso: "2026-08-02T12:00:00.000Z",
|
|
430
|
+
endIso: "2026-08-02T12:10:00.000Z",
|
|
431
|
+
segments: [
|
|
432
|
+
{
|
|
433
|
+
speakerKey: "0",
|
|
434
|
+
text: "We should ship the release once the migration lands, and then review the rollout plan together.",
|
|
435
|
+
startIso: "2026-08-02T12:00:00.000Z",
|
|
436
|
+
},
|
|
437
|
+
],
|
|
438
|
+
};
|
|
439
|
+
const registry = emptySpeakerRegistry();
|
|
440
|
+
|
|
441
|
+
const turns = buildExtractionTurns("fixture", "2026-08-02", conversation, registry);
|
|
442
|
+
|
|
443
|
+
assert.ok(turns.length > 0, "the conversation is long enough to extract");
|
|
444
|
+
for (const turn of turns) {
|
|
445
|
+
assert.equal(turn.ambientCapture, true);
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* `BufferManager` validates a live turn against its `copyBufferTurn` snapshot
|
|
451
|
+
* before extracting. If the copy dropped an explicit `ambientCapture: false`
|
|
452
|
+
* while the comparison stayed strict, the two would never match and extraction
|
|
453
|
+
* would be skipped for as long as that turn stayed buffered.
|
|
454
|
+
*/
|
|
455
|
+
test("copyBufferTurn round-trips both ambient-flag values and equality agrees", () => {
|
|
456
|
+
for (const ambientCapture of [true, false, undefined]) {
|
|
457
|
+
const turn: BufferTurn = {
|
|
458
|
+
role: "user",
|
|
459
|
+
content: "a buffered turn",
|
|
460
|
+
timestamp: "2026-08-02T12:00:00.000Z",
|
|
461
|
+
...(ambientCapture === undefined ? {} : { ambientCapture }),
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
const copy = copyBufferTurn(turn);
|
|
465
|
+
|
|
466
|
+
assert.equal(copy.ambientCapture, ambientCapture, `copy preserves ${String(ambientCapture)}`);
|
|
467
|
+
assert.equal(bufferTurnsEqual(copy, turn), true, `snapshot matches for ${String(ambientCapture)}`);
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
test("the meeting scribe prompt carries the ambient-audio rule", () => {
|
|
472
|
+
assert.ok(SUMMARY_SYSTEM_PROMPT.includes(AMBIENT_CAPTURE_PROMPT_RULE));
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
test("personhood comes from entity metadata, not from how entityRef is spelled", () => {
|
|
476
|
+
// The prompt asks for `person-jane-doe` but the field is optional and models
|
|
477
|
+
// routinely emit a bare `dana`, so the prefix alone is not a reliable signal.
|
|
478
|
+
const refs = collectPersonEntityRefs({
|
|
479
|
+
entities: [
|
|
480
|
+
{ name: "Dana Reed", type: "person" },
|
|
481
|
+
{ name: "remnic", type: "project" },
|
|
482
|
+
],
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
assert.equal(isHighImpactPersonalFact({ category: "fact", content: "Dana has ALS.", entityRef: "dana-reed" }, refs), true);
|
|
486
|
+
assert.equal(isHighImpactPersonalFact({ category: "fact", content: "Dana has ALS.", entityRef: "Dana_Reed" }, refs), true);
|
|
487
|
+
assert.equal(
|
|
488
|
+
isHighImpactPersonalFact({ category: "fact", content: "Ships on Fridays.", entityRef: "remnic" }, refs),
|
|
489
|
+
false,
|
|
490
|
+
"non-person entities stay out of the cap",
|
|
491
|
+
);
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
test("the clamp resolves person entities from the extraction it is given", () => {
|
|
495
|
+
const clamped = clampAmbientCaptureConfidence({
|
|
496
|
+
facts: [
|
|
497
|
+
{ category: "fact", content: "Dana has ALS.", confidence: 0.95, tags: ["personal"], entityRef: "dana" },
|
|
498
|
+
{ category: "fact", content: "Remnic ships on Fridays.", confidence: 0.95, tags: ["tools"], entityRef: "remnic" },
|
|
499
|
+
],
|
|
500
|
+
profileUpdates: [],
|
|
501
|
+
entities: [
|
|
502
|
+
{ name: "dana", type: "person", facts: [] },
|
|
503
|
+
{ name: "remnic", type: "project", facts: [] },
|
|
504
|
+
],
|
|
505
|
+
questions: [],
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
assert.equal(clamped.facts[0]?.confidence, SPECULATIVE_CONFIDENCE_CEILING, "an unprefixed person ref still clamps");
|
|
509
|
+
assert.equal(clamped.facts[1]?.confidence, 0.95);
|
|
510
|
+
});
|