@remnic/core 9.30.1 → 9.32.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 +55 -44
- package/dist/access-authorization-probe.d.ts +10 -10
- package/dist/access-authorization-probe.js +56 -45
- package/dist/access-boundary.d.ts +13 -11
- package/dist/access-boundary.js +55 -44
- package/dist/access-cli.js +170 -126
- package/dist/access-cli.js.map +1 -1
- package/dist/access-extraction-force-flush.d.ts +119 -0
- package/dist/access-extraction-force-flush.js +171 -0
- package/dist/access-health-types.d.ts +1 -1
- package/dist/access-http-lcm-compaction.d.ts +47 -13
- package/dist/access-http-lcm-compaction.js +7 -3
- package/dist/access-http-lifecycle-flush.d.ts +132 -0
- package/dist/access-http-lifecycle-flush.js +9 -0
- package/dist/access-http-lifecycle-flush.js.map +1 -0
- package/dist/access-http.d.ts +11 -10
- package/dist/access-http.js +71 -59
- package/dist/access-identity-continuity-surface.d.ts +8 -8
- package/dist/access-identity-continuity-surface.js +55 -44
- package/dist/access-lcm-surface.d.ts +10 -10
- package/dist/access-lcm-surface.js +55 -44
- package/dist/access-mcp-output-schemas.js +1 -1
- package/dist/access-mcp.d.ts +16 -10
- package/dist/access-mcp.js +63 -52
- package/dist/access-memory-search-fanout.d.ts +2 -2
- package/dist/{access-namespace-preflight-VfXssvoI.d.ts → access-namespace-preflight-COhbXBqS.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +3 -3
- package/dist/access-namespace-preflight.js +55 -44
- package/dist/access-observe-helpers.d.ts +22 -0
- package/dist/access-observe-helpers.js +10 -0
- package/dist/access-observe-helpers.js.map +1 -0
- package/dist/access-observe-write-surface.d.ts +51 -47
- package/dist/access-observe-write-surface.js +55 -44
- package/dist/access-operations-batch.js +58 -47
- package/dist/access-operations.d.ts +11 -11
- package/dist/access-operations.js +60 -49
- package/dist/access-recall-concurrency.d.ts +10 -10
- package/dist/access-recall-concurrency.js +55 -44
- package/dist/access-recall-response.d.ts +10 -10
- package/dist/access-recall-response.js +55 -44
- package/dist/access-recall-surface.d.ts +10 -10
- package/dist/access-recall-surface.js +55 -44
- package/dist/access-schema.d.ts +37 -7
- package/dist/access-schema.js +5 -3
- package/dist/{access-service-B5RwVsTV.d.ts → access-service-BmBTtEKO.d.ts} +44 -20
- package/dist/access-service-helpers.d.ts +113 -0
- package/dist/access-service-helpers.js +8 -0
- package/dist/access-service-helpers.js.map +1 -0
- package/dist/access-service.d.ts +10 -10
- package/dist/access-service.js +55 -44
- package/dist/access-surface-catalog.d.ts +10 -10
- package/dist/access-surface-catalog.js +2 -0
- package/dist/access-surface-catalog.js.map +1 -1
- 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/active-recall.js +2 -2
- package/dist/adapters/index.js +7 -7
- package/dist/adapters/registry.js +3 -3
- 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 +14 -14
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer-turn-helpers.d.ts +5 -0
- package/dist/buffer-turn-helpers.js +24 -0
- package/dist/buffer-turn-helpers.js.map +1 -0
- package/dist/buffer.d.ts +17 -4
- package/dist/buffer.js +21 -1
- 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/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
- package/dist/capsule-crypto-7FJQINUR.js.map +1 -0
- package/dist/{capsule-merge-5KKJQBWQ.js → capsule-merge-2H2IUTBT.js} +4 -4
- package/dist/{catalog-V7inUQdp.d.ts → catalog-Dm-DvNBY.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +21 -22
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-LEPOP46W.js → chunk-227UFSEQ.js} +4 -4
- package/dist/{chunk-I5NLEENJ.js → chunk-27HHNYSQ.js} +3 -3
- package/dist/{chunk-2SA56WMI.js → chunk-2LTDWSR6.js} +4 -4
- package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
- package/dist/{chunk-SPJXKAVF.js → chunk-2NTGBZLZ.js} +14 -13
- package/dist/chunk-2NTGBZLZ.js.map +1 -0
- package/dist/{chunk-P5PXWTW7.js → chunk-2Q4JJ3FZ.js} +3 -3
- package/dist/{chunk-G5R3D5UP.js → chunk-2QIMTVEJ.js} +6 -5
- package/dist/chunk-2QIMTVEJ.js.map +1 -0
- package/dist/{chunk-H5CPS5JP.js → chunk-35IVNNRK.js} +3 -3
- package/dist/{chunk-LBOD4U5B.js → chunk-3EQ2XB3W.js} +6 -6
- package/dist/{chunk-YTSNAUXN.js → chunk-3F2LKUMU.js} +22 -8
- package/dist/chunk-3F2LKUMU.js.map +1 -0
- package/dist/chunk-3QL24R5Y.js +9 -0
- package/dist/chunk-3QL24R5Y.js.map +1 -0
- package/dist/chunk-4RNZMRAV.js +60 -0
- package/dist/chunk-4RNZMRAV.js.map +1 -0
- package/dist/chunk-5IVLTFOV.js +65 -0
- package/dist/chunk-5IVLTFOV.js.map +1 -0
- package/dist/{chunk-2EUVEDF5.js → chunk-5WZVQRHV.js} +2 -2
- package/dist/{chunk-ALSGMEJR.js → chunk-65ZPVYTA.js} +7 -7
- package/dist/{chunk-GIBMDSJ2.js → chunk-6P7MTSU5.js} +2 -2
- package/dist/{chunk-5VQJBH2G.js → chunk-6TAUHL33.js} +2 -2
- package/dist/{chunk-WVO4G37W.js → chunk-7TEZUUGM.js} +3 -3
- package/dist/{chunk-MJCGLM25.js → chunk-7VUAG236.js} +5 -5
- package/dist/{chunk-CZRYLSSW.js → chunk-AJL6NNX6.js} +2 -2
- package/dist/{chunk-LGHKJABJ.js → chunk-AQEJE3WO.js} +40 -18
- package/dist/chunk-AQEJE3WO.js.map +1 -0
- package/dist/{chunk-66772WBP.js → chunk-AQWVJURR.js} +5 -5
- package/dist/{chunk-RKNJBZ55.js → chunk-AU7Q3LSC.js} +7 -7
- package/dist/{chunk-IYZ5K7MU.js → chunk-BUE5E2HL.js} +4 -187
- package/dist/chunk-BUE5E2HL.js.map +1 -0
- package/dist/{chunk-NHWB6HG2.js → chunk-CE5355TT.js} +21 -5
- package/dist/chunk-CE5355TT.js.map +1 -0
- package/dist/{chunk-M3C2V3PV.js → chunk-CJDNT45S.js} +12 -12
- package/dist/{chunk-D2ANTDGO.js → chunk-E6BMSH7U.js} +2 -2
- package/dist/{chunk-CKMO4RDY.js → chunk-EMDLM3LW.js} +4 -4
- package/dist/chunk-ER7W6H4T.js +112 -0
- package/dist/chunk-ER7W6H4T.js.map +1 -0
- package/dist/{chunk-RGIWINDN.js → chunk-FHBITMRY.js} +30 -30
- package/dist/{chunk-6FUPCJUL.js → chunk-FMFLGS5Z.js} +54 -54
- package/dist/chunk-FMFLGS5Z.js.map +1 -0
- package/dist/{chunk-FDAMS4PK.js → chunk-G2YQ57YO.js} +4 -4
- package/dist/{chunk-6U7F52DE.js → chunk-HFQQWAMS.js} +62 -62
- package/dist/{chunk-5W4ZLBEZ.js → chunk-HKPJPOW7.js} +2 -2
- package/dist/{chunk-JCBWCYEJ.js → chunk-IGWFKW4B.js} +2 -2
- package/dist/{chunk-AITCS2RC.js → chunk-IJ7HK452.js} +4 -4
- package/dist/{chunk-4WKA6I65.js → chunk-J3ZGPYXB.js} +1135 -311
- package/dist/chunk-J3ZGPYXB.js.map +1 -0
- package/dist/{chunk-D3LMYTBV.js → chunk-J7WZUL2K.js} +9 -9
- package/dist/{chunk-5W7CTZ2E.js → chunk-KQAFEZQX.js} +4 -4
- package/dist/{chunk-YNQBRLC5.js → chunk-LUQ443JP.js} +520 -2011
- package/dist/chunk-LUQ443JP.js.map +1 -0
- package/dist/{chunk-Z54EM5YZ.js → chunk-MAXVH44E.js} +7 -7
- package/dist/{chunk-WZFAPHIK.js → chunk-MU7ZHSZE.js} +2 -2
- package/dist/chunk-N5Z4EVOR.js +123 -0
- package/dist/chunk-N5Z4EVOR.js.map +1 -0
- package/dist/{chunk-AZ5BTEKX.js → chunk-NQUF7XKR.js} +2 -2
- package/dist/{chunk-W4FBGYGK.js → chunk-NRV4Y3PM.js} +1 -1
- package/dist/{chunk-62U4J2GN.js → chunk-ODGOP7P2.js} +2 -2
- package/dist/{chunk-QJAQNXWI.js → chunk-ONHRRJZM.js} +6 -6
- package/dist/{chunk-ACXPX4AG.js → chunk-OPBTPRGY.js} +2 -2
- package/dist/{chunk-XOZ4ALGB.js → chunk-QDTZ2HF7.js} +3 -3
- package/dist/{chunk-GBJ4RDFR.js → chunk-QIHIHZYC.js} +66 -91
- package/dist/chunk-QIHIHZYC.js.map +1 -0
- package/dist/{chunk-ZPSVBSOF.js → chunk-QMWFQBIL.js} +3 -3
- package/dist/{chunk-W5EG6LE3.js → chunk-THCPRMRF.js} +3 -3
- package/dist/{chunk-4A6YGWQN.js → chunk-TL4TO3EA.js} +115 -120
- package/dist/chunk-TL4TO3EA.js.map +1 -0
- package/dist/{chunk-VI2JQPNQ.js → chunk-U7QYBSQJ.js} +2 -2
- package/dist/chunk-ULARSG5Z.js +203 -0
- package/dist/chunk-ULARSG5Z.js.map +1 -0
- package/dist/{chunk-TH2LSRMG.js → chunk-UORKJ34C.js} +2 -2
- package/dist/{chunk-4Z4XNEWZ.js → chunk-VCD4PSK2.js} +56 -12
- package/dist/chunk-VCD4PSK2.js.map +1 -0
- package/dist/{chunk-K5GB36ME.js → chunk-VMZ56EE3.js} +2 -2
- package/dist/{chunk-HUHX2OCX.js → chunk-VVDPPDDF.js} +1 -1
- package/dist/chunk-VVDPPDDF.js.map +1 -0
- package/dist/{chunk-RMMVQQA6.js → chunk-WDISJRMG.js} +2 -2
- package/dist/{chunk-B6JDYXL7.js → chunk-WWUVONGW.js} +7 -1
- package/dist/chunk-WWUVONGW.js.map +1 -0
- package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
- package/dist/{chunk-CVILPI77.js → chunk-XOQSEF7X.js} +6 -6
- package/dist/{chunk-RPW2NOU6.js → chunk-YIAA2X3D.js} +41 -1
- package/dist/chunk-YIAA2X3D.js.map +1 -0
- package/dist/chunk-YPC7W6GA.js +1604 -0
- package/dist/chunk-YPC7W6GA.js.map +1 -0
- package/dist/{chunk-YTQNQ4KB.js → chunk-YX5LN6JR.js} +3 -3
- package/dist/{chunk-IC6CBHCA.js → chunk-Z7XKUWYS.js} +2 -2
- package/dist/{chunk-PHWUFPCO.js → chunk-ZCPP5OW6.js} +61 -53
- package/dist/chunk-ZCPP5OW6.js.map +1 -0
- package/dist/{cli-C4GbETPC.d.ts → cli-DRJLv1Xt.d.ts} +5 -5
- package/dist/cli.d.ts +12 -12
- package/dist/cli.js +96 -86
- package/dist/compounding/engine.d.ts +2 -2
- package/dist/compounding/engine.js +14 -14
- 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/config.js +2 -2
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +14 -15
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +3 -2
- package/dist/connectors/index.js +24 -23
- package/dist/consolidation-provenance-check.d.ts +2 -2
- package/dist/consolidation-provenance-check.js +5 -5
- package/dist/consolidation-undo.d.ts +2 -2
- package/dist/consolidation-undo.js +3 -3
- package/dist/contradiction/index.d.ts +2 -2
- package/dist/contradiction/index.js +4 -4
- 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 +26 -26
- 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 +14 -14
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +8 -8
- 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-source-grounding-rules.d.ts +1 -1
- package/dist/extraction-source-grounding.d.ts +15 -2
- package/dist/extraction-source-grounding.js +10 -1
- package/dist/extraction.d.ts +2 -15
- package/dist/extraction.js +5 -4
- 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 +19 -19
- package/dist/index.js +253 -246
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/engine.js +3 -3
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/index.js +6 -6
- 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-helpers.d.ts +7 -0
- package/dist/local-llm-helpers.js +16 -0
- package/dist/local-llm-helpers.js.map +1 -0
- package/dist/local-llm.d.ts +3 -6
- package/dist/local-llm.js +2 -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 +14 -14
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +14 -14
- package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-projection.js +15 -15
- package/dist/{maintenance-CL30NWtc.d.ts → maintenance-C6Pffz30.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-corpus-version.js +2 -2
- 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-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 +24 -24
- 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 +14 -14
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/offline-sync-impression-drain.d.ts +1 -1
- package/dist/offline-sync-impression-drain.js +6 -5
- package/dist/operator-doctor-corpus.d.ts +1 -1
- package/dist/operator-doctor-corpus.js +29 -29
- package/dist/operator-doctor-replica.d.ts +1 -1
- package/dist/operator-doctor-replica.js +3 -3
- package/dist/operator-toolkit.d.ts +3 -3
- package/dist/operator-toolkit.js +39 -38
- package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
- package/dist/orchestration/maintenance.d.ts +4 -4
- package/dist/orchestration/maintenance.js +22 -21
- package/dist/{orchestrator-CKTCRwWV.d.ts → orchestrator-eQlmasno.d.ts} +72 -34
- package/dist/orchestrator.d.ts +8 -8
- package/dist/orchestrator.js +169 -162
- package/dist/page-versioning.js +3 -3
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/{pipeline-B7wj4rRZ.d.ts → pipeline-CZGmAMQ2.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-q9tg4dHp.d.ts → qmd-DBj4MF8T.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/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-divergence.js +2 -2
- package/dist/replica-peers-config.d.ts +1 -1
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/resume-bundles.js +2 -2
- 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-CWDyglPM.d.ts → scope-profiles-S85lrsUn.d.ts} +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 +12 -12
- 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-BUE3deLn.d.ts → semantic-consolidation-DVzDcV6x.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +17 -18
- package/dist/semantic-rule-promotion.js +14 -14
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +14 -14
- package/dist/{service-CXgM0bQG.d.ts → service-C2M-wD4W.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/{storage-DysJq-XH.d.ts → storage-dyBC3Q84.d.ts} +1 -1
- package/dist/storage.d.ts +2 -2
- package/dist/storage.js +13 -13
- package/dist/summarizer.d.ts +1 -1
- package/dist/summarizer.js +3 -2
- 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/tokens.js +2 -2
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/capsule-import.js +5 -5
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-aPPzhnjT.d.ts → types-D63ZI--P.d.ts} +23 -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 +14 -14
- package/dist/write-envelope.d.ts +1 -1
- package/package.json +2 -2
- package/src/access-boundary.ts +3 -0
- package/src/access-cli.test.ts +93 -0
- package/src/access-cli.ts +56 -2
- package/src/access-extraction-force-flush.ts +177 -0
- package/src/access-http-extraction-force-flush.test.ts +132 -0
- package/src/access-http-lcm-compaction.ts +99 -22
- package/src/access-http-lifecycle-flush.ts +81 -0
- package/src/access-http.test.ts +227 -0
- package/src/access-http.ts +33 -40
- package/src/access-mcp-output-schemas.ts +6 -0
- package/src/access-mcp.test.ts +40 -0
- package/src/access-mcp.ts +32 -1
- package/src/access-observe-helpers.ts +180 -0
- package/src/access-observe-write-surface.ts +78 -19
- package/src/access-operations-batch.ts +2 -1
- package/src/access-schema-pi.test.ts +17 -0
- package/src/access-schema.ts +28 -11
- package/src/access-service-helpers.ts +46 -0
- package/src/access-service-observe-lcm-parity.test.ts +781 -31
- package/src/access-service-observe-scope.test.ts +88 -0
- package/src/access-service.ts +46 -128
- package/src/access-surface-catalog.test.ts +32 -0
- package/src/access-surface-catalog.ts +2 -0
- package/src/buffer-session.test.ts +148 -0
- package/src/buffer-turn-helpers.ts +152 -0
- package/src/buffer.ts +126 -201
- package/src/connectors/index.ts +1 -1
- package/src/connectors/label.ts +18 -0
- package/src/correction/correction-access-wiring.ts +79 -27
- package/src/correction/correction-executor.test.ts +542 -1
- package/src/correction/correction-executor.ts +309 -89
- package/src/correction/correction-planner.test.ts +35 -1
- package/src/correction/correction-planner.ts +50 -3
- package/src/correction/correction-service.ts +12 -7
- package/src/correction/correction-storage-integration.test.ts +172 -1
- package/src/correction/passive-capture.test.ts +35 -0
- package/src/correction/passive-capture.ts +17 -3
- package/src/extraction-source-grounding.ts +55 -1
- package/src/extraction-timeout.test.ts +51 -0
- package/src/extraction.ts +64 -90
- package/src/local-llm-headers-timeout.test.ts +48 -0
- package/src/local-llm-helpers.ts +58 -0
- package/src/local-llm.ts +62 -58
- package/src/orchestration/extraction-run-helpers.ts +309 -0
- package/src/orchestration/extraction-run.test.ts +350 -7
- package/src/orchestration/extraction-run.ts +327 -250
- package/src/orchestration/recall-result-formatter.ts +21 -2
- package/src/orchestration/recall-search-pipeline.test.ts +34 -0
- package/src/orchestration/recall-search-pipeline.ts +9 -1
- package/src/orchestration/session-context.ts +193 -18
- package/src/orchestration/turn-ingestion.ts +61 -11
- package/src/orchestrator-flush.test.ts +511 -5
- package/src/orchestrator.ts +8 -6
- package/src/recall-source-connector-label.test.ts +300 -0
- package/src/types.ts +3 -3
- package/dist/chunk-3UXOZBHV.js +0 -20
- package/dist/chunk-3UXOZBHV.js.map +0 -1
- package/dist/chunk-4A6YGWQN.js.map +0 -1
- package/dist/chunk-4WKA6I65.js.map +0 -1
- package/dist/chunk-4Z4XNEWZ.js.map +0 -1
- package/dist/chunk-6FUPCJUL.js.map +0 -1
- package/dist/chunk-B6JDYXL7.js.map +0 -1
- package/dist/chunk-G5R3D5UP.js.map +0 -1
- package/dist/chunk-GBJ4RDFR.js.map +0 -1
- package/dist/chunk-HUHX2OCX.js.map +0 -1
- package/dist/chunk-IYZ5K7MU.js.map +0 -1
- package/dist/chunk-LGHKJABJ.js.map +0 -1
- package/dist/chunk-NHWB6HG2.js.map +0 -1
- package/dist/chunk-PHWUFPCO.js.map +0 -1
- package/dist/chunk-RPW2NOU6.js.map +0 -1
- package/dist/chunk-SPJXKAVF.js.map +0 -1
- package/dist/chunk-YNQBRLC5.js.map +0 -1
- package/dist/chunk-YTSNAUXN.js.map +0 -1
- /package/dist/{capsule-crypto-GWVG7LGC.js.map → access-extraction-force-flush.js.map} +0 -0
- /package/dist/{capsule-merge-5KKJQBWQ.js.map → capsule-merge-2H2IUTBT.js.map} +0 -0
- /package/dist/{chunk-LEPOP46W.js.map → chunk-227UFSEQ.js.map} +0 -0
- /package/dist/{chunk-I5NLEENJ.js.map → chunk-27HHNYSQ.js.map} +0 -0
- /package/dist/{chunk-2SA56WMI.js.map → chunk-2LTDWSR6.js.map} +0 -0
- /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
- /package/dist/{chunk-P5PXWTW7.js.map → chunk-2Q4JJ3FZ.js.map} +0 -0
- /package/dist/{chunk-H5CPS5JP.js.map → chunk-35IVNNRK.js.map} +0 -0
- /package/dist/{chunk-LBOD4U5B.js.map → chunk-3EQ2XB3W.js.map} +0 -0
- /package/dist/{chunk-2EUVEDF5.js.map → chunk-5WZVQRHV.js.map} +0 -0
- /package/dist/{chunk-ALSGMEJR.js.map → chunk-65ZPVYTA.js.map} +0 -0
- /package/dist/{chunk-GIBMDSJ2.js.map → chunk-6P7MTSU5.js.map} +0 -0
- /package/dist/{chunk-5VQJBH2G.js.map → chunk-6TAUHL33.js.map} +0 -0
- /package/dist/{chunk-WVO4G37W.js.map → chunk-7TEZUUGM.js.map} +0 -0
- /package/dist/{chunk-MJCGLM25.js.map → chunk-7VUAG236.js.map} +0 -0
- /package/dist/{chunk-CZRYLSSW.js.map → chunk-AJL6NNX6.js.map} +0 -0
- /package/dist/{chunk-66772WBP.js.map → chunk-AQWVJURR.js.map} +0 -0
- /package/dist/{chunk-RKNJBZ55.js.map → chunk-AU7Q3LSC.js.map} +0 -0
- /package/dist/{chunk-M3C2V3PV.js.map → chunk-CJDNT45S.js.map} +0 -0
- /package/dist/{chunk-D2ANTDGO.js.map → chunk-E6BMSH7U.js.map} +0 -0
- /package/dist/{chunk-CKMO4RDY.js.map → chunk-EMDLM3LW.js.map} +0 -0
- /package/dist/{chunk-RGIWINDN.js.map → chunk-FHBITMRY.js.map} +0 -0
- /package/dist/{chunk-FDAMS4PK.js.map → chunk-G2YQ57YO.js.map} +0 -0
- /package/dist/{chunk-6U7F52DE.js.map → chunk-HFQQWAMS.js.map} +0 -0
- /package/dist/{chunk-5W4ZLBEZ.js.map → chunk-HKPJPOW7.js.map} +0 -0
- /package/dist/{chunk-JCBWCYEJ.js.map → chunk-IGWFKW4B.js.map} +0 -0
- /package/dist/{chunk-AITCS2RC.js.map → chunk-IJ7HK452.js.map} +0 -0
- /package/dist/{chunk-D3LMYTBV.js.map → chunk-J7WZUL2K.js.map} +0 -0
- /package/dist/{chunk-5W7CTZ2E.js.map → chunk-KQAFEZQX.js.map} +0 -0
- /package/dist/{chunk-Z54EM5YZ.js.map → chunk-MAXVH44E.js.map} +0 -0
- /package/dist/{chunk-WZFAPHIK.js.map → chunk-MU7ZHSZE.js.map} +0 -0
- /package/dist/{chunk-AZ5BTEKX.js.map → chunk-NQUF7XKR.js.map} +0 -0
- /package/dist/{chunk-W4FBGYGK.js.map → chunk-NRV4Y3PM.js.map} +0 -0
- /package/dist/{chunk-62U4J2GN.js.map → chunk-ODGOP7P2.js.map} +0 -0
- /package/dist/{chunk-QJAQNXWI.js.map → chunk-ONHRRJZM.js.map} +0 -0
- /package/dist/{chunk-ACXPX4AG.js.map → chunk-OPBTPRGY.js.map} +0 -0
- /package/dist/{chunk-XOZ4ALGB.js.map → chunk-QDTZ2HF7.js.map} +0 -0
- /package/dist/{chunk-ZPSVBSOF.js.map → chunk-QMWFQBIL.js.map} +0 -0
- /package/dist/{chunk-W5EG6LE3.js.map → chunk-THCPRMRF.js.map} +0 -0
- /package/dist/{chunk-VI2JQPNQ.js.map → chunk-U7QYBSQJ.js.map} +0 -0
- /package/dist/{chunk-TH2LSRMG.js.map → chunk-UORKJ34C.js.map} +0 -0
- /package/dist/{chunk-K5GB36ME.js.map → chunk-VMZ56EE3.js.map} +0 -0
- /package/dist/{chunk-RMMVQQA6.js.map → chunk-WDISJRMG.js.map} +0 -0
- /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
- /package/dist/{chunk-CVILPI77.js.map → chunk-XOQSEF7X.js.map} +0 -0
- /package/dist/{chunk-YTQNQ4KB.js.map → chunk-YX5LN6JR.js.map} +0 -0
- /package/dist/{chunk-IC6CBHCA.js.map → chunk-Z7XKUWYS.js.map} +0 -0
package/src/extraction.ts
CHANGED
|
@@ -39,8 +39,11 @@ import { ProfilingCollector } from "./profiling.js";
|
|
|
39
39
|
import { normalizeProcedureSteps } from "./procedural/procedure-types.js";
|
|
40
40
|
import { normalizeReasoningTrace } from "./reasoning-trace-types.js";
|
|
41
41
|
import { looksLikeMechanicalTelemetryTranscript } from "./telemetry-transcript.js";
|
|
42
|
-
import {
|
|
43
|
-
|
|
42
|
+
import {
|
|
43
|
+
attachExtractionProvenance,
|
|
44
|
+
applyExtractionSourceGrounding,
|
|
45
|
+
type ExtractionGroundingRoleSources,
|
|
46
|
+
} from "./extraction-source-grounding.js";
|
|
44
47
|
import { isMemoryCategory } from "./write-envelope.js";
|
|
45
48
|
import { classifyExtractionThrownError, classifyFallbackParseFailure } from "./extraction-error-classification.js";
|
|
46
49
|
export { classifyExtractionThrownError, classifyFallbackParseFailure } from "./extraction-error-classification.js";
|
|
@@ -185,6 +188,12 @@ export function shouldEnableLocalExtractionThinking(
|
|
|
185
188
|
conversationChars < config.localLlmThinkingThresholdChars;
|
|
186
189
|
}
|
|
187
190
|
|
|
191
|
+
function throwIfExtractionAborted(signal?: AbortSignal): void {
|
|
192
|
+
if (!signal?.aborted) return;
|
|
193
|
+
const reason = signal.reason;
|
|
194
|
+
throw reason instanceof Error ? reason : new Error("extraction aborted");
|
|
195
|
+
}
|
|
196
|
+
|
|
188
197
|
export class ExtractionEngine {
|
|
189
198
|
private client: OpenAI | null;
|
|
190
199
|
private localLlm: LocalLlmClient;
|
|
@@ -661,19 +670,21 @@ export class ExtractionEngine {
|
|
|
661
670
|
assertionSource: string,
|
|
662
671
|
messageTimestamp?: Date,
|
|
663
672
|
roleAssertionSources?: ExtractionGroundingRoleSources,
|
|
673
|
+
signal?: AbortSignal,
|
|
664
674
|
): Promise<ExtractionResult> {
|
|
665
675
|
if (!resolvePipelineProcessingCapabilities(this.config).proactiveExtraction) return base;
|
|
666
676
|
const maxAdditional = Math.max(0, Math.floor(this.config.maxProactiveQuestionsPerExtraction));
|
|
667
677
|
if (!shouldRunProactivePass(this.config, maxAdditional, this.shouldUseLocalLlm, this.localLlm)) return base;
|
|
668
678
|
|
|
669
679
|
try {
|
|
670
|
-
const proactive = await this.generateProactiveQuestions(conversation, base, maxAdditional);
|
|
680
|
+
const proactive = await this.generateProactiveQuestions(conversation, base, maxAdditional, signal);
|
|
671
681
|
if (proactive.length === 0) return base;
|
|
672
682
|
const proactiveAdditions = await this.answerProactiveQuestions(
|
|
673
683
|
conversation,
|
|
674
684
|
base,
|
|
675
685
|
proactive,
|
|
676
686
|
maxAdditional,
|
|
687
|
+
signal,
|
|
677
688
|
);
|
|
678
689
|
const sanitizedAdditions = this.sanitizeExtractionResult(proactiveAdditions, messageTimestamp);
|
|
679
690
|
const groundedAdditions = this.applySourceGrounding(
|
|
@@ -686,6 +697,7 @@ export class ExtractionEngine {
|
|
|
686
697
|
if (!this.hasExtractionOutputs(groundedAdditions)) return base;
|
|
687
698
|
return this.mergeProactiveExtractionPass(base, groundedAdditions, maxAdditional);
|
|
688
699
|
} catch (err) {
|
|
700
|
+
if (signal?.aborted) throw err;
|
|
689
701
|
log.debug(`proactive extraction question pass failed (ignored): ${err}`);
|
|
690
702
|
return base;
|
|
691
703
|
}
|
|
@@ -729,6 +741,7 @@ export class ExtractionEngine {
|
|
|
729
741
|
conversation: string,
|
|
730
742
|
base: ExtractionResult,
|
|
731
743
|
maxAdditional: number,
|
|
744
|
+
signal?: AbortSignal,
|
|
732
745
|
): Promise<ExtractionQuestion[]> {
|
|
733
746
|
const existingQuestionKeys = new Set(
|
|
734
747
|
(base.questions ?? [])
|
|
@@ -776,8 +789,10 @@ export class ExtractionEngine {
|
|
|
776
789
|
timeoutMs: this.config.proactiveExtractionTimeoutMs,
|
|
777
790
|
operation: "proactive_extraction",
|
|
778
791
|
priority: "background",
|
|
792
|
+
signal,
|
|
779
793
|
},
|
|
780
794
|
);
|
|
795
|
+
throwIfExtractionAborted(signal);
|
|
781
796
|
if (localResponse?.content) {
|
|
782
797
|
const localParsed = this.parseProactiveQuestionsFromText(
|
|
783
798
|
localResponse.content.trim(),
|
|
@@ -791,7 +806,7 @@ export class ExtractionEngine {
|
|
|
791
806
|
return [];
|
|
792
807
|
}
|
|
793
808
|
} catch (err) {
|
|
794
|
-
if (!this.config.localLlmFallback) {
|
|
809
|
+
if (signal?.aborted || !this.config.localLlmFallback) {
|
|
795
810
|
throw err;
|
|
796
811
|
}
|
|
797
812
|
}
|
|
@@ -810,6 +825,7 @@ export class ExtractionEngine {
|
|
|
810
825
|
temperature: 0.2,
|
|
811
826
|
maxTokens: this.config.proactiveExtractionMaxTokens,
|
|
812
827
|
timeoutMs: this.config.proactiveExtractionTimeoutMs,
|
|
828
|
+
signal,
|
|
813
829
|
}),
|
|
814
830
|
);
|
|
815
831
|
if (!fallbackResult?.questions) return [];
|
|
@@ -825,6 +841,7 @@ export class ExtractionEngine {
|
|
|
825
841
|
base: ExtractionResult,
|
|
826
842
|
proactiveQuestions: ExtractionQuestion[],
|
|
827
843
|
maxAdditional: number,
|
|
844
|
+
signal?: AbortSignal,
|
|
828
845
|
): Promise<ExtractionResult> {
|
|
829
846
|
const factsPreview = base.facts
|
|
830
847
|
.slice(0, 8)
|
|
@@ -883,8 +900,10 @@ export class ExtractionEngine {
|
|
|
883
900
|
timeoutMs: this.config.proactiveExtractionTimeoutMs,
|
|
884
901
|
operation: "proactive_extraction",
|
|
885
902
|
priority: "background",
|
|
903
|
+
signal,
|
|
886
904
|
},
|
|
887
905
|
);
|
|
906
|
+
throwIfExtractionAborted(signal);
|
|
888
907
|
if (localResponse?.content) {
|
|
889
908
|
const parsed = this.parseProactiveExtractionResultFromText(localResponse.content.trim());
|
|
890
909
|
if (parsed) {
|
|
@@ -895,7 +914,7 @@ export class ExtractionEngine {
|
|
|
895
914
|
return { facts: [], profileUpdates: [], entities: [], questions: [] };
|
|
896
915
|
}
|
|
897
916
|
} catch (err) {
|
|
898
|
-
if (!this.config.localLlmFallback) {
|
|
917
|
+
if (signal?.aborted || !this.config.localLlmFallback) {
|
|
899
918
|
throw err;
|
|
900
919
|
}
|
|
901
920
|
}
|
|
@@ -914,6 +933,7 @@ export class ExtractionEngine {
|
|
|
914
933
|
temperature: 0.2,
|
|
915
934
|
maxTokens: this.config.proactiveExtractionMaxTokens,
|
|
916
935
|
timeoutMs: this.config.proactiveExtractionTimeoutMs,
|
|
936
|
+
signal,
|
|
917
937
|
}),
|
|
918
938
|
);
|
|
919
939
|
if (!fallbackResult) {
|
|
@@ -1077,73 +1097,6 @@ export class ExtractionEngine {
|
|
|
1077
1097
|
return null;
|
|
1078
1098
|
}
|
|
1079
1099
|
|
|
1080
|
-
/**
|
|
1081
|
-
* Attach claim-level provenance spans to each fact in the extraction result
|
|
1082
|
-
* (issue #1575 PR 2). Runs once at write time, after sanitize + proactive
|
|
1083
|
-
* pass so ALL facts (base + proactive additions) get verified spans before
|
|
1084
|
-
* the result is returned for persistence.
|
|
1085
|
-
*
|
|
1086
|
-
* The validator locates each fact's LLM-provided `quote` in the buffered
|
|
1087
|
-
* turns and builds a `ProvenanceSource[]` with verified offsets. Never
|
|
1088
|
-
* throws, never drops a fact — an unverifiable span is a tagged state, not
|
|
1089
|
-
* a silent failure (rule 34 spirit). When `provenance.enabled` is false,
|
|
1090
|
-
* this is a no-op (byte-identical to pre-feature behavior, rule 39).
|
|
1091
|
-
*/
|
|
1092
|
-
private attachProvenanceToResult(
|
|
1093
|
-
result: ExtractionResult,
|
|
1094
|
-
turns: ReadonlyArray<{
|
|
1095
|
-
content: string;
|
|
1096
|
-
sessionKey?: string;
|
|
1097
|
-
logicalSessionKey?: string;
|
|
1098
|
-
timestamp: string;
|
|
1099
|
-
turnFingerprint?: string;
|
|
1100
|
-
}>,
|
|
1101
|
-
): ExtractionResult {
|
|
1102
|
-
// Even when provenance is disabled, strip the transient LLM-provided
|
|
1103
|
-
// `quote` field so it does not leak through the persist pipeline (the
|
|
1104
|
-
// enabled path strips it after validation; the disabled path must match).
|
|
1105
|
-
// quote is never persisted to frontmatter, but carrying it risks it
|
|
1106
|
-
// surfacing in content-hash dedup or downstream in-memory consumers
|
|
1107
|
-
// (cursor thread dHiY).
|
|
1108
|
-
if (!this.config.provenance?.enabled) {
|
|
1109
|
-
if (result.facts.length === 0) return result;
|
|
1110
|
-
return {
|
|
1111
|
-
...result,
|
|
1112
|
-
facts: result.facts.map((fact) => {
|
|
1113
|
-
if (fact.quote === undefined) return fact;
|
|
1114
|
-
const { quote: _stripped, ...rest } = fact;
|
|
1115
|
-
return rest;
|
|
1116
|
-
}),
|
|
1117
|
-
};
|
|
1118
|
-
}
|
|
1119
|
-
if (result.facts.length === 0) return result;
|
|
1120
|
-
const provenanceTurns: ProvenanceTurnInput[] = turns.map((t) => ({
|
|
1121
|
-
content: t.content,
|
|
1122
|
-
sessionKey: t.sessionKey,
|
|
1123
|
-
logicalSessionKey: t.logicalSessionKey,
|
|
1124
|
-
timestamp: t.timestamp,
|
|
1125
|
-
turnId: t.turnFingerprint,
|
|
1126
|
-
}));
|
|
1127
|
-
const facts = result.facts.map((fact) => {
|
|
1128
|
-
const built = buildFactProvenance(
|
|
1129
|
-
fact.quote,
|
|
1130
|
-
provenanceTurns,
|
|
1131
|
-
this.config.provenance,
|
|
1132
|
-
);
|
|
1133
|
-
// Strip the transient `quote` field — it has served its purpose (the
|
|
1134
|
-
// validator consumed it) and must NOT leak into the persisted ExtractedFact
|
|
1135
|
-
// shape or the content-hash dedup key (rule 23 / checklist §13).
|
|
1136
|
-
const { quote: _stripped, ...factWithoutQuote } = fact;
|
|
1137
|
-
return {
|
|
1138
|
-
...factWithoutQuote,
|
|
1139
|
-
...(built.sources && built.sources.length > 0 ? { sources: built.sources } : {}),
|
|
1140
|
-
...(built.provenance !== "none" ? { provenance: built.provenance } : {}),
|
|
1141
|
-
...(built.requireSpansPending ? { requireSpansPending: true } : {}),
|
|
1142
|
-
};
|
|
1143
|
-
});
|
|
1144
|
-
return { ...result, facts };
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
1100
|
private applySourceGrounding(
|
|
1148
1101
|
result: ExtractionResult,
|
|
1149
1102
|
sourceText: string,
|
|
@@ -1175,10 +1128,14 @@ export class ExtractionEngine {
|
|
|
1175
1128
|
turnFingerprint?: string;
|
|
1176
1129
|
}>,
|
|
1177
1130
|
): ExtractionResult {
|
|
1178
|
-
return
|
|
1131
|
+
return attachExtractionProvenance(result, turns, this.config.provenance);
|
|
1179
1132
|
}
|
|
1180
1133
|
|
|
1181
|
-
async extract(
|
|
1134
|
+
async extract(
|
|
1135
|
+
turns: BufferTurn[],
|
|
1136
|
+
existingEntities?: string[],
|
|
1137
|
+
signal?: AbortSignal,
|
|
1138
|
+
): Promise<ExtractionResult> {
|
|
1182
1139
|
const lifecycleCaps = resolveMemoryLifecycleCapabilities(this.config);
|
|
1183
1140
|
|
|
1184
1141
|
// Guard: skip if buffer is empty or all turns are whitespace-only
|
|
@@ -1269,7 +1226,8 @@ export class ExtractionEngine {
|
|
|
1269
1226
|
this.profiler.startSpan("local-llm", extractionTraceId);
|
|
1270
1227
|
primaryExtractorAttempted = true;
|
|
1271
1228
|
try {
|
|
1272
|
-
const localResult = await this.extractWithLocalLlm(conversation, existingEntities);
|
|
1229
|
+
const localResult = await this.extractWithLocalLlm(conversation, existingEntities, signal);
|
|
1230
|
+
throwIfExtractionAborted(signal);
|
|
1273
1231
|
if (localResult) {
|
|
1274
1232
|
const durationMs = Date.now() - startTime;
|
|
1275
1233
|
this.profiler.endSpan("local-llm", extractionTraceId);
|
|
@@ -1290,6 +1248,7 @@ export class ExtractionEngine {
|
|
|
1290
1248
|
assertionSource,
|
|
1291
1249
|
messageTimestamp,
|
|
1292
1250
|
roleAssertionSources,
|
|
1251
|
+
signal,
|
|
1293
1252
|
);
|
|
1294
1253
|
return this.finalizeExtractionResult(finalResult, boundedTurns);
|
|
1295
1254
|
}
|
|
@@ -1307,6 +1266,7 @@ export class ExtractionEngine {
|
|
|
1307
1266
|
}
|
|
1308
1267
|
log.info("extraction: local LLM unavailable, falling back to gateway default AI");
|
|
1309
1268
|
} catch (err) {
|
|
1269
|
+
if (signal?.aborted) throw err;
|
|
1310
1270
|
if (!this.config.localLlmFallback) {
|
|
1311
1271
|
log.warn("extraction: local LLM error and fallback disabled:", err);
|
|
1312
1272
|
return {
|
|
@@ -1330,7 +1290,7 @@ export class ExtractionEngine {
|
|
|
1330
1290
|
this.profiler.startSpan("direct-client", extractionTraceId);
|
|
1331
1291
|
primaryExtractorAttempted = true;
|
|
1332
1292
|
try {
|
|
1333
|
-
const directResult = await this.extractWithDirectClient(conversation, existingEntities);
|
|
1293
|
+
const directResult = await this.extractWithDirectClient(conversation, existingEntities, signal);
|
|
1334
1294
|
if (directResult) {
|
|
1335
1295
|
const durationMs = Date.now() - startTime;
|
|
1336
1296
|
this.profiler.endSpan("direct-client", extractionTraceId);
|
|
@@ -1351,6 +1311,7 @@ export class ExtractionEngine {
|
|
|
1351
1311
|
assertionSource,
|
|
1352
1312
|
messageTimestamp,
|
|
1353
1313
|
roleAssertionSources,
|
|
1314
|
+
signal,
|
|
1354
1315
|
);
|
|
1355
1316
|
return this.finalizeExtractionResult(finalResult, boundedTurns);
|
|
1356
1317
|
}
|
|
@@ -1365,6 +1326,7 @@ export class ExtractionEngine {
|
|
|
1365
1326
|
closedDirectTrace = true;
|
|
1366
1327
|
log.info("extraction: direct client returned no result, falling back to gateway AI");
|
|
1367
1328
|
} catch (err) {
|
|
1329
|
+
if (signal?.aborted) throw err;
|
|
1368
1330
|
try {
|
|
1369
1331
|
this.emit({
|
|
1370
1332
|
kind: "llm_error", traceId, model: this.config.model, operation: "extraction",
|
|
@@ -1420,6 +1382,7 @@ export class ExtractionEngine {
|
|
|
1420
1382
|
temperature: 0.3,
|
|
1421
1383
|
maxTokens: this.config.extractionMaxOutputTokens,
|
|
1422
1384
|
timeoutMs: this.config.localLlmTimeoutMs,
|
|
1385
|
+
signal,
|
|
1423
1386
|
}),
|
|
1424
1387
|
);
|
|
1425
1388
|
|
|
@@ -1450,6 +1413,7 @@ export class ExtractionEngine {
|
|
|
1450
1413
|
assertionSource,
|
|
1451
1414
|
messageTimestamp,
|
|
1452
1415
|
roleAssertionSources,
|
|
1416
|
+
signal,
|
|
1453
1417
|
);
|
|
1454
1418
|
return this.finalizeExtractionResult(finalResult, boundedTurns);
|
|
1455
1419
|
}
|
|
@@ -1476,6 +1440,7 @@ export class ExtractionEngine {
|
|
|
1476
1440
|
extractionFailureClass: fallbackParseFailureClass,
|
|
1477
1441
|
};
|
|
1478
1442
|
} catch (err) {
|
|
1443
|
+
if (signal?.aborted) throw err;
|
|
1479
1444
|
this.emit({
|
|
1480
1445
|
kind: "llm_error", traceId: fallbackTraceId, model: "fallback", operation: "extraction",
|
|
1481
1446
|
durationMs: Date.now() - fallbackStartTime, error: String(err),
|
|
@@ -1504,7 +1469,11 @@ export class ExtractionEngine {
|
|
|
1504
1469
|
* Extract memories using local LLM with JSON mode.
|
|
1505
1470
|
* Uses a minimal prompt to fit within local model context limits (typically 4k-8k).
|
|
1506
1471
|
*/
|
|
1507
|
-
private async extractWithLocalLlm(
|
|
1472
|
+
private async extractWithLocalLlm(
|
|
1473
|
+
conversation: string,
|
|
1474
|
+
existingEntities?: string[],
|
|
1475
|
+
signal?: AbortSignal,
|
|
1476
|
+
): Promise<ExtractionResult | null> {
|
|
1508
1477
|
const lifecycleCaps = resolveMemoryLifecycleCapabilities(this.config);
|
|
1509
1478
|
log.debug(
|
|
1510
1479
|
`extractWithLocalLlm: starting extraction, localLlmEnabled=${this.shouldUseLocalLlm}, model=${this.config.localLlmModel}`,
|
|
@@ -1574,6 +1543,7 @@ ${truncatedConversation}`;
|
|
|
1574
1543
|
? false
|
|
1575
1544
|
: undefined,
|
|
1576
1545
|
priority: "background",
|
|
1546
|
+
signal,
|
|
1577
1547
|
},
|
|
1578
1548
|
);
|
|
1579
1549
|
|
|
@@ -1625,6 +1595,7 @@ ${truncatedConversation}`;
|
|
|
1625
1595
|
private async extractWithDirectClient(
|
|
1626
1596
|
conversation: string,
|
|
1627
1597
|
existingEntities?: string[],
|
|
1598
|
+
signal?: AbortSignal,
|
|
1628
1599
|
): Promise<ExtractionResult | null> {
|
|
1629
1600
|
if (!this.client) return null;
|
|
1630
1601
|
|
|
@@ -1633,19 +1604,22 @@ ${truncatedConversation}`;
|
|
|
1633
1604
|
});
|
|
1634
1605
|
log.debug(`extractWithDirectClient: calling model=${this.config.model} tokenParams=${JSON.stringify(tokenParams)}`);
|
|
1635
1606
|
|
|
1636
|
-
const response = await this.client.chat.completions.create(
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1607
|
+
const response = await this.client.chat.completions.create(
|
|
1608
|
+
{
|
|
1609
|
+
model: this.config.model,
|
|
1610
|
+
messages: [
|
|
1611
|
+
{
|
|
1612
|
+
role: "system",
|
|
1613
|
+
content:
|
|
1614
|
+
this.buildExtractionInstructions(existingEntities) +
|
|
1615
|
+
`\n\nReturn only valid JSON matching this shape. Placeholder text describes field shape only and is never source evidence:\n${EXTRACTION_RESPONSE_SHAPE}`,
|
|
1616
|
+
},
|
|
1617
|
+
{ role: "user", content: conversation },
|
|
1618
|
+
],
|
|
1619
|
+
...tokenParams,
|
|
1620
|
+
},
|
|
1621
|
+
signal ? { signal } : undefined,
|
|
1622
|
+
);
|
|
1649
1623
|
|
|
1650
1624
|
const content = response.choices?.[0]?.message?.content?.trim();
|
|
1651
1625
|
if (!content) {
|
|
@@ -269,3 +269,51 @@ test("a process-wide custom dispatcher is left in place", async () => {
|
|
|
269
269
|
assert.ok(restored);
|
|
270
270
|
await restored.close();
|
|
271
271
|
});
|
|
272
|
+
|
|
273
|
+
test("aborting during a retry backoff stops the local request lane", async () => {
|
|
274
|
+
const original = globalThis.fetch;
|
|
275
|
+
const abortController = new AbortController();
|
|
276
|
+
let calls = 0;
|
|
277
|
+
globalThis.fetch = (async () => {
|
|
278
|
+
calls += 1;
|
|
279
|
+
setTimeout(() => abortController.abort(new Error("deadline")), 10);
|
|
280
|
+
return new Response("temporary failure", { status: 503 });
|
|
281
|
+
}) as typeof fetch;
|
|
282
|
+
|
|
283
|
+
try {
|
|
284
|
+
const client = new LocalLlmClient(
|
|
285
|
+
createConfig({ localLlmRetry5xxCount: 2, localLlmRetryBackoffMs: 5_000 }),
|
|
286
|
+
);
|
|
287
|
+
primeClient(client);
|
|
288
|
+
const result = await client.chatCompletion(
|
|
289
|
+
[{ role: "user", content: "extract facts" }],
|
|
290
|
+
{ signal: abortController.signal },
|
|
291
|
+
);
|
|
292
|
+
assert.equal(result, null);
|
|
293
|
+
assert.equal(calls, 1);
|
|
294
|
+
} finally {
|
|
295
|
+
globalThis.fetch = original;
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
test("availability probes stop after the caller aborts", async () => {
|
|
300
|
+
const abortController = new AbortController();
|
|
301
|
+
let requests = 0;
|
|
302
|
+
const server = http.createServer((_req, res) => {
|
|
303
|
+
requests += 1;
|
|
304
|
+
if (requests === 1) abortController.abort();
|
|
305
|
+
res.writeHead(503, { "content-type": "application/json" });
|
|
306
|
+
res.end("{}");
|
|
307
|
+
});
|
|
308
|
+
await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
309
|
+
const { port } = server.address() as AddressInfo;
|
|
310
|
+
try {
|
|
311
|
+
const client = new LocalLlmClient(
|
|
312
|
+
createConfig({ localLlmUrl: `http://127.0.0.1:${port}/v1` }),
|
|
313
|
+
);
|
|
314
|
+
assert.equal(await client.checkAvailability(abortController.signal), false);
|
|
315
|
+
assert.equal(requests, 1, "an aborted availability check must not start later probes");
|
|
316
|
+
} finally {
|
|
317
|
+
await new Promise<void>((resolve) => server.close(() => resolve()));
|
|
318
|
+
}
|
|
319
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export function isAbortError(err: unknown): boolean {
|
|
2
|
+
if (!err || typeof err !== "object") return false;
|
|
3
|
+
const maybe = err as { name?: string; message?: string };
|
|
4
|
+
return (
|
|
5
|
+
maybe.name === "AbortError" ||
|
|
6
|
+
maybe.message === "This operation was aborted" ||
|
|
7
|
+
maybe.message === "The operation was aborted"
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function waitForRetryBackoff(backoffMs: number, signal?: AbortSignal): Promise<boolean> {
|
|
12
|
+
return new Promise((resolve) => {
|
|
13
|
+
let settled = false;
|
|
14
|
+
let timer: NodeJS.Timeout | undefined;
|
|
15
|
+
const onAbort = (): void => {
|
|
16
|
+
if (settled) return;
|
|
17
|
+
settled = true;
|
|
18
|
+
if (timer) clearTimeout(timer);
|
|
19
|
+
signal?.removeEventListener("abort", onAbort);
|
|
20
|
+
resolve(false);
|
|
21
|
+
};
|
|
22
|
+
const onTimer = (): void => {
|
|
23
|
+
if (settled) return;
|
|
24
|
+
settled = true;
|
|
25
|
+
signal?.removeEventListener("abort", onAbort);
|
|
26
|
+
resolve(true);
|
|
27
|
+
};
|
|
28
|
+
timer = setTimeout(onTimer, backoffMs);
|
|
29
|
+
if (signal) {
|
|
30
|
+
if (signal.aborted) onAbort();
|
|
31
|
+
else signal.addEventListener("abort", onAbort, { once: true });
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function normalizeBackendTripReason(reason: string): string {
|
|
37
|
+
const cleaned = reason.replace(/\s+/g, " ").replace(/^[-:–—\s]+/, "").trim();
|
|
38
|
+
if (!cleaned) return "unknown local backend failure";
|
|
39
|
+
return cleaned.length > 160 ? `${cleaned.slice(0, 157)}...` : cleaned;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function extractNonRecoverableBackendReason(reason: string): string | null {
|
|
43
|
+
const match = reason.match(
|
|
44
|
+
/Failed to load model|Library not loaded|different Team IDs|code signature|llm_engine_mlx_amphibian/i,
|
|
45
|
+
);
|
|
46
|
+
return match?.[0] ?? null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function extractNonRecoverableBackendReasonFromErrorText(errorText: string): string | null {
|
|
50
|
+
const directReason = extractNonRecoverableBackendReason(errorText);
|
|
51
|
+
if (directReason) return directReason;
|
|
52
|
+
try {
|
|
53
|
+
const parsed = JSON.parse(errorText) as { error?: { message?: string } };
|
|
54
|
+
return extractNonRecoverableBackendReason(parsed?.error?.message ?? "");
|
|
55
|
+
} catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|