@remnic/core 9.69.86 → 9.69.88
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 +74 -67
- package/dist/access-authorization-probe.js +75 -68
- package/dist/access-boundary.js +74 -67
- package/dist/access-citation-namespace.js +2 -2
- package/dist/access-cli.js +158 -151
- package/dist/access-cli.js.map +1 -1
- package/dist/access-extraction-force-flush.d.ts.map +1 -1
- package/dist/access-extraction-force-flush.js +74 -67
- package/dist/access-http-briefing.js +75 -68
- package/dist/access-http-offline-stream.d.ts.map +1 -1
- package/dist/access-http-offline-stream.js +1 -1
- package/dist/access-http-query.js +76 -69
- package/dist/access-http.js +100 -93
- package/dist/access-identity-continuity-surface.js +74 -67
- package/dist/access-lcm-surface.js +74 -67
- package/dist/access-mcp-output-schemas.d.ts.map +1 -1
- package/dist/access-mcp-output-schemas.js +1 -1
- package/dist/access-mcp.d.ts.map +1 -1
- package/dist/access-mcp.js +89 -82
- package/dist/access-namespace-preflight.js +74 -67
- package/dist/access-observe-write-category.js +19 -13
- package/dist/access-observe-write-surface.js +74 -67
- package/dist/access-offline-manifest.js +15 -10
- package/dist/access-operations-batch.js +78 -71
- package/dist/access-operations.js +85 -78
- package/dist/access-recall-concurrency.js +74 -67
- package/dist/access-recall-diagnostics.js +4 -4
- package/dist/access-recall-response.js +74 -67
- package/dist/access-recall-surface.js +74 -67
- package/dist/access-schema.js +15 -7
- package/dist/access-service-helpers.d.ts +1 -0
- package/dist/access-service-helpers.d.ts.map +1 -1
- package/dist/access-service-helpers.js +1 -1
- package/dist/access-service.d.ts.map +1 -1
- package/dist/access-service.js +74 -67
- package/dist/access-surface-catalog.js +76 -69
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/active-recall.js +34 -28
- package/dist/active-recall.js.map +1 -1
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/{auto-sync-WEUDMXUW.js → auto-sync-U5N3CB5Y.js} +10 -10
- package/dist/background-generation.js +2 -2
- package/dist/briefing.js +18 -18
- package/dist/buffer.js +9 -8
- package/dist/calibration.js +2 -2
- package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-YO5QJ6L3.js} +2 -2
- package/dist/{capsule-merge-3MNURAQ3.js → capsule-merge-ZCXUPLNJ.js} +2 -2
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.js +21 -21
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.js +3 -3
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-JE334SIA.js → chunk-22DYJLFN.js} +2 -2
- package/dist/{chunk-DGAWEJVI.js → chunk-2DLWLNO4.js} +3 -3
- package/dist/{chunk-J3IWHCMF.js → chunk-2DT7PIDZ.js} +3 -3
- package/dist/{chunk-NKFLHW7J.js → chunk-2NAD4YCI.js} +2 -2
- package/dist/{chunk-SV72F4DS.js → chunk-2WLMWP2T.js} +2 -2
- package/dist/{chunk-IVH7INFM.js → chunk-3O5BB45T.js} +7 -7
- package/dist/{chunk-RDEUG2M2.js → chunk-3SGTV7RD.js} +6 -6
- package/dist/{chunk-QOPB6KE3.js → chunk-3TB2XQ3C.js} +2 -2
- package/dist/{chunk-C7JAUNFC.js → chunk-4KN2JLQV.js} +2 -2
- package/dist/{chunk-TIQZNDZ5.js → chunk-4MP7XR5J.js} +2 -2
- package/dist/chunk-4NSLQ7EU.js +137 -0
- package/dist/chunk-4NSLQ7EU.js.map +1 -0
- package/dist/{chunk-7DE2NOON.js → chunk-4O4XCBOS.js} +3 -3
- package/dist/{chunk-SLEAJ67D.js → chunk-4OQET73E.js} +4 -4
- package/dist/{chunk-Q3THVX75.js → chunk-4RL3JOB3.js} +2 -2
- package/dist/{chunk-GDYU6VF4.js → chunk-5AYUHSAU.js} +2 -2
- package/dist/{chunk-B47OHVFT.js → chunk-5E6RYRYW.js} +7 -7
- package/dist/{chunk-2U3R3DDH.js → chunk-5FAGCOZD.js} +9 -9
- package/dist/{chunk-CRKWSSS4.js → chunk-5MNUBT7T.js} +2 -2
- package/dist/{chunk-CK5KOVHW.js → chunk-5R627MYY.js} +3 -2
- package/dist/{chunk-CK5KOVHW.js.map → chunk-5R627MYY.js.map} +1 -1
- package/dist/chunk-5X4MXNEU.js +64 -0
- package/dist/chunk-5X4MXNEU.js.map +1 -0
- package/dist/{chunk-52II7PB6.js → chunk-645WOU5I.js} +4 -4
- package/dist/{chunk-7G6WUOLB.js → chunk-66DKTOBY.js} +2 -2
- package/dist/{chunk-AZ2X5LNA.js → chunk-6LYAEM54.js} +2 -2
- package/dist/{chunk-DUJYRVUD.js → chunk-6O2VUWV6.js} +3 -3
- package/dist/{chunk-IMAP236M.js → chunk-6UQFJULG.js} +2 -2
- package/dist/chunk-75PT4N7Q.js +75 -0
- package/dist/chunk-75PT4N7Q.js.map +1 -0
- package/dist/{chunk-2I6VHX6Q.js → chunk-76M5OK7V.js} +2 -2
- package/dist/{chunk-OEBLZZKK.js → chunk-7XG7KMIW.js} +2 -2
- package/dist/{chunk-FYAU4S6E.js → chunk-A4VSOUCB.js} +3 -3
- package/dist/{chunk-GEX5NI36.js → chunk-AE5U5NMS.js} +2 -2
- package/dist/{chunk-UNJOB4DY.js → chunk-AEHVZY3X.js} +2 -2
- package/dist/{chunk-ML2MVAEZ.js → chunk-AEU4EQGV.js} +1 -1
- package/dist/{chunk-3SG4FGDV.js → chunk-AWD36R4D.js} +5 -2
- package/dist/chunk-AWD36R4D.js.map +1 -0
- package/dist/{chunk-JVY556FW.js → chunk-AWG3TIAY.js} +2 -2
- package/dist/{chunk-JX6USXZR.js → chunk-AXC4WSF3.js} +4 -4
- package/dist/{chunk-BOUFVFV2.js → chunk-AZSGSRIM.js} +2 -2
- package/dist/{chunk-VZBW6CDG.js → chunk-B3O3IRZN.js} +1 -1
- package/dist/{chunk-4V44AA7O.js → chunk-BGI4NUAO.js} +2 -2
- package/dist/{chunk-BNPLDVM6.js → chunk-BJVO4H5C.js} +2 -2
- package/dist/{chunk-S42HZILI.js → chunk-BLVR4WYU.js} +3 -3
- package/dist/{chunk-JXMECXMF.js → chunk-BOZJD5PK.js} +2 -2
- package/dist/{chunk-6DTJBTHL.js → chunk-BUQKSQXL.js} +15 -3
- package/dist/chunk-BUQKSQXL.js.map +1 -0
- package/dist/{chunk-OWHERGF2.js → chunk-BXLOS5AJ.js} +2 -2
- package/dist/{chunk-EVBI7S4J.js → chunk-C6U57KG4.js} +4 -4
- package/dist/{chunk-RB776UH3.js → chunk-C7V3KPKJ.js} +235 -93
- package/dist/chunk-C7V3KPKJ.js.map +1 -0
- package/dist/{chunk-T4BE5KJM.js → chunk-C7ZDKWPS.js} +4 -4
- package/dist/{chunk-HKFJ3PF3.js → chunk-CRXRZA3G.js} +2 -2
- package/dist/{chunk-NMBX4D7P.js → chunk-CZJA2EQE.js} +2 -2
- package/dist/{chunk-BJX3VQWZ.js → chunk-D5BSQR63.js} +2 -2
- package/dist/{chunk-MFZACYZ6.js → chunk-DGS34QSY.js} +2 -2
- package/dist/{chunk-UVYI6VIX.js → chunk-DQEMWVMT.js} +1 -1
- package/dist/{chunk-DQISIT63.js → chunk-DZ42MDZE.js} +3 -3
- package/dist/{chunk-5ELENZTA.js → chunk-EDIH6X2P.js} +2 -2
- package/dist/{chunk-3BTFBQLO.js → chunk-EFHNFTWB.js} +49 -3
- package/dist/chunk-EFHNFTWB.js.map +1 -0
- package/dist/{chunk-C3QXITIP.js → chunk-EQUD7FP4.js} +2 -2
- package/dist/chunk-ETUZFFPU.js +218 -0
- package/dist/chunk-ETUZFFPU.js.map +1 -0
- package/dist/{chunk-YNDLCWXS.js → chunk-EZ25VE3G.js} +4 -4
- package/dist/{chunk-IA3X2Y4K.js → chunk-FJLQXMTU.js} +3 -3
- package/dist/{chunk-TY446V34.js → chunk-FKD656D2.js} +2 -2
- package/dist/{chunk-CLXTDOKV.js → chunk-FUNBJQYR.js} +2 -2
- package/dist/{chunk-CLSYE5OZ.js → chunk-G2STTRYB.js} +2 -2
- package/dist/{chunk-SQDKX4RW.js → chunk-GWM6T5EQ.js} +2 -2
- package/dist/{chunk-AXDOF4VI.js → chunk-GZDTVYK2.js} +2 -2
- package/dist/{chunk-55FCXCXJ.js → chunk-H56VY4BY.js} +7 -7
- package/dist/{chunk-OM5BIPBR.js → chunk-H5BJWPUI.js} +4 -4
- package/dist/{chunk-7QK5TUTW.js → chunk-HLB7GKGG.js} +2 -2
- package/dist/{chunk-CHDGJJV6.js → chunk-HWLIMQE2.js} +2 -2
- package/dist/{chunk-QB75LKQQ.js → chunk-IOSZHHJC.js} +34 -15
- package/dist/chunk-IOSZHHJC.js.map +1 -0
- package/dist/{chunk-NAFPHFDM.js → chunk-JNLEJE4A.js} +2 -2
- package/dist/{chunk-7UUKRS3J.js → chunk-JVPWRNHA.js} +3 -3
- package/dist/{chunk-6ET2VII7.js → chunk-JYG2334B.js} +2 -2
- package/dist/chunk-K6T33R4Q.js +535 -0
- package/dist/chunk-K6T33R4Q.js.map +1 -0
- package/dist/{chunk-2QG4SLZI.js → chunk-KF7PQ7G2.js} +2 -2
- package/dist/{chunk-WIKO4SCR.js → chunk-LHRQBMJN.js} +2 -2
- package/dist/{chunk-IFCKHPY4.js → chunk-LO4UKPKX.js} +2 -2
- package/dist/{chunk-TEV2JGU5.js → chunk-LU7E2MXE.js} +19 -19
- package/dist/{chunk-RJLV4BKR.js → chunk-LV5H6FTN.js} +2 -2
- package/dist/{chunk-IBGEHKQ6.js → chunk-LW3HKRL7.js} +3 -3
- package/dist/{chunk-3XQYM4RE.js → chunk-M6C7SOR6.js} +2 -2
- package/dist/{chunk-JN72EPOE.js → chunk-MAAL6OZV.js} +7 -7
- package/dist/chunk-MAAL6OZV.js.map +1 -0
- package/dist/{chunk-MY2PLXSM.js → chunk-MCTM4YPL.js} +2 -1
- package/dist/{chunk-MY2PLXSM.js.map → chunk-MCTM4YPL.js.map} +1 -1
- package/dist/{chunk-T4QGUXCV.js → chunk-MXCAJKMA.js} +9 -9
- package/dist/{chunk-BMYZTZ5D.js → chunk-MY7B3HYC.js} +2 -2
- package/dist/{chunk-NB3LRY4T.js → chunk-N4PYB235.js} +2 -2
- package/dist/{chunk-S3YM4SZQ.js → chunk-N7QV3CMX.js} +2 -2
- package/dist/{chunk-3GN2PEOT.js → chunk-NYKIUQL6.js} +2 -2
- package/dist/{chunk-WQZZDN5M.js → chunk-OCFXVDBZ.js} +322 -376
- package/dist/chunk-OCFXVDBZ.js.map +1 -0
- package/dist/{chunk-L2LBMKSI.js → chunk-OK52IY3W.js} +10 -10
- package/dist/{chunk-WB2I2EQK.js → chunk-P2ODTYOF.js} +2 -2
- package/dist/{chunk-RIEX7NOZ.js → chunk-PEBHPCX2.js} +2 -2
- package/dist/{chunk-VYCOJKSX.js → chunk-PO7NXNGC.js} +2 -2
- package/dist/{chunk-G6SVZWPB.js → chunk-PZX3AQLF.js} +44 -1
- package/dist/chunk-PZX3AQLF.js.map +1 -0
- package/dist/{chunk-XAITGGX5.js → chunk-Q4AUIFUA.js} +4 -4
- package/dist/{chunk-EU3N5MK3.js → chunk-QAW55ZHJ.js} +4 -4
- package/dist/{chunk-SVZWVZ7E.js → chunk-QB57WIS6.js} +101 -93
- package/dist/chunk-QB57WIS6.js.map +1 -0
- package/dist/{chunk-I4G4UWQA.js → chunk-QI2E6ISQ.js} +1 -1
- package/dist/{chunk-CK5U7JGH.js → chunk-QI7K7BZ5.js} +2 -2
- package/dist/{chunk-VTPASHTO.js → chunk-R3X2T2LP.js} +3 -3
- package/dist/{chunk-I53NAHZ4.js → chunk-RBITPCMK.js} +10 -9
- package/dist/chunk-RBITPCMK.js.map +1 -0
- package/dist/{chunk-EJPF6XDQ.js → chunk-RDJ6C7NZ.js} +3 -3
- package/dist/{chunk-C2WWQ4OR.js → chunk-RMMA44HE.js} +1 -1
- package/dist/chunk-RMMA44HE.js.map +1 -0
- package/dist/{chunk-QC56VZXC.js → chunk-S2GE2K36.js} +85 -82
- package/dist/{chunk-QC56VZXC.js.map → chunk-S2GE2K36.js.map} +1 -1
- package/dist/{chunk-2UPTRDGM.js → chunk-SCXURCVT.js} +3 -3
- package/dist/{chunk-S55WTPFJ.js → chunk-STEOT4DI.js} +20 -20
- package/dist/chunk-STEOT4DI.js.map +1 -0
- package/dist/{chunk-N3MNDVJO.js → chunk-SWBC3UER.js} +2 -2
- package/dist/{chunk-ZTHGFTMW.js → chunk-TKC5LZ43.js} +2 -2
- package/dist/chunk-TYT4TEQV.js +45 -0
- package/dist/chunk-TYT4TEQV.js.map +1 -0
- package/dist/{chunk-YRLHEEQT.js → chunk-U6VC6RP3.js} +2 -2
- package/dist/chunk-UCPGOUDZ.js +726 -0
- package/dist/chunk-UCPGOUDZ.js.map +1 -0
- package/dist/{chunk-MOQPEFLN.js → chunk-UP75KL3L.js} +2 -2
- package/dist/{chunk-D5F7TKMH.js → chunk-V4JZCTMK.js} +2 -2
- package/dist/{chunk-NAYBHNGN.js → chunk-VALKBYBN.js} +2 -2
- package/dist/{chunk-BUKK5SWA.js → chunk-VDX2J7OX.js} +2 -2
- package/dist/{chunk-H36X4NRH.js → chunk-VVX5PZFS.js} +2 -2
- package/dist/{chunk-RCQKAOOB.js → chunk-W3XXFPRI.js} +52 -52
- package/dist/{chunk-W75BBBSY.js → chunk-WKY7N3L7.js} +11 -11
- package/dist/{chunk-GZAGLCQH.js → chunk-X5SHE2O3.js} +3 -3
- package/dist/{chunk-OAOBL6OY.js → chunk-XOV7NRY5.js} +5 -5
- package/dist/{chunk-FZVROZKC.js → chunk-XVZA6VXC.js} +4 -4
- package/dist/{chunk-RGMVMVMF.js → chunk-YBA52OKG.js} +2 -1
- package/dist/chunk-YBA52OKG.js.map +1 -0
- package/dist/{chunk-IP5VLSLO.js → chunk-YJ7MW627.js} +2 -2
- package/dist/{chunk-HS75MCQF.js → chunk-YRULQW5J.js} +2 -2
- package/dist/{chunk-DINRT75P.js → chunk-YSBL7VPO.js} +2 -2
- package/dist/{chunk-QWUJWBZ5.js → chunk-Z3O53WZR.js} +2 -2
- package/dist/{chunk-KERNN6BC.js → chunk-Z5LP6ILP.js} +2 -2
- package/dist/{chunk-5FNZ3G6X.js → chunk-Z6EZCN6Z.js} +5 -5
- package/dist/chunk-ZJP66Q4I.js +48 -0
- package/dist/chunk-ZJP66Q4I.js.map +1 -0
- package/dist/{chunk-JS3S2HVG.js → chunk-ZZZ4I455.js} +2 -2
- package/dist/cli.js +122 -115
- package/dist/coding/export-okf-codegraph.js +19 -19
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compounding/engine.js +19 -19
- package/dist/config.js +34 -28
- package/dist/connectors/codex-materialize-runner.js +18 -18
- package/dist/connectors/index.js +18 -18
- package/dist/console/state.d.ts +30 -0
- package/dist/console/state.d.ts.map +1 -1
- package/dist/contradiction/index.js +7 -7
- package/dist/{contradiction-scan-5EJYRKD3.js → contradiction-scan-TAGMOUQ2.js} +3 -3
- package/dist/convergence-refresh.js +20 -20
- package/dist/corpus-watermark.js +20 -20
- package/dist/correction/correction-access-wiring.d.ts.map +1 -1
- package/dist/dashboard-runtime.js +2 -2
- package/dist/deep-recall-http-glue.js +15 -8
- package/dist/deep-recall-policy-llm.js +3 -3
- package/dist/deep-recall.js +2 -2
- package/dist/embedding-fallback.d.ts +41 -31
- package/dist/embedding-fallback.d.ts.map +1 -1
- package/dist/embedding-fallback.js +9 -1
- package/dist/embedding-generation-lock.d.ts +49 -0
- package/dist/embedding-generation-lock.d.ts.map +1 -0
- package/dist/embedding-generation-lock.js +19 -0
- package/dist/embedding-index-storage.d.ts +276 -0
- package/dist/embedding-index-storage.d.ts.map +1 -0
- package/dist/embedding-index-storage.js +28 -0
- package/dist/entity-retrieval.js +19 -19
- package/dist/event-order-recall.js +3 -3
- package/dist/explicit-capture.js +6 -6
- package/dist/external-wiki-access.js +75 -68
- package/dist/extraction-faithfulness.js +3 -3
- package/dist/extraction-judge.js +3 -3
- package/dist/extraction-liveness.d.ts +9 -0
- package/dist/extraction-liveness.d.ts.map +1 -1
- package/dist/extraction-liveness.js +2 -1
- package/dist/extraction-llm-health.d.ts +32 -0
- package/dist/extraction-llm-health.d.ts.map +1 -0
- package/dist/extraction-llm-health.js +17 -0
- package/dist/extraction-span-config.js +3 -2
- package/dist/extraction-span-materialize.js +2 -2
- package/dist/extraction.js +29 -28
- package/dist/fallback-llm.js +2 -2
- package/dist/{first-start-migration-GAT7G733.js → first-start-migration-7OATHJKB.js} +4 -4
- package/dist/{graph-edge-decay-PVKDKLQK.js → graph-edge-decay-MKIRZ762.js} +6 -6
- package/dist/graph-jsonl.js +4 -4
- package/dist/graph-snapshot.js +4 -4
- package/dist/graph.js +5 -5
- package/dist/harmonic-retrieval.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +237 -206
- package/dist/json-extract.d.ts.map +1 -1
- package/dist/json-extract.js +1 -1
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.js +5 -5
- package/dist/local-llm.d.ts.map +1 -1
- package/dist/local-llm.js +2 -2
- package/dist/location/index.js +21 -21
- package/dist/maintenance/memory-governance.js +18 -18
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +18 -18
- package/dist/maintenance/rebuild-memory-projection.js +19 -19
- package/dist/memory-browse-operations.js +75 -68
- package/dist/memory-browse.js +3 -3
- package/dist/memory-subject.js +3 -3
- package/dist/namespaces/migrate.js +19 -19
- package/dist/namespaces/search.js +4 -4
- package/dist/namespaces/storage.js +18 -18
- package/dist/offline-sync-embedding-generation.d.ts +207 -0
- package/dist/offline-sync-embedding-generation.d.ts.map +1 -0
- package/dist/offline-sync-embedding-generation.js +42 -0
- package/dist/offline-sync-embedding-generation.js.map +1 -0
- package/dist/offline-sync-exclude-globs.d.ts +15 -0
- package/dist/offline-sync-exclude-globs.d.ts.map +1 -1
- package/dist/offline-sync-exclude-globs.js +11 -3
- package/dist/offline-sync-file-io.d.ts +7 -0
- package/dist/offline-sync-file-io.d.ts.map +1 -1
- package/dist/offline-sync-file-io.js +14 -2
- package/dist/offline-sync-impression-drain.js +3 -3
- package/dist/offline-sync-runtime-state.d.ts +5 -0
- package/dist/offline-sync-runtime-state.d.ts.map +1 -0
- package/dist/offline-sync-runtime-state.js +14 -0
- package/dist/offline-sync-runtime-state.js.map +1 -0
- package/dist/offline-sync-snapshot-stream.d.ts +26 -0
- package/dist/offline-sync-snapshot-stream.d.ts.map +1 -0
- package/dist/offline-sync-snapshot-stream.js +28 -0
- package/dist/offline-sync-snapshot-stream.js.map +1 -0
- package/dist/offline-sync-upload-staging.d.ts +34 -0
- package/dist/offline-sync-upload-staging.d.ts.map +1 -0
- package/dist/offline-sync-upload-staging.js +26 -0
- package/dist/offline-sync-upload-staging.js.map +1 -0
- package/dist/offline-sync.d.ts +46 -27
- package/dist/offline-sync.d.ts.map +1 -1
- package/dist/offline-sync.js +21 -8
- package/dist/operator-doctor-corpus.js +21 -21
- package/dist/operator-toolkit.js +46 -40
- package/dist/orchestration/extraction-run.d.ts.map +1 -1
- package/dist/orchestration/maintenance.js +30 -30
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +159 -152
- package/dist/recall-navigation-operations.js +75 -68
- package/dist/recall-navigation.js +74 -67
- package/dist/recall-planner-llm.js +2 -2
- package/dist/recall-state-view-admission.js +3 -3
- package/dist/recall-why-service.js +6 -6
- package/dist/recall-why.js +3 -3
- package/dist/reconcile/manifest.js +4 -4
- package/dist/{resolution-UYJU5JUA.js → resolution-K4A3VPKZ.js} +8 -8
- package/dist/resolution-K4A3VPKZ.js.map +1 -0
- package/dist/resume-bundles.js +35 -29
- package/dist/salvage-envelope.js +5 -5
- package/dist/search/factory.js +3 -3
- package/dist/search/index.js +7 -7
- package/dist/secure-store/index.js +2 -2
- package/dist/secure-store/secure-fs.d.ts +14 -1
- package/dist/secure-store/secure-fs.d.ts.map +1 -1
- package/dist/semantic-consolidation.js +19 -19
- package/dist/semantic-rule-promotion.js +18 -18
- package/dist/semantic-rule-verifier.js +18 -18
- package/dist/source-agent-qualifier.js +23 -22
- package/dist/standup/build.js +18 -18
- package/dist/{state-ITXJKXRE.js → state-JB47KHYV.js} +2 -2
- package/dist/state-JB47KHYV.js.map +1 -0
- package/dist/storage.d.ts +9 -3
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +17 -17
- package/dist/subject-config.js +4 -4
- package/dist/summarizer.js +6 -6
- package/dist/support-passport/index.js +77 -70
- package/dist/{trace-ZFVRH4GO.js → trace-LXXCMZJA.js} +3 -3
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/capsule-import.js +3 -3
- package/dist/transfer/export-okf.js +19 -19
- package/dist/{tui-55UJMJX7.js → tui-2Z5WOV7L.js} +3 -3
- package/dist/tui-2Z5WOV7L.js.map +1 -0
- package/dist/verified-recall.js +18 -18
- package/dist/who-knows-cli.js +19 -19
- package/dist/who-knows.js +18 -18
- package/dist/write-envelope.js +4 -4
- package/package.json +2 -2
- package/src/access-extraction-force-flush.ts +15 -7
- package/src/access-http-offline-stream.ts +3 -0
- package/src/access-mcp-output-schemas.ts +1 -0
- package/src/access-mcp.ts +90 -28
- package/src/access-service-health.test.ts +41 -5
- package/src/access-service-helpers.ts +1 -0
- package/src/access-service-observe-lcm-parity.test.ts +56 -24
- package/src/access-service.ts +7 -18
- package/src/console/state.test.ts +56 -0
- package/src/console/state.ts +83 -0
- package/src/correction/correction-access-wiring.ts +36 -8
- package/src/correction/correction-classify-parse.test.ts +178 -0
- package/src/embedding-fallback.ts +325 -141
- package/src/embedding-generation-lock.ts +141 -0
- package/src/embedding-index-storage.test.ts +245 -0
- package/src/embedding-index-storage.ts +1068 -0
- package/src/extraction-liveness.ts +13 -1
- package/src/extraction-llm-health.test.ts +103 -0
- package/src/extraction-llm-health.ts +71 -0
- package/src/index.ts +3 -3
- package/src/json-extract.ts +6 -0
- package/src/local-llm-thinking.test.ts +12 -0
- package/src/local-llm.ts +1 -0
- package/src/offline-sync-embedding-generation.test.ts +2173 -0
- package/src/offline-sync-embedding-generation.ts +885 -0
- package/src/offline-sync-exclude-globs.ts +112 -0
- package/src/offline-sync-file-io.ts +48 -0
- package/src/offline-sync-runtime-state.ts +48 -0
- package/src/offline-sync-snapshot-stream.ts +99 -0
- package/src/offline-sync-upload-staging.ts +291 -0
- package/src/offline-sync.test.ts +164 -1
- package/src/offline-sync.ts +458 -453
- package/src/orchestration/extraction-run.test.ts +55 -1
- package/src/orchestration/extraction-run.ts +13 -0
- package/src/orchestrator.ts +2 -1
- package/src/secure-store/secure-fs.ts +26 -6
- package/src/storage.ts +11 -6
- package/dist/chunk-3BTFBQLO.js.map +0 -1
- package/dist/chunk-3SG4FGDV.js.map +0 -1
- package/dist/chunk-6DTJBTHL.js.map +0 -1
- package/dist/chunk-AREGMX2J.js +0 -50
- package/dist/chunk-AREGMX2J.js.map +0 -1
- package/dist/chunk-C2WWQ4OR.js.map +0 -1
- package/dist/chunk-G6SVZWPB.js.map +0 -1
- package/dist/chunk-I53NAHZ4.js.map +0 -1
- package/dist/chunk-JN72EPOE.js.map +0 -1
- package/dist/chunk-QB75LKQQ.js.map +0 -1
- package/dist/chunk-RB776UH3.js.map +0 -1
- package/dist/chunk-RGMVMVMF.js.map +0 -1
- package/dist/chunk-S55WTPFJ.js.map +0 -1
- package/dist/chunk-SVZWVZ7E.js.map +0 -1
- package/dist/chunk-WQZZDN5M.js.map +0 -1
- /package/dist/{auto-sync-WEUDMXUW.js.map → auto-sync-U5N3CB5Y.js.map} +0 -0
- /package/dist/{capsule-crypto-GWVG7LGC.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
- /package/dist/{capsule-merge-3MNURAQ3.js.map → capsule-merge-ZCXUPLNJ.js.map} +0 -0
- /package/dist/{chunk-JE334SIA.js.map → chunk-22DYJLFN.js.map} +0 -0
- /package/dist/{chunk-DGAWEJVI.js.map → chunk-2DLWLNO4.js.map} +0 -0
- /package/dist/{chunk-J3IWHCMF.js.map → chunk-2DT7PIDZ.js.map} +0 -0
- /package/dist/{chunk-NKFLHW7J.js.map → chunk-2NAD4YCI.js.map} +0 -0
- /package/dist/{chunk-SV72F4DS.js.map → chunk-2WLMWP2T.js.map} +0 -0
- /package/dist/{chunk-IVH7INFM.js.map → chunk-3O5BB45T.js.map} +0 -0
- /package/dist/{chunk-RDEUG2M2.js.map → chunk-3SGTV7RD.js.map} +0 -0
- /package/dist/{chunk-QOPB6KE3.js.map → chunk-3TB2XQ3C.js.map} +0 -0
- /package/dist/{chunk-C7JAUNFC.js.map → chunk-4KN2JLQV.js.map} +0 -0
- /package/dist/{chunk-TIQZNDZ5.js.map → chunk-4MP7XR5J.js.map} +0 -0
- /package/dist/{chunk-7DE2NOON.js.map → chunk-4O4XCBOS.js.map} +0 -0
- /package/dist/{chunk-SLEAJ67D.js.map → chunk-4OQET73E.js.map} +0 -0
- /package/dist/{chunk-Q3THVX75.js.map → chunk-4RL3JOB3.js.map} +0 -0
- /package/dist/{chunk-GDYU6VF4.js.map → chunk-5AYUHSAU.js.map} +0 -0
- /package/dist/{chunk-B47OHVFT.js.map → chunk-5E6RYRYW.js.map} +0 -0
- /package/dist/{chunk-2U3R3DDH.js.map → chunk-5FAGCOZD.js.map} +0 -0
- /package/dist/{chunk-CRKWSSS4.js.map → chunk-5MNUBT7T.js.map} +0 -0
- /package/dist/{chunk-52II7PB6.js.map → chunk-645WOU5I.js.map} +0 -0
- /package/dist/{chunk-7G6WUOLB.js.map → chunk-66DKTOBY.js.map} +0 -0
- /package/dist/{chunk-AZ2X5LNA.js.map → chunk-6LYAEM54.js.map} +0 -0
- /package/dist/{chunk-DUJYRVUD.js.map → chunk-6O2VUWV6.js.map} +0 -0
- /package/dist/{chunk-IMAP236M.js.map → chunk-6UQFJULG.js.map} +0 -0
- /package/dist/{chunk-2I6VHX6Q.js.map → chunk-76M5OK7V.js.map} +0 -0
- /package/dist/{chunk-OEBLZZKK.js.map → chunk-7XG7KMIW.js.map} +0 -0
- /package/dist/{chunk-FYAU4S6E.js.map → chunk-A4VSOUCB.js.map} +0 -0
- /package/dist/{chunk-GEX5NI36.js.map → chunk-AE5U5NMS.js.map} +0 -0
- /package/dist/{chunk-UNJOB4DY.js.map → chunk-AEHVZY3X.js.map} +0 -0
- /package/dist/{chunk-ML2MVAEZ.js.map → chunk-AEU4EQGV.js.map} +0 -0
- /package/dist/{chunk-JVY556FW.js.map → chunk-AWG3TIAY.js.map} +0 -0
- /package/dist/{chunk-JX6USXZR.js.map → chunk-AXC4WSF3.js.map} +0 -0
- /package/dist/{chunk-BOUFVFV2.js.map → chunk-AZSGSRIM.js.map} +0 -0
- /package/dist/{chunk-VZBW6CDG.js.map → chunk-B3O3IRZN.js.map} +0 -0
- /package/dist/{chunk-4V44AA7O.js.map → chunk-BGI4NUAO.js.map} +0 -0
- /package/dist/{chunk-BNPLDVM6.js.map → chunk-BJVO4H5C.js.map} +0 -0
- /package/dist/{chunk-S42HZILI.js.map → chunk-BLVR4WYU.js.map} +0 -0
- /package/dist/{chunk-JXMECXMF.js.map → chunk-BOZJD5PK.js.map} +0 -0
- /package/dist/{chunk-OWHERGF2.js.map → chunk-BXLOS5AJ.js.map} +0 -0
- /package/dist/{chunk-EVBI7S4J.js.map → chunk-C6U57KG4.js.map} +0 -0
- /package/dist/{chunk-T4BE5KJM.js.map → chunk-C7ZDKWPS.js.map} +0 -0
- /package/dist/{chunk-HKFJ3PF3.js.map → chunk-CRXRZA3G.js.map} +0 -0
- /package/dist/{chunk-NMBX4D7P.js.map → chunk-CZJA2EQE.js.map} +0 -0
- /package/dist/{chunk-BJX3VQWZ.js.map → chunk-D5BSQR63.js.map} +0 -0
- /package/dist/{chunk-MFZACYZ6.js.map → chunk-DGS34QSY.js.map} +0 -0
- /package/dist/{chunk-UVYI6VIX.js.map → chunk-DQEMWVMT.js.map} +0 -0
- /package/dist/{chunk-DQISIT63.js.map → chunk-DZ42MDZE.js.map} +0 -0
- /package/dist/{chunk-5ELENZTA.js.map → chunk-EDIH6X2P.js.map} +0 -0
- /package/dist/{chunk-C3QXITIP.js.map → chunk-EQUD7FP4.js.map} +0 -0
- /package/dist/{chunk-YNDLCWXS.js.map → chunk-EZ25VE3G.js.map} +0 -0
- /package/dist/{chunk-IA3X2Y4K.js.map → chunk-FJLQXMTU.js.map} +0 -0
- /package/dist/{chunk-TY446V34.js.map → chunk-FKD656D2.js.map} +0 -0
- /package/dist/{chunk-CLXTDOKV.js.map → chunk-FUNBJQYR.js.map} +0 -0
- /package/dist/{chunk-CLSYE5OZ.js.map → chunk-G2STTRYB.js.map} +0 -0
- /package/dist/{chunk-SQDKX4RW.js.map → chunk-GWM6T5EQ.js.map} +0 -0
- /package/dist/{chunk-AXDOF4VI.js.map → chunk-GZDTVYK2.js.map} +0 -0
- /package/dist/{chunk-55FCXCXJ.js.map → chunk-H56VY4BY.js.map} +0 -0
- /package/dist/{chunk-OM5BIPBR.js.map → chunk-H5BJWPUI.js.map} +0 -0
- /package/dist/{chunk-7QK5TUTW.js.map → chunk-HLB7GKGG.js.map} +0 -0
- /package/dist/{chunk-CHDGJJV6.js.map → chunk-HWLIMQE2.js.map} +0 -0
- /package/dist/{chunk-NAFPHFDM.js.map → chunk-JNLEJE4A.js.map} +0 -0
- /package/dist/{chunk-7UUKRS3J.js.map → chunk-JVPWRNHA.js.map} +0 -0
- /package/dist/{chunk-6ET2VII7.js.map → chunk-JYG2334B.js.map} +0 -0
- /package/dist/{chunk-2QG4SLZI.js.map → chunk-KF7PQ7G2.js.map} +0 -0
- /package/dist/{chunk-WIKO4SCR.js.map → chunk-LHRQBMJN.js.map} +0 -0
- /package/dist/{chunk-IFCKHPY4.js.map → chunk-LO4UKPKX.js.map} +0 -0
- /package/dist/{chunk-TEV2JGU5.js.map → chunk-LU7E2MXE.js.map} +0 -0
- /package/dist/{chunk-RJLV4BKR.js.map → chunk-LV5H6FTN.js.map} +0 -0
- /package/dist/{chunk-IBGEHKQ6.js.map → chunk-LW3HKRL7.js.map} +0 -0
- /package/dist/{chunk-3XQYM4RE.js.map → chunk-M6C7SOR6.js.map} +0 -0
- /package/dist/{chunk-T4QGUXCV.js.map → chunk-MXCAJKMA.js.map} +0 -0
- /package/dist/{chunk-BMYZTZ5D.js.map → chunk-MY7B3HYC.js.map} +0 -0
- /package/dist/{chunk-NB3LRY4T.js.map → chunk-N4PYB235.js.map} +0 -0
- /package/dist/{chunk-S3YM4SZQ.js.map → chunk-N7QV3CMX.js.map} +0 -0
- /package/dist/{chunk-3GN2PEOT.js.map → chunk-NYKIUQL6.js.map} +0 -0
- /package/dist/{chunk-L2LBMKSI.js.map → chunk-OK52IY3W.js.map} +0 -0
- /package/dist/{chunk-WB2I2EQK.js.map → chunk-P2ODTYOF.js.map} +0 -0
- /package/dist/{chunk-RIEX7NOZ.js.map → chunk-PEBHPCX2.js.map} +0 -0
- /package/dist/{chunk-VYCOJKSX.js.map → chunk-PO7NXNGC.js.map} +0 -0
- /package/dist/{chunk-XAITGGX5.js.map → chunk-Q4AUIFUA.js.map} +0 -0
- /package/dist/{chunk-EU3N5MK3.js.map → chunk-QAW55ZHJ.js.map} +0 -0
- /package/dist/{chunk-I4G4UWQA.js.map → chunk-QI2E6ISQ.js.map} +0 -0
- /package/dist/{chunk-CK5U7JGH.js.map → chunk-QI7K7BZ5.js.map} +0 -0
- /package/dist/{chunk-VTPASHTO.js.map → chunk-R3X2T2LP.js.map} +0 -0
- /package/dist/{chunk-EJPF6XDQ.js.map → chunk-RDJ6C7NZ.js.map} +0 -0
- /package/dist/{chunk-2UPTRDGM.js.map → chunk-SCXURCVT.js.map} +0 -0
- /package/dist/{chunk-N3MNDVJO.js.map → chunk-SWBC3UER.js.map} +0 -0
- /package/dist/{chunk-ZTHGFTMW.js.map → chunk-TKC5LZ43.js.map} +0 -0
- /package/dist/{chunk-YRLHEEQT.js.map → chunk-U6VC6RP3.js.map} +0 -0
- /package/dist/{chunk-MOQPEFLN.js.map → chunk-UP75KL3L.js.map} +0 -0
- /package/dist/{chunk-D5F7TKMH.js.map → chunk-V4JZCTMK.js.map} +0 -0
- /package/dist/{chunk-NAYBHNGN.js.map → chunk-VALKBYBN.js.map} +0 -0
- /package/dist/{chunk-BUKK5SWA.js.map → chunk-VDX2J7OX.js.map} +0 -0
- /package/dist/{chunk-H36X4NRH.js.map → chunk-VVX5PZFS.js.map} +0 -0
- /package/dist/{chunk-RCQKAOOB.js.map → chunk-W3XXFPRI.js.map} +0 -0
- /package/dist/{chunk-W75BBBSY.js.map → chunk-WKY7N3L7.js.map} +0 -0
- /package/dist/{chunk-GZAGLCQH.js.map → chunk-X5SHE2O3.js.map} +0 -0
- /package/dist/{chunk-OAOBL6OY.js.map → chunk-XOV7NRY5.js.map} +0 -0
- /package/dist/{chunk-FZVROZKC.js.map → chunk-XVZA6VXC.js.map} +0 -0
- /package/dist/{chunk-IP5VLSLO.js.map → chunk-YJ7MW627.js.map} +0 -0
- /package/dist/{chunk-HS75MCQF.js.map → chunk-YRULQW5J.js.map} +0 -0
- /package/dist/{chunk-DINRT75P.js.map → chunk-YSBL7VPO.js.map} +0 -0
- /package/dist/{chunk-QWUJWBZ5.js.map → chunk-Z3O53WZR.js.map} +0 -0
- /package/dist/{chunk-KERNN6BC.js.map → chunk-Z5LP6ILP.js.map} +0 -0
- /package/dist/{chunk-5FNZ3G6X.js.map → chunk-Z6EZCN6Z.js.map} +0 -0
- /package/dist/{chunk-JS3S2HVG.js.map → chunk-ZZZ4I455.js.map} +0 -0
- /package/dist/{contradiction-scan-5EJYRKD3.js.map → contradiction-scan-TAGMOUQ2.js.map} +0 -0
- /package/dist/{graph-edge-decay-PVKDKLQK.js.map → embedding-generation-lock.js.map} +0 -0
- /package/dist/{resolution-UYJU5JUA.js.map → embedding-index-storage.js.map} +0 -0
- /package/dist/{state-ITXJKXRE.js.map → extraction-llm-health.js.map} +0 -0
- /package/dist/{first-start-migration-GAT7G733.js.map → first-start-migration-7OATHJKB.js.map} +0 -0
- /package/dist/{tui-55UJMJX7.js.map → graph-edge-decay-MKIRZ762.js.map} +0 -0
- /package/dist/{trace-ZFVRH4GO.js.map → trace-LXXCMZJA.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/offline-sync-embedding-generation.ts"],"sourcesContent":["// Embedding-index generation semantics for offline sync (issue #3146, PR\n// #3148). Extracted from offline-sync.ts so the god-file line-count ratchet\n// does not grow when the rules gain behavior. The snapshot walker treats\n// every `state/embeddings/` shard set — or a legacy `state/embeddings.json`\n// marker — as ONE generation, in both directions:\n//\n// 1. Atomic replacement (apply side): an incoming generation is staged\n// complete, verified byte-for-byte, and published through the store's\n// single backup-swap state machine. A crash or write failure can never\n// leave a mix of the local and incoming generation on disk, and a\n// local-only shard of a replaced generation is removed by the swap, not\n// merged into the incoming set.\n// 2. Filter-to-omit, never filter-to-delete (push side): when an exclusion\n// filter removes ANY member of a local generation from a push, the\n// WHOLE generation is omitted — files and deletion metadata — and the\n// receiver keeps its copy. A filtered generation must never look\n// deleted, and a partially filtered snapshot must never look like a\n// complete generation.\nimport { createHash, randomBytes } from \"node:crypto\";\nimport { lstat, mkdir, readFile, readdir, rm, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n type EmbeddingIndexFile,\n EmbeddingIndexFileStore,\n type EmbeddingIndexIdentity,\n type EmbeddingIndexStoreIo,\n EmbeddingIndexStorageError,\n parseEmbeddingIndexDocument,\n serializeEmbeddingShard,\n shardEntriesForIndex,\n validateShardMembership,\n} from \"./embedding-index-storage.js\";\nimport {\n assertEmbeddingGenerationLockHeld,\n type EmbeddingGenerationFence,\n embeddingGenerationLockPath,\n withEmbeddingGenerationLock,\n} from \"./embedding-generation-lock.js\";\nimport type { OfflineSyncExcludeFile, OfflineSyncFileTarget } from \"./offline-sync-file-io.js\";\nimport { EMBEDDING_SHARD_FILE_PATTERN } from \"./offline-sync-runtime-state.js\";\nimport { log } from \"./logger.js\";\nimport type {\n OfflineSyncFileDeleteTarget,\n OfflineSyncFileStagingReadTarget,\n OfflineSyncFileStagingWriteTarget,\n OfflineSyncFileState,\n} from \"./offline-sync.js\";\nimport { type SafeArchiveRoot, resolveSafeArchiveTarget } from \"./transfer/fs-utils.js\";\n\nconst EMBEDDING_MARKER_BASENAME = \"embeddings.json\";\nexport const EMBEDDING_SHARD_DIR_BASENAME = \"embeddings\";\n\n/**\n * Canonical `state` dir prefix (\"state\" or \"namespaces/<ns>/state\") for a\n * path's segments, or null when the path is not canonical runtime state.\n */\nfunction canonicalStateDirPrefix(parts: string[]): string | null {\n if (parts[0] === \"state\") return \"state\";\n if (parts[0] === \"namespaces\" && parts.length >= 4 && parts[2] === \"state\") {\n return `namespaces/${parts[1]}/state`;\n }\n return null;\n}\n\n/** The sharded-generation directory when `relPath` is one of its shards. */\nexport function embeddingShardDirOf(relPath: string): string | null {\n const parts = relPath.split(\"/\");\n if (parts.length < 3) return null;\n if (!EMBEDDING_SHARD_FILE_PATTERN.test(parts[parts.length - 1] ?? \"\")) return null;\n if (parts[parts.length - 2] !== EMBEDDING_SHARD_DIR_BASENAME) return null;\n if (canonicalStateDirPrefix(parts) === null) return null;\n return parts.slice(0, -1).join(\"/\");\n}\n\n/**\n * True when `dirPath` is a canonical embeddings generation dir\n * (`state/embeddings` or `namespaces/<ns>/state/embeddings`). Encodes the\n * snapshot-field shape contract without a ReDoS-shaped literal (issue #2439).\n */\nexport function isEmbeddingGenerationDirPath(dirPath: string): boolean {\n const membership = embeddingGenerationMembership(`${dirPath}/shard-0000.json`);\n return membership !== null && membership.shardDir === dirPath;\n}\n\n/** The state dir when `relPath` is the legacy single-file marker. */\nexport function embeddingMarkerDirOf(relPath: string): string | null {\n const parts = relPath.split(\"/\");\n if ((parts[parts.length - 1] ?? \"\") !== EMBEDDING_MARKER_BASENAME) return null;\n if (canonicalStateDirPrefix(parts) === null) return null;\n return parts.slice(0, -1).join(\"/\");\n}\n\n/**\n * Membership of `relPath` in an embedding generation: shards belong to their\n * `.../embeddings` directory, the legacy marker belongs to the sibling\n * `.../embeddings` directory of its state dir.\n */\nexport function embeddingGenerationMembership(relPath: string): { kind: \"shard\" | \"marker\"; shardDir: string } | null {\n const shardDir = embeddingShardDirOf(relPath);\n if (shardDir) return { kind: \"shard\", shardDir };\n const markerDir = embeddingMarkerDirOf(relPath);\n if (markerDir) return { kind: \"marker\", shardDir: `${markerDir}/${EMBEDDING_SHARD_DIR_BASENAME}` };\n return null;\n}\n\nexport interface IncomingEmbeddingGenerations {\n /** Generation dirs with at least one incoming shard. */\n shardDirs: Set<string>;\n /** State dirs whose incoming snapshot carries the legacy marker. */\n legacyMarkerDirs: Set<string>;\n}\n\n/** Classify incoming snapshot paths into embedding generations. */\nexport function detectIncomingEmbeddingGenerations(incomingPaths: Iterable<string>): IncomingEmbeddingGenerations {\n const shardDirs = new Set<string>();\n const legacyMarkerDirs = new Set<string>();\n for (const relPath of incomingPaths) {\n const membership = embeddingGenerationMembership(relPath);\n if (!membership) continue;\n if (membership.kind === \"shard\") shardDirs.add(membership.shardDir);\n else legacyMarkerDirs.add(membership.shardDir);\n }\n return { shardDirs, legacyMarkerDirs };\n}\n\nfunction shardRelPath(shardDirRel: string, shardIndex: number): string {\n return `${shardDirRel}/shard-${String(shardIndex).padStart(4, \"0\")}.json`;\n}\n\nfunction describeIndexReadFailure(\n read: { outcome: \"absent\" } | { outcome: \"foreign\" } | { outcome: \"unreadable\"; reason: string }\n): string {\n if (read.outcome === \"unreadable\") return read.reason;\n if (read.outcome === \"foreign\") return \"unrecognized index format\";\n return \"generation document is absent\";\n}\n\nfunction sha256Hex(buffer: Buffer): string {\n return createHash(\"sha256\").update(buffer).digest(\"hex\");\n}\n\nasync function pathExists(absPath: string): Promise<boolean> {\n try {\n await lstat(absPath);\n return true;\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"ENOENT\") return false;\n throw err;\n }\n}\n\nexport interface EmbeddingGenerationTransactionIo {\n /** Storage-backed local read: hydrates unchanged shards (metadata-only\n * pulls skip their content) and decrypts secure-store files. */\n readFile?: (target: OfflineSyncFileTarget) => Promise<Buffer>;\n writeStagingFile?: (target: OfflineSyncFileStagingWriteTarget) => Promise<void>;\n readStagingFile?: (target: OfflineSyncFileStagingReadTarget) => Promise<Buffer>;\n deleteFile?: (target: OfflineSyncFileDeleteTarget) => Promise<void>;\n}\n\nexport interface EmbeddingGenerationTransactionInput {\n root: SafeArchiveRoot;\n /** The generation dir, e.g. `state/embeddings`. */\n shardDirRel: string;\n /** Incoming shard rel paths — the complete incoming sharded generation. */\n incomingShardPaths: string[];\n /** Incoming legacy marker (rel path + verified content), when the\n * incoming generation is legacy-layout. Mutually exclusive with\n * `incomingShardPaths`. */\n incomingMarker: { path: string; sha256: string; buffer: Buffer | null } | null;\n /** True when the incoming snapshot ALSO carries the legacy marker while\n * shards form the generation (mixed remote): the per-file loop then writes\n * the marker as the inert remote artifact, so this transaction must NOT\n * remove a local marker. */\n incomingMarkerPresent: boolean;\n /** Incoming shard records (sha256 for local hydration of unchanged\n * metadata-only pulls). */\n incomingShardStates: ReadonlyMap<string, OfflineSyncFileState>;\n /** Verified incoming content by rel path (absent for shards the metadata\n * hydration skipped because the local hash already matches). */\n incomingBuffers: ReadonlyMap<string, Buffer>;\n /**\n * Shared-base states (pre-census): lets the transaction re-evaluate\n * divergence against ACTUAL disk contents while holding the mutation\n * lock, instead of trusting the census taken before the lock\n * (codex P1: a daemon mutation between census and lock was discarded).\n */\n baseStates?: ReadonlyMap<string, { sha256: string }>;\n io: EmbeddingGenerationTransactionIo;\n now: number;\n}\n\nexport interface EmbeddingGenerationTransactionResult {\n shardDirRel: string;\n upserted: number;\n deleted: number;\n /** nextBase states for files the transaction published. */\n writtenStates: Map<string, OfflineSyncFileState>;\n /** nextBase paths the transaction removed (stale shards, demoted marker). */\n removedPaths: Set<string>;\n /** Paths the per-file apply loop must skip — all handled here. */\n handledPaths: Set<string>;\n /** True when the generation was deferred (not published) because the disk\n * diverged from the shared base while the lock was held. */\n deferredLocalDivergence?: boolean;\n}\n\n/**\n * Content for ONE incoming generation member: the verified incoming buffer,\n * or the LOCAL file hash-verified against the incoming record (metadata-only\n * pulls skip content whose local hash already matches — the local bytes ARE\n * the incoming content). Shared by the shard and legacy-marker branches.\n */\nasync function hydratedIncomingBuffer(\n io: EmbeddingGenerationTransactionIo,\n root: SafeArchiveRoot,\n relPath: string,\n expectedSha256: string,\n incoming: Buffer | null | undefined,\n): Promise<Buffer> {\n if (incoming) return incoming;\n const filePath = await resolveSafeArchiveTarget(root, relPath);\n const local = io.readFile\n ? await io.readFile({ root: root.abs, path: relPath, filePath })\n : await readFile(filePath);\n if (sha256Hex(local) !== expectedSha256) {\n throw new EmbeddingIndexStorageError(\n `cannot hydrate unchanged embedding index file ${relPath}: local digest does not match the incoming record; local generation preserved`,\n );\n }\n return local;\n}\n\n/**\n * Apply ONE incoming embedding generation atomically (issue #3148, round 4):\n * recover an interrupted replacement, validate the complete incoming\n * generation (legacy markers are converted to the sharded layout so the\n * one-way layout is preserved), stage it, verify the staged bytes, then\n * publish through the shared backup-swap. Any failure before the swap leaves\n * the local generation untouched; a crash in the swap gap is rolled back by\n * the store's recovery on next use.\n */\n/**\n * Enumerate and hash the ACTUAL local generation on disk (legacy marker +\n * every shard) through the configured secure IO — the fresh in-lock census\n * the stale pre-lock apply census cannot be trusted for (codex P1).\n */\n/** Scope the shared vault base to this physical embedding generation. */\nfunction baseStatesForGeneration(\n base: ReadonlyMap<string, { sha256: string }> | undefined,\n shardDirRel: string,\n): Map<string, { sha256: string }> {\n return new Map([...base ?? []].filter(([relPath]) => embeddingGenerationMembership(relPath)?.shardDir === shardDirRel));\n}\n\nasync function censusGenerationState(\n io: EmbeddingGenerationTransactionIo,\n root: SafeArchiveRoot,\n markerRel: string,\n markerAbs: string,\n shardDirAbs: string,\n shardDirRel: string,\n): Promise<Map<string, string>> {\n const census = new Map<string, string>();\n const readSha = async (relPath: string, filePath: string) =>\n sha256Hex(io.readFile ? await io.readFile({ root: root.abs, path: relPath, filePath }) : await readFile(filePath));\n if (await pathExists(markerAbs)) census.set(markerRel, await readSha(markerRel, markerAbs));\n const names = await readdir(shardDirAbs).catch((err: NodeJS.ErrnoException) => {\n if (err.code === \"ENOENT\") return [] as string[];\n throw err;\n });\n for (const name of names.filter((candidate) => EMBEDDING_SHARD_FILE_PATTERN.test(candidate)).sort()) {\n const relPath = `${shardDirRel}/${name}`;\n census.set(relPath, await readSha(relPath, path.join(shardDirAbs, name)));\n }\n return census;\n}\n\n/** Incoming member states for the divergence helper (digests as fallback). */\nfunction incomingGenerationStates(input: EmbeddingGenerationTransactionInput): { path: string; sha256: string }[] {\n const states = input.incomingShardPaths.map((relPath) => ({\n path: relPath,\n sha256: input.incomingShardStates.get(relPath)?.sha256 ?? sha256Hex(input.incomingBuffers.get(relPath) ?? Buffer.alloc(0)),\n }));\n if (input.incomingMarker) {\n states.push({ path: input.incomingMarker.path, sha256: input.incomingMarker.sha256 });\n }\n return states;\n}\n\nexport async function applyEmbeddingGenerationTransaction(\n input: EmbeddingGenerationTransactionInput\n): Promise<EmbeddingGenerationTransactionResult> {\n const { root, shardDirRel, io } = input;\n const stateDirRel = shardDirRel.slice(0, -`/${EMBEDDING_SHARD_DIR_BASENAME}`.length);\n const stateDirAbs = await resolveSafeArchiveTarget(root, stateDirRel);\n return await withEmbeddingGenerationLock(stateDirAbs, async (section) => {\n const lockPath = embeddingGenerationLockPath(stateDirAbs);\n const fence: EmbeddingGenerationFence = () => assertEmbeddingGenerationLockHeld(lockPath, section);\n const markerRel = `${stateDirRel}/${EMBEDDING_MARKER_BASENAME}`;\n const shardDirAbs = await resolveSafeArchiveTarget(root, shardDirRel);\n const markerAbs = await resolveSafeArchiveTarget(root, markerRel);\n const store = new EmbeddingIndexFileStore(\n markerAbs,\n shardDirAbs,\n await resolveSafeArchiveTarget(root, `${stateDirRel}/embedding-fallback-status.json`)\n );\n\n // 1. Close a pending rename gap (old generation restored) before staging:\n // the swap below must never build on a half-replaced generation. The\n // fixed backup path is validated first: a planted symlink (or any\n // escape) must fail closed instead of being renamed into the published\n // position or removed through. The restored target is re-resolved so a\n // symlinked restoration cannot slip past the subsequent IO.\n const backupRel = `${stateDirRel}/embeddings.pre-replace.tmp`;\n await resolveSafeArchiveTarget(root, backupRel);\n if (await store.recoverIfInterrupted(fence)) {\n await resolveSafeArchiveTarget(root, shardDirRel);\n }\n\n // Codex P1: the apply census was taken BEFORE this lock, so it may be\n // stale. Re-enumerate and hash the ACTUAL local generation through the\n // secure IO and defer the WHOLE generation when the disk no longer\n // matches the shared base — a concurrent daemon mutation must never be\n // silently discarded by the swap.\n // No shared base (fresh catch-up) = no divergence semantics to protect.\n const baseStates = baseStatesForGeneration(input.baseStates, shardDirRel);\n if (baseStates.size > 0) {\n const localCensus = await censusGenerationState(io, root, markerRel, markerAbs, shardDirAbs, shardDirRel);\n const baseArr = [...baseStates].map(([relPath, state]) => ({ path: relPath, sha256: state.sha256 }));\n const censusArr = [...localCensus].map(([relPath, sha256]) => ({ path: relPath, sha256 }));\n const deferrals = divergedEmbeddingGenerationDeferrals({\n incomingFiles: incomingGenerationStates(input),\n baseFiles: baseArr,\n currentFiles: censusArr,\n });\n const addedOrRemovedSinceBase =\n censusArr.some((member) => !baseStates.has(member.path)) ||\n baseArr.some((member) => !localCensus.has(member.path));\n if (deferrals.length > 0 || addedOrRemovedSinceBase) {\n const handled = new Set<string>(input.incomingShardPaths);\n if (input.incomingMarker) handled.add(input.incomingMarker.path);\n if (input.incomingMarkerPresent) handled.add(markerRel);\n for (const relPath of localCensus.keys()) handled.add(relPath);\n log.warn(\n `embedding generation ${shardDirRel} deferred: disk diverged from the shared base under the mutation lock (${deferrals.length > 0 ? deferrals.join(\", \") : \"generation membership changed since base\"}); nothing published, nothing removed`,\n );\n return {\n shardDirRel,\n upserted: 0,\n deleted: 0,\n writtenStates: new Map<string, OfflineSyncFileState>(),\n removedPaths: new Set<string>(),\n handledPaths: handled,\n deferredLocalDivergence: true,\n };\n }\n }\n\n const published = new Map<string, Buffer>();\n let identity: EmbeddingIndexIdentity | null = null;\n // Divergence re-evaluation happens HERE, under the lock, against real\n // disk bytes: the apply-side census may already be stale.\n // 2. Build the complete incoming generation (final rel path → plaintext\n // bytes) and validate every document BEFORE touching local state.\n if (input.incomingMarker) {\n const markerBuffer = await hydratedIncomingBuffer(\n io,\n root,\n input.incomingMarker.path,\n input.incomingMarker.sha256,\n input.incomingMarker.buffer,\n );\n const read = parseEmbeddingIndexDocument(markerBuffer.toString(\"utf-8\"));\n if (read.outcome !== \"ok\") {\n throw new EmbeddingIndexStorageError(\n `refusing incoming embedding index generation ${markerRel}: ${describeIndexReadFailure(read)}; local generation preserved`\n );\n }\n identity = { provider: read.file.provider, model: read.file.model };\n const groups = shardEntriesForIndex(read.file);\n for (const [shardIndex, entries] of groups) {\n if (Object.keys(entries).length === 0) continue;\n published.set(\n shardRelPath(shardDirRel, shardIndex),\n Buffer.from(serializeEmbeddingShard(read.file, shardIndex, entries), \"utf-8\")\n );\n }\n } else {\n for (const relPath of input.incomingShardPaths) {\n // Metadata-only pulls skip content whose local hash already matches\n // the incoming record: the LOCAL bytes ARE the incoming content, so\n // read and hash-verify them instead of failing (codex rounds 5-6).\n const state = input.incomingShardStates.get(relPath);\n const buffer = await hydratedIncomingBuffer(\n io,\n root,\n relPath,\n state?.sha256 ?? \"\",\n input.incomingBuffers.get(relPath),\n );\n const read = parseEmbeddingIndexDocument(buffer.toString(\"utf-8\"));\n if (read.outcome !== \"ok\") {\n throw new EmbeddingIndexStorageError(\n `refusing incoming embedding index shard ${relPath}: ${describeIndexReadFailure(read)}; local generation preserved`\n );\n }\n validateShardMembership(relPath.split(\"/\").pop() ?? \"\", read.file);\n const shardIdentity = { provider: read.file.provider, model: read.file.model };\n if (!identity) identity = shardIdentity;\n if (identity.provider !== shardIdentity.provider || identity.model !== shardIdentity.model) {\n throw new EmbeddingIndexStorageError(\n `refusing mixed-identity incoming embedding index generation in ${shardDirRel}: ${relPath} is ${shardIdentity.provider}/${shardIdentity.model} but the generation is ${identity.provider}/${identity.model}; local generation preserved`\n );\n }\n published.set(relPath, buffer);\n }\n if (published.size === 0) {\n throw new EmbeddingIndexStorageError(\n `incoming embedding index generation ${shardDirRel} is empty; local generation preserved`\n );\n }\n }\n\n const stagingRel = `${stateDirRel}/embeddings.staging.tmp-sync-${process.pid}-${input.now}-${randomBytes(8).toString(\"hex\")}`;\n const stagingAbs = await resolveSafeArchiveTarget(root, stagingRel);\n try {\n await mkdir(stagingAbs, { recursive: true });\n\n // 3. Stage the complete generation. With storage-backed IO the staged\n // ciphertext binds its FINAL canonical path (`aadRelPath`), so after\n // the directory swap it decrypts at the published path — a physical\n // staging-path AAD would make the published generation unreadable.\n for (const [relPath, buffer] of published) {\n const stagedRel = `${stagingRel}/${path.basename(relPath)}`;\n const stagedAbs = await resolveSafeArchiveTarget(root, stagedRel);\n const finalAbs = await resolveSafeArchiveTarget(root, relPath);\n if (io.writeStagingFile) {\n await io.writeStagingFile({\n root: root.abs,\n path: stagedRel,\n filePath: stagedAbs,\n content: buffer,\n finalAadFilePath: finalAbs,\n });\n } else {\n await writeFile(stagedAbs, buffer, { mode: 0o600 });\n }\n }\n\n // 4. Verify the staged bytes against the incoming content before the\n // published generation is touched at all.\n for (const [relPath, buffer] of published) {\n const stagedRel = `${stagingRel}/${path.basename(relPath)}`;\n const stagedAbs = await resolveSafeArchiveTarget(root, stagedRel);\n const staged = io.readStagingFile\n ? await io.readStagingFile({\n root: root.abs,\n path: stagedRel,\n filePath: stagedAbs,\n finalAadFilePath: await resolveSafeArchiveTarget(root, relPath),\n })\n : await readFile(stagedAbs);\n if (!staged.equals(buffer)) {\n throw new EmbeddingIndexStorageError(\n `staged embedding index file ${stagedRel} does not match the incoming content; local generation preserved`\n );\n }\n }\n\n // 5. Publish with the ONE swap state machine shared with persist(). The\n // old directory moves aside wholesale, so local shards absent from\n // the incoming generation are removed by the swap — never merged.\n const localShardRels = (\n await readdir(shardDirAbs).catch((err) => {\n if ((err as NodeJS.ErrnoException).code === \"ENOENT\") return [] as string[];\n throw err;\n })\n )\n .filter((name) => EMBEDDING_SHARD_FILE_PATTERN.test(name))\n .map((name) => `${shardDirRel}/${name}`)\n .sort();\n await store.publishSwappedGeneration(stagingAbs, fence);\n\n const writtenStates = new Map<string, OfflineSyncFileState>();\n for (const [relPath, buffer] of published) {\n writtenStates.set(relPath, {\n path: relPath,\n sha256: sha256Hex(buffer),\n bytes: buffer.length,\n mtimeMs: input.now,\n });\n }\n const removedPaths = new Set<string>(localShardRels.filter((rel) => !published.has(rel)));\n let deleted = removedPaths.size;\n let markerCleanupFailed = false;\n if ((await pathExists(markerAbs)) && !input.incomingMarker && !input.incomingMarkerPresent) {\n // Publication is already committed. Keep its base advancement even if\n // marker cleanup fails, retaining the marker in base for a retry.\n try {\n if (io.deleteFile) await io.deleteFile({ root: root.abs, path: markerRel, filePath: markerAbs });\n else await rm(markerAbs, { force: true });\n removedPaths.add(markerRel);\n deleted += 1;\n } catch (err) {\n markerCleanupFailed = true;\n log.warn(`embedding generation ${shardDirRel}: marker cleanup deferred after publish: ${err}`);\n }\n }\n return {\n shardDirRel,\n upserted: published.size,\n deleted,\n writtenStates,\n removedPaths,\n handledPaths: new Set([...published.keys(), ...removedPaths, ...(markerCleanupFailed ? [markerRel] : [])]),\n };\n } catch (err) {\n await rm(stagingAbs, { recursive: true, force: true }).catch(() => undefined);\n throw err;\n }\n });\n}\n\n// ---------------------------------------------------------------------------\n// Push-side whole-generation omission\n// ---------------------------------------------------------------------------\n\nexport interface EmbeddingGenerationOmissionOptions {\n rootAbs: string;\n userExcludeRegexps?: readonly RegExp[];\n excludeFile?: OfflineSyncExcludeFile;\n /** Recorded deletion-revision paths: a tombstoned member counts as a\n * generation member for omission detection even though it is absent on\n * disk (its exclusion must omit the WHOLE generation). */\n tombstonedPaths?: readonly string[];\n /**\n * Per-path push exclusion predicate (structural + node-local defaults +\n * user regexps). Defaults to the built-in default excludes + the supplied\n * user regexps, matching the walk that consumes the result.\n */\n isExcludedRelPath?: (relPath: string) => boolean;\n}\n\nexport interface EmbeddingGenerationOmission {\n /** Existing member paths omitted because their generation is partial. */\n omittedPaths: Set<string>;\n /** Generation dirs whose members are omitted (snapshot field value). */\n omittedDirs: string[];\n}\n\n/**\n * Compute the push-side whole-generation omission set: when ANY on-disk\n * member of an embedding generation is excluded by a push filter, EVERY\n * member of that generation is omitted (issue #3148, round 4).\n */\nexport async function computeOmittedEmbeddingGenerationPaths(\n options: EmbeddingGenerationOmissionOptions\n): Promise<EmbeddingGenerationOmission> {\n const omittedPaths = new Set<string>();\n const omittedDirs: string[] = [];\n const stateDirs = [\"state\"];\n let namespaceNames: string[] = [];\n try {\n namespaceNames = (await readdir(path.join(options.rootAbs, \"namespaces\"), { withFileTypes: true }))\n .filter((entry) => entry.isDirectory())\n .map((entry) => entry.name);\n } catch {\n // no namespaces\n }\n for (const ns of namespaceNames) stateDirs.push(`namespaces/${ns}/state`);\n const isExcluded = options.isExcludedRelPath ??\n ((relPath: string) =>\n matchesOfflineSyncDefaultExclude(relPath) ||\n Boolean(options.userExcludeRegexps?.some((re) => re.test(relPath))));\n\n for (const stateDir of stateDirs) {\n const markerRel = `${stateDir}/${EMBEDDING_MARKER_BASENAME}`;\n const shardDirRel = `${stateDir}/${EMBEDDING_SHARD_DIR_BASENAME}`;\n const shardDirAbs = path.join(options.rootAbs, ...shardDirRel.split(\"/\"));\n const memberRels: string[] = [];\n if (await pathExists(path.join(options.rootAbs, ...markerRel.split(\"/\")))) {\n memberRels.push(markerRel);\n }\n let shardNames: string[] = [];\n try {\n shardNames = (await readdir(shardDirAbs, { withFileTypes: true }))\n .filter((entry) => entry.isFile() && EMBEDDING_SHARD_FILE_PATTERN.test(entry.name))\n .map((entry) => entry.name);\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== \"ENOENT\") throw err;\n }\n for (const name of shardNames) memberRels.push(`${shardDirRel}/${name}`);\n // A tombstoned member is part of the generation even though it is\n // already absent on disk: its exclusion must omit the WHOLE generation,\n // not just drop its revision individually (codex round 6, XkFf).\n for (const tombstoned of options.tombstonedPaths ?? []) {\n const membership = embeddingGenerationMembership(tombstoned);\n if (membership?.shardDir === shardDirRel && !memberRels.includes(tombstoned)) {\n memberRels.push(tombstoned);\n }\n }\n if (memberRels.length === 0) continue;\n\n const excludedMembers: string[] = [];\n for (const relPath of memberRels) {\n let excluded = isExcluded(relPath);\n if (!excluded && options.excludeFile) {\n excluded = await options.excludeFile({\n root: options.rootAbs,\n path: relPath,\n filePath: path.join(options.rootAbs, ...relPath.split(\"/\")),\n });\n }\n if (excluded) excludedMembers.push(relPath);\n }\n if (excludedMembers.length === 0) continue;\n omittedDirs.push(shardDirRel);\n omittedPaths.add(shardDirRel); // skip new shards after the omission header\n for (const relPath of memberRels) omittedPaths.add(relPath);\n }\n return { omittedPaths, omittedDirs };\n}\n\n/** Reject an exclusion introduced after the snapshot header was computed. */\nexport async function assertEmbeddingGenerationStillIncluded(\n rootAbs: string, shardDirRel: string, excludeFile: OfflineSyncExcludeFile | undefined,\n isExcludedRelPath: (relPath: string) => boolean, tombstonedPaths: readonly string[],\n): Promise<void> {\n const current = await computeOmittedEmbeddingGenerationPaths({ rootAbs, excludeFile, isExcludedRelPath, tombstonedPaths });\n if (current.omittedDirs.includes(shardDirRel)) {\n throw new EmbeddingIndexStorageError(\n `embedding generation ${shardDirRel} became partially excluded during snapshot capture; retry with a fresh omission header`,\n );\n }\n}\n\n/** True when a path belongs to a generation the push omitted. */\nexport function isPathInOmittedEmbeddingGeneration(relPath: string, omittedDirs: ReadonlySet<string>): boolean {\n const membership = embeddingGenerationMembership(relPath);\n return membership !== null && omittedDirs.has(membership.shardDir);\n}\n\nexport type { EmbeddingIndexFile };\n\nimport { matchesOfflineSyncDefaultExclude } from \"./offline-sync-exclude-globs.js\";\nimport type { OfflineSyncDeletionRevision } from \"./offline-sync.js\";\n\nexport interface PushEmbeddingGenerationState {\n /** Generation dirs omitted by the push filters (snapshot header value). */\n omittedDirs: string[];\n /** All omitted member paths (walk skip set). */\n omittedPaths: Set<string>;\n /** Deletions with whole-generation suppression applied. */\n deletions: OfflineSyncDeletionRevision[];\n}\n\n/**\n * One-call push-side generation state for streaming snapshot builders: the\n * whole-generation omission set (from user regexps, excludeFile, and default\n * excludes) plus the deletion list with omitted-generation revisions\n * suppressed — including revisions for members that are already absent, so a\n * filtered generation can never be announced as deleted.\n */\nexport async function resolvePushEmbeddingGenerationState(options: {\n rootAbs: string;\n includeTranscripts: boolean;\n userExcludeRegexps?: readonly RegExp[];\n excludeFile?: OfflineSyncExcludeFile;\n deletions: readonly OfflineSyncDeletionRevision[];\n}): Promise<PushEmbeddingGenerationState> {\n const omission = await computeOmittedEmbeddingGenerationPaths({\n rootAbs: options.rootAbs,\n userExcludeRegexps: options.userExcludeRegexps,\n excludeFile: options.excludeFile,\n // RAW pre-filter tombstones: a deleted member's exclusion must omit the\n // whole generation even though the member is already absent on disk.\n tombstonedPaths: options.deletions.map((deletion) => deletion.path),\n isExcludedRelPath: (relPath) =>\n matchesOfflineSyncDefaultExclude(relPath) ||\n Boolean(options.userExcludeRegexps?.some((re) => re.test(relPath))),\n });\n const omittedDirs = new Set(omission.omittedDirs);\n const deletions = options.deletions.filter((deletion) => {\n if (matchesOfflineSyncDefaultExclude(deletion.path)) return false;\n if (options.userExcludeRegexps?.some((re) => re.test(deletion.path))) return false;\n const membership = embeddingGenerationMembership(deletion.path);\n if (membership && omittedDirs.has(membership.shardDir)) return false;\n return true;\n });\n return { omittedDirs: omission.omittedDirs, omittedPaths: omission.omittedPaths, deletions };\n}\n\n\ninterface StorageBackedIndexIoHost {\n readOfflineSyncFile(filePath: string, opts?: { aadFilePath?: string }): Promise<Buffer>;\n writeOfflineSyncStagingFile(\n filePath: string,\n content: Buffer,\n opts?: { aadFilePath?: string },\n ): Promise<void>;\n}\n\n/**\n * Daemon wiring for the index store IO backed by a StorageManager:\n * canonical-path secure reads/writes, so sync-published encrypted shards\n * decrypt in the daemon and daemon-written shards decrypt on sync. Shard\n * STAGING writes bind the FINAL published path.\n */\nexport function storageBackedIndexStoreIo(storage: StorageBackedIndexIoHost): EmbeddingIndexStoreIo {\n return {\n readUtf8: async (filePath) => (await storage.readOfflineSyncFile(filePath)).toString(\"utf-8\"),\n writeUtf8: (filePath, contents, opts) =>\n storage.writeOfflineSyncStagingFile(\n filePath,\n Buffer.from(contents, \"utf-8\"),\n opts?.finalAadFilePath === undefined ? undefined : { aadFilePath: opts.finalAadFilePath },\n ),\n };\n}\n\nexport interface EmbeddingGenerationRemovalInput {\n root: SafeArchiveRoot;\n /** The generation dir, e.g. `state/embeddings`. */\n shardDirRel: string;\n io: Pick<EmbeddingGenerationTransactionIo, \"deleteFile\" | \"readFile\">;\n /** Incoming deletion revisions by path, threaded so each removed member's\n * tombstone is recorded through the configured delete hook AFTER the\n * atomic empty publication (round 6: raw removal must not lose them). */\n deletionMtimeByPath?: ReadonlyMap<string, number>;\n now: number;\n /**\n * Shared-base states: when the live generation diverged from the base\n * (daemon indexed, added, or removed members after the census), the\n * removal DEFERS instead of erasing the local work (codex P1).\n */\n baseStates?: ReadonlyMap<string, { sha256: string }>;\n}\n\n/**\n * Remove a LOCAL embedding generation atomically because the remote deleted\n * it wholesale (every member has a deletion revision): recover first, then\n * demote the published directory through the store's single swap state\n * machine and delete the backup — a crash or delete failure can never leave\n * a partial same-identity generation serving silently missing memories.\n * The local legacy marker, when present, is removed through the same delete\n * hook the per-file path uses.\n */\nexport async function applyEmbeddingGenerationRemoval(\n input: EmbeddingGenerationRemovalInput,\n): Promise<EmbeddingGenerationTransactionResult> {\n const { root, shardDirRel, io } = input;\n const stateDirRel = shardDirRel.slice(0, -(`/${EMBEDDING_SHARD_DIR_BASENAME}`.length));\n const stateDirAbs = await resolveSafeArchiveTarget(root, stateDirRel);\n return await withEmbeddingGenerationLock(stateDirAbs, async (section) => {\n const lockPath = embeddingGenerationLockPath(stateDirAbs);\n const fence: EmbeddingGenerationFence = () => assertEmbeddingGenerationLockHeld(lockPath, section);\n const markerRel = `${stateDirRel}/${EMBEDDING_MARKER_BASENAME}`;\n const shardDirAbs = await resolveSafeArchiveTarget(root, shardDirRel);\n const markerAbs = await resolveSafeArchiveTarget(root, markerRel);\n const store = new EmbeddingIndexFileStore(\n markerAbs,\n shardDirAbs,\n await resolveSafeArchiveTarget(root, `${stateDirRel}/embedding-fallback-status.json`),\n );\n await store.recoverIfInterrupted(fence);\n\n // Codex P1: the deletion census is stale by the time the lock is held.\n // When the live generation no longer matches the shared base (daemon\n // indexed, added, or removed members), DEFER the removal — the local\n // work survives and a later sync re-evaluates with a fresh base.\n // No shared base (fresh catch-up) = no divergence semantics to protect.\n const baseStates = baseStatesForGeneration(input.baseStates, shardDirRel);\n if (baseStates.size > 0) {\n const localCensus = await censusGenerationState(io, root, markerRel, markerAbs, shardDirAbs, shardDirRel);\n const baseArr = [...baseStates].map(([relPath, state]) => ({ path: relPath, sha256: state.sha256 }));\n const censusArr = [...localCensus].map(([relPath, sha256]) => ({ path: relPath, sha256 }));\n const changedSinceBase =\n censusArr.some((member) => {\n // A MODIFIED member must also defer: removing the generation would\n // erase the daemon's rewrite, not just the remote's stale copy.\n const baseSha = baseStates.get(member.path)?.sha256;\n return baseSha === undefined || baseSha !== member.sha256;\n }) || baseArr.some((member) => !localCensus.has(member.path));\n if (changedSinceBase) {\n const removedPaths = new Set<string>([...localCensus.keys()]);\n log.warn(\n `embedding generation removal ${shardDirRel} deferred: disk diverged from the shared base under the mutation lock; local generation preserved`,\n );\n return {\n shardDirRel,\n upserted: 0,\n deleted: 0,\n writtenStates: new Map<string, OfflineSyncFileState>(),\n removedPaths,\n handledPaths: new Set(removedPaths),\n deferredLocalDivergence: true,\n };\n }\n }\n const localShardRels = (await readdir(shardDirAbs).catch((err) => {\n if ((err as NodeJS.ErrnoException).code === \"ENOENT\") return [] as string[];\n throw err;\n }))\n .filter((name) => EMBEDDING_SHARD_FILE_PATTERN.test(name))\n .map((name) => `${shardDirRel}/${name}`)\n .sort();\n await store.removePublishedGeneration(fence);\n const removedPaths = new Set(localShardRels);\n let deleted = removedPaths.size;\n const markerPresent = await pathExists(markerAbs);\n if (markerPresent) {\n removedPaths.add(markerRel);\n deleted += 1;\n }\n // Preserve the replicated tombstones through the configured hooks AFTER\n // the atomic publication: raw removal must not lose the deletion\n // revisions, or a downstream sync without base evidence retains stale\n // entries. EVERY member (shards and marker) is recorded exactly ONCE with\n // the remote revision when known, so a first hook call without a revision\n // is never overwritten by an older replicated one. The storage hook\n // tolerates already-absent paths.\n let firstError: unknown = null;\n for (const relPath of removedPaths) {\n const memberAbs = relPath === markerRel ? markerAbs : await resolveSafeArchiveTarget(root, relPath);\n const mtimeMs = input.deletionMtimeByPath?.get(relPath) ?? input.now;\n if (io.deleteFile) {\n try {\n await io.deleteFile({\n root: root.abs,\n path: relPath,\n filePath: await resolveSafeArchiveTarget(root, relPath),\n mtimeMs,\n });\n } catch (err) {\n firstError ??= err;\n log.warn(`embedding generation removal: tombstone recording failed for ${relPath}: ${err instanceof Error ? err.message : String(err)}`);\n }\n } else if (relPath === markerRel && markerPresent) {\n await rm(markerAbs, { force: true });\n }\n }\n if (firstError) throw firstError;\n return {\n shardDirRel,\n upserted: 0,\n deleted,\n writtenStates: new Map(),\n removedPaths,\n handledPaths: new Set(removedPaths),\n };\n });\n}\n\n/** Defer a whole generation when the shared remote base would erase a local change. */\nexport function divergedEmbeddingGenerationDeferrals(options: {\n incomingFiles: readonly { path: string; sha256: string }[];\n baseFiles: readonly { path: string; sha256: string }[];\n currentFiles: readonly { path: string; sha256: string }[];\n}): string[] {\n const base = new Map(options.baseFiles.map((f) => [f.path, f.sha256]));\n const current = new Map(options.currentFiles.map((f) => [f.path, f.sha256]));\n const incomingByPath = new Map(options.incomingFiles.map((f) => [f.path, f.sha256]));\n const sharedDirs = new Set(options.baseFiles.map((f) => embeddingGenerationMembership(f.path)?.shardDir));\n const conflictedDirs = new Set<string>();\n for (const relPath of new Set([...base.keys(), ...current.keys(), ...incomingByPath.keys()])) {\n const membership = embeddingGenerationMembership(relPath);\n // Without a shared generation base this is an initial remote-authoritative\n // import, not evidence of local indexing after a synchronized snapshot.\n if (!membership || !sharedDirs.has(membership.shardDir)) continue;\n const currentSha = current.get(relPath);\n if (currentSha !== base.get(relPath) && currentSha !== incomingByPath.get(relPath)) {\n conflictedDirs.add(membership.shardDir);\n }\n }\n if (conflictedDirs.size === 0) return [];\n const deferred: string[] = [];\n // Include local/base members too: an all-absent remote generation still\n // needs a concrete deferral so its removal cannot erase a local change.\n for (const relPath of new Set([...base.keys(), ...current.keys(), ...incomingByPath.keys()])) {\n const membership = embeddingGenerationMembership(relPath);\n if (membership && conflictedDirs.has(membership.shardDir)) deferred.push(relPath);\n }\n return deferred.sort((left, right) => left.localeCompare(right));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,SAAS,YAAY,mBAAmB;AACxC,SAAS,OAAO,OAAO,UAAU,SAAS,IAAI,iBAAiB;AAC/D,OAAO,UAAU;AA6BjB,IAAM,4BAA4B;AAC3B,IAAM,+BAA+B;AAM5C,SAAS,wBAAwB,OAAgC;AAC/D,MAAI,MAAM,CAAC,MAAM,QAAS,QAAO;AACjC,MAAI,MAAM,CAAC,MAAM,gBAAgB,MAAM,UAAU,KAAK,MAAM,CAAC,MAAM,SAAS;AAC1E,WAAO,cAAc,MAAM,CAAC,CAAC;AAAA,EAC/B;AACA,SAAO;AACT;AAGO,SAAS,oBAAoB,SAAgC;AAClE,QAAM,QAAQ,QAAQ,MAAM,GAAG;AAC/B,MAAI,MAAM,SAAS,EAAG,QAAO;AAC7B,MAAI,CAAC,6BAA6B,KAAK,MAAM,MAAM,SAAS,CAAC,KAAK,EAAE,EAAG,QAAO;AAC9E,MAAI,MAAM,MAAM,SAAS,CAAC,MAAM,6BAA8B,QAAO;AACrE,MAAI,wBAAwB,KAAK,MAAM,KAAM,QAAO;AACpD,SAAO,MAAM,MAAM,GAAG,EAAE,EAAE,KAAK,GAAG;AACpC;AAOO,SAAS,6BAA6B,SAA0B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eAAe,eAAe,IAAI,OAAO,GAAG;AAClF,qBAAe,IAAI,WAAW,QAAQ;AAAA,IACxC;AAAA,EACF;AACA,MAAI,eAAe,SAAS,EAAG,QAAO,CAAC;AACvC,QAAM,WAAqB,CAAC;AAG5B,aAAW,WAAW,oBAAI,IAAI,CAAC,GAAG,KAAK,KAAK,GAAG,GAAG,QAAQ,KAAK,GAAG,GAAG,eAAe,KAAK,CAAC,CAAC,GAAG;AAC5F,UAAM,aAAa,8BAA8B,OAAO;AACxD,QAAI,cAAc,eAAe,IAAI,WAAW,QAAQ,EAAG,UAAS,KAAK,OAAO;AAAA,EAClF;AACA,SAAO,SAAS,KAAK,CAAC,MAAM,UAAU,KAAK,cAAc,KAAK,CAAC;AACjE;","names":["removedPaths"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
extractJsonCandidates
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YBA52OKG.js";
|
|
4
4
|
|
|
5
5
|
// src/background-generation.ts
|
|
6
6
|
async function completeBackgroundGeneration(config, messages, fetchImpl = fetch) {
|
|
@@ -41,4 +41,4 @@ export {
|
|
|
41
41
|
completeBackgroundGeneration,
|
|
42
42
|
parseBackgroundGenerationJson
|
|
43
43
|
};
|
|
44
|
-
//# sourceMappingURL=chunk-
|
|
44
|
+
//# sourceMappingURL=chunk-KF7PQ7G2.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
PROMOTION_CANDIDATES_DEFAULT_MIN_ACCESS,
|
|
7
7
|
isSubjectGuardMode
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-PO7NXNGC.js";
|
|
9
9
|
|
|
10
10
|
// src/subject-config.ts
|
|
11
11
|
function assertObjectBlock(value, key, shape) {
|
|
@@ -52,4 +52,4 @@ function parseSubjectRuntimeConfig(cfg) {
|
|
|
52
52
|
export {
|
|
53
53
|
parseSubjectRuntimeConfig
|
|
54
54
|
};
|
|
55
|
-
//# sourceMappingURL=chunk-
|
|
55
|
+
//# sourceMappingURL=chunk-LHRQBMJN.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-B7RWBZXW.js";
|
|
4
4
|
import {
|
|
5
5
|
resolveCausalTrajectoryStoreDir
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-B3O3IRZN.js";
|
|
7
7
|
import {
|
|
8
8
|
normalizeRecallTokens
|
|
9
9
|
} from "./chunk-YCVB7X56.js";
|
|
@@ -339,4 +339,4 @@ export {
|
|
|
339
339
|
scoreStitchCandidate,
|
|
340
340
|
stitchCausalChain
|
|
341
341
|
};
|
|
342
|
-
//# sourceMappingURL=chunk-
|
|
342
|
+
//# sourceMappingURL=chunk-LO4UKPKX.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-TB6CBZ5V.js";
|
|
7
7
|
import {
|
|
8
8
|
AdapterRegistry
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Q4AUIFUA.js";
|
|
10
10
|
import {
|
|
11
11
|
maybeRespondRecallNavigation
|
|
12
12
|
} from "./chunk-ZSEFGDCI.js";
|
|
@@ -18,13 +18,13 @@ import {
|
|
|
18
18
|
} from "./chunk-3HSRWJTC.js";
|
|
19
19
|
import {
|
|
20
20
|
respondDeepRecall
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-YJ7MW627.js";
|
|
22
22
|
import {
|
|
23
23
|
handleSupportPassportOwnerHttp
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-CRXRZA3G.js";
|
|
25
25
|
import {
|
|
26
26
|
buildSupportPassportPublicRequestHandler
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-HLB7GKGG.js";
|
|
28
28
|
import {
|
|
29
29
|
handleMcpGetSse
|
|
30
30
|
} from "./chunk-SRT6SHVZ.js";
|
|
@@ -37,34 +37,34 @@ import {
|
|
|
37
37
|
processChatMessage,
|
|
38
38
|
sessionBelongsToPrincipal,
|
|
39
39
|
subscribeChatTranscript
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-IOSZHHJC.js";
|
|
41
41
|
import {
|
|
42
42
|
RelayMissionStoreError
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-3SGTV7RD.js";
|
|
44
44
|
import {
|
|
45
45
|
executeResolution,
|
|
46
46
|
isValidResolutionVerb
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-R3X2T2LP.js";
|
|
48
48
|
import {
|
|
49
49
|
handleRecallWhyHttpQuery,
|
|
50
50
|
handleRecallXrayHttpQuery
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-AZSGSRIM.js";
|
|
52
52
|
import {
|
|
53
53
|
toDottedRemnicName
|
|
54
54
|
} from "./chunk-ZQUVBZI4.js";
|
|
55
55
|
import {
|
|
56
56
|
respondOfflineManifestStream,
|
|
57
57
|
respondOfflineSnapshotStream
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-5R627MYY.js";
|
|
59
59
|
import {
|
|
60
60
|
nonEmptyQueryParam,
|
|
61
61
|
optionalNamespaceKindQueryParam,
|
|
62
62
|
optionalQueryString,
|
|
63
63
|
positiveIntQueryParam
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-GWM6T5EQ.js";
|
|
65
65
|
import {
|
|
66
66
|
respondBriefingHttp
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-CZJA2EQE.js";
|
|
68
68
|
import {
|
|
69
69
|
maybeHandleLifecycleFlush
|
|
70
70
|
} from "./chunk-2BPPGNAQ.js";
|
|
@@ -75,14 +75,14 @@ import {
|
|
|
75
75
|
authorizationProbeNamespaces,
|
|
76
76
|
authorizationProbeRequiresPrincipalNamespace,
|
|
77
77
|
probeOperationAuthorization
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-4KN2JLQV.js";
|
|
79
79
|
import {
|
|
80
80
|
getOperation,
|
|
81
81
|
resolveQueryNamespaceWritablePreflight
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-QB57WIS6.js";
|
|
83
83
|
import {
|
|
84
84
|
handleWhoKnowsHttpQuery
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-6UQFJULG.js";
|
|
86
86
|
import {
|
|
87
87
|
isTrustZoneName
|
|
88
88
|
} from "./chunk-ROBHL3GL.js";
|
|
@@ -94,10 +94,10 @@ import {
|
|
|
94
94
|
} from "./chunk-QLK3SL7Q.js";
|
|
95
95
|
import {
|
|
96
96
|
validateRequest
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-LW3HKRL7.js";
|
|
98
98
|
import {
|
|
99
99
|
peerManifestRevision
|
|
100
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-N7QV3CMX.js";
|
|
101
101
|
import {
|
|
102
102
|
assertOperationAllowed,
|
|
103
103
|
capabilityAllowsOp,
|
|
@@ -109,7 +109,7 @@ import {
|
|
|
109
109
|
OFFLINE_SYNC_APPLY_MAX_BODY_BYTES,
|
|
110
110
|
OFFLINE_SYNC_FILE_CONTENT_MAX_CHUNK_BYTES,
|
|
111
111
|
OFFLINE_SYNC_SNAPSHOT_BASE_MAX_BODY_BYTES
|
|
112
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-OCFXVDBZ.js";
|
|
113
113
|
import {
|
|
114
114
|
isDefaultReviewNamespace,
|
|
115
115
|
listPairs,
|
|
@@ -2546,7 +2546,7 @@ var EngramAccessHttpServer = class extends ReviewDeckAccessHttpBase {
|
|
|
2546
2546
|
if (req.method === "POST" && pathname === "/engram/v1/contradiction-scan") {
|
|
2547
2547
|
this.enforceTokenOp("contradiction_scan_run");
|
|
2548
2548
|
const body = await this.readJsonBody(req);
|
|
2549
|
-
const { runContradictionScan } = await import("./contradiction-scan-
|
|
2549
|
+
const { runContradictionScan } = await import("./contradiction-scan-TAGMOUQ2.js");
|
|
2550
2550
|
const principal = this.resolveRequestPrincipal(req);
|
|
2551
2551
|
const result = await runContradictionScan({
|
|
2552
2552
|
storage: this.service.storageRef,
|
|
@@ -3557,4 +3557,4 @@ export {
|
|
|
3557
3557
|
resolveDefaultAdminConsolePublicDir,
|
|
3558
3558
|
EngramAccessHttpServer
|
|
3559
3559
|
};
|
|
3560
|
-
//# sourceMappingURL=chunk-
|
|
3560
|
+
//# sourceMappingURL=chunk-LU7E2MXE.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSearchBackend
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4OQET73E.js";
|
|
4
4
|
import {
|
|
5
5
|
namespaceIdentityToken,
|
|
6
6
|
normalizeNamespaceIdentity
|
|
@@ -508,4 +508,4 @@ export {
|
|
|
508
508
|
NamespaceSearchRouter,
|
|
509
509
|
normalizeQmdResultPath
|
|
510
510
|
};
|
|
511
|
-
//# sourceMappingURL=chunk-
|
|
511
|
+
//# sourceMappingURL=chunk-LV5H6FTN.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isValidCapsuleSince
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VDX2J7OX.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-OCFXVDBZ.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-LW3HKRL7.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-5JMAGU26.js";
|
|
6
6
|
import {
|
|
7
7
|
runPostConsolidationMaterialize
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QI7K7BZ5.js";
|
|
9
9
|
import {
|
|
10
10
|
isSemanticConsolidationLlmOperator
|
|
11
11
|
} from "./chunk-G7D6GZ5J.js";
|
|
@@ -220,4 +220,4 @@ export {
|
|
|
220
220
|
buildExtensionsBlockForConsolidation,
|
|
221
221
|
materializeAfterSemanticConsolidation
|
|
222
222
|
};
|
|
223
|
-
//# sourceMappingURL=chunk-
|
|
223
|
+
//# sourceMappingURL=chunk-M6C7SOR6.js.map
|
|
@@ -120,7 +120,7 @@ function filePathAad(filePath, memoryDir) {
|
|
|
120
120
|
}
|
|
121
121
|
return Buffer.from(rel, "utf8");
|
|
122
122
|
}
|
|
123
|
-
async function readMaybeEncryptedFileBuffer(filePath, key, memoryDir) {
|
|
123
|
+
async function readMaybeEncryptedFileBuffer(filePath, key, memoryDir, opts) {
|
|
124
124
|
const buf = await readFile(filePath);
|
|
125
125
|
if (!isEncryptedFile(buf)) {
|
|
126
126
|
return buf;
|
|
@@ -130,17 +130,17 @@ async function readMaybeEncryptedFileBuffer(filePath, key, memoryDir) {
|
|
|
130
130
|
`secure-store is locked \u2014 cannot read encrypted file at ${filePath}. Run \`remnic secure-store unlock\` to decrypt.`
|
|
131
131
|
);
|
|
132
132
|
}
|
|
133
|
-
return decryptFileBodyForPath(buf, key, filePath, memoryDir);
|
|
133
|
+
return decryptFileBodyForPath(buf, key, filePath, memoryDir, opts?.aadFilePath);
|
|
134
134
|
}
|
|
135
135
|
async function readMaybeEncryptedFile(filePath, key, memoryDir) {
|
|
136
136
|
return (await readMaybeEncryptedFileBuffer(filePath, key, memoryDir)).toString("utf8");
|
|
137
137
|
}
|
|
138
138
|
async function writeMaybeEncryptedFile(filePath, content, key, options = {}, memoryDir) {
|
|
139
|
-
const { mode = 384, atomic = true } = options;
|
|
139
|
+
const { mode = 384, atomic = true, aadFilePath } = options;
|
|
140
140
|
await mkdir(path.dirname(filePath), { recursive: true });
|
|
141
141
|
let data;
|
|
142
142
|
if (key !== null) {
|
|
143
|
-
const aad = filePathAad(filePath, memoryDir);
|
|
143
|
+
const aad = aadFilePath !== void 0 ? filePathAad(aadFilePath, memoryDir) : filePathAad(filePath, memoryDir);
|
|
144
144
|
data = encryptFileBody(content, key, aad);
|
|
145
145
|
} else {
|
|
146
146
|
data = content;
|
|
@@ -347,8 +347,8 @@ async function decryptMemoryDirToPlaintext(dir, key) {
|
|
|
347
347
|
function uniqueAtomicTempPath(filePath, label) {
|
|
348
348
|
return `${filePath}.${label}-${process.pid}-${Date.now()}-${randomUUID()}`;
|
|
349
349
|
}
|
|
350
|
-
function decryptFileBodyForPath(buf, key, filePath, memoryDir) {
|
|
351
|
-
const aad = filePathAad(filePath, memoryDir);
|
|
350
|
+
function decryptFileBodyForPath(buf, key, filePath, memoryDir, aadFilePath) {
|
|
351
|
+
const aad = aadFilePath !== void 0 ? filePathAad(aadFilePath, memoryDir) : filePathAad(filePath, memoryDir);
|
|
352
352
|
try {
|
|
353
353
|
return decryptFileBody(buf, key, aad);
|
|
354
354
|
} catch (err) {
|
|
@@ -550,4 +550,4 @@ export {
|
|
|
550
550
|
migrateMemoryDirToEncrypted,
|
|
551
551
|
decryptMemoryDirToPlaintext
|
|
552
552
|
};
|
|
553
|
-
//# sourceMappingURL=chunk-
|
|
553
|
+
//# sourceMappingURL=chunk-MAAL6OZV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/secure-store/secure-fs.ts"],"sourcesContent":["/**\n * Transparent file-level encryption for the secure-store module.\n *\n * Issue #690 (PR 3/4) — storage.ts integration layer.\n *\n * This module sits between the raw filesystem and StorageManager.\n * Every memory file is either:\n * - a plain UTF-8 text file (legacy, back-compat), or\n * - a REMNIC-ENC sealed file (AES-256-GCM, see format below).\n *\n * On-disk format\n * --------------\n * Encrypted files begin with a 9-byte magic header:\n *\n * REMNIC-ENC (7 ASCII bytes)\n * VER (1 byte, currently 0x01)\n * FLAGS (1 byte, reserved, must be 0x00)\n *\n * Followed immediately by a `seal()` envelope from `cipher.ts`:\n *\n * [VERSION:1][SALT:16][IV:12][AUTHTAG:16][CIPHERTEXT:...]\n *\n * The magic header makes encrypted files sniffable without attempting\n * a full `open()` call and gives operators a clear signal that the\n * file cannot be read by opening it in an editor.\n *\n * AAD\n * ---\n * The file path relative to the memory root is bound as Associated\n * Authenticated Data (AAD) on both encrypt and decrypt. This means\n * moving or renaming an encrypted file without re-encrypting it will\n * cause auth-tag failure on the next read — the file is tied to its\n * path. Callers that move files must re-encrypt them.\n *\n * Back-compat\n * -----------\n * `readMaybeEncryptedFile` transparently handles both formats: if the\n * file does NOT start with the magic bytes, it is returned as-is (plain\n * text). This lets an operator migrate incrementally: newly-written\n * files are encrypted while existing files continue to be read in plain\n * form until `migrateMemoryDirToEncrypted` is run.\n *\n * Naming: `secure-fs.ts` (not `vault-fs.ts`) — see `kdf.ts` naming note.\n */\n\nimport { createCipheriv, createDecipheriv, randomBytes, randomUUID } from \"node:crypto\";\nimport { lstat, mkdir, open as openFile, readFile, readdir, rename, unlink, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport {\n AUTH_TAG_LENGTH,\n ENVELOPE_HEADER_SIZE,\n ENVELOPE_LAYOUT,\n ENVELOPE_SALT_LENGTH,\n ENVELOPE_VERSION,\n IV_LENGTH,\n generateSalt,\n open as openEnvelope,\n parseEnvelope,\n seal,\n} from \"./cipher.js\";\nimport { RECALL_FALLBACK_DIRS } from \"../utils/category-dir.js\";\nimport { isErrnoCode } from \"../utils/errno.js\";\n\n// ---------------------------------------------------------------------------\n// Error classes\n// ---------------------------------------------------------------------------\n\n/**\n * Thrown when a read is attempted but the keyring entry for this\n * store is absent (i.e. `secure-store unlock` has not been run\n * since the last daemon start).\n */\nexport class SecureStoreLockedError extends Error {\n constructor(message = \"secure-store is locked — run `remnic secure-store unlock` to decrypt\") {\n super(message);\n this.name = \"SecureStoreLockedError\";\n }\n}\n\n/**\n * Thrown when `open()` fails because the auth tag does not validate.\n * This covers both wrong-key and tampered-ciphertext scenarios —\n * intentionally indistinguishable from the caller's perspective.\n */\nexport class SecureStoreDecryptError extends Error {\n constructor(message = \"secure-store decryption failed — wrong key or tampered ciphertext\") {\n super(message);\n this.name = \"SecureStoreDecryptError\";\n }\n}\n\n// ---------------------------------------------------------------------------\n// Magic header\n// ---------------------------------------------------------------------------\n\n/** Magic bytes: the ASCII string \"REMNIC-ENC\" (10 bytes). */\nexport const MAGIC_BYTES = Buffer.from(\"REMNIC-ENC\", \"ascii\");\n\n/** Current on-disk version byte. */\nexport const FILE_FORMAT_VERSION = 0x01;\n\n/** Reserved flags byte — must be 0x00. */\nexport const FILE_FORMAT_FLAGS = 0x00;\n\n/** Total size of the magic header prefix (magic + version + flags). */\nexport const MAGIC_HEADER_SIZE = MAGIC_BYTES.length + 2; // 12 bytes\n\n/**\n * Exact, deterministic bytes `writeMaybeEncryptedFile` adds to an encrypted\n * file beyond its plaintext body: the magic header prefix plus the fixed\n * envelope header (version + salt + IV + auth tag). AES-256-GCM ciphertext\n * matches the plaintext length and the state-file write path applies no\n * compression, so an encrypted state file is exactly `plaintext +\n * SECURE_STORE_ENVELOPE_OVERHEAD_BYTES` on disk. Compaction reserves this so an\n * encrypted ledger lands strictly below the reader's whole-file decrypt cap\n * (issue #2033).\n */\nexport const SECURE_STORE_ENVELOPE_OVERHEAD_BYTES = MAGIC_HEADER_SIZE + ENVELOPE_HEADER_SIZE;\n\n// ---------------------------------------------------------------------------\n// Detection\n// ---------------------------------------------------------------------------\n\n/**\n * Return true iff `buf` begins with the REMNIC-ENC magic header.\n * Does not validate the envelope; just identifies the format.\n */\nexport function isEncryptedFile(buf: Uint8Array): boolean {\n if (buf.length < MAGIC_HEADER_SIZE) return false;\n const b = Buffer.isBuffer(buf) ? buf : Buffer.from(buf);\n return b.subarray(0, MAGIC_BYTES.length).equals(MAGIC_BYTES);\n}\n\ntype PositionedFileReader = {\n read: (buffer: Buffer, offset: number, length: number, position: number) => Promise<{ bytesRead: number }>;\n};\n\nasync function readPositionedPrefix(handle: PositionedFileReader, buffer: Buffer): Promise<number> {\n let bytesRead = 0;\n while (bytesRead < buffer.length) {\n const result = await handle.read(buffer, bytesRead, buffer.length - bytesRead, bytesRead);\n if (result.bytesRead === 0) break;\n bytesRead += result.bytesRead;\n }\n return bytesRead;\n}\n\n/**\n * True when the REGULAR file at `probePath` is encrypted at rest (its first\n * bytes are the REMNIC-ENC magic header). ENOENT resolves to false — an absent\n * file has nothing to probe. A symlink, FIFO, device, or any other non-regular\n * path is REFUSED with a throw rather than opened: opening a FIFO blocks until a\n * writer appears and a symlink would redirect the probe outside our tree. The\n * ledgers and per-event spills we manage are always regular files, so a\n * non-regular path is an anomaly the caller must treat as unsafe, never follow\n * (#2033). Shared by the CLI ledger recovery probe and the auto-compaction probe\n * so both enforce identical open safety.\n */\nexport async function probeEncryptedRegularFileHeader(probePath: string): Promise<boolean> {\n let entryStat;\n try {\n entryStat = await lstat(probePath);\n } catch (err) {\n if (isErrnoCode(err, \"ENOENT\")) return false;\n throw err;\n }\n if (!entryStat.isFile()) {\n throw new Error(\n `refusing to probe non-regular state path ${probePath} ` +\n `(symlink/FIFO/device); opening it could block or escape containment (#2033)`\n );\n }\n const handle = await openFile(probePath, \"r\");\n try {\n const header = Buffer.alloc(MAGIC_HEADER_SIZE);\n const bytesRead = await readPositionedPrefix(handle, header);\n return isEncryptedFile(header.subarray(0, bytesRead));\n } finally {\n await handle.close();\n }\n}\n\n// ---------------------------------------------------------------------------\n// Encrypt / decrypt file body\n// ---------------------------------------------------------------------------\n\n/**\n * Encrypt `plain` (UTF-8 content of a memory file) and return a\n * Buffer ready to write to disk.\n *\n * @param plain Plain-text file content (UTF-8 string or Buffer).\n * @param key 32-byte AES-256 key from the keyring.\n * @param aad Optional associated data — defaults to empty if omitted.\n * Callers should pass the file path relative to memoryDir\n * so the ciphertext is bound to its location.\n */\nexport function encryptFileBody(plain: string | Buffer, key: Buffer, aad?: Buffer): Buffer {\n const plainBuf = typeof plain === \"string\" ? Buffer.from(plain, \"utf8\") : plain;\n const salt = generateSalt();\n const envelope = seal(key, salt, plainBuf, aad ? { aad } : {});\n\n const header = Buffer.alloc(MAGIC_HEADER_SIZE);\n MAGIC_BYTES.copy(header, 0);\n header.writeUInt8(FILE_FORMAT_VERSION, MAGIC_BYTES.length);\n header.writeUInt8(FILE_FORMAT_FLAGS, MAGIC_BYTES.length + 1);\n\n return Buffer.concat([header, envelope]);\n}\n\n/**\n * Decrypt a buffer produced by `encryptFileBody` and return the\n * original UTF-8 content.\n *\n * Throws `SecureStoreDecryptError` on auth failure (wrong key or\n * tampered ciphertext). Throws a plain `Error` for structural problems\n * (truncated buffer, wrong magic, unsupported version).\n */\nexport function decryptFileBody(buf: Buffer, key: Buffer, aad?: Buffer): Buffer {\n if (!isEncryptedFile(buf)) {\n throw new Error(\"decryptFileBody: buffer does not start with REMNIC-ENC magic header\");\n }\n const version = buf.readUInt8(MAGIC_BYTES.length);\n if (version !== FILE_FORMAT_VERSION) {\n throw new Error(\n `decryptFileBody: unsupported file format version ${version} (this build supports ${FILE_FORMAT_VERSION})`\n );\n }\n const flags = buf.readUInt8(MAGIC_BYTES.length + 1);\n if (flags !== FILE_FORMAT_FLAGS) {\n throw new Error(`decryptFileBody: unknown flags byte 0x${flags.toString(16).padStart(2, \"0\")}`);\n }\n const envelope = buf.subarray(MAGIC_HEADER_SIZE);\n parseEnvelope(envelope);\n try {\n return openEnvelope(key, envelope, aad ? { aad } : {});\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n throw new SecureStoreDecryptError(`secure-store decryption failed: ${msg}`);\n }\n}\n\nfunction buildHeaderAad(salt: Uint8Array): Buffer {\n const out = Buffer.alloc(1 + ENVELOPE_SALT_LENGTH);\n out.writeUInt8(ENVELOPE_VERSION, 0);\n Buffer.from(salt).copy(out, 1);\n return out;\n}\n\n// ---------------------------------------------------------------------------\n// Path → AAD helper\n// ---------------------------------------------------------------------------\n\n/**\n * Build the AAD buffer for a file at `filePath` relative to\n * `memoryDir`. The AAD binds the ciphertext to its path so a\n * file cannot be silently relocated without re-encryption.\n *\n * When `memoryDir` is supplied and `filePath` is absolute, the\n * relative sub-path is used. Otherwise `filePath` is used verbatim.\n */\nexport function filePathAad(filePath: string, memoryDir?: string): Buffer {\n let rel = filePath;\n if (memoryDir && path.isAbsolute(filePath)) {\n rel = path.relative(memoryDir, filePath);\n }\n return Buffer.from(rel, \"utf8\");\n}\n\n// ---------------------------------------------------------------------------\n// High-level read / write helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Read a file from `filePath`.\n *\n * - If the file is plaintext (no magic header), return its content\n * as-is — back-compat with unencrypted stores.\n * - If the file is encrypted AND `key` is provided, decrypt and return\n * the plaintext content.\n * - If the file is encrypted AND `key` is null, throw\n * `SecureStoreLockedError`.\n *\n * @param filePath Absolute path to the file.\n * @param key 32-byte AES-256 key, or null when the store is locked.\n * @param memoryDir Memory root for path-bound AAD. Should be absolute.\n */\nexport async function readMaybeEncryptedFileBuffer(\n filePath: string,\n key: Buffer | null,\n memoryDir?: string,\n opts?: { aadFilePath?: string }\n): Promise<Buffer> {\n const buf = await readFile(filePath);\n if (!isEncryptedFile(buf)) {\n // Plain file — legacy or unencrypted store.\n return buf;\n }\n // Encrypted — key required.\n if (key === null) {\n throw new SecureStoreLockedError(\n `secure-store is locked — cannot read encrypted file at ${filePath}. Run \\`remnic secure-store unlock\\` to decrypt.`\n );\n }\n return decryptFileBodyForPath(buf, key, filePath, memoryDir, opts?.aadFilePath);\n}\n\nexport async function readMaybeEncryptedFile(\n filePath: string,\n key: Buffer | null,\n memoryDir?: string\n): Promise<string> {\n return (await readMaybeEncryptedFileBuffer(filePath, key, memoryDir)).toString(\"utf8\");\n}\n\nexport interface WriteMaybeEncryptedFileOptions {\n /**\n * File mode bits. Default 0o600 (owner read/write only).\n * Applied only on create; existing files inherit their existing mode.\n */\n mode?: number;\n /**\n * If true, write atomically via a temp file + rename (CLAUDE.md gotcha #54).\n * Default true.\n */\n atomic?: boolean;\n /**\n * ABSOLUTE final path whose canonical AAD (via {@link filePathAad})\n * replaces the physical `filePath`'s. Used by the offline-sync generation\n * transaction: staged ciphertext physically lives under a staging\n * directory but must decrypt at its FINAL published path after the\n * staging directory is swapped into place by rename. Deriving the AAD\n * from the absolute final path through the SAME filePathAad logic as\n * ordinary reads keeps write and read derivations identical on every\n * platform (POSIX and Windows separators alike). (issue #3148, round 4/5)\n */\n aadFilePath?: string;\n}\n\n/**\n * Write `content` to `filePath`.\n *\n * - If `key` is provided and non-null, encrypt the content first.\n * - If `key` is null, write the content as plain UTF-8 (unencrypted store).\n *\n * Writes atomically: content is written to a unique temp file\n * first, then renamed into place (CLAUDE.md gotcha #54 — never delete\n * before write).\n */\nexport async function writeMaybeEncryptedFile(\n filePath: string,\n content: string | Buffer,\n key: Buffer | null,\n options: WriteMaybeEncryptedFileOptions = {},\n memoryDir?: string\n): Promise<void> {\n const { mode = 0o600, atomic = true, aadFilePath } = options;\n await mkdir(path.dirname(filePath), { recursive: true });\n\n let data: Buffer | string;\n if (key !== null) {\n const aad = aadFilePath !== undefined ? filePathAad(aadFilePath, memoryDir) : filePathAad(filePath, memoryDir);\n data = encryptFileBody(content, key, aad);\n } else {\n data = content;\n }\n\n if (atomic) {\n const tempPath = uniqueAtomicTempPath(filePath, \"tmp\");\n try {\n await writeFile(tempPath, data, { mode });\n await rename(tempPath, filePath);\n } catch (err) {\n // Best-effort cleanup of the temp file.\n try {\n await unlink(tempPath);\n } catch {\n // ignore\n }\n throw err;\n }\n } else {\n await writeFile(filePath, data, { mode });\n }\n}\n\nexport async function writeMaybeEncryptedFileFromChunks(\n filePath: string,\n chunks: AsyncIterable<Buffer>,\n key: Buffer | null,\n options: WriteMaybeEncryptedFileOptions = {},\n memoryDir?: string\n): Promise<void> {\n const { mode = 0o600, atomic = true } = options;\n await mkdir(path.dirname(filePath), { recursive: true });\n const writePath = atomic ? `${filePath}.tmp-${process.pid}-${Date.now()}` : filePath;\n let completed = false;\n try {\n const handle = await openFile(writePath, \"w\", mode);\n try {\n if (key !== null) {\n const salt = generateSalt();\n const iv = randomBytes(IV_LENGTH);\n const header = Buffer.alloc(MAGIC_HEADER_SIZE + ENVELOPE_HEADER_SIZE);\n MAGIC_BYTES.copy(header, 0);\n header.writeUInt8(FILE_FORMAT_VERSION, MAGIC_BYTES.length);\n header.writeUInt8(FILE_FORMAT_FLAGS, MAGIC_BYTES.length + 1);\n const envelopeOffset = MAGIC_HEADER_SIZE;\n header.writeUInt8(ENVELOPE_VERSION, envelopeOffset + ENVELOPE_LAYOUT.version);\n salt.copy(header, envelopeOffset + ENVELOPE_LAYOUT.salt);\n iv.copy(header, envelopeOffset + ENVELOPE_LAYOUT.iv);\n await handle.write(header);\n\n const cipher = createCipheriv(\"aes-256-gcm\", key, iv, { authTagLength: AUTH_TAG_LENGTH });\n const aad = filePathAad(filePath, memoryDir);\n cipher.setAAD(Buffer.concat([buildHeaderAad(salt), aad]));\n for await (const chunk of chunks) {\n if (chunk.length === 0) continue;\n const encrypted = cipher.update(chunk);\n if (encrypted.length > 0) await handle.write(encrypted);\n }\n const final = cipher.final();\n if (final.length > 0) await handle.write(final);\n const authTag = cipher.getAuthTag();\n await handle.write(authTag, 0, authTag.length, MAGIC_HEADER_SIZE + ENVELOPE_LAYOUT.authTag);\n } else {\n for await (const chunk of chunks) {\n if (chunk.length > 0) await handle.write(chunk);\n }\n }\n } finally {\n await handle.close();\n }\n if (atomic) {\n await rename(writePath, filePath);\n }\n completed = true;\n } finally {\n if (!completed && atomic) {\n await unlink(writePath).catch(() => {});\n }\n }\n}\n\n/**\n * Stream a file through the secure-store reader without buffering the whole\n * payload. Plaintext files are passed through unchanged; encrypted files are\n * authenticated and decrypted incrementally.\n */\nexport async function* readMaybeEncryptedFileFromChunks(\n filePath: string,\n key: Buffer | null,\n memoryDir?: string,\n chunkSize = 64 * 1024\n): AsyncIterable<Buffer> {\n const handle = await openFile(filePath, \"r\");\n const headerSize = MAGIC_HEADER_SIZE + ENVELOPE_HEADER_SIZE;\n try {\n const prefix = Buffer.alloc(headerSize);\n const prefixBytes = await readPositionedPrefix(handle, prefix);\n const prefixView = prefix.subarray(0, prefixBytes);\n if (!isEncryptedFile(prefixView)) {\n if (prefixBytes > 0) yield Buffer.from(prefixView);\n let position = prefixBytes;\n const buffer = Buffer.alloc(chunkSize);\n for (;;) {\n const { bytesRead } = await handle.read(buffer, 0, buffer.length, position);\n if (bytesRead === 0) break;\n position += bytesRead;\n yield Buffer.from(buffer.subarray(0, bytesRead));\n }\n return;\n }\n if (prefixBytes < headerSize) {\n throw new Error(`encrypted file header is truncated: ${filePath}`);\n }\n if (key === null) {\n throw new SecureStoreLockedError(\n `secure-store is locked — cannot read encrypted file at ${filePath}. ` +\n \"Run `remnic secure-store unlock` to decrypt.\"\n );\n }\n const envelope = prefix.subarray(MAGIC_HEADER_SIZE);\n const version = envelope.readUInt8(ENVELOPE_LAYOUT.version);\n if (version !== ENVELOPE_VERSION) {\n throw new Error(`secure-store: unsupported envelope version ${version}`);\n }\n const salt = envelope.subarray(ENVELOPE_LAYOUT.salt, ENVELOPE_LAYOUT.salt + ENVELOPE_SALT_LENGTH);\n const iv = envelope.subarray(ENVELOPE_LAYOUT.iv, ENVELOPE_LAYOUT.iv + IV_LENGTH);\n const authTag = envelope.subarray(ENVELOPE_LAYOUT.authTag, ENVELOPE_LAYOUT.authTag + AUTH_TAG_LENGTH);\n const decipher = createDecipheriv(\"aes-256-gcm\", key, iv, { authTagLength: AUTH_TAG_LENGTH });\n decipher.setAAD(Buffer.concat([buildHeaderAad(salt), filePathAad(filePath, memoryDir)]));\n decipher.setAuthTag(authTag);\n let position = headerSize;\n const buffer = Buffer.alloc(chunkSize);\n try {\n for (;;) {\n const { bytesRead } = await handle.read(buffer, 0, buffer.length, position);\n if (bytesRead === 0) break;\n position += bytesRead;\n const plain = decipher.update(buffer.subarray(0, bytesRead));\n if (plain.length > 0) yield plain;\n }\n const final = decipher.final();\n if (final.length > 0) yield final;\n } catch (err) {\n if (err instanceof SecureStoreDecryptError) throw err;\n const message = err instanceof Error ? err.message : String(err);\n throw new SecureStoreDecryptError(`secure-store decryption failed: ${message}`);\n }\n } finally {\n await handle.close();\n }\n}\n\n// ---------------------------------------------------------------------------\n// Migration\n// ---------------------------------------------------------------------------\n\nexport interface MigrateResult {\n /** Number of files successfully encrypted. */\n encrypted: number;\n /** Number of files already encrypted (skipped). */\n skipped: number;\n /** Files that failed to encrypt (path → error message). */\n errors: Array<{ filePath: string; error: string }>;\n}\n\nexport interface DecryptResult {\n /** Number of files successfully decrypted back to plaintext. */\n decrypted: number;\n /** Number of files already plaintext (skipped). */\n skipped: number;\n /** Files that failed to decrypt (path → error message). */\n errors: Array<{ filePath: string; error: string }>;\n}\n\n/**\n * Walk `dir` recursively, find encryptable storage-managed files that are not\n * yet encrypted, and re-write them as encrypted files under `key`.\n *\n * Safety rules per CLAUDE.md gotchas #54 and #25:\n * 1. A page-version snapshot is taken (via `createVersion`) BEFORE\n * each overwrite so the plaintext version is preserved in history.\n * Since this module has no direct access to `page-versioning.ts`\n * internals, callers who have page-versioning configured should\n * pass `onBeforeEncrypt` to take the snapshot.\n * 2. The new encrypted content is written to a temp file first,\n * then renamed atomically — never deleted before written.\n * 3. If encryption of any file fails, the error is recorded and the\n * original file is left intact (partial migration is safe).\n *\n * @param dir Absolute path to the memory directory.\n * @param key 32-byte AES-256 key.\n * @param onBeforeEncrypt Optional callback invoked before encrypting\n * each file. Can be used to take page-version\n * snapshots. Errors here are non-fatal.\n */\nexport async function migrateMemoryDirToEncrypted(\n dir: string,\n key: Buffer,\n onBeforeEncrypt?: (filePath: string) => Promise<void>\n): Promise<MigrateResult> {\n const result: MigrateResult = { encrypted: 0, skipped: 0, errors: [] };\n\n const files = await collectEncryptableStorageFiles(dir);\n for (const filePath of files) {\n try {\n const buf = await readFile(filePath);\n if (isEncryptedFile(buf)) {\n result.skipped++;\n continue;\n }\n // Call optional pre-encryption hook (e.g. page-version snapshot).\n if (onBeforeEncrypt) {\n try {\n await onBeforeEncrypt(filePath);\n } catch {\n // Non-fatal — continue with encryption even if snapshot fails.\n }\n }\n const content = buf.toString(\"utf8\");\n const aad = filePathAad(filePath, dir);\n const encrypted = encryptFileBody(content, key, aad);\n\n // Atomic write: temp → rename (gotcha #54).\n const tempPath = uniqueAtomicTempPath(filePath, \"enc-tmp\");\n try {\n await writeFile(tempPath, encrypted, { mode: 0o600 });\n await rename(tempPath, filePath);\n result.encrypted++;\n } catch (writeErr) {\n // Clean up temp file, leave original intact.\n try {\n const { unlink } = await import(\"node:fs/promises\");\n await unlink(tempPath);\n } catch {\n // ignore\n }\n throw writeErr;\n }\n } catch (err) {\n result.errors.push({\n filePath,\n error: err instanceof Error ? err.message : String(err),\n });\n }\n }\n\n return result;\n}\n\n/**\n * Walk `dir` recursively, find storage-managed encrypted files, and\n * re-write them as plaintext under the same paths.\n *\n * This is the reversible counterpart to {@link migrateMemoryDirToEncrypted}.\n * It only touches files under the same storage-managed roots, skips\n * plaintext files, skips symlinks, excludes `.secure-store/`, and writes\n * each plaintext replacement via temp-file + rename so a per-file failure\n * leaves the ciphertext intact.\n */\nexport async function decryptMemoryDirToPlaintext(dir: string, key: Buffer): Promise<DecryptResult> {\n const result: DecryptResult = { decrypted: 0, skipped: 0, errors: [] };\n\n const files = await collectStorageManagedFiles(dir, isDecryptableStoragePath);\n for (const filePath of files) {\n try {\n const buf = await readFile(filePath);\n if (!isEncryptedFile(buf)) {\n result.skipped++;\n continue;\n }\n\n const plaintext = decryptFileBodyForPath(buf, key, filePath, dir);\n const tempPath = uniqueAtomicTempPath(filePath, \"dec-tmp\");\n try {\n await writeFile(tempPath, plaintext, { mode: 0o600 });\n await rename(tempPath, filePath);\n result.decrypted++;\n } catch (writeErr) {\n try {\n await unlink(tempPath);\n } catch {\n // ignore cleanup errors; original ciphertext is still intact.\n }\n throw writeErr;\n }\n } catch (err) {\n result.errors.push({\n filePath,\n error: err instanceof Error ? err.message : String(err),\n });\n }\n }\n\n return result;\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\nfunction uniqueAtomicTempPath(filePath: string, label: string): string {\n return `${filePath}.${label}-${process.pid}-${Date.now()}-${randomUUID()}`;\n}\n\nfunction decryptFileBodyForPath(\n buf: Buffer,\n key: Buffer,\n filePath: string,\n memoryDir?: string,\n aadFilePath?: string\n): Buffer {\n // A canonical-AAD stage read (offline-sync generation transaction) binds\n // the FINAL published path, not the physical staging path.\n const aad = aadFilePath !== undefined ? filePathAad(aadFilePath, memoryDir) : filePathAad(filePath, memoryDir);\n try {\n return decryptFileBody(buf, key, aad);\n } catch (err) {\n if (!(err instanceof SecureStoreDecryptError)) {\n throw err;\n }\n const legacyRoot = legacyNamespaceAadRootForFile(filePath, memoryDir);\n if (legacyRoot) {\n try {\n return decryptFileBody(buf, key, filePathAad(filePath, legacyRoot));\n } catch {\n // Fall through to the namespace-reader fallback below.\n }\n }\n\n const topLevelRoot = topLevelAadRootForNamespaceReader(filePath, memoryDir);\n if (topLevelRoot) {\n try {\n return decryptFileBody(buf, key, filePathAad(filePath, topLevelRoot));\n } catch {\n // Preserve the caller-facing error from the canonical decrypt attempt.\n }\n }\n\n throw err;\n }\n}\n\nfunction topLevelAadRootForNamespaceReader(filePath: string, memoryDir?: string): string | null {\n if (!memoryDir || !path.isAbsolute(filePath)) return null;\n const resolvedMemoryDir = path.resolve(memoryDir);\n const rel = path.relative(resolvedMemoryDir, filePath);\n if (rel === \"\" || rel.startsWith(\"..\") || path.isAbsolute(rel)) return null;\n const parts = resolvedMemoryDir.split(path.sep);\n if (parts.length < 3 || parts.at(-2) !== \"namespaces\" || !parts.at(-1)) return null;\n const topLevelRoot = parts.slice(0, -2).join(path.sep) || path.sep;\n const topRel = path.relative(topLevelRoot, filePath);\n if (topRel === \"\" || topRel.startsWith(\"..\") || path.isAbsolute(topRel)) {\n return null;\n }\n const topParts = topRel.split(path.sep);\n if (topParts[0] !== \"namespaces\" || topParts[1] !== parts.at(-1)) {\n return null;\n }\n return topLevelRoot;\n}\n\nfunction legacyNamespaceAadRootForFile(filePath: string, memoryDir?: string): string | null {\n if (!memoryDir || !path.isAbsolute(filePath)) return null;\n const rel = path.relative(memoryDir, filePath);\n if (rel === \"\" || rel.startsWith(\"..\") || path.isAbsolute(rel)) return null;\n const parts = rel.split(path.sep);\n if (parts[0] === \"namespaces\" && parts.length >= 3 && parts[1]) {\n return path.join(memoryDir, \"namespaces\", parts[1]);\n }\n return null;\n}\n\n/**\n * Recursively collect files under `dir` that are read through the\n * storage-layer secure-store helpers, excluding symlinked entries and\n * `.secure-store/` metadata.\n */\nasync function collectEncryptableStorageFiles(dir: string, rootDir = dir): Promise<string[]> {\n return collectStorageManagedFiles(dir, isEncryptableStoragePath, rootDir);\n}\n\n/**\n * Recursively collect regular files under storage-managed roots, excluding\n * symlinked entries and `.secure-store/` metadata. This broader collector is\n * used by the decrypt/disable path so future encrypted sidecars can be\n * restored without requiring extension-specific logic.\n */\nasync function collectStorageManagedFiles(\n dir: string,\n includeFile: (filePath: string, rootDir: string) => boolean,\n rootDir = dir\n): Promise<string[]> {\n const results: string[] = [];\n let scanDir = dir;\n let scanRootDir = rootDir;\n if (path.resolve(dir) === path.resolve(rootDir)) {\n const normalizedRoot = await resolveStorageManagedRootForScan(dir);\n if (!normalizedRoot) return results;\n scanDir = normalizedRoot;\n scanRootDir = normalizedRoot;\n }\n let names: string[];\n try {\n names = await readdir(scanDir, { encoding: \"utf8\" });\n } catch {\n return results;\n }\n for (const name of names) {\n if (name.startsWith(\".secure-store\")) continue;\n const full = path.join(scanDir, name);\n let isDir = false;\n let isFile = false;\n try {\n const s = await lstat(full);\n if (s.isSymbolicLink()) continue;\n isDir = s.isDirectory();\n isFile = s.isFile();\n } catch {\n continue;\n }\n if (isDir) {\n const sub = await collectStorageManagedFiles(full, includeFile, scanRootDir);\n results.push(...sub);\n } else if (isFile && includeFile(full, scanRootDir)) {\n results.push(full);\n }\n }\n return results;\n}\n\nasync function resolveStorageManagedRootForScan(dir: string): Promise<string | null> {\n const lstatPath = normalizePathForLstat(dir);\n let stat: Awaited<ReturnType<typeof lstat>>;\n try {\n stat = await lstat(lstatPath);\n } catch (error) {\n if (isFsErrorWithCode(error, \"ENOENT\")) return null;\n throw error;\n }\n if (stat.isSymbolicLink()) {\n throw new Error(`secure-store migration root must not be a symlink: ${dir}`);\n }\n if (!stat.isDirectory()) {\n throw new Error(`secure-store migration root must be a directory: ${dir}`);\n }\n return lstatPath;\n}\n\nfunction normalizePathForLstat(filePath: string): string {\n return stripTrailingPathSeparators(path.normalize(filePath));\n}\n\nfunction isFsErrorWithCode(error: unknown, code: string): boolean {\n return typeof error === \"object\" && error !== null && (error as { code?: unknown }).code === code;\n}\n\nfunction stripTrailingPathSeparators(filePath: string): string {\n const root = path.parse(filePath).root;\n let end = filePath.length;\n while (\n end > root.length &&\n (filePath[end - 1] === path.sep || filePath[end - 1] === path.posix.sep || filePath[end - 1] === path.win32.sep)\n ) {\n end -= 1;\n }\n return end === filePath.length ? filePath : filePath.slice(0, end);\n}\n\nfunction isEncryptableStoragePath(filePath: string, rootDir: string): boolean {\n const rel = path.relative(rootDir, filePath);\n if (rel === \"\" || rel.startsWith(\"..\") || path.isAbsolute(rel)) return false;\n const normalized = normalizeStorageRelativePath(rel);\n if (normalized === \"profile.md\") return true;\n if (isEncryptableStateSidecar(normalized)) return true;\n if (isEncryptableSummarySidecar(normalized)) return true;\n const firstSegment = normalized.split(\"/\", 1)[0];\n return ENCRYPTABLE_MARKDOWN_STORAGE_ROOTS.has(firstSegment) && normalized.endsWith(\".md\");\n}\n\nfunction isDecryptableStoragePath(filePath: string, rootDir: string): boolean {\n if (isEncryptableStoragePath(filePath, rootDir)) return true;\n const rel = path.relative(rootDir, filePath);\n if (rel === \"\" || rel.startsWith(\"..\") || path.isAbsolute(rel)) return false;\n const normalized = normalizeStorageRelativePath(rel);\n const firstSegment = normalized.split(\"/\", 1)[0];\n return DECRYPTABLE_SIDECAR_ROOTS.has(firstSegment);\n}\n\nfunction normalizeStorageRelativePath(rel: string): string {\n const normalized = rel.split(path.sep).join(\"/\");\n const parts = normalized.split(\"/\");\n if (parts[0] === \"namespaces\" && parts.length >= 3) {\n return parts.slice(2).join(\"/\");\n }\n return normalized;\n}\n\n// Every recall MEMORY category directory (facts/ + the CATEGORY_DIR_MAP memory\n// dirs) must be encryptable at rest — #1546 routes decision/preference/moment/...\n// memories into their own dirs, so hardcoding only facts/corrections/procedures/\n// reasoning-traces would silently write those categories in plaintext on\n// encrypted stores. RECALL_FALLBACK_DIRS is the single source of truth for that\n// set; the extra non-category markdown roots (artifacts/archive/entities/\n// identity) are appended.\n//\n// questions/ is deliberately EXCLUDED (RECALL_FALLBACK_DIRS omits the non-memory\n// queue dirs): the question queue is written/resolved through plain readFile/\n// writeFile (StorageManager.writeQuestion/resolveQuestion), NOT the secure-file\n// helpers. Encrypting questions/ here would make migration seal those files,\n// after which resolveQuestion() would read ciphertext as UTF-8, fail to update\n// the frontmatter, and overwrite/corrupt the file while returning success\n// (codex #1563 review). Keeping questions/ plaintext preserves the queue's\n// existing behavior; #1546 does not change question encryption.\nconst ENCRYPTABLE_MARKDOWN_STORAGE_ROOTS = new Set<string>([\n ...RECALL_FALLBACK_DIRS,\n \"artifacts\",\n \"archive\",\n \"entities\",\n \"identity\",\n]);\n\nconst ENCRYPTABLE_STATE_SIDECARS = new Set([\n \"state/behavior-signals.jsonl\",\n \"state/buffer-surprise-ledger.jsonl\",\n \"state/buffer.json\",\n \"state/compression-guideline-draft-state.json\",\n \"state/compression-guideline-state.json\",\n \"state/compression-guidelines.draft.md\",\n \"state/compression-guidelines.md\",\n \"state/entity-synthesis-queue.json\",\n \"state/fact-hashes.txt\",\n \"state/memory-actions.jsonl\",\n \"state/memory-lifecycle-ledger.jsonl\",\n \"state/meta.json\",\n \"state/reextract-jobs.jsonl\",\n \"state/topics.json\",\n]);\n\nfunction isEncryptableStateSidecar(normalized: string): boolean {\n return ENCRYPTABLE_STATE_SIDECARS.has(normalized);\n}\n\nfunction isEncryptableSummarySidecar(normalized: string): boolean {\n return normalized.startsWith(\"summaries/\") && normalized.endsWith(\".json\");\n}\n\nconst DECRYPTABLE_SIDECAR_ROOTS = new Set([\"state\", \"indexes\", \"index\", \"provenance\"]);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6CA,SAAS,gBAAgB,kBAAkB,aAAa,kBAAkB;AAC1E,SAAS,OAAO,OAAO,QAAQ,UAAU,UAAU,SAAS,QAAQ,QAAQ,iBAAiB;AAC7F,OAAO,UAAU;AA0BV,IAAM,yBAAN,cAAqC,MAAM;AAAA,EAChD,YAAY,UAAU,6EAAwE;AAC5F,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAOO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EACjD,YAAY,UAAU,0EAAqE;AACzF,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAOO,IAAM,cAAc,OAAO,KAAK,cAAc,OAAO;AAGrD,IAAM,sBAAsB;AAG5B,IAAM,oBAAoB;AAG1B,IAAM,oBAAoB,YAAY,SAAS;AAY/C,IAAM,uCAAuC,oBAAoB;AAUjE,SAAS,gBAAgB,KAA0B;AACxD,MAAI,IAAI,SAAS,kBAAmB,QAAO;AAC3C,QAAM,IAAI,OAAO,SAAS,GAAG,IAAI,MAAM,OAAO,KAAK,GAAG;AACtD,SAAO,EAAE,SAAS,GAAG,YAAY,MAAM,EAAE,OAAO,WAAW;AAC7D;AAMA,eAAe,qBAAqB,QAA8B,QAAiC;AACjG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M,UAAU,GAAG;AAClD,WAAO,MAAM,MAAM,CAAC,EAAE,KAAK,GAAG;AAAA,EAChC;AACA,SAAO;AACT;AAkBA,IAAM,qCAAqC,oBAAI,IAAY;AAAA,EACzD,GAAG;AAAA,EACH;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,6BAA6B,oBAAI,IAAI;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,SAAS,0BAA0B,YAA6B;AAC9D,SAAO,2BAA2B,IAAI,UAAU;AAClD;AAEA,SAAS,4BAA4B,YAA6B;AAChE,SAAO,WAAW,WAAW,YAAY,KAAK,WAAW,SAAS,OAAO;AAC3E;AAEA,IAAM,4BAA4B,oBAAI,IAAI,CAAC,SAAS,WAAW,SAAS,YAAY,CAAC;","names":["position","buffer","unlink"]}
|
|
@@ -551,6 +551,7 @@ var TOOL_OUTPUT_SCHEMAS = {
|
|
|
551
551
|
maintenanceLedgerTail: T_ARRAY,
|
|
552
552
|
qmdProbe: T_OBJECT,
|
|
553
553
|
daemon: T_OBJECT,
|
|
554
|
+
embeddingIndex: T_OBJECT,
|
|
554
555
|
errors: T_ARRAY
|
|
555
556
|
}),
|
|
556
557
|
dreams_status: objectSchema({ phases: T_OBJECT, windowStart: T_STRING, windowEnd: T_STRING }),
|
|
@@ -630,4 +631,4 @@ function applyToolOutputSchemas(tools, canonicalPrefix, legacyPrefix) {
|
|
|
630
631
|
export {
|
|
631
632
|
applyToolOutputSchemas
|
|
632
633
|
};
|
|
633
|
-
//# sourceMappingURL=chunk-
|
|
634
|
+
//# sourceMappingURL=chunk-MCTM4YPL.js.map
|