@remnic/core 9.54.5 → 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 -24
- package/dist/access-admin-ops-surface.js +32 -29
- package/dist/access-authorization-probe.d.ts +25 -23
- package/dist/access-authorization-probe.js +35 -30
- package/dist/access-boundary.d.ts +26 -24
- package/dist/access-boundary.js +36 -31
- package/dist/access-cli.js +86 -80
- 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 -19
- package/dist/access-extraction-force-flush.js +32 -29
- package/dist/access-health-types.d.ts +1 -1
- package/dist/access-http-lcm-compaction.d.ts +22 -22
- package/dist/access-http-lifecycle-flush.d.ts +22 -22
- package/dist/access-http-offline-stream.d.ts +18 -18
- package/dist/access-http-query.js +32 -29
- package/dist/access-http.d.ts +55 -37
- package/dist/access-http.js +52 -43
- package/dist/access-identity-continuity-surface.d.ts +9 -9
- package/dist/access-identity-continuity-surface.js +32 -29
- package/dist/access-lcm-surface.d.ts +21 -21
- package/dist/access-lcm-surface.js +32 -29
- package/dist/access-mcp.d.ts +22 -22
- package/dist/access-mcp.js +40 -36
- package/dist/access-memory-search-fanout.d.ts +2 -2
- package/dist/{access-namespace-preflight-BdHlGd_T.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 +32 -29
- package/dist/access-observe-write-surface.d.ts +22 -22
- package/dist/access-observe-write-surface.js +32 -29
- package/dist/access-offline-manifest.d.ts +9 -9
- package/dist/access-offline-manifest.js +2 -2
- package/dist/access-operations-batch.js +34 -31
- package/dist/access-operations.d.ts +26 -26
- package/dist/access-operations.js +38 -34
- package/dist/access-recall-concurrency.d.ts +21 -21
- package/dist/access-recall-concurrency.js +32 -29
- package/dist/access-recall-response.d.ts +19 -19
- package/dist/access-recall-response.js +32 -29
- package/dist/access-recall-surface.d.ts +19 -19
- package/dist/access-recall-surface.js +32 -29
- package/dist/access-schema.d.ts +88 -88
- package/dist/access-schema.js +3 -3
- package/dist/{access-service-DL7X9hrg.d.ts → access-service-DkSdXK4S.d.ts} +1314 -83
- package/dist/access-service-helpers.d.ts +22 -22
- package/dist/access-service.d.ts +31 -31
- package/dist/access-service.js +32 -29
- package/dist/access-surface-catalog.d.ts +22 -22
- 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 +6 -5
- package/dist/active-memory-bridge.js +2 -2
- package/dist/active-recall.d.ts +1 -1
- package/dist/active-recall.js +2 -1
- package/dist/active-recall.js.map +1 -1
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- 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 +14 -14
- 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 +2 -2
- 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-B90is4d8.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 +15 -15
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/{chunk-CSY44OKU.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-AU7Q3LSC.js → chunk-2QSZNTDO.js} +4 -4
- 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-TKFGFDPJ.js → chunk-3TIZPSJC.js} +4 -4
- package/dist/{chunk-B4T3FQMT.js → chunk-43SEBY2M.js} +1 -1
- package/dist/{chunk-LVKYLMSM.js → chunk-46SZBVDS.js} +2 -2
- package/dist/{chunk-YKZLOPTC.js → chunk-5FD7JMTX.js} +2 -2
- package/dist/{chunk-2PNXOQ4P.js → chunk-5NB726GV.js} +3 -7
- 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-WM5LD6AT.js → chunk-6CYHUWCO.js} +2 -2
- package/dist/{chunk-BIF4SHMD.js → chunk-76JJSXK7.js} +1 -1
- package/dist/chunk-76JJSXK7.js.map +1 -0
- package/dist/{chunk-3SXLD5T3.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-YR65W7BV.js → chunk-BRR5EUTF.js} +3 -3
- package/dist/{chunk-JKW663ZN.js → chunk-CIAI24TQ.js} +2 -2
- package/dist/{chunk-3WGI7F4V.js → chunk-D3LBIUWV.js} +9219 -5233
- package/dist/chunk-D3LBIUWV.js.map +1 -0
- package/dist/{chunk-YDWPYDML.js → chunk-EKTP7MNS.js} +4 -4
- package/dist/{chunk-6LEIWWAF.js → chunk-F2JRDPON.js} +2 -2
- package/dist/{chunk-VYQ4URQB.js → chunk-FFRTNF3L.js} +2 -2
- package/dist/{chunk-TY6MKIWP.js → chunk-FONWBCVY.js} +3 -3
- package/dist/{chunk-XSV2YDCJ.js → chunk-FPLM2TKD.js} +2 -2
- package/dist/{chunk-VTU5IEKY.js → chunk-FTPONF6B.js} +2 -2
- package/dist/{chunk-6PZGKGAO.js → chunk-FWX7W5PM.js} +2 -2
- package/dist/{chunk-QPW3PAIH.js → chunk-G6DFSS6A.js} +2 -2
- package/dist/{chunk-2DD6ZHOM.js → chunk-GJ776BC2.js} +3 -3
- package/dist/{chunk-XKAR4RF6.js → chunk-GN3WRFJY.js} +6 -6
- package/dist/{chunk-RG426DJO.js → chunk-H7NAZ3UB.js} +2 -2
- package/dist/{chunk-BSXGTDVJ.js → chunk-HBUFQRIM.js} +2 -2
- package/dist/{chunk-FFEBSFVT.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-QTO6BMQZ.js → chunk-I3MSGFGD.js} +17 -6
- package/dist/chunk-I3MSGFGD.js.map +1 -0
- package/dist/{chunk-5JKUSBMX.js → chunk-IKP5OYQQ.js} +2 -2
- package/dist/{chunk-KQAFEZQX.js → chunk-IPLYGWQF.js} +5 -5
- package/dist/{chunk-DBY26JJJ.js → chunk-IQ4NVWEF.js} +2 -2
- package/dist/{chunk-7Q7JWLQ4.js → chunk-JYG4OLWH.js} +2 -2
- package/dist/{chunk-3OTSVCPK.js → chunk-K26NWEOC.js} +4 -4
- package/dist/{chunk-WZWZRZ2V.js → chunk-K2UGPTYY.js} +484 -43
- 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-HOIRB77A.js → chunk-L6Z5OAS4.js} +2 -2
- package/dist/{chunk-7RZJWZ46.js → chunk-LEPOP46W.js} +5 -5
- package/dist/{chunk-QQXWFDRD.js → chunk-M4YHAODQ.js} +270 -684
- package/dist/chunk-M4YHAODQ.js.map +1 -0
- package/dist/{chunk-NGT35IGQ.js → chunk-MIH3CJPN.js} +3 -3
- package/dist/{chunk-QPAQSG3F.js → chunk-MK5VEWCR.js} +2 -2
- package/dist/chunk-NISZQW72.js +140 -0
- package/dist/chunk-NISZQW72.js.map +1 -0
- package/dist/{chunk-L7RTUEDG.js → chunk-OCIP6YMD.js} +2 -2
- package/dist/{chunk-2INWPC6E.js → chunk-PG4QBPVG.js} +20 -10
- package/dist/chunk-PG4QBPVG.js.map +1 -0
- package/dist/{chunk-DDA55IVB.js → chunk-PT54WISF.js} +189 -55
- package/dist/chunk-PT54WISF.js.map +1 -0
- package/dist/{chunk-UWJNKGBA.js → chunk-QZLDRQ4I.js} +5 -5
- package/dist/{chunk-UYOXFFEY.js → chunk-RUNORG2P.js} +3 -3
- package/dist/{chunk-LC3FD4BV.js → chunk-RZQ6W2W4.js} +39 -39
- package/dist/{chunk-MRGJZ75M.js → chunk-SMNYAMJD.js} +3 -3
- package/dist/{chunk-MKQBXQKU.js → chunk-TB6CBZ5V.js} +22 -15
- package/dist/chunk-TB6CBZ5V.js.map +1 -0
- package/dist/{chunk-DN2IDKI5.js → chunk-TO7ZTWJW.js} +2 -2
- package/dist/{chunk-K2TDK7GG.js → chunk-TWTUGCTY.js} +2 -2
- package/dist/{chunk-CUTFSLSD.js → chunk-UCTS3DDH.js} +2 -2
- package/dist/{chunk-JYIJNNN3.js → chunk-UG6VXIOK.js} +2 -2
- package/dist/{chunk-QOQQMVR2.js → chunk-UKYS3NU5.js} +2 -2
- package/dist/{chunk-VZRFGJCH.js → chunk-UPLZNJKN.js} +2 -2
- package/dist/{chunk-C23BYTJV.js → chunk-UW5NPZJ2.js} +40 -12
- package/dist/chunk-UW5NPZJ2.js.map +1 -0
- package/dist/{chunk-DOOWFDWN.js → chunk-V6ERBR7U.js} +2 -2
- package/dist/{chunk-7HG7MGAP.js → chunk-W5ZKPI34.js} +462 -2673
- package/dist/chunk-W5ZKPI34.js.map +1 -0
- package/dist/{chunk-HNDIND7P.js → chunk-XX4HPFFM.js} +54 -15
- package/dist/chunk-XX4HPFFM.js.map +1 -0
- package/dist/{chunk-N7CXQ5TA.js → chunk-XZHE2DEN.js} +1 -1
- package/dist/chunk-YXQEKCZM.js +223 -0
- package/dist/chunk-YXQEKCZM.js.map +1 -0
- package/dist/{chunk-6NNNURLK.js → chunk-Z54EM5YZ.js} +4 -4
- package/dist/{chunk-F2Y6I74C.js → chunk-ZRZVLB7O.js} +2 -2
- package/dist/{chunk-CLKBV3Z3.js → chunk-ZUKIUXHQ.js} +9 -9
- package/dist/{cli-jfuZXixq.d.ts → cli-Bze8S0Qs.d.ts} +5 -5
- package/dist/cli.d.ts +22 -22
- package/dist/cli.js +66 -58
- package/dist/coding/pre-action-gate.d.ts +1 -1
- package/dist/compounding/engine.d.ts +2 -2
- package/dist/compounding/engine.js +14 -14
- 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 +2 -1
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +14 -14
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +14 -14
- 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 +2 -2
- package/dist/{contradiction-scan-KCADHXPE.js → contradiction-scan-JDTBXRGW.js} +3 -3
- package/dist/converge-config.d.ts +1 -1
- package/dist/convergence-refresh.d.ts +2 -2
- package/dist/convergence-refresh.js +16 -16
- 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 +16 -16
- 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-CTDuAVJc.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 +14 -14
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +9 -9
- package/dist/explicit-capture.js +4 -3
- package/dist/external-wiki-access.d.ts +22 -22
- package/dist/external-wiki-access.js +33 -30
- 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 -22
- 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 +20 -20
- package/dist/fallback-llm.d.ts +14 -1
- package/dist/fallback-llm.js +1 -1
- package/dist/{first-start-migration-LMMZFLKK.js → first-start-migration-CRZCZAJN.js} +5 -5
- 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 +704 -1421
- package/dist/index.js +203 -118
- 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 +2 -2
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/index.js +2 -2
- 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 +14 -14
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +14 -14
- package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-projection.js +15 -15
- package/dist/{maintenance-heMZSq7G.d.ts → maintenance-C8aRWfhq.d.ts} +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +22 -22
- 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-store.d.ts +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 +15 -15
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/search.js +6 -6
- package/dist/namespaces/storage.d.ts +3 -3
- package/dist/namespaces/storage.js +14 -14
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/offline-sync-impression-drain.d.ts +1 -1
- package/dist/operator-doctor-corpus.d.ts +1 -1
- package/dist/operator-doctor-corpus.js +17 -17
- package/dist/operator-doctor-replica.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +3 -3
- package/dist/operator-toolkit.js +23 -22
- package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
- package/dist/orchestration/maintenance.d.ts +4 -4
- package/dist/orchestration/maintenance.js +19 -19
- package/dist/{orchestrator-BQQPsSjs.d.ts → orchestrator-D85CzDDY.d.ts} +8 -8
- package/dist/orchestrator.d.ts +9 -9
- package/dist/orchestrator.js +86 -80
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/{pipeline-DFfmsnGk.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/{qmd-BF5bcVRs.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 +1 -1
- package/dist/reconcile/manifest.d.ts +1 -1
- package/dist/reconcile/plan.d.ts +1 -1
- package/dist/replay/normalizers/chatgpt.d.ts +1 -1
- package/dist/replay/normalizers/claude.d.ts +1 -1
- package/dist/replay/normalizers/openclaw.d.ts +1 -1
- package/dist/replay/normalizers/shared.d.ts +1 -1
- package/dist/replay/runner.d.ts +1 -1
- package/dist/replay/types.d.ts +1 -1
- package/dist/replica-divergence.d.ts +1 -1
- package/dist/replica-peers-config.d.ts +1 -1
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/resume-bundles.js +3 -2
- 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 +116 -116
- package/dist/{scope-profiles-CbUOsE_E.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 +5 -5
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +9 -9
- 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-DAB3xdKM.d.ts → semantic-consolidation-BP7NAX0N.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +15 -15
- package/dist/semantic-rule-promotion.js +14 -14
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +14 -14
- package/dist/{service-DGKg2O6r.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 +9 -9
- package/dist/signal.d.ts +1 -1
- package/dist/source-agent-qualifier.d.ts +1 -1
- package/dist/source-agent-qualifier.js +16 -16
- package/dist/{storage-CC1jKcWg.d.ts → storage-qOnaJ1Lw.d.ts} +4 -1
- package/dist/storage.d.ts +2 -2
- package/dist/storage.js +13 -13
- 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 +1 -1
- package/dist/tier-routing.js +2 -2
- package/dist/{tier-stats-JDN6HRNT.js → tier-stats-EXYSKSVN.js} +3 -3
- 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 +90 -90
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-BnQza1y8.d.ts → types-ed-SvS2t.d.ts} +7 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.js +14 -14
- 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 +1940 -643
- package/src/access-http.ts +81 -74
- package/src/access-mcp.ts +3 -1
- package/src/access-operations.ts +2 -0
- package/src/access-service.ts +612 -845
- package/src/access-surface-catalog.test.ts +40 -10
- package/src/access-surface-catalog.ts +15 -0
- package/src/active-memory-bridge.ts +17 -19
- package/src/config.ts +18 -9
- package/src/fallback-llm.test.ts +54 -0
- package/src/fallback-llm.ts +54 -9
- 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/mcp-read-only-tools.ts +3 -0
- package/src/relay/mission-access.test.ts +11 -11
- package/src/relay/mission-ui.test.ts +3 -1
- package/src/storage/tombstone-blocked-capture-sync.ts +31 -0
- package/src/storage-contract/failure-semantics.test.ts +102 -0
- 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 +8 -0
- package/src/support-passport/card-projection.ts +77 -16
- 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 +533 -31
- package/src/support-passport/card-service.ts +506 -364
- 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 +15 -2
- package/src/support-passport/contracts.ts +13 -0
- package/src/support-passport/errors.ts +6 -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 +45 -1
- package/src/support-passport/grant-generated-batch-scope.test.ts +201 -0
- package/src/support-passport/grant-service-cache.test.ts +2 -2
- package/src/support-passport/grant-service-cancellation.test.ts +2 -0
- package/src/support-passport/grant-service-marker-cache.test.ts +62 -0
- package/src/support-passport/grant-service.test.ts +853 -239
- package/src/support-passport/grant-service.ts +206 -57
- package/src/support-passport/grant-store.ts +7 -3
- package/src/support-passport/index.ts +10 -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/owner-http.test.ts +671 -0
- package/src/support-passport/owner-lock.ts +26 -9
- package/src/support-passport/private-file.test.ts +99 -0
- package/src/support-passport/private-file.ts +139 -12
- 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/types.ts +7 -0
- package/src/write-rate-limiter.test.ts +30 -6
- package/src/write-rate-limiter.ts +29 -18
- package/dist/chunk-2INWPC6E.js.map +0 -1
- package/dist/chunk-2PNXOQ4P.js.map +0 -1
- package/dist/chunk-3SXLD5T3.js.map +0 -1
- package/dist/chunk-3WGI7F4V.js.map +0 -1
- package/dist/chunk-7HG7MGAP.js.map +0 -1
- package/dist/chunk-BIF4SHMD.js.map +0 -1
- package/dist/chunk-C23BYTJV.js.map +0 -1
- package/dist/chunk-CSY44OKU.js.map +0 -1
- package/dist/chunk-DDA55IVB.js.map +0 -1
- package/dist/chunk-HNDIND7P.js.map +0 -1
- package/dist/chunk-L6CQ7WIW.js.map +0 -1
- package/dist/chunk-MKQBXQKU.js.map +0 -1
- package/dist/chunk-QQXWFDRD.js.map +0 -1
- package/dist/chunk-QTO6BMQZ.js.map +0 -1
- package/dist/chunk-WZWZRZ2V.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-AU7Q3LSC.js.map → chunk-2QSZNTDO.js.map} +0 -0
- /package/dist/{chunk-TKFGFDPJ.js.map → chunk-3TIZPSJC.js.map} +0 -0
- /package/dist/{chunk-B4T3FQMT.js.map → chunk-43SEBY2M.js.map} +0 -0
- /package/dist/{chunk-LVKYLMSM.js.map → chunk-46SZBVDS.js.map} +0 -0
- /package/dist/{chunk-YKZLOPTC.js.map → chunk-5FD7JMTX.js.map} +0 -0
- /package/dist/{chunk-WM5LD6AT.js.map → chunk-6CYHUWCO.js.map} +0 -0
- /package/dist/{chunk-YR65W7BV.js.map → chunk-BRR5EUTF.js.map} +0 -0
- /package/dist/{chunk-JKW663ZN.js.map → chunk-CIAI24TQ.js.map} +0 -0
- /package/dist/{chunk-YDWPYDML.js.map → chunk-EKTP7MNS.js.map} +0 -0
- /package/dist/{chunk-6LEIWWAF.js.map → chunk-F2JRDPON.js.map} +0 -0
- /package/dist/{chunk-VYQ4URQB.js.map → chunk-FFRTNF3L.js.map} +0 -0
- /package/dist/{chunk-TY6MKIWP.js.map → chunk-FONWBCVY.js.map} +0 -0
- /package/dist/{chunk-XSV2YDCJ.js.map → chunk-FPLM2TKD.js.map} +0 -0
- /package/dist/{chunk-VTU5IEKY.js.map → chunk-FTPONF6B.js.map} +0 -0
- /package/dist/{chunk-6PZGKGAO.js.map → chunk-FWX7W5PM.js.map} +0 -0
- /package/dist/{chunk-QPW3PAIH.js.map → chunk-G6DFSS6A.js.map} +0 -0
- /package/dist/{chunk-2DD6ZHOM.js.map → chunk-GJ776BC2.js.map} +0 -0
- /package/dist/{chunk-XKAR4RF6.js.map → chunk-GN3WRFJY.js.map} +0 -0
- /package/dist/{chunk-RG426DJO.js.map → chunk-H7NAZ3UB.js.map} +0 -0
- /package/dist/{chunk-BSXGTDVJ.js.map → chunk-HBUFQRIM.js.map} +0 -0
- /package/dist/{chunk-FFEBSFVT.js.map → chunk-HGJ6NJ4E.js.map} +0 -0
- /package/dist/{chunk-5JKUSBMX.js.map → chunk-IKP5OYQQ.js.map} +0 -0
- /package/dist/{chunk-KQAFEZQX.js.map → chunk-IPLYGWQF.js.map} +0 -0
- /package/dist/{chunk-DBY26JJJ.js.map → chunk-IQ4NVWEF.js.map} +0 -0
- /package/dist/{chunk-7Q7JWLQ4.js.map → chunk-JYG4OLWH.js.map} +0 -0
- /package/dist/{chunk-3OTSVCPK.js.map → chunk-K26NWEOC.js.map} +0 -0
- /package/dist/{chunk-HOIRB77A.js.map → chunk-L6Z5OAS4.js.map} +0 -0
- /package/dist/{chunk-7RZJWZ46.js.map → chunk-LEPOP46W.js.map} +0 -0
- /package/dist/{chunk-NGT35IGQ.js.map → chunk-MIH3CJPN.js.map} +0 -0
- /package/dist/{chunk-QPAQSG3F.js.map → chunk-MK5VEWCR.js.map} +0 -0
- /package/dist/{chunk-L7RTUEDG.js.map → chunk-OCIP6YMD.js.map} +0 -0
- /package/dist/{chunk-UWJNKGBA.js.map → chunk-QZLDRQ4I.js.map} +0 -0
- /package/dist/{chunk-UYOXFFEY.js.map → chunk-RUNORG2P.js.map} +0 -0
- /package/dist/{chunk-LC3FD4BV.js.map → chunk-RZQ6W2W4.js.map} +0 -0
- /package/dist/{chunk-MRGJZ75M.js.map → chunk-SMNYAMJD.js.map} +0 -0
- /package/dist/{chunk-DN2IDKI5.js.map → chunk-TO7ZTWJW.js.map} +0 -0
- /package/dist/{chunk-K2TDK7GG.js.map → chunk-TWTUGCTY.js.map} +0 -0
- /package/dist/{chunk-CUTFSLSD.js.map → chunk-UCTS3DDH.js.map} +0 -0
- /package/dist/{chunk-JYIJNNN3.js.map → chunk-UG6VXIOK.js.map} +0 -0
- /package/dist/{chunk-QOQQMVR2.js.map → chunk-UKYS3NU5.js.map} +0 -0
- /package/dist/{chunk-VZRFGJCH.js.map → chunk-UPLZNJKN.js.map} +0 -0
- /package/dist/{chunk-DOOWFDWN.js.map → chunk-V6ERBR7U.js.map} +0 -0
- /package/dist/{chunk-N7CXQ5TA.js.map → chunk-XZHE2DEN.js.map} +0 -0
- /package/dist/{chunk-6NNNURLK.js.map → chunk-Z54EM5YZ.js.map} +0 -0
- /package/dist/{chunk-F2Y6I74C.js.map → chunk-ZRZVLB7O.js.map} +0 -0
- /package/dist/{chunk-CLKBV3Z3.js.map → chunk-ZUKIUXHQ.js.map} +0 -0
- /package/dist/{contradiction-scan-KCADHXPE.js.map → contradiction-scan-JDTBXRGW.js.map} +0 -0
- /package/dist/{first-start-migration-LMMZFLKK.js.map → first-start-migration-CRZCZAJN.js.map} +0 -0
- /package/dist/{tier-stats-JDN6HRNT.js.map → tier-stats-EXYSKSVN.js.map} +0 -0
package/src/access-service.ts
CHANGED
|
@@ -1,217 +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
|
-
import {
|
|
36
|
-
combineNamespaces,
|
|
37
|
-
lcmSessionKeyForNamespace,
|
|
38
|
-
projectTagProjectId,
|
|
39
|
-
resolveCodingNamespaceOverlay,
|
|
40
|
-
type CodingNamespaceOverlay,
|
|
41
|
-
} from "./coding/coding-namespace.js";
|
|
42
38
|
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 { createSupportPassportPrivateFileExclusion, isSupportPassportPrivateMemory } from "./support-passport/card-projection.js";
|
|
114
|
-
import {
|
|
115
|
-
applySupportPassportOfflineSyncChangeset,
|
|
116
|
-
applySupportPassportOfflineSyncFileContent,
|
|
117
|
-
} from "./support-passport/offline-sync-guard.js";
|
|
118
|
-
import {
|
|
119
|
-
buildQualityScore,
|
|
120
109
|
buildProposedActions,
|
|
110
|
+
buildQualityScore,
|
|
121
111
|
groupActionsByStatus,
|
|
122
112
|
listMemoryGovernanceRuns,
|
|
123
|
-
readMemoryGovernanceRunArtifact,
|
|
113
|
+
type readMemoryGovernanceRunArtifact,
|
|
124
114
|
runMemoryGovernance,
|
|
125
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";
|
|
126
121
|
import { runProcedureMining } from "./procedural/procedure-miner.js";
|
|
122
|
+
import type { AnomalyDetectorResult } from "./recall-audit-anomaly.js";
|
|
123
|
+
import { isHandleToken } from "./recall-handles.js";
|
|
127
124
|
import { displayErrorDetail } from "./runtime/better-sqlite.js";
|
|
128
|
-
import
|
|
129
|
-
|
|
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";
|
|
130
135
|
import type { WearablesService } from "./wearables/service.js";
|
|
131
|
-
import
|
|
132
|
-
import
|
|
136
|
+
import { exportWorkBoardMarkdown, exportWorkBoardSnapshot, importWorkBoardSnapshot } from "./work/board.js";
|
|
137
|
+
import { wrapWorkLayerContext } from "./work/boundary.js";
|
|
138
|
+
import { WorkStorage } from "./work/storage.js";
|
|
133
139
|
|
|
134
140
|
import * as wearablesMeetings from "./access-wearables-meetings-surface.js";
|
|
135
141
|
import type { WearablesMeetingsHost, WearablesMeetingsScope } from "./access-wearables-meetings-surface.js";
|
|
136
142
|
export type { WearablesMeetingsScope };
|
|
143
|
+
import * as nodePath from "node:path";
|
|
137
144
|
import {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
} from "./
|
|
141
|
-
import {
|
|
142
|
-
normalizeProjectionPreview,
|
|
143
|
-
normalizeProjectionTags,
|
|
144
|
-
} from "./memory-projection-format.js";
|
|
145
|
-
import {
|
|
146
|
-
inferMemoryStatus,
|
|
147
|
-
toMemoryPathRel,
|
|
148
|
-
} from "./memory-lifecycle-ledger-utils.js";
|
|
149
|
-
import { getMemoryProjectionPath } from "./memory-projection-store.js";
|
|
150
|
-
import { canReadNamespace, canWriteNamespace, citationAuthorizedNamespaces, defaultNamespaceForPrincipal, recallNamespacesForPrincipal, resolvePrincipal } from "./namespaces/principal.js";
|
|
145
|
+
type EngramAccessNamespaceWritableRequest,
|
|
146
|
+
resolveNamespaceWritablePreflight,
|
|
147
|
+
} from "./access-namespace-preflight.js";
|
|
151
148
|
import {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
type
|
|
155
|
-
type
|
|
156
|
-
|
|
157
|
-
} from "./
|
|
158
|
-
import {
|
|
159
|
-
type ScopePlan,
|
|
160
|
-
resolveScopePlan,
|
|
161
|
-
resolveScopedWritableNamespaceValue,
|
|
162
|
-
resolveWritableNamespaceValue,
|
|
163
|
-
type WritableNamespaceResult,
|
|
164
|
-
} from "./scopes/scope-plan.js";
|
|
165
|
-
import { resolveNamespaceWritablePreflight, type EngramAccessNamespaceWritableRequest } from "./access-namespace-preflight.js";
|
|
166
|
-
import { namespaceIdentityFromToken } from "./namespaces/identity.js";
|
|
167
|
-
import { namespaceCollectionName } from "./namespaces/search.js";
|
|
168
|
-
import { SecureStoreLockedError } from "./secure-store/index.js";
|
|
169
|
-
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";
|
|
170
155
|
import {
|
|
156
|
+
type AdminNamespaceFilter,
|
|
157
|
+
type AdminNamespaceQmdHealth,
|
|
171
158
|
AdminPromotionError,
|
|
159
|
+
type InspectScopeOptions,
|
|
160
|
+
type MemoryPromotionTargetKind,
|
|
161
|
+
type PromotionStorageProvider,
|
|
162
|
+
type ScopeInspection,
|
|
172
163
|
auditTranscripts,
|
|
173
164
|
gatherMaintenanceHealth,
|
|
174
165
|
inspectScope,
|
|
175
166
|
listAdminNamespaces,
|
|
176
167
|
promoteMemory,
|
|
177
168
|
redactSensitive,
|
|
178
|
-
type AdminNamespaceFilter,
|
|
179
|
-
type AdminNamespaceQmdHealth,
|
|
180
|
-
type InspectScopeOptions,
|
|
181
|
-
type MemoryPromotionTargetKind,
|
|
182
|
-
type PromotionStorageProvider,
|
|
183
|
-
type ScopeInspection,
|
|
184
169
|
} from "./admin/admin-surfaces.js";
|
|
185
|
-
import
|
|
186
|
-
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";
|
|
187
197
|
import type {
|
|
188
198
|
GraphRecallSnapshot,
|
|
189
199
|
IntentDebugSnapshot,
|
|
190
200
|
Orchestrator,
|
|
191
201
|
RecallInvocationOptions,
|
|
192
202
|
} from "./orchestrator.js";
|
|
193
|
-
import {
|
|
194
|
-
import {
|
|
195
|
-
|
|
196
|
-
type GraphSnapshotRequest,
|
|
197
|
-
type GraphSnapshotResponse,
|
|
198
|
-
type GraphSnapshotNodeMetadata,
|
|
199
|
-
} from "./graph-snapshot.js";
|
|
200
|
-
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";
|
|
201
206
|
import {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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";
|
|
207
216
|
import {
|
|
208
|
-
getTrustZoneStoreStatus,
|
|
209
|
-
isTrustZoneName,
|
|
210
|
-
listTrustZoneRecords,
|
|
211
|
-
promoteTrustZoneRecord,
|
|
212
|
-
scoreTrustZoneProvenance,
|
|
213
|
-
seedTrustZoneDemoDataset,
|
|
214
|
-
summarizeTrustZonePromotionReadiness,
|
|
215
217
|
type TrustZoneDemoSeedResult,
|
|
216
218
|
type TrustZoneName,
|
|
217
219
|
type TrustZonePromotionResult,
|
|
@@ -220,26 +222,28 @@ import {
|
|
|
220
222
|
type TrustZoneRecordKind,
|
|
221
223
|
type TrustZoneSourceClass,
|
|
222
224
|
type TrustZoneStoreStatus,
|
|
225
|
+
getTrustZoneStoreStatus,
|
|
226
|
+
isTrustZoneName,
|
|
227
|
+
listTrustZoneRecords,
|
|
228
|
+
promoteTrustZoneRecord,
|
|
229
|
+
scoreTrustZoneProvenance,
|
|
230
|
+
seedTrustZoneDemoDataset,
|
|
231
|
+
summarizeTrustZonePromotionReadiness,
|
|
223
232
|
} from "./trust-zones.js";
|
|
224
233
|
import type {
|
|
234
|
+
CodingContext,
|
|
225
235
|
EntityFile,
|
|
226
|
-
MemoryFile,
|
|
227
236
|
MemoryActionOutcome,
|
|
228
|
-
CodingContext, SourceConnectorProvenance,
|
|
229
237
|
MemoryActionType,
|
|
238
|
+
MemoryFile,
|
|
230
239
|
MemoryLifecycleEvent,
|
|
231
240
|
MemoryStatus,
|
|
232
241
|
PluginConfig,
|
|
233
242
|
RecallDisclosure,
|
|
234
243
|
RecallPlanMode,
|
|
244
|
+
SourceConnectorProvenance,
|
|
235
245
|
} from "./types.js";
|
|
236
|
-
import {
|
|
237
|
-
delegateExtractionForceFlush,
|
|
238
|
-
type EngramAccessExtractionForceFlushRequest,
|
|
239
|
-
type EngramAccessExtractionForceFlushResponse,
|
|
240
|
-
type EngramAccessLcmCompactionFlushRequest,
|
|
241
|
-
type EngramAccessLcmCompactionFlushResponse,
|
|
242
|
-
} from "./access-service-helpers.js";
|
|
246
|
+
import type { SupportPassportModelRoute } from "./support-passport/model-adapter.js";
|
|
243
247
|
export type {
|
|
244
248
|
EngramAccessExtractionForceFlushRequest,
|
|
245
249
|
EngramAccessExtractionForceFlushResponse,
|
|
@@ -247,79 +251,70 @@ export type {
|
|
|
247
251
|
EngramAccessLcmCompactionFlushResponse,
|
|
248
252
|
};
|
|
249
253
|
|
|
250
|
-
import {
|
|
251
|
-
import {
|
|
252
|
-
import
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
} 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";
|
|
256
260
|
import {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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";
|
|
265
272
|
import type { SemanticDedupLookup } from "./dedup/semantic.js";
|
|
266
|
-
import {
|
|
273
|
+
import type { FallbackLlmClient } from "./fallback-llm.js";
|
|
274
|
+
import type { LocalLlmClient } from "./local-llm.js";
|
|
267
275
|
import {
|
|
268
|
-
recordMemoryOutcome,
|
|
269
276
|
type MemoryOutcomeKind,
|
|
270
277
|
type RecordMemoryOutcomeResult,
|
|
278
|
+
recordMemoryOutcome,
|
|
271
279
|
} from "./memory-worth-outcomes.js";
|
|
272
|
-
import {
|
|
280
|
+
import type { LcmMessagePartInput, MessagePartSourceFormat } from "./message-parts/index.js";
|
|
273
281
|
import { recordObjectiveStateSnapshotsFromObservedMessages } from "./objective-state-writers.js";
|
|
282
|
+
import { objectiveStateStoreOverrideForNamespace } from "./objective-state.js";
|
|
283
|
+
import { offlineSyncStorageForSnapshot } from "./offline-sync-impression-drain.js";
|
|
274
284
|
import {
|
|
275
|
-
importCapsule as importCapsuleFn,
|
|
276
|
-
type ImportCapsuleOptions,
|
|
277
|
-
type ImportCapsuleResult,
|
|
278
|
-
} from "./transfer/capsule-import.js";
|
|
279
|
-
import {
|
|
280
|
-
exportCapsule as exportCapsuleFn,
|
|
281
|
-
type ExportCapsuleOptions,
|
|
282
|
-
type ExportCapsuleResult,
|
|
283
|
-
} from "./transfer/capsule-export.js";
|
|
284
|
-
import {
|
|
285
|
-
defaultCapsulesDir,
|
|
286
|
-
type CapsuleListEntry,
|
|
287
|
-
} from "./capsule-cli.js";
|
|
288
|
-
import {
|
|
289
|
-
compileOfflineSyncExcludeGlobs,
|
|
290
|
-
buildOfflineSyncSnapshot,
|
|
291
|
-
buildOfflineSyncSnapshotFromBase,
|
|
292
|
-
buildOfflineSyncSnapshotForPaths,
|
|
293
|
-
iterateOfflineSyncSnapshotFileRecords,
|
|
294
|
-
filterOfflineSyncDeletionRevisions,
|
|
295
285
|
OFFLINE_SYNC_SNAPSHOT_FORMAT,
|
|
296
|
-
readOfflineSyncFileContentChunk,
|
|
297
|
-
type OfflineSyncApplyFileContentChunkResult,
|
|
298
286
|
type OfflineSyncApplyChangesetResult,
|
|
299
|
-
type
|
|
287
|
+
type OfflineSyncApplyFileContentChunkResult,
|
|
300
288
|
type OfflineSyncFileContentChunk,
|
|
289
|
+
type OfflineSyncFileRecord,
|
|
301
290
|
type OfflineSyncFileState,
|
|
302
291
|
type OfflineSyncSnapshot,
|
|
292
|
+
buildOfflineSyncSnapshot,
|
|
293
|
+
buildOfflineSyncSnapshotForPaths,
|
|
294
|
+
buildOfflineSyncSnapshotFromBase,
|
|
295
|
+
compileOfflineSyncExcludeGlobs,
|
|
296
|
+
filterOfflineSyncDeletionRevisions,
|
|
297
|
+
iterateOfflineSyncSnapshotFileRecords,
|
|
298
|
+
readOfflineSyncFileContentChunk,
|
|
303
299
|
} from "./offline-sync.js";
|
|
304
|
-
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";
|
|
305
307
|
import {
|
|
306
|
-
|
|
307
|
-
type
|
|
308
|
-
|
|
308
|
+
type ExportCapsuleOptions,
|
|
309
|
+
type ExportCapsuleResult,
|
|
310
|
+
exportCapsule as exportCapsuleFn,
|
|
311
|
+
} from "./transfer/capsule-export.js";
|
|
309
312
|
import {
|
|
310
|
-
|
|
311
|
-
type
|
|
312
|
-
|
|
313
|
-
} from "./
|
|
314
|
-
import {
|
|
315
|
-
import { resolveAccessSetupCapabilities, resolveGraphConstructionCapabilities, resolveIndexingCapabilities } from "./capabilities.js";
|
|
316
|
-
import { resolveRecallEnhancementCapabilities } from "./capabilities.js";
|
|
317
|
-
import { AccessObserveWriteSurface } from "./access-observe-write-surface.js";
|
|
318
|
-
import { AccessLcmSurface } from "./access-lcm-surface.js";
|
|
319
|
-
import { AccessAdminOpsSurface } from "./access-admin-ops-surface.js";
|
|
320
|
-
import { AccessRecallSurface } from "./access-recall-surface.js";
|
|
321
|
-
import { AccessIdentityContinuitySurface } from "./access-identity-continuity-surface.js";
|
|
322
|
-
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";
|
|
323
318
|
|
|
324
319
|
import { EngramAccessInputError, NamespaceNotWritableError } from "./access-errors.js";
|
|
325
320
|
// Re-exported so existing `import { … } from "./access-service.js"` callers keep
|
|
@@ -349,9 +344,7 @@ async function getPackageVersion(): Promise<string> {
|
|
|
349
344
|
try {
|
|
350
345
|
const raw = await nodeFs.readFile(new URL("../package.json", import.meta.url), "utf-8");
|
|
351
346
|
const parsed = JSON.parse(raw) as { version?: unknown };
|
|
352
|
-
cachedPackageVersion = typeof parsed.version === "string" && parsed.version.length > 0
|
|
353
|
-
? parsed.version
|
|
354
|
-
: "unknown";
|
|
347
|
+
cachedPackageVersion = typeof parsed.version === "string" && parsed.version.length > 0 ? parsed.version : "unknown";
|
|
355
348
|
} catch {
|
|
356
349
|
cachedPackageVersion = "unknown";
|
|
357
350
|
}
|
|
@@ -880,7 +873,9 @@ export type EngramAccessActionConfidenceResponse = ActionConfidenceResult;
|
|
|
880
873
|
|
|
881
874
|
export async function buildProjectedGovernanceProposedActions(
|
|
882
875
|
storage: Awaited<ReturnType<Orchestrator["getStorage"]>>,
|
|
883
|
-
projected: NonNullable<
|
|
876
|
+
projected: NonNullable<
|
|
877
|
+
Awaited<ReturnType<Awaited<ReturnType<Orchestrator["getStorage"]>>["getProjectedGovernanceRecord"]>>
|
|
878
|
+
>
|
|
884
879
|
): Promise<Awaited<ReturnType<typeof readMemoryGovernanceRunArtifact>>["appliedActions"]> {
|
|
885
880
|
const reviewQueue = projected.reviewQueueRows.map((row) => ({
|
|
886
881
|
entryId: row.entryId,
|
|
@@ -892,13 +887,14 @@ export async function buildProjectedGovernanceProposedActions(
|
|
|
892
887
|
suggestedStatus: row.suggestedStatus,
|
|
893
888
|
relatedMemoryIds: row.relatedMemoryIds,
|
|
894
889
|
})) as Awaited<ReturnType<typeof readMemoryGovernanceRunArtifact>>["reviewQueue"];
|
|
895
|
-
const memories = (
|
|
896
|
-
.
|
|
890
|
+
const memories = (
|
|
891
|
+
await Promise.all(projected.reviewQueueRows.map((row) => storage.getMemoryById(row.memoryId)))
|
|
892
|
+
).filter((memory): memory is MemoryFile => Boolean(memory));
|
|
897
893
|
return buildProposedActions(reviewQueue, memories);
|
|
898
894
|
}
|
|
899
895
|
|
|
900
896
|
export function hasGroupedGovernanceActions(
|
|
901
|
-
grouped?: Awaited<ReturnType<typeof readMemoryGovernanceRunArtifact>>["transitionReport"]["proposed"]
|
|
897
|
+
grouped?: Awaited<ReturnType<typeof readMemoryGovernanceRunArtifact>>["transitionReport"]["proposed"]
|
|
902
898
|
): boolean {
|
|
903
899
|
if (!grouped) return false;
|
|
904
900
|
return Object.values(grouped).some((actions) => Array.isArray(actions) && actions.length > 0);
|
|
@@ -1132,7 +1128,6 @@ export interface EngramAccessLcmStatusResponse {
|
|
|
1132
1128
|
stats?: { totalTurns?: number };
|
|
1133
1129
|
}
|
|
1134
1130
|
|
|
1135
|
-
|
|
1136
1131
|
export interface EngramAccessLcmCompactionRecordRequest {
|
|
1137
1132
|
sessionKey: string;
|
|
1138
1133
|
namespace?: string;
|
|
@@ -1158,7 +1153,7 @@ function normalizePagination(limit?: number, offset?: number): { limit: number;
|
|
|
1158
1153
|
}
|
|
1159
1154
|
|
|
1160
1155
|
function normalizeBrowseSort(
|
|
1161
|
-
sort?: EngramAccessMemoryBrowseRequest["sort"]
|
|
1156
|
+
sort?: EngramAccessMemoryBrowseRequest["sort"]
|
|
1162
1157
|
): NonNullable<EngramAccessMemoryBrowseRequest["sort"]> {
|
|
1163
1158
|
switch (sort) {
|
|
1164
1159
|
case "updated_asc":
|
|
@@ -1191,7 +1186,7 @@ function summarizeTrustZoneRecord(
|
|
|
1191
1186
|
allRecords: TrustZoneRecord[],
|
|
1192
1187
|
poisoningDefenseEnabled: boolean,
|
|
1193
1188
|
trustZonesEnabled: boolean,
|
|
1194
|
-
promotionEnabled: boolean
|
|
1189
|
+
promotionEnabled: boolean
|
|
1195
1190
|
): EngramAccessTrustZoneRecordSummary {
|
|
1196
1191
|
const trustScore = poisoningDefenseEnabled ? scoreTrustZoneProvenance(record) : undefined;
|
|
1197
1192
|
const readiness = summarizeTrustZonePromotionReadiness({
|
|
@@ -1234,7 +1229,7 @@ function summarizeTrustZoneRecord(
|
|
|
1234
1229
|
function compareBrowseMemory(
|
|
1235
1230
|
sort: NonNullable<EngramAccessMemoryBrowseRequest["sort"]>,
|
|
1236
1231
|
left: MemoryFile,
|
|
1237
|
-
right: MemoryFile
|
|
1232
|
+
right: MemoryFile
|
|
1238
1233
|
): number {
|
|
1239
1234
|
const leftUpdated = left.frontmatter.updated ?? left.frontmatter.created ?? "";
|
|
1240
1235
|
const rightUpdated = right.frontmatter.updated ?? right.frontmatter.created ?? "";
|
|
@@ -1286,10 +1281,9 @@ export function shapeMemorySummary(
|
|
|
1286
1281
|
memory: MemoryFile,
|
|
1287
1282
|
baseDir: string,
|
|
1288
1283
|
disclosure?: RecallDisclosure,
|
|
1289
|
-
rawExcerpts?: EngramAccessMemorySummary["rawExcerpts"]
|
|
1284
|
+
rawExcerpts?: EngramAccessMemorySummary["rawExcerpts"]
|
|
1290
1285
|
): EngramAccessMemorySummary {
|
|
1291
|
-
const includeFullContent =
|
|
1292
|
-
disclosure === "section" || disclosure === "raw";
|
|
1286
|
+
const includeFullContent = disclosure === "section" || disclosure === "raw";
|
|
1293
1287
|
return {
|
|
1294
1288
|
id: memory.frontmatter.id,
|
|
1295
1289
|
path: memory.path,
|
|
@@ -1302,13 +1296,11 @@ export function shapeMemorySummary(
|
|
|
1302
1296
|
preview: normalizeProjectionPreview(memory.content),
|
|
1303
1297
|
...(disclosure !== undefined ? { disclosure } : {}),
|
|
1304
1298
|
...(includeFullContent ? { content: memory.content } : {}),
|
|
1305
|
-
...(disclosure === "raw" && rawExcerpts !== undefined
|
|
1306
|
-
? { rawExcerpts }
|
|
1307
|
-
: {}),
|
|
1299
|
+
...(disclosure === "raw" && rawExcerpts !== undefined ? { rawExcerpts } : {}),
|
|
1308
1300
|
};
|
|
1309
1301
|
}
|
|
1310
1302
|
|
|
1311
|
-
export class EngramAccessService {
|
|
1303
|
+
export class EngramAccessService extends SupportPassportAccessServiceBase {
|
|
1312
1304
|
private readonly idempotency: AccessIdempotencyStore;
|
|
1313
1305
|
private readonly idempotencyLocks = new Map<string, Promise<void>>();
|
|
1314
1306
|
private readonly recallSemaphores = new Map<string, unknown>();
|
|
@@ -1317,6 +1309,7 @@ export class EngramAccessService {
|
|
|
1317
1309
|
private readonly auditAdapter: AccessAuditAdapter | null;
|
|
1318
1310
|
private readonly corpusWatermarkCache = new CorpusWatermarkCache();
|
|
1319
1311
|
private readonly replicaDivergenceMonitor: ReplicaDivergenceMonitor;
|
|
1312
|
+
private readonly injectedSupportPassportGatewayRoute: SupportPassportModelRoute | null;
|
|
1320
1313
|
|
|
1321
1314
|
/** AccessObserveWriteSurface (access-service decomposition). Lazy; selfDeps live wiring. */
|
|
1322
1315
|
private _accessObserveWriteSurface: AccessObserveWriteSurface | undefined;
|
|
@@ -1324,7 +1317,7 @@ export class EngramAccessService {
|
|
|
1324
1317
|
private get accessObserveWriteSurface(): AccessObserveWriteSurface {
|
|
1325
1318
|
if (!this._accessObserveWriteSurface) {
|
|
1326
1319
|
this._accessObserveWriteSurface = new AccessObserveWriteSurface(
|
|
1327
|
-
selfDeps<ConstructorParameters<typeof AccessObserveWriteSurface>[0]>(this)
|
|
1320
|
+
selfDeps<ConstructorParameters<typeof AccessObserveWriteSurface>[0]>(this)
|
|
1328
1321
|
);
|
|
1329
1322
|
}
|
|
1330
1323
|
return this._accessObserveWriteSurface;
|
|
@@ -1335,9 +1328,7 @@ export class EngramAccessService {
|
|
|
1335
1328
|
|
|
1336
1329
|
private get accessLcmSurface(): AccessLcmSurface {
|
|
1337
1330
|
if (!this._accessLcmSurface) {
|
|
1338
|
-
this._accessLcmSurface = new AccessLcmSurface(
|
|
1339
|
-
selfDeps<ConstructorParameters<typeof AccessLcmSurface>[0]>(this),
|
|
1340
|
-
);
|
|
1331
|
+
this._accessLcmSurface = new AccessLcmSurface(selfDeps<ConstructorParameters<typeof AccessLcmSurface>[0]>(this));
|
|
1341
1332
|
}
|
|
1342
1333
|
return this._accessLcmSurface;
|
|
1343
1334
|
}
|
|
@@ -1348,7 +1339,7 @@ export class EngramAccessService {
|
|
|
1348
1339
|
private get accessAdminOpsSurface(): AccessAdminOpsSurface {
|
|
1349
1340
|
if (!this._accessAdminOpsSurface) {
|
|
1350
1341
|
this._accessAdminOpsSurface = new AccessAdminOpsSurface(
|
|
1351
|
-
selfDeps<ConstructorParameters<typeof AccessAdminOpsSurface>[0]>(this)
|
|
1342
|
+
selfDeps<ConstructorParameters<typeof AccessAdminOpsSurface>[0]>(this)
|
|
1352
1343
|
);
|
|
1353
1344
|
}
|
|
1354
1345
|
return this._accessAdminOpsSurface;
|
|
@@ -1360,7 +1351,7 @@ export class EngramAccessService {
|
|
|
1360
1351
|
private get accessRecallSurface(): AccessRecallSurface {
|
|
1361
1352
|
if (!this._accessRecallSurface) {
|
|
1362
1353
|
this._accessRecallSurface = new AccessRecallSurface(
|
|
1363
|
-
selfDeps<ConstructorParameters<typeof AccessRecallSurface>[0]>(this)
|
|
1354
|
+
selfDeps<ConstructorParameters<typeof AccessRecallSurface>[0]>(this)
|
|
1364
1355
|
);
|
|
1365
1356
|
}
|
|
1366
1357
|
return this._accessRecallSurface;
|
|
@@ -1372,20 +1363,28 @@ export class EngramAccessService {
|
|
|
1372
1363
|
private get accessIdentityContinuitySurface(): AccessIdentityContinuitySurface {
|
|
1373
1364
|
if (!this._accessIdentityContinuitySurface) {
|
|
1374
1365
|
this._accessIdentityContinuitySurface = new AccessIdentityContinuitySurface(
|
|
1375
|
-
selfDeps<ConstructorParameters<typeof AccessIdentityContinuitySurface>[0]>(this)
|
|
1366
|
+
selfDeps<ConstructorParameters<typeof AccessIdentityContinuitySurface>[0]>(this)
|
|
1376
1367
|
);
|
|
1377
1368
|
}
|
|
1378
1369
|
return this._accessIdentityContinuitySurface;
|
|
1379
1370
|
}
|
|
1380
1371
|
private readonly extractionLivenessWarn = new ExtractionLivenessWarnThrottle();
|
|
1381
1372
|
|
|
1382
|
-
constructor(
|
|
1373
|
+
constructor(
|
|
1374
|
+
private readonly orchestrator: Orchestrator,
|
|
1375
|
+
options: {
|
|
1376
|
+
resolveSecretRef?: ResolveSecretRefFn | null;
|
|
1377
|
+
supportPassportGatewayRoute?: SupportPassportModelRoute | null;
|
|
1378
|
+
} = {}
|
|
1379
|
+
) {
|
|
1380
|
+
super();
|
|
1383
1381
|
this.idempotency = new AccessIdempotencyStore(orchestrator.config.memoryDir);
|
|
1384
1382
|
// Peer SecretRef tokens resolve at poll time through the host resolver, the
|
|
1385
1383
|
// same indirection as agentAccessHttp.authToken (review round 1). Absent a
|
|
1386
1384
|
// resolver, string/${ENV} tokens still work and a SecretRef degrades to a
|
|
1387
1385
|
// per-peer `unreachable` (never a throw).
|
|
1388
1386
|
this.replicaDivergenceMonitor = new ReplicaDivergenceMonitor({ resolveSecretRef: options.resolveSecretRef });
|
|
1387
|
+
this.injectedSupportPassportGatewayRoute = options.supportPassportGatewayRoute ?? null;
|
|
1389
1388
|
const accessCaps = resolveAccessSetupCapabilities(orchestrator.config); // #1566 Cluster B
|
|
1390
1389
|
this.budget = new CrossNamespaceBudget({
|
|
1391
1390
|
enabled: accessCaps.recallCrossNamespaceBudget,
|
|
@@ -1417,6 +1416,10 @@ export class EngramAccessService {
|
|
|
1417
1416
|
}
|
|
1418
1417
|
}
|
|
1419
1418
|
|
|
1419
|
+
override get supportPassportGatewayRouteRef(): SupportPassportModelRoute | null {
|
|
1420
|
+
return this.injectedSupportPassportGatewayRoute;
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1420
1423
|
get briefingEnabled(): boolean {
|
|
1421
1424
|
return this.orchestrator.config.briefing?.enabled === true;
|
|
1422
1425
|
}
|
|
@@ -1424,7 +1427,10 @@ export class EngramAccessService {
|
|
|
1424
1427
|
private resolveNamespace(namespace?: string): string {
|
|
1425
1428
|
const requested = namespace?.trim();
|
|
1426
1429
|
if (!requested) return this.orchestrator.config.defaultNamespace;
|
|
1427
|
-
if (
|
|
1430
|
+
if (
|
|
1431
|
+
!resolveNamespaceCapabilities(this.orchestrator.config).namespaces &&
|
|
1432
|
+
requested !== this.orchestrator.config.defaultNamespace
|
|
1433
|
+
) {
|
|
1428
1434
|
throw new EngramAccessInputError(`unsupported namespace: ${requested}`);
|
|
1429
1435
|
}
|
|
1430
1436
|
return requested;
|
|
@@ -1441,7 +1447,7 @@ export class EngramAccessService {
|
|
|
1441
1447
|
private resolveRecallNamespace(
|
|
1442
1448
|
namespace: string | undefined,
|
|
1443
1449
|
sessionKey: string | undefined,
|
|
1444
|
-
authenticatedPrincipal?: string
|
|
1450
|
+
authenticatedPrincipal?: string
|
|
1445
1451
|
): string | undefined {
|
|
1446
1452
|
const requested = namespace?.trim();
|
|
1447
1453
|
if (!requested) return undefined;
|
|
@@ -1462,7 +1468,7 @@ export class EngramAccessService {
|
|
|
1462
1468
|
private writableNamespaceFor(
|
|
1463
1469
|
namespace: string | undefined,
|
|
1464
1470
|
sessionKey: string | undefined,
|
|
1465
|
-
authenticatedPrincipal?: string
|
|
1471
|
+
authenticatedPrincipal?: string
|
|
1466
1472
|
): string {
|
|
1467
1473
|
// #1521: delegates to the scope-module resolver. The inline
|
|
1468
1474
|
// namespace/principal resolution + writability check is retired so the
|
|
@@ -1471,7 +1477,7 @@ export class EngramAccessService {
|
|
|
1471
1477
|
namespace,
|
|
1472
1478
|
sessionKey,
|
|
1473
1479
|
authenticatedPrincipal,
|
|
1474
|
-
this.orchestrator.config
|
|
1480
|
+
this.orchestrator.config
|
|
1475
1481
|
);
|
|
1476
1482
|
if (!result.ok) {
|
|
1477
1483
|
if (result.reason === "unsupported") {
|
|
@@ -1479,13 +1485,12 @@ export class EngramAccessService {
|
|
|
1479
1485
|
}
|
|
1480
1486
|
throw new NamespaceNotWritableError(
|
|
1481
1487
|
result.namespace,
|
|
1482
|
-
this.resolveRequestPrincipal(sessionKey, authenticatedPrincipal)
|
|
1488
|
+
this.resolveRequestPrincipal(sessionKey, authenticatedPrincipal)
|
|
1483
1489
|
);
|
|
1484
1490
|
}
|
|
1485
1491
|
return result.namespace;
|
|
1486
1492
|
}
|
|
1487
1493
|
|
|
1488
|
-
|
|
1489
1494
|
/** Shared coding-scope derivation for the read/write resolvers below —
|
|
1490
1495
|
* coding context, overlay, principal, scope-profile plan for an IMPLICIT
|
|
1491
1496
|
* request, IDENTICAL to recall precedence (session-first, per-call fallback)
|
|
@@ -1497,7 +1502,7 @@ export class EngramAccessService {
|
|
|
1497
1502
|
namespace?: string;
|
|
1498
1503
|
sessionKey?: string;
|
|
1499
1504
|
authenticatedPrincipal?: string;
|
|
1500
|
-
}
|
|
1505
|
+
}
|
|
1501
1506
|
): Promise<{
|
|
1502
1507
|
principal: string | undefined;
|
|
1503
1508
|
codingContext: CodingContext | null;
|
|
@@ -1509,14 +1514,13 @@ export class EngramAccessService {
|
|
|
1509
1514
|
// searches the base namespace; a sessionless write/read must too — otherwise
|
|
1510
1515
|
// a client that injects cwd/projectTag but no sessionKey would land in a
|
|
1511
1516
|
// `default-project-*` namespace its own recall never searches (Codex review).
|
|
1512
|
-
const hasSession =
|
|
1513
|
-
typeof request.sessionKey === "string" && request.sessionKey.length > 0;
|
|
1517
|
+
const hasSession = typeof request.sessionKey === "string" && request.sessionKey.length > 0;
|
|
1514
1518
|
const codingContext =
|
|
1515
1519
|
hasSession &&
|
|
1516
1520
|
resolveNamespaceCapabilities(this.orchestrator.config).namespaces &&
|
|
1517
1521
|
this.orchestrator.config.codingMode?.projectScope
|
|
1518
|
-
? this.orchestrator.getCodingContextForSession(request.sessionKey) ??
|
|
1519
|
-
(await resolveCodingContextFromOptions(request))
|
|
1522
|
+
? (this.orchestrator.getCodingContextForSession(request.sessionKey) ??
|
|
1523
|
+
(await resolveCodingContextFromOptions(request)))
|
|
1520
1524
|
: null;
|
|
1521
1525
|
const overlay =
|
|
1522
1526
|
hasSession &&
|
|
@@ -1525,13 +1529,10 @@ export class EngramAccessService {
|
|
|
1525
1529
|
? resolveCodingNamespaceOverlay(
|
|
1526
1530
|
codingContext,
|
|
1527
1531
|
this.orchestrator.config.codingMode,
|
|
1528
|
-
this.orchestrator.config.defaultNamespace
|
|
1532
|
+
this.orchestrator.config.defaultNamespace
|
|
1529
1533
|
)
|
|
1530
1534
|
: null;
|
|
1531
|
-
const principal = this.resolveRequestPrincipal(
|
|
1532
|
-
request.sessionKey,
|
|
1533
|
-
request.authenticatedPrincipal,
|
|
1534
|
-
);
|
|
1535
|
+
const principal = this.resolveRequestPrincipal(request.sessionKey, request.authenticatedPrincipal);
|
|
1535
1536
|
const profilePlan = resolveScopeProfilePlan({
|
|
1536
1537
|
config: this.orchestrator.config,
|
|
1537
1538
|
principal,
|
|
@@ -1542,11 +1543,7 @@ export class EngramAccessService {
|
|
|
1542
1543
|
}
|
|
1543
1544
|
|
|
1544
1545
|
private assertTokenCanWriteNamespace(namespace: string): void {
|
|
1545
|
-
enforceNamespaceAllowList(
|
|
1546
|
-
tokenCapabilityStore.getStore(),
|
|
1547
|
-
namespace,
|
|
1548
|
-
this.orchestrator.config.defaultNamespace,
|
|
1549
|
-
);
|
|
1546
|
+
enforceNamespaceAllowList(tokenCapabilityStore.getStore(), namespace, this.orchestrator.config.defaultNamespace);
|
|
1550
1547
|
}
|
|
1551
1548
|
|
|
1552
1549
|
/**
|
|
@@ -1564,15 +1561,11 @@ export class EngramAccessService {
|
|
|
1564
1561
|
sessionKey?: string;
|
|
1565
1562
|
authenticatedPrincipal?: string;
|
|
1566
1563
|
},
|
|
1567
|
-
enforceToken
|
|
1564
|
+
enforceToken = true
|
|
1568
1565
|
): Promise<string> {
|
|
1569
1566
|
const requested = request.namespace?.trim();
|
|
1570
1567
|
if (requested) {
|
|
1571
|
-
const namespace = this.writableNamespaceFor(
|
|
1572
|
-
requested,
|
|
1573
|
-
request.sessionKey,
|
|
1574
|
-
request.authenticatedPrincipal,
|
|
1575
|
-
);
|
|
1568
|
+
const namespace = this.writableNamespaceFor(requested, request.sessionKey, request.authenticatedPrincipal);
|
|
1576
1569
|
if (enforceToken) this.assertTokenCanWriteNamespace(namespace);
|
|
1577
1570
|
return namespace;
|
|
1578
1571
|
}
|
|
@@ -1594,7 +1587,7 @@ export class EngramAccessService {
|
|
|
1594
1587
|
throw new NamespaceNotWritableError(
|
|
1595
1588
|
result.namespace,
|
|
1596
1589
|
principal,
|
|
1597
|
-
`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"}`
|
|
1598
1591
|
);
|
|
1599
1592
|
}
|
|
1600
1593
|
|
|
@@ -1604,12 +1597,9 @@ export class EngramAccessService {
|
|
|
1604
1597
|
throw new NamespaceNotWritableError(result.namespace, principal);
|
|
1605
1598
|
}
|
|
1606
1599
|
|
|
1607
|
-
async namespaceWritablePreflight(
|
|
1608
|
-
request
|
|
1609
|
-
|
|
1610
|
-
return resolveNamespaceWritablePreflight(
|
|
1611
|
-
request,
|
|
1612
|
-
(preflightRequest) => this.resolveCodingScopedWriteNamespace(preflightRequest, false),
|
|
1600
|
+
async namespaceWritablePreflight(request: EngramAccessNamespaceWritableRequest): Promise<WritableNamespaceResult> {
|
|
1601
|
+
return resolveNamespaceWritablePreflight(request, (preflightRequest) =>
|
|
1602
|
+
this.resolveCodingScopedWriteNamespace(preflightRequest, false)
|
|
1613
1603
|
);
|
|
1614
1604
|
}
|
|
1615
1605
|
|
|
@@ -1625,14 +1615,10 @@ export class EngramAccessService {
|
|
|
1625
1615
|
namespace?: string;
|
|
1626
1616
|
sessionKey?: string;
|
|
1627
1617
|
authenticatedPrincipal?: string;
|
|
1628
|
-
}
|
|
1618
|
+
}
|
|
1629
1619
|
): Promise<string> {
|
|
1630
|
-
const principal = this.resolveRequestPrincipal(
|
|
1631
|
-
|
|
1632
|
-
request.authenticatedPrincipal,
|
|
1633
|
-
);
|
|
1634
|
-
const hasExplicitNamespace =
|
|
1635
|
-
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;
|
|
1636
1622
|
if (hasExplicitNamespace) {
|
|
1637
1623
|
return this.resolveReadableNamespace(request.namespace, principal);
|
|
1638
1624
|
}
|
|
@@ -1696,15 +1682,11 @@ export class EngramAccessService {
|
|
|
1696
1682
|
namespace?: string;
|
|
1697
1683
|
sessionKey?: string;
|
|
1698
1684
|
authenticatedPrincipal?: string;
|
|
1699
|
-
}
|
|
1685
|
+
}
|
|
1700
1686
|
): Promise<MemoryScopePlan> {
|
|
1701
1687
|
const warnings: string[] = [];
|
|
1702
|
-
const principal = this.resolveRequestPrincipal(
|
|
1703
|
-
|
|
1704
|
-
request.authenticatedPrincipal,
|
|
1705
|
-
);
|
|
1706
|
-
const hasExplicitNamespace =
|
|
1707
|
-
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;
|
|
1708
1690
|
|
|
1709
1691
|
if (hasExplicitNamespace) {
|
|
1710
1692
|
// Explicit namespace wins; authorized through the existing policy path.
|
|
@@ -1714,7 +1696,7 @@ export class EngramAccessService {
|
|
|
1714
1696
|
const writeNamespace = this.writableNamespaceFor(
|
|
1715
1697
|
request.namespace,
|
|
1716
1698
|
request.sessionKey,
|
|
1717
|
-
request.authenticatedPrincipal
|
|
1699
|
+
request.authenticatedPrincipal
|
|
1718
1700
|
);
|
|
1719
1701
|
this.assertTokenCanWriteNamespace(writeNamespace);
|
|
1720
1702
|
return {
|
|
@@ -1732,22 +1714,14 @@ export class EngramAccessService {
|
|
|
1732
1714
|
// No explicit namespace → principal self base, optionally overlaid with the
|
|
1733
1715
|
// session's coding (project/branch) context — the SAME resolution recall and
|
|
1734
1716
|
// the orchestrator buffer-flush write path use (rule 42 symmetry).
|
|
1735
|
-
const baseNamespace = defaultNamespaceForPrincipal(
|
|
1736
|
-
principal,
|
|
1737
|
-
this.orchestrator.config,
|
|
1738
|
-
);
|
|
1717
|
+
const baseNamespace = defaultNamespaceForPrincipal(principal, this.orchestrator.config);
|
|
1739
1718
|
|
|
1740
1719
|
// Resolve the coding context and overlay through the shared read-only
|
|
1741
1720
|
// resolver used by the other scoped access paths. It applies the same
|
|
1742
1721
|
// session-first, per-call fallback precedence without mutating session
|
|
1743
1722
|
// state, so concurrent requests cannot observe temporary context.
|
|
1744
|
-
const {
|
|
1745
|
-
|
|
1746
|
-
profilePlan,
|
|
1747
|
-
} = await this.resolveCodingScopeInputs(request);
|
|
1748
|
-
const overlaidBase = codingOverlay
|
|
1749
|
-
? combineNamespaces(baseNamespace, codingOverlay.namespace)
|
|
1750
|
-
: baseNamespace;
|
|
1723
|
+
const { overlay: codingOverlay, profilePlan } = await this.resolveCodingScopeInputs(request);
|
|
1724
|
+
const overlaidBase = codingOverlay ? combineNamespaces(baseNamespace, codingOverlay.namespace) : baseNamespace;
|
|
1751
1725
|
const codingOverlayApplied = overlaidBase !== baseNamespace;
|
|
1752
1726
|
const assertWriteNamespaceAllowed = (namespace: string): void => {
|
|
1753
1727
|
this.assertTokenCanWriteNamespace(namespace);
|
|
@@ -1755,11 +1729,13 @@ export class EngramAccessService {
|
|
|
1755
1729
|
if (profilePlan) {
|
|
1756
1730
|
const selectedLayer = profilePlan.layers.find((layer) => layer.id === profilePlan.writeLayer);
|
|
1757
1731
|
const writeNamespaceReadable =
|
|
1758
|
-
profilePlan.writeNamespace.length > 0 &&
|
|
1759
|
-
profilePlan.readNamespaces.includes(profilePlan.writeNamespace);
|
|
1732
|
+
profilePlan.writeNamespace.length > 0 && profilePlan.readNamespaces.includes(profilePlan.writeNamespace);
|
|
1760
1733
|
if (!selectedLayer?.writable || !writeNamespaceReadable) {
|
|
1761
|
-
throw new NamespaceNotWritableError(
|
|
1762
|
-
|
|
1734
|
+
throw new NamespaceNotWritableError(
|
|
1735
|
+
profilePlan.writeNamespace,
|
|
1736
|
+
principal,
|
|
1737
|
+
`scope profile ${profilePlan.profileId} has no writable layer for principal ${principal ?? "anonymous"}`
|
|
1738
|
+
);
|
|
1763
1739
|
}
|
|
1764
1740
|
const legacyRecallNamespaces = Array.isArray(this.orchestrator.config.defaultRecallNamespaces)
|
|
1765
1741
|
? recallNamespacesForPrincipal(principal, this.orchestrator.config)
|
|
@@ -1780,8 +1756,8 @@ export class EngramAccessService {
|
|
|
1780
1756
|
(layer.id === "userProject" || layer.id === "teamProject") &&
|
|
1781
1757
|
layer.readable &&
|
|
1782
1758
|
layer.namespace &&
|
|
1783
|
-
readNamespaces.includes(layer.namespace)
|
|
1784
|
-
)
|
|
1759
|
+
readNamespaces.includes(layer.namespace)
|
|
1760
|
+
)
|
|
1785
1761
|
);
|
|
1786
1762
|
assertWriteNamespaceAllowed(profilePlan.writeNamespace);
|
|
1787
1763
|
return {
|
|
@@ -1806,11 +1782,7 @@ export class EngramAccessService {
|
|
|
1806
1782
|
// namespace), collapsing the namespaces-disabled / no-session /
|
|
1807
1783
|
// projectScope-off cases to config.defaultNamespace exactly as before
|
|
1808
1784
|
// (rule 39 parity with resolveCodingScopedWriteNamespace).
|
|
1809
|
-
const writeNamespace = this.writableNamespaceFor(
|
|
1810
|
-
undefined,
|
|
1811
|
-
request.sessionKey,
|
|
1812
|
-
request.authenticatedPrincipal,
|
|
1813
|
-
);
|
|
1785
|
+
const writeNamespace = this.writableNamespaceFor(undefined, request.sessionKey, request.authenticatedPrincipal);
|
|
1814
1786
|
// Objective-state keeps its STRICTER pre-#1495 contract (#928): an implicit
|
|
1815
1787
|
// snapshot is based on the PRINCIPAL SELF namespace and authorized against
|
|
1816
1788
|
// THAT base (rule 48 least-privilege). This rejection MUST stay (security):
|
|
@@ -1892,9 +1864,7 @@ export class EngramAccessService {
|
|
|
1892
1864
|
if (scope.scopeProfile && scope.writeLayer !== "userProject") {
|
|
1893
1865
|
return scope.writeNamespace;
|
|
1894
1866
|
}
|
|
1895
|
-
return scope.codingOverlayApplied
|
|
1896
|
-
? this.orchestrator.config.defaultNamespace
|
|
1897
|
-
: scope.writeNamespace;
|
|
1867
|
+
return scope.codingOverlayApplied ? this.orchestrator.config.defaultNamespace : scope.writeNamespace;
|
|
1898
1868
|
}
|
|
1899
1869
|
|
|
1900
1870
|
private async objectiveStateStoreLocationForNamespace(namespace: string): Promise<{
|
|
@@ -1932,9 +1902,7 @@ export class EngramAccessService {
|
|
|
1932
1902
|
// unauthenticated. Unauthenticated callers must NOT be allowed to read
|
|
1933
1903
|
// arbitrary namespaces: that would bypass all readPrincipals policies.
|
|
1934
1904
|
if (!principal) {
|
|
1935
|
-
throw new EngramAccessInputError(
|
|
1936
|
-
"authentication required: namespaces are enabled and no principal was supplied",
|
|
1937
|
-
);
|
|
1905
|
+
throw new EngramAccessInputError("authentication required: namespaces are enabled and no principal was supplied");
|
|
1938
1906
|
}
|
|
1939
1907
|
|
|
1940
1908
|
// Authenticated caller — enforce the namespace ACL as normal.
|
|
@@ -1946,7 +1914,7 @@ export class EngramAccessService {
|
|
|
1946
1914
|
|
|
1947
1915
|
private async resolveReadableNamespacesForSearch(
|
|
1948
1916
|
namespace: string | undefined,
|
|
1949
|
-
principal?: string
|
|
1917
|
+
principal?: string
|
|
1950
1918
|
): Promise<string[]> {
|
|
1951
1919
|
const requested = namespace?.trim();
|
|
1952
1920
|
if (requested) {
|
|
@@ -1958,15 +1926,10 @@ export class EngramAccessService {
|
|
|
1958
1926
|
}
|
|
1959
1927
|
|
|
1960
1928
|
if (!principal) {
|
|
1961
|
-
throw new EngramAccessInputError(
|
|
1962
|
-
"authentication required: namespaces are enabled and no principal was supplied",
|
|
1963
|
-
);
|
|
1929
|
+
throw new EngramAccessInputError("authentication required: namespaces are enabled and no principal was supplied");
|
|
1964
1930
|
}
|
|
1965
1931
|
|
|
1966
|
-
const legacyRecallNamespaces = recallNamespacesForPrincipal(
|
|
1967
|
-
principal,
|
|
1968
|
-
this.orchestrator.config,
|
|
1969
|
-
);
|
|
1932
|
+
const legacyRecallNamespaces = recallNamespacesForPrincipal(principal, this.orchestrator.config);
|
|
1970
1933
|
const profilePlan = resolveScopeProfilePlan({
|
|
1971
1934
|
config: this.orchestrator.config,
|
|
1972
1935
|
principal,
|
|
@@ -1998,9 +1961,7 @@ export class EngramAccessService {
|
|
|
1998
1961
|
});
|
|
1999
1962
|
return mergeMemorySearchDefaultFallback(profileNamespaces, fallback);
|
|
2000
1963
|
}
|
|
2001
|
-
return legacyRecallNamespaces.filter((ns) =>
|
|
2002
|
-
canReadNamespace(principal, ns, this.orchestrator.config),
|
|
2003
|
-
);
|
|
1964
|
+
return legacyRecallNamespaces.filter((ns) => canReadNamespace(principal, ns, this.orchestrator.config));
|
|
2004
1965
|
}
|
|
2005
1966
|
|
|
2006
1967
|
private resolveAllReadableConfiguredNamespaces(principal: string): string[] {
|
|
@@ -2010,14 +1971,13 @@ export class EngramAccessService {
|
|
|
2010
1971
|
config.sharedNamespace,
|
|
2011
1972
|
...config.namespacePolicies.map((policy) => policy.name),
|
|
2012
1973
|
];
|
|
2013
|
-
return [...new Set(candidates)]
|
|
2014
|
-
.filter((namespace) => canReadNamespace(principal, namespace, config));
|
|
1974
|
+
return [...new Set(candidates)].filter((namespace) => canReadNamespace(principal, namespace, config));
|
|
2015
1975
|
}
|
|
2016
1976
|
|
|
2017
1977
|
private resolveMemorySearchNamespacesForCollection(
|
|
2018
1978
|
collection: string | undefined,
|
|
2019
1979
|
namespaces: string[],
|
|
2020
|
-
collectionPrincipal?: string
|
|
1980
|
+
collectionPrincipal?: string
|
|
2021
1981
|
): string[] {
|
|
2022
1982
|
if (!resolveNamespaceCapabilities(this.orchestrator.config).namespaces) {
|
|
2023
1983
|
return namespaces;
|
|
@@ -2057,16 +2017,14 @@ export class EngramAccessService {
|
|
|
2057
2017
|
return matchedNamespaces;
|
|
2058
2018
|
}
|
|
2059
2019
|
|
|
2060
|
-
throw new EngramAccessInputError(
|
|
2061
|
-
"collection is not namespace-scoped for the requested principal",
|
|
2062
|
-
);
|
|
2020
|
+
throw new EngramAccessInputError("collection is not namespace-scoped for the requested principal");
|
|
2063
2021
|
}
|
|
2064
2022
|
|
|
2065
2023
|
private async buildRecallDebug(
|
|
2066
2024
|
snapshot: LastRecallSnapshot | null,
|
|
2067
2025
|
namespace: string,
|
|
2068
2026
|
includeDebug: boolean,
|
|
2069
|
-
sessionKey?: string
|
|
2027
|
+
sessionKey?: string
|
|
2070
2028
|
): Promise<EngramAccessRecallResponse["debug"] | undefined> {
|
|
2071
2029
|
if (!includeDebug) return undefined;
|
|
2072
2030
|
if (!sessionKey?.trim()) return undefined;
|
|
@@ -2076,10 +2034,10 @@ export class EngramAccessService {
|
|
|
2076
2034
|
]);
|
|
2077
2035
|
return snapshot || intent || graph
|
|
2078
2036
|
? {
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2037
|
+
snapshot: snapshot ?? undefined,
|
|
2038
|
+
intent,
|
|
2039
|
+
graph,
|
|
2040
|
+
}
|
|
2083
2041
|
: undefined;
|
|
2084
2042
|
}
|
|
2085
2043
|
|
|
@@ -2112,60 +2070,52 @@ export class EngramAccessService {
|
|
|
2112
2070
|
*/
|
|
2113
2071
|
rawExcerptsSuppressed?: boolean;
|
|
2114
2072
|
}): Promise<EngramAccessRecallResponse> {
|
|
2115
|
-
return this.accessRecallSurface.buildRecallResponseFromXraySnapshot(
|
|
2116
|
-
options,
|
|
2117
|
-
);
|
|
2073
|
+
return this.accessRecallSurface.buildRecallResponseFromXraySnapshot(options);
|
|
2118
2074
|
}
|
|
2119
2075
|
|
|
2120
2076
|
private async serializeRecallResults(
|
|
2121
2077
|
snapshot: LastRecallSnapshot | null,
|
|
2122
2078
|
disclosure: RecallDisclosure,
|
|
2123
|
-
rawContext:
|
|
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
|
-
|
|
2154
|
-
|
|
2155
|
-
}
|
|
2156
|
-
| 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
|
|
2157
2111
|
): Promise<EngramAccessMemorySummary[]> {
|
|
2158
|
-
return this.accessRecallSurface.serializeRecallResults(
|
|
2159
|
-
snapshot,
|
|
2160
|
-
disclosure,
|
|
2161
|
-
rawContext,
|
|
2162
|
-
);
|
|
2112
|
+
return this.accessRecallSurface.serializeRecallResults(snapshot, disclosure, rawContext);
|
|
2163
2113
|
}
|
|
2164
2114
|
|
|
2165
2115
|
private async storageForAbsoluteRecallPath(
|
|
2166
2116
|
memoryPath: string,
|
|
2167
2117
|
primaryNamespace: string,
|
|
2168
|
-
recallNamespaces: readonly string[] = []
|
|
2118
|
+
recallNamespaces: readonly string[] = []
|
|
2169
2119
|
): Promise<{ storage: StorageManager; dir: string; namespace: string } | null> {
|
|
2170
2120
|
const resolvedPath = nodePath.resolve(memoryPath);
|
|
2171
2121
|
const memoryRoot = nodePath.resolve(this.orchestrator.config.memoryDir);
|
|
@@ -2196,10 +2146,7 @@ export class EngramAccessService {
|
|
|
2196
2146
|
}
|
|
2197
2147
|
const candidateRoot = nodePath.resolve(candidateStorage.dir);
|
|
2198
2148
|
if (!isPathInsideStorageRoot(candidateRoot, resolvedPath)) continue;
|
|
2199
|
-
if (
|
|
2200
|
-
candidateRoot === memoryRoot &&
|
|
2201
|
-
isPathInsideStorageRoot(namespacesRoot, resolvedPath)
|
|
2202
|
-
) {
|
|
2149
|
+
if (candidateRoot === memoryRoot && isPathInsideStorageRoot(namespacesRoot, resolvedPath)) {
|
|
2203
2150
|
continue;
|
|
2204
2151
|
}
|
|
2205
2152
|
matches.push({ storage: candidateStorage, dir: candidateRoot, namespace: ns });
|
|
@@ -2227,12 +2174,9 @@ export class EngramAccessService {
|
|
|
2227
2174
|
* callers).
|
|
2228
2175
|
*/
|
|
2229
2176
|
lcmSessionIds?: string[];
|
|
2230
|
-
} | null
|
|
2177
|
+
} | null
|
|
2231
2178
|
): Promise<EngramAccessMemorySummary["rawExcerpts"] | null> {
|
|
2232
|
-
return this.accessRecallSurface.fetchRawExcerpts(
|
|
2233
|
-
disclosure,
|
|
2234
|
-
context,
|
|
2235
|
-
);
|
|
2179
|
+
return this.accessRecallSurface.fetchRawExcerpts(disclosure, context);
|
|
2236
2180
|
}
|
|
2237
2181
|
|
|
2238
2182
|
private async handleIdempotentWrite<T extends { idempotencyReplay?: boolean }>(options: {
|
|
@@ -2352,7 +2296,10 @@ export class EngramAccessService {
|
|
|
2352
2296
|
const current = new Promise<void>((resolve) => {
|
|
2353
2297
|
release = resolve;
|
|
2354
2298
|
});
|
|
2355
|
-
const queued = previous.then(
|
|
2299
|
+
const queued = previous.then(
|
|
2300
|
+
() => current,
|
|
2301
|
+
() => current
|
|
2302
|
+
);
|
|
2356
2303
|
this.idempotencyLocks.set(key, queued);
|
|
2357
2304
|
|
|
2358
2305
|
await previous.catch(() => {});
|
|
@@ -2381,7 +2328,7 @@ export class EngramAccessService {
|
|
|
2381
2328
|
const extraction = await computeExtractionLivenessStatus(
|
|
2382
2329
|
this.orchestrator,
|
|
2383
2330
|
extractionWatermark,
|
|
2384
|
-
caps?.namespaces !== undefined ? undefined : this.extractionLivenessWarn
|
|
2331
|
+
caps?.namespaces !== undefined ? undefined : this.extractionLivenessWarn
|
|
2385
2332
|
);
|
|
2386
2333
|
let scopedDegradedReason: string | null = null;
|
|
2387
2334
|
if (extraction.degraded) {
|
|
@@ -2406,7 +2353,9 @@ export class EngramAccessService {
|
|
|
2406
2353
|
// ONE call: the corpus array and the flag describing it must not come from
|
|
2407
2354
|
// two independently-cached scans (round 8, codex P1).
|
|
2408
2355
|
const corpusCensus = await computeServiceCorpusCensus(this.orchestrator, {
|
|
2409
|
-
cache: this.corpusWatermarkCache,
|
|
2356
|
+
cache: this.corpusWatermarkCache,
|
|
2357
|
+
caps,
|
|
2358
|
+
});
|
|
2410
2359
|
let projectionAvailable = false;
|
|
2411
2360
|
try {
|
|
2412
2361
|
await stat(getMemoryProjectionPath(storage.dir));
|
|
@@ -2426,7 +2375,7 @@ export class EngramAccessService {
|
|
|
2426
2375
|
searchBackend,
|
|
2427
2376
|
qmdEnabled,
|
|
2428
2377
|
resolvedNamespace,
|
|
2429
|
-
this.qmdCollectionForHealth(resolvedNamespace, storage.dir)
|
|
2378
|
+
this.qmdCollectionForHealth(resolvedNamespace, storage.dir)
|
|
2430
2379
|
),
|
|
2431
2380
|
nativeKnowledgeEnabled: this.orchestrator.config.nativeKnowledge?.enabled === true,
|
|
2432
2381
|
projectionAvailable,
|
|
@@ -2452,8 +2401,7 @@ export class EngramAccessService {
|
|
|
2452
2401
|
}
|
|
2453
2402
|
|
|
2454
2403
|
const useLegacyDefaultCollection =
|
|
2455
|
-
namespace === this.orchestrator.config.defaultNamespace &&
|
|
2456
|
-
storageDir === this.orchestrator.config.memoryDir;
|
|
2404
|
+
namespace === this.orchestrator.config.defaultNamespace && storageDir === this.orchestrator.config.memoryDir;
|
|
2457
2405
|
return namespaceCollectionName(this.orchestrator.config.qmdCollection, namespace, {
|
|
2458
2406
|
defaultNamespace: this.orchestrator.config.defaultNamespace,
|
|
2459
2407
|
useLegacyDefaultCollection,
|
|
@@ -2464,34 +2412,24 @@ export class EngramAccessService {
|
|
|
2464
2412
|
searchBackend: string,
|
|
2465
2413
|
qmdEnabled: boolean,
|
|
2466
2414
|
namespace: string,
|
|
2467
|
-
collection: string
|
|
2415
|
+
collection: string
|
|
2468
2416
|
): Promise<EngramAccessQmdHealthResponse> {
|
|
2469
|
-
return this.accessObserveWriteSurface.qmdHealth(
|
|
2470
|
-
searchBackend,
|
|
2471
|
-
qmdEnabled,
|
|
2472
|
-
namespace,
|
|
2473
|
-
collection,
|
|
2474
|
-
);
|
|
2417
|
+
return this.accessObserveWriteSurface.qmdHealth(searchBackend, qmdEnabled, namespace, collection);
|
|
2475
2418
|
}
|
|
2476
2419
|
|
|
2477
2420
|
private async namespaceQmdHealth(
|
|
2478
2421
|
searchBackend: string,
|
|
2479
2422
|
qmdEnabled: boolean,
|
|
2480
2423
|
namespace: string,
|
|
2481
|
-
fallbackCollection: string
|
|
2424
|
+
fallbackCollection: string
|
|
2482
2425
|
): Promise<EngramAccessQmdHealthResponse | null> {
|
|
2483
|
-
return this.accessObserveWriteSurface.namespaceQmdHealth(
|
|
2484
|
-
searchBackend,
|
|
2485
|
-
qmdEnabled,
|
|
2486
|
-
namespace,
|
|
2487
|
-
fallbackCollection,
|
|
2488
|
-
);
|
|
2426
|
+
return this.accessObserveWriteSurface.namespaceQmdHealth(searchBackend, qmdEnabled, namespace, fallbackCollection);
|
|
2489
2427
|
}
|
|
2490
2428
|
|
|
2491
2429
|
private async qmdCollectionState(
|
|
2492
2430
|
searchBackend: string,
|
|
2493
2431
|
qmdEnabled: boolean,
|
|
2494
|
-
collection: string
|
|
2432
|
+
collection: string
|
|
2495
2433
|
): Promise<EngramAccessQmdCollectionState> {
|
|
2496
2434
|
if (searchBackend !== "qmd" || !qmdEnabled) return "skipped";
|
|
2497
2435
|
const qmd = this.orchestrator.qmd;
|
|
@@ -2512,10 +2450,7 @@ export class EngramAccessService {
|
|
|
2512
2450
|
}
|
|
2513
2451
|
}
|
|
2514
2452
|
|
|
2515
|
-
private async qmdProbeAvailable(
|
|
2516
|
-
searchBackend: string,
|
|
2517
|
-
qmdEnabled: boolean,
|
|
2518
|
-
): Promise<boolean> {
|
|
2453
|
+
private async qmdProbeAvailable(searchBackend: string, qmdEnabled: boolean): Promise<boolean> {
|
|
2519
2454
|
if (searchBackend !== "qmd" || !qmdEnabled) return false;
|
|
2520
2455
|
const qmd = this.orchestrator.qmd;
|
|
2521
2456
|
if (!qmd) return false;
|
|
@@ -2546,14 +2481,12 @@ export class EngramAccessService {
|
|
|
2546
2481
|
}
|
|
2547
2482
|
|
|
2548
2483
|
async actionConfidence(
|
|
2549
|
-
request: EngramAccessActionConfidenceRequest = {}
|
|
2484
|
+
request: EngramAccessActionConfidenceRequest = {}
|
|
2550
2485
|
): Promise<EngramAccessActionConfidenceResponse> {
|
|
2551
2486
|
return evaluateActionConfidence(request);
|
|
2552
2487
|
}
|
|
2553
2488
|
|
|
2554
|
-
async daySummary(
|
|
2555
|
-
request: EngramAccessDaySummaryRequest,
|
|
2556
|
-
): Promise<import("./types.js").DaySummaryResult | null> {
|
|
2489
|
+
async daySummary(request: EngramAccessDaySummaryRequest): Promise<import("./types.js").DaySummaryResult | null> {
|
|
2557
2490
|
if (!resolveRecallAuxiliaryCapabilities(this.orchestrator.config).daySummary) {
|
|
2558
2491
|
throw new EngramAccessInputError("day summary is disabled");
|
|
2559
2492
|
}
|
|
@@ -2570,12 +2503,8 @@ export class EngramAccessService {
|
|
|
2570
2503
|
return this.orchestrator.generateDaySummary(memories);
|
|
2571
2504
|
}
|
|
2572
2505
|
|
|
2573
|
-
async briefing(
|
|
2574
|
-
request
|
|
2575
|
-
): Promise<EngramAccessBriefingResponse> {
|
|
2576
|
-
return this.accessObserveWriteSurface.briefing(
|
|
2577
|
-
request,
|
|
2578
|
-
);
|
|
2506
|
+
async briefing(request: EngramAccessBriefingRequest): Promise<EngramAccessBriefingResponse> {
|
|
2507
|
+
return this.accessObserveWriteSurface.briefing(request);
|
|
2579
2508
|
}
|
|
2580
2509
|
|
|
2581
2510
|
/**
|
|
@@ -2640,7 +2569,7 @@ export class EngramAccessService {
|
|
|
2640
2569
|
*/
|
|
2641
2570
|
private async maybeAttachCodingContext(
|
|
2642
2571
|
sessionKey: string | undefined,
|
|
2643
|
-
options: { cwd?: string; projectTag?: string }
|
|
2572
|
+
options: { cwd?: string; projectTag?: string }
|
|
2644
2573
|
): Promise<void> {
|
|
2645
2574
|
if (!sessionKey) return;
|
|
2646
2575
|
// Respect the configuration gate (CLAUDE.md #30).
|
|
@@ -2692,10 +2621,9 @@ export class EngramAccessService {
|
|
|
2692
2621
|
* later bare recalls miss (Codex review).
|
|
2693
2622
|
*/
|
|
2694
2623
|
private async attachCodingContextAfterScopedWrite(
|
|
2695
|
-
request: CodingScopedWriteInput & { namespace?: string; sessionKey?: string }
|
|
2624
|
+
request: CodingScopedWriteInput & { namespace?: string; sessionKey?: string }
|
|
2696
2625
|
): Promise<void> {
|
|
2697
|
-
const hasExplicitNamespace =
|
|
2698
|
-
typeof request.namespace === "string" && request.namespace.trim().length > 0;
|
|
2626
|
+
const hasExplicitNamespace = typeof request.namespace === "string" && request.namespace.trim().length > 0;
|
|
2699
2627
|
if (hasExplicitNamespace) return;
|
|
2700
2628
|
await this.maybeAttachCodingContext(request.sessionKey, {
|
|
2701
2629
|
cwd: request.cwd,
|
|
@@ -2713,9 +2641,7 @@ export class EngramAccessService {
|
|
|
2713
2641
|
const authenticatedPrincipal = request.authenticatedPrincipal?.trim();
|
|
2714
2642
|
const principal = this.resolveRequestPrincipal(request.sessionKey, authenticatedPrincipal);
|
|
2715
2643
|
if (resolveNamespaceCapabilities(this.orchestrator.config).namespaces && !principal) {
|
|
2716
|
-
throw new EngramAccessInputError(
|
|
2717
|
-
"authentication required: namespaces are enabled and no principal was supplied",
|
|
2718
|
-
);
|
|
2644
|
+
throw new EngramAccessInputError("authentication required: namespaces are enabled and no principal was supplied");
|
|
2719
2645
|
}
|
|
2720
2646
|
const principalKey = principal ?? "default";
|
|
2721
2647
|
// Single-flight gate resolved through the shared access-setup capability
|
|
@@ -2727,66 +2653,49 @@ export class EngramAccessService {
|
|
|
2727
2653
|
normalizedRequest,
|
|
2728
2654
|
requestFingerprint,
|
|
2729
2655
|
principalKey,
|
|
2730
|
-
singleFlight
|
|
2656
|
+
singleFlight
|
|
2731
2657
|
);
|
|
2732
2658
|
}
|
|
2733
2659
|
|
|
2734
|
-
private async executeRecall(
|
|
2735
|
-
request
|
|
2736
|
-
): Promise<RecallExecResult> {
|
|
2737
|
-
return this.accessRecallSurface.executeRecall(
|
|
2738
|
-
request,
|
|
2739
|
-
);
|
|
2660
|
+
private async executeRecall(request: EngramAccessRecallRequest): Promise<RecallExecResult> {
|
|
2661
|
+
return this.accessRecallSurface.executeRecall(request);
|
|
2740
2662
|
}
|
|
2741
2663
|
|
|
2742
|
-
async recallExplain(
|
|
2743
|
-
|
|
2744
|
-
): Promise<EngramAccessRecallExplainResponse> {
|
|
2745
|
-
const requestedNamespace = request.namespace?.trim()
|
|
2746
|
-
? this.resolveNamespace(request.namespace)
|
|
2747
|
-
: undefined;
|
|
2664
|
+
async recallExplain(request: EngramAccessRecallExplainRequest = {}): Promise<EngramAccessRecallExplainResponse> {
|
|
2665
|
+
const requestedNamespace = request.namespace?.trim() ? this.resolveNamespace(request.namespace) : undefined;
|
|
2748
2666
|
const authenticatedPrincipal = request.authenticatedPrincipal?.trim();
|
|
2749
|
-
const principal =
|
|
2750
|
-
authenticatedPrincipal
|
|
2751
|
-
|| resolvePrincipal(request.sessionKey, this.orchestrator.config);
|
|
2667
|
+
const principal = authenticatedPrincipal || resolvePrincipal(request.sessionKey, this.orchestrator.config);
|
|
2752
2668
|
if (requestedNamespace) {
|
|
2753
2669
|
if (!canReadNamespace(principal, requestedNamespace, this.orchestrator.config)) {
|
|
2754
2670
|
return { found: false };
|
|
2755
2671
|
}
|
|
2756
|
-
} else if (
|
|
2757
|
-
resolveNamespaceCapabilities(this.orchestrator.config).namespaces
|
|
2758
|
-
&& !principal
|
|
2759
|
-
) {
|
|
2672
|
+
} else if (resolveNamespaceCapabilities(this.orchestrator.config).namespaces && !principal) {
|
|
2760
2673
|
return { found: false };
|
|
2761
2674
|
}
|
|
2762
2675
|
const snapshot = request.sessionKey
|
|
2763
2676
|
? (() => {
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
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
|
+
})()
|
|
2769
2682
|
: (() => {
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
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
|
+
})();
|
|
2775
2688
|
const readableSnapshot = (() => {
|
|
2776
2689
|
if (!snapshot || !resolveNamespaceCapabilities(this.orchestrator.config).namespaces) return snapshot;
|
|
2777
2690
|
const snapshotNamespace = snapshot.namespace ?? this.orchestrator.config.defaultNamespace;
|
|
2778
|
-
return canReadNamespace(principal, snapshotNamespace, this.orchestrator.config)
|
|
2779
|
-
? snapshot
|
|
2780
|
-
: null;
|
|
2691
|
+
return canReadNamespace(principal, snapshotNamespace, this.orchestrator.config) ? snapshot : null;
|
|
2781
2692
|
})();
|
|
2782
2693
|
const namespace = (() => {
|
|
2783
2694
|
if (requestedNamespace) return requestedNamespace;
|
|
2784
2695
|
if (readableSnapshot?.namespace) return readableSnapshot.namespace;
|
|
2785
2696
|
const fallbackNamespace = this.orchestrator.config.defaultNamespace;
|
|
2786
2697
|
if (!resolveNamespaceCapabilities(this.orchestrator.config).namespaces) return fallbackNamespace;
|
|
2787
|
-
return canReadNamespace(principal, fallbackNamespace, this.orchestrator.config)
|
|
2788
|
-
? fallbackNamespace
|
|
2789
|
-
: null;
|
|
2698
|
+
return canReadNamespace(principal, fallbackNamespace, this.orchestrator.config) ? fallbackNamespace : null;
|
|
2790
2699
|
})();
|
|
2791
2700
|
if (!namespace) return { found: false };
|
|
2792
2701
|
const [intent, graph] = await Promise.all([
|
|
@@ -2797,17 +2706,10 @@ export class EngramAccessService {
|
|
|
2797
2706
|
return { found: true, snapshot: readableSnapshot ?? undefined, intent, graph };
|
|
2798
2707
|
}
|
|
2799
2708
|
|
|
2800
|
-
async recallTierExplain(
|
|
2801
|
-
sessionKey?: string,
|
|
2802
|
-
namespace?: string,
|
|
2803
|
-
authenticatedPrincipal?: string,
|
|
2804
|
-
) {
|
|
2709
|
+
async recallTierExplain(sessionKey?: string, namespace?: string, authenticatedPrincipal?: string) {
|
|
2805
2710
|
const namespacesEnabled = resolveNamespaceCapabilities(this.orchestrator.config).namespaces;
|
|
2806
|
-
const requestedNamespace = namespace?.trim()
|
|
2807
|
-
|
|
2808
|
-
: undefined;
|
|
2809
|
-
const principal = authenticatedPrincipal?.trim()
|
|
2810
|
-
|| resolvePrincipal(sessionKey, this.orchestrator.config);
|
|
2711
|
+
const requestedNamespace = namespace?.trim() ? this.resolveNamespace(namespace) : undefined;
|
|
2712
|
+
const principal = authenticatedPrincipal?.trim() || resolvePrincipal(sessionKey, this.orchestrator.config);
|
|
2811
2713
|
|
|
2812
2714
|
if (requestedNamespace) {
|
|
2813
2715
|
if (!canReadNamespace(principal, requestedNamespace, this.orchestrator.config)) {
|
|
@@ -2827,11 +2729,8 @@ export class EngramAccessService {
|
|
|
2827
2729
|
return candidate.namespace === requestedNamespace ? candidate : null;
|
|
2828
2730
|
}
|
|
2829
2731
|
if (!namespacesEnabled) return candidate;
|
|
2830
|
-
const snapshotNs = candidate.namespace
|
|
2831
|
-
|
|
2832
|
-
return canReadNamespace(principal, snapshotNs, this.orchestrator.config)
|
|
2833
|
-
? candidate
|
|
2834
|
-
: null;
|
|
2732
|
+
const snapshotNs = candidate.namespace ?? this.orchestrator.config.defaultNamespace;
|
|
2733
|
+
return canReadNamespace(principal, snapshotNs, this.orchestrator.config) ? candidate : null;
|
|
2835
2734
|
})();
|
|
2836
2735
|
|
|
2837
2736
|
return toRecallExplainJson(snapshot);
|
|
@@ -2884,18 +2783,13 @@ export class EngramAccessService {
|
|
|
2884
2783
|
snapshot?: RecallXraySnapshot;
|
|
2885
2784
|
recall?: EngramAccessRecallResponse;
|
|
2886
2785
|
}> {
|
|
2887
|
-
return this.accessRecallSurface.recallXray(
|
|
2888
|
-
request,
|
|
2889
|
-
);
|
|
2786
|
+
return this.accessRecallSurface.recallXray(request);
|
|
2890
2787
|
}
|
|
2891
2788
|
async memoryStore(
|
|
2892
2789
|
request: EngramAccessMemoryStoreRequest,
|
|
2893
|
-
hooks?: { enforceWriteQuota?: () => void | Promise<void> }
|
|
2790
|
+
hooks?: { enforceWriteQuota?: () => void | Promise<void> }
|
|
2894
2791
|
): Promise<EngramAccessWriteResponse> {
|
|
2895
|
-
return this.accessObserveWriteSurface.memoryStore(
|
|
2896
|
-
request,
|
|
2897
|
-
hooks,
|
|
2898
|
-
);
|
|
2792
|
+
return this.accessObserveWriteSurface.memoryStore(request, hooks);
|
|
2899
2793
|
}
|
|
2900
2794
|
|
|
2901
2795
|
async peekMemoryStoreIdempotency(request: EngramAccessMemoryStoreRequest): Promise<EngramAccessIdempotencyStatus> {
|
|
@@ -2927,16 +2821,13 @@ export class EngramAccessService {
|
|
|
2927
2821
|
|
|
2928
2822
|
async suggestionSubmit(
|
|
2929
2823
|
request: EngramAccessSuggestionSubmitRequest,
|
|
2930
|
-
hooks?: { enforceWriteQuota?: () => void | Promise<void> }
|
|
2824
|
+
hooks?: { enforceWriteQuota?: () => void | Promise<void> }
|
|
2931
2825
|
): Promise<EngramAccessWriteResponse> {
|
|
2932
|
-
return this.accessObserveWriteSurface.suggestionSubmit(
|
|
2933
|
-
request,
|
|
2934
|
-
hooks,
|
|
2935
|
-
);
|
|
2826
|
+
return this.accessObserveWriteSurface.suggestionSubmit(request, hooks);
|
|
2936
2827
|
}
|
|
2937
2828
|
|
|
2938
2829
|
async peekSuggestionSubmitIdempotency(
|
|
2939
|
-
request: EngramAccessSuggestionSubmitRequest
|
|
2830
|
+
request: EngramAccessSuggestionSubmitRequest
|
|
2940
2831
|
): Promise<EngramAccessIdempotencyStatus> {
|
|
2941
2832
|
const namespace = await this.resolveCodingScopedWriteNamespace(request);
|
|
2942
2833
|
const schemaVersion = request.schemaVersion ?? ENGRAM_ACCESS_WRITE_SCHEMA_VERSION;
|
|
@@ -2966,7 +2857,7 @@ export class EngramAccessService {
|
|
|
2966
2857
|
|
|
2967
2858
|
private validateWriteCandidate(
|
|
2968
2859
|
request: EngramAccessMemoryStoreRequest | EngramAccessSuggestionSubmitRequest,
|
|
2969
|
-
namespace: string
|
|
2860
|
+
namespace: string
|
|
2970
2861
|
): ValidExplicitCapture {
|
|
2971
2862
|
try {
|
|
2972
2863
|
return {
|
|
@@ -2975,7 +2866,7 @@ export class EngramAccessService {
|
|
|
2975
2866
|
...request,
|
|
2976
2867
|
namespace,
|
|
2977
2868
|
},
|
|
2978
|
-
"legacy_tool"
|
|
2869
|
+
"legacy_tool"
|
|
2979
2870
|
),
|
|
2980
2871
|
// The namespace was resolved AND authorized by
|
|
2981
2872
|
// resolveCodingScopedWriteNamespace (explicit namespaces via
|
|
@@ -2994,7 +2885,7 @@ export class EngramAccessService {
|
|
|
2994
2885
|
memoryId: string,
|
|
2995
2886
|
namespace?: string,
|
|
2996
2887
|
principal?: string,
|
|
2997
|
-
sessionKey?: string
|
|
2888
|
+
sessionKey?: string
|
|
2998
2889
|
): Promise<EngramAccessMemoryResponse> {
|
|
2999
2890
|
// Issue #1582 — accept a `[m:xxxx]` handle in place of a memory id; resolve
|
|
3000
2891
|
// it against the caller's session via the shared helper (rule 22). A raw id
|
|
@@ -3021,7 +2912,7 @@ export class EngramAccessService {
|
|
|
3021
2912
|
async codegraphTool(
|
|
3022
2913
|
request: CodegraphSurfaceRequest,
|
|
3023
2914
|
authenticatedPrincipal?: string,
|
|
3024
|
-
sourceConnector?: string
|
|
2915
|
+
sourceConnector?: string
|
|
3025
2916
|
): Promise<CodegraphSurfaceResponse> {
|
|
3026
2917
|
const principal = authenticatedPrincipal ?? "default";
|
|
3027
2918
|
const memoryDir = this.orchestrator.config.memoryDir;
|
|
@@ -3073,8 +2964,10 @@ export class EngramAccessService {
|
|
|
3073
2964
|
|
|
3074
2965
|
/** Whether the coding_decision tool should appear in tools/list (rule 39). */
|
|
3075
2966
|
get decisionRecordSurfaceVisible(): boolean {
|
|
3076
|
-
return
|
|
3077
|
-
|
|
2967
|
+
return (
|
|
2968
|
+
this.orchestrator.config.codingKnowledge?.enabled === true &&
|
|
2969
|
+
this.orchestrator.config.codingKnowledge?.decisionRecords === true
|
|
2970
|
+
);
|
|
3078
2971
|
}
|
|
3079
2972
|
/**
|
|
3080
2973
|
* Thin delegate — handler logic in coding/decision-surfaces.ts (#1548 PR2).
|
|
@@ -3086,7 +2979,7 @@ export class EngramAccessService {
|
|
|
3086
2979
|
async codingDecision(
|
|
3087
2980
|
request: DecisionSurfaceRequest,
|
|
3088
2981
|
authenticatedPrincipal?: string,
|
|
3089
|
-
sourceConnector?: string
|
|
2982
|
+
sourceConnector?: string
|
|
3090
2983
|
): Promise<DecisionSurfaceResponse> {
|
|
3091
2984
|
return handleCodingDecision(request, {
|
|
3092
2985
|
codingKnowledge: this.orchestrator.config.codingKnowledge,
|
|
@@ -3099,23 +2992,27 @@ export class EngramAccessService {
|
|
|
3099
2992
|
sessionKey: req.sessionKey,
|
|
3100
2993
|
authenticatedPrincipal,
|
|
3101
2994
|
})
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
2995
|
+
: await this.resolveCodingScopedReadableNamespace({
|
|
2996
|
+
namespace: req.namespace,
|
|
2997
|
+
sessionKey: req.sessionKey,
|
|
2998
|
+
authenticatedPrincipal,
|
|
2999
|
+
});
|
|
3107
3000
|
const storage = await this.orchestrator.getStorage(ns);
|
|
3108
3001
|
return Object.assign(storage, { namespace: ns });
|
|
3109
3002
|
},
|
|
3110
|
-
throwInputError: (msg) => {
|
|
3003
|
+
throwInputError: (msg) => {
|
|
3004
|
+
throw new EngramAccessInputError(msg);
|
|
3005
|
+
},
|
|
3111
3006
|
sourceConnector,
|
|
3112
3007
|
});
|
|
3113
3008
|
}
|
|
3114
3009
|
|
|
3115
3010
|
/** Whether the coding_architecture tool should appear in tools/list (rule 39). */
|
|
3116
3011
|
get architectureCardSurfaceVisible(): boolean {
|
|
3117
|
-
return
|
|
3118
|
-
|
|
3012
|
+
return (
|
|
3013
|
+
this.orchestrator.config.codingKnowledge?.enabled === true &&
|
|
3014
|
+
this.orchestrator.config.codingKnowledge?.architectureCard === true
|
|
3015
|
+
);
|
|
3119
3016
|
}
|
|
3120
3017
|
|
|
3121
3018
|
/**
|
|
@@ -3134,7 +3031,7 @@ export class EngramAccessService {
|
|
|
3134
3031
|
async codingArchitecture(
|
|
3135
3032
|
request: ArchitectureSurfaceRequest,
|
|
3136
3033
|
authenticatedPrincipal?: string,
|
|
3137
|
-
sourceConnector?: string
|
|
3034
|
+
sourceConnector?: string
|
|
3138
3035
|
): Promise<ArchitectureSurfaceResponse> {
|
|
3139
3036
|
const resolvedConfig = this.orchestrator.config;
|
|
3140
3037
|
return handleCodingArchitecture(request, {
|
|
@@ -3148,35 +3045,40 @@ export class EngramAccessService {
|
|
|
3148
3045
|
sessionKey: req.sessionKey,
|
|
3149
3046
|
authenticatedPrincipal,
|
|
3150
3047
|
})
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3048
|
+
: await this.resolveCodingScopedReadableNamespace({
|
|
3049
|
+
namespace: req.namespace,
|
|
3050
|
+
sessionKey: req.sessionKey,
|
|
3051
|
+
authenticatedPrincipal,
|
|
3052
|
+
});
|
|
3156
3053
|
const storage = await this.orchestrator.getStorage(ns);
|
|
3157
3054
|
return Object.assign(storage, { namespace: ns }) as ArchitectureSurfaceStorage;
|
|
3158
3055
|
},
|
|
3159
|
-
buildCard: async (repoRoot) =>
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3056
|
+
buildCard: async (repoRoot) =>
|
|
3057
|
+
buildArchitectureCard(repoRoot, {
|
|
3058
|
+
llmSummary: this.orchestrator.config.codingKnowledge?.architectureCardLlmSummary === true,
|
|
3059
|
+
summariser: createArchitectureCardSummariser(this.fallbackLlmRef ?? this.localLlmRef),
|
|
3060
|
+
}),
|
|
3163
3061
|
versioning: createArchitectureVersioningHook(
|
|
3164
3062
|
resolvedConfig.versioningEnabled === true,
|
|
3165
3063
|
resolvedConfig.versioningMaxPerPage,
|
|
3166
3064
|
resolvedConfig.versioningSidecarDir,
|
|
3167
3065
|
resolvedConfig.memoryDir,
|
|
3168
3066
|
(p) => nodeFs.readFile(p, "utf-8"),
|
|
3169
|
-
createVersion
|
|
3067
|
+
createVersion
|
|
3170
3068
|
),
|
|
3171
|
-
throwInputError: (msg) => {
|
|
3069
|
+
throwInputError: (msg) => {
|
|
3070
|
+
throw new EngramAccessInputError(msg);
|
|
3071
|
+
},
|
|
3172
3072
|
sourceConnector,
|
|
3173
3073
|
});
|
|
3174
3074
|
}
|
|
3175
3075
|
|
|
3176
3076
|
/** Whether the coding_delta tool should appear in tools/list (rule 39). */
|
|
3177
3077
|
get sessionDeltaSurfaceVisible(): boolean {
|
|
3178
|
-
return
|
|
3179
|
-
|
|
3078
|
+
return (
|
|
3079
|
+
this.orchestrator.config.codingKnowledge?.enabled === true &&
|
|
3080
|
+
this.orchestrator.config.codingKnowledge?.sessionDelta === true
|
|
3081
|
+
);
|
|
3180
3082
|
}
|
|
3181
3083
|
/**
|
|
3182
3084
|
* Thin delegate — handler logic in coding/session-delta-surfaces.ts (#1548 PR4).
|
|
@@ -3185,10 +3087,7 @@ export class EngramAccessService {
|
|
|
3185
3087
|
* coding surfaces; the delta state file lives under
|
|
3186
3088
|
* `<memoryDir>/state/coding-knowledge/<namespace>.json`.
|
|
3187
3089
|
*/
|
|
3188
|
-
async codingDelta(
|
|
3189
|
-
request: DeltaSurfaceRequest,
|
|
3190
|
-
authenticatedPrincipal?: string,
|
|
3191
|
-
): Promise<DeltaSurfaceResponse> {
|
|
3090
|
+
async codingDelta(request: DeltaSurfaceRequest, authenticatedPrincipal?: string): Promise<DeltaSurfaceResponse> {
|
|
3192
3091
|
return handleCodingDelta(request, {
|
|
3193
3092
|
codingKnowledge: this.orchestrator.config.codingKnowledge,
|
|
3194
3093
|
getCodingContext: (sk) => this.orchestrator.getCodingContextForSession(sk),
|
|
@@ -3231,7 +3130,9 @@ export class EngramAccessService {
|
|
|
3231
3130
|
// bounded synchronous invoker rather than the abortable scope resolver.
|
|
3232
3131
|
return defaultGitInvokerSync()(cwd, args);
|
|
3233
3132
|
},
|
|
3234
|
-
throwInputError: (msg) => {
|
|
3133
|
+
throwInputError: (msg) => {
|
|
3134
|
+
throw new EngramAccessInputError(msg);
|
|
3135
|
+
},
|
|
3235
3136
|
});
|
|
3236
3137
|
}
|
|
3237
3138
|
|
|
@@ -3280,7 +3181,7 @@ export class EngramAccessService {
|
|
|
3280
3181
|
{ role: "system", content: system },
|
|
3281
3182
|
{ role: "user", content: user },
|
|
3282
3183
|
],
|
|
3283
|
-
{ operation: "correction-classify", priority: "background" }
|
|
3184
|
+
{ operation: "correction-classify", priority: "background" }
|
|
3284
3185
|
);
|
|
3285
3186
|
if (!result) {
|
|
3286
3187
|
throw new Error("correction classify+draft: local LLM unavailable (disabled or in cooldown)");
|
|
@@ -3299,28 +3200,18 @@ export class EngramAccessService {
|
|
|
3299
3200
|
* handle that misses or is ambiguous becomes an EngramAccessInputError so the
|
|
3300
3201
|
* boundary maps it to a 400 (rule 34/51 — list candidates, never guess).
|
|
3301
3202
|
*/
|
|
3302
|
-
private resolveMemoryIdOrHandleInput(
|
|
3303
|
-
ref: string,
|
|
3304
|
-
sessionKey: string | undefined,
|
|
3305
|
-
): string {
|
|
3203
|
+
private resolveMemoryIdOrHandleInput(ref: string, sessionKey: string | undefined): string {
|
|
3306
3204
|
if (!isHandleToken(ref)) return ref;
|
|
3307
3205
|
try {
|
|
3308
3206
|
return this.orchestrator.resolveMemoryIdOrHandle(ref, sessionKey);
|
|
3309
3207
|
} catch (err) {
|
|
3310
|
-
throw new EngramAccessInputError(
|
|
3311
|
-
err instanceof Error ? err.message : String(err),
|
|
3312
|
-
);
|
|
3208
|
+
throw new EngramAccessInputError(err instanceof Error ? err.message : String(err));
|
|
3313
3209
|
}
|
|
3314
3210
|
}
|
|
3315
3211
|
|
|
3316
|
-
async correctionPlan(
|
|
3317
|
-
request: CorrectionRequest,
|
|
3318
|
-
opts?: { abortSignal?: AbortSignal },
|
|
3319
|
-
): Promise<CorrectionPlan> {
|
|
3212
|
+
async correctionPlan(request: CorrectionRequest, opts?: { abortSignal?: AbortSignal }): Promise<CorrectionPlan> {
|
|
3320
3213
|
if (request.targetIds?.some((id) => isHandleToken(id))) {
|
|
3321
|
-
const targetIds = request.targetIds.map((id) =>
|
|
3322
|
-
this.resolveMemoryIdOrHandleInput(id, request.sessionKey),
|
|
3323
|
-
);
|
|
3214
|
+
const targetIds = request.targetIds.map((id) => this.resolveMemoryIdOrHandleInput(id, request.sessionKey));
|
|
3324
3215
|
return this.correctionService().plan({ ...request, targetIds }, opts);
|
|
3325
3216
|
}
|
|
3326
3217
|
return this.correctionService().plan(request, opts);
|
|
@@ -3334,7 +3225,7 @@ export class EngramAccessService {
|
|
|
3334
3225
|
sessionKey?: string;
|
|
3335
3226
|
principal?: string;
|
|
3336
3227
|
abortSignal?: AbortSignal;
|
|
3337
|
-
}
|
|
3228
|
+
}
|
|
3338
3229
|
): Promise<CorrectionOutcome> {
|
|
3339
3230
|
return this.correctionService().apply(planId, opts);
|
|
3340
3231
|
}
|
|
@@ -3349,18 +3240,13 @@ export class EngramAccessService {
|
|
|
3349
3240
|
|
|
3350
3241
|
async correctionDiscard(
|
|
3351
3242
|
planId: string,
|
|
3352
|
-
opts: { namespace?: string; sessionKey?: string; principal?: string }
|
|
3243
|
+
opts: { namespace?: string; sessionKey?: string; principal?: string }
|
|
3353
3244
|
): Promise<void> {
|
|
3354
3245
|
return this.correctionService().discard(planId, opts);
|
|
3355
3246
|
}
|
|
3356
3247
|
|
|
3357
|
-
async memoryBrowse(
|
|
3358
|
-
|
|
3359
|
-
): Promise<EngramAccessMemoryBrowseResponse> {
|
|
3360
|
-
const resolvedNamespace = this.resolveReadableNamespace(
|
|
3361
|
-
request.namespace,
|
|
3362
|
-
request.authenticatedPrincipal,
|
|
3363
|
-
);
|
|
3248
|
+
async memoryBrowse(request: EngramAccessMemoryBrowseRequest = {}): Promise<EngramAccessMemoryBrowseResponse> {
|
|
3249
|
+
const resolvedNamespace = this.resolveReadableNamespace(request.namespace, request.authenticatedPrincipal);
|
|
3364
3250
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
3365
3251
|
const { limit, offset } = normalizePagination(request.limit, request.offset);
|
|
3366
3252
|
const sort = normalizeBrowseSort(request.sort);
|
|
@@ -3389,7 +3275,7 @@ export class EngramAccessService {
|
|
|
3389
3275
|
};
|
|
3390
3276
|
}
|
|
3391
3277
|
|
|
3392
|
-
let memories = [...await storage.readAllMemories(), ...await storage.readArchivedMemories()];
|
|
3278
|
+
let memories = [...(await storage.readAllMemories()), ...(await storage.readArchivedMemories())];
|
|
3393
3279
|
memories = memories.filter((memory) => {
|
|
3394
3280
|
if (isSupportPassportPrivateMemory(memory)) return false;
|
|
3395
3281
|
const status = inferMemoryStatus(memory.frontmatter, toMemoryPathRel(storage.dir, memory.path)).toLowerCase();
|
|
@@ -3402,7 +3288,9 @@ export class EngramAccessService {
|
|
|
3402
3288
|
memory.content,
|
|
3403
3289
|
memory.frontmatter.entityRef ?? "",
|
|
3404
3290
|
...memory.frontmatter.tags,
|
|
3405
|
-
]
|
|
3291
|
+
]
|
|
3292
|
+
.join("\n")
|
|
3293
|
+
.toLowerCase();
|
|
3406
3294
|
return haystack.includes(query);
|
|
3407
3295
|
});
|
|
3408
3296
|
|
|
@@ -3425,8 +3313,8 @@ export class EngramAccessService {
|
|
|
3425
3313
|
async memoryTimeline(
|
|
3426
3314
|
memoryId: string,
|
|
3427
3315
|
namespace?: string,
|
|
3428
|
-
limit
|
|
3429
|
-
principal?: string
|
|
3316
|
+
limit = 200,
|
|
3317
|
+
principal?: string
|
|
3430
3318
|
): Promise<EngramAccessTimelineResponse> {
|
|
3431
3319
|
const resolvedNamespace = this.resolveReadableNamespace(namespace, principal);
|
|
3432
3320
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
@@ -3441,12 +3329,14 @@ export class EngramAccessService {
|
|
|
3441
3329
|
};
|
|
3442
3330
|
}
|
|
3443
3331
|
|
|
3444
|
-
async entityList(
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3332
|
+
async entityList(
|
|
3333
|
+
options: {
|
|
3334
|
+
namespace?: string;
|
|
3335
|
+
query?: string;
|
|
3336
|
+
limit?: number;
|
|
3337
|
+
offset?: number;
|
|
3338
|
+
} = {}
|
|
3339
|
+
): Promise<EngramAccessEntityListResponse> {
|
|
3450
3340
|
const storage = await this.orchestrator.getStorage(options.namespace);
|
|
3451
3341
|
const resolvedNamespace = options.namespace?.trim() || this.orchestrator.config.defaultNamespace;
|
|
3452
3342
|
const { limit, offset } = normalizePagination(options.limit, options.offset);
|
|
@@ -3466,7 +3356,9 @@ export class EngramAccessService {
|
|
|
3466
3356
|
...entity.aliases,
|
|
3467
3357
|
...entity.facts,
|
|
3468
3358
|
...(entity.structuredSections ?? []).flatMap((section) => [section.title, ...section.facts]),
|
|
3469
|
-
]
|
|
3359
|
+
]
|
|
3360
|
+
.join("\n")
|
|
3361
|
+
.toLowerCase();
|
|
3470
3362
|
if (!haystack.includes(query)) continue;
|
|
3471
3363
|
}
|
|
3472
3364
|
entities.push({
|
|
@@ -3503,11 +3395,7 @@ export class EngramAccessService {
|
|
|
3503
3395
|
}
|
|
3504
3396
|
|
|
3505
3397
|
async reviewQueue(runId?: string, namespace?: string, principal?: string): Promise<EngramAccessReviewQueueResponse> {
|
|
3506
|
-
return this.accessAdminOpsSurface.reviewQueue(
|
|
3507
|
-
runId,
|
|
3508
|
-
namespace,
|
|
3509
|
-
principal,
|
|
3510
|
-
);
|
|
3398
|
+
return this.accessAdminOpsSurface.reviewQueue(runId, namespace, principal);
|
|
3511
3399
|
}
|
|
3512
3400
|
|
|
3513
3401
|
async maintenance(namespace?: string, principal?: string): Promise<EngramAccessMaintenanceResponse> {
|
|
@@ -3531,7 +3419,7 @@ export class EngramAccessService {
|
|
|
3531
3419
|
let staleActive = 0;
|
|
3532
3420
|
let lowConfidenceActive = 0;
|
|
3533
3421
|
|
|
3534
|
-
const memories = [...await storage.readAllMemories(), ...await storage.readArchivedMemories()];
|
|
3422
|
+
const memories = [...(await storage.readAllMemories()), ...(await storage.readArchivedMemories())];
|
|
3535
3423
|
for (const memory of memories) {
|
|
3536
3424
|
const status = inferMemoryStatus(memory.frontmatter, toMemoryPathRel(storage.dir, memory.path)).toLowerCase();
|
|
3537
3425
|
const confidenceTier = memory.frontmatter.confidenceTier ?? "unknown";
|
|
@@ -3580,7 +3468,7 @@ export class EngramAccessService {
|
|
|
3580
3468
|
batchSize?: number;
|
|
3581
3469
|
authenticatedPrincipal?: string;
|
|
3582
3470
|
},
|
|
3583
|
-
principal?: string
|
|
3471
|
+
principal?: string
|
|
3584
3472
|
): Promise<{
|
|
3585
3473
|
namespace: string;
|
|
3586
3474
|
runId: string;
|
|
@@ -3592,10 +3480,7 @@ export class EngramAccessService {
|
|
|
3592
3480
|
summaryPath: string;
|
|
3593
3481
|
reportPath: string;
|
|
3594
3482
|
}> {
|
|
3595
|
-
return this.accessAdminOpsSurface.governanceRun(
|
|
3596
|
-
request,
|
|
3597
|
-
principal,
|
|
3598
|
-
);
|
|
3483
|
+
return this.accessAdminOpsSurface.governanceRun(request, principal);
|
|
3599
3484
|
}
|
|
3600
3485
|
|
|
3601
3486
|
async entitySynthesisRun(
|
|
@@ -3604,7 +3489,7 @@ export class EngramAccessService {
|
|
|
3604
3489
|
maxEntities?: number;
|
|
3605
3490
|
authenticatedPrincipal?: string;
|
|
3606
3491
|
},
|
|
3607
|
-
principal?: string
|
|
3492
|
+
principal?: string
|
|
3608
3493
|
): Promise<{
|
|
3609
3494
|
namespace: string;
|
|
3610
3495
|
requested: number;
|
|
@@ -3619,7 +3504,7 @@ export class EngramAccessService {
|
|
|
3619
3504
|
namespace?: string;
|
|
3620
3505
|
authenticatedPrincipal?: string;
|
|
3621
3506
|
},
|
|
3622
|
-
principal?: string
|
|
3507
|
+
principal?: string
|
|
3623
3508
|
): Promise<{
|
|
3624
3509
|
namespace: string;
|
|
3625
3510
|
clustersProcessed: number;
|
|
@@ -3629,7 +3514,7 @@ export class EngramAccessService {
|
|
|
3629
3514
|
const resolvedNamespace = this.writableNamespaceFor(
|
|
3630
3515
|
request.namespace,
|
|
3631
3516
|
undefined,
|
|
3632
|
-
request.authenticatedPrincipal ?? principal
|
|
3517
|
+
request.authenticatedPrincipal ?? principal
|
|
3633
3518
|
);
|
|
3634
3519
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
3635
3520
|
const result = await runProcedureMining({
|
|
@@ -3650,13 +3535,9 @@ export class EngramAccessService {
|
|
|
3650
3535
|
authenticatedPrincipal?: string;
|
|
3651
3536
|
force?: boolean;
|
|
3652
3537
|
} = {},
|
|
3653
|
-
principal?: string
|
|
3538
|
+
principal?: string
|
|
3654
3539
|
): Promise<LiveConnectorsRunSummary> {
|
|
3655
|
-
this.writableNamespaceFor(
|
|
3656
|
-
undefined,
|
|
3657
|
-
undefined,
|
|
3658
|
-
request.authenticatedPrincipal ?? principal,
|
|
3659
|
-
);
|
|
3540
|
+
this.writableNamespaceFor(undefined, undefined, request.authenticatedPrincipal ?? principal);
|
|
3660
3541
|
return this.orchestrator.runLiveConnectors({
|
|
3661
3542
|
force: request.force === true,
|
|
3662
3543
|
});
|
|
@@ -3688,7 +3569,7 @@ export class EngramAccessService {
|
|
|
3688
3569
|
authenticatedPrincipal?: string;
|
|
3689
3570
|
force?: boolean;
|
|
3690
3571
|
} = {},
|
|
3691
|
-
principal?: string
|
|
3572
|
+
principal?: string
|
|
3692
3573
|
): Promise<{
|
|
3693
3574
|
namespace: string;
|
|
3694
3575
|
ran: boolean;
|
|
@@ -3701,7 +3582,7 @@ export class EngramAccessService {
|
|
|
3701
3582
|
const resolvedNamespace = this.writableNamespaceFor(
|
|
3702
3583
|
request.namespace,
|
|
3703
3584
|
undefined,
|
|
3704
|
-
request.authenticatedPrincipal ?? principal
|
|
3585
|
+
request.authenticatedPrincipal ?? principal
|
|
3705
3586
|
);
|
|
3706
3587
|
const outcome = await this.orchestrator.runPatternReinforcement({
|
|
3707
3588
|
namespace: resolvedNamespace,
|
|
@@ -3735,12 +3616,9 @@ export class EngramAccessService {
|
|
|
3735
3616
|
*/
|
|
3736
3617
|
async procedureStats(
|
|
3737
3618
|
request: { namespace?: string } = {},
|
|
3738
|
-
principal?: string
|
|
3619
|
+
principal?: string
|
|
3739
3620
|
): Promise<ProcedureStatsReport & { namespace: string }> {
|
|
3740
|
-
const resolvedNamespace = this.resolveReadableNamespace(
|
|
3741
|
-
request.namespace,
|
|
3742
|
-
principal,
|
|
3743
|
-
);
|
|
3621
|
+
const resolvedNamespace = this.resolveReadableNamespace(request.namespace, principal);
|
|
3744
3622
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
3745
3623
|
const report = await computeProcedureStats({
|
|
3746
3624
|
storage,
|
|
@@ -3765,7 +3643,7 @@ export class EngramAccessService {
|
|
|
3765
3643
|
sessionKey?: string;
|
|
3766
3644
|
hours?: number;
|
|
3767
3645
|
embed?: boolean;
|
|
3768
|
-
} = {}
|
|
3646
|
+
} = {}
|
|
3769
3647
|
): Promise<{
|
|
3770
3648
|
enabled: boolean;
|
|
3771
3649
|
sessionKey?: string;
|
|
@@ -3777,17 +3655,11 @@ export class EngramAccessService {
|
|
|
3777
3655
|
reason?: string;
|
|
3778
3656
|
retryAfterMs?: number;
|
|
3779
3657
|
}> {
|
|
3780
|
-
return this.accessAdminOpsSurface.conversationIndexUpdate(
|
|
3781
|
-
request,
|
|
3782
|
-
);
|
|
3658
|
+
return this.accessAdminOpsSurface.conversationIndexUpdate(request);
|
|
3783
3659
|
}
|
|
3784
3660
|
|
|
3785
|
-
async profilingReport(
|
|
3786
|
-
request
|
|
3787
|
-
): Promise<AccessProfilingReportResponse> {
|
|
3788
|
-
return this.accessAdminOpsSurface.profilingReport(
|
|
3789
|
-
request,
|
|
3790
|
-
);
|
|
3661
|
+
async profilingReport(request: AccessProfilingReportRequest = {}): Promise<AccessProfilingReportResponse> {
|
|
3662
|
+
return this.accessAdminOpsSurface.profilingReport(request);
|
|
3791
3663
|
}
|
|
3792
3664
|
|
|
3793
3665
|
async trustZoneStatus(namespace?: string, principal?: string): Promise<EngramAccessTrustZoneStatusResponse> {
|
|
@@ -3807,7 +3679,7 @@ export class EngramAccessService {
|
|
|
3807
3679
|
|
|
3808
3680
|
async trustZoneBrowse(
|
|
3809
3681
|
request: EngramAccessTrustZoneBrowseRequest,
|
|
3810
|
-
principal?: string
|
|
3682
|
+
principal?: string
|
|
3811
3683
|
): Promise<EngramAccessTrustZoneBrowseResponse> {
|
|
3812
3684
|
const resolvedNamespace = this.resolveReadableNamespace(request.namespace, principal);
|
|
3813
3685
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
@@ -3834,22 +3706,17 @@ export class EngramAccessService {
|
|
|
3834
3706
|
result.allRecords,
|
|
3835
3707
|
resolveSecurityCapabilities(this.orchestrator.config).memoryPoisoningDefense === true,
|
|
3836
3708
|
resolveSecurityCapabilities(this.orchestrator.config).trustZones === true,
|
|
3837
|
-
resolveSecurityCapabilities(this.orchestrator.config).quarantinePromotion === true
|
|
3838
|
-
)
|
|
3709
|
+
resolveSecurityCapabilities(this.orchestrator.config).quarantinePromotion === true
|
|
3710
|
+
)
|
|
3711
|
+
),
|
|
3839
3712
|
};
|
|
3840
3713
|
}
|
|
3841
3714
|
|
|
3842
|
-
async trustZonePromote(
|
|
3843
|
-
request: EngramAccessTrustZonePromoteRequest,
|
|
3844
|
-
): Promise<EngramAccessTrustZonePromoteResponse> {
|
|
3715
|
+
async trustZonePromote(request: EngramAccessTrustZonePromoteRequest): Promise<EngramAccessTrustZonePromoteResponse> {
|
|
3845
3716
|
if (!isTrustZoneName(request.targetZone)) {
|
|
3846
3717
|
throw new EngramAccessInputError(`unsupported trust-zone target: ${String(request.targetZone)}`);
|
|
3847
3718
|
}
|
|
3848
|
-
const resolvedNamespace = this.writableNamespaceFor(
|
|
3849
|
-
request.namespace,
|
|
3850
|
-
undefined,
|
|
3851
|
-
request.authenticatedPrincipal,
|
|
3852
|
-
);
|
|
3719
|
+
const resolvedNamespace = this.writableNamespaceFor(request.namespace, undefined, request.authenticatedPrincipal);
|
|
3853
3720
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
3854
3721
|
let result: TrustZonePromotionResult;
|
|
3855
3722
|
try {
|
|
@@ -3877,13 +3744,9 @@ export class EngramAccessService {
|
|
|
3877
3744
|
}
|
|
3878
3745
|
|
|
3879
3746
|
async trustZoneDemoSeed(
|
|
3880
|
-
request: EngramAccessTrustZoneDemoSeedRequest
|
|
3747
|
+
request: EngramAccessTrustZoneDemoSeedRequest
|
|
3881
3748
|
): Promise<EngramAccessTrustZoneDemoSeedResponse> {
|
|
3882
|
-
const resolvedNamespace = this.writableNamespaceFor(
|
|
3883
|
-
request.namespace,
|
|
3884
|
-
undefined,
|
|
3885
|
-
request.authenticatedPrincipal,
|
|
3886
|
-
);
|
|
3749
|
+
const resolvedNamespace = this.writableNamespaceFor(request.namespace, undefined, request.authenticatedPrincipal);
|
|
3887
3750
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
3888
3751
|
let result: TrustZoneDemoSeedResult;
|
|
3889
3752
|
try {
|
|
@@ -3905,7 +3768,7 @@ export class EngramAccessService {
|
|
|
3905
3768
|
}
|
|
3906
3769
|
|
|
3907
3770
|
async reviewDisposition(
|
|
3908
|
-
request: EngramAccessReviewDispositionRequest
|
|
3771
|
+
request: EngramAccessReviewDispositionRequest
|
|
3909
3772
|
): Promise<EngramAccessReviewDispositionResponse> {
|
|
3910
3773
|
const memoryId = request.memoryId.trim();
|
|
3911
3774
|
const reasonCode = request.reasonCode.trim();
|
|
@@ -3916,11 +3779,7 @@ export class EngramAccessService {
|
|
|
3916
3779
|
throw new EngramAccessInputError("reasonCode is required");
|
|
3917
3780
|
}
|
|
3918
3781
|
|
|
3919
|
-
const resolvedNamespace = this.writableNamespaceFor(
|
|
3920
|
-
request.namespace,
|
|
3921
|
-
undefined,
|
|
3922
|
-
request.authenticatedPrincipal,
|
|
3923
|
-
);
|
|
3782
|
+
const resolvedNamespace = this.writableNamespaceFor(request.namespace, undefined, request.authenticatedPrincipal);
|
|
3924
3783
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
3925
3784
|
const memory = await storage.getMemoryById(memoryId);
|
|
3926
3785
|
if (!memory || isSupportPassportPrivateMemory(memory)) {
|
|
@@ -3953,10 +3812,14 @@ export class EngramAccessService {
|
|
|
3953
3812
|
};
|
|
3954
3813
|
}
|
|
3955
3814
|
|
|
3956
|
-
const updated = await storage.writeMemoryFrontmatter(
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3815
|
+
const updated = await storage.writeMemoryFrontmatter(
|
|
3816
|
+
memory,
|
|
3817
|
+
{
|
|
3818
|
+
status: request.status,
|
|
3819
|
+
updated: updatedAt,
|
|
3820
|
+
},
|
|
3821
|
+
lifecycle
|
|
3822
|
+
);
|
|
3960
3823
|
if (!updated) {
|
|
3961
3824
|
throw new Error(`failed to update memory disposition: ${memoryId}`);
|
|
3962
3825
|
}
|
|
@@ -3987,14 +3850,14 @@ export class EngramAccessService {
|
|
|
3987
3850
|
memory: MemoryFile,
|
|
3988
3851
|
baseDir: string,
|
|
3989
3852
|
disclosure?: RecallDisclosure,
|
|
3990
|
-
rawExcerpts?: EngramAccessMemorySummary["rawExcerpts"]
|
|
3853
|
+
rawExcerpts?: EngramAccessMemorySummary["rawExcerpts"]
|
|
3991
3854
|
): EngramAccessMemorySummary {
|
|
3992
3855
|
return shapeMemorySummary(memory, baseDir, disclosure, rawExcerpts);
|
|
3993
3856
|
}
|
|
3994
3857
|
|
|
3995
3858
|
async observe(
|
|
3996
3859
|
request: EngramAccessObserveRequest,
|
|
3997
|
-
hooks?: { enforceWriteQuota?: () => void | Promise<void> }
|
|
3860
|
+
hooks?: { enforceWriteQuota?: () => void | Promise<void> }
|
|
3998
3861
|
): Promise<EngramAccessObserveResponse> {
|
|
3999
3862
|
// Issue #1649: dedup retried observe POSTs server-side. A retry with the
|
|
4000
3863
|
// same `idempotencyKey` replays the cached response and skips every side
|
|
@@ -4049,15 +3912,11 @@ export class EngramAccessService {
|
|
|
4049
3912
|
}
|
|
4050
3913
|
|
|
4051
3914
|
private async runObserve(request: EngramAccessObserveRequest): Promise<EngramAccessObserveResponse> {
|
|
4052
|
-
return this.accessObserveWriteSurface.runObserve(
|
|
4053
|
-
request,
|
|
4054
|
-
);
|
|
3915
|
+
return this.accessObserveWriteSurface.runObserve(request);
|
|
4055
3916
|
}
|
|
4056
3917
|
|
|
4057
3918
|
async lcmSearch(request: EngramAccessLcmSearchRequest): Promise<EngramAccessLcmSearchResponse> {
|
|
4058
|
-
return this.accessLcmSurface.lcmSearch(
|
|
4059
|
-
request,
|
|
4060
|
-
);
|
|
3919
|
+
return this.accessLcmSurface.lcmSearch(request);
|
|
4061
3920
|
}
|
|
4062
3921
|
|
|
4063
3922
|
/**
|
|
@@ -4087,27 +3946,23 @@ export class EngramAccessService {
|
|
|
4087
3946
|
resolvedNamespace: string,
|
|
4088
3947
|
sessionKeyForOverlay: string | undefined,
|
|
4089
3948
|
authenticatedPrincipal: string | undefined,
|
|
4090
|
-
purpose: "read" | "write" = "read"
|
|
3949
|
+
purpose: "read" | "write" = "read"
|
|
4091
3950
|
): string {
|
|
4092
3951
|
return this.accessLcmSurface.resolveLcmReadNamespace(
|
|
4093
3952
|
explicitNamespace,
|
|
4094
3953
|
resolvedNamespace,
|
|
4095
3954
|
sessionKeyForOverlay,
|
|
4096
3955
|
authenticatedPrincipal,
|
|
4097
|
-
purpose
|
|
3956
|
+
purpose
|
|
4098
3957
|
);
|
|
4099
3958
|
}
|
|
4100
3959
|
|
|
4101
3960
|
private resolveRawExcerptReadNamespace(
|
|
4102
3961
|
explicitNamespace: string | undefined,
|
|
4103
3962
|
sessionKey: string | undefined,
|
|
4104
|
-
authenticatedPrincipal: string | undefined
|
|
3963
|
+
authenticatedPrincipal: string | undefined
|
|
4105
3964
|
): string | undefined {
|
|
4106
|
-
return this.accessLcmSurface.resolveRawExcerptReadNamespace(
|
|
4107
|
-
explicitNamespace,
|
|
4108
|
-
sessionKey,
|
|
4109
|
-
authenticatedPrincipal,
|
|
4110
|
-
);
|
|
3965
|
+
return this.accessLcmSurface.resolveRawExcerptReadNamespace(explicitNamespace, sessionKey, authenticatedPrincipal);
|
|
4111
3966
|
}
|
|
4112
3967
|
|
|
4113
3968
|
/**
|
|
@@ -4140,9 +3995,7 @@ export class EngramAccessService {
|
|
|
4140
3995
|
* `config.defaultNamespace`, keeping single-user recall byte-for-byte
|
|
4141
3996
|
* unchanged.
|
|
4142
3997
|
*/
|
|
4143
|
-
private resolveImplicitLcmReadFallbackNamespace(
|
|
4144
|
-
principal: string | undefined,
|
|
4145
|
-
): string | undefined {
|
|
3998
|
+
private resolveImplicitLcmReadFallbackNamespace(principal: string | undefined): string | undefined {
|
|
4146
3999
|
const config = this.orchestrator.config;
|
|
4147
4000
|
if (!resolveNamespaceCapabilities(config).namespaces) return config.defaultNamespace;
|
|
4148
4001
|
// PROCEED when `default` is readable (single-store / readable-default flows)
|
|
@@ -4166,10 +4019,7 @@ export class EngramAccessService {
|
|
|
4166
4019
|
// scoped overlay key (with a session) or empty (sessionless). SUPPRESS
|
|
4167
4020
|
// (`undefined`) when the self base is not readable-in-recall.
|
|
4168
4021
|
const selfBase = defaultNamespaceForPrincipal(principal, config);
|
|
4169
|
-
const selfReadableInRecall = recallNamespacesForPrincipal(
|
|
4170
|
-
principal,
|
|
4171
|
-
config,
|
|
4172
|
-
).includes(selfBase);
|
|
4022
|
+
const selfReadableInRecall = recallNamespacesForPrincipal(principal, config).includes(selfBase);
|
|
4173
4023
|
return selfReadableInRecall ? config.defaultNamespace : undefined;
|
|
4174
4024
|
}
|
|
4175
4025
|
|
|
@@ -4178,21 +4028,17 @@ export class EngramAccessService {
|
|
|
4178
4028
|
resolvedNamespace: string,
|
|
4179
4029
|
sessionKey: string,
|
|
4180
4030
|
authenticatedPrincipal: string | undefined,
|
|
4181
|
-
purpose: "read" | "write" = "read"
|
|
4031
|
+
purpose: "read" | "write" = "read"
|
|
4182
4032
|
): string {
|
|
4183
4033
|
const effectiveNamespace = this.resolveLcmReadNamespace(
|
|
4184
4034
|
explicitNamespace,
|
|
4185
4035
|
resolvedNamespace,
|
|
4186
4036
|
sessionKey,
|
|
4187
4037
|
authenticatedPrincipal,
|
|
4188
|
-
purpose
|
|
4038
|
+
purpose
|
|
4189
4039
|
);
|
|
4190
4040
|
return (
|
|
4191
|
-
lcmSessionKeyForNamespace(
|
|
4192
|
-
effectiveNamespace,
|
|
4193
|
-
sessionKey,
|
|
4194
|
-
this.orchestrator.config.defaultNamespace,
|
|
4195
|
-
) ?? sessionKey
|
|
4041
|
+
lcmSessionKeyForNamespace(effectiveNamespace, sessionKey, this.orchestrator.config.defaultNamespace) ?? sessionKey
|
|
4196
4042
|
);
|
|
4197
4043
|
}
|
|
4198
4044
|
|
|
@@ -4225,18 +4071,12 @@ export class EngramAccessService {
|
|
|
4225
4071
|
*/
|
|
4226
4072
|
private resolveScopeProfileLcmReadNamespaces(
|
|
4227
4073
|
sessionKey: string | undefined,
|
|
4228
|
-
authenticatedPrincipal: string | undefined
|
|
4074
|
+
authenticatedPrincipal: string | undefined
|
|
4229
4075
|
): string[] | null {
|
|
4230
4076
|
const config = this.orchestrator.config;
|
|
4231
4077
|
const principal = this.resolveRequestPrincipal(sessionKey, authenticatedPrincipal);
|
|
4232
|
-
const codingContext = sessionKey
|
|
4233
|
-
|
|
4234
|
-
: null;
|
|
4235
|
-
const codingOverlay = resolveCodingNamespaceOverlay(
|
|
4236
|
-
codingContext,
|
|
4237
|
-
config.codingMode,
|
|
4238
|
-
config.defaultNamespace,
|
|
4239
|
-
);
|
|
4078
|
+
const codingContext = sessionKey ? this.orchestrator.getCodingContextForSession(sessionKey) : null;
|
|
4079
|
+
const codingOverlay = resolveCodingNamespaceOverlay(codingContext, config.codingMode, config.defaultNamespace);
|
|
4240
4080
|
const profilePlan = resolveScopeProfilePlan({
|
|
4241
4081
|
config,
|
|
4242
4082
|
principal,
|
|
@@ -4263,11 +4103,7 @@ export class EngramAccessService {
|
|
|
4263
4103
|
const seen = new Set<string>();
|
|
4264
4104
|
for (const namespace of namespaces) {
|
|
4265
4105
|
const key =
|
|
4266
|
-
lcmSessionKeyForNamespace(
|
|
4267
|
-
namespace,
|
|
4268
|
-
sessionKey,
|
|
4269
|
-
this.orchestrator.config.defaultNamespace,
|
|
4270
|
-
) ?? sessionKey;
|
|
4106
|
+
lcmSessionKeyForNamespace(namespace, sessionKey, this.orchestrator.config.defaultNamespace) ?? sessionKey;
|
|
4271
4107
|
if (!seen.has(key)) {
|
|
4272
4108
|
seen.add(key);
|
|
4273
4109
|
out.push(key);
|
|
@@ -4280,18 +4116,18 @@ export class EngramAccessService {
|
|
|
4280
4116
|
explicitNamespace: string | undefined,
|
|
4281
4117
|
resolvedNamespace: string,
|
|
4282
4118
|
sessionKey: string,
|
|
4283
|
-
authenticatedPrincipal: string | undefined
|
|
4119
|
+
authenticatedPrincipal: string | undefined
|
|
4284
4120
|
): string[] {
|
|
4285
4121
|
return this.accessLcmSurface.resolveLcmReadSessionIds(
|
|
4286
4122
|
explicitNamespace,
|
|
4287
4123
|
resolvedNamespace,
|
|
4288
4124
|
sessionKey,
|
|
4289
|
-
authenticatedPrincipal
|
|
4125
|
+
authenticatedPrincipal
|
|
4290
4126
|
);
|
|
4291
4127
|
}
|
|
4292
4128
|
|
|
4293
4129
|
async lcmCompactionFlush(
|
|
4294
|
-
request: EngramAccessLcmCompactionFlushRequest
|
|
4130
|
+
request: EngramAccessLcmCompactionFlushRequest
|
|
4295
4131
|
): Promise<EngramAccessLcmCompactionFlushResponse> {
|
|
4296
4132
|
if (!request.sessionKey || typeof request.sessionKey !== "string" || request.sessionKey.trim().length === 0) {
|
|
4297
4133
|
throw new EngramAccessInputError("sessionKey is required and must be a non-empty string");
|
|
@@ -4313,11 +4149,8 @@ export class EngramAccessService {
|
|
|
4313
4149
|
|
|
4314
4150
|
// Flush the same LCM session ID observe archived under.
|
|
4315
4151
|
const lcmSessionKey =
|
|
4316
|
-
lcmSessionKeyForNamespace(
|
|
4317
|
-
|
|
4318
|
-
request.sessionKey,
|
|
4319
|
-
this.orchestrator.config.defaultNamespace,
|
|
4320
|
-
) ?? request.sessionKey;
|
|
4152
|
+
lcmSessionKeyForNamespace(scope.writeNamespace, request.sessionKey, this.orchestrator.config.defaultNamespace) ??
|
|
4153
|
+
request.sessionKey;
|
|
4321
4154
|
await this.orchestrator.lcmEngine.waitForSessionObserveIdle(lcmSessionKey);
|
|
4322
4155
|
await this.orchestrator.lcmEngine.preCompactionFlush(lcmSessionKey);
|
|
4323
4156
|
return {
|
|
@@ -4328,7 +4161,9 @@ export class EngramAccessService {
|
|
|
4328
4161
|
};
|
|
4329
4162
|
}
|
|
4330
4163
|
|
|
4331
|
-
async extractionForceFlush(
|
|
4164
|
+
async extractionForceFlush(
|
|
4165
|
+
request: EngramAccessExtractionForceFlushRequest
|
|
4166
|
+
): Promise<EngramAccessExtractionForceFlushResponse> {
|
|
4332
4167
|
return delegateExtractionForceFlush(this.accessObserveWriteSurface, request);
|
|
4333
4168
|
}
|
|
4334
4169
|
cancelPendingObservePreparations(sessionKey: string, scopeHint?: string): void {
|
|
@@ -4339,12 +4174,12 @@ export class EngramAccessService {
|
|
|
4339
4174
|
sessionKey: string,
|
|
4340
4175
|
principal?: string,
|
|
4341
4176
|
namespace?: string,
|
|
4342
|
-
scopeHint?: string
|
|
4177
|
+
scopeHint?: string
|
|
4343
4178
|
): void {
|
|
4344
4179
|
this.accessObserveWriteSurface.cancelPendingObserveExtractions(sessionKey, principal, namespace, scopeHint);
|
|
4345
4180
|
}
|
|
4346
4181
|
async lcmCompactionRecord(
|
|
4347
|
-
request: EngramAccessLcmCompactionRecordRequest
|
|
4182
|
+
request: EngramAccessLcmCompactionRecordRequest
|
|
4348
4183
|
): Promise<EngramAccessLcmCompactionRecordResponse> {
|
|
4349
4184
|
if (!request.sessionKey || typeof request.sessionKey !== "string" || request.sessionKey.trim().length === 0) {
|
|
4350
4185
|
throw new EngramAccessInputError("sessionKey is required and must be a non-empty string");
|
|
@@ -4386,17 +4221,10 @@ export class EngramAccessService {
|
|
|
4386
4221
|
// A write-only / self-omitted principal still records on the overlay queue
|
|
4387
4222
|
// because the scope plan authorized the write target by WRITE policy.
|
|
4388
4223
|
const lcmSessionKey =
|
|
4389
|
-
lcmSessionKeyForNamespace(
|
|
4390
|
-
|
|
4391
|
-
request.sessionKey,
|
|
4392
|
-
this.orchestrator.config.defaultNamespace,
|
|
4393
|
-
) ?? request.sessionKey;
|
|
4224
|
+
lcmSessionKeyForNamespace(scope.writeNamespace, request.sessionKey, this.orchestrator.config.defaultNamespace) ??
|
|
4225
|
+
request.sessionKey;
|
|
4394
4226
|
await this.orchestrator.lcmEngine.waitForSessionObserveIdle(lcmSessionKey);
|
|
4395
|
-
await this.orchestrator.lcmEngine.recordCompaction(
|
|
4396
|
-
lcmSessionKey,
|
|
4397
|
-
request.tokensBefore,
|
|
4398
|
-
request.tokensAfter,
|
|
4399
|
-
);
|
|
4227
|
+
await this.orchestrator.lcmEngine.recordCompaction(lcmSessionKey, request.tokensBefore, request.tokensAfter);
|
|
4400
4228
|
return {
|
|
4401
4229
|
enabled: true,
|
|
4402
4230
|
recorded: true,
|
|
@@ -4519,9 +4347,7 @@ export class EngramAccessService {
|
|
|
4519
4347
|
tags?: string[];
|
|
4520
4348
|
dueAt?: string;
|
|
4521
4349
|
}): Promise<unknown> {
|
|
4522
|
-
return this.accessObserveWriteSurface.workTask(
|
|
4523
|
-
request,
|
|
4524
|
-
);
|
|
4350
|
+
return this.accessObserveWriteSurface.workTask(request);
|
|
4525
4351
|
}
|
|
4526
4352
|
|
|
4527
4353
|
async workProject(request: {
|
|
@@ -4535,9 +4361,7 @@ export class EngramAccessService {
|
|
|
4535
4361
|
taskId?: string;
|
|
4536
4362
|
projectId?: string;
|
|
4537
4363
|
}): Promise<unknown> {
|
|
4538
|
-
return this.accessObserveWriteSurface.workProject(
|
|
4539
|
-
request,
|
|
4540
|
-
);
|
|
4364
|
+
return this.accessObserveWriteSurface.workProject(request);
|
|
4541
4365
|
}
|
|
4542
4366
|
|
|
4543
4367
|
async workBoard(request: {
|
|
@@ -4546,9 +4370,7 @@ export class EngramAccessService {
|
|
|
4546
4370
|
snapshotJson?: string;
|
|
4547
4371
|
linkToMemory?: boolean;
|
|
4548
4372
|
}): Promise<unknown> {
|
|
4549
|
-
return this.accessObserveWriteSurface.workBoard(
|
|
4550
|
-
request,
|
|
4551
|
-
);
|
|
4373
|
+
return this.accessObserveWriteSurface.workBoard(request);
|
|
4552
4374
|
}
|
|
4553
4375
|
|
|
4554
4376
|
async sharedContextWriteOutput(request: {
|
|
@@ -4686,7 +4508,10 @@ export class EngramAccessService {
|
|
|
4686
4508
|
eventLimit?: number;
|
|
4687
4509
|
}): Promise<unknown> {
|
|
4688
4510
|
if (!resolveCompressionCapabilities(this.orchestrator.config).compressionGuidelineLearning) {
|
|
4689
|
-
return {
|
|
4511
|
+
return {
|
|
4512
|
+
enabled: false,
|
|
4513
|
+
reason: "Compression guideline learning is disabled. Enable `compressionGuidelineLearningEnabled: true`.",
|
|
4514
|
+
};
|
|
4690
4515
|
}
|
|
4691
4516
|
return await this.orchestrator.compressionGuidelineCoordinator.optimizeCompressionGuidelines({
|
|
4692
4517
|
dryRun: request.dryRun,
|
|
@@ -4735,7 +4560,7 @@ export class EngramAccessService {
|
|
|
4735
4560
|
// The caller's own collection disambiguates a prefix that is also
|
|
4736
4561
|
// a memory category name (`collection: "facts"`).
|
|
4737
4562
|
{ ...config, requestedCollection: request.collection?.trim() || undefined },
|
|
4738
|
-
"qmd"
|
|
4563
|
+
"qmd"
|
|
4739
4564
|
),
|
|
4740
4565
|
filterPrivate: this.orchestrator.filterPrivateSearchResults,
|
|
4741
4566
|
authorizeFlatCorpus: (namespace, principal) => void this.resolveReadableNamespace(namespace, principal),
|
|
@@ -4743,13 +4568,13 @@ export class EngramAccessService {
|
|
|
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}`,
|
|
@@ -5492,15 +5271,16 @@ export class EngramAccessService {
|
|
|
5492
5271
|
}
|
|
5493
5272
|
|
|
5494
5273
|
async offlineSyncSnapshotStream(
|
|
5495
|
-
options: Omit<EngramAccessOfflineSyncSnapshotRequest, "baseCapturedAt" | "baseFiles"> & {
|
|
5274
|
+
options: Omit<EngramAccessOfflineSyncSnapshotRequest, "baseCapturedAt" | "baseFiles"> & {
|
|
5275
|
+
signal?: AbortSignal;
|
|
5276
|
+
} = {}
|
|
5496
5277
|
): Promise<EngramAccessOfflineSyncSnapshotStreamResponse> {
|
|
5497
5278
|
const resolvedNamespace = this.resolveReadableNamespace(options.namespace, options.principal);
|
|
5498
5279
|
const storage = await offlineSyncStorageForSnapshot(this.orchestrator, resolvedNamespace);
|
|
5499
5280
|
const storageHash = createHash("sha256").update(storage.dir).digest("hex").slice(0, 16);
|
|
5500
5281
|
const deletions = await filterOfflineSyncDeletionRevisions({
|
|
5501
5282
|
root: storage.dir,
|
|
5502
|
-
deletions: [...await storage.readDeletionRevisions()]
|
|
5503
|
-
.map(([path, mtimeMs]) => ({ path, mtimeMs })),
|
|
5283
|
+
deletions: [...(await storage.readDeletionRevisions())].map(([path, mtimeMs]) => ({ path, mtimeMs })),
|
|
5504
5284
|
includeTranscripts: options.includeTranscripts !== false,
|
|
5505
5285
|
userExcludeRegexps: this.offlineSyncUserExcludes,
|
|
5506
5286
|
});
|
|
@@ -5525,7 +5305,7 @@ export class EngramAccessService {
|
|
|
5525
5305
|
};
|
|
5526
5306
|
}
|
|
5527
5307
|
async offlineSyncManifestStream(
|
|
5528
|
-
options: EngramAccessOfflineSyncManifestRequest & { signal?: AbortSignal } = {}
|
|
5308
|
+
options: EngramAccessOfflineSyncManifestRequest & { signal?: AbortSignal } = {}
|
|
5529
5309
|
): Promise<OfflineSyncManifestStreamResponse> {
|
|
5530
5310
|
const namespace = this.resolveReadableNamespace(options.namespace, options.principal);
|
|
5531
5311
|
return createOfflineSyncManifestStream(
|
|
@@ -5533,14 +5313,11 @@ export class EngramAccessService {
|
|
|
5533
5313
|
namespace,
|
|
5534
5314
|
this.offlineSyncUserExcludes,
|
|
5535
5315
|
options,
|
|
5536
|
-
parseFrontmatter
|
|
5316
|
+
parseFrontmatter
|
|
5537
5317
|
);
|
|
5538
5318
|
}
|
|
5539
5319
|
|
|
5540
|
-
|
|
5541
|
-
async offlineSyncFiles(
|
|
5542
|
-
options: EngramAccessOfflineSyncFilesRequest,
|
|
5543
|
-
): Promise<EngramAccessOfflineSyncFilesResponse> {
|
|
5320
|
+
async offlineSyncFiles(options: EngramAccessOfflineSyncFilesRequest): Promise<EngramAccessOfflineSyncFilesResponse> {
|
|
5544
5321
|
const resolvedNamespace = this.resolveReadableNamespace(options.namespace, options.principal);
|
|
5545
5322
|
const storage = await offlineSyncStorageForSnapshot(this.orchestrator, resolvedNamespace);
|
|
5546
5323
|
const storageHash = createHash("sha256").update(storage.dir).digest("hex").slice(0, 16);
|
|
@@ -5573,7 +5350,7 @@ export class EngramAccessService {
|
|
|
5573
5350
|
}
|
|
5574
5351
|
|
|
5575
5352
|
async offlineSyncFileContent(
|
|
5576
|
-
options: EngramAccessOfflineSyncFileContentRequest
|
|
5353
|
+
options: EngramAccessOfflineSyncFileContentRequest
|
|
5577
5354
|
): Promise<EngramAccessOfflineSyncFileContentResponse> {
|
|
5578
5355
|
const resolvedNamespace = this.resolveReadableNamespace(options.namespace, options.principal);
|
|
5579
5356
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
@@ -5608,13 +5385,9 @@ export class EngramAccessService {
|
|
|
5608
5385
|
}
|
|
5609
5386
|
|
|
5610
5387
|
async offlineSyncApplyFileContent(
|
|
5611
|
-
options: EngramAccessOfflineSyncApplyFileContentRequest
|
|
5388
|
+
options: EngramAccessOfflineSyncApplyFileContentRequest
|
|
5612
5389
|
): Promise<EngramAccessOfflineSyncApplyFileContentResponse> {
|
|
5613
|
-
const resolvedNamespace = this.writableNamespaceFor(
|
|
5614
|
-
options.namespace,
|
|
5615
|
-
undefined,
|
|
5616
|
-
options.principal,
|
|
5617
|
-
);
|
|
5390
|
+
const resolvedNamespace = this.writableNamespaceFor(options.namespace, undefined, options.principal);
|
|
5618
5391
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
5619
5392
|
try {
|
|
5620
5393
|
const result = await applySupportPassportOfflineSyncFileContent(storage, options);
|
|
@@ -5643,21 +5416,17 @@ export class EngramAccessService {
|
|
|
5643
5416
|
}
|
|
5644
5417
|
|
|
5645
5418
|
async offlineSyncFinalizeConvergence(
|
|
5646
|
-
options: EngramAccessOfflineSyncFinalizeConvergenceRequest
|
|
5419
|
+
options: EngramAccessOfflineSyncFinalizeConvergenceRequest
|
|
5647
5420
|
): Promise<EngramAccessOfflineSyncFinalizeConvergenceResponse> {
|
|
5648
5421
|
if (options.sourceId !== "remnic-converge") {
|
|
5649
5422
|
throw new EngramAccessInputError("sourceId must be remnic-converge");
|
|
5650
5423
|
}
|
|
5651
|
-
const requestedNamespaces = options.namespaces?.length
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
undefined,
|
|
5658
|
-
options.principal,
|
|
5659
|
-
)),
|
|
5660
|
-
));
|
|
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
|
+
);
|
|
5661
5430
|
await this.orchestrator.refreshNamespacesAfterConvergence(resolvedNamespaces);
|
|
5662
5431
|
return {
|
|
5663
5432
|
namespaces: resolvedNamespaces,
|
|
@@ -5665,14 +5434,8 @@ export class EngramAccessService {
|
|
|
5665
5434
|
};
|
|
5666
5435
|
}
|
|
5667
5436
|
|
|
5668
|
-
async offlineSyncApply(
|
|
5669
|
-
options
|
|
5670
|
-
): Promise<EngramAccessOfflineSyncApplyResponse> {
|
|
5671
|
-
const resolvedNamespace = this.writableNamespaceFor(
|
|
5672
|
-
options.namespace,
|
|
5673
|
-
undefined,
|
|
5674
|
-
options.principal,
|
|
5675
|
-
);
|
|
5437
|
+
async offlineSyncApply(options: EngramAccessOfflineSyncApplyRequest): Promise<EngramAccessOfflineSyncApplyResponse> {
|
|
5438
|
+
const resolvedNamespace = this.writableNamespaceFor(options.namespace, undefined, options.principal);
|
|
5676
5439
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
5677
5440
|
try {
|
|
5678
5441
|
const result = await applySupportPassportOfflineSyncChangeset(storage, options);
|
|
@@ -5717,9 +5480,7 @@ export class EngramAccessService {
|
|
|
5717
5480
|
namespace?: string;
|
|
5718
5481
|
authenticatedPrincipal?: string;
|
|
5719
5482
|
}): Promise<import("./types.js").DreamsRunResult> {
|
|
5720
|
-
return this.accessAdminOpsSurface.dreamsRun(
|
|
5721
|
-
options,
|
|
5722
|
-
);
|
|
5483
|
+
return this.accessAdminOpsSurface.dreamsRun(options);
|
|
5723
5484
|
}
|
|
5724
5485
|
|
|
5725
5486
|
// ---------------------------------------------------------------------------
|
|
@@ -5748,19 +5509,27 @@ export class EngramAccessService {
|
|
|
5748
5509
|
return wearablesMeetings.wearablesStatus(this.wmHost, scope);
|
|
5749
5510
|
}
|
|
5750
5511
|
|
|
5751
|
-
async wearablesSync(
|
|
5512
|
+
async wearablesSync(
|
|
5513
|
+
request: { source?: string; date?: string; days?: number; forceMemories?: boolean } & WearablesMeetingsScope
|
|
5514
|
+
): Promise<Awaited<ReturnType<WearablesService["sync"]>>> {
|
|
5752
5515
|
return wearablesMeetings.wearablesSync(this.wmHost, request);
|
|
5753
5516
|
}
|
|
5754
5517
|
|
|
5755
|
-
async wearablesTranscriptDay(
|
|
5518
|
+
async wearablesTranscriptDay(
|
|
5519
|
+
request: { date: string; source?: string } & WearablesMeetingsScope
|
|
5520
|
+
): Promise<Awaited<ReturnType<WearablesService["dayTranscript"]>>> {
|
|
5756
5521
|
return wearablesMeetings.wearablesTranscriptDay(this.wmHost, request);
|
|
5757
5522
|
}
|
|
5758
5523
|
|
|
5759
|
-
async wearablesTranscriptSearch(
|
|
5524
|
+
async wearablesTranscriptSearch(
|
|
5525
|
+
request: { query: string; source?: string; from?: string; to?: string; limit?: number } & WearablesMeetingsScope
|
|
5526
|
+
): Promise<Awaited<ReturnType<WearablesService["searchTranscripts"]>>> {
|
|
5760
5527
|
return wearablesMeetings.wearablesTranscriptSearch(this.wmHost, request);
|
|
5761
5528
|
}
|
|
5762
5529
|
|
|
5763
|
-
async wearablesTranscriptMemories(
|
|
5530
|
+
async wearablesTranscriptMemories(
|
|
5531
|
+
request: { source?: string; date?: string; limit?: number } & WearablesMeetingsScope
|
|
5532
|
+
): Promise<Awaited<ReturnType<WearablesService["transcriptMemories"]>>> {
|
|
5764
5533
|
return wearablesMeetings.wearablesTranscriptMemories(this.wmHost, request);
|
|
5765
5534
|
}
|
|
5766
5535
|
|
|
@@ -5800,7 +5569,7 @@ export class EngramAccessService {
|
|
|
5800
5569
|
// inspectScope helper (admin-surfaces.ts) owns the single namespace-flag
|
|
5801
5570
|
// read for this surface and threads it through resolveScopePlan.
|
|
5802
5571
|
const codingContext = options.sessionKey
|
|
5803
|
-
? this.orchestrator.getCodingContextForSession(options.sessionKey) ?? null
|
|
5572
|
+
? (this.orchestrator.getCodingContextForSession(options.sessionKey) ?? null)
|
|
5804
5573
|
: null;
|
|
5805
5574
|
const inspection = inspectScope({
|
|
5806
5575
|
config,
|
|
@@ -5878,8 +5647,6 @@ export class EngramAccessService {
|
|
|
5878
5647
|
reason: string;
|
|
5879
5648
|
actor?: never; // ignored — actor is derived from the authenticated principal
|
|
5880
5649
|
}) {
|
|
5881
|
-
return this.accessAdminOpsSurface.adminPromoteMemory(
|
|
5882
|
-
request,
|
|
5883
|
-
);
|
|
5650
|
+
return this.accessAdminOpsSurface.adminPromoteMemory(request);
|
|
5884
5651
|
}
|
|
5885
5652
|
}
|