@remnic/core 9.69.10 → 9.69.12
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 +15 -13
- package/dist/access-admin-ops-surface.js +46 -34
- package/dist/access-authorization-probe.d.ts +13 -11
- package/dist/access-authorization-probe.js +47 -35
- package/dist/access-boundary.d.ts +13 -11
- package/dist/access-boundary.js +46 -34
- package/dist/access-cli.js +108 -97
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.d.ts +2 -1
- package/dist/access-extraction-force-flush.d.ts +13 -11
- package/dist/access-extraction-force-flush.js +46 -34
- package/dist/access-health-types.d.ts +2 -1
- package/dist/access-http-lcm-compaction.d.ts +13 -11
- package/dist/access-http-lifecycle-flush.d.ts +13 -11
- package/dist/access-http-offline-stream.d.ts +13 -11
- package/dist/access-http-query.d.ts +3 -2
- package/dist/access-http-query.js +48 -36
- package/dist/access-http.d.ts +14 -12
- package/dist/access-http.js +67 -53
- package/dist/access-identity-continuity-surface.d.ts +10 -9
- package/dist/access-identity-continuity-surface.js +46 -34
- package/dist/access-lcm-surface.d.ts +13 -11
- package/dist/access-lcm-surface.js +46 -34
- package/dist/access-mcp-output-schemas.js +1 -1
- package/dist/access-mcp.d.ts +13 -11
- package/dist/access-mcp.js +58 -45
- package/dist/access-memory-search-fanout.d.ts +3 -2
- package/dist/{access-namespace-preflight-S8fhQcCo.d.ts → access-namespace-preflight-Cy0yPsaE.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +4 -3
- package/dist/access-namespace-preflight.js +46 -34
- package/dist/access-observe-write-surface.d.ts +15 -13
- package/dist/access-observe-write-surface.js +46 -34
- package/dist/access-offline-manifest.d.ts +10 -9
- package/dist/access-offline-manifest.js +3 -3
- package/dist/access-operations-batch.js +49 -37
- package/dist/access-operations.d.ts +19 -17
- package/dist/access-operations.js +54 -42
- package/dist/access-recall-concurrency.d.ts +13 -11
- package/dist/access-recall-concurrency.js +46 -34
- package/dist/access-recall-response.d.ts +13 -11
- package/dist/access-recall-response.js +46 -34
- package/dist/access-recall-surface.d.ts +13 -11
- package/dist/access-recall-surface.js +46 -34
- package/dist/access-schema.d.ts +107 -90
- package/dist/access-schema.js +7 -5
- package/dist/{access-service-DcfM0Vf0.d.ts → access-service-Baz5xW5X.d.ts} +89 -72
- package/dist/access-service-helpers.d.ts +13 -11
- package/dist/access-service.d.ts +13 -11
- package/dist/access-service.js +46 -34
- package/dist/access-surface-catalog.d.ts +13 -11
- package/dist/access-surface-catalog.js +50 -36
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/access-wearables-meetings-surface.d.ts +4 -3
- package/dist/action-confidence.d.ts +2 -1
- package/dist/active-memory-bridge.d.ts +2 -1
- package/dist/active-recall.d.ts +2 -1
- package/dist/active-recall.js +6 -5
- package/dist/active-recall.js.map +1 -1
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/ambient-provenance.d.ts +2 -1
- package/dist/artifact-search.d.ts +2 -1
- package/dist/behavior-learner.d.ts +2 -1
- package/dist/behavior-signals.d.ts +2 -1
- package/dist/bootstrap.d.ts +10 -9
- package/dist/briefing-window.d.ts +3 -2
- package/dist/briefing.d.ts +3 -2
- package/dist/briefing.js +13 -13
- package/dist/buffer-surprise-report.d.ts +2 -1
- package/dist/buffer-turn-helpers.d.ts +2 -1
- package/dist/buffer.d.ts +3 -2
- package/dist/bulk-import/index.d.ts +4 -3
- package/dist/calibration.d.ts +2 -1
- package/dist/capabilities.d.ts +2 -1
- package/dist/{catalog-BmBXTtOs.d.ts → catalog-9X8WpZNO.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +2 -1
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.d.ts +2 -1
- package/dist/causal-consolidation.js +16 -16
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.d.ts +2 -1
- package/dist/causal-trajectory-graph.js +2 -2
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-D5VPIJN3.js → chunk-227WJVPY.js} +2 -2
- package/dist/{chunk-Y3BWCIY2.js → chunk-2EHDPHMD.js} +2 -2
- package/dist/{chunk-2LKW6OO7.js → chunk-2XJDAEAM.js} +2 -2
- package/dist/{chunk-P23JWI3D.js → chunk-3ITTF7YH.js} +52 -52
- package/dist/{chunk-3DT2F5OI.js → chunk-3YKOFCKP.js} +11 -6
- package/dist/chunk-3YKOFCKP.js.map +1 -0
- package/dist/{chunk-NGP2FPB2.js → chunk-4UVDLNHQ.js} +2 -2
- package/dist/{chunk-HXWOVCS6.js → chunk-4WIKMOE3.js} +44 -22
- package/dist/chunk-4WIKMOE3.js.map +1 -0
- package/dist/{chunk-6RPB2TDG.js → chunk-5HO3QBAD.js} +11 -6
- package/dist/chunk-5HO3QBAD.js.map +1 -0
- package/dist/{chunk-AYWPIH4M.js → chunk-5P2KNFJZ.js} +149 -25
- package/dist/chunk-5P2KNFJZ.js.map +1 -0
- package/dist/{chunk-FJMIQTMH.js → chunk-5YQ7RFSO.js} +2 -2
- package/dist/{chunk-KQAFEZQX.js → chunk-7LCGFUMB.js} +4 -4
- package/dist/{chunk-EESYTBXV.js → chunk-7NCUHD5U.js} +2 -2
- package/dist/{chunk-X574KX52.js → chunk-7ZMU4XQT.js} +2 -2
- package/dist/{chunk-SG3Z67FB.js → chunk-APZXA4WI.js} +2 -2
- package/dist/{chunk-2QSZNTDO.js → chunk-AU7Q3LSC.js} +4 -4
- package/dist/{chunk-VGMRI4J6.js → chunk-B75VCEX5.js} +4 -4
- package/dist/{chunk-D35XLYQ7.js → chunk-BE4Y6GK6.js} +11 -11
- package/dist/{chunk-ELKD5PCD.js → chunk-BEXFNGQ3.js} +3 -3
- package/dist/{chunk-U5SRTYFS.js → chunk-BFDOBESV.js} +2 -2
- package/dist/{chunk-OLT3YTDH.js → chunk-BIJAWZYW.js} +4 -4
- package/dist/{chunk-FU2NYFX6.js → chunk-BO4PWIJY.js} +3 -3
- package/dist/{chunk-JMAG7WZ7.js → chunk-BX6GW4KC.js} +2 -2
- package/dist/chunk-CC37E3QM.js +198 -0
- package/dist/chunk-CC37E3QM.js.map +1 -0
- package/dist/{chunk-J2R275FN.js → chunk-CTCGHNWN.js} +4 -4
- package/dist/{chunk-X5PIDJ3L.js → chunk-DA4ZMCBU.js} +3 -3
- package/dist/{chunk-IVAW3HBF.js → chunk-DH3V7RCQ.js} +21 -13
- package/dist/chunk-DH3V7RCQ.js.map +1 -0
- package/dist/chunk-DXFG2VGN.js +50 -0
- package/dist/chunk-DXFG2VGN.js.map +1 -0
- package/dist/{chunk-4OFKZAJG.js → chunk-EAARGPWI.js} +2 -1
- package/dist/chunk-EAARGPWI.js.map +1 -0
- package/dist/{chunk-H6RSANGQ.js → chunk-ETZ7KKOS.js} +2 -2
- package/dist/{chunk-K4E3Y3ZX.js → chunk-G7VEQEMG.js} +2 -1
- package/dist/chunk-G7VEQEMG.js.map +1 -0
- package/dist/{chunk-XZBXINXZ.js → chunk-GIC6BASP.js} +4 -4
- package/dist/{chunk-SXQZMC7R.js → chunk-GR4C3FHT.js} +2 -2
- package/dist/{chunk-7DYGPGCT.js → chunk-H5IIBGDM.js} +2 -2
- package/dist/{chunk-CNNXMIS6.js → chunk-HFRGCNFY.js} +10 -10
- package/dist/chunk-HRATODNO.js +28 -0
- package/dist/chunk-HRATODNO.js.map +1 -0
- package/dist/{chunk-MAG6M3B6.js → chunk-HTOWFFAI.js} +2 -2
- package/dist/chunk-HUSTM6PU.js +27 -0
- package/dist/chunk-HUSTM6PU.js.map +1 -0
- package/dist/{chunk-FOCMJEHH.js → chunk-I4QAH4SY.js} +3 -3
- package/dist/{chunk-FSGCXGK6.js → chunk-I6DUKBUI.js} +2 -2
- package/dist/{chunk-VI637ILW.js → chunk-IN673LEP.js} +48 -15
- package/dist/chunk-IN673LEP.js.map +1 -0
- package/dist/{chunk-6FUMA6AA.js → chunk-JGXMA6HL.js} +2 -2
- package/dist/{chunk-TA7UZZMW.js → chunk-JHTF22NQ.js} +2 -2
- package/dist/{chunk-DZ3CNJPB.js → chunk-LDOQE34V.js} +2 -2
- package/dist/{chunk-MEW53VQJ.js → chunk-LDWIPYJ6.js} +7 -7
- package/dist/{chunk-227UFSEQ.js → chunk-LEPOP46W.js} +4 -4
- package/dist/{chunk-KJTSWJZN.js → chunk-LF6SHWVV.js} +2 -2
- package/dist/{chunk-G6OZZX7P.js → chunk-LJAP4KSW.js} +2 -2
- package/dist/{chunk-NV6BTBUI.js → chunk-LJNLLNEM.js} +2 -2
- package/dist/{chunk-FFFZEF6B.js → chunk-LUDXSSTW.js} +2 -2
- package/dist/{chunk-PCH2CVCS.js → chunk-LWBSEYW3.js} +6 -6
- package/dist/chunk-M6RORUO5.js +59 -0
- package/dist/chunk-M6RORUO5.js.map +1 -0
- package/dist/{chunk-FMUJGGKW.js → chunk-M7DGN6JZ.js} +3 -3
- package/dist/{chunk-TZIHB2LP.js → chunk-MNH2GM4O.js} +5 -5
- package/dist/{chunk-RACZB5HT.js → chunk-N37X5RU7.js} +4 -4
- package/dist/{chunk-LK4TOYPU.js → chunk-NF3NMAG7.js} +2 -2
- package/dist/{chunk-QL4U3SJA.js → chunk-NHLEFBE2.js} +11 -3
- package/dist/chunk-NHLEFBE2.js.map +1 -0
- package/dist/chunk-NN5CQTAJ.js +42 -0
- package/dist/chunk-NN5CQTAJ.js.map +1 -0
- package/dist/{chunk-AG46P24C.js → chunk-NNBZS3DY.js} +4 -4
- package/dist/{chunk-LZ2JTO7N.js → chunk-OASGWNYL.js} +2 -2
- package/dist/chunk-OEDW4ER7.js +62 -0
- package/dist/chunk-OEDW4ER7.js.map +1 -0
- package/dist/{chunk-C2JCVZWX.js → chunk-OLBZ2WGG.js} +2 -2
- package/dist/{chunk-Z3SQEEB6.js → chunk-OUKBMQ2O.js} +2 -2
- package/dist/{chunk-XXW32OL7.js → chunk-OYV6RKPM.js} +1 -1
- package/dist/chunk-OYV6RKPM.js.map +1 -0
- package/dist/{chunk-2Z3DG5CQ.js → chunk-P6GKRT2H.js} +1 -1
- package/dist/{chunk-UGA6PZTX.js → chunk-P7LVYPIX.js} +3 -3
- package/dist/{chunk-26JWBSWD.js → chunk-PGCZLHRB.js} +11 -3
- package/dist/chunk-PGCZLHRB.js.map +1 -0
- package/dist/{chunk-VE45LRCE.js → chunk-QRDSXR3V.js} +2 -2
- package/dist/{chunk-KS67VHXA.js → chunk-QUVWFZOU.js} +2 -2
- package/dist/{chunk-AI4QFDPR.js → chunk-R7FXPG4T.js} +2 -2
- package/dist/chunk-RF2SMMPP.js +37 -0
- package/dist/chunk-RF2SMMPP.js.map +1 -0
- package/dist/{chunk-X66BHMAU.js → chunk-RJ57OOCD.js} +2 -2
- package/dist/chunk-S5G2LAL7.js +354 -0
- package/dist/chunk-S5G2LAL7.js.map +1 -0
- package/dist/{chunk-VXMKW7YN.js → chunk-TRLCMLX7.js} +2 -2
- package/dist/{chunk-ELCMVOQT.js → chunk-V3HUBF7T.js} +2 -2
- package/dist/{chunk-KMIAD7JR.js → chunk-VHAKBUBD.js} +2 -2
- package/dist/{chunk-GS5IFIVE.js → chunk-VYD63IFH.js} +3 -3
- package/dist/chunk-VZIAVM72.js +49 -0
- package/dist/chunk-VZIAVM72.js.map +1 -0
- package/dist/chunk-WTWQA7BB.js +28 -0
- package/dist/chunk-WTWQA7BB.js.map +1 -0
- package/dist/{chunk-TBRG2SYY.js → chunk-X4FIZAVQ.js} +94 -52
- package/dist/chunk-X4FIZAVQ.js.map +1 -0
- package/dist/{chunk-WSFPNCRA.js → chunk-XFPHV65N.js} +2 -2
- package/dist/{chunk-JCUG7AXZ.js → chunk-XJJYSX6F.js} +4 -4
- package/dist/{chunk-I6DURYZI.js → chunk-XMIAU4CO.js} +2 -2
- package/dist/{chunk-PJIGYPO5.js → chunk-XQGFIAG7.js} +2 -2
- package/dist/{chunk-B2URC6LJ.js → chunk-YWN3GYI2.js} +2 -2
- package/dist/{chunk-TG6JEJDV.js → chunk-Z33VUMKY.js} +3 -3
- package/dist/{cli-CFpMhqz5.d.ts → cli-CMtkGBdz.d.ts} +5 -5
- package/dist/cli.d.ts +15 -13
- package/dist/cli.js +88 -77
- package/dist/coding/export-okf-codegraph.d.ts +2 -1
- package/dist/coding/export-okf-codegraph.js +13 -13
- package/dist/coding/pre-action-gate.d.ts +2 -1
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compounding/engine.d.ts +3 -2
- package/dist/compounding/engine.js +15 -14
- package/dist/compounding/preference-consolidator.d.ts +2 -1
- package/dist/compression-optimizer.d.ts +2 -1
- package/dist/config.d.ts +2 -1
- package/dist/config.js +6 -5
- package/dist/connectors/codex-materialize-runner.d.ts +2 -1
- package/dist/connectors/codex-materialize-runner.js +13 -13
- package/dist/connectors/codex-materialize.d.ts +2 -1
- package/dist/connectors/index.d.ts +2 -1
- package/dist/connectors/index.js +13 -13
- package/dist/consolidation-provenance-check.d.ts +3 -2
- package/dist/consolidation-undo.d.ts +3 -2
- package/dist/contradiction/index.d.ts +4 -3
- package/dist/converge-config.d.ts +2 -1
- package/dist/convergence-refresh.d.ts +3 -2
- package/dist/convergence-refresh.js +15 -15
- package/dist/conversation-index/backend.d.ts +2 -1
- package/dist/conversation-index/backend.js +2 -2
- package/dist/conversation-index/chunker.d.ts +2 -1
- package/dist/conversation-index/faiss-adapter.d.ts +2 -1
- package/dist/conversation-index/indexer.d.ts +2 -1
- package/dist/conversation-index/search.d.ts +2 -1
- package/dist/corpus-watermark.d.ts +2 -1
- package/dist/corpus-watermark.js +15 -15
- package/dist/cross-lingual-recall.d.ts +2 -1
- package/dist/day-summary.d.ts +2 -1
- package/dist/deep-recall-config.d.ts +32 -0
- package/dist/deep-recall-config.js +12 -0
- package/dist/deep-recall-http-glue.d.ts +170 -0
- package/dist/deep-recall-http-glue.js +31 -0
- package/dist/deep-recall-http-glue.js.map +1 -0
- package/dist/deep-recall-mcp-tools.d.ts +144 -0
- package/dist/deep-recall-mcp-tools.js +8 -0
- package/dist/deep-recall-mcp-tools.js.map +1 -0
- package/dist/deep-recall-policy-llm.d.ts +37 -0
- package/dist/deep-recall-policy-llm.js +19 -0
- package/dist/deep-recall-policy-llm.js.map +1 -0
- package/dist/deep-recall-renderer.d.ts +16 -0
- package/dist/deep-recall-renderer.js +8 -0
- package/dist/deep-recall-renderer.js.map +1 -0
- package/dist/deep-recall-seeds.d.ts +83 -0
- package/dist/deep-recall-seeds.js +8 -0
- package/dist/deep-recall-seeds.js.map +1 -0
- package/dist/deep-recall.d.ts +97 -0
- package/dist/deep-recall.js +13 -0
- package/dist/deep-recall.js.map +1 -0
- package/dist/delinearize.d.ts +2 -1
- package/dist/dependency-propagation-config.d.ts +2 -1
- package/dist/{dependency-propagation-delivery-BC3bCEet.d.ts → dependency-propagation-delivery-BZGUecZf.d.ts} +1 -1
- package/dist/direct-answer-wiring.d.ts +2 -1
- package/dist/direct-answer.d.ts +2 -1
- package/dist/embedding-fallback.d.ts +2 -1
- package/dist/enrichment/index.d.ts +2 -1
- package/dist/entity-origin-fields.d.ts +2 -1
- package/dist/entity-retrieval.d.ts +3 -2
- package/dist/entity-retrieval.js +13 -13
- package/dist/entity-schema.d.ts +2 -1
- package/dist/episodic-context.d.ts +2 -1
- package/dist/eval-trajectory-contracts.d.ts +2 -1
- package/dist/eval-trajectory-store.d.ts +2 -1
- package/dist/eval-trajectory.d.ts +2 -1
- package/dist/explicit-capture.d.ts +10 -9
- package/dist/external-wiki-access.d.ts +13 -11
- package/dist/external-wiki-access.js +47 -35
- package/dist/external-wiki-collection-registration.d.ts +2 -1
- package/dist/external-wiki-collection.d.ts +2 -1
- package/dist/external-wiki-mcp-tools.d.ts +13 -11
- package/dist/extraction-error-classification.d.ts +2 -1
- package/dist/extraction-faithfulness.d.ts +2 -1
- package/dist/extraction-judge-telemetry.d.ts +2 -1
- package/dist/extraction-judge-training.d.ts +2 -1
- package/dist/extraction-judge.d.ts +2 -1
- package/dist/extraction-liveness.d.ts +2 -1
- package/dist/extraction-normalization.d.ts +2 -1
- package/dist/extraction-prompt.d.ts +2 -1
- package/dist/extraction-source-grounding-rules.d.ts +2 -1
- package/dist/extraction-source-grounding.d.ts +2 -1
- package/dist/extraction.d.ts +2 -1
- package/dist/extraction.js +15 -15
- package/dist/fallback-llm.d.ts +2 -1
- package/dist/graph-dashboard-diff.d.ts +2 -1
- package/dist/graph-dashboard-key.d.ts +2 -1
- package/dist/graph-dashboard-parser.d.ts +2 -1
- package/dist/{graph-edge-decay-DGTBFALQ.js → graph-edge-decay-FXGELBFA.js} +4 -4
- package/dist/graph-edge-decay-FXGELBFA.js.map +1 -0
- package/dist/graph-edge-reinforcement.d.ts +2 -1
- package/dist/graph-path-reconstruction.d.ts +2 -1
- package/dist/graph-path-scoring.d.ts +2 -1
- package/dist/graph-snapshot.d.ts +2 -1
- package/dist/graph-snapshot.js +3 -3
- package/dist/graph.d.ts +2 -1
- package/dist/graph.js +2 -2
- package/dist/harmonic-construction.js +3 -3
- package/dist/harmonic-retrieval.d.ts +38 -2
- package/dist/harmonic-retrieval.js +12 -3
- package/dist/importance.d.ts +2 -1
- package/dist/importers/index.d.ts +2 -1
- package/dist/in-flight-reads.d.ts +2 -1
- package/dist/{index-D4hS9uxK.d.ts → index-B4iTvT-w.d.ts} +2 -2
- package/dist/index.d.ts +701 -699
- package/dist/index.js +126 -115
- package/dist/intent.d.ts +2 -1
- package/dist/lcm/engine.d.ts +2 -1
- package/dist/lcm/index.d.ts +2 -1
- package/dist/lcm/tools.d.ts +2 -1
- package/dist/lifecycle.d.ts +2 -1
- package/dist/live-connectors-runner.d.ts +2 -1
- package/dist/local-llm.d.ts +2 -1
- package/dist/local-model-endpoint.d.ts +2 -1
- package/dist/location/index.d.ts +4 -3
- package/dist/location/index.js +15 -15
- package/dist/maintenance/memory-governance.d.ts +2 -1
- package/dist/maintenance/memory-governance.js +13 -13
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +3 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +13 -13
- package/dist/maintenance/rebuild-memory-projection.d.ts +3 -2
- package/dist/maintenance/rebuild-memory-projection.js +14 -14
- package/dist/{maintenance-BRcc3Hx8.d.ts → maintenance-BBpNqEeJ.d.ts} +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +13 -11
- package/dist/mcp-read-only-tools.js +1 -1
- package/dist/memory-action-policy.d.ts +2 -1
- package/dist/memory-cache.d.ts +2 -1
- package/dist/memory-controller.d.ts +2 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +2 -1
- package/dist/memory-projection-store.d.ts +2 -1
- package/dist/memory-provenance.d.ts +2 -1
- package/dist/memory-snapshot.d.ts +2 -1
- package/dist/memory-subject-cli.d.ts +13 -11
- package/dist/memory-subject.d.ts +13 -11
- package/dist/memory-worth-outcomes.d.ts +3 -2
- package/dist/models-json.d.ts +2 -1
- package/dist/namespaces/migrate.d.ts +4 -3
- package/dist/namespaces/migrate.js +14 -14
- package/dist/namespaces/principal.d.ts +2 -1
- package/dist/namespaces/search.d.ts +2 -1
- package/dist/namespaces/search.js +9 -9
- package/dist/namespaces/storage.d.ts +4 -3
- package/dist/namespaces/storage.js +13 -13
- package/dist/native-knowledge.d.ts +2 -1
- package/dist/offline-sync-impression-drain.d.ts +2 -1
- package/dist/offline-sync.js +2 -2
- package/dist/operator-doctor-corpus.d.ts +2 -1
- package/dist/operator-doctor-corpus.js +16 -16
- package/dist/operator-doctor-replica.d.ts +2 -1
- package/dist/operator-toolkit.d.ts +4 -3
- package/dist/operator-toolkit.js +29 -28
- package/dist/orchestration/compression-guideline-coordinator.d.ts +3 -2
- package/dist/orchestration/maintenance.d.ts +5 -4
- package/dist/orchestration/maintenance.js +21 -21
- package/dist/{orchestrator-Btq9lzAN.d.ts → orchestrator-DglY1H0w.d.ts} +8 -8
- package/dist/orchestrator.d.ts +10 -9
- package/dist/orchestrator.js +108 -97
- package/dist/patterns-cli.d.ts +2 -1
- package/dist/{pipeline-CZoNdFb5.d.ts → pipeline-C7qRsy6g.d.ts} +1 -1
- package/dist/policy-runtime.d.ts +2 -1
- package/dist/proactive-contention.d.ts +2 -1
- package/dist/provenance.d.ts +2 -1
- package/dist/{public-http-C9-CHc40.d.ts → public-http-CU-Cwwdb.d.ts} +1 -1
- package/dist/{qmd-VIjSCKIE.d.ts → qmd-YRLTa3AE.d.ts} +1 -1
- package/dist/qmd-preflight.d.ts +3 -2
- package/dist/qmd-recall-cache.d.ts +2 -1
- package/dist/qmd.d.ts +3 -2
- package/dist/recall-concurrency-config.d.ts +2 -1
- package/dist/recall-deep-expand-select.js +4 -44
- package/dist/recall-deep-expand-select.js.map +1 -1
- package/dist/recall-deep-frontier.js +4 -23
- package/dist/recall-deep-frontier.js.map +1 -1
- package/dist/recall-deep-rewrite.js +4 -23
- package/dist/recall-deep-rewrite.js.map +1 -1
- package/dist/recall-disclosure-escalation.d.ts +2 -1
- package/dist/recall-explain-renderer.d.ts +2 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-memory-map.d.ts +2 -1
- package/dist/recall-navigate-access.d.ts +2 -1
- package/dist/recall-navigate-access.js +2 -2
- package/dist/recall-navigate-disclosure.d.ts +2 -1
- package/dist/recall-navigate-disclosure.js +1 -1
- package/dist/recall-navigate.d.ts +2 -1
- package/dist/recall-navigate.js +2 -2
- package/dist/recall-planner-llm.d.ts +2 -1
- package/dist/recall-state.d.ts +2 -1
- package/dist/recall-tag-filter.d.ts +2 -1
- package/dist/recall-timings.d.ts +2 -1
- package/dist/recall-xray-cli.d.ts +2 -1
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +2 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +2 -1
- package/dist/recall-xray.js +2 -2
- package/dist/reconcile/cursor.d.ts +2 -1
- package/dist/reconcile/manifest.d.ts +2 -1
- package/dist/reconcile/plan.d.ts +2 -1
- package/dist/replay/normalizers/chatgpt.d.ts +2 -1
- package/dist/replay/normalizers/claude.d.ts +2 -1
- package/dist/replay/normalizers/openclaw.d.ts +2 -1
- package/dist/replay/normalizers/shared.d.ts +2 -1
- package/dist/replay/runner.d.ts +2 -1
- package/dist/replay/types.d.ts +2 -1
- package/dist/replica-divergence.d.ts +2 -1
- package/dist/replica-peers-config.d.ts +2 -1
- package/dist/resolve-auth-token.d.ts +2 -1
- package/dist/resume-bundles.js +7 -6
- package/dist/retrieval-agents.d.ts +3 -2
- package/dist/retrieval-tiers.d.ts +2 -1
- package/dist/routing/engine.d.ts +2 -1
- package/dist/routing/store.d.ts +2 -1
- package/dist/salvage-envelope.d.ts +2 -1
- package/dist/schemas.d.ts +176 -176
- package/dist/{scope-profiles-DqbxQXIS.d.ts → scope-profiles-BVvqVzJX.d.ts} +1 -1
- package/dist/search/embed-helper.d.ts +2 -1
- package/dist/search/factory.d.ts +2 -1
- package/dist/search/factory.js +8 -8
- package/dist/search/index.d.ts +2 -1
- package/dist/search/index.js +13 -13
- package/dist/search/lancedb-backend.d.ts +2 -1
- package/dist/search/lancedb-backend.js +2 -2
- package/dist/search/meilisearch-backend.d.ts +2 -1
- package/dist/search/meilisearch-backend.js +2 -2
- package/dist/search/noop-backend.d.ts +2 -1
- package/dist/search/orama-backend.d.ts +2 -1
- package/dist/search/orama-backend.js +2 -2
- package/dist/search/port.d.ts +2 -1
- package/dist/search/remote-backend.d.ts +2 -1
- package/dist/{semantic-consolidation-DW3rEUoW.d.ts → semantic-consolidation-BzCI6Kuu.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +3 -2
- package/dist/semantic-consolidation.js +14 -14
- package/dist/semantic-rule-promotion.js +13 -13
- package/dist/semantic-rule-verifier.d.ts +2 -1
- package/dist/semantic-rule-verifier.js +13 -13
- package/dist/{service-B2vJU_Bx.d.ts → service-DQ3Gscy5.d.ts} +2 -2
- package/dist/session-observer-bands.d.ts +2 -1
- package/dist/session-observer-state.d.ts +2 -1
- package/dist/shared-context/manager.d.ts +43 -7
- package/dist/shared-context/manager.js +2 -1
- package/dist/signal.d.ts +2 -1
- package/dist/source-agent-qualifier.d.ts +2 -1
- package/dist/source-agent-qualifier.js +13 -13
- package/dist/standup/build.js +13 -13
- package/dist/{storage-6fn7BPmb.d.ts → storage-DmTbQdD0.d.ts} +1 -1
- package/dist/storage.d.ts +3 -2
- package/dist/storage.js +12 -12
- package/dist/subject-config.d.ts +2 -1
- package/dist/summarizer.d.ts +2 -1
- package/dist/summary-snapshot.d.ts +2 -1
- package/dist/support-passport/index.d.ts +16 -14
- package/dist/support-passport/index.js +49 -37
- package/dist/temporal-supersession.d.ts +3 -2
- package/dist/temporal-timeline-recall.d.ts +2 -1
- package/dist/temporal-validity.d.ts +2 -1
- package/dist/threading.d.ts +2 -1
- package/dist/tier-migration.d.ts +3 -2
- package/dist/tier-routing.d.ts +2 -1
- package/dist/topics.d.ts +2 -1
- package/dist/transcript.d.ts +2 -1
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/capsule-import.js +2 -2
- package/dist/transfer/export-okf.d.ts +2 -1
- package/dist/transfer/export-okf.js +14 -14
- package/dist/transfer/types.d.ts +78 -78
- package/dist/trust-score-stage.d.ts +2 -1
- package/dist/trust-score.d.ts +2 -1
- package/dist/{types-eM7QIcX2.d.ts → types-CLRTESSD.d.ts} +3 -1
- package/dist/types.d.ts +2 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +2 -1
- package/dist/verified-recall.js +13 -13
- package/dist/who-knows-cli.d.ts +13 -11
- package/dist/who-knows-cli.js +14 -14
- package/dist/who-knows.d.ts +13 -11
- package/dist/who-knows.js +13 -13
- package/dist/write-envelope.d.ts +2 -1
- package/package.json +2 -2
- package/src/access-boundary.ts +1 -0
- package/src/access-http.ts +5 -5
- package/src/access-mcp-output-schemas.ts +1 -0
- package/src/access-mcp.ts +3 -3
- package/src/access-operations-batch.ts +3 -1
- package/src/access-schema.ts +12 -0
- package/src/access-service.ts +162 -5
- package/src/access-surface-catalog.ts +2 -0
- package/src/cli/deep-recall-commands.ts +60 -0
- package/src/cli.ts +2 -2
- package/src/config.test.ts +19 -0
- package/src/config.ts +7 -0
- package/src/deep-recall-config.ts +83 -0
- package/src/deep-recall-http-glue.ts +75 -0
- package/src/deep-recall-mcp-tools.ts +33 -0
- package/src/deep-recall-policy-llm.ts +65 -0
- package/src/deep-recall-renderer.ts +41 -0
- package/src/deep-recall-seeds.ts +134 -0
- package/src/deep-recall-surface.test.ts +902 -0
- package/src/deep-recall.test.ts +348 -0
- package/src/deep-recall.ts +572 -0
- package/src/harmonic-retrieval.ts +78 -25
- package/src/mcp-read-only-tools.ts +1 -0
- package/src/shared-context/envelope-at.test.ts +23 -0
- package/src/shared-context/envelope-at.ts +12 -6
- package/src/shared-context/envelope-io.ts +184 -0
- package/src/shared-context/envelope-wiring.test.ts +193 -0
- package/src/shared-context/governance.ts +28 -9
- package/src/shared-context/iso-instant.ts +43 -0
- package/src/shared-context/manager.ts +74 -15
- package/src/shared-context/provenance.ts +3 -26
- package/src/shared-context/write-origin.test.ts +145 -0
- package/src/types.ts +3 -1
- package/dist/chunk-26JWBSWD.js.map +0 -1
- package/dist/chunk-3DT2F5OI.js.map +0 -1
- package/dist/chunk-4OFKZAJG.js.map +0 -1
- package/dist/chunk-6RPB2TDG.js.map +0 -1
- package/dist/chunk-AYWPIH4M.js.map +0 -1
- package/dist/chunk-HXWOVCS6.js.map +0 -1
- package/dist/chunk-IVAW3HBF.js.map +0 -1
- package/dist/chunk-K4E3Y3ZX.js.map +0 -1
- package/dist/chunk-QL4U3SJA.js.map +0 -1
- package/dist/chunk-TBRG2SYY.js.map +0 -1
- package/dist/chunk-VI637ILW.js.map +0 -1
- package/dist/chunk-XXW32OL7.js.map +0 -1
- /package/dist/{chunk-D5VPIJN3.js.map → chunk-227WJVPY.js.map} +0 -0
- /package/dist/{chunk-Y3BWCIY2.js.map → chunk-2EHDPHMD.js.map} +0 -0
- /package/dist/{chunk-2LKW6OO7.js.map → chunk-2XJDAEAM.js.map} +0 -0
- /package/dist/{chunk-P23JWI3D.js.map → chunk-3ITTF7YH.js.map} +0 -0
- /package/dist/{chunk-NGP2FPB2.js.map → chunk-4UVDLNHQ.js.map} +0 -0
- /package/dist/{chunk-FJMIQTMH.js.map → chunk-5YQ7RFSO.js.map} +0 -0
- /package/dist/{chunk-KQAFEZQX.js.map → chunk-7LCGFUMB.js.map} +0 -0
- /package/dist/{chunk-EESYTBXV.js.map → chunk-7NCUHD5U.js.map} +0 -0
- /package/dist/{chunk-X574KX52.js.map → chunk-7ZMU4XQT.js.map} +0 -0
- /package/dist/{chunk-SG3Z67FB.js.map → chunk-APZXA4WI.js.map} +0 -0
- /package/dist/{chunk-2QSZNTDO.js.map → chunk-AU7Q3LSC.js.map} +0 -0
- /package/dist/{chunk-VGMRI4J6.js.map → chunk-B75VCEX5.js.map} +0 -0
- /package/dist/{chunk-D35XLYQ7.js.map → chunk-BE4Y6GK6.js.map} +0 -0
- /package/dist/{chunk-ELKD5PCD.js.map → chunk-BEXFNGQ3.js.map} +0 -0
- /package/dist/{chunk-U5SRTYFS.js.map → chunk-BFDOBESV.js.map} +0 -0
- /package/dist/{chunk-OLT3YTDH.js.map → chunk-BIJAWZYW.js.map} +0 -0
- /package/dist/{chunk-FU2NYFX6.js.map → chunk-BO4PWIJY.js.map} +0 -0
- /package/dist/{chunk-JMAG7WZ7.js.map → chunk-BX6GW4KC.js.map} +0 -0
- /package/dist/{chunk-J2R275FN.js.map → chunk-CTCGHNWN.js.map} +0 -0
- /package/dist/{chunk-X5PIDJ3L.js.map → chunk-DA4ZMCBU.js.map} +0 -0
- /package/dist/{chunk-H6RSANGQ.js.map → chunk-ETZ7KKOS.js.map} +0 -0
- /package/dist/{chunk-XZBXINXZ.js.map → chunk-GIC6BASP.js.map} +0 -0
- /package/dist/{chunk-SXQZMC7R.js.map → chunk-GR4C3FHT.js.map} +0 -0
- /package/dist/{chunk-7DYGPGCT.js.map → chunk-H5IIBGDM.js.map} +0 -0
- /package/dist/{chunk-CNNXMIS6.js.map → chunk-HFRGCNFY.js.map} +0 -0
- /package/dist/{chunk-MAG6M3B6.js.map → chunk-HTOWFFAI.js.map} +0 -0
- /package/dist/{chunk-FOCMJEHH.js.map → chunk-I4QAH4SY.js.map} +0 -0
- /package/dist/{chunk-FSGCXGK6.js.map → chunk-I6DUKBUI.js.map} +0 -0
- /package/dist/{chunk-6FUMA6AA.js.map → chunk-JGXMA6HL.js.map} +0 -0
- /package/dist/{chunk-TA7UZZMW.js.map → chunk-JHTF22NQ.js.map} +0 -0
- /package/dist/{chunk-DZ3CNJPB.js.map → chunk-LDOQE34V.js.map} +0 -0
- /package/dist/{chunk-MEW53VQJ.js.map → chunk-LDWIPYJ6.js.map} +0 -0
- /package/dist/{chunk-227UFSEQ.js.map → chunk-LEPOP46W.js.map} +0 -0
- /package/dist/{chunk-KJTSWJZN.js.map → chunk-LF6SHWVV.js.map} +0 -0
- /package/dist/{chunk-G6OZZX7P.js.map → chunk-LJAP4KSW.js.map} +0 -0
- /package/dist/{chunk-NV6BTBUI.js.map → chunk-LJNLLNEM.js.map} +0 -0
- /package/dist/{chunk-FFFZEF6B.js.map → chunk-LUDXSSTW.js.map} +0 -0
- /package/dist/{chunk-PCH2CVCS.js.map → chunk-LWBSEYW3.js.map} +0 -0
- /package/dist/{chunk-FMUJGGKW.js.map → chunk-M7DGN6JZ.js.map} +0 -0
- /package/dist/{chunk-TZIHB2LP.js.map → chunk-MNH2GM4O.js.map} +0 -0
- /package/dist/{chunk-RACZB5HT.js.map → chunk-N37X5RU7.js.map} +0 -0
- /package/dist/{chunk-LK4TOYPU.js.map → chunk-NF3NMAG7.js.map} +0 -0
- /package/dist/{chunk-AG46P24C.js.map → chunk-NNBZS3DY.js.map} +0 -0
- /package/dist/{chunk-LZ2JTO7N.js.map → chunk-OASGWNYL.js.map} +0 -0
- /package/dist/{chunk-C2JCVZWX.js.map → chunk-OLBZ2WGG.js.map} +0 -0
- /package/dist/{chunk-Z3SQEEB6.js.map → chunk-OUKBMQ2O.js.map} +0 -0
- /package/dist/{chunk-2Z3DG5CQ.js.map → chunk-P6GKRT2H.js.map} +0 -0
- /package/dist/{chunk-UGA6PZTX.js.map → chunk-P7LVYPIX.js.map} +0 -0
- /package/dist/{chunk-VE45LRCE.js.map → chunk-QRDSXR3V.js.map} +0 -0
- /package/dist/{chunk-KS67VHXA.js.map → chunk-QUVWFZOU.js.map} +0 -0
- /package/dist/{chunk-AI4QFDPR.js.map → chunk-R7FXPG4T.js.map} +0 -0
- /package/dist/{chunk-X66BHMAU.js.map → chunk-RJ57OOCD.js.map} +0 -0
- /package/dist/{chunk-VXMKW7YN.js.map → chunk-TRLCMLX7.js.map} +0 -0
- /package/dist/{chunk-ELCMVOQT.js.map → chunk-V3HUBF7T.js.map} +0 -0
- /package/dist/{chunk-KMIAD7JR.js.map → chunk-VHAKBUBD.js.map} +0 -0
- /package/dist/{chunk-GS5IFIVE.js.map → chunk-VYD63IFH.js.map} +0 -0
- /package/dist/{chunk-WSFPNCRA.js.map → chunk-XFPHV65N.js.map} +0 -0
- /package/dist/{chunk-JCUG7AXZ.js.map → chunk-XJJYSX6F.js.map} +0 -0
- /package/dist/{chunk-I6DURYZI.js.map → chunk-XMIAU4CO.js.map} +0 -0
- /package/dist/{chunk-PJIGYPO5.js.map → chunk-XQGFIAG7.js.map} +0 -0
- /package/dist/{chunk-B2URC6LJ.js.map → chunk-YWN3GYI2.js.map} +0 -0
- /package/dist/{chunk-TG6JEJDV.js.map → chunk-Z33VUMKY.js.map} +0 -0
- /package/dist/{graph-edge-decay-DGTBFALQ.js.map → deep-recall-config.js.map} +0 -0
package/src/access-service.ts
CHANGED
|
@@ -33,6 +33,7 @@ import { readAggregateExtractionWatermark } from "./orchestration/extraction-wat
|
|
|
33
33
|
import { ReplicaDivergenceMonitor } from "./replica-divergence.js";
|
|
34
34
|
import type { ResolveSecretRefFn } from "./resolve-auth-token.js";
|
|
35
35
|
import { buildAccessWriteRequestFingerprint, buildObserveRequestFingerprint } from "./write-envelope.js";
|
|
36
|
+
import { UNATTRIBUTED_ACCESS_WRITE_ORIGIN } from "./shared-context/envelope-io.js";
|
|
36
37
|
export type { EngramAccessHealthResponse, EngramAccessQmdCollectionState, EngramAccessQmdHealthResponse };
|
|
37
38
|
import { AccessAuditAdapter, type AccessAuditConfig, type AccessAuditResult } from "./access-audit.js";
|
|
38
39
|
import {
|
|
@@ -168,6 +169,15 @@ import {
|
|
|
168
169
|
redactSensitive,
|
|
169
170
|
} from "./admin/admin-surfaces.js";
|
|
170
171
|
import { FileCalendarSource, buildBriefing, parseBriefingFocus, parseBriefingWindow } from "./briefing.js";
|
|
172
|
+
import {
|
|
173
|
+
type DeepRecallResult,
|
|
174
|
+
runBudgetedDeepRecall,
|
|
175
|
+
} from "./deep-recall.js";
|
|
176
|
+
import { callDeepRecallPolicyLlm } from "./deep-recall-policy-llm.js";
|
|
177
|
+
import { createDeepRecallSeedSearch } from "./deep-recall-seeds.js";
|
|
178
|
+
import { renderDeepRecallResult } from "./deep-recall-renderer.js";
|
|
179
|
+
import { readProjectedHarmonicGraph } from "./harmonic-retrieval.js";
|
|
180
|
+
import { stripAttributesSuffix } from "./structured-attributes.js";
|
|
171
181
|
import {
|
|
172
182
|
type GraphSnapshotNodeMetadata,
|
|
173
183
|
type GraphSnapshotRequest,
|
|
@@ -2684,6 +2694,133 @@ export class EngramAccessService extends SupportPassportAccessServiceBase {
|
|
|
2684
2694
|
return toRecallExplainJson(snapshot);
|
|
2685
2695
|
}
|
|
2686
2696
|
|
|
2697
|
+
/**
|
|
2698
|
+
* Budgeted REFINE/EXPAND/STOP deep recall (issue #2332). Deep surface
|
|
2699
|
+
* only — never called from the recall hot path. Single implementation
|
|
2700
|
+
* for MCP, HTTP, and CLI (rule 22: one renderer, one service method).
|
|
2701
|
+
*/
|
|
2702
|
+
async deepRecall(request: {
|
|
2703
|
+
query: string;
|
|
2704
|
+
namespace?: string;
|
|
2705
|
+
sessionKey?: string;
|
|
2706
|
+
authenticatedPrincipal?: string;
|
|
2707
|
+
maxSteps?: number;
|
|
2708
|
+
}): Promise<DeepRecallResult & { rendered: string }> {
|
|
2709
|
+
const cfg = this.orchestrator.config.deepRecall;
|
|
2710
|
+
if (!cfg.enabled) {
|
|
2711
|
+
return {
|
|
2712
|
+
ok: false,
|
|
2713
|
+
error: "disabled",
|
|
2714
|
+
entries: [],
|
|
2715
|
+
trace: [],
|
|
2716
|
+
rendered: "deep recall is disabled; set deepRecall.enabled",
|
|
2717
|
+
};
|
|
2718
|
+
}
|
|
2719
|
+
const query = typeof request.query === "string" ? request.query.trim() : "";
|
|
2720
|
+
if (query.length === 0) {
|
|
2721
|
+
throw new EngramAccessInputError("deepRecall: query is required");
|
|
2722
|
+
}
|
|
2723
|
+
let effective = cfg;
|
|
2724
|
+
const requestedSteps = request.maxSteps;
|
|
2725
|
+
if (requestedSteps !== undefined) {
|
|
2726
|
+
if (typeof requestedSteps !== "number" || !Number.isInteger(requestedSteps) || requestedSteps < 0) {
|
|
2727
|
+
throw new EngramAccessInputError("deepRecall: maxSteps must be a non-negative integer");
|
|
2728
|
+
}
|
|
2729
|
+
// `deepRecall.maxSteps: 0` is a documented disable value (§33): the
|
|
2730
|
+
// policy loop is off, so ANY positive override is a refusal rather than
|
|
2731
|
+
// a ceiling comparison. The zero case resolves first, so the ceiling
|
|
2732
|
+
// threshold below only runs while the loop is enabled.
|
|
2733
|
+
if (cfg.maxSteps <= 0) {
|
|
2734
|
+
if (requestedSteps > 0) {
|
|
2735
|
+
throw new EngramAccessInputError(
|
|
2736
|
+
"deepRecall: the policy loop is disabled (deepRecall.maxSteps=0); maxSteps must be 0",
|
|
2737
|
+
);
|
|
2738
|
+
}
|
|
2739
|
+
} else if (requestedSteps > cfg.maxSteps) {
|
|
2740
|
+
throw new EngramAccessInputError(
|
|
2741
|
+
`deepRecall: maxSteps ${requestedSteps} exceeds the configured ceiling ${cfg.maxSteps}`,
|
|
2742
|
+
);
|
|
2743
|
+
}
|
|
2744
|
+
effective = { ...cfg, maxSteps: requestedSteps };
|
|
2745
|
+
}
|
|
2746
|
+
const principal =
|
|
2747
|
+
request.authenticatedPrincipal?.trim() || resolvePrincipal(request.sessionKey, this.orchestrator.config);
|
|
2748
|
+
// Read path resolves through the SAME namespace layer as memoryGet (§30):
|
|
2749
|
+
// one resolved namespace, one storage instance, for seeds and expansions.
|
|
2750
|
+
const resolvedNamespace = this.resolveReadableNamespace(request.namespace, principal);
|
|
2751
|
+
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
2752
|
+
const config = this.orchestrator.config;
|
|
2753
|
+
// `abstractionNodeStoreDir` names the DEFAULT namespace's graph store and
|
|
2754
|
+
// takes precedence over `storage.dir` inside the store resolver, so only a
|
|
2755
|
+
// default-namespace read may pass it. This is the rule the harmonic WRITE
|
|
2756
|
+
// path already applies (persistConstructedHarmonicRecords: the override
|
|
2757
|
+
// goes to the base namespace only); passing it here made every non-default
|
|
2758
|
+
// namespace load the DEFAULT namespace's nodes and anchors, missing its own
|
|
2759
|
+
// anchor expansions and exposing foreign graph metadata on an id collision.
|
|
2760
|
+
const graphStoreDir =
|
|
2761
|
+
resolvedNamespace === config.defaultNamespace ? config.abstractionNodeStoreDir : undefined;
|
|
2762
|
+
// Seeds route through the namespace search router (never the base
|
|
2763
|
+
// `config.qmdCollection`, which is the DEFAULT namespace's collection):
|
|
2764
|
+
// a non-default caller must search its own suffixed collection or deep
|
|
2765
|
+
// recall silently misses its corpus and returns foreign doc ids. Hit ->
|
|
2766
|
+
// memory-id resolution is per hit through the shared QMD result resolver
|
|
2767
|
+
// (which also decodes the raw collection-qualified path forms the
|
|
2768
|
+
// namespaces-disabled fanout returns), so no invocation pre-scans the
|
|
2769
|
+
// namespace corpus.
|
|
2770
|
+
const result = await runBudgetedDeepRecall(
|
|
2771
|
+
{
|
|
2772
|
+
config: effective,
|
|
2773
|
+
searchSeed: createDeepRecallSeedSearch({
|
|
2774
|
+
namespace: resolvedNamespace,
|
|
2775
|
+
storage,
|
|
2776
|
+
router: this.orchestrator,
|
|
2777
|
+
resolver: this.orchestrator.qmdResultResolver,
|
|
2778
|
+
}),
|
|
2779
|
+
// Nodes and anchors are projected against the namespace's CURRENT
|
|
2780
|
+
// active memories through the SAME helper searchHarmonicRetrieval
|
|
2781
|
+
// uses. A raw read still carries the stored title, summary, and
|
|
2782
|
+
// anchor value of a memory that was later rejected or quarantined,
|
|
2783
|
+
// and the deep-recall state prompt hands those to the policy LLM long
|
|
2784
|
+
// before `loadMemory(...).active` can exclude the memory itself.
|
|
2785
|
+
loadGraph: async () =>
|
|
2786
|
+
readProjectedHarmonicGraph({
|
|
2787
|
+
memoryDir: storage.dir,
|
|
2788
|
+
abstractionNodeStoreDir: graphStoreDir,
|
|
2789
|
+
anchorsEnabled: true,
|
|
2790
|
+
}),
|
|
2791
|
+
loadMemory: async (memoryId) => {
|
|
2792
|
+
const memory = await storage.getMemoryById(memoryId);
|
|
2793
|
+
// Same private-record exclusion memoryGet applies (#2332): a
|
|
2794
|
+
// support-passport private record is reported as absent (null),
|
|
2795
|
+
// never as content — deep recall must not become the read surface
|
|
2796
|
+
// that answers what every other surface denies.
|
|
2797
|
+
if (!memory || isSupportPassportPrivateMemory(memory)) return null;
|
|
2798
|
+
return {
|
|
2799
|
+
memoryId,
|
|
2800
|
+
content: memory.frontmatter.structuredAttributes
|
|
2801
|
+
? stripAttributesSuffix(memory.content)
|
|
2802
|
+
: memory.content,
|
|
2803
|
+
// Enumerate the active set — never an exclusion list (§41).
|
|
2804
|
+
active: inferMemoryStatus(
|
|
2805
|
+
memory.frontmatter,
|
|
2806
|
+
toMemoryPathRel(storage.dir, memory.path)
|
|
2807
|
+
) === "active",
|
|
2808
|
+
};
|
|
2809
|
+
},
|
|
2810
|
+
callPolicy: (statePrompt, timeoutMs) =>
|
|
2811
|
+
callDeepRecallPolicyLlm({
|
|
2812
|
+
statePrompt,
|
|
2813
|
+
config,
|
|
2814
|
+
localLlm: this.orchestrator.localLlm ?? null,
|
|
2815
|
+
fallbackLlm: this.orchestrator.fastGatewayLlm ?? null,
|
|
2816
|
+
timeoutMs,
|
|
2817
|
+
}),
|
|
2818
|
+
},
|
|
2819
|
+
query,
|
|
2820
|
+
);
|
|
2821
|
+
return { ...result, rendered: renderDeepRecallResult(result) };
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2687
2824
|
async recallXray(request: {
|
|
2688
2825
|
query: string;
|
|
2689
2826
|
sessionKey?: string;
|
|
@@ -4430,15 +4567,35 @@ export class EngramAccessService extends SupportPassportAccessServiceBase {
|
|
|
4430
4567
|
agentId: string;
|
|
4431
4568
|
title: string;
|
|
4432
4569
|
content: string;
|
|
4570
|
+
/** Authenticated principal resolved by the surface, never client-supplied. */
|
|
4571
|
+
principal?: string;
|
|
4433
4572
|
}): Promise<unknown> {
|
|
4434
4573
|
if (!this.orchestrator.sharedContext) {
|
|
4435
4574
|
return { enabled: false, reason: "Shared context is disabled. Enable `sharedContextEnabled: true`." };
|
|
4436
4575
|
}
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4576
|
+
let fp: string;
|
|
4577
|
+
try {
|
|
4578
|
+
fp = await this.orchestrator.sharedContext.writeAgentOutput({
|
|
4579
|
+
agentId: request.agentId,
|
|
4580
|
+
title: request.title,
|
|
4581
|
+
content: request.content,
|
|
4582
|
+
// The origin is server-owned in BOTH cases (issue #1957 review
|
|
4583
|
+
// round 4): the authenticated principal when one resolved, and a
|
|
4584
|
+
// reserved unattributed token otherwise — a principal-less
|
|
4585
|
+
// authenticated request must never stamp the client's `agentId`
|
|
4586
|
+
// as audit metadata. The client label survives only as the
|
|
4587
|
+
// producer, which feeds grouping and display, never authority.
|
|
4588
|
+
...(request.principal
|
|
4589
|
+
? { authenticatedIdentity: request.principal }
|
|
4590
|
+
: { unattributedOrigin: UNATTRIBUTED_ACCESS_WRITE_ORIGIN }),
|
|
4591
|
+
});
|
|
4592
|
+
} catch (error) {
|
|
4593
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
4594
|
+
if (message.startsWith("shared-context write origin mismatch")) {
|
|
4595
|
+
throw new EngramAccessInputError(message);
|
|
4596
|
+
}
|
|
4597
|
+
throw error;
|
|
4598
|
+
}
|
|
4442
4599
|
return { written: true, path: fp };
|
|
4443
4600
|
}
|
|
4444
4601
|
|
|
@@ -71,6 +71,7 @@ export const MCP_TOOLS: readonly McpToolEntry[] = [
|
|
|
71
71
|
{ tool: "meetings_list", operation: "meetings_list" },
|
|
72
72
|
{ tool: "meetings_get", operation: "meetings_get" },
|
|
73
73
|
{ tool: "meetings_build", operation: "meetings_build" },
|
|
74
|
+
{ tool: "deep_recall", operation: "deep_recall" },
|
|
74
75
|
{ tool: "standup", operation: "standup" },
|
|
75
76
|
{ tool: "action_confidence", operation: "action_confidence" },
|
|
76
77
|
{ tool: "chatgpt_memory_inspector", operation: "chatgpt_memory_inspector" },
|
|
@@ -235,6 +236,7 @@ export const HTTP_ROUTES: readonly HttpRouteEntry[] = [
|
|
|
235
236
|
{ method: "GET", pathname: "/engram/v1/meetings", operation: "meetings_list" },
|
|
236
237
|
{ method: "POST", pathname: "/engram/v1/meetings/build", operation: "meetings_build" },
|
|
237
238
|
{ method: "GET", pathname: "/engram/v1/meetings/:id", operation: "meetings_get" },
|
|
239
|
+
{ method: "POST", pathname: "/engram/v1/recall/deep", operation: "deep_recall" },
|
|
238
240
|
{ method: "GET", pathname: "/engram/v1/standup", operation: "standup" },
|
|
239
241
|
{ method: "POST", pathname: "/engram/v1/observe", operation: "observe" },
|
|
240
242
|
{ method: "POST", pathname: "/engram/v1/lcm/search", operation: "lcm_search" },
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep-recall command group (issue #2332) — extracted from cli.ts so the
|
|
3
|
+
* surface file stays at its structural ceiling (same seam as
|
|
4
|
+
* meetings-commands.ts). `engram deep-recall <query>` runs the budgeted
|
|
5
|
+
* REFINE/EXPAND/STOP loop through EngramAccessService — the same single
|
|
6
|
+
* implementation MCP and HTTP call.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { Orchestrator } from "../orchestrator.js";
|
|
10
|
+
import type { CliCommand } from "../cli.js";
|
|
11
|
+
import { EngramAccessService } from "../access-service.js";
|
|
12
|
+
|
|
13
|
+
function parseMaxSteps(raw: unknown): number | undefined {
|
|
14
|
+
if (raw === undefined || raw === null) return undefined;
|
|
15
|
+
const value = typeof raw === "string" ? Number(raw) : raw;
|
|
16
|
+
if (typeof value !== "number" || !Number.isFinite(value) || !Number.isInteger(value) || value < 0) {
|
|
17
|
+
throw new Error(`--max-steps must be a non-negative integer; got ${JSON.stringify(raw)}`);
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function registerDeepRecallCommands(cmd: CliCommand, orchestrator: Orchestrator): void {
|
|
23
|
+
cmd
|
|
24
|
+
.command("deep-recall <query>")
|
|
25
|
+
.description("Budgeted multi-hop retrieval over the anchor graph (slow, thorough; issue #2332)")
|
|
26
|
+
.option("--max-steps <n>", "Policy-step ceiling (cannot exceed the configured deepRecall.maxSteps)")
|
|
27
|
+
.option("--namespace <ns>", "Namespace to scope the retrieval to")
|
|
28
|
+
.option("--json", "JSON output (full entries + trace)")
|
|
29
|
+
.action(async (...args: unknown[]) => {
|
|
30
|
+
const query = String(args[0] ?? "");
|
|
31
|
+
const options = (args[args.length - 1] ?? {}) as Record<string, unknown>;
|
|
32
|
+
let maxSteps: number | undefined;
|
|
33
|
+
try {
|
|
34
|
+
maxSteps = parseMaxSteps(options.maxSteps);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
37
|
+
process.exitCode = 1;
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const service = new EngramAccessService(orchestrator);
|
|
41
|
+
try {
|
|
42
|
+
const result = await service.deepRecall({
|
|
43
|
+
query,
|
|
44
|
+
...(maxSteps !== undefined ? { maxSteps } : {}),
|
|
45
|
+
...(typeof options.namespace === "string" && options.namespace.length > 0
|
|
46
|
+
? { namespace: options.namespace }
|
|
47
|
+
: {}),
|
|
48
|
+
});
|
|
49
|
+
if (options.json === true) {
|
|
50
|
+
console.log(JSON.stringify(result, null, 2));
|
|
51
|
+
} else {
|
|
52
|
+
console.log(result.rendered);
|
|
53
|
+
}
|
|
54
|
+
if (!result.ok) process.exitCode = 1;
|
|
55
|
+
} catch (err) {
|
|
56
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
57
|
+
process.exitCode = 1;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
package/src/cli.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { bumpMemoryCorpusVersionForDir } from "./memory-corpus-version.js";
|
|
|
14
14
|
import { utcDayRange } from "./transcript.js";
|
|
15
15
|
import { padEndDisplay, truncateGraphemeSafe } from "./whitespace.js";
|
|
16
16
|
import { runWearablesCliCommand } from "./wearables/cli.js";
|
|
17
|
-
import { registerMeetingsCommands } from "./cli/meetings-commands.js";
|
|
17
|
+
import { registerMeetingsCommands } from "./cli/meetings-commands.js"; import { registerDeepRecallCommands } from "./cli/deep-recall-commands.js";
|
|
18
18
|
import { registerExportOkfCommand, registerOkfCommands } from "./cli/okf-commands.js";
|
|
19
19
|
import { registerSkillsCommands } from "./cli/skills-commands.js";
|
|
20
20
|
import { registerResearchStatusCommands } from "./cli/research-status-commands.js";
|
|
@@ -6230,7 +6230,7 @@ export function registerCli(
|
|
|
6230
6230
|
|
|
6231
6231
|
registerResearchStatusCommands(cmd, orchestrator);
|
|
6232
6232
|
|
|
6233
|
-
registerCreationLedgerCommands(cmd, orchestrator); registerMeetingsCommands(cmd, orchestrator); registerOkfCommands(cmd, orchestrator);
|
|
6233
|
+
registerCreationLedgerCommands(cmd, orchestrator); registerMeetingsCommands(cmd, orchestrator); registerOkfCommands(cmd, orchestrator); registerDeepRecallCommands(cmd, orchestrator);
|
|
6234
6234
|
|
|
6235
6235
|
cmd
|
|
6236
6236
|
.command("trust-zone-promote")
|
package/src/config.test.ts
CHANGED
|
@@ -2656,3 +2656,22 @@ test("parseConfig rejects array contradictionLocalization values", () => {
|
|
|
2656
2656
|
/contradictionLocalization must be an object/,
|
|
2657
2657
|
);
|
|
2658
2658
|
});
|
|
2659
|
+
|
|
2660
|
+
test("parseConfig coerces string-typed sharedContextAllowBindingAuthority from the CLI", () => {
|
|
2661
|
+
// `--config sharedContextAllowBindingAuthority=true` arrives as a string, so a
|
|
2662
|
+
// strict `=== true` silently left the feature off for anyone who enabled it.
|
|
2663
|
+
for (const enabled of ["true", "1", "yes", "on", true]) {
|
|
2664
|
+
assert.equal(
|
|
2665
|
+
parseConfig({ sharedContextAllowBindingAuthority: enabled }).sharedContextAllowBindingAuthority,
|
|
2666
|
+
true,
|
|
2667
|
+
`${JSON.stringify(enabled)} must enable binding authority`,
|
|
2668
|
+
);
|
|
2669
|
+
}
|
|
2670
|
+
for (const disabled of ["false", "0", "no", "off", false, undefined, "", "garbage"]) {
|
|
2671
|
+
assert.equal(
|
|
2672
|
+
parseConfig({ sharedContextAllowBindingAuthority: disabled }).sharedContextAllowBindingAuthority,
|
|
2673
|
+
false,
|
|
2674
|
+
`${JSON.stringify(disabled)} must leave binding authority off`,
|
|
2675
|
+
);
|
|
2676
|
+
}
|
|
2677
|
+
});
|
package/src/config.ts
CHANGED
|
@@ -46,6 +46,7 @@ import { parseProceduralMaintenanceConfig } from "./procedural/maintenance-confi
|
|
|
46
46
|
import { parseActiveContextFields } from "./active-context-config.js";
|
|
47
47
|
import { parseSkillProjectionConfig } from "./procedural/skill-projection.js";
|
|
48
48
|
import { parseDriftDetectionConfig } from "./preferences/drift-config.js";
|
|
49
|
+
import { parseDeepRecallConfig } from "./deep-recall-config.js";
|
|
49
50
|
import { parseContradictionLocalizationConfig, parseContradictionScanConfig } from "./contradiction-config.js";
|
|
50
51
|
import { parseGraphPathScoringConfig } from "./graph-path-scoring-config.js";
|
|
51
52
|
import { parseWritePathDedupConfig } from "./dedup/novelty-gate.js";
|
|
@@ -1793,6 +1794,8 @@ export function parseConfig(
|
|
|
1793
1794
|
contradictionScan: parseContradictionScanConfig(cfg.contradictionScan),
|
|
1794
1795
|
// Preference drift detection (issue #2371)
|
|
1795
1796
|
driftDetection: parseDriftDetectionConfig(cfg.driftDetection),
|
|
1797
|
+
// Budgeted deep-recall surface (issue #2332)
|
|
1798
|
+
deepRecall: parseDeepRecallConfig(cfg.deepRecall),
|
|
1796
1799
|
dependencyPropagation: parseDependencyPropagationConfig(cfg),
|
|
1797
1800
|
// Temporal Supersession (issue #375)
|
|
1798
1801
|
temporalSupersessionEnabled: cfg.temporalSupersessionEnabled !== false, // On by default
|
|
@@ -3026,6 +3029,10 @@ export function parseConfig(
|
|
|
3026
3029
|
|
|
3027
3030
|
// v4.0 shared-context (default off)
|
|
3028
3031
|
sharedContextEnabled: cfg.sharedContextEnabled === true,
|
|
3032
|
+
// CLI values arrive as strings (`--config sharedContextAllowBindingAuthority=true`),
|
|
3033
|
+
// so a strict `=== true` silently keeps the feature off. Default stays false.
|
|
3034
|
+
sharedContextAllowBindingAuthority:
|
|
3035
|
+
coerceBool(cfg.sharedContextAllowBindingAuthority, "sharedContextAllowBindingAuthority") ?? false,
|
|
3029
3036
|
sharedContextDir:
|
|
3030
3037
|
typeof cfg.sharedContextDir === "string" && cfg.sharedContextDir.length > 0 ? cfg.sharedContextDir : undefined,
|
|
3031
3038
|
sharedContextMaxInjectChars:
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep-recall config (issue #2332) — the `deepRecall` block.
|
|
3
|
+
*
|
|
4
|
+
* Parsed the same way `driftDetection` and `contradictionScan` are:
|
|
5
|
+
* shape-validated, string-coercion safe (§24), and honoring documented
|
|
6
|
+
* zero/no-op values (§33) rather than clamping them to something non-zero.
|
|
7
|
+
* `maxSteps: 0` disables the policy loop (seed-only retrieval);
|
|
8
|
+
* `maxResults: 0` returns an empty entry list; `maxExpandPerStep: 0`
|
|
9
|
+
* lets the policy pick EXPAND but select nothing. Millisecond fields
|
|
10
|
+
* of `0` mean "no timeout on that axis".
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { coerceBool, coerceNumber } from "./connectors/coerce.js";
|
|
14
|
+
|
|
15
|
+
export interface DeepRecallConfig {
|
|
16
|
+
/** Master switch for the deep-recall surface. Default false. */
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
/** Policy iterations; 0 disables the loop (seed-only). Default 4. */
|
|
19
|
+
maxSteps: number;
|
|
20
|
+
/** Per-step cap on frontier nodes pulled into the working set. Default 3. */
|
|
21
|
+
maxExpandPerStep: number;
|
|
22
|
+
/** Final working-set cap returned to the caller. Default 12. */
|
|
23
|
+
maxResults: number;
|
|
24
|
+
/** Per policy-call timeout in ms; 0 = none. Default 10000. */
|
|
25
|
+
stepTimeoutMs: number;
|
|
26
|
+
/** Whole-invocation wall-clock timeout in ms; 0 = none. Default 45000. */
|
|
27
|
+
totalTimeoutMs: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface DeepRecallSettings {
|
|
31
|
+
deepRecall: DeepRecallConfig;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const DEEP_RECALL_CONFIG_DEFAULTS: DeepRecallConfig = {
|
|
35
|
+
enabled: false,
|
|
36
|
+
maxSteps: 4,
|
|
37
|
+
maxExpandPerStep: 3,
|
|
38
|
+
maxResults: 12,
|
|
39
|
+
stepTimeoutMs: 10000,
|
|
40
|
+
totalTimeoutMs: 45000,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
function parseFlag(src: Record<string, unknown>, key: string, fallback: boolean): boolean {
|
|
44
|
+
const value = src[key];
|
|
45
|
+
if (value === undefined || value === null) return fallback;
|
|
46
|
+
const coerced = coerceBool(value);
|
|
47
|
+
if (coerced === undefined) {
|
|
48
|
+
throw new Error(`deepRecall.${key} must be a boolean (or "true"/"false"/"1"/"0"); got ${JSON.stringify(value)}`);
|
|
49
|
+
}
|
|
50
|
+
return coerced;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function parseCount(src: Record<string, unknown>, key: string, fallback: number): number {
|
|
54
|
+
const value = src[key];
|
|
55
|
+
if (value === undefined || value === null) return fallback;
|
|
56
|
+
const coerced = coerceNumber(value);
|
|
57
|
+
if (coerced === undefined || !Number.isFinite(coerced)) {
|
|
58
|
+
throw new Error(`deepRecall.${key} must be a finite number; got ${JSON.stringify(value)}`);
|
|
59
|
+
}
|
|
60
|
+
if (!Number.isInteger(coerced)) {
|
|
61
|
+
throw new Error(`deepRecall.${key} must be an integer; got ${JSON.stringify(value)}`);
|
|
62
|
+
}
|
|
63
|
+
if (coerced < 0) {
|
|
64
|
+
throw new Error(`deepRecall.${key} must not be negative; got ${JSON.stringify(value)}`);
|
|
65
|
+
}
|
|
66
|
+
return coerced;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function parseDeepRecallConfig(raw: unknown): DeepRecallConfig {
|
|
70
|
+
if (raw === undefined || raw === null) return { ...DEEP_RECALL_CONFIG_DEFAULTS };
|
|
71
|
+
if (typeof raw !== "object" || Array.isArray(raw)) {
|
|
72
|
+
throw new Error(`deepRecall must be an object; got ${JSON.stringify(raw)}`);
|
|
73
|
+
}
|
|
74
|
+
const src = raw as Record<string, unknown>;
|
|
75
|
+
return {
|
|
76
|
+
enabled: parseFlag(src, "enabled", DEEP_RECALL_CONFIG_DEFAULTS.enabled),
|
|
77
|
+
maxSteps: parseCount(src, "maxSteps", DEEP_RECALL_CONFIG_DEFAULTS.maxSteps),
|
|
78
|
+
maxExpandPerStep: parseCount(src, "maxExpandPerStep", DEEP_RECALL_CONFIG_DEFAULTS.maxExpandPerStep),
|
|
79
|
+
maxResults: parseCount(src, "maxResults", DEEP_RECALL_CONFIG_DEFAULTS.maxResults),
|
|
80
|
+
stepTimeoutMs: parseCount(src, "stepTimeoutMs", DEEP_RECALL_CONFIG_DEFAULTS.stepTimeoutMs),
|
|
81
|
+
totalTimeoutMs: parseCount(src, "totalTimeoutMs", DEEP_RECALL_CONFIG_DEFAULTS.totalTimeoutMs),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep-recall HTTP glue (issue #2332) — route body lives here so
|
|
3
|
+
* access-http.ts stays at its structural ceiling (same seam as
|
|
4
|
+
* meetings/http-glue.ts and location/http-glue.ts).
|
|
5
|
+
*
|
|
6
|
+
* Input errors map to 400; everything else rethrows so backend faults keep
|
|
7
|
+
* flowing to the global 500 handler. `deepRecall.enabled` gating lives in
|
|
8
|
+
* EngramAccessService — this module only translates transport shape.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
12
|
+
import { deepRecallRequestSchema } from "./access-schema.js";
|
|
13
|
+
import { EngramAccessInputError } from "./access-errors.js";
|
|
14
|
+
import type { EngramAccessService } from "./access-service.js";
|
|
15
|
+
|
|
16
|
+
type RespondJson = (res: ServerResponse, status: number, payload: unknown) => void;
|
|
17
|
+
type ReadJsonBody = (req: IncomingMessage) => Promise<unknown>;
|
|
18
|
+
|
|
19
|
+
function coerceMaxSteps(raw: unknown): number | undefined {
|
|
20
|
+
if (raw === undefined || raw === null) return undefined;
|
|
21
|
+
const value = typeof raw === "string" ? Number(raw) : raw;
|
|
22
|
+
if (typeof value !== "number" || !Number.isFinite(value) || !Number.isInteger(value) || value < 0) {
|
|
23
|
+
throw new EngramAccessInputError("maxSteps must be a non-negative integer");
|
|
24
|
+
}
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export async function respondDeepRecall(
|
|
29
|
+
req: IncomingMessage,
|
|
30
|
+
res: ServerResponse,
|
|
31
|
+
respondJson: RespondJson,
|
|
32
|
+
readJsonBody: ReadJsonBody,
|
|
33
|
+
service: EngramAccessService,
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the caller scope for a body-supplied namespace/sessionKey. The
|
|
36
|
+
* body `namespace` is user-controlled, so it MUST flow through the SAME
|
|
37
|
+
* effective-namespace allow-list gate as the query-string value (issue
|
|
38
|
+
* #1850 finding 2 / #2332 review): a scoped bearer that passes an allowed
|
|
39
|
+
* `?namespace=` while setting a different `namespace` in the body would
|
|
40
|
+
* otherwise read another tenant. access-http supplies the gate and applies
|
|
41
|
+
* the query-string fallback, so this module never selects a namespace of
|
|
42
|
+
* its own. Throws 403 when the effective namespace is not permitted.
|
|
43
|
+
*
|
|
44
|
+
* `authenticatedPrincipal` is the identity the transport authenticated, and
|
|
45
|
+
* it MUST reach the service: authorization and the audit trail derive from
|
|
46
|
+
* the presenting principal, never from the client-supplied `sessionKey`.
|
|
47
|
+
* Dropping it let a crafted key matching another principal rule read that
|
|
48
|
+
* principal's namespaces, and made a legitimate namespace-enabled request
|
|
49
|
+
* with no session key fail as unauthenticated.
|
|
50
|
+
*/
|
|
51
|
+
scopeFor: (
|
|
52
|
+
bodyNamespace?: string,
|
|
53
|
+
bodySessionKey?: string,
|
|
54
|
+
) => { namespace?: string; sessionKey?: string; authenticatedPrincipal?: string },
|
|
55
|
+
): Promise<void> {
|
|
56
|
+
const parsed = deepRecallRequestSchema.safeParse(await readJsonBody(req));
|
|
57
|
+
if (!parsed.success) {
|
|
58
|
+
respondJson(
|
|
59
|
+
res,
|
|
60
|
+
400,
|
|
61
|
+
{ error: "invalid_request", detail: parsed.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ") },
|
|
62
|
+
);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const maxSteps = coerceMaxSteps(parsed.data.maxSteps);
|
|
66
|
+
const scope = scopeFor(parsed.data.namespace, parsed.data.sessionKey);
|
|
67
|
+
const result = await service.deepRecall({
|
|
68
|
+
query: parsed.data.query,
|
|
69
|
+
...(maxSteps !== undefined ? { maxSteps } : {}),
|
|
70
|
+
namespace: scope.namespace,
|
|
71
|
+
sessionKey: scope.sessionKey,
|
|
72
|
+
authenticatedPrincipal: scope.authenticatedPrincipal,
|
|
73
|
+
});
|
|
74
|
+
respondJson(res, 200, result);
|
|
75
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep-recall MCP tool definition (issue #2332) — extracted from
|
|
3
|
+
* access-mcp.ts so the surface file stays at its structural ceiling.
|
|
4
|
+
* Spread back into `this.tools` (`...DEEP_RECALL_MCP_TOOLS`); the
|
|
5
|
+
* migrated-operation mapping spreads into MCP_MIGRATED_OPERATIONS.
|
|
6
|
+
* The `remnic.` canonical alias is minted by withToolAliases at
|
|
7
|
+
* tools/list time (same as meetings).
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { McpTool } from "./access-mcp.js";
|
|
11
|
+
|
|
12
|
+
export const DEEP_RECALL_MCP_TOOLS: McpTool[] = [
|
|
13
|
+
{
|
|
14
|
+
name: "engram.deep_recall",
|
|
15
|
+
description:
|
|
16
|
+
"Budgeted REFINE/EXPAND/STOP multi-hop retrieval over the cue-anchor graph (issue #2332). Slow and thorough (seconds; several LLM calls) — opt in when a question warrants deep search, not for routine recall. Returns ranked entries plus a per-step trace. Typed error when deepRecall.enabled is off.",
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: "object",
|
|
19
|
+
properties: {
|
|
20
|
+
query: { type: "string", description: "The question to retrieve for. Required." },
|
|
21
|
+
maxSteps: {
|
|
22
|
+
type: "integer",
|
|
23
|
+
minimum: 0,
|
|
24
|
+
description: "Optional policy-step ceiling; cannot exceed the configured deepRecall.maxSteps.",
|
|
25
|
+
},
|
|
26
|
+
namespace: { type: "string", description: "Caller namespace to scope this operation to." },
|
|
27
|
+
sessionKey: { type: "string", description: "Session key for principal/namespace resolution." },
|
|
28
|
+
},
|
|
29
|
+
required: ["query"],
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Policy-call LLM routing for deep recall (issue #2332).
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `extraction-judge.ts` `callJudgeLlm` exactly: local client first
|
|
5
|
+
* (json_object response format) unless modelSource is "gateway", then the
|
|
6
|
+
* fallback client with the shared background-task chain options. Never a
|
|
7
|
+
* raw OpenAI client. Returns null when both legs fail — the loop treats
|
|
8
|
+
* that as a stop, never a crash.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { gatewayTaskChainOptions, type FallbackLlmClient } from "./fallback-llm.js";
|
|
12
|
+
import type { LocalLlmClient } from "./local-llm.js";
|
|
13
|
+
import type { PluginConfig } from "./types.js";
|
|
14
|
+
|
|
15
|
+
export const DEEP_RECALL_POLICY_SYSTEM_PROMPT =
|
|
16
|
+
"You are the retrieval policy for a long-term memory system. Given the question, the current working set of retrieved memories, and the frontier of anchor-linked candidates, choose exactly one action: REFINE (rewrite the query), EXPAND (follow named frontier nodes), or STOP. Respond with JSON only.";
|
|
17
|
+
|
|
18
|
+
export async function callDeepRecallPolicyLlm(input: {
|
|
19
|
+
statePrompt: string;
|
|
20
|
+
config: PluginConfig;
|
|
21
|
+
localLlm: LocalLlmClient | null;
|
|
22
|
+
fallbackLlm: FallbackLlmClient | null;
|
|
23
|
+
timeoutMs: number;
|
|
24
|
+
}): Promise<string | null> {
|
|
25
|
+
const messages: Array<{ role: "system" | "user"; content: string }> = [
|
|
26
|
+
{ role: "system", content: DEEP_RECALL_POLICY_SYSTEM_PROMPT },
|
|
27
|
+
{ role: "user", content: input.statePrompt },
|
|
28
|
+
];
|
|
29
|
+
const timeout = input.timeoutMs > 0 ? input.timeoutMs : undefined;
|
|
30
|
+
const skipLocal = input.config.modelSource === "gateway";
|
|
31
|
+
const gatewayChain = gatewayTaskChainOptions(input.config);
|
|
32
|
+
|
|
33
|
+
if (input.localLlm && !skipLocal) {
|
|
34
|
+
try {
|
|
35
|
+
const result = await input.localLlm.chatCompletion(messages, {
|
|
36
|
+
temperature: 0.1,
|
|
37
|
+
maxTokens: 1024,
|
|
38
|
+
...(timeout ? { timeoutMs: timeout } : {}),
|
|
39
|
+
responseFormat: { type: "json_object" },
|
|
40
|
+
operation: "deep-recall-policy",
|
|
41
|
+
});
|
|
42
|
+
if (result?.content) return result.content;
|
|
43
|
+
} catch {
|
|
44
|
+
// fall through to the gateway leg
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (input.fallbackLlm) {
|
|
49
|
+
try {
|
|
50
|
+
const result = await input.fallbackLlm.chatCompletion(
|
|
51
|
+
messages as Array<{ role: "system" | "user" | "assistant"; content: string }>,
|
|
52
|
+
{
|
|
53
|
+
temperature: 0.1,
|
|
54
|
+
maxTokens: 1024,
|
|
55
|
+
...(timeout ? { timeoutMs: timeout } : {}),
|
|
56
|
+
...gatewayChain,
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
if (result?.content) return result.content;
|
|
60
|
+
} catch {
|
|
61
|
+
// both legs failed — caller treats null as a stop
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared markdown renderer for deep recall (issue #2332).
|
|
3
|
+
*
|
|
4
|
+
* Rule 22 (AGENTS.md): never fork formatting — CLI text output, MCP text
|
|
5
|
+
* output, and any later surface all render through this one module.
|
|
6
|
+
* Deterministic: entries in result order, trace in step order.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { DeepRecallResult } from "./deep-recall.js";
|
|
10
|
+
|
|
11
|
+
export function renderDeepRecallResult(result: DeepRecallResult): string {
|
|
12
|
+
if (!result.ok) {
|
|
13
|
+
return [`# Deep recall`, ``, `- error: ${result.error ?? "unknown"}`, ``].join("\n");
|
|
14
|
+
}
|
|
15
|
+
const lines: string[] = ["# Deep recall", ""];
|
|
16
|
+
if (result.entries.length === 0) {
|
|
17
|
+
lines.push("No memories retrieved.", "");
|
|
18
|
+
} else {
|
|
19
|
+
lines.push("## Memories", "");
|
|
20
|
+
for (const [index, entry] of result.entries.entries()) {
|
|
21
|
+
const via = entry.viaAnchor ? ` via anchor "${entry.viaAnchor}"` : "";
|
|
22
|
+
lines.push(
|
|
23
|
+
`${index + 1}. **${entry.memoryId}** (score ${entry.score.toFixed(3)}, origin ${entry.origin}${via})`,
|
|
24
|
+
);
|
|
25
|
+
lines.push(` ${entry.content.replace(/\s+/g, " ").trim().slice(0, 400)}`);
|
|
26
|
+
}
|
|
27
|
+
lines.push("");
|
|
28
|
+
}
|
|
29
|
+
lines.push("## Trace", "");
|
|
30
|
+
if (result.trace.length === 0) {
|
|
31
|
+
lines.push("(empty)");
|
|
32
|
+
} else {
|
|
33
|
+
for (const step of result.trace) {
|
|
34
|
+
lines.push(
|
|
35
|
+
`- step ${step.step}: ${step.action} — ${step.detail} (workingSet=${step.workingSetSize}, frontier=${step.frontierSize}, ${step.durationMs}ms)`,
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
lines.push("");
|
|
40
|
+
return lines.join("\n");
|
|
41
|
+
}
|