@remnic/core 10.0.49 → 10.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-admin-ops-surface.js +41 -40
- package/dist/access-authorization-probe.js +42 -41
- package/dist/access-boundary.js +41 -40
- package/dist/access-cli.js +107 -106
- package/dist/access-cli.js.map +1 -1
- package/dist/access-extraction-force-flush.js +41 -40
- package/dist/access-http-briefing.d.ts +2 -0
- package/dist/access-http-briefing.d.ts.map +1 -1
- package/dist/access-http-briefing.js +42 -41
- package/dist/access-http-query.js +43 -42
- package/dist/access-http.d.ts.map +1 -1
- package/dist/access-http.js +59 -58
- package/dist/access-identity-continuity-surface.js +41 -40
- package/dist/access-lcm-surface.js +41 -40
- package/dist/access-mcp.js +51 -50
- package/dist/access-namespace-preflight.js +41 -40
- package/dist/access-observe-write-category.d.ts +1 -1
- package/dist/access-observe-write-category.d.ts.map +1 -1
- package/dist/access-observe-write-category.js +10 -10
- package/dist/access-observe-write-surface.d.ts.map +1 -1
- package/dist/access-observe-write-surface.js +41 -40
- package/dist/access-offline-manifest.js +4 -4
- package/dist/access-operations-batch.js +42 -41
- package/dist/access-operations.js +49 -48
- package/dist/access-recall-concurrency.js +41 -40
- package/dist/access-recall-response.js +41 -40
- package/dist/access-recall-surface.js +41 -40
- package/dist/access-schema.js +6 -6
- package/dist/access-service.d.ts +5 -0
- package/dist/access-service.d.ts.map +1 -1
- package/dist/access-service.js +41 -40
- package/dist/access-surface-catalog.js +43 -42
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/active-recall.js +14 -14
- package/dist/{auto-sync-BNCBMU6H.js → auto-sync-UQQ6YJSB.js} +3 -3
- package/dist/briefing-deadline.d.ts +7 -0
- package/dist/briefing-deadline.d.ts.map +1 -0
- package/dist/briefing-deadline.js +13 -0
- package/dist/briefing-window.d.ts +12 -4
- package/dist/briefing-window.d.ts.map +1 -1
- package/dist/briefing-window.js +3 -1
- package/dist/briefing.d.ts +2 -0
- package/dist/briefing.d.ts.map +1 -1
- package/dist/briefing.js +12 -11
- package/dist/buffer.js +3 -3
- package/dist/calibration.js +2 -2
- package/dist/{capsule-merge-RNQUP2VL.js → capsule-merge-D4BTIJGK.js} +3 -3
- package/dist/causal-consolidation.js +11 -11
- package/dist/{chunk-ESDOQEJM.js → chunk-2AKIVSHP.js} +2 -2
- package/dist/{chunk-MCS4LIXP.js → chunk-43TUWQNR.js} +2 -2
- package/dist/{chunk-2NLCDNGA.js → chunk-564YP3DW.js} +2 -2
- package/dist/{chunk-PBWJVRKE.js → chunk-5FUDSK6Z.js} +2 -2
- package/dist/{chunk-V4GPFCJ7.js → chunk-5G53JSRO.js} +2 -2
- package/dist/{chunk-WJCAAVZX.js → chunk-5X2H3X4J.js} +2 -2
- package/dist/{chunk-CPBYKOTC.js → chunk-6ZQX3R66.js} +2 -2
- package/dist/{chunk-AF4UIHON.js → chunk-74AY3S7U.js} +9 -9
- package/dist/{chunk-XSJL62LE.js → chunk-7J6A5MV2.js} +2 -2
- package/dist/{chunk-A3WXV7YU.js → chunk-7SAE6T36.js} +2 -2
- package/dist/{chunk-BWF3KNSQ.js → chunk-7YVER7ZO.js} +2 -2
- package/dist/{chunk-5IDQVE4U.js → chunk-A3UFV4K3.js} +6 -6
- package/dist/{chunk-LWRIGKFM.js → chunk-A5L5KGDI.js} +19 -1
- package/dist/chunk-A5L5KGDI.js.map +1 -0
- package/dist/{chunk-6TIVVOVU.js → chunk-BNJAVRNJ.js} +9 -9
- package/dist/{chunk-CMOYD5CA.js → chunk-CCL2OXFO.js} +2 -2
- package/dist/{chunk-7XFQSQYS.js → chunk-CRN3EPE2.js} +4 -3
- package/dist/chunk-CRN3EPE2.js.map +1 -0
- package/dist/{chunk-3NYIXVCT.js → chunk-DMKTOCC7.js} +2 -2
- package/dist/chunk-DMKTOCC7.js.map +1 -0
- package/dist/{chunk-FRXS6SC7.js → chunk-EKUI7I2X.js} +20 -4
- package/dist/chunk-EKUI7I2X.js.map +1 -0
- package/dist/{chunk-N6EM7ESC.js → chunk-EKYWZYZJ.js} +22 -14
- package/dist/chunk-EKYWZYZJ.js.map +1 -0
- package/dist/{chunk-FOKTW6GY.js → chunk-EWBXMGXR.js} +2 -2
- package/dist/{chunk-YNDLCWXS.js → chunk-EZ25VE3G.js} +4 -4
- package/dist/{chunk-6W3QH3QW.js → chunk-GQIYL7OD.js} +388 -292
- package/dist/chunk-GQIYL7OD.js.map +1 -0
- package/dist/{chunk-E47UQBYW.js → chunk-GXVXBYRA.js} +3 -3
- package/dist/{chunk-RZDDNH63.js → chunk-HKOMHP6D.js} +27 -15
- package/dist/chunk-HKOMHP6D.js.map +1 -0
- package/dist/{chunk-AGCEJDG2.js → chunk-HPNXS6W6.js} +2 -2
- package/dist/{chunk-O4CA53UY.js → chunk-IMKOJVD4.js} +69 -63
- package/dist/chunk-IMKOJVD4.js.map +1 -0
- package/dist/{chunk-N5PISU26.js → chunk-IN6U2BS5.js} +2 -2
- package/dist/{chunk-HI53EK3Y.js → chunk-IUYXCTA7.js} +2 -2
- package/dist/{chunk-VGRBKEBH.js → chunk-JBWD3J5U.js} +3 -3
- package/dist/{chunk-YB3WN6XA.js → chunk-K5QQXVG6.js} +12 -12
- package/dist/{chunk-7LCGFUMB.js → chunk-KQAFEZQX.js} +4 -4
- package/dist/{chunk-HDT3DMUF.js → chunk-KW5YZELC.js} +2 -2
- package/dist/{chunk-DM6SOROF.js → chunk-LIBVANOF.js} +2 -2
- package/dist/{chunk-VKUMKVEU.js → chunk-LMMBV7QC.js} +4 -4
- package/dist/{chunk-NMOEOQV4.js → chunk-M2DOJBH7.js} +2 -2
- package/dist/{chunk-3INLTKTW.js → chunk-M4HRYLOA.js} +2 -2
- package/dist/{chunk-YY6PWFUC.js → chunk-M6TP6UYD.js} +3 -3
- package/dist/{chunk-BJTFLP3J.js → chunk-MLNXATFG.js} +2 -2
- package/dist/{chunk-C7WDWD35.js → chunk-MWURUSRE.js} +5 -5
- package/dist/{chunk-WIBWONL4.js → chunk-N74WJ7B2.js} +2 -2
- package/dist/{chunk-LCHFINL4.js → chunk-N7FNCE7F.js} +2 -2
- package/dist/{chunk-QZK6HG4J.js → chunk-NPLM7AFU.js} +2 -2
- package/dist/{chunk-CRJX4OMN.js → chunk-NSP5PIQH.js} +2 -2
- package/dist/{chunk-X52SXKVC.js → chunk-P7OVFGMU.js} +2 -2
- package/dist/{chunk-2J6BIOVN.js → chunk-PJCVI44H.js} +2 -2
- package/dist/{chunk-Q6PYCPHO.js → chunk-Q3PNQYAC.js} +2 -2
- package/dist/{chunk-D76AHITY.js → chunk-QS765SBL.js} +2 -2
- package/dist/{chunk-KNCR7APE.js → chunk-QTDZ2NYC.js} +7 -7
- package/dist/{chunk-YFXRLRKP.js → chunk-S4OZKPBS.js} +7 -11
- package/dist/{chunk-YFXRLRKP.js.map → chunk-S4OZKPBS.js.map} +1 -1
- package/dist/{chunk-HCPVL6SF.js → chunk-SJTSWG2Z.js} +3 -3
- package/dist/{chunk-SA6P2KS3.js → chunk-TEH5MDX5.js} +33 -17
- package/dist/chunk-TEH5MDX5.js.map +1 -0
- package/dist/{chunk-XFND63OB.js → chunk-TFWJXWL6.js} +2 -2
- package/dist/{chunk-SVJ5JVZO.js → chunk-TXKQBQYW.js} +3 -3
- package/dist/{chunk-WQFHHJWK.js → chunk-UALXWWGN.js} +2 -2
- package/dist/{chunk-3PVKV3XL.js → chunk-UNOAVHV4.js} +2 -2
- package/dist/{chunk-FYZXZUGU.js → chunk-UQBOPCDK.js} +2 -2
- package/dist/{chunk-SUKPM6DV.js → chunk-UWMZT2TY.js} +47 -4
- package/dist/chunk-UWMZT2TY.js.map +1 -0
- package/dist/{chunk-OD7ZXCUF.js → chunk-UXGXJUZ5.js} +7 -7
- package/dist/{chunk-NH37SP6V.js → chunk-UZVQFGAY.js} +81 -78
- package/dist/chunk-UZVQFGAY.js.map +1 -0
- package/dist/{chunk-2BY56HE6.js → chunk-VCOMACR6.js} +35 -35
- package/dist/{chunk-5FNZ3G6X.js → chunk-VKQI47DJ.js} +4 -4
- package/dist/{chunk-MPJDQC4G.js → chunk-WJCXUE2J.js} +2 -2
- package/dist/{chunk-C3HRYVGD.js → chunk-WV4UYDP6.js} +2 -2
- package/dist/{chunk-E3DL3CAL.js → chunk-WXJC2L66.js} +2 -2
- package/dist/chunk-X2KO4FK5.js +40 -0
- package/dist/chunk-X2KO4FK5.js.map +1 -0
- package/dist/{chunk-O7GNSHFF.js → chunk-XC3H7KON.js} +2 -2
- package/dist/{chunk-OOOX5C4X.js → chunk-XL2EE5W3.js} +4 -4
- package/dist/{chunk-NUK5XU3P.js → chunk-XTXWR6KQ.js} +25 -10
- package/dist/chunk-XTXWR6KQ.js.map +1 -0
- package/dist/{chunk-CZVNOTLR.js → chunk-XXR4A33N.js} +2 -2
- package/dist/{chunk-2AV2U2SZ.js → chunk-YDIOMDBW.js} +2 -2
- package/dist/{chunk-QFTNWDJ6.js → chunk-YECEEJUU.js} +2 -2
- package/dist/{chunk-BMG3SAXA.js → chunk-Z5277JWF.js} +3 -3
- package/dist/{chunk-SW3WHVKN.js → chunk-ZFNXJEUG.js} +2 -2
- package/dist/{chunk-VY6BD5KB.js → chunk-ZMO2S5RT.js} +12 -10
- package/dist/chunk-ZMO2S5RT.js.map +1 -0
- package/dist/{chunk-KMTMMBEB.js → chunk-ZNRTHYYW.js} +6 -6
- package/dist/{chunk-VCBS5GRQ.js → chunk-ZSMA67FV.js} +2 -2
- package/dist/cli.js +80 -79
- package/dist/coding/export-okf-codegraph.js +9 -9
- package/dist/compounding/engine.js +11 -11
- package/dist/config.js +14 -14
- package/dist/connectors/codex-materialize-runner.js +10 -10
- package/dist/connectors/index.js +10 -10
- package/dist/consolidation-provenance-check.js +4 -4
- package/dist/consolidation-undo.js +2 -2
- package/dist/convergence-refresh.js +12 -12
- package/dist/corpus-watermark.js +12 -12
- package/dist/correction/passive-correction-notifications.d.ts +1 -1
- package/dist/correction/passive-correction-notifications.d.ts.map +1 -1
- package/dist/dashboard-runtime.js +2 -2
- package/dist/deep-recall-http-glue.js +7 -7
- package/dist/{entity-canonical-id-migration-2YOLMOFC.js → entity-canonical-id-migration-ZBNRGUNV.js} +3 -3
- package/dist/entity-canonical-id-migration-ZBNRGUNV.js.map +1 -0
- package/dist/entity-retrieval.js +11 -11
- package/dist/explicit-capture.js +2 -2
- package/dist/external-wiki-access.js +42 -41
- package/dist/extraction.js +16 -16
- package/dist/{first-start-migration-QVD22WWS.js → first-start-migration-A6PHIBUQ.js} +4 -4
- package/dist/harmonic-retrieval.js +10 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +130 -122
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.js +5 -5
- package/dist/local-llm.js +2 -2
- package/dist/location/index.js +15 -15
- package/dist/location/tagging.d.ts +7 -5
- package/dist/location/tagging.d.ts.map +1 -1
- package/dist/maintenance/memory-governance.js +10 -10
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +10 -10
- package/dist/maintenance/rebuild-memory-projection-runner.js +12 -12
- package/dist/maintenance/rebuild-memory-projection.js +11 -11
- package/dist/memory-browse-operations.js +42 -41
- package/dist/namespaces/migrate.js +11 -11
- package/dist/namespaces/storage.js +10 -10
- package/dist/offline-sync-file-io.d.ts +15 -0
- package/dist/offline-sync-file-io.d.ts.map +1 -1
- package/dist/offline-sync-file-io.js +9 -1
- package/dist/offline-sync-snapshot-stream.js +4 -4
- package/dist/offline-sync-upload-staging.js +2 -2
- package/dist/offline-sync.d.ts.map +1 -1
- package/dist/offline-sync.js +3 -3
- package/dist/operator-doctor-corpus.js +13 -13
- package/dist/operator-toolkit.js +24 -24
- package/dist/orchestration/maintenance.js +23 -23
- package/dist/orchestrator.d.ts +1 -0
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +109 -108
- package/dist/page-versioning.js +2 -2
- package/dist/recall-navigation-operations.js +42 -41
- package/dist/recall-navigation.js +41 -40
- package/dist/resume-bundles.js +15 -15
- package/dist/semantic-consolidation.js +15 -15
- package/dist/semantic-rule-promotion.js +10 -10
- package/dist/semantic-rule-verifier.js +10 -10
- package/dist/source-agent-qualifier.js +13 -13
- package/dist/standup/build.js +10 -10
- package/dist/storage/entity-canonical-id-migration-adapter.d.ts +1 -0
- package/dist/storage/entity-canonical-id-migration-adapter.d.ts.map +1 -1
- package/dist/storage/entity-canonical-id-migration.d.ts +7 -0
- package/dist/storage/entity-canonical-id-migration.d.ts.map +1 -1
- package/dist/storage/entity-canonical-id-references.d.ts +2 -0
- package/dist/storage/entity-canonical-id-references.d.ts.map +1 -1
- package/dist/storage/entity-migration-completion-cache.d.ts +46 -0
- package/dist/storage/entity-migration-completion-cache.d.ts.map +1 -0
- package/dist/storage/entity-store.d.ts +1 -8
- package/dist/storage/entity-store.d.ts.map +1 -1
- package/dist/storage/memory-read-store.d.ts +3 -2
- package/dist/storage/memory-read-store.d.ts.map +1 -1
- package/dist/storage/windowed-memory-read.d.ts +6 -0
- package/dist/storage/windowed-memory-read.d.ts.map +1 -1
- package/dist/storage.d.ts +2 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +9 -9
- package/dist/summarizer.js +3 -3
- package/dist/support-passport/index.js +44 -43
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/capsule-import.js +4 -4
- package/dist/transfer/export-okf.js +10 -10
- package/dist/verified-recall.js +10 -10
- package/dist/who-knows-cli.js +11 -11
- package/dist/who-knows.js +10 -10
- package/package.json +2 -2
- package/src/access-http-briefing.ts +4 -0
- package/src/access-http.test.ts +40 -11
- package/src/access-http.ts +6 -0
- package/src/access-observe-write-category.ts +1 -1
- package/src/access-observe-write-surface.ts +24 -19
- package/src/access-operations-batch.ts +18 -2
- package/src/access-service.ts +5 -0
- package/src/briefing-abort.test.ts +173 -0
- package/src/briefing-deadline.test.ts +84 -0
- package/src/briefing-deadline.ts +33 -0
- package/src/briefing-window-abort.test.ts +47 -0
- package/src/briefing-window.ts +33 -4
- package/src/briefing.ts +23 -16
- package/src/correction/passive-correction-notifications-abort.test.ts +42 -0
- package/src/correction/passive-correction-notifications.ts +4 -0
- package/src/entity-lazy-compatibility.test.ts +229 -0
- package/src/entity-migration-completion-notification.test.ts +148 -0
- package/src/index.ts +1 -1
- package/src/location/tagging.ts +14 -12
- package/src/offline-sync-file-io.ts +61 -2
- package/src/offline-sync.test.ts +313 -20
- package/src/offline-sync.ts +43 -21
- package/src/orchestrator-init.test.ts +49 -1
- package/src/orchestrator.ts +9 -8
- package/src/storage/entity-canonical-id-migration-adapter.ts +16 -1
- package/src/storage/entity-canonical-id-migration.ts +17 -8
- package/src/storage/entity-canonical-id-references.ts +24 -0
- package/src/storage/entity-migration-completion-cache.nofollow.test.ts +223 -0
- package/src/storage/entity-migration-completion-cache.ts +153 -0
- package/src/storage/entity-store.ts +58 -86
- package/src/storage/memory-read-store.ts +9 -3
- package/src/storage/windowed-memory-read.ts +8 -0
- package/src/storage-startup-nonblocking-migration.test.ts +183 -0
- package/src/storage.ts +7 -2
- package/src/testing/subjects/entity-migration-completion-cache.test.ts +90 -0
- package/dist/chunk-3NYIXVCT.js.map +0 -1
- package/dist/chunk-6W3QH3QW.js.map +0 -1
- package/dist/chunk-7XFQSQYS.js.map +0 -1
- package/dist/chunk-FRXS6SC7.js.map +0 -1
- package/dist/chunk-LWRIGKFM.js.map +0 -1
- package/dist/chunk-N6EM7ESC.js.map +0 -1
- package/dist/chunk-NH37SP6V.js.map +0 -1
- package/dist/chunk-NUK5XU3P.js.map +0 -1
- package/dist/chunk-O4CA53UY.js.map +0 -1
- package/dist/chunk-RZDDNH63.js.map +0 -1
- package/dist/chunk-SA6P2KS3.js.map +0 -1
- package/dist/chunk-SUKPM6DV.js.map +0 -1
- package/dist/chunk-VY6BD5KB.js.map +0 -1
- /package/dist/{auto-sync-BNCBMU6H.js.map → auto-sync-UQQ6YJSB.js.map} +0 -0
- /package/dist/{entity-canonical-id-migration-2YOLMOFC.js.map → briefing-deadline.js.map} +0 -0
- /package/dist/{capsule-merge-RNQUP2VL.js.map → capsule-merge-D4BTIJGK.js.map} +0 -0
- /package/dist/{chunk-ESDOQEJM.js.map → chunk-2AKIVSHP.js.map} +0 -0
- /package/dist/{chunk-MCS4LIXP.js.map → chunk-43TUWQNR.js.map} +0 -0
- /package/dist/{chunk-2NLCDNGA.js.map → chunk-564YP3DW.js.map} +0 -0
- /package/dist/{chunk-PBWJVRKE.js.map → chunk-5FUDSK6Z.js.map} +0 -0
- /package/dist/{chunk-V4GPFCJ7.js.map → chunk-5G53JSRO.js.map} +0 -0
- /package/dist/{chunk-WJCAAVZX.js.map → chunk-5X2H3X4J.js.map} +0 -0
- /package/dist/{chunk-CPBYKOTC.js.map → chunk-6ZQX3R66.js.map} +0 -0
- /package/dist/{chunk-AF4UIHON.js.map → chunk-74AY3S7U.js.map} +0 -0
- /package/dist/{chunk-XSJL62LE.js.map → chunk-7J6A5MV2.js.map} +0 -0
- /package/dist/{chunk-A3WXV7YU.js.map → chunk-7SAE6T36.js.map} +0 -0
- /package/dist/{chunk-BWF3KNSQ.js.map → chunk-7YVER7ZO.js.map} +0 -0
- /package/dist/{chunk-5IDQVE4U.js.map → chunk-A3UFV4K3.js.map} +0 -0
- /package/dist/{chunk-6TIVVOVU.js.map → chunk-BNJAVRNJ.js.map} +0 -0
- /package/dist/{chunk-CMOYD5CA.js.map → chunk-CCL2OXFO.js.map} +0 -0
- /package/dist/{chunk-FOKTW6GY.js.map → chunk-EWBXMGXR.js.map} +0 -0
- /package/dist/{chunk-YNDLCWXS.js.map → chunk-EZ25VE3G.js.map} +0 -0
- /package/dist/{chunk-E47UQBYW.js.map → chunk-GXVXBYRA.js.map} +0 -0
- /package/dist/{chunk-AGCEJDG2.js.map → chunk-HPNXS6W6.js.map} +0 -0
- /package/dist/{chunk-N5PISU26.js.map → chunk-IN6U2BS5.js.map} +0 -0
- /package/dist/{chunk-HI53EK3Y.js.map → chunk-IUYXCTA7.js.map} +0 -0
- /package/dist/{chunk-VGRBKEBH.js.map → chunk-JBWD3J5U.js.map} +0 -0
- /package/dist/{chunk-YB3WN6XA.js.map → chunk-K5QQXVG6.js.map} +0 -0
- /package/dist/{chunk-7LCGFUMB.js.map → chunk-KQAFEZQX.js.map} +0 -0
- /package/dist/{chunk-HDT3DMUF.js.map → chunk-KW5YZELC.js.map} +0 -0
- /package/dist/{chunk-DM6SOROF.js.map → chunk-LIBVANOF.js.map} +0 -0
- /package/dist/{chunk-VKUMKVEU.js.map → chunk-LMMBV7QC.js.map} +0 -0
- /package/dist/{chunk-NMOEOQV4.js.map → chunk-M2DOJBH7.js.map} +0 -0
- /package/dist/{chunk-3INLTKTW.js.map → chunk-M4HRYLOA.js.map} +0 -0
- /package/dist/{chunk-YY6PWFUC.js.map → chunk-M6TP6UYD.js.map} +0 -0
- /package/dist/{chunk-BJTFLP3J.js.map → chunk-MLNXATFG.js.map} +0 -0
- /package/dist/{chunk-C7WDWD35.js.map → chunk-MWURUSRE.js.map} +0 -0
- /package/dist/{chunk-WIBWONL4.js.map → chunk-N74WJ7B2.js.map} +0 -0
- /package/dist/{chunk-LCHFINL4.js.map → chunk-N7FNCE7F.js.map} +0 -0
- /package/dist/{chunk-QZK6HG4J.js.map → chunk-NPLM7AFU.js.map} +0 -0
- /package/dist/{chunk-CRJX4OMN.js.map → chunk-NSP5PIQH.js.map} +0 -0
- /package/dist/{chunk-X52SXKVC.js.map → chunk-P7OVFGMU.js.map} +0 -0
- /package/dist/{chunk-2J6BIOVN.js.map → chunk-PJCVI44H.js.map} +0 -0
- /package/dist/{chunk-Q6PYCPHO.js.map → chunk-Q3PNQYAC.js.map} +0 -0
- /package/dist/{chunk-D76AHITY.js.map → chunk-QS765SBL.js.map} +0 -0
- /package/dist/{chunk-KNCR7APE.js.map → chunk-QTDZ2NYC.js.map} +0 -0
- /package/dist/{chunk-HCPVL6SF.js.map → chunk-SJTSWG2Z.js.map} +0 -0
- /package/dist/{chunk-XFND63OB.js.map → chunk-TFWJXWL6.js.map} +0 -0
- /package/dist/{chunk-SVJ5JVZO.js.map → chunk-TXKQBQYW.js.map} +0 -0
- /package/dist/{chunk-WQFHHJWK.js.map → chunk-UALXWWGN.js.map} +0 -0
- /package/dist/{chunk-3PVKV3XL.js.map → chunk-UNOAVHV4.js.map} +0 -0
- /package/dist/{chunk-FYZXZUGU.js.map → chunk-UQBOPCDK.js.map} +0 -0
- /package/dist/{chunk-OD7ZXCUF.js.map → chunk-UXGXJUZ5.js.map} +0 -0
- /package/dist/{chunk-2BY56HE6.js.map → chunk-VCOMACR6.js.map} +0 -0
- /package/dist/{chunk-5FNZ3G6X.js.map → chunk-VKQI47DJ.js.map} +0 -0
- /package/dist/{chunk-MPJDQC4G.js.map → chunk-WJCXUE2J.js.map} +0 -0
- /package/dist/{chunk-C3HRYVGD.js.map → chunk-WV4UYDP6.js.map} +0 -0
- /package/dist/{chunk-E3DL3CAL.js.map → chunk-WXJC2L66.js.map} +0 -0
- /package/dist/{chunk-O7GNSHFF.js.map → chunk-XC3H7KON.js.map} +0 -0
- /package/dist/{chunk-OOOX5C4X.js.map → chunk-XL2EE5W3.js.map} +0 -0
- /package/dist/{chunk-CZVNOTLR.js.map → chunk-XXR4A33N.js.map} +0 -0
- /package/dist/{chunk-2AV2U2SZ.js.map → chunk-YDIOMDBW.js.map} +0 -0
- /package/dist/{chunk-QFTNWDJ6.js.map → chunk-YECEEJUU.js.map} +0 -0
- /package/dist/{chunk-BMG3SAXA.js.map → chunk-Z5277JWF.js.map} +0 -0
- /package/dist/{chunk-SW3WHVKN.js.map → chunk-ZFNXJEUG.js.map} +0 -0
- /package/dist/{chunk-KMTMMBEB.js.map → chunk-ZNRTHYYW.js.map} +0 -0
- /package/dist/{chunk-VCBS5GRQ.js.map → chunk-ZSMA67FV.js.map} +0 -0
- /package/dist/{first-start-migration-QVD22WWS.js.map → first-start-migration-A6PHIBUQ.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/access-operations-batch.ts"],"sourcesContent":["/**\n * Batch migration of remaining access-surface handlers through the boundary\n * (issue #1525 / #1668). Each operation routes MCP/HTTP/CLI dispatch through\n * the shared validation + error-mapping layer in access-boundary.ts.\n *\n * Strict per-tool Zod schemas replace the earlier permissive looseSchema (#1668).\n * Each schema validates known field types; .passthrough() tolerates MCP client\n * context injection (cwd/projectTag/sessionKey) without silent type coercion.\n * The stripNulls preprocessor handles the OpenAI-schema null-for-absent gotcha.\n */\n\nimport { randomUUID } from \"node:crypto\";\nimport { z } from \"zod\";\nimport type { DreamsPhase, RecallDisclosure, RecallPlanMode } from \"./types.js\";\nimport type { RemnicChatGptMemoryInspectorInput } from \"./mcp-memory-inspector-app.js\";\nimport { defineOperation } from \"./access-boundary.js\";\nimport { EngramAccessForbiddenError } from \"./access-errors.js\";\nimport {\n type ObserveRequest,\n observeRequestSchema,\n type RecallRequest,\n recallRequestSchema,\n retainedCategoryAlias,\n suggestionSubmitRequestSchema,\n} from \"./access-schema.js\";\nimport { EngramAccessInputError, type EngramAccessService, type EngramAccessBriefingRequest } from \"./access-service.js\";\nimport { enforceNamespaceAllowList, tokenCapabilityStore } from \"./access-token-capabilities.js\";\nimport { projectTagProjectId } from \"./coding/coding-namespace.js\";\nimport {\n parseNamespacePreflightWriteOp,\n resolveAuthorizedNamespaceWritablePreflight,\n type EngramAccessNamespaceWritableRequest,\n} from \"./access-namespace-preflight.js\";\nimport { expandTildePath } from \"./utils/path.js\";\nimport { resolvePrincipal } from \"./namespaces/principal.js\";\nimport {\n parseSharedWriteOutputControls,\n type SharedWriteOutputControls,\n} from \"./shared-context/write-output-controls.js\";\nimport { getRecallTimingStatus, isRecallTimingsOperator } from \"./recall-timings.js\";\nimport { parseDeepRecallMaxSteps } from \"./deep-recall-config.js\";\nimport { validateBriefingFormat } from \"./briefing.js\";\nimport {\n buildChatGptMemoryInspectorActionRequest,\n buildChatGptMemoryInspectorResult,\n} from \"./mcp-memory-inspector-app.js\";\nimport { listPairs, isDefaultReviewNamespace, readPair } from \"./contradiction/contradiction-review.js\";\nimport { executeResolution, isValidResolutionVerb } from \"./contradiction/resolution.js\";\nimport { runContradictionScan } from \"./contradiction/contradiction-scan.js\";\nimport { runPreferenceDriftScan } from \"./preferences/preference-drift.js\";\nimport { runGraphEdgeDecayMaintenanceAcrossNamespaces } from \"./maintenance/graph-edge-decay.js\";\nimport { normalizeDreamsStatusWindowHours } from \"./maintenance/dreams-ledger.js\";\n\n// ---------------------------------------------------------------------------\n// Shared helpers\n// ---------------------------------------------------------------------------\n\nfunction stripNulls(data: unknown): unknown {\n if (data !== null && typeof data === \"object\" && !Array.isArray(data)) {\n const obj = data as Record<string, unknown>;\n const cleaned: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj)) {\n if (value !== null) cleaned[key] = value;\n }\n return cleaned;\n }\n return data;\n}\n\nfunction strictSchema<T extends z.ZodRawShape>(shape: T): z.ZodType<Record<string, unknown>> {\n return z.preprocess(stripNulls, z.object(shape).passthrough()) as unknown as z.ZodType<Record<string, unknown>>;\n}\n\n/**\n * stripNulls, but keys listed in `preserve` keep their null values. Used by\n * boundary schemas whose wire contract treats an explicit `null` as a\n * meaningful value (e.g. recall `codingContext: null` clears the session\n * context — it must not be collapsed into \"absent\").\n */\nfunction stripNullsExcept(data: unknown, preserve: readonly string[]): unknown {\n if (data !== null && typeof data === \"object\" && !Array.isArray(data)) {\n const cleaned: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(data as Record<string, unknown>)) {\n if (value !== null || preserve.includes(key)) cleaned[key] = value;\n }\n return cleaned;\n }\n return data;\n}\n\n\nfunction optStr(v: unknown): string | undefined { return typeof v === \"string\" ? v : undefined; }\nfunction reqStr(v: unknown, field: string): string {\n if (typeof v !== \"string\" || v.length === 0) throw new EngramAccessInputError(field + \" is required and must be a non-empty string\");\n return v;\n}\nfunction defStr(v: unknown, d: string): string { return typeof v === \"string\" ? v : d; }\nfunction optNum(v: unknown): number | undefined { return typeof v === \"number\" && Number.isFinite(v) ? v : undefined; }\nfunction optBool(v: unknown): boolean | undefined { return typeof v === \"boolean\" ? v : undefined; }\nfunction optStrArr(v: unknown): string[] | undefined { return Array.isArray(v) && v.every((x) => typeof x === \"string\") ? v : undefined; }\n\nconst S = {\n str: z.string().optional(),\n num: z.number().optional(),\n // Accept numbers and numeric strings (MCP clients sometimes send \"7\" for 7).\n flexNum: z.union([z.number(), z.string()]).optional(),\n bool: z.boolean().optional(),\n strArr: z.array(z.string()).optional(),\n};\n\n// === RECALL ===\n// Issue #2482: the boundary validates against the SAME canonical zod schema\n// the HTTP transport uses (recallRequestSchema). No parallel field list, no\n// silent defaults — a missing `query` or a bad enum is a 400 at the boundary.\n// `codingContext: null` survives the null-strip (explicit session-context\n// clear); every other null is the MCP null-for-absent idiom.\ndefineOperation({\n name: \"recall\",\n description: \"Semantic recall.\",\n schema: z.preprocess((data) => stripNullsExcept(data, [\"codingContext\"]), recallRequestSchema) as unknown as z.ZodType<RecallRequest>,\n handler: async (input, ctx) => ({\n result: await ctx.service.recall({\n ...input,\n authenticatedPrincipal: ctx.authenticatedPrincipal,\n ...(ctx.sourceConnector ? { sourceConnector: ctx.sourceConnector } : {}),\n ...(ctx.abortSignal ? { abortSignal: ctx.abortSignal } : {}),\n }),\n }),\n});\ndefineOperation({ name: \"recall_explain\", description: \"Explain recall plan.\", schema: strictSchema({ sessionKey: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.recallExplain({ sessionKey: optStr(input.sessionKey), namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });\ndefineOperation({ name: \"set_coding_context\", description: \"Set coding context.\", schema: z.preprocess((data) => stripNullsExcept(data, [\"codingContext\"]), z.object({ sessionKey: S.str, codingContext: z.union([z.null(), z.object({ projectId: S.str, branch: z.union([z.string(), z.null()]).optional(), rootPath: S.str, defaultBranch: z.union([z.string(), z.null()]).optional() }).passthrough()]).optional(), projectTag: S.str }).passthrough()) as unknown as z.ZodType<Record<string, unknown>>, // codingContext: null = clear context (preserved).\n handler: async (input, ctx) => {\n const sessionKey = defStr(input.sessionKey, \"\");\n const projectTag = optStr(input.projectTag);\n const hasProjectTag = projectTag !== undefined && projectTag.trim().length > 0;\n const hasCodingContext = \"codingContext\" in input;\n if (!hasCodingContext && hasProjectTag) { const tag = projectTag!.trim(); const pid = projectTagProjectId(tag); ctx.service.setCodingContext({ sessionKey, codingContext: { projectId: pid, branch: null, rootPath: pid, defaultBranch: null } }); return { result: { ok: true } }; }\n if (!hasCodingContext && !hasProjectTag) throw new EngramAccessInputError(\"set_coding_context requires either codingContext or projectTag\");\n const rawCtx = (input as Record<string, unknown>).codingContext;\n let codingContext: { projectId: string; branch: string | null; rootPath: string; defaultBranch: string | null } | null = null;\n if (rawCtx !== null) { if (typeof rawCtx !== \"object\") throw new EngramAccessInputError(\"codingContext must be an object or null\"); const o = rawCtx as Record<string, unknown>; const branch = o.branch === null ? null : optStr(o.branch); const dB = o.defaultBranch === null ? null : optStr(o.defaultBranch); if (branch === undefined) throw new EngramAccessInputError(\"codingContext.branch must be a string or null\"); if (dB === undefined) throw new EngramAccessInputError(\"codingContext.defaultBranch must be a string or null\"); codingContext = { projectId: defStr(o.projectId, \"\"), branch, rootPath: defStr(o.rootPath, \"\"), defaultBranch: dB }; }\n ctx.service.setCodingContext({ sessionKey, codingContext });\n return { result: { ok: true } };\n },\n});\ndefineOperation({ name: \"recall_tier_explain\", description: \"Explain recall tiers.\", schema: strictSchema({ sessionKey: S.str, namespace: S.str }), handler: async (input, ctx) => { const sk = optStr(input.sessionKey); const ns = optStr(input.namespace); return { result: await ctx.service.recallTierExplain(sk && sk.length > 0 ? sk : undefined, ns && ns.length > 0 ? ns : undefined, ctx.authenticatedPrincipal) }; } });\ndefineOperation({ name: \"recall_xray\", description: \"X-ray recall.\", schema: strictSchema({ query: S.str, sessionKey: S.str, namespace: S.str, budget: z.unknown().optional(), disclosure: S.str }),\n handler: async (input, ctx) => {\n let budget: number | undefined;\n if (input.budget !== undefined) { const p = typeof input.budget === \"number\" ? input.budget : typeof input.budget === \"string\" ? Number(input.budget) : undefined; if (p === undefined || !Number.isFinite(p) || p <= 0 || !Number.isInteger(p)) throw new EngramAccessInputError(\"recall_xray: budget expects a positive integer\"); budget = p; }\n const dr = optStr(input.disclosure);\n return { result: await ctx.service.recallXray({ query: defStr(input.query, \"\"), sessionKey: optStr(input.sessionKey), namespace: optStr(input.namespace), budget, authenticatedPrincipal: ctx.authenticatedPrincipal, sourceConnector: ctx.sourceConnector, ...(dr && dr !== \"\" ? { disclosure: dr as RecallDisclosure } : {}), ...(ctx.abortSignal ? { abortSignal: ctx.abortSignal } : {}) }) };\n },\n});\ndefineOperation({ name: \"recall_why\", description: \"Diagnose why a query did not recall an expected memory (#3033). Read-only.\", schema: strictSchema({ query: S.str, expect: S.str, sessionKey: S.str, namespace: S.str }),\n handler: async (input, ctx) => {\n // A supplied-but-blank `expect` is a caller mistake: forward it so the\n // service rejects it, matching the HTTP route's 400 (checklist #39).\n const expect = optStr(input.expect);\n return { result: await ctx.service.recallWhy({ query: defStr(input.query, \"\"), ...(expect !== undefined ? { expect } : {}), sessionKey: optStr(input.sessionKey), namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal, sourceConnector: ctx.sourceConnector, ...(ctx.abortSignal ? { abortSignal: ctx.abortSignal } : {}) }) };\n },\n});\ndefineOperation({ name: \"who_knows\", description: \"Rank entities by demonstrated expertise for a topic (#2057).\", schema: strictSchema({ topic: S.str, limit: S.flexNum, namespace: S.str }),\n handler: async (input, ctx) => {\n const topic = defStr(input.topic, \"\");\n let limit: number | undefined;\n if (input.limit !== undefined) { const p = typeof input.limit === \"number\" ? input.limit : Number(input.limit); if (!Number.isInteger(p) || p < 1) throw new EngramAccessInputError(\"who_knows: limit expects a positive integer\"); limit = p; }\n return { result: await ctx.service.whoKnows({ topic, ...(limit !== undefined ? { limit } : {}), namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) };\n },\n});\ndefineOperation({ name: \"promotion_candidates\", description: \"List agent-subject reuse-signaled promotion candidates (#2372).\", schema: strictSchema({ namespace: S.str, targetNamespace: S.str, limit: S.flexNum }),\n handler: async (input, ctx) => {\n let limit: number | undefined;\n if (input.limit !== undefined) { const p = typeof input.limit === \"number\" ? input.limit : Number(input.limit); if (!Number.isInteger(p) || p < 1 || p > 100) throw new EngramAccessInputError(\"promotion_candidates: limit expects an integer in [1, 100]\"); limit = p; }\n return { result: await ctx.service.promotionCandidates({ ...(limit !== undefined ? { limit } : {}), namespace: optStr(input.namespace), targetNamespace: optStr(input.targetNamespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) };\n },\n});\ndefineOperation({ name: \"namespace_writable\", description: \"Read-only preflight: is a namespace writable for the caller's principal?\", allowedByOps: [\"namespace_writable\", \"observe\", \"memory_store\"], schema: strictSchema({ namespace: S.str, sessionKey: S.str, op: S.str, cwd: S.str, projectTag: S.str }), handler: async (input, ctx) => {\n const writeOp = parseNamespacePreflightWriteOp(optStr(input.op));\n const namespace = optStr(input.namespace);\n const request: EngramAccessNamespaceWritableRequest = {\n sessionKey: optStr(input.sessionKey),\n authenticatedPrincipal: ctx.authenticatedPrincipal,\n cwd: optStr(input.cwd),\n projectTag: optStr(input.projectTag),\n ...(namespace ? { namespace } : {}),\n };\n return {\n result: await resolveAuthorizedNamespaceWritablePreflight(\n tokenCapabilityStore.getStore(),\n request,\n ctx.service.configRef.defaultNamespace,\n writeOp,\n (preflightRequest) => ctx.service.namespaceWritablePreflight(preflightRequest),\n ),\n };\n} });\n\n// === WEARABLES ===\ndefineOperation({ name: \"wearables_status\", description: \"Wearables status.\", schema: strictSchema({ namespace: S.str, sessionKey: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.wearablesStatus({ authenticatedPrincipal: ctx.authenticatedPrincipal, namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey) }) }) });\ndefineOperation({ name: \"wearables_sync\", description: \"Sync wearables.\", schema: strictSchema({ source: S.str, date: S.str, days: S.flexNum, forceMemories: S.bool, namespace: S.str, sessionKey: S.str }), handler: async (input, ctx) => { const summaries = await ctx.service.wearablesSync({ source: optStr(input.source), date: optStr(input.date), days: typeof input.days === \"number\" ? input.days : typeof input.days === \"string\" && Number.isFinite(Number(input.days)) ? Number(input.days) : undefined, forceMemories: optBool(input.forceMemories), authenticatedPrincipal: ctx.authenticatedPrincipal, namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey) }); return { result: { summaries } }; } });\ndefineOperation({ name: \"transcript_day\", description: \"Transcript for a day.\", schema: strictSchema({ date: S.str, source: S.str, namespace: S.str, sessionKey: S.str }), handler: async (input, ctx) => { const d = defStr(input.date, \"\"); if (d.trim().length === 0) throw new EngramAccessInputError(\"transcript_day: date is required (YYYY-MM-DD)\"); const transcripts = await ctx.service.wearablesTranscriptDay({ date: d, source: optStr(input.source), authenticatedPrincipal: ctx.authenticatedPrincipal, namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey) }); return { result: { transcripts } }; } });\ndefineOperation({ name: \"transcript_search\", description: \"Search transcripts.\", schema: strictSchema({ query: S.str, source: S.str, from: S.str, to: S.str, limit: S.flexNum, namespace: S.str, sessionKey: S.str }), handler: async (input, ctx) => { const q = defStr(input.query, \"\"); if (q.trim().length === 0) throw new EngramAccessInputError(\"transcript_search: query is required\"); const results = await ctx.service.wearablesTranscriptSearch({ query: q, source: optStr(input.source), from: optStr(input.from), to: optStr(input.to), limit: typeof input.limit === \"number\" ? input.limit : typeof input.limit === \"string\" && Number.isFinite(Number(input.limit)) ? Number(input.limit) : undefined, authenticatedPrincipal: ctx.authenticatedPrincipal, namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey) }); return { result: { results } }; } });\ndefineOperation({ name: \"transcript_memories\", description: \"Transcript memories.\", schema: strictSchema({ source: S.str, date: S.str, limit: S.flexNum, namespace: S.str, sessionKey: S.str }), handler: async (input, ctx) => { const memories = await ctx.service.wearablesTranscriptMemories({ source: optStr(input.source), date: optStr(input.date), limit: typeof input.limit === \"number\" ? input.limit : typeof input.limit === \"string\" && Number.isFinite(Number(input.limit)) ? Number(input.limit) : undefined, authenticatedPrincipal: ctx.authenticatedPrincipal, namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey) }); return { result: { memories } }; } });\n\n// === MEETINGS (issue #1900) ===\ndefineOperation({ name: \"meetings_list\", description: \"List stored meeting records (all days, or one day).\", schema: strictSchema({ date: S.str, namespace: S.str, sessionKey: S.str }), handler: async (input, ctx) => { const d = optStr(input.date); return { result: await ctx.service.meetingsList(d && d.length > 0 ? d : undefined, { authenticatedPrincipal: ctx.authenticatedPrincipal, namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey) }) }; } });\ndefineOperation({ name: \"meetings_get\", description: \"Get a stored meeting record by id.\", schema: strictSchema({ id: S.str, namespace: S.str, sessionKey: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.meetingsGet(reqStr(input.id, \"id\"), { authenticatedPrincipal: ctx.authenticatedPrincipal, namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey) }) }) });\ndefineOperation({ name: \"meetings_build\", description: \"Detect + fuse + store a day's meetings.\", schema: strictSchema({ date: S.str, namespace: S.str, sessionKey: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.meetingsBuild(reqStr(input.date, \"date\"), { authenticatedPrincipal: ctx.authenticatedPrincipal, namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey) }) }) });\n// === DEEP RECALL (issue #2332) — budgeted REFINE/EXPAND/STOP retrieval ===\ndefineOperation({ name: \"deep_recall\", description: \"Budgeted multi-hop deep recall over the anchor graph.\", schema: strictSchema({ query: S.str, maxSteps: S.flexNum, namespace: S.str, sessionKey: S.str }), handler: async (input, ctx) => {\n const q = defStr(input.query, \"\");\n if (q.trim().length === 0) throw new EngramAccessInputError(\"deep_recall: query is required\");\n // Strict boundary parse (issue #2915): `\"abc\"` must NOT silently become the\n // configured default and `\"\"` must NOT become 0 — both are rejected.\n let maxSteps: number | undefined;\n try {\n maxSteps = parseDeepRecallMaxSteps(input.maxSteps);\n } catch (err) {\n throw new EngramAccessInputError(`deep_recall: ${err instanceof Error ? err.message : String(err)}`);\n }\n return { result: await ctx.service.deepRecall({ query: q, maxSteps, authenticatedPrincipal: ctx.authenticatedPrincipal, namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey), ...(ctx.abortSignal ? { abortSignal: ctx.abortSignal } : {}) }) };\n} });\n\n// === ACTION CONFIDENCE + INSPECTOR + CAPSULE ===\ndefineOperation({ name: \"action_confidence\", description: \"Action confidence.\", schema: strictSchema({ intendedAction: S.str, confidence: S.num, risk: S.str, contextReadiness: S.str, currentContextScopes: S.strArr, userRules: z.array(z.unknown()).optional(), retrievedMemories: z.array(z.unknown()).optional() }), handler: async (input, ctx) => { const req: Record<string, unknown> = {}; if (input.intendedAction !== undefined) req.intendedAction = optStr(input.intendedAction); if (input.confidence !== undefined) req.confidence = optNum(input.confidence); if (input.risk !== undefined) req.risk = optStr(input.risk) as \"low\" | \"medium\" | \"high\" | \"irreversible\" | \"restricted\" | undefined; if (input.contextReadiness !== undefined) req.contextReadiness = optStr(input.contextReadiness) as \"none\" | \"partial\" | \"sufficient\" | undefined; if (input.currentContextScopes !== undefined) req.currentContextScopes = optStrArr(input.currentContextScopes); if (input.userRules !== undefined) req.userRules = input.userRules; if (input.retrievedMemories !== undefined) req.retrievedMemories = input.retrievedMemories; return { result: await ctx.service.actionConfidence(req) }; } });\ndefineOperation({ name: \"chatgpt_memory_inspector\", description: \"Memory inspector.\", schema: strictSchema({ query: S.str, sessionKey: S.str, namespace: S.str, currentContextScopes: S.strArr, allowUnverifiedPreview: S.bool }),\n handler: async (input, ctx) => {\n const q = defStr(input.query, \"\");\n if (q.trim().length === 0) throw new EngramAccessInputError(\"chatgpt_memory_inspector requires a non-empty query string\");\n const ii: RemnicChatGptMemoryInspectorInput = { query: q.trim() };\n if (typeof input.sessionKey === \"string\" && input.sessionKey.trim().length > 0) ii.sessionKey = input.sessionKey;\n if (typeof input.namespace === \"string\" && input.namespace.trim().length > 0) ii.namespace = input.namespace;\n if (input.currentContextScopes !== undefined) ii.currentContextScopes = input.currentContextScopes as string[];\n if (input.allowUnverifiedPreview !== undefined) ii.allowUnverifiedPreview = input.allowUnverifiedPreview as boolean;\n const rsk = ii.sessionKey ?? (ctx.authenticatedPrincipal ? \"remnic:chatgpt-memory-inspector:\" + randomUUID() : undefined);\n const xr = await ctx.service.recallXray({ query: ii.query, sessionKey: rsk, namespace: ii.namespace, currentContextScopes: ii.currentContextScopes, authenticatedPrincipal: ctx.authenticatedPrincipal, ...(ctx.sourceConnector ? { sourceConnector: ctx.sourceConnector } : {}), mode: \"full\", disclosure: \"chunk\", includeRecall: true, ...(ctx.abortSignal ? { abortSignal: ctx.abortSignal } : {}) });\n const x = xr.snapshotFound === true ? (xr.snapshot ?? null) : null;\n const r = xr.recall ?? { query: ii.query, namespace: ii.namespace ?? x?.namespace ?? \"global\", context: \"\", count: 0, memoryIds: [], results: [], fallbackUsed: false, sourcesUsed: [], disclosure: \"chunk\" as const };\n const ac = await ctx.service.actionConfidence(buildChatGptMemoryInspectorActionRequest(ii, r, x));\n return { result: buildChatGptMemoryInspectorResult(ii, r, x, ac) };\n },\n});\ndefineOperation({ name: \"day_summary\", description: \"Day summary.\", schema: strictSchema({ memories: S.str, includeLocation: S.bool, sessionKey: S.str, namespace: S.str, timeZone: S.str, cwd: S.str, projectTag: S.str }), handler: async (input, ctx) => { const req: Record<string, unknown> = {}; if (input.memories !== undefined) req.memories = optStr(input.memories); if (input.includeLocation !== undefined) req.includeLocation = optBool(input.includeLocation); if (input.sessionKey !== undefined) req.sessionKey = optStr(input.sessionKey); if (input.namespace !== undefined) req.namespace = optStr(input.namespace); if (input.timeZone !== undefined) req.timeZone = optStr(input.timeZone); const summary = await ctx.service.daySummary(req); return { result: summary ?? {} }; } });\ndefineOperation({ name: \"capsule_export\", description: \"Export capsule.\", schema: strictSchema({ name: S.str, namespace: S.str, since: S.str, includeKinds: S.strArr, peerIds: S.strArr, includeTranscripts: S.bool, encrypt: S.bool, cwd: S.str, projectTag: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.capsuleExport({ name: optStr(input.name) ?? \"\", namespace: optStr(input.namespace), since: optStr(input.since), includeKinds: optStrArr(input.includeKinds), peerIds: optStrArr(input.peerIds), includeTranscripts: optBool(input.includeTranscripts as unknown), encrypt: optBool(input.encrypt as unknown), principal: ctx.authenticatedPrincipal } as unknown as Parameters<EngramAccessService[\"capsuleExport\"]>[0]) }) });\ndefineOperation({ name: \"capsule_import\", description: \"Import capsule.\", schema: strictSchema({ archivePath: S.str, namespace: S.str, mode: S.str, passphrase: S.str, cwd: S.str, projectTag: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.capsuleImport({ archivePath: expandTildePath(optStr(input.archivePath) ?? \"\"), namespace: optStr(input.namespace), mode: optStr(input.mode) as \"skip\" | \"overwrite\" | \"fork\" | undefined, passphrase: optStr(input.passphrase), principal: ctx.authenticatedPrincipal }) }) });\ndefineOperation({ name: \"capsule_list\", description: \"List capsules.\", schema: strictSchema({ namespace: S.str, sessionKey: S.str, cwd: S.str, projectTag: S.str }), handler: async (input, ctx) => {\n const rp = ctx.authenticatedPrincipal ?? (typeof input.sessionKey === \"string\" && input.sessionKey.length > 0 && ctx.service.configRef ? resolvePrincipal(input.sessionKey, ctx.service.configRef) : undefined);\n return { result: await ctx.service.capsuleList({ namespace: optStr(input.namespace), principal: rp }) };\n} });\n\n// === GOVERNANCE ===\ndefineOperation({ name: \"memory_governance_run\", description: \"Run governance.\", schema: strictSchema({ namespace: S.str, mode: S.str, recentDays: S.num, maxMemories: S.num, batchSize: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.governanceRun({ namespace: optStr(input.namespace), mode: optStr(input.mode) === \"apply\" ? \"apply\" : \"shadow\", recentDays: optNum(input.recentDays), maxMemories: optNum(input.maxMemories), batchSize: optNum(input.batchSize), authenticatedPrincipal: ctx.authenticatedPrincipal }, ctx.authenticatedPrincipal) }) });\ndefineOperation({ name: \"entity_synthesis_run\", description: \"Bulk-drain the entity synthesis queue (issue #2136).\", schema: strictSchema({ namespace: S.str, maxEntities: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.entitySynthesisRun({ namespace: optStr(input.namespace), maxEntities: input.maxEntities === undefined ? undefined : (input.maxEntities as number), authenticatedPrincipal: ctx.authenticatedPrincipal }, ctx.authenticatedPrincipal) }) });\ndefineOperation({ name: \"procedure_mining_run\", description: \"Run procedure mining.\", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.procedureMiningRun({ namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }, ctx.authenticatedPrincipal) }) });\ndefineOperation({ name: \"pattern_reinforcement_run\", description: \"Run pattern reinforcement.\", schema: strictSchema({ namespace: S.str, force: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.patternReinforcementRun({ namespace: optStr(input.namespace), force: input.force === true, authenticatedPrincipal: ctx.authenticatedPrincipal }, ctx.authenticatedPrincipal) }) });\ndefineOperation({ name: \"procedural_stats\", description: \"Procedural stats.\", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.procedureStats({ namespace: optStr(input.namespace) }, ctx.authenticatedPrincipal) }) });\ndefineOperation({ name: \"procedure_library_maintenance\", description: \"Run procedure library maintenance (issue #2370): shadow-first merge / repair-flag / retire from outcome telemetry. apply=true plus procedural.maintenance.enabled required for writes.\", schema: strictSchema({ namespace: S.str, apply: S.bool, dryRun: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.procedureLibraryMaintenance({ namespace: optStr(input.namespace), apply: input.apply === true, dryRun: input.dryRun === true, authenticatedPrincipal: ctx.authenticatedPrincipal }, ctx.authenticatedPrincipal) }) });\n\n// === MEMORY/ENTITY/OBSERVE/LCM ===\ndefineOperation({ name: \"memory_timeline\", description: \"Memory timeline.\", schema: strictSchema({ memoryId: S.str, namespace: S.str, limit: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.memoryTimeline(optStr(input.memoryId) ?? \"\", optStr(input.namespace), optNum(input.limit) ?? 200, ctx.authenticatedPrincipal) }) });\n// Issue #2482/#2829: suggestion_submit validates through the canonical\n// suggestionSubmitRequestSchema — the SAME schema the HTTP transport and the\n// MCP wire parse use, category alias transform included. The raw spelling\n// survives on `ctx.rawInput` for the coercion note.\ndefineOperation({\n name: \"suggestion_submit\",\n description: \"Submit suggestion.\",\n schema: z.preprocess((data) => stripNullsExcept(data, [\"codingContext\"]), suggestionSubmitRequestSchema),\n handler: async (input, ctx) => {\n const rawCategory = retainedCategoryAlias(ctx.rawInput);\n return {\n result: await ctx.service.suggestionSubmit({\n ...input,\n authenticatedPrincipal: ctx.authenticatedPrincipal,\n ...(ctx.sourceConnector ? { sourceConnector: ctx.sourceConnector } : {}),\n ...(rawCategory ? { rawCategory } : {}),\n }),\n };\n },\n});\ndefineOperation({ name: \"entity_get\", description: \"Get entity.\", schema: strictSchema({ name: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.entityGet(optStr(input.name) ?? \"\", optStr(input.namespace), ctx.authenticatedPrincipal) }) });\ndefineOperation({ name: \"review_queue_list\", description: \"List review queue.\", schema: strictSchema({ runId: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.reviewQueue(optStr(input.runId) ?? \"\", optStr(input.namespace), ctx.authenticatedPrincipal) }) });\n// Issue #2482: observe validates through the canonical observeRequestSchema\n// (same as HTTP/MCP wire validation). Nullable wire fields (parts /\n// sourceFormat) map to undefined for the service's cleaned message form.\ndefineOperation({\n name: \"observe\",\n description: \"Observe messages.\",\n schema: z.preprocess(stripNulls, observeRequestSchema) as unknown as z.ZodType<ObserveRequest>,\n handler: async (input, ctx) => ({\n result: await ctx.service.observe(\n {\n sessionKey: input.sessionKey,\n messages: input.messages.map((message) => ({\n role: message.role,\n content: message.content,\n ...(message.parts ? { parts: message.parts } : {}),\n ...(message.rawContent !== undefined ? { rawContent: message.rawContent } : {}),\n ...(message.sourceFormat ? { sourceFormat: message.sourceFormat } : {}),\n })),\n skipExtraction: input.skipExtraction === true,\n idempotencyKey: input.idempotencyKey,\n namespace: input.namespace,\n authenticatedPrincipal: ctx.authenticatedPrincipal,\n cwd: input.cwd,\n projectTag: input.projectTag,\n ...(ctx.sourceConnector ? { sourceConnector: ctx.sourceConnector } : {}),\n },\n ctx.hooks?.enforceWriteQuota ? { enforceWriteQuota: ctx.hooks.enforceWriteQuota } : undefined,\n ),\n }),\n});\ndefineOperation({ name: \"lcm_search\", description: \"Search LCM.\", schema: strictSchema({ query: S.str, sessionKey: S.str, sessionPrefix: S.str, namespace: S.str, limit: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.lcmSearch({ query: defStr(input.query, \"\"), sessionKey: optStr(input.sessionKey), sessionPrefix: optStr(input.sessionPrefix), namespace: optStr(input.namespace), limit: optNum(input.limit), authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });\ndefineOperation({ name: \"lcm_compaction_flush\", description: \"Flush LCM compaction.\", schema: strictSchema({ sessionKey: S.str, namespace: S.str, cwd: S.str, projectTag: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.lcmCompactionFlush({ sessionKey: optStr(input.sessionKey) ?? \"\", namespace: optStr(input.namespace), cwd: optStr(input.cwd), projectTag: optStr(input.projectTag), authenticatedPrincipal: ctx.authenticatedPrincipal, ...(ctx.abortSignal ? { abortSignal: ctx.abortSignal } : {}) }) }) });\ndefineOperation({ name: \"extraction_force_flush\", description: \"Force-drain a session extraction buffer.\", schema: strictSchema({ sessionKey: S.str, namespace: S.str, cwd: S.str, projectTag: S.str, deadlineMs: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.extractionForceFlush({ sessionKey: optStr(input.sessionKey) ?? \"\", namespace: optStr(input.namespace), cwd: optStr(input.cwd), projectTag: optStr(input.projectTag), deadlineMs: optNum(input.deadlineMs), authenticatedPrincipal: ctx.authenticatedPrincipal, onCommitted: ctx.hooks?.recordWriteCommit, ...(ctx.abortSignal ? { abortSignal: ctx.abortSignal } : {}) }) }) });\ndefineOperation({ name: \"lcm_compaction_record\", description: \"Record LCM compaction.\", schema: strictSchema({ sessionKey: S.str, namespace: S.str, tokensBefore: S.num, tokensAfter: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.lcmCompactionRecord({ sessionKey: optStr(input.sessionKey) ?? \"\", namespace: optStr(input.namespace), tokensBefore: optNum(input.tokensBefore) ?? 0, tokensAfter: optNum(input.tokensAfter) ?? 0, authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });\n\n// === CONTINUITY/IDENTITY ===\ndefineOperation({ name: \"continuity_audit_generate\", description: \"Continuity audit.\", fleetWide: true, schema: strictSchema({ period: S.str, key: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.continuityAuditGenerate({ period: optStr(input.period) === \"monthly\" ? \"monthly\" : optStr(input.period) === \"weekly\" ? \"weekly\" : undefined, key: optStr(input.key) }) }) });\ndefineOperation({ name: \"continuity_incident_open\", description: \"Open incident.\", schema: strictSchema({ symptom: S.str, namespace: S.str, triggerWindow: S.str, suspectedCause: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.continuityIncidentOpen({ symptom: optStr(input.symptom) ?? \"\", namespace: optStr(input.namespace), triggerWindow: optStr(input.triggerWindow), suspectedCause: optStr(input.suspectedCause), principal: ctx.authenticatedPrincipal }) }) });\ndefineOperation({ name: \"continuity_incident_close\", description: \"Close incident.\", schema: strictSchema({ id: S.str, namespace: S.str, fixApplied: S.str, verificationResult: S.str, preventiveRule: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.continuityIncidentClose({ id: optStr(input.id) ?? \"\", namespace: optStr(input.namespace), fixApplied: optStr(input.fixApplied) ?? \"\", verificationResult: optStr(input.verificationResult) ?? \"\", preventiveRule: optStr(input.preventiveRule), principal: ctx.authenticatedPrincipal }) }) });\ndefineOperation({ name: \"continuity_incident_list\", description: \"List incidents.\", schema: strictSchema({ state: S.str, namespace: S.str, limit: S.num }), handler: async (input, ctx) => { const st = optStr(input.state); return { result: await ctx.service.continuityIncidentList({ state: st === \"closed\" ? \"closed\" : st === \"all\" ? \"all\" : st === \"open\" ? \"open\" : undefined, namespace: optStr(input.namespace), limit: optNum(input.limit), principal: ctx.authenticatedPrincipal }) }; } });\ndefineOperation({ name: \"continuity_loop_add_or_update\", description: \"Add/update loop.\", schema: strictSchema({ id: S.str, cadence: S.str, purpose: S.str, status: S.str, killCondition: S.str, namespace: S.str, lastReviewed: S.str, notes: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.continuityLoopAddOrUpdate({ id: optStr(input.id) ?? \"\", cadence: (optStr(input.cadence) as \"daily\" | \"weekly\" | \"monthly\" | \"quarterly\") ?? \"weekly\", purpose: optStr(input.purpose) ?? \"\", status: (optStr(input.status) as \"active\" | \"paused\" | \"retired\") ?? \"active\", killCondition: optStr(input.killCondition) ?? \"\", namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal, lastReviewed: optStr(input.lastReviewed), notes: optStr(input.notes) }) }) });\ndefineOperation({ name: \"continuity_loop_review\", description: \"Review loop.\", schema: strictSchema({ id: S.str, namespace: S.str, status: S.str, notes: S.str, reviewedAt: S.str }), handler: async (input, ctx) => { const st = optStr(input.status); return { result: await ctx.service.continuityLoopReview({ id: optStr(input.id) ?? \"\", namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal, status: st === \"active\" || st === \"paused\" || st === \"retired\" ? st as \"active\" | \"paused\" | \"retired\" : undefined, notes: optStr(input.notes), reviewedAt: optStr(input.reviewedAt) }) }; } });\ndefineOperation({ name: \"identity_anchor_get\", description: \"Get identity anchor.\", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.identityAnchorGet({ namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) }) });\ndefineOperation({ name: \"identity_anchor_update\", description: \"Update identity anchor.\", schema: strictSchema({ namespace: S.str, identityTraits: S.str, communicationPreferences: S.str, operatingPrinciples: S.str, continuityNotes: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.identityAnchorUpdate({ namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal, identityTraits: optStr(input.identityTraits), communicationPreferences: optStr(input.communicationPreferences), operatingPrinciples: optStr(input.operatingPrinciples), continuityNotes: optStr(input.continuityNotes) }) }) });\ndefineOperation({ name: \"memory_identity\", description: \"Memory identity.\", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.memoryIdentity({ namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) }) });\n\n// === WORK/SHARED ===\ndefineOperation({ name: \"work_task\", description: \"Manage work task.\", schema: strictSchema({ action: S.str, id: S.str, title: S.str, description: S.str, status: S.str, priority: S.str, owner: S.str, assignee: S.str, projectId: S.str, tags: S.strArr, dueAt: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.workTask({ action: (optStr(input.action) as \"update\" | \"list\" | \"get\" | \"create\" | \"delete\" | \"transition\") ?? \"list\", id: optStr(input.id), title: optStr(input.title), description: optStr(input.description), status: optStr(input.status), priority: optStr(input.priority), owner: optStr(input.owner), assignee: optStr(input.assignee), projectId: optStr(input.projectId), tags: optStrArr(input.tags), dueAt: optStr(input.dueAt) }) }) });\ndefineOperation({ name: \"work_project\", description: \"Manage work project.\", schema: strictSchema({ action: S.str, id: S.str, name: S.str, description: S.str, status: S.str, owner: S.str, tags: S.strArr, taskId: S.str, projectId: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.workProject({ action: (optStr(input.action) as \"update\" | \"list\" | \"get\" | \"create\" | \"delete\" | \"link_task\") ?? \"list\", id: optStr(input.id), name: optStr(input.name), description: optStr(input.description), status: optStr(input.status), owner: optStr(input.owner), tags: optStrArr(input.tags), taskId: optStr(input.taskId), projectId: optStr(input.projectId) }) }) });\ndefineOperation({ name: \"work_board\", description: \"Manage work board.\", schema: strictSchema({ action: S.str, projectId: S.str, snapshotJson: S.str, linkToMemory: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.workBoard({ action: (optStr(input.action) as \"export_markdown\" | \"export_snapshot\" | \"import_snapshot\") ?? \"export_markdown\", projectId: optStr(input.projectId) ?? \"\", snapshotJson: optStr(input.snapshotJson) ?? \"\", linkToMemory: input.linkToMemory === true }) }) });\n// Issue #2920: the envelope controls (authority/expiresAt/supersedes) are\n// parsed by the ONE canonical surface module shared with the OpenClaw tool\n// (write-output-controls.ts); semantics stay in composeWriteEnvelope. A\n// client-supplied principal/namespace is rejected here — identity and\n// scoping are server-resolved (ctx.authenticatedPrincipal).\ndefineOperation({\n name: \"shared_context_write_output\",\n description: \"Write shared output.\",\n schema: strictSchema({ agentId: S.str, title: S.str, content: S.str, authority: S.str, expiresAt: S.str, supersedes: S.str }),\n handler: async (input, ctx) => {\n let controls: SharedWriteOutputControls;\n try {\n controls = parseSharedWriteOutputControls(input);\n } catch (error) {\n throw new EngramAccessInputError(error instanceof Error ? error.message : String(error));\n }\n return {\n result: await ctx.service.sharedContextWriteOutput({\n agentId: optStr(input.agentId) ?? \"\",\n title: optStr(input.title) ?? \"\",\n content: optStr(input.content) ?? \"\",\n ...controls,\n principal: ctx.authenticatedPrincipal,\n }),\n };\n },\n});\ndefineOperation({ name: \"shared_feedback_record\", description: \"Record shared feedback.\", schema: strictSchema({ agent: S.str, decision: S.str, reason: S.str, date: S.str, learning: S.str, outcome: S.str, severity: S.str, confidence: S.num, workflow: S.str, tags: S.strArr, evidenceWindowStart: S.str, evidenceWindowEnd: S.str, refs: S.strArr }), handler: async (input, ctx) => { const sv = optStr(input.severity); return { result: await ctx.service.sharedFeedbackRecord({ agent: optStr(input.agent) ?? \"\", decision: (optStr(input.decision) as \"rejected\" | \"approved\" | \"approved_with_feedback\") ?? \"approved\", reason: optStr(input.reason) ?? \"\", date: optStr(input.date), learning: optStr(input.learning), outcome: optStr(input.outcome), severity: sv === \"low\" || sv === \"medium\" || sv === \"high\" ? sv as \"low\" | \"medium\" | \"high\" : undefined, confidence: optNum(input.confidence), workflow: optStr(input.workflow), tags: optStrArr(input.tags), evidenceWindowStart: optStr(input.evidenceWindowStart), evidenceWindowEnd: optStr(input.evidenceWindowEnd), refs: optStrArr(input.refs) }) }; } });\ndefineOperation({ name: \"shared_priorities_append\", description: \"Append priorities.\", schema: strictSchema({ agentId: S.str, text: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.sharedPrioritiesAppend({ agentId: optStr(input.agentId) ?? \"\", text: optStr(input.text) ?? \"\" }) }) });\ndefineOperation({ name: \"shared_context_cross_signals_run\", description: \"Run cross signals.\", fleetWide: true, schema: strictSchema({ date: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.sharedContextCrossSignalsRun({ date: optStr(input.date) }) }) });\ndefineOperation({ name: \"shared_context_curate_daily\", description: \"Curate daily.\", fleetWide: true, schema: strictSchema({ date: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.sharedContextCurateDaily({ date: optStr(input.date) }) }) });\ndefineOperation({ name: \"compounding_weekly_synthesize\", description: \"Weekly synthesize.\", fleetWide: true, schema: strictSchema({ weekId: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.compoundingWeeklySynthesize({ weekId: optStr(input.weekId) }) }) });\ndefineOperation({ name: \"compounding_promote_candidate\", description: \"Promote candidate.\", fleetWide: true, schema: strictSchema({ weekId: S.str, candidateId: S.str, dryRun: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.compoundingPromoteCandidate({ weekId: optStr(input.weekId) ?? \"\", candidateId: optStr(input.candidateId) ?? \"\", dryRun: input.dryRun === true }) }) });\ndefineOperation({ name: \"compression_guidelines_optimize\", description: \"Optimize guidelines.\", fleetWide: true, schema: strictSchema({ dryRun: S.bool, eventLimit: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.compressionGuidelinesOptimize({ dryRun: input.dryRun === true, eventLimit: optNum(input.eventLimit) }) }) });\ndefineOperation({ name: \"compression_guidelines_activate\", description: \"Activate guidelines.\", fleetWide: true, schema: strictSchema({ expectedContentHash: S.str, expectedGuidelineVersion: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.compressionGuidelinesActivate({ expectedContentHash: optStr(input.expectedContentHash), expectedGuidelineVersion: optNum(input.expectedGuidelineVersion) }) }) });\n\n// === MEMORY DEBUG/GRAPH/FEEDBACK ===\ndefineOperation({ name: \"memory_profile\", description: \"Memory profile.\", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.memoryProfile(optStr(input.namespace), ctx.authenticatedPrincipal) }) });\ndefineOperation({ name: \"memory_entities_list\", description: \"List entities.\", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.memoryEntitiesList(optStr(input.namespace), ctx.authenticatedPrincipal) }) });\ndefineOperation({ name: \"memory_questions\", description: \"Memory questions.\", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.memoryQuestions(optStr(input.namespace), ctx.authenticatedPrincipal) }) });\ndefineOperation({ name: \"memory_last_recall\", description: \"Last recall.\", schema: strictSchema({ sessionKey: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.lastRecallSnapshot(optStr(input.sessionKey)) }) });\ndefineOperation({ name: \"memory_intent_debug\", description: \"Debug intent.\", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.intentDebug(optStr(input.namespace)) }) });\ndefineOperation({ name: \"memory_qmd_debug\", description: \"Debug QMD.\", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.qmdDebug(optStr(input.namespace)) }) });\ndefineOperation({ name: \"memory_graph_explain\", description: \"Explain graph.\", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.graphExplainLastRecall(optStr(input.namespace)) }) });\ndefineOperation({ name: \"graph_snapshot\", description: \"Graph snapshot.\", schema: strictSchema({ namespace: S.str, limit: S.num, since: S.str, focusNodeId: S.str, categories: S.strArr }), handler: async (input, ctx) => ({ result: await ctx.service.graphSnapshot({ namespace: optStr(input.namespace), limit: optNum(input.limit), since: optStr(input.since), focusNodeId: optStr(input.focusNodeId), categories: optStrArr(input.categories) }, ctx.authenticatedPrincipal) }) });\ndefineOperation({ name: \"memory_feedback\", description: \"Record feedback.\", schema: strictSchema({ memoryId: S.str, vote: S.str, note: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.memoryFeedback({ memoryId: optStr(input.memoryId) ?? \"\", vote: optStr(input.vote) === \"down\" ? \"down\" : \"up\", note: optStr(input.note) }) }) });\ndefineOperation({ name: \"memory_promote\", description: \"Promote memory.\", schema: strictSchema({ memoryId: S.str, namespace: S.str, sessionKey: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.memoryPromote({ memoryId: optStr(input.memoryId) ?? \"\", namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey), principal: ctx.authenticatedPrincipal }) }) });\ndefineOperation({ name: \"memory_outcome\", description: \"Record outcome.\", schema: strictSchema({ memoryId: S.str, outcome: S.str, namespace: S.str, sessionKey: S.str, timestamp: S.str }), handler: async (input, ctx) => { const o = optStr(input.outcome); if (o !== \"success\" && o !== \"failure\") throw new EngramAccessInputError(\"memory_outcome: outcome must be \\\"success\\\" or \\\"failure\\\"; got \" + JSON.stringify(o)); return { result: await ctx.service.memoryOutcome({ memoryId: optStr(input.memoryId) ?? \"\", outcome: o, namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey), timestamp: optStr(input.timestamp), principal: ctx.authenticatedPrincipal }) }; } });\ndefineOperation({ name: \"memory_action_apply\", description: \"Apply action.\", schema: strictSchema({ action: S.str, outcome: S.str, reason: S.str, memoryId: S.str, namespace: S.str, sessionKey: S.str, content: S.str, category: S.str, linkTargetId: S.str, linkType: S.str, linkStrength: S.num, artifactType: S.str, execute: S.bool, sourcePrompt: S.str, dryRun: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.memoryActionApply({ action: optStr(input.action) ?? \"\", outcome: optStr(input.outcome), reason: optStr(input.reason), memoryId: optStr(input.memoryId) ?? \"\", namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey), content: optStr(input.content), category: optStr(input.category), linkTargetId: optStr(input.linkTargetId), linkType: optStr(input.linkType), linkStrength: optNum(input.linkStrength), artifactType: optStr(input.artifactType), execute: optBool(input.execute), sourcePrompt: optStr(input.sourcePrompt), dryRun: input.dryRun === true, principal: ctx.authenticatedPrincipal }) }) });\ndefineOperation({ name: \"context_checkpoint\", description: \"Context checkpoint.\", schema: strictSchema({ sessionKey: S.str, context: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.contextCheckpoint({ sessionKey: optStr(input.sessionKey) ?? \"\", context: optStr(input.context) ?? \"\", namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) }) });\ndefineOperation({\n name: \"briefing\", description: \"Daily briefing.\",\n schema: strictSchema({ since: S.str, focus: S.str, namespace: S.str, includeLocation: S.bool, format: S.str, maxFollowups: S.num }),\n handler: async (input, ctx) => {\n const rf = optStr(input.format);\n const fe = validateBriefingFormat(rf);\n if (fe) throw new EngramAccessInputError(fe);\n // SAFETY: validateBriefingFormat rejects every format except json, markdown, or undefined.\n const request: EngramAccessBriefingRequest = {\n since: optStr(input.since), focus: optStr(input.focus), namespace: optStr(input.namespace),\n includeLocation: optBool(input.includeLocation), format: rf as \"json\" | \"markdown\" | undefined,\n maxFollowups: optNum(input.maxFollowups), principal: ctx.authenticatedPrincipal,\n };\n if (ctx.abortSignal) request.abortSignal = ctx.abortSignal;\n return { result: await ctx.service.briefing(request) };\n },\n});\n\n// === CONTRADICTION/REVIEW ===\ndefineOperation({ name: \"review_list\", description: \"List review pairs.\", schema: strictSchema({ filter: S.str, namespace: S.str, limit: S.num }),\n handler: async (input, ctx) => {\n const VF = new Set([\"all\", \"unresolved\", \"contradicts\", \"independent\", \"duplicates\", \"needs-user\"]);\n const rf = optStr(input.filter) ?? \"unresolved\";\n if (!VF.has(rf)) throw new EngramAccessInputError(\"Invalid filter '\" + rf + \"'. Valid: \" + [...VF].join(\", \"));\n const ns = optStr(input.namespace);\n const resolved = await ctx.service.getReadableStorageForNamespace(ns, ctx.authenticatedPrincipal);\n const rn = ctx.service.configRef.namespacesEnabled ? resolved.namespace : undefined;\n const iun = Boolean(rn && isDefaultReviewNamespace(ctx.service.configRef.defaultNamespace, ns, rn));\n return { result: await listPairs(ctx.service.memoryDir, { filter: rf as \"all\" | \"unresolved\" | \"contradicts\" | \"independent\" | \"duplicates\" | \"needs-user\", namespace: rn, includeUnscopedForNamespace: iun, limit: optNum(input.limit) ?? 50 }) };\n },\n});\ndefineOperation({ name: \"review_resolve\", description: \"Resolve pair.\", schema: strictSchema({ pairId: S.str, verb: S.str, mergedMemoryId: S.str, mergedContent: S.str }),\n handler: async (input, ctx) => {\n const pid = defStr(input.pairId, \"\"); const vb = defStr(input.verb, \"\");\n if (!pid) throw new EngramAccessInputError(\"pairId is required\");\n if (!vb) throw new EngramAccessInputError(\"verb is required\");\n if (!isValidResolutionVerb(vb)) throw new EngramAccessInputError(\"Invalid verb: \" + vb);\n // Per-token namespace enforcement (issue #1850 round 9): review_resolve\n // selects its target BY pairId, so the affected namespace comes from the\n // record — NOT a request param that the MCP-over-HTTP tools/call gate\n // (toolAcceptsNamespace) already enforces (this tool's schema carries no\n // `namespace` property). A namespace-scoped bearer must not mutate a\n // contradiction pair in a namespace outside its allow-list. Load the pair\n // to learn its namespace, enforce the token's scope via the SAME\n // effective-namespace chokepoint the HTTP review/resolve route uses\n // (enforceNamespaceAllowList maps undefined → default, so a scoped token\n // whose allow-list INCLUDES the default can resolve a legacy pair), and\n // fail closed BEFORE dispatching the (mutating) resolution. A missing pair\n // falls through to executeResolution's existing not-found result. No-op for\n // unrestricted/legacy tokens. Mirrors access-http.ts review/resolve exactly.\n const targetPair = readPair(ctx.service.memoryDir, pid);\n if (targetPair) {\n enforceNamespaceAllowList(\n tokenCapabilityStore.getStore(),\n targetPair.namespace,\n ctx.service.configRef?.defaultNamespace,\n );\n }\n return { result: await executeResolution(ctx.service.memoryDir, ctx.service.storageRef, pid, vb, { mergedMemoryId: optStr(input.mergedMemoryId), mergedContent: optStr(input.mergedContent), storageForNamespace: async (namespace) => { const r = await ctx.service.getWritableStorageForNamespace(namespace, ctx.authenticatedPrincipal); return r.storage; }, onMergedMemoryWritten: () => {} }) };\n },\n});\ndefineOperation({ name: \"contradiction_scan_run\", description: \"Run scan.\", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await runContradictionScan({ storage: ctx.service.storageRef, config: ctx.service.configRef, memoryDir: ctx.service.memoryDir, embeddingLookupFactory: ctx.service.embeddingLookupFactoryRef, storageForNamespace: (ns) => ctx.service.getWritableStorageForNamespace(ns ?? undefined, ctx.authenticatedPrincipal), localLlm: ctx.service.localLlmRef, fallbackLlm: ctx.service.fallbackLlmRef, namespace: optStr(input.namespace) }) }) });\ndefineOperation({ name: \"preference_drift_scan\", description: \"Run preference drift scan.\", schema: strictSchema({ namespace: S.str, apply: S.bool }), handler: async (input, ctx) => ({ result: await runPreferenceDriftScan({ storage: ctx.service.storageRef, config: ctx.service.configRef, memoryDir: ctx.service.memoryDir, embeddingLookupFactory: ctx.service.embeddingLookupFactoryRef, storageForNamespace: (ns) => ctx.service.getWritableStorageForNamespace(ns ?? undefined, ctx.authenticatedPrincipal), localLlm: ctx.service.localLlmRef, fallbackLlm: ctx.service.fallbackLlmRef, namespace: optStr(input.namespace), apply: input.apply === true }) }) });\ndefineOperation({ name: \"graph_edge_decay_run\", description: \"Run edge decay.\", fleetWide: true, schema: strictSchema({ dryRun: S.bool }), handler: async (input, ctx) => { const cfg = ctx.service.configRef; if (!cfg.graphEdgeDecayEnabled) return { result: { ranAt: new Date().toISOString(), disabled: true, reason: \"graphEdgeDecayEnabled is false\" } }; return { result: { results: await runGraphEdgeDecayMaintenanceAcrossNamespaces(ctx.service.memoryDir, { windowMs: cfg.graphEdgeDecayWindowMs, perWindow: cfg.graphEdgeDecayPerWindow, floor: cfg.graphEdgeDecayFloor, visibilityThreshold: cfg.graphEdgeDecayVisibilityThreshold, dryRun: input.dryRun === true, namespacesEnabled: cfg.namespacesEnabled === true, defaultNamespace: cfg.defaultNamespace }) } }; } });\n\n// === SUMMARIZE/PROFILING/PEERS/CONSOLE/DREAMS ===\ndefineOperation({ name: \"memory_summarize_hourly\", description: \"Hourly summarize.\", fleetWide: true, schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.memorySummarizeHourly() }) });\ndefineOperation({ name: \"conversation_index_update\", description: \"Update conv index.\", fleetWide: true, schema: strictSchema({ sessionKey: S.str, hours: S.num, embed: S.bool }), handler: async (input, ctx) => { if (input.sessionKey !== undefined && typeof input.sessionKey !== \"string\") throw new EngramAccessInputError(\"sessionKey must be a string when provided\"); return { result: await ctx.service.conversationIndexUpdate({ sessionKey: optStr(input.sessionKey), hours: optNum(input.hours), embed: optBool(input.embed) }) }; } });\ndefineOperation({ name: \"profiling_report\", description: \"Profiling report.\", schema: strictSchema({ format: S.str, limit: S.num }), handler: async (input, ctx) => { if (input.format !== undefined && typeof input.format !== \"string\") throw new EngramAccessInputError(\"format must be a string when provided\"); if (input.limit !== undefined && typeof input.limit !== \"number\") throw new EngramAccessInputError(\"limit must be a number when provided\"); return { result: await ctx.service.profilingReport({ format: optStr(input.format), limit: optNum(input.limit) }) }; } });\ndefineOperation({ name: \"live_connectors_run\", description: \"Run connectors.\", fleetWide: true, schema: strictSchema({ force: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.liveConnectorsRun({ authenticatedPrincipal: ctx.authenticatedPrincipal, force: input.force === true }, ctx.authenticatedPrincipal) }) });\ndefineOperation({ name: \"peer_list\", description: \"List peers.\", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.peerList() }) });\ndefineOperation({ name: \"peer_get\", description: \"Get peer.\", schema: strictSchema({ id: S.str }), handler: async (input, ctx) => { const id = defStr(input.id, \"\"); if (!id) throw new EngramAccessInputError(\"peer_get: id is required\"); return { result: await ctx.service.peerGet(id) }; } });\ndefineOperation({ name: \"peer_set\", description: \"Set peer.\", schema: strictSchema({ id: S.str, kind: S.str, displayName: S.str, notes: S.str }), handler: async (input, ctx) => { const id = defStr(input.id, \"\"); if (!id) throw new EngramAccessInputError(\"peer_set: id is required\"); if (input.kind !== undefined && typeof input.kind !== \"string\") throw new EngramAccessInputError(\"peer_set: kind must be a string when provided\"); if (input.displayName !== undefined && typeof input.displayName !== \"string\") throw new EngramAccessInputError(\"peer_set: displayName must be a string when provided\"); if (input.notes !== undefined && typeof input.notes !== \"string\") throw new EngramAccessInputError(\"peer_set: notes must be a string when provided\"); return { result: await ctx.service.peerSet({ id, kind: optStr(input.kind), displayName: optStr(input.displayName), notes: optStr(input.notes) }) }; } });\ndefineOperation({ name: \"peer_delete\", description: \"Delete peer.\", schema: strictSchema({ id: S.str }), handler: async (input, ctx) => { const id = defStr(input.id, \"\"); if (!id) throw new EngramAccessInputError(\"peer_delete: id is required\"); return { result: await ctx.service.peerDelete(id) }; } });\ndefineOperation({ name: \"peer_profile_get\", description: \"Get peer profile.\", schema: strictSchema({ id: S.str }), handler: async (input, ctx) => { const id = defStr(input.id, \"\"); if (!id) throw new EngramAccessInputError(\"peer_profile_get: id is required\"); return { result: await ctx.service.peerProfileGet(id) }; } });\ndefineOperation({ name: \"peer_forget\", description: \"Forget peer.\", schema: strictSchema({ id: S.str, confirm: S.str }), handler: async (input, ctx) => { const id = defStr(input.id, \"\"); if (!id) throw new EngramAccessInputError(\"peer_forget: id is required\"); const c = optStr(input.confirm) ?? \"\"; if (c !== \"yes\") throw new EngramAccessInputError(\"peer_forget: confirm must be 'yes' to prevent accidental data loss\"); return { result: await ctx.service.peerForget(id, { confirm: \"yes\" }) }; } });\ndefineOperation({ name: \"console_state\", description: \"Console state.\", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.consoleState(optStr(input.namespace), ctx.authenticatedPrincipal) }) });\ndefineOperation({ name: \"dreams_status\", description: \"Dreams status.\", schema: strictSchema({ windowHours: S.num, namespace: S.str }), handler: async (input, ctx) => { let wh = 24; try { wh = normalizeDreamsStatusWindowHours(input.windowHours); } catch { throw new EngramAccessInputError(\"dreams_status: windowHours must be a positive integer. Got: \" + String(input.windowHours)); } return { result: await ctx.service.dreamsStatus({ windowHours: wh, namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) }; } });\ndefineOperation({ name: \"dreams_run\", description: \"Run dreams.\", schema: strictSchema({ phase: S.str, dryRun: S.bool, namespace: S.str }), handler: async (input, ctx) => { const VP = [\"lightSleep\", \"rem\", \"deepSleep\"]; const ph = optStr(input.phase) ?? \"\"; if (!ph || !VP.includes(ph)) throw new EngramAccessInputError(\"dreams_run: phase must be one of: \" + VP.join(\", \")); if (input.dryRun !== undefined && typeof input.dryRun !== \"boolean\") throw new EngramAccessInputError(\"dreams_run: dryRun must be boolean\"); return { result: await ctx.service.dreamsRun({ phase: ph as DreamsPhase, dryRun: input.dryRun === true, namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) }; } });\n\ndefineOperation({ name: \"correction_pending\", description: \"List pending corrections (HTTP GET).\", schema: strictSchema({ namespace: S.str, sessionKey: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.correctionListPending({ namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey), principal: ctx.authenticatedPrincipal }) }) });\n\n// === HTTP-ONLY ===\ndefineOperation({ name: \"offline_sync_snapshot\", description: \"Offline sync snapshot.\", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.offlineSyncSnapshot() }) });\ndefineOperation({ name: \"offline_sync_files\", description: \"Offline sync files.\", schema: strictSchema({ paths: S.strArr, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.offlineSyncFiles({ paths: optStrArr(input.paths) ?? [], namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) }) });\ndefineOperation({ name: \"offline_sync_file_content\", description: \"Read file content.\", schema: strictSchema({ path: S.str, namespace: S.str, offset: S.num, length: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.offlineSyncFileContent({ path: optStr(input.path) ?? \"\", namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal, offset: optNum(input.offset), length: optNum(input.length) }) }) });\ndefineOperation({ name: \"offline_sync_apply_file_content\", description: \"Apply file content.\", schema: strictSchema({ sourceId: S.str, path: S.str, sha256: S.str, bytes: S.num, mtimeMs: S.num, offset: S.num, baseSha256: S.str, content: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.offlineSyncApplyFileContent({ sourceId: optStr(input.sourceId) ?? \"\", path: optStr(input.path) ?? \"\", sha256: optStr(input.sha256) ?? \"\", bytes: optNum(input.bytes) ?? 0, mtimeMs: optNum(input.mtimeMs) ?? 0, offset: optNum(input.offset), baseSha256: optStr(input.baseSha256), content: Buffer.from(defStr(input.content, \"\"), \"base64\"), namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) }) });\ndefineOperation({ name: \"offline_sync_apply\", description: \"Apply sync.\", schema: strictSchema({ changeset: z.unknown().optional(), namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.offlineSyncApply({ changeset: input.changeset, namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) }) });\ndefineOperation({ name: \"lcm_status\", description: \"LCM status.\", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.lcmStatus() }) });\ndefineOperation({ name: \"memory_list\", description: \"List memories.\", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.memoryBrowse() }) });\ndefineOperation({\n name: \"recall_timings\",\n description: \"List recent recall timings.\",\n schema: strictSchema({}),\n handler: async (_input, ctx) => {\n if (\n !isRecallTimingsOperator(\n ctx.service.configRef,\n ctx.authenticatedPrincipal,\n ctx.operatorPrincipal,\n )\n ) {\n throw new EngramAccessForbiddenError(\"recall timings require the configured operator principal\");\n }\n return { result: getRecallTimingStatus(ctx.service.configRef) };\n },\n});\ndefineOperation({ name: \"entity_list\", description: \"List entities.\", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.entityList({}, ctx.authenticatedPrincipal) }) });\ndefineOperation({ name: \"maintenance_status\", description: \"Maintenance status.\", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.maintenance() }) });\ndefineOperation({ name: \"quality_status\", description: \"Quality status.\", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.quality() }) });\ndefineOperation({ name: \"trust_zones_status\", description: \"Trust-zone status.\", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.trustZoneStatus() }) });\ndefineOperation({ name: \"trust_zones_records\", description: \"Browse trust-zone records.\", schema: strictSchema({ namespace: S.str, limit: S.num, offset: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.trustZoneBrowse({ namespace: optStr(input.namespace), limit: optNum(input.limit), offset: optNum(input.offset) }, ctx.authenticatedPrincipal) }) });\ndefineOperation({ name: \"review_disposition\", description: \"Review disposition.\", schema: strictSchema({ memoryId: S.str, status: S.str, reasonCode: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.reviewDisposition({ memoryId: optStr(input.memoryId) ?? \"\", status: (optStr(input.status) ?? \"archived\") as never, reasonCode: optStr(input.reasonCode) ?? \"\", namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });\ndefineOperation({ name: \"review_deck_list\", description: \"List review deck.\", schema: strictSchema({ namespace: S.str, cursor: S.str, limit: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.reviewDeckList({ namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal, cursor: optStr(input.cursor), limit: optNum(input.limit) ?? 1 }) }) });\ndefineOperation({ name: \"review_deck_action\", description: \"Apply review deck action.\", schema: strictSchema({ itemId: S.str, revision: S.str, action: S.str, correctionText: S.str, idempotencyKey: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.reviewDeckAction({ schemaVersion: 1, itemId: reqStr(input.itemId, \"itemId\"), revision: reqStr(input.revision, \"revision\"), action: reqStr(input.action, \"action\") as \"keep\", idempotencyKey: reqStr(input.idempotencyKey, \"idempotencyKey\"), ...(optStr(input.correctionText) ? { correctionText: optStr(input.correctionText)! } : {}) } as never, { principal: ctx.authenticatedPrincipal, signal: ctx.abortSignal }) }) });\ndefineOperation({ name: \"review_deck_undo\", description: \"Undo review deck action.\", schema: strictSchema({ receiptId: S.str, expectedRevision: S.str, idempotencyKey: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.reviewDeckUndo({ schemaVersion: 1, receiptId: reqStr(input.receiptId, \"receiptId\"), expectedRevision: reqStr(input.expectedRevision, \"expectedRevision\"), idempotencyKey: reqStr(input.idempotencyKey, \"idempotencyKey\") }, { principal: ctx.authenticatedPrincipal, signal: ctx.abortSignal }) }) });\ndefineOperation({ name: \"trust_zones_promote\", description: \"Promote trust-zone.\", schema: strictSchema({ recordId: S.str, targetZone: S.str, promotionReason: S.str, dryRun: S.bool, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.trustZonePromote({ recordId: optStr(input.recordId) ?? \"\", targetZone: (optStr(input.targetZone) ?? \"working\") as never, promotionReason: optStr(input.promotionReason) ?? \"\", dryRun: input.dryRun === true, namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });\ndefineOperation({ name: \"trust_zones_demo_seed\", description: \"Demo seed.\", schema: strictSchema({ scenario: S.str, dryRun: S.bool, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.trustZoneDemoSeed({ scenario: optStr(input.scenario), dryRun: input.dryRun === true, namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });\ndefineOperation({ name: \"citations_observed\", description: \"Record citations.\", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { ok: true } }) });\ndefineOperation({ name: \"contradiction_detail\", description: \"Contradiction detail.\", schema: strictSchema({ id: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await listPairs(ctx.service.memoryDir, { filter: \"all\" as const, namespace: optStr(input.namespace), includeUnscopedForNamespace: false, limit: 1 }) }) });\ndefineOperation({ name: \"offline_sync_snapshot_stream\", description: \"SSE stream.\", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.offlineSyncSnapshotStream() }) });\ndefineOperation({ name: \"graph_events\", description: \"SSE graph events.\", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { stream: \"sse\" } }) });\ndefineOperation({ name: \"chat_message\", description: \"Chat message.\", schema: strictSchema({ message: S.str, chatSessionId: S.str }), handler: async (_i, _ctx) => ({ result: { ok: true } }) });\ndefineOperation({ name: \"chat_events\", description: \"SSE chat events.\", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { stream: \"sse\" } }) });\ndefineOperation({ name: \"adapters_status\", description: \"Adapter registry metadata (issue #1850 round 5). Marker op: the HTTP transport builds the response from its own adapterRegistry, but the op still must be registered so it appears in listRegisteredOperations and enforceTokenOp can gate it for scoped tokens.\", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { ok: true } }) });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAS,kBAAkB;AAC3B,SAAS,SAAS;AA6ClB,SAAS,WAAW,MAAwB;AAC1C,MAAI,SAAS,QAAQ,OAAO,SAAS,YAAY,CAAC,MAAM,QAAQ,IAAI,GAAG;AACrE,UAAM,MAAM;AACZ,UAAM,UAAmC,CAAC;AAC1C,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,UAAI,UAAU,KAAM,SAAQ,GAAG,IAAI;AAAA,IACrC;AACA,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,SAAS,aAAsC,OAA8C;AAC3F,SAAO,EAAE,WAAW,YAAY,EAAE,OAAO,KAAK,EAAE,YAAY,CAAC;AAC/D;AAQA,SAAS,iBAAiB,MAAe,UAAsC;AAC7E,MAAI,SAAS,QAAQ,OAAO,SAAS,YAAY,CAA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|
|
218
|
-
//# sourceMappingURL=chunk-
|
|
218
|
+
//# sourceMappingURL=chunk-XXR4A33N.js.map
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
} from "./chunk-YCVB7X56.js";
|
|
38
38
|
import {
|
|
39
39
|
fillWearableConversationLocations
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-S4OZKPBS.js";
|
|
41
41
|
import {
|
|
42
42
|
composeMemoryEnvelope
|
|
43
43
|
} from "./chunk-TWRPWJJT.js";
|
|
@@ -1329,4 +1329,4 @@ export {
|
|
|
1329
1329
|
syncWearableSource,
|
|
1330
1330
|
defaultTimezone
|
|
1331
1331
|
};
|
|
1332
|
-
//# sourceMappingURL=chunk-
|
|
1332
|
+
//# sourceMappingURL=chunk-YDIOMDBW.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NamespaceStorageRouter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TFWJXWL6.js";
|
|
4
4
|
import {
|
|
5
5
|
namespaceCollectionName
|
|
6
6
|
} from "./chunk-LXXIV7Y2.js";
|
|
@@ -213,4 +213,4 @@ export {
|
|
|
213
213
|
verifyNamespaces,
|
|
214
214
|
runNamespaceMigration
|
|
215
215
|
};
|
|
216
|
-
//# sourceMappingURL=chunk-
|
|
216
|
+
//# sourceMappingURL=chunk-YECEEJUU.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isValidCapsuleSince
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KQAFEZQX.js";
|
|
4
4
|
import {
|
|
5
5
|
CAPSULE_ID_PATTERN
|
|
6
6
|
} from "./chunk-WEHSQBFR.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
OFFLINE_SYNC_FILE_CONTENT_MAX_CHUNK_BYTES,
|
|
14
14
|
OFFLINE_SYNC_MAX_MTIME_MS
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-TEH5MDX5.js";
|
|
16
16
|
import {
|
|
17
17
|
validateArchiveRelativePath
|
|
18
18
|
} from "./chunk-GCGJW34D.js";
|
|
@@ -563,4 +563,4 @@ export {
|
|
|
563
563
|
actionConfidenceRequestSchema,
|
|
564
564
|
validateRequest
|
|
565
565
|
};
|
|
566
|
-
//# sourceMappingURL=chunk-
|
|
566
|
+
//# sourceMappingURL=chunk-Z5277JWF.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runLocationSync
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LMMBV7QC.js";
|
|
4
4
|
import {
|
|
5
5
|
log
|
|
6
6
|
} from "./chunk-3WCASNQZ.js";
|
|
@@ -58,4 +58,4 @@ export {
|
|
|
58
58
|
LOCATION_SYNC_DEFAULT_INTERVAL_MS,
|
|
59
59
|
startLocationAutoSync
|
|
60
60
|
};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-ZFNXJEUG.js.map
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
ENTITY_CANONICAL_ID_RECONCILE_MARKER,
|
|
8
8
|
assertSafeEntityId,
|
|
9
9
|
withEntityCanonicalMutationLock
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-A5L5KGDI.js";
|
|
11
11
|
import {
|
|
12
12
|
computeSupersessionKey,
|
|
13
13
|
normalizeSupersessionKey
|
|
@@ -58,6 +58,7 @@ var EntityCanonicalIdMigrationStateSchema = z.object({
|
|
|
58
58
|
version: z.literal(ENTITY_CANONICAL_ID_MIGRATION_VERSION),
|
|
59
59
|
complete: z.boolean(),
|
|
60
60
|
mappings: z.record(z.string().min(1)),
|
|
61
|
+
completionFingerprint: z.string().optional(),
|
|
61
62
|
/**
|
|
62
63
|
* Pairs the migration refused to resolve, PARKED rather than dropped.
|
|
63
64
|
* Deleting the record would strand the collision: once an operator removes
|
|
@@ -692,14 +693,11 @@ async function migrateLegacyEntityCanonicalIds(deps) {
|
|
|
692
693
|
if (!isErrnoCode(error, "ENOENT")) throw error;
|
|
693
694
|
}
|
|
694
695
|
}
|
|
695
|
-
let state = await readState(deps)
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
mappings: {}
|
|
701
|
-
};
|
|
702
|
-
}
|
|
696
|
+
let state = await readState(deps) ?? {
|
|
697
|
+
version: ENTITY_CANONICAL_ID_MIGRATION_VERSION,
|
|
698
|
+
complete: false,
|
|
699
|
+
mappings: {}
|
|
700
|
+
};
|
|
703
701
|
const blocked = /* @__PURE__ */ new Map();
|
|
704
702
|
const scanNotes = { junk: /* @__PURE__ */ new Set(), malformed: /* @__PURE__ */ new Set() };
|
|
705
703
|
const staleParked = /* @__PURE__ */ new Map();
|
|
@@ -732,6 +730,10 @@ async function migrateLegacyEntityCanonicalIds(deps) {
|
|
|
732
730
|
}
|
|
733
731
|
const completionFingerprint = await deps.readMigrationFingerprint?.();
|
|
734
732
|
if (await fileExists(reconcileMarkerPath)) return void 0;
|
|
733
|
+
if (completionFingerprint !== void 0 && state.completionFingerprint !== completionFingerprint) {
|
|
734
|
+
state = { ...state, complete: true, completionFingerprint };
|
|
735
|
+
await publishState(deps, state);
|
|
736
|
+
}
|
|
735
737
|
return completionFingerprint;
|
|
736
738
|
};
|
|
737
739
|
const pruneBlocked = async () => {
|
|
@@ -889,4 +891,4 @@ export {
|
|
|
889
891
|
readSafeEntityEntries,
|
|
890
892
|
migrateLegacyEntityCanonicalIds
|
|
891
893
|
};
|
|
892
|
-
//# sourceMappingURL=chunk-
|
|
894
|
+
//# sourceMappingURL=chunk-ZMO2S5RT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/storage/entity-canonical-id-migration.ts"],"sourcesContent":["import { createHash, randomUUID } from \"node:crypto\";\nimport {\n access,\n lstat,\n readFile,\n readdir,\n realpath,\n rename,\n stat as statFile,\n unlink,\n writeFile,\n} from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { lstatSync, readFileSync } from \"node:fs\";\nimport { z } from \"zod\";\nimport { computeSupersessionKey, normalizeSupersessionKey } from \"../temporal-supersession.js\";\nimport type { EntityFile, MemoryFile } from \"../types.js\";\nimport { log } from \"../logger.js\";\nimport { isErrnoCode } from \"../utils/errno.js\";\nimport { withHeldFileLock } from \"../utils/serialize-mutations.js\";\nimport { RECALL_FALLBACK_DIRS } from \"../utils/category-dir.js\";\nimport { assertPathInsideRoot } from \"../utils/path-containment.js\";\nimport { withEntityCanonicalMutationLock } from \"./entity-canonical-id-lock.js\";\nimport { assertSafeEntityId } from \"./entity-id-safety.js\";\nimport { isMalformedEntityRecord } from \"../utils/malformed-entity-record.js\";\nimport {\n isMacOsReplicationJunkBasename,\n warnIgnoredMacOsReplicationJunk,\n} from \"../utils/macos-replication-junk.js\";\n\nimport {\n ENTITY_CANONICAL_ID_MIGRATION_FILE,\n ENTITY_CANONICAL_ID_RECONCILE_CONSUMING_MARKER,\n ENTITY_CANONICAL_ID_RECONCILE_MARKER,\n resolveHistoricalEntityCanonicalId,\n} from \"./entity-canonical-id-references.js\";\n\nconst ENTITY_CANONICAL_ID_MIGRATION_VERSION = 1;\nconst ENTITY_CANONICAL_ID_MIGRATION_LOCK_STALE_MS = 60_000;\nconst ENTITY_CANONICAL_ID_MIGRATION_LOCK_MAX_WAIT_MS = 300_000;\nconst TOMBSTONE_LOCK_STALE_MS = 30_000;\nconst TOMBSTONE_LOCK_MAX_WAIT_MS = 5_000;\nconst MEMORY_REWRITE_MAX_PASSES = 3;\nconst ENTITY_MAPPING_RESCAN_MAX_PASSES = 3;\n\nconst EntityCanonicalIdMigrationStateSchema = z.object({\n version: z.literal(ENTITY_CANONICAL_ID_MIGRATION_VERSION),\n complete: z.boolean(),\n mappings: z.record(z.string().min(1)),\n completionFingerprint: z.string().optional(),\n /**\n * Pairs the migration refused to resolve, PARKED rather than dropped.\n * Deleting the record would strand the collision: once an operator removes\n * the legacy file, no later scan can rediscover the mapping, so references\n * still naming the legacy id would never be rewritten. Optional so a journal\n * written by an older build still parses.\n */\n blocked: z.record(z.string().min(1)).optional(),\n});\n\ntype EntityCanonicalIdMigrationState = z.infer<typeof EntityCanonicalIdMigrationStateSchema>;\n\nexport interface EntityCanonicalIdMigrationDependencies {\n stateDir: string;\n entitiesDir: string;\n normalizeEntityName(raw: string, type: string): string;\n resolveEntityFilePath(id: string): string | null;\n readStorageSecureFile(filePath: string): Promise<string>;\n writeStorageSecureFile(filePath: string, content: string, forceEncrypt?: boolean): Promise<void>;\n isEncryptedStorageFile(filePath: string): Promise<boolean>;\n snapshotBeforeWrite(filePath: string, trigger: \"write\"): Promise<void>;\n parseEntityFile(content: string): EntityFile;\n serializeEntityFile(entity: EntityFile): string;\n serializeMemoryWithEntityRef(memory: MemoryFile, entityRef: string): string;\n readMemoryByPath(filePath: string): Promise<MemoryFile | null>;\n readAllMemories(): Promise<MemoryFile[]>;\n readAllColdMemories(): Promise<MemoryFile[]>;\n readArchivedMemories(): Promise<MemoryFile[]>;\n validateMemoryScanRoots?(): Promise<void>;\n rewriteProjectedEntityReferences(mappings: Readonly<Record<string, string>>): Promise<void>;\n rewriteProjectedMemoryEntityReference(\n memoryId: string,\n previousEntityRef: string,\n nextEntityRef: string,\n ): Promise<void>;\n invalidateKnowledgeIndexCache(): void;\n invalidateAllMemoriesCache(): void;\n invalidateColdMemoriesCache(): void;\n bumpMemoryStatusVersion(): void;\n readMigrationFingerprint?(): Promise<string>;\n}\n\nasync function fingerprintPath(filePath: string): Promise<string> {\n let fileStat;\n try {\n fileStat = await lstat(filePath);\n } catch (error) {\n if (!isErrnoCode(error, \"ENOENT\")) throw error;\n }\n return fileStat\n ? `${fileStat.dev}:${fileStat.ino}:${fileStat.mtimeMs}:${fileStat.ctimeMs}:${fileStat.size}`\n : \"missing\";\n}\n\nasync function fingerprintEntityEntries(entitiesDir: string): Promise<string> {\n let names: string[];\n try {\n names = (await readdir(entitiesDir))\n .filter((name) => path.extname(name) === \".md\" && !isMacOsReplicationJunkBasename(name))\n .sort();\n } catch (error) {\n if (isErrnoCode(error, \"ENOENT\")) return \"missing\";\n throw error;\n }\n const hash = createHash(\"sha256\");\n for (const name of names) {\n hash.update(`${name.length}:${name}:`);\n try {\n const entry = await lstat(path.join(entitiesDir, name), { bigint: true });\n hash.update(`${entry.dev}:${entry.ino}:${entry.size}:${entry.mtimeNs}:${entry.ctimeNs}`);\n } catch (error) {\n if (!isErrnoCode(error, \"ENOENT\")) throw error;\n hash.update(\"missing\");\n }\n hash.update(\"\\n\");\n }\n return hash.digest(\"hex\");\n}\n\n/**\n * Completion fingerprint for migration inputs only. Entity entry identities\n * catch same-path edits that do not change the directory inode; the cooperative\n * sentinel covers managed writes. Memory-corpus writes stay excluded so plain\n * fact writes do not reopen migration.\n */\nexport async function getFingerprint(\n baseDir: string,\n entitiesDir: string,\n getEntityMutationVersion: () => string,\n): Promise<string> {\n const [\n entityDirectoryFingerprint,\n entityEntriesFingerprint,\n aliasFingerprint,\n reconcileFingerprint,\n consumingFingerprint,\n ] = await Promise.all([\n fingerprintPath(entitiesDir),\n fingerprintEntityEntries(entitiesDir),\n fingerprintPath(path.join(baseDir, \"config\", \"aliases.json\")),\n fingerprintPath(path.join(baseDir, \"state\", ENTITY_CANONICAL_ID_RECONCILE_MARKER)),\n fingerprintPath(path.join(baseDir, \"state\", ENTITY_CANONICAL_ID_RECONCILE_CONSUMING_MARKER)),\n ]);\n return [\n entityDirectoryFingerprint,\n entityEntriesFingerprint,\n aliasFingerprint,\n reconcileFingerprint,\n consumingFingerprint,\n getEntityMutationVersion(),\n ].join(\":\");\n}\n\nexport async function validateRoots(\n baseDir: string,\n entitiesDir: string,\n stateDir: string,\n archiveDir: string,\n): Promise<void> {\n let baseStat;\n try {\n baseStat = await lstat(baseDir);\n } catch (error) {\n if (isErrnoCode(error, \"ENOENT\")) return;\n throw error;\n }\n if (baseStat.isSymbolicLink() || !baseStat.isDirectory()) {\n throw new Error(`Refusing entity canonical-id migration through unsafe memory root: ${baseDir}.`);\n }\n const memoryRoot = await realpath(baseDir);\n const roots = [\n entitiesDir,\n stateDir,\n ...RECALL_FALLBACK_DIRS.map((directory) => path.join(baseDir, directory)),\n path.join(baseDir, \"cold\"),\n archiveDir,\n ];\n for (const root of roots) {\n let rootStat;\n try {\n rootStat = await lstat(root);\n } catch (error) {\n if (isErrnoCode(error, \"ENOENT\")) continue;\n throw error;\n }\n if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) {\n throw new Error(`Refusing entity canonical-id migration through unsafe memory root: ${root}.`);\n }\n assertPathInsideRoot(memoryRoot, await realpath(root), root);\n }\n}\n\nfunction statePath(deps: EntityCanonicalIdMigrationDependencies): string {\n return path.join(deps.stateDir, ENTITY_CANONICAL_ID_MIGRATION_FILE);\n}\n\nasync function assertSafeMigrationStateFile(\n deps: EntityCanonicalIdMigrationDependencies,\n): Promise<void> {\n const migrationStatePath = statePath(deps);\n let fileStat;\n try {\n fileStat = await lstat(migrationStatePath);\n } catch (error) {\n if (isErrnoCode(error, \"ENOENT\")) return;\n throw error;\n }\n if (fileStat.isSymbolicLink() || !fileStat.isFile()) {\n throw new Error(\n `Refusing entity canonical-id migration through unsafe migration state file: ${migrationStatePath}.`,\n );\n }\n const [stateRoot, stateFile] = await Promise.all([\n realpath(deps.stateDir),\n realpath(migrationStatePath),\n ]);\n assertPathInsideRoot(stateRoot, stateFile, migrationStatePath);\n}\nasync function assertSafeTombstoneFile(\n deps: EntityCanonicalIdMigrationDependencies,\n tombstonePath: string,\n): Promise<boolean> {\n let fileStat;\n try {\n fileStat = await lstat(tombstonePath);\n } catch (error) {\n if (isErrnoCode(error, \"ENOENT\")) return false;\n throw error;\n }\n if (fileStat.isSymbolicLink() || !fileStat.isFile()) {\n throw new Error(\n `Refusing entity canonical-id migration through unsafe tombstone ledger: ${tombstonePath}.`,\n );\n }\n const [stateRoot, tombstoneFile] = await Promise.all([\n realpath(deps.stateDir),\n realpath(tombstonePath),\n ]);\n assertPathInsideRoot(stateRoot, tombstoneFile, tombstonePath);\n return true;\n}\n\nfunction lockPath(deps: EntityCanonicalIdMigrationDependencies): string {\n return path.join(deps.stateDir, \"entity-canonical-id-migration.lock\");\n}\n\n\nasync function readState(\n deps: EntityCanonicalIdMigrationDependencies\n): Promise<EntityCanonicalIdMigrationState | null> {\n await assertSafeMigrationStateFile(deps);\n let raw: string;\n try {\n raw = await readFile(statePath(deps), \"utf-8\");\n } catch (error) {\n if (isErrnoCode(error, \"ENOENT\")) return null;\n throw error;\n }\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n throw new Error(\"Invalid entity canonical-id migration state.\");\n }\n const result = EntityCanonicalIdMigrationStateSchema.safeParse(parsed);\n if (!result.success) throw new Error(\"Invalid entity canonical-id migration state.\");\n for (const mappings of [result.data.mappings, result.data.blocked ?? {}]) {\n for (const [legacyId, canonicalId] of Object.entries(mappings)) {\n assertSafeEntityId(legacyId);\n assertSafeEntityId(canonicalId);\n }\n }\n return result.data;\n}\n\nasync function writeState(\n deps: EntityCanonicalIdMigrationDependencies,\n state: EntityCanonicalIdMigrationState\n): Promise<void> {\n const destination = statePath(deps);\n const temporary = `${destination}.${process.pid}.${randomUUID()}.tmp`;\n try {\n await writeFile(temporary, `${JSON.stringify(state, null, 2)}\\n`, \"utf-8\");\n await rename(temporary, destination);\n } finally {\n await unlink(temporary).catch(() => undefined);\n }\n}\n\n/**\n * Every journal publish — additive merges, completion markers, prunes —\n * serializes under the entity MUTATION lock (issue #2213 review): entity\n * writers, post-persist repair settles, and tombstone appends revalidate\n * the journal identity under that lock, so an unlocked publish could land\n * inside their resolve→write window and strand the write on a superseded\n * id space.\n */\nasync function publishState(\n deps: EntityCanonicalIdMigrationDependencies,\n state: EntityCanonicalIdMigrationState\n): Promise<void> {\n await withEntityCanonicalMutationLock(deps.stateDir, async () => {\n await writeState(deps, state);\n });\n}\n\nasync function fileExists(filePath: string): Promise<boolean> {\n try {\n await access(filePath);\n return true;\n } catch (error) {\n if (isErrnoCode(error, \"ENOENT\")) return false;\n throw error;\n }\n}\n\nasync function sameFileIdentity(leftPath: string, rightPath: string): Promise<boolean> {\n try {\n const [left, right] = await Promise.all([statFile(leftPath), statFile(rightPath)]);\n return left.dev === right.dev && left.ino === right.ino;\n } catch (error) {\n if (isErrnoCode(error, \"ENOENT\")) return false;\n throw error;\n }\n}\n\nasync function assertNotSymlink(filePath: string, label: string): Promise<void> {\n let stat;\n try {\n stat = await lstat(filePath);\n } catch (error) {\n if (isErrnoCode(error, \"ENOENT\")) return;\n throw error;\n }\n if (stat.isSymbolicLink()) {\n throw new Error(`Refusing entity canonical-id migration through symlink: ${label}.`);\n }\n}\nasync function assertNotMemorySymlink(filePath: string): Promise<void> {\n let stat;\n try {\n stat = await lstat(filePath);\n } catch (error) {\n if (isErrnoCode(error, \"ENOENT\")) return;\n throw error;\n }\n if (stat.isSymbolicLink()) {\n throw new Error(`Refusing entity canonical-id migration through symlinked memory: ${filePath}.`);\n }\n}\nasync function assertEntityContentUnchanged(\n deps: EntityCanonicalIdMigrationDependencies,\n filePath: string,\n expectedContent: string,\n legacyId: string,\n): Promise<void> {\n const latestContent = await deps.readStorageSecureFile(filePath);\n if (latestContent !== expectedContent) {\n throw new Error(`Legacy entity id ${legacyId} changed while migration was running; retry migration.`);\n }\n}\n\n/**\n * Fail-closed entity-entry validation for the startup path: refuses a\n * symlinked or non-directory entities root and any symlinked entry, without\n * taking the migration lock. Exported so `ensureDirectories()` can run it\n * before deferring the migration (#3139) — the same check\n * `migrateLegacyEntityCanonicalIds` performs under the lock.\n */\nexport async function readSafeEntityEntries(entitiesDir: string): Promise<string[]> {\n const rootStat = await lstat(entitiesDir);\n if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) {\n throw new Error(\"Refusing entity canonical-id migration through a symlinked or non-directory entities root.\");\n }\n const entries = await readdir(entitiesDir);\n for (const entry of entries) {\n await assertNotSymlink(path.join(entitiesDir, entry), entry);\n }\n return entries;\n}\n\n/**\n * Legacy ids the migration cannot resolve on its own, mapped to the canonical\n * id they collide with. Two entity files describing one entity is an ORDINARY\n * operator state, and picking a winner would silently drop whichever side lost.\n * So the pair is skipped and reported: reads of the legacy id keep working\n * exactly as they did before the migration ran.\n */\nexport type BlockedEntityPairs = Map<string, string>;\n\ninterface EntityScanNotes {\n junk: Set<string>;\n malformed: Set<string>;\n}\n\nasync function discoverMappings(\n deps: EntityCanonicalIdMigrationDependencies,\n knownMappings: Readonly<Record<string, string>> = {},\n blocked: BlockedEntityPairs = new Map(),\n scanNotes?: EntityScanNotes,\n): Promise<Record<string, string>> {\n const mappings: Record<string, string> = {};\n const canonicalOwners = new Map<string, string[]>();\n // Blocks describe THIS scan of the directory, so they are rebuilt per pass.\n // Accumulating them across a run would let a collision another writer has\n // since resolved keep pruning its now-valid mapping: the entity file gets\n // renamed while the pruned mapping skips the reference rewrite, stranding\n // memories on a filename that no longer exists.\n blocked.clear();\n const entityEntries = await readSafeEntityEntries(deps.entitiesDir);\n for (const entry of entityEntries) {\n // AppleDouble (`._*`) and `.DS_Store` are Finder metadata, not entity\n // files. A real file that cannot be parsed is left in place: this scan\n // runs during directory init, and aborting it took the daemon down.\n // Skipping is the same outcome as the old throw (the file is not\n // rewritten) without refusing to boot. Symlink checks above still run.\n if (isMacOsReplicationJunkBasename(entry)) {\n scanNotes?.junk.add(entry);\n continue;\n }\n if (!entry.endsWith(\".md\")) continue;\n const legacyId = entry.slice(0, -\".md\".length);\n assertSafeEntityId(legacyId);\n const legacyPath = deps.resolveEntityFilePath(legacyId);\n if (legacyPath === null) continue;\n const entityContent = await deps.readStorageSecureFile(legacyPath);\n if (isMalformedEntityRecord(entityContent)) {\n scanNotes?.malformed.add(entry);\n continue;\n }\n const entity = deps.parseEntityFile(entityContent);\n if (!entity.name.trim() || !entity.type.trim()) {\n scanNotes?.malformed.add(entry);\n continue;\n }\n const canonicalId = deps.normalizeEntityName(entity.name, entity.type);\n assertSafeEntityId(canonicalId);\n if (legacyId === canonicalId) continue;\n const canonicalPath = deps.resolveEntityFilePath(canonicalId);\n if (canonicalPath === null) continue;\n const canonicalExists = await fileExists(canonicalPath);\n if (\n canonicalExists\n && await sameFileIdentity(legacyPath, canonicalPath)\n && knownMappings[legacyId] === canonicalId\n ) continue;\n if (canonicalExists) {\n const canonicalContent = await deps.readStorageSecureFile(canonicalPath);\n if (entityContent !== canonicalContent) {\n blocked.set(legacyId, canonicalId);\n continue;\n }\n }\n canonicalOwners.set(canonicalId, [...(canonicalOwners.get(canonicalId) ?? []), legacyId]);\n mappings[legacyId] = canonicalId;\n }\n // A canonical id claimed by more than one legacy file has no non-arbitrary\n // winner, and readdir order is not stable (§6) - so the \"winner\" would differ\n // between hosts reading identical data. Block every claimant instead.\n for (const [canonicalId, claimants] of canonicalOwners) {\n if (claimants.length < 2) continue;\n for (const legacyId of claimants) {\n blocked.set(legacyId, canonicalId);\n delete mappings[legacyId];\n }\n }\n return mappings;\n}\n\nasync function rewriteReferences(\n deps: EntityCanonicalIdMigrationDependencies,\n mappings: Readonly<Record<string, string>>,\n refreshLock: () => Promise<boolean>\n): Promise<{ rewroteColdMemory: boolean }> {\n let rewroteColdMemory = false;\n for (let pass = 0; pass < MEMORY_REWRITE_MAX_PASSES; pass += 1) {\n deps.invalidateAllMemoriesCache();\n deps.invalidateColdMemoriesCache();\n const [hotMemories, coldMemories, archivedMemories] = await Promise.all([\n deps.readAllMemories(),\n deps.readAllColdMemories(),\n deps.readArchivedMemories(),\n ]);\n const seenPaths = new Set<string>();\n let rewroteAny = false;\n for (const memory of [...hotMemories, ...coldMemories, ...archivedMemories]) {\n const memoryPath = path.resolve(memory.path);\n if (seenPaths.has(memoryPath)) continue;\n seenPaths.add(memoryPath);\n const previousEntityRef = memory.frontmatter.entityRef;\n const canonicalId = previousEntityRef ? mappings[previousEntityRef] : undefined;\n if (!previousEntityRef || !canonicalId) continue;\n await assertNotMemorySymlink(memory.path);\n const observedMemoryFingerprint = await fingerprintPath(memory.path);\n if (observedMemoryFingerprint === \"missing\") continue;\n if (!(await refreshLock())) throw new Error(\"Lost entity canonical-id migration lock.\");\n const latestMemory = await deps.readMemoryByPath(memory.path);\n if (!latestMemory) continue;\n const latestMemoryFingerprint = await fingerprintPath(latestMemory.path);\n if (latestMemoryFingerprint !== observedMemoryFingerprint) continue;\n const latestPreviousEntityRef = latestMemory.frontmatter.entityRef;\n const latestCanonicalId = latestPreviousEntityRef ? mappings[latestPreviousEntityRef] : undefined;\n if (!latestPreviousEntityRef || !latestCanonicalId) continue;\n const memoryEncrypted = await deps.isEncryptedStorageFile(latestMemory.path);\n if ((await fingerprintPath(latestMemory.path)) !== latestMemoryFingerprint) continue;\n await deps.snapshotBeforeWrite(latestMemory.path, \"write\");\n if ((await fingerprintPath(latestMemory.path)) !== latestMemoryFingerprint) continue;\n await deps.writeStorageSecureFile(\n latestMemory.path,\n deps.serializeMemoryWithEntityRef(latestMemory, latestCanonicalId),\n memoryEncrypted,\n );\n await deps.rewriteProjectedMemoryEntityReference(\n latestMemory.frontmatter.id,\n latestPreviousEntityRef,\n latestCanonicalId,\n );\n rewroteAny = true;\n rewroteColdMemory ||= latestMemory.path.includes(`${path.sep}cold${path.sep}`);\n }\n if (!rewroteAny) return { rewroteColdMemory };\n }\n throw new Error(\"Memory references changed while entity canonical-id migration was running; retry migration.\");\n}\n\nfunction rewriteTombstoneLine(\n line: string,\n mappings: Readonly<Record<string, string>>,\n normalizedMappings: ReadonlyMap<string, string>,\n): string {\n let parsed: unknown;\n try {\n parsed = JSON.parse(line);\n } catch {\n return line;\n }\n if (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) return line;\n\n const tombstone = parsed as Record<string, unknown>;\n let changed = false;\n if (typeof tombstone.entityRef === \"string\") {\n const canonicalId = mappings[tombstone.entityRef];\n if (canonicalId) {\n tombstone.entityRef = canonicalId;\n changed = true;\n }\n }\n if (typeof tombstone.supersessionKey === \"string\") {\n const separator = tombstone.supersessionKey.indexOf(\"::\");\n if (separator < 0) return changed ? JSON.stringify(tombstone) : line;\n const normalizedLegacyId = normalizeSupersessionKey(tombstone.supersessionKey.slice(0, separator));\n const canonicalId = normalizedMappings.get(normalizedLegacyId);\n if (canonicalId) {\n const canonicalKey = computeSupersessionKey(canonicalId, tombstone.supersessionKey.slice(separator + 2));\n if (canonicalKey) {\n tombstone.supersessionKey = canonicalKey;\n changed = true;\n }\n }\n }\n return changed ? JSON.stringify(tombstone) : line;\n}\n\nasync function rewriteTombstoneReferences(\n deps: EntityCanonicalIdMigrationDependencies,\n mappings: Readonly<Record<string, string>>,\n refreshLock: () => Promise<boolean>\n): Promise<void> {\n const tombstonePath = path.join(deps.stateDir, \"tombstones.jsonl\");\n const normalizedMappings = new Map<string, string>();\n for (const [legacyId, canonicalId] of Object.entries(mappings)) {\n const normalizedLegacyId = normalizeSupersessionKey(legacyId);\n if (normalizedLegacyId && !normalizedMappings.has(normalizedLegacyId)) {\n normalizedMappings.set(normalizedLegacyId, canonicalId);\n }\n }\n\n await withHeldFileLock(\n path.join(deps.stateDir, \"tombstones.lock\"),\n {\n staleMs: TOMBSTONE_LOCK_STALE_MS,\n maxWaitMs: TOMBSTONE_LOCK_MAX_WAIT_MS,\n },\n async (acquired, tombstoneLock) => {\n if (!acquired) throw new Error(\"Timed out waiting for active tombstone migration.\");\n if (!(await assertSafeTombstoneFile(deps, tombstonePath))) return;\n const tombstoneEncrypted = await deps.isEncryptedStorageFile(tombstonePath);\n const original = await deps.readStorageSecureFile(tombstonePath);\n let changed = false;\n const rewritten = original\n .split(\"\\n\")\n .map((line) => {\n const next = rewriteTombstoneLine(line, mappings, normalizedMappings);\n changed ||= next !== line;\n return next;\n })\n .join(\"\\n\");\n if (!changed) return;\n if (!(await refreshLock())) throw new Error(\"Lost entity canonical-id migration lock.\");\n if (!(await tombstoneLock.refresh())) throw new Error(\"Lost tombstone migration lock.\");\n await deps.snapshotBeforeWrite(tombstonePath, \"write\");\n await deps.writeStorageSecureFile(tombstonePath, rewritten, tombstoneEncrypted);\n },\n );\n}\n\nasync function rewriteRelationshipTargets(\n deps: EntityCanonicalIdMigrationDependencies,\n mappings: Readonly<Record<string, string>>,\n refreshLock: () => Promise<boolean>\n): Promise<boolean> {\n let rewritten = false;\n const entries = await readSafeEntityEntries(deps.entitiesDir);\n for (const entry of entries) {\n if (!entry.endsWith(\".md\") || isMacOsReplicationJunkBasename(entry)) continue;\n const entityPath = deps.resolveEntityFilePath(entry.slice(0, -\".md\".length));\n if (entityPath === null) continue;\n const observedEntityFingerprint = await fingerprintPath(entityPath);\n if (observedEntityFingerprint === \"missing\") continue;\n const entityRaw = await deps.readStorageSecureFile(entityPath);\n if (isMalformedEntityRecord(entityRaw)) continue;\n const entity = deps.parseEntityFile(entityRaw);\n const relationships = entity.relationships.map((relationship) => {\n const target = mappings[relationship.target];\n return target ? { ...relationship, target } : relationship;\n });\n if (relationships.every((relationship, index) => relationship === entity.relationships[index])) continue;\n const rewroteEntity = await withEntityCanonicalMutationLock(\n deps.stateDir,\n async (refreshEntityLock) => {\n if (!(await refreshLock())) throw new Error(\"Lost entity canonical-id migration lock.\");\n const latestRaw = await deps.readStorageSecureFile(entityPath);\n if (isMalformedEntityRecord(latestRaw)) return false;\n const latestEntity = deps.parseEntityFile(latestRaw);\n if ((await fingerprintPath(entityPath)) !== observedEntityFingerprint) return false;\n const latestRelationships = latestEntity.relationships.map((relationship) => {\n const target = mappings[relationship.target];\n return target ? { ...relationship, target } : relationship;\n });\n if (latestRelationships.every((relationship, index) => relationship === latestEntity.relationships[index])) {\n return false;\n }\n const entityEncrypted = await deps.isEncryptedStorageFile(entityPath);\n if (!(await refreshEntityLock())) throw new Error(\"Lost entity mutation lock.\");\n if ((await fingerprintPath(entityPath)) !== observedEntityFingerprint) return false;\n await deps.snapshotBeforeWrite(entityPath, \"write\");\n if ((await fingerprintPath(entityPath)) !== observedEntityFingerprint) return false;\n await deps.writeStorageSecureFile(\n entityPath,\n deps.serializeEntityFile({ ...latestEntity, relationships: latestRelationships }),\n entityEncrypted,\n );\n return true;\n },\n );\n rewritten ||= rewroteEntity;\n }\n return rewritten;\n}\n\nasync function rewriteKnownReferences(\n deps: EntityCanonicalIdMigrationDependencies,\n mappings: Readonly<Record<string, string>>,\n refreshLock: () => Promise<boolean>,\n): Promise<boolean> {\n await rewriteRelationshipTargets(deps, mappings, refreshLock);\n let rewroteColdMemory = (await rewriteReferences(deps, mappings, refreshLock)).rewroteColdMemory;\n await rewriteTombstoneReferences(deps, mappings, refreshLock);\n await deps.rewriteProjectedEntityReferences(mappings);\n const finalMemoryPass = await rewriteReferences(deps, mappings, refreshLock);\n rewroteColdMemory ||= finalMemoryPass.rewroteColdMemory;\n return rewroteColdMemory;\n}\n\nfunction wouldCreateMappingCycle(\n mappings: Readonly<Record<string, string>>,\n legacyId: string,\n canonicalId: string,\n): boolean {\n let current = canonicalId;\n const seen = new Set<string>();\n while (true) {\n if (current === legacyId) return true;\n if (seen.has(current)) return false;\n seen.add(current);\n const next = mappings[current];\n if (!next || next === current) return false;\n current = next;\n }\n}\n\nfunction rejectMappingCycles(\n existing: Readonly<Record<string, string>>,\n discovered: Readonly<Record<string, string>>,\n): Record<string, string> {\n const accepted: Record<string, string> = {};\n const merged = { ...existing };\n for (const [legacyId, canonicalId] of Object.entries(discovered)) {\n if (\n merged[legacyId] === undefined &&\n wouldCreateMappingCycle(merged, legacyId, canonicalId)\n ) continue;\n accepted[legacyId] = canonicalId;\n merged[legacyId] = canonicalId;\n }\n return accepted;\n}\n\nfunction mergeDiscoveredMappings(\n existing: Readonly<Record<string, string>>,\n discovered: Readonly<Record<string, string>>,\n): Record<string, string> {\n const merged = { ...existing };\n const canonicalOwners = new Map<string, string>();\n for (const [legacyId, canonicalId] of Object.entries(discovered)) {\n const previousMapping = merged[legacyId];\n if (previousMapping !== undefined && previousMapping !== canonicalId) {\n continue;\n }\n if (previousMapping === undefined && wouldCreateMappingCycle(merged, legacyId, canonicalId)) continue;\n const previousOwner = canonicalOwners.get(canonicalId);\n if (previousOwner !== undefined && previousOwner !== legacyId) {\n throw new Error(\n `Cannot migrate legacy entity ids ${previousOwner} and ${legacyId}: both normalize to ${canonicalId}.`,\n );\n }\n merged[legacyId] = canonicalId;\n canonicalOwners.set(canonicalId, legacyId);\n }\n return merged;\n}\nfunction collapseMappings(mappings: Readonly<Record<string, string>>): Record<string, string> {\n const collapsed: Record<string, string> = {};\n for (const legacyId of Object.keys(mappings)) {\n let current = legacyId;\n const seen = new Set<string>();\n while (true) {\n const next = mappings[current];\n if (!next || next === current) break;\n if (seen.has(current)) {\n throw new Error(`Entity canonical-id migration mapping cycle includes ${legacyId}.`);\n }\n seen.add(current);\n current = next;\n }\n if (current !== legacyId) collapsed[legacyId] = current;\n }\n return collapsed;\n}\n\ntype EntityFileMigrationResult = {\n deferred: boolean;\n progressed: boolean;\n /** The pair collided on content; skipped and reported, never migrated. */\n blocked?: boolean;\n};\n\nasync function migrateEntityFilePair(\n deps: EntityCanonicalIdMigrationDependencies,\n legacyId: string,\n canonicalId: string,\n refreshMigrationLock: () => Promise<boolean>,\n): Promise<EntityFileMigrationResult> {\n return withEntityCanonicalMutationLock(deps.stateDir, async (refreshEntityLock) => {\n assertSafeEntityId(legacyId);\n assertSafeEntityId(canonicalId);\n const legacyPath = deps.resolveEntityFilePath(legacyId);\n const canonicalPath = deps.resolveEntityFilePath(canonicalId);\n if (legacyPath === null || canonicalPath === null) {\n throw new Error(\"Invalid entity canonical-id migration path.\");\n }\n await assertNotSymlink(legacyPath, legacyId);\n await assertNotSymlink(canonicalPath, canonicalId);\n const legacyExists = await fileExists(legacyPath);\n const canonicalExists = await fileExists(canonicalPath);\n if (!legacyExists && !canonicalExists) return { deferred: true, progressed: false };\n if (legacyExists && canonicalExists) {\n if (await sameFileIdentity(legacyPath, canonicalPath)) return { deferred: false, progressed: false };\n const [legacyContent, canonicalContent, legacyEncrypted, canonicalEncrypted] = await Promise.all([\n deps.readStorageSecureFile(legacyPath),\n deps.readStorageSecureFile(canonicalPath),\n deps.isEncryptedStorageFile(legacyPath),\n deps.isEncryptedStorageFile(canonicalPath),\n ]);\n if (legacyContent !== canonicalContent) {\n // A mapping persisted by an older build, or a file changed since\n // discovery. Same verdict as discovery: skip the pair, keep both files.\n return { deferred: false, progressed: false, blocked: true };\n }\n if (legacyEncrypted && !canonicalEncrypted) {\n if (!(await refreshMigrationLock()) || !(await refreshEntityLock())) {\n throw new Error(\"Lost entity canonical-id migration lock.\");\n }\n await deps.snapshotBeforeWrite(canonicalPath, \"write\");\n await deps.writeStorageSecureFile(canonicalPath, legacyContent, true);\n if ((await deps.readStorageSecureFile(canonicalPath)) !== legacyContent) {\n throw new Error(`Cannot verify migrated entity id ${canonicalId}.`);\n }\n }\n if (!(await refreshMigrationLock()) || !(await refreshEntityLock())) {\n throw new Error(\"Lost entity canonical-id migration lock.\");\n }\n await deps.snapshotBeforeWrite(legacyPath, \"write\");\n await assertNotSymlink(legacyPath, legacyId);\n await assertEntityContentUnchanged(deps, legacyPath, legacyContent, legacyId);\n await unlink(legacyPath);\n return { deferred: false, progressed: true };\n }\n if (!legacyExists) return { deferred: false, progressed: false };\n if (!(await refreshMigrationLock()) || !(await refreshEntityLock())) {\n throw new Error(\"Lost entity canonical-id migration lock.\");\n }\n const entityEncrypted = await deps.isEncryptedStorageFile(legacyPath);\n const entityContent = await deps.readStorageSecureFile(legacyPath);\n await assertNotSymlink(legacyPath, legacyId);\n await assertEntityContentUnchanged(deps, legacyPath, entityContent, legacyId);\n // A journal entry must not relocate Finder metadata or a record this scan\n // would leave in place. readStorageSecureFile has already decrypted, so\n // the check is on that plaintext. The mapping stays for a later repair.\n if (\n isMacOsReplicationJunkBasename(path.basename(legacyPath))\n || isMalformedEntityRecord(entityContent)\n ) {\n return { deferred: false, progressed: false };\n }\n let canonicalFingerprintAfterWrite: string | null = null;\n try {\n await deps.writeStorageSecureFile(canonicalPath, entityContent, entityEncrypted);\n canonicalFingerprintAfterWrite = await fingerprintPath(canonicalPath);\n if ((await deps.readStorageSecureFile(canonicalPath)) !== entityContent) {\n throw new Error(`Cannot verify migrated entity id ${canonicalId}.`);\n }\n if (!(await refreshMigrationLock()) || !(await refreshEntityLock())) {\n throw new Error(\"Lost entity canonical-id migration lock.\");\n }\n await deps.snapshotBeforeWrite(legacyPath, \"write\");\n await assertNotSymlink(legacyPath, legacyId);\n await assertEntityContentUnchanged(deps, legacyPath, entityContent, legacyId);\n await unlink(legacyPath);\n } catch (error) {\n if (!canonicalExists && canonicalFingerprintAfterWrite !== null) {\n try {\n if ((await fingerprintPath(canonicalPath)) === canonicalFingerprintAfterWrite) {\n await assertNotSymlink(canonicalPath, canonicalId);\n await unlink(canonicalPath);\n }\n } catch {\n // Preserve the migration error when cleanup races another writer.\n }\n }\n throw error;\n }\n return { deferred: false, progressed: true };\n });\n}\n\nexport async function migrateLegacyEntityCanonicalIds(\n deps: EntityCanonicalIdMigrationDependencies,\n): Promise<string | undefined> {\n return withHeldFileLock(\n lockPath(deps),\n {\n staleMs: ENTITY_CANONICAL_ID_MIGRATION_LOCK_STALE_MS,\n maxWaitMs: ENTITY_CANONICAL_ID_MIGRATION_LOCK_MAX_WAIT_MS,\n },\n async (acquired, lock) => {\n if (!acquired) throw new Error(\"Timed out waiting for active entity canonical-id migration.\");\n await deps.validateMemoryScanRoots?.();\n await readSafeEntityEntries(deps.entitiesDir);\n // A raw-byte writer (offline sync, consolidation-undo, governance\n // restore) may have landed memory bytes this process never vetted; the\n // marker requests ONE reference-reconciliation pass (issue #2213). The\n // observed generation is RENAMED aside before the pass so a request made\n // WHILE this run scans creates a fresh marker that survives finish() —\n // and a `.consuming` file left by a crashed run still owes its pass.\n const reconcileMarkerPath = path.join(deps.stateDir, ENTITY_CANONICAL_ID_RECONCILE_MARKER);\n const consumingMarkerPath = path.join(deps.stateDir, ENTITY_CANONICAL_ID_RECONCILE_CONSUMING_MARKER);\n let reconcileRequested = await fileExists(consumingMarkerPath);\n if (await fileExists(reconcileMarkerPath)) {\n try {\n await rename(reconcileMarkerPath, consumingMarkerPath);\n reconcileRequested = true;\n } catch (error) {\n if (!isErrnoCode(error, \"ENOENT\")) throw error;\n }\n }\n let state: EntityCanonicalIdMigrationState = await readState(deps) ?? {\n version: ENTITY_CANONICAL_ID_MIGRATION_VERSION,\n complete: false,\n mappings: {},\n };\n const blocked: BlockedEntityPairs = new Map();\n const scanNotes: EntityScanNotes = { junk: new Set(), malformed: new Set() };\n // Parks for pairs whose files are GONE, tracked separately from\n // collision parks: pruneBlocked drops these (the canonical file is gone\n // too), and the rescan's blocked.clear() would otherwise silence them\n // before finish() reports anything.\n const staleParked: BlockedEntityPairs = new Map();\n // ONE aggregated line per run, not one per pair per restart: this used to\n // abort the daemon, so the operator needs the whole list and the remedy.\n const finish = async (): Promise<string | undefined> => {\n if (blocked.size > 0) {\n const pairs = [...blocked].map(([legacyId, canonicalId]) => `${legacyId} -> ${canonicalId}`).join(\", \");\n log.warn(\n `entity canonical-id migration skipped ${blocked.size} unresolvable pair(s): ${pairs}. `\n + \"Both files were kept and the legacy id still resolves; merge or delete one side to migrate it.\",\n );\n }\n if (staleParked.size > 0) {\n const pairs = [...staleParked].map(([legacyId, canonicalId]) => `${legacyId} -> ${canonicalId}`).join(\", \");\n log.warn(\n `entity canonical-id migration dropped ${staleParked.size} mapping(s) whose entity files are gone: ${pairs}. `\n + \"The stale journal entries were removed; references to those legacy ids do not resolve either way.\",\n );\n }\n warnIgnoredMacOsReplicationJunk(deps.entitiesDir, scanNotes.junk.size, (message) => {\n log.warn(`entity canonical-id migration ${message}`);\n });\n if (scanNotes.malformed.size > 0) {\n const names = [...scanNotes.malformed].sort().join(\", \");\n log.warn(\n `entity canonical-id migration skipped ${scanNotes.malformed.size} malformed entity file(s): ${names}. `\n + \"Each file was left in place; startup continues. Fix or remove the file to migrate it.\",\n );\n }\n // Every finish() path either just rewrote references (main/reconcile\n // paths), has none to rewrite (empty mappings), or observed no marker\n // (stable no-op) — so the CONSUMED generation is removed here. A fresh\n // marker written mid-run is untouched, and a crash before this point\n // leaves `.consuming` set for the next run (the rewrite is idempotent).\n if (reconcileRequested) {\n await unlink(consumingMarkerPath).catch((error: unknown) => {\n if (!isErrnoCode(error, \"ENOENT\")) throw error;\n });\n }\n // A FRESH marker written while this run scanned means bytes landed the\n // pass may not have covered. Withholding the completion fingerprint\n // makes the runner's stability check fail, so it immediately retries —\n // and the retry consumes the fresh generation. ORDER MATTERS: read the\n // fingerprint BEFORE the marker check. A marker landing after the\n // fingerprint read but before the check is caught by the check; one\n // landing after the check is absent from the returned fingerprint, so\n // the live marker mismatches the runner's cached completion and the\n // next ensure() re-invokes. Checking first left a window where the\n // fingerprint could SEAL a marker the check never saw.\n const completionFingerprint = await deps.readMigrationFingerprint?.();\n if (await fileExists(reconcileMarkerPath)) return undefined;\n if (completionFingerprint !== undefined && state.completionFingerprint !== completionFingerprint) {\n state = { ...state, complete: true, completionFingerprint };\n await publishState(deps, state);\n }\n return completionFingerprint;\n };\n /**\n * Drop blocked pairs from the working set. Discovery only refuses to\n * ADD them; a mapping persisted by an earlier run would otherwise still\n * be applied - migrating one claimant and rewriting every reference onto\n * the canonical file, i.e. picking the winner this fix exists to avoid,\n * off stale state rather than what is on disk.\n */\n /** @returns true when a park was promoted back into the mapping set. */\n const pruneBlocked = async (): Promise<boolean> => {\n const current = state;\n if (!current) return false;\n // THIS scan's verdict wins over the journal: normalization can change\n // between runs, so a stale parked target would otherwise be promoted\n // later and rewrite references onto an id that does not exist.\n let revived = false;\n const parked: Record<string, string> = { ...(current.blocked ?? {}) };\n const active: Record<string, string> = {};\n for (const [legacyId, canonicalId] of Object.entries(current.mappings)) {\n if (!blocked.has(legacyId)) active[legacyId] = canonicalId;\n }\n for (const [legacyId, canonicalId] of blocked) parked[legacyId] = canonicalId;\n // A parked pair whose legacy file is gone was resolved by keeping the\n // canonical side. The rename is moot; the reference rewrite is not, and\n // this record is the only thing that can still perform it.\n // A park survives ONLY while this scan re-establishes the collision.\n // Anything else - the scan found a real migration, or found the source\n // needs none (already canonical under a newer normalization) - makes\n // the record obsolete, and keeping it lets a later deletion promote a\n // target the entity never occupied.\n for (const [legacyId, canonicalId] of Object.entries(parked)) {\n if (blocked.has(legacyId)) continue;\n delete parked[legacyId];\n if (active[legacyId] !== undefined) continue;\n const legacyPath = deps.resolveEntityFilePath(legacyId);\n if (legacyPath !== null && (await fileExists(legacyPath))) continue;\n // Resolve the parked target through ACTIVE moves before deciding\n // its file is gone: a parked A -> B beside an active B -> C must\n // promote to A -> C and rewrite, not drop because B was moved\n // out-of-band. Only a target with no surviving file may drop.\n let target = canonicalId;\n const seenTargets = new Set<string>();\n while (active[target] !== undefined && !seenTargets.has(target)) {\n seenTargets.add(target);\n target = active[target]!;\n }\n const targetPath = deps.resolveEntityFilePath(target);\n if (targetPath === null || !(await fileExists(targetPath))) {\n staleParked.set(legacyId, canonicalId);\n continue;\n }\n active[legacyId] = target;\n revived = true;\n }\n // Reviving a whole chain at once yields A -> B -> C, and each rewrite\n // surface makes a different number of passes over it - so collapse\n // transitively before anything consumes the set.\n const collapsed = collapseMappings(active);\n // Parked targets follow ACTIVE moves only: hopping over a still-blocked\n // link would jump to an id the migration has not been allowed to reach.\n for (const [legacyId, canonicalId] of Object.entries(parked)) {\n const moved = collapsed[canonicalId];\n if (moved !== undefined && moved !== legacyId) parked[legacyId] = moved;\n }\n const same = (a: Record<string, string>, b: Record<string, string>): boolean =>\n Object.keys(a).length === Object.keys(b).length\n && Object.entries(a).every(([key, value]) => b[key] === value);\n if (same(collapsed, current.mappings) && same(parked, current.blocked ?? {})) return revived;\n // Parking/removing an active mapping mid-entity-write would land an\n // alias/activity/relationship mutation on a now-unrelated canonical\n // claimant — the reconcile pass rewrites references, it cannot move\n // a misplaced mutation. publishState serializes under the lock.\n state = { ...current, mappings: collapsed, blocked: parked };\n await publishState(deps, state);\n return revived;\n };\n const previousMappings = state.mappings;\n const collapsedMappings = collapseMappings(previousMappings);\n const mappingsChanged =\n Object.keys(collapsedMappings).length !== Object.keys(previousMappings).length\n || Object.entries(collapsedMappings).some(([legacyId, canonicalId]) =>\n previousMappings[legacyId] !== canonicalId\n );\n state = { ...state, mappings: collapsedMappings };\n for (let migrationPass = 0; migrationPass < ENTITY_MAPPING_RESCAN_MAX_PASSES; migrationPass += 1) {\n if (!(await lock.refresh())) throw new Error(\"Lost entity canonical-id migration lock.\");\n const discoveredBefore = rejectMappingCycles(\n state.mappings,\n await discoverMappings(deps, state.mappings, blocked, scanNotes),\n );\n const revivedBefore = await pruneBlocked();\n const mergedBefore = collapseMappings(mergeDiscoveredMappings(state.mappings, discoveredBefore));\n // Stable completed journal → no-op (issue #2213). Retained mappings are\n // read-compat state whose references were already rewritten (to\n // convergence) before `complete: true` was persisted, so re-running\n // `rewriteKnownReferences` here re-read the ENTIRE hot+cold+archived\n // corpus — twice — and invalidated every memory cache on EVERY\n // `ensureDirectories()`. On a write-active daemon that was a\n // self-sustaining hot loop (multi-GB/s of re-reads, caches never warm,\n // recall degraded to the fallback path). A park revived by THIS run's\n // pruneBlocked still owes its reference rewrite: it falls through to\n // the main flow below, which demotes `complete` BEFORE rewriting — so\n // a crash mid-rewrite resumes, which the old in-place rewrite did not.\n if (\n state.complete\n && Object.keys(discoveredBefore).length === 0\n && !mappingsChanged\n && !revivedBefore\n ) {\n // Stable journal, but a raw-byte writer requested reconciliation:\n // run ONE bounded rewrite pass over the retained mappings, then let\n // finish() consume the marker.\n if (reconcileRequested && Object.keys(state.mappings).length > 0) {\n const rewroteColdMemory = await rewriteKnownReferences(\n deps,\n state.mappings,\n () => lock.refresh(),\n );\n deps.invalidateKnowledgeIndexCache();\n deps.invalidateAllMemoriesCache();\n if (rewroteColdMemory) deps.invalidateColdMemoriesCache();\n deps.bumpMemoryStatusVersion();\n }\n return finish();\n }\n if (\n state.complete\n || Object.keys(discoveredBefore).length > 0\n || Object.keys(mergedBefore).length !== Object.keys(state.mappings).length\n ) {\n state = { ...state, complete: false, mappings: mergedBefore };\n await publishState(deps, state);\n }\n if (Object.keys(state.mappings).length === 0) {\n if (!(await lock.refresh())) throw new Error(\"Lost entity canonical-id migration lock.\");\n const discoveredAfter = rejectMappingCycles(\n state.mappings,\n await discoverMappings(deps, state.mappings, blocked, scanNotes),\n );\n // Reconcile before declaring completion: this rescan can resolve a\n // park (another writer removed the legacy file), and completing\n // without promoting it strands its references behind a fingerprint\n // that already reflects the deletion - so no later run revisits it.\n const revivedInRescan = await pruneBlocked();\n if (Object.keys(discoveredAfter).length === 0 && !revivedInRescan) {\n await publishState(deps, { ...state, complete: true });\n return finish();\n }\n state = {\n ...state,\n complete: false,\n mappings: collapseMappings(mergeDiscoveredMappings(state.mappings, discoveredAfter)),\n };\n await publishState(deps, state);\n continue;\n }\n let pendingMappings = Object.entries(state.mappings);\n while (pendingMappings.length > 0) {\n const deferredMappings: Array<[string, string]> = [];\n let progressed = false;\n for (const [legacyId, canonicalId] of pendingMappings) {\n const result = await migrateEntityFilePair(\n deps,\n legacyId,\n canonicalId,\n () => lock.refresh(),\n );\n if (result.blocked) blocked.set(legacyId, canonicalId);\n else if (result.deferred) deferredMappings.push([legacyId, canonicalId]);\n progressed ||= result.progressed;\n }\n if (deferredMappings.length === 0) break;\n if (!progressed) {\n // Deferred means both files are missing: no later pass can help\n // these pairs, so park them all instead of Fatal-exiting.\n for (const [legacyId, canonicalId] of deferredMappings) {\n blocked.set(legacyId, canonicalId);\n staleParked.set(legacyId, canonicalId);\n }\n break;\n }\n pendingMappings = deferredMappings;\n }\n await pruneBlocked();\n\n const rewroteColdMemory = await rewriteKnownReferences(\n deps,\n state.mappings,\n () => lock.refresh(),\n );\n deps.invalidateKnowledgeIndexCache();\n deps.invalidateAllMemoriesCache();\n if (rewroteColdMemory) deps.invalidateColdMemoriesCache();\n deps.bumpMemoryStatusVersion();\n\n if (!(await lock.refresh())) throw new Error(\"Lost entity canonical-id migration lock.\");\n const discoveredAfter = rejectMappingCycles(\n state.mappings,\n await discoverMappings(deps, state.mappings, blocked, scanNotes),\n );\n // A park resolved after the rewrite pass is promoted here, and a\n // promotion still has to be APPLIED. Completing on `discoveredAfter`\n // alone fingerprints the post-deletion corpus, so the runner never\n // retries and those references stay stranded.\n const revivedAfterRewrite = await pruneBlocked();\n if (Object.keys(discoveredAfter).length === 0 && !revivedAfterRewrite) {\n await publishState(deps, { ...state, complete: true });\n return finish();\n }\n state = {\n ...state,\n complete: false,\n mappings: collapseMappings(mergeDiscoveredMappings(state.mappings, discoveredAfter)),\n };\n await publishState(deps, state);\n }\n throw new Error(\"Entity canonical-id migration mappings changed while migration was running; retry migration.\");\n }\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,kBAAkB;AACvC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,OACK;AACP,OAAO,UAAU;AAEjB,SAAS,SAAS;AAuBlB,IAAM,wCAAwC;AAC9C,IAAM,8CAA8C;AACpD,IAAM,iDAAiD;AACvD,IAAM,0BAA0B;AAChC,IAAM,6BAA6B;AACnC,IAAM,4BAA4B;AAClC,IAAM,mCAAmC;AAEzC,IAAM,wCAAwC,EAAE,OAAO;AAAA,EACrD,SAAS,EAAE,QAAQ,qCAAqC;AAAA,EACxD,UAAU,EAAE,QAAQ;AAAA,EACpB,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AAAA,EACpC,uBAAuB,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ3C,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS;AAChD,CAAC;AAkCD,eAAe,gBAAgB,UAAmC;AAChE,MAAI;AACJ,MAAI;AACF,eAAW,MAAM,MAAM,QAAQ;AAAA,EACjC,SAAS,OAAO;AACd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