@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
|
@@ -24,21 +24,45 @@ export interface LocationProviderEnv {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export interface LocationProviderSetupDeps {
|
|
27
|
-
/** Injectable env (tests); defaults to
|
|
27
|
+
/** Injectable env (tests); defaults to provider-specific process variables. */
|
|
28
28
|
env?: LocationProviderEnv;
|
|
29
|
+
/** Per-source env overrides keyed by provider id. */
|
|
30
|
+
envBySource?: ReadonlyMap<string, LocationProviderEnv>;
|
|
29
31
|
/** Injectable module loader (tests); defaults to a dynamic import. */
|
|
30
32
|
importModule?: (specifier: string) => Promise<unknown>;
|
|
33
|
+
/** Injectable setup lookup (tests); defaults to the global setup registry. */
|
|
34
|
+
getSetup?: (id: string) => LocationProviderSetupEntry | undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type LocationProviderPackageLoader = <TModule>() => Promise<TModule>;
|
|
38
|
+
|
|
39
|
+
export interface LocationProviderSetupContext {
|
|
40
|
+
readonly config: LocationConfig;
|
|
41
|
+
readonly env?: LocationProviderEnv;
|
|
42
|
+
readonly loadPackage: LocationProviderPackageLoader;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface LocationProviderSetupEntry {
|
|
46
|
+
readonly id: string;
|
|
47
|
+
readonly packageSpecifier: string;
|
|
48
|
+
readonly setup: (context: LocationProviderSetupContext) => Promise<boolean>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface ReittiProviderRegistrationOptions {
|
|
52
|
+
baseUrl: string;
|
|
53
|
+
token: string;
|
|
54
|
+
timezone: string;
|
|
55
|
+
authMode?: "x-api-token" | "bearer";
|
|
31
56
|
}
|
|
32
57
|
|
|
33
58
|
interface ReittiProviderModule {
|
|
34
|
-
ensureReittiProviderRegistered(options:
|
|
35
|
-
baseUrl: string;
|
|
36
|
-
token: string;
|
|
37
|
-
timezone: string;
|
|
38
|
-
authMode?: "x-api-token" | "bearer";
|
|
39
|
-
}): boolean;
|
|
59
|
+
ensureReittiProviderRegistered(options: ReittiProviderRegistrationOptions): boolean;
|
|
40
60
|
}
|
|
41
61
|
|
|
62
|
+
const PROVIDER_ID_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
|
|
63
|
+
// Computed scope prefix prevents bundlers from statically resolving optional connectors.
|
|
64
|
+
const OPTIONAL_PACKAGE_SCOPE = "@remnic/";
|
|
65
|
+
|
|
42
66
|
const loadFailuresWarned = new Set<string>();
|
|
43
67
|
|
|
44
68
|
function readReittiEnv(): LocationProviderEnv {
|
|
@@ -49,6 +73,95 @@ function readReittiEnv(): LocationProviderEnv {
|
|
|
49
73
|
};
|
|
50
74
|
}
|
|
51
75
|
|
|
76
|
+
const BUILT_IN_LOCATION_PROVIDER_SETUPS: readonly LocationProviderSetupEntry[] = [
|
|
77
|
+
{
|
|
78
|
+
id: "reitti",
|
|
79
|
+
packageSpecifier: `${OPTIONAL_PACKAGE_SCOPE}connector-reitti`,
|
|
80
|
+
async setup(context) {
|
|
81
|
+
const env = context.env ?? readReittiEnv();
|
|
82
|
+
const baseUrl = env.baseUrl?.trim();
|
|
83
|
+
const token = env.token?.trim();
|
|
84
|
+
if (!baseUrl || !token) return false;
|
|
85
|
+
const mod = await context.loadPackage<ReittiProviderModule>();
|
|
86
|
+
const options: ReittiProviderRegistrationOptions = {
|
|
87
|
+
baseUrl,
|
|
88
|
+
token,
|
|
89
|
+
timezone: context.config.timezone,
|
|
90
|
+
};
|
|
91
|
+
if (env.authMode === "x-api-token" || env.authMode === "bearer") {
|
|
92
|
+
options.authMode = env.authMode;
|
|
93
|
+
}
|
|
94
|
+
return mod.ensureReittiProviderRegistered(options);
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
const providerSetups = new Map<string, LocationProviderSetupEntry>();
|
|
100
|
+
|
|
101
|
+
function seedBuiltInProviderSetups(): void {
|
|
102
|
+
for (const entry of BUILT_IN_LOCATION_PROVIDER_SETUPS) {
|
|
103
|
+
providerSetups.set(entry.id, entry);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
seedBuiltInProviderSetups();
|
|
108
|
+
|
|
109
|
+
function assertValidProviderSetup(entry: LocationProviderSetupEntry): void {
|
|
110
|
+
if (!entry || !(entry instanceof Object)) {
|
|
111
|
+
throw new TypeError("location provider setup must be an object");
|
|
112
|
+
}
|
|
113
|
+
if (!entry.id || entry.id.constructor !== String || !PROVIDER_ID_PATTERN.test(entry.id)) {
|
|
114
|
+
throw new RangeError(
|
|
115
|
+
"location provider setup id must be a non-empty lowercase kebab string (a-z, 0-9, hyphens)",
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
if (
|
|
119
|
+
!entry.packageSpecifier ||
|
|
120
|
+
entry.packageSpecifier.constructor !== String ||
|
|
121
|
+
entry.packageSpecifier.trim().length === 0
|
|
122
|
+
) {
|
|
123
|
+
throw new TypeError(`location provider setup '${entry.id}' must declare a non-empty packageSpecifier`);
|
|
124
|
+
}
|
|
125
|
+
if (!(entry.setup instanceof Function)) {
|
|
126
|
+
throw new TypeError(`location provider setup '${entry.id}' must implement setup()`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Register an optional location provider bootstrap entry for a source id. */
|
|
131
|
+
export function registerLocationProviderSetup(entry: LocationProviderSetupEntry): void {
|
|
132
|
+
assertValidProviderSetup(entry);
|
|
133
|
+
if (providerSetups.has(entry.id)) {
|
|
134
|
+
throw new Error(`location provider setup '${entry.id}' is already registered`);
|
|
135
|
+
}
|
|
136
|
+
providerSetups.set(entry.id, {
|
|
137
|
+
id: entry.id,
|
|
138
|
+
packageSpecifier: entry.packageSpecifier.trim(),
|
|
139
|
+
setup: entry.setup,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Remove a registered provider setup entry by id. Returns `true` if removed. */
|
|
144
|
+
export function unregisterLocationProviderSetup(id: string): boolean {
|
|
145
|
+
return Boolean(id && id.constructor === String && providerSetups.delete(id));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Look up a registered provider setup entry by source id. */
|
|
149
|
+
export function getLocationProviderSetup(id: string): LocationProviderSetupEntry | undefined {
|
|
150
|
+
return !id || id.constructor !== String ? undefined : providerSetups.get(id);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** List registered provider setup source ids in sorted order. */
|
|
154
|
+
export function listLocationProviderSetups(): string[] {
|
|
155
|
+
return [...providerSetups.keys()].sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Test-only: reset provider setups to built-in defaults and clear warned specifiers. */
|
|
159
|
+
export function resetLocationProviderSetups(): void {
|
|
160
|
+
providerSetups.clear();
|
|
161
|
+
loadFailuresWarned.clear();
|
|
162
|
+
seedBuiltInProviderSetups();
|
|
163
|
+
}
|
|
164
|
+
|
|
52
165
|
/**
|
|
53
166
|
* Register every configured+enabled source's provider when its optional
|
|
54
167
|
* package and credentials are available. Idempotent; returns the ids this
|
|
@@ -61,40 +174,33 @@ export async function ensureConfiguredLocationProviders(
|
|
|
61
174
|
): Promise<string[]> {
|
|
62
175
|
const registered: string[] = [];
|
|
63
176
|
if (!config.enabled) return registered;
|
|
177
|
+
const load = deps.importModule ?? ((s: string) => import(s));
|
|
178
|
+
const resolveSetup = deps.getSetup ?? getLocationProviderSetup;
|
|
64
179
|
for (const source of config.sources) {
|
|
65
180
|
if (!source.enabled) continue;
|
|
66
181
|
if (getLocationProvider(source.id) !== undefined) continue;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
env.authMode === "x-api-token" || env.authMode === "bearer" ? env.authMode : undefined;
|
|
76
|
-
const specifier = "@remnic/" + "connector-reitti";
|
|
77
|
-
const load = deps.importModule ?? ((s: string) => import(s));
|
|
182
|
+
const entry = resolveSetup(source.id);
|
|
183
|
+
if (entry === undefined) continue;
|
|
184
|
+
const env = deps.envBySource?.get(source.id) ?? deps.env;
|
|
185
|
+
const loadPackage: LocationProviderPackageLoader = async <TModule>(): Promise<TModule> => {
|
|
186
|
+
// SAFETY: Dynamic ESM import returns an opaque module namespace; each
|
|
187
|
+
// registered setup entry declares its optional package's export contract.
|
|
188
|
+
return (await load(entry.packageSpecifier)) as TModule;
|
|
189
|
+
};
|
|
78
190
|
try {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
mod.ensureReittiProviderRegistered({
|
|
82
|
-
baseUrl,
|
|
83
|
-
token,
|
|
84
|
-
timezone: config.timezone,
|
|
85
|
-
...(authMode !== undefined ? { authMode } : {}),
|
|
86
|
-
})
|
|
87
|
-
) {
|
|
88
|
-
registered.push("reitti");
|
|
191
|
+
if (await entry.setup({ config, env, loadPackage })) {
|
|
192
|
+
registered.push(source.id);
|
|
89
193
|
}
|
|
90
194
|
} catch (err) {
|
|
91
195
|
// Absent optional package is the common case (skip silently); a real
|
|
92
196
|
// load failure is worth one warn line, never credentials.
|
|
93
197
|
const message = err instanceof Error ? err.message : String(err);
|
|
94
|
-
if (!message.includes(
|
|
95
|
-
if (!loadFailuresWarned.has(
|
|
96
|
-
loadFailuresWarned.add(
|
|
97
|
-
log.warn(
|
|
198
|
+
if (!message.includes(entry.packageSpecifier)) {
|
|
199
|
+
if (!loadFailuresWarned.has(entry.packageSpecifier)) {
|
|
200
|
+
loadFailuresWarned.add(entry.packageSpecifier);
|
|
201
|
+
log.warn(
|
|
202
|
+
`location: failed to load optional provider package ${entry.packageSpecifier}: ${message}`,
|
|
203
|
+
);
|
|
98
204
|
}
|
|
99
205
|
}
|
|
100
206
|
}
|
package/src/model-registry.ts
CHANGED
|
@@ -322,17 +322,6 @@ export class ModelRegistry {
|
|
|
322
322
|
};
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
/**
|
|
326
|
-
* Fetch capabilities from Hugging Face (if available)
|
|
327
|
-
* Returns true if successful
|
|
328
|
-
*/
|
|
329
|
-
async fetchFromHuggingFace(modelId: string): Promise<boolean> {
|
|
330
|
-
// This would be implemented to fetch from HF Hub API
|
|
331
|
-
// For now, we rely on the known models and manual updates
|
|
332
|
-
log.info(`ModelRegistry: fetchFromHuggingFace not yet implemented for ${modelId}`);
|
|
333
|
-
return false;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
325
|
/**
|
|
337
326
|
* List all cached models
|
|
338
327
|
*/
|
|
@@ -207,7 +207,7 @@ export class SemanticConsolidationCoordinator {
|
|
|
207
207
|
{
|
|
208
208
|
role: "system" as const,
|
|
209
209
|
content: operatorAwareEnabled
|
|
210
|
-
? 'You are a memory consolidation system. Return ONLY a JSON object with
|
|
210
|
+
? 'You are a memory consolidation system. Return ONLY a JSON object with an "operator" key and either "output" or, for split, "outputs". The "operator" value MUST be one of the exact strings "merge", "update", or "split" — never a pipe-separated placeholder, never prose. "output" is the canonical memory text; "outputs" is an array with one canonical memory text per separated fact.'
|
|
211
211
|
: "You are a memory consolidation system. Output only the consolidated memory text.",
|
|
212
212
|
},
|
|
213
213
|
{ role: "user" as const, content: prompt },
|
|
@@ -248,20 +248,20 @@ export class SemanticConsolidationCoordinator {
|
|
|
248
248
|
// wider `ConsolidationOperator` type in #687 PR 2/4 but is
|
|
249
249
|
// reserved for the maintenance job and must never be assignable
|
|
250
250
|
// here (Cursor Bugbot review, PR #730).
|
|
251
|
-
let
|
|
251
|
+
let canonicalOutputs: string[];
|
|
252
252
|
let operator: SemanticConsolidationLlmOperator;
|
|
253
253
|
if (operatorAwareEnabled) {
|
|
254
254
|
const parsed = parseOperatorAwareConsolidationResponse(
|
|
255
255
|
response.content,
|
|
256
256
|
cluster,
|
|
257
257
|
);
|
|
258
|
-
|
|
258
|
+
canonicalOutputs = parsed.outputs;
|
|
259
259
|
operator = parsed.operator;
|
|
260
260
|
} else {
|
|
261
|
-
|
|
261
|
+
canonicalOutputs = [parseConsolidationResponse(response.content)];
|
|
262
262
|
operator = chooseConsolidationOperator(cluster);
|
|
263
263
|
}
|
|
264
|
-
cluster.canonicalContent =
|
|
264
|
+
cluster.canonicalContent = canonicalOutputs.join("\n\n");
|
|
265
265
|
|
|
266
266
|
// Pick the most recent memory's metadata as the basis for lineage
|
|
267
267
|
const sorted = [...cluster.memories].sort(
|
|
@@ -294,36 +294,43 @@ export class SemanticConsolidationCoordinator {
|
|
|
294
294
|
// Sealed-envelope write (issue #1989 PR4): canonical content is
|
|
295
295
|
// LLM-merged and tags are unioned from stored rows — salvage so a
|
|
296
296
|
// limit-violating union cannot abort consolidation (warn-logged).
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
297
|
+
// SPLIT writes one canonical memory per output (#3566); every write shares the lineage.
|
|
298
|
+
const canonicalIds: string[] = [];
|
|
299
|
+
let canonicalBlocked = false;
|
|
300
|
+
for (const canonicalContent of canonicalOutputs) {
|
|
301
|
+
const canonicalEnvelope = composeMemoryEnvelope(
|
|
302
|
+
{
|
|
303
|
+
content: canonicalContent,
|
|
304
|
+
category: newest.frontmatter.category,
|
|
305
|
+
confidence: newest.frontmatter.confidence,
|
|
306
|
+
tags: [
|
|
307
|
+
...new Set(
|
|
308
|
+
cluster.memories.flatMap((m) => m.frontmatter.tags ?? []),
|
|
309
|
+
),
|
|
310
|
+
],
|
|
311
|
+
},
|
|
312
|
+
{ source: "semantic-consolidation" },
|
|
313
|
+
{ salvage: true },
|
|
314
|
+
);
|
|
315
|
+
if (canonicalEnvelope.salvageNotes.length > 0) {
|
|
316
|
+
log.warn(`semantic-consolidation write salvaged invalid fields: ${canonicalEnvelope.salvageNotes.join("; ")}`);
|
|
317
|
+
}
|
|
318
|
+
const written = await targetStorage.writeSealedMemory(
|
|
319
|
+
canonicalEnvelope,
|
|
320
|
+
{
|
|
321
|
+
actor: "semantic-consolidation",
|
|
322
|
+
lineage: lineageIds,
|
|
323
|
+
derivedFrom: derivedFromEntries.length > 0 ? derivedFromEntries : undefined,
|
|
324
|
+
derivedVia: operator,
|
|
325
|
+
},
|
|
326
|
+
);
|
|
327
|
+
canonicalIds.push(written.id);
|
|
328
|
+
if (written.tombstoneBlocked) canonicalBlocked = true;
|
|
313
329
|
}
|
|
314
|
-
const { id: canonicalId, tombstoneBlocked: canonicalBlocked } = await targetStorage.writeSealedMemory(
|
|
315
|
-
canonicalEnvelope,
|
|
316
|
-
{
|
|
317
|
-
actor: "semantic-consolidation",
|
|
318
|
-
lineage: lineageIds,
|
|
319
|
-
derivedFrom: derivedFromEntries.length > 0 ? derivedFromEntries : undefined,
|
|
320
|
-
derivedVia: operator,
|
|
321
|
-
},
|
|
322
|
-
);
|
|
323
330
|
if (canonicalBlocked) {
|
|
324
331
|
// #1645: canonical matched a tombstone (pending_review). Don't archive
|
|
325
332
|
// the sources — consolidation must never delete the only active copy.
|
|
326
|
-
log.info(`[semantic-consolidation] cluster in "${cluster.category}" tombstone-blocked — keeping ${cluster.memories.length} source(s) active (pending_review ${
|
|
333
|
+
log.info(`[semantic-consolidation] cluster in "${cluster.category}" tombstone-blocked — keeping ${cluster.memories.length} source(s) active (pending_review ${canonicalIds.join(", ")})`);
|
|
327
334
|
continue;
|
|
328
335
|
}
|
|
329
336
|
canonicalWriteCompleted = true;
|
|
@@ -340,7 +347,7 @@ export class SemanticConsolidationCoordinator {
|
|
|
340
347
|
const archiveResult = await targetStorage.archiveMemory(m, {
|
|
341
348
|
actor: "semantic-consolidation",
|
|
342
349
|
reasonCode: "semantic-consolidation",
|
|
343
|
-
relatedMemoryIds:
|
|
350
|
+
relatedMemoryIds: canonicalIds,
|
|
344
351
|
});
|
|
345
352
|
if (archiveResult) {
|
|
346
353
|
// Remove from the same storage-scoped content-hash index that
|
|
@@ -392,7 +399,7 @@ export class SemanticConsolidationCoordinator {
|
|
|
392
399
|
}
|
|
393
400
|
|
|
394
401
|
log.info(
|
|
395
|
-
`[semantic-consolidation] consolidated ${cluster.memories.length} memories → ${
|
|
402
|
+
`[semantic-consolidation] consolidated ${cluster.memories.length} memories → ${canonicalIds.join(", ")}`,
|
|
396
403
|
);
|
|
397
404
|
} catch (err) {
|
|
398
405
|
log.warn(
|
|
@@ -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,
|