@remnic/core 9.54.7 → 9.55.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 +64 -62
- package/dist/access-authorization-probe.d.ts +11 -11
- package/dist/access-authorization-probe.js +65 -63
- package/dist/access-boundary.d.ts +11 -11
- package/dist/access-boundary.js +64 -62
- package/dist/access-cli.js +141 -138
- 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 +11 -11
- package/dist/access-extraction-force-flush.js +64 -62
- package/dist/access-health-types.d.ts +1 -1
- package/dist/access-http-lcm-compaction.d.ts +11 -11
- package/dist/access-http-lifecycle-flush.d.ts +11 -11
- package/dist/access-http-offline-stream.d.ts +11 -11
- package/dist/access-http-query.js +64 -62
- package/dist/access-http.d.ts +12 -12
- package/dist/access-http.js +80 -78
- package/dist/access-identity-continuity-surface.d.ts +9 -9
- package/dist/access-identity-continuity-surface.js +64 -62
- package/dist/access-lcm-surface.d.ts +11 -11
- package/dist/access-lcm-surface.js +64 -62
- package/dist/access-mcp.d.ts +11 -11
- package/dist/access-mcp.js +73 -71
- package/dist/access-memory-search-fanout.d.ts +2 -2
- package/dist/access-memory-search-fanout.js +3 -3
- package/dist/{access-namespace-preflight-CCNn_6NE.d.ts → access-namespace-preflight-Bpt-SYP0.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +3 -3
- package/dist/access-namespace-preflight.js +64 -62
- package/dist/access-observe-write-surface.d.ts +11 -11
- package/dist/access-observe-write-surface.js +64 -62
- package/dist/access-offline-manifest.d.ts +9 -9
- package/dist/access-offline-manifest.js +9 -9
- package/dist/access-operations-batch.js +68 -66
- package/dist/access-operations.d.ts +14 -14
- package/dist/access-operations.js +72 -70
- package/dist/access-recall-concurrency.d.ts +11 -11
- package/dist/access-recall-concurrency.js +64 -62
- package/dist/access-recall-response.d.ts +11 -11
- package/dist/access-recall-response.js +64 -62
- package/dist/access-recall-surface.d.ts +11 -11
- package/dist/access-recall-surface.js +64 -62
- package/dist/access-schema.d.ts +88 -88
- package/dist/access-schema.js +4 -4
- package/dist/{access-service-DK82xdNi.d.ts → access-service-4DO8XMq6.d.ts} +71 -71
- package/dist/access-service-helpers.d.ts +11 -11
- package/dist/access-service.d.ts +11 -11
- package/dist/access-service.js +64 -62
- package/dist/access-surface-catalog.d.ts +11 -11
- package/dist/access-surface-catalog.js +66 -64
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/access-wearables-meetings-surface.d.ts +3 -3
- package/dist/action-confidence.d.ts +1 -1
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-memory-bridge.js +3 -3
- 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 +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/ambient-provenance.d.ts +1 -1
- package/dist/artifact-search.d.ts +1 -1
- package/dist/{auto-sync-NR3GPCOA.js → auto-sync-5HVRCMGZ.js} +3 -3
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-learner.js +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +9 -9
- package/dist/briefing-window.d.ts +36 -0
- package/dist/briefing-window.js +9 -0
- package/dist/briefing.d.ts +2 -2
- package/dist/briefing.js +24 -22
- 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 +8 -7
- package/dist/bulk-import/index.d.ts +3 -3
- package/dist/calibration.d.ts +1 -1
- package/dist/capabilities.d.ts +8 -8
- package/dist/capabilities.js +1 -1
- package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
- package/dist/{catalog-DGFf8mD9.d.ts → catalog-BasnO3Bw.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +26 -25
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/causal-trajectory-graph.js +2 -2
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-LEPOP46W.js → chunk-227UFSEQ.js} +4 -4
- package/dist/{chunk-I6WYQSX4.js → chunk-2NKY7OC6.js} +14 -2
- package/dist/chunk-2NKY7OC6.js.map +1 -0
- package/dist/{chunk-FTPONF6B.js → chunk-2YREVL4T.js} +2 -2
- package/dist/{chunk-PG4QBPVG.js → chunk-3VFVQDZO.js} +8 -4
- package/dist/chunk-3VFVQDZO.js.map +1 -0
- package/dist/{chunk-KM55SMLG.js → chunk-4KM3V6VS.js} +2 -2
- package/dist/{chunk-HAEU3ZW7.js → chunk-4OW2T32G.js} +2 -2
- package/dist/{chunk-43SEBY2M.js → chunk-4QFCAKNM.js} +1 -1
- package/dist/{chunk-RZQ6W2W4.js → chunk-4THNU7OF.js} +427 -52
- package/dist/chunk-4THNU7OF.js.map +1 -0
- package/dist/{chunk-76JJSXK7.js → chunk-5QHDXMXP.js} +1 -1
- package/dist/chunk-5QHDXMXP.js.map +1 -0
- package/dist/{chunk-KFBOPMF6.js → chunk-5ZIWRMZM.js} +5 -5
- package/dist/{chunk-GWFSVJ4P.js → chunk-6KTXE6A3.js} +2 -2
- package/dist/{chunk-FPLM2TKD.js → chunk-6P2NUVM5.js} +26 -24
- package/dist/chunk-6P2NUVM5.js.map +1 -0
- package/dist/chunk-6Q3ZTEF6.js +54 -0
- package/dist/chunk-6Q3ZTEF6.js.map +1 -0
- package/dist/{chunk-GJ776BC2.js → chunk-7NSC4IVA.js} +4 -3
- package/dist/{chunk-GJ776BC2.js.map → chunk-7NSC4IVA.js.map} +1 -1
- package/dist/{chunk-GN3WRFJY.js → chunk-7PKNOXYB.js} +14 -14
- package/dist/{chunk-AHVEHR6K.js → chunk-7ZNJN5WZ.js} +13 -1
- package/dist/chunk-7ZNJN5WZ.js.map +1 -0
- package/dist/{chunk-RZRUV6N2.js → chunk-ANMIOQPU.js} +2 -2
- package/dist/{chunk-RPSYDM6C.js → chunk-BPWZDHFM.js} +2 -2
- package/dist/{chunk-CIAI24TQ.js → chunk-BVRREV3N.js} +2 -2
- package/dist/{chunk-M4YHAODQ.js → chunk-BWJMBJCY.js} +306 -244
- package/dist/chunk-BWJMBJCY.js.map +1 -0
- package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
- package/dist/{chunk-I3MSGFGD.js → chunk-CKSEJD7K.js} +2 -2
- package/dist/{chunk-46SZBVDS.js → chunk-CME347TM.js} +2 -2
- package/dist/{chunk-BGLY7EEM.js → chunk-CMRUIKVA.js} +3 -3
- package/dist/{chunk-HGJ6NJ4E.js → chunk-D4LVHPOA.js} +2 -2
- package/dist/{chunk-YK6BDDHP.js → chunk-DFEODULB.js} +2 -2
- package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
- package/dist/{chunk-W6FNX2LP.js → chunk-E57E5SCS.js} +2 -2
- package/dist/{chunk-M23RF3LJ.js → chunk-ER4BLWI6.js} +2 -2
- package/dist/{chunk-QZLDRQ4I.js → chunk-F7M36OG2.js} +5 -5
- package/dist/{chunk-D3LBIUWV.js → chunk-FK7T55BA.js} +80 -61
- package/dist/{chunk-D3LBIUWV.js.map → chunk-FK7T55BA.js.map} +1 -1
- package/dist/{chunk-5FD7JMTX.js → chunk-FONW766A.js} +2 -2
- package/dist/{chunk-3TIZPSJC.js → chunk-FR3FNPCJ.js} +3 -3
- package/dist/{chunk-G6DFSS6A.js → chunk-GUNIXT36.js} +2 -2
- package/dist/{chunk-K2UGPTYY.js → chunk-H6ZXNH5I.js} +2 -2
- package/dist/{chunk-BRR5EUTF.js → chunk-HC55YCNK.js} +2 -2
- package/dist/{chunk-PT54WISF.js → chunk-HQ2VGCGP.js} +14 -14
- package/dist/{chunk-AHZOMHWN.js → chunk-HXXGZ4KV.js} +1 -1
- package/dist/{chunk-ZRZVLB7O.js → chunk-HYVBJLEK.js} +5 -5
- package/dist/{chunk-W5ZKPI34.js → chunk-IFFW25NG.js} +330 -202
- package/dist/chunk-IFFW25NG.js.map +1 -0
- package/dist/{chunk-3GD2HFR6.js → chunk-IGWVMA4Y.js} +2 -2
- package/dist/{chunk-FONWBCVY.js → chunk-IKT6ZVO7.js} +3 -3
- package/dist/{chunk-TO7ZTWJW.js → chunk-ION47U3Z.js} +3 -3
- package/dist/{chunk-OCIP6YMD.js → chunk-IXGQP4RZ.js} +3 -3
- package/dist/{chunk-UPLZNJKN.js → chunk-JFPZEWY3.js} +3 -3
- package/dist/{chunk-SMNYAMJD.js → chunk-JKL53MOY.js} +4 -4
- package/dist/{chunk-2FKEIPIT.js → chunk-JOA4Q765.js} +3 -3
- package/dist/{chunk-2XRE6FLM.js → chunk-JUOZ62Y7.js} +3 -1
- package/dist/chunk-JUOZ62Y7.js.map +1 -0
- package/dist/{chunk-MLPTFODV.js → chunk-KHQ57QLJ.js} +4 -4
- package/dist/{chunk-NSVDUN76.js → chunk-LCU5R6TQ.js} +8 -3
- package/dist/chunk-LCU5R6TQ.js.map +1 -0
- package/dist/{chunk-IQ4NVWEF.js → chunk-LYPG7GOO.js} +4 -4
- package/dist/{chunk-IQ4NVWEF.js.map → chunk-LYPG7GOO.js.map} +1 -1
- package/dist/{chunk-KRTY3ENI.js → chunk-MDVBCPOS.js} +2 -2
- package/dist/{chunk-UCTS3DDH.js → chunk-N655QIA2.js} +4 -4
- package/dist/{chunk-5NB726GV.js → chunk-NFQB6RJT.js} +3 -3
- package/dist/{chunk-UYYW2KPU.js → chunk-NP7FLVZW.js} +2 -2
- package/dist/{chunk-CX5SW2EW.js → chunk-NRFU5MVH.js} +4 -4
- package/dist/{chunk-NISZQW72.js → chunk-O4TTIMOP.js} +2 -2
- package/dist/{chunk-7BD6O7ZV.js → chunk-O54B5YNM.js} +3 -3
- package/dist/{chunk-UKYS3NU5.js → chunk-ONCWJBWV.js} +3 -3
- package/dist/{chunk-OUKBMQ2O.js → chunk-PD66CVSD.js} +2 -2
- package/dist/{chunk-QYN5PXDZ.js → chunk-PPUTUOC3.js} +2 -2
- package/dist/{chunk-MIH3CJPN.js → chunk-PSH3VFZ7.js} +4 -4
- package/dist/{chunk-MK5VEWCR.js → chunk-QKPDN325.js} +2 -2
- package/dist/{chunk-EVWWT3KE.js → chunk-QP2IZTUR.js} +2 -2
- package/dist/{chunk-K26NWEOC.js → chunk-QSDPVZPD.js} +5 -5
- package/dist/{chunk-S354QO4R.js → chunk-QV7OEHFN.js} +2 -2
- package/dist/{chunk-HBUFQRIM.js → chunk-QZR3WT3L.js} +2 -2
- package/dist/{chunk-EEAMSNSG.js → chunk-R7TZ2HCS.js} +2 -2
- package/dist/{chunk-YXQEKCZM.js → chunk-R7UHWPYI.js} +2 -2
- package/dist/{chunk-2QSZNTDO.js → chunk-RKNJBZ55.js} +4 -4
- package/dist/{chunk-L6Z5OAS4.js → chunk-RL3EGL7A.js} +2 -2
- package/dist/{chunk-QCECHYZL.js → chunk-RVO6TCTU.js} +6 -6
- package/dist/{chunk-JYG4OLWH.js → chunk-S6AH7WSF.js} +3 -3
- package/dist/{chunk-6CYHUWCO.js → chunk-SFCJCMZQ.js} +5 -5
- package/dist/{chunk-V6ERBR7U.js → chunk-T3HC7RJ7.js} +2 -2
- package/dist/chunk-T3JQTCCO.js +94 -0
- package/dist/chunk-T3JQTCCO.js.map +1 -0
- package/dist/{chunk-FFRTNF3L.js → chunk-T6EQPZ6E.js} +4 -4
- package/dist/{chunk-FWX7W5PM.js → chunk-TAMY4NKO.js} +2 -2
- package/dist/{chunk-7TBXNYLO.js → chunk-TAPFJ3ET.js} +2 -2
- package/dist/{chunk-RUNORG2P.js → chunk-TF3LMM5E.js} +6 -11
- package/dist/chunk-TF3LMM5E.js.map +1 -0
- package/dist/{chunk-ZUKIUXHQ.js → chunk-TFXYQNBH.js} +12 -12
- package/dist/{chunk-26ZXBTYN.js → chunk-THACANBI.js} +4 -4
- package/dist/{chunk-37DZZFFM.js → chunk-TLVLJSWS.js} +2 -2
- package/dist/{chunk-6QPI2ITJ.js → chunk-TVKWT2CY.js} +4 -4
- package/dist/{chunk-H7NAZ3UB.js → chunk-U7BMN33M.js} +2 -2
- package/dist/chunk-UBCBDJOB.js +22 -0
- package/dist/chunk-UBCBDJOB.js.map +1 -0
- package/dist/{chunk-XZHE2DEN.js → chunk-UTDMY476.js} +50 -6
- package/dist/chunk-UTDMY476.js.map +1 -0
- package/dist/{chunk-6LKEUCEM.js → chunk-UXREWVW4.js} +2 -2
- package/dist/{chunk-SUPEYLH2.js → chunk-UYCIS6V5.js} +2 -2
- package/dist/{chunk-EKTP7MNS.js → chunk-V3IT3XNG.js} +7 -7
- package/dist/{chunk-IPLYGWQF.js → chunk-VDX2J7OX.js} +6 -6
- package/dist/{chunk-IKP5OYQQ.js → chunk-VWP5DEHU.js} +2 -2
- package/dist/{chunk-NQMSEB5D.js → chunk-X5OIPQME.js} +2 -2
- package/dist/{chunk-RBII7637.js → chunk-XRPPHIRI.js} +2 -2
- package/dist/{chunk-BIJAWZYW.js → chunk-YMOPYG3K.js} +6 -6
- package/dist/{cli-BPDUXnAl.d.ts → cli-CQdYilcx.d.ts} +61 -11
- package/dist/cli.d.ts +18 -18
- package/dist/cli.js +107 -102
- package/dist/coding/pre-action-gate.d.ts +1 -1
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compounding/engine.d.ts +2 -2
- package/dist/compounding/engine.js +25 -24
- package/dist/compounding/preference-consolidator.d.ts +1 -1
- package/dist/compression-optimizer.d.ts +1 -1
- package/dist/config-security.d.ts +7 -0
- package/dist/config-security.js +12 -0
- 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 +23 -22
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +24 -23
- 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 +4 -4
- package/dist/{contradiction-scan-JDTBXRGW.js → contradiction-scan-522AYLQC.js} +3 -3
- package/dist/converge-config.d.ts +1 -1
- package/dist/convergence-refresh.d.ts +2 -2
- package/dist/convergence-refresh.js +25 -24
- 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/day-summary.js +2 -2
- package/dist/delinearize.d.ts +1 -1
- package/dist/dependency-propagation-config.d.ts +1 -1
- package/dist/{dependency-propagation-delivery-CzEfB31P.d.ts → dependency-propagation-delivery-C_K_AHcv.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/embedding-fallback.js +2 -2
- package/dist/enrichment/index.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +4 -2
- package/dist/entity-retrieval.js +24 -22
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +9 -9
- package/dist/explicit-capture.js +6 -6
- package/dist/external-wiki-access.d.ts +11 -11
- package/dist/external-wiki-access.js +65 -63
- 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 +11 -11
- 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-normalization.d.ts +1 -1
- package/dist/extraction-normalization.js +3 -3
- package/dist/extraction-prompt.d.ts +1 -1
- package/dist/extraction-prompt.js +2 -2
- 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 +38 -37
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/{first-start-migration-CRZCZAJN.js → first-start-migration-HZ4VPRFQ.js} +2 -2
- package/dist/{forget-EHGGJZLX.js → forget-5TWK7CZT.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-decay-65KMOJWY.js → graph-edge-decay-ZXGBXNPW.js} +4 -4
- package/dist/graph-edge-decay-ZXGBXNPW.js.map +1 -0
- 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-snapshot.js +3 -3
- package/dist/graph.d.ts +1 -1
- package/dist/graph.js +3 -3
- 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 +755 -706
- package/dist/index.js +214 -188
- 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/index.js +3 -3
- 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-llm.js +3 -3
- package/dist/local-model-endpoint.d.ts +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +23 -22
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +23 -22
- package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-projection.js +24 -23
- package/dist/{maintenance-C8aRWfhq.d.ts → maintenance-DdP931i9.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-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/principal.js +2 -2
- 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 +23 -22
- 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/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 +38 -36
- package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
- package/dist/orchestration/compression-guideline-coordinator.js +2 -2
- package/dist/orchestration/maintenance.d.ts +4 -4
- package/dist/orchestration/maintenance.js +31 -30
- package/dist/{orchestrator-D85CzDDY.d.ts → orchestrator-DxUWX7gs.d.ts} +26 -20
- package/dist/orchestrator.d.ts +9 -9
- package/dist/orchestrator.js +171 -168
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/{pipeline-DPcUifCO.d.ts → pipeline-BKUMU1vU.d.ts} +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/policy-runtime.js +1 -1
- package/dist/proactive-contention.d.ts +1 -1
- package/dist/provenance.d.ts +1 -1
- package/dist/{public-http-D3GBeII4.d.ts → public-http-Dw0bJhcC.d.ts} +1 -1
- package/dist/{qmd-dFCHp1r0.d.ts → qmd-DJP-GLFe.d.ts} +1 -1
- package/dist/qmd-preflight.d.ts +2 -2
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +2 -2
- package/dist/qmd.js +4 -4
- package/dist/recall-concurrency-config.d.ts +1 -1
- package/dist/recall-context-composition.d.ts +11 -1
- package/dist/recall-context-composition.js +4 -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 +3 -3
- package/dist/recall-state.d.ts +1 -1
- package/dist/recall-tag-filter.d.ts +1 -1
- package/dist/recall-timings.d.ts +1 -1
- package/dist/recall-xray-cli.d.ts +1 -1
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +1 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +1 -1
- package/dist/recall-xray.js +2 -2
- package/dist/reconcile/cursor.d.ts +1 -1
- package/dist/reconcile/manifest.d.ts +1 -1
- package/dist/reconcile/manifest.js +3 -3
- package/dist/reconcile/plan.d.ts +1 -1
- package/dist/replay/normalizers/chatgpt.d.ts +1 -1
- package/dist/replay/normalizers/claude.d.ts +1 -1
- package/dist/replay/normalizers/openclaw.d.ts +1 -1
- package/dist/replay/normalizers/shared.d.ts +1 -1
- package/dist/replay/runner.d.ts +1 -1
- package/dist/replay/types.d.ts +1 -1
- package/dist/replica-divergence.d.ts +1 -1
- package/dist/replica-peers-config.d.ts +1 -1
- package/dist/{resolution-MMOD5WC4.js → resolution-DKMBPXHI.js} +3 -3
- package/dist/resolution-DKMBPXHI.js.map +1 -0
- 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/salvage-envelope.js +2 -2
- package/dist/schemas.d.ts +138 -138
- package/dist/{scope-profiles-DICK7GtN.d.ts → scope-profiles-CaKcnB-6.d.ts} +1 -1
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/embed-helper.js +2 -2
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/factory.js +7 -7
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +7 -7
- 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-BP7NAX0N.d.ts → semantic-consolidation-P0eMWqh-.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +24 -23
- package/dist/semantic-rule-promotion.js +23 -22
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +23 -22
- package/dist/{service-DT-pJyda.d.ts → service-D5GQLxq_.d.ts} +2 -2
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- package/dist/shared-context/manager.d.ts +9 -9
- package/dist/shared-context/manager.js +2 -2
- package/dist/signal.d.ts +1 -1
- package/dist/source-agent-qualifier.d.ts +1 -1
- package/dist/source-agent-qualifier.js +31 -30
- package/dist/{storage-qOnaJ1Lw.d.ts → storage-DIyil2ll.d.ts} +18 -10
- package/dist/storage.d.ts +2 -2
- package/dist/storage.js +22 -21
- package/dist/summarizer.d.ts +1 -1
- package/dist/summarizer.js +4 -4
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/support-passport/index.d.ts +14 -14
- package/dist/support-passport/index.js +67 -65
- package/dist/temporal-supersession.d.ts +2 -2
- package/dist/temporal-timeline-recall.d.ts +3 -1
- package/dist/temporal-timeline-recall.js +3 -1
- package/dist/temporal-validity.d.ts +1 -1
- package/dist/threading.d.ts +1 -1
- package/dist/tier-migration.d.ts +2 -2
- package/dist/tier-routing.d.ts +1 -1
- package/dist/{tier-stats-EXYSKSVN.js → tier-stats-7E6OBUSD.js} +2 -2
- 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 +2 -2
- package/dist/transfer/capsule-export.js +3 -3
- package/dist/transfer/capsule-import.js +2 -2
- package/dist/transfer/types.d.ts +66 -66
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-ed-SvS2t.d.ts → types-CbXieHKr.d.ts} +15 -3
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.js +23 -22
- package/dist/write-envelope.d.ts +5 -2
- package/dist/write-envelope.js +1 -1
- package/package.json +2 -2
- package/src/bitemporal-frontmatter.test.ts +20 -1
- package/src/briefing-window.ts +27 -0
- package/src/briefing.test.ts +29 -0
- package/src/briefing.ts +2 -9
- package/src/capabilities.test.ts +2 -0
- package/src/capabilities.ts +17 -17
- package/src/cli.ts +14 -0
- package/src/config-security.ts +131 -0
- package/src/config.test.ts +61 -0
- package/src/config.ts +2 -1
- package/src/entity-retrieval.ts +31 -24
- package/src/index.ts +4 -6
- package/src/maintenance/memory-governance.ts +1 -0
- package/src/orchestration/conversation-index-coordinator.ts +13 -2
- package/src/orchestration/extraction-injection-gate.ts +154 -0
- package/src/orchestration/extraction-origin-context.ts +90 -0
- package/src/orchestration/extraction-persist.ts +66 -64
- package/src/orchestration/extraction-run.ts +4 -2
- package/src/orchestration/extraction-security.test.ts +271 -0
- package/src/orchestration/graph-recall-coordinator.ts +2 -0
- package/src/orchestration/namespace-read-fanout.ts +1 -0
- package/src/orchestration/qmd-result-resolver.ts +1 -0
- package/src/orchestration/recall-internal.ts +17 -11
- package/src/orchestration/recall-result-formatter.ts +35 -6
- package/src/orchestration/recall-search-pipeline.ts +3 -5
- package/src/orchestration/recall-search-prefilter.ts +1 -0
- package/src/orchestrator.ts +2 -1
- package/src/procedural/procedure-recall.ts +11 -1
- package/src/recall-authority-fence.test.ts +180 -0
- package/src/recall-context-composition.ts +28 -0
- package/src/security/audit-memory-cli.ts +42 -0
- package/src/security/audit-memory.test.ts +252 -0
- package/src/security/audit-memory.ts +318 -0
- package/src/security/injection-screen.test.ts +77 -0
- package/src/security/injection-screen.ts +158 -0
- package/src/security/origin-authority.test.ts +61 -0
- package/src/security/origin-authority.ts +88 -0
- package/src/security/types.ts +14 -0
- package/src/semantic-rule-promotion.ts +1 -1
- package/src/storage/memory-read-store.ts +1 -0
- package/src/storage/windowed-memory-read.ts +109 -0
- package/src/storage.ts +17 -15
- package/src/temporal-timeline-recall.test.ts +18 -0
- package/src/temporal-timeline-recall.ts +12 -1
- package/src/testing/subjects/windowed-memory-read.test.ts +146 -0
- package/src/types.ts +4 -4
- package/src/write-envelope.test.ts +1 -0
- package/src/write-envelope.ts +9 -0
- package/dist/chunk-2XRE6FLM.js.map +0 -1
- package/dist/chunk-76JJSXK7.js.map +0 -1
- package/dist/chunk-AHVEHR6K.js.map +0 -1
- package/dist/chunk-FPLM2TKD.js.map +0 -1
- package/dist/chunk-I6WYQSX4.js.map +0 -1
- package/dist/chunk-M4YHAODQ.js.map +0 -1
- package/dist/chunk-NSVDUN76.js.map +0 -1
- package/dist/chunk-PG4QBPVG.js.map +0 -1
- package/dist/chunk-RUNORG2P.js.map +0 -1
- package/dist/chunk-RZQ6W2W4.js.map +0 -1
- package/dist/chunk-W5ZKPI34.js.map +0 -1
- package/dist/chunk-XZHE2DEN.js.map +0 -1
- /package/dist/{auto-sync-NR3GPCOA.js.map → auto-sync-5HVRCMGZ.js.map} +0 -0
- /package/dist/{capsule-crypto-7FJQINUR.js.map → briefing-window.js.map} +0 -0
- /package/dist/{contradiction-scan-JDTBXRGW.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
- /package/dist/{chunk-LEPOP46W.js.map → chunk-227UFSEQ.js.map} +0 -0
- /package/dist/{chunk-FTPONF6B.js.map → chunk-2YREVL4T.js.map} +0 -0
- /package/dist/{chunk-KM55SMLG.js.map → chunk-4KM3V6VS.js.map} +0 -0
- /package/dist/{chunk-HAEU3ZW7.js.map → chunk-4OW2T32G.js.map} +0 -0
- /package/dist/{chunk-43SEBY2M.js.map → chunk-4QFCAKNM.js.map} +0 -0
- /package/dist/{chunk-KFBOPMF6.js.map → chunk-5ZIWRMZM.js.map} +0 -0
- /package/dist/{chunk-GWFSVJ4P.js.map → chunk-6KTXE6A3.js.map} +0 -0
- /package/dist/{chunk-GN3WRFJY.js.map → chunk-7PKNOXYB.js.map} +0 -0
- /package/dist/{chunk-RZRUV6N2.js.map → chunk-ANMIOQPU.js.map} +0 -0
- /package/dist/{chunk-RPSYDM6C.js.map → chunk-BPWZDHFM.js.map} +0 -0
- /package/dist/{chunk-CIAI24TQ.js.map → chunk-BVRREV3N.js.map} +0 -0
- /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
- /package/dist/{chunk-I3MSGFGD.js.map → chunk-CKSEJD7K.js.map} +0 -0
- /package/dist/{chunk-46SZBVDS.js.map → chunk-CME347TM.js.map} +0 -0
- /package/dist/{chunk-BGLY7EEM.js.map → chunk-CMRUIKVA.js.map} +0 -0
- /package/dist/{chunk-HGJ6NJ4E.js.map → chunk-D4LVHPOA.js.map} +0 -0
- /package/dist/{chunk-YK6BDDHP.js.map → chunk-DFEODULB.js.map} +0 -0
- /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
- /package/dist/{chunk-W6FNX2LP.js.map → chunk-E57E5SCS.js.map} +0 -0
- /package/dist/{chunk-M23RF3LJ.js.map → chunk-ER4BLWI6.js.map} +0 -0
- /package/dist/{chunk-QZLDRQ4I.js.map → chunk-F7M36OG2.js.map} +0 -0
- /package/dist/{chunk-5FD7JMTX.js.map → chunk-FONW766A.js.map} +0 -0
- /package/dist/{chunk-3TIZPSJC.js.map → chunk-FR3FNPCJ.js.map} +0 -0
- /package/dist/{chunk-G6DFSS6A.js.map → chunk-GUNIXT36.js.map} +0 -0
- /package/dist/{chunk-K2UGPTYY.js.map → chunk-H6ZXNH5I.js.map} +0 -0
- /package/dist/{chunk-BRR5EUTF.js.map → chunk-HC55YCNK.js.map} +0 -0
- /package/dist/{chunk-PT54WISF.js.map → chunk-HQ2VGCGP.js.map} +0 -0
- /package/dist/{chunk-AHZOMHWN.js.map → chunk-HXXGZ4KV.js.map} +0 -0
- /package/dist/{chunk-ZRZVLB7O.js.map → chunk-HYVBJLEK.js.map} +0 -0
- /package/dist/{chunk-3GD2HFR6.js.map → chunk-IGWVMA4Y.js.map} +0 -0
- /package/dist/{chunk-FONWBCVY.js.map → chunk-IKT6ZVO7.js.map} +0 -0
- /package/dist/{chunk-TO7ZTWJW.js.map → chunk-ION47U3Z.js.map} +0 -0
- /package/dist/{chunk-OCIP6YMD.js.map → chunk-IXGQP4RZ.js.map} +0 -0
- /package/dist/{chunk-UPLZNJKN.js.map → chunk-JFPZEWY3.js.map} +0 -0
- /package/dist/{chunk-SMNYAMJD.js.map → chunk-JKL53MOY.js.map} +0 -0
- /package/dist/{chunk-2FKEIPIT.js.map → chunk-JOA4Q765.js.map} +0 -0
- /package/dist/{chunk-MLPTFODV.js.map → chunk-KHQ57QLJ.js.map} +0 -0
- /package/dist/{chunk-KRTY3ENI.js.map → chunk-MDVBCPOS.js.map} +0 -0
- /package/dist/{chunk-UCTS3DDH.js.map → chunk-N655QIA2.js.map} +0 -0
- /package/dist/{chunk-5NB726GV.js.map → chunk-NFQB6RJT.js.map} +0 -0
- /package/dist/{chunk-UYYW2KPU.js.map → chunk-NP7FLVZW.js.map} +0 -0
- /package/dist/{chunk-CX5SW2EW.js.map → chunk-NRFU5MVH.js.map} +0 -0
- /package/dist/{chunk-NISZQW72.js.map → chunk-O4TTIMOP.js.map} +0 -0
- /package/dist/{chunk-7BD6O7ZV.js.map → chunk-O54B5YNM.js.map} +0 -0
- /package/dist/{chunk-UKYS3NU5.js.map → chunk-ONCWJBWV.js.map} +0 -0
- /package/dist/{chunk-OUKBMQ2O.js.map → chunk-PD66CVSD.js.map} +0 -0
- /package/dist/{chunk-QYN5PXDZ.js.map → chunk-PPUTUOC3.js.map} +0 -0
- /package/dist/{chunk-MIH3CJPN.js.map → chunk-PSH3VFZ7.js.map} +0 -0
- /package/dist/{chunk-MK5VEWCR.js.map → chunk-QKPDN325.js.map} +0 -0
- /package/dist/{chunk-EVWWT3KE.js.map → chunk-QP2IZTUR.js.map} +0 -0
- /package/dist/{chunk-K26NWEOC.js.map → chunk-QSDPVZPD.js.map} +0 -0
- /package/dist/{chunk-S354QO4R.js.map → chunk-QV7OEHFN.js.map} +0 -0
- /package/dist/{chunk-HBUFQRIM.js.map → chunk-QZR3WT3L.js.map} +0 -0
- /package/dist/{chunk-EEAMSNSG.js.map → chunk-R7TZ2HCS.js.map} +0 -0
- /package/dist/{chunk-YXQEKCZM.js.map → chunk-R7UHWPYI.js.map} +0 -0
- /package/dist/{chunk-2QSZNTDO.js.map → chunk-RKNJBZ55.js.map} +0 -0
- /package/dist/{chunk-L6Z5OAS4.js.map → chunk-RL3EGL7A.js.map} +0 -0
- /package/dist/{chunk-QCECHYZL.js.map → chunk-RVO6TCTU.js.map} +0 -0
- /package/dist/{chunk-JYG4OLWH.js.map → chunk-S6AH7WSF.js.map} +0 -0
- /package/dist/{chunk-6CYHUWCO.js.map → chunk-SFCJCMZQ.js.map} +0 -0
- /package/dist/{chunk-V6ERBR7U.js.map → chunk-T3HC7RJ7.js.map} +0 -0
- /package/dist/{chunk-FFRTNF3L.js.map → chunk-T6EQPZ6E.js.map} +0 -0
- /package/dist/{chunk-FWX7W5PM.js.map → chunk-TAMY4NKO.js.map} +0 -0
- /package/dist/{chunk-7TBXNYLO.js.map → chunk-TAPFJ3ET.js.map} +0 -0
- /package/dist/{chunk-ZUKIUXHQ.js.map → chunk-TFXYQNBH.js.map} +0 -0
- /package/dist/{chunk-26ZXBTYN.js.map → chunk-THACANBI.js.map} +0 -0
- /package/dist/{chunk-37DZZFFM.js.map → chunk-TLVLJSWS.js.map} +0 -0
- /package/dist/{chunk-6QPI2ITJ.js.map → chunk-TVKWT2CY.js.map} +0 -0
- /package/dist/{chunk-H7NAZ3UB.js.map → chunk-U7BMN33M.js.map} +0 -0
- /package/dist/{chunk-6LKEUCEM.js.map → chunk-UXREWVW4.js.map} +0 -0
- /package/dist/{chunk-SUPEYLH2.js.map → chunk-UYCIS6V5.js.map} +0 -0
- /package/dist/{chunk-EKTP7MNS.js.map → chunk-V3IT3XNG.js.map} +0 -0
- /package/dist/{chunk-IPLYGWQF.js.map → chunk-VDX2J7OX.js.map} +0 -0
- /package/dist/{chunk-IKP5OYQQ.js.map → chunk-VWP5DEHU.js.map} +0 -0
- /package/dist/{chunk-NQMSEB5D.js.map → chunk-X5OIPQME.js.map} +0 -0
- /package/dist/{chunk-RBII7637.js.map → chunk-XRPPHIRI.js.map} +0 -0
- /package/dist/{chunk-BIJAWZYW.js.map → chunk-YMOPYG3K.js.map} +0 -0
- /package/dist/{graph-edge-decay-65KMOJWY.js.map → config-security.js.map} +0 -0
- /package/dist/{resolution-MMOD5WC4.js.map → contradiction-scan-522AYLQC.js.map} +0 -0
- /package/dist/{first-start-migration-CRZCZAJN.js.map → first-start-migration-HZ4VPRFQ.js.map} +0 -0
- /package/dist/{forget-EHGGJZLX.js.map → forget-5TWK7CZT.js.map} +0 -0
- /package/dist/{tier-stats-EXYSKSVN.js.map → tier-stats-7E6OBUSD.js.map} +0 -0
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TombstoneStore,
|
|
3
|
-
applyTombstoneResurrectionGate,
|
|
4
|
-
buildRetiredFactTombstoneInputs,
|
|
5
|
-
collectRetiredMemoriesForRebuild
|
|
6
|
-
} from "./chunk-MLPTFODV.js";
|
|
7
1
|
import {
|
|
8
2
|
WEARABLES_DIR_NAME,
|
|
9
3
|
escapeSegmentText,
|
|
@@ -15,16 +9,25 @@ import {
|
|
|
15
9
|
unescapeSegmentText,
|
|
16
10
|
unescapeSpeakerLabel
|
|
17
11
|
} from "./chunk-UHVXE24Y.js";
|
|
12
|
+
import {
|
|
13
|
+
TombstoneStore,
|
|
14
|
+
applyTombstoneResurrectionGate,
|
|
15
|
+
buildRetiredFactTombstoneInputs,
|
|
16
|
+
collectRetiredMemoriesForRebuild
|
|
17
|
+
} from "./chunk-KHQ57QLJ.js";
|
|
18
18
|
import {
|
|
19
19
|
normalizeQmdResultPath
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-ION47U3Z.js";
|
|
21
21
|
import {
|
|
22
22
|
withholdToolScopedFromSharedNamespace
|
|
23
23
|
} from "./chunk-S2V7RUCL.js";
|
|
24
24
|
import {
|
|
25
25
|
SPECULATIVE_TTL_DAYS,
|
|
26
26
|
confidenceTier
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-5QHDXMXP.js";
|
|
28
|
+
import {
|
|
29
|
+
createMemorySnapshot
|
|
30
|
+
} from "./chunk-S2HLHAZ4.js";
|
|
28
31
|
import {
|
|
29
32
|
normalizeProjectionPreview,
|
|
30
33
|
normalizeProjectionTags
|
|
@@ -33,9 +36,6 @@ import {
|
|
|
33
36
|
rewriteProjectedEntityReferences,
|
|
34
37
|
rewriteProjectedMemoryEntityReference
|
|
35
38
|
} from "./chunk-PO7NXBG2.js";
|
|
36
|
-
import {
|
|
37
|
-
createMemorySnapshot
|
|
38
|
-
} from "./chunk-S2HLHAZ4.js";
|
|
39
39
|
import {
|
|
40
40
|
rotateMarkdownFileToArchive
|
|
41
41
|
} from "./chunk-DM2T26WE.js";
|
|
@@ -61,12 +61,12 @@ import {
|
|
|
61
61
|
isQueuedReviewMemory,
|
|
62
62
|
parseTombstoneBlockedOfflineSyncMemory,
|
|
63
63
|
tombstoneBlocked
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-H6ZXNH5I.js";
|
|
65
65
|
import {
|
|
66
66
|
composeMemoryEnvelope,
|
|
67
67
|
isSealedMemoryEnvelope,
|
|
68
68
|
sealedWriteToLegacyArgs
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-LCU5R6TQ.js";
|
|
70
70
|
import {
|
|
71
71
|
normalizeEntityName
|
|
72
72
|
} from "./chunk-YXZG5TVN.js";
|
|
@@ -131,6 +131,9 @@ import {
|
|
|
131
131
|
normalizeEntityStructuredSection,
|
|
132
132
|
sortStructuredSectionsBySchema
|
|
133
133
|
} from "./chunk-ZIKENA2C.js";
|
|
134
|
+
import {
|
|
135
|
+
parseOriginClass
|
|
136
|
+
} from "./chunk-6Q3ZTEF6.js";
|
|
134
137
|
import {
|
|
135
138
|
archive_mutation_version_exports,
|
|
136
139
|
bumpArchiveMutationIfChanged,
|
|
@@ -176,7 +179,7 @@ import {
|
|
|
176
179
|
CONTENT_HASH_INDEX_RETRY_MAX_DELAY_MS,
|
|
177
180
|
ContentHashIndex,
|
|
178
181
|
FactHashIndexNotAuthoritativeError
|
|
179
|
-
} from "./chunk-
|
|
182
|
+
} from "./chunk-NRFU5MVH.js";
|
|
180
183
|
import {
|
|
181
184
|
markProjectedMemoryPathInvalid,
|
|
182
185
|
readProjectedGovernanceRecord,
|
|
@@ -185,12 +188,12 @@ import {
|
|
|
185
188
|
readProjectedMemoryTimeline,
|
|
186
189
|
updateProjectedMemoryPath
|
|
187
190
|
} from "./chunk-2LWQSV6A.js";
|
|
188
|
-
import {
|
|
189
|
-
withHeldFileLock
|
|
190
|
-
} from "./chunk-FFAZ2XFU.js";
|
|
191
191
|
import {
|
|
192
192
|
computeLegacyContentHash
|
|
193
193
|
} from "./chunk-5FVVY2EB.js";
|
|
194
|
+
import {
|
|
195
|
+
withHeldFileLock
|
|
196
|
+
} from "./chunk-FFAZ2XFU.js";
|
|
194
197
|
import {
|
|
195
198
|
isSupportPassportPrivateMemory
|
|
196
199
|
} from "./chunk-XX4HPFFM.js";
|
|
@@ -210,7 +213,7 @@ import {
|
|
|
210
213
|
} from "./chunk-P7FMDTKL.js";
|
|
211
214
|
import {
|
|
212
215
|
resolveNamespaceCapabilities
|
|
213
|
-
} from "./chunk-
|
|
216
|
+
} from "./chunk-JUOZ62Y7.js";
|
|
214
217
|
import {
|
|
215
218
|
isAbortError,
|
|
216
219
|
raceAbort
|
|
@@ -247,7 +250,7 @@ import {
|
|
|
247
250
|
readdir as readdir6,
|
|
248
251
|
readFile as readFile2,
|
|
249
252
|
realpath as realpath3,
|
|
250
|
-
stat as
|
|
253
|
+
stat as stat3,
|
|
251
254
|
writeFile as writeFile2,
|
|
252
255
|
mkdir,
|
|
253
256
|
unlink as unlink4,
|
|
@@ -256,11 +259,11 @@ import {
|
|
|
256
259
|
} from "fs/promises";
|
|
257
260
|
import { appendFileSync, createReadStream, mkdirSync, statSync } from "fs";
|
|
258
261
|
import { createHash as createHash6 } from "crypto";
|
|
259
|
-
import
|
|
262
|
+
import path11 from "path";
|
|
260
263
|
|
|
261
264
|
// src/storage/memory-read-store.ts
|
|
262
|
-
import { lstat, readdir, realpath, stat } from "fs/promises";
|
|
263
|
-
import
|
|
265
|
+
import { lstat, readdir, realpath, stat as stat2 } from "fs/promises";
|
|
266
|
+
import path2 from "path";
|
|
264
267
|
|
|
265
268
|
// src/storage/memory-frontmatter-metadata.ts
|
|
266
269
|
var rawDocumentByMemory = /* @__PURE__ */ new WeakMap();
|
|
@@ -272,6 +275,59 @@ function readRawMemoryDocument(owner) {
|
|
|
272
275
|
return rawDocumentByMemory.get(owner);
|
|
273
276
|
}
|
|
274
277
|
|
|
278
|
+
// src/storage/windowed-memory-read.ts
|
|
279
|
+
import { stat } from "fs/promises";
|
|
280
|
+
import path from "path";
|
|
281
|
+
async function readWindowedMemories(store, options, hotCache, rememberMemorySnapshots) {
|
|
282
|
+
if (options.updatedAfter !== void 0 && (!(options.updatedAfter instanceof Date) || !Number.isFinite(options.updatedAfter.getTime()))) {
|
|
283
|
+
throw new TypeError("updatedAfter must be a valid Date");
|
|
284
|
+
}
|
|
285
|
+
if (hotCache.enabled && options.updatedAfter !== void 0 && options.maxMemories === void 0 && options.batchSize === void 0 && options.includeMalformedPaths !== true) {
|
|
286
|
+
const cached = getCachedMemories(hotCache.baseDir, hotCache.corpusVersion, hotCache.cacheKeyId, hotCache.ttlMs);
|
|
287
|
+
if (cached !== null) {
|
|
288
|
+
const updatedAfterMs = options.updatedAfter.getTime();
|
|
289
|
+
const selected = (await Promise.all(
|
|
290
|
+
cached.map(async (memory) => {
|
|
291
|
+
const timestampMs = await readWindowTimestamp(memory);
|
|
292
|
+
return timestampMs === null || timestampMs >= updatedAfterMs ? memory : null;
|
|
293
|
+
})
|
|
294
|
+
)).filter((memory) => memory !== null);
|
|
295
|
+
const memories = orderWindowMemories(selected, hotCache.baseDir);
|
|
296
|
+
return { memories: rememberMemorySnapshots(memories), filePaths: memories.map((memory) => memory.path) };
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
const result = await store.readMemoriesWindow(options);
|
|
300
|
+
return {
|
|
301
|
+
...result,
|
|
302
|
+
memories: rememberMemorySnapshots(result.memories)
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
async function readWindowTimestamp(memory) {
|
|
306
|
+
const rawDocument = readRawMemoryDocument(memory);
|
|
307
|
+
const frontmatterBlock = rawDocument?.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/)?.[1];
|
|
308
|
+
const rawTimestamp = frontmatterBlock?.match(/^[ \t]*updated:[ \t]*"?([^"\r\n]*)"?/m)?.[1] || frontmatterBlock?.match(/^[ \t]*created:[ \t]*"?([^"\r\n]*)"?/m)?.[1] || memory.frontmatter.updated || memory.frontmatter.created;
|
|
309
|
+
const timestampMs = typeof rawTimestamp === "string" ? Date.parse(rawTimestamp.trim()) : Number.NaN;
|
|
310
|
+
if (Number.isFinite(timestampMs)) return timestampMs;
|
|
311
|
+
try {
|
|
312
|
+
return (await stat(memory.path)).mtimeMs;
|
|
313
|
+
} catch {
|
|
314
|
+
return null;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
function orderWindowMemories(memories, baseDir) {
|
|
318
|
+
const correctionsRoot = path.join(baseDir, "corrections");
|
|
319
|
+
const corrections = memories.filter((memory) => memory.path === correctionsRoot || memory.path.startsWith(`${correctionsRoot}${path.sep}`)).sort((left, right) => right.path.localeCompare(left.path));
|
|
320
|
+
const facts = memories.filter((memory) => memory.path !== correctionsRoot && !memory.path.startsWith(`${correctionsRoot}${path.sep}`)).sort((left, right) => right.path.localeCompare(left.path));
|
|
321
|
+
const ordered = [];
|
|
322
|
+
for (let index = 0; index < Math.max(corrections.length, facts.length); index += 1) {
|
|
323
|
+
const correction = corrections[index];
|
|
324
|
+
if (correction) ordered.push(correction);
|
|
325
|
+
const fact = facts[index];
|
|
326
|
+
if (fact) ordered.push(fact);
|
|
327
|
+
}
|
|
328
|
+
return ordered;
|
|
329
|
+
}
|
|
330
|
+
|
|
275
331
|
// src/storage/memory-read-store.ts
|
|
276
332
|
function isPropagatableReadError(err) {
|
|
277
333
|
const code = err.code;
|
|
@@ -304,7 +360,7 @@ var MemoryReadStore = class {
|
|
|
304
360
|
if (!/^[a-z][a-z0-9-]{0,63}$/.test(source)) continue;
|
|
305
361
|
let entries;
|
|
306
362
|
try {
|
|
307
|
-
entries = await readdir(
|
|
363
|
+
entries = await readdir(path2.join(this.deps.wearablesDir, source));
|
|
308
364
|
} catch (err) {
|
|
309
365
|
if (err.code === "ENOENT") continue;
|
|
310
366
|
throw err;
|
|
@@ -337,7 +393,7 @@ var MemoryReadStore = class {
|
|
|
337
393
|
const entries = await readdir(dir, { withFileTypes: true });
|
|
338
394
|
for (const entry of entries) {
|
|
339
395
|
checkCorpusReadAbort(options);
|
|
340
|
-
const fullPath =
|
|
396
|
+
const fullPath = path2.join(dir, entry.name);
|
|
341
397
|
if (entry.isDirectory()) {
|
|
342
398
|
await readDir(fullPath);
|
|
343
399
|
continue;
|
|
@@ -416,7 +472,7 @@ var MemoryReadStore = class {
|
|
|
416
472
|
for (const entry of entries) {
|
|
417
473
|
checkCorpusReadAbort(options);
|
|
418
474
|
if (entry.isSymbolicLink()) continue;
|
|
419
|
-
const fullPath =
|
|
475
|
+
const fullPath = path2.join(dir, entry.name);
|
|
420
476
|
if (entry.isDirectory()) {
|
|
421
477
|
subdirs.push(fullPath);
|
|
422
478
|
} else if (entry.name.endsWith(".md")) {
|
|
@@ -440,7 +496,7 @@ var MemoryReadStore = class {
|
|
|
440
496
|
}
|
|
441
497
|
async collectActiveMemoryPaths(options) {
|
|
442
498
|
return this.collectContainedMarkdownPaths(
|
|
443
|
-
RECALL_FALLBACK_DIRS.map((dir) =>
|
|
499
|
+
RECALL_FALLBACK_DIRS.map((dir) => path2.join(this.deps.baseDir, dir)),
|
|
444
500
|
options?.propagateReadErrors ?? false,
|
|
445
501
|
options
|
|
446
502
|
);
|
|
@@ -465,7 +521,7 @@ var MemoryReadStore = class {
|
|
|
465
521
|
const tiers = await Promise.all([
|
|
466
522
|
this.collectActiveMemoryPaths(),
|
|
467
523
|
this.collectColdMemoryPaths(),
|
|
468
|
-
this.collectContainedMarkdownPaths([
|
|
524
|
+
this.collectContainedMarkdownPaths([path2.join(this.deps.baseDir, "archive")])
|
|
469
525
|
]);
|
|
470
526
|
return tiers.flat();
|
|
471
527
|
}
|
|
@@ -545,7 +601,7 @@ var MemoryReadStore = class {
|
|
|
545
601
|
const entries = await readdir(dir, { withFileTypes: true });
|
|
546
602
|
const subdirs = [];
|
|
547
603
|
for (const entry of entries) {
|
|
548
|
-
const fullPath =
|
|
604
|
+
const fullPath = path2.join(dir, entry.name);
|
|
549
605
|
if (entry.isDirectory()) {
|
|
550
606
|
subdirs.push(fullPath);
|
|
551
607
|
} else if (entry.name.endsWith(".md")) {
|
|
@@ -579,12 +635,12 @@ var MemoryReadStore = class {
|
|
|
579
635
|
content: parsed.content
|
|
580
636
|
}, raw);
|
|
581
637
|
}
|
|
582
|
-
const normalizedPath = filePath.split(
|
|
638
|
+
const normalizedPath = filePath.split(path2.sep).join("/");
|
|
583
639
|
if (normalizedPath.includes("/entities/") && filePath.endsWith(".md")) {
|
|
584
640
|
const entity = parseEntityFile(raw, this.deps.entitySchemas);
|
|
585
641
|
if (!entity.name) return null;
|
|
586
|
-
const nameWithoutExt =
|
|
587
|
-
const fileMtime = entity.updated || await
|
|
642
|
+
const nameWithoutExt = path2.basename(filePath, ".md");
|
|
643
|
+
const fileMtime = entity.updated || await stat2(filePath).then((s) => s.mtime.toISOString()).catch(() => (/* @__PURE__ */ new Date(0)).toISOString());
|
|
588
644
|
return {
|
|
589
645
|
path: filePath,
|
|
590
646
|
frontmatter: {
|
|
@@ -754,7 +810,7 @@ var MemoryReadStore = class {
|
|
|
754
810
|
const cached = this.deps.storageManagerClass.questionsCache.get(cacheKey);
|
|
755
811
|
if (cached && Date.now() - cached.loadedAt < this.deps.storageManagerClass.QUESTIONS_CACHE_TTL_MS) {
|
|
756
812
|
try {
|
|
757
|
-
const dirStat = await
|
|
813
|
+
const dirStat = await stat2(this.deps.questionsDir);
|
|
758
814
|
if (dirStat.mtimeMs <= cached.loadedAt) {
|
|
759
815
|
const all = cached.questions;
|
|
760
816
|
return opts?.unresolvedOnly ? all.filter((q) => !q.resolved) : all;
|
|
@@ -767,7 +823,7 @@ var MemoryReadStore = class {
|
|
|
767
823
|
const questions = [];
|
|
768
824
|
for (const file of files) {
|
|
769
825
|
if (!file.endsWith(".md")) continue;
|
|
770
|
-
const filePath =
|
|
826
|
+
const filePath = path2.join(this.deps.questionsDir, file);
|
|
771
827
|
const raw = await readMaybeEncryptedFile(filePath, this.deps._secureStoreKey, this.deps.baseDir);
|
|
772
828
|
const parsed = this.deps.parseQuestionFile(raw, filePath);
|
|
773
829
|
if (parsed) {
|
|
@@ -1494,7 +1550,7 @@ function selfDeps(self) {
|
|
|
1494
1550
|
|
|
1495
1551
|
// src/storage/entity-store.ts
|
|
1496
1552
|
import { readdir as readdir2, unlink } from "fs/promises";
|
|
1497
|
-
import
|
|
1553
|
+
import path3 from "path";
|
|
1498
1554
|
var EntityStore = class {
|
|
1499
1555
|
constructor(deps) {
|
|
1500
1556
|
this.deps = deps;
|
|
@@ -1514,7 +1570,7 @@ var EntityStore = class {
|
|
|
1514
1570
|
async readEntityForMutation(name, method, historicalIds) {
|
|
1515
1571
|
const canonical = resolveHistoricalEntityCanonicalId(name, historicalIds);
|
|
1516
1572
|
for (const candidate of canonical === name ? [name] : [canonical, name]) {
|
|
1517
|
-
const filePath =
|
|
1573
|
+
const filePath = path3.join(this.deps.entitiesDir, `${candidate}.md`);
|
|
1518
1574
|
try {
|
|
1519
1575
|
const entity = parseEntityFile(await this.deps.readStorageSecureFile(filePath), this.deps.entitySchemas);
|
|
1520
1576
|
return { filePath, entity };
|
|
@@ -1539,7 +1595,7 @@ var EntityStore = class {
|
|
|
1539
1595
|
* `mutate` returns false to skip the write. Resolves true when written.
|
|
1540
1596
|
*/
|
|
1541
1597
|
async mutateEntityFile(name, method, mutate) {
|
|
1542
|
-
const stateDir =
|
|
1598
|
+
const stateDir = path3.join(this.deps.baseDir, "state");
|
|
1543
1599
|
return withEntityCanonicalMutationLock(stateDir, async () => {
|
|
1544
1600
|
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
1545
1601
|
const idsAtResolve = this.deps.currentHistoricalIds();
|
|
@@ -1594,7 +1650,7 @@ var EntityStore = class {
|
|
|
1594
1650
|
async writeEntity(name, type, facts, options = {}) {
|
|
1595
1651
|
await this.deps.ensureDirectories();
|
|
1596
1652
|
return withEntityCanonicalMutationLock(
|
|
1597
|
-
|
|
1653
|
+
path3.join(this.deps.baseDir, "state"),
|
|
1598
1654
|
() => this.writeEntityUnlocked(name, type, facts, options)
|
|
1599
1655
|
);
|
|
1600
1656
|
}
|
|
@@ -1615,7 +1671,7 @@ var EntityStore = class {
|
|
|
1615
1671
|
log.debug(`fuzzy match: "${normalized}" \u2192 existing "${match}"`);
|
|
1616
1672
|
normalized = match;
|
|
1617
1673
|
}
|
|
1618
|
-
const filePath =
|
|
1674
|
+
const filePath = path3.join(this.deps.entitiesDir, `${normalized}.md`);
|
|
1619
1675
|
let entity = {
|
|
1620
1676
|
name,
|
|
1621
1677
|
type,
|
|
@@ -1726,7 +1782,7 @@ var EntityStore = class {
|
|
|
1726
1782
|
/** Re-serialize every entity file into the compiled-truth timeline shape. */
|
|
1727
1783
|
async migrateEntityFilesToCompiledTruthTimeline() {
|
|
1728
1784
|
const entityNames = await this.listEntityNames();
|
|
1729
|
-
const stateDir =
|
|
1785
|
+
const stateDir = path3.join(this.deps.baseDir, "state");
|
|
1730
1786
|
let migrated = 0;
|
|
1731
1787
|
for (const entityName of entityNames) {
|
|
1732
1788
|
const wrote = await withEntityCanonicalMutationLock(stateDir, async () => {
|
|
@@ -1753,12 +1809,12 @@ var EntityStore = class {
|
|
|
1753
1809
|
*/
|
|
1754
1810
|
async updateEntitySynthesis(name, synthesis, options = {}) {
|
|
1755
1811
|
return withEntityCanonicalMutationLock(
|
|
1756
|
-
|
|
1812
|
+
path3.join(this.deps.baseDir, "state"),
|
|
1757
1813
|
() => this.updateEntitySynthesisUnlocked(name, synthesis, options)
|
|
1758
1814
|
);
|
|
1759
1815
|
}
|
|
1760
1816
|
async updateEntitySynthesisUnlocked(name, synthesis, options = {}) {
|
|
1761
|
-
const filePath =
|
|
1817
|
+
const filePath = path3.join(this.deps.entitiesDir, `${name}.md`);
|
|
1762
1818
|
let entity;
|
|
1763
1819
|
try {
|
|
1764
1820
|
const content = await this.deps.readStorageSecureFile(filePath);
|
|
@@ -1816,7 +1872,7 @@ var EntityStore = class {
|
|
|
1816
1872
|
const results = await Promise.all(
|
|
1817
1873
|
batch.map(async (entry) => {
|
|
1818
1874
|
try {
|
|
1819
|
-
return await this.deps.readStorageSecureFile(
|
|
1875
|
+
return await this.deps.readStorageSecureFile(path3.join(this.deps.entitiesDir, entry));
|
|
1820
1876
|
} catch (err) {
|
|
1821
1877
|
if (err instanceof SecureStoreLockedError) throw err;
|
|
1822
1878
|
if (!isErrnoCode(err, "ENOENT")) throw err;
|
|
@@ -1891,7 +1947,7 @@ ${rows.join("\n")}
|
|
|
1891
1947
|
*/
|
|
1892
1948
|
async mergeFragmentedEntities() {
|
|
1893
1949
|
return withEntityCanonicalMutationLock(
|
|
1894
|
-
|
|
1950
|
+
path3.join(this.deps.baseDir, "state"),
|
|
1895
1951
|
() => this.mergeFragmentedEntitiesUnlocked()
|
|
1896
1952
|
);
|
|
1897
1953
|
}
|
|
@@ -1936,7 +1992,7 @@ ${rows.join("\n")}
|
|
|
1936
1992
|
extraSections: []
|
|
1937
1993
|
};
|
|
1938
1994
|
for (const file of files) {
|
|
1939
|
-
const filePath =
|
|
1995
|
+
const filePath = path3.join(this.deps.entitiesDir, file);
|
|
1940
1996
|
try {
|
|
1941
1997
|
const content = await this.deps.readStorageSecureFile(filePath);
|
|
1942
1998
|
const parsed = parseEntityFile(content, this.deps.entitySchemas);
|
|
@@ -2067,11 +2123,11 @@ ${rows.join("\n")}
|
|
|
2067
2123
|
}
|
|
2068
2124
|
mergedEntity.created = mergedEntity.created || mergedEntity.updated || (/* @__PURE__ */ new Date()).toISOString();
|
|
2069
2125
|
mergedEntity.updated = mergedEntity.updated || (/* @__PURE__ */ new Date()).toISOString();
|
|
2070
|
-
const canonicalPath =
|
|
2126
|
+
const canonicalPath = path3.join(this.deps.entitiesDir, `${canonical}.md`);
|
|
2071
2127
|
await this.deps.writeStorageSecureFile(canonicalPath, serializeEntityFile(mergedEntity, this.deps.entitySchemas));
|
|
2072
2128
|
this.deps.bumpEntityMutationVersion();
|
|
2073
2129
|
for (const file of files) {
|
|
2074
|
-
const filePath =
|
|
2130
|
+
const filePath = path3.join(this.deps.entitiesDir, file);
|
|
2075
2131
|
if (filePath !== canonicalPath) {
|
|
2076
2132
|
try {
|
|
2077
2133
|
await unlink(filePath);
|
|
@@ -2091,7 +2147,7 @@ ${rows.join("\n")}
|
|
|
2091
2147
|
|
|
2092
2148
|
// src/storage/identity-continuity-store.ts
|
|
2093
2149
|
import { readdir as readdir3 } from "fs/promises";
|
|
2094
|
-
import
|
|
2150
|
+
import path4 from "path";
|
|
2095
2151
|
var IdentityContinuityStore = class {
|
|
2096
2152
|
constructor(deps) {
|
|
2097
2153
|
this.deps = deps;
|
|
@@ -2116,7 +2172,7 @@ var IdentityContinuityStore = class {
|
|
|
2116
2172
|
const date = nowIso.slice(0, 10);
|
|
2117
2173
|
const id = this.deps.generateId("incident");
|
|
2118
2174
|
const incident = createContinuityIncidentRecord(id, input, nowIso);
|
|
2119
|
-
const filePath =
|
|
2175
|
+
const filePath = path4.join(this.deps.identityIncidentsDir, `${date}-${id}.md`);
|
|
2120
2176
|
await this.deps.writeStorageSecureFile(filePath, serializeContinuityIncident(incident));
|
|
2121
2177
|
return { ...incident, filePath };
|
|
2122
2178
|
}
|
|
@@ -2129,7 +2185,7 @@ var IdentityContinuityStore = class {
|
|
|
2129
2185
|
const incidents = [];
|
|
2130
2186
|
for (const file of candidates) {
|
|
2131
2187
|
if (incidents.length >= cappedLimit) break;
|
|
2132
|
-
const filePath =
|
|
2188
|
+
const filePath = path4.join(this.deps.identityIncidentsDir, file);
|
|
2133
2189
|
try {
|
|
2134
2190
|
const raw = await this.deps.readStorageSecureFile(filePath);
|
|
2135
2191
|
const parsed = parseContinuityIncident(raw);
|
|
@@ -2160,7 +2216,7 @@ var IdentityContinuityStore = class {
|
|
|
2160
2216
|
await this.deps.ensureDirectories();
|
|
2161
2217
|
const safeKey = this.sanitizeIdentityAuditKey(key);
|
|
2162
2218
|
const dir = period === "weekly" ? this.deps.identityAuditsWeeklyDir : this.deps.identityAuditsMonthlyDir;
|
|
2163
|
-
const filePath =
|
|
2219
|
+
const filePath = path4.join(dir, `${safeKey}.md`);
|
|
2164
2220
|
await this.deps.writeStorageSecureFile(filePath, content);
|
|
2165
2221
|
return filePath;
|
|
2166
2222
|
}
|
|
@@ -2168,7 +2224,7 @@ var IdentityContinuityStore = class {
|
|
|
2168
2224
|
try {
|
|
2169
2225
|
const safeKey = this.sanitizeIdentityAuditKey(key);
|
|
2170
2226
|
const dir = period === "weekly" ? this.deps.identityAuditsWeeklyDir : this.deps.identityAuditsMonthlyDir;
|
|
2171
|
-
return await this.deps.readStorageSecureFile(
|
|
2227
|
+
return await this.deps.readStorageSecureFile(path4.join(dir, `${safeKey}.md`));
|
|
2172
2228
|
} catch (err) {
|
|
2173
2229
|
if (err instanceof Error && err.message === "Invalid identity audit key") return null;
|
|
2174
2230
|
if (!isErrnoCode(err, "ENOENT")) throw err;
|
|
@@ -2224,12 +2280,12 @@ var IdentityContinuityStore = class {
|
|
|
2224
2280
|
const fileNames = await this.readContinuityIncidentFileNames();
|
|
2225
2281
|
const directMatch = fileNames.find((name) => name.endsWith(`-${id}.md`));
|
|
2226
2282
|
if (directMatch) {
|
|
2227
|
-
const directPath =
|
|
2283
|
+
const directPath = path4.join(this.deps.identityIncidentsDir, directMatch);
|
|
2228
2284
|
const parsed = await this.readContinuityIncidentFile(directPath);
|
|
2229
2285
|
if (parsed?.id === id) return directPath;
|
|
2230
2286
|
}
|
|
2231
2287
|
for (const fileName of fileNames) {
|
|
2232
|
-
const filePath =
|
|
2288
|
+
const filePath = path4.join(this.deps.identityIncidentsDir, fileName);
|
|
2233
2289
|
const parsed = await this.readContinuityIncidentFile(filePath);
|
|
2234
2290
|
if (parsed?.id === id) return filePath;
|
|
2235
2291
|
}
|
|
@@ -2257,7 +2313,7 @@ import {
|
|
|
2257
2313
|
unlink as unlink2,
|
|
2258
2314
|
writeFile
|
|
2259
2315
|
} from "fs/promises";
|
|
2260
|
-
import
|
|
2316
|
+
import path5 from "path";
|
|
2261
2317
|
import { z } from "zod";
|
|
2262
2318
|
var ENTITY_CANONICAL_ID_MIGRATION_VERSION = 1;
|
|
2263
2319
|
var ENTITY_CANONICAL_ID_MIGRATION_LOCK_STALE_MS = 6e4;
|
|
@@ -2291,7 +2347,7 @@ async function fingerprintPath(filePath) {
|
|
|
2291
2347
|
async function fingerprintEntityEntries(entitiesDir) {
|
|
2292
2348
|
let names;
|
|
2293
2349
|
try {
|
|
2294
|
-
names = (await readdir4(entitiesDir)).filter((name) =>
|
|
2350
|
+
names = (await readdir4(entitiesDir)).filter((name) => path5.extname(name) === ".md").sort();
|
|
2295
2351
|
} catch (error) {
|
|
2296
2352
|
if (isErrnoCode(error, "ENOENT")) return "missing";
|
|
2297
2353
|
throw error;
|
|
@@ -2300,7 +2356,7 @@ async function fingerprintEntityEntries(entitiesDir) {
|
|
|
2300
2356
|
for (const name of names) {
|
|
2301
2357
|
hash.update(`${name.length}:${name}:`);
|
|
2302
2358
|
try {
|
|
2303
|
-
const entry = await lstat2(
|
|
2359
|
+
const entry = await lstat2(path5.join(entitiesDir, name), { bigint: true });
|
|
2304
2360
|
hash.update(`${entry.dev}:${entry.ino}:${entry.size}:${entry.mtimeNs}:${entry.ctimeNs}`);
|
|
2305
2361
|
} catch (error) {
|
|
2306
2362
|
if (!isErrnoCode(error, "ENOENT")) throw error;
|
|
@@ -2320,9 +2376,9 @@ async function getFingerprint(baseDir, entitiesDir, getEntityMutationVersion) {
|
|
|
2320
2376
|
] = await Promise.all([
|
|
2321
2377
|
fingerprintPath(entitiesDir),
|
|
2322
2378
|
fingerprintEntityEntries(entitiesDir),
|
|
2323
|
-
fingerprintPath(
|
|
2324
|
-
fingerprintPath(
|
|
2325
|
-
fingerprintPath(
|
|
2379
|
+
fingerprintPath(path5.join(baseDir, "config", "aliases.json")),
|
|
2380
|
+
fingerprintPath(path5.join(baseDir, "state", ENTITY_CANONICAL_ID_RECONCILE_MARKER)),
|
|
2381
|
+
fingerprintPath(path5.join(baseDir, "state", ENTITY_CANONICAL_ID_RECONCILE_CONSUMING_MARKER))
|
|
2326
2382
|
]);
|
|
2327
2383
|
return [
|
|
2328
2384
|
entityDirectoryFingerprint,
|
|
@@ -2348,8 +2404,8 @@ async function validateRoots(baseDir, entitiesDir, stateDir, archiveDir) {
|
|
|
2348
2404
|
const roots = [
|
|
2349
2405
|
entitiesDir,
|
|
2350
2406
|
stateDir,
|
|
2351
|
-
...RECALL_FALLBACK_DIRS.map((directory) =>
|
|
2352
|
-
|
|
2407
|
+
...RECALL_FALLBACK_DIRS.map((directory) => path5.join(baseDir, directory)),
|
|
2408
|
+
path5.join(baseDir, "cold"),
|
|
2353
2409
|
archiveDir
|
|
2354
2410
|
];
|
|
2355
2411
|
for (const root of roots) {
|
|
@@ -2367,7 +2423,7 @@ async function validateRoots(baseDir, entitiesDir, stateDir, archiveDir) {
|
|
|
2367
2423
|
}
|
|
2368
2424
|
}
|
|
2369
2425
|
function statePath(deps) {
|
|
2370
|
-
return
|
|
2426
|
+
return path5.join(deps.stateDir, ENTITY_CANONICAL_ID_MIGRATION_FILE);
|
|
2371
2427
|
}
|
|
2372
2428
|
async function assertSafeMigrationStateFile(deps) {
|
|
2373
2429
|
const migrationStatePath = statePath(deps);
|
|
@@ -2410,7 +2466,7 @@ async function assertSafeTombstoneFile(deps, tombstonePath) {
|
|
|
2410
2466
|
return true;
|
|
2411
2467
|
}
|
|
2412
2468
|
function lockPath(deps) {
|
|
2413
|
-
return
|
|
2469
|
+
return path5.join(deps.stateDir, "entity-canonical-id-migration.lock");
|
|
2414
2470
|
}
|
|
2415
2471
|
async function readState(deps) {
|
|
2416
2472
|
await assertSafeMigrationStateFile(deps);
|
|
@@ -2472,26 +2528,26 @@ async function sameFileIdentity(leftPath, rightPath) {
|
|
|
2472
2528
|
}
|
|
2473
2529
|
}
|
|
2474
2530
|
async function assertNotSymlink(filePath, label) {
|
|
2475
|
-
let
|
|
2531
|
+
let stat4;
|
|
2476
2532
|
try {
|
|
2477
|
-
|
|
2533
|
+
stat4 = await lstat2(filePath);
|
|
2478
2534
|
} catch (error) {
|
|
2479
2535
|
if (isErrnoCode(error, "ENOENT")) return;
|
|
2480
2536
|
throw error;
|
|
2481
2537
|
}
|
|
2482
|
-
if (
|
|
2538
|
+
if (stat4.isSymbolicLink()) {
|
|
2483
2539
|
throw new Error(`Refusing entity canonical-id migration through symlink: ${label}.`);
|
|
2484
2540
|
}
|
|
2485
2541
|
}
|
|
2486
2542
|
async function assertNotMemorySymlink(filePath) {
|
|
2487
|
-
let
|
|
2543
|
+
let stat4;
|
|
2488
2544
|
try {
|
|
2489
|
-
|
|
2545
|
+
stat4 = await lstat2(filePath);
|
|
2490
2546
|
} catch (error) {
|
|
2491
2547
|
if (isErrnoCode(error, "ENOENT")) return;
|
|
2492
2548
|
throw error;
|
|
2493
2549
|
}
|
|
2494
|
-
if (
|
|
2550
|
+
if (stat4.isSymbolicLink()) {
|
|
2495
2551
|
throw new Error(`Refusing entity canonical-id migration through symlinked memory: ${filePath}.`);
|
|
2496
2552
|
}
|
|
2497
2553
|
}
|
|
@@ -2508,7 +2564,7 @@ async function readSafeEntityEntries(entitiesDir) {
|
|
|
2508
2564
|
}
|
|
2509
2565
|
const entries = await readdir4(entitiesDir);
|
|
2510
2566
|
for (const entry of entries) {
|
|
2511
|
-
await assertNotSymlink(
|
|
2567
|
+
await assertNotSymlink(path5.join(entitiesDir, entry), entry);
|
|
2512
2568
|
}
|
|
2513
2569
|
return entries;
|
|
2514
2570
|
}
|
|
@@ -2570,7 +2626,7 @@ async function rewriteReferences(deps, mappings, refreshLock) {
|
|
|
2570
2626
|
const seenPaths = /* @__PURE__ */ new Set();
|
|
2571
2627
|
let rewroteAny = false;
|
|
2572
2628
|
for (const memory of [...hotMemories, ...coldMemories, ...archivedMemories]) {
|
|
2573
|
-
const memoryPath =
|
|
2629
|
+
const memoryPath = path5.resolve(memory.path);
|
|
2574
2630
|
if (seenPaths.has(memoryPath)) continue;
|
|
2575
2631
|
seenPaths.add(memoryPath);
|
|
2576
2632
|
const previousEntityRef = memory.frontmatter.entityRef;
|
|
@@ -2602,7 +2658,7 @@ async function rewriteReferences(deps, mappings, refreshLock) {
|
|
|
2602
2658
|
latestCanonicalId
|
|
2603
2659
|
);
|
|
2604
2660
|
rewroteAny = true;
|
|
2605
|
-
rewroteColdMemory ||= latestMemory.path.includes(`${
|
|
2661
|
+
rewroteColdMemory ||= latestMemory.path.includes(`${path5.sep}cold${path5.sep}`);
|
|
2606
2662
|
}
|
|
2607
2663
|
if (!rewroteAny) return { rewroteColdMemory };
|
|
2608
2664
|
}
|
|
@@ -2641,7 +2697,7 @@ function rewriteTombstoneLine(line, mappings, normalizedMappings) {
|
|
|
2641
2697
|
return changed ? JSON.stringify(tombstone) : line;
|
|
2642
2698
|
}
|
|
2643
2699
|
async function rewriteTombstoneReferences(deps, mappings, refreshLock) {
|
|
2644
|
-
const tombstonePath =
|
|
2700
|
+
const tombstonePath = path5.join(deps.stateDir, "tombstones.jsonl");
|
|
2645
2701
|
const normalizedMappings = /* @__PURE__ */ new Map();
|
|
2646
2702
|
for (const [legacyId, canonicalId] of Object.entries(mappings)) {
|
|
2647
2703
|
const normalizedLegacyId = normalizeSupersessionKey(legacyId);
|
|
@@ -2650,7 +2706,7 @@ async function rewriteTombstoneReferences(deps, mappings, refreshLock) {
|
|
|
2650
2706
|
}
|
|
2651
2707
|
}
|
|
2652
2708
|
await withHeldFileLock(
|
|
2653
|
-
|
|
2709
|
+
path5.join(deps.stateDir, "tombstones.lock"),
|
|
2654
2710
|
{
|
|
2655
2711
|
staleMs: TOMBSTONE_LOCK_STALE_MS,
|
|
2656
2712
|
maxWaitMs: TOMBSTONE_LOCK_MAX_WAIT_MS
|
|
@@ -2889,8 +2945,8 @@ async function migrateLegacyEntityCanonicalIds(deps) {
|
|
|
2889
2945
|
if (!acquired) throw new Error("Timed out waiting for active entity canonical-id migration.");
|
|
2890
2946
|
await deps.validateMemoryScanRoots?.();
|
|
2891
2947
|
await readSafeEntityEntries(deps.entitiesDir);
|
|
2892
|
-
const reconcileMarkerPath =
|
|
2893
|
-
const consumingMarkerPath =
|
|
2948
|
+
const reconcileMarkerPath = path5.join(deps.stateDir, ENTITY_CANONICAL_ID_RECONCILE_MARKER);
|
|
2949
|
+
const consumingMarkerPath = path5.join(deps.stateDir, ENTITY_CANONICAL_ID_RECONCILE_CONSUMING_MARKER);
|
|
2894
2950
|
let reconcileRequested = await fileExists(consumingMarkerPath);
|
|
2895
2951
|
if (await fileExists(reconcileMarkerPath)) {
|
|
2896
2952
|
try {
|
|
@@ -3286,7 +3342,7 @@ import {
|
|
|
3286
3342
|
readFileSync,
|
|
3287
3343
|
realpathSync
|
|
3288
3344
|
} from "fs";
|
|
3289
|
-
import
|
|
3345
|
+
import path6 from "path";
|
|
3290
3346
|
function resolveSafeAliasRoots(baseDir, configDir) {
|
|
3291
3347
|
let baseStat;
|
|
3292
3348
|
try {
|
|
@@ -3313,8 +3369,8 @@ function resolveSafeAliasRoots(baseDir, configDir) {
|
|
|
3313
3369
|
return memoryRoot;
|
|
3314
3370
|
}
|
|
3315
3371
|
function readEntityAliasConfigSync(baseDir) {
|
|
3316
|
-
const configDir =
|
|
3317
|
-
const aliasPath =
|
|
3372
|
+
const configDir = path6.join(baseDir, "config");
|
|
3373
|
+
const aliasPath = path6.join(configDir, "aliases.json");
|
|
3318
3374
|
let memoryRoot = resolveSafeAliasRoots(baseDir, configDir);
|
|
3319
3375
|
if (memoryRoot === void 0) return void 0;
|
|
3320
3376
|
let aliasPreflight;
|
|
@@ -3375,7 +3431,7 @@ function decodeYamlScalar(value) {
|
|
|
3375
3431
|
}
|
|
3376
3432
|
|
|
3377
3433
|
// src/orchestration/qmd-result-resolver.ts
|
|
3378
|
-
import
|
|
3434
|
+
import path7 from "path";
|
|
3379
3435
|
var INTERNAL_QMD_ROOTS = /* @__PURE__ */ new Set([
|
|
3380
3436
|
...ALL_CATEGORY_DIRS,
|
|
3381
3437
|
"activity",
|
|
@@ -3396,7 +3452,7 @@ var INTERNAL_QMD_ROOTS = /* @__PURE__ */ new Set([
|
|
|
3396
3452
|
]);
|
|
3397
3453
|
var PRIVATE_RESULT_RESOLUTION_CONCURRENCY = 16;
|
|
3398
3454
|
function qmdCollectionPathParts(resultPath) {
|
|
3399
|
-
if (!resultPath ||
|
|
3455
|
+
if (!resultPath || path7.isAbsolute(resultPath)) return null;
|
|
3400
3456
|
if (resultPath.trim().startsWith("qmd://")) {
|
|
3401
3457
|
try {
|
|
3402
3458
|
const parsed = new URL(resultPath.trim());
|
|
@@ -3421,9 +3477,9 @@ function qmdCollectionPathParts(resultPath) {
|
|
|
3421
3477
|
}
|
|
3422
3478
|
function qmdResultPathCandidates(storageDir, resultPath) {
|
|
3423
3479
|
const candidates = /* @__PURE__ */ new Set();
|
|
3424
|
-
const storageRoot =
|
|
3480
|
+
const storageRoot = path7.resolve(storageDir);
|
|
3425
3481
|
const addCandidate = (candidate) => {
|
|
3426
|
-
const resolved =
|
|
3482
|
+
const resolved = path7.resolve(candidate);
|
|
3427
3483
|
if (isPathInsideStorageRoot(storageRoot, resolved)) {
|
|
3428
3484
|
candidates.add(resolved);
|
|
3429
3485
|
}
|
|
@@ -3431,18 +3487,18 @@ function qmdResultPathCandidates(storageDir, resultPath) {
|
|
|
3431
3487
|
const addRelativeCandidates = (relativePath) => {
|
|
3432
3488
|
const normalized = relativePath.replace(/\\/g, "/").replace(/^\/+/, "");
|
|
3433
3489
|
if (!normalized) return;
|
|
3434
|
-
addCandidate(
|
|
3490
|
+
addCandidate(path7.join(storageRoot, normalized));
|
|
3435
3491
|
if (/^\d{4}-\d{2}-\d{2}\//.test(normalized)) {
|
|
3436
|
-
addCandidate(
|
|
3492
|
+
addCandidate(path7.join(storageRoot, "facts", normalized));
|
|
3437
3493
|
}
|
|
3438
3494
|
};
|
|
3439
|
-
if (
|
|
3495
|
+
if (path7.isAbsolute(resultPath)) {
|
|
3440
3496
|
addCandidate(resultPath);
|
|
3441
|
-
const relative2 =
|
|
3442
|
-
if (relative2 && !relative2.startsWith("..") && !
|
|
3443
|
-
const normalized = relative2.split(
|
|
3497
|
+
const relative2 = path7.relative(storageRoot, path7.resolve(resultPath));
|
|
3498
|
+
if (relative2 && !relative2.startsWith("..") && !path7.isAbsolute(relative2)) {
|
|
3499
|
+
const normalized = relative2.split(path7.sep).join("/");
|
|
3444
3500
|
if (/^\d{4}-\d{2}-\d{2}\//.test(normalized)) {
|
|
3445
|
-
addCandidate(
|
|
3501
|
+
addCandidate(path7.join(storageRoot, "facts", normalized));
|
|
3446
3502
|
}
|
|
3447
3503
|
}
|
|
3448
3504
|
} else {
|
|
@@ -3478,7 +3534,7 @@ var QmdResultResolver = class {
|
|
|
3478
3534
|
const seenStorageDirs = /* @__PURE__ */ new Set();
|
|
3479
3535
|
const addStorage = (storage) => {
|
|
3480
3536
|
const storageDir = storageDirOrNull(storage);
|
|
3481
|
-
const storageKey = storageDir ?
|
|
3537
|
+
const storageKey = storageDir ? path7.resolve(storageDir) : `storage-without-dir-${storages.length}`;
|
|
3482
3538
|
if (seenStorageDirs.has(storageKey)) return;
|
|
3483
3539
|
seenStorageDirs.add(storageKey);
|
|
3484
3540
|
storages.push(storage);
|
|
@@ -3508,7 +3564,7 @@ var QmdResultResolver = class {
|
|
|
3508
3564
|
continue;
|
|
3509
3565
|
}
|
|
3510
3566
|
try {
|
|
3511
|
-
const coldRoot =
|
|
3567
|
+
const coldRoot = path7.join(storageDir, "cold");
|
|
3512
3568
|
for (const candidate of qmdResultPathCandidates(coldRoot, parts.relativePath)) {
|
|
3513
3569
|
const memory = await storage.readMemoryByPath(candidate);
|
|
3514
3570
|
if (memory) return memory;
|
|
@@ -3558,9 +3614,9 @@ var QmdResultResolver = class {
|
|
|
3558
3614
|
error: err.message
|
|
3559
3615
|
});
|
|
3560
3616
|
}
|
|
3561
|
-
if (!
|
|
3617
|
+
if (!path7.isAbsolute(fallbackResultPath)) return null;
|
|
3562
3618
|
}
|
|
3563
|
-
if (
|
|
3619
|
+
if (path7.isAbsolute(fallbackResultPath)) {
|
|
3564
3620
|
if (!fallbackStorageDir) {
|
|
3565
3621
|
return await fallbackStorage.readMemoryByPath(fallbackResultPath);
|
|
3566
3622
|
}
|
|
@@ -3617,17 +3673,17 @@ var QmdResultResolver = class {
|
|
|
3617
3673
|
if (!memory && parts && !collectionIsKnownInternal && !collectionIsConfigured) {
|
|
3618
3674
|
memory = await this.readQmdResultMemory(parts.relativePath, fallbackStorage, namespaces, result.namespace);
|
|
3619
3675
|
}
|
|
3620
|
-
const absoluteInsideMemoryRoot =
|
|
3676
|
+
const absoluteInsideMemoryRoot = path7.isAbsolute(result.path) && isPathInsideStorageRoot(path7.resolve(config.memoryDir), path7.resolve(result.path));
|
|
3621
3677
|
const hasExplicitQmdCollection = result.path.trim().startsWith("qmd://");
|
|
3622
3678
|
const unresolvedInternalPath = !memory && (absoluteInsideMemoryRoot || collectionIsKnownInternal && (!preserveUnresolved || hasExplicitQmdCollection) || hasExplicitQmdCollection && collectionIsConfigured);
|
|
3623
|
-
const unresolvedExternalCollection = !memory && (parts !== null && !collectionIsKnownInternal && !collectionIsConfigured ||
|
|
3679
|
+
const unresolvedExternalCollection = !memory && (parts !== null && !collectionIsKnownInternal && !collectionIsConfigured || path7.isAbsolute(result.path) && !isPathInsideStorageRoot(path7.resolve(config.memoryDir), path7.resolve(result.path)));
|
|
3624
3680
|
return memory !== null && !isSupportPassportPrivateMemory(memory) || !memory && !unresolvedInternalPath && (preserveUnresolved || unresolvedExternalCollection);
|
|
3625
3681
|
}
|
|
3626
3682
|
async resolveColdQmdResultForRecall(result, fallbackStorage, recallNamespaces = []) {
|
|
3627
3683
|
const memory = await this.readQmdResultMemory(result.path, fallbackStorage, recallNamespaces, result.namespace);
|
|
3628
3684
|
if (!memory) return null;
|
|
3629
3685
|
let ownerNamespace = null;
|
|
3630
|
-
if (
|
|
3686
|
+
if (path7.isAbsolute(memory.path)) {
|
|
3631
3687
|
const ownerStorage = await this.storageForAbsoluteQmdResultPath(memory.path, fallbackStorage, recallNamespaces);
|
|
3632
3688
|
ownerNamespace = ownerStorage?.namespace ?? null;
|
|
3633
3689
|
if (!ownerNamespace && resolveNamespaceCapabilities(this.getConfig()).namespaces) return null;
|
|
@@ -3642,22 +3698,23 @@ var QmdResultResolver = class {
|
|
|
3642
3698
|
...result,
|
|
3643
3699
|
docid: result.docid || memory.frontmatter.id,
|
|
3644
3700
|
path: memory.path,
|
|
3645
|
-
snippet: result.snippet || memory.content.slice(0, 400)
|
|
3701
|
+
snippet: result.snippet || memory.content.slice(0, 400),
|
|
3702
|
+
origin: memory.frontmatter.origin
|
|
3646
3703
|
}
|
|
3647
3704
|
};
|
|
3648
3705
|
}
|
|
3649
3706
|
async storageForAbsoluteQmdResultPath(resultPath, fallbackStorage, recallNamespaces = []) {
|
|
3650
|
-
const resolvedPath =
|
|
3707
|
+
const resolvedPath = path7.resolve(resultPath);
|
|
3651
3708
|
const config = this.getConfig();
|
|
3652
|
-
const memoryRoot =
|
|
3653
|
-
const namespacesRoot =
|
|
3709
|
+
const memoryRoot = path7.resolve(config.memoryDir);
|
|
3710
|
+
const namespacesRoot = path7.join(memoryRoot, "namespaces");
|
|
3654
3711
|
const fallbackStorageDir = storageDirOrNull(fallbackStorage);
|
|
3655
3712
|
const matches = [];
|
|
3656
3713
|
const seenDirs = /* @__PURE__ */ new Set();
|
|
3657
3714
|
const maybeAddStorage = (storage, namespace) => {
|
|
3658
3715
|
const storageDir = storageDirOrNull(storage);
|
|
3659
3716
|
if (!storageDir) return;
|
|
3660
|
-
const candidateRoot =
|
|
3717
|
+
const candidateRoot = path7.resolve(storageDir);
|
|
3661
3718
|
if (seenDirs.has(candidateRoot)) return;
|
|
3662
3719
|
if (!isPathInsideStorageRoot(candidateRoot, resolvedPath)) return;
|
|
3663
3720
|
if (candidateRoot === memoryRoot && isPathInsideStorageRoot(namespacesRoot, resolvedPath)) {
|
|
@@ -3675,7 +3732,7 @@ var QmdResultResolver = class {
|
|
|
3675
3732
|
candidateNamespaces.add(ns);
|
|
3676
3733
|
}
|
|
3677
3734
|
if (isPathInsideStorageRoot(namespacesRoot, resolvedPath)) {
|
|
3678
|
-
const relativeToNamespaces =
|
|
3735
|
+
const relativeToNamespaces = path7.relative(namespacesRoot, resolvedPath);
|
|
3679
3736
|
const [namespaceSegment] = relativeToNamespaces.split(/[\\/]/);
|
|
3680
3737
|
if (namespaceSegment) {
|
|
3681
3738
|
candidateNamespaces.add(namespaceIdentityFromToken(namespaceSegment) ?? namespaceSegment);
|
|
@@ -4321,7 +4378,7 @@ function fuseDay(date, inputs, options = {}) {
|
|
|
4321
4378
|
|
|
4322
4379
|
// src/wearables/fusion/store.ts
|
|
4323
4380
|
import { createHash as createHash3 } from "crypto";
|
|
4324
|
-
import * as
|
|
4381
|
+
import * as path8 from "path";
|
|
4325
4382
|
var FUSION_KIND = "wearable-fusion";
|
|
4326
4383
|
function hashFusionBody(conversations) {
|
|
4327
4384
|
return createHash3("sha256").update(JSON.stringify(conversations), "utf-8").digest("hex");
|
|
@@ -4508,7 +4565,7 @@ var FusionArtifactStore = class {
|
|
|
4508
4565
|
`invalid wearable fusion date '${String(date)}' \u2014 expected YYYY-MM-DD`
|
|
4509
4566
|
);
|
|
4510
4567
|
}
|
|
4511
|
-
return
|
|
4568
|
+
return path8.join(this.wearablesDir, FUSION_DIR_NAME, `${date}.md`);
|
|
4512
4569
|
}
|
|
4513
4570
|
async writeFusedDay(date, serialized) {
|
|
4514
4571
|
const filePath = this.fusedDayPath(date);
|
|
@@ -4545,7 +4602,7 @@ var FusionArtifactStore = class {
|
|
|
4545
4602
|
}
|
|
4546
4603
|
/** List dates with stored fused artifacts, newest first. */
|
|
4547
4604
|
async listFusedDays() {
|
|
4548
|
-
const fusionDir =
|
|
4605
|
+
const fusionDir = path8.join(this.wearablesDir, FUSION_DIR_NAME);
|
|
4549
4606
|
await this.assertPathContained(fusionDir);
|
|
4550
4607
|
let entries;
|
|
4551
4608
|
try {
|
|
@@ -4589,10 +4646,10 @@ var FusionArtifactStore = class {
|
|
|
4589
4646
|
try {
|
|
4590
4647
|
rootReal = await this.io.realpath(this.memoryDir);
|
|
4591
4648
|
} catch {
|
|
4592
|
-
rootReal =
|
|
4649
|
+
rootReal = path8.resolve(this.memoryDir);
|
|
4593
4650
|
}
|
|
4594
4651
|
await this.assertNoEscape(rootReal, this.wearablesDir);
|
|
4595
|
-
await this.assertNoEscape(rootReal,
|
|
4652
|
+
await this.assertNoEscape(rootReal, path8.dirname(targetPath));
|
|
4596
4653
|
await this.assertNoEscape(rootReal, targetPath);
|
|
4597
4654
|
await this.assertFusionDirNotSymlinked();
|
|
4598
4655
|
}
|
|
@@ -4606,15 +4663,15 @@ var FusionArtifactStore = class {
|
|
|
4606
4663
|
* (a fresh write creates a real directory lexically under the root).
|
|
4607
4664
|
*/
|
|
4608
4665
|
async assertFusionDirNotSymlinked() {
|
|
4609
|
-
const fusionDir =
|
|
4610
|
-
let
|
|
4666
|
+
const fusionDir = path8.join(this.wearablesDir, FUSION_DIR_NAME);
|
|
4667
|
+
let stat4;
|
|
4611
4668
|
try {
|
|
4612
|
-
|
|
4669
|
+
stat4 = await this.io.lstat(fusionDir);
|
|
4613
4670
|
} catch (err) {
|
|
4614
4671
|
if (err.code === "ENOENT") return;
|
|
4615
4672
|
throw err;
|
|
4616
4673
|
}
|
|
4617
|
-
if (
|
|
4674
|
+
if (stat4.isSymbolicLink) {
|
|
4618
4675
|
throw new Error(
|
|
4619
4676
|
"wearable fusion dir '_fusion' is a symbolic link \u2014 refusing to follow it even when it resolves inside the memory dir (AGENTS.md pattern #3)"
|
|
4620
4677
|
);
|
|
@@ -4742,7 +4799,7 @@ function reconstructFusionInputs(date, dayTranscripts) {
|
|
|
4742
4799
|
|
|
4743
4800
|
// src/meetings/store.ts
|
|
4744
4801
|
import { createHash as createHash4 } from "crypto";
|
|
4745
|
-
import * as
|
|
4802
|
+
import * as path9 from "path";
|
|
4746
4803
|
var MEETINGS_DIR_NAME = "meetings";
|
|
4747
4804
|
var MEETING_KIND = "meeting";
|
|
4748
4805
|
var MEETING_FORMAT_VERSION = 1;
|
|
@@ -4911,7 +4968,7 @@ var MeetingRecordStore = class {
|
|
|
4911
4968
|
constructor(memoryDir, io) {
|
|
4912
4969
|
this.memoryDir = memoryDir;
|
|
4913
4970
|
this.io = io;
|
|
4914
|
-
this.meetingsDir =
|
|
4971
|
+
this.meetingsDir = path9.join(memoryDir, MEETINGS_DIR_NAME);
|
|
4915
4972
|
}
|
|
4916
4973
|
memoryDir;
|
|
4917
4974
|
io;
|
|
@@ -4927,7 +4984,7 @@ var MeetingRecordStore = class {
|
|
|
4927
4984
|
if (idDate !== date) {
|
|
4928
4985
|
throw new Error(`meeting id '${id}' does not belong to date '${date}'`);
|
|
4929
4986
|
}
|
|
4930
|
-
return
|
|
4987
|
+
return path9.join(this.meetingsDir, date, `${id}.md`);
|
|
4931
4988
|
}
|
|
4932
4989
|
/** Idempotently persist a record: skip the write when contentHash is unchanged. */
|
|
4933
4990
|
async saveMeetingRecord(record) {
|
|
@@ -4958,7 +5015,7 @@ var MeetingRecordStore = class {
|
|
|
4958
5015
|
if (!isValidTranscriptDate(date)) {
|
|
4959
5016
|
throw new Error(`invalid meeting date '${String(date)}' \u2014 expected YYYY-MM-DD`);
|
|
4960
5017
|
}
|
|
4961
|
-
const dayDir =
|
|
5018
|
+
const dayDir = path9.join(this.meetingsDir, date);
|
|
4962
5019
|
await this.assertPathContained(dayDir);
|
|
4963
5020
|
let entries;
|
|
4964
5021
|
try {
|
|
@@ -5026,10 +5083,10 @@ var MeetingRecordStore = class {
|
|
|
5026
5083
|
try {
|
|
5027
5084
|
rootReal = await this.io.realpath(this.memoryDir);
|
|
5028
5085
|
} catch {
|
|
5029
|
-
rootReal =
|
|
5086
|
+
rootReal = path9.resolve(this.memoryDir);
|
|
5030
5087
|
}
|
|
5031
5088
|
await this.assertNoEscape(rootReal, this.meetingsDir);
|
|
5032
|
-
await this.assertNoEscape(rootReal,
|
|
5089
|
+
await this.assertNoEscape(rootReal, path9.dirname(targetPath));
|
|
5033
5090
|
await this.assertNoEscape(rootReal, targetPath);
|
|
5034
5091
|
await this.assertNotSymlink(this.meetingsDir, "directory");
|
|
5035
5092
|
const dayDir = this.dayDirWithin(targetPath);
|
|
@@ -5039,22 +5096,22 @@ var MeetingRecordStore = class {
|
|
|
5039
5096
|
/** The `<meetings>/<date>` directory on the path to `targetPath`, or null when
|
|
5040
5097
|
* `targetPath` is the meetings root itself. */
|
|
5041
5098
|
dayDirWithin(targetPath) {
|
|
5042
|
-
const rel =
|
|
5043
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
5044
|
-
const first = rel.split(
|
|
5099
|
+
const rel = path9.relative(this.meetingsDir, targetPath);
|
|
5100
|
+
if (rel === "" || rel.startsWith("..") || path9.isAbsolute(rel)) return null;
|
|
5101
|
+
const first = rel.split(path9.sep)[0];
|
|
5045
5102
|
if (first === void 0 || first.length === 0) return null;
|
|
5046
|
-
return
|
|
5103
|
+
return path9.join(this.meetingsDir, first);
|
|
5047
5104
|
}
|
|
5048
5105
|
async assertNotSymlink(target, kind) {
|
|
5049
|
-
let
|
|
5106
|
+
let stat4;
|
|
5050
5107
|
try {
|
|
5051
|
-
|
|
5108
|
+
stat4 = await this.io.lstat(target);
|
|
5052
5109
|
} catch (err) {
|
|
5053
5110
|
if (err.code === "ENOENT") return;
|
|
5054
5111
|
throw err;
|
|
5055
5112
|
}
|
|
5056
|
-
if (
|
|
5057
|
-
const label =
|
|
5113
|
+
if (stat4.isSymbolicLink) {
|
|
5114
|
+
const label = path9.relative(this.memoryDir, target) || MEETINGS_DIR_NAME;
|
|
5058
5115
|
throw new Error(
|
|
5059
5116
|
`meetings ${kind} '${label}' is a symbolic link \u2014 refusing to follow it even when it resolves inside the memory dir (AGENTS.md pattern #3)`
|
|
5060
5117
|
);
|
|
@@ -5078,7 +5135,7 @@ var SORT_STR = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
|
5078
5135
|
|
|
5079
5136
|
// src/storage/supersession-audit.ts
|
|
5080
5137
|
import { readdir as readdir5 } from "fs/promises";
|
|
5081
|
-
import
|
|
5138
|
+
import path10 from "path";
|
|
5082
5139
|
async function hasSupersessionAudit(lookup, oldMemoryId, newMemoryId, auditBody, structuredAttributes) {
|
|
5083
5140
|
let entries;
|
|
5084
5141
|
try {
|
|
@@ -5089,7 +5146,7 @@ async function hasSupersessionAudit(lookup, oldMemoryId, newMemoryId, auditBody,
|
|
|
5089
5146
|
}
|
|
5090
5147
|
for (const entry of entries) {
|
|
5091
5148
|
if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
|
|
5092
|
-
const memory = await lookup.readMemoryByPath(
|
|
5149
|
+
const memory = await lookup.readMemoryByPath(path10.join(lookup.correctionsDir, entry.name));
|
|
5093
5150
|
if (memory?.frontmatter.category === "correction" && (memory.frontmatter.sourceMemoryId === oldMemoryId || memory.frontmatter.sourceMemoryId === void 0 && memory.frontmatter.lineage?.includes(oldMemoryId)) && memory.frontmatter.lineage?.includes(newMemoryId) && stripAttributesSuffix(memory.content) === auditBody && (structuredAttributes === void 0 || Object.entries(structuredAttributes).every(
|
|
5094
5151
|
([key, value]) => memory.frontmatter.structuredAttributes?.[key] === value
|
|
5095
5152
|
))) {
|
|
@@ -5609,6 +5666,7 @@ function serializeFrontmatter(fm) {
|
|
|
5609
5666
|
`confidenceTier: ${fm.confidenceTier}`,
|
|
5610
5667
|
`tags: [${fm.tags.map((t) => `"${t}"`).join(", ")}]`
|
|
5611
5668
|
];
|
|
5669
|
+
if (fm.origin) lines.push(`origin: ${/^[A-Za-z0-9:_.*-]+$/.test(fm.origin) ? fm.origin : JSON.stringify(fm.origin)}`);
|
|
5612
5670
|
if (fm.entityRef) lines.push(`entityRef: ${fm.entityRef}`);
|
|
5613
5671
|
if (fm.sourceConnector) {
|
|
5614
5672
|
const safe = /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(fm.sourceConnector);
|
|
@@ -6006,6 +6064,7 @@ function parseFrontmatter(raw) {
|
|
|
6006
6064
|
confidenceTier: fm.confidenceTier || confidenceTier(conf),
|
|
6007
6065
|
tags,
|
|
6008
6066
|
entityRef: fm.entityRef || void 0,
|
|
6067
|
+
origin: fm.origin !== void 0 ? parseOriginClass(decodeYamlScalar(fm.origin)) : void 0,
|
|
6009
6068
|
sourceConnector: fm.sourceConnector ? decodeYamlScalar(fm.sourceConnector) || void 0 : void 0,
|
|
6010
6069
|
toolScoped: fm.toolScoped === "true" ? true : void 0,
|
|
6011
6070
|
supersedes: fm.supersedes || void 0,
|
|
@@ -6098,17 +6157,17 @@ function inferEntityTypeFromContent(content) {
|
|
|
6098
6157
|
}
|
|
6099
6158
|
var KNOWN_ENTITY_FILENAME_PREFIXES = /* @__PURE__ */ new Set(["company", "other", "person", "place", "project", "tool", "topic"]);
|
|
6100
6159
|
function inferEntityTypeFromFilename(pathRel) {
|
|
6101
|
-
const basename =
|
|
6160
|
+
const basename = path11.basename(pathRel, ".md").toLowerCase();
|
|
6102
6161
|
const separator = basename.indexOf("-");
|
|
6103
6162
|
if (separator <= 0) return void 0;
|
|
6104
6163
|
const candidate = basename.slice(0, separator);
|
|
6105
6164
|
return KNOWN_ENTITY_FILENAME_PREFIXES.has(candidate) ? candidate : void 0;
|
|
6106
6165
|
}
|
|
6107
6166
|
function normalizeFrontmatterForPath(frontmatter, pathRel, content = "") {
|
|
6108
|
-
const normalizedPath = pathRel.split(
|
|
6167
|
+
const normalizedPath = pathRel.split(path11.sep).join("/");
|
|
6109
6168
|
let normalizedFrontmatter = frontmatter;
|
|
6110
6169
|
if (normalizedPath === "entities" || normalizedPath.startsWith("entities/") || normalizedPath.includes("/entities/")) {
|
|
6111
|
-
const basename =
|
|
6170
|
+
const basename = path11.basename(pathRel, ".md");
|
|
6112
6171
|
const inferredType = inferEntityTypeFromContent(content) || inferEntityTypeFromFilename(pathRel) || "entity";
|
|
6113
6172
|
const existingTags = Array.isArray(frontmatter.tags) ? frontmatter.tags : [];
|
|
6114
6173
|
normalizedFrontmatter = {
|
|
@@ -6575,9 +6634,9 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
6575
6634
|
this.entitySchemas = entitySchemas;
|
|
6576
6635
|
this.deletionRevisionStore = new DeletionRevisionStore({
|
|
6577
6636
|
baseDir,
|
|
6578
|
-
deletionRevisionMetadataPath:
|
|
6579
|
-
invalidationCommitMetadataPath:
|
|
6580
|
-
deletionRevisionLockPath:
|
|
6637
|
+
deletionRevisionMetadataPath: path11.join(baseDir, ".offline-sync", "deletion-revisions.v1.json"),
|
|
6638
|
+
invalidationCommitMetadataPath: path11.join(baseDir, ".offline-sync", "invalidation-commits.v1.json"),
|
|
6639
|
+
deletionRevisionLockPath: path11.join(baseDir, ".offline-sync", "deletion-revisions.v1.json.lock"),
|
|
6581
6640
|
assertManagedStoragePath: (filePath, method) => this.assertManagedStoragePath(filePath, method)
|
|
6582
6641
|
});
|
|
6583
6642
|
this.hotMemoriesCacheEnabled = hotMemoriesCacheEnabledOverride ?? _StorageManager.hotMemoriesCacheDefaultByDir.get(baseDir) ?? _StorageManager.hotMemoriesCacheDefault;
|
|
@@ -6765,8 +6824,8 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
6765
6824
|
}
|
|
6766
6825
|
/** Whether `filePath` resolves to `stateDir` itself or a path contained in it. */
|
|
6767
6826
|
isStateFilePath(filePath) {
|
|
6768
|
-
const rel =
|
|
6769
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
6827
|
+
const rel = path11.relative(this.stateDir, path11.resolve(filePath));
|
|
6828
|
+
return rel === "" || !rel.startsWith("..") && !path11.isAbsolute(rel);
|
|
6770
6829
|
}
|
|
6771
6830
|
// ── Tombstone store (issue #1579) ───────────────────────────────────────
|
|
6772
6831
|
// Instance-scoped (rule 11) + namespace-scoped (rule 42) tombstone index.
|
|
@@ -6881,8 +6940,8 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
6881
6940
|
* /srv/cold/remnic), skipping the patch and stranding a stale hot entry.
|
|
6882
6941
|
*/
|
|
6883
6942
|
isColdOrArchiveTierPath(p) {
|
|
6884
|
-
const rel =
|
|
6885
|
-
return rel === "cold" || rel === "archive" || rel.startsWith(`cold${
|
|
6943
|
+
const rel = path11.relative(this.baseDir, p);
|
|
6944
|
+
return rel === "cold" || rel === "archive" || rel.startsWith(`cold${path11.sep}`) || rel.startsWith(`archive${path11.sep}`);
|
|
6886
6945
|
}
|
|
6887
6946
|
/**
|
|
6888
6947
|
* Mark the secure-store as required for this storage instance.
|
|
@@ -6969,7 +7028,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
6969
7028
|
void 0,
|
|
6970
7029
|
this.baseDir
|
|
6971
7030
|
);
|
|
6972
|
-
const rel =
|
|
7031
|
+
const rel = path11.relative(this.baseDir, filePath).split(path11.sep).join("/");
|
|
6973
7032
|
return `${rel}:${version.versionId}`;
|
|
6974
7033
|
} catch (err) {
|
|
6975
7034
|
log.warn(
|
|
@@ -7049,12 +7108,12 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
7049
7108
|
}
|
|
7050
7109
|
identityFilePath(workspaceDir, namespace) {
|
|
7051
7110
|
const rawNamespace = typeof namespace === "string" ? namespace.trim() : "";
|
|
7052
|
-
if (!rawNamespace) return
|
|
7111
|
+
if (!rawNamespace) return path11.join(workspaceDir, "IDENTITY.md");
|
|
7053
7112
|
const safeNamespace = rawNamespace.replace(/[^a-zA-Z0-9._-]/g, "-");
|
|
7054
|
-
return
|
|
7113
|
+
return path11.join(workspaceDir, `IDENTITY.${safeNamespace}.md`);
|
|
7055
7114
|
}
|
|
7056
7115
|
versionFilePath(kind) {
|
|
7057
|
-
return
|
|
7116
|
+
return path11.join(this.stateDir, `.${kind}-version.log`);
|
|
7058
7117
|
}
|
|
7059
7118
|
bumpSharedVersion(kind, fallbackMap) {
|
|
7060
7119
|
const filePath = this.versionFilePath(kind);
|
|
@@ -7158,7 +7217,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
7158
7217
|
// memories.
|
|
7159
7218
|
// -------------------------------------------------------------------------
|
|
7160
7219
|
get wearablesDir() {
|
|
7161
|
-
return
|
|
7220
|
+
return path11.join(this.baseDir, WEARABLES_DIR_NAME);
|
|
7162
7221
|
}
|
|
7163
7222
|
/**
|
|
7164
7223
|
* Resolve the on-disk path for a source/day transcript. Throws on
|
|
@@ -7174,7 +7233,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
7174
7233
|
if (!isValidTranscriptDate(date)) {
|
|
7175
7234
|
throw new Error(`invalid wearable transcript date '${String(date)}' \u2014 expected YYYY-MM-DD`);
|
|
7176
7235
|
}
|
|
7177
|
-
return
|
|
7236
|
+
return path11.join(this.wearablesDir, sourceId, `${date}.md`);
|
|
7178
7237
|
}
|
|
7179
7238
|
async writeWearableDayTranscript(sourceId, date, serialized) {
|
|
7180
7239
|
const targetPath = this.wearableTranscriptPath(sourceId, date);
|
|
@@ -7290,25 +7349,25 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
7290
7349
|
});
|
|
7291
7350
|
}
|
|
7292
7351
|
get factsDir() {
|
|
7293
|
-
return
|
|
7352
|
+
return path11.join(this.baseDir, "facts");
|
|
7294
7353
|
}
|
|
7295
7354
|
get correctionsDir() {
|
|
7296
|
-
return
|
|
7355
|
+
return path11.join(this.baseDir, "corrections");
|
|
7297
7356
|
}
|
|
7298
7357
|
get proceduresDir() {
|
|
7299
|
-
return
|
|
7358
|
+
return path11.join(this.baseDir, "procedures");
|
|
7300
7359
|
}
|
|
7301
7360
|
get reasoningTracesDir() {
|
|
7302
|
-
return
|
|
7361
|
+
return path11.join(this.baseDir, "reasoning-traces");
|
|
7303
7362
|
}
|
|
7304
7363
|
get entitiesDir() {
|
|
7305
|
-
return
|
|
7364
|
+
return path11.join(this.baseDir, "entities");
|
|
7306
7365
|
}
|
|
7307
7366
|
resolveEntityFilePath(name) {
|
|
7308
7367
|
if (typeof name !== "string") return null;
|
|
7309
|
-
const filePath =
|
|
7310
|
-
const relative2 =
|
|
7311
|
-
if (relative2 === "" || relative2.startsWith("..") ||
|
|
7368
|
+
const filePath = path11.resolve(this.entitiesDir, `${name}.md`);
|
|
7369
|
+
const relative2 = path11.relative(this.entitiesDir, filePath);
|
|
7370
|
+
if (relative2 === "" || relative2.startsWith("..") || path11.isAbsolute(relative2)) {
|
|
7312
7371
|
return null;
|
|
7313
7372
|
}
|
|
7314
7373
|
return filePath;
|
|
@@ -7319,7 +7378,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
7319
7378
|
async readDependencyPropagationQueueFile(filePath) {
|
|
7320
7379
|
const target = await resolveSafeStoragePath(
|
|
7321
7380
|
this.baseDir,
|
|
7322
|
-
|
|
7381
|
+
path11.relative(
|
|
7323
7382
|
this.baseDir,
|
|
7324
7383
|
this.assertManagedStoragePath(filePath, "storage.readDependencyPropagationQueueFile")
|
|
7325
7384
|
)
|
|
@@ -7329,7 +7388,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
7329
7388
|
async writeDependencyPropagationQueueFile(filePath, content) {
|
|
7330
7389
|
const target = await resolveSafeStoragePath(
|
|
7331
7390
|
this.baseDir,
|
|
7332
|
-
|
|
7391
|
+
path11.relative(
|
|
7333
7392
|
this.baseDir,
|
|
7334
7393
|
this.assertManagedStoragePath(filePath, "storage.writeDependencyPropagationQueueFile")
|
|
7335
7394
|
)
|
|
@@ -7343,10 +7402,10 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
7343
7402
|
});
|
|
7344
7403
|
}
|
|
7345
7404
|
assertManagedStoragePath(filePath, method) {
|
|
7346
|
-
const resolved =
|
|
7347
|
-
const base =
|
|
7348
|
-
const rel =
|
|
7349
|
-
if (rel === "" || rel === ".." || rel.startsWith(`..${
|
|
7405
|
+
const resolved = path11.resolve(filePath);
|
|
7406
|
+
const base = path11.resolve(this.baseDir);
|
|
7407
|
+
const rel = path11.relative(base, resolved);
|
|
7408
|
+
if (rel === "" || rel === ".." || rel.startsWith(`..${path11.sep}`) || path11.isAbsolute(rel)) {
|
|
7350
7409
|
throw new Error(`${method}: file path escapes memory dir`);
|
|
7351
7410
|
}
|
|
7352
7411
|
return resolved;
|
|
@@ -7378,8 +7437,8 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
7378
7437
|
}
|
|
7379
7438
|
async digestOfflineSyncFile(filePath) {
|
|
7380
7439
|
const target = this.assertManagedStoragePath(filePath, "storage.digestOfflineSyncFile");
|
|
7381
|
-
const st = await
|
|
7382
|
-
const relPath =
|
|
7440
|
+
const st = await stat3(target);
|
|
7441
|
+
const relPath = path11.relative(this.baseDir, target).split(path11.sep).join("/");
|
|
7383
7442
|
const cache = await this.loadOfflineSyncDigestCache();
|
|
7384
7443
|
const cached = cache.get(relPath);
|
|
7385
7444
|
if (cached && cached.statBytes === st.size && cached.mtimeMs === st.mtimeMs && cached.ctimeMs === st.ctimeMs && !cached.encrypted) {
|
|
@@ -7440,7 +7499,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
7440
7499
|
const bytes = typeof record.bytes === "number" ? record.bytes : NaN;
|
|
7441
7500
|
const sha256 = typeof record.sha256 === "string" ? record.sha256 : "";
|
|
7442
7501
|
const encrypted = record.encrypted === true;
|
|
7443
|
-
if (cachePath.length === 0 || cachePath === ".." || cachePath.startsWith("../") ||
|
|
7502
|
+
if (cachePath.length === 0 || cachePath === ".." || cachePath.startsWith("../") || path11.isAbsolute(cachePath) || !Number.isFinite(statBytes) || !Number.isFinite(mtimeMs) || !Number.isFinite(ctimeMs) || !Number.isFinite(bytes) || !/^[a-f0-9]{64}$/i.test(sha256)) {
|
|
7444
7503
|
continue;
|
|
7445
7504
|
}
|
|
7446
7505
|
cache.set(cachePath, { statBytes, mtimeMs, ctimeMs, encrypted, sha256, bytes });
|
|
@@ -7482,7 +7541,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
7482
7541
|
const cache = this.offlineSyncDigestCache;
|
|
7483
7542
|
if (!cache) return;
|
|
7484
7543
|
const entries = [...cache.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([entryPath, entry]) => ({ path: entryPath, ...entry }));
|
|
7485
|
-
await mkdir(
|
|
7544
|
+
await mkdir(path11.dirname(this.offlineSyncDigestCachePath), { recursive: true });
|
|
7486
7545
|
await writeFile2(this.offlineSyncDigestCachePath, `${JSON.stringify({ version: 1, entries })}
|
|
7487
7546
|
`, "utf-8");
|
|
7488
7547
|
}).catch((err) => {
|
|
@@ -7540,7 +7599,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
7540
7599
|
async isEncryptedFileHeader(filePath) {
|
|
7541
7600
|
let st;
|
|
7542
7601
|
try {
|
|
7543
|
-
st = await
|
|
7602
|
+
st = await stat3(filePath);
|
|
7544
7603
|
} catch (err) {
|
|
7545
7604
|
if (isErrnoCode(err, "ENOENT")) return false;
|
|
7546
7605
|
throw err;
|
|
@@ -7571,7 +7630,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
7571
7630
|
}
|
|
7572
7631
|
async appendStorageSecureFileUnlocked(filePath, content) {
|
|
7573
7632
|
const writeKey = this.resolveWriteKey();
|
|
7574
|
-
await mkdir(
|
|
7633
|
+
await mkdir(path11.dirname(filePath), { recursive: true });
|
|
7575
7634
|
if (writeKey === null) {
|
|
7576
7635
|
try {
|
|
7577
7636
|
if (await this.isEncryptedFileHeader(filePath)) {
|
|
@@ -7597,13 +7656,13 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
7597
7656
|
this.notifyCatalogWriteForPath(filePath);
|
|
7598
7657
|
}
|
|
7599
7658
|
get stateDir() {
|
|
7600
|
-
return
|
|
7659
|
+
return path11.join(this.baseDir, "state");
|
|
7601
7660
|
}
|
|
7602
7661
|
get offlineSyncDigestCachePath() {
|
|
7603
|
-
return
|
|
7662
|
+
return path11.join(this.baseDir, ".offline-sync", "digest-cache.v1.json");
|
|
7604
7663
|
}
|
|
7605
7664
|
get entitySynthesisQueuePath() {
|
|
7606
|
-
return
|
|
7665
|
+
return path11.join(this.stateDir, "entity-synthesis-queue.json");
|
|
7607
7666
|
}
|
|
7608
7667
|
// ── Tombstone store access (issue #1579) ─────────────────────────────────
|
|
7609
7668
|
/**
|
|
@@ -7613,7 +7672,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
7613
7672
|
* helpers are injected into the store).
|
|
7614
7673
|
*/
|
|
7615
7674
|
get tombstonesPath() {
|
|
7616
|
-
return
|
|
7675
|
+
return path11.join(this.stateDir, "tombstones.jsonl");
|
|
7617
7676
|
}
|
|
7618
7677
|
/**
|
|
7619
7678
|
* Configure the tombstone invariant for this storage instance. Installed
|
|
@@ -7643,7 +7702,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
7643
7702
|
const requested = new Set(sourceMemoryIds);
|
|
7644
7703
|
const sourcePaths = await (sourcePathsPromise ??= this.memoryReadStore.collectTombstoneMigrationPaths());
|
|
7645
7704
|
const directPaths = sourcePaths.filter(
|
|
7646
|
-
(filePath) => requested.has(
|
|
7705
|
+
(filePath) => requested.has(path11.basename(filePath, ".md"))
|
|
7647
7706
|
);
|
|
7648
7707
|
const contents = /* @__PURE__ */ new Map();
|
|
7649
7708
|
for (const memory of await this.readParsedMemoriesFromPaths(directPaths, 50)) {
|
|
@@ -7937,55 +7996,55 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
7937
7996
|
return legacyMatches.length > 0 ? [...new Set(legacyMatches.map((content) => ContentHashIndex.computeHash(content)))] : [persistedHash];
|
|
7938
7997
|
}
|
|
7939
7998
|
get questionsDir() {
|
|
7940
|
-
return
|
|
7999
|
+
return path11.join(this.baseDir, "questions");
|
|
7941
8000
|
}
|
|
7942
8001
|
get artifactsDir() {
|
|
7943
|
-
return
|
|
8002
|
+
return path11.join(this.baseDir, "artifacts");
|
|
7944
8003
|
}
|
|
7945
8004
|
get identityDir() {
|
|
7946
|
-
return
|
|
8005
|
+
return path11.join(this.baseDir, "identity");
|
|
7947
8006
|
}
|
|
7948
8007
|
get identityAnchorPath() {
|
|
7949
|
-
return
|
|
8008
|
+
return path11.join(this.identityDir, "identity-anchor.md");
|
|
7950
8009
|
}
|
|
7951
8010
|
get identityIncidentsDir() {
|
|
7952
|
-
return
|
|
8011
|
+
return path11.join(this.identityDir, "incidents");
|
|
7953
8012
|
}
|
|
7954
8013
|
get identityAuditsWeeklyDir() {
|
|
7955
|
-
return
|
|
8014
|
+
return path11.join(this.identityDir, "audits", "weekly");
|
|
7956
8015
|
}
|
|
7957
8016
|
get identityAuditsMonthlyDir() {
|
|
7958
|
-
return
|
|
8017
|
+
return path11.join(this.identityDir, "audits", "monthly");
|
|
7959
8018
|
}
|
|
7960
8019
|
get identityImprovementLoopsPath() {
|
|
7961
|
-
return
|
|
8020
|
+
return path11.join(this.identityDir, "improvement-loops.md");
|
|
7962
8021
|
}
|
|
7963
8022
|
get identityReflectionsPath() {
|
|
7964
|
-
return
|
|
8023
|
+
return path11.join(this.identityDir, "reflections.md");
|
|
7965
8024
|
}
|
|
7966
8025
|
get profilePath() {
|
|
7967
|
-
return
|
|
8026
|
+
return path11.join(this.baseDir, "profile.md");
|
|
7968
8027
|
}
|
|
7969
8028
|
get memoryActionsPath() {
|
|
7970
|
-
return
|
|
8029
|
+
return path11.join(this.stateDir, "memory-actions.jsonl");
|
|
7971
8030
|
}
|
|
7972
8031
|
get memoryLifecycleLedgerPath() {
|
|
7973
|
-
return
|
|
8032
|
+
return path11.join(this.stateDir, "memory-lifecycle-ledger.jsonl");
|
|
7974
8033
|
}
|
|
7975
8034
|
get compressionGuidelinesPath() {
|
|
7976
|
-
return
|
|
8035
|
+
return path11.join(this.stateDir, "compression-guidelines.md");
|
|
7977
8036
|
}
|
|
7978
8037
|
get compressionGuidelineDraftPath() {
|
|
7979
|
-
return
|
|
8038
|
+
return path11.join(this.stateDir, "compression-guidelines.draft.md");
|
|
7980
8039
|
}
|
|
7981
8040
|
get compressionGuidelineStatePath() {
|
|
7982
|
-
return
|
|
8041
|
+
return path11.join(this.stateDir, "compression-guideline-state.json");
|
|
7983
8042
|
}
|
|
7984
8043
|
get compressionGuidelineDraftStatePath() {
|
|
7985
|
-
return
|
|
8044
|
+
return path11.join(this.stateDir, "compression-guideline-draft-state.json");
|
|
7986
8045
|
}
|
|
7987
8046
|
get behaviorSignalsPath() {
|
|
7988
|
-
return
|
|
8047
|
+
return path11.join(this.stateDir, "behavior-signals.jsonl");
|
|
7989
8048
|
}
|
|
7990
8049
|
/**
|
|
7991
8050
|
* In-memory dedup key set for behavior-signals appends (issue #1909),
|
|
@@ -8017,7 +8076,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
8017
8076
|
* governance sweeps can treat it uniformly.
|
|
8018
8077
|
*/
|
|
8019
8078
|
get bufferSurpriseLedgerPath() {
|
|
8020
|
-
return
|
|
8079
|
+
return path11.join(this.stateDir, "buffer-surprise-ledger.jsonl");
|
|
8021
8080
|
}
|
|
8022
8081
|
/**
|
|
8023
8082
|
* Entity alias table loaded from THIS store's config/aliases.json.
|
|
@@ -8078,7 +8137,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
8078
8137
|
this.loadAliasesSync();
|
|
8079
8138
|
}
|
|
8080
8139
|
loadAliasesSync() {
|
|
8081
|
-
const aliasPath =
|
|
8140
|
+
const aliasPath = path11.join(this.baseDir, "config", "aliases.json");
|
|
8082
8141
|
this.userAliases = {};
|
|
8083
8142
|
const raw = readEntityAliasConfigSync(this.baseDir);
|
|
8084
8143
|
if (raw === void 0) return;
|
|
@@ -8116,9 +8175,9 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
8116
8175
|
await mkdir(this.baseDir, { recursive: true });
|
|
8117
8176
|
await validateRoots(this.baseDir, this.entitiesDir, this.stateDir, this.archiveDir);
|
|
8118
8177
|
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
8119
|
-
await mkdir(
|
|
8120
|
-
await mkdir(
|
|
8121
|
-
await mkdir(
|
|
8178
|
+
await mkdir(path11.join(this.factsDir, today), { recursive: true });
|
|
8179
|
+
await mkdir(path11.join(this.proceduresDir, today), { recursive: true });
|
|
8180
|
+
await mkdir(path11.join(this.reasoningTracesDir, today), { recursive: true });
|
|
8122
8181
|
await mkdir(this.correctionsDir, { recursive: true });
|
|
8123
8182
|
await mkdir(this.entitiesDir, { recursive: true });
|
|
8124
8183
|
await mkdir(this.stateDir, { recursive: true });
|
|
@@ -8128,7 +8187,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
8128
8187
|
await mkdir(this.identityIncidentsDir, { recursive: true });
|
|
8129
8188
|
await mkdir(this.identityAuditsWeeklyDir, { recursive: true });
|
|
8130
8189
|
await mkdir(this.identityAuditsMonthlyDir, { recursive: true });
|
|
8131
|
-
await mkdir(
|
|
8190
|
+
await mkdir(path11.join(this.baseDir, "config"), { recursive: true });
|
|
8132
8191
|
await this.entityCanonicalIdMigration.ensure();
|
|
8133
8192
|
if (this.hotMemoriesCacheEnabled && this.getMemoryCorpusVersion() === 0) {
|
|
8134
8193
|
this.bumpMemoryCorpusVersion();
|
|
@@ -8150,11 +8209,11 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
8150
8209
|
async resolveCategoryWritePath(category, id, today) {
|
|
8151
8210
|
if (category === "correction") {
|
|
8152
8211
|
await mkdir(this.correctionsDir, { recursive: true });
|
|
8153
|
-
return
|
|
8212
|
+
return path11.join(this.correctionsDir, `${id}.md`);
|
|
8154
8213
|
}
|
|
8155
|
-
const datedDir =
|
|
8214
|
+
const datedDir = path11.join(getCategoryDir(this.baseDir, category), today);
|
|
8156
8215
|
await mkdir(datedDir, { recursive: true });
|
|
8157
|
-
return
|
|
8216
|
+
return path11.join(datedDir, `${id}.md`);
|
|
8158
8217
|
}
|
|
8159
8218
|
async findExistingTombstoneBlockedMemory(content, category, sourceConnector) {
|
|
8160
8219
|
const identity = buildExplicitCaptureDedupKey(content, category, sourceConnector);
|
|
@@ -8236,6 +8295,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
|
|
|
8236
8295
|
if (options.sourceConnector !== void 0) {
|
|
8237
8296
|
fm.sourceConnector = options.sourceConnector;
|
|
8238
8297
|
}
|
|
8298
|
+
if (options.origin !== void 0) fm.origin = parseOriginClass(options.origin);
|
|
8239
8299
|
const sanitized = assemblePersistedBody(content, options.structuredAttributes);
|
|
8240
8300
|
if (!sanitized.clean) {
|
|
8241
8301
|
log.warn(`memory content sanitized for ${id}; violations=${sanitized.violations.join(", ")}`);
|
|
@@ -8519,7 +8579,7 @@ ${sanitized.text}
|
|
|
8519
8579
|
await this.ensureDirectories();
|
|
8520
8580
|
const now = /* @__PURE__ */ new Date();
|
|
8521
8581
|
const day = now.toISOString().slice(0, 10);
|
|
8522
|
-
const dir =
|
|
8582
|
+
const dir = path11.join(this.artifactsDir, day);
|
|
8523
8583
|
await mkdir(dir, { recursive: true });
|
|
8524
8584
|
const id = `artifact-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
|
|
8525
8585
|
const fm = {
|
|
@@ -8538,6 +8598,7 @@ ${sanitized.text}
|
|
|
8538
8598
|
intentActionType: options.intentActionType,
|
|
8539
8599
|
intentEntityTypes: options.intentEntityTypes,
|
|
8540
8600
|
...options.sourceConnector ? { sourceConnector: options.sourceConnector } : {},
|
|
8601
|
+
...options.origin ? { origin: parseOriginClass(options.origin) } : {},
|
|
8541
8602
|
...options.toolScoped ? { toolScoped: true } : {}
|
|
8542
8603
|
};
|
|
8543
8604
|
const sanitized = sanitizeMemoryContent(quote);
|
|
@@ -8545,7 +8606,7 @@ ${sanitized.text}
|
|
|
8545
8606
|
log.warn(`artifact content rejected for ${id}; violations=${sanitized.violations.join(", ")}`);
|
|
8546
8607
|
return "";
|
|
8547
8608
|
}
|
|
8548
|
-
const filePath =
|
|
8609
|
+
const filePath = path11.join(dir, `${id}.md`);
|
|
8549
8610
|
await this.writeStorageSecureFile(filePath, `${serializeFrontmatter(fm)}
|
|
8550
8611
|
|
|
8551
8612
|
${sanitized.text}
|
|
@@ -8833,7 +8894,7 @@ ${sanitized.text}
|
|
|
8833
8894
|
* per-process in-memory cache safe across process boundaries.
|
|
8834
8895
|
*/
|
|
8835
8896
|
invalidateColdMemoriesCache() {
|
|
8836
|
-
const coldRoot =
|
|
8897
|
+
const coldRoot = path11.join(this.baseDir, "cold");
|
|
8837
8898
|
_StorageManager.coldMemoriesCache.delete(coldRoot);
|
|
8838
8899
|
this.bumpColdWriteVersion();
|
|
8839
8900
|
invalidateAllForDir(this.baseDir);
|
|
@@ -8922,11 +8983,11 @@ ${sanitized.text}
|
|
|
8922
8983
|
async readWindowUpdatedMs(filePath) {
|
|
8923
8984
|
try {
|
|
8924
8985
|
const raw = await readMaybeEncryptedFile(filePath, this._secureStoreKey, this.baseDir);
|
|
8925
|
-
const match = raw.match(/^---\n([\s\S]*?)\n
|
|
8986
|
+
const match = raw.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
|
|
8926
8987
|
if (!match) return null;
|
|
8927
8988
|
const frontmatterBlock = match[1];
|
|
8928
|
-
const rawUpdated = frontmatterBlock.match(/^updated
|
|
8929
|
-
const updatedMs = rawUpdated ? Date.parse(rawUpdated) : Number.NaN;
|
|
8989
|
+
const rawUpdated = frontmatterBlock.match(/^[ \t]*updated:[ \t]*"?([^"\r\n]*)"?/m)?.[1] || frontmatterBlock.match(/^[ \t]*created:[ \t]*"?([^"\r\n]*)"?/m)?.[1] || null;
|
|
8990
|
+
const updatedMs = rawUpdated ? Date.parse(rawUpdated.trim()) : Number.NaN;
|
|
8930
8991
|
return Number.isFinite(updatedMs) ? updatedMs : null;
|
|
8931
8992
|
} catch {
|
|
8932
8993
|
return null;
|
|
@@ -8940,7 +9001,7 @@ ${sanitized.text}
|
|
|
8940
9001
|
return updatedMs >= updatedAfterMs ? filePath : null;
|
|
8941
9002
|
}
|
|
8942
9003
|
try {
|
|
8943
|
-
const fileStat = await
|
|
9004
|
+
const fileStat = await stat3(filePath);
|
|
8944
9005
|
return fileStat.mtimeMs >= updatedAfterMs ? filePath : null;
|
|
8945
9006
|
} catch {
|
|
8946
9007
|
return filePath;
|
|
@@ -8953,7 +9014,7 @@ ${sanitized.text}
|
|
|
8953
9014
|
const correctionPaths = [];
|
|
8954
9015
|
const factPaths = [];
|
|
8955
9016
|
for (const filePath of filePaths) {
|
|
8956
|
-
if (filePath === this.correctionsDir || filePath.startsWith(`${this.correctionsDir}${
|
|
9017
|
+
if (filePath === this.correctionsDir || filePath.startsWith(`${this.correctionsDir}${path11.sep}`)) {
|
|
8957
9018
|
correctionPaths.push(filePath);
|
|
8958
9019
|
} else {
|
|
8959
9020
|
factPaths.push(filePath);
|
|
@@ -8996,7 +9057,7 @@ ${sanitized.text}
|
|
|
8996
9057
|
return { memories, filePaths };
|
|
8997
9058
|
}
|
|
8998
9059
|
async readMemoriesWindow(options = {}) {
|
|
8999
|
-
return this.memoryReadStore.
|
|
9060
|
+
return readWindowedMemories(this.memoryReadStore, options, { enabled: this.hotMemoriesCacheEnabled, baseDir: this.baseDir, corpusVersion: this.getMemoryCorpusVersion(), cacheKeyId: this.hotCacheKeyId(), ttlMs: this.hotCacheTtlMs() }, (memories) => this.rememberMemorySnapshots(memories));
|
|
9000
9061
|
}
|
|
9001
9062
|
async _readAllMemoriesFromDisk(options) {
|
|
9002
9063
|
const filePaths = await this.collectActiveMemoryPaths(options);
|
|
@@ -9016,7 +9077,7 @@ ${sanitized.text}
|
|
|
9016
9077
|
try {
|
|
9017
9078
|
const entries = await readdir6(dir, { withFileTypes: true });
|
|
9018
9079
|
for (const entry of entries) {
|
|
9019
|
-
const fullPath =
|
|
9080
|
+
const fullPath = path11.join(dir, entry.name);
|
|
9020
9081
|
if (entry.isDirectory()) {
|
|
9021
9082
|
await readDir(fullPath);
|
|
9022
9083
|
} else if (entry.name.endsWith(".md")) {
|
|
@@ -9059,7 +9120,7 @@ ${sanitized.text}
|
|
|
9059
9120
|
return this.rememberMemorySnapshot(await this.memoryReadStore.readMemoryByPath(filePath));
|
|
9060
9121
|
}
|
|
9061
9122
|
resolveTierRootDir(tier) {
|
|
9062
|
-
return tier === "cold" ?
|
|
9123
|
+
return tier === "cold" ? path11.join(this.baseDir, "cold") : this.baseDir;
|
|
9063
9124
|
}
|
|
9064
9125
|
resolveMemoryDateDir(memory) {
|
|
9065
9126
|
const preferred = memory.frontmatter.created || memory.frontmatter.updated;
|
|
@@ -9074,13 +9135,13 @@ ${sanitized.text}
|
|
|
9074
9135
|
buildTierMemoryPath(memory, tier) {
|
|
9075
9136
|
const root = this.resolveTierRootDir(tier);
|
|
9076
9137
|
if (this.isArtifactMemory(memory)) {
|
|
9077
|
-
return
|
|
9138
|
+
return path11.join(root, "artifacts", this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
|
|
9078
9139
|
}
|
|
9079
9140
|
if (memory.frontmatter.category === "correction") {
|
|
9080
|
-
return
|
|
9141
|
+
return path11.join(root, "corrections", `${memory.frontmatter.id}.md`);
|
|
9081
9142
|
}
|
|
9082
9143
|
const dir = categoryDirName(memory.frontmatter.category);
|
|
9083
|
-
return
|
|
9144
|
+
return path11.join(root, dir, this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
|
|
9084
9145
|
}
|
|
9085
9146
|
async writeMemoryFileAtomic(targetPath, memory) {
|
|
9086
9147
|
const refIdsAtWrite = this.currentHistoricalIds();
|
|
@@ -9158,8 +9219,8 @@ ${memory.content}
|
|
|
9158
9219
|
memory.frontmatter.entityRef = current.frontmatter.entityRef;
|
|
9159
9220
|
}
|
|
9160
9221
|
durable = true;
|
|
9161
|
-
const sourcePath =
|
|
9162
|
-
const destPath =
|
|
9222
|
+
const sourcePath = path11.resolve(current.path);
|
|
9223
|
+
const destPath = path11.resolve(targetPath);
|
|
9163
9224
|
if (sourcePath !== destPath) {
|
|
9164
9225
|
await recordArchiveDelete2(this.baseDir, current.path, () => this.deleteManagedStorageFile(current.path));
|
|
9165
9226
|
this.invalidateAllMemoriesCache();
|
|
@@ -9183,8 +9244,8 @@ ${memory.content}
|
|
|
9183
9244
|
}
|
|
9184
9245
|
async migrateMemoryToTier(memory, targetTier) {
|
|
9185
9246
|
const targetPath = this.buildTierMemoryPath(memory, targetTier);
|
|
9186
|
-
const sourcePath =
|
|
9187
|
-
const destPath =
|
|
9247
|
+
const sourcePath = path11.resolve(memory.path);
|
|
9248
|
+
const destPath = path11.resolve(targetPath);
|
|
9188
9249
|
if (sourcePath === destPath) {
|
|
9189
9250
|
return { changed: false, targetPath };
|
|
9190
9251
|
}
|
|
@@ -9194,7 +9255,7 @@ ${memory.content}
|
|
|
9194
9255
|
return { changed, targetPath };
|
|
9195
9256
|
}
|
|
9196
9257
|
get archiveDir() {
|
|
9197
|
-
return
|
|
9258
|
+
return path11.join(this.baseDir, "archive");
|
|
9198
9259
|
}
|
|
9199
9260
|
/**
|
|
9200
9261
|
* Archive a memory by moving it from facts/ to archive/YYYY-MM-DD/.
|
|
@@ -9207,7 +9268,7 @@ ${memory.content}
|
|
|
9207
9268
|
try {
|
|
9208
9269
|
const now = lifecycle?.at ?? /* @__PURE__ */ new Date();
|
|
9209
9270
|
const today = now.toISOString().slice(0, 10);
|
|
9210
|
-
const destDir =
|
|
9271
|
+
const destDir = path11.join(this.archiveDir, today);
|
|
9211
9272
|
await mkdir(destDir, { recursive: true });
|
|
9212
9273
|
const refIdsAtWrite = this.currentHistoricalIds();
|
|
9213
9274
|
const updatedFm = canonicalizeEntityRefOption(
|
|
@@ -9223,7 +9284,7 @@ ${memory.content}
|
|
|
9223
9284
|
|
|
9224
9285
|
${current.content}
|
|
9225
9286
|
`;
|
|
9226
|
-
const destPath =
|
|
9287
|
+
const destPath = path11.join(destDir, path11.basename(current.path));
|
|
9227
9288
|
const priorDest = await this.readStorageSecureFile(destPath).catch(() => null);
|
|
9228
9289
|
await recordArchiveWrite(this.baseDir, destPath, () => this.writeStorageSecureFile(destPath, fileContent));
|
|
9229
9290
|
if (typeof current.frontmatter.entityRef === "string") {
|
|
@@ -9456,7 +9517,7 @@ ${memory.content}
|
|
|
9456
9517
|
`;
|
|
9457
9518
|
await this.writeTombstoneBlockedFrontmatter(memory, fileContent, updated, async () => {
|
|
9458
9519
|
this.invalidateAllMemoriesCache();
|
|
9459
|
-
if (memory.path.includes(`${
|
|
9520
|
+
if (memory.path.includes(`${path11.sep}cold${path11.sep}`)) {
|
|
9460
9521
|
this.invalidateColdMemoriesCache();
|
|
9461
9522
|
}
|
|
9462
9523
|
});
|
|
@@ -9467,7 +9528,7 @@ ${memory.content}
|
|
|
9467
9528
|
});
|
|
9468
9529
|
}
|
|
9469
9530
|
await this.patchHotMemoriesCache({ addedPath: memory.path });
|
|
9470
|
-
if (memory.path.includes(`${
|
|
9531
|
+
if (memory.path.includes(`${path11.sep}cold${path11.sep}`)) {
|
|
9471
9532
|
this.invalidateColdMemoriesCache();
|
|
9472
9533
|
}
|
|
9473
9534
|
try {
|
|
@@ -9548,7 +9609,7 @@ ${memory.content}
|
|
|
9548
9609
|
return deleted;
|
|
9549
9610
|
}
|
|
9550
9611
|
async loadBuffer() {
|
|
9551
|
-
const bufferPath =
|
|
9612
|
+
const bufferPath = path11.join(this.stateDir, "buffer.json");
|
|
9552
9613
|
try {
|
|
9553
9614
|
const raw = await this.readStorageSecureFile(bufferPath);
|
|
9554
9615
|
return JSON.parse(raw);
|
|
@@ -9560,11 +9621,11 @@ ${memory.content}
|
|
|
9560
9621
|
}
|
|
9561
9622
|
async saveBuffer(state) {
|
|
9562
9623
|
await this.ensureDirectories();
|
|
9563
|
-
const bufferPath =
|
|
9624
|
+
const bufferPath = path11.join(this.stateDir, "buffer.json");
|
|
9564
9625
|
await this.writeStorageSecureFile(bufferPath, JSON.stringify(state, null, 2));
|
|
9565
9626
|
}
|
|
9566
9627
|
async loadMeta() {
|
|
9567
|
-
const metaPath =
|
|
9628
|
+
const metaPath = path11.join(this.stateDir, "meta.json");
|
|
9568
9629
|
try {
|
|
9569
9630
|
const raw = await this.readStorageSecureFile(metaPath);
|
|
9570
9631
|
const parsed = JSON.parse(raw);
|
|
@@ -9597,7 +9658,7 @@ ${memory.content}
|
|
|
9597
9658
|
}
|
|
9598
9659
|
async saveMeta(state) {
|
|
9599
9660
|
await this.ensureDirectories();
|
|
9600
|
-
const metaPath =
|
|
9661
|
+
const metaPath = path11.join(this.stateDir, "meta.json");
|
|
9601
9662
|
await this.writeStorageSecureFile(metaPath, JSON.stringify(state, null, 2));
|
|
9602
9663
|
}
|
|
9603
9664
|
async appendMemoryActionEvents(events) {
|
|
@@ -9661,7 +9722,7 @@ ${memory.content}
|
|
|
9661
9722
|
},
|
|
9662
9723
|
(payload) => this.appendStorageSecureFile(target, payload),
|
|
9663
9724
|
async () => {
|
|
9664
|
-
await mkdir(
|
|
9725
|
+
await mkdir(path11.dirname(target), { recursive: true });
|
|
9665
9726
|
}
|
|
9666
9727
|
);
|
|
9667
9728
|
}
|
|
@@ -9693,7 +9754,7 @@ ${memory.content}
|
|
|
9693
9754
|
let existingKeys;
|
|
9694
9755
|
let identity = null;
|
|
9695
9756
|
try {
|
|
9696
|
-
const st = await
|
|
9757
|
+
const st = await stat3(this.behaviorSignalsPath);
|
|
9697
9758
|
identity = { size: st.size, mtimeMs: st.mtimeMs };
|
|
9698
9759
|
if (this.behaviorSignalsKeyCache && this.behaviorSignalsKeyCache.identity.size === identity.size && this.behaviorSignalsKeyCache.identity.mtimeMs === identity.mtimeMs) {
|
|
9699
9760
|
existingKeys = this.behaviorSignalsKeyCache.keys;
|
|
@@ -9741,7 +9802,7 @@ ${memory.content}
|
|
|
9741
9802
|
await this.appendStorageSecureFile(this.behaviorSignalsPath, payload);
|
|
9742
9803
|
for (const key of pending) existingKeys.add(key);
|
|
9743
9804
|
try {
|
|
9744
|
-
const st = await
|
|
9805
|
+
const st = await stat3(this.behaviorSignalsPath);
|
|
9745
9806
|
const expectedSize = (identity?.size ?? 0) + Buffer.byteLength(payload, "utf-8");
|
|
9746
9807
|
if (st.size === expectedSize) {
|
|
9747
9808
|
this.behaviorSignalsKeyCache = {
|
|
@@ -9759,7 +9820,7 @@ ${memory.content}
|
|
|
9759
9820
|
async appendReextractJobs(events) {
|
|
9760
9821
|
if (events.length === 0) return 0;
|
|
9761
9822
|
await this.ensureDirectories();
|
|
9762
|
-
const filePath =
|
|
9823
|
+
const filePath = path11.join(this.stateDir, "reextract-jobs.jsonl");
|
|
9763
9824
|
const lines = events.map((event) => JSON.stringify(event)).join("\n") + "\n";
|
|
9764
9825
|
try {
|
|
9765
9826
|
await this.appendStorageSecureFile(filePath, lines);
|
|
@@ -9772,7 +9833,7 @@ ${memory.content}
|
|
|
9772
9833
|
}
|
|
9773
9834
|
async readReextractJobs(limit = 200) {
|
|
9774
9835
|
const safeLimit = Number.isFinite(limit) ? Math.max(1, Math.min(1e3, Math.floor(limit))) : 200;
|
|
9775
|
-
const filePath =
|
|
9836
|
+
const filePath = path11.join(this.stateDir, "reextract-jobs.jsonl");
|
|
9776
9837
|
try {
|
|
9777
9838
|
const raw = await this.readStorageSecureFile(filePath);
|
|
9778
9839
|
const lines = raw.split("\n").filter((line) => line.trim().length > 0);
|
|
@@ -9999,7 +10060,7 @@ ${question}
|
|
|
9999
10060
|
|
|
10000
10061
|
**Context:** ${context}
|
|
10001
10062
|
`;
|
|
10002
|
-
const filePath =
|
|
10063
|
+
const filePath = path11.join(this.questionsDir, `${id}.md`);
|
|
10003
10064
|
await this.writeStorageSecureFile(filePath, content);
|
|
10004
10065
|
log.debug(`wrote question ${id} to ${filePath}`);
|
|
10005
10066
|
this.invalidateQuestionsCache();
|
|
@@ -10017,7 +10078,7 @@ ${question}
|
|
|
10017
10078
|
if (!match) return null;
|
|
10018
10079
|
const frontmatterStr = match[1];
|
|
10019
10080
|
const body = match[2].trim();
|
|
10020
|
-
const id = this.extractFrontmatterValue(frontmatterStr, "id") ??
|
|
10081
|
+
const id = this.extractFrontmatterValue(frontmatterStr, "id") ?? path11.basename(filePath, ".md");
|
|
10021
10082
|
const created = this.extractFrontmatterValue(frontmatterStr, "created") ?? "";
|
|
10022
10083
|
const priority = parseFloat(this.extractFrontmatterValue(frontmatterStr, "priority") ?? "0.5");
|
|
10023
10084
|
const resolved = this.extractFrontmatterValue(frontmatterStr, "resolved") === "true";
|
|
@@ -10073,11 +10134,11 @@ ${question}
|
|
|
10073
10134
|
} catch {
|
|
10074
10135
|
}
|
|
10075
10136
|
const hygiene = opts?.hygiene;
|
|
10076
|
-
const rotateEnabled = hygiene?.enabled === true && hygiene.rotateEnabled === true && Array.isArray(hygiene.rotatePaths) && hygiene.rotatePaths.includes(
|
|
10137
|
+
const rotateEnabled = hygiene?.enabled === true && hygiene.rotateEnabled === true && Array.isArray(hygiene.rotatePaths) && hygiene.rotatePaths.includes(path11.basename(identityPath));
|
|
10077
10138
|
if (rotateEnabled) {
|
|
10078
10139
|
const maxBytes = hygiene.rotateMaxBytes;
|
|
10079
10140
|
if (existing.length > maxBytes) {
|
|
10080
|
-
const archiveDir =
|
|
10141
|
+
const archiveDir = path11.join(workspaceDir, hygiene.archiveDir);
|
|
10081
10142
|
const { newContent } = await rotateMarkdownFileToArchive({
|
|
10082
10143
|
filePath: identityPath,
|
|
10083
10144
|
archiveDir,
|
|
@@ -10337,14 +10398,14 @@ ${reflection}
|
|
|
10337
10398
|
if (entries.length === 0) return 0;
|
|
10338
10399
|
const memories = await this.readAllMemories();
|
|
10339
10400
|
const memoryMap = new Map(memories.map((m) => [m.frontmatter.id, m]));
|
|
10340
|
-
const memoryPathMap = new Map(memories.map((m) => [
|
|
10401
|
+
const memoryPathMap = new Map(memories.map((m) => [path11.resolve(m.path), m]));
|
|
10341
10402
|
let updated = 0;
|
|
10342
10403
|
const prevVersion = this.getMemoryCorpusVersion();
|
|
10343
10404
|
const keyId = this.hotCacheKeyId();
|
|
10344
10405
|
const warm = this.hotMemoriesCacheEnabled && getCachedMemories(this.baseDir, prevVersion, keyId, this.hotCacheTtlMs()) !== null;
|
|
10345
10406
|
const appliedPatches = /* @__PURE__ */ new Map();
|
|
10346
10407
|
for (const entry of entries) {
|
|
10347
|
-
const memory = entry.memoryPath ? memoryPathMap.get(
|
|
10408
|
+
const memory = entry.memoryPath ? memoryPathMap.get(path11.resolve(entry.memoryPath)) : memoryMap.get(entry.memoryId);
|
|
10348
10409
|
if (!memory) continue;
|
|
10349
10410
|
try {
|
|
10350
10411
|
const applied = await this.withTombstoneBlockedMemoryPathLock(memory.path, async (current) => {
|
|
@@ -10375,7 +10436,7 @@ ${current.content}
|
|
|
10375
10436
|
if (warm) {
|
|
10376
10437
|
updateCacheOnWrite(this.baseDir, { ...applied.current, frontmatter: applied.newFm }, keyId);
|
|
10377
10438
|
}
|
|
10378
|
-
appliedPatches.set(
|
|
10439
|
+
appliedPatches.set(path11.resolve(memory.path), {
|
|
10379
10440
|
accessCount: entry.newCount,
|
|
10380
10441
|
lastAccessed: entry.lastAccessed
|
|
10381
10442
|
});
|
|
@@ -10391,7 +10452,7 @@ ${current.content}
|
|
|
10391
10452
|
const cur = getCachedMemories(this.baseDir, prevVersion, keyId);
|
|
10392
10453
|
if (cur) {
|
|
10393
10454
|
const reapplied = cur.map((m) => {
|
|
10394
|
-
const patch = appliedPatches.get(
|
|
10455
|
+
const patch = appliedPatches.get(path11.resolve(m.path));
|
|
10395
10456
|
return patch ? {
|
|
10396
10457
|
...m,
|
|
10397
10458
|
frontmatter: { ...m.frontmatter, accessCount: patch.accessCount, lastAccessed: patch.lastAccessed }
|
|
@@ -10421,7 +10482,7 @@ ${current.content}
|
|
|
10421
10482
|
const pathsById = /* @__PURE__ */ new Map();
|
|
10422
10483
|
const filePathsById = /* @__PURE__ */ new Map();
|
|
10423
10484
|
for (const filePath of filePaths) {
|
|
10424
|
-
const memoryId =
|
|
10485
|
+
const memoryId = path11.basename(filePath, ".md");
|
|
10425
10486
|
if (!wantedIds.has(memoryId)) continue;
|
|
10426
10487
|
const paths = filePathsById.get(memoryId) ?? [];
|
|
10427
10488
|
paths.push(filePath);
|
|
@@ -10433,7 +10494,7 @@ ${current.content}
|
|
|
10433
10494
|
const preferredMatches = [];
|
|
10434
10495
|
for (const preferredPath of preferred) {
|
|
10435
10496
|
const directCandidates = new Set(qmdResultPathCandidates(this.baseDir, preferredPath));
|
|
10436
|
-
const directMatch = existingPaths.find((filePath) => directCandidates.has(
|
|
10497
|
+
const directMatch = existingPaths.find((filePath) => directCandidates.has(path11.resolve(filePath)));
|
|
10437
10498
|
if (directMatch) {
|
|
10438
10499
|
preferredMatches.push(directMatch);
|
|
10439
10500
|
continue;
|
|
@@ -10445,7 +10506,7 @@ ${current.content}
|
|
|
10445
10506
|
candidates.add(candidate);
|
|
10446
10507
|
}
|
|
10447
10508
|
}
|
|
10448
|
-
const match = existingPaths.find((filePath) => candidates.has(
|
|
10509
|
+
const match = existingPaths.find((filePath) => candidates.has(path11.resolve(filePath)));
|
|
10449
10510
|
if (match) preferredMatches.push(match);
|
|
10450
10511
|
}
|
|
10451
10512
|
if (preferredMatches.length > 0) {
|
|
@@ -10569,6 +10630,7 @@ ${current.content}
|
|
|
10569
10630
|
...options.sources ? { sources: options.sources } : {},
|
|
10570
10631
|
...options.provenance ? { provenance: options.provenance } : {},
|
|
10571
10632
|
...options.sourceConnector ? { sourceConnector: options.sourceConnector } : {},
|
|
10633
|
+
...options.origin ? { origin: parseOriginClass(options.origin) } : {},
|
|
10572
10634
|
...options.toolScoped || withholdToolScopedFromSharedNamespace({
|
|
10573
10635
|
content: sanitized.text,
|
|
10574
10636
|
sourceConnector: options.sourceConnector
|
|
@@ -10764,11 +10826,11 @@ ${current.content}
|
|
|
10764
10826
|
}
|
|
10765
10827
|
}
|
|
10766
10828
|
get summariesDir() {
|
|
10767
|
-
return
|
|
10829
|
+
return path11.join(this.baseDir, "summaries");
|
|
10768
10830
|
}
|
|
10769
10831
|
async writeSummary(summary) {
|
|
10770
10832
|
await mkdir(this.summariesDir, { recursive: true });
|
|
10771
|
-
const filePath =
|
|
10833
|
+
const filePath = path11.join(this.summariesDir, `${summary.id}.json`);
|
|
10772
10834
|
await this.writeStorageSecureFile(filePath, JSON.stringify(summary, null, 2));
|
|
10773
10835
|
log.debug(`wrote summary ${summary.id}`);
|
|
10774
10836
|
}
|
|
@@ -10778,7 +10840,7 @@ ${current.content}
|
|
|
10778
10840
|
const summaries = [];
|
|
10779
10841
|
for (const file of files) {
|
|
10780
10842
|
if (!file.endsWith(".json")) continue;
|
|
10781
|
-
const filePath =
|
|
10843
|
+
const filePath = path11.join(this.summariesDir, file);
|
|
10782
10844
|
const raw = await this.readStorageSecureFile(filePath);
|
|
10783
10845
|
summaries.push(JSON.parse(raw));
|
|
10784
10846
|
}
|
|
@@ -10848,7 +10910,7 @@ ${current.content}
|
|
|
10848
10910
|
return archived;
|
|
10849
10911
|
}
|
|
10850
10912
|
async saveTopics(topics) {
|
|
10851
|
-
const metaPath =
|
|
10913
|
+
const metaPath = path11.join(this.stateDir, "topics.json");
|
|
10852
10914
|
await mkdir(this.stateDir, { recursive: true });
|
|
10853
10915
|
await this.writeStorageSecureFile(
|
|
10854
10916
|
metaPath,
|
|
@@ -10857,7 +10919,7 @@ ${current.content}
|
|
|
10857
10919
|
log.debug(`saved ${topics.length} topic scores`);
|
|
10858
10920
|
}
|
|
10859
10921
|
async loadTopics() {
|
|
10860
|
-
const metaPath =
|
|
10922
|
+
const metaPath = path11.join(this.stateDir, "topics.json");
|
|
10861
10923
|
try {
|
|
10862
10924
|
const raw = await this.readStorageSecureFile(metaPath);
|
|
10863
10925
|
return JSON.parse(raw);
|
|
@@ -10972,4 +11034,4 @@ export {
|
|
|
10972
11034
|
isValidBufferSurpriseEvent,
|
|
10973
11035
|
StorageManager3 as StorageManager
|
|
10974
11036
|
};
|
|
10975
|
-
//# sourceMappingURL=chunk-
|
|
11037
|
+
//# sourceMappingURL=chunk-BWJMBJCY.js.map
|