@remnic/core 9.54.4 → 9.54.6
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 +24 -23
- package/dist/access-admin-ops-surface.js +55 -50
- package/dist/access-authorization-probe.d.ts +25 -22
- package/dist/access-authorization-probe.js +58 -51
- package/dist/access-boundary.d.ts +26 -23
- package/dist/access-boundary.js +59 -52
- package/dist/access-cli.js +115 -107
- 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 +19 -18
- package/dist/access-extraction-force-flush.js +55 -50
- package/dist/access-health-types.d.ts +1 -1
- package/dist/access-http-lcm-compaction.d.ts +22 -21
- package/dist/access-http-lifecycle-flush.d.ts +22 -21
- package/dist/access-http-offline-stream.d.ts +19 -18
- package/dist/access-http-query.js +55 -50
- package/dist/access-http.d.ts +55 -36
- package/dist/access-http.js +76 -65
- package/dist/access-identity-continuity-surface.d.ts +9 -9
- package/dist/access-identity-continuity-surface.js +55 -50
- package/dist/access-lcm-surface.d.ts +21 -20
- package/dist/access-lcm-surface.js +55 -50
- package/dist/access-mcp.d.ts +22 -21
- package/dist/access-mcp.js +63 -57
- package/dist/access-memory-search-fanout.d.ts +22 -2
- package/dist/access-memory-search-fanout.js +1 -1
- package/dist/{access-namespace-preflight-C7n4tgWC.d.ts → access-namespace-preflight-CCNn_6NE.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +3 -3
- package/dist/access-namespace-preflight.js +55 -50
- package/dist/access-observe-write-surface.d.ts +22 -21
- package/dist/access-observe-write-surface.js +55 -50
- package/dist/access-offline-manifest.d.ts +10 -9
- package/dist/access-offline-manifest.js +12 -10
- package/dist/access-operations-batch.js +57 -52
- package/dist/access-operations.d.ts +23 -22
- package/dist/access-operations.js +61 -55
- package/dist/access-recall-concurrency.d.ts +21 -20
- package/dist/access-recall-concurrency.js +55 -50
- package/dist/access-recall-response.d.ts +19 -18
- package/dist/access-recall-response.js +55 -50
- package/dist/access-recall-surface.d.ts +19 -18
- package/dist/access-recall-surface.js +55 -50
- package/dist/access-schema.d.ts +2 -2
- package/dist/access-schema.js +5 -4
- package/dist/{access-service-CXvbxLK-.d.ts → access-service-DkSdXK4S.d.ts} +1314 -83
- package/dist/access-service-helpers.d.ts +22 -21
- package/dist/access-service.d.ts +31 -30
- package/dist/access-service.js +55 -50
- package/dist/access-surface-catalog.d.ts +22 -21
- package/dist/access-surface-catalog.js +209 -2
- 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 +14 -1
- package/dist/active-memory-bridge.js +6 -1
- package/dist/active-recall.d.ts +1 -1
- package/dist/active-recall.js +4 -2
- package/dist/active-recall.js.map +1 -1
- package/dist/adapters/index.js +7 -7
- package/dist/adapters/registry.js +3 -3
- package/dist/admin-console/public/what-helps-me/app.js +1594 -0
- package/dist/admin-console/public/what-helps-me/index.html +339 -0
- package/dist/admin-console/public/what-helps-me/model.js +685 -0
- package/dist/admin-console/public/what-helps-me/what-helps-me.css +1296 -0
- package/dist/ambient-provenance.d.ts +1 -1
- package/dist/artifact-search.d.ts +1 -1
- package/dist/{auto-sync-TDHLZPVP.js → auto-sync-NR3GPCOA.js} +4 -4
- 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.d.ts +2 -2
- package/dist/briefing.js +33 -12
- 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/buffer.js +3 -3
- package/dist/bulk-import/index.d.ts +3 -3
- package/dist/calibration.d.ts +1 -1
- package/dist/calibration.js +1 -1
- package/dist/capabilities.d.ts +1 -1
- package/dist/{catalog-BOOxl-I2.d.ts → catalog-DGFf8mD9.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +34 -13
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/{chunk-ZYLC7NFO.js → chunk-26ZXBTYN.js} +4 -4
- package/dist/chunk-26ZXBTYN.js.map +1 -0
- package/dist/{chunk-LLJMAULE.js → chunk-2FKEIPIT.js} +5 -5
- package/dist/{chunk-3CSX3ETE.js → chunk-2LWQSV6A.js} +23 -11
- package/dist/chunk-2LWQSV6A.js.map +1 -0
- package/dist/{chunk-JBPKEARU.js → chunk-2QSZNTDO.js} +7 -7
- package/dist/chunk-37DZZFFM.js +502 -0
- package/dist/chunk-37DZZFFM.js.map +1 -0
- package/dist/chunk-3HSRWJTC.js +9 -0
- package/dist/chunk-3HSRWJTC.js.map +1 -0
- package/dist/{chunk-XUAMCLY4.js → chunk-3TIZPSJC.js} +17 -13
- package/dist/chunk-3TIZPSJC.js.map +1 -0
- package/dist/{chunk-PDDTI7IC.js → chunk-43SEBY2M.js} +1 -1
- package/dist/{chunk-HWRD23DW.js → chunk-46SZBVDS.js} +3 -3
- package/dist/{chunk-6HPHEFXT.js → chunk-5FD7JMTX.js} +2 -2
- package/dist/{chunk-7BZOBA5J.js → chunk-5NB726GV.js} +70 -16
- package/dist/chunk-5NB726GV.js.map +1 -0
- package/dist/chunk-62OKGIJA.js +39 -0
- package/dist/chunk-62OKGIJA.js.map +1 -0
- package/dist/{chunk-IBKR2TFR.js → chunk-6CYHUWCO.js} +2 -2
- package/dist/{chunk-YN6ASZUG.js → chunk-6QPI2ITJ.js} +5 -5
- package/dist/{chunk-UU3G6GUP.js → chunk-76JJSXK7.js} +1 -1
- package/dist/chunk-76JJSXK7.js.map +1 -0
- package/dist/{chunk-PX2LSHYM.js → chunk-7BD6O7ZV.js} +189 -4
- package/dist/chunk-7BD6O7ZV.js.map +1 -0
- package/dist/chunk-7TBXNYLO.js +346 -0
- package/dist/chunk-7TBXNYLO.js.map +1 -0
- package/dist/{chunk-NH5IR2WM.js → chunk-BRR5EUTF.js} +6 -2
- package/dist/chunk-BRR5EUTF.js.map +1 -0
- package/dist/{chunk-NIS256NW.js → chunk-CIAI24TQ.js} +3 -3
- package/dist/{chunk-T2JHZWH6.js → chunk-D3LBIUWV.js} +11703 -7573
- package/dist/chunk-D3LBIUWV.js.map +1 -0
- package/dist/{chunk-7FGL6CGA.js → chunk-DVYRD4HY.js} +2 -2
- package/dist/{chunk-G7Z6EENO.js → chunk-EKTP7MNS.js} +4 -4
- package/dist/{chunk-S75M5ZRK.js → chunk-F2JRDPON.js} +16 -1
- package/dist/chunk-F2JRDPON.js.map +1 -0
- package/dist/{chunk-RZ4XGKOJ.js → chunk-FFRTNF3L.js} +8 -8
- package/dist/{chunk-VKXWK44Q.js → chunk-FONWBCVY.js} +3 -3
- package/dist/{chunk-DZD576ZU.js → chunk-FPLM2TKD.js} +2 -2
- package/dist/{chunk-ZPJ4QSGP.js → chunk-FTPONF6B.js} +2 -2
- package/dist/{chunk-LJS7KUPV.js → chunk-FWX7W5PM.js} +2 -2
- package/dist/{chunk-UTRO5UJU.js → chunk-G6DFSS6A.js} +5 -1
- package/dist/chunk-G6DFSS6A.js.map +1 -0
- package/dist/{chunk-6LAPLZOS.js → chunk-GJ776BC2.js} +8 -3
- package/dist/chunk-GJ776BC2.js.map +1 -0
- package/dist/{chunk-G4T7L557.js → chunk-GN3WRFJY.js} +6 -6
- package/dist/{chunk-QT2FRYI4.js → chunk-H7NAZ3UB.js} +2 -2
- package/dist/{chunk-APPFNGX6.js → chunk-HBUFQRIM.js} +2 -2
- package/dist/{chunk-UU7TRFNE.js → chunk-HGJ6NJ4E.js} +2 -2
- package/dist/{chunk-WB7JSQCP.js → chunk-HIEWDJ2O.js} +5 -2
- package/dist/{chunk-WB7JSQCP.js.map → chunk-HIEWDJ2O.js.map} +1 -1
- package/dist/{chunk-UES4BHA2.js → chunk-I3MSGFGD.js} +17 -6
- package/dist/chunk-I3MSGFGD.js.map +1 -0
- package/dist/{chunk-C4ZNGVK3.js → chunk-IKP5OYQQ.js} +2 -2
- package/dist/{chunk-KQAFEZQX.js → chunk-IPLYGWQF.js} +5 -5
- package/dist/{chunk-RDJRFDJY.js → chunk-IQ4NVWEF.js} +2 -2
- package/dist/{chunk-CGVHPCP2.js → chunk-JYG4OLWH.js} +2 -2
- package/dist/{chunk-WOPA3SGI.js → chunk-K26NWEOC.js} +8 -8
- package/dist/{chunk-K4QS7LXU.js → chunk-K2UGPTYY.js} +485 -44
- package/dist/chunk-K2UGPTYY.js.map +1 -0
- package/dist/{chunk-L6CQ7WIW.js → chunk-KFBOPMF6.js} +11 -11
- package/dist/chunk-KFBOPMF6.js.map +1 -0
- package/dist/{chunk-G7A5HLUS.js → chunk-KJH6W2I7.js} +2 -2
- package/dist/{chunk-IXEBUYO4.js → chunk-KM55SMLG.js} +11 -2
- package/dist/{chunk-IXEBUYO4.js.map → chunk-KM55SMLG.js.map} +1 -1
- package/dist/{chunk-HOIRB77A.js → chunk-L6Z5OAS4.js} +2 -2
- package/dist/chunk-LC2BDILZ.js +57 -0
- package/dist/chunk-LC2BDILZ.js.map +1 -0
- package/dist/{chunk-227UFSEQ.js → chunk-LEPOP46W.js} +4 -4
- package/dist/{chunk-6R4G7N4S.js → chunk-M4YHAODQ.js} +388 -748
- package/dist/chunk-M4YHAODQ.js.map +1 -0
- package/dist/{chunk-3JLPGJ43.js → chunk-MIH3CJPN.js} +5 -5
- package/dist/{chunk-QHFV6VNU.js → chunk-MK5VEWCR.js} +2 -2
- package/dist/chunk-NISZQW72.js +140 -0
- package/dist/chunk-NISZQW72.js.map +1 -0
- package/dist/{chunk-GUKBW4HL.js → chunk-NQMSEB5D.js} +6 -6
- package/dist/{chunk-G2LUMAUF.js → chunk-OCIP6YMD.js} +12 -5
- package/dist/chunk-OCIP6YMD.js.map +1 -0
- package/dist/{chunk-47P3RYZP.js → chunk-PG4QBPVG.js} +21 -11
- package/dist/chunk-PG4QBPVG.js.map +1 -0
- package/dist/{chunk-WRJVB3C2.js → chunk-PO7NXBG2.js} +2 -2
- package/dist/{chunk-QWGE2PUH.js → chunk-PT54WISF.js} +190 -56
- package/dist/chunk-PT54WISF.js.map +1 -0
- package/dist/{chunk-AZM4CCAC.js → chunk-QZLDRQ4I.js} +8 -8
- package/dist/{chunk-THPPCISA.js → chunk-RBII7637.js} +5 -5
- package/dist/{chunk-JDZPNCMA.js → chunk-RUNORG2P.js} +6 -3
- package/dist/chunk-RUNORG2P.js.map +1 -0
- package/dist/{chunk-JV5YUBIZ.js → chunk-RZQ6W2W4.js} +50 -44
- package/dist/chunk-RZQ6W2W4.js.map +1 -0
- package/dist/{chunk-RUMNY5DT.js → chunk-SMNYAMJD.js} +6 -2
- package/dist/chunk-SMNYAMJD.js.map +1 -0
- package/dist/{chunk-MKQBXQKU.js → chunk-TB6CBZ5V.js} +22 -15
- package/dist/chunk-TB6CBZ5V.js.map +1 -0
- package/dist/{chunk-VMMQDEN5.js → chunk-TO7ZTWJW.js} +2 -2
- package/dist/{chunk-K2TDK7GG.js → chunk-TWTUGCTY.js} +2 -2
- package/dist/{chunk-HLYR2TQL.js → chunk-UCTS3DDH.js} +2 -2
- package/dist/{chunk-JYIJNNN3.js → chunk-UG6VXIOK.js} +2 -2
- package/dist/{chunk-WM65LU67.js → chunk-UKYS3NU5.js} +2 -2
- package/dist/{chunk-WDBX6VER.js → chunk-UPLZNJKN.js} +5 -5
- package/dist/{chunk-C23BYTJV.js → chunk-UW5NPZJ2.js} +40 -12
- package/dist/chunk-UW5NPZJ2.js.map +1 -0
- package/dist/{chunk-2GFK22OZ.js → chunk-V6ERBR7U.js} +2 -2
- package/dist/{chunk-CYF6WVE7.js → chunk-W5ZKPI34.js} +139 -158
- package/dist/chunk-W5ZKPI34.js.map +1 -0
- package/dist/chunk-XX4HPFFM.js +370 -0
- package/dist/chunk-XX4HPFFM.js.map +1 -0
- package/dist/{chunk-ZMYDYNI4.js → chunk-XZHE2DEN.js} +4 -4
- package/dist/chunk-YXQEKCZM.js +223 -0
- package/dist/chunk-YXQEKCZM.js.map +1 -0
- package/dist/{chunk-GYPQL6XN.js → chunk-Z4N7SVVF.js} +35 -47
- package/dist/chunk-Z4N7SVVF.js.map +1 -0
- package/dist/{chunk-MAXVH44E.js → chunk-Z54EM5YZ.js} +7 -7
- package/dist/{chunk-YGLY6QFV.js → chunk-ZRZVLB7O.js} +2 -2
- package/dist/{chunk-4IIFL7GC.js → chunk-ZUKIUXHQ.js} +10 -10
- package/dist/{cli-DVUFIa5E.d.ts → cli-Bze8S0Qs.d.ts} +5 -5
- package/dist/cli.d.ts +22 -21
- package/dist/cli.js +90 -80
- package/dist/coding/pre-action-gate.d.ts +1 -1
- package/dist/compounding/engine.d.ts +2 -2
- package/dist/compounding/engine.js +33 -12
- 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 -2
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +33 -12
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +32 -12
- package/dist/consolidation-provenance-check.d.ts +2 -2
- package/dist/consolidation-undo.d.ts +2 -2
- package/dist/contradiction/index.d.ts +2 -2
- package/dist/contradiction/index.js +3 -1
- package/dist/contradiction-scan-JDTBXRGW.js +20 -0
- package/dist/converge-config.d.ts +1 -1
- package/dist/convergence-refresh.d.ts +2 -2
- package/dist/convergence-refresh.js +35 -14
- package/dist/conversation-index/backend.d.ts +1 -1
- package/dist/conversation-index/backend.js +2 -2
- 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 +25 -24
- 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-XzF76C9n.d.ts → dependency-propagation-delivery-CzEfB31P.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-retrieval.d.ts +2 -2
- package/dist/entity-retrieval.js +33 -12
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +9 -9
- package/dist/explicit-capture.js +7 -4
- package/dist/external-wiki-access.d.ts +22 -21
- package/dist/external-wiki-access.js +56 -51
- 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 +22 -21
- package/dist/extraction-error-classification.d.ts +1 -1
- package/dist/extraction-faithfulness.d.ts +1 -1
- package/dist/extraction-faithfulness.js +2 -2
- 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-judge.js +2 -2
- 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 +35 -19
- package/dist/fallback-llm.d.ts +14 -1
- package/dist/fallback-llm.js +1 -1
- package/dist/{first-start-migration-626C5554.js → first-start-migration-CRZCZAJN.js} +11 -3
- package/dist/first-start-migration-CRZCZAJN.js.map +1 -0
- 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-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.d.ts +1 -1
- 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.d.ts +314 -308
- package/dist/index.js +304 -133
- package/dist/inline-script.d.ts +3 -0
- package/dist/inline-script.js +8 -0
- package/dist/inline-script.js.map +1 -0
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/engine.js +3 -3
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/index.js +6 -6
- 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 +2 -1
- package/dist/local-llm.js +2 -2
- package/dist/local-model-endpoint.d.ts +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +33 -12
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +33 -12
- package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-projection.js +34 -13
- package/dist/{maintenance-BJzNIKBE.d.ts → maintenance-C8aRWfhq.d.ts} +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +22 -21
- 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-lifecycle-ledger-utils.d.ts +1 -1
- package/dist/memory-projection-mutations.js +2 -2
- package/dist/memory-projection-store.d.ts +6 -2
- package/dist/memory-projection-store.js +1 -1
- package/dist/memory-provenance.d.ts +1 -1
- package/dist/memory-snapshot.d.ts +1 -1
- package/dist/memory-worth-outcomes.d.ts +2 -2
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +3 -3
- package/dist/namespaces/migrate.js +24 -23
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/search.js +8 -8
- package/dist/namespaces/storage.d.ts +3 -3
- package/dist/namespaces/storage.js +33 -12
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/offline-sync-file-io.d.ts +20 -0
- package/dist/offline-sync-file-io.js +18 -0
- package/dist/offline-sync-file-io.js.map +1 -0
- package/dist/offline-sync-impression-drain.d.ts +1 -1
- package/dist/offline-sync-impression-drain.js +5 -5
- package/dist/offline-sync.d.ts +8 -6
- package/dist/offline-sync.js +2 -1
- package/dist/operator-doctor-corpus.d.ts +1 -1
- package/dist/operator-doctor-corpus.js +26 -25
- package/dist/operator-doctor-replica.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +3 -3
- package/dist/operator-toolkit.js +39 -36
- package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
- package/dist/orchestration/maintenance.d.ts +4 -4
- package/dist/orchestration/maintenance.js +38 -18
- package/dist/{orchestrator-BiXgBJBQ.d.ts → orchestrator-D85CzDDY.d.ts} +11 -8
- package/dist/orchestrator.d.ts +9 -9
- package/dist/orchestrator.js +117 -109
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/{pipeline-sz_dcuLg.d.ts → pipeline-DPcUifCO.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-D-SyWNj6.d.ts +25 -0
- package/dist/{purge-533FZLS4.js → purge-GB7PZHT2.js} +2 -2
- package/dist/{qmd-eAWObK4M.d.ts → qmd-dFCHp1r0.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-explain-renderer.js +3 -3
- package/dist/recall-memory-map.d.ts +1 -1
- package/dist/recall-planner-llm.d.ts +1 -1
- package/dist/recall-planner-llm.js +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-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +1 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +1 -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/manifest.js +6 -5
- package/dist/reconcile/plan.d.ts +2 -1
- package/dist/reconcile/plan.js +3 -2
- 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 -3
- 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/schemas.d.ts +38 -38
- package/dist/{scope-profiles-BBQsXuyj.d.ts → scope-profiles-DICK7GtN.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 +6 -6
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +12 -12
- 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-HD8RkzVA.d.ts → semantic-consolidation-BP7NAX0N.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +34 -13
- package/dist/semantic-rule-promotion.js +33 -12
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +33 -12
- package/dist/{service-DIrtHHEg.d.ts → service-DT-pJyda.d.ts} +660 -660
- 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 +31 -15
- package/dist/{storage-DqCzXi56.d.ts → storage-qOnaJ1Lw.d.ts} +49 -13
- package/dist/storage.d.ts +2 -2
- package/dist/storage.js +33 -12
- package/dist/summarizer.d.ts +1 -1
- package/dist/summarizer.js +5 -5
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/support-passport/index.d.ts +518 -0
- package/dist/support-passport/index.js +357 -0
- package/dist/support-passport/index.js.map +1 -0
- 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 +2 -2
- package/dist/tier-routing.js +7 -1
- package/dist/{tier-stats-2JCZYEF7.js → tier-stats-EXYSKSVN.js} +8 -2
- package/dist/{tier-stats-2JCZYEF7.js.map → tier-stats-EXYSKSVN.js.map} +1 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/transfer/autodetect.js +1 -1
- package/dist/transfer/backup.js +1 -1
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/types.d.ts +36 -36
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-d_j4vC6N.d.ts → types-ed-SvS2t.d.ts} +8 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +2 -2
- package/dist/verified-recall.js +33 -12
- package/dist/write-envelope.d.ts +1 -1
- package/dist/write-rate-limiter.d.ts +11 -5
- package/dist/write-rate-limiter.js +1 -1
- package/package.json +12 -2
- package/scripts/build-with-heap.mjs +11 -1
- package/src/access-authorization-probe.ts +20 -2
- package/src/access-boundary.ts +32 -0
- package/src/access-http.test.ts +1971 -643
- package/src/access-http.ts +81 -74
- package/src/access-mcp.ts +3 -1
- package/src/access-memory-search-fanout.ts +24 -1
- package/src/access-offline-manifest.ts +5 -0
- package/src/access-operations.ts +2 -0
- package/src/access-service-namespace.test.ts +14 -0
- package/src/access-service-observe-scope.test.ts +2 -0
- package/src/access-service-offline-file-content.test.ts +211 -0
- package/src/access-service.ts +628 -884
- package/src/access-surface-catalog.test.ts +40 -10
- package/src/access-surface-catalog.ts +15 -0
- package/src/active-memory-bridge.test.ts +151 -0
- package/src/active-memory-bridge.ts +95 -21
- package/src/briefing.test.ts +38 -0
- package/src/briefing.ts +3 -3
- package/src/cli.ts +6 -1
- package/src/config.ts +18 -9
- package/src/connectors/codex-materialize-runner.ts +2 -0
- package/src/contradiction/contradiction-scan.ts +2 -0
- package/src/contradiction/contradiction.test.ts +42 -0
- package/src/correction/correction-access-wiring.ts +8 -2
- package/src/correction/correction-storage-integration.test.ts +7 -0
- package/src/explicit-capture.test.ts +24 -0
- package/src/explicit-capture.ts +2 -0
- package/src/fallback-llm.test.ts +54 -0
- package/src/fallback-llm.ts +54 -9
- package/src/index.ts +3 -0
- package/src/inline-script.ts +6 -0
- package/src/local-llm-headers-timeout.test.ts +42 -0
- package/src/local-llm.ts +8 -8
- package/src/maintenance/first-start-migration.ts +2 -1
- package/src/maintenance/memory-governance.test.ts +25 -0
- package/src/maintenance/memory-governance.ts +4 -1
- package/src/maintenance/pattern-reinforcement.test.ts +20 -0
- package/src/maintenance/pattern-reinforcement.ts +2 -1
- package/src/maintenance/rebuild-memory-projection.ts +8 -8
- package/src/mcp-read-only-tools.ts +3 -0
- package/src/memory-projection-store.ts +25 -27
- package/src/offline-sync-file-io.ts +68 -0
- package/src/offline-sync.ts +43 -57
- package/src/orchestration/consolidation-run.ts +5 -4
- package/src/orchestration/contradiction-linking-coordinator.ts +7 -0
- package/src/orchestration/contradiction-localization.integration.test.ts +115 -0
- package/src/orchestration/lifecycle-policy-coordinator.ts +2 -1
- package/src/orchestration/qmd-result-resolver.test.ts +215 -14
- package/src/orchestration/qmd-result-resolver.ts +142 -82
- package/src/orchestration/recall-search-pipeline.test.ts +41 -0
- package/src/orchestration/recall-search-pipeline.ts +12 -0
- package/src/orchestration/semantic-consolidation-coordinator.ts +2 -1
- package/src/orchestration/tier-migration-coordinator.ts +23 -56
- package/src/orchestration/workspace-ops.test.ts +37 -0
- package/src/orchestration/workspace-ops.ts +5 -29
- package/src/orchestrator.ts +7 -8
- package/src/relay/mission-access.test.ts +11 -11
- package/src/relay/mission-ui.test.ts +3 -1
- package/src/storage/supersession-audit.ts +7 -1
- package/src/storage/supersession-side-effects.ts +17 -5
- package/src/storage/tombstone-blocked-capture-sync.ts +31 -0
- package/src/storage-contract/failure-semantics.test.ts +102 -0
- package/src/storage.ts +18 -19
- package/src/support-passport/access-http-base.ts +143 -0
- package/src/support-passport/access-http.ts +172 -0
- package/src/support-passport/access-operations.ts +272 -0
- package/src/support-passport/access-service-base.test.ts +193 -0
- package/src/support-passport/access-service-base.ts +176 -0
- package/src/support-passport/access-surface.test.ts +283 -0
- package/src/support-passport/access-surface.ts +286 -0
- package/src/support-passport/card-projection.test.ts +137 -0
- package/src/support-passport/card-projection.ts +348 -0
- package/src/support-passport/card-replacement.ts +126 -0
- package/src/support-passport/card-service-commit-forwarding.test.ts +160 -0
- package/src/support-passport/card-service.test.ts +2964 -0
- package/src/support-passport/card-service.ts +1184 -0
- package/src/support-passport/card-state.ts +158 -0
- package/src/support-passport/config-model-routing.test.ts +37 -0
- package/src/support-passport/config.test.ts +34 -0
- package/src/support-passport/config.ts +41 -0
- package/src/support-passport/contracts.test.ts +156 -0
- package/src/support-passport/contracts.ts +149 -0
- package/src/support-passport/errors.ts +30 -0
- package/src/support-passport/generated-batch.test.ts +185 -0
- package/src/support-passport/generated-batch.ts +338 -0
- package/src/support-passport/grant-contracts.ts +183 -0
- package/src/support-passport/grant-generated-batch-scope.test.ts +201 -0
- package/src/support-passport/grant-service-cache.test.ts +148 -0
- package/src/support-passport/grant-service-cancellation.test.ts +83 -0
- package/src/support-passport/grant-service-marker-cache.test.ts +62 -0
- package/src/support-passport/grant-service.test.ts +3496 -0
- package/src/support-passport/grant-service.ts +513 -0
- package/src/support-passport/grant-store-commit-hook.test.ts +123 -0
- package/src/support-passport/grant-store-order.test.ts +60 -0
- package/src/support-passport/grant-store-path-safety.test.ts +30 -0
- package/src/support-passport/grant-store-recovery.test.ts +448 -0
- package/src/support-passport/grant-store.ts +906 -0
- package/src/support-passport/index.ts +17 -0
- package/src/support-passport/mcp-tools.test.ts +222 -0
- package/src/support-passport/mcp-tools.ts +187 -0
- package/src/support-passport/model-adapter.test.ts +840 -0
- package/src/support-passport/model-adapter.ts +602 -0
- package/src/support-passport/model-audit-pinned-write.test.ts +59 -0
- package/src/support-passport/model-audit.ts +152 -0
- package/src/support-passport/model-bridge.test.ts +456 -0
- package/src/support-passport/model-bridge.ts +439 -0
- package/src/support-passport/model-contracts.ts +124 -0
- package/src/support-passport/model-service.test.ts +1731 -0
- package/src/support-passport/model-service.ts +399 -0
- package/src/support-passport/offline-sync-guard.ts +230 -0
- package/src/support-passport/owner-http.test.ts +671 -0
- package/src/support-passport/owner-lock.ts +70 -0
- package/src/support-passport/private-file.test.ts +99 -0
- package/src/support-passport/private-file.ts +498 -0
- package/src/support-passport/public-http.test.ts +476 -0
- package/src/support-passport/public-http.ts +601 -0
- package/src/support-passport/ui.test.ts +181 -0
- package/src/tier-routing.ts +28 -17
- package/src/training-export/converter.test.ts +24 -0
- package/src/training-export/converter.ts +2 -0
- package/src/types.ts +8 -1
- package/src/wearables/service.test.ts +13 -0
- package/src/wearables/service.ts +2 -0
- package/src/write-rate-limiter.test.ts +30 -6
- package/src/write-rate-limiter.ts +29 -18
- package/dist/chunk-3CSX3ETE.js.map +0 -1
- package/dist/chunk-47P3RYZP.js.map +0 -1
- package/dist/chunk-6LAPLZOS.js.map +0 -1
- package/dist/chunk-6R4G7N4S.js.map +0 -1
- package/dist/chunk-7BZOBA5J.js.map +0 -1
- package/dist/chunk-C23BYTJV.js.map +0 -1
- package/dist/chunk-CYF6WVE7.js.map +0 -1
- package/dist/chunk-G2LUMAUF.js.map +0 -1
- package/dist/chunk-GYPQL6XN.js.map +0 -1
- package/dist/chunk-JDZPNCMA.js.map +0 -1
- package/dist/chunk-JV5YUBIZ.js.map +0 -1
- package/dist/chunk-K4QS7LXU.js.map +0 -1
- package/dist/chunk-L6CQ7WIW.js.map +0 -1
- package/dist/chunk-MKQBXQKU.js.map +0 -1
- package/dist/chunk-NH5IR2WM.js.map +0 -1
- package/dist/chunk-PX2LSHYM.js.map +0 -1
- package/dist/chunk-QWGE2PUH.js.map +0 -1
- package/dist/chunk-RUMNY5DT.js.map +0 -1
- package/dist/chunk-S75M5ZRK.js.map +0 -1
- package/dist/chunk-T2JHZWH6.js.map +0 -1
- package/dist/chunk-UES4BHA2.js.map +0 -1
- package/dist/chunk-UTRO5UJU.js.map +0 -1
- package/dist/chunk-UU3G6GUP.js.map +0 -1
- package/dist/chunk-XUAMCLY4.js.map +0 -1
- package/dist/chunk-ZYLC7NFO.js.map +0 -1
- package/dist/contradiction-scan-HYLIRMJ2.js +0 -14
- package/dist/first-start-migration-626C5554.js.map +0 -1
- /package/dist/{auto-sync-TDHLZPVP.js.map → auto-sync-NR3GPCOA.js.map} +0 -0
- /package/dist/{chunk-LLJMAULE.js.map → chunk-2FKEIPIT.js.map} +0 -0
- /package/dist/{chunk-JBPKEARU.js.map → chunk-2QSZNTDO.js.map} +0 -0
- /package/dist/{chunk-PDDTI7IC.js.map → chunk-43SEBY2M.js.map} +0 -0
- /package/dist/{chunk-HWRD23DW.js.map → chunk-46SZBVDS.js.map} +0 -0
- /package/dist/{chunk-6HPHEFXT.js.map → chunk-5FD7JMTX.js.map} +0 -0
- /package/dist/{chunk-IBKR2TFR.js.map → chunk-6CYHUWCO.js.map} +0 -0
- /package/dist/{chunk-YN6ASZUG.js.map → chunk-6QPI2ITJ.js.map} +0 -0
- /package/dist/{chunk-NIS256NW.js.map → chunk-CIAI24TQ.js.map} +0 -0
- /package/dist/{chunk-7FGL6CGA.js.map → chunk-DVYRD4HY.js.map} +0 -0
- /package/dist/{chunk-G7Z6EENO.js.map → chunk-EKTP7MNS.js.map} +0 -0
- /package/dist/{chunk-RZ4XGKOJ.js.map → chunk-FFRTNF3L.js.map} +0 -0
- /package/dist/{chunk-VKXWK44Q.js.map → chunk-FONWBCVY.js.map} +0 -0
- /package/dist/{chunk-DZD576ZU.js.map → chunk-FPLM2TKD.js.map} +0 -0
- /package/dist/{chunk-ZPJ4QSGP.js.map → chunk-FTPONF6B.js.map} +0 -0
- /package/dist/{chunk-LJS7KUPV.js.map → chunk-FWX7W5PM.js.map} +0 -0
- /package/dist/{chunk-G4T7L557.js.map → chunk-GN3WRFJY.js.map} +0 -0
- /package/dist/{chunk-QT2FRYI4.js.map → chunk-H7NAZ3UB.js.map} +0 -0
- /package/dist/{chunk-APPFNGX6.js.map → chunk-HBUFQRIM.js.map} +0 -0
- /package/dist/{chunk-UU7TRFNE.js.map → chunk-HGJ6NJ4E.js.map} +0 -0
- /package/dist/{chunk-C4ZNGVK3.js.map → chunk-IKP5OYQQ.js.map} +0 -0
- /package/dist/{chunk-KQAFEZQX.js.map → chunk-IPLYGWQF.js.map} +0 -0
- /package/dist/{chunk-RDJRFDJY.js.map → chunk-IQ4NVWEF.js.map} +0 -0
- /package/dist/{chunk-CGVHPCP2.js.map → chunk-JYG4OLWH.js.map} +0 -0
- /package/dist/{chunk-WOPA3SGI.js.map → chunk-K26NWEOC.js.map} +0 -0
- /package/dist/{chunk-G7A5HLUS.js.map → chunk-KJH6W2I7.js.map} +0 -0
- /package/dist/{chunk-HOIRB77A.js.map → chunk-L6Z5OAS4.js.map} +0 -0
- /package/dist/{chunk-227UFSEQ.js.map → chunk-LEPOP46W.js.map} +0 -0
- /package/dist/{chunk-3JLPGJ43.js.map → chunk-MIH3CJPN.js.map} +0 -0
- /package/dist/{chunk-QHFV6VNU.js.map → chunk-MK5VEWCR.js.map} +0 -0
- /package/dist/{chunk-GUKBW4HL.js.map → chunk-NQMSEB5D.js.map} +0 -0
- /package/dist/{chunk-WRJVB3C2.js.map → chunk-PO7NXBG2.js.map} +0 -0
- /package/dist/{chunk-AZM4CCAC.js.map → chunk-QZLDRQ4I.js.map} +0 -0
- /package/dist/{chunk-THPPCISA.js.map → chunk-RBII7637.js.map} +0 -0
- /package/dist/{chunk-VMMQDEN5.js.map → chunk-TO7ZTWJW.js.map} +0 -0
- /package/dist/{chunk-K2TDK7GG.js.map → chunk-TWTUGCTY.js.map} +0 -0
- /package/dist/{chunk-HLYR2TQL.js.map → chunk-UCTS3DDH.js.map} +0 -0
- /package/dist/{chunk-JYIJNNN3.js.map → chunk-UG6VXIOK.js.map} +0 -0
- /package/dist/{chunk-WM65LU67.js.map → chunk-UKYS3NU5.js.map} +0 -0
- /package/dist/{chunk-WDBX6VER.js.map → chunk-UPLZNJKN.js.map} +0 -0
- /package/dist/{chunk-2GFK22OZ.js.map → chunk-V6ERBR7U.js.map} +0 -0
- /package/dist/{chunk-ZMYDYNI4.js.map → chunk-XZHE2DEN.js.map} +0 -0
- /package/dist/{chunk-MAXVH44E.js.map → chunk-Z54EM5YZ.js.map} +0 -0
- /package/dist/{chunk-YGLY6QFV.js.map → chunk-ZRZVLB7O.js.map} +0 -0
- /package/dist/{chunk-4IIFL7GC.js.map → chunk-ZUKIUXHQ.js.map} +0 -0
- /package/dist/{contradiction-scan-HYLIRMJ2.js.map → contradiction-scan-JDTBXRGW.js.map} +0 -0
- /package/dist/{purge-533FZLS4.js.map → purge-GB7PZHT2.js.map} +0 -0
package/src/access-service.ts
CHANGED
|
@@ -1,212 +1,219 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { buildAccessWriteRequestFingerprint, buildObserveRequestFingerprint } from "./write-envelope.js";
|
|
3
|
-
import * as nodeFs from "node:fs/promises";
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
4
2
|
import { constants as fsConstants } from "node:fs";
|
|
5
3
|
import { readdirSync, unlinkSync } from "node:fs";
|
|
6
|
-
import {
|
|
4
|
+
import { stat } from "node:fs/promises";
|
|
5
|
+
import * as nodeFs from "node:fs/promises";
|
|
7
6
|
import { ZodError } from "zod";
|
|
8
|
-
import {
|
|
9
|
-
import { computeExtractionLivenessStatus, ExtractionLivenessWarnThrottle } from "./extraction-liveness.js";
|
|
10
|
-
import { readAggregateExtractionWatermark } from "./orchestration/extraction-watermark.js";
|
|
11
|
-
import { enforceNamespaceAllowList, tokenCapabilityStore } from "./access-token-capabilities.js";
|
|
7
|
+
import { decodeCitationNamespace } from "./access-citation-namespace.js";
|
|
12
8
|
import {
|
|
13
|
-
recordCitationUsage as recordCitationUsageForAccess,
|
|
14
9
|
type CitationUsageRequest,
|
|
15
10
|
type CitationUsageResult,
|
|
11
|
+
recordCitationUsage as recordCitationUsageForAccess,
|
|
16
12
|
} from "./access-citation.js";
|
|
17
|
-
import { decodeCitationNamespace } from "./access-citation-namespace.js";
|
|
18
|
-
import { coordinateRecall, type RecallCoordinatorHost, type RecallExecResult } from "./access-recall-concurrency.js";
|
|
19
|
-
import { resolveNamespaceCapabilities,
|
|
20
|
-
resolveMemoryLifecycleCapabilities,
|
|
21
|
-
resolveQmdCapabilities,
|
|
22
|
-
resolveSecurityCapabilities, resolveObjectiveStateCapabilities, resolveCompressionCapabilities, resolveRecallAuxiliaryCapabilities } from "./capabilities.js";
|
|
23
|
-
import { CorpusWatermarkCache, computeServiceCorpusCensus } from "./corpus-watermark.js";
|
|
24
|
-
import { ReplicaDivergenceMonitor } from "./replica-divergence.js";
|
|
25
|
-
import type { ResolveSecretRefFn } from "./resolve-auth-token.js";
|
|
26
13
|
import type {
|
|
27
14
|
EngramAccessHealthResponse,
|
|
28
15
|
EngramAccessQmdCollectionState,
|
|
29
16
|
EngramAccessQmdHealthResponse,
|
|
30
17
|
} from "./access-health-types.js";
|
|
18
|
+
import { AccessIdempotencyStore, hashAccessIdempotencyPayload } from "./access-idempotency.js";
|
|
19
|
+
import { type RecallCoordinatorHost, type RecallExecResult, coordinateRecall } from "./access-recall-concurrency.js";
|
|
20
|
+
import { enforceNamespaceAllowList, tokenCapabilityStore } from "./access-token-capabilities.js";
|
|
21
|
+
import {
|
|
22
|
+
resolveCompressionCapabilities,
|
|
23
|
+
resolveMemoryLifecycleCapabilities,
|
|
24
|
+
resolveNamespaceCapabilities,
|
|
25
|
+
resolveObjectiveStateCapabilities,
|
|
26
|
+
resolveQmdCapabilities,
|
|
27
|
+
resolveRecallAuxiliaryCapabilities,
|
|
28
|
+
resolveSecurityCapabilities,
|
|
29
|
+
} from "./capabilities.js";
|
|
30
|
+
import { CorpusWatermarkCache, computeServiceCorpusCensus } from "./corpus-watermark.js";
|
|
31
|
+
import { ExtractionLivenessWarnThrottle, computeExtractionLivenessStatus } from "./extraction-liveness.js";
|
|
32
|
+
import { readAggregateExtractionWatermark } from "./orchestration/extraction-watermark.js";
|
|
33
|
+
import { ReplicaDivergenceMonitor } from "./replica-divergence.js";
|
|
34
|
+
import type { ResolveSecretRefFn } from "./resolve-auth-token.js";
|
|
35
|
+
import { buildAccessWriteRequestFingerprint, buildObserveRequestFingerprint } from "./write-envelope.js";
|
|
31
36
|
export type { EngramAccessHealthResponse, EngramAccessQmdCollectionState, EngramAccessQmdHealthResponse };
|
|
32
37
|
import { AccessAuditAdapter, type AccessAuditConfig, type AccessAuditResult } from "./access-audit.js";
|
|
33
|
-
import type { AnomalyDetectorResult } from "./recall-audit-anomaly.js";
|
|
34
|
-
import { resolveGitContext } from "./coding/git-context.js";
|
|
35
38
|
import {
|
|
36
|
-
combineNamespaces,
|
|
37
|
-
lcmSessionKeyForNamespace,
|
|
38
|
-
projectTagProjectId,
|
|
39
|
-
resolveCodingNamespaceOverlay,
|
|
40
|
-
type CodingNamespaceOverlay,
|
|
41
|
-
} from "./coding/coding-namespace.js";
|
|
42
|
-
import {
|
|
43
|
-
resolveCodingContextFromOptions,
|
|
44
39
|
type InterruptibleCodingScopeInput,
|
|
40
|
+
resolveCodingContextFromOptions,
|
|
45
41
|
} from "./access-coding-context-resolution.js";
|
|
46
42
|
import {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
defaultNamespaceAtFlatRoot,
|
|
44
|
+
memorySearchThroughScope,
|
|
45
|
+
mergeMemorySearchDefaultFallback,
|
|
46
|
+
resolveMemorySearchDefaultFallback,
|
|
47
|
+
} from "./access-memory-search-fanout.js";
|
|
48
|
+
import { buildArchitectureCard, createArchitectureCardSummariser } from "./coding/architecture-card.js";
|
|
51
49
|
import {
|
|
52
|
-
|
|
50
|
+
ARCHITECTURE_CARD_TAG,
|
|
53
51
|
type ArchitectureSurfaceRequest,
|
|
54
52
|
type ArchitectureSurfaceResponse,
|
|
55
53
|
type ArchitectureSurfaceStorage,
|
|
56
54
|
createArchitectureVersioningHook,
|
|
57
|
-
|
|
55
|
+
handleCodingArchitecture,
|
|
58
56
|
} from "./coding/architecture-surfaces.js";
|
|
59
|
-
import { buildArchitectureCard, createArchitectureCardSummariser } from "./coding/architecture-card.js";
|
|
60
|
-
import {
|
|
61
|
-
handleCodegraphTool,
|
|
62
|
-
type CodegraphSurfaceContext,
|
|
63
|
-
type CodegraphSurfaceRequest,
|
|
64
|
-
type CodegraphSurfaceResponse,
|
|
65
|
-
} from "./coding/codegraph-surfaces.js";
|
|
66
57
|
import {
|
|
58
|
+
type CodegraphStore,
|
|
67
59
|
codegraphSurfaceVisible,
|
|
68
60
|
getCodegraphStore,
|
|
69
61
|
makeCodegraphRuntimeDelegates,
|
|
70
62
|
resolveCodegraphProjectId,
|
|
71
|
-
type CodegraphStore,
|
|
72
63
|
} from "./coding/codegraph-runtime.js";
|
|
73
64
|
import {
|
|
74
|
-
|
|
65
|
+
type CodegraphSurfaceContext,
|
|
66
|
+
type CodegraphSurfaceRequest,
|
|
67
|
+
type CodegraphSurfaceResponse,
|
|
68
|
+
handleCodegraphTool,
|
|
69
|
+
} from "./coding/codegraph-surfaces.js";
|
|
70
|
+
import {
|
|
71
|
+
type CodingNamespaceOverlay,
|
|
72
|
+
combineNamespaces,
|
|
73
|
+
lcmSessionKeyForNamespace,
|
|
74
|
+
projectTagProjectId,
|
|
75
|
+
resolveCodingNamespaceOverlay,
|
|
76
|
+
} from "./coding/coding-namespace.js";
|
|
77
|
+
import {
|
|
78
|
+
type DecisionSurfaceRequest,
|
|
79
|
+
type DecisionSurfaceResponse,
|
|
80
|
+
handleCodingDecision,
|
|
81
|
+
} from "./coding/decision-surfaces.js";
|
|
82
|
+
import { resolveGitContext } from "./coding/git-context.js";
|
|
83
|
+
import { defaultGitInvokerSync } from "./coding/git-context.js";
|
|
84
|
+
import {
|
|
75
85
|
type DeltaSurfaceRequest,
|
|
76
86
|
type DeltaSurfaceResponse,
|
|
77
87
|
type DeltaSurfaceStorage,
|
|
88
|
+
handleCodingDelta,
|
|
78
89
|
} from "./coding/session-delta-surfaces.js";
|
|
79
|
-
import { defaultGitInvokerSync } from "./coding/git-context.js";
|
|
80
90
|
import {
|
|
81
|
-
createCorrectionService,
|
|
82
|
-
isCorrectionFeatureEnabled,
|
|
83
|
-
CorrectionService,
|
|
84
91
|
type CorrectionOutcome,
|
|
85
92
|
type CorrectionPlan,
|
|
86
93
|
type CorrectionRequest,
|
|
94
|
+
type CorrectionService,
|
|
95
|
+
createCorrectionService,
|
|
96
|
+
isCorrectionFeatureEnabled,
|
|
87
97
|
} from "./correction/index.js";
|
|
88
|
-
import {
|
|
89
|
-
import { createVersion } from "./page-versioning.js";
|
|
90
|
-
import { WorkStorage } from "./work/storage.js";
|
|
91
|
-
import {
|
|
92
|
-
exportWorkBoardMarkdown,
|
|
93
|
-
exportWorkBoardSnapshot,
|
|
94
|
-
importWorkBoardSnapshot,
|
|
95
|
-
} from "./work/board.js";
|
|
96
|
-
import { wrapWorkLayerContext } from "./work/boundary.js";
|
|
98
|
+
import { type BudgetWarning, CrossNamespaceBudget } from "./cross-namespace-budget.js";
|
|
97
99
|
import {
|
|
100
|
+
type ExplicitCaptureInput,
|
|
101
|
+
type ValidExplicitCapture,
|
|
98
102
|
persistExplicitCapture,
|
|
99
103
|
queueExplicitCaptureForReview,
|
|
100
104
|
validateExplicitCaptureInput,
|
|
101
|
-
type ExplicitCaptureInput,
|
|
102
|
-
type ValidExplicitCapture,
|
|
103
105
|
} from "./explicit-capture.js";
|
|
104
|
-
import {
|
|
106
|
+
import type { LiveConnectorsRunSummary } from "./live-connectors-runner.js";
|
|
105
107
|
import { log } from "./logger.js";
|
|
106
108
|
import {
|
|
107
|
-
defaultNamespaceAtFlatRoot,
|
|
108
|
-
mergeMemorySearchDefaultFallback,
|
|
109
|
-
resolveMemorySearchDefaultFallback,
|
|
110
|
-
memorySearchThroughScope,
|
|
111
|
-
} from "./access-memory-search-fanout.js";
|
|
112
|
-
import { isSearchExcludedPath } from "./orchestration/generic-recall-paths.js";
|
|
113
|
-
import {
|
|
114
|
-
buildQualityScore,
|
|
115
109
|
buildProposedActions,
|
|
110
|
+
buildQualityScore,
|
|
116
111
|
groupActionsByStatus,
|
|
117
112
|
listMemoryGovernanceRuns,
|
|
118
|
-
readMemoryGovernanceRunArtifact,
|
|
113
|
+
type readMemoryGovernanceRunArtifact,
|
|
119
114
|
runMemoryGovernance,
|
|
120
115
|
} from "./maintenance/memory-governance.js";
|
|
116
|
+
import type { PatternReinforcementResult } from "./maintenance/pattern-reinforcement.js";
|
|
117
|
+
import type { MeetingsDayBuildSummary } from "./meetings/build.js";
|
|
118
|
+
import type { MeetingsGetResult, MeetingsListResult } from "./meetings/service.js";
|
|
119
|
+
import { isSearchExcludedPath } from "./orchestration/generic-recall-paths.js";
|
|
120
|
+
import { createVersion } from "./page-versioning.js";
|
|
121
121
|
import { runProcedureMining } from "./procedural/procedure-miner.js";
|
|
122
|
+
import type { AnomalyDetectorResult } from "./recall-audit-anomaly.js";
|
|
123
|
+
import { isHandleToken } from "./recall-handles.js";
|
|
122
124
|
import { displayErrorDetail } from "./runtime/better-sqlite.js";
|
|
123
|
-
import
|
|
124
|
-
|
|
125
|
+
import {
|
|
126
|
+
SUPPORT_PASSPORT_AUDIT_TAG,
|
|
127
|
+
SUPPORT_PASSPORT_CARD_TAG,
|
|
128
|
+
createSupportPassportPrivateFileExclusion,
|
|
129
|
+
isSupportPassportPrivateMemory,
|
|
130
|
+
} from "./support-passport/card-projection.js";
|
|
131
|
+
import {
|
|
132
|
+
applySupportPassportOfflineSyncChangeset,
|
|
133
|
+
applySupportPassportOfflineSyncFileContent,
|
|
134
|
+
} from "./support-passport/offline-sync-guard.js";
|
|
125
135
|
import type { WearablesService } from "./wearables/service.js";
|
|
126
|
-
import
|
|
127
|
-
import
|
|
136
|
+
import { exportWorkBoardMarkdown, exportWorkBoardSnapshot, importWorkBoardSnapshot } from "./work/board.js";
|
|
137
|
+
import { wrapWorkLayerContext } from "./work/boundary.js";
|
|
138
|
+
import { WorkStorage } from "./work/storage.js";
|
|
128
139
|
|
|
129
140
|
import * as wearablesMeetings from "./access-wearables-meetings-surface.js";
|
|
130
141
|
import type { WearablesMeetingsHost, WearablesMeetingsScope } from "./access-wearables-meetings-surface.js";
|
|
131
142
|
export type { WearablesMeetingsScope };
|
|
143
|
+
import * as nodePath from "node:path";
|
|
132
144
|
import {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
} from "./
|
|
136
|
-
import {
|
|
137
|
-
normalizeProjectionPreview,
|
|
138
|
-
normalizeProjectionTags,
|
|
139
|
-
} from "./memory-projection-format.js";
|
|
140
|
-
import {
|
|
141
|
-
inferMemoryStatus,
|
|
142
|
-
toMemoryPathRel,
|
|
143
|
-
} from "./memory-lifecycle-ledger-utils.js";
|
|
144
|
-
import { getMemoryProjectionPath } from "./memory-projection-store.js";
|
|
145
|
-
import { canReadNamespace, canWriteNamespace, citationAuthorizedNamespaces, defaultNamespaceForPrincipal, recallNamespacesForPrincipal, resolvePrincipal } from "./namespaces/principal.js";
|
|
145
|
+
type EngramAccessNamespaceWritableRequest,
|
|
146
|
+
resolveNamespaceWritablePreflight,
|
|
147
|
+
} from "./access-namespace-preflight.js";
|
|
146
148
|
import {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
type
|
|
150
|
-
type
|
|
151
|
-
|
|
152
|
-
} from "./
|
|
153
|
-
import {
|
|
154
|
-
type ScopePlan,
|
|
155
|
-
resolveScopePlan,
|
|
156
|
-
resolveScopedWritableNamespaceValue,
|
|
157
|
-
resolveWritableNamespaceValue,
|
|
158
|
-
type WritableNamespaceResult,
|
|
159
|
-
} from "./scopes/scope-plan.js";
|
|
160
|
-
import { resolveNamespaceWritablePreflight, type EngramAccessNamespaceWritableRequest } from "./access-namespace-preflight.js";
|
|
161
|
-
import { namespaceIdentityFromToken } from "./namespaces/identity.js";
|
|
162
|
-
import { namespaceCollectionName } from "./namespaces/search.js";
|
|
163
|
-
import { SecureStoreLockedError } from "./secure-store/index.js";
|
|
164
|
-
import { isPathInsideStorageRoot } from "./storage-paths.js";
|
|
149
|
+
type EngramAccessExtractionForceFlushRequest,
|
|
150
|
+
type EngramAccessExtractionForceFlushResponse,
|
|
151
|
+
type EngramAccessLcmCompactionFlushRequest,
|
|
152
|
+
type EngramAccessLcmCompactionFlushResponse,
|
|
153
|
+
delegateExtractionForceFlush,
|
|
154
|
+
} from "./access-service-helpers.js";
|
|
165
155
|
import {
|
|
156
|
+
type AdminNamespaceFilter,
|
|
157
|
+
type AdminNamespaceQmdHealth,
|
|
166
158
|
AdminPromotionError,
|
|
159
|
+
type InspectScopeOptions,
|
|
160
|
+
type MemoryPromotionTargetKind,
|
|
161
|
+
type PromotionStorageProvider,
|
|
162
|
+
type ScopeInspection,
|
|
167
163
|
auditTranscripts,
|
|
168
164
|
gatherMaintenanceHealth,
|
|
169
165
|
inspectScope,
|
|
170
166
|
listAdminNamespaces,
|
|
171
167
|
promoteMemory,
|
|
172
168
|
redactSensitive,
|
|
173
|
-
type AdminNamespaceFilter,
|
|
174
|
-
type AdminNamespaceQmdHealth,
|
|
175
|
-
type InspectScopeOptions,
|
|
176
|
-
type MemoryPromotionTargetKind,
|
|
177
|
-
type PromotionStorageProvider,
|
|
178
|
-
type ScopeInspection,
|
|
179
169
|
} from "./admin/admin-surfaces.js";
|
|
180
|
-
import
|
|
181
|
-
import
|
|
170
|
+
import { FileCalendarSource, buildBriefing, parseBriefingFocus, parseBriefingWindow } from "./briefing.js";
|
|
171
|
+
import {
|
|
172
|
+
type GraphSnapshotNodeMetadata,
|
|
173
|
+
type GraphSnapshotRequest,
|
|
174
|
+
type GraphSnapshotResponse,
|
|
175
|
+
buildGraphSnapshot,
|
|
176
|
+
} from "./graph-snapshot.js";
|
|
177
|
+
import { inferMemoryStatus, toMemoryPathRel } from "./memory-lifecycle-ledger-utils.js";
|
|
178
|
+
import { normalizeProjectionPreview, normalizeProjectionTags } from "./memory-projection-format.js";
|
|
179
|
+
import { getMemoryProjectionPath } from "./memory-projection-store.js";
|
|
180
|
+
import { namespaceIdentityFromToken } from "./namespaces/identity.js";
|
|
181
|
+
import {
|
|
182
|
+
canReadNamespace,
|
|
183
|
+
canWriteNamespace,
|
|
184
|
+
citationAuthorizedNamespaces,
|
|
185
|
+
defaultNamespaceForPrincipal,
|
|
186
|
+
recallNamespacesForPrincipal,
|
|
187
|
+
resolvePrincipal,
|
|
188
|
+
} from "./namespaces/principal.js";
|
|
189
|
+
import {
|
|
190
|
+
type ResolvedScopeProfilePlan,
|
|
191
|
+
type ScopeProfileLayerResolution,
|
|
192
|
+
type ScopeProfilePromotionResolution,
|
|
193
|
+
expandScopeProfileReadNamespaces,
|
|
194
|
+
resolveScopeProfilePlan,
|
|
195
|
+
} from "./namespaces/scope-profiles.js";
|
|
196
|
+
import { namespaceCollectionName } from "./namespaces/search.js";
|
|
182
197
|
import type {
|
|
183
198
|
GraphRecallSnapshot,
|
|
184
199
|
IntentDebugSnapshot,
|
|
185
200
|
Orchestrator,
|
|
186
201
|
RecallInvocationOptions,
|
|
187
202
|
} from "./orchestrator.js";
|
|
188
|
-
import {
|
|
189
|
-
import {
|
|
190
|
-
|
|
191
|
-
type GraphSnapshotRequest,
|
|
192
|
-
type GraphSnapshotResponse,
|
|
193
|
-
type GraphSnapshotNodeMetadata,
|
|
194
|
-
} from "./graph-snapshot.js";
|
|
195
|
-
import * as nodePath from "node:path";
|
|
203
|
+
import { type ProcedureStatsReport, computeProcedureStats } from "./procedural/procedure-stats.js";
|
|
204
|
+
import type { RecallContextComposition } from "./recall-context-composition.js";
|
|
205
|
+
import type { LastRecallSnapshot } from "./recall-state.js";
|
|
196
206
|
import {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
207
|
+
type ScopePlan,
|
|
208
|
+
type WritableNamespaceResult,
|
|
209
|
+
resolveScopePlan,
|
|
210
|
+
resolveScopedWritableNamespaceValue,
|
|
211
|
+
resolveWritableNamespaceValue,
|
|
212
|
+
} from "./scopes/scope-plan.js";
|
|
213
|
+
import { SecureStoreLockedError } from "./secure-store/index.js";
|
|
214
|
+
import { isPathInsideStorageRoot } from "./storage-paths.js";
|
|
215
|
+
import { type StorageManager, parseEntityFile, parseFrontmatter } from "./storage.js";
|
|
202
216
|
import {
|
|
203
|
-
getTrustZoneStoreStatus,
|
|
204
|
-
isTrustZoneName,
|
|
205
|
-
listTrustZoneRecords,
|
|
206
|
-
promoteTrustZoneRecord,
|
|
207
|
-
scoreTrustZoneProvenance,
|
|
208
|
-
seedTrustZoneDemoDataset,
|
|
209
|
-
summarizeTrustZonePromotionReadiness,
|
|
210
217
|
type TrustZoneDemoSeedResult,
|
|
211
218
|
type TrustZoneName,
|
|
212
219
|
type TrustZonePromotionResult,
|
|
@@ -215,26 +222,28 @@ import {
|
|
|
215
222
|
type TrustZoneRecordKind,
|
|
216
223
|
type TrustZoneSourceClass,
|
|
217
224
|
type TrustZoneStoreStatus,
|
|
225
|
+
getTrustZoneStoreStatus,
|
|
226
|
+
isTrustZoneName,
|
|
227
|
+
listTrustZoneRecords,
|
|
228
|
+
promoteTrustZoneRecord,
|
|
229
|
+
scoreTrustZoneProvenance,
|
|
230
|
+
seedTrustZoneDemoDataset,
|
|
231
|
+
summarizeTrustZonePromotionReadiness,
|
|
218
232
|
} from "./trust-zones.js";
|
|
219
233
|
import type {
|
|
234
|
+
CodingContext,
|
|
220
235
|
EntityFile,
|
|
221
|
-
MemoryFile,
|
|
222
236
|
MemoryActionOutcome,
|
|
223
|
-
CodingContext, SourceConnectorProvenance,
|
|
224
237
|
MemoryActionType,
|
|
238
|
+
MemoryFile,
|
|
225
239
|
MemoryLifecycleEvent,
|
|
226
240
|
MemoryStatus,
|
|
227
241
|
PluginConfig,
|
|
228
242
|
RecallDisclosure,
|
|
229
243
|
RecallPlanMode,
|
|
244
|
+
SourceConnectorProvenance,
|
|
230
245
|
} from "./types.js";
|
|
231
|
-
import {
|
|
232
|
-
delegateExtractionForceFlush,
|
|
233
|
-
type EngramAccessExtractionForceFlushRequest,
|
|
234
|
-
type EngramAccessExtractionForceFlushResponse,
|
|
235
|
-
type EngramAccessLcmCompactionFlushRequest,
|
|
236
|
-
type EngramAccessLcmCompactionFlushResponse,
|
|
237
|
-
} from "./access-service-helpers.js";
|
|
246
|
+
import type { SupportPassportModelRoute } from "./support-passport/model-adapter.js";
|
|
238
247
|
export type {
|
|
239
248
|
EngramAccessExtractionForceFlushRequest,
|
|
240
249
|
EngramAccessExtractionForceFlushResponse,
|
|
@@ -242,81 +251,70 @@ export type {
|
|
|
242
251
|
EngramAccessLcmCompactionFlushResponse,
|
|
243
252
|
};
|
|
244
253
|
|
|
245
|
-
import {
|
|
246
|
-
import {
|
|
247
|
-
import
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
} from "./
|
|
254
|
+
import { AccessAdminOpsSurface } from "./access-admin-ops-surface.js";
|
|
255
|
+
import { AccessIdentityContinuitySurface } from "./access-identity-continuity-surface.js";
|
|
256
|
+
import { AccessLcmSurface } from "./access-lcm-surface.js";
|
|
257
|
+
import { AccessObserveWriteSurface } from "./access-observe-write-surface.js";
|
|
258
|
+
import { type OfflineSyncManifestStreamResponse, createOfflineSyncManifestStream } from "./access-offline-manifest.js";
|
|
259
|
+
import { AccessRecallSurface } from "./access-recall-surface.js";
|
|
251
260
|
import {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
261
|
+
type ActionConfidenceInput,
|
|
262
|
+
type ActionConfidenceResult,
|
|
263
|
+
evaluateActionConfidence,
|
|
264
|
+
} from "./action-confidence.js";
|
|
265
|
+
import {
|
|
266
|
+
resolveAccessSetupCapabilities,
|
|
267
|
+
resolveGraphConstructionCapabilities,
|
|
268
|
+
resolveIndexingCapabilities,
|
|
269
|
+
} from "./capabilities.js";
|
|
270
|
+
import { resolveRecallEnhancementCapabilities } from "./capabilities.js";
|
|
271
|
+
import { type CapsuleListEntry, defaultCapsulesDir } from "./capsule-cli.js";
|
|
260
272
|
import type { SemanticDedupLookup } from "./dedup/semantic.js";
|
|
261
|
-
import {
|
|
273
|
+
import type { FallbackLlmClient } from "./fallback-llm.js";
|
|
274
|
+
import type { LocalLlmClient } from "./local-llm.js";
|
|
262
275
|
import {
|
|
263
|
-
recordMemoryOutcome,
|
|
264
276
|
type MemoryOutcomeKind,
|
|
265
277
|
type RecordMemoryOutcomeResult,
|
|
278
|
+
recordMemoryOutcome,
|
|
266
279
|
} from "./memory-worth-outcomes.js";
|
|
267
|
-
import {
|
|
280
|
+
import type { LcmMessagePartInput, MessagePartSourceFormat } from "./message-parts/index.js";
|
|
268
281
|
import { recordObjectiveStateSnapshotsFromObservedMessages } from "./objective-state-writers.js";
|
|
282
|
+
import { objectiveStateStoreOverrideForNamespace } from "./objective-state.js";
|
|
283
|
+
import { offlineSyncStorageForSnapshot } from "./offline-sync-impression-drain.js";
|
|
269
284
|
import {
|
|
270
|
-
importCapsule as importCapsuleFn,
|
|
271
|
-
type ImportCapsuleOptions,
|
|
272
|
-
type ImportCapsuleResult,
|
|
273
|
-
} from "./transfer/capsule-import.js";
|
|
274
|
-
import {
|
|
275
|
-
exportCapsule as exportCapsuleFn,
|
|
276
|
-
type ExportCapsuleOptions,
|
|
277
|
-
type ExportCapsuleResult,
|
|
278
|
-
} from "./transfer/capsule-export.js";
|
|
279
|
-
import {
|
|
280
|
-
defaultCapsulesDir,
|
|
281
|
-
type CapsuleListEntry,
|
|
282
|
-
} from "./capsule-cli.js";
|
|
283
|
-
import {
|
|
284
|
-
applyOfflineSyncFileContentChunk,
|
|
285
|
-
compileOfflineSyncExcludeGlobs,
|
|
286
|
-
applyOfflineSyncChangeset,
|
|
287
|
-
buildOfflineSyncSnapshot,
|
|
288
|
-
buildOfflineSyncSnapshotFromBase,
|
|
289
|
-
buildOfflineSyncSnapshotForPaths,
|
|
290
|
-
iterateOfflineSyncSnapshotFileRecords,
|
|
291
|
-
filterOfflineSyncDeletionRevisions,
|
|
292
285
|
OFFLINE_SYNC_SNAPSHOT_FORMAT,
|
|
293
|
-
readOfflineSyncFileContentChunk,
|
|
294
|
-
type OfflineSyncApplyFileContentChunkResult,
|
|
295
286
|
type OfflineSyncApplyChangesetResult,
|
|
296
|
-
type
|
|
287
|
+
type OfflineSyncApplyFileContentChunkResult,
|
|
297
288
|
type OfflineSyncFileContentChunk,
|
|
289
|
+
type OfflineSyncFileRecord,
|
|
298
290
|
type OfflineSyncFileState,
|
|
299
291
|
type OfflineSyncSnapshot,
|
|
292
|
+
buildOfflineSyncSnapshot,
|
|
293
|
+
buildOfflineSyncSnapshotForPaths,
|
|
294
|
+
buildOfflineSyncSnapshotFromBase,
|
|
295
|
+
compileOfflineSyncExcludeGlobs,
|
|
296
|
+
filterOfflineSyncDeletionRevisions,
|
|
297
|
+
iterateOfflineSyncSnapshotFileRecords,
|
|
298
|
+
readOfflineSyncFileContentChunk,
|
|
300
299
|
} from "./offline-sync.js";
|
|
301
|
-
import {
|
|
300
|
+
import { selfDeps } from "./orchestration/self-deps.js";
|
|
301
|
+
import { formatProfileTraceAscii } from "./profiling.js";
|
|
302
|
+
import { decideDisclosureEscalation } from "./recall-disclosure-escalation.js";
|
|
303
|
+
import { toRecallExplainJson } from "./recall-explain-renderer.js";
|
|
304
|
+
import { type TagMatchMode, applyTagFilter, normalizeTags, parseTagMatch } from "./recall-tag-filter.js";
|
|
305
|
+
import { type RecallXraySnapshot, estimateRecallTokens } from "./recall-xray.js";
|
|
306
|
+
import { SupportPassportAccessServiceBase } from "./support-passport/access-service-base.js";
|
|
302
307
|
import {
|
|
303
|
-
|
|
304
|
-
type
|
|
305
|
-
|
|
308
|
+
type ExportCapsuleOptions,
|
|
309
|
+
type ExportCapsuleResult,
|
|
310
|
+
exportCapsule as exportCapsuleFn,
|
|
311
|
+
} from "./transfer/capsule-export.js";
|
|
306
312
|
import {
|
|
307
|
-
|
|
308
|
-
type
|
|
309
|
-
|
|
310
|
-
} from "./
|
|
311
|
-
import {
|
|
312
|
-
import { resolveAccessSetupCapabilities, resolveGraphConstructionCapabilities, resolveIndexingCapabilities } from "./capabilities.js";
|
|
313
|
-
import { resolveRecallEnhancementCapabilities } from "./capabilities.js";
|
|
314
|
-
import { AccessObserveWriteSurface } from "./access-observe-write-surface.js";
|
|
315
|
-
import { AccessLcmSurface } from "./access-lcm-surface.js";
|
|
316
|
-
import { AccessAdminOpsSurface } from "./access-admin-ops-surface.js";
|
|
317
|
-
import { AccessRecallSurface } from "./access-recall-surface.js";
|
|
318
|
-
import { AccessIdentityContinuitySurface } from "./access-identity-continuity-surface.js";
|
|
319
|
-
import { selfDeps } from "./orchestration/self-deps.js";
|
|
313
|
+
type ImportCapsuleOptions,
|
|
314
|
+
type ImportCapsuleResult,
|
|
315
|
+
importCapsule as importCapsuleFn,
|
|
316
|
+
} from "./transfer/capsule-import.js";
|
|
317
|
+
import { DEFAULT_RECALL_DISCLOSURE, isRecallDisclosure } from "./types.js";
|
|
320
318
|
|
|
321
319
|
import { EngramAccessInputError, NamespaceNotWritableError } from "./access-errors.js";
|
|
322
320
|
// Re-exported so existing `import { … } from "./access-service.js"` callers keep
|
|
@@ -346,9 +344,7 @@ async function getPackageVersion(): Promise<string> {
|
|
|
346
344
|
try {
|
|
347
345
|
const raw = await nodeFs.readFile(new URL("../package.json", import.meta.url), "utf-8");
|
|
348
346
|
const parsed = JSON.parse(raw) as { version?: unknown };
|
|
349
|
-
cachedPackageVersion = typeof parsed.version === "string" && parsed.version.length > 0
|
|
350
|
-
? parsed.version
|
|
351
|
-
: "unknown";
|
|
347
|
+
cachedPackageVersion = typeof parsed.version === "string" && parsed.version.length > 0 ? parsed.version : "unknown";
|
|
352
348
|
} catch {
|
|
353
349
|
cachedPackageVersion = "unknown";
|
|
354
350
|
}
|
|
@@ -877,7 +873,9 @@ export type EngramAccessActionConfidenceResponse = ActionConfidenceResult;
|
|
|
877
873
|
|
|
878
874
|
export async function buildProjectedGovernanceProposedActions(
|
|
879
875
|
storage: Awaited<ReturnType<Orchestrator["getStorage"]>>,
|
|
880
|
-
projected: NonNullable<
|
|
876
|
+
projected: NonNullable<
|
|
877
|
+
Awaited<ReturnType<Awaited<ReturnType<Orchestrator["getStorage"]>>["getProjectedGovernanceRecord"]>>
|
|
878
|
+
>
|
|
881
879
|
): Promise<Awaited<ReturnType<typeof readMemoryGovernanceRunArtifact>>["appliedActions"]> {
|
|
882
880
|
const reviewQueue = projected.reviewQueueRows.map((row) => ({
|
|
883
881
|
entryId: row.entryId,
|
|
@@ -889,13 +887,14 @@ export async function buildProjectedGovernanceProposedActions(
|
|
|
889
887
|
suggestedStatus: row.suggestedStatus,
|
|
890
888
|
relatedMemoryIds: row.relatedMemoryIds,
|
|
891
889
|
})) as Awaited<ReturnType<typeof readMemoryGovernanceRunArtifact>>["reviewQueue"];
|
|
892
|
-
const memories = (
|
|
893
|
-
.
|
|
890
|
+
const memories = (
|
|
891
|
+
await Promise.all(projected.reviewQueueRows.map((row) => storage.getMemoryById(row.memoryId)))
|
|
892
|
+
).filter((memory): memory is MemoryFile => Boolean(memory));
|
|
894
893
|
return buildProposedActions(reviewQueue, memories);
|
|
895
894
|
}
|
|
896
895
|
|
|
897
896
|
export function hasGroupedGovernanceActions(
|
|
898
|
-
grouped?: Awaited<ReturnType<typeof readMemoryGovernanceRunArtifact>>["transitionReport"]["proposed"]
|
|
897
|
+
grouped?: Awaited<ReturnType<typeof readMemoryGovernanceRunArtifact>>["transitionReport"]["proposed"]
|
|
899
898
|
): boolean {
|
|
900
899
|
if (!grouped) return false;
|
|
901
900
|
return Object.values(grouped).some((actions) => Array.isArray(actions) && actions.length > 0);
|
|
@@ -1129,7 +1128,6 @@ export interface EngramAccessLcmStatusResponse {
|
|
|
1129
1128
|
stats?: { totalTurns?: number };
|
|
1130
1129
|
}
|
|
1131
1130
|
|
|
1132
|
-
|
|
1133
1131
|
export interface EngramAccessLcmCompactionRecordRequest {
|
|
1134
1132
|
sessionKey: string;
|
|
1135
1133
|
namespace?: string;
|
|
@@ -1155,7 +1153,7 @@ function normalizePagination(limit?: number, offset?: number): { limit: number;
|
|
|
1155
1153
|
}
|
|
1156
1154
|
|
|
1157
1155
|
function normalizeBrowseSort(
|
|
1158
|
-
sort?: EngramAccessMemoryBrowseRequest["sort"]
|
|
1156
|
+
sort?: EngramAccessMemoryBrowseRequest["sort"]
|
|
1159
1157
|
): NonNullable<EngramAccessMemoryBrowseRequest["sort"]> {
|
|
1160
1158
|
switch (sort) {
|
|
1161
1159
|
case "updated_asc":
|
|
@@ -1188,7 +1186,7 @@ function summarizeTrustZoneRecord(
|
|
|
1188
1186
|
allRecords: TrustZoneRecord[],
|
|
1189
1187
|
poisoningDefenseEnabled: boolean,
|
|
1190
1188
|
trustZonesEnabled: boolean,
|
|
1191
|
-
promotionEnabled: boolean
|
|
1189
|
+
promotionEnabled: boolean
|
|
1192
1190
|
): EngramAccessTrustZoneRecordSummary {
|
|
1193
1191
|
const trustScore = poisoningDefenseEnabled ? scoreTrustZoneProvenance(record) : undefined;
|
|
1194
1192
|
const readiness = summarizeTrustZonePromotionReadiness({
|
|
@@ -1231,7 +1229,7 @@ function summarizeTrustZoneRecord(
|
|
|
1231
1229
|
function compareBrowseMemory(
|
|
1232
1230
|
sort: NonNullable<EngramAccessMemoryBrowseRequest["sort"]>,
|
|
1233
1231
|
left: MemoryFile,
|
|
1234
|
-
right: MemoryFile
|
|
1232
|
+
right: MemoryFile
|
|
1235
1233
|
): number {
|
|
1236
1234
|
const leftUpdated = left.frontmatter.updated ?? left.frontmatter.created ?? "";
|
|
1237
1235
|
const rightUpdated = right.frontmatter.updated ?? right.frontmatter.created ?? "";
|
|
@@ -1283,10 +1281,9 @@ export function shapeMemorySummary(
|
|
|
1283
1281
|
memory: MemoryFile,
|
|
1284
1282
|
baseDir: string,
|
|
1285
1283
|
disclosure?: RecallDisclosure,
|
|
1286
|
-
rawExcerpts?: EngramAccessMemorySummary["rawExcerpts"]
|
|
1284
|
+
rawExcerpts?: EngramAccessMemorySummary["rawExcerpts"]
|
|
1287
1285
|
): EngramAccessMemorySummary {
|
|
1288
|
-
const includeFullContent =
|
|
1289
|
-
disclosure === "section" || disclosure === "raw";
|
|
1286
|
+
const includeFullContent = disclosure === "section" || disclosure === "raw";
|
|
1290
1287
|
return {
|
|
1291
1288
|
id: memory.frontmatter.id,
|
|
1292
1289
|
path: memory.path,
|
|
@@ -1299,13 +1296,11 @@ export function shapeMemorySummary(
|
|
|
1299
1296
|
preview: normalizeProjectionPreview(memory.content),
|
|
1300
1297
|
...(disclosure !== undefined ? { disclosure } : {}),
|
|
1301
1298
|
...(includeFullContent ? { content: memory.content } : {}),
|
|
1302
|
-
...(disclosure === "raw" && rawExcerpts !== undefined
|
|
1303
|
-
? { rawExcerpts }
|
|
1304
|
-
: {}),
|
|
1299
|
+
...(disclosure === "raw" && rawExcerpts !== undefined ? { rawExcerpts } : {}),
|
|
1305
1300
|
};
|
|
1306
1301
|
}
|
|
1307
1302
|
|
|
1308
|
-
export class EngramAccessService {
|
|
1303
|
+
export class EngramAccessService extends SupportPassportAccessServiceBase {
|
|
1309
1304
|
private readonly idempotency: AccessIdempotencyStore;
|
|
1310
1305
|
private readonly idempotencyLocks = new Map<string, Promise<void>>();
|
|
1311
1306
|
private readonly recallSemaphores = new Map<string, unknown>();
|
|
@@ -1314,6 +1309,7 @@ export class EngramAccessService {
|
|
|
1314
1309
|
private readonly auditAdapter: AccessAuditAdapter | null;
|
|
1315
1310
|
private readonly corpusWatermarkCache = new CorpusWatermarkCache();
|
|
1316
1311
|
private readonly replicaDivergenceMonitor: ReplicaDivergenceMonitor;
|
|
1312
|
+
private readonly injectedSupportPassportGatewayRoute: SupportPassportModelRoute | null;
|
|
1317
1313
|
|
|
1318
1314
|
/** AccessObserveWriteSurface (access-service decomposition). Lazy; selfDeps live wiring. */
|
|
1319
1315
|
private _accessObserveWriteSurface: AccessObserveWriteSurface | undefined;
|
|
@@ -1321,7 +1317,7 @@ export class EngramAccessService {
|
|
|
1321
1317
|
private get accessObserveWriteSurface(): AccessObserveWriteSurface {
|
|
1322
1318
|
if (!this._accessObserveWriteSurface) {
|
|
1323
1319
|
this._accessObserveWriteSurface = new AccessObserveWriteSurface(
|
|
1324
|
-
selfDeps<ConstructorParameters<typeof AccessObserveWriteSurface>[0]>(this)
|
|
1320
|
+
selfDeps<ConstructorParameters<typeof AccessObserveWriteSurface>[0]>(this)
|
|
1325
1321
|
);
|
|
1326
1322
|
}
|
|
1327
1323
|
return this._accessObserveWriteSurface;
|
|
@@ -1332,9 +1328,7 @@ export class EngramAccessService {
|
|
|
1332
1328
|
|
|
1333
1329
|
private get accessLcmSurface(): AccessLcmSurface {
|
|
1334
1330
|
if (!this._accessLcmSurface) {
|
|
1335
|
-
this._accessLcmSurface = new AccessLcmSurface(
|
|
1336
|
-
selfDeps<ConstructorParameters<typeof AccessLcmSurface>[0]>(this),
|
|
1337
|
-
);
|
|
1331
|
+
this._accessLcmSurface = new AccessLcmSurface(selfDeps<ConstructorParameters<typeof AccessLcmSurface>[0]>(this));
|
|
1338
1332
|
}
|
|
1339
1333
|
return this._accessLcmSurface;
|
|
1340
1334
|
}
|
|
@@ -1345,7 +1339,7 @@ export class EngramAccessService {
|
|
|
1345
1339
|
private get accessAdminOpsSurface(): AccessAdminOpsSurface {
|
|
1346
1340
|
if (!this._accessAdminOpsSurface) {
|
|
1347
1341
|
this._accessAdminOpsSurface = new AccessAdminOpsSurface(
|
|
1348
|
-
selfDeps<ConstructorParameters<typeof AccessAdminOpsSurface>[0]>(this)
|
|
1342
|
+
selfDeps<ConstructorParameters<typeof AccessAdminOpsSurface>[0]>(this)
|
|
1349
1343
|
);
|
|
1350
1344
|
}
|
|
1351
1345
|
return this._accessAdminOpsSurface;
|
|
@@ -1357,7 +1351,7 @@ export class EngramAccessService {
|
|
|
1357
1351
|
private get accessRecallSurface(): AccessRecallSurface {
|
|
1358
1352
|
if (!this._accessRecallSurface) {
|
|
1359
1353
|
this._accessRecallSurface = new AccessRecallSurface(
|
|
1360
|
-
selfDeps<ConstructorParameters<typeof AccessRecallSurface>[0]>(this)
|
|
1354
|
+
selfDeps<ConstructorParameters<typeof AccessRecallSurface>[0]>(this)
|
|
1361
1355
|
);
|
|
1362
1356
|
}
|
|
1363
1357
|
return this._accessRecallSurface;
|
|
@@ -1369,20 +1363,28 @@ export class EngramAccessService {
|
|
|
1369
1363
|
private get accessIdentityContinuitySurface(): AccessIdentityContinuitySurface {
|
|
1370
1364
|
if (!this._accessIdentityContinuitySurface) {
|
|
1371
1365
|
this._accessIdentityContinuitySurface = new AccessIdentityContinuitySurface(
|
|
1372
|
-
selfDeps<ConstructorParameters<typeof AccessIdentityContinuitySurface>[0]>(this)
|
|
1366
|
+
selfDeps<ConstructorParameters<typeof AccessIdentityContinuitySurface>[0]>(this)
|
|
1373
1367
|
);
|
|
1374
1368
|
}
|
|
1375
1369
|
return this._accessIdentityContinuitySurface;
|
|
1376
1370
|
}
|
|
1377
1371
|
private readonly extractionLivenessWarn = new ExtractionLivenessWarnThrottle();
|
|
1378
1372
|
|
|
1379
|
-
constructor(
|
|
1373
|
+
constructor(
|
|
1374
|
+
private readonly orchestrator: Orchestrator,
|
|
1375
|
+
options: {
|
|
1376
|
+
resolveSecretRef?: ResolveSecretRefFn | null;
|
|
1377
|
+
supportPassportGatewayRoute?: SupportPassportModelRoute | null;
|
|
1378
|
+
} = {}
|
|
1379
|
+
) {
|
|
1380
|
+
super();
|
|
1380
1381
|
this.idempotency = new AccessIdempotencyStore(orchestrator.config.memoryDir);
|
|
1381
1382
|
// Peer SecretRef tokens resolve at poll time through the host resolver, the
|
|
1382
1383
|
// same indirection as agentAccessHttp.authToken (review round 1). Absent a
|
|
1383
1384
|
// resolver, string/${ENV} tokens still work and a SecretRef degrades to a
|
|
1384
1385
|
// per-peer `unreachable` (never a throw).
|
|
1385
1386
|
this.replicaDivergenceMonitor = new ReplicaDivergenceMonitor({ resolveSecretRef: options.resolveSecretRef });
|
|
1387
|
+
this.injectedSupportPassportGatewayRoute = options.supportPassportGatewayRoute ?? null;
|
|
1386
1388
|
const accessCaps = resolveAccessSetupCapabilities(orchestrator.config); // #1566 Cluster B
|
|
1387
1389
|
this.budget = new CrossNamespaceBudget({
|
|
1388
1390
|
enabled: accessCaps.recallCrossNamespaceBudget,
|
|
@@ -1414,6 +1416,10 @@ export class EngramAccessService {
|
|
|
1414
1416
|
}
|
|
1415
1417
|
}
|
|
1416
1418
|
|
|
1419
|
+
override get supportPassportGatewayRouteRef(): SupportPassportModelRoute | null {
|
|
1420
|
+
return this.injectedSupportPassportGatewayRoute;
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1417
1423
|
get briefingEnabled(): boolean {
|
|
1418
1424
|
return this.orchestrator.config.briefing?.enabled === true;
|
|
1419
1425
|
}
|
|
@@ -1421,7 +1427,10 @@ export class EngramAccessService {
|
|
|
1421
1427
|
private resolveNamespace(namespace?: string): string {
|
|
1422
1428
|
const requested = namespace?.trim();
|
|
1423
1429
|
if (!requested) return this.orchestrator.config.defaultNamespace;
|
|
1424
|
-
if (
|
|
1430
|
+
if (
|
|
1431
|
+
!resolveNamespaceCapabilities(this.orchestrator.config).namespaces &&
|
|
1432
|
+
requested !== this.orchestrator.config.defaultNamespace
|
|
1433
|
+
) {
|
|
1425
1434
|
throw new EngramAccessInputError(`unsupported namespace: ${requested}`);
|
|
1426
1435
|
}
|
|
1427
1436
|
return requested;
|
|
@@ -1438,7 +1447,7 @@ export class EngramAccessService {
|
|
|
1438
1447
|
private resolveRecallNamespace(
|
|
1439
1448
|
namespace: string | undefined,
|
|
1440
1449
|
sessionKey: string | undefined,
|
|
1441
|
-
authenticatedPrincipal?: string
|
|
1450
|
+
authenticatedPrincipal?: string
|
|
1442
1451
|
): string | undefined {
|
|
1443
1452
|
const requested = namespace?.trim();
|
|
1444
1453
|
if (!requested) return undefined;
|
|
@@ -1459,7 +1468,7 @@ export class EngramAccessService {
|
|
|
1459
1468
|
private writableNamespaceFor(
|
|
1460
1469
|
namespace: string | undefined,
|
|
1461
1470
|
sessionKey: string | undefined,
|
|
1462
|
-
authenticatedPrincipal?: string
|
|
1471
|
+
authenticatedPrincipal?: string
|
|
1463
1472
|
): string {
|
|
1464
1473
|
// #1521: delegates to the scope-module resolver. The inline
|
|
1465
1474
|
// namespace/principal resolution + writability check is retired so the
|
|
@@ -1468,7 +1477,7 @@ export class EngramAccessService {
|
|
|
1468
1477
|
namespace,
|
|
1469
1478
|
sessionKey,
|
|
1470
1479
|
authenticatedPrincipal,
|
|
1471
|
-
this.orchestrator.config
|
|
1480
|
+
this.orchestrator.config
|
|
1472
1481
|
);
|
|
1473
1482
|
if (!result.ok) {
|
|
1474
1483
|
if (result.reason === "unsupported") {
|
|
@@ -1476,13 +1485,12 @@ export class EngramAccessService {
|
|
|
1476
1485
|
}
|
|
1477
1486
|
throw new NamespaceNotWritableError(
|
|
1478
1487
|
result.namespace,
|
|
1479
|
-
this.resolveRequestPrincipal(sessionKey, authenticatedPrincipal)
|
|
1488
|
+
this.resolveRequestPrincipal(sessionKey, authenticatedPrincipal)
|
|
1480
1489
|
);
|
|
1481
1490
|
}
|
|
1482
1491
|
return result.namespace;
|
|
1483
1492
|
}
|
|
1484
1493
|
|
|
1485
|
-
|
|
1486
1494
|
/** Shared coding-scope derivation for the read/write resolvers below —
|
|
1487
1495
|
* coding context, overlay, principal, scope-profile plan for an IMPLICIT
|
|
1488
1496
|
* request, IDENTICAL to recall precedence (session-first, per-call fallback)
|
|
@@ -1494,7 +1502,7 @@ export class EngramAccessService {
|
|
|
1494
1502
|
namespace?: string;
|
|
1495
1503
|
sessionKey?: string;
|
|
1496
1504
|
authenticatedPrincipal?: string;
|
|
1497
|
-
}
|
|
1505
|
+
}
|
|
1498
1506
|
): Promise<{
|
|
1499
1507
|
principal: string | undefined;
|
|
1500
1508
|
codingContext: CodingContext | null;
|
|
@@ -1506,14 +1514,13 @@ export class EngramAccessService {
|
|
|
1506
1514
|
// searches the base namespace; a sessionless write/read must too — otherwise
|
|
1507
1515
|
// a client that injects cwd/projectTag but no sessionKey would land in a
|
|
1508
1516
|
// `default-project-*` namespace its own recall never searches (Codex review).
|
|
1509
|
-
const hasSession =
|
|
1510
|
-
typeof request.sessionKey === "string" && request.sessionKey.length > 0;
|
|
1517
|
+
const hasSession = typeof request.sessionKey === "string" && request.sessionKey.length > 0;
|
|
1511
1518
|
const codingContext =
|
|
1512
1519
|
hasSession &&
|
|
1513
1520
|
resolveNamespaceCapabilities(this.orchestrator.config).namespaces &&
|
|
1514
1521
|
this.orchestrator.config.codingMode?.projectScope
|
|
1515
|
-
? this.orchestrator.getCodingContextForSession(request.sessionKey) ??
|
|
1516
|
-
(await resolveCodingContextFromOptions(request))
|
|
1522
|
+
? (this.orchestrator.getCodingContextForSession(request.sessionKey) ??
|
|
1523
|
+
(await resolveCodingContextFromOptions(request)))
|
|
1517
1524
|
: null;
|
|
1518
1525
|
const overlay =
|
|
1519
1526
|
hasSession &&
|
|
@@ -1522,13 +1529,10 @@ export class EngramAccessService {
|
|
|
1522
1529
|
? resolveCodingNamespaceOverlay(
|
|
1523
1530
|
codingContext,
|
|
1524
1531
|
this.orchestrator.config.codingMode,
|
|
1525
|
-
this.orchestrator.config.defaultNamespace
|
|
1532
|
+
this.orchestrator.config.defaultNamespace
|
|
1526
1533
|
)
|
|
1527
1534
|
: null;
|
|
1528
|
-
const principal = this.resolveRequestPrincipal(
|
|
1529
|
-
request.sessionKey,
|
|
1530
|
-
request.authenticatedPrincipal,
|
|
1531
|
-
);
|
|
1535
|
+
const principal = this.resolveRequestPrincipal(request.sessionKey, request.authenticatedPrincipal);
|
|
1532
1536
|
const profilePlan = resolveScopeProfilePlan({
|
|
1533
1537
|
config: this.orchestrator.config,
|
|
1534
1538
|
principal,
|
|
@@ -1539,11 +1543,7 @@ export class EngramAccessService {
|
|
|
1539
1543
|
}
|
|
1540
1544
|
|
|
1541
1545
|
private assertTokenCanWriteNamespace(namespace: string): void {
|
|
1542
|
-
enforceNamespaceAllowList(
|
|
1543
|
-
tokenCapabilityStore.getStore(),
|
|
1544
|
-
namespace,
|
|
1545
|
-
this.orchestrator.config.defaultNamespace,
|
|
1546
|
-
);
|
|
1546
|
+
enforceNamespaceAllowList(tokenCapabilityStore.getStore(), namespace, this.orchestrator.config.defaultNamespace);
|
|
1547
1547
|
}
|
|
1548
1548
|
|
|
1549
1549
|
/**
|
|
@@ -1561,15 +1561,11 @@ export class EngramAccessService {
|
|
|
1561
1561
|
sessionKey?: string;
|
|
1562
1562
|
authenticatedPrincipal?: string;
|
|
1563
1563
|
},
|
|
1564
|
-
enforceToken
|
|
1564
|
+
enforceToken = true
|
|
1565
1565
|
): Promise<string> {
|
|
1566
1566
|
const requested = request.namespace?.trim();
|
|
1567
1567
|
if (requested) {
|
|
1568
|
-
const namespace = this.writableNamespaceFor(
|
|
1569
|
-
requested,
|
|
1570
|
-
request.sessionKey,
|
|
1571
|
-
request.authenticatedPrincipal,
|
|
1572
|
-
);
|
|
1568
|
+
const namespace = this.writableNamespaceFor(requested, request.sessionKey, request.authenticatedPrincipal);
|
|
1573
1569
|
if (enforceToken) this.assertTokenCanWriteNamespace(namespace);
|
|
1574
1570
|
return namespace;
|
|
1575
1571
|
}
|
|
@@ -1591,7 +1587,7 @@ export class EngramAccessService {
|
|
|
1591
1587
|
throw new NamespaceNotWritableError(
|
|
1592
1588
|
result.namespace,
|
|
1593
1589
|
principal,
|
|
1594
|
-
`scope profile ${profilePlan.profileId} has no writable layer for principal ${principal ?? "anonymous"}
|
|
1590
|
+
`scope profile ${profilePlan.profileId} has no writable layer for principal ${principal ?? "anonymous"}`
|
|
1595
1591
|
);
|
|
1596
1592
|
}
|
|
1597
1593
|
|
|
@@ -1601,12 +1597,9 @@ export class EngramAccessService {
|
|
|
1601
1597
|
throw new NamespaceNotWritableError(result.namespace, principal);
|
|
1602
1598
|
}
|
|
1603
1599
|
|
|
1604
|
-
async namespaceWritablePreflight(
|
|
1605
|
-
request
|
|
1606
|
-
|
|
1607
|
-
return resolveNamespaceWritablePreflight(
|
|
1608
|
-
request,
|
|
1609
|
-
(preflightRequest) => this.resolveCodingScopedWriteNamespace(preflightRequest, false),
|
|
1600
|
+
async namespaceWritablePreflight(request: EngramAccessNamespaceWritableRequest): Promise<WritableNamespaceResult> {
|
|
1601
|
+
return resolveNamespaceWritablePreflight(request, (preflightRequest) =>
|
|
1602
|
+
this.resolveCodingScopedWriteNamespace(preflightRequest, false)
|
|
1610
1603
|
);
|
|
1611
1604
|
}
|
|
1612
1605
|
|
|
@@ -1622,14 +1615,10 @@ export class EngramAccessService {
|
|
|
1622
1615
|
namespace?: string;
|
|
1623
1616
|
sessionKey?: string;
|
|
1624
1617
|
authenticatedPrincipal?: string;
|
|
1625
|
-
}
|
|
1618
|
+
}
|
|
1626
1619
|
): Promise<string> {
|
|
1627
|
-
const principal = this.resolveRequestPrincipal(
|
|
1628
|
-
|
|
1629
|
-
request.authenticatedPrincipal,
|
|
1630
|
-
);
|
|
1631
|
-
const hasExplicitNamespace =
|
|
1632
|
-
typeof request.namespace === "string" && request.namespace.trim().length > 0;
|
|
1620
|
+
const principal = this.resolveRequestPrincipal(request.sessionKey, request.authenticatedPrincipal);
|
|
1621
|
+
const hasExplicitNamespace = typeof request.namespace === "string" && request.namespace.trim().length > 0;
|
|
1633
1622
|
if (hasExplicitNamespace) {
|
|
1634
1623
|
return this.resolveReadableNamespace(request.namespace, principal);
|
|
1635
1624
|
}
|
|
@@ -1693,15 +1682,11 @@ export class EngramAccessService {
|
|
|
1693
1682
|
namespace?: string;
|
|
1694
1683
|
sessionKey?: string;
|
|
1695
1684
|
authenticatedPrincipal?: string;
|
|
1696
|
-
}
|
|
1685
|
+
}
|
|
1697
1686
|
): Promise<MemoryScopePlan> {
|
|
1698
1687
|
const warnings: string[] = [];
|
|
1699
|
-
const principal = this.resolveRequestPrincipal(
|
|
1700
|
-
|
|
1701
|
-
request.authenticatedPrincipal,
|
|
1702
|
-
);
|
|
1703
|
-
const hasExplicitNamespace =
|
|
1704
|
-
typeof request.namespace === "string" && request.namespace.trim().length > 0;
|
|
1688
|
+
const principal = this.resolveRequestPrincipal(request.sessionKey, request.authenticatedPrincipal);
|
|
1689
|
+
const hasExplicitNamespace = typeof request.namespace === "string" && request.namespace.trim().length > 0;
|
|
1705
1690
|
|
|
1706
1691
|
if (hasExplicitNamespace) {
|
|
1707
1692
|
// Explicit namespace wins; authorized through the existing policy path.
|
|
@@ -1711,7 +1696,7 @@ export class EngramAccessService {
|
|
|
1711
1696
|
const writeNamespace = this.writableNamespaceFor(
|
|
1712
1697
|
request.namespace,
|
|
1713
1698
|
request.sessionKey,
|
|
1714
|
-
request.authenticatedPrincipal
|
|
1699
|
+
request.authenticatedPrincipal
|
|
1715
1700
|
);
|
|
1716
1701
|
this.assertTokenCanWriteNamespace(writeNamespace);
|
|
1717
1702
|
return {
|
|
@@ -1728,23 +1713,15 @@ export class EngramAccessService {
|
|
|
1728
1713
|
|
|
1729
1714
|
// No explicit namespace → principal self base, optionally overlaid with the
|
|
1730
1715
|
// session's coding (project/branch) context — the SAME resolution recall and
|
|
1731
|
-
// the orchestrator buffer-flush write path use (rule 42 symmetry).
|
|
1732
|
-
const baseNamespace = defaultNamespaceForPrincipal(
|
|
1733
|
-
principal,
|
|
1734
|
-
this.orchestrator.config,
|
|
1735
|
-
);
|
|
1716
|
+
// the orchestrator buffer-flush write path use (rule 42 symmetry).
|
|
1717
|
+
const baseNamespace = defaultNamespaceForPrincipal(principal, this.orchestrator.config);
|
|
1736
1718
|
|
|
1737
1719
|
// Resolve the coding context and overlay through the shared read-only
|
|
1738
1720
|
// resolver used by the other scoped access paths. It applies the same
|
|
1739
1721
|
// session-first, per-call fallback precedence without mutating session
|
|
1740
1722
|
// state, so concurrent requests cannot observe temporary context.
|
|
1741
|
-
const {
|
|
1742
|
-
|
|
1743
|
-
profilePlan,
|
|
1744
|
-
} = await this.resolveCodingScopeInputs(request);
|
|
1745
|
-
const overlaidBase = codingOverlay
|
|
1746
|
-
? combineNamespaces(baseNamespace, codingOverlay.namespace)
|
|
1747
|
-
: baseNamespace;
|
|
1723
|
+
const { overlay: codingOverlay, profilePlan } = await this.resolveCodingScopeInputs(request);
|
|
1724
|
+
const overlaidBase = codingOverlay ? combineNamespaces(baseNamespace, codingOverlay.namespace) : baseNamespace;
|
|
1748
1725
|
const codingOverlayApplied = overlaidBase !== baseNamespace;
|
|
1749
1726
|
const assertWriteNamespaceAllowed = (namespace: string): void => {
|
|
1750
1727
|
this.assertTokenCanWriteNamespace(namespace);
|
|
@@ -1752,11 +1729,13 @@ export class EngramAccessService {
|
|
|
1752
1729
|
if (profilePlan) {
|
|
1753
1730
|
const selectedLayer = profilePlan.layers.find((layer) => layer.id === profilePlan.writeLayer);
|
|
1754
1731
|
const writeNamespaceReadable =
|
|
1755
|
-
profilePlan.writeNamespace.length > 0 &&
|
|
1756
|
-
profilePlan.readNamespaces.includes(profilePlan.writeNamespace);
|
|
1732
|
+
profilePlan.writeNamespace.length > 0 && profilePlan.readNamespaces.includes(profilePlan.writeNamespace);
|
|
1757
1733
|
if (!selectedLayer?.writable || !writeNamespaceReadable) {
|
|
1758
|
-
throw new NamespaceNotWritableError(
|
|
1759
|
-
|
|
1734
|
+
throw new NamespaceNotWritableError(
|
|
1735
|
+
profilePlan.writeNamespace,
|
|
1736
|
+
principal,
|
|
1737
|
+
`scope profile ${profilePlan.profileId} has no writable layer for principal ${principal ?? "anonymous"}`
|
|
1738
|
+
);
|
|
1760
1739
|
}
|
|
1761
1740
|
const legacyRecallNamespaces = Array.isArray(this.orchestrator.config.defaultRecallNamespaces)
|
|
1762
1741
|
? recallNamespacesForPrincipal(principal, this.orchestrator.config)
|
|
@@ -1777,8 +1756,8 @@ export class EngramAccessService {
|
|
|
1777
1756
|
(layer.id === "userProject" || layer.id === "teamProject") &&
|
|
1778
1757
|
layer.readable &&
|
|
1779
1758
|
layer.namespace &&
|
|
1780
|
-
readNamespaces.includes(layer.namespace)
|
|
1781
|
-
)
|
|
1759
|
+
readNamespaces.includes(layer.namespace)
|
|
1760
|
+
)
|
|
1782
1761
|
);
|
|
1783
1762
|
assertWriteNamespaceAllowed(profilePlan.writeNamespace);
|
|
1784
1763
|
return {
|
|
@@ -1803,11 +1782,7 @@ export class EngramAccessService {
|
|
|
1803
1782
|
// namespace), collapsing the namespaces-disabled / no-session /
|
|
1804
1783
|
// projectScope-off cases to config.defaultNamespace exactly as before
|
|
1805
1784
|
// (rule 39 parity with resolveCodingScopedWriteNamespace).
|
|
1806
|
-
const writeNamespace = this.writableNamespaceFor(
|
|
1807
|
-
undefined,
|
|
1808
|
-
request.sessionKey,
|
|
1809
|
-
request.authenticatedPrincipal,
|
|
1810
|
-
);
|
|
1785
|
+
const writeNamespace = this.writableNamespaceFor(undefined, request.sessionKey, request.authenticatedPrincipal);
|
|
1811
1786
|
// Objective-state keeps its STRICTER pre-#1495 contract (#928): an implicit
|
|
1812
1787
|
// snapshot is based on the PRINCIPAL SELF namespace and authorized against
|
|
1813
1788
|
// THAT base (rule 48 least-privilege). This rejection MUST stay (security):
|
|
@@ -1889,9 +1864,7 @@ export class EngramAccessService {
|
|
|
1889
1864
|
if (scope.scopeProfile && scope.writeLayer !== "userProject") {
|
|
1890
1865
|
return scope.writeNamespace;
|
|
1891
1866
|
}
|
|
1892
|
-
return scope.codingOverlayApplied
|
|
1893
|
-
? this.orchestrator.config.defaultNamespace
|
|
1894
|
-
: scope.writeNamespace;
|
|
1867
|
+
return scope.codingOverlayApplied ? this.orchestrator.config.defaultNamespace : scope.writeNamespace;
|
|
1895
1868
|
}
|
|
1896
1869
|
|
|
1897
1870
|
private async objectiveStateStoreLocationForNamespace(namespace: string): Promise<{
|
|
@@ -1929,9 +1902,7 @@ export class EngramAccessService {
|
|
|
1929
1902
|
// unauthenticated. Unauthenticated callers must NOT be allowed to read
|
|
1930
1903
|
// arbitrary namespaces: that would bypass all readPrincipals policies.
|
|
1931
1904
|
if (!principal) {
|
|
1932
|
-
throw new EngramAccessInputError(
|
|
1933
|
-
"authentication required: namespaces are enabled and no principal was supplied",
|
|
1934
|
-
);
|
|
1905
|
+
throw new EngramAccessInputError("authentication required: namespaces are enabled and no principal was supplied");
|
|
1935
1906
|
}
|
|
1936
1907
|
|
|
1937
1908
|
// Authenticated caller — enforce the namespace ACL as normal.
|
|
@@ -1943,7 +1914,7 @@ export class EngramAccessService {
|
|
|
1943
1914
|
|
|
1944
1915
|
private async resolveReadableNamespacesForSearch(
|
|
1945
1916
|
namespace: string | undefined,
|
|
1946
|
-
principal?: string
|
|
1917
|
+
principal?: string
|
|
1947
1918
|
): Promise<string[]> {
|
|
1948
1919
|
const requested = namespace?.trim();
|
|
1949
1920
|
if (requested) {
|
|
@@ -1955,15 +1926,10 @@ export class EngramAccessService {
|
|
|
1955
1926
|
}
|
|
1956
1927
|
|
|
1957
1928
|
if (!principal) {
|
|
1958
|
-
throw new EngramAccessInputError(
|
|
1959
|
-
"authentication required: namespaces are enabled and no principal was supplied",
|
|
1960
|
-
);
|
|
1929
|
+
throw new EngramAccessInputError("authentication required: namespaces are enabled and no principal was supplied");
|
|
1961
1930
|
}
|
|
1962
1931
|
|
|
1963
|
-
const legacyRecallNamespaces = recallNamespacesForPrincipal(
|
|
1964
|
-
principal,
|
|
1965
|
-
this.orchestrator.config,
|
|
1966
|
-
);
|
|
1932
|
+
const legacyRecallNamespaces = recallNamespacesForPrincipal(principal, this.orchestrator.config);
|
|
1967
1933
|
const profilePlan = resolveScopeProfilePlan({
|
|
1968
1934
|
config: this.orchestrator.config,
|
|
1969
1935
|
principal,
|
|
@@ -1995,9 +1961,7 @@ export class EngramAccessService {
|
|
|
1995
1961
|
});
|
|
1996
1962
|
return mergeMemorySearchDefaultFallback(profileNamespaces, fallback);
|
|
1997
1963
|
}
|
|
1998
|
-
return legacyRecallNamespaces.filter((ns) =>
|
|
1999
|
-
canReadNamespace(principal, ns, this.orchestrator.config),
|
|
2000
|
-
);
|
|
1964
|
+
return legacyRecallNamespaces.filter((ns) => canReadNamespace(principal, ns, this.orchestrator.config));
|
|
2001
1965
|
}
|
|
2002
1966
|
|
|
2003
1967
|
private resolveAllReadableConfiguredNamespaces(principal: string): string[] {
|
|
@@ -2007,14 +1971,13 @@ export class EngramAccessService {
|
|
|
2007
1971
|
config.sharedNamespace,
|
|
2008
1972
|
...config.namespacePolicies.map((policy) => policy.name),
|
|
2009
1973
|
];
|
|
2010
|
-
return [...new Set(candidates)]
|
|
2011
|
-
.filter((namespace) => canReadNamespace(principal, namespace, config));
|
|
1974
|
+
return [...new Set(candidates)].filter((namespace) => canReadNamespace(principal, namespace, config));
|
|
2012
1975
|
}
|
|
2013
1976
|
|
|
2014
1977
|
private resolveMemorySearchNamespacesForCollection(
|
|
2015
1978
|
collection: string | undefined,
|
|
2016
1979
|
namespaces: string[],
|
|
2017
|
-
collectionPrincipal?: string
|
|
1980
|
+
collectionPrincipal?: string
|
|
2018
1981
|
): string[] {
|
|
2019
1982
|
if (!resolveNamespaceCapabilities(this.orchestrator.config).namespaces) {
|
|
2020
1983
|
return namespaces;
|
|
@@ -2054,16 +2017,14 @@ export class EngramAccessService {
|
|
|
2054
2017
|
return matchedNamespaces;
|
|
2055
2018
|
}
|
|
2056
2019
|
|
|
2057
|
-
throw new EngramAccessInputError(
|
|
2058
|
-
"collection is not namespace-scoped for the requested principal",
|
|
2059
|
-
);
|
|
2020
|
+
throw new EngramAccessInputError("collection is not namespace-scoped for the requested principal");
|
|
2060
2021
|
}
|
|
2061
2022
|
|
|
2062
2023
|
private async buildRecallDebug(
|
|
2063
2024
|
snapshot: LastRecallSnapshot | null,
|
|
2064
2025
|
namespace: string,
|
|
2065
2026
|
includeDebug: boolean,
|
|
2066
|
-
sessionKey?: string
|
|
2027
|
+
sessionKey?: string
|
|
2067
2028
|
): Promise<EngramAccessRecallResponse["debug"] | undefined> {
|
|
2068
2029
|
if (!includeDebug) return undefined;
|
|
2069
2030
|
if (!sessionKey?.trim()) return undefined;
|
|
@@ -2073,10 +2034,10 @@ export class EngramAccessService {
|
|
|
2073
2034
|
]);
|
|
2074
2035
|
return snapshot || intent || graph
|
|
2075
2036
|
? {
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2037
|
+
snapshot: snapshot ?? undefined,
|
|
2038
|
+
intent,
|
|
2039
|
+
graph,
|
|
2040
|
+
}
|
|
2080
2041
|
: undefined;
|
|
2081
2042
|
}
|
|
2082
2043
|
|
|
@@ -2109,60 +2070,52 @@ export class EngramAccessService {
|
|
|
2109
2070
|
*/
|
|
2110
2071
|
rawExcerptsSuppressed?: boolean;
|
|
2111
2072
|
}): Promise<EngramAccessRecallResponse> {
|
|
2112
|
-
return this.accessRecallSurface.buildRecallResponseFromXraySnapshot(
|
|
2113
|
-
options,
|
|
2114
|
-
);
|
|
2073
|
+
return this.accessRecallSurface.buildRecallResponseFromXraySnapshot(options);
|
|
2115
2074
|
}
|
|
2116
2075
|
|
|
2117
2076
|
private async serializeRecallResults(
|
|
2118
2077
|
snapshot: LastRecallSnapshot | null,
|
|
2119
2078
|
disclosure: RecallDisclosure,
|
|
2120
|
-
rawContext:
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
}
|
|
2153
|
-
| null = null,
|
|
2079
|
+
rawContext: {
|
|
2080
|
+
query: string;
|
|
2081
|
+
sessionKey?: string;
|
|
2082
|
+
/**
|
|
2083
|
+
* Read-authorization-gated namespace for the raw-excerpt LCM lookup
|
|
2084
|
+
* (#1505 thread 2f7). When the caller supplies it, the raw lookup uses
|
|
2085
|
+
* THIS namespace prefix instead of `snapshot.namespace` (the
|
|
2086
|
+
* write/overlay namespace), so raw disclosure honours the SAME read
|
|
2087
|
+
* gate as normal recall + `lcmSearch`. Omitted ⇒ falls back to the
|
|
2088
|
+
* snapshot namespace (single-store / sessionless callers, unchanged).
|
|
2089
|
+
*/
|
|
2090
|
+
rawExcerptNamespace?: string;
|
|
2091
|
+
/**
|
|
2092
|
+
* Ordered, read-authorized LCM read session_id SET (#1505 fallback
|
|
2093
|
+
* unification). When supplied, raw disclosure queries each key (primary
|
|
2094
|
+
* coding overlay → read fallbacks) and merges rows so a branch-scoped
|
|
2095
|
+
* session finds excerpts archived at project/root scope. Already
|
|
2096
|
+
* read-gated, so no unauthorized overlay key is present. Omitted ⇒ the
|
|
2097
|
+
* legacy single `rawExcerptNamespace`-prefixed key (unchanged).
|
|
2098
|
+
*/
|
|
2099
|
+
rawExcerptSessionIds?: string[];
|
|
2100
|
+
/**
|
|
2101
|
+
* Force NO raw excerpts even when `disclosure === "raw"` (#1505 thread
|
|
2102
|
+
* NBHWz). Set by callers when the IMPLICIT raw-excerpt read gate found
|
|
2103
|
+
* NO readable LCM namespace (a restrictive `default` READ policy with
|
|
2104
|
+
* no readable overlay/self namespace). The lookup must NOT fall back to
|
|
2105
|
+
* `snapshot.namespace` (the write/overlay namespace the read gate
|
|
2106
|
+
* excludes) — it returns empty excerpts so raw recall degrades
|
|
2107
|
+
* gracefully instead of leaking unreadable rows or throwing.
|
|
2108
|
+
*/
|
|
2109
|
+
rawExcerptsSuppressed?: boolean;
|
|
2110
|
+
} | null = null
|
|
2154
2111
|
): Promise<EngramAccessMemorySummary[]> {
|
|
2155
|
-
return this.accessRecallSurface.serializeRecallResults(
|
|
2156
|
-
snapshot,
|
|
2157
|
-
disclosure,
|
|
2158
|
-
rawContext,
|
|
2159
|
-
);
|
|
2112
|
+
return this.accessRecallSurface.serializeRecallResults(snapshot, disclosure, rawContext);
|
|
2160
2113
|
}
|
|
2161
2114
|
|
|
2162
2115
|
private async storageForAbsoluteRecallPath(
|
|
2163
2116
|
memoryPath: string,
|
|
2164
2117
|
primaryNamespace: string,
|
|
2165
|
-
recallNamespaces: readonly string[] = []
|
|
2118
|
+
recallNamespaces: readonly string[] = []
|
|
2166
2119
|
): Promise<{ storage: StorageManager; dir: string; namespace: string } | null> {
|
|
2167
2120
|
const resolvedPath = nodePath.resolve(memoryPath);
|
|
2168
2121
|
const memoryRoot = nodePath.resolve(this.orchestrator.config.memoryDir);
|
|
@@ -2193,10 +2146,7 @@ export class EngramAccessService {
|
|
|
2193
2146
|
}
|
|
2194
2147
|
const candidateRoot = nodePath.resolve(candidateStorage.dir);
|
|
2195
2148
|
if (!isPathInsideStorageRoot(candidateRoot, resolvedPath)) continue;
|
|
2196
|
-
if (
|
|
2197
|
-
candidateRoot === memoryRoot &&
|
|
2198
|
-
isPathInsideStorageRoot(namespacesRoot, resolvedPath)
|
|
2199
|
-
) {
|
|
2149
|
+
if (candidateRoot === memoryRoot && isPathInsideStorageRoot(namespacesRoot, resolvedPath)) {
|
|
2200
2150
|
continue;
|
|
2201
2151
|
}
|
|
2202
2152
|
matches.push({ storage: candidateStorage, dir: candidateRoot, namespace: ns });
|
|
@@ -2224,12 +2174,9 @@ export class EngramAccessService {
|
|
|
2224
2174
|
* callers).
|
|
2225
2175
|
*/
|
|
2226
2176
|
lcmSessionIds?: string[];
|
|
2227
|
-
} | null
|
|
2177
|
+
} | null
|
|
2228
2178
|
): Promise<EngramAccessMemorySummary["rawExcerpts"] | null> {
|
|
2229
|
-
return this.accessRecallSurface.fetchRawExcerpts(
|
|
2230
|
-
disclosure,
|
|
2231
|
-
context,
|
|
2232
|
-
);
|
|
2179
|
+
return this.accessRecallSurface.fetchRawExcerpts(disclosure, context);
|
|
2233
2180
|
}
|
|
2234
2181
|
|
|
2235
2182
|
private async handleIdempotentWrite<T extends { idempotencyReplay?: boolean }>(options: {
|
|
@@ -2349,7 +2296,10 @@ export class EngramAccessService {
|
|
|
2349
2296
|
const current = new Promise<void>((resolve) => {
|
|
2350
2297
|
release = resolve;
|
|
2351
2298
|
});
|
|
2352
|
-
const queued = previous.then(
|
|
2299
|
+
const queued = previous.then(
|
|
2300
|
+
() => current,
|
|
2301
|
+
() => current
|
|
2302
|
+
);
|
|
2353
2303
|
this.idempotencyLocks.set(key, queued);
|
|
2354
2304
|
|
|
2355
2305
|
await previous.catch(() => {});
|
|
@@ -2378,7 +2328,7 @@ export class EngramAccessService {
|
|
|
2378
2328
|
const extraction = await computeExtractionLivenessStatus(
|
|
2379
2329
|
this.orchestrator,
|
|
2380
2330
|
extractionWatermark,
|
|
2381
|
-
caps?.namespaces !== undefined ? undefined : this.extractionLivenessWarn
|
|
2331
|
+
caps?.namespaces !== undefined ? undefined : this.extractionLivenessWarn
|
|
2382
2332
|
);
|
|
2383
2333
|
let scopedDegradedReason: string | null = null;
|
|
2384
2334
|
if (extraction.degraded) {
|
|
@@ -2403,7 +2353,9 @@ export class EngramAccessService {
|
|
|
2403
2353
|
// ONE call: the corpus array and the flag describing it must not come from
|
|
2404
2354
|
// two independently-cached scans (round 8, codex P1).
|
|
2405
2355
|
const corpusCensus = await computeServiceCorpusCensus(this.orchestrator, {
|
|
2406
|
-
cache: this.corpusWatermarkCache,
|
|
2356
|
+
cache: this.corpusWatermarkCache,
|
|
2357
|
+
caps,
|
|
2358
|
+
});
|
|
2407
2359
|
let projectionAvailable = false;
|
|
2408
2360
|
try {
|
|
2409
2361
|
await stat(getMemoryProjectionPath(storage.dir));
|
|
@@ -2423,7 +2375,7 @@ export class EngramAccessService {
|
|
|
2423
2375
|
searchBackend,
|
|
2424
2376
|
qmdEnabled,
|
|
2425
2377
|
resolvedNamespace,
|
|
2426
|
-
this.qmdCollectionForHealth(resolvedNamespace, storage.dir)
|
|
2378
|
+
this.qmdCollectionForHealth(resolvedNamespace, storage.dir)
|
|
2427
2379
|
),
|
|
2428
2380
|
nativeKnowledgeEnabled: this.orchestrator.config.nativeKnowledge?.enabled === true,
|
|
2429
2381
|
projectionAvailable,
|
|
@@ -2449,8 +2401,7 @@ export class EngramAccessService {
|
|
|
2449
2401
|
}
|
|
2450
2402
|
|
|
2451
2403
|
const useLegacyDefaultCollection =
|
|
2452
|
-
namespace === this.orchestrator.config.defaultNamespace &&
|
|
2453
|
-
storageDir === this.orchestrator.config.memoryDir;
|
|
2404
|
+
namespace === this.orchestrator.config.defaultNamespace && storageDir === this.orchestrator.config.memoryDir;
|
|
2454
2405
|
return namespaceCollectionName(this.orchestrator.config.qmdCollection, namespace, {
|
|
2455
2406
|
defaultNamespace: this.orchestrator.config.defaultNamespace,
|
|
2456
2407
|
useLegacyDefaultCollection,
|
|
@@ -2461,34 +2412,24 @@ export class EngramAccessService {
|
|
|
2461
2412
|
searchBackend: string,
|
|
2462
2413
|
qmdEnabled: boolean,
|
|
2463
2414
|
namespace: string,
|
|
2464
|
-
collection: string
|
|
2415
|
+
collection: string
|
|
2465
2416
|
): Promise<EngramAccessQmdHealthResponse> {
|
|
2466
|
-
return this.accessObserveWriteSurface.qmdHealth(
|
|
2467
|
-
searchBackend,
|
|
2468
|
-
qmdEnabled,
|
|
2469
|
-
namespace,
|
|
2470
|
-
collection,
|
|
2471
|
-
);
|
|
2417
|
+
return this.accessObserveWriteSurface.qmdHealth(searchBackend, qmdEnabled, namespace, collection);
|
|
2472
2418
|
}
|
|
2473
2419
|
|
|
2474
2420
|
private async namespaceQmdHealth(
|
|
2475
2421
|
searchBackend: string,
|
|
2476
2422
|
qmdEnabled: boolean,
|
|
2477
2423
|
namespace: string,
|
|
2478
|
-
fallbackCollection: string
|
|
2424
|
+
fallbackCollection: string
|
|
2479
2425
|
): Promise<EngramAccessQmdHealthResponse | null> {
|
|
2480
|
-
return this.accessObserveWriteSurface.namespaceQmdHealth(
|
|
2481
|
-
searchBackend,
|
|
2482
|
-
qmdEnabled,
|
|
2483
|
-
namespace,
|
|
2484
|
-
fallbackCollection,
|
|
2485
|
-
);
|
|
2426
|
+
return this.accessObserveWriteSurface.namespaceQmdHealth(searchBackend, qmdEnabled, namespace, fallbackCollection);
|
|
2486
2427
|
}
|
|
2487
2428
|
|
|
2488
2429
|
private async qmdCollectionState(
|
|
2489
2430
|
searchBackend: string,
|
|
2490
2431
|
qmdEnabled: boolean,
|
|
2491
|
-
collection: string
|
|
2432
|
+
collection: string
|
|
2492
2433
|
): Promise<EngramAccessQmdCollectionState> {
|
|
2493
2434
|
if (searchBackend !== "qmd" || !qmdEnabled) return "skipped";
|
|
2494
2435
|
const qmd = this.orchestrator.qmd;
|
|
@@ -2509,10 +2450,7 @@ export class EngramAccessService {
|
|
|
2509
2450
|
}
|
|
2510
2451
|
}
|
|
2511
2452
|
|
|
2512
|
-
private async qmdProbeAvailable(
|
|
2513
|
-
searchBackend: string,
|
|
2514
|
-
qmdEnabled: boolean,
|
|
2515
|
-
): Promise<boolean> {
|
|
2453
|
+
private async qmdProbeAvailable(searchBackend: string, qmdEnabled: boolean): Promise<boolean> {
|
|
2516
2454
|
if (searchBackend !== "qmd" || !qmdEnabled) return false;
|
|
2517
2455
|
const qmd = this.orchestrator.qmd;
|
|
2518
2456
|
if (!qmd) return false;
|
|
@@ -2543,14 +2481,12 @@ export class EngramAccessService {
|
|
|
2543
2481
|
}
|
|
2544
2482
|
|
|
2545
2483
|
async actionConfidence(
|
|
2546
|
-
request: EngramAccessActionConfidenceRequest = {}
|
|
2484
|
+
request: EngramAccessActionConfidenceRequest = {}
|
|
2547
2485
|
): Promise<EngramAccessActionConfidenceResponse> {
|
|
2548
2486
|
return evaluateActionConfidence(request);
|
|
2549
2487
|
}
|
|
2550
2488
|
|
|
2551
|
-
async daySummary(
|
|
2552
|
-
request: EngramAccessDaySummaryRequest,
|
|
2553
|
-
): Promise<import("./types.js").DaySummaryResult | null> {
|
|
2489
|
+
async daySummary(request: EngramAccessDaySummaryRequest): Promise<import("./types.js").DaySummaryResult | null> {
|
|
2554
2490
|
if (!resolveRecallAuxiliaryCapabilities(this.orchestrator.config).daySummary) {
|
|
2555
2491
|
throw new EngramAccessInputError("day summary is disabled");
|
|
2556
2492
|
}
|
|
@@ -2567,12 +2503,8 @@ export class EngramAccessService {
|
|
|
2567
2503
|
return this.orchestrator.generateDaySummary(memories);
|
|
2568
2504
|
}
|
|
2569
2505
|
|
|
2570
|
-
async briefing(
|
|
2571
|
-
request
|
|
2572
|
-
): Promise<EngramAccessBriefingResponse> {
|
|
2573
|
-
return this.accessObserveWriteSurface.briefing(
|
|
2574
|
-
request,
|
|
2575
|
-
);
|
|
2506
|
+
async briefing(request: EngramAccessBriefingRequest): Promise<EngramAccessBriefingResponse> {
|
|
2507
|
+
return this.accessObserveWriteSurface.briefing(request);
|
|
2576
2508
|
}
|
|
2577
2509
|
|
|
2578
2510
|
/**
|
|
@@ -2637,7 +2569,7 @@ export class EngramAccessService {
|
|
|
2637
2569
|
*/
|
|
2638
2570
|
private async maybeAttachCodingContext(
|
|
2639
2571
|
sessionKey: string | undefined,
|
|
2640
|
-
options: { cwd?: string; projectTag?: string }
|
|
2572
|
+
options: { cwd?: string; projectTag?: string }
|
|
2641
2573
|
): Promise<void> {
|
|
2642
2574
|
if (!sessionKey) return;
|
|
2643
2575
|
// Respect the configuration gate (CLAUDE.md #30).
|
|
@@ -2689,10 +2621,9 @@ export class EngramAccessService {
|
|
|
2689
2621
|
* later bare recalls miss (Codex review).
|
|
2690
2622
|
*/
|
|
2691
2623
|
private async attachCodingContextAfterScopedWrite(
|
|
2692
|
-
request: CodingScopedWriteInput & { namespace?: string; sessionKey?: string }
|
|
2624
|
+
request: CodingScopedWriteInput & { namespace?: string; sessionKey?: string }
|
|
2693
2625
|
): Promise<void> {
|
|
2694
|
-
const hasExplicitNamespace =
|
|
2695
|
-
typeof request.namespace === "string" && request.namespace.trim().length > 0;
|
|
2626
|
+
const hasExplicitNamespace = typeof request.namespace === "string" && request.namespace.trim().length > 0;
|
|
2696
2627
|
if (hasExplicitNamespace) return;
|
|
2697
2628
|
await this.maybeAttachCodingContext(request.sessionKey, {
|
|
2698
2629
|
cwd: request.cwd,
|
|
@@ -2710,9 +2641,7 @@ export class EngramAccessService {
|
|
|
2710
2641
|
const authenticatedPrincipal = request.authenticatedPrincipal?.trim();
|
|
2711
2642
|
const principal = this.resolveRequestPrincipal(request.sessionKey, authenticatedPrincipal);
|
|
2712
2643
|
if (resolveNamespaceCapabilities(this.orchestrator.config).namespaces && !principal) {
|
|
2713
|
-
throw new EngramAccessInputError(
|
|
2714
|
-
"authentication required: namespaces are enabled and no principal was supplied",
|
|
2715
|
-
);
|
|
2644
|
+
throw new EngramAccessInputError("authentication required: namespaces are enabled and no principal was supplied");
|
|
2716
2645
|
}
|
|
2717
2646
|
const principalKey = principal ?? "default";
|
|
2718
2647
|
// Single-flight gate resolved through the shared access-setup capability
|
|
@@ -2724,66 +2653,49 @@ export class EngramAccessService {
|
|
|
2724
2653
|
normalizedRequest,
|
|
2725
2654
|
requestFingerprint,
|
|
2726
2655
|
principalKey,
|
|
2727
|
-
singleFlight
|
|
2656
|
+
singleFlight
|
|
2728
2657
|
);
|
|
2729
2658
|
}
|
|
2730
2659
|
|
|
2731
|
-
private async executeRecall(
|
|
2732
|
-
request
|
|
2733
|
-
): Promise<RecallExecResult> {
|
|
2734
|
-
return this.accessRecallSurface.executeRecall(
|
|
2735
|
-
request,
|
|
2736
|
-
);
|
|
2660
|
+
private async executeRecall(request: EngramAccessRecallRequest): Promise<RecallExecResult> {
|
|
2661
|
+
return this.accessRecallSurface.executeRecall(request);
|
|
2737
2662
|
}
|
|
2738
2663
|
|
|
2739
|
-
async recallExplain(
|
|
2740
|
-
|
|
2741
|
-
): Promise<EngramAccessRecallExplainResponse> {
|
|
2742
|
-
const requestedNamespace = request.namespace?.trim()
|
|
2743
|
-
? this.resolveNamespace(request.namespace)
|
|
2744
|
-
: undefined;
|
|
2664
|
+
async recallExplain(request: EngramAccessRecallExplainRequest = {}): Promise<EngramAccessRecallExplainResponse> {
|
|
2665
|
+
const requestedNamespace = request.namespace?.trim() ? this.resolveNamespace(request.namespace) : undefined;
|
|
2745
2666
|
const authenticatedPrincipal = request.authenticatedPrincipal?.trim();
|
|
2746
|
-
const principal =
|
|
2747
|
-
authenticatedPrincipal
|
|
2748
|
-
|| resolvePrincipal(request.sessionKey, this.orchestrator.config);
|
|
2667
|
+
const principal = authenticatedPrincipal || resolvePrincipal(request.sessionKey, this.orchestrator.config);
|
|
2749
2668
|
if (requestedNamespace) {
|
|
2750
2669
|
if (!canReadNamespace(principal, requestedNamespace, this.orchestrator.config)) {
|
|
2751
2670
|
return { found: false };
|
|
2752
2671
|
}
|
|
2753
|
-
} else if (
|
|
2754
|
-
resolveNamespaceCapabilities(this.orchestrator.config).namespaces
|
|
2755
|
-
&& !principal
|
|
2756
|
-
) {
|
|
2672
|
+
} else if (resolveNamespaceCapabilities(this.orchestrator.config).namespaces && !principal) {
|
|
2757
2673
|
return { found: false };
|
|
2758
2674
|
}
|
|
2759
2675
|
const snapshot = request.sessionKey
|
|
2760
2676
|
? (() => {
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2677
|
+
const candidate = this.orchestrator.lastRecall.get(request.sessionKey);
|
|
2678
|
+
if (!candidate) return null;
|
|
2679
|
+
if (!requestedNamespace) return candidate;
|
|
2680
|
+
return candidate.namespace === requestedNamespace ? candidate : null;
|
|
2681
|
+
})()
|
|
2766
2682
|
: (() => {
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2683
|
+
const candidate = this.orchestrator.lastRecall.getMostRecent();
|
|
2684
|
+
if (!candidate) return null;
|
|
2685
|
+
if (!requestedNamespace) return candidate;
|
|
2686
|
+
return candidate.namespace === requestedNamespace ? candidate : null;
|
|
2687
|
+
})();
|
|
2772
2688
|
const readableSnapshot = (() => {
|
|
2773
2689
|
if (!snapshot || !resolveNamespaceCapabilities(this.orchestrator.config).namespaces) return snapshot;
|
|
2774
2690
|
const snapshotNamespace = snapshot.namespace ?? this.orchestrator.config.defaultNamespace;
|
|
2775
|
-
return canReadNamespace(principal, snapshotNamespace, this.orchestrator.config)
|
|
2776
|
-
? snapshot
|
|
2777
|
-
: null;
|
|
2691
|
+
return canReadNamespace(principal, snapshotNamespace, this.orchestrator.config) ? snapshot : null;
|
|
2778
2692
|
})();
|
|
2779
2693
|
const namespace = (() => {
|
|
2780
2694
|
if (requestedNamespace) return requestedNamespace;
|
|
2781
2695
|
if (readableSnapshot?.namespace) return readableSnapshot.namespace;
|
|
2782
2696
|
const fallbackNamespace = this.orchestrator.config.defaultNamespace;
|
|
2783
2697
|
if (!resolveNamespaceCapabilities(this.orchestrator.config).namespaces) return fallbackNamespace;
|
|
2784
|
-
return canReadNamespace(principal, fallbackNamespace, this.orchestrator.config)
|
|
2785
|
-
? fallbackNamespace
|
|
2786
|
-
: null;
|
|
2698
|
+
return canReadNamespace(principal, fallbackNamespace, this.orchestrator.config) ? fallbackNamespace : null;
|
|
2787
2699
|
})();
|
|
2788
2700
|
if (!namespace) return { found: false };
|
|
2789
2701
|
const [intent, graph] = await Promise.all([
|
|
@@ -2794,17 +2706,10 @@ export class EngramAccessService {
|
|
|
2794
2706
|
return { found: true, snapshot: readableSnapshot ?? undefined, intent, graph };
|
|
2795
2707
|
}
|
|
2796
2708
|
|
|
2797
|
-
async recallTierExplain(
|
|
2798
|
-
sessionKey?: string,
|
|
2799
|
-
namespace?: string,
|
|
2800
|
-
authenticatedPrincipal?: string,
|
|
2801
|
-
) {
|
|
2709
|
+
async recallTierExplain(sessionKey?: string, namespace?: string, authenticatedPrincipal?: string) {
|
|
2802
2710
|
const namespacesEnabled = resolveNamespaceCapabilities(this.orchestrator.config).namespaces;
|
|
2803
|
-
const requestedNamespace = namespace?.trim()
|
|
2804
|
-
|
|
2805
|
-
: undefined;
|
|
2806
|
-
const principal = authenticatedPrincipal?.trim()
|
|
2807
|
-
|| resolvePrincipal(sessionKey, this.orchestrator.config);
|
|
2711
|
+
const requestedNamespace = namespace?.trim() ? this.resolveNamespace(namespace) : undefined;
|
|
2712
|
+
const principal = authenticatedPrincipal?.trim() || resolvePrincipal(sessionKey, this.orchestrator.config);
|
|
2808
2713
|
|
|
2809
2714
|
if (requestedNamespace) {
|
|
2810
2715
|
if (!canReadNamespace(principal, requestedNamespace, this.orchestrator.config)) {
|
|
@@ -2824,11 +2729,8 @@ export class EngramAccessService {
|
|
|
2824
2729
|
return candidate.namespace === requestedNamespace ? candidate : null;
|
|
2825
2730
|
}
|
|
2826
2731
|
if (!namespacesEnabled) return candidate;
|
|
2827
|
-
const snapshotNs = candidate.namespace
|
|
2828
|
-
|
|
2829
|
-
return canReadNamespace(principal, snapshotNs, this.orchestrator.config)
|
|
2830
|
-
? candidate
|
|
2831
|
-
: null;
|
|
2732
|
+
const snapshotNs = candidate.namespace ?? this.orchestrator.config.defaultNamespace;
|
|
2733
|
+
return canReadNamespace(principal, snapshotNs, this.orchestrator.config) ? candidate : null;
|
|
2832
2734
|
})();
|
|
2833
2735
|
|
|
2834
2736
|
return toRecallExplainJson(snapshot);
|
|
@@ -2881,18 +2783,13 @@ export class EngramAccessService {
|
|
|
2881
2783
|
snapshot?: RecallXraySnapshot;
|
|
2882
2784
|
recall?: EngramAccessRecallResponse;
|
|
2883
2785
|
}> {
|
|
2884
|
-
return this.accessRecallSurface.recallXray(
|
|
2885
|
-
request,
|
|
2886
|
-
);
|
|
2786
|
+
return this.accessRecallSurface.recallXray(request);
|
|
2887
2787
|
}
|
|
2888
2788
|
async memoryStore(
|
|
2889
2789
|
request: EngramAccessMemoryStoreRequest,
|
|
2890
|
-
hooks?: { enforceWriteQuota?: () => void | Promise<void> }
|
|
2790
|
+
hooks?: { enforceWriteQuota?: () => void | Promise<void> }
|
|
2891
2791
|
): Promise<EngramAccessWriteResponse> {
|
|
2892
|
-
return this.accessObserveWriteSurface.memoryStore(
|
|
2893
|
-
request,
|
|
2894
|
-
hooks,
|
|
2895
|
-
);
|
|
2792
|
+
return this.accessObserveWriteSurface.memoryStore(request, hooks);
|
|
2896
2793
|
}
|
|
2897
2794
|
|
|
2898
2795
|
async peekMemoryStoreIdempotency(request: EngramAccessMemoryStoreRequest): Promise<EngramAccessIdempotencyStatus> {
|
|
@@ -2924,16 +2821,13 @@ export class EngramAccessService {
|
|
|
2924
2821
|
|
|
2925
2822
|
async suggestionSubmit(
|
|
2926
2823
|
request: EngramAccessSuggestionSubmitRequest,
|
|
2927
|
-
hooks?: { enforceWriteQuota?: () => void | Promise<void> }
|
|
2824
|
+
hooks?: { enforceWriteQuota?: () => void | Promise<void> }
|
|
2928
2825
|
): Promise<EngramAccessWriteResponse> {
|
|
2929
|
-
return this.accessObserveWriteSurface.suggestionSubmit(
|
|
2930
|
-
request,
|
|
2931
|
-
hooks,
|
|
2932
|
-
);
|
|
2826
|
+
return this.accessObserveWriteSurface.suggestionSubmit(request, hooks);
|
|
2933
2827
|
}
|
|
2934
2828
|
|
|
2935
2829
|
async peekSuggestionSubmitIdempotency(
|
|
2936
|
-
request: EngramAccessSuggestionSubmitRequest
|
|
2830
|
+
request: EngramAccessSuggestionSubmitRequest
|
|
2937
2831
|
): Promise<EngramAccessIdempotencyStatus> {
|
|
2938
2832
|
const namespace = await this.resolveCodingScopedWriteNamespace(request);
|
|
2939
2833
|
const schemaVersion = request.schemaVersion ?? ENGRAM_ACCESS_WRITE_SCHEMA_VERSION;
|
|
@@ -2963,7 +2857,7 @@ export class EngramAccessService {
|
|
|
2963
2857
|
|
|
2964
2858
|
private validateWriteCandidate(
|
|
2965
2859
|
request: EngramAccessMemoryStoreRequest | EngramAccessSuggestionSubmitRequest,
|
|
2966
|
-
namespace: string
|
|
2860
|
+
namespace: string
|
|
2967
2861
|
): ValidExplicitCapture {
|
|
2968
2862
|
try {
|
|
2969
2863
|
return {
|
|
@@ -2972,7 +2866,7 @@ export class EngramAccessService {
|
|
|
2972
2866
|
...request,
|
|
2973
2867
|
namespace,
|
|
2974
2868
|
},
|
|
2975
|
-
"legacy_tool"
|
|
2869
|
+
"legacy_tool"
|
|
2976
2870
|
),
|
|
2977
2871
|
// The namespace was resolved AND authorized by
|
|
2978
2872
|
// resolveCodingScopedWriteNamespace (explicit namespaces via
|
|
@@ -2991,7 +2885,7 @@ export class EngramAccessService {
|
|
|
2991
2885
|
memoryId: string,
|
|
2992
2886
|
namespace?: string,
|
|
2993
2887
|
principal?: string,
|
|
2994
|
-
sessionKey?: string
|
|
2888
|
+
sessionKey?: string
|
|
2995
2889
|
): Promise<EngramAccessMemoryResponse> {
|
|
2996
2890
|
// Issue #1582 — accept a `[m:xxxx]` handle in place of a memory id; resolve
|
|
2997
2891
|
// it against the caller's session via the shared helper (rule 22). A raw id
|
|
@@ -3000,9 +2894,7 @@ export class EngramAccessService {
|
|
|
3000
2894
|
const resolvedNamespace = this.resolveReadableNamespace(namespace, principal);
|
|
3001
2895
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
3002
2896
|
const memory = await storage.getMemoryById(resolvedId);
|
|
3003
|
-
if (!memory) {
|
|
3004
|
-
return { found: false, namespace: resolvedNamespace };
|
|
3005
|
-
}
|
|
2897
|
+
if (!memory || isSupportPassportPrivateMemory(memory)) return { found: false, namespace: resolvedNamespace };
|
|
3006
2898
|
return {
|
|
3007
2899
|
found: true,
|
|
3008
2900
|
namespace: resolvedNamespace,
|
|
@@ -3020,7 +2912,7 @@ export class EngramAccessService {
|
|
|
3020
2912
|
async codegraphTool(
|
|
3021
2913
|
request: CodegraphSurfaceRequest,
|
|
3022
2914
|
authenticatedPrincipal?: string,
|
|
3023
|
-
sourceConnector?: string
|
|
2915
|
+
sourceConnector?: string
|
|
3024
2916
|
): Promise<CodegraphSurfaceResponse> {
|
|
3025
2917
|
const principal = authenticatedPrincipal ?? "default";
|
|
3026
2918
|
const memoryDir = this.orchestrator.config.memoryDir;
|
|
@@ -3072,8 +2964,10 @@ export class EngramAccessService {
|
|
|
3072
2964
|
|
|
3073
2965
|
/** Whether the coding_decision tool should appear in tools/list (rule 39). */
|
|
3074
2966
|
get decisionRecordSurfaceVisible(): boolean {
|
|
3075
|
-
return
|
|
3076
|
-
|
|
2967
|
+
return (
|
|
2968
|
+
this.orchestrator.config.codingKnowledge?.enabled === true &&
|
|
2969
|
+
this.orchestrator.config.codingKnowledge?.decisionRecords === true
|
|
2970
|
+
);
|
|
3077
2971
|
}
|
|
3078
2972
|
/**
|
|
3079
2973
|
* Thin delegate — handler logic in coding/decision-surfaces.ts (#1548 PR2).
|
|
@@ -3085,7 +2979,7 @@ export class EngramAccessService {
|
|
|
3085
2979
|
async codingDecision(
|
|
3086
2980
|
request: DecisionSurfaceRequest,
|
|
3087
2981
|
authenticatedPrincipal?: string,
|
|
3088
|
-
sourceConnector?: string
|
|
2982
|
+
sourceConnector?: string
|
|
3089
2983
|
): Promise<DecisionSurfaceResponse> {
|
|
3090
2984
|
return handleCodingDecision(request, {
|
|
3091
2985
|
codingKnowledge: this.orchestrator.config.codingKnowledge,
|
|
@@ -3098,23 +2992,27 @@ export class EngramAccessService {
|
|
|
3098
2992
|
sessionKey: req.sessionKey,
|
|
3099
2993
|
authenticatedPrincipal,
|
|
3100
2994
|
})
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
2995
|
+
: await this.resolveCodingScopedReadableNamespace({
|
|
2996
|
+
namespace: req.namespace,
|
|
2997
|
+
sessionKey: req.sessionKey,
|
|
2998
|
+
authenticatedPrincipal,
|
|
2999
|
+
});
|
|
3106
3000
|
const storage = await this.orchestrator.getStorage(ns);
|
|
3107
3001
|
return Object.assign(storage, { namespace: ns });
|
|
3108
3002
|
},
|
|
3109
|
-
throwInputError: (msg) => {
|
|
3003
|
+
throwInputError: (msg) => {
|
|
3004
|
+
throw new EngramAccessInputError(msg);
|
|
3005
|
+
},
|
|
3110
3006
|
sourceConnector,
|
|
3111
3007
|
});
|
|
3112
3008
|
}
|
|
3113
3009
|
|
|
3114
3010
|
/** Whether the coding_architecture tool should appear in tools/list (rule 39). */
|
|
3115
3011
|
get architectureCardSurfaceVisible(): boolean {
|
|
3116
|
-
return
|
|
3117
|
-
|
|
3012
|
+
return (
|
|
3013
|
+
this.orchestrator.config.codingKnowledge?.enabled === true &&
|
|
3014
|
+
this.orchestrator.config.codingKnowledge?.architectureCard === true
|
|
3015
|
+
);
|
|
3118
3016
|
}
|
|
3119
3017
|
|
|
3120
3018
|
/**
|
|
@@ -3133,7 +3031,7 @@ export class EngramAccessService {
|
|
|
3133
3031
|
async codingArchitecture(
|
|
3134
3032
|
request: ArchitectureSurfaceRequest,
|
|
3135
3033
|
authenticatedPrincipal?: string,
|
|
3136
|
-
sourceConnector?: string
|
|
3034
|
+
sourceConnector?: string
|
|
3137
3035
|
): Promise<ArchitectureSurfaceResponse> {
|
|
3138
3036
|
const resolvedConfig = this.orchestrator.config;
|
|
3139
3037
|
return handleCodingArchitecture(request, {
|
|
@@ -3147,35 +3045,40 @@ export class EngramAccessService {
|
|
|
3147
3045
|
sessionKey: req.sessionKey,
|
|
3148
3046
|
authenticatedPrincipal,
|
|
3149
3047
|
})
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3048
|
+
: await this.resolveCodingScopedReadableNamespace({
|
|
3049
|
+
namespace: req.namespace,
|
|
3050
|
+
sessionKey: req.sessionKey,
|
|
3051
|
+
authenticatedPrincipal,
|
|
3052
|
+
});
|
|
3155
3053
|
const storage = await this.orchestrator.getStorage(ns);
|
|
3156
3054
|
return Object.assign(storage, { namespace: ns }) as ArchitectureSurfaceStorage;
|
|
3157
3055
|
},
|
|
3158
|
-
buildCard: async (repoRoot) =>
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3056
|
+
buildCard: async (repoRoot) =>
|
|
3057
|
+
buildArchitectureCard(repoRoot, {
|
|
3058
|
+
llmSummary: this.orchestrator.config.codingKnowledge?.architectureCardLlmSummary === true,
|
|
3059
|
+
summariser: createArchitectureCardSummariser(this.fallbackLlmRef ?? this.localLlmRef),
|
|
3060
|
+
}),
|
|
3162
3061
|
versioning: createArchitectureVersioningHook(
|
|
3163
3062
|
resolvedConfig.versioningEnabled === true,
|
|
3164
3063
|
resolvedConfig.versioningMaxPerPage,
|
|
3165
3064
|
resolvedConfig.versioningSidecarDir,
|
|
3166
3065
|
resolvedConfig.memoryDir,
|
|
3167
3066
|
(p) => nodeFs.readFile(p, "utf-8"),
|
|
3168
|
-
createVersion
|
|
3067
|
+
createVersion
|
|
3169
3068
|
),
|
|
3170
|
-
throwInputError: (msg) => {
|
|
3069
|
+
throwInputError: (msg) => {
|
|
3070
|
+
throw new EngramAccessInputError(msg);
|
|
3071
|
+
},
|
|
3171
3072
|
sourceConnector,
|
|
3172
3073
|
});
|
|
3173
3074
|
}
|
|
3174
3075
|
|
|
3175
3076
|
/** Whether the coding_delta tool should appear in tools/list (rule 39). */
|
|
3176
3077
|
get sessionDeltaSurfaceVisible(): boolean {
|
|
3177
|
-
return
|
|
3178
|
-
|
|
3078
|
+
return (
|
|
3079
|
+
this.orchestrator.config.codingKnowledge?.enabled === true &&
|
|
3080
|
+
this.orchestrator.config.codingKnowledge?.sessionDelta === true
|
|
3081
|
+
);
|
|
3179
3082
|
}
|
|
3180
3083
|
/**
|
|
3181
3084
|
* Thin delegate — handler logic in coding/session-delta-surfaces.ts (#1548 PR4).
|
|
@@ -3184,10 +3087,7 @@ export class EngramAccessService {
|
|
|
3184
3087
|
* coding surfaces; the delta state file lives under
|
|
3185
3088
|
* `<memoryDir>/state/coding-knowledge/<namespace>.json`.
|
|
3186
3089
|
*/
|
|
3187
|
-
async codingDelta(
|
|
3188
|
-
request: DeltaSurfaceRequest,
|
|
3189
|
-
authenticatedPrincipal?: string,
|
|
3190
|
-
): Promise<DeltaSurfaceResponse> {
|
|
3090
|
+
async codingDelta(request: DeltaSurfaceRequest, authenticatedPrincipal?: string): Promise<DeltaSurfaceResponse> {
|
|
3191
3091
|
return handleCodingDelta(request, {
|
|
3192
3092
|
codingKnowledge: this.orchestrator.config.codingKnowledge,
|
|
3193
3093
|
getCodingContext: (sk) => this.orchestrator.getCodingContextForSession(sk),
|
|
@@ -3230,7 +3130,9 @@ export class EngramAccessService {
|
|
|
3230
3130
|
// bounded synchronous invoker rather than the abortable scope resolver.
|
|
3231
3131
|
return defaultGitInvokerSync()(cwd, args);
|
|
3232
3132
|
},
|
|
3233
|
-
throwInputError: (msg) => {
|
|
3133
|
+
throwInputError: (msg) => {
|
|
3134
|
+
throw new EngramAccessInputError(msg);
|
|
3135
|
+
},
|
|
3234
3136
|
});
|
|
3235
3137
|
}
|
|
3236
3138
|
|
|
@@ -3279,7 +3181,7 @@ export class EngramAccessService {
|
|
|
3279
3181
|
{ role: "system", content: system },
|
|
3280
3182
|
{ role: "user", content: user },
|
|
3281
3183
|
],
|
|
3282
|
-
{ operation: "correction-classify", priority: "background" }
|
|
3184
|
+
{ operation: "correction-classify", priority: "background" }
|
|
3283
3185
|
);
|
|
3284
3186
|
if (!result) {
|
|
3285
3187
|
throw new Error("correction classify+draft: local LLM unavailable (disabled or in cooldown)");
|
|
@@ -3298,28 +3200,18 @@ export class EngramAccessService {
|
|
|
3298
3200
|
* handle that misses or is ambiguous becomes an EngramAccessInputError so the
|
|
3299
3201
|
* boundary maps it to a 400 (rule 34/51 — list candidates, never guess).
|
|
3300
3202
|
*/
|
|
3301
|
-
private resolveMemoryIdOrHandleInput(
|
|
3302
|
-
ref: string,
|
|
3303
|
-
sessionKey: string | undefined,
|
|
3304
|
-
): string {
|
|
3203
|
+
private resolveMemoryIdOrHandleInput(ref: string, sessionKey: string | undefined): string {
|
|
3305
3204
|
if (!isHandleToken(ref)) return ref;
|
|
3306
3205
|
try {
|
|
3307
3206
|
return this.orchestrator.resolveMemoryIdOrHandle(ref, sessionKey);
|
|
3308
3207
|
} catch (err) {
|
|
3309
|
-
throw new EngramAccessInputError(
|
|
3310
|
-
err instanceof Error ? err.message : String(err),
|
|
3311
|
-
);
|
|
3208
|
+
throw new EngramAccessInputError(err instanceof Error ? err.message : String(err));
|
|
3312
3209
|
}
|
|
3313
3210
|
}
|
|
3314
3211
|
|
|
3315
|
-
async correctionPlan(
|
|
3316
|
-
request: CorrectionRequest,
|
|
3317
|
-
opts?: { abortSignal?: AbortSignal },
|
|
3318
|
-
): Promise<CorrectionPlan> {
|
|
3212
|
+
async correctionPlan(request: CorrectionRequest, opts?: { abortSignal?: AbortSignal }): Promise<CorrectionPlan> {
|
|
3319
3213
|
if (request.targetIds?.some((id) => isHandleToken(id))) {
|
|
3320
|
-
const targetIds = request.targetIds.map((id) =>
|
|
3321
|
-
this.resolveMemoryIdOrHandleInput(id, request.sessionKey),
|
|
3322
|
-
);
|
|
3214
|
+
const targetIds = request.targetIds.map((id) => this.resolveMemoryIdOrHandleInput(id, request.sessionKey));
|
|
3323
3215
|
return this.correctionService().plan({ ...request, targetIds }, opts);
|
|
3324
3216
|
}
|
|
3325
3217
|
return this.correctionService().plan(request, opts);
|
|
@@ -3333,7 +3225,7 @@ export class EngramAccessService {
|
|
|
3333
3225
|
sessionKey?: string;
|
|
3334
3226
|
principal?: string;
|
|
3335
3227
|
abortSignal?: AbortSignal;
|
|
3336
|
-
}
|
|
3228
|
+
}
|
|
3337
3229
|
): Promise<CorrectionOutcome> {
|
|
3338
3230
|
return this.correctionService().apply(planId, opts);
|
|
3339
3231
|
}
|
|
@@ -3348,18 +3240,13 @@ export class EngramAccessService {
|
|
|
3348
3240
|
|
|
3349
3241
|
async correctionDiscard(
|
|
3350
3242
|
planId: string,
|
|
3351
|
-
opts: { namespace?: string; sessionKey?: string; principal?: string }
|
|
3243
|
+
opts: { namespace?: string; sessionKey?: string; principal?: string }
|
|
3352
3244
|
): Promise<void> {
|
|
3353
3245
|
return this.correctionService().discard(planId, opts);
|
|
3354
3246
|
}
|
|
3355
3247
|
|
|
3356
|
-
async memoryBrowse(
|
|
3357
|
-
|
|
3358
|
-
): Promise<EngramAccessMemoryBrowseResponse> {
|
|
3359
|
-
const resolvedNamespace = this.resolveReadableNamespace(
|
|
3360
|
-
request.namespace,
|
|
3361
|
-
request.authenticatedPrincipal,
|
|
3362
|
-
);
|
|
3248
|
+
async memoryBrowse(request: EngramAccessMemoryBrowseRequest = {}): Promise<EngramAccessMemoryBrowseResponse> {
|
|
3249
|
+
const resolvedNamespace = this.resolveReadableNamespace(request.namespace, request.authenticatedPrincipal);
|
|
3363
3250
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
3364
3251
|
const { limit, offset } = normalizePagination(request.limit, request.offset);
|
|
3365
3252
|
const sort = normalizeBrowseSort(request.sort);
|
|
@@ -3371,6 +3258,7 @@ export class EngramAccessService {
|
|
|
3371
3258
|
query,
|
|
3372
3259
|
status: statusFilter,
|
|
3373
3260
|
category: categoryFilter,
|
|
3261
|
+
excludePrivateRecords: true,
|
|
3374
3262
|
sort,
|
|
3375
3263
|
limit,
|
|
3376
3264
|
offset,
|
|
@@ -3387,8 +3275,9 @@ export class EngramAccessService {
|
|
|
3387
3275
|
};
|
|
3388
3276
|
}
|
|
3389
3277
|
|
|
3390
|
-
let memories = [...await storage.readAllMemories(), ...await storage.readArchivedMemories()];
|
|
3278
|
+
let memories = [...(await storage.readAllMemories()), ...(await storage.readArchivedMemories())];
|
|
3391
3279
|
memories = memories.filter((memory) => {
|
|
3280
|
+
if (isSupportPassportPrivateMemory(memory)) return false;
|
|
3392
3281
|
const status = inferMemoryStatus(memory.frontmatter, toMemoryPathRel(storage.dir, memory.path)).toLowerCase();
|
|
3393
3282
|
if (statusFilter && status !== statusFilter) return false;
|
|
3394
3283
|
if (categoryFilter && memory.frontmatter.category.toLowerCase() !== categoryFilter) return false;
|
|
@@ -3399,7 +3288,9 @@ export class EngramAccessService {
|
|
|
3399
3288
|
memory.content,
|
|
3400
3289
|
memory.frontmatter.entityRef ?? "",
|
|
3401
3290
|
...memory.frontmatter.tags,
|
|
3402
|
-
]
|
|
3291
|
+
]
|
|
3292
|
+
.join("\n")
|
|
3293
|
+
.toLowerCase();
|
|
3403
3294
|
return haystack.includes(query);
|
|
3404
3295
|
});
|
|
3405
3296
|
|
|
@@ -3422,11 +3313,13 @@ export class EngramAccessService {
|
|
|
3422
3313
|
async memoryTimeline(
|
|
3423
3314
|
memoryId: string,
|
|
3424
3315
|
namespace?: string,
|
|
3425
|
-
limit
|
|
3426
|
-
principal?: string
|
|
3316
|
+
limit = 200,
|
|
3317
|
+
principal?: string
|
|
3427
3318
|
): Promise<EngramAccessTimelineResponse> {
|
|
3428
3319
|
const resolvedNamespace = this.resolveReadableNamespace(namespace, principal);
|
|
3429
3320
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
3321
|
+
const memory = await storage.getMemoryByIdIncludingArchived(memoryId);
|
|
3322
|
+
if (!memory || isSupportPassportPrivateMemory(memory)) return { found: false, namespace: resolvedNamespace, count: 0, timeline: [] };
|
|
3430
3323
|
const timeline = await storage.getMemoryTimeline(memoryId, limit);
|
|
3431
3324
|
return {
|
|
3432
3325
|
found: timeline.length > 0,
|
|
@@ -3436,12 +3329,14 @@ export class EngramAccessService {
|
|
|
3436
3329
|
};
|
|
3437
3330
|
}
|
|
3438
3331
|
|
|
3439
|
-
async entityList(
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3332
|
+
async entityList(
|
|
3333
|
+
options: {
|
|
3334
|
+
namespace?: string;
|
|
3335
|
+
query?: string;
|
|
3336
|
+
limit?: number;
|
|
3337
|
+
offset?: number;
|
|
3338
|
+
} = {}
|
|
3339
|
+
): Promise<EngramAccessEntityListResponse> {
|
|
3445
3340
|
const storage = await this.orchestrator.getStorage(options.namespace);
|
|
3446
3341
|
const resolvedNamespace = options.namespace?.trim() || this.orchestrator.config.defaultNamespace;
|
|
3447
3342
|
const { limit, offset } = normalizePagination(options.limit, options.offset);
|
|
@@ -3461,7 +3356,9 @@ export class EngramAccessService {
|
|
|
3461
3356
|
...entity.aliases,
|
|
3462
3357
|
...entity.facts,
|
|
3463
3358
|
...(entity.structuredSections ?? []).flatMap((section) => [section.title, ...section.facts]),
|
|
3464
|
-
]
|
|
3359
|
+
]
|
|
3360
|
+
.join("\n")
|
|
3361
|
+
.toLowerCase();
|
|
3465
3362
|
if (!haystack.includes(query)) continue;
|
|
3466
3363
|
}
|
|
3467
3364
|
entities.push({
|
|
@@ -3498,11 +3395,7 @@ export class EngramAccessService {
|
|
|
3498
3395
|
}
|
|
3499
3396
|
|
|
3500
3397
|
async reviewQueue(runId?: string, namespace?: string, principal?: string): Promise<EngramAccessReviewQueueResponse> {
|
|
3501
|
-
return this.accessAdminOpsSurface.reviewQueue(
|
|
3502
|
-
runId,
|
|
3503
|
-
namespace,
|
|
3504
|
-
principal,
|
|
3505
|
-
);
|
|
3398
|
+
return this.accessAdminOpsSurface.reviewQueue(runId, namespace, principal);
|
|
3506
3399
|
}
|
|
3507
3400
|
|
|
3508
3401
|
async maintenance(namespace?: string, principal?: string): Promise<EngramAccessMaintenanceResponse> {
|
|
@@ -3526,7 +3419,7 @@ export class EngramAccessService {
|
|
|
3526
3419
|
let staleActive = 0;
|
|
3527
3420
|
let lowConfidenceActive = 0;
|
|
3528
3421
|
|
|
3529
|
-
const memories = [...await storage.readAllMemories(), ...await storage.readArchivedMemories()];
|
|
3422
|
+
const memories = [...(await storage.readAllMemories()), ...(await storage.readArchivedMemories())];
|
|
3530
3423
|
for (const memory of memories) {
|
|
3531
3424
|
const status = inferMemoryStatus(memory.frontmatter, toMemoryPathRel(storage.dir, memory.path)).toLowerCase();
|
|
3532
3425
|
const confidenceTier = memory.frontmatter.confidenceTier ?? "unknown";
|
|
@@ -3575,7 +3468,7 @@ export class EngramAccessService {
|
|
|
3575
3468
|
batchSize?: number;
|
|
3576
3469
|
authenticatedPrincipal?: string;
|
|
3577
3470
|
},
|
|
3578
|
-
principal?: string
|
|
3471
|
+
principal?: string
|
|
3579
3472
|
): Promise<{
|
|
3580
3473
|
namespace: string;
|
|
3581
3474
|
runId: string;
|
|
@@ -3587,10 +3480,7 @@ export class EngramAccessService {
|
|
|
3587
3480
|
summaryPath: string;
|
|
3588
3481
|
reportPath: string;
|
|
3589
3482
|
}> {
|
|
3590
|
-
return this.accessAdminOpsSurface.governanceRun(
|
|
3591
|
-
request,
|
|
3592
|
-
principal,
|
|
3593
|
-
);
|
|
3483
|
+
return this.accessAdminOpsSurface.governanceRun(request, principal);
|
|
3594
3484
|
}
|
|
3595
3485
|
|
|
3596
3486
|
async entitySynthesisRun(
|
|
@@ -3599,7 +3489,7 @@ export class EngramAccessService {
|
|
|
3599
3489
|
maxEntities?: number;
|
|
3600
3490
|
authenticatedPrincipal?: string;
|
|
3601
3491
|
},
|
|
3602
|
-
principal?: string
|
|
3492
|
+
principal?: string
|
|
3603
3493
|
): Promise<{
|
|
3604
3494
|
namespace: string;
|
|
3605
3495
|
requested: number;
|
|
@@ -3614,7 +3504,7 @@ export class EngramAccessService {
|
|
|
3614
3504
|
namespace?: string;
|
|
3615
3505
|
authenticatedPrincipal?: string;
|
|
3616
3506
|
},
|
|
3617
|
-
principal?: string
|
|
3507
|
+
principal?: string
|
|
3618
3508
|
): Promise<{
|
|
3619
3509
|
namespace: string;
|
|
3620
3510
|
clustersProcessed: number;
|
|
@@ -3624,7 +3514,7 @@ export class EngramAccessService {
|
|
|
3624
3514
|
const resolvedNamespace = this.writableNamespaceFor(
|
|
3625
3515
|
request.namespace,
|
|
3626
3516
|
undefined,
|
|
3627
|
-
request.authenticatedPrincipal ?? principal
|
|
3517
|
+
request.authenticatedPrincipal ?? principal
|
|
3628
3518
|
);
|
|
3629
3519
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
3630
3520
|
const result = await runProcedureMining({
|
|
@@ -3645,13 +3535,9 @@ export class EngramAccessService {
|
|
|
3645
3535
|
authenticatedPrincipal?: string;
|
|
3646
3536
|
force?: boolean;
|
|
3647
3537
|
} = {},
|
|
3648
|
-
principal?: string
|
|
3538
|
+
principal?: string
|
|
3649
3539
|
): Promise<LiveConnectorsRunSummary> {
|
|
3650
|
-
this.writableNamespaceFor(
|
|
3651
|
-
undefined,
|
|
3652
|
-
undefined,
|
|
3653
|
-
request.authenticatedPrincipal ?? principal,
|
|
3654
|
-
);
|
|
3540
|
+
this.writableNamespaceFor(undefined, undefined, request.authenticatedPrincipal ?? principal);
|
|
3655
3541
|
return this.orchestrator.runLiveConnectors({
|
|
3656
3542
|
force: request.force === true,
|
|
3657
3543
|
});
|
|
@@ -3683,7 +3569,7 @@ export class EngramAccessService {
|
|
|
3683
3569
|
authenticatedPrincipal?: string;
|
|
3684
3570
|
force?: boolean;
|
|
3685
3571
|
} = {},
|
|
3686
|
-
principal?: string
|
|
3572
|
+
principal?: string
|
|
3687
3573
|
): Promise<{
|
|
3688
3574
|
namespace: string;
|
|
3689
3575
|
ran: boolean;
|
|
@@ -3696,7 +3582,7 @@ export class EngramAccessService {
|
|
|
3696
3582
|
const resolvedNamespace = this.writableNamespaceFor(
|
|
3697
3583
|
request.namespace,
|
|
3698
3584
|
undefined,
|
|
3699
|
-
request.authenticatedPrincipal ?? principal
|
|
3585
|
+
request.authenticatedPrincipal ?? principal
|
|
3700
3586
|
);
|
|
3701
3587
|
const outcome = await this.orchestrator.runPatternReinforcement({
|
|
3702
3588
|
namespace: resolvedNamespace,
|
|
@@ -3730,12 +3616,9 @@ export class EngramAccessService {
|
|
|
3730
3616
|
*/
|
|
3731
3617
|
async procedureStats(
|
|
3732
3618
|
request: { namespace?: string } = {},
|
|
3733
|
-
principal?: string
|
|
3619
|
+
principal?: string
|
|
3734
3620
|
): Promise<ProcedureStatsReport & { namespace: string }> {
|
|
3735
|
-
const resolvedNamespace = this.resolveReadableNamespace(
|
|
3736
|
-
request.namespace,
|
|
3737
|
-
principal,
|
|
3738
|
-
);
|
|
3621
|
+
const resolvedNamespace = this.resolveReadableNamespace(request.namespace, principal);
|
|
3739
3622
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
3740
3623
|
const report = await computeProcedureStats({
|
|
3741
3624
|
storage,
|
|
@@ -3760,7 +3643,7 @@ export class EngramAccessService {
|
|
|
3760
3643
|
sessionKey?: string;
|
|
3761
3644
|
hours?: number;
|
|
3762
3645
|
embed?: boolean;
|
|
3763
|
-
} = {}
|
|
3646
|
+
} = {}
|
|
3764
3647
|
): Promise<{
|
|
3765
3648
|
enabled: boolean;
|
|
3766
3649
|
sessionKey?: string;
|
|
@@ -3772,17 +3655,11 @@ export class EngramAccessService {
|
|
|
3772
3655
|
reason?: string;
|
|
3773
3656
|
retryAfterMs?: number;
|
|
3774
3657
|
}> {
|
|
3775
|
-
return this.accessAdminOpsSurface.conversationIndexUpdate(
|
|
3776
|
-
request,
|
|
3777
|
-
);
|
|
3658
|
+
return this.accessAdminOpsSurface.conversationIndexUpdate(request);
|
|
3778
3659
|
}
|
|
3779
3660
|
|
|
3780
|
-
async profilingReport(
|
|
3781
|
-
request
|
|
3782
|
-
): Promise<AccessProfilingReportResponse> {
|
|
3783
|
-
return this.accessAdminOpsSurface.profilingReport(
|
|
3784
|
-
request,
|
|
3785
|
-
);
|
|
3661
|
+
async profilingReport(request: AccessProfilingReportRequest = {}): Promise<AccessProfilingReportResponse> {
|
|
3662
|
+
return this.accessAdminOpsSurface.profilingReport(request);
|
|
3786
3663
|
}
|
|
3787
3664
|
|
|
3788
3665
|
async trustZoneStatus(namespace?: string, principal?: string): Promise<EngramAccessTrustZoneStatusResponse> {
|
|
@@ -3802,7 +3679,7 @@ export class EngramAccessService {
|
|
|
3802
3679
|
|
|
3803
3680
|
async trustZoneBrowse(
|
|
3804
3681
|
request: EngramAccessTrustZoneBrowseRequest,
|
|
3805
|
-
principal?: string
|
|
3682
|
+
principal?: string
|
|
3806
3683
|
): Promise<EngramAccessTrustZoneBrowseResponse> {
|
|
3807
3684
|
const resolvedNamespace = this.resolveReadableNamespace(request.namespace, principal);
|
|
3808
3685
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
@@ -3829,22 +3706,17 @@ export class EngramAccessService {
|
|
|
3829
3706
|
result.allRecords,
|
|
3830
3707
|
resolveSecurityCapabilities(this.orchestrator.config).memoryPoisoningDefense === true,
|
|
3831
3708
|
resolveSecurityCapabilities(this.orchestrator.config).trustZones === true,
|
|
3832
|
-
resolveSecurityCapabilities(this.orchestrator.config).quarantinePromotion === true
|
|
3833
|
-
)
|
|
3709
|
+
resolveSecurityCapabilities(this.orchestrator.config).quarantinePromotion === true
|
|
3710
|
+
)
|
|
3711
|
+
),
|
|
3834
3712
|
};
|
|
3835
3713
|
}
|
|
3836
3714
|
|
|
3837
|
-
async trustZonePromote(
|
|
3838
|
-
request: EngramAccessTrustZonePromoteRequest,
|
|
3839
|
-
): Promise<EngramAccessTrustZonePromoteResponse> {
|
|
3715
|
+
async trustZonePromote(request: EngramAccessTrustZonePromoteRequest): Promise<EngramAccessTrustZonePromoteResponse> {
|
|
3840
3716
|
if (!isTrustZoneName(request.targetZone)) {
|
|
3841
3717
|
throw new EngramAccessInputError(`unsupported trust-zone target: ${String(request.targetZone)}`);
|
|
3842
3718
|
}
|
|
3843
|
-
const resolvedNamespace = this.writableNamespaceFor(
|
|
3844
|
-
request.namespace,
|
|
3845
|
-
undefined,
|
|
3846
|
-
request.authenticatedPrincipal,
|
|
3847
|
-
);
|
|
3719
|
+
const resolvedNamespace = this.writableNamespaceFor(request.namespace, undefined, request.authenticatedPrincipal);
|
|
3848
3720
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
3849
3721
|
let result: TrustZonePromotionResult;
|
|
3850
3722
|
try {
|
|
@@ -3872,13 +3744,9 @@ export class EngramAccessService {
|
|
|
3872
3744
|
}
|
|
3873
3745
|
|
|
3874
3746
|
async trustZoneDemoSeed(
|
|
3875
|
-
request: EngramAccessTrustZoneDemoSeedRequest
|
|
3747
|
+
request: EngramAccessTrustZoneDemoSeedRequest
|
|
3876
3748
|
): Promise<EngramAccessTrustZoneDemoSeedResponse> {
|
|
3877
|
-
const resolvedNamespace = this.writableNamespaceFor(
|
|
3878
|
-
request.namespace,
|
|
3879
|
-
undefined,
|
|
3880
|
-
request.authenticatedPrincipal,
|
|
3881
|
-
);
|
|
3749
|
+
const resolvedNamespace = this.writableNamespaceFor(request.namespace, undefined, request.authenticatedPrincipal);
|
|
3882
3750
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
3883
3751
|
let result: TrustZoneDemoSeedResult;
|
|
3884
3752
|
try {
|
|
@@ -3900,7 +3768,7 @@ export class EngramAccessService {
|
|
|
3900
3768
|
}
|
|
3901
3769
|
|
|
3902
3770
|
async reviewDisposition(
|
|
3903
|
-
request: EngramAccessReviewDispositionRequest
|
|
3771
|
+
request: EngramAccessReviewDispositionRequest
|
|
3904
3772
|
): Promise<EngramAccessReviewDispositionResponse> {
|
|
3905
3773
|
const memoryId = request.memoryId.trim();
|
|
3906
3774
|
const reasonCode = request.reasonCode.trim();
|
|
@@ -3911,14 +3779,10 @@ export class EngramAccessService {
|
|
|
3911
3779
|
throw new EngramAccessInputError("reasonCode is required");
|
|
3912
3780
|
}
|
|
3913
3781
|
|
|
3914
|
-
const resolvedNamespace = this.writableNamespaceFor(
|
|
3915
|
-
request.namespace,
|
|
3916
|
-
undefined,
|
|
3917
|
-
request.authenticatedPrincipal,
|
|
3918
|
-
);
|
|
3782
|
+
const resolvedNamespace = this.writableNamespaceFor(request.namespace, undefined, request.authenticatedPrincipal);
|
|
3919
3783
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
3920
3784
|
const memory = await storage.getMemoryById(memoryId);
|
|
3921
|
-
if (!memory) {
|
|
3785
|
+
if (!memory || isSupportPassportPrivateMemory(memory)) {
|
|
3922
3786
|
throw new EngramAccessInputError(`memory not found: ${memoryId}`);
|
|
3923
3787
|
}
|
|
3924
3788
|
|
|
@@ -3948,10 +3812,14 @@ export class EngramAccessService {
|
|
|
3948
3812
|
};
|
|
3949
3813
|
}
|
|
3950
3814
|
|
|
3951
|
-
const updated = await storage.writeMemoryFrontmatter(
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3815
|
+
const updated = await storage.writeMemoryFrontmatter(
|
|
3816
|
+
memory,
|
|
3817
|
+
{
|
|
3818
|
+
status: request.status,
|
|
3819
|
+
updated: updatedAt,
|
|
3820
|
+
},
|
|
3821
|
+
lifecycle
|
|
3822
|
+
);
|
|
3955
3823
|
if (!updated) {
|
|
3956
3824
|
throw new Error(`failed to update memory disposition: ${memoryId}`);
|
|
3957
3825
|
}
|
|
@@ -3982,14 +3850,14 @@ export class EngramAccessService {
|
|
|
3982
3850
|
memory: MemoryFile,
|
|
3983
3851
|
baseDir: string,
|
|
3984
3852
|
disclosure?: RecallDisclosure,
|
|
3985
|
-
rawExcerpts?: EngramAccessMemorySummary["rawExcerpts"]
|
|
3853
|
+
rawExcerpts?: EngramAccessMemorySummary["rawExcerpts"]
|
|
3986
3854
|
): EngramAccessMemorySummary {
|
|
3987
3855
|
return shapeMemorySummary(memory, baseDir, disclosure, rawExcerpts);
|
|
3988
3856
|
}
|
|
3989
3857
|
|
|
3990
3858
|
async observe(
|
|
3991
3859
|
request: EngramAccessObserveRequest,
|
|
3992
|
-
hooks?: { enforceWriteQuota?: () => void | Promise<void> }
|
|
3860
|
+
hooks?: { enforceWriteQuota?: () => void | Promise<void> }
|
|
3993
3861
|
): Promise<EngramAccessObserveResponse> {
|
|
3994
3862
|
// Issue #1649: dedup retried observe POSTs server-side. A retry with the
|
|
3995
3863
|
// same `idempotencyKey` replays the cached response and skips every side
|
|
@@ -4044,15 +3912,11 @@ export class EngramAccessService {
|
|
|
4044
3912
|
}
|
|
4045
3913
|
|
|
4046
3914
|
private async runObserve(request: EngramAccessObserveRequest): Promise<EngramAccessObserveResponse> {
|
|
4047
|
-
return this.accessObserveWriteSurface.runObserve(
|
|
4048
|
-
request,
|
|
4049
|
-
);
|
|
3915
|
+
return this.accessObserveWriteSurface.runObserve(request);
|
|
4050
3916
|
}
|
|
4051
3917
|
|
|
4052
3918
|
async lcmSearch(request: EngramAccessLcmSearchRequest): Promise<EngramAccessLcmSearchResponse> {
|
|
4053
|
-
return this.accessLcmSurface.lcmSearch(
|
|
4054
|
-
request,
|
|
4055
|
-
);
|
|
3919
|
+
return this.accessLcmSurface.lcmSearch(request);
|
|
4056
3920
|
}
|
|
4057
3921
|
|
|
4058
3922
|
/**
|
|
@@ -4082,27 +3946,23 @@ export class EngramAccessService {
|
|
|
4082
3946
|
resolvedNamespace: string,
|
|
4083
3947
|
sessionKeyForOverlay: string | undefined,
|
|
4084
3948
|
authenticatedPrincipal: string | undefined,
|
|
4085
|
-
purpose: "read" | "write" = "read"
|
|
3949
|
+
purpose: "read" | "write" = "read"
|
|
4086
3950
|
): string {
|
|
4087
3951
|
return this.accessLcmSurface.resolveLcmReadNamespace(
|
|
4088
3952
|
explicitNamespace,
|
|
4089
3953
|
resolvedNamespace,
|
|
4090
3954
|
sessionKeyForOverlay,
|
|
4091
3955
|
authenticatedPrincipal,
|
|
4092
|
-
purpose
|
|
3956
|
+
purpose
|
|
4093
3957
|
);
|
|
4094
3958
|
}
|
|
4095
3959
|
|
|
4096
3960
|
private resolveRawExcerptReadNamespace(
|
|
4097
3961
|
explicitNamespace: string | undefined,
|
|
4098
3962
|
sessionKey: string | undefined,
|
|
4099
|
-
authenticatedPrincipal: string | undefined
|
|
3963
|
+
authenticatedPrincipal: string | undefined
|
|
4100
3964
|
): string | undefined {
|
|
4101
|
-
return this.accessLcmSurface.resolveRawExcerptReadNamespace(
|
|
4102
|
-
explicitNamespace,
|
|
4103
|
-
sessionKey,
|
|
4104
|
-
authenticatedPrincipal,
|
|
4105
|
-
);
|
|
3965
|
+
return this.accessLcmSurface.resolveRawExcerptReadNamespace(explicitNamespace, sessionKey, authenticatedPrincipal);
|
|
4106
3966
|
}
|
|
4107
3967
|
|
|
4108
3968
|
/**
|
|
@@ -4135,9 +3995,7 @@ export class EngramAccessService {
|
|
|
4135
3995
|
* `config.defaultNamespace`, keeping single-user recall byte-for-byte
|
|
4136
3996
|
* unchanged.
|
|
4137
3997
|
*/
|
|
4138
|
-
private resolveImplicitLcmReadFallbackNamespace(
|
|
4139
|
-
principal: string | undefined,
|
|
4140
|
-
): string | undefined {
|
|
3998
|
+
private resolveImplicitLcmReadFallbackNamespace(principal: string | undefined): string | undefined {
|
|
4141
3999
|
const config = this.orchestrator.config;
|
|
4142
4000
|
if (!resolveNamespaceCapabilities(config).namespaces) return config.defaultNamespace;
|
|
4143
4001
|
// PROCEED when `default` is readable (single-store / readable-default flows)
|
|
@@ -4161,10 +4019,7 @@ export class EngramAccessService {
|
|
|
4161
4019
|
// scoped overlay key (with a session) or empty (sessionless). SUPPRESS
|
|
4162
4020
|
// (`undefined`) when the self base is not readable-in-recall.
|
|
4163
4021
|
const selfBase = defaultNamespaceForPrincipal(principal, config);
|
|
4164
|
-
const selfReadableInRecall = recallNamespacesForPrincipal(
|
|
4165
|
-
principal,
|
|
4166
|
-
config,
|
|
4167
|
-
).includes(selfBase);
|
|
4022
|
+
const selfReadableInRecall = recallNamespacesForPrincipal(principal, config).includes(selfBase);
|
|
4168
4023
|
return selfReadableInRecall ? config.defaultNamespace : undefined;
|
|
4169
4024
|
}
|
|
4170
4025
|
|
|
@@ -4173,21 +4028,17 @@ export class EngramAccessService {
|
|
|
4173
4028
|
resolvedNamespace: string,
|
|
4174
4029
|
sessionKey: string,
|
|
4175
4030
|
authenticatedPrincipal: string | undefined,
|
|
4176
|
-
purpose: "read" | "write" = "read"
|
|
4031
|
+
purpose: "read" | "write" = "read"
|
|
4177
4032
|
): string {
|
|
4178
4033
|
const effectiveNamespace = this.resolveLcmReadNamespace(
|
|
4179
4034
|
explicitNamespace,
|
|
4180
4035
|
resolvedNamespace,
|
|
4181
4036
|
sessionKey,
|
|
4182
4037
|
authenticatedPrincipal,
|
|
4183
|
-
purpose
|
|
4038
|
+
purpose
|
|
4184
4039
|
);
|
|
4185
4040
|
return (
|
|
4186
|
-
lcmSessionKeyForNamespace(
|
|
4187
|
-
effectiveNamespace,
|
|
4188
|
-
sessionKey,
|
|
4189
|
-
this.orchestrator.config.defaultNamespace,
|
|
4190
|
-
) ?? sessionKey
|
|
4041
|
+
lcmSessionKeyForNamespace(effectiveNamespace, sessionKey, this.orchestrator.config.defaultNamespace) ?? sessionKey
|
|
4191
4042
|
);
|
|
4192
4043
|
}
|
|
4193
4044
|
|
|
@@ -4220,18 +4071,12 @@ export class EngramAccessService {
|
|
|
4220
4071
|
*/
|
|
4221
4072
|
private resolveScopeProfileLcmReadNamespaces(
|
|
4222
4073
|
sessionKey: string | undefined,
|
|
4223
|
-
authenticatedPrincipal: string | undefined
|
|
4074
|
+
authenticatedPrincipal: string | undefined
|
|
4224
4075
|
): string[] | null {
|
|
4225
4076
|
const config = this.orchestrator.config;
|
|
4226
4077
|
const principal = this.resolveRequestPrincipal(sessionKey, authenticatedPrincipal);
|
|
4227
|
-
const codingContext = sessionKey
|
|
4228
|
-
|
|
4229
|
-
: null;
|
|
4230
|
-
const codingOverlay = resolveCodingNamespaceOverlay(
|
|
4231
|
-
codingContext,
|
|
4232
|
-
config.codingMode,
|
|
4233
|
-
config.defaultNamespace,
|
|
4234
|
-
);
|
|
4078
|
+
const codingContext = sessionKey ? this.orchestrator.getCodingContextForSession(sessionKey) : null;
|
|
4079
|
+
const codingOverlay = resolveCodingNamespaceOverlay(codingContext, config.codingMode, config.defaultNamespace);
|
|
4235
4080
|
const profilePlan = resolveScopeProfilePlan({
|
|
4236
4081
|
config,
|
|
4237
4082
|
principal,
|
|
@@ -4258,11 +4103,7 @@ export class EngramAccessService {
|
|
|
4258
4103
|
const seen = new Set<string>();
|
|
4259
4104
|
for (const namespace of namespaces) {
|
|
4260
4105
|
const key =
|
|
4261
|
-
lcmSessionKeyForNamespace(
|
|
4262
|
-
namespace,
|
|
4263
|
-
sessionKey,
|
|
4264
|
-
this.orchestrator.config.defaultNamespace,
|
|
4265
|
-
) ?? sessionKey;
|
|
4106
|
+
lcmSessionKeyForNamespace(namespace, sessionKey, this.orchestrator.config.defaultNamespace) ?? sessionKey;
|
|
4266
4107
|
if (!seen.has(key)) {
|
|
4267
4108
|
seen.add(key);
|
|
4268
4109
|
out.push(key);
|
|
@@ -4275,18 +4116,18 @@ export class EngramAccessService {
|
|
|
4275
4116
|
explicitNamespace: string | undefined,
|
|
4276
4117
|
resolvedNamespace: string,
|
|
4277
4118
|
sessionKey: string,
|
|
4278
|
-
authenticatedPrincipal: string | undefined
|
|
4119
|
+
authenticatedPrincipal: string | undefined
|
|
4279
4120
|
): string[] {
|
|
4280
4121
|
return this.accessLcmSurface.resolveLcmReadSessionIds(
|
|
4281
4122
|
explicitNamespace,
|
|
4282
4123
|
resolvedNamespace,
|
|
4283
4124
|
sessionKey,
|
|
4284
|
-
authenticatedPrincipal
|
|
4125
|
+
authenticatedPrincipal
|
|
4285
4126
|
);
|
|
4286
4127
|
}
|
|
4287
4128
|
|
|
4288
4129
|
async lcmCompactionFlush(
|
|
4289
|
-
request: EngramAccessLcmCompactionFlushRequest
|
|
4130
|
+
request: EngramAccessLcmCompactionFlushRequest
|
|
4290
4131
|
): Promise<EngramAccessLcmCompactionFlushResponse> {
|
|
4291
4132
|
if (!request.sessionKey || typeof request.sessionKey !== "string" || request.sessionKey.trim().length === 0) {
|
|
4292
4133
|
throw new EngramAccessInputError("sessionKey is required and must be a non-empty string");
|
|
@@ -4308,11 +4149,8 @@ export class EngramAccessService {
|
|
|
4308
4149
|
|
|
4309
4150
|
// Flush the same LCM session ID observe archived under.
|
|
4310
4151
|
const lcmSessionKey =
|
|
4311
|
-
lcmSessionKeyForNamespace(
|
|
4312
|
-
|
|
4313
|
-
request.sessionKey,
|
|
4314
|
-
this.orchestrator.config.defaultNamespace,
|
|
4315
|
-
) ?? request.sessionKey;
|
|
4152
|
+
lcmSessionKeyForNamespace(scope.writeNamespace, request.sessionKey, this.orchestrator.config.defaultNamespace) ??
|
|
4153
|
+
request.sessionKey;
|
|
4316
4154
|
await this.orchestrator.lcmEngine.waitForSessionObserveIdle(lcmSessionKey);
|
|
4317
4155
|
await this.orchestrator.lcmEngine.preCompactionFlush(lcmSessionKey);
|
|
4318
4156
|
return {
|
|
@@ -4323,7 +4161,9 @@ export class EngramAccessService {
|
|
|
4323
4161
|
};
|
|
4324
4162
|
}
|
|
4325
4163
|
|
|
4326
|
-
async extractionForceFlush(
|
|
4164
|
+
async extractionForceFlush(
|
|
4165
|
+
request: EngramAccessExtractionForceFlushRequest
|
|
4166
|
+
): Promise<EngramAccessExtractionForceFlushResponse> {
|
|
4327
4167
|
return delegateExtractionForceFlush(this.accessObserveWriteSurface, request);
|
|
4328
4168
|
}
|
|
4329
4169
|
cancelPendingObservePreparations(sessionKey: string, scopeHint?: string): void {
|
|
@@ -4334,12 +4174,12 @@ export class EngramAccessService {
|
|
|
4334
4174
|
sessionKey: string,
|
|
4335
4175
|
principal?: string,
|
|
4336
4176
|
namespace?: string,
|
|
4337
|
-
scopeHint?: string
|
|
4177
|
+
scopeHint?: string
|
|
4338
4178
|
): void {
|
|
4339
4179
|
this.accessObserveWriteSurface.cancelPendingObserveExtractions(sessionKey, principal, namespace, scopeHint);
|
|
4340
4180
|
}
|
|
4341
4181
|
async lcmCompactionRecord(
|
|
4342
|
-
request: EngramAccessLcmCompactionRecordRequest
|
|
4182
|
+
request: EngramAccessLcmCompactionRecordRequest
|
|
4343
4183
|
): Promise<EngramAccessLcmCompactionRecordResponse> {
|
|
4344
4184
|
if (!request.sessionKey || typeof request.sessionKey !== "string" || request.sessionKey.trim().length === 0) {
|
|
4345
4185
|
throw new EngramAccessInputError("sessionKey is required and must be a non-empty string");
|
|
@@ -4381,17 +4221,10 @@ export class EngramAccessService {
|
|
|
4381
4221
|
// A write-only / self-omitted principal still records on the overlay queue
|
|
4382
4222
|
// because the scope plan authorized the write target by WRITE policy.
|
|
4383
4223
|
const lcmSessionKey =
|
|
4384
|
-
lcmSessionKeyForNamespace(
|
|
4385
|
-
|
|
4386
|
-
request.sessionKey,
|
|
4387
|
-
this.orchestrator.config.defaultNamespace,
|
|
4388
|
-
) ?? request.sessionKey;
|
|
4224
|
+
lcmSessionKeyForNamespace(scope.writeNamespace, request.sessionKey, this.orchestrator.config.defaultNamespace) ??
|
|
4225
|
+
request.sessionKey;
|
|
4389
4226
|
await this.orchestrator.lcmEngine.waitForSessionObserveIdle(lcmSessionKey);
|
|
4390
|
-
await this.orchestrator.lcmEngine.recordCompaction(
|
|
4391
|
-
lcmSessionKey,
|
|
4392
|
-
request.tokensBefore,
|
|
4393
|
-
request.tokensAfter,
|
|
4394
|
-
);
|
|
4227
|
+
await this.orchestrator.lcmEngine.recordCompaction(lcmSessionKey, request.tokensBefore, request.tokensAfter);
|
|
4395
4228
|
return {
|
|
4396
4229
|
enabled: true,
|
|
4397
4230
|
recorded: true,
|
|
@@ -4514,9 +4347,7 @@ export class EngramAccessService {
|
|
|
4514
4347
|
tags?: string[];
|
|
4515
4348
|
dueAt?: string;
|
|
4516
4349
|
}): Promise<unknown> {
|
|
4517
|
-
return this.accessObserveWriteSurface.workTask(
|
|
4518
|
-
request,
|
|
4519
|
-
);
|
|
4350
|
+
return this.accessObserveWriteSurface.workTask(request);
|
|
4520
4351
|
}
|
|
4521
4352
|
|
|
4522
4353
|
async workProject(request: {
|
|
@@ -4530,9 +4361,7 @@ export class EngramAccessService {
|
|
|
4530
4361
|
taskId?: string;
|
|
4531
4362
|
projectId?: string;
|
|
4532
4363
|
}): Promise<unknown> {
|
|
4533
|
-
return this.accessObserveWriteSurface.workProject(
|
|
4534
|
-
request,
|
|
4535
|
-
);
|
|
4364
|
+
return this.accessObserveWriteSurface.workProject(request);
|
|
4536
4365
|
}
|
|
4537
4366
|
|
|
4538
4367
|
async workBoard(request: {
|
|
@@ -4541,13 +4370,9 @@ export class EngramAccessService {
|
|
|
4541
4370
|
snapshotJson?: string;
|
|
4542
4371
|
linkToMemory?: boolean;
|
|
4543
4372
|
}): Promise<unknown> {
|
|
4544
|
-
return this.accessObserveWriteSurface.workBoard(
|
|
4545
|
-
request,
|
|
4546
|
-
);
|
|
4373
|
+
return this.accessObserveWriteSurface.workBoard(request);
|
|
4547
4374
|
}
|
|
4548
4375
|
|
|
4549
|
-
// ── Shared Context / Compounding ────────────────────────────────────────
|
|
4550
|
-
|
|
4551
4376
|
async sharedContextWriteOutput(request: {
|
|
4552
4377
|
agentId: string;
|
|
4553
4378
|
title: string;
|
|
@@ -4678,14 +4503,15 @@ export class EngramAccessService {
|
|
|
4678
4503
|
});
|
|
4679
4504
|
}
|
|
4680
4505
|
|
|
4681
|
-
// ── Compression Guidelines ────────────────────────────────────────────
|
|
4682
|
-
|
|
4683
4506
|
async compressionGuidelinesOptimize(request: {
|
|
4684
4507
|
dryRun?: boolean;
|
|
4685
4508
|
eventLimit?: number;
|
|
4686
4509
|
}): Promise<unknown> {
|
|
4687
4510
|
if (!resolveCompressionCapabilities(this.orchestrator.config).compressionGuidelineLearning) {
|
|
4688
|
-
return {
|
|
4511
|
+
return {
|
|
4512
|
+
enabled: false,
|
|
4513
|
+
reason: "Compression guideline learning is disabled. Enable `compressionGuidelineLearningEnabled: true`.",
|
|
4514
|
+
};
|
|
4689
4515
|
}
|
|
4690
4516
|
return await this.orchestrator.compressionGuidelineCoordinator.optimizeCompressionGuidelines({
|
|
4691
4517
|
dryRun: request.dryRun,
|
|
@@ -4705,7 +4531,6 @@ export class EngramAccessService {
|
|
|
4705
4531
|
expectedGuidelineVersion: request.expectedGuidelineVersion,
|
|
4706
4532
|
});
|
|
4707
4533
|
}
|
|
4708
|
-
// ── Memory search & debug ─────────────────────────────────────────────
|
|
4709
4534
|
|
|
4710
4535
|
async memorySearch(request: {
|
|
4711
4536
|
query: string;
|
|
@@ -4719,6 +4544,7 @@ export class EngramAccessService {
|
|
|
4719
4544
|
return memorySearchThroughScope(
|
|
4720
4545
|
{
|
|
4721
4546
|
namespacesEnabled: resolveNamespaceCapabilities(config).namespaces,
|
|
4547
|
+
memoryCollections: [config.qmdCollection, config.qmdColdCollection ?? "openclaw-engram-cold"],
|
|
4722
4548
|
// `0` is preserved, never coerced: a zero limit is a runtime
|
|
4723
4549
|
// compatibility guarantee (AGENTS.md guardrail 4), and it means the
|
|
4724
4550
|
// same thing here as an explicit `maxResults: 0` from the caller - an
|
|
@@ -4734,22 +4560,21 @@ export class EngramAccessService {
|
|
|
4734
4560
|
// The caller's own collection disambiguates a prefix that is also
|
|
4735
4561
|
// a memory category name (`collection: "facts"`).
|
|
4736
4562
|
{ ...config, requestedCollection: request.collection?.trim() || undefined },
|
|
4737
|
-
"qmd"
|
|
4563
|
+
"qmd"
|
|
4738
4564
|
),
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
},
|
|
4565
|
+
filterPrivate: this.orchestrator.filterPrivateSearchResults,
|
|
4566
|
+
authorizeFlatCorpus: (namespace, principal) => void this.resolveReadableNamespace(namespace, principal),
|
|
4742
4567
|
authorizeNamespaces: async (namespace, principal, collection) =>
|
|
4743
4568
|
this.resolveMemorySearchNamespacesForCollection(
|
|
4744
4569
|
collection,
|
|
4745
4570
|
await this.resolveReadableNamespacesForSearch(namespace, principal),
|
|
4746
|
-
namespace?.trim() ? undefined : principal
|
|
4571
|
+
namespace?.trim() ? undefined : principal
|
|
4747
4572
|
),
|
|
4748
4573
|
searchAcrossNamespaces: (params) => this.orchestrator.searchAcrossNamespaces(params),
|
|
4749
4574
|
searchGlobal: (query, maxResults) => qmd.searchGlobal(query, maxResults),
|
|
4750
4575
|
search: (query, collection, maxResults) => qmd.search(query, collection, maxResults),
|
|
4751
4576
|
},
|
|
4752
|
-
request
|
|
4577
|
+
request
|
|
4753
4578
|
);
|
|
4754
4579
|
}
|
|
4755
4580
|
|
|
@@ -4769,7 +4594,10 @@ export class EngramAccessService {
|
|
|
4769
4594
|
return { entities, count: entities.length };
|
|
4770
4595
|
}
|
|
4771
4596
|
|
|
4772
|
-
async memoryQuestions(
|
|
4597
|
+
async memoryQuestions(
|
|
4598
|
+
namespace?: string,
|
|
4599
|
+
principal?: string
|
|
4600
|
+
): Promise<{ questions: Array<{ id: string; question: string; resolved: boolean }>; count: number }> {
|
|
4773
4601
|
const resolvedNs = this.resolveReadableNamespace(namespace, principal);
|
|
4774
4602
|
const storage = await this.orchestrator.getStorage(resolvedNs);
|
|
4775
4603
|
const questions = await storage.readQuestions();
|
|
@@ -4803,12 +4631,9 @@ export class EngramAccessService {
|
|
|
4803
4631
|
|
|
4804
4632
|
async graphSnapshot(
|
|
4805
4633
|
request: GraphSnapshotRequest & { namespace?: string },
|
|
4806
|
-
authenticatedPrincipal?: string
|
|
4634
|
+
authenticatedPrincipal?: string
|
|
4807
4635
|
): Promise<GraphSnapshotResponse> {
|
|
4808
|
-
return this.accessAdminOpsSurface.graphSnapshot(
|
|
4809
|
-
request,
|
|
4810
|
-
authenticatedPrincipal,
|
|
4811
|
-
);
|
|
4636
|
+
return this.accessAdminOpsSurface.graphSnapshot(request, authenticatedPrincipal);
|
|
4812
4637
|
}
|
|
4813
4638
|
|
|
4814
4639
|
async memoryFeedback(request: {
|
|
@@ -4823,11 +4648,7 @@ export class EngramAccessService {
|
|
|
4823
4648
|
reason: "Feedback is disabled. Enable `feedbackEnabled: true` in the Engram config to store feedback.",
|
|
4824
4649
|
};
|
|
4825
4650
|
}
|
|
4826
|
-
await this.orchestrator.recordMemoryFeedback(
|
|
4827
|
-
request.memoryId,
|
|
4828
|
-
request.vote,
|
|
4829
|
-
request.note,
|
|
4830
|
-
);
|
|
4651
|
+
await this.orchestrator.recordMemoryFeedback(request.memoryId, request.vote, request.note);
|
|
4831
4652
|
return { recorded: true };
|
|
4832
4653
|
}
|
|
4833
4654
|
|
|
@@ -4854,15 +4675,9 @@ export class EngramAccessService {
|
|
|
4854
4675
|
timestamp?: string;
|
|
4855
4676
|
}): Promise<RecordMemoryOutcomeResult> {
|
|
4856
4677
|
if (request.memoryId.includes("/") || request.memoryId.includes("\\")) {
|
|
4857
|
-
throw new EngramAccessInputError(
|
|
4858
|
-
"memoryId must not contain path separators",
|
|
4859
|
-
);
|
|
4678
|
+
throw new EngramAccessInputError("memoryId must not contain path separators");
|
|
4860
4679
|
}
|
|
4861
|
-
const resolvedNs = this.writableNamespaceFor(
|
|
4862
|
-
request.namespace,
|
|
4863
|
-
request.sessionKey,
|
|
4864
|
-
request.principal,
|
|
4865
|
-
);
|
|
4680
|
+
const resolvedNs = this.writableNamespaceFor(request.namespace, request.sessionKey, request.principal);
|
|
4866
4681
|
const storage = await this.orchestrator.getStorage(resolvedNs);
|
|
4867
4682
|
// We only have the ID at the access surface, but `recordMemoryOutcome`
|
|
4868
4683
|
// accepts a path for the benefit of ledger-driven callers that already
|
|
@@ -4910,9 +4725,7 @@ export class EngramAccessService {
|
|
|
4910
4725
|
sourcePrompt?: string;
|
|
4911
4726
|
dryRun?: boolean;
|
|
4912
4727
|
}): Promise<unknown> {
|
|
4913
|
-
return this.accessObserveWriteSurface.memoryActionApply(
|
|
4914
|
-
request,
|
|
4915
|
-
);
|
|
4728
|
+
return this.accessObserveWriteSurface.memoryActionApply(request);
|
|
4916
4729
|
}
|
|
4917
4730
|
|
|
4918
4731
|
async contextCheckpoint(request: {
|
|
@@ -4960,39 +4773,23 @@ export class EngramAccessService {
|
|
|
4960
4773
|
};
|
|
4961
4774
|
}
|
|
4962
4775
|
|
|
4963
|
-
async recordCitationUsage(
|
|
4964
|
-
request: CitationUsageRequest,
|
|
4965
|
-
): Promise<CitationUsageResult> {
|
|
4776
|
+
async recordCitationUsage(request: CitationUsageRequest): Promise<CitationUsageResult> {
|
|
4966
4777
|
return recordCitationUsageForAccess(
|
|
4967
4778
|
{
|
|
4968
4779
|
resolveNamespace: (namespace, sessionId, authenticatedPrincipal) =>
|
|
4969
4780
|
this.writableNamespaceFor(namespace, sessionId, authenticatedPrincipal),
|
|
4970
|
-
resolveNamespaceForPath: async (
|
|
4971
|
-
memoryPath,
|
|
4972
|
-
fallbackNamespace,
|
|
4973
|
-
sessionId,
|
|
4974
|
-
authenticatedPrincipal,
|
|
4975
|
-
) => {
|
|
4781
|
+
resolveNamespaceForPath: async (memoryPath, fallbackNamespace, sessionId, authenticatedPrincipal) => {
|
|
4976
4782
|
const principal = this.resolveRequestPrincipal(sessionId, authenticatedPrincipal);
|
|
4977
4783
|
const namespacesEnabled = resolveNamespaceCapabilities(this.orchestrator.config).namespaces;
|
|
4978
|
-
if (
|
|
4979
|
-
|
|
4980
|
-
!canReadNamespace(principal, fallbackNamespace, this.orchestrator.config)
|
|
4981
|
-
) {
|
|
4982
|
-
throw new EngramAccessInputError(
|
|
4983
|
-
`namespace is not readable: ${fallbackNamespace}`,
|
|
4984
|
-
);
|
|
4784
|
+
if (namespacesEnabled && !canReadNamespace(principal, fallbackNamespace, this.orchestrator.config)) {
|
|
4785
|
+
throw new EngramAccessInputError(`namespace is not readable: ${fallbackNamespace}`);
|
|
4985
4786
|
}
|
|
4986
4787
|
const authorizedNamespaces = namespacesEnabled
|
|
4987
4788
|
? Array.from(
|
|
4988
|
-
new Set([...citationAuthorizedNamespaces(principal, this.orchestrator.config), fallbackNamespace])
|
|
4789
|
+
new Set([...citationAuthorizedNamespaces(principal, this.orchestrator.config), fallbackNamespace])
|
|
4989
4790
|
)
|
|
4990
4791
|
: [fallbackNamespace];
|
|
4991
|
-
const resolved = await this.storageForAbsoluteRecallPath(
|
|
4992
|
-
memoryPath,
|
|
4993
|
-
fallbackNamespace,
|
|
4994
|
-
authorizedNamespaces,
|
|
4995
|
-
);
|
|
4792
|
+
const resolved = await this.storageForAbsoluteRecallPath(memoryPath, fallbackNamespace, authorizedNamespaces);
|
|
4996
4793
|
if (!resolved) {
|
|
4997
4794
|
if (nodePath.isAbsolute(memoryPath)) {
|
|
4998
4795
|
throw new EngramAccessInputError("cited path is outside the caller's readable namespaces");
|
|
@@ -5001,7 +4798,7 @@ export class EngramAccessService {
|
|
|
5001
4798
|
(ns) => this.orchestrator.getStorage(ns),
|
|
5002
4799
|
authorizedNamespaces,
|
|
5003
4800
|
memoryPath,
|
|
5004
|
-
fallbackNamespace
|
|
4801
|
+
fallbackNamespace
|
|
5005
4802
|
);
|
|
5006
4803
|
}
|
|
5007
4804
|
return resolved.namespace;
|
|
@@ -5010,7 +4807,7 @@ export class EngramAccessService {
|
|
|
5010
4807
|
trackMemoryAccess: (memoryIds, memoryPaths, memoryNamespaces) =>
|
|
5011
4808
|
this.orchestrator.trackMemoryAccess(memoryIds, memoryPaths, memoryNamespaces),
|
|
5012
4809
|
},
|
|
5013
|
-
request
|
|
4810
|
+
request
|
|
5014
4811
|
);
|
|
5015
4812
|
}
|
|
5016
4813
|
|
|
@@ -5028,7 +4825,7 @@ export class EngramAccessService {
|
|
|
5028
4825
|
*/
|
|
5029
4826
|
async consoleState(
|
|
5030
4827
|
namespace?: string,
|
|
5031
|
-
principal?: string
|
|
4828
|
+
principal?: string
|
|
5032
4829
|
): Promise<import("./console/state.js").ConsoleStateSnapshot> {
|
|
5033
4830
|
// Enforce namespace ACL — throws EngramAccessInputError if unauthorized.
|
|
5034
4831
|
const resolvedNamespace = this.resolveReadableNamespace(namespace, principal);
|
|
@@ -5067,12 +4864,7 @@ export class EngramAccessService {
|
|
|
5067
4864
|
* not exist rather than throwing, matching the `memoryGet` / `entityGet`
|
|
5068
4865
|
* pattern used throughout the service.
|
|
5069
4866
|
*/
|
|
5070
|
-
async peerGet(
|
|
5071
|
-
peerId: string,
|
|
5072
|
-
): Promise<
|
|
5073
|
-
| { found: true; peer: import("./peers/types.js").Peer }
|
|
5074
|
-
| { found: false }
|
|
5075
|
-
> {
|
|
4867
|
+
async peerGet(peerId: string): Promise<{ found: true; peer: import("./peers/types.js").Peer } | { found: false }> {
|
|
5076
4868
|
const peers = await import("./peers/index.js");
|
|
5077
4869
|
const validateId: (id: unknown) => void = peers.assertValidPeerId;
|
|
5078
4870
|
try {
|
|
@@ -5118,9 +4910,7 @@ export class EngramAccessService {
|
|
|
5118
4910
|
// First write — require kind.
|
|
5119
4911
|
const kind = input.kind ?? "human";
|
|
5120
4912
|
if (!ALLOWED_KINDS.has(kind)) {
|
|
5121
|
-
throw new EngramAccessInputError(
|
|
5122
|
-
`peer kind must be one of ${[...ALLOWED_KINDS].join(", ")}`,
|
|
5123
|
-
);
|
|
4913
|
+
throw new EngramAccessInputError(`peer kind must be one of ${[...ALLOWED_KINDS].join(", ")}`);
|
|
5124
4914
|
}
|
|
5125
4915
|
const newPeer: import("./peers/types.js").Peer = {
|
|
5126
4916
|
id,
|
|
@@ -5188,10 +4978,7 @@ export class EngramAccessService {
|
|
|
5188
4978
|
* was removed; `{ ok: true, purged: false }` when the directory did
|
|
5189
4979
|
* not exist (idempotent no-op).
|
|
5190
4980
|
*/
|
|
5191
|
-
async peerForget(
|
|
5192
|
-
peerId: string,
|
|
5193
|
-
opts: { confirm: string },
|
|
5194
|
-
): Promise<{ ok: true; purged: boolean }> {
|
|
4981
|
+
async peerForget(peerId: string, opts: { confirm: string }): Promise<{ ok: true; purged: boolean }> {
|
|
5195
4982
|
const peers = await import("./peers/index.js");
|
|
5196
4983
|
const validateId: (id: unknown) => void = peers.assertValidPeerId;
|
|
5197
4984
|
try {
|
|
@@ -5200,9 +4987,7 @@ export class EngramAccessService {
|
|
|
5200
4987
|
throw new EngramAccessInputError((err as Error).message);
|
|
5201
4988
|
}
|
|
5202
4989
|
if (opts.confirm !== "yes") {
|
|
5203
|
-
throw new EngramAccessInputError(
|
|
5204
|
-
"peerForget requires confirm: 'yes' to prevent accidental data loss",
|
|
5205
|
-
);
|
|
4990
|
+
throw new EngramAccessInputError("peerForget requires confirm: 'yes' to prevent accidental data loss");
|
|
5206
4991
|
}
|
|
5207
4992
|
const result = await peers.forgetPeer(this.orchestrator.config.memoryDir, peerId, {
|
|
5208
4993
|
confirm: "yes",
|
|
@@ -5217,11 +5002,8 @@ export class EngramAccessService {
|
|
|
5217
5002
|
* but in practice the reasoner only writes profiles for registered peers.
|
|
5218
5003
|
*/
|
|
5219
5004
|
async peerProfileGet(
|
|
5220
|
-
peerId: string
|
|
5221
|
-
): Promise<
|
|
5222
|
-
| { found: true; profile: import("./peers/types.js").PeerProfile }
|
|
5223
|
-
| { found: false }
|
|
5224
|
-
> {
|
|
5005
|
+
peerId: string
|
|
5006
|
+
): Promise<{ found: true; profile: import("./peers/types.js").PeerProfile } | { found: false }> {
|
|
5225
5007
|
const peers = await import("./peers/index.js");
|
|
5226
5008
|
const validateId: (id: unknown) => void = peers.assertValidPeerId;
|
|
5227
5009
|
try {
|
|
@@ -5260,7 +5042,10 @@ export class EngramAccessService {
|
|
|
5260
5042
|
return storage.dir;
|
|
5261
5043
|
}
|
|
5262
5044
|
|
|
5263
|
-
async getReadableStorageForNamespace(
|
|
5045
|
+
async getReadableStorageForNamespace(
|
|
5046
|
+
namespace?: string,
|
|
5047
|
+
principal?: string
|
|
5048
|
+
): Promise<{
|
|
5264
5049
|
namespace: string;
|
|
5265
5050
|
storage: StorageManager;
|
|
5266
5051
|
}> {
|
|
@@ -5269,29 +5054,33 @@ export class EngramAccessService {
|
|
|
5269
5054
|
return { namespace: resolved, storage };
|
|
5270
5055
|
}
|
|
5271
5056
|
|
|
5272
|
-
async getWritableStorageForNamespace(
|
|
5057
|
+
async getWritableStorageForNamespace(
|
|
5058
|
+
namespace?: string,
|
|
5059
|
+
principal?: string
|
|
5060
|
+
): Promise<{
|
|
5061
|
+
principal: string;
|
|
5273
5062
|
namespace: string;
|
|
5274
5063
|
storage: StorageManager;
|
|
5275
5064
|
}> {
|
|
5276
5065
|
if (resolveNamespaceCapabilities(this.orchestrator.config).namespaces && !principal?.trim()) {
|
|
5277
|
-
throw new EngramAccessInputError(
|
|
5278
|
-
"authentication required: namespaces are enabled and no principal was supplied",
|
|
5279
|
-
);
|
|
5066
|
+
throw new EngramAccessInputError("authentication required: namespaces are enabled and no principal was supplied");
|
|
5280
5067
|
}
|
|
5281
5068
|
const resolved = this.writableNamespaceFor(namespace, undefined, principal);
|
|
5282
5069
|
const storage = await this.orchestrator.getStorage(resolved);
|
|
5283
|
-
return { namespace: resolved, storage };
|
|
5070
|
+
return { principal: principal?.trim() ?? "system", namespace: resolved, storage };
|
|
5284
5071
|
}
|
|
5285
|
-
|
|
5286
5072
|
get storageRef(): StorageManager {
|
|
5287
5073
|
return this.orchestrator.storage;
|
|
5288
5074
|
}
|
|
5289
5075
|
|
|
5290
|
-
// #1522: recordCatalogWrite removed — catalog touch handled at the storage chokepoint.
|
|
5076
|
+
// #1522: recordCatalogWrite removed — catalog touch handled at the storage chokepoint.
|
|
5291
5077
|
|
|
5292
5078
|
get configRef(): PluginConfig {
|
|
5293
5079
|
return this.orchestrator.config;
|
|
5294
5080
|
}
|
|
5081
|
+
getStorageForResolvedNamespace(namespace: string): Promise<StorageManager> {
|
|
5082
|
+
return this.orchestrator.getStorage(namespace);
|
|
5083
|
+
}
|
|
5295
5084
|
|
|
5296
5085
|
get localLlmRef(): LocalLlmClient | null {
|
|
5297
5086
|
return this.orchestrator.localLlm ?? null;
|
|
@@ -5332,7 +5121,7 @@ export class EngramAccessService {
|
|
|
5332
5121
|
memoryDir?: string;
|
|
5333
5122
|
namespace?: string;
|
|
5334
5123
|
principal?: string;
|
|
5335
|
-
}
|
|
5124
|
+
}
|
|
5336
5125
|
): Promise<ImportCapsuleResult> {
|
|
5337
5126
|
const { namespace, principal, root: explicitRoot, memoryDir: explicitMemoryDir, ...importOptions } = opts;
|
|
5338
5127
|
const resolvedNamespace = this.writableNamespaceFor(namespace, undefined, principal);
|
|
@@ -5378,23 +5167,15 @@ export class EngramAccessService {
|
|
|
5378
5167
|
}
|
|
5379
5168
|
|
|
5380
5169
|
private isCapsuleImportPathInputFsError(err: unknown): boolean {
|
|
5381
|
-
const code =
|
|
5382
|
-
? (err as { code?: unknown }).code
|
|
5383
|
-
|
|
5384
|
-
return (
|
|
5385
|
-
code === "ENOENT" ||
|
|
5386
|
-
code === "ENOTDIR" ||
|
|
5387
|
-
code === "EACCES" ||
|
|
5388
|
-
code === "EPERM" ||
|
|
5389
|
-
code === "ELOOP"
|
|
5390
|
-
);
|
|
5170
|
+
const code =
|
|
5171
|
+
typeof err === "object" && err !== null && "code" in err ? (err as { code?: unknown }).code : undefined;
|
|
5172
|
+
return code === "ENOENT" || code === "ENOTDIR" || code === "EACCES" || code === "EPERM" || code === "ELOOP";
|
|
5391
5173
|
}
|
|
5392
5174
|
|
|
5393
5175
|
private isCapsuleImportArchiveInputError(err: unknown, message: string): boolean {
|
|
5394
5176
|
if (err instanceof ZodError) return true;
|
|
5395
|
-
const code =
|
|
5396
|
-
? (err as { code?: unknown }).code
|
|
5397
|
-
: undefined;
|
|
5177
|
+
const code =
|
|
5178
|
+
typeof err === "object" && err !== null && "code" in err ? (err as { code?: unknown }).code : undefined;
|
|
5398
5179
|
if (typeof code === "string" && code.startsWith("Z_")) return true;
|
|
5399
5180
|
return (
|
|
5400
5181
|
message.startsWith("importCapsule: archive") ||
|
|
@@ -5419,14 +5200,14 @@ export class EngramAccessService {
|
|
|
5419
5200
|
memoryDir?: string;
|
|
5420
5201
|
namespace?: string;
|
|
5421
5202
|
principal?: string;
|
|
5422
|
-
}
|
|
5203
|
+
}
|
|
5423
5204
|
): Promise<ExportCapsuleResult> {
|
|
5424
5205
|
const { namespace, principal, root: explicitRoot, memoryDir: explicitMemoryDir, ...exportOptions } = opts;
|
|
5425
5206
|
const resolvedNamespace = this.writableNamespaceFor(namespace, undefined, principal);
|
|
5426
5207
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
5427
5208
|
const root = explicitRoot ?? storage.dir;
|
|
5428
5209
|
const memoryDir = explicitMemoryDir ?? this.orchestrator.config.memoryDir;
|
|
5429
|
-
const pluginVersion = exportOptions.pluginVersion ?? await getPackageVersion();
|
|
5210
|
+
const pluginVersion = exportOptions.pluginVersion ?? (await getPackageVersion());
|
|
5430
5211
|
return exportCapsuleFn({
|
|
5431
5212
|
...exportOptions,
|
|
5432
5213
|
pluginVersion,
|
|
@@ -5439,9 +5220,7 @@ export class EngramAccessService {
|
|
|
5439
5220
|
namespace?: string;
|
|
5440
5221
|
principal?: string;
|
|
5441
5222
|
}): Promise<EngramAccessCapsuleListResponse> {
|
|
5442
|
-
return this.accessAdminOpsSurface.capsuleList(
|
|
5443
|
-
options,
|
|
5444
|
-
);
|
|
5223
|
+
return this.accessAdminOpsSurface.capsuleList(options);
|
|
5445
5224
|
}
|
|
5446
5225
|
|
|
5447
5226
|
/**
|
|
@@ -5455,23 +5234,23 @@ export class EngramAccessService {
|
|
|
5455
5234
|
private get offlineSyncUserExcludes(): RegExp[] {
|
|
5456
5235
|
if (!this._offlineSyncUserExcludes) {
|
|
5457
5236
|
this._offlineSyncUserExcludes = compileOfflineSyncExcludeGlobs(
|
|
5458
|
-
this.orchestrator.config.offlineSyncExcludes ?? []
|
|
5237
|
+
this.orchestrator.config.offlineSyncExcludes ?? []
|
|
5459
5238
|
);
|
|
5460
5239
|
}
|
|
5461
5240
|
return this._offlineSyncUserExcludes;
|
|
5462
5241
|
}
|
|
5463
5242
|
|
|
5464
5243
|
async offlineSyncSnapshot(
|
|
5465
|
-
options: EngramAccessOfflineSyncSnapshotRequest & { signal?: AbortSignal } = {}
|
|
5244
|
+
options: EngramAccessOfflineSyncSnapshotRequest & { signal?: AbortSignal } = {}
|
|
5466
5245
|
): Promise<EngramAccessOfflineSyncSnapshotResponse> {
|
|
5467
5246
|
const resolvedNamespace = this.resolveReadableNamespace(options.namespace, options.principal);
|
|
5468
5247
|
const storage = await offlineSyncStorageForSnapshot(this.orchestrator, resolvedNamespace);
|
|
5469
5248
|
const storageHash = createHash("sha256").update(storage.dir).digest("hex").slice(0, 16);
|
|
5470
|
-
const deletions = [...await storage.readDeletionRevisions()]
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5249
|
+
const deletions = [...(await storage.readDeletionRevisions())].map(([path, mtimeMs]) => ({ path, mtimeMs }));
|
|
5250
|
+
const snapshotBuilder =
|
|
5251
|
+
options.includeContent === false && options.baseFiles && options.baseFiles.length > 0
|
|
5252
|
+
? buildOfflineSyncSnapshotFromBase
|
|
5253
|
+
: buildOfflineSyncSnapshot;
|
|
5475
5254
|
const snapshot = await snapshotBuilder({
|
|
5476
5255
|
root: storage.dir,
|
|
5477
5256
|
sourceId: `remnic:${resolvedNamespace}:${storageHash}`,
|
|
@@ -5483,6 +5262,7 @@ export class EngramAccessService {
|
|
|
5483
5262
|
signal: options.signal,
|
|
5484
5263
|
userExcludeRegexps: this.offlineSyncUserExcludes,
|
|
5485
5264
|
deletions,
|
|
5265
|
+
excludeFile: createSupportPassportPrivateFileExclusion(storage),
|
|
5486
5266
|
});
|
|
5487
5267
|
return {
|
|
5488
5268
|
namespace: resolvedNamespace,
|
|
@@ -5491,15 +5271,16 @@ export class EngramAccessService {
|
|
|
5491
5271
|
}
|
|
5492
5272
|
|
|
5493
5273
|
async offlineSyncSnapshotStream(
|
|
5494
|
-
options: Omit<EngramAccessOfflineSyncSnapshotRequest, "baseCapturedAt" | "baseFiles"> & {
|
|
5274
|
+
options: Omit<EngramAccessOfflineSyncSnapshotRequest, "baseCapturedAt" | "baseFiles"> & {
|
|
5275
|
+
signal?: AbortSignal;
|
|
5276
|
+
} = {}
|
|
5495
5277
|
): Promise<EngramAccessOfflineSyncSnapshotStreamResponse> {
|
|
5496
5278
|
const resolvedNamespace = this.resolveReadableNamespace(options.namespace, options.principal);
|
|
5497
5279
|
const storage = await offlineSyncStorageForSnapshot(this.orchestrator, resolvedNamespace);
|
|
5498
5280
|
const storageHash = createHash("sha256").update(storage.dir).digest("hex").slice(0, 16);
|
|
5499
5281
|
const deletions = await filterOfflineSyncDeletionRevisions({
|
|
5500
5282
|
root: storage.dir,
|
|
5501
|
-
deletions: [...await storage.readDeletionRevisions()]
|
|
5502
|
-
.map(([path, mtimeMs]) => ({ path, mtimeMs })),
|
|
5283
|
+
deletions: [...(await storage.readDeletionRevisions())].map(([path, mtimeMs]) => ({ path, mtimeMs })),
|
|
5503
5284
|
includeTranscripts: options.includeTranscripts !== false,
|
|
5504
5285
|
userExcludeRegexps: this.offlineSyncUserExcludes,
|
|
5505
5286
|
});
|
|
@@ -5519,11 +5300,12 @@ export class EngramAccessService {
|
|
|
5519
5300
|
readFileDigest: async ({ filePath }) => storage.digestOfflineSyncFile(filePath),
|
|
5520
5301
|
signal: options.signal,
|
|
5521
5302
|
userExcludeRegexps: this.offlineSyncUserExcludes,
|
|
5303
|
+
excludeFile: createSupportPassportPrivateFileExclusion(storage),
|
|
5522
5304
|
}),
|
|
5523
5305
|
};
|
|
5524
5306
|
}
|
|
5525
5307
|
async offlineSyncManifestStream(
|
|
5526
|
-
options: EngramAccessOfflineSyncManifestRequest & { signal?: AbortSignal } = {}
|
|
5308
|
+
options: EngramAccessOfflineSyncManifestRequest & { signal?: AbortSignal } = {}
|
|
5527
5309
|
): Promise<OfflineSyncManifestStreamResponse> {
|
|
5528
5310
|
const namespace = this.resolveReadableNamespace(options.namespace, options.principal);
|
|
5529
5311
|
return createOfflineSyncManifestStream(
|
|
@@ -5531,14 +5313,11 @@ export class EngramAccessService {
|
|
|
5531
5313
|
namespace,
|
|
5532
5314
|
this.offlineSyncUserExcludes,
|
|
5533
5315
|
options,
|
|
5534
|
-
parseFrontmatter
|
|
5316
|
+
parseFrontmatter
|
|
5535
5317
|
);
|
|
5536
5318
|
}
|
|
5537
5319
|
|
|
5538
|
-
|
|
5539
|
-
async offlineSyncFiles(
|
|
5540
|
-
options: EngramAccessOfflineSyncFilesRequest,
|
|
5541
|
-
): Promise<EngramAccessOfflineSyncFilesResponse> {
|
|
5320
|
+
async offlineSyncFiles(options: EngramAccessOfflineSyncFilesRequest): Promise<EngramAccessOfflineSyncFilesResponse> {
|
|
5542
5321
|
const resolvedNamespace = this.resolveReadableNamespace(options.namespace, options.principal);
|
|
5543
5322
|
const storage = await offlineSyncStorageForSnapshot(this.orchestrator, resolvedNamespace);
|
|
5544
5323
|
const storageHash = createHash("sha256").update(storage.dir).digest("hex").slice(0, 16);
|
|
@@ -5551,6 +5330,7 @@ export class EngramAccessService {
|
|
|
5551
5330
|
includeTranscripts: options.includeTranscripts !== false,
|
|
5552
5331
|
readFile: async ({ filePath }) => storage.readOfflineSyncFile(filePath),
|
|
5553
5332
|
userExcludeRegexps: this.offlineSyncUserExcludes,
|
|
5333
|
+
excludeFile: createSupportPassportPrivateFileExclusion(storage),
|
|
5554
5334
|
});
|
|
5555
5335
|
return {
|
|
5556
5336
|
namespace: resolvedNamespace,
|
|
@@ -5570,7 +5350,7 @@ export class EngramAccessService {
|
|
|
5570
5350
|
}
|
|
5571
5351
|
|
|
5572
5352
|
async offlineSyncFileContent(
|
|
5573
|
-
options: EngramAccessOfflineSyncFileContentRequest
|
|
5353
|
+
options: EngramAccessOfflineSyncFileContentRequest
|
|
5574
5354
|
): Promise<EngramAccessOfflineSyncFileContentResponse> {
|
|
5575
5355
|
const resolvedNamespace = this.resolveReadableNamespace(options.namespace, options.principal);
|
|
5576
5356
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
@@ -5583,6 +5363,7 @@ export class EngramAccessService {
|
|
|
5583
5363
|
includeTranscripts: options.includeTranscripts !== false,
|
|
5584
5364
|
readFile: async ({ filePath }) => storage.readOfflineSyncFile(filePath),
|
|
5585
5365
|
userExcludeRegexps: this.offlineSyncUserExcludes,
|
|
5366
|
+
excludeFile: createSupportPassportPrivateFileExclusion(storage),
|
|
5586
5367
|
});
|
|
5587
5368
|
return {
|
|
5588
5369
|
namespace: resolvedNamespace,
|
|
@@ -5604,32 +5385,12 @@ export class EngramAccessService {
|
|
|
5604
5385
|
}
|
|
5605
5386
|
|
|
5606
5387
|
async offlineSyncApplyFileContent(
|
|
5607
|
-
options: EngramAccessOfflineSyncApplyFileContentRequest
|
|
5388
|
+
options: EngramAccessOfflineSyncApplyFileContentRequest
|
|
5608
5389
|
): Promise<EngramAccessOfflineSyncApplyFileContentResponse> {
|
|
5609
|
-
const resolvedNamespace = this.writableNamespaceFor(
|
|
5610
|
-
options.namespace,
|
|
5611
|
-
undefined,
|
|
5612
|
-
options.principal,
|
|
5613
|
-
);
|
|
5390
|
+
const resolvedNamespace = this.writableNamespaceFor(options.namespace, undefined, options.principal);
|
|
5614
5391
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
5615
5392
|
try {
|
|
5616
|
-
const result = await
|
|
5617
|
-
root: storage.dir,
|
|
5618
|
-
sourceId: options.sourceId,
|
|
5619
|
-
path: options.path,
|
|
5620
|
-
sha256: options.sha256,
|
|
5621
|
-
bytes: options.bytes,
|
|
5622
|
-
mtimeMs: options.mtimeMs,
|
|
5623
|
-
offset: options.offset,
|
|
5624
|
-
baseSha256: options.baseSha256,
|
|
5625
|
-
content: options.content,
|
|
5626
|
-
includeTranscripts: options.includeTranscripts !== false,
|
|
5627
|
-
readFile: async ({ filePath }) => storage.readOfflineSyncFile(filePath),
|
|
5628
|
-
readFileDigest: async ({ filePath }) => storage.digestOfflineSyncFile(filePath),
|
|
5629
|
-
writeFile: async ({ filePath, content }) => storage.writeOfflineSyncFile(filePath, content),
|
|
5630
|
-
writeStagingFile: async ({ filePath, content }) => storage.writeOfflineSyncStagingFile(filePath, content),
|
|
5631
|
-
writeFileChunks: async ({ filePath, chunks }) => storage.writeOfflineSyncFileChunks(filePath, chunks),
|
|
5632
|
-
});
|
|
5393
|
+
const result = await applySupportPassportOfflineSyncFileContent(storage, options);
|
|
5633
5394
|
return {
|
|
5634
5395
|
namespace: resolvedNamespace,
|
|
5635
5396
|
...result,
|
|
@@ -5655,21 +5416,17 @@ export class EngramAccessService {
|
|
|
5655
5416
|
}
|
|
5656
5417
|
|
|
5657
5418
|
async offlineSyncFinalizeConvergence(
|
|
5658
|
-
options: EngramAccessOfflineSyncFinalizeConvergenceRequest
|
|
5419
|
+
options: EngramAccessOfflineSyncFinalizeConvergenceRequest
|
|
5659
5420
|
): Promise<EngramAccessOfflineSyncFinalizeConvergenceResponse> {
|
|
5660
5421
|
if (options.sourceId !== "remnic-converge") {
|
|
5661
5422
|
throw new EngramAccessInputError("sourceId must be remnic-converge");
|
|
5662
5423
|
}
|
|
5663
|
-
const requestedNamespaces = options.namespaces?.length
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
undefined,
|
|
5670
|
-
options.principal,
|
|
5671
|
-
)),
|
|
5672
|
-
));
|
|
5424
|
+
const requestedNamespaces = options.namespaces?.length ? options.namespaces : [undefined];
|
|
5425
|
+
const resolvedNamespaces = Array.from(
|
|
5426
|
+
new Set(
|
|
5427
|
+
requestedNamespaces.map((namespace) => this.writableNamespaceFor(namespace, undefined, options.principal))
|
|
5428
|
+
)
|
|
5429
|
+
);
|
|
5673
5430
|
await this.orchestrator.refreshNamespacesAfterConvergence(resolvedNamespaces);
|
|
5674
5431
|
return {
|
|
5675
5432
|
namespaces: resolvedNamespaces,
|
|
@@ -5677,28 +5434,11 @@ export class EngramAccessService {
|
|
|
5677
5434
|
};
|
|
5678
5435
|
}
|
|
5679
5436
|
|
|
5680
|
-
async offlineSyncApply(
|
|
5681
|
-
options
|
|
5682
|
-
): Promise<EngramAccessOfflineSyncApplyResponse> {
|
|
5683
|
-
const resolvedNamespace = this.writableNamespaceFor(
|
|
5684
|
-
options.namespace,
|
|
5685
|
-
undefined,
|
|
5686
|
-
options.principal,
|
|
5687
|
-
);
|
|
5437
|
+
async offlineSyncApply(options: EngramAccessOfflineSyncApplyRequest): Promise<EngramAccessOfflineSyncApplyResponse> {
|
|
5438
|
+
const resolvedNamespace = this.writableNamespaceFor(options.namespace, undefined, options.principal);
|
|
5688
5439
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
5689
5440
|
try {
|
|
5690
|
-
const result = await
|
|
5691
|
-
root: storage.dir,
|
|
5692
|
-
changeset: options.changeset,
|
|
5693
|
-
returnCurrentFiles: options.returnCurrentFiles,
|
|
5694
|
-
readFile: async ({ filePath }) => storage.readOfflineSyncFile(filePath),
|
|
5695
|
-
readFileDigest: async ({ filePath }) => storage.digestOfflineSyncFile(filePath),
|
|
5696
|
-
writeFile: async ({ filePath, content }) => storage.writeOfflineSyncFile(filePath, content),
|
|
5697
|
-
deleteFile: async ({ filePath, mtimeMs }) =>
|
|
5698
|
-
storage.deleteOfflineSyncFile(filePath, mtimeMs ?? null),
|
|
5699
|
-
recordDeletionRevision: async ({ filePath, mtimeMs }) =>
|
|
5700
|
-
storage.recordReplicatedDeletionRevision(filePath, mtimeMs),
|
|
5701
|
-
});
|
|
5441
|
+
const result = await applySupportPassportOfflineSyncChangeset(storage, options);
|
|
5702
5442
|
return {
|
|
5703
5443
|
namespace: resolvedNamespace,
|
|
5704
5444
|
...result,
|
|
@@ -5740,9 +5480,7 @@ export class EngramAccessService {
|
|
|
5740
5480
|
namespace?: string;
|
|
5741
5481
|
authenticatedPrincipal?: string;
|
|
5742
5482
|
}): Promise<import("./types.js").DreamsRunResult> {
|
|
5743
|
-
return this.accessAdminOpsSurface.dreamsRun(
|
|
5744
|
-
options,
|
|
5745
|
-
);
|
|
5483
|
+
return this.accessAdminOpsSurface.dreamsRun(options);
|
|
5746
5484
|
}
|
|
5747
5485
|
|
|
5748
5486
|
// ---------------------------------------------------------------------------
|
|
@@ -5771,19 +5509,27 @@ export class EngramAccessService {
|
|
|
5771
5509
|
return wearablesMeetings.wearablesStatus(this.wmHost, scope);
|
|
5772
5510
|
}
|
|
5773
5511
|
|
|
5774
|
-
async wearablesSync(
|
|
5512
|
+
async wearablesSync(
|
|
5513
|
+
request: { source?: string; date?: string; days?: number; forceMemories?: boolean } & WearablesMeetingsScope
|
|
5514
|
+
): Promise<Awaited<ReturnType<WearablesService["sync"]>>> {
|
|
5775
5515
|
return wearablesMeetings.wearablesSync(this.wmHost, request);
|
|
5776
5516
|
}
|
|
5777
5517
|
|
|
5778
|
-
async wearablesTranscriptDay(
|
|
5518
|
+
async wearablesTranscriptDay(
|
|
5519
|
+
request: { date: string; source?: string } & WearablesMeetingsScope
|
|
5520
|
+
): Promise<Awaited<ReturnType<WearablesService["dayTranscript"]>>> {
|
|
5779
5521
|
return wearablesMeetings.wearablesTranscriptDay(this.wmHost, request);
|
|
5780
5522
|
}
|
|
5781
5523
|
|
|
5782
|
-
async wearablesTranscriptSearch(
|
|
5524
|
+
async wearablesTranscriptSearch(
|
|
5525
|
+
request: { query: string; source?: string; from?: string; to?: string; limit?: number } & WearablesMeetingsScope
|
|
5526
|
+
): Promise<Awaited<ReturnType<WearablesService["searchTranscripts"]>>> {
|
|
5783
5527
|
return wearablesMeetings.wearablesTranscriptSearch(this.wmHost, request);
|
|
5784
5528
|
}
|
|
5785
5529
|
|
|
5786
|
-
async wearablesTranscriptMemories(
|
|
5530
|
+
async wearablesTranscriptMemories(
|
|
5531
|
+
request: { source?: string; date?: string; limit?: number } & WearablesMeetingsScope
|
|
5532
|
+
): Promise<Awaited<ReturnType<WearablesService["transcriptMemories"]>>> {
|
|
5787
5533
|
return wearablesMeetings.wearablesTranscriptMemories(this.wmHost, request);
|
|
5788
5534
|
}
|
|
5789
5535
|
|
|
@@ -5823,7 +5569,7 @@ export class EngramAccessService {
|
|
|
5823
5569
|
// inspectScope helper (admin-surfaces.ts) owns the single namespace-flag
|
|
5824
5570
|
// read for this surface and threads it through resolveScopePlan.
|
|
5825
5571
|
const codingContext = options.sessionKey
|
|
5826
|
-
? this.orchestrator.getCodingContextForSession(options.sessionKey) ?? null
|
|
5572
|
+
? (this.orchestrator.getCodingContextForSession(options.sessionKey) ?? null)
|
|
5827
5573
|
: null;
|
|
5828
5574
|
const inspection = inspectScope({
|
|
5829
5575
|
config,
|
|
@@ -5901,8 +5647,6 @@ export class EngramAccessService {
|
|
|
5901
5647
|
reason: string;
|
|
5902
5648
|
actor?: never; // ignored — actor is derived from the authenticated principal
|
|
5903
5649
|
}) {
|
|
5904
|
-
return this.accessAdminOpsSurface.adminPromoteMemory(
|
|
5905
|
-
request,
|
|
5906
|
-
);
|
|
5650
|
+
return this.accessAdminOpsSurface.adminPromoteMemory(request);
|
|
5907
5651
|
}
|
|
5908
5652
|
}
|