@remnic/core 9.65.5 → 9.65.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-admin-ops-surface.d.ts +11 -11
- package/dist/access-admin-ops-surface.js +26 -26
- package/dist/access-authorization-probe.d.ts +11 -11
- package/dist/access-authorization-probe.js +27 -27
- package/dist/access-boundary.d.ts +11 -11
- package/dist/access-boundary.js +26 -26
- package/dist/access-cli.js +110 -104
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.d.ts +1 -1
- package/dist/access-extraction-force-flush.d.ts +11 -11
- package/dist/access-extraction-force-flush.js +26 -26
- package/dist/access-health-types.d.ts +1 -1
- package/dist/access-http-lcm-compaction.d.ts +11 -11
- package/dist/access-http-lifecycle-flush.d.ts +11 -11
- package/dist/access-http-offline-stream.d.ts +11 -11
- package/dist/access-http-query.d.ts +2 -2
- package/dist/access-http-query.js +28 -28
- package/dist/access-http.d.ts +13 -18
- package/dist/access-http.js +46 -44
- package/dist/access-identity-continuity-surface.d.ts +9 -9
- package/dist/access-identity-continuity-surface.js +26 -26
- package/dist/access-lcm-surface.d.ts +11 -11
- package/dist/access-lcm-surface.js +26 -26
- package/dist/access-mcp-output-schemas.js +1 -1
- package/dist/access-mcp.d.ts +11 -11
- package/dist/access-mcp.js +37 -35
- package/dist/access-memory-search-fanout.d.ts +2 -2
- package/dist/{access-namespace-preflight-D_6mo8ms.d.ts → access-namespace-preflight-8VYKmRX0.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +3 -3
- package/dist/access-namespace-preflight.js +26 -26
- package/dist/access-observe-write-surface.d.ts +11 -11
- package/dist/access-observe-write-surface.js +26 -26
- package/dist/access-offline-manifest.d.ts +9 -9
- package/dist/access-operations-batch.js +29 -29
- package/dist/access-operations.d.ts +12 -12
- package/dist/access-operations.js +34 -32
- package/dist/access-recall-concurrency.d.ts +11 -11
- package/dist/access-recall-concurrency.js +26 -26
- package/dist/access-recall-response.d.ts +11 -11
- package/dist/access-recall-response.js +26 -26
- package/dist/access-recall-surface.d.ts +11 -11
- package/dist/access-recall-surface.js +26 -26
- package/dist/access-schema.js +3 -3
- package/dist/{access-service-sbiNS5UB.d.ts → access-service-Crk__Git.d.ts} +8 -8
- package/dist/access-service-helpers.d.ts +11 -11
- package/dist/access-service.d.ts +11 -11
- package/dist/access-service.js +26 -26
- package/dist/access-surface-catalog.d.ts +11 -11
- package/dist/access-surface-catalog.js +38 -28
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/access-wearables-meetings-surface.d.ts +3 -3
- package/dist/action-confidence.d.ts +1 -1
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-recall.d.ts +1 -1
- package/dist/active-recall.js +4 -4
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/ambient-provenance.d.ts +1 -1
- package/dist/artifact-search.d.ts +1 -1
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +9 -9
- package/dist/briefing-window.d.ts +2 -2
- package/dist/briefing.d.ts +2 -2
- package/dist/briefing.js +8 -8
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer-turn-helpers.d.ts +1 -1
- package/dist/buffer.d.ts +2 -2
- package/dist/bulk-import/index.d.ts +3 -3
- package/dist/calibration.d.ts +1 -1
- package/dist/capabilities.d.ts +1 -1
- package/dist/{capsule-crypto-YO5QJ6L3.js → capsule-crypto-7FJQINUR.js} +2 -2
- package/dist/{catalog-DO_7zfkv.d.ts → catalog-DybwVNW3.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +11 -11
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/causal-trajectory-graph.js +2 -2
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-BXLOS5AJ.js → chunk-2NLLXCJG.js} +2 -2
- package/dist/{chunk-NZPFCP5A.js → chunk-2PSX5BJU.js} +2 -2
- package/dist/chunk-3BCULS4U.js +1093 -0
- package/dist/chunk-3BCULS4U.js.map +1 -0
- package/dist/{chunk-IIRCHGWD.js → chunk-3RI5Y7KU.js} +2 -2
- package/dist/{chunk-H7BZBSP6.js → chunk-52II7PB6.js} +4 -4
- package/dist/{chunk-J3ATBB7M.js → chunk-5DH6PG4B.js} +2 -2
- package/dist/{chunk-M4AHBM72.js → chunk-5HERQ5FX.js} +10 -10
- package/dist/{chunk-W675UJCZ.js → chunk-5HK3CJAR.js} +2 -2
- package/dist/{chunk-2MVTAIL3.js → chunk-5S4LQOPE.js} +2 -2
- package/dist/{chunk-OZDFB22S.js → chunk-5VPQSRQO.js} +3 -3
- package/dist/{chunk-YZJM6CLF.js → chunk-6CPUQ5D6.js} +10 -10
- package/dist/{chunk-2IXQSGCU.js → chunk-7F27PCSN.js} +2 -2
- package/dist/{chunk-OWQNJJY2.js → chunk-7TCGNUVP.js} +2 -2
- package/dist/{chunk-3NH3VP3U.js → chunk-7WR462EM.js} +2 -2
- package/dist/{chunk-NH6LC57D.js → chunk-A32YEQAM.js} +2 -2
- package/dist/{chunk-HF5BUTI6.js → chunk-ACOC27BB.js} +2 -2
- package/dist/{chunk-N56GVOWR.js → chunk-AFR6AIM4.js} +144 -78
- package/dist/chunk-AFR6AIM4.js.map +1 -0
- package/dist/{chunk-LYBIHM4N.js → chunk-ANJXPFRS.js} +47 -26
- package/dist/chunk-ANJXPFRS.js.map +1 -0
- package/dist/{chunk-FC7TIRFS.js → chunk-AX7UXCHJ.js} +6 -1
- package/dist/chunk-AX7UXCHJ.js.map +1 -0
- package/dist/{chunk-THVI4Y7X.js → chunk-BJTHRFFC.js} +6 -6
- package/dist/chunk-BWGCOLEL.js +61 -0
- package/dist/chunk-BWGCOLEL.js.map +1 -0
- package/dist/{chunk-BW4GAF57.js → chunk-CFGU52XJ.js} +2 -2
- package/dist/{chunk-DPNXADEI.js → chunk-D4QVPP3G.js} +2 -2
- package/dist/{chunk-BK5G2MHO.js → chunk-EOHKUWXW.js} +2 -2
- package/dist/{chunk-YNDLCWXS.js → chunk-EZ25VE3G.js} +4 -4
- package/dist/{chunk-ZK4BFABK.js → chunk-F635GAL7.js} +4 -4
- package/dist/{chunk-IURMJBGP.js → chunk-F6QHHRWP.js} +2 -2
- package/dist/{chunk-BA2GLSIP.js → chunk-FMQ4MOQO.js} +91 -28
- package/dist/chunk-FMQ4MOQO.js.map +1 -0
- package/dist/{chunk-LDBFXD4F.js → chunk-FP7YTTVO.js} +3 -1
- package/dist/chunk-FP7YTTVO.js.map +1 -0
- package/dist/{chunk-TJFI3K2O.js → chunk-GEPACVWN.js} +2 -2
- package/dist/{chunk-PP7R754B.js → chunk-GPFZFCRN.js} +1 -1
- package/dist/{chunk-UCKG36HO.js → chunk-GTSVEEP3.js} +2 -2
- package/dist/{chunk-KTPXXVDQ.js → chunk-I4343FIA.js} +79 -6
- package/dist/chunk-I4343FIA.js.map +1 -0
- package/dist/{chunk-DPGH6LHQ.js → chunk-I7EX6KSH.js} +57 -57
- package/dist/{chunk-JPAKBNTM.js → chunk-IP4ZNT4U.js} +2 -2
- package/dist/{chunk-AXGFOFNY.js → chunk-IY7UXD3J.js} +2 -2
- package/dist/{chunk-YHCBJULX.js → chunk-JAQXUGLN.js} +2 -2
- package/dist/{chunk-RKNJBZ55.js → chunk-JBPKEARU.js} +4 -4
- package/dist/chunk-JCCWJHOP.js +240 -0
- package/dist/chunk-JCCWJHOP.js.map +1 -0
- package/dist/{chunk-VDX2J7OX.js → chunk-KQAFEZQX.js} +2 -2
- package/dist/{chunk-D2YNNDML.js → chunk-KWIGDKM2.js} +2 -2
- package/dist/{chunk-YB4GBWBU.js → chunk-LLQCM2U2.js} +81 -81
- package/dist/{chunk-OLBZ2WGG.js → chunk-LTBKKSCX.js} +2 -2
- package/dist/{chunk-DORFF5N5.js → chunk-NG3MBQV4.js} +2 -2
- package/dist/{chunk-DUEDOYZD.js → chunk-OPGL46PX.js} +2 -2
- package/dist/{chunk-OUKBMQ2O.js → chunk-PD66CVSD.js} +2 -2
- package/dist/{chunk-CQBIN77D.js → chunk-PDDSFELN.js} +2 -2
- package/dist/{chunk-6433HV72.js → chunk-PMVPCZJZ.js} +2 -2
- package/dist/{chunk-DJZWNKFO.js → chunk-RGCF4XNH.js} +7 -7
- package/dist/{chunk-CV3GNPOE.js → chunk-RQE4TITU.js} +29 -24
- package/dist/chunk-RQE4TITU.js.map +1 -0
- package/dist/{chunk-4JSF7UUP.js → chunk-S3K2CIK5.js} +2 -2
- package/dist/chunk-SDEPLF7V.js +325 -0
- package/dist/chunk-SDEPLF7V.js.map +1 -0
- package/dist/{chunk-OCCHUEZB.js → chunk-SEA6M7SS.js} +2 -2
- package/dist/{chunk-KOO37E4Y.js → chunk-SVVIASVX.js} +2 -2
- package/dist/{chunk-4K7IW3F7.js → chunk-UD7UNYRD.js} +34 -3
- package/dist/chunk-UD7UNYRD.js.map +1 -0
- package/dist/chunk-ULM7JCDH.js +154 -0
- package/dist/chunk-ULM7JCDH.js.map +1 -0
- package/dist/{chunk-FBR7PIL4.js → chunk-VKCAHCBI.js} +2 -2
- package/dist/{chunk-WDXD6ITO.js → chunk-VXVZ2GM3.js} +2 -2
- package/dist/chunk-W2UOAATB.js +521 -0
- package/dist/chunk-W2UOAATB.js.map +1 -0
- package/dist/{chunk-DUZARALI.js → chunk-WTOZBZNN.js} +3 -3
- package/dist/{chunk-DQEMWVMT.js → chunk-X7Y7WX73.js} +1 -1
- package/dist/{chunk-2EPOGPKO.js → chunk-YKWFK7XA.js} +5 -5
- package/dist/{chunk-BIJAWZYW.js → chunk-YMOPYG3K.js} +6 -6
- package/dist/{chunk-UFR6HX7A.js → chunk-YRVAKONL.js} +1 -1
- package/dist/{chunk-ECLJ4LA2.js → chunk-YWSQD2IB.js} +2 -2
- package/dist/{chunk-NLEH4RTB.js → chunk-Z4U3UN56.js} +2 -2
- package/dist/{chunk-YDKF4MSJ.js → chunk-ZAOHJDKH.js} +3 -3
- package/dist/{chunk-KFIOPZ25.js → chunk-ZIJDI4CP.js} +2 -2
- package/dist/{cli-BqdqPdG_.d.ts → cli-B322UMvB.d.ts} +6 -6
- package/dist/cli.d.ts +14 -14
- package/dist/cli.js +73 -72
- package/dist/coding/pre-action-gate.d.ts +1 -1
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compounding/engine.d.ts +2 -2
- package/dist/compounding/engine.js +8 -8
- package/dist/compounding/preference-consolidator.d.ts +1 -1
- package/dist/compression-optimizer.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +4 -4
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +8 -8
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +8 -8
- package/dist/consolidation-provenance-check.d.ts +2 -2
- package/dist/consolidation-undo.d.ts +2 -2
- package/dist/contradiction/index.d.ts +3 -3
- package/dist/converge-config.d.ts +1 -1
- package/dist/convergence-refresh.d.ts +2 -2
- package/dist/convergence-refresh.js +10 -10
- package/dist/conversation-index/backend.d.ts +1 -1
- package/dist/conversation-index/chunker.d.ts +1 -1
- package/dist/conversation-index/faiss-adapter.d.ts +1 -1
- package/dist/conversation-index/indexer.d.ts +1 -1
- package/dist/conversation-index/search.d.ts +1 -1
- package/dist/corpus-watermark.d.ts +1 -1
- package/dist/corpus-watermark.js +10 -10
- package/dist/cross-lingual-recall.d.ts +1 -1
- package/dist/dashboard-runtime.js +2 -2
- package/dist/day-summary.d.ts +1 -1
- package/dist/delinearize.d.ts +1 -1
- package/dist/dependency-propagation-config.d.ts +1 -1
- package/dist/{dependency-propagation-delivery-D23_x-s5.d.ts → dependency-propagation-delivery-BGcNairQ.d.ts} +1 -1
- package/dist/direct-answer-wiring.d.ts +1 -1
- package/dist/direct-answer.d.ts +1 -1
- package/dist/embedding-fallback.d.ts +1 -1
- package/dist/enrichment/index.d.ts +1 -1
- package/dist/entity-origin-fields.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +2 -2
- package/dist/entity-retrieval.js +8 -8
- package/dist/entity-schema.d.ts +1 -1
- package/dist/episodic-context.d.ts +1 -1
- package/dist/eval-trajectory-contracts.d.ts +256 -0
- package/dist/eval-trajectory-contracts.js +56 -0
- package/dist/eval-trajectory-store.d.ts +39 -0
- package/dist/eval-trajectory-store.js +19 -0
- package/dist/eval-trajectory-store.js.map +1 -0
- package/dist/eval-trajectory.d.ts +67 -0
- package/dist/eval-trajectory.js +46 -0
- package/dist/eval-trajectory.js.map +1 -0
- package/dist/event-order-recall.js +2 -2
- package/dist/explicit-capture.d.ts +9 -9
- package/dist/external-wiki-access.d.ts +11 -11
- package/dist/external-wiki-access.js +27 -27
- package/dist/external-wiki-collection-registration.d.ts +1 -1
- package/dist/external-wiki-collection.d.ts +1 -1
- package/dist/external-wiki-mcp-tools.d.ts +11 -11
- package/dist/extraction-error-classification.d.ts +1 -1
- package/dist/extraction-faithfulness.d.ts +1 -1
- package/dist/extraction-judge-telemetry.d.ts +1 -1
- package/dist/extraction-judge-training.d.ts +1 -1
- package/dist/extraction-judge.d.ts +1 -1
- package/dist/extraction-liveness.d.ts +1 -1
- package/dist/extraction-normalization.d.ts +1 -1
- package/dist/extraction-prompt.d.ts +1 -1
- package/dist/extraction-source-grounding-rules.d.ts +1 -1
- package/dist/extraction-source-grounding.d.ts +1 -1
- package/dist/extraction.d.ts +1 -1
- package/dist/extraction.js +10 -10
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/graph-dashboard-diff.d.ts +1 -1
- package/dist/graph-dashboard-key.d.ts +1 -1
- package/dist/graph-dashboard-parser.d.ts +1 -1
- package/dist/{graph-edge-decay-FXGELBFA.js → graph-edge-decay-A4SDFMMS.js} +4 -4
- package/dist/graph-edge-decay-A4SDFMMS.js.map +1 -0
- package/dist/graph-edge-reinforcement.d.ts +1 -1
- package/dist/graph-path-reconstruction.d.ts +1 -1
- package/dist/graph-path-scoring.d.ts +1 -1
- package/dist/graph-snapshot.d.ts +1 -1
- package/dist/graph-snapshot.js +3 -3
- package/dist/graph.d.ts +1 -1
- package/dist/graph.js +3 -3
- package/dist/harmonic-retrieval.js +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/importers/index.d.ts +1 -1
- package/dist/in-flight-reads.d.ts +1 -1
- package/dist/{index--QhGIXF2.d.ts → index-By2QUAMh.d.ts} +2 -2
- package/dist/index.d.ts +27 -23
- package/dist/index.js +199 -141
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/engine.js +4 -4
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/index.js +10 -10
- package/dist/lcm/tools.d.ts +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/local-llm.d.ts +1 -1
- package/dist/local-model-endpoint.d.ts +1 -1
- package/dist/location/index.d.ts +128 -1
- package/dist/location/index.js +60 -750
- package/dist/location/index.js.map +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +8 -8
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +8 -8
- package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-projection.js +9 -9
- package/dist/{maintenance-PFvY1Pw_.d.ts → maintenance-Dm2McrIx.d.ts} +4 -3
- package/dist/mcp-memory-inspector-app.d.ts +11 -11
- package/dist/mcp-read-only-tools.js +1 -1
- package/dist/memory-action-policy.d.ts +1 -1
- package/dist/memory-cache.d.ts +1 -1
- package/dist/memory-controller.d.ts +203 -0
- package/dist/memory-controller.js +23 -0
- package/dist/memory-controller.js.map +1 -0
- package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
- package/dist/memory-projection-store.d.ts +1 -1
- package/dist/memory-provenance.d.ts +1 -1
- package/dist/memory-snapshot.d.ts +1 -1
- package/dist/memory-subject-cli.d.ts +11 -11
- package/dist/memory-subject.d.ts +11 -11
- package/dist/memory-worth-outcomes.d.ts +47 -3
- package/dist/memory-worth-outcomes.js +5 -3
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +3 -3
- package/dist/namespaces/migrate.js +9 -9
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/search.js +5 -5
- package/dist/namespaces/storage.d.ts +3 -3
- package/dist/namespaces/storage.js +8 -8
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/offline-sync-impression-drain.d.ts +1 -1
- package/dist/operator-doctor-corpus.d.ts +1 -1
- package/dist/operator-doctor-corpus.js +11 -11
- package/dist/operator-doctor-replica.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +3 -3
- package/dist/operator-toolkit.js +22 -22
- package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
- package/dist/orchestration/maintenance.d.ts +4 -4
- package/dist/orchestration/maintenance.js +16 -14
- package/dist/{orchestrator-4wzJrPVm.d.ts → orchestrator-Co1DyfuP.d.ts} +8 -8
- package/dist/orchestrator.d.ts +9 -9
- package/dist/orchestrator.js +110 -104
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/{pipeline-CgXgdIrF.d.ts → pipeline-DotMnb6y.d.ts} +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/proactive-contention.d.ts +1 -1
- package/dist/provenance.d.ts +1 -1
- package/dist/{public-http-BP3VQDl5.d.ts → public-http-PJRtnSi-.d.ts} +1 -1
- package/dist/{qmd-BppGGxsi.d.ts → qmd-BP0n11fR.d.ts} +1 -1
- package/dist/qmd-preflight.d.ts +2 -2
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +2 -2
- package/dist/recall-concurrency-config.d.ts +1 -1
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +1 -1
- package/dist/recall-memory-map.d.ts +1 -1
- package/dist/recall-planner-llm.d.ts +1 -1
- package/dist/recall-state.d.ts +1 -1
- package/dist/recall-tag-filter.d.ts +1 -1
- package/dist/recall-timings.d.ts +1 -1
- package/dist/recall-xray-cli.d.ts +1 -1
- package/dist/recall-xray-renderer.d.ts +1 -1
- package/dist/recall-xray.d.ts +1 -1
- package/dist/reconcile/cursor.d.ts +1 -1
- package/dist/reconcile/manifest.d.ts +1 -1
- package/dist/reconcile/plan.d.ts +1 -1
- package/dist/replay/normalizers/chatgpt.d.ts +1 -1
- package/dist/replay/normalizers/claude.d.ts +1 -1
- package/dist/replay/normalizers/openclaw.d.ts +1 -1
- package/dist/replay/normalizers/shared.d.ts +1 -1
- package/dist/replay/runner.d.ts +1 -1
- package/dist/replay/types.d.ts +1 -1
- package/dist/replica-divergence.d.ts +1 -1
- package/dist/replica-peers-config.d.ts +1 -1
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/resume-bundles.js +5 -5
- package/dist/retrieval-agents.d.ts +2 -2
- package/dist/retrieval-tiers.d.ts +1 -1
- package/dist/routing/engine.d.ts +1 -1
- package/dist/routing/store.d.ts +1 -1
- package/dist/salvage-envelope.d.ts +1 -1
- package/dist/{scope-profiles-ChZUtxDU.d.ts → scope-profiles-6ChZKTy-.d.ts} +1 -1
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/factory.js +4 -4
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +10 -10
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/port.d.ts +1 -1
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/{semantic-consolidation-mSPwQSmF.d.ts → semantic-consolidation-DziYcW5J.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +9 -9
- package/dist/semantic-rule-promotion.js +8 -8
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +8 -8
- package/dist/{service-BICWLwSP.d.ts → service-C7rIBuK_.d.ts} +2 -2
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- package/dist/shared-context/manager.d.ts +1 -1
- package/dist/signal.d.ts +1 -1
- package/dist/source-agent-qualifier.d.ts +1 -1
- package/dist/source-agent-qualifier.js +8 -8
- package/dist/{storage-B7urx1K3.d.ts → storage-B1hEx8Xg.d.ts} +1 -1
- package/dist/storage.d.ts +2 -2
- package/dist/storage.js +7 -7
- package/dist/subject-config.d.ts +1 -1
- package/dist/summarizer.d.ts +1 -1
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/support-passport/index.d.ts +14 -14
- package/dist/support-passport/index.js +29 -29
- package/dist/temporal-supersession.d.ts +2 -2
- package/dist/temporal-timeline-recall.d.ts +1 -1
- package/dist/temporal-validity.d.ts +1 -1
- package/dist/threading.d.ts +1 -1
- package/dist/tier-migration.d.ts +2 -2
- package/dist/tier-routing.d.ts +1 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/capsule-import.js +2 -2
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-ETU5N6nB.d.ts → types-BHDNxGTT.d.ts} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.js +8 -8
- package/dist/who-knows-cli.d.ts +11 -11
- package/dist/who-knows-cli.js +9 -9
- package/dist/who-knows.d.ts +11 -11
- package/dist/who-knows.js +8 -8
- package/dist/write-envelope.d.ts +1 -1
- package/package.json +2 -2
- package/src/access-boundary.ts +5 -0
- package/src/access-http.ts +15 -16
- package/src/access-mcp-output-schemas.ts +5 -0
- package/src/access-mcp.ts +6 -6
- package/src/access-operations.ts +2 -0
- package/src/access-surface-catalog.ts +10 -0
- package/src/eval-trajectory-contracts.ts +411 -0
- package/src/eval-trajectory-store.ts +306 -0
- package/src/eval-trajectory.test.ts +534 -0
- package/src/eval-trajectory.ts +773 -0
- package/src/index.ts +5 -0
- package/src/location/access-operations.ts +84 -0
- package/src/location/http-glue.test.ts +100 -0
- package/src/location/http-glue.ts +85 -0
- package/src/location/index.ts +3 -0
- package/src/location/mcp-tools.ts +82 -0
- package/src/location/provider-setup.test.ts +106 -0
- package/src/location/provider-setup.ts +103 -0
- package/src/location/scheduler.test.ts +113 -0
- package/src/location/scheduler.ts +98 -0
- package/src/location/surfaces.test.ts +241 -0
- package/src/location/surfaces.ts +329 -0
- package/src/maintenance/day-summary-cron.ts +45 -0
- package/src/mcp-read-only-tools.ts +2 -0
- package/src/memory-controller.test.ts +347 -0
- package/src/memory-controller.ts +547 -0
- package/src/memory-worth-outcomes.test.ts +53 -18
- package/src/memory-worth-outcomes.ts +91 -9
- package/src/orchestration/maintenance.ts +22 -30
- package/src/wearables/http-glue.ts +28 -0
- package/dist/chunk-4K7IW3F7.js.map +0 -1
- package/dist/chunk-BA2GLSIP.js.map +0 -1
- package/dist/chunk-CV3GNPOE.js.map +0 -1
- package/dist/chunk-FC7TIRFS.js.map +0 -1
- package/dist/chunk-KTPXXVDQ.js.map +0 -1
- package/dist/chunk-LDBFXD4F.js.map +0 -1
- package/dist/chunk-LYBIHM4N.js.map +0 -1
- package/dist/chunk-N56GVOWR.js.map +0 -1
- /package/dist/{capsule-crypto-YO5QJ6L3.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
- /package/dist/{chunk-BXLOS5AJ.js.map → chunk-2NLLXCJG.js.map} +0 -0
- /package/dist/{chunk-NZPFCP5A.js.map → chunk-2PSX5BJU.js.map} +0 -0
- /package/dist/{chunk-IIRCHGWD.js.map → chunk-3RI5Y7KU.js.map} +0 -0
- /package/dist/{chunk-H7BZBSP6.js.map → chunk-52II7PB6.js.map} +0 -0
- /package/dist/{chunk-J3ATBB7M.js.map → chunk-5DH6PG4B.js.map} +0 -0
- /package/dist/{chunk-M4AHBM72.js.map → chunk-5HERQ5FX.js.map} +0 -0
- /package/dist/{chunk-W675UJCZ.js.map → chunk-5HK3CJAR.js.map} +0 -0
- /package/dist/{chunk-2MVTAIL3.js.map → chunk-5S4LQOPE.js.map} +0 -0
- /package/dist/{chunk-OZDFB22S.js.map → chunk-5VPQSRQO.js.map} +0 -0
- /package/dist/{chunk-YZJM6CLF.js.map → chunk-6CPUQ5D6.js.map} +0 -0
- /package/dist/{chunk-2IXQSGCU.js.map → chunk-7F27PCSN.js.map} +0 -0
- /package/dist/{chunk-OWQNJJY2.js.map → chunk-7TCGNUVP.js.map} +0 -0
- /package/dist/{chunk-3NH3VP3U.js.map → chunk-7WR462EM.js.map} +0 -0
- /package/dist/{chunk-NH6LC57D.js.map → chunk-A32YEQAM.js.map} +0 -0
- /package/dist/{chunk-HF5BUTI6.js.map → chunk-ACOC27BB.js.map} +0 -0
- /package/dist/{chunk-THVI4Y7X.js.map → chunk-BJTHRFFC.js.map} +0 -0
- /package/dist/{chunk-BW4GAF57.js.map → chunk-CFGU52XJ.js.map} +0 -0
- /package/dist/{chunk-DPNXADEI.js.map → chunk-D4QVPP3G.js.map} +0 -0
- /package/dist/{chunk-BK5G2MHO.js.map → chunk-EOHKUWXW.js.map} +0 -0
- /package/dist/{chunk-YNDLCWXS.js.map → chunk-EZ25VE3G.js.map} +0 -0
- /package/dist/{chunk-ZK4BFABK.js.map → chunk-F635GAL7.js.map} +0 -0
- /package/dist/{chunk-IURMJBGP.js.map → chunk-F6QHHRWP.js.map} +0 -0
- /package/dist/{chunk-TJFI3K2O.js.map → chunk-GEPACVWN.js.map} +0 -0
- /package/dist/{chunk-PP7R754B.js.map → chunk-GPFZFCRN.js.map} +0 -0
- /package/dist/{chunk-UCKG36HO.js.map → chunk-GTSVEEP3.js.map} +0 -0
- /package/dist/{chunk-DPGH6LHQ.js.map → chunk-I7EX6KSH.js.map} +0 -0
- /package/dist/{chunk-JPAKBNTM.js.map → chunk-IP4ZNT4U.js.map} +0 -0
- /package/dist/{chunk-AXGFOFNY.js.map → chunk-IY7UXD3J.js.map} +0 -0
- /package/dist/{chunk-YHCBJULX.js.map → chunk-JAQXUGLN.js.map} +0 -0
- /package/dist/{chunk-RKNJBZ55.js.map → chunk-JBPKEARU.js.map} +0 -0
- /package/dist/{chunk-VDX2J7OX.js.map → chunk-KQAFEZQX.js.map} +0 -0
- /package/dist/{chunk-D2YNNDML.js.map → chunk-KWIGDKM2.js.map} +0 -0
- /package/dist/{chunk-YB4GBWBU.js.map → chunk-LLQCM2U2.js.map} +0 -0
- /package/dist/{chunk-OLBZ2WGG.js.map → chunk-LTBKKSCX.js.map} +0 -0
- /package/dist/{chunk-DORFF5N5.js.map → chunk-NG3MBQV4.js.map} +0 -0
- /package/dist/{chunk-DUEDOYZD.js.map → chunk-OPGL46PX.js.map} +0 -0
- /package/dist/{chunk-OUKBMQ2O.js.map → chunk-PD66CVSD.js.map} +0 -0
- /package/dist/{chunk-CQBIN77D.js.map → chunk-PDDSFELN.js.map} +0 -0
- /package/dist/{chunk-6433HV72.js.map → chunk-PMVPCZJZ.js.map} +0 -0
- /package/dist/{chunk-DJZWNKFO.js.map → chunk-RGCF4XNH.js.map} +0 -0
- /package/dist/{chunk-4JSF7UUP.js.map → chunk-S3K2CIK5.js.map} +0 -0
- /package/dist/{chunk-OCCHUEZB.js.map → chunk-SEA6M7SS.js.map} +0 -0
- /package/dist/{chunk-KOO37E4Y.js.map → chunk-SVVIASVX.js.map} +0 -0
- /package/dist/{chunk-FBR7PIL4.js.map → chunk-VKCAHCBI.js.map} +0 -0
- /package/dist/{chunk-WDXD6ITO.js.map → chunk-VXVZ2GM3.js.map} +0 -0
- /package/dist/{chunk-DUZARALI.js.map → chunk-WTOZBZNN.js.map} +0 -0
- /package/dist/{chunk-DQEMWVMT.js.map → chunk-X7Y7WX73.js.map} +0 -0
- /package/dist/{chunk-2EPOGPKO.js.map → chunk-YKWFK7XA.js.map} +0 -0
- /package/dist/{chunk-BIJAWZYW.js.map → chunk-YMOPYG3K.js.map} +0 -0
- /package/dist/{chunk-UFR6HX7A.js.map → chunk-YRVAKONL.js.map} +0 -0
- /package/dist/{chunk-ECLJ4LA2.js.map → chunk-YWSQD2IB.js.map} +0 -0
- /package/dist/{chunk-NLEH4RTB.js.map → chunk-Z4U3UN56.js.map} +0 -0
- /package/dist/{chunk-YDKF4MSJ.js.map → chunk-ZAOHJDKH.js.map} +0 -0
- /package/dist/{chunk-KFIOPZ25.js.map → chunk-ZIJDI4CP.js.map} +0 -0
- /package/dist/{graph-edge-decay-FXGELBFA.js.map → eval-trajectory-contracts.js.map} +0 -0
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
import { planRecallMode } from "./intent.js";
|
|
3
|
+
import { evaluateMemoryActionPolicy } from "./memory-action-policy.js";
|
|
4
|
+
import type { RuntimePolicyValues } from "./policy-runtime.js";
|
|
5
|
+
import type { UtilityRuntimeValues } from "./utility-runtime.js";
|
|
6
|
+
import type { MemoryActionEligibilityContext, MemoryActionType, RecallPlanMode } from "./types.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Gated unified memory controller (#2348).
|
|
10
|
+
*
|
|
11
|
+
* One state enters, one choice leaves. Host-free: every effectful collaborator
|
|
12
|
+
* (adapters, executors, report reader, recorder, telemetry, clock) is injected.
|
|
13
|
+
* The coordinator creates no store and claims no counterfactual lift.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export type MemoryControllerMode = "off" | "shadow" | "active";
|
|
17
|
+
|
|
18
|
+
export type MemoryControllerActionFamily = "persistent_memory" | "recall" | "active_context" | "no_op";
|
|
19
|
+
|
|
20
|
+
/** #2347 adapter seam: the host supplies plans, core only picks one. */
|
|
21
|
+
export interface ActiveContextMessage {
|
|
22
|
+
id: string;
|
|
23
|
+
text: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ActiveContextPlan {
|
|
27
|
+
transform: "SUMMARY" | "FILTER";
|
|
28
|
+
messageIds: string[];
|
|
29
|
+
planId: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ActiveContextAdapter {
|
|
33
|
+
plan(messages: ActiveContextMessage[]): ActiveContextPlan | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** #2345 report + #2346 paired-seed evidence, read through one port. */
|
|
37
|
+
export interface MemoryControllerEvidenceReport {
|
|
38
|
+
status: "pass" | "fail";
|
|
39
|
+
version: string;
|
|
40
|
+
configHash: string;
|
|
41
|
+
generatedAt: string;
|
|
42
|
+
/** sha256 over the canonical report fields; recomputed on verification. */
|
|
43
|
+
reportHash: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface MemoryControllerPairedSeedEvidence {
|
|
47
|
+
status: "pass" | "fail";
|
|
48
|
+
seedCount: number;
|
|
49
|
+
generatedAt: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface MemoryControllerEvidence {
|
|
53
|
+
report: MemoryControllerEvidenceReport;
|
|
54
|
+
pairedSeed: MemoryControllerPairedSeedEvidence;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface MemoryControllerReportReader {
|
|
58
|
+
read(): Promise<MemoryControllerEvidence | null>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface MemoryControllerReceipt {
|
|
62
|
+
decisionId: string;
|
|
63
|
+
ok: boolean;
|
|
64
|
+
detail?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface MemoryControllerExecutors {
|
|
68
|
+
executePersistentMemory?(input: {
|
|
69
|
+
decisionId: string;
|
|
70
|
+
action: MemoryActionType;
|
|
71
|
+
eligibility: MemoryActionEligibilityContext;
|
|
72
|
+
stateHash: string;
|
|
73
|
+
}): Promise<MemoryControllerReceipt>;
|
|
74
|
+
executeRecall?(input: { decisionId: string; mode: RecallPlanMode }): Promise<MemoryControllerReceipt>;
|
|
75
|
+
executeActiveContext?(input: {
|
|
76
|
+
decisionId: string;
|
|
77
|
+
plan: ActiveContextPlan;
|
|
78
|
+
}): Promise<MemoryControllerReceipt>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface MemoryControllerEvent {
|
|
82
|
+
schemaVersion: 1;
|
|
83
|
+
phase: "choice" | "outcome";
|
|
84
|
+
decisionId: string;
|
|
85
|
+
timestamp: string;
|
|
86
|
+
requestedMode: MemoryControllerMode;
|
|
87
|
+
effectiveMode: MemoryControllerMode;
|
|
88
|
+
stateHash: string;
|
|
89
|
+
choice: MemoryControllerChoice;
|
|
90
|
+
scores: Record<MemoryControllerActionFamily, number>;
|
|
91
|
+
executed: boolean;
|
|
92
|
+
reviewOnly?: boolean;
|
|
93
|
+
demotionReasons?: string[];
|
|
94
|
+
failureClass?: "record_failed" | "executor_error" | "bad_receipt" | "no_executor";
|
|
95
|
+
receipt?: MemoryControllerReceipt;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface MemoryControllerRecorder {
|
|
99
|
+
record(event: MemoryControllerEvent): Promise<void>;
|
|
100
|
+
/** Prior shadow choice records; active promotion requires shadow history. */
|
|
101
|
+
countShadowRecords(): Promise<number>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface MemoryControllerConfig {
|
|
105
|
+
mode: MemoryControllerMode;
|
|
106
|
+
/** Expected #2345 report schema version. */
|
|
107
|
+
reportVersion: string;
|
|
108
|
+
/** Evidence older than this is stale and forces shadow. */
|
|
109
|
+
evidenceMaxAgeMs: number;
|
|
110
|
+
/** Paired-seed arms must cover at least this many seeds (#2346). */
|
|
111
|
+
minPairedSeeds: number;
|
|
112
|
+
/** Active promotion requires at least this many prior shadow records. */
|
|
113
|
+
shadowMinRecords: number;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface MemoryControllerState {
|
|
117
|
+
prompt: string;
|
|
118
|
+
persistentMemoryCandidate?: {
|
|
119
|
+
action: MemoryActionType;
|
|
120
|
+
eligibility: MemoryActionEligibilityContext;
|
|
121
|
+
};
|
|
122
|
+
contextMessages?: ActiveContextMessage[];
|
|
123
|
+
/** 0..1 host-measured context pressure. */
|
|
124
|
+
contextPressure?: number;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export type MemoryControllerChoice =
|
|
128
|
+
| { family: "persistent_memory"; action: MemoryActionType; eligibility: MemoryActionEligibilityContext }
|
|
129
|
+
| { family: "recall"; mode: RecallPlanMode }
|
|
130
|
+
| { family: "active_context"; plan: ActiveContextPlan }
|
|
131
|
+
| { family: "no_op" };
|
|
132
|
+
|
|
133
|
+
export interface MemoryControllerRunResult {
|
|
134
|
+
decisionId: string;
|
|
135
|
+
requestedMode: MemoryControllerMode;
|
|
136
|
+
effectiveMode: MemoryControllerMode;
|
|
137
|
+
stateHash: string;
|
|
138
|
+
choice: MemoryControllerChoice;
|
|
139
|
+
scores: Record<MemoryControllerActionFamily, number>;
|
|
140
|
+
executed: boolean;
|
|
141
|
+
reviewOnly: boolean;
|
|
142
|
+
recorded: boolean;
|
|
143
|
+
receipt?: MemoryControllerReceipt;
|
|
144
|
+
demotionReasons: string[];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface MemoryControllerDeps {
|
|
148
|
+
config: MemoryControllerConfig;
|
|
149
|
+
reportReader?: MemoryControllerReportReader;
|
|
150
|
+
recorder?: MemoryControllerRecorder;
|
|
151
|
+
executors?: MemoryControllerExecutors;
|
|
152
|
+
activeContextAdapter?: ActiveContextAdapter;
|
|
153
|
+
policyRuntime?: { loadRuntimeValues(): Promise<RuntimePolicyValues | null> };
|
|
154
|
+
readUtilityRuntime?: () => Promise<UtilityRuntimeValues | null>;
|
|
155
|
+
telemetry?: (event: MemoryControllerEvent) => void;
|
|
156
|
+
clock?: () => Date;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const NO_OP_FLOOR = 0.35;
|
|
160
|
+
/** `discard` (and any destructive change) stays review-only in active mode. */
|
|
161
|
+
const REVIEW_ONLY_ACTIONS: Partial<Record<MemoryActionType, true>> = { discard: true };
|
|
162
|
+
|
|
163
|
+
export function controllerConfigHash(config: MemoryControllerConfig): string {
|
|
164
|
+
return sha256(
|
|
165
|
+
JSON.stringify({
|
|
166
|
+
mode: config.mode,
|
|
167
|
+
reportVersion: config.reportVersion,
|
|
168
|
+
evidenceMaxAgeMs: config.evidenceMaxAgeMs,
|
|
169
|
+
minPairedSeeds: config.minPairedSeeds,
|
|
170
|
+
shadowMinRecords: config.shadowMinRecords,
|
|
171
|
+
})
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export function hashControllerState(state: MemoryControllerState): string {
|
|
176
|
+
return sha256(
|
|
177
|
+
JSON.stringify({
|
|
178
|
+
prompt: state.prompt,
|
|
179
|
+
persistentMemoryCandidate: state.persistentMemoryCandidate ?? null,
|
|
180
|
+
contextMessages: state.contextMessages ?? null,
|
|
181
|
+
contextPressure: state.contextPressure ?? null,
|
|
182
|
+
})
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Canonical #2345 report hash; producers sign with this, the controller verifies. */
|
|
187
|
+
export function computeEvidenceReportHash(fields: {
|
|
188
|
+
status: MemoryControllerEvidenceReport["status"];
|
|
189
|
+
version: string;
|
|
190
|
+
configHash: string;
|
|
191
|
+
generatedAt: string;
|
|
192
|
+
}): string {
|
|
193
|
+
return sha256(JSON.stringify(fields));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** Verifies the #2345 report hash over its canonical fields. */
|
|
197
|
+
export function verifyEvidenceReport(report: MemoryControllerEvidenceReport): boolean {
|
|
198
|
+
return (
|
|
199
|
+
computeEvidenceReportHash({
|
|
200
|
+
status: report.status,
|
|
201
|
+
version: report.version,
|
|
202
|
+
configHash: report.configHash,
|
|
203
|
+
generatedAt: report.generatedAt,
|
|
204
|
+
}) === report.reportHash
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function sha256(input: string): string {
|
|
209
|
+
return createHash("sha256").update(input).digest("hex");
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function clampScore(value: number): number {
|
|
213
|
+
if (!Number.isFinite(value)) return Number.NaN;
|
|
214
|
+
return Math.max(0, Math.min(1, value));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Bad scores fail closed to `no_op`.
|
|
219
|
+
*/
|
|
220
|
+
export function chooseAction(input: {
|
|
221
|
+
state: MemoryControllerState;
|
|
222
|
+
activeContextAdapter?: ActiveContextAdapter;
|
|
223
|
+
runtimeValues?: RuntimePolicyValues | null;
|
|
224
|
+
utilityValues?: UtilityRuntimeValues | null;
|
|
225
|
+
}): { choice: MemoryControllerChoice; scores: Record<MemoryControllerActionFamily, number> } {
|
|
226
|
+
const { state, activeContextAdapter, runtimeValues, utilityValues } = input;
|
|
227
|
+
|
|
228
|
+
// recall: current recall path.
|
|
229
|
+
const recallMode = planRecallMode(state.prompt ?? "");
|
|
230
|
+
const recallScore =
|
|
231
|
+
recallMode === "no_recall" ? 0 : recallMode === "minimal" ? 0.4 : 0.6 + 0.2 * (runtimeValues?.recencyWeight ?? 0);
|
|
232
|
+
|
|
233
|
+
// persistent_memory: current action path + policy.
|
|
234
|
+
let persistentScore = 0;
|
|
235
|
+
const candidate = state.persistentMemoryCandidate;
|
|
236
|
+
if (candidate) {
|
|
237
|
+
const policy = evaluateMemoryActionPolicy({
|
|
238
|
+
action: candidate.action,
|
|
239
|
+
eligibility: candidate.eligibility,
|
|
240
|
+
options: { actionsEnabled: true, maxCompressionTokensPerHour: Number.POSITIVE_INFINITY },
|
|
241
|
+
});
|
|
242
|
+
if (policy.decision === "allow") {
|
|
243
|
+
persistentScore = 0.4 + 0.4 * (candidate.eligibility.confidence ?? 0);
|
|
244
|
+
} else if (policy.decision === "defer") {
|
|
245
|
+
persistentScore = 0.2;
|
|
246
|
+
}
|
|
247
|
+
// Utility runtime may suppress the persistent family.
|
|
248
|
+
if (utilityValues && utilityValues.rankingSuppressMultiplier > 1) {
|
|
249
|
+
persistentScore *= 1 / utilityValues.rankingSuppressMultiplier;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// active_context: current context path through the #2347 adapter.
|
|
254
|
+
let contextScore = 0;
|
|
255
|
+
let contextPlan: ActiveContextPlan | null = null;
|
|
256
|
+
const pressure = state.contextPressure;
|
|
257
|
+
if (activeContextAdapter && typeof pressure === "number" && Number.isFinite(pressure) && pressure > 0.5) {
|
|
258
|
+
contextPlan = activeContextAdapter.plan(state.contextMessages ?? []);
|
|
259
|
+
if (contextPlan && contextPlan.messageIds.length > 0) {
|
|
260
|
+
contextScore = 0.3 + 0.5 * Math.max(0, Math.min(1, pressure));
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const scores: Record<MemoryControllerActionFamily, number> = {
|
|
265
|
+
recall: clampScore(recallScore),
|
|
266
|
+
persistent_memory: clampScore(persistentScore),
|
|
267
|
+
active_context: clampScore(contextScore),
|
|
268
|
+
no_op: NO_OP_FLOOR,
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
// Bad scores fail closed.
|
|
272
|
+
if (Object.values(scores).some((score) => !Number.isFinite(score) || score < 0 || score > 1)) {
|
|
273
|
+
return { choice: { family: "no_op" }, scores };
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
let choice: MemoryControllerChoice = { family: "no_op" };
|
|
277
|
+
let best = scores.no_op;
|
|
278
|
+
if (scores.recall > best) {
|
|
279
|
+
best = scores.recall;
|
|
280
|
+
choice = { family: "recall", mode: recallMode };
|
|
281
|
+
}
|
|
282
|
+
if (scores.persistent_memory > best) {
|
|
283
|
+
best = scores.persistent_memory;
|
|
284
|
+
choice = {
|
|
285
|
+
family: "persistent_memory",
|
|
286
|
+
action: candidate!.action,
|
|
287
|
+
eligibility: candidate!.eligibility,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
if (scores.active_context > best) {
|
|
291
|
+
choice = { family: "active_context", plan: contextPlan! };
|
|
292
|
+
}
|
|
293
|
+
return { choice, scores };
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/** Returns the demotion reasons when active-mode gates fail; empty means go. */
|
|
297
|
+
export async function evaluateActiveGates(input: {
|
|
298
|
+
config: MemoryControllerConfig;
|
|
299
|
+
reportReader?: MemoryControllerReportReader;
|
|
300
|
+
recorder?: MemoryControllerRecorder;
|
|
301
|
+
consecutiveReceiptFailures: number;
|
|
302
|
+
now: Date;
|
|
303
|
+
}): Promise<string[]> {
|
|
304
|
+
const { config, reportReader, recorder, consecutiveReceiptFailures, now } = input;
|
|
305
|
+
const reasons: string[] = [];
|
|
306
|
+
|
|
307
|
+
if (!reportReader) return ["no_report_reader"];
|
|
308
|
+
|
|
309
|
+
const evidence = await reportReader.read();
|
|
310
|
+
if (!evidence) return ["no_evidence"];
|
|
311
|
+
|
|
312
|
+
const { report, pairedSeed } = evidence;
|
|
313
|
+
if (report.status !== "pass") reasons.push("report_not_passing");
|
|
314
|
+
if (report.version !== config.reportVersion) reasons.push("report_version_mismatch");
|
|
315
|
+
if (report.configHash !== controllerConfigHash(config)) reasons.push("report_config_unbound");
|
|
316
|
+
if (!verifyEvidenceReport(report)) reasons.push("report_hash_invalid");
|
|
317
|
+
const reportGeneratedAt = Date.parse(report.generatedAt);
|
|
318
|
+
if (!Number.isFinite(reportGeneratedAt) || now.getTime() - reportGeneratedAt > config.evidenceMaxAgeMs) {
|
|
319
|
+
reasons.push("report_stale");
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (pairedSeed.status !== "pass") reasons.push("paired_seed_not_passing");
|
|
323
|
+
if (pairedSeed.seedCount < config.minPairedSeeds) reasons.push("paired_seed_count_low");
|
|
324
|
+
const seedGeneratedAt = Date.parse(pairedSeed.generatedAt);
|
|
325
|
+
if (!Number.isFinite(seedGeneratedAt) || now.getTime() - seedGeneratedAt > config.evidenceMaxAgeMs) {
|
|
326
|
+
reasons.push("paired_seed_stale");
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const shadowRecords = recorder ? await recorder.countShadowRecords() : 0;
|
|
330
|
+
if (shadowRecords < config.shadowMinRecords) reasons.push("shadow_history_insufficient");
|
|
331
|
+
|
|
332
|
+
if (consecutiveReceiptFailures > 0) reasons.push("recent_receipt_failures");
|
|
333
|
+
|
|
334
|
+
return reasons;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
export class MemoryControllerCoordinator {
|
|
338
|
+
private readonly deps: MemoryControllerDeps;
|
|
339
|
+
private readonly clock: () => Date;
|
|
340
|
+
private consecutiveReceiptFailures = 0;
|
|
341
|
+
|
|
342
|
+
constructor(deps: MemoryControllerDeps) {
|
|
343
|
+
this.deps = deps;
|
|
344
|
+
this.clock = deps.clock ?? (() => new Date());
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
async run(state: MemoryControllerState): Promise<MemoryControllerRunResult> {
|
|
348
|
+
const decisionId = randomUUID();
|
|
349
|
+
const stateHash = hashControllerState(state);
|
|
350
|
+
const requestedMode = this.deps.config.mode;
|
|
351
|
+
|
|
352
|
+
// off: no choice, no read, no write, no call.
|
|
353
|
+
if (requestedMode === "off") {
|
|
354
|
+
return {
|
|
355
|
+
decisionId,
|
|
356
|
+
requestedMode,
|
|
357
|
+
effectiveMode: "off",
|
|
358
|
+
stateHash,
|
|
359
|
+
choice: { family: "no_op" },
|
|
360
|
+
scores: { persistent_memory: 0, recall: 0, active_context: 0, no_op: 0 },
|
|
361
|
+
executed: false,
|
|
362
|
+
reviewOnly: false,
|
|
363
|
+
recorded: false,
|
|
364
|
+
demotionReasons: ["mode_off"],
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
const [runtimeValues, utilityValues] = await Promise.all([
|
|
369
|
+
this.deps.policyRuntime?.loadRuntimeValues() ?? null,
|
|
370
|
+
this.deps.readUtilityRuntime?.() ?? null,
|
|
371
|
+
]);
|
|
372
|
+
const { choice, scores } = chooseAction({
|
|
373
|
+
state,
|
|
374
|
+
activeContextAdapter: this.deps.activeContextAdapter,
|
|
375
|
+
runtimeValues,
|
|
376
|
+
utilityValues,
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
let demotionReasons: string[] = [];
|
|
380
|
+
let effectiveMode = requestedMode;
|
|
381
|
+
if (requestedMode === "active") {
|
|
382
|
+
demotionReasons = await evaluateActiveGates({
|
|
383
|
+
config: this.deps.config,
|
|
384
|
+
reportReader: this.deps.reportReader,
|
|
385
|
+
recorder: this.deps.recorder,
|
|
386
|
+
consecutiveReceiptFailures: this.consecutiveReceiptFailures,
|
|
387
|
+
now: this.clock(),
|
|
388
|
+
});
|
|
389
|
+
if (demotionReasons.length > 0) effectiveMode = "shadow";
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
const baseEvent: MemoryControllerEvent = {
|
|
393
|
+
schemaVersion: 1,
|
|
394
|
+
phase: "choice",
|
|
395
|
+
decisionId,
|
|
396
|
+
timestamp: this.clock().toISOString(),
|
|
397
|
+
requestedMode,
|
|
398
|
+
effectiveMode,
|
|
399
|
+
stateHash,
|
|
400
|
+
choice,
|
|
401
|
+
scores,
|
|
402
|
+
executed: false,
|
|
403
|
+
...(demotionReasons.length > 0 ? { demotionReasons } : {}),
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
// Shadow records before any active dispatch.
|
|
407
|
+
let recorded = false;
|
|
408
|
+
if (this.deps.recorder) {
|
|
409
|
+
try {
|
|
410
|
+
await this.deps.recorder.record(baseEvent);
|
|
411
|
+
this.deps.telemetry?.(baseEvent);
|
|
412
|
+
recorded = true;
|
|
413
|
+
} catch {
|
|
414
|
+
// Bad recorder stops work: no dispatch, no outcome event.
|
|
415
|
+
return {
|
|
416
|
+
decisionId,
|
|
417
|
+
requestedMode,
|
|
418
|
+
effectiveMode,
|
|
419
|
+
stateHash,
|
|
420
|
+
choice,
|
|
421
|
+
scores,
|
|
422
|
+
executed: false,
|
|
423
|
+
reviewOnly: false,
|
|
424
|
+
recorded: false,
|
|
425
|
+
demotionReasons: [...demotionReasons, "record_failed"],
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
if (effectiveMode !== "active") {
|
|
431
|
+
return {
|
|
432
|
+
decisionId,
|
|
433
|
+
requestedMode,
|
|
434
|
+
effectiveMode,
|
|
435
|
+
stateHash,
|
|
436
|
+
choice,
|
|
437
|
+
scores,
|
|
438
|
+
executed: false,
|
|
439
|
+
reviewOnly: false,
|
|
440
|
+
recorded,
|
|
441
|
+
demotionReasons,
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// First active scope: reversible actions only.
|
|
446
|
+
if (choice.family === "persistent_memory" && REVIEW_ONLY_ACTIONS[choice.action]) {
|
|
447
|
+
const event: MemoryControllerEvent = {
|
|
448
|
+
...baseEvent,
|
|
449
|
+
phase: "outcome",
|
|
450
|
+
reviewOnly: true,
|
|
451
|
+
demotionReasons: ["review_only_action"],
|
|
452
|
+
};
|
|
453
|
+
await this.recordOutcome(event);
|
|
454
|
+
return {
|
|
455
|
+
decisionId,
|
|
456
|
+
requestedMode,
|
|
457
|
+
effectiveMode,
|
|
458
|
+
stateHash,
|
|
459
|
+
choice,
|
|
460
|
+
scores,
|
|
461
|
+
executed: false,
|
|
462
|
+
reviewOnly: true,
|
|
463
|
+
recorded,
|
|
464
|
+
demotionReasons,
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
const receipt = await this.dispatch(choice, stateHash, decisionId, baseEvent);
|
|
469
|
+
return {
|
|
470
|
+
decisionId,
|
|
471
|
+
requestedMode,
|
|
472
|
+
effectiveMode,
|
|
473
|
+
stateHash,
|
|
474
|
+
choice,
|
|
475
|
+
scores,
|
|
476
|
+
executed: receipt?.ok === true,
|
|
477
|
+
reviewOnly: false,
|
|
478
|
+
recorded,
|
|
479
|
+
...(receipt ? { receipt } : {}),
|
|
480
|
+
demotionReasons,
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
private async dispatch(
|
|
485
|
+
choice: MemoryControllerChoice,
|
|
486
|
+
stateHash: string,
|
|
487
|
+
decisionId: string,
|
|
488
|
+
baseEvent: MemoryControllerEvent
|
|
489
|
+
): Promise<MemoryControllerReceipt | undefined> {
|
|
490
|
+
const executors = this.deps.executors ?? {};
|
|
491
|
+
try {
|
|
492
|
+
let receipt: MemoryControllerReceipt | undefined;
|
|
493
|
+
if (choice.family === "persistent_memory") {
|
|
494
|
+
if (!executors.executePersistentMemory) throw new Error("no_executor:persistent_memory");
|
|
495
|
+
receipt = await executors.executePersistentMemory({
|
|
496
|
+
decisionId,
|
|
497
|
+
action: choice.action,
|
|
498
|
+
eligibility: choice.eligibility,
|
|
499
|
+
stateHash,
|
|
500
|
+
});
|
|
501
|
+
} else if (choice.family === "recall") {
|
|
502
|
+
if (!executors.executeRecall) throw new Error("no_executor:recall");
|
|
503
|
+
receipt = await executors.executeRecall({ decisionId, mode: choice.mode });
|
|
504
|
+
} else if (choice.family === "active_context") {
|
|
505
|
+
if (!executors.executeActiveContext) throw new Error("no_executor:active_context");
|
|
506
|
+
receipt = await executors.executeActiveContext({ decisionId, plan: choice.plan });
|
|
507
|
+
} else {
|
|
508
|
+
// no_op executed trivially; no executor call.
|
|
509
|
+
receipt = { decisionId, ok: true };
|
|
510
|
+
}
|
|
511
|
+
if (!isValidReceipt(receipt, decisionId)) {
|
|
512
|
+
this.consecutiveReceiptFailures += 1;
|
|
513
|
+
await this.recordOutcome({ ...baseEvent, phase: "outcome", failureClass: "bad_receipt" });
|
|
514
|
+
return undefined;
|
|
515
|
+
}
|
|
516
|
+
this.consecutiveReceiptFailures = 0;
|
|
517
|
+
await this.recordOutcome({ ...baseEvent, phase: "outcome", executed: receipt.ok, receipt });
|
|
518
|
+
return receipt;
|
|
519
|
+
} catch (error) {
|
|
520
|
+
this.consecutiveReceiptFailures += 1;
|
|
521
|
+
await this.recordOutcome({
|
|
522
|
+
...baseEvent,
|
|
523
|
+
phase: "outcome",
|
|
524
|
+
failureClass: (error as Error)?.message?.startsWith("no_executor:") ? "no_executor" : "executor_error",
|
|
525
|
+
});
|
|
526
|
+
return undefined;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
private async recordOutcome(event: MemoryControllerEvent): Promise<void> {
|
|
531
|
+
if (!this.deps.recorder) return;
|
|
532
|
+
await this.deps.recorder.record(event);
|
|
533
|
+
this.deps.telemetry?.(event);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function isValidReceipt(receipt: unknown, decisionId: string): boolean {
|
|
538
|
+
return (
|
|
539
|
+
typeof receipt === "object" &&
|
|
540
|
+
receipt !== null &&
|
|
541
|
+
(receipt as MemoryControllerReceipt).decisionId === decisionId &&
|
|
542
|
+
typeof (receipt as MemoryControllerReceipt).ok === "boolean"
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
// ponytail: consecutiveReceiptFailures is per-instance, not persisted; persist
|
|
547
|
+
// with the recorder if coordinator restarts must carry receipt health forward.
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import test from "node:test";
|
|
2
1
|
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import
|
|
5
|
+
import test from "node:test";
|
|
6
6
|
|
|
7
|
-
import { StorageManager } from "./storage.js";
|
|
8
7
|
import {
|
|
9
|
-
recordMemoryOutcome,
|
|
10
8
|
memoryWorthOutcomeEligibleCategories,
|
|
9
|
+
recordMemoryOutcome,
|
|
10
|
+
toMemoryOutcomeObservation,
|
|
11
11
|
} from "./memory-worth-outcomes.js";
|
|
12
|
+
import { StorageManager } from "./storage.js";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Issue #560 PR 3 — tests for the outcome signal pipeline.
|
|
@@ -27,7 +28,7 @@ import {
|
|
|
27
28
|
async function writeFactFile(
|
|
28
29
|
storage: StorageManager,
|
|
29
30
|
body: string,
|
|
30
|
-
extraFrontmatterLines: string[] = []
|
|
31
|
+
extraFrontmatterLines: string[] = []
|
|
31
32
|
): Promise<{ id: string; filePath: string }> {
|
|
32
33
|
const today = new Date().toISOString().slice(0, 10);
|
|
33
34
|
const id = `fact-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
@@ -51,10 +52,7 @@ async function writeFactFile(
|
|
|
51
52
|
return { id, filePath };
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
async function writeCorrectionFile(
|
|
55
|
-
storage: StorageManager,
|
|
56
|
-
body: string,
|
|
57
|
-
): Promise<{ id: string; filePath: string }> {
|
|
55
|
+
async function writeCorrectionFile(storage: StorageManager, body: string): Promise<{ id: string; filePath: string }> {
|
|
58
56
|
const id = `correction-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
59
57
|
const lines = [
|
|
60
58
|
"---",
|
|
@@ -68,10 +66,7 @@ async function writeCorrectionFile(
|
|
|
68
66
|
"tags: []",
|
|
69
67
|
"---",
|
|
70
68
|
];
|
|
71
|
-
const correctionsDir = path.join(
|
|
72
|
-
(storage as unknown as { baseDir: string }).baseDir,
|
|
73
|
-
"corrections",
|
|
74
|
-
);
|
|
69
|
+
const correctionsDir = path.join((storage as unknown as { baseDir: string }).baseDir, "corrections");
|
|
75
70
|
await mkdir(correctionsDir, { recursive: true });
|
|
76
71
|
const filePath = path.join(correctionsDir, `${id}.md`);
|
|
77
72
|
await writeFile(filePath, `${lines.join("\n")}\n\n${body}\n`, "utf-8");
|
|
@@ -140,10 +135,7 @@ test("consecutive outcomes accumulate independently", async () => {
|
|
|
140
135
|
try {
|
|
141
136
|
const storage = new StorageManager(dir);
|
|
142
137
|
await storage.ensureDirectories();
|
|
143
|
-
const { id, filePath } = await writeFactFile(storage, "Accumulating outcomes.", [
|
|
144
|
-
"mw_success: 2",
|
|
145
|
-
"mw_fail: 0",
|
|
146
|
-
]);
|
|
138
|
+
const { id, filePath } = await writeFactFile(storage, "Accumulating outcomes.", ["mw_success: 2", "mw_fail: 0"]);
|
|
147
139
|
|
|
148
140
|
await recordMemoryOutcome(storage, { memoryPath: filePath, outcome: "success" });
|
|
149
141
|
await recordMemoryOutcome(storage, { memoryPath: filePath, outcome: "failure" });
|
|
@@ -289,7 +281,7 @@ test("concurrent outcomes for the same memory do NOT lose updates", async () =>
|
|
|
289
281
|
|
|
290
282
|
const N = 10;
|
|
291
283
|
const calls = Array.from({ length: N }, () =>
|
|
292
|
-
recordMemoryOutcome(storage, { memoryPath: filePath, outcome: "success" })
|
|
284
|
+
recordMemoryOutcome(storage, { memoryPath: filePath, outcome: "success" })
|
|
293
285
|
);
|
|
294
286
|
const results = await Promise.all(calls);
|
|
295
287
|
|
|
@@ -318,3 +310,46 @@ test("eligible-category set is exactly {fact, procedure}", () => {
|
|
|
318
310
|
assert.ok(eligible.has("fact"));
|
|
319
311
|
assert.ok(eligible.has("procedure"));
|
|
320
312
|
});
|
|
313
|
+
|
|
314
|
+
// ---------------------------------------------------------------------------
|
|
315
|
+
// Issue #2345 — pure MemoryOutcomeObservation view (no writes, no counters)
|
|
316
|
+
// ---------------------------------------------------------------------------
|
|
317
|
+
|
|
318
|
+
test("outcome facts with time and join data become observations", () => {
|
|
319
|
+
const view = toMemoryOutcomeObservation({
|
|
320
|
+
memoryId: "fact-1",
|
|
321
|
+
namespace: "test-ns",
|
|
322
|
+
outcome: "success",
|
|
323
|
+
observedAt: "2026-08-12T00:00:00.000Z",
|
|
324
|
+
joinId: "act-1",
|
|
325
|
+
});
|
|
326
|
+
assert.equal(view.status, "observed");
|
|
327
|
+
if (view.status === "observed") {
|
|
328
|
+
assert.equal(view.observation.schemaVersion, 1);
|
|
329
|
+
assert.equal(view.observation.observedAt, "2026-08-12T00:00:00.000Z");
|
|
330
|
+
assert.equal(view.observation.joinId, "act-1");
|
|
331
|
+
// Round-trips through public types (undefined optionals drop in JSON).
|
|
332
|
+
const roundTripped = JSON.parse(JSON.stringify(view.observation)) as Record<string, unknown>;
|
|
333
|
+
assert.equal(roundTripped.schemaVersion, 1);
|
|
334
|
+
assert.equal(roundTripped.memoryId, "fact-1");
|
|
335
|
+
assert.equal(roundTripped.joinId, "act-1");
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
test("counter-only rows stay missing_observation and never guess an action", () => {
|
|
340
|
+
const noTime = toMemoryOutcomeObservation({
|
|
341
|
+
memoryId: "fact-1",
|
|
342
|
+
namespace: "test-ns",
|
|
343
|
+
outcome: "success",
|
|
344
|
+
joinId: "act-1",
|
|
345
|
+
});
|
|
346
|
+
assert.deepEqual(noTime, { status: "missing_observation", memoryId: "fact-1", reason: "missing_observed_at" });
|
|
347
|
+
|
|
348
|
+
const noJoin = toMemoryOutcomeObservation({
|
|
349
|
+
memoryId: "fact-2",
|
|
350
|
+
namespace: "test-ns",
|
|
351
|
+
outcome: "failure",
|
|
352
|
+
observedAt: new Date("2026-08-12T00:00:00.000Z"),
|
|
353
|
+
});
|
|
354
|
+
assert.deepEqual(noJoin, { status: "missing_observation", memoryId: "fact-2", reason: "missing_join_data" });
|
|
355
|
+
});
|