@remnic/core 10.0.169 → 10.0.171
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.js +124 -123
- package/dist/access-cli.js +124 -123
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.js +8 -8
- package/dist/access-extraction-force-flush-preempt.js +124 -123
- package/dist/access-extraction-force-flush.js +124 -123
- package/dist/access-http-briefing.js +124 -123
- package/dist/access-http-query.js +124 -123
- package/dist/access-http.js +124 -123
- package/dist/access-identity-continuity-surface.js +124 -123
- package/dist/access-lcm-surface.js +124 -123
- package/dist/access-mcp.js +124 -123
- package/dist/access-observe-write-category.js +8 -8
- package/dist/access-observe-write-surface.js +124 -123
- package/dist/access-offline-manifest.js +5 -5
- package/dist/access-operations-batch.js +124 -123
- package/dist/access-operations.js +124 -123
- package/dist/access-recall-concurrency.js +124 -123
- package/dist/access-recall-diagnostics.js +2 -2
- package/dist/access-recall-response.js +124 -123
- package/dist/access-recall-surface.d.ts.map +1 -1
- package/dist/access-recall-surface.js +124 -123
- package/dist/access-schema.js +7 -7
- package/dist/access-service.js +124 -123
- package/dist/active-recall.js +21 -20
- package/dist/active-recall.js.map +1 -1
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/behavior-learner.js +1 -1
- package/dist/briefing.js +13 -13
- package/dist/buffer.js +6 -6
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.js +16 -16
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.js +2 -2
- package/dist/causal-trajectory.js +1 -1
- package/dist/chat/chat-engine.d.ts +5 -3
- package/dist/chat/chat-engine.d.ts.map +1 -1
- package/dist/chat/chat-executor.d.ts +3 -4
- package/dist/chat/chat-executor.d.ts.map +1 -1
- package/dist/{chunk-FHWX2REL.js → chunk-2OAFPBQB.js} +2 -2
- package/dist/{chunk-5IZL4DCV.js → chunk-4DF5LMBJ.js} +2 -2
- package/dist/{chunk-FWTGO4NE.js → chunk-4DLGKTM6.js} +2 -2
- package/dist/{chunk-D6YCETHG.js → chunk-4E2Z44CV.js} +2 -2
- package/dist/{chunk-W4EJMMPP.js → chunk-4LVQSHHN.js} +11 -11
- package/dist/{chunk-W4Q65VJL.js → chunk-4X7HQKAG.js} +2 -2
- package/dist/{chunk-I74SUMNI.js → chunk-5ACIRCBO.js} +65 -3
- package/dist/chunk-5ACIRCBO.js.map +1 -0
- package/dist/{chunk-LPUEBFX2.js → chunk-5JCYPBY5.js} +2 -2
- package/dist/{chunk-ID65XTF3.js → chunk-5SOSQTVE.js} +2 -2
- package/dist/{chunk-SEIGLG62.js → chunk-6VFMEBXY.js} +4 -4
- package/dist/{chunk-333SBFXB.js → chunk-7AAMJQFW.js} +2 -2
- package/dist/{chunk-AHOYKJ5X.js → chunk-7SNEJNA3.js} +96 -23
- package/dist/chunk-7SNEJNA3.js.map +1 -0
- package/dist/{chunk-T3MCVSUC.js → chunk-A2XFG462.js} +2 -2
- package/dist/{chunk-HXFIILGF.js → chunk-BFPF5N3H.js} +4 -4
- package/dist/{chunk-GWY5ZFHP.js → chunk-BJOQQCYC.js} +5 -5
- package/dist/{chunk-7OYDFIL4.js → chunk-CY2C5LM4.js} +3 -3
- package/dist/{chunk-BFBS7OFQ.js → chunk-DC55RIEZ.js} +4 -4
- package/dist/{chunk-TGQW3AMK.js → chunk-DNXQVCIC.js} +3 -3
- package/dist/{chunk-TQ4CELUR.js → chunk-E53NLIAP.js} +3 -3
- package/dist/{chunk-2LA3H54D.js → chunk-E5IZTY4W.js} +2 -2
- package/dist/{chunk-PFR6ZKQI.js → chunk-EBI6FI5U.js} +6 -6
- package/dist/{chunk-JN7OSQJR.js → chunk-ETTV5F53.js} +2 -2
- package/dist/{chunk-FRYCXXTB.js → chunk-FSORYJRP.js} +3 -3
- package/dist/{chunk-K36RMINQ.js → chunk-GOZXQNIM.js} +3 -3
- package/dist/{chunk-H4IU24V5.js → chunk-GUF2JKG5.js} +2 -2
- package/dist/{chunk-XTRC6SSS.js → chunk-H6TCS5XX.js} +11 -8
- package/dist/chunk-H6TCS5XX.js.map +1 -0
- package/dist/{chunk-MTJFK42O.js → chunk-HHVK2JRE.js} +2 -2
- package/dist/{chunk-D5ZLTLHF.js → chunk-HR3DKJCU.js} +2 -2
- package/dist/{chunk-AUFPPBC3.js → chunk-IJKO5RVJ.js} +3 -3
- package/dist/{chunk-O3OEVYUR.js → chunk-IK7NPYYU.js} +2 -2
- package/dist/{chunk-ILNPU5W5.js → chunk-IMA4DJ7K.js} +5 -45
- package/dist/chunk-IMA4DJ7K.js.map +1 -0
- package/dist/{chunk-ACPFBVUD.js → chunk-JDH2BA2P.js} +2 -2
- package/dist/{chunk-VF6SC4OD.js → chunk-JNBSTHVT.js} +2 -2
- package/dist/chunk-JVVWCZ2P.js +18 -0
- package/dist/chunk-JVVWCZ2P.js.map +1 -0
- package/dist/{chunk-OBPOIZNR.js → chunk-KBHUGMUW.js} +2 -2
- package/dist/{chunk-M7CFCRWJ.js → chunk-KW4XA7GM.js} +3 -3
- package/dist/{chunk-B5KTTWC7.js → chunk-L5EE2CXU.js} +2 -2
- package/dist/{chunk-QNUNAXBE.js → chunk-L7LZDISF.js} +1 -9
- package/dist/{chunk-QNUNAXBE.js.map → chunk-L7LZDISF.js.map} +1 -1
- package/dist/{chunk-N3FRR6II.js → chunk-LAOJHOTG.js} +2 -2
- package/dist/{chunk-QPLI7LUU.js → chunk-LH57QATU.js} +2 -2
- package/dist/{chunk-JGGNUEVD.js → chunk-NDPS6OU2.js} +2 -2
- package/dist/{chunk-N7AIFTSH.js → chunk-NJG63FY2.js} +1 -1
- package/dist/{chunk-N7AIFTSH.js.map → chunk-NJG63FY2.js.map} +1 -1
- package/dist/{chunk-UPD5XDJX.js → chunk-NKAGGDSL.js} +4 -4
- package/dist/{chunk-G3RLCVJC.js → chunk-OGQL7QC7.js} +2 -2
- package/dist/{chunk-K3FH3LAQ.js → chunk-OJXK5C6Z.js} +4 -4
- package/dist/{chunk-HDLNSDLK.js → chunk-P3XO7HE3.js} +2 -2
- package/dist/{chunk-VMRPLHEU.js → chunk-PQIFYBUX.js} +2 -2
- package/dist/{chunk-WLT6LTQP.js → chunk-PRRWKTK6.js} +2 -2
- package/dist/{chunk-CX24SVLK.js → chunk-Q7OKGBZY.js} +2 -2
- package/dist/{chunk-BHRPZBAH.js → chunk-QJBULLKG.js} +3 -3
- package/dist/{chunk-WCJQ3OUP.js → chunk-QKAFFVSO.js} +2 -2
- package/dist/{chunk-VKXJQF5C.js → chunk-QKBFVLDH.js} +2 -2
- package/dist/{chunk-I7WPLMUX.js → chunk-QRCE77YX.js} +2 -2
- package/dist/{chunk-K2DTHNDY.js → chunk-R2AJAAHJ.js} +4 -4
- package/dist/{chunk-5KDDAQ6K.js → chunk-R3UQIS3F.js} +6 -6
- package/dist/{chunk-B3M56D2A.js → chunk-RDHEBINJ.js} +2 -2
- package/dist/{chunk-3I3NXB6X.js → chunk-RHQL2RIM.js} +2 -2
- package/dist/{chunk-FMIM36I4.js → chunk-SA2YALFU.js} +2 -2
- package/dist/{chunk-DPL5VO5V.js → chunk-SAPC7N43.js} +3 -3
- package/dist/{chunk-7FPI5MFB.js → chunk-SLWD7TB6.js} +5 -5
- package/dist/{chunk-ZA6CYFAK.js → chunk-SOQOUZ2Y.js} +2 -2
- package/dist/{chunk-VHXRLD6S.js → chunk-T2JZF45K.js} +2 -2
- package/dist/{chunk-32OTLNAU.js → chunk-T2KCROPA.js} +230 -216
- package/dist/chunk-T2KCROPA.js.map +1 -0
- package/dist/{chunk-63A2BU2B.js → chunk-T4MKFTJF.js} +2 -2
- package/dist/{chunk-E7ATID4Z.js → chunk-UFX24WNJ.js} +14 -14
- package/dist/{chunk-HQPFACXO.js → chunk-UH3FPX3L.js} +2 -2
- package/dist/{chunk-3LADDLAF.js → chunk-V5W67PQV.js} +4 -4
- package/dist/{chunk-PRC7SZYM.js → chunk-VAQIBC2L.js} +2 -2
- package/dist/{chunk-3Q3XD3NO.js → chunk-W2E2WFXL.js} +3 -3
- package/dist/{chunk-GF5NN3LE.js → chunk-W2UV6VE3.js} +2 -2
- package/dist/{chunk-SH3GOZWK.js → chunk-W35ICLYZ.js} +2 -2
- package/dist/{chunk-ALTLOHO7.js → chunk-WF2LYKOB.js} +2 -2
- package/dist/{chunk-FSXYBIEZ.js → chunk-X5MFCZDL.js} +72 -35
- package/dist/chunk-X5MFCZDL.js.map +1 -0
- package/dist/{chunk-FZVROZKC.js → chunk-XVZA6VXC.js} +4 -4
- package/dist/{chunk-IJVU4ILJ.js → chunk-XYNUEXLC.js} +4 -4
- package/dist/{chunk-RVAPK2S7.js → chunk-Y65XX5PC.js} +2 -2
- package/dist/{chunk-YWMCV5HL.js → chunk-YE77U5HZ.js} +3 -3
- package/dist/{chunk-VPEIWMUT.js → chunk-YLTU2DC4.js} +2 -2
- package/dist/{chunk-62YZOQFR.js → chunk-YRD525ZO.js} +2 -2
- package/dist/{chunk-TBBDFYXW.js → chunk-YVUNHNB6.js} +2 -3
- package/dist/chunk-YVUNHNB6.js.map +1 -0
- package/dist/{chunk-ITGAGNX5.js → chunk-YY5UXARJ.js} +24 -12
- package/dist/chunk-YY5UXARJ.js.map +1 -0
- package/dist/{chunk-U7KP6QFU.js → chunk-ZJ3CEAJD.js} +2 -2
- package/dist/{chunk-QC2MHZDD.js → chunk-ZOJUWVAU.js} +1 -1
- package/dist/{chunk-HH6PXQ2B.js → chunk-ZYP4YEEI.js} +2 -2
- package/dist/cli.js +124 -123
- package/dist/coding/export-okf-codegraph.js +21 -21
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compounding/engine.js +14 -14
- package/dist/config-deprecations.d.ts +3 -0
- package/dist/config-deprecations.d.ts.map +1 -0
- package/dist/config-deprecations.js +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +21 -20
- package/dist/connectors/codex-materialize-runner.js +13 -13
- package/dist/connectors/index.js +13 -13
- package/dist/convergence-refresh.js +16 -16
- package/dist/corpus-watermark.js +15 -15
- package/dist/correction/correction-access-wiring.d.ts +4 -1
- package/dist/correction/correction-access-wiring.d.ts.map +1 -1
- package/dist/deep-recall-http-glue.js +8 -8
- package/dist/deep-recall.js +2 -2
- package/dist/embedding-fallback.js +1 -1
- package/dist/entity-retrieval.js +14 -14
- package/dist/explicit-capture.js +124 -123
- package/dist/extraction-span-materialize.js +2 -2
- package/dist/extraction.js +22 -22
- package/dist/{first-start-migration-BPVJ4HJQ.js → first-start-migration-PPPP54X6.js} +5 -5
- package/dist/{graph-edge-decay-CXTNJ7IQ.js → graph-edge-decay-EKWXRBWF.js} +5 -5
- package/dist/graph-jsonl.js +3 -3
- package/dist/graph-snapshot.js +3 -3
- package/dist/graph.js +2 -2
- package/dist/harmonic-retrieval.js +13 -13
- package/dist/index.js +173 -171
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.js +4 -4
- package/dist/lifecycle.d.ts +0 -6
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +1 -1
- package/dist/location/index.js +25 -15
- package/dist/location/provider-setup.d.ts +26 -1
- package/dist/location/provider-setup.d.ts.map +1 -1
- package/dist/maintenance/memory-governance.js +14 -14
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +13 -13
- package/dist/maintenance/rebuild-memory-projection-runner.js +16 -16
- package/dist/maintenance/rebuild-memory-projection.js +15 -15
- package/dist/memory-browse.js +6 -6
- package/dist/{migrate-from-identity-anchor-MJYB6NNN.js → migrate-from-identity-anchor-TZSZXJ6L.js} +2 -2
- package/dist/migrate-from-identity-anchor-TZSZXJ6L.js.map +1 -0
- package/dist/model-registry.d.ts +0 -5
- package/dist/model-registry.d.ts.map +1 -1
- package/dist/model-registry.js +1 -1
- package/dist/namespaces/migrate.js +14 -14
- package/dist/namespaces/search.js +6 -6
- package/dist/namespaces/storage.js +13 -13
- package/dist/offline-sync-changeset-generations.js +3 -3
- package/dist/offline-sync-embedding-generation.js +2 -2
- package/dist/offline-sync-snapshot-stream.js +5 -5
- package/dist/offline-sync.js +4 -4
- package/dist/operator-doctor-corpus.js +16 -16
- package/dist/operator-toolkit.js +32 -31
- package/dist/orchestration/backlog-scheduler.js +125 -124
- package/dist/orchestration/backlog-scheduler.js.map +1 -1
- package/dist/orchestration/buffer-drain-runner.js +125 -124
- package/dist/orchestration/maintenance.js +22 -22
- package/dist/orchestration/semantic-consolidation-coordinator.d.ts.map +1 -1
- package/dist/orchestration/workspace-ops.d.ts.map +1 -1
- package/dist/orchestrator.js +124 -123
- package/dist/peers/index.d.ts +2 -1
- package/dist/peers/index.d.ts.map +1 -1
- package/dist/peers/index.js +3 -3
- package/dist/peers/interaction-log-append.d.ts +8 -0
- package/dist/peers/interaction-log-append.d.ts.map +1 -0
- package/dist/peers/storage.d.ts +22 -8
- package/dist/peers/storage.d.ts.map +1 -1
- package/dist/policy-runtime.js +2 -2
- package/dist/qmd.js +2 -2
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-navigate-access.js +2 -2
- package/dist/recall-navigate-disclosure.js +2 -2
- package/dist/recall-navigate.js +2 -2
- package/dist/recall-navigation.js +124 -123
- package/dist/recall-state-view-admission.js +6 -6
- package/dist/recall-why-service.js +6 -6
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.js +2 -2
- package/dist/resume-bundles.js +22 -21
- package/dist/retrieval.js +2 -2
- package/dist/search/factory.js +5 -5
- package/dist/search/index.js +9 -9
- package/dist/semantic-consolidation.d.ts +10 -16
- package/dist/semantic-consolidation.d.ts.map +1 -1
- package/dist/semantic-consolidation.js +14 -14
- package/dist/semantic-rule-promotion.js +13 -13
- package/dist/semantic-rule-verifier.js +13 -13
- package/dist/source-agent-qualifier.js +17 -17
- package/dist/standup/build.js +13 -13
- package/dist/storage/links-frontmatter.d.ts +3 -0
- package/dist/storage/links-frontmatter.d.ts.map +1 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +12 -12
- package/dist/summarizer.js +2 -2
- package/dist/tier-routing.js +2 -2
- package/dist/{tier-stats-FLFKN7Y6.js → tier-stats-XWJSVEHC.js} +5 -5
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/capsule-import.js +2 -2
- package/dist/transfer/export-okf.js +13 -13
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/utility-learner.js +2 -2
- package/dist/utility-runtime.js +3 -3
- package/dist/verified-recall.js +13 -13
- package/dist/who-knows-cli.js +14 -14
- package/dist/who-knows.js +13 -13
- package/package.json +2 -2
- package/src/access-recall-surface.ts +0 -2
- package/src/chat/chat-engine.ts +5 -3
- package/src/chat/chat-executor.test.ts +150 -0
- package/src/chat/chat-executor.ts +31 -20
- package/src/chat/chat-factory.ts +1 -1
- package/src/config-deprecations.ts +14 -0
- package/src/config.ts +2 -1
- package/src/correction/correction-access-wiring.ts +4 -1
- package/src/lifecycle.ts +0 -8
- package/src/location/provider-setup.test.ts +273 -2
- package/src/location/provider-setup.ts +138 -32
- package/src/model-registry.ts +0 -11
- package/src/orchestration/semantic-consolidation-coordinator.ts +40 -33
- package/src/orchestration/semantic-consolidation-split.test.ts +72 -0
- package/src/orchestration/workspace-ops.test.ts +23 -0
- package/src/orchestration/workspace-ops.ts +6 -5
- package/src/peers/index.ts +1 -1
- package/src/peers/interaction-log-append.ts +132 -0
- package/src/peers/peers.test.ts +30 -0
- package/src/peers/profile-reasoner.ts +1 -1
- package/src/peers/storage.ts +4 -105
- package/src/semantic-consolidation.ts +35 -27
- package/src/storage/links-frontmatter.ts +69 -0
- package/src/storage-links-parse.test.ts +153 -0
- package/src/storage.ts +4 -18
- package/src/testing/subjects/dependency-propagation.test.ts +5 -4
- package/src/types.ts +1 -0
- package/dist/chunk-32OTLNAU.js.map +0 -1
- package/dist/chunk-AHOYKJ5X.js.map +0 -1
- package/dist/chunk-FSXYBIEZ.js.map +0 -1
- package/dist/chunk-I74SUMNI.js.map +0 -1
- package/dist/chunk-ILNPU5W5.js.map +0 -1
- package/dist/chunk-ITGAGNX5.js.map +0 -1
- package/dist/chunk-TBBDFYXW.js.map +0 -1
- package/dist/chunk-XTRC6SSS.js.map +0 -1
- /package/dist/{chunk-FHWX2REL.js.map → chunk-2OAFPBQB.js.map} +0 -0
- /package/dist/{chunk-5IZL4DCV.js.map → chunk-4DF5LMBJ.js.map} +0 -0
- /package/dist/{chunk-FWTGO4NE.js.map → chunk-4DLGKTM6.js.map} +0 -0
- /package/dist/{chunk-D6YCETHG.js.map → chunk-4E2Z44CV.js.map} +0 -0
- /package/dist/{chunk-W4EJMMPP.js.map → chunk-4LVQSHHN.js.map} +0 -0
- /package/dist/{chunk-W4Q65VJL.js.map → chunk-4X7HQKAG.js.map} +0 -0
- /package/dist/{chunk-LPUEBFX2.js.map → chunk-5JCYPBY5.js.map} +0 -0
- /package/dist/{chunk-ID65XTF3.js.map → chunk-5SOSQTVE.js.map} +0 -0
- /package/dist/{chunk-SEIGLG62.js.map → chunk-6VFMEBXY.js.map} +0 -0
- /package/dist/{chunk-333SBFXB.js.map → chunk-7AAMJQFW.js.map} +0 -0
- /package/dist/{chunk-T3MCVSUC.js.map → chunk-A2XFG462.js.map} +0 -0
- /package/dist/{chunk-HXFIILGF.js.map → chunk-BFPF5N3H.js.map} +0 -0
- /package/dist/{chunk-GWY5ZFHP.js.map → chunk-BJOQQCYC.js.map} +0 -0
- /package/dist/{chunk-7OYDFIL4.js.map → chunk-CY2C5LM4.js.map} +0 -0
- /package/dist/{chunk-BFBS7OFQ.js.map → chunk-DC55RIEZ.js.map} +0 -0
- /package/dist/{chunk-TGQW3AMK.js.map → chunk-DNXQVCIC.js.map} +0 -0
- /package/dist/{chunk-TQ4CELUR.js.map → chunk-E53NLIAP.js.map} +0 -0
- /package/dist/{chunk-2LA3H54D.js.map → chunk-E5IZTY4W.js.map} +0 -0
- /package/dist/{chunk-PFR6ZKQI.js.map → chunk-EBI6FI5U.js.map} +0 -0
- /package/dist/{chunk-JN7OSQJR.js.map → chunk-ETTV5F53.js.map} +0 -0
- /package/dist/{chunk-FRYCXXTB.js.map → chunk-FSORYJRP.js.map} +0 -0
- /package/dist/{chunk-K36RMINQ.js.map → chunk-GOZXQNIM.js.map} +0 -0
- /package/dist/{chunk-H4IU24V5.js.map → chunk-GUF2JKG5.js.map} +0 -0
- /package/dist/{chunk-MTJFK42O.js.map → chunk-HHVK2JRE.js.map} +0 -0
- /package/dist/{chunk-D5ZLTLHF.js.map → chunk-HR3DKJCU.js.map} +0 -0
- /package/dist/{chunk-AUFPPBC3.js.map → chunk-IJKO5RVJ.js.map} +0 -0
- /package/dist/{chunk-O3OEVYUR.js.map → chunk-IK7NPYYU.js.map} +0 -0
- /package/dist/{chunk-ACPFBVUD.js.map → chunk-JDH2BA2P.js.map} +0 -0
- /package/dist/{chunk-VF6SC4OD.js.map → chunk-JNBSTHVT.js.map} +0 -0
- /package/dist/{chunk-OBPOIZNR.js.map → chunk-KBHUGMUW.js.map} +0 -0
- /package/dist/{chunk-M7CFCRWJ.js.map → chunk-KW4XA7GM.js.map} +0 -0
- /package/dist/{chunk-B5KTTWC7.js.map → chunk-L5EE2CXU.js.map} +0 -0
- /package/dist/{chunk-N3FRR6II.js.map → chunk-LAOJHOTG.js.map} +0 -0
- /package/dist/{chunk-QPLI7LUU.js.map → chunk-LH57QATU.js.map} +0 -0
- /package/dist/{chunk-JGGNUEVD.js.map → chunk-NDPS6OU2.js.map} +0 -0
- /package/dist/{chunk-UPD5XDJX.js.map → chunk-NKAGGDSL.js.map} +0 -0
- /package/dist/{chunk-G3RLCVJC.js.map → chunk-OGQL7QC7.js.map} +0 -0
- /package/dist/{chunk-K3FH3LAQ.js.map → chunk-OJXK5C6Z.js.map} +0 -0
- /package/dist/{chunk-HDLNSDLK.js.map → chunk-P3XO7HE3.js.map} +0 -0
- /package/dist/{chunk-VMRPLHEU.js.map → chunk-PQIFYBUX.js.map} +0 -0
- /package/dist/{chunk-WLT6LTQP.js.map → chunk-PRRWKTK6.js.map} +0 -0
- /package/dist/{chunk-CX24SVLK.js.map → chunk-Q7OKGBZY.js.map} +0 -0
- /package/dist/{chunk-BHRPZBAH.js.map → chunk-QJBULLKG.js.map} +0 -0
- /package/dist/{chunk-WCJQ3OUP.js.map → chunk-QKAFFVSO.js.map} +0 -0
- /package/dist/{chunk-VKXJQF5C.js.map → chunk-QKBFVLDH.js.map} +0 -0
- /package/dist/{chunk-I7WPLMUX.js.map → chunk-QRCE77YX.js.map} +0 -0
- /package/dist/{chunk-K2DTHNDY.js.map → chunk-R2AJAAHJ.js.map} +0 -0
- /package/dist/{chunk-5KDDAQ6K.js.map → chunk-R3UQIS3F.js.map} +0 -0
- /package/dist/{chunk-B3M56D2A.js.map → chunk-RDHEBINJ.js.map} +0 -0
- /package/dist/{chunk-3I3NXB6X.js.map → chunk-RHQL2RIM.js.map} +0 -0
- /package/dist/{chunk-FMIM36I4.js.map → chunk-SA2YALFU.js.map} +0 -0
- /package/dist/{chunk-DPL5VO5V.js.map → chunk-SAPC7N43.js.map} +0 -0
- /package/dist/{chunk-7FPI5MFB.js.map → chunk-SLWD7TB6.js.map} +0 -0
- /package/dist/{chunk-ZA6CYFAK.js.map → chunk-SOQOUZ2Y.js.map} +0 -0
- /package/dist/{chunk-VHXRLD6S.js.map → chunk-T2JZF45K.js.map} +0 -0
- /package/dist/{chunk-63A2BU2B.js.map → chunk-T4MKFTJF.js.map} +0 -0
- /package/dist/{chunk-E7ATID4Z.js.map → chunk-UFX24WNJ.js.map} +0 -0
- /package/dist/{chunk-HQPFACXO.js.map → chunk-UH3FPX3L.js.map} +0 -0
- /package/dist/{chunk-3LADDLAF.js.map → chunk-V5W67PQV.js.map} +0 -0
- /package/dist/{chunk-PRC7SZYM.js.map → chunk-VAQIBC2L.js.map} +0 -0
- /package/dist/{chunk-3Q3XD3NO.js.map → chunk-W2E2WFXL.js.map} +0 -0
- /package/dist/{chunk-GF5NN3LE.js.map → chunk-W2UV6VE3.js.map} +0 -0
- /package/dist/{chunk-SH3GOZWK.js.map → chunk-W35ICLYZ.js.map} +0 -0
- /package/dist/{chunk-ALTLOHO7.js.map → chunk-WF2LYKOB.js.map} +0 -0
- /package/dist/{chunk-FZVROZKC.js.map → chunk-XVZA6VXC.js.map} +0 -0
- /package/dist/{chunk-IJVU4ILJ.js.map → chunk-XYNUEXLC.js.map} +0 -0
- /package/dist/{chunk-RVAPK2S7.js.map → chunk-Y65XX5PC.js.map} +0 -0
- /package/dist/{chunk-YWMCV5HL.js.map → chunk-YE77U5HZ.js.map} +0 -0
- /package/dist/{chunk-VPEIWMUT.js.map → chunk-YLTU2DC4.js.map} +0 -0
- /package/dist/{chunk-62YZOQFR.js.map → chunk-YRD525ZO.js.map} +0 -0
- /package/dist/{chunk-U7KP6QFU.js.map → chunk-ZJ3CEAJD.js.map} +0 -0
- /package/dist/{chunk-QC2MHZDD.js.map → chunk-ZOJUWVAU.js.map} +0 -0
- /package/dist/{chunk-HH6PXQ2B.js.map → chunk-ZYP4YEEI.js.map} +0 -0
- /package/dist/{graph-edge-decay-CXTNJ7IQ.js.map → config-deprecations.js.map} +0 -0
- /package/dist/{first-start-migration-BPVJ4HJQ.js.map → first-start-migration-PPPP54X6.js.map} +0 -0
- /package/dist/{migrate-from-identity-anchor-MJYB6NNN.js.map → graph-edge-decay-EKWXRBWF.js.map} +0 -0
- /package/dist/{tier-stats-FLFKN7Y6.js.map → tier-stats-XWJSVEHC.js.map} +0 -0
package/src/peers/storage.ts
CHANGED
|
@@ -131,7 +131,7 @@ async function writeFileNoFollowIfAbsent(file: string, data: string): Promise<bo
|
|
|
131
131
|
|
|
132
132
|
/** Append to a file, refusing to follow symlinks AND verifying parent
|
|
133
133
|
* inode stability (codex P1 round 9). */
|
|
134
|
-
async function appendFileNoFollow(file: string, data: string): Promise<void> {
|
|
134
|
+
export async function appendFileNoFollow(file: string, data: string): Promise<void> {
|
|
135
135
|
await assertParentDirInodeStable(file);
|
|
136
136
|
const fh = await openNoFollow(
|
|
137
137
|
file,
|
|
@@ -274,7 +274,7 @@ async function assertPeersRootNotSymlink(memoryDir: string): Promise<void> {
|
|
|
274
274
|
* target. The dir handle is held across the mkdir, then we lstat
|
|
275
275
|
* the candidate and reject if it's a symlink.
|
|
276
276
|
*/
|
|
277
|
-
async function mkdirPeerDirAtomic(memoryDir: string, peerId: string): Promise<void> {
|
|
277
|
+
export async function mkdirPeerDirAtomic(memoryDir: string, peerId: string): Promise<void> {
|
|
278
278
|
const root = peersRoot(memoryDir);
|
|
279
279
|
// Ensure the root exists as a real directory, not a symlink. Use
|
|
280
280
|
// mkdir + lstat: if mkdir succeeds (or EEXIST), lstat must report
|
|
@@ -326,7 +326,7 @@ async function mkdirPeerDirAtomic(memoryDir: string, peerId: string): Promise<vo
|
|
|
326
326
|
* can lstat it and realpath-check containment. For first-time writes,
|
|
327
327
|
* call `mkdirPeerDirAtomic` BEFORE this; for reads, this alone.
|
|
328
328
|
*/
|
|
329
|
-
async function assertPeerDirNotEscaped(memoryDir: string, peerId: string): Promise<void> {
|
|
329
|
+
export async function assertPeerDirNotEscaped(memoryDir: string, peerId: string): Promise<void> {
|
|
330
330
|
const candidate = peerDir(memoryDir, peerId);
|
|
331
331
|
const root = peersRoot(memoryDir);
|
|
332
332
|
// 1. The peers root must not be a symlink (defensive — writers
|
|
@@ -361,7 +361,7 @@ function profilePath(memoryDir: string, peerId: string): string {
|
|
|
361
361
|
return path.join(peerDir(memoryDir, peerId), "profile.md");
|
|
362
362
|
}
|
|
363
363
|
|
|
364
|
-
function interactionsPath(memoryDir: string, peerId: string): string {
|
|
364
|
+
export function interactionsPath(memoryDir: string, peerId: string): string {
|
|
365
365
|
return path.join(peerDir(memoryDir, peerId), "interactions.log.md");
|
|
366
366
|
}
|
|
367
367
|
|
|
@@ -898,20 +898,6 @@ export async function listPeers(memoryDir: string): Promise<Peer[]> {
|
|
|
898
898
|
// Interaction log (append-only)
|
|
899
899
|
// ──────────────────────────────────────────────────────────────────────
|
|
900
900
|
|
|
901
|
-
function sanitizeLogField(value: string): string {
|
|
902
|
-
// Cursor Medium: every interaction-log field — not just summary —
|
|
903
|
-
// must collapse newlines so a malicious or buggy `timestamp` /
|
|
904
|
-
// `kind` / `sessionId` value can't break the one-line-per-entry
|
|
905
|
-
// invariant the append-only log relies on. Replace CR/LF/Tab with
|
|
906
|
-
// a single space; trim leading/trailing whitespace.
|
|
907
|
-
return value.replace(/[\r\n\t]+/g, " ").trim();
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
function isCanonicalIsoTimestamp(value: string): boolean {
|
|
911
|
-
const ms = Date.parse(value);
|
|
912
|
-
return Number.isFinite(ms) && new Date(ms).toISOString() === value;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
901
|
function parseIsoTimestampMs(value: string): number | null {
|
|
916
902
|
if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/.test(value)) {
|
|
917
903
|
return null;
|
|
@@ -920,93 +906,6 @@ function parseIsoTimestampMs(value: string): number | null {
|
|
|
920
906
|
return Number.isFinite(ms) ? ms : null;
|
|
921
907
|
}
|
|
922
908
|
|
|
923
|
-
function assertCanonicalIsoTimestamp(value: string, field: string): void {
|
|
924
|
-
if (!isCanonicalIsoTimestamp(value)) {
|
|
925
|
-
throw new Error(`${field} must be a canonical ISO-8601 timestamp`);
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
function formatLogEntry(entry: PeerInteractionLogEntry): string {
|
|
930
|
-
// One line per entry. We use a leading bullet so the file remains
|
|
931
|
-
// readable as ordinary markdown. Order: timestamp, kind, optional
|
|
932
|
-
// session id, summary. ALL fields are passed through `sanitizeLogField`
|
|
933
|
-
// so a stray newline anywhere can't shatter the append-only invariant
|
|
934
|
-
// (cursor Medium on PR #723).
|
|
935
|
-
//
|
|
936
|
-
// Cursor Low on PR #736: the previous bare `session=<id>` token was
|
|
937
|
-
// ambiguous with summaries that literally start with `session=`
|
|
938
|
-
// (e.g. summary `"session=foo bar"` round-tripped to
|
|
939
|
-
// `{sessionId: "foo", summary: "bar"}`). New entries wrap the
|
|
940
|
-
// session marker in square brackets — `[session=<id>]` — which a
|
|
941
|
-
// sanitized summary can never start with (sanitizeLogField never
|
|
942
|
-
// emits `[` as the first character of a summary that originally
|
|
943
|
-
// started with `session=`, and bracketed metadata is unambiguously
|
|
944
|
-
// distinct from `session=` text). Old entries written by previous
|
|
945
|
-
// code remain parseable through the legacy fallback in
|
|
946
|
-
// `parseLogLine`.
|
|
947
|
-
const ts = sanitizeLogField(entry.timestamp);
|
|
948
|
-
const kind = sanitizeLogField(entry.kind);
|
|
949
|
-
const summary = sanitizeLogField(entry.summary);
|
|
950
|
-
const session = entry.sessionId
|
|
951
|
-
? ` [session=${sanitizeLogField(entry.sessionId)}]`
|
|
952
|
-
: "";
|
|
953
|
-
return `- [${ts}] (${kind})${session} ${summary}`;
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
/**
|
|
957
|
-
* Append one entry to a peer's interaction log.
|
|
958
|
-
*
|
|
959
|
-
* Creates `peers/{id}/` and `interactions.log.md` if needed. The file is
|
|
960
|
-
* append-only by contract — this helper never rewrites prior entries.
|
|
961
|
-
* Returns the absolute path of the log file (useful for tests).
|
|
962
|
-
*/
|
|
963
|
-
export async function appendInteractionLog(
|
|
964
|
-
memoryDir: string,
|
|
965
|
-
peerId: string,
|
|
966
|
-
entry: PeerInteractionLogEntry,
|
|
967
|
-
): Promise<string> {
|
|
968
|
-
assertValidPeerId(peerId);
|
|
969
|
-
// Codex P2 round 10: trim() before the empty check matches what
|
|
970
|
-
// sanitizeLogField does at format time. A whitespace-only
|
|
971
|
-
// `timestamp` or `kind` would previously pass validation and then
|
|
972
|
-
// be normalized to "" later, producing an entry like `- [] ()`
|
|
973
|
-
// that breaks downstream parsers.
|
|
974
|
-
if (typeof entry.timestamp !== "string" || entry.timestamp.trim() === "") {
|
|
975
|
-
throw new Error("interaction entry must have a non-whitespace timestamp");
|
|
976
|
-
}
|
|
977
|
-
assertCanonicalIsoTimestamp(entry.timestamp.trim(), "interaction entry timestamp");
|
|
978
|
-
if (typeof entry.kind !== "string" || entry.kind.trim() === "") {
|
|
979
|
-
throw new Error("interaction entry must have a non-whitespace kind");
|
|
980
|
-
}
|
|
981
|
-
if (typeof entry.summary !== "string") {
|
|
982
|
-
throw new Error("interaction entry must have a string summary");
|
|
983
|
-
}
|
|
984
|
-
// Codex P2 round 6/8/9: optional sessionId must be a non-empty
|
|
985
|
-
// string OR strictly `undefined` (omitted). null and empty string
|
|
986
|
-
// are both rejected explicitly: the previous behavior silently
|
|
987
|
-
// dropped them during formatting, which reinterprets invalid input
|
|
988
|
-
// instead of failing fast like other validators in this module.
|
|
989
|
-
// Codex P2 round 12: trim() before the empty check matches what
|
|
990
|
-
// sanitizeLogField does at format time. Whitespace-only sessionId
|
|
991
|
-
// would otherwise pass validation and produce a `session=` token
|
|
992
|
-
// with an empty value that breaks downstream log parsers.
|
|
993
|
-
if (entry.sessionId !== undefined) {
|
|
994
|
-
if (typeof entry.sessionId !== "string" || entry.sessionId.trim() === "") {
|
|
995
|
-
throw new Error("interaction entry sessionId must be a non-whitespace string when provided");
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
await mkdirPeerDirAtomic(memoryDir, peerId);
|
|
999
|
-
await assertPeerDirNotEscaped(memoryDir, peerId);
|
|
1000
|
-
const file = interactionsPath(memoryDir, peerId);
|
|
1001
|
-
const line = formatLogEntry(entry) + "\n";
|
|
1002
|
-
// `appendFile` creates the file if it does not exist. POSIX guarantees
|
|
1003
|
-
// writes < PIPE_BUF are atomic; entries on this path are well under
|
|
1004
|
-
// that bound. Ordering across concurrent writers is the caller's
|
|
1005
|
-
// responsibility for now — the reasoner runs serially in PR 2/5.
|
|
1006
|
-
await appendFileNoFollow(file, line);
|
|
1007
|
-
return file;
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
909
|
// ──────────────────────────────────────────────────────────────────────
|
|
1011
910
|
// Profile read/write (schema scaffold; reasoner ships in PR 2/5)
|
|
1012
911
|
// ──────────────────────────────────────────────────────────────────────
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* Reduces memory store bloat while preserving all unique information.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
|
|
9
11
|
import type { MemoryFile, PluginConfig } from "./types.js";
|
|
10
12
|
import { normalizeRecallTokens, countRecallTokenOverlap } from "./recall-tokenization.js";
|
|
11
13
|
import { runPostConsolidationMaterialize } from "./connectors/codex-materialize-runner.js";
|
|
@@ -179,15 +181,16 @@ export function parseConsolidationResponse(response: string): string {
|
|
|
179
181
|
* Falls back to the heuristic default when the LLM omits or returns an
|
|
180
182
|
* unknown value (the parser never surfaces an invalid operator; see
|
|
181
183
|
* `parseOperatorAwareConsolidationResponse`).
|
|
182
|
-
* - `
|
|
183
|
-
*
|
|
184
|
+
* - `outputs` — the canonical memory bodies to persist, never empty.
|
|
185
|
+
* MERGE and UPDATE always carry exactly one; SPLIT carries one body per
|
|
186
|
+
* separated fact (#3566).
|
|
184
187
|
*/
|
|
185
188
|
export interface OperatorAwareConsolidationResult {
|
|
186
189
|
// Restricted to the LLM-allowed subset (Cursor Bugbot, PR #730):
|
|
187
190
|
// `pattern-reinforcement` is reserved for the maintenance job and
|
|
188
191
|
// must never reach this struct from a consolidation LLM response.
|
|
189
192
|
operator: _SemanticConsolidationLlmOperator;
|
|
190
|
-
|
|
193
|
+
outputs: string[];
|
|
191
194
|
}
|
|
192
195
|
|
|
193
196
|
/**
|
|
@@ -203,11 +206,9 @@ export interface OperatorAwareConsolidationResult {
|
|
|
203
206
|
* - A cluster of size 1 that still reaches consolidation (future path,
|
|
204
207
|
* e.g. supersession of a single older memory by a newer value) is an
|
|
205
208
|
* UPDATE.
|
|
206
|
-
* - SPLIT is never selected by the heuristic
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* logical source actually encodes several distinct facts — at which
|
|
210
|
-
* point the orchestrator would need to write multiple outputs.
|
|
209
|
+
* - SPLIT is never selected by the heuristic: only the LLM can decide
|
|
210
|
+
* that one logical source encodes several distinct facts. When it
|
|
211
|
+
* does, the coordinator writes one canonical memory per output.
|
|
211
212
|
*/
|
|
212
213
|
export function chooseConsolidationOperator(
|
|
213
214
|
cluster: ConsolidationCluster,
|
|
@@ -217,14 +218,9 @@ export function chooseConsolidationOperator(
|
|
|
217
218
|
}
|
|
218
219
|
|
|
219
220
|
/**
|
|
220
|
-
* Build the operator-aware LLM prompt.
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
* The prompt is additive: it still asks for a single canonical blob under
|
|
224
|
-
* `output`, so the upstream write path does not change. Future expansions
|
|
225
|
-
* (SPLIT emitting multiple outputs) are explicitly documented as
|
|
226
|
-
* out-of-scope for the parser — `parseOperatorAwareConsolidationResponse`
|
|
227
|
-
* collapses any SPLIT response into a single canonical output for now.
|
|
221
|
+
* Build the operator-aware LLM prompt. MERGE and UPDATE return
|
|
222
|
+
* `{ "operator", "output" }`; SPLIT returns `{ "operator": "split",
|
|
223
|
+
* "outputs": [...] }` with one canonical body per separated fact (#3566).
|
|
228
224
|
*/
|
|
229
225
|
export function buildOperatorAwareConsolidationPrompt(
|
|
230
226
|
cluster: ConsolidationCluster,
|
|
@@ -243,20 +239,26 @@ Pick exactly ONE consolidation operator for this cluster and return a JSON objec
|
|
|
243
239
|
Operator vocabulary:
|
|
244
240
|
- "merge" — multiple distinct source memories overlap and should be collapsed into one canonical memory (most common).
|
|
245
241
|
- "update" — one source memory carries a stale value that a newer source supersedes within the same logical fact.
|
|
246
|
-
- "split" — a single logical source really encodes multiple distinct facts that should be separated (rare
|
|
242
|
+
- "split" — a single logical source really encodes multiple distinct facts that should be separated (rare). For split, replace "output" with "outputs": an array holding one canonical memory text per separated fact.
|
|
247
243
|
|
|
248
244
|
Output JSON ONLY, no prose before or after. The "operator" key MUST be set to exactly one of the three strings "merge", "update", or "split" — never a pipe-separated placeholder like "merge|update|split". Example shape:
|
|
249
245
|
{
|
|
250
246
|
"operator": "merge",
|
|
251
247
|
"output": "<the canonical memory text>"
|
|
252
248
|
}
|
|
249
|
+
Split shape:
|
|
250
|
+
{
|
|
251
|
+
"operator": "split",
|
|
252
|
+
"outputs": ["<first fact>", "<second fact>"]
|
|
253
|
+
}
|
|
253
254
|
|
|
254
|
-
|
|
255
|
+
Each canonical memory text must:
|
|
255
256
|
1. Preserve ALL unique information from every source memory
|
|
256
257
|
2. Remove redundancy and repetition
|
|
257
258
|
3. Use clear, concise language
|
|
258
259
|
4. Match the "${cluster.category}" category and tone
|
|
259
260
|
5. NOT add information that isn't in the sources
|
|
261
|
+
For split, the outputs together must hold all of the source information, and each output holds one fact.
|
|
260
262
|
|
|
261
263
|
${memoryTexts}
|
|
262
264
|
|
|
@@ -283,7 +285,7 @@ export function parseOperatorAwareConsolidationResponse(
|
|
|
283
285
|
): OperatorAwareConsolidationResult {
|
|
284
286
|
const fallback: OperatorAwareConsolidationResult = {
|
|
285
287
|
operator: chooseConsolidationOperator(cluster),
|
|
286
|
-
|
|
288
|
+
outputs: [response.trim()],
|
|
287
289
|
};
|
|
288
290
|
|
|
289
291
|
const trimmed = response.trim();
|
|
@@ -302,13 +304,10 @@ export function parseOperatorAwareConsolidationResponse(
|
|
|
302
304
|
// `Example: {"note":"..."} ... {"operator":"merge",...}`). Walk the
|
|
303
305
|
// payload tracking nesting + string/escape state and skip past
|
|
304
306
|
// objects that don't look like our target shape.
|
|
305
|
-
const
|
|
306
|
-
if (
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
const obj = parsed as Record<string, unknown>;
|
|
310
|
-
const rawOperator = typeof obj.operator === "string" ? obj.operator.trim().toLowerCase() : "";
|
|
311
|
-
const rawOutput = typeof obj.output === "string" ? obj.output : "";
|
|
307
|
+
const reply = CONSOLIDATION_LLM_REPLY.safeParse(findLastJsonObjectWithOperator(payload));
|
|
308
|
+
if (!reply.success) return fallback;
|
|
309
|
+
const rawOperator = reply.data.operator?.trim().toLowerCase() ?? "";
|
|
310
|
+
const rawOutput = reply.data.output ?? "";
|
|
312
311
|
|
|
313
312
|
// Narrow gate (Cursor Bugbot review on PR #730 head `aa1c2a8`):
|
|
314
313
|
// accept ONLY the legacy split/merge/update LLM vocabulary here.
|
|
@@ -320,10 +319,19 @@ export function parseOperatorAwareConsolidationResponse(
|
|
|
320
319
|
? rawOperator
|
|
321
320
|
: chooseConsolidationOperator(cluster);
|
|
322
321
|
const output = rawOutput.trim().length > 0 ? rawOutput.trim() : response.trim();
|
|
322
|
+
const splitOutputs = (reply.data.outputs ?? []).map((entry) => entry.trim()).filter((entry) => entry.length > 0);
|
|
323
|
+
if (operator === "split" && splitOutputs.length > 0) return { operator, outputs: splitOutputs };
|
|
323
324
|
|
|
324
|
-
return { operator, output };
|
|
325
|
+
return { operator, outputs: [output] };
|
|
325
326
|
}
|
|
326
327
|
|
|
328
|
+
// Fields read from the model's JSON object; a wrong-typed field reads as absent.
|
|
329
|
+
const CONSOLIDATION_LLM_REPLY = z.object({
|
|
330
|
+
operator: z.string().optional().catch(undefined),
|
|
331
|
+
output: z.string().optional().catch(undefined),
|
|
332
|
+
outputs: z.array(z.string()).optional().catch(undefined),
|
|
333
|
+
});
|
|
334
|
+
|
|
327
335
|
/**
|
|
328
336
|
* Walk `text`, find all balanced top-level `{ ... }` blocks whose
|
|
329
337
|
* JSON.parse result is an object with an `operator` key, and return
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { MemoryLink } from "../types.js";
|
|
2
|
+
|
|
3
|
+
// Parse links: block-sequence items of "key: value" fields under the
|
|
4
|
+
// links: key. Field order is free; an item missing targetId, a known
|
|
5
|
+
// linkType, or a 0-1 strength drops alone (issue #3568). Fields must sit
|
|
6
|
+
// at the item's own key column — deeper lines are nested scalar content
|
|
7
|
+
// (e.g. a "note: |" block), not link fields.
|
|
8
|
+
export function parseFrontmatterLinks(
|
|
9
|
+
fmBlock: string,
|
|
10
|
+
parseReason: (raw: string) => string,
|
|
11
|
+
): MemoryLink[] | undefined {
|
|
12
|
+
const fmLines = fmBlock.split("\n");
|
|
13
|
+
const linksKeyIdx = fmLines.findIndex((l) => l.trimEnd() === "links:");
|
|
14
|
+
if (linksKeyIdx === -1) return undefined;
|
|
15
|
+
|
|
16
|
+
const linksIndent = fmLines[linksKeyIdx].search(/\S/);
|
|
17
|
+
const items: Record<string, string>[] = [];
|
|
18
|
+
let fieldIndent = -1;
|
|
19
|
+
let itemIndent = -1;
|
|
20
|
+
for (let k = linksKeyIdx + 1; k < fmLines.length; k++) {
|
|
21
|
+
const line = fmLines[k];
|
|
22
|
+
const t = line.trim();
|
|
23
|
+
if (!t || t.startsWith("#")) continue;
|
|
24
|
+
const indent = line.search(/\S/);
|
|
25
|
+
if (indent <= linksIndent) break;
|
|
26
|
+
if (t.startsWith("- ")) {
|
|
27
|
+
if (itemIndent === -1) itemIndent = indent;
|
|
28
|
+
if (indent !== itemIndent) continue;
|
|
29
|
+
items.push({});
|
|
30
|
+
const inline = t.slice(2);
|
|
31
|
+
const colon = inline.indexOf(":");
|
|
32
|
+
fieldIndent = colon > 0 ? indent + 2 : -1;
|
|
33
|
+
if (colon > 0) {
|
|
34
|
+
items[items.length - 1][inline.slice(0, colon).trim()] = inline.slice(colon + 1).trim();
|
|
35
|
+
}
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (items.length === 0) continue;
|
|
39
|
+
const colon = t.indexOf(":");
|
|
40
|
+
if (colon <= 0) continue;
|
|
41
|
+
if (fieldIndent === -1) fieldIndent = indent;
|
|
42
|
+
if (indent !== fieldIndent) continue;
|
|
43
|
+
items[items.length - 1][t.slice(0, colon).trim()] = t.slice(colon + 1).trim();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const links: MemoryLink[] = [];
|
|
47
|
+
for (const item of items) {
|
|
48
|
+
const strength = item.strength ? Number(item.strength) : NaN;
|
|
49
|
+
if (
|
|
50
|
+
!item.targetId ||
|
|
51
|
+
!["follows", "references", "contradicts", "supports", "related"].includes(item.linkType ?? "") ||
|
|
52
|
+
!Number.isFinite(strength) ||
|
|
53
|
+
strength < 0 ||
|
|
54
|
+
strength > 1
|
|
55
|
+
) continue;
|
|
56
|
+
links.push({
|
|
57
|
+
targetId: item.targetId,
|
|
58
|
+
// SAFETY: linkType passed the closed literal list in the guard
|
|
59
|
+
// above, so the string narrows to MemoryLink["linkType"].
|
|
60
|
+
linkType: item.linkType as MemoryLink["linkType"],
|
|
61
|
+
strength,
|
|
62
|
+
reason:
|
|
63
|
+
item.reason?.startsWith('"') && item.reason.endsWith('"')
|
|
64
|
+
? parseReason(item.reason.slice(1, -1))
|
|
65
|
+
: item.reason,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return links.length > 0 ? links : undefined;
|
|
69
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import * as assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
|
|
4
|
+
import { parseFrontmatter } from "./storage.js";
|
|
5
|
+
|
|
6
|
+
const BODY = "body text\n";
|
|
7
|
+
|
|
8
|
+
test("links: block items parse regardless of field order (issue #3568)", () => {
|
|
9
|
+
const raw = `---
|
|
10
|
+
links:
|
|
11
|
+
- strength: 0.8
|
|
12
|
+
targetId: mem-a
|
|
13
|
+
linkType: related
|
|
14
|
+
---
|
|
15
|
+
${BODY}`;
|
|
16
|
+
const links = parseFrontmatter(raw)?.frontmatter.links;
|
|
17
|
+
assert.deepEqual(links, [
|
|
18
|
+
{ targetId: "mem-a", linkType: "related", strength: 0.8, reason: undefined },
|
|
19
|
+
]);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("links: items round-trip in the serializer's own order", () => {
|
|
23
|
+
const raw = `---
|
|
24
|
+
links:
|
|
25
|
+
- targetId: mem-a
|
|
26
|
+
linkType: related
|
|
27
|
+
strength: 0.8
|
|
28
|
+
reason: "because \\"quoted\\""
|
|
29
|
+
- targetId: mem-b
|
|
30
|
+
linkType: contradicts
|
|
31
|
+
strength: 0.2
|
|
32
|
+
---
|
|
33
|
+
${BODY}`;
|
|
34
|
+
const links = parseFrontmatter(raw)?.frontmatter.links;
|
|
35
|
+
assert.equal(links?.length, 2);
|
|
36
|
+
assert.equal(links?.[0]?.reason, 'because "quoted"');
|
|
37
|
+
assert.equal(links?.[1]?.targetId, "mem-b");
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test("links: a corrupt item drops without losing its siblings", () => {
|
|
41
|
+
const raw = `---
|
|
42
|
+
links:
|
|
43
|
+
- targetId: mem-a
|
|
44
|
+
linkType: related
|
|
45
|
+
strength: 0.8
|
|
46
|
+
- targetId: mem-b
|
|
47
|
+
linkType: related
|
|
48
|
+
- targetId: mem-c
|
|
49
|
+
linkType: bogus-type
|
|
50
|
+
strength: 0.5
|
|
51
|
+
- targetId: mem-d
|
|
52
|
+
linkType: supports
|
|
53
|
+
strength: 1.5
|
|
54
|
+
---
|
|
55
|
+
${BODY}`;
|
|
56
|
+
const links = parseFrontmatter(raw)?.frontmatter.links;
|
|
57
|
+
assert.deepEqual(links, [
|
|
58
|
+
{ targetId: "mem-a", linkType: "related", strength: 0.8, reason: undefined },
|
|
59
|
+
]);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test("links: a link-shaped string inside another scalar makes no phantom link", () => {
|
|
63
|
+
const raw = `---
|
|
64
|
+
description: "note - targetId: mem-x linkType: related strength: 0.9 inside"
|
|
65
|
+
---
|
|
66
|
+
${BODY}`;
|
|
67
|
+
const links = parseFrontmatter(raw)?.frontmatter.links;
|
|
68
|
+
assert.equal(links, undefined);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test("links: a standalone comment between items does not truncate the list", () => {
|
|
72
|
+
const raw = `---
|
|
73
|
+
links:
|
|
74
|
+
- targetId: mem-a
|
|
75
|
+
linkType: related
|
|
76
|
+
strength: 0.8
|
|
77
|
+
# next link
|
|
78
|
+
- targetId: mem-b
|
|
79
|
+
linkType: supports
|
|
80
|
+
strength: 0.5
|
|
81
|
+
---
|
|
82
|
+
${BODY}`;
|
|
83
|
+
const links = parseFrontmatter(raw)?.frontmatter.links;
|
|
84
|
+
assert.equal(links?.length, 2);
|
|
85
|
+
assert.equal(links?.[1]?.targetId, "mem-b");
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test("links: block-scalar content inside an item cannot overwrite link fields", () => {
|
|
89
|
+
const raw = `---
|
|
90
|
+
links:
|
|
91
|
+
- targetId: mem-a
|
|
92
|
+
linkType: related
|
|
93
|
+
strength: 0.8
|
|
94
|
+
note: |
|
|
95
|
+
targetId: mem-x
|
|
96
|
+
linkType: contradicts
|
|
97
|
+
strength: 0.9
|
|
98
|
+
---
|
|
99
|
+
${BODY}`;
|
|
100
|
+
const links = parseFrontmatter(raw)?.frontmatter.links;
|
|
101
|
+
assert.deepEqual(links, [
|
|
102
|
+
{ targetId: "mem-a", linkType: "related", strength: 0.8, reason: undefined },
|
|
103
|
+
]);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test("links: a dash line inside nested scalar content is not a new item", () => {
|
|
107
|
+
const raw = `---
|
|
108
|
+
links:
|
|
109
|
+
- targetId: mem-a
|
|
110
|
+
linkType: related
|
|
111
|
+
strength: 0.8
|
|
112
|
+
note: |
|
|
113
|
+
- targetId: mem-x
|
|
114
|
+
linkType: contradicts
|
|
115
|
+
strength: 0.9
|
|
116
|
+
---
|
|
117
|
+
${BODY}`;
|
|
118
|
+
const links = parseFrontmatter(raw)?.frontmatter.links;
|
|
119
|
+
assert.deepEqual(links, [
|
|
120
|
+
{ targetId: "mem-a", linkType: "related", strength: 0.8, reason: undefined },
|
|
121
|
+
]);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test("links: an empty strength drops the item, strength 0 stays valid", () => {
|
|
125
|
+
const raw = `---
|
|
126
|
+
links:
|
|
127
|
+
- targetId: mem-a
|
|
128
|
+
linkType: related
|
|
129
|
+
strength:
|
|
130
|
+
- targetId: mem-b
|
|
131
|
+
linkType: supports
|
|
132
|
+
strength: 0
|
|
133
|
+
---
|
|
134
|
+
${BODY}`;
|
|
135
|
+
const links = parseFrontmatter(raw)?.frontmatter.links;
|
|
136
|
+
assert.deepEqual(links, [
|
|
137
|
+
{ targetId: "mem-b", linkType: "supports", strength: 0, reason: undefined },
|
|
138
|
+
]);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test("links: unknown keys on an item do not drop the link", () => {
|
|
142
|
+
const raw = `---
|
|
143
|
+
links:
|
|
144
|
+
- targetId: mem-a
|
|
145
|
+
linkType: related
|
|
146
|
+
strength: 0.8
|
|
147
|
+
created: 2026-11-21
|
|
148
|
+
---
|
|
149
|
+
${BODY}`;
|
|
150
|
+
const links = parseFrontmatter(raw)?.frontmatter.links;
|
|
151
|
+
assert.equal(links?.length, 1);
|
|
152
|
+
assert.equal(links?.[0]?.targetId, "mem-a");
|
|
153
|
+
});
|
package/src/storage.ts
CHANGED
|
@@ -29,6 +29,7 @@ import { MemoryReadStore, readWindowedMemories, type WindowedMemoryReadOptions,
|
|
|
29
29
|
import { runCommittedInvalidation } from "./storage/committed-invalidation.js";
|
|
30
30
|
import { renderProfileWithLastUpdated, stripOkfProfileFrontmatter, withOkfProfileFrontmatter } from "./storage/profile-header.js";
|
|
31
31
|
import { appendToProfileSerialized, commitConsolidatedProfileSerialized, type ProfileMutationPorts } from "./storage/profile-mutation.js";
|
|
32
|
+
import { parseFrontmatterLinks } from "./storage/links-frontmatter.js";
|
|
32
33
|
import { parseQuestionFile as parseQuestionFileText } from "./storage/questions-file.js";
|
|
33
34
|
import { assertNotOkfReservedBasename, OKF_QUESTION_TYPE, okfTypeForEntityKind, okfTypeForMemory } from "./okf/type-mapping.js";
|
|
34
35
|
import { appendContextTransformRecords, readContextTransformRecords } from "./storage/context-transform-ledger.js";
|
|
@@ -954,24 +955,9 @@ export function parseFrontmatter(raw: string): { frontmatter: MemoryFrontmatter;
|
|
|
954
955
|
content,
|
|
955
956
|
};
|
|
956
957
|
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
const links: MemoryLink[] = [];
|
|
961
|
-
const linkMatches = fmBlock.matchAll(
|
|
962
|
-
/- targetId: (\S+)\s+linkType: (\S+)\s+strength: ([\d.]+)(?:\s+reason: "((?:\\.|[^"\\])*)")?/g
|
|
963
|
-
);
|
|
964
|
-
for (const match of linkMatches) {
|
|
965
|
-
links.push({
|
|
966
|
-
targetId: match[1],
|
|
967
|
-
linkType: match[2] as MemoryLink["linkType"],
|
|
968
|
-
strength: parseFloat(match[3]),
|
|
969
|
-
reason: match[4] ? parseLinkReasonValue(match[4]) : undefined,
|
|
970
|
-
});
|
|
971
|
-
}
|
|
972
|
-
if (links.length > 0) {
|
|
973
|
-
result.frontmatter.links = links;
|
|
974
|
-
}
|
|
958
|
+
const links = parseFrontmatterLinks(fmBlock, parseLinkReasonValue);
|
|
959
|
+
if (links) {
|
|
960
|
+
result.frontmatter.links = links;
|
|
975
961
|
}
|
|
976
962
|
|
|
977
963
|
return result;
|
|
@@ -123,10 +123,11 @@ function namespaceMemories(namespace: NamespaceName): MemoryFile[] {
|
|
|
123
123
|
|
|
124
124
|
function serializeFixture(memory: MemoryFile): string {
|
|
125
125
|
const links = (memory.frontmatter.links ?? [])
|
|
126
|
-
.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
.flatMap((link) => [
|
|
127
|
+
` - targetId: ${link.targetId}`,
|
|
128
|
+
` linkType: ${link.linkType}`,
|
|
129
|
+
` strength: ${link.strength ?? 0.9}`,
|
|
130
|
+
])
|
|
130
131
|
.join("\n");
|
|
131
132
|
return [
|
|
132
133
|
"---",
|
package/src/types.ts
CHANGED
|
@@ -1884,6 +1884,7 @@ export interface PluginConfig
|
|
|
1884
1884
|
cmcBehaviorMinFrequency: number;
|
|
1885
1885
|
cmcBehaviorMinSessions: number;
|
|
1886
1886
|
cmcBehaviorConfidenceThreshold: number;
|
|
1887
|
+
/** @deprecated No effect: lifecycle scoring has no causal impact signal (#3667). Parsed so existing configs load. */
|
|
1887
1888
|
cmcLifecycleCausalImpactWeight: number;
|
|
1888
1889
|
|
|
1889
1890
|
// PEDC (Prediction-Error-Driven Calibration) — model-user alignment
|