@remnic/core 10.0.169 → 10.0.170
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/{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-32OTLNAU.js → chunk-5YIOUS5T.js} +203 -198
- package/dist/chunk-5YIOUS5T.js.map +1 -0
- 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-7FPI5MFB.js → chunk-QMFHKWHN.js} +5 -5
- 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-ZA6CYFAK.js → chunk-SOQOUZ2Y.js} +2 -2
- package/dist/{chunk-VHXRLD6S.js → chunk-T2JZF45K.js} +2 -2
- 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/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/config-deprecations.ts +14 -0
- package/src/config.ts +2 -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-7FPI5MFB.js.map → chunk-QMFHKWHN.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-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
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
|
|
4
|
+
import { parseConfig } from "../config.js";
|
|
5
|
+
import type { LocalLlmClient } from "../local-llm.js";
|
|
6
|
+
import type { StorageManager } from "../storage.js";
|
|
7
|
+
import type { MemoryFile } from "../types.js";
|
|
8
|
+
import { SemanticConsolidationCoordinator } from "./semantic-consolidation-coordinator.js";
|
|
9
|
+
|
|
10
|
+
function makeMemory(index: number): MemoryFile {
|
|
11
|
+
const created = `2026-04-${String(10 + index).padStart(2, "0")}T00:00:00Z`;
|
|
12
|
+
return {
|
|
13
|
+
path: `/memory/facts/m${index}.md`,
|
|
14
|
+
frontmatter: {
|
|
15
|
+
id: `m${index}`,
|
|
16
|
+
category: "fact",
|
|
17
|
+
created,
|
|
18
|
+
updated: created,
|
|
19
|
+
source: "extraction",
|
|
20
|
+
confidence: 0.8,
|
|
21
|
+
confidenceTier: "implied",
|
|
22
|
+
tags: [],
|
|
23
|
+
},
|
|
24
|
+
content: "The deploy runs on Fridays and the release notes go to the team channel.",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
test("a SPLIT response writes one memory per output and archives sources against all of them (#3566)", async () => {
|
|
29
|
+
const memories = Array.from({ length: 10 }, (_, i) => makeMemory(i));
|
|
30
|
+
const written: string[] = [];
|
|
31
|
+
const archived: Array<{ id: string; related: string[] }> = [];
|
|
32
|
+
const fakeStorage = {
|
|
33
|
+
dir: "/memory",
|
|
34
|
+
readAllMemories: async () => memories,
|
|
35
|
+
snapshotForProvenance: async () => null,
|
|
36
|
+
writeSealedMemory: async (envelope: { content: string }) => {
|
|
37
|
+
written.push(envelope.content);
|
|
38
|
+
return { id: `canonical-${written.length}`, tombstoneBlocked: false };
|
|
39
|
+
},
|
|
40
|
+
archiveMemory: async (memory: MemoryFile, lifecycle?: { relatedMemoryIds?: string[] }) => {
|
|
41
|
+
archived.push({ id: memory.frontmatter.id, related: lifecycle?.relatedMemoryIds ?? [] });
|
|
42
|
+
return `/memory/archive/${memory.frontmatter.id}.md`;
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
const fakeFastLlm = {
|
|
46
|
+
chatCompletion: async () => ({
|
|
47
|
+
content: JSON.stringify({
|
|
48
|
+
operator: "split",
|
|
49
|
+
outputs: ["The deploy runs on Fridays.", "Release notes go to the team channel."],
|
|
50
|
+
}),
|
|
51
|
+
}),
|
|
52
|
+
};
|
|
53
|
+
const coordinator = new SemanticConsolidationCoordinator({
|
|
54
|
+
config: parseConfig({ operatorAwareConsolidationEnabled: true, semanticConsolidationModel: "fast" }),
|
|
55
|
+
// SAFETY: the coordinator only calls the five members the fake defines on this path.
|
|
56
|
+
getStorage: (): StorageManager => fakeStorage as never,
|
|
57
|
+
// SAFETY: the fast-LLM path only calls chatCompletion.
|
|
58
|
+
getFastLlm: (): LocalLlmClient => fakeFastLlm as never,
|
|
59
|
+
// SAFETY: archival only calls removeFromIndex.
|
|
60
|
+
embeddingFallback: { removeFromIndex: async () => {} } as never,
|
|
61
|
+
removeContentHashForMemory: async () => {},
|
|
62
|
+
saveContentHashIndexes: async () => {},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const result = await coordinator.runSemanticConsolidation({ force: true });
|
|
66
|
+
|
|
67
|
+
assert.ok(result.clustersFound >= 1, `expected a cluster, got ${result.clustersFound}`);
|
|
68
|
+
assert.equal(result.errors, 0);
|
|
69
|
+
assert.deepEqual(written, ["The deploy runs on Fridays.", "Release notes go to the team channel."]);
|
|
70
|
+
assert.ok(archived.length > 0);
|
|
71
|
+
for (const entry of archived) assert.deepEqual(entry.related, ["canonical-1", "canonical-2"]);
|
|
72
|
+
});
|
|
@@ -510,3 +510,26 @@ test("flushAccessTracking tries the plain path before the QMD collection candida
|
|
|
510
510
|
await coordinator.flushAccessTracking();
|
|
511
511
|
assert.deepEqual(out.flushed.map((e) => [e.memoryPath, e.newCount]), [[viaPlainPath, 51]]);
|
|
512
512
|
});
|
|
513
|
+
|
|
514
|
+
test("validateLocalLlmModel warns to update persisted config instead of mutating it — #3562", async () => {
|
|
515
|
+
// The validator detected config.localLlmMaxContext > the loaded model's
|
|
516
|
+
// real window and silently rewrote the shared config object via a cast.
|
|
517
|
+
// The contract: validation warns the user to fix their persisted config;
|
|
518
|
+
// the config object is never mutated behind consumers' backs.
|
|
519
|
+
const config = { localLlmMaxContext: 131072 };
|
|
520
|
+
// SAFETY: validateLocalLlmModel reads only config + localLlm; the
|
|
521
|
+
// remaining WorkspaceOpsDeps members are unused by this method.
|
|
522
|
+
// oxlint-disable-next-line anti-slop/no-chained-type-assertions -- the test stub is a deps partial
|
|
523
|
+
const coordinator = new WorkspaceOpsCoordinator({
|
|
524
|
+
config,
|
|
525
|
+
localLlm: {
|
|
526
|
+
getLoadedModelInfo: async () => ({ id: "qwen-local", contextWindow: 32768 }),
|
|
527
|
+
},
|
|
528
|
+
} as unknown as WorkspaceOpsDeps);
|
|
529
|
+
await coordinator.validateLocalLlmModel();
|
|
530
|
+
assert.equal(
|
|
531
|
+
config.localLlmMaxContext,
|
|
532
|
+
131072,
|
|
533
|
+
"validateLocalLlmModel must not rewrite config.localLlmMaxContext",
|
|
534
|
+
);
|
|
535
|
+
});
|
|
@@ -634,15 +634,16 @@ export class WorkspaceOpsCoordinator {
|
|
|
634
634
|
configuredMaxContext &&
|
|
635
635
|
configuredMaxContext > modelInfo.contextWindow
|
|
636
636
|
) {
|
|
637
|
+
// Warn — never rewrite the shared config behind consumers'
|
|
638
|
+
// backs (#3562). The user owns the persisted value; an
|
|
639
|
+
// oversized localLlmMaxContext stays in effect until they
|
|
640
|
+
// lower it, and prompts may exceed the model's window.
|
|
637
641
|
log.warn(
|
|
638
642
|
`Local LLM context mismatch: engram configured for ${configuredMaxContext.toLocaleString()} tokens, ` +
|
|
639
643
|
`but ${modelInfo.id} only supports ${modelInfo.contextWindow.toLocaleString()}. ` +
|
|
640
|
-
`
|
|
644
|
+
`Set localLlmMaxContext to ${modelInfo.contextWindow.toLocaleString()} or lower in your ` +
|
|
645
|
+
`persisted config to avoid context-length errors.`,
|
|
641
646
|
);
|
|
642
|
-
// Update the config in-memory to match actual capability
|
|
643
|
-
// (This is a temporary fix - user should update their config)
|
|
644
|
-
(this.deps.config as { localLlmMaxContext?: number }).localLlmMaxContext =
|
|
645
|
-
modelInfo.contextWindow;
|
|
646
647
|
}
|
|
647
648
|
} else {
|
|
648
649
|
log.debug(
|
package/src/peers/index.ts
CHANGED
|
@@ -30,12 +30,12 @@ export {
|
|
|
30
30
|
deletePeer,
|
|
31
31
|
forgetPeer,
|
|
32
32
|
listPeers,
|
|
33
|
-
appendInteractionLog,
|
|
34
33
|
readInteractionLogRaw,
|
|
35
34
|
readPeerInteractionLog,
|
|
36
35
|
readPeerProfile,
|
|
37
36
|
writePeerProfile,
|
|
38
37
|
} from "./storage.js";
|
|
38
|
+
export { appendInteractionLog } from "./interaction-log-append.js";
|
|
39
39
|
|
|
40
40
|
export {
|
|
41
41
|
runPeerProfileReasoner,
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* peers/interaction-log-append.ts — append path for the peer
|
|
3
|
+
* interaction log, extracted from storage.ts (#1995 ratchet: the file
|
|
4
|
+
* exceeded its grandfathered ceiling). Read/parse stays in storage.ts.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
|
|
9
|
+
import type { PeerInteractionLogEntry } from "./types.js";
|
|
10
|
+
import {
|
|
11
|
+
appendFileNoFollow,
|
|
12
|
+
assertPeerDirNotEscaped,
|
|
13
|
+
assertValidPeerId,
|
|
14
|
+
interactionsPath,
|
|
15
|
+
mkdirPeerDirAtomic,
|
|
16
|
+
} from "./storage.js";
|
|
17
|
+
|
|
18
|
+
// Boundary decode for the untrusted entry argument. The checks below
|
|
19
|
+
// carry the Codex P2 review history: trim() before the empty check
|
|
20
|
+
// matches what sanitizeLogField does at format time (round 10/12); a
|
|
21
|
+
// whitespace-only timestamp or kind would previously pass validation
|
|
22
|
+
// and then be normalized to "" later, producing an entry like
|
|
23
|
+
// `- [] ()` that breaks downstream parsers; optional sessionId must be
|
|
24
|
+
// a non-empty string OR strictly `undefined` — null and "" are both
|
|
25
|
+
// rejected explicitly (rounds 6/8/9) because silently dropping them
|
|
26
|
+
// reinterprets invalid input instead of failing fast.
|
|
27
|
+
const NON_WHITESPACE_TIMESTAMP = "interaction entry must have a non-whitespace timestamp";
|
|
28
|
+
const NON_WHITESPACE_KIND = "interaction entry must have a non-whitespace kind";
|
|
29
|
+
const STRING_SUMMARY = "interaction entry must have a string summary";
|
|
30
|
+
const NON_WHITESPACE_SESSION = "interaction entry sessionId must be a non-whitespace string when provided";
|
|
31
|
+
const interactionEntrySchema = z.object({
|
|
32
|
+
timestamp: z.string({ error: NON_WHITESPACE_TIMESTAMP }).trim().min(1, NON_WHITESPACE_TIMESTAMP),
|
|
33
|
+
kind: z.string({ error: NON_WHITESPACE_KIND }).trim().min(1, NON_WHITESPACE_KIND),
|
|
34
|
+
summary: z.string({ error: STRING_SUMMARY }),
|
|
35
|
+
sessionId: z.string({ error: NON_WHITESPACE_SESSION }).trim().min(1, NON_WHITESPACE_SESSION).optional(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
function sanitizeLogField(value: string): string {
|
|
39
|
+
// Cursor Medium: every interaction-log field — not just summary —
|
|
40
|
+
// must collapse newlines so a malicious or buggy `timestamp` /
|
|
41
|
+
// `kind` / `sessionId` value can't break the one-line-per-entry
|
|
42
|
+
// invariant the append-only log relies on. Replace CR/LF/Tab with
|
|
43
|
+
// a single space; trim leading/trailing whitespace.
|
|
44
|
+
return value.replace(/[\r\n\t]+/g, " ").trim();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function isCanonicalIsoTimestamp(value: string): boolean {
|
|
48
|
+
const ms = Date.parse(value);
|
|
49
|
+
return Number.isFinite(ms) && new Date(ms).toISOString() === value;
|
|
50
|
+
}
|
|
51
|
+
function assertCanonicalIsoTimestamp(value: string, field: string): void {
|
|
52
|
+
if (!isCanonicalIsoTimestamp(value)) {
|
|
53
|
+
throw new Error(`${field} must be a canonical ISO-8601 timestamp`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function formatLogEntry(entry: PeerInteractionLogEntry): string {
|
|
58
|
+
// One line per entry. We use a leading bullet so the file remains
|
|
59
|
+
// readable as ordinary markdown. Order: timestamp, kind, optional
|
|
60
|
+
// session id, summary. ALL fields are passed through `sanitizeLogField`
|
|
61
|
+
// so a stray newline anywhere can't shatter the append-only invariant
|
|
62
|
+
// (cursor Medium on PR #723).
|
|
63
|
+
//
|
|
64
|
+
// Cursor Low on PR #736: the previous bare `session=<id>` token was
|
|
65
|
+
// ambiguous with summaries that literally start with `session=`
|
|
66
|
+
// (e.g. summary `"session=foo bar"` round-tripped to
|
|
67
|
+
// `{sessionId: "foo", summary: "bar"}`). New entries wrap the
|
|
68
|
+
// session marker in square brackets — `[session=<id>]` — which a
|
|
69
|
+
// sanitized summary can never start with (sanitizeLogField never
|
|
70
|
+
// emits `[` as the first character of a summary that originally
|
|
71
|
+
// started with `session=`, and bracketed metadata is unambiguously
|
|
72
|
+
// distinct from `session=` text). Old entries written by previous
|
|
73
|
+
// code remain parseable through the legacy fallback in
|
|
74
|
+
// `parseLogLine`.
|
|
75
|
+
const ts = sanitizeLogField(entry.timestamp);
|
|
76
|
+
const kind = sanitizeLogField(entry.kind);
|
|
77
|
+
const summary = sanitizeLogField(entry.summary);
|
|
78
|
+
const session = entry.sessionId
|
|
79
|
+
? ` [session=${sanitizeLogField(entry.sessionId)}]`
|
|
80
|
+
: "";
|
|
81
|
+
return `- [${ts}] (${kind})${session} ${summary}`;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Append one entry to a peer's interaction log.
|
|
86
|
+
*
|
|
87
|
+
* Creates `peers/{id}/` and `interactions.log.md` if needed. The file is
|
|
88
|
+
* append-only by contract — this helper never rewrites prior entries.
|
|
89
|
+
* Returns the absolute path of the log file (useful for tests).
|
|
90
|
+
*
|
|
91
|
+
* Concurrency contract: appends to the same file are serialized
|
|
92
|
+
* in-process via a per-file promise chain — entries land in enqueue
|
|
93
|
+
* order and a single entry can never be split by another writer's chunk
|
|
94
|
+
* (#3564). Ordering across separate PROCESSES is still the caller's
|
|
95
|
+
* responsibility (POSIX gives atomicity per write, not ordering).
|
|
96
|
+
*/
|
|
97
|
+
// Per-file tail of the append chain. Bounded to files with an in-flight
|
|
98
|
+
// write: the writer deletes its entry when it is still the tail.
|
|
99
|
+
const appendQueues = new Map<string, Promise<void>>();
|
|
100
|
+
export async function appendInteractionLog(
|
|
101
|
+
memoryDir: string,
|
|
102
|
+
peerId: string,
|
|
103
|
+
entry: PeerInteractionLogEntry,
|
|
104
|
+
): Promise<string> {
|
|
105
|
+
assertValidPeerId(peerId);
|
|
106
|
+
const parsedEntry = interactionEntrySchema.safeParse(entry);
|
|
107
|
+
if (!parsedEntry.success) {
|
|
108
|
+
throw new Error(parsedEntry.error.issues[0]?.message ?? "invalid interaction entry");
|
|
109
|
+
}
|
|
110
|
+
const e = parsedEntry.data;
|
|
111
|
+
assertCanonicalIsoTimestamp(e.timestamp, "interaction entry timestamp");
|
|
112
|
+
await mkdirPeerDirAtomic(memoryDir, peerId);
|
|
113
|
+
await assertPeerDirNotEscaped(memoryDir, peerId);
|
|
114
|
+
const file = interactionsPath(memoryDir, peerId);
|
|
115
|
+
const line = formatLogEntry(e) + "\n";
|
|
116
|
+
// `appendFile` creates the file if it does not exist. Serialize writes
|
|
117
|
+
// per file so concurrent callers' entries land in enqueue order —
|
|
118
|
+
// `fh.writeFile` chunks a large entry across multiple writes, and an
|
|
119
|
+
// unqueued writer could otherwise interleave between them (#3564).
|
|
120
|
+
// The chain tail is kept on a .catch(() => {}) so one failed append
|
|
121
|
+
// does not poison the queue for followers.
|
|
122
|
+
const prev = appendQueues.get(file) ?? Promise.resolve();
|
|
123
|
+
const write = prev.then(() => appendFileNoFollow(file, line));
|
|
124
|
+
const tail = write.catch(() => {});
|
|
125
|
+
appendQueues.set(file, tail);
|
|
126
|
+
try {
|
|
127
|
+
await write;
|
|
128
|
+
} finally {
|
|
129
|
+
if (appendQueues.get(file) === tail) appendQueues.delete(file);
|
|
130
|
+
}
|
|
131
|
+
return file;
|
|
132
|
+
}
|
package/src/peers/peers.test.ts
CHANGED
|
@@ -297,6 +297,36 @@ test("appendInteractionLog appends entries in order", async () => {
|
|
|
297
297
|
assert.ok(lines[2].includes("third turn"));
|
|
298
298
|
});
|
|
299
299
|
|
|
300
|
+
test("appendInteractionLog serializes concurrent appends to one peer — #3564", async () => {
|
|
301
|
+
// Concurrent callers may append to the same peer's log (the reasoner is
|
|
302
|
+
// serial today, but the helper is a public export — nothing enforces
|
|
303
|
+
// enqueue order). A large entry is chunked across multiple writes
|
|
304
|
+
// internally; without per-file serialization a concurrent small write
|
|
305
|
+
// lands BETWEEN those chunks, corrupting the large entry or reordering
|
|
306
|
+
// the log. Contract: entries appear in enqueue order, each intact.
|
|
307
|
+
const dir = await makeTempDir();
|
|
308
|
+
const peerId = "agent.codex";
|
|
309
|
+
const big = `BIG-${"x".repeat(4 << 20)}-BIG-END`;
|
|
310
|
+
const [fileA, fileB] = await Promise.all([
|
|
311
|
+
appendInteractionLog(dir, peerId, {
|
|
312
|
+
timestamp: "2026-04-25T00:00:01.000Z",
|
|
313
|
+
kind: "message",
|
|
314
|
+
summary: big,
|
|
315
|
+
}),
|
|
316
|
+
appendInteractionLog(dir, peerId, {
|
|
317
|
+
timestamp: "2026-04-25T00:00:02.000Z",
|
|
318
|
+
kind: "message",
|
|
319
|
+
summary: "SMALL-END",
|
|
320
|
+
}),
|
|
321
|
+
]);
|
|
322
|
+
assert.equal(fileA, fileB);
|
|
323
|
+
const raw = await readInteractionLogRaw(dir, peerId);
|
|
324
|
+
const lines = raw.trim().split("\n");
|
|
325
|
+
assert.equal(lines.length, 2, `expected 2 intact lines, got ${lines.length}`);
|
|
326
|
+
assert.ok(lines[0].includes("BIG-") && lines[0].includes("BIG-END"));
|
|
327
|
+
assert.ok(lines[1].includes("SMALL-END"));
|
|
328
|
+
});
|
|
329
|
+
|
|
300
330
|
test("appendInteractionLog escapes embedded newlines so each entry stays one line", async () => {
|
|
301
331
|
const dir = await makeTempDir();
|
|
302
332
|
const peerId = "human.alex";
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
import {
|
|
35
|
-
appendInteractionLog,
|
|
36
35
|
listPeers,
|
|
37
36
|
readPeerInteractionLog,
|
|
38
37
|
readPeerProfile,
|
|
39
38
|
writePeerProfile,
|
|
40
39
|
} from "./storage.js";
|
|
40
|
+
import { appendInteractionLog } from "./interaction-log-append.js";
|
|
41
41
|
import type {
|
|
42
42
|
Peer,
|
|
43
43
|
PeerInteractionLogEntry,
|
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
|