@remnic/core 9.29.0 → 9.30.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 +11 -11
- package/dist/access-admin-ops-surface.js +19 -18
- package/dist/access-authorization-probe.d.ts +11 -11
- package/dist/access-authorization-probe.js +20 -19
- package/dist/access-boundary.d.ts +11 -11
- package/dist/access-boundary.js +19 -18
- package/dist/access-citation-namespace.js +2 -2
- package/dist/access-cli.js +45 -44
- package/dist/access-cli.js.map +1 -1
- package/dist/access-health-types.d.ts +1 -1
- package/dist/access-http-lcm-compaction.d.ts +11 -11
- package/dist/access-http.d.ts +11 -11
- package/dist/access-http.js +25 -24
- package/dist/access-identity-continuity-surface.d.ts +8 -8
- package/dist/access-identity-continuity-surface.js +19 -18
- package/dist/access-lcm-surface.d.ts +10 -10
- package/dist/access-lcm-surface.js +19 -18
- package/dist/access-mcp.d.ts +11 -11
- package/dist/access-mcp.js +23 -22
- package/dist/access-memory-search-fanout.d.ts +2 -2
- package/dist/{access-namespace-preflight-DCXBkDp0.d.ts → access-namespace-preflight-VfXssvoI.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +3 -3
- package/dist/access-namespace-preflight.js +19 -18
- package/dist/access-observe-write-surface.d.ts +10 -10
- package/dist/access-observe-write-surface.js +19 -18
- package/dist/access-operations-batch.js +20 -19
- package/dist/access-operations.d.ts +11 -11
- package/dist/access-operations.js +22 -21
- package/dist/access-recall-concurrency.d.ts +11 -11
- package/dist/access-recall-concurrency.js +19 -18
- package/dist/access-recall-response.d.ts +10 -10
- package/dist/access-recall-response.js +19 -18
- package/dist/access-recall-surface.d.ts +10 -10
- package/dist/access-recall-surface.js +19 -18
- package/dist/access-schema.d.ts +7 -7
- package/dist/access-schema.js +3 -3
- package/dist/{access-service-DvPW_M5j.d.ts → access-service-B5RwVsTV.d.ts} +7 -7
- package/dist/access-service.d.ts +11 -11
- package/dist/access-service.js +19 -18
- package/dist/access-surface-catalog.d.ts +11 -11
- package/dist/access-wearables-meetings-surface.d.ts +4 -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 +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 +3 -2
- package/dist/briefing.js +10 -9
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer.d.ts +3 -2
- package/dist/bulk-import/index.d.ts +3 -3
- package/dist/calibration.d.ts +1 -1
- package/dist/capabilities.d.ts +1 -1
- package/dist/{catalog-BIVgftWu.d.ts → catalog-V7inUQdp.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 +11 -10
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/{chunk-KUJQHXPH.js → chunk-2EUVEDF5.js} +2 -2
- package/dist/{chunk-2XC73SHY.js → chunk-4WKA6I65.js} +20 -20
- package/dist/{chunk-2XC73SHY.js.map → chunk-4WKA6I65.js.map} +1 -1
- package/dist/{chunk-AIK5W3IW.js → chunk-5TFP4CUL.js} +68 -2
- package/dist/chunk-5TFP4CUL.js.map +1 -0
- package/dist/{chunk-EVX44I7C.js → chunk-5W4ZLBEZ.js} +9 -9
- package/dist/{chunk-P3MH72CI.js → chunk-62U4J2GN.js} +2 -2
- package/dist/{chunk-YGHMSDLK.js → chunk-66772WBP.js} +2 -2
- package/dist/{chunk-EP5BVCRI.js → chunk-6BNE62PM.js} +2 -2
- package/dist/{chunk-AAP5T6QG.js → chunk-6DNMUYEE.js} +2 -2
- package/dist/{chunk-SG265CVF.js → chunk-6FUPCJUL.js} +7 -7
- package/dist/{chunk-WZ7UB7XQ.js → chunk-6U7F52DE.js} +19 -19
- package/dist/{chunk-E4OCKU67.js → chunk-7XC2HX75.js} +2 -2
- package/dist/{chunk-OVRQLAYR.js → chunk-AZ5BTEKX.js} +2 -2
- package/dist/{chunk-2HNUMF5V.js → chunk-CZRYLSSW.js} +3 -3
- package/dist/chunk-FBUE6PD3.js +1769 -0
- package/dist/chunk-FBUE6PD3.js.map +1 -0
- package/dist/{chunk-WONS4RZ2.js → chunk-FDAMS4PK.js} +2 -2
- package/dist/{chunk-WL5EBRDH.js → chunk-FFAZ2XFU.js} +9 -8
- package/dist/chunk-FFAZ2XFU.js.map +1 -0
- package/dist/{chunk-Q6VFVAKZ.js → chunk-GIBMDSJ2.js} +2 -2
- package/dist/{chunk-ZXAGJFHJ.js → chunk-H5CPS5JP.js} +3 -3
- package/dist/{chunk-NBDCZWP4.js → chunk-I5NLEENJ.js} +2 -2
- package/dist/{chunk-DRBXHRXE.js → chunk-IB26HVAJ.js} +2 -2
- package/dist/{chunk-XEQ7OT7U.js → chunk-IC6CBHCA.js} +3 -3
- package/dist/{chunk-CMRQ34J5.js → chunk-JCBWCYEJ.js} +2 -2
- package/dist/{chunk-3PDOVUHC.js → chunk-KXB4VXHY.js} +2 -2
- package/dist/{chunk-G6LBWZRF.js → chunk-LBOD4U5B.js} +7 -7
- package/dist/{chunk-ZGOQTOYA.js → chunk-LGHKJABJ.js} +3 -3
- package/dist/{chunk-T3GCXULH.js → chunk-M3C2V3PV.js} +10 -10
- package/dist/{chunk-OFHFH655.js → chunk-MJCGLM25.js} +8 -8
- package/dist/{chunk-JDZRYH2N.js → chunk-NHWB6HG2.js} +2 -2
- package/dist/{chunk-TC3VNKGX.js → chunk-NM2WP3B7.js} +4 -4
- package/dist/{chunk-IMA2EWLV.js → chunk-P5PXWTW7.js} +2 -2
- package/dist/chunk-PH3ZWL3W.js +786 -0
- package/dist/chunk-PH3ZWL3W.js.map +1 -0
- package/dist/{chunk-QMBNMPQM.js → chunk-PUS63Q3G.js} +24 -22
- package/dist/{chunk-QMBNMPQM.js.map → chunk-PUS63Q3G.js.map} +1 -1
- package/dist/{chunk-2QMKMVHH.js → chunk-QNWXCJ76.js} +2 -2
- package/dist/{chunk-FCDWWCLX.js → chunk-RGIWINDN.js} +427 -795
- package/dist/chunk-RGIWINDN.js.map +1 -0
- package/dist/{chunk-CSMCNOPH.js → chunk-SPJXKAVF.js} +3 -3
- package/dist/{chunk-4PBVXX7L.js → chunk-TH2LSRMG.js} +2 -2
- package/dist/{chunk-ESBQWC3U.js → chunk-VI2JQPNQ.js} +2 -2
- package/dist/{chunk-GGUBDXRR.js → chunk-W5EG6LE3.js} +2 -2
- package/dist/{chunk-DEBHXHJR.js → chunk-WIPEXG6R.js} +2 -2
- package/dist/{chunk-SH6YO3LT.js → chunk-WVO4G37W.js} +2 -2
- package/dist/{chunk-VVIW3PTA.js → chunk-YTQNQ4KB.js} +14 -14
- package/dist/{chunk-PKRIQL3V.js → chunk-YTSNAUXN.js} +2 -2
- package/dist/{chunk-QAOGGNE3.js → chunk-ZPSVBSOF.js} +4 -4
- package/dist/{cli-CxoSOiG0.d.ts → cli-C4GbETPC.d.ts} +5 -5
- package/dist/cli.d.ts +13 -13
- package/dist/cli.js +36 -35
- package/dist/compounding/engine.d.ts +3 -2
- package/dist/compounding/engine.js +10 -9
- 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 +3 -3
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +10 -9
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +10 -9
- package/dist/consolidation-provenance-check.d.ts +3 -2
- package/dist/consolidation-undo.d.ts +3 -2
- package/dist/contradiction/index.d.ts +3 -2
- package/dist/conversation-index/backend.d.ts +1 -1
- 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 +12 -11
- 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 +3 -2
- package/dist/entity-retrieval.js +10 -9
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +52 -10
- package/dist/explicit-capture.js +13 -1
- 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 +1 -1
- package/dist/extraction.d.ts +1 -1
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/{forget-HRPLVB3W.js → forget-4UY2EOKH.js} +3 -3
- 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 +21 -21
- package/dist/index.js +47 -45
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/tools.d.ts +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/local-llm.d.ts +1 -1
- package/dist/local-model-endpoint.d.ts +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +10 -9
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +10 -9
- package/dist/maintenance/rebuild-memory-projection.d.ts +3 -2
- package/dist/maintenance/rebuild-memory-projection.js +11 -10
- package/dist/{maintenance-Cb-PjxQd.d.ts → maintenance-CL30NWtc.d.ts} +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +11 -11
- 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-worth-outcomes.d.ts +3 -2
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +4 -3
- package/dist/namespaces/migrate.js +11 -10
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/storage.d.ts +4 -3
- package/dist/namespaces/storage.js +10 -9
- 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 +5 -5
- package/dist/offline-sync.js +2 -2
- package/dist/operator-doctor-corpus.d.ts +1 -1
- package/dist/operator-doctor-corpus.js +13 -12
- package/dist/operator-doctor-replica.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +4 -3
- package/dist/operator-toolkit.js +18 -17
- package/dist/orchestration/compression-guideline-coordinator.d.ts +3 -2
- package/dist/orchestration/maintenance.d.ts +5 -4
- package/dist/orchestration/maintenance.js +15 -14
- package/dist/{orchestrator-5GKqb_HL.d.ts → orchestrator-CKTCRwWV.d.ts} +7 -7
- package/dist/orchestrator.d.ts +8 -8
- package/dist/orchestrator.js +45 -44
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/{pipeline-3Qi1TpRo.d.ts → pipeline-B7wj4rRZ.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/{purge-YSGX5BOG.js → purge-533FZLS4.js} +16 -9
- package/dist/purge-533FZLS4.js.map +1 -0
- package/dist/qmd-preflight.d.ts +2 -2
- package/dist/{qmd-D9JqzzRX.d.ts → qmd-q9tg4dHp.d.ts} +1 -1
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +2 -2
- package/dist/recall-concurrency-config.d.ts +1 -1
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +1 -1
- package/dist/recall-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-state.js +2 -2
- 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-renderer.d.ts +1 -1
- package/dist/recall-xray.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/resume-bundles.js +4 -4
- 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 +22 -22
- package/dist/{scope-profiles-C4g6_UdP.d.ts → scope-profiles-CWDyglPM.d.ts} +1 -1
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/index.d.ts +1 -1
- 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/secure-store/index.js +2 -2
- package/dist/{semantic-consolidation-BrxqnzTW.d.ts → semantic-consolidation-BUE3deLn.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +11 -10
- package/dist/semantic-rule-promotion.js +10 -9
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +10 -9
- package/dist/{service-Bi1JgxdP.d.ts → service-CXgM0bQG.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-CcH6yPk2.d.ts → storage-DysJq-XH.d.ts} +163 -27
- package/dist/storage.d.ts +3 -2
- package/dist/storage.js +12 -10
- package/dist/summarizer.d.ts +1 -1
- package/dist/summarizer.js +3 -3
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/summary-snapshot.js +2 -2
- package/dist/temporal-supersession.d.ts +3 -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 +3 -2
- package/dist/tier-routing.d.ts +1 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/transfer/types.d.ts +12 -12
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-Dg0w9ADr.d.ts → types-aPPzhnjT.d.ts} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/utils/serialize-mutations.d.ts +11 -7
- package/dist/utils/serialize-mutations.js +1 -1
- package/dist/verified-recall.js +10 -9
- package/dist/write-envelope.d.ts +1 -1
- package/package.json +2 -2
- package/src/access-observe-write-surface.ts +1 -1
- package/src/access-service-coding-write.test.ts +40 -0
- package/src/explicit-capture.test.ts +1110 -1
- package/src/explicit-capture.ts +534 -135
- package/src/maintenance/purge.test.ts +157 -1
- package/src/maintenance/purge.ts +15 -9
- package/src/secure-store/secure-fs.ts +78 -1
- package/src/storage/content-hash-index.ts +43 -17
- package/src/storage/entity-canonical-id-migration.ts +151 -23
- package/src/storage/tombstone-blocked-capture-index.ts +562 -0
- package/src/storage/tombstone-blocked-capture-mutation.ts +284 -0
- package/src/storage/tombstone-blocked-capture-sync.ts +872 -0
- package/src/storage-fact-hash-index-defer.test.ts +2900 -57
- package/src/storage.ts +266 -265
- package/src/testing/subjects/tombstone-blocked-capture.test.ts +181 -0
- package/src/utils/serialize-mutations.test.ts +4 -1
- package/src/utils/serialize-mutations.ts +26 -27
- package/dist/chunk-55MDBZLC.js +0 -490
- package/dist/chunk-55MDBZLC.js.map +0 -1
- package/dist/chunk-AIK5W3IW.js.map +0 -1
- package/dist/chunk-FCDWWCLX.js.map +0 -1
- package/dist/chunk-WL5EBRDH.js.map +0 -1
- package/dist/purge-YSGX5BOG.js.map +0 -1
- /package/dist/{chunk-KUJQHXPH.js.map → chunk-2EUVEDF5.js.map} +0 -0
- /package/dist/{chunk-EVX44I7C.js.map → chunk-5W4ZLBEZ.js.map} +0 -0
- /package/dist/{chunk-P3MH72CI.js.map → chunk-62U4J2GN.js.map} +0 -0
- /package/dist/{chunk-YGHMSDLK.js.map → chunk-66772WBP.js.map} +0 -0
- /package/dist/{chunk-EP5BVCRI.js.map → chunk-6BNE62PM.js.map} +0 -0
- /package/dist/{chunk-AAP5T6QG.js.map → chunk-6DNMUYEE.js.map} +0 -0
- /package/dist/{chunk-SG265CVF.js.map → chunk-6FUPCJUL.js.map} +0 -0
- /package/dist/{chunk-WZ7UB7XQ.js.map → chunk-6U7F52DE.js.map} +0 -0
- /package/dist/{chunk-E4OCKU67.js.map → chunk-7XC2HX75.js.map} +0 -0
- /package/dist/{chunk-OVRQLAYR.js.map → chunk-AZ5BTEKX.js.map} +0 -0
- /package/dist/{chunk-2HNUMF5V.js.map → chunk-CZRYLSSW.js.map} +0 -0
- /package/dist/{chunk-WONS4RZ2.js.map → chunk-FDAMS4PK.js.map} +0 -0
- /package/dist/{chunk-Q6VFVAKZ.js.map → chunk-GIBMDSJ2.js.map} +0 -0
- /package/dist/{chunk-ZXAGJFHJ.js.map → chunk-H5CPS5JP.js.map} +0 -0
- /package/dist/{chunk-NBDCZWP4.js.map → chunk-I5NLEENJ.js.map} +0 -0
- /package/dist/{chunk-DRBXHRXE.js.map → chunk-IB26HVAJ.js.map} +0 -0
- /package/dist/{chunk-XEQ7OT7U.js.map → chunk-IC6CBHCA.js.map} +0 -0
- /package/dist/{chunk-CMRQ34J5.js.map → chunk-JCBWCYEJ.js.map} +0 -0
- /package/dist/{chunk-3PDOVUHC.js.map → chunk-KXB4VXHY.js.map} +0 -0
- /package/dist/{chunk-G6LBWZRF.js.map → chunk-LBOD4U5B.js.map} +0 -0
- /package/dist/{chunk-ZGOQTOYA.js.map → chunk-LGHKJABJ.js.map} +0 -0
- /package/dist/{chunk-T3GCXULH.js.map → chunk-M3C2V3PV.js.map} +0 -0
- /package/dist/{chunk-OFHFH655.js.map → chunk-MJCGLM25.js.map} +0 -0
- /package/dist/{chunk-JDZRYH2N.js.map → chunk-NHWB6HG2.js.map} +0 -0
- /package/dist/{chunk-TC3VNKGX.js.map → chunk-NM2WP3B7.js.map} +0 -0
- /package/dist/{chunk-IMA2EWLV.js.map → chunk-P5PXWTW7.js.map} +0 -0
- /package/dist/{chunk-2QMKMVHH.js.map → chunk-QNWXCJ76.js.map} +0 -0
- /package/dist/{chunk-CSMCNOPH.js.map → chunk-SPJXKAVF.js.map} +0 -0
- /package/dist/{chunk-4PBVXX7L.js.map → chunk-TH2LSRMG.js.map} +0 -0
- /package/dist/{chunk-ESBQWC3U.js.map → chunk-VI2JQPNQ.js.map} +0 -0
- /package/dist/{chunk-GGUBDXRR.js.map → chunk-W5EG6LE3.js.map} +0 -0
- /package/dist/{chunk-DEBHXHJR.js.map → chunk-WIPEXG6R.js.map} +0 -0
- /package/dist/{chunk-SH6YO3LT.js.map → chunk-WVO4G37W.js.map} +0 -0
- /package/dist/{chunk-VVIW3PTA.js.map → chunk-YTQNQ4KB.js.map} +0 -0
- /package/dist/{chunk-PKRIQL3V.js.map → chunk-YTSNAUXN.js.map} +0 -0
- /package/dist/{chunk-QAOGGNE3.js.map → chunk-ZPSVBSOF.js.map} +0 -0
- /package/dist/{forget-HRPLVB3W.js.map → forget-4UY2EOKH.js.map} +0 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { mkdir } from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { withHeldFileLock } from "../utils/serialize-mutations.js";
|
|
6
|
+
import type { MemoryFile, MemoryFrontmatter } from "../types.js";
|
|
7
|
+
const TOMBSTONE_CAPTURE_WRITE_LOCK_STALE_MS = 60_000;
|
|
8
|
+
const CAPTURE_WRITE_LOCK_MAX_ATTEMPTS = 3;
|
|
9
|
+
const CAPTURE_WRITE_LOCK_RETRY_BASE_MS = 25;
|
|
10
|
+
const CAPTURE_WRITE_LOCK_BUSY_MESSAGE = "tombstone-blocked capture write lock remained busy";
|
|
11
|
+
|
|
12
|
+
export function isTombstoneBlockedCaptureWriteLockBusy(error: unknown): boolean {
|
|
13
|
+
return error instanceof Error && error.message === CAPTURE_WRITE_LOCK_BUSY_MESSAGE;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function normalizeExplicitCaptureContent(value: string): string {
|
|
17
|
+
return value.toLowerCase().replace(/\s+/g, " ").trim();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function buildExplicitCaptureDedupKey(
|
|
21
|
+
content: string,
|
|
22
|
+
category: string,
|
|
23
|
+
sourceConnector: string | undefined
|
|
24
|
+
): string {
|
|
25
|
+
const encode = (label: string, value: string): string => `${label} ${value.length} ${value}`;
|
|
26
|
+
return [
|
|
27
|
+
encode("category", category),
|
|
28
|
+
encode("connector", sourceConnector?.trim() ?? ""),
|
|
29
|
+
encode("content", normalizeExplicitCaptureContent(content)),
|
|
30
|
+
].join(" ");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function captureIdentityHash(memory: MemoryFile): string {
|
|
34
|
+
return createHash("sha256")
|
|
35
|
+
.update(buildExplicitCaptureDedupKey(memory.content, memory.frontmatter.category, memory.frontmatter.sourceConnector))
|
|
36
|
+
.digest("hex");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type TombstoneBlockedCaptureWriteLockOptions = {
|
|
40
|
+
readonly stateDir: string;
|
|
41
|
+
readonly withHeldFileLock?: typeof withHeldFileLock;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export class TombstoneBlockedCaptureWriteLock {
|
|
45
|
+
private readonly context = new AsyncLocalStorage<ReadonlySet<string>>();
|
|
46
|
+
|
|
47
|
+
constructor(private readonly options: TombstoneBlockedCaptureWriteLockOptions) {}
|
|
48
|
+
|
|
49
|
+
private captureWriteLockPathForHash(identityHash: string): string {
|
|
50
|
+
const filename =
|
|
51
|
+
identityHash.length === 0
|
|
52
|
+
? "explicit-capture-write.lock"
|
|
53
|
+
: `explicit-capture-write-${identityHash}.lock`;
|
|
54
|
+
return path.join(this.options.stateDir, "tombstone-blocked-capture", filename);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private async withSingleCaptureWriteLock<T>(lockPath: string, task: () => Promise<T>): Promise<T> {
|
|
58
|
+
await mkdir(path.dirname(lockPath), { recursive: true });
|
|
59
|
+
const retry = Symbol("retry");
|
|
60
|
+
const permanentFailure = Symbol("permanent-failure");
|
|
61
|
+
const runWithHeldFileLock = this.options.withHeldFileLock ?? withHeldFileLock;
|
|
62
|
+
for (let attempt = 0; attempt < CAPTURE_WRITE_LOCK_MAX_ATTEMPTS; attempt += 1) {
|
|
63
|
+
const result = await runWithHeldFileLock<T | typeof retry | typeof permanentFailure>(
|
|
64
|
+
lockPath,
|
|
65
|
+
{
|
|
66
|
+
staleMs: TOMBSTONE_CAPTURE_WRITE_LOCK_STALE_MS,
|
|
67
|
+
maxWaitMs: 1_000,
|
|
68
|
+
pollMs: 25,
|
|
69
|
+
},
|
|
70
|
+
async (acquired, controller) => {
|
|
71
|
+
if (acquired) return await task();
|
|
72
|
+
return controller.failure === "error" ? permanentFailure : retry;
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
if (result === permanentFailure) {
|
|
76
|
+
throw new Error("tombstone-blocked capture write lock acquisition failed");
|
|
77
|
+
}
|
|
78
|
+
if (result !== retry) return result;
|
|
79
|
+
if (attempt === CAPTURE_WRITE_LOCK_MAX_ATTEMPTS - 1) break;
|
|
80
|
+
const delayState = Promise.withResolvers<void>();
|
|
81
|
+
setTimeout(delayState.resolve, CAPTURE_WRITE_LOCK_RETRY_BASE_MS * 2 ** attempt);
|
|
82
|
+
await delayState.promise;
|
|
83
|
+
}
|
|
84
|
+
throw new Error(CAPTURE_WRITE_LOCK_BUSY_MESSAGE);
|
|
85
|
+
}
|
|
86
|
+
private async withPhysicalCaptureWriteLocks<T>(
|
|
87
|
+
task: () => Promise<T>,
|
|
88
|
+
identityHashes: readonly string[]
|
|
89
|
+
): Promise<T> {
|
|
90
|
+
const lockPaths = [...new Set(identityHashes.map((hash) => this.captureWriteLockPathForHash(hash)))].sort();
|
|
91
|
+
const acquire = async (index: number): Promise<T> => {
|
|
92
|
+
if (index === lockPaths.length) return await task();
|
|
93
|
+
return await this.withSingleCaptureWriteLock(lockPaths[index], () => acquire(index + 1));
|
|
94
|
+
};
|
|
95
|
+
return await acquire(0);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
async withCaptureWriteLock<T>(
|
|
100
|
+
task: () => Promise<T>,
|
|
101
|
+
identity?: string | readonly string[]
|
|
102
|
+
): Promise<T> {
|
|
103
|
+
const identities =
|
|
104
|
+
Array.isArray(identity) && identity.length > 0 ? identity : [typeof identity === "string" ? identity : ""];
|
|
105
|
+
return await this.withCaptureWriteLocks(task, identities, []);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async withCaptureWriteLockHashes<T>(
|
|
109
|
+
task: () => Promise<T>,
|
|
110
|
+
identityHashes: readonly string[]
|
|
111
|
+
): Promise<T> {
|
|
112
|
+
return await this.withCaptureWriteLocks(task, [], identityHashes);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async withCaptureWriteLockAndHashes<T>(
|
|
116
|
+
task: () => Promise<T>,
|
|
117
|
+
identity: string | readonly string[] | undefined,
|
|
118
|
+
identityHashes: readonly string[]
|
|
119
|
+
): Promise<T> {
|
|
120
|
+
const identities =
|
|
121
|
+
Array.isArray(identity) && identity.length > 0 ? identity : [typeof identity === "string" ? identity : ""];
|
|
122
|
+
return await this.withCaptureWriteLocks(task, identities, identityHashes);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private async withCaptureWriteLocks<T>(
|
|
126
|
+
task: () => Promise<T>,
|
|
127
|
+
identities: readonly string[],
|
|
128
|
+
identityHashes: readonly string[]
|
|
129
|
+
): Promise<T> {
|
|
130
|
+
const current = this.context.getStore();
|
|
131
|
+
const hashToken = (key: string): string =>
|
|
132
|
+
`\u0000${key.length === 0 ? "" : createHash("sha256").update(key).digest("hex")}`;
|
|
133
|
+
const identityHash = (key: string): string =>
|
|
134
|
+
key.length === 0 ? "" : createHash("sha256").update(key).digest("hex");
|
|
135
|
+
const identityKeys = [...new Set(identities)];
|
|
136
|
+
const hashes = [...new Set(identityHashes)];
|
|
137
|
+
const missingIdentityHashes = identityKeys
|
|
138
|
+
.filter((key) => !current || (!current.has(key) && !current.has(hashToken(key))))
|
|
139
|
+
.map(identityHash);
|
|
140
|
+
const missingHashes = hashes.filter((hash) => !current || !current.has(`\u0000${hash}`));
|
|
141
|
+
const physicalMissing = [...new Set([...missingIdentityHashes, ...missingHashes])];
|
|
142
|
+
if (current && physicalMissing.length > 0) {
|
|
143
|
+
const heldLockPaths = [...current]
|
|
144
|
+
.filter((token) => token.startsWith("\u0000"))
|
|
145
|
+
.map((token) => this.captureWriteLockPathForHash(token.slice(1)));
|
|
146
|
+
const requestedLockPaths = physicalMissing.map((hash) => this.captureWriteLockPathForHash(hash));
|
|
147
|
+
if (heldLockPaths.some((held) => requestedLockPaths.some((requested) => requested < held))) {
|
|
148
|
+
throw new Error(CAPTURE_WRITE_LOCK_BUSY_MESSAGE);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const next = new Set(current);
|
|
152
|
+
for (const key of identityKeys) {
|
|
153
|
+
next.add(key);
|
|
154
|
+
next.add(hashToken(key));
|
|
155
|
+
}
|
|
156
|
+
for (const hash of hashes) next.add(`\u0000${hash}`);
|
|
157
|
+
const run = () => this.context.run(next, task);
|
|
158
|
+
if (physicalMissing.length === 0) return await run();
|
|
159
|
+
return await this.withPhysicalCaptureWriteLocks(run, physicalMissing);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
export type TombstoneBlockedMutationHost = {
|
|
165
|
+
readCurrent: () => Promise<MemoryFile | null>;
|
|
166
|
+
isBlocked: (memory: MemoryFile | null) => boolean;
|
|
167
|
+
isQueuedReview: (memory: MemoryFile | null) => boolean;
|
|
168
|
+
memoryIdentity: (memory: MemoryFile) => string;
|
|
169
|
+
prepareWrite: () => Promise<string>;
|
|
170
|
+
commitWrite: (marker: string) => Promise<void>;
|
|
171
|
+
discardWrite: (marker: string) => Promise<void>;
|
|
172
|
+
markUntrusted: () => void;
|
|
173
|
+
writeStorageSecureFile: (pathname: string, fileContent: string) => Promise<void>;
|
|
174
|
+
withCaptureWriteLock: (task: () => Promise<void>, identity: string | readonly string[]) => Promise<void>;
|
|
175
|
+
logWarning: (message: string) => void;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export type TombstoneBlockedMutation = {
|
|
179
|
+
blocked: boolean;
|
|
180
|
+
pathname: string;
|
|
181
|
+
fileContent: string;
|
|
182
|
+
identity: string | readonly string[];
|
|
183
|
+
updateIndex: (rebuildMarker?: string, current?: MemoryFile | null) => Promise<void>;
|
|
184
|
+
beforeIndexUpdate?: () => Promise<void>;
|
|
185
|
+
coordinate?: boolean;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export async function runTombstoneBlockedMutation(
|
|
189
|
+
host: TombstoneBlockedMutationHost,
|
|
190
|
+
mutation: TombstoneBlockedMutation,
|
|
191
|
+
): Promise<void> {
|
|
192
|
+
let lockIdentity: string | readonly string[] = mutation.identity;
|
|
193
|
+
let mustLock = mutation.blocked || mutation.coordinate === true;
|
|
194
|
+
for (;;) {
|
|
195
|
+
let retryIdentity: string | undefined;
|
|
196
|
+
const mutate = async (): Promise<void> => {
|
|
197
|
+
const current = await host.readCurrent();
|
|
198
|
+
const currentBlocked = host.isBlocked(current);
|
|
199
|
+
const currentQueuedReview = host.isQueuedReview(current);
|
|
200
|
+
if (current !== null && (currentBlocked || currentQueuedReview)) {
|
|
201
|
+
const currentIdentity = host.memoryIdentity(current);
|
|
202
|
+
const heldIdentities = Array.isArray(lockIdentity) ? lockIdentity : [lockIdentity];
|
|
203
|
+
if (!heldIdentities.includes(currentIdentity)) {
|
|
204
|
+
retryIdentity = currentIdentity;
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const rebuildMarker = mutation.blocked || currentBlocked ? await host.prepareWrite() : undefined;
|
|
209
|
+
try {
|
|
210
|
+
await host.writeStorageSecureFile(mutation.pathname, mutation.fileContent);
|
|
211
|
+
} catch (err) {
|
|
212
|
+
if (rebuildMarker) {
|
|
213
|
+
try {
|
|
214
|
+
await host.discardWrite(rebuildMarker);
|
|
215
|
+
} catch (cleanupError) {
|
|
216
|
+
host.markUntrusted();
|
|
217
|
+
host.logWarning(`storage.tombstoneBlocked failed to clear write marker: ${cleanupError}`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
throw err;
|
|
221
|
+
}
|
|
222
|
+
if (rebuildMarker) {
|
|
223
|
+
try {
|
|
224
|
+
await host.commitWrite(rebuildMarker);
|
|
225
|
+
} catch (err) {
|
|
226
|
+
host.markUntrusted();
|
|
227
|
+
host.logWarning(`storage.tombstoneBlocked committed write marker failed: ${err}`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (rebuildMarker) await mutation.beforeIndexUpdate?.();
|
|
231
|
+
await mutation.updateIndex(rebuildMarker, currentBlocked && current !== null ? current : undefined);
|
|
232
|
+
};
|
|
233
|
+
if (mustLock) {
|
|
234
|
+
await host.withCaptureWriteLock(mutate, lockIdentity);
|
|
235
|
+
} else {
|
|
236
|
+
await mutate();
|
|
237
|
+
}
|
|
238
|
+
if (retryIdentity === undefined) return;
|
|
239
|
+
const identities = Array.isArray(lockIdentity)
|
|
240
|
+
? [...lockIdentity, retryIdentity]
|
|
241
|
+
: [lockIdentity, retryIdentity];
|
|
242
|
+
lockIdentity = [...new Set(identities)];
|
|
243
|
+
mustLock = true;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export function tombstoneBlocked(frontmatter: MemoryFrontmatter): boolean {
|
|
248
|
+
return frontmatter.status === "pending_review" && Boolean(frontmatter.blockedBy);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export function isQueuedReviewFrontmatter(frontmatter: MemoryFrontmatter): boolean {
|
|
252
|
+
return frontmatter.status === "pending_review" && (frontmatter.tags ?? []).includes("queued-review");
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export function isQueuedReviewMemory(memory: MemoryFile | null): memory is MemoryFile {
|
|
256
|
+
return memory !== null && isQueuedReviewFrontmatter(memory.frontmatter);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export type TombstoneBlockedChunkMutation = {
|
|
260
|
+
blocked: boolean;
|
|
261
|
+
id: string;
|
|
262
|
+
identity: string;
|
|
263
|
+
findDuplicate: () => Promise<MemoryFile | null>;
|
|
264
|
+
persistMemory: () => Promise<void>;
|
|
265
|
+
afterWrite: () => Promise<void>;
|
|
266
|
+
withCaptureWriteLock: (task: () => Promise<string>, identity: string) => Promise<string>;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
export async function runTombstoneBlockedChunkMutation(
|
|
270
|
+
mutation: TombstoneBlockedChunkMutation,
|
|
271
|
+
): Promise<string> {
|
|
272
|
+
const persist = async (): Promise<string> => {
|
|
273
|
+
if (mutation.blocked) {
|
|
274
|
+
const duplicate = await mutation.findDuplicate();
|
|
275
|
+
if (duplicate) return duplicate.frontmatter.id;
|
|
276
|
+
}
|
|
277
|
+
await mutation.persistMemory();
|
|
278
|
+
await mutation.afterWrite();
|
|
279
|
+
return mutation.id;
|
|
280
|
+
};
|
|
281
|
+
return mutation.blocked
|
|
282
|
+
? await mutation.withCaptureWriteLock(persist, mutation.identity)
|
|
283
|
+
: await persist();
|
|
284
|
+
}
|