@remnic/core 9.54.4 → 9.54.6
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 +24 -23
- package/dist/access-admin-ops-surface.js +55 -50
- package/dist/access-authorization-probe.d.ts +25 -22
- package/dist/access-authorization-probe.js +58 -51
- package/dist/access-boundary.d.ts +26 -23
- package/dist/access-boundary.js +59 -52
- package/dist/access-cli.js +115 -107
- 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 +19 -18
- package/dist/access-extraction-force-flush.js +55 -50
- package/dist/access-health-types.d.ts +1 -1
- package/dist/access-http-lcm-compaction.d.ts +22 -21
- package/dist/access-http-lifecycle-flush.d.ts +22 -21
- package/dist/access-http-offline-stream.d.ts +19 -18
- package/dist/access-http-query.js +55 -50
- package/dist/access-http.d.ts +55 -36
- package/dist/access-http.js +76 -65
- package/dist/access-identity-continuity-surface.d.ts +9 -9
- package/dist/access-identity-continuity-surface.js +55 -50
- package/dist/access-lcm-surface.d.ts +21 -20
- package/dist/access-lcm-surface.js +55 -50
- package/dist/access-mcp.d.ts +22 -21
- package/dist/access-mcp.js +63 -57
- package/dist/access-memory-search-fanout.d.ts +22 -2
- package/dist/access-memory-search-fanout.js +1 -1
- package/dist/{access-namespace-preflight-C7n4tgWC.d.ts → access-namespace-preflight-CCNn_6NE.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +3 -3
- package/dist/access-namespace-preflight.js +55 -50
- package/dist/access-observe-write-surface.d.ts +22 -21
- package/dist/access-observe-write-surface.js +55 -50
- package/dist/access-offline-manifest.d.ts +10 -9
- package/dist/access-offline-manifest.js +12 -10
- package/dist/access-operations-batch.js +57 -52
- package/dist/access-operations.d.ts +23 -22
- package/dist/access-operations.js +61 -55
- package/dist/access-recall-concurrency.d.ts +21 -20
- package/dist/access-recall-concurrency.js +55 -50
- package/dist/access-recall-response.d.ts +19 -18
- package/dist/access-recall-response.js +55 -50
- package/dist/access-recall-surface.d.ts +19 -18
- package/dist/access-recall-surface.js +55 -50
- package/dist/access-schema.d.ts +2 -2
- package/dist/access-schema.js +5 -4
- package/dist/{access-service-CXvbxLK-.d.ts → access-service-DkSdXK4S.d.ts} +1314 -83
- package/dist/access-service-helpers.d.ts +22 -21
- package/dist/access-service.d.ts +31 -30
- package/dist/access-service.js +55 -50
- package/dist/access-surface-catalog.d.ts +22 -21
- package/dist/access-surface-catalog.js +209 -2
- 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 +14 -1
- package/dist/active-memory-bridge.js +6 -1
- package/dist/active-recall.d.ts +1 -1
- package/dist/active-recall.js +4 -2
- package/dist/active-recall.js.map +1 -1
- package/dist/adapters/index.js +7 -7
- package/dist/adapters/registry.js +3 -3
- package/dist/admin-console/public/what-helps-me/app.js +1594 -0
- package/dist/admin-console/public/what-helps-me/index.html +339 -0
- package/dist/admin-console/public/what-helps-me/model.js +685 -0
- package/dist/admin-console/public/what-helps-me/what-helps-me.css +1296 -0
- package/dist/ambient-provenance.d.ts +1 -1
- package/dist/artifact-search.d.ts +1 -1
- package/dist/{auto-sync-TDHLZPVP.js → auto-sync-NR3GPCOA.js} +4 -4
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +9 -9
- package/dist/briefing.d.ts +2 -2
- package/dist/briefing.js +33 -12
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer-turn-helpers.d.ts +1 -1
- package/dist/buffer.d.ts +2 -2
- package/dist/buffer.js +3 -3
- package/dist/bulk-import/index.d.ts +3 -3
- package/dist/calibration.d.ts +1 -1
- package/dist/calibration.js +1 -1
- package/dist/capabilities.d.ts +1 -1
- package/dist/{catalog-BOOxl-I2.d.ts → catalog-DGFf8mD9.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 +34 -13
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/{chunk-ZYLC7NFO.js → chunk-26ZXBTYN.js} +4 -4
- package/dist/chunk-26ZXBTYN.js.map +1 -0
- package/dist/{chunk-LLJMAULE.js → chunk-2FKEIPIT.js} +5 -5
- package/dist/{chunk-3CSX3ETE.js → chunk-2LWQSV6A.js} +23 -11
- package/dist/chunk-2LWQSV6A.js.map +1 -0
- package/dist/{chunk-JBPKEARU.js → chunk-2QSZNTDO.js} +7 -7
- package/dist/chunk-37DZZFFM.js +502 -0
- package/dist/chunk-37DZZFFM.js.map +1 -0
- package/dist/chunk-3HSRWJTC.js +9 -0
- package/dist/chunk-3HSRWJTC.js.map +1 -0
- package/dist/{chunk-XUAMCLY4.js → chunk-3TIZPSJC.js} +17 -13
- package/dist/chunk-3TIZPSJC.js.map +1 -0
- package/dist/{chunk-PDDTI7IC.js → chunk-43SEBY2M.js} +1 -1
- package/dist/{chunk-HWRD23DW.js → chunk-46SZBVDS.js} +3 -3
- package/dist/{chunk-6HPHEFXT.js → chunk-5FD7JMTX.js} +2 -2
- package/dist/{chunk-7BZOBA5J.js → chunk-5NB726GV.js} +70 -16
- package/dist/chunk-5NB726GV.js.map +1 -0
- package/dist/chunk-62OKGIJA.js +39 -0
- package/dist/chunk-62OKGIJA.js.map +1 -0
- package/dist/{chunk-IBKR2TFR.js → chunk-6CYHUWCO.js} +2 -2
- package/dist/{chunk-YN6ASZUG.js → chunk-6QPI2ITJ.js} +5 -5
- package/dist/{chunk-UU3G6GUP.js → chunk-76JJSXK7.js} +1 -1
- package/dist/chunk-76JJSXK7.js.map +1 -0
- package/dist/{chunk-PX2LSHYM.js → chunk-7BD6O7ZV.js} +189 -4
- package/dist/chunk-7BD6O7ZV.js.map +1 -0
- package/dist/chunk-7TBXNYLO.js +346 -0
- package/dist/chunk-7TBXNYLO.js.map +1 -0
- package/dist/{chunk-NH5IR2WM.js → chunk-BRR5EUTF.js} +6 -2
- package/dist/chunk-BRR5EUTF.js.map +1 -0
- package/dist/{chunk-NIS256NW.js → chunk-CIAI24TQ.js} +3 -3
- package/dist/{chunk-T2JHZWH6.js → chunk-D3LBIUWV.js} +11703 -7573
- package/dist/chunk-D3LBIUWV.js.map +1 -0
- package/dist/{chunk-7FGL6CGA.js → chunk-DVYRD4HY.js} +2 -2
- package/dist/{chunk-G7Z6EENO.js → chunk-EKTP7MNS.js} +4 -4
- package/dist/{chunk-S75M5ZRK.js → chunk-F2JRDPON.js} +16 -1
- package/dist/chunk-F2JRDPON.js.map +1 -0
- package/dist/{chunk-RZ4XGKOJ.js → chunk-FFRTNF3L.js} +8 -8
- package/dist/{chunk-VKXWK44Q.js → chunk-FONWBCVY.js} +3 -3
- package/dist/{chunk-DZD576ZU.js → chunk-FPLM2TKD.js} +2 -2
- package/dist/{chunk-ZPJ4QSGP.js → chunk-FTPONF6B.js} +2 -2
- package/dist/{chunk-LJS7KUPV.js → chunk-FWX7W5PM.js} +2 -2
- package/dist/{chunk-UTRO5UJU.js → chunk-G6DFSS6A.js} +5 -1
- package/dist/chunk-G6DFSS6A.js.map +1 -0
- package/dist/{chunk-6LAPLZOS.js → chunk-GJ776BC2.js} +8 -3
- package/dist/chunk-GJ776BC2.js.map +1 -0
- package/dist/{chunk-G4T7L557.js → chunk-GN3WRFJY.js} +6 -6
- package/dist/{chunk-QT2FRYI4.js → chunk-H7NAZ3UB.js} +2 -2
- package/dist/{chunk-APPFNGX6.js → chunk-HBUFQRIM.js} +2 -2
- package/dist/{chunk-UU7TRFNE.js → chunk-HGJ6NJ4E.js} +2 -2
- package/dist/{chunk-WB7JSQCP.js → chunk-HIEWDJ2O.js} +5 -2
- package/dist/{chunk-WB7JSQCP.js.map → chunk-HIEWDJ2O.js.map} +1 -1
- package/dist/{chunk-UES4BHA2.js → chunk-I3MSGFGD.js} +17 -6
- package/dist/chunk-I3MSGFGD.js.map +1 -0
- package/dist/{chunk-C4ZNGVK3.js → chunk-IKP5OYQQ.js} +2 -2
- package/dist/{chunk-KQAFEZQX.js → chunk-IPLYGWQF.js} +5 -5
- package/dist/{chunk-RDJRFDJY.js → chunk-IQ4NVWEF.js} +2 -2
- package/dist/{chunk-CGVHPCP2.js → chunk-JYG4OLWH.js} +2 -2
- package/dist/{chunk-WOPA3SGI.js → chunk-K26NWEOC.js} +8 -8
- package/dist/{chunk-K4QS7LXU.js → chunk-K2UGPTYY.js} +485 -44
- package/dist/chunk-K2UGPTYY.js.map +1 -0
- package/dist/{chunk-L6CQ7WIW.js → chunk-KFBOPMF6.js} +11 -11
- package/dist/chunk-KFBOPMF6.js.map +1 -0
- package/dist/{chunk-G7A5HLUS.js → chunk-KJH6W2I7.js} +2 -2
- package/dist/{chunk-IXEBUYO4.js → chunk-KM55SMLG.js} +11 -2
- package/dist/{chunk-IXEBUYO4.js.map → chunk-KM55SMLG.js.map} +1 -1
- package/dist/{chunk-HOIRB77A.js → chunk-L6Z5OAS4.js} +2 -2
- package/dist/chunk-LC2BDILZ.js +57 -0
- package/dist/chunk-LC2BDILZ.js.map +1 -0
- package/dist/{chunk-227UFSEQ.js → chunk-LEPOP46W.js} +4 -4
- package/dist/{chunk-6R4G7N4S.js → chunk-M4YHAODQ.js} +388 -748
- package/dist/chunk-M4YHAODQ.js.map +1 -0
- package/dist/{chunk-3JLPGJ43.js → chunk-MIH3CJPN.js} +5 -5
- package/dist/{chunk-QHFV6VNU.js → chunk-MK5VEWCR.js} +2 -2
- package/dist/chunk-NISZQW72.js +140 -0
- package/dist/chunk-NISZQW72.js.map +1 -0
- package/dist/{chunk-GUKBW4HL.js → chunk-NQMSEB5D.js} +6 -6
- package/dist/{chunk-G2LUMAUF.js → chunk-OCIP6YMD.js} +12 -5
- package/dist/chunk-OCIP6YMD.js.map +1 -0
- package/dist/{chunk-47P3RYZP.js → chunk-PG4QBPVG.js} +21 -11
- package/dist/chunk-PG4QBPVG.js.map +1 -0
- package/dist/{chunk-WRJVB3C2.js → chunk-PO7NXBG2.js} +2 -2
- package/dist/{chunk-QWGE2PUH.js → chunk-PT54WISF.js} +190 -56
- package/dist/chunk-PT54WISF.js.map +1 -0
- package/dist/{chunk-AZM4CCAC.js → chunk-QZLDRQ4I.js} +8 -8
- package/dist/{chunk-THPPCISA.js → chunk-RBII7637.js} +5 -5
- package/dist/{chunk-JDZPNCMA.js → chunk-RUNORG2P.js} +6 -3
- package/dist/chunk-RUNORG2P.js.map +1 -0
- package/dist/{chunk-JV5YUBIZ.js → chunk-RZQ6W2W4.js} +50 -44
- package/dist/chunk-RZQ6W2W4.js.map +1 -0
- package/dist/{chunk-RUMNY5DT.js → chunk-SMNYAMJD.js} +6 -2
- package/dist/chunk-SMNYAMJD.js.map +1 -0
- package/dist/{chunk-MKQBXQKU.js → chunk-TB6CBZ5V.js} +22 -15
- package/dist/chunk-TB6CBZ5V.js.map +1 -0
- package/dist/{chunk-VMMQDEN5.js → chunk-TO7ZTWJW.js} +2 -2
- package/dist/{chunk-K2TDK7GG.js → chunk-TWTUGCTY.js} +2 -2
- package/dist/{chunk-HLYR2TQL.js → chunk-UCTS3DDH.js} +2 -2
- package/dist/{chunk-JYIJNNN3.js → chunk-UG6VXIOK.js} +2 -2
- package/dist/{chunk-WM65LU67.js → chunk-UKYS3NU5.js} +2 -2
- package/dist/{chunk-WDBX6VER.js → chunk-UPLZNJKN.js} +5 -5
- package/dist/{chunk-C23BYTJV.js → chunk-UW5NPZJ2.js} +40 -12
- package/dist/chunk-UW5NPZJ2.js.map +1 -0
- package/dist/{chunk-2GFK22OZ.js → chunk-V6ERBR7U.js} +2 -2
- package/dist/{chunk-CYF6WVE7.js → chunk-W5ZKPI34.js} +139 -158
- package/dist/chunk-W5ZKPI34.js.map +1 -0
- package/dist/chunk-XX4HPFFM.js +370 -0
- package/dist/chunk-XX4HPFFM.js.map +1 -0
- package/dist/{chunk-ZMYDYNI4.js → chunk-XZHE2DEN.js} +4 -4
- package/dist/chunk-YXQEKCZM.js +223 -0
- package/dist/chunk-YXQEKCZM.js.map +1 -0
- package/dist/{chunk-GYPQL6XN.js → chunk-Z4N7SVVF.js} +35 -47
- package/dist/chunk-Z4N7SVVF.js.map +1 -0
- package/dist/{chunk-MAXVH44E.js → chunk-Z54EM5YZ.js} +7 -7
- package/dist/{chunk-YGLY6QFV.js → chunk-ZRZVLB7O.js} +2 -2
- package/dist/{chunk-4IIFL7GC.js → chunk-ZUKIUXHQ.js} +10 -10
- package/dist/{cli-DVUFIa5E.d.ts → cli-Bze8S0Qs.d.ts} +5 -5
- package/dist/cli.d.ts +22 -21
- package/dist/cli.js +90 -80
- package/dist/coding/pre-action-gate.d.ts +1 -1
- package/dist/compounding/engine.d.ts +2 -2
- package/dist/compounding/engine.js +33 -12
- 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 +4 -2
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +33 -12
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +32 -12
- 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/contradiction/index.js +3 -1
- package/dist/contradiction-scan-JDTBXRGW.js +20 -0
- package/dist/converge-config.d.ts +1 -1
- package/dist/convergence-refresh.d.ts +2 -2
- package/dist/convergence-refresh.js +35 -14
- 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 +25 -24
- package/dist/day-summary.d.ts +1 -1
- package/dist/delinearize.d.ts +1 -1
- package/dist/dependency-propagation-config.d.ts +1 -1
- package/dist/{dependency-propagation-delivery-XzF76C9n.d.ts → dependency-propagation-delivery-CzEfB31P.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 +33 -12
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +9 -9
- package/dist/explicit-capture.js +7 -4
- package/dist/external-wiki-access.d.ts +22 -21
- package/dist/external-wiki-access.js +56 -51
- 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 +22 -21
- package/dist/extraction-error-classification.d.ts +1 -1
- package/dist/extraction-faithfulness.d.ts +1 -1
- package/dist/extraction-faithfulness.js +2 -2
- 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-judge.js +2 -2
- package/dist/extraction-liveness.d.ts +1 -1
- package/dist/extraction-normalization.d.ts +1 -1
- package/dist/extraction-prompt.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/extraction.js +35 -19
- package/dist/fallback-llm.d.ts +14 -1
- package/dist/fallback-llm.js +1 -1
- package/dist/{first-start-migration-626C5554.js → first-start-migration-CRZCZAJN.js} +11 -3
- package/dist/first-start-migration-CRZCZAJN.js.map +1 -0
- 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-path-reconstruction.d.ts +1 -1
- package/dist/graph-path-scoring.d.ts +1 -1
- package/dist/graph-snapshot.d.ts +1 -1
- package/dist/graph.d.ts +1 -1
- package/dist/harmonic-retrieval.js +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 +314 -308
- package/dist/index.js +304 -133
- package/dist/inline-script.d.ts +3 -0
- package/dist/inline-script.js +8 -0
- package/dist/inline-script.js.map +1 -0
- 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.d.ts +2 -1
- package/dist/local-llm.js +2 -2
- package/dist/local-model-endpoint.d.ts +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +33 -12
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +33 -12
- package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-projection.js +34 -13
- package/dist/{maintenance-BJzNIKBE.d.ts → maintenance-C8aRWfhq.d.ts} +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +22 -21
- package/dist/mcp-read-only-tools.js +1 -1
- 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-mutations.js +2 -2
- package/dist/memory-projection-store.d.ts +6 -2
- package/dist/memory-projection-store.js +1 -1
- package/dist/memory-provenance.d.ts +1 -1
- package/dist/memory-snapshot.d.ts +1 -1
- package/dist/memory-worth-outcomes.d.ts +2 -2
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +3 -3
- package/dist/namespaces/migrate.js +24 -23
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/search.js +8 -8
- package/dist/namespaces/storage.d.ts +3 -3
- package/dist/namespaces/storage.js +33 -12
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/offline-sync-file-io.d.ts +20 -0
- package/dist/offline-sync-file-io.js +18 -0
- package/dist/offline-sync-file-io.js.map +1 -0
- package/dist/offline-sync-impression-drain.d.ts +1 -1
- package/dist/offline-sync-impression-drain.js +5 -5
- package/dist/offline-sync.d.ts +8 -6
- package/dist/offline-sync.js +2 -1
- package/dist/operator-doctor-corpus.d.ts +1 -1
- package/dist/operator-doctor-corpus.js +26 -25
- package/dist/operator-doctor-replica.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +3 -3
- package/dist/operator-toolkit.js +39 -36
- package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
- package/dist/orchestration/maintenance.d.ts +4 -4
- package/dist/orchestration/maintenance.js +38 -18
- package/dist/{orchestrator-BiXgBJBQ.d.ts → orchestrator-D85CzDDY.d.ts} +11 -8
- package/dist/orchestrator.d.ts +9 -9
- package/dist/orchestrator.js +117 -109
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/{pipeline-sz_dcuLg.d.ts → pipeline-DPcUifCO.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/public-http-D-SyWNj6.d.ts +25 -0
- package/dist/{purge-533FZLS4.js → purge-GB7PZHT2.js} +2 -2
- package/dist/{qmd-eAWObK4M.d.ts → qmd-dFCHp1r0.d.ts} +1 -1
- package/dist/qmd-preflight.d.ts +2 -2
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +2 -2
- package/dist/recall-concurrency-config.d.ts +1 -1
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +1 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-memory-map.d.ts +1 -1
- package/dist/recall-planner-llm.d.ts +1 -1
- package/dist/recall-planner-llm.js +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 +2 -1
- package/dist/reconcile/manifest.d.ts +2 -1
- package/dist/reconcile/manifest.js +6 -5
- package/dist/reconcile/plan.d.ts +2 -1
- package/dist/reconcile/plan.js +3 -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-peers-config.d.ts +1 -1
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/resume-bundles.js +5 -3
- 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 +38 -38
- package/dist/{scope-profiles-BBQsXuyj.d.ts → scope-profiles-DICK7GtN.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 +6 -6
- 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-HD8RkzVA.d.ts → semantic-consolidation-BP7NAX0N.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +34 -13
- package/dist/semantic-rule-promotion.js +33 -12
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +33 -12
- package/dist/{service-DIrtHHEg.d.ts → service-DT-pJyda.d.ts} +660 -660
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- package/dist/shared-context/manager.d.ts +1 -1
- package/dist/signal.d.ts +1 -1
- package/dist/source-agent-qualifier.d.ts +1 -1
- package/dist/source-agent-qualifier.js +31 -15
- package/dist/{storage-DqCzXi56.d.ts → storage-qOnaJ1Lw.d.ts} +49 -13
- package/dist/storage.d.ts +2 -2
- package/dist/storage.js +33 -12
- package/dist/summarizer.d.ts +1 -1
- package/dist/summarizer.js +5 -5
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/support-passport/index.d.ts +518 -0
- package/dist/support-passport/index.js +357 -0
- package/dist/support-passport/index.js.map +1 -0
- 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 +2 -2
- package/dist/tier-routing.js +7 -1
- package/dist/{tier-stats-2JCZYEF7.js → tier-stats-EXYSKSVN.js} +8 -2
- package/dist/{tier-stats-2JCZYEF7.js.map → tier-stats-EXYSKSVN.js.map} +1 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/transfer/autodetect.js +1 -1
- package/dist/transfer/backup.js +1 -1
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/types.d.ts +36 -36
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-d_j4vC6N.d.ts → types-ed-SvS2t.d.ts} +8 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +2 -2
- package/dist/verified-recall.js +33 -12
- package/dist/write-envelope.d.ts +1 -1
- package/dist/write-rate-limiter.d.ts +11 -5
- package/dist/write-rate-limiter.js +1 -1
- package/package.json +12 -2
- package/scripts/build-with-heap.mjs +11 -1
- package/src/access-authorization-probe.ts +20 -2
- package/src/access-boundary.ts +32 -0
- package/src/access-http.test.ts +1971 -643
- package/src/access-http.ts +81 -74
- package/src/access-mcp.ts +3 -1
- package/src/access-memory-search-fanout.ts +24 -1
- package/src/access-offline-manifest.ts +5 -0
- package/src/access-operations.ts +2 -0
- package/src/access-service-namespace.test.ts +14 -0
- package/src/access-service-observe-scope.test.ts +2 -0
- package/src/access-service-offline-file-content.test.ts +211 -0
- package/src/access-service.ts +628 -884
- package/src/access-surface-catalog.test.ts +40 -10
- package/src/access-surface-catalog.ts +15 -0
- package/src/active-memory-bridge.test.ts +151 -0
- package/src/active-memory-bridge.ts +95 -21
- package/src/briefing.test.ts +38 -0
- package/src/briefing.ts +3 -3
- package/src/cli.ts +6 -1
- package/src/config.ts +18 -9
- package/src/connectors/codex-materialize-runner.ts +2 -0
- package/src/contradiction/contradiction-scan.ts +2 -0
- package/src/contradiction/contradiction.test.ts +42 -0
- package/src/correction/correction-access-wiring.ts +8 -2
- package/src/correction/correction-storage-integration.test.ts +7 -0
- package/src/explicit-capture.test.ts +24 -0
- package/src/explicit-capture.ts +2 -0
- package/src/fallback-llm.test.ts +54 -0
- package/src/fallback-llm.ts +54 -9
- package/src/index.ts +3 -0
- package/src/inline-script.ts +6 -0
- package/src/local-llm-headers-timeout.test.ts +42 -0
- package/src/local-llm.ts +8 -8
- package/src/maintenance/first-start-migration.ts +2 -1
- package/src/maintenance/memory-governance.test.ts +25 -0
- package/src/maintenance/memory-governance.ts +4 -1
- package/src/maintenance/pattern-reinforcement.test.ts +20 -0
- package/src/maintenance/pattern-reinforcement.ts +2 -1
- package/src/maintenance/rebuild-memory-projection.ts +8 -8
- package/src/mcp-read-only-tools.ts +3 -0
- package/src/memory-projection-store.ts +25 -27
- package/src/offline-sync-file-io.ts +68 -0
- package/src/offline-sync.ts +43 -57
- package/src/orchestration/consolidation-run.ts +5 -4
- package/src/orchestration/contradiction-linking-coordinator.ts +7 -0
- package/src/orchestration/contradiction-localization.integration.test.ts +115 -0
- package/src/orchestration/lifecycle-policy-coordinator.ts +2 -1
- package/src/orchestration/qmd-result-resolver.test.ts +215 -14
- package/src/orchestration/qmd-result-resolver.ts +142 -82
- package/src/orchestration/recall-search-pipeline.test.ts +41 -0
- package/src/orchestration/recall-search-pipeline.ts +12 -0
- package/src/orchestration/semantic-consolidation-coordinator.ts +2 -1
- package/src/orchestration/tier-migration-coordinator.ts +23 -56
- package/src/orchestration/workspace-ops.test.ts +37 -0
- package/src/orchestration/workspace-ops.ts +5 -29
- package/src/orchestrator.ts +7 -8
- package/src/relay/mission-access.test.ts +11 -11
- package/src/relay/mission-ui.test.ts +3 -1
- package/src/storage/supersession-audit.ts +7 -1
- package/src/storage/supersession-side-effects.ts +17 -5
- package/src/storage/tombstone-blocked-capture-sync.ts +31 -0
- package/src/storage-contract/failure-semantics.test.ts +102 -0
- package/src/storage.ts +18 -19
- package/src/support-passport/access-http-base.ts +143 -0
- package/src/support-passport/access-http.ts +172 -0
- package/src/support-passport/access-operations.ts +272 -0
- package/src/support-passport/access-service-base.test.ts +193 -0
- package/src/support-passport/access-service-base.ts +176 -0
- package/src/support-passport/access-surface.test.ts +283 -0
- package/src/support-passport/access-surface.ts +286 -0
- package/src/support-passport/card-projection.test.ts +137 -0
- package/src/support-passport/card-projection.ts +348 -0
- package/src/support-passport/card-replacement.ts +126 -0
- package/src/support-passport/card-service-commit-forwarding.test.ts +160 -0
- package/src/support-passport/card-service.test.ts +2964 -0
- package/src/support-passport/card-service.ts +1184 -0
- package/src/support-passport/card-state.ts +158 -0
- package/src/support-passport/config-model-routing.test.ts +37 -0
- package/src/support-passport/config.test.ts +34 -0
- package/src/support-passport/config.ts +41 -0
- package/src/support-passport/contracts.test.ts +156 -0
- package/src/support-passport/contracts.ts +149 -0
- package/src/support-passport/errors.ts +30 -0
- package/src/support-passport/generated-batch.test.ts +185 -0
- package/src/support-passport/generated-batch.ts +338 -0
- package/src/support-passport/grant-contracts.ts +183 -0
- package/src/support-passport/grant-generated-batch-scope.test.ts +201 -0
- package/src/support-passport/grant-service-cache.test.ts +148 -0
- package/src/support-passport/grant-service-cancellation.test.ts +83 -0
- package/src/support-passport/grant-service-marker-cache.test.ts +62 -0
- package/src/support-passport/grant-service.test.ts +3496 -0
- package/src/support-passport/grant-service.ts +513 -0
- package/src/support-passport/grant-store-commit-hook.test.ts +123 -0
- package/src/support-passport/grant-store-order.test.ts +60 -0
- package/src/support-passport/grant-store-path-safety.test.ts +30 -0
- package/src/support-passport/grant-store-recovery.test.ts +448 -0
- package/src/support-passport/grant-store.ts +906 -0
- package/src/support-passport/index.ts +17 -0
- package/src/support-passport/mcp-tools.test.ts +222 -0
- package/src/support-passport/mcp-tools.ts +187 -0
- package/src/support-passport/model-adapter.test.ts +840 -0
- package/src/support-passport/model-adapter.ts +602 -0
- package/src/support-passport/model-audit-pinned-write.test.ts +59 -0
- package/src/support-passport/model-audit.ts +152 -0
- package/src/support-passport/model-bridge.test.ts +456 -0
- package/src/support-passport/model-bridge.ts +439 -0
- package/src/support-passport/model-contracts.ts +124 -0
- package/src/support-passport/model-service.test.ts +1731 -0
- package/src/support-passport/model-service.ts +399 -0
- package/src/support-passport/offline-sync-guard.ts +230 -0
- package/src/support-passport/owner-http.test.ts +671 -0
- package/src/support-passport/owner-lock.ts +70 -0
- package/src/support-passport/private-file.test.ts +99 -0
- package/src/support-passport/private-file.ts +498 -0
- package/src/support-passport/public-http.test.ts +476 -0
- package/src/support-passport/public-http.ts +601 -0
- package/src/support-passport/ui.test.ts +181 -0
- package/src/tier-routing.ts +28 -17
- package/src/training-export/converter.test.ts +24 -0
- package/src/training-export/converter.ts +2 -0
- package/src/types.ts +8 -1
- package/src/wearables/service.test.ts +13 -0
- package/src/wearables/service.ts +2 -0
- package/src/write-rate-limiter.test.ts +30 -6
- package/src/write-rate-limiter.ts +29 -18
- package/dist/chunk-3CSX3ETE.js.map +0 -1
- package/dist/chunk-47P3RYZP.js.map +0 -1
- package/dist/chunk-6LAPLZOS.js.map +0 -1
- package/dist/chunk-6R4G7N4S.js.map +0 -1
- package/dist/chunk-7BZOBA5J.js.map +0 -1
- package/dist/chunk-C23BYTJV.js.map +0 -1
- package/dist/chunk-CYF6WVE7.js.map +0 -1
- package/dist/chunk-G2LUMAUF.js.map +0 -1
- package/dist/chunk-GYPQL6XN.js.map +0 -1
- package/dist/chunk-JDZPNCMA.js.map +0 -1
- package/dist/chunk-JV5YUBIZ.js.map +0 -1
- package/dist/chunk-K4QS7LXU.js.map +0 -1
- package/dist/chunk-L6CQ7WIW.js.map +0 -1
- package/dist/chunk-MKQBXQKU.js.map +0 -1
- package/dist/chunk-NH5IR2WM.js.map +0 -1
- package/dist/chunk-PX2LSHYM.js.map +0 -1
- package/dist/chunk-QWGE2PUH.js.map +0 -1
- package/dist/chunk-RUMNY5DT.js.map +0 -1
- package/dist/chunk-S75M5ZRK.js.map +0 -1
- package/dist/chunk-T2JHZWH6.js.map +0 -1
- package/dist/chunk-UES4BHA2.js.map +0 -1
- package/dist/chunk-UTRO5UJU.js.map +0 -1
- package/dist/chunk-UU3G6GUP.js.map +0 -1
- package/dist/chunk-XUAMCLY4.js.map +0 -1
- package/dist/chunk-ZYLC7NFO.js.map +0 -1
- package/dist/contradiction-scan-HYLIRMJ2.js +0 -14
- package/dist/first-start-migration-626C5554.js.map +0 -1
- /package/dist/{auto-sync-TDHLZPVP.js.map → auto-sync-NR3GPCOA.js.map} +0 -0
- /package/dist/{chunk-LLJMAULE.js.map → chunk-2FKEIPIT.js.map} +0 -0
- /package/dist/{chunk-JBPKEARU.js.map → chunk-2QSZNTDO.js.map} +0 -0
- /package/dist/{chunk-PDDTI7IC.js.map → chunk-43SEBY2M.js.map} +0 -0
- /package/dist/{chunk-HWRD23DW.js.map → chunk-46SZBVDS.js.map} +0 -0
- /package/dist/{chunk-6HPHEFXT.js.map → chunk-5FD7JMTX.js.map} +0 -0
- /package/dist/{chunk-IBKR2TFR.js.map → chunk-6CYHUWCO.js.map} +0 -0
- /package/dist/{chunk-YN6ASZUG.js.map → chunk-6QPI2ITJ.js.map} +0 -0
- /package/dist/{chunk-NIS256NW.js.map → chunk-CIAI24TQ.js.map} +0 -0
- /package/dist/{chunk-7FGL6CGA.js.map → chunk-DVYRD4HY.js.map} +0 -0
- /package/dist/{chunk-G7Z6EENO.js.map → chunk-EKTP7MNS.js.map} +0 -0
- /package/dist/{chunk-RZ4XGKOJ.js.map → chunk-FFRTNF3L.js.map} +0 -0
- /package/dist/{chunk-VKXWK44Q.js.map → chunk-FONWBCVY.js.map} +0 -0
- /package/dist/{chunk-DZD576ZU.js.map → chunk-FPLM2TKD.js.map} +0 -0
- /package/dist/{chunk-ZPJ4QSGP.js.map → chunk-FTPONF6B.js.map} +0 -0
- /package/dist/{chunk-LJS7KUPV.js.map → chunk-FWX7W5PM.js.map} +0 -0
- /package/dist/{chunk-G4T7L557.js.map → chunk-GN3WRFJY.js.map} +0 -0
- /package/dist/{chunk-QT2FRYI4.js.map → chunk-H7NAZ3UB.js.map} +0 -0
- /package/dist/{chunk-APPFNGX6.js.map → chunk-HBUFQRIM.js.map} +0 -0
- /package/dist/{chunk-UU7TRFNE.js.map → chunk-HGJ6NJ4E.js.map} +0 -0
- /package/dist/{chunk-C4ZNGVK3.js.map → chunk-IKP5OYQQ.js.map} +0 -0
- /package/dist/{chunk-KQAFEZQX.js.map → chunk-IPLYGWQF.js.map} +0 -0
- /package/dist/{chunk-RDJRFDJY.js.map → chunk-IQ4NVWEF.js.map} +0 -0
- /package/dist/{chunk-CGVHPCP2.js.map → chunk-JYG4OLWH.js.map} +0 -0
- /package/dist/{chunk-WOPA3SGI.js.map → chunk-K26NWEOC.js.map} +0 -0
- /package/dist/{chunk-G7A5HLUS.js.map → chunk-KJH6W2I7.js.map} +0 -0
- /package/dist/{chunk-HOIRB77A.js.map → chunk-L6Z5OAS4.js.map} +0 -0
- /package/dist/{chunk-227UFSEQ.js.map → chunk-LEPOP46W.js.map} +0 -0
- /package/dist/{chunk-3JLPGJ43.js.map → chunk-MIH3CJPN.js.map} +0 -0
- /package/dist/{chunk-QHFV6VNU.js.map → chunk-MK5VEWCR.js.map} +0 -0
- /package/dist/{chunk-GUKBW4HL.js.map → chunk-NQMSEB5D.js.map} +0 -0
- /package/dist/{chunk-WRJVB3C2.js.map → chunk-PO7NXBG2.js.map} +0 -0
- /package/dist/{chunk-AZM4CCAC.js.map → chunk-QZLDRQ4I.js.map} +0 -0
- /package/dist/{chunk-THPPCISA.js.map → chunk-RBII7637.js.map} +0 -0
- /package/dist/{chunk-VMMQDEN5.js.map → chunk-TO7ZTWJW.js.map} +0 -0
- /package/dist/{chunk-K2TDK7GG.js.map → chunk-TWTUGCTY.js.map} +0 -0
- /package/dist/{chunk-HLYR2TQL.js.map → chunk-UCTS3DDH.js.map} +0 -0
- /package/dist/{chunk-JYIJNNN3.js.map → chunk-UG6VXIOK.js.map} +0 -0
- /package/dist/{chunk-WM65LU67.js.map → chunk-UKYS3NU5.js.map} +0 -0
- /package/dist/{chunk-WDBX6VER.js.map → chunk-UPLZNJKN.js.map} +0 -0
- /package/dist/{chunk-2GFK22OZ.js.map → chunk-V6ERBR7U.js.map} +0 -0
- /package/dist/{chunk-ZMYDYNI4.js.map → chunk-XZHE2DEN.js.map} +0 -0
- /package/dist/{chunk-MAXVH44E.js.map → chunk-Z54EM5YZ.js.map} +0 -0
- /package/dist/{chunk-YGLY6QFV.js.map → chunk-ZRZVLB7O.js.map} +0 -0
- /package/dist/{chunk-4IIFL7GC.js.map → chunk-ZUKIUXHQ.js.map} +0 -0
- /package/dist/{contradiction-scan-HYLIRMJ2.js.map → contradiction-scan-JDTBXRGW.js.map} +0 -0
- /package/dist/{purge-533FZLS4.js.map → purge-GB7PZHT2.js.map} +0 -0
|
@@ -12,10 +12,13 @@ import {
|
|
|
12
12
|
} from "./chunk-CX5SW2EW.js";
|
|
13
13
|
import {
|
|
14
14
|
markProjectedMemoryPathInvalid
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-2LWQSV6A.js";
|
|
16
16
|
import {
|
|
17
17
|
withHeldFileLock
|
|
18
18
|
} from "./chunk-FFAZ2XFU.js";
|
|
19
|
+
import {
|
|
20
|
+
resolveSafeStoragePath
|
|
21
|
+
} from "./chunk-FF4KLI5W.js";
|
|
19
22
|
import {
|
|
20
23
|
readMaybeEncryptedFileFromChunks,
|
|
21
24
|
writeMaybeEncryptedFileFromChunks
|
|
@@ -30,11 +33,427 @@ import {
|
|
|
30
33
|
log
|
|
31
34
|
} from "./chunk-3WCASNQZ.js";
|
|
32
35
|
|
|
36
|
+
// src/storage/deletion-revision-store.ts
|
|
37
|
+
import { createHash, randomUUID } from "crypto";
|
|
38
|
+
import { lstat, mkdir, open, readFile, rename, unlink } from "fs/promises";
|
|
39
|
+
import path from "path";
|
|
40
|
+
var DELETION_REVISION_MAX_MTIME_MS = 864e13;
|
|
41
|
+
var DELETION_REVISION_LOCK_STALE_MS = 6e4;
|
|
42
|
+
var DELETION_REVISION_LOCK_MAX_WAIT_MS = 12e4;
|
|
43
|
+
var INVALIDATION_COMMIT_MAX_TIMESTAMP_MS = 864e13;
|
|
44
|
+
var INVALIDATION_PROOF_QUARANTINE_MAX_IDS = 1024;
|
|
45
|
+
function canonicalizeInvalidationEvidence(value) {
|
|
46
|
+
if (Array.isArray(value)) return value.map((item) => canonicalizeInvalidationEvidence(item));
|
|
47
|
+
if (value && typeof value === "object") {
|
|
48
|
+
const result = {};
|
|
49
|
+
for (const key of Object.keys(value).sort()) {
|
|
50
|
+
result[key] = canonicalizeInvalidationEvidence(value[key]);
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
function invalidationCommitFingerprint(memory) {
|
|
57
|
+
const frontmatter = { ...memory.frontmatter };
|
|
58
|
+
delete frontmatter.accessCount;
|
|
59
|
+
delete frontmatter.lastAccessed;
|
|
60
|
+
return createHash("sha256").update(
|
|
61
|
+
JSON.stringify(
|
|
62
|
+
canonicalizeInvalidationEvidence({
|
|
63
|
+
content: memory.content,
|
|
64
|
+
frontmatter
|
|
65
|
+
})
|
|
66
|
+
)
|
|
67
|
+
).digest("hex");
|
|
68
|
+
}
|
|
69
|
+
function isValidInvalidationCommitTimestamp(value) {
|
|
70
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= INVALIDATION_COMMIT_MAX_TIMESTAMP_MS;
|
|
71
|
+
}
|
|
72
|
+
function isValidInvalidationCommitFingerprint(value) {
|
|
73
|
+
return typeof value === "string" && /^[a-f0-9]{64}$/.test(value);
|
|
74
|
+
}
|
|
75
|
+
function isValidMemoryId(value) {
|
|
76
|
+
return typeof value === "string" && value.length > 0 && !value.includes("\0");
|
|
77
|
+
}
|
|
78
|
+
function isValidDeletionRevisionPath(value) {
|
|
79
|
+
return typeof value === "string" && value.length > 0 && !value.includes("\\") && !value.includes("\0") && !path.posix.isAbsolute(value) && path.posix.normalize(value) === value && value !== "." && value !== ".." && !value.startsWith("../");
|
|
80
|
+
}
|
|
81
|
+
function deletionRevisionPathIdentity(value) {
|
|
82
|
+
return value.normalize("NFC").toUpperCase().toLowerCase();
|
|
83
|
+
}
|
|
84
|
+
var DeletionRevisionStore = class {
|
|
85
|
+
options;
|
|
86
|
+
invalidationProofQuarantine = /* @__PURE__ */ new Set();
|
|
87
|
+
invalidationProofQuarantineFull = false;
|
|
88
|
+
invalidationProofQuarantineFullAt = null;
|
|
89
|
+
constructor(options) {
|
|
90
|
+
this.options = options;
|
|
91
|
+
}
|
|
92
|
+
quarantineInvalidationProof(memoryId) {
|
|
93
|
+
if (this.invalidationProofQuarantineFull) {
|
|
94
|
+
const nextBoundary = Date.now() + 1;
|
|
95
|
+
this.invalidationProofQuarantineFullAt = Math.max(
|
|
96
|
+
this.invalidationProofQuarantineFullAt ?? 0,
|
|
97
|
+
nextBoundary
|
|
98
|
+
);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (this.invalidationProofQuarantine.has(memoryId)) return;
|
|
102
|
+
if (this.invalidationProofQuarantine.size >= INVALIDATION_PROOF_QUARANTINE_MAX_IDS) {
|
|
103
|
+
this.invalidationProofQuarantineFull = true;
|
|
104
|
+
this.invalidationProofQuarantineFullAt = Date.now() + 1;
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
this.invalidationProofQuarantine.add(memoryId);
|
|
108
|
+
}
|
|
109
|
+
async resolveConfiguredStoragePath(targetPath) {
|
|
110
|
+
const baseDir = path.resolve(this.options.baseDir);
|
|
111
|
+
const relativePath = path.relative(baseDir, path.resolve(targetPath));
|
|
112
|
+
return resolveSafeStoragePath(baseDir, relativePath);
|
|
113
|
+
}
|
|
114
|
+
async resolveManagedStoragePath(filePath, method) {
|
|
115
|
+
const assertedPath = this.options.assertManagedStoragePath(filePath, method);
|
|
116
|
+
const target = await this.resolveConfiguredStoragePath(assertedPath);
|
|
117
|
+
const relativePath = path.relative(path.resolve(this.options.baseDir), target).split(path.sep).join("/");
|
|
118
|
+
return { target, relativePath };
|
|
119
|
+
}
|
|
120
|
+
parseDeletionRevisionMetadata(raw) {
|
|
121
|
+
let parsed;
|
|
122
|
+
try {
|
|
123
|
+
parsed = JSON.parse(raw);
|
|
124
|
+
} catch {
|
|
125
|
+
throw new Error("Deletion revision metadata is invalid.");
|
|
126
|
+
}
|
|
127
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
128
|
+
throw new Error("Deletion revision metadata is invalid.");
|
|
129
|
+
}
|
|
130
|
+
const root = parsed;
|
|
131
|
+
if (Object.keys(root).sort().join(",") !== "deletions,version" || root.version !== 1 || !Array.isArray(root.deletions)) {
|
|
132
|
+
throw new Error("Deletion revision metadata is invalid.");
|
|
133
|
+
}
|
|
134
|
+
const revisions = /* @__PURE__ */ new Map();
|
|
135
|
+
const pathByIdentity = /* @__PURE__ */ new Map();
|
|
136
|
+
for (const rawEntry of root.deletions) {
|
|
137
|
+
if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) {
|
|
138
|
+
throw new Error("Deletion revision metadata is invalid.");
|
|
139
|
+
}
|
|
140
|
+
const entry = rawEntry;
|
|
141
|
+
if (Object.keys(entry).sort().join(",") !== "mtimeMs,path" || !isValidDeletionRevisionPath(entry.path) || typeof entry.mtimeMs !== "number" || !Number.isFinite(entry.mtimeMs) || entry.mtimeMs < 0 || entry.mtimeMs > DELETION_REVISION_MAX_MTIME_MS || revisions.has(entry.path)) {
|
|
142
|
+
throw new Error("Deletion revision metadata is invalid.");
|
|
143
|
+
}
|
|
144
|
+
const identity = deletionRevisionPathIdentity(entry.path);
|
|
145
|
+
if (pathByIdentity.has(identity)) {
|
|
146
|
+
throw new Error("Deletion revision metadata is invalid.");
|
|
147
|
+
}
|
|
148
|
+
pathByIdentity.set(identity, entry.path);
|
|
149
|
+
revisions.set(entry.path, entry.mtimeMs);
|
|
150
|
+
}
|
|
151
|
+
return new Map([...revisions.entries()].sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0));
|
|
152
|
+
}
|
|
153
|
+
async readDeletionRevisionMetadata() {
|
|
154
|
+
const metadataPath = await this.resolveConfiguredStoragePath(this.options.deletionRevisionMetadataPath);
|
|
155
|
+
let raw;
|
|
156
|
+
try {
|
|
157
|
+
raw = await readFile(metadataPath, "utf8");
|
|
158
|
+
} catch (error) {
|
|
159
|
+
if (isErrnoCode(error, "ENOENT")) return /* @__PURE__ */ new Map();
|
|
160
|
+
throw new Error("Deletion revision metadata is unavailable.");
|
|
161
|
+
}
|
|
162
|
+
return this.parseDeletionRevisionMetadata(raw);
|
|
163
|
+
}
|
|
164
|
+
async writeDeletionRevisionMetadata(revisions, lock) {
|
|
165
|
+
const metadataPath = await this.resolveConfiguredStoragePath(this.options.deletionRevisionMetadataPath);
|
|
166
|
+
const deletions = [...revisions.entries()].sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([entryPath, mtimeMs]) => ({ path: entryPath, mtimeMs }));
|
|
167
|
+
const metadata = { version: 1, deletions };
|
|
168
|
+
const temporaryPath = await this.resolveConfiguredStoragePath(
|
|
169
|
+
`${metadataPath}.${process.pid}.${randomUUID()}.tmp`
|
|
170
|
+
);
|
|
171
|
+
let handle = null;
|
|
172
|
+
try {
|
|
173
|
+
handle = await open(temporaryPath, "wx", 384);
|
|
174
|
+
await handle.writeFile(`${JSON.stringify(metadata)}
|
|
175
|
+
`, "utf8");
|
|
176
|
+
await handle.sync();
|
|
177
|
+
await handle.close();
|
|
178
|
+
handle = null;
|
|
179
|
+
if (!await lock.refresh()) {
|
|
180
|
+
throw new Error("Deletion revision metadata lock was lost.");
|
|
181
|
+
}
|
|
182
|
+
const renameTarget = await this.resolveConfiguredStoragePath(this.options.deletionRevisionMetadataPath);
|
|
183
|
+
await rename(temporaryPath, renameTarget);
|
|
184
|
+
} finally {
|
|
185
|
+
if (handle !== null) {
|
|
186
|
+
await handle.close().catch((error) => {
|
|
187
|
+
log.warn("failed to close deletion revision metadata temporary file", error);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
const cleanupPath = await this.resolveConfiguredStoragePath(temporaryPath).catch((error) => {
|
|
191
|
+
log.warn("failed to resolve deletion revision metadata temporary file for cleanup", error);
|
|
192
|
+
return null;
|
|
193
|
+
});
|
|
194
|
+
if (cleanupPath !== null) {
|
|
195
|
+
await unlink(cleanupPath).catch((error) => {
|
|
196
|
+
if (!isErrnoCode(error, "ENOENT")) {
|
|
197
|
+
log.warn("failed to clean up deletion revision metadata temporary file", error);
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
async withDeletionRevisionLock(task) {
|
|
204
|
+
const lockPath = await this.resolveConfiguredStoragePath(this.options.deletionRevisionLockPath);
|
|
205
|
+
return withHeldFileLock(
|
|
206
|
+
lockPath,
|
|
207
|
+
{
|
|
208
|
+
staleMs: DELETION_REVISION_LOCK_STALE_MS,
|
|
209
|
+
maxWaitMs: DELETION_REVISION_LOCK_MAX_WAIT_MS
|
|
210
|
+
},
|
|
211
|
+
async (acquired, lock) => {
|
|
212
|
+
if (!acquired) throw new Error("Deletion revision metadata lock is unavailable.");
|
|
213
|
+
return task(lock);
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
async readDeletionRevisions() {
|
|
218
|
+
return this.withDeletionRevisionLock(async () => this.readDeletionRevisionMetadata());
|
|
219
|
+
}
|
|
220
|
+
parseInvalidationCommitMetadata(raw) {
|
|
221
|
+
let parsed;
|
|
222
|
+
try {
|
|
223
|
+
parsed = JSON.parse(raw);
|
|
224
|
+
} catch {
|
|
225
|
+
throw new Error("Invalidation commit metadata is invalid.");
|
|
226
|
+
}
|
|
227
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
228
|
+
throw new Error("Invalidation commit metadata is invalid.");
|
|
229
|
+
}
|
|
230
|
+
const root = parsed;
|
|
231
|
+
if (Object.keys(root).sort().join(",") !== "commits,version" || root.version !== 1 || !Array.isArray(root.commits)) {
|
|
232
|
+
throw new Error("Invalidation commit metadata is invalid.");
|
|
233
|
+
}
|
|
234
|
+
const commits = /* @__PURE__ */ new Map();
|
|
235
|
+
for (const rawEntry of root.commits) {
|
|
236
|
+
if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) {
|
|
237
|
+
throw new Error("Invalidation commit metadata is invalid.");
|
|
238
|
+
}
|
|
239
|
+
const entry = rawEntry;
|
|
240
|
+
if (Object.keys(entry).sort().join(",") !== "committedAt,fingerprint,memoryId" || !isValidMemoryId(entry.memoryId) || !isValidInvalidationCommitFingerprint(entry.fingerprint) || !isValidInvalidationCommitTimestamp(entry.committedAt) || commits.has(entry.memoryId)) {
|
|
241
|
+
throw new Error("Invalidation commit metadata is invalid.");
|
|
242
|
+
}
|
|
243
|
+
commits.set(entry.memoryId, {
|
|
244
|
+
fingerprint: entry.fingerprint,
|
|
245
|
+
committedAt: entry.committedAt
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
return commits;
|
|
249
|
+
}
|
|
250
|
+
async readInvalidationCommitMetadata() {
|
|
251
|
+
const metadataPath = await this.resolveConfiguredStoragePath(this.options.invalidationCommitMetadataPath);
|
|
252
|
+
let raw;
|
|
253
|
+
try {
|
|
254
|
+
raw = await readFile(metadataPath, "utf8");
|
|
255
|
+
} catch (error) {
|
|
256
|
+
if (isErrnoCode(error, "ENOENT")) return /* @__PURE__ */ new Map();
|
|
257
|
+
throw new Error("Invalidation commit metadata is unavailable.");
|
|
258
|
+
}
|
|
259
|
+
return this.parseInvalidationCommitMetadata(raw);
|
|
260
|
+
}
|
|
261
|
+
async writeInvalidationCommitMetadata(commits, lock) {
|
|
262
|
+
const metadataPath = await this.resolveConfiguredStoragePath(this.options.invalidationCommitMetadataPath);
|
|
263
|
+
const entries = [...commits.entries()].sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([memoryId, value]) => ({
|
|
264
|
+
memoryId,
|
|
265
|
+
fingerprint: value.fingerprint,
|
|
266
|
+
committedAt: value.committedAt
|
|
267
|
+
}));
|
|
268
|
+
const metadata = { version: 1, commits: entries };
|
|
269
|
+
const temporaryPath = await this.resolveConfiguredStoragePath(
|
|
270
|
+
`${metadataPath}.${process.pid}.${randomUUID()}.tmp`
|
|
271
|
+
);
|
|
272
|
+
const metadataDir = await this.resolveConfiguredStoragePath(path.dirname(metadataPath));
|
|
273
|
+
let handle = null;
|
|
274
|
+
let renamed = false;
|
|
275
|
+
try {
|
|
276
|
+
await mkdir(metadataDir, { recursive: true });
|
|
277
|
+
handle = await open(temporaryPath, "wx", 384);
|
|
278
|
+
await handle.writeFile(`${JSON.stringify(metadata)}
|
|
279
|
+
`, "utf8");
|
|
280
|
+
await handle.sync();
|
|
281
|
+
await handle.close();
|
|
282
|
+
handle = null;
|
|
283
|
+
if (!await lock.refresh()) {
|
|
284
|
+
throw new Error("Invalidation commit metadata lock was lost.");
|
|
285
|
+
}
|
|
286
|
+
const renameTarget = await this.resolveConfiguredStoragePath(this.options.invalidationCommitMetadataPath);
|
|
287
|
+
await rename(temporaryPath, renameTarget);
|
|
288
|
+
renamed = true;
|
|
289
|
+
} finally {
|
|
290
|
+
if (handle !== null) {
|
|
291
|
+
await handle.close().catch((error) => {
|
|
292
|
+
log.warn("failed to close invalidation commit metadata temporary file", error);
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
const cleanupPath = await this.resolveConfiguredStoragePath(temporaryPath).catch((error) => {
|
|
296
|
+
log.warn("failed to resolve invalidation commit metadata temporary file for cleanup", error);
|
|
297
|
+
return null;
|
|
298
|
+
});
|
|
299
|
+
if (cleanupPath !== null) {
|
|
300
|
+
await unlink(cleanupPath).catch((error) => {
|
|
301
|
+
if (!isErrnoCode(error, "ENOENT")) {
|
|
302
|
+
log.warn(
|
|
303
|
+
`failed to clean up invalidation commit metadata temporary file after ${renamed ? "commit" : "failure"}`,
|
|
304
|
+
error
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
async hasCommittedInvalidation(memory) {
|
|
312
|
+
const memoryId = memory.frontmatter.id;
|
|
313
|
+
const fingerprint = invalidationCommitFingerprint(memory);
|
|
314
|
+
return this.withDeletionRevisionLock(async () => {
|
|
315
|
+
const entry = (await this.readInvalidationCommitMetadata()).get(memoryId);
|
|
316
|
+
if (entry?.fingerprint !== fingerprint) return false;
|
|
317
|
+
if (this.invalidationProofQuarantine.has(memoryId)) return false;
|
|
318
|
+
if (!this.invalidationProofQuarantineFull) return true;
|
|
319
|
+
const fullAt = this.invalidationProofQuarantineFullAt;
|
|
320
|
+
return fullAt !== null && entry.committedAt >= fullAt;
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
async recordCommittedInvalidation(memory) {
|
|
324
|
+
const fingerprint = invalidationCommitFingerprint(memory);
|
|
325
|
+
await this.withDeletionRevisionLock(async (lock) => {
|
|
326
|
+
const fullAt = this.invalidationProofQuarantineFullAt;
|
|
327
|
+
const committedAt = fullAt === null ? Date.now() : Math.max(Date.now(), fullAt + 1);
|
|
328
|
+
const commits = await this.readInvalidationCommitMetadata();
|
|
329
|
+
commits.set(memory.frontmatter.id, {
|
|
330
|
+
fingerprint,
|
|
331
|
+
committedAt
|
|
332
|
+
});
|
|
333
|
+
await this.writeInvalidationCommitMetadata(commits, lock);
|
|
334
|
+
this.invalidationProofQuarantine.delete(memory.frontmatter.id);
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
async clearCommittedInvalidation(memory) {
|
|
338
|
+
const memoryId = memory.frontmatter.id;
|
|
339
|
+
this.quarantineInvalidationProof(memoryId);
|
|
340
|
+
const fingerprint = invalidationCommitFingerprint(memory);
|
|
341
|
+
let cleared = false;
|
|
342
|
+
try {
|
|
343
|
+
await this.withDeletionRevisionLock(async (lock) => {
|
|
344
|
+
const commits = await this.readInvalidationCommitMetadata();
|
|
345
|
+
const current = commits.get(memoryId);
|
|
346
|
+
if (current?.fingerprint !== fingerprint) return;
|
|
347
|
+
commits.delete(memoryId);
|
|
348
|
+
await this.writeInvalidationCommitMetadata(commits, lock);
|
|
349
|
+
});
|
|
350
|
+
cleared = true;
|
|
351
|
+
} finally {
|
|
352
|
+
if (cleared) this.invalidationProofQuarantine.delete(memoryId);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
async recordReplicatedDeletionRevision(filePath, mtimeMs) {
|
|
356
|
+
const { relativePath } = await this.resolveManagedStoragePath(
|
|
357
|
+
filePath,
|
|
358
|
+
"storage.recordReplicatedDeletionRevision"
|
|
359
|
+
);
|
|
360
|
+
if (typeof mtimeMs !== "number" || !Number.isFinite(mtimeMs) || mtimeMs < 0 || mtimeMs > DELETION_REVISION_MAX_MTIME_MS) {
|
|
361
|
+
throw new Error("Deletion revision timestamp is invalid.");
|
|
362
|
+
}
|
|
363
|
+
if (!isValidDeletionRevisionPath(relativePath)) {
|
|
364
|
+
throw new Error("Deletion revision path is invalid.");
|
|
365
|
+
}
|
|
366
|
+
await this.withDeletionRevisionLock(async (lock) => {
|
|
367
|
+
const revisions = await this.readDeletionRevisionMetadata();
|
|
368
|
+
const identity = deletionRevisionPathIdentity(relativePath);
|
|
369
|
+
let existingPath;
|
|
370
|
+
for (const candidatePath of revisions.keys()) {
|
|
371
|
+
if (deletionRevisionPathIdentity(candidatePath) === identity) {
|
|
372
|
+
existingPath = candidatePath;
|
|
373
|
+
break;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
const existingMtimeMs = existingPath === void 0 ? void 0 : revisions.get(existingPath);
|
|
377
|
+
if (existingMtimeMs !== void 0 && existingMtimeMs >= mtimeMs) return;
|
|
378
|
+
const updated = new Map(revisions);
|
|
379
|
+
if (existingPath !== void 0) updated.delete(existingPath);
|
|
380
|
+
updated.set(relativePath, mtimeMs);
|
|
381
|
+
await this.writeDeletionRevisionMetadata(updated, lock);
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
async writeManagedStorageFile(filePath, write) {
|
|
385
|
+
const { relativePath } = await this.resolveManagedStoragePath(filePath, "storage.writeManagedStorageFile");
|
|
386
|
+
if (!isValidDeletionRevisionPath(relativePath)) {
|
|
387
|
+
throw new Error("Deletion revision path is invalid.");
|
|
388
|
+
}
|
|
389
|
+
await this.withDeletionRevisionLock(async (lock) => {
|
|
390
|
+
const before = await this.readDeletionRevisionMetadata();
|
|
391
|
+
const identity = deletionRevisionPathIdentity(relativePath);
|
|
392
|
+
const existingPath = [...before.keys()].find(
|
|
393
|
+
(candidatePath) => deletionRevisionPathIdentity(candidatePath) === identity
|
|
394
|
+
);
|
|
395
|
+
await write();
|
|
396
|
+
if (existingPath === void 0) return;
|
|
397
|
+
const updated = new Map(before);
|
|
398
|
+
updated.delete(existingPath);
|
|
399
|
+
await this.writeDeletionRevisionMetadata(updated, lock);
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
async deleteManagedStorageFile(filePath, deletionMtimeMs) {
|
|
403
|
+
const { target, relativePath } = await this.resolveManagedStoragePath(
|
|
404
|
+
filePath,
|
|
405
|
+
"storage.deleteManagedStorageFile"
|
|
406
|
+
);
|
|
407
|
+
if (deletionMtimeMs !== void 0 && deletionMtimeMs !== null && (typeof deletionMtimeMs !== "number" || !Number.isFinite(deletionMtimeMs) || deletionMtimeMs < 0 || deletionMtimeMs > DELETION_REVISION_MAX_MTIME_MS)) {
|
|
408
|
+
throw new Error("Deletion revision timestamp is invalid.");
|
|
409
|
+
}
|
|
410
|
+
return this.withDeletionRevisionLock(async (lock) => {
|
|
411
|
+
const safeTarget = await this.resolveConfiguredStoragePath(target);
|
|
412
|
+
try {
|
|
413
|
+
await lstat(safeTarget);
|
|
414
|
+
} catch (error) {
|
|
415
|
+
if (isErrnoCode(error, "ENOENT")) return false;
|
|
416
|
+
throw error;
|
|
417
|
+
}
|
|
418
|
+
if (!isValidDeletionRevisionPath(relativePath)) {
|
|
419
|
+
throw new Error("Deletion revision path is invalid.");
|
|
420
|
+
}
|
|
421
|
+
const revision = deletionMtimeMs === null ? void 0 : deletionMtimeMs ?? Date.now();
|
|
422
|
+
const before = await this.readDeletionRevisionMetadata();
|
|
423
|
+
const identity = deletionRevisionPathIdentity(relativePath);
|
|
424
|
+
let existingPath;
|
|
425
|
+
for (const candidatePath of before.keys()) {
|
|
426
|
+
if (deletionRevisionPathIdentity(candidatePath) === identity) {
|
|
427
|
+
existingPath = candidatePath;
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
const existing = existingPath === void 0 ? void 0 : before.get(existingPath);
|
|
432
|
+
const changed = existingPath !== void 0 && existingPath !== relativePath || (revision === void 0 ? existing !== void 0 : existing !== revision);
|
|
433
|
+
if (changed) {
|
|
434
|
+
const updated = new Map(before);
|
|
435
|
+
if (existingPath !== void 0) updated.delete(existingPath);
|
|
436
|
+
if (revision !== void 0) updated.set(relativePath, revision);
|
|
437
|
+
await this.writeDeletionRevisionMetadata(updated, lock);
|
|
438
|
+
}
|
|
439
|
+
try {
|
|
440
|
+
const unlinkTarget = await this.resolveConfiguredStoragePath(target);
|
|
441
|
+
await unlink(unlinkTarget);
|
|
442
|
+
return true;
|
|
443
|
+
} catch (error) {
|
|
444
|
+
if (changed) await this.writeDeletionRevisionMetadata(before, lock);
|
|
445
|
+
if (isErrnoCode(error, "ENOENT")) return false;
|
|
446
|
+
throw error;
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
|
|
33
452
|
// src/storage/tombstone-blocked-capture-mutation.ts
|
|
34
453
|
import { AsyncLocalStorage } from "async_hooks";
|
|
35
|
-
import { createHash } from "crypto";
|
|
36
|
-
import { mkdir } from "fs/promises";
|
|
37
|
-
import
|
|
454
|
+
import { createHash as createHash2 } from "crypto";
|
|
455
|
+
import { mkdir as mkdir2 } from "fs/promises";
|
|
456
|
+
import path2 from "path";
|
|
38
457
|
var TOMBSTONE_CAPTURE_WRITE_LOCK_STALE_MS = 6e4;
|
|
39
458
|
var CAPTURE_WRITE_LOCK_MAX_ATTEMPTS = 3;
|
|
40
459
|
var CAPTURE_WRITE_LOCK_RETRY_BASE_MS = 25;
|
|
@@ -57,7 +476,7 @@ function buildCapturePathLockIdentity(pathname) {
|
|
|
57
476
|
return `path ${pathname.length} ${pathname}`;
|
|
58
477
|
}
|
|
59
478
|
function captureIdentityHash(memory) {
|
|
60
|
-
return
|
|
479
|
+
return createHash2("sha256").update(
|
|
61
480
|
buildExplicitCaptureDedupKey(memory.content, memory.frontmatter.category, memory.frontmatter.sourceConnector)
|
|
62
481
|
).digest("hex");
|
|
63
482
|
}
|
|
@@ -69,10 +488,10 @@ var TombstoneBlockedCaptureWriteLock = class {
|
|
|
69
488
|
context = new AsyncLocalStorage();
|
|
70
489
|
captureWriteLockPathForHash(identityHash) {
|
|
71
490
|
const filename = identityHash.length === 0 ? "explicit-capture-write.lock" : `explicit-capture-write-${identityHash}.lock`;
|
|
72
|
-
return
|
|
491
|
+
return path2.join(this.options.stateDir, "tombstone-blocked-capture", filename);
|
|
73
492
|
}
|
|
74
493
|
async withSingleCaptureWriteLock(lockPath, task) {
|
|
75
|
-
await
|
|
494
|
+
await mkdir2(path2.dirname(lockPath), { recursive: true });
|
|
76
495
|
const retry = /* @__PURE__ */ Symbol("retry");
|
|
77
496
|
const permanentFailure = /* @__PURE__ */ Symbol("permanent-failure");
|
|
78
497
|
const runWithHeldFileLock = this.options.withHeldFileLock ?? withHeldFileLock;
|
|
@@ -121,8 +540,8 @@ var TombstoneBlockedCaptureWriteLock = class {
|
|
|
121
540
|
}
|
|
122
541
|
async withCaptureWriteLocks(task, identities, identityHashes) {
|
|
123
542
|
const current = this.context.getStore();
|
|
124
|
-
const hashToken = (key) => `\0${key.length === 0 ? "" :
|
|
125
|
-
const identityHash = (key) => key.length === 0 ? "" :
|
|
543
|
+
const hashToken = (key) => `\0${key.length === 0 ? "" : createHash2("sha256").update(key).digest("hex")}`;
|
|
544
|
+
const identityHash = (key) => key.length === 0 ? "" : createHash2("sha256").update(key).digest("hex");
|
|
126
545
|
const identityKeys = [...new Set(identities)];
|
|
127
546
|
const hashes = [...new Set(identityHashes)];
|
|
128
547
|
const requested = [
|
|
@@ -217,16 +636,16 @@ function isQueuedReviewMemory(memory) {
|
|
|
217
636
|
}
|
|
218
637
|
|
|
219
638
|
// src/storage/tombstone-blocked-capture-sync.ts
|
|
220
|
-
import { createHash as
|
|
221
|
-
import { unlink as
|
|
222
|
-
import
|
|
639
|
+
import { createHash as createHash3, randomUUID as randomUUID3 } from "crypto";
|
|
640
|
+
import { unlink as unlink3 } from "fs/promises";
|
|
641
|
+
import path4 from "path";
|
|
223
642
|
import { isDeepStrictEqual } from "util";
|
|
224
643
|
|
|
225
644
|
// src/storage/tombstone-blocked-capture-index.ts
|
|
226
645
|
import { execFile } from "child_process";
|
|
227
|
-
import { randomUUID } from "crypto";
|
|
228
|
-
import { mkdir as
|
|
229
|
-
import
|
|
646
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
647
|
+
import { mkdir as mkdir3, readFile as readFile2, readdir, rename as rename2, stat, unlink as unlink2, writeFile } from "fs/promises";
|
|
648
|
+
import path3 from "path";
|
|
230
649
|
import { promisify } from "util";
|
|
231
650
|
var REBUILD_MAX_ATTEMPTS = 3;
|
|
232
651
|
var execFileAsync = promisify(execFile);
|
|
@@ -248,7 +667,7 @@ var TombstoneBlockedCaptureIndex = class {
|
|
|
248
667
|
}
|
|
249
668
|
createIndex() {
|
|
250
669
|
return new ContentHashIndex(
|
|
251
|
-
|
|
670
|
+
path3.join(this.options.stateDir, "tombstone-blocked-capture"),
|
|
252
671
|
this.options.secureStoreKeyProvider,
|
|
253
672
|
this.options.secureStoreWriteKeyProvider,
|
|
254
673
|
this.options.memoryDir,
|
|
@@ -256,19 +675,19 @@ var TombstoneBlockedCaptureIndex = class {
|
|
|
256
675
|
);
|
|
257
676
|
}
|
|
258
677
|
indexPath() {
|
|
259
|
-
return
|
|
678
|
+
return path3.join(this.options.stateDir, "tombstone-blocked-capture", "fact-hashes.txt");
|
|
260
679
|
}
|
|
261
680
|
rebuildMarkerPath() {
|
|
262
|
-
return
|
|
681
|
+
return path3.join(this.options.stateDir, "tombstone-blocked-capture", "rebuild-required");
|
|
263
682
|
}
|
|
264
683
|
async readRebuildMarkers() {
|
|
265
684
|
try {
|
|
266
685
|
const entries = (await readdir(this.rebuildMarkerPath())).filter((entry) => !entry.startsWith("."));
|
|
267
686
|
return (await Promise.all(
|
|
268
687
|
entries.map(async (entry) => {
|
|
269
|
-
const markerPath =
|
|
688
|
+
const markerPath = path3.join(this.rebuildMarkerPath(), entry);
|
|
270
689
|
try {
|
|
271
|
-
const raw = (await
|
|
690
|
+
const raw = (await readFile2(markerPath, "utf8")).trim();
|
|
272
691
|
if (raw === "committed") return { path: markerPath, committed: true };
|
|
273
692
|
let value;
|
|
274
693
|
let malformed = false;
|
|
@@ -289,7 +708,7 @@ var TombstoneBlockedCaptureIndex = class {
|
|
|
289
708
|
const markerStat = await stat(markerPath).catch(() => null);
|
|
290
709
|
const createdAt = typeof value.createdAt === "number" && Number.isFinite(value.createdAt) ? value.createdAt : markerStat?.mtimeMs;
|
|
291
710
|
if (typeof value.pid !== "number" || !Number.isInteger(value.pid)) malformed = true;
|
|
292
|
-
const ownerId = typeof value.ownerId === "string" && value.ownerId.length > 0 ? value.ownerId :
|
|
711
|
+
const ownerId = typeof value.ownerId === "string" && value.ownerId.length > 0 ? value.ownerId : path3.basename(markerPath);
|
|
293
712
|
if (typeof value.ownerId !== "string" || value.ownerId.length === 0) malformed = true;
|
|
294
713
|
const processStartedAtMs = typeof value.processStartedAtMs === "number" && Number.isFinite(value.processStartedAtMs) && value.processStartedAtMs > 0 ? value.processStartedAtMs : void 0;
|
|
295
714
|
return {
|
|
@@ -369,21 +788,21 @@ var TombstoneBlockedCaptureIndex = class {
|
|
|
369
788
|
}
|
|
370
789
|
// A pending marker protects the pre-commit gap; only committed markers are safe for another writer to clear.
|
|
371
790
|
async writeMarkerAtomically(markerPath, payload) {
|
|
372
|
-
const temporaryPath = `${markerPath}.tmp-${process.pid}-${
|
|
791
|
+
const temporaryPath = `${markerPath}.tmp-${process.pid}-${randomUUID2()}`;
|
|
373
792
|
try {
|
|
374
793
|
await writeFile(temporaryPath, payload, "utf8");
|
|
375
|
-
await
|
|
794
|
+
await rename2(temporaryPath, markerPath);
|
|
376
795
|
} finally {
|
|
377
|
-
await
|
|
796
|
+
await unlink2(temporaryPath).catch((err) => {
|
|
378
797
|
if (!isErrnoCode(err, "ENOENT")) throw err;
|
|
379
798
|
});
|
|
380
799
|
}
|
|
381
800
|
}
|
|
382
801
|
async markRebuildRequired(committed = false) {
|
|
383
802
|
const markerDir = this.rebuildMarkerPath();
|
|
384
|
-
await
|
|
385
|
-
const ownerId =
|
|
386
|
-
const markerPath =
|
|
803
|
+
await mkdir3(markerDir, { recursive: true });
|
|
804
|
+
const ownerId = randomUUID2();
|
|
805
|
+
const markerPath = path3.join(markerDir, ownerId);
|
|
387
806
|
await this.writeMarkerAtomically(
|
|
388
807
|
markerPath,
|
|
389
808
|
`${JSON.stringify({
|
|
@@ -403,7 +822,7 @@ var TombstoneBlockedCaptureIndex = class {
|
|
|
403
822
|
`${JSON.stringify({
|
|
404
823
|
state: "committed",
|
|
405
824
|
pid: process.pid,
|
|
406
|
-
ownerId:
|
|
825
|
+
ownerId: path3.basename(markerPath),
|
|
407
826
|
createdAt: Date.now(),
|
|
408
827
|
processStartedAtMs: MARKER_PROCESS_STARTED_AT_MS
|
|
409
828
|
})}
|
|
@@ -414,7 +833,7 @@ var TombstoneBlockedCaptureIndex = class {
|
|
|
414
833
|
await Promise.all(
|
|
415
834
|
markerPaths.map(async (markerPath) => {
|
|
416
835
|
try {
|
|
417
|
-
await
|
|
836
|
+
await unlink2(markerPath);
|
|
418
837
|
} catch (err) {
|
|
419
838
|
if (!isErrnoCode(err, "ENOENT")) throw err;
|
|
420
839
|
}
|
|
@@ -644,8 +1063,8 @@ var TombstoneBlockedCaptureIndex = class {
|
|
|
644
1063
|
await this.failOpen("writeMemoryFrontmatter", () => this.sync(before, { ...before, frontmatter }, rebuildMarker));
|
|
645
1064
|
}
|
|
646
1065
|
shouldRebuildAfterInvalidationForPath(filePath) {
|
|
647
|
-
const relative =
|
|
648
|
-
const category = relative.split(
|
|
1066
|
+
const relative = path3.relative(path3.resolve(this.options.memoryDir), path3.resolve(filePath));
|
|
1067
|
+
const category = relative.split(path3.sep)[0];
|
|
649
1068
|
return category === "cold" || RECALL_FALLBACK_DIRS.includes(category);
|
|
650
1069
|
}
|
|
651
1070
|
};
|
|
@@ -793,6 +1212,26 @@ var TombstoneBlockedCaptureIndexHost = class {
|
|
|
793
1212
|
async withTombstoneBlockedCaptureWriteLock(task, identity) {
|
|
794
1213
|
return await this.getTombstoneBlockedCaptureIndex().withCaptureWriteLock(task, identity);
|
|
795
1214
|
}
|
|
1215
|
+
/** Read selected memories while their mutation locks remain held. */
|
|
1216
|
+
async readMemorySnapshotsIfUnchanged(expected) {
|
|
1217
|
+
return await this.withMemorySnapshotsIfUnchanged(expected, async (memories) => memories);
|
|
1218
|
+
}
|
|
1219
|
+
async withMemorySnapshotsIfUnchanged(expected, task) {
|
|
1220
|
+
if (expected.length === 0) return await task([]);
|
|
1221
|
+
const pathnames = [...new Set(expected.map((memory) => memory.path))];
|
|
1222
|
+
if (pathnames.length !== expected.length) return null;
|
|
1223
|
+
return await this.withTombstoneBlockedCaptureWriteLock(async () => {
|
|
1224
|
+
const current = await Promise.all(pathnames.map((pathname) => this.readMemoryByPath(pathname)));
|
|
1225
|
+
for (let index = 0; index < expected.length; index += 1) {
|
|
1226
|
+
const actual = current[index];
|
|
1227
|
+
const snapshot = expected[index];
|
|
1228
|
+
if (!actual || !snapshot || actual.frontmatter.id !== snapshot.frontmatter.id || invalidationCommitFingerprint(actual) !== invalidationCommitFingerprint(snapshot)) {
|
|
1229
|
+
return null;
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
return await task(current);
|
|
1233
|
+
}, pathnames.map(buildCapturePathLockIdentity));
|
|
1234
|
+
}
|
|
796
1235
|
async withTombstoneBlockedCaptureWriteLockAndHashes(task, identity, identityHashes) {
|
|
797
1236
|
return await this.getTombstoneBlockedCaptureIndex().withCaptureWriteLockAndHashes(task, identity, identityHashes);
|
|
798
1237
|
}
|
|
@@ -955,11 +1394,11 @@ var TombstoneBlockedCaptureIndexHost = class {
|
|
|
955
1394
|
this.invalidateAllMemoriesCache();
|
|
956
1395
|
this.invalidateKnowledgeIndexCache();
|
|
957
1396
|
this.markFactHashIndexNotAuthoritative();
|
|
958
|
-
if (filePath.includes(`${
|
|
1397
|
+
if (filePath.includes(`${path4.sep}cold${path4.sep}`)) {
|
|
959
1398
|
this.invalidateColdMemoriesCache();
|
|
960
1399
|
}
|
|
961
1400
|
await this.rebuildTombstoneBlockedCaptureAfterInvalidationForPath(filePath, ownedMarker);
|
|
962
|
-
if (filePath.includes(`${
|
|
1401
|
+
if (filePath.includes(`${path4.sep}artifacts${path4.sep}`)) {
|
|
963
1402
|
this.bumpArtifactWriteVersion();
|
|
964
1403
|
}
|
|
965
1404
|
const memoryDir = this.tombstoneBlockedCaptureIndexOptions().memoryDir;
|
|
@@ -1054,7 +1493,7 @@ var TombstoneBlockedCaptureIndexHost = class {
|
|
|
1054
1493
|
bumpArchiveMutationForPath(memoryDir, true, current.path);
|
|
1055
1494
|
markProjectedMemoryPathInvalid(memoryDir, current.frontmatter.id);
|
|
1056
1495
|
this.invalidateAllMemoriesCache();
|
|
1057
|
-
if (current.path.includes(`${
|
|
1496
|
+
if (current.path.includes(`${path4.sep}cold${path4.sep}`)) {
|
|
1058
1497
|
this.invalidateColdMemoriesCache();
|
|
1059
1498
|
}
|
|
1060
1499
|
await this.rebuildTombstoneBlockedCaptureAfterInvalidation(rebuildMarker);
|
|
@@ -1132,7 +1571,7 @@ var TombstoneBlockedCaptureIndexHost = class {
|
|
|
1132
1571
|
async writeTombstoneBlockedOfflineSyncFile(target, content) {
|
|
1133
1572
|
const options = this.tombstoneBlockedCaptureIndexOptions();
|
|
1134
1573
|
const after = options.parseMemory?.(target, content) ?? null;
|
|
1135
|
-
await withRawEntityPageMutation(
|
|
1574
|
+
await withRawEntityPageMutation(path4.dirname(options.stateDir), target, async () => {
|
|
1136
1575
|
await this.runTombstoneBlockedOfflineSyncMutation(
|
|
1137
1576
|
target,
|
|
1138
1577
|
after,
|
|
@@ -1171,11 +1610,11 @@ var TombstoneBlockedCaptureIndexHost = class {
|
|
|
1171
1610
|
return { after, chunks: replay };
|
|
1172
1611
|
}
|
|
1173
1612
|
const options = this.tombstoneBlockedCaptureIndexOptions();
|
|
1174
|
-
const stagePath =
|
|
1613
|
+
const stagePath = path4.join(
|
|
1175
1614
|
options.stateDir,
|
|
1176
1615
|
"tombstone-blocked-capture",
|
|
1177
1616
|
"offline-sync-staging",
|
|
1178
|
-
`${
|
|
1617
|
+
`${randomUUID3()}.stage`
|
|
1179
1618
|
);
|
|
1180
1619
|
const stagedChunks = (async function* () {
|
|
1181
1620
|
for (const chunk of buffered) yield chunk;
|
|
@@ -1196,7 +1635,7 @@ var TombstoneBlockedCaptureIndexHost = class {
|
|
|
1196
1635
|
);
|
|
1197
1636
|
return await this.describeStagedOfflineSyncChunks(target, stagePath, parseMemory);
|
|
1198
1637
|
} catch (err) {
|
|
1199
|
-
await
|
|
1638
|
+
await unlink3(stagePath).catch(() => {
|
|
1200
1639
|
});
|
|
1201
1640
|
throw err;
|
|
1202
1641
|
}
|
|
@@ -1250,7 +1689,7 @@ var TombstoneBlockedCaptureIndexHost = class {
|
|
|
1250
1689
|
encode("connector", connector),
|
|
1251
1690
|
`content ${normalizedLength} `
|
|
1252
1691
|
].join(" ");
|
|
1253
|
-
let identityHash =
|
|
1692
|
+
let identityHash = createHash3("sha256");
|
|
1254
1693
|
let normalSigmaIdentityHash;
|
|
1255
1694
|
identityHash.update(identityPrefix);
|
|
1256
1695
|
const identityNormalizer = createExplicitContentNormalizer({
|
|
@@ -1296,7 +1735,7 @@ var TombstoneBlockedCaptureIndexHost = class {
|
|
|
1296
1735
|
const coordinate = this.getTombstoneBlockedCaptureIndex().shouldRebuildAfterInvalidationForPath(target);
|
|
1297
1736
|
const prepared = coordinate ? await this.prepareTombstoneBlockedOfflineSyncChunks(target, chunks) : { after: null, chunks };
|
|
1298
1737
|
const streamedIdentity = prepared.streamedIdentity;
|
|
1299
|
-
const baseDir =
|
|
1738
|
+
const baseDir = path4.dirname(this.tombstoneBlockedCaptureIndexOptions().stateDir);
|
|
1300
1739
|
try {
|
|
1301
1740
|
await withRawEntityPageMutation(baseDir, target, async () => {
|
|
1302
1741
|
await this.runTombstoneBlockedOfflineSyncMutation(
|
|
@@ -1308,7 +1747,7 @@ var TombstoneBlockedCaptureIndexHost = class {
|
|
|
1308
1747
|
);
|
|
1309
1748
|
});
|
|
1310
1749
|
} finally {
|
|
1311
|
-
if (prepared.stagePath !== void 0) await
|
|
1750
|
+
if (prepared.stagePath !== void 0) await unlink3(prepared.stagePath).catch(() => {
|
|
1312
1751
|
});
|
|
1313
1752
|
}
|
|
1314
1753
|
}
|
|
@@ -1328,7 +1767,7 @@ var TombstoneBlockedCaptureIndexHost = class {
|
|
|
1328
1767
|
*/
|
|
1329
1768
|
async requestSyncReconcileIfMigrationPath(target) {
|
|
1330
1769
|
const stateDir = this.tombstoneBlockedCaptureIndexOptions().stateDir;
|
|
1331
|
-
if (!pathMayCarryEntityRefs(
|
|
1770
|
+
if (!pathMayCarryEntityRefs(path4.dirname(stateDir), target)) return;
|
|
1332
1771
|
await requestEntityCanonicalIdReconcile(stateDir);
|
|
1333
1772
|
}
|
|
1334
1773
|
async deleteOfflineSyncFile(filePath, deletionMtimeMs) {
|
|
@@ -1338,7 +1777,7 @@ var TombstoneBlockedCaptureIndexHost = class {
|
|
|
1338
1777
|
}
|
|
1339
1778
|
async deleteTombstoneBlockedOfflineSyncFile(target, deletionMtimeMs) {
|
|
1340
1779
|
const stateDir = this.tombstoneBlockedCaptureIndexOptions().stateDir;
|
|
1341
|
-
await withRawEntityPageMutation(
|
|
1780
|
+
await withRawEntityPageMutation(path4.dirname(stateDir), target, async () => {
|
|
1342
1781
|
await this.runTombstoneBlockedOfflineSyncMutation(target, null, async () => {
|
|
1343
1782
|
return await this.deleteManagedStorageFile(target, deletionMtimeMs);
|
|
1344
1783
|
});
|
|
@@ -1365,6 +1804,8 @@ var TombstoneBlockedCaptureIndexHost = class {
|
|
|
1365
1804
|
};
|
|
1366
1805
|
|
|
1367
1806
|
export {
|
|
1807
|
+
invalidationCommitFingerprint,
|
|
1808
|
+
DeletionRevisionStore,
|
|
1368
1809
|
isTombstoneBlockedCaptureWriteLockBusy,
|
|
1369
1810
|
normalizeExplicitCaptureContent,
|
|
1370
1811
|
buildExplicitCaptureDedupKey,
|
|
@@ -1374,4 +1815,4 @@ export {
|
|
|
1374
1815
|
parseTombstoneBlockedOfflineSyncMemory,
|
|
1375
1816
|
TombstoneBlockedCaptureIndexHost
|
|
1376
1817
|
};
|
|
1377
|
-
//# sourceMappingURL=chunk-
|
|
1818
|
+
//# sourceMappingURL=chunk-K2UGPTYY.js.map
|