@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
|
@@ -2,24 +2,61 @@ import {
|
|
|
2
2
|
DEFAULT_TRANSFER_EXCLUDE_DIRS
|
|
3
3
|
} from "./chunk-UI3NYK34.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
cleanupOfflineUpload,
|
|
6
|
+
digestOfflineUploadStagingContent,
|
|
7
|
+
hashText,
|
|
8
|
+
pruneOfflineUploadStaging,
|
|
9
|
+
writeOfflineUploadChunk,
|
|
10
|
+
writeSafeFileFromUpload
|
|
11
|
+
} from "./chunk-ETUZFFPU.js";
|
|
12
|
+
import {
|
|
13
|
+
EMBEDDING_SHARD_DIR_BASENAME,
|
|
14
|
+
applyEmbeddingGenerationRemoval,
|
|
15
|
+
applyEmbeddingGenerationTransaction,
|
|
16
|
+
assertEmbeddingGenerationStillIncluded,
|
|
17
|
+
computeOmittedEmbeddingGenerationPaths,
|
|
18
|
+
detectIncomingEmbeddingGenerations,
|
|
19
|
+
divergedEmbeddingGenerationDeferrals,
|
|
20
|
+
embeddingGenerationMembership,
|
|
21
|
+
embeddingMarkerDirOf,
|
|
22
|
+
embeddingShardDirOf,
|
|
23
|
+
isEmbeddingGenerationDirPath,
|
|
24
|
+
isPathInOmittedEmbeddingGeneration
|
|
25
|
+
} from "./chunk-K6T33R4Q.js";
|
|
10
26
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./chunk-
|
|
27
|
+
matchesOfflineSyncDefaultExclude
|
|
28
|
+
} from "./chunk-4NSLQ7EU.js";
|
|
13
29
|
import {
|
|
30
|
+
OFFLINE_SYNC_FAST_BASE_MTIME_TOLERANCE_MS,
|
|
31
|
+
SYNC_INTERNAL_DIR,
|
|
32
|
+
assertOfflineSyncMtimeMs,
|
|
14
33
|
isEncryptedOfflineSyncFile,
|
|
15
34
|
plainFileDigest,
|
|
16
35
|
readPlainOfflineSyncFileChunk,
|
|
36
|
+
setSafeFileMtime,
|
|
17
37
|
sha256OfflineSyncFile,
|
|
18
38
|
shouldExcludeOfflineSyncFile
|
|
19
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-EFHNFTWB.js";
|
|
40
|
+
import {
|
|
41
|
+
prepareSafeArchiveRoot,
|
|
42
|
+
resolveSafeArchiveTarget,
|
|
43
|
+
sha256Bytes,
|
|
44
|
+
validateArchiveRelativePath
|
|
45
|
+
} from "./chunk-GCGJW34D.js";
|
|
46
|
+
import {
|
|
47
|
+
isCanonicalRuntimeStatePath,
|
|
48
|
+
shouldDeleteAbsentIncomingOfflineRuntimeFile,
|
|
49
|
+
shouldPreferIncomingOfflineRuntimeFile
|
|
50
|
+
} from "./chunk-TYT4TEQV.js";
|
|
51
|
+
import {
|
|
52
|
+
withEmbeddingGenerationLock,
|
|
53
|
+
withEmbeddingGenerationLockIter
|
|
54
|
+
} from "./chunk-75PT4N7Q.js";
|
|
55
|
+
import {
|
|
56
|
+
EmbeddingIndexStorageError
|
|
57
|
+
} from "./chunk-UCPGOUDZ.js";
|
|
20
58
|
import {
|
|
21
59
|
CENSUS_MAX_MTIME_MS,
|
|
22
|
-
isCensusMtimeMs,
|
|
23
60
|
isSha256Hex
|
|
24
61
|
} from "./chunk-LQWOFU6L.js";
|
|
25
62
|
import {
|
|
@@ -27,18 +64,15 @@ import {
|
|
|
27
64
|
} from "./chunk-P7FMDTKL.js";
|
|
28
65
|
|
|
29
66
|
// src/offline-sync.ts
|
|
30
|
-
import {
|
|
67
|
+
import { randomUUID } from "crypto";
|
|
31
68
|
import {
|
|
32
69
|
lstat,
|
|
33
70
|
mkdir,
|
|
34
|
-
open,
|
|
35
71
|
readdir,
|
|
36
72
|
readFile,
|
|
37
73
|
rename,
|
|
38
|
-
rm,
|
|
39
74
|
stat,
|
|
40
75
|
unlink,
|
|
41
|
-
utimes,
|
|
42
76
|
writeFile
|
|
43
77
|
} from "fs/promises";
|
|
44
78
|
import path from "path";
|
|
@@ -50,9 +84,6 @@ var OFFLINE_SYNC_FILE_CONTENT_TRANSFER_CHUNK_BYTES = 8 * 1024 * 1024;
|
|
|
50
84
|
var OFFLINE_SYNC_APPLY_MAX_BODY_BYTES = 16 * 1024 * 1024;
|
|
51
85
|
var OFFLINE_SYNC_SNAPSHOT_BASE_MAX_BODY_BYTES = 64 * 1024 * 1024;
|
|
52
86
|
var OFFLINE_SYNC_MAX_MTIME_MS = CENSUS_MAX_MTIME_MS;
|
|
53
|
-
var SYNC_INTERNAL_DIR = ".offline-sync";
|
|
54
|
-
var OFFLINE_SYNC_UPLOAD_STAGING_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
55
|
-
var OFFLINE_SYNC_FAST_BASE_MTIME_TOLERANCE_MS = 1e3;
|
|
56
87
|
var OFFLINE_SYNC_FAST_BASE_CTIME_TOLERANCE_MS = 1;
|
|
57
88
|
var EXCLUDED_FILE_NAMES = /* @__PURE__ */ new Set([
|
|
58
89
|
".sync-state.json"
|
|
@@ -61,45 +92,6 @@ var EXCLUDED_FILE_PREFIXES = [
|
|
|
61
92
|
".remnic-sync.",
|
|
62
93
|
".remnic-sync-state."
|
|
63
94
|
];
|
|
64
|
-
function globToRegExp(glob) {
|
|
65
|
-
if (typeof glob !== "string" || glob.length === 0) {
|
|
66
|
-
throw new Error("offlineSyncExcludes entry must be a non-empty string");
|
|
67
|
-
}
|
|
68
|
-
if (glob.includes("\0")) {
|
|
69
|
-
throw new Error("offlineSyncExcludes entry must not contain NUL bytes");
|
|
70
|
-
}
|
|
71
|
-
let source = "";
|
|
72
|
-
for (let i = 0; i < glob.length; i += 1) {
|
|
73
|
-
const ch = glob[i];
|
|
74
|
-
if (ch === "*") {
|
|
75
|
-
if (glob[i + 1] === "*") {
|
|
76
|
-
if (glob[i + 2] === "/") {
|
|
77
|
-
source += "(?:.*/)?";
|
|
78
|
-
i += 2;
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
source += ".*";
|
|
82
|
-
i += 1;
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
source += "[^/]*";
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
if (ch === "?") {
|
|
89
|
-
source += "[^/]";
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
if (ch === "/") {
|
|
93
|
-
source += "/";
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
source += ch.replace(/[\\^$.+()|{}\[\]]/g, "\\$&");
|
|
97
|
-
}
|
|
98
|
-
return new RegExp(`^${source}$`);
|
|
99
|
-
}
|
|
100
|
-
function hashText(value) {
|
|
101
|
-
return createHash("sha256").update(value).digest("hex");
|
|
102
|
-
}
|
|
103
95
|
function sha256Buffer(buffer) {
|
|
104
96
|
return sha256Bytes(buffer);
|
|
105
97
|
}
|
|
@@ -122,19 +114,6 @@ function assertNonNegativeInteger(value, field) {
|
|
|
122
114
|
}
|
|
123
115
|
return value;
|
|
124
116
|
}
|
|
125
|
-
function assertNonNegativeFinite(value, field) {
|
|
126
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
127
|
-
throw new Error(`${field} must be a non-negative finite number`);
|
|
128
|
-
}
|
|
129
|
-
return value;
|
|
130
|
-
}
|
|
131
|
-
function assertOfflineSyncMtimeMs(value, field) {
|
|
132
|
-
const mtimeMs = assertNonNegativeFinite(value, field);
|
|
133
|
-
if (!isCensusMtimeMs(mtimeMs)) {
|
|
134
|
-
throw new Error(`${field} must be within JavaScript Date range`);
|
|
135
|
-
}
|
|
136
|
-
return mtimeMs;
|
|
137
|
-
}
|
|
138
117
|
function assertBoolean(value, field) {
|
|
139
118
|
if (typeof value !== "boolean") {
|
|
140
119
|
throw new Error(`${field} must be a boolean`);
|
|
@@ -206,12 +185,17 @@ function snapshotBuilderDeletions(options) {
|
|
|
206
185
|
if (deletions.length === 0) return deletions;
|
|
207
186
|
const presentPaths = new Set(options.files.map((file) => file.path.toLowerCase()));
|
|
208
187
|
const scopedPaths = options.paths ? new Set(options.paths.map((relPath) => relPath.toLowerCase())) : void 0;
|
|
209
|
-
return deletions.filter((deletion) => (scopedPaths === void 0 || scopedPaths.has(deletion.path.toLowerCase())) && !presentPaths.has(deletion.path.toLowerCase()) && !(options.excludeNodeLocalState === false ? shouldExcludeRelPath(deletion.path, options.includeTranscripts) : shouldExcludePushRelPath(
|
|
188
|
+
return deletions.filter((deletion) => (scopedPaths === void 0 || scopedPaths.has(deletion.path.toLowerCase())) && !presentPaths.has(deletion.path.toLowerCase()) && !isDeletionInOmittedGeneration(deletion.path, options.omittedGenerationDirs) && !(options.excludeNodeLocalState === false ? shouldExcludeRelPath(deletion.path, options.includeTranscripts) : shouldExcludePushRelPath(
|
|
210
189
|
deletion.path,
|
|
211
190
|
options.includeTranscripts,
|
|
212
191
|
options.userExcludeRegexps
|
|
213
192
|
)));
|
|
214
193
|
}
|
|
194
|
+
function isDeletionInOmittedGeneration(relPath, omittedGenerationDirs) {
|
|
195
|
+
if (!omittedGenerationDirs || omittedGenerationDirs.size === 0) return false;
|
|
196
|
+
const membership = embeddingGenerationMembership(relPath);
|
|
197
|
+
return membership !== null && omittedGenerationDirs.has(membership.shardDir);
|
|
198
|
+
}
|
|
215
199
|
async function filterOfflineSyncDeletionRevisions(options) {
|
|
216
200
|
const deletions = normalizeDeletionRevisions(options.deletions, "deletions");
|
|
217
201
|
if (deletions === void 0) throw new Error("deletions must be an array");
|
|
@@ -222,9 +206,16 @@ async function filterOfflineSyncDeletionRevisions(options) {
|
|
|
222
206
|
"root"
|
|
223
207
|
);
|
|
224
208
|
const includeTranscripts = options.includeTranscripts !== false;
|
|
209
|
+
const omission = await computeOmittedEmbeddingGenerationPaths({
|
|
210
|
+
rootAbs: root.abs,
|
|
211
|
+
userExcludeRegexps: options.userExcludeRegexps,
|
|
212
|
+
excludeFile: options.excludeFile,
|
|
213
|
+
isExcludedRelPath: (relPath) => shouldExcludePushRelPath(relPath, includeTranscripts, options.userExcludeRegexps)
|
|
214
|
+
});
|
|
215
|
+
const omittedDirs = new Set(omission.omittedDirs);
|
|
225
216
|
const filtered = [];
|
|
226
217
|
for (const deletion of deletions) {
|
|
227
|
-
if (shouldExcludePushRelPath(deletion.path, includeTranscripts, options.userExcludeRegexps)) {
|
|
218
|
+
if (shouldExcludePushRelPath(deletion.path, includeTranscripts, options.userExcludeRegexps) || isDeletionInOmittedGeneration(deletion.path, omittedDirs)) {
|
|
228
219
|
continue;
|
|
229
220
|
}
|
|
230
221
|
const filePath = path.join(root.abs, ...deletion.path.split("/"));
|
|
@@ -272,6 +263,22 @@ function normalizeOfflineSyncSnapshot(input, options = {}) {
|
|
|
272
263
|
if (excludedPath) {
|
|
273
264
|
throw new Error(`offline sync snapshot contains excluded path: ${excludedPath}`);
|
|
274
265
|
}
|
|
266
|
+
let omittedEmbeddingGenerationDirs;
|
|
267
|
+
if (obj.omittedEmbeddingGenerationDirs !== void 0) {
|
|
268
|
+
if (!Array.isArray(obj.omittedEmbeddingGenerationDirs)) {
|
|
269
|
+
throw new Error("offline sync snapshot omittedEmbeddingGenerationDirs must be an array");
|
|
270
|
+
}
|
|
271
|
+
const seenDirs = /* @__PURE__ */ new Set();
|
|
272
|
+
for (const [index, entry] of obj.omittedEmbeddingGenerationDirs.entries()) {
|
|
273
|
+
if (typeof entry !== "string" || !isEmbeddingGenerationDirPath(entry) || seenDirs.has(entry)) {
|
|
274
|
+
throw new Error(
|
|
275
|
+
`omittedEmbeddingGenerationDirs[${index}] must be a unique canonical embeddings generation dir`
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
seenDirs.add(entry);
|
|
279
|
+
}
|
|
280
|
+
omittedEmbeddingGenerationDirs = [...seenDirs].sort((left, right) => left.localeCompare(right));
|
|
281
|
+
}
|
|
275
282
|
return {
|
|
276
283
|
format: OFFLINE_SYNC_SNAPSHOT_FORMAT,
|
|
277
284
|
schemaVersion: 1,
|
|
@@ -279,7 +286,8 @@ function normalizeOfflineSyncSnapshot(input, options = {}) {
|
|
|
279
286
|
sourceId,
|
|
280
287
|
includeTranscripts,
|
|
281
288
|
files,
|
|
282
|
-
...deletions === void 0 ? {} : { deletions }
|
|
289
|
+
...deletions === void 0 ? {} : { deletions },
|
|
290
|
+
...omittedEmbeddingGenerationDirs === void 0 ? {} : { omittedEmbeddingGenerationDirs }
|
|
283
291
|
};
|
|
284
292
|
}
|
|
285
293
|
function normalizeOfflineSyncChangeset(input) {
|
|
@@ -404,79 +412,12 @@ function shouldExcludePushRelPath(relPosix, includeTranscripts, userExcludeRegex
|
|
|
404
412
|
if (userExcludeRegexps && userExcludeRegexps.some((re) => re.test(relPosix))) return true;
|
|
405
413
|
return false;
|
|
406
414
|
}
|
|
407
|
-
var DEFAULT_OFFLINE_SYNC_EXCLUDE_REGEXPS = DEFAULT_OFFLINE_SYNC_EXCLUDE_GLOBS.map((glob) => globToRegExp(glob));
|
|
408
|
-
function matchesOfflineSyncDefaultExclude(relPosix) {
|
|
409
|
-
for (const regexp of DEFAULT_OFFLINE_SYNC_EXCLUDE_REGEXPS) {
|
|
410
|
-
if (regexp.test(relPosix)) return true;
|
|
411
|
-
}
|
|
412
|
-
return false;
|
|
413
|
-
}
|
|
414
|
-
function compileOfflineSyncExcludeGlobs(globs) {
|
|
415
|
-
const out = [];
|
|
416
|
-
for (const entry of globs) {
|
|
417
|
-
if (typeof entry !== "string" || entry.length === 0) {
|
|
418
|
-
throw new Error("offlineSyncExcludes must contain only non-empty strings");
|
|
419
|
-
}
|
|
420
|
-
out.push(globToRegExp(entry));
|
|
421
|
-
}
|
|
422
|
-
return out;
|
|
423
|
-
}
|
|
424
|
-
function parseOfflineSyncExcludes(raw) {
|
|
425
|
-
if (raw === void 0 || raw === null) return [];
|
|
426
|
-
if (!Array.isArray(raw)) {
|
|
427
|
-
throw new Error(
|
|
428
|
-
`offlineSyncExcludes must be an array of non-empty glob strings; got ${typeof raw}`
|
|
429
|
-
);
|
|
430
|
-
}
|
|
431
|
-
for (const entry of raw) {
|
|
432
|
-
if (typeof entry !== "string" || entry.trim().length === 0) {
|
|
433
|
-
throw new Error(
|
|
434
|
-
"offlineSyncExcludes must contain only non-empty glob strings"
|
|
435
|
-
);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
const globs = raw.map((entry) => entry.trim());
|
|
439
|
-
compileOfflineSyncExcludeGlobs(globs);
|
|
440
|
-
return globs;
|
|
441
|
-
}
|
|
442
415
|
function shouldIgnoreIncomingRuntimePath(relPosix) {
|
|
443
416
|
if (isInternalRemnicStatePath(relPosix)) return true;
|
|
444
417
|
const parts = relPosix.split("/");
|
|
445
418
|
const basename = parts[parts.length - 1] ?? "";
|
|
446
419
|
return isCanonicalRuntimeStatePath(parts) && basename.includes(".tmp-");
|
|
447
420
|
}
|
|
448
|
-
function isCanonicalRuntimeStatePath(parts) {
|
|
449
|
-
if (parts[0] === "state") return true;
|
|
450
|
-
return parts[0] === "namespaces" && parts.length >= 4 && parts[2] === "state";
|
|
451
|
-
}
|
|
452
|
-
var REMOTE_AUTHORITATIVE_RUNTIME_STATE_FILES = /* @__PURE__ */ new Set([
|
|
453
|
-
".artifact-write-version.log",
|
|
454
|
-
".memory-status-version.log",
|
|
455
|
-
"buffer.json",
|
|
456
|
-
"embeddings.json",
|
|
457
|
-
"index_time.json",
|
|
458
|
-
"last_intent.json",
|
|
459
|
-
"last_qmd_recall.json",
|
|
460
|
-
"last_recall.json",
|
|
461
|
-
"lcm.sqlite-shm",
|
|
462
|
-
"lcm.sqlite-wal",
|
|
463
|
-
"memory-lifecycle-ledger.jsonl",
|
|
464
|
-
"recall_impressions.jsonl"
|
|
465
|
-
]);
|
|
466
|
-
var ABSENT_INCOMING_RUNTIME_DELETE_FILES = /* @__PURE__ */ new Set([
|
|
467
|
-
"lcm.sqlite-shm",
|
|
468
|
-
"lcm.sqlite-wal"
|
|
469
|
-
]);
|
|
470
|
-
function shouldPreferIncomingOfflineRuntimeFile(relPosix) {
|
|
471
|
-
const parts = relPosix.split("/");
|
|
472
|
-
const basename = parts[parts.length - 1] ?? "";
|
|
473
|
-
return isCanonicalRuntimeStatePath(parts) && REMOTE_AUTHORITATIVE_RUNTIME_STATE_FILES.has(basename);
|
|
474
|
-
}
|
|
475
|
-
function shouldDeleteAbsentIncomingOfflineRuntimeFile(relPosix) {
|
|
476
|
-
const parts = relPosix.split("/");
|
|
477
|
-
const basename = parts[parts.length - 1] ?? "";
|
|
478
|
-
return isCanonicalRuntimeStatePath(parts) && ABSENT_INCOMING_RUNTIME_DELETE_FILES.has(basename);
|
|
479
|
-
}
|
|
480
421
|
function filterBaseFilesForMode(files, includeTranscripts) {
|
|
481
422
|
return files.filter((file) => !shouldExcludeRelPath(file.path, includeTranscripts));
|
|
482
423
|
}
|
|
@@ -526,7 +467,14 @@ async function* iterateOfflineSyncSnapshotFileRecords(options) {
|
|
|
526
467
|
const rootAbs = path.resolve(options.root);
|
|
527
468
|
const root = await prepareSafeArchiveRoot(rootAbs, "iterateOfflineSyncSnapshotFileRecords", "root");
|
|
528
469
|
const includeTranscripts = options.includeTranscripts !== false;
|
|
529
|
-
|
|
470
|
+
const pushExcludes = options.excludeNodeLocalState !== false;
|
|
471
|
+
const skipGenerationPaths = options.skipEmbeddingGenerationPaths ?? (pushExcludes ? (await computeOmittedEmbeddingGenerationPaths({
|
|
472
|
+
rootAbs: root.abs,
|
|
473
|
+
userExcludeRegexps: options.userExcludeRegexps,
|
|
474
|
+
excludeFile: options.excludeFile,
|
|
475
|
+
isExcludedRelPath: (relPath) => shouldExcludePushRelPath(relPath, includeTranscripts, options.userExcludeRegexps)
|
|
476
|
+
})).omittedPaths : void 0);
|
|
477
|
+
async function* walk(dirAbs, includeContent = options.includeContent === true) {
|
|
530
478
|
throwIfOfflineSyncAborted(options.signal);
|
|
531
479
|
let entries = await readdir(dirAbs, { withFileTypes: true });
|
|
532
480
|
entries = entries.sort((left, right) => left.name.localeCompare(right.name));
|
|
@@ -534,9 +482,25 @@ async function* iterateOfflineSyncSnapshotFileRecords(options) {
|
|
|
534
482
|
const abs = path.join(dirAbs, entry.name);
|
|
535
483
|
const relPosix = path.relative(root.abs, abs).split(path.sep).join("/");
|
|
536
484
|
if (options.excludeNodeLocalState === false ? shouldExcludeRelPath(relPosix, includeTranscripts) : shouldExcludePushRelPath(relPosix, includeTranscripts, options.userExcludeRegexps)) continue;
|
|
485
|
+
if (skipGenerationPaths?.has(relPosix)) continue;
|
|
537
486
|
if (entry.isSymbolicLink()) continue;
|
|
538
487
|
if (entry.isDirectory()) {
|
|
539
|
-
|
|
488
|
+
if (isEmbeddingGenerationDirPath(relPosix)) {
|
|
489
|
+
yield* withEmbeddingGenerationLockIter(
|
|
490
|
+
path.dirname(abs),
|
|
491
|
+
(content) => walk(abs, content),
|
|
492
|
+
includeContent,
|
|
493
|
+
() => assertEmbeddingGenerationStillIncluded(
|
|
494
|
+
root.abs,
|
|
495
|
+
relPosix,
|
|
496
|
+
options.excludeFile,
|
|
497
|
+
(rel) => shouldExcludePushRelPath(rel, includeTranscripts, options.userExcludeRegexps),
|
|
498
|
+
[]
|
|
499
|
+
)
|
|
500
|
+
);
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
503
|
+
yield* walk(abs, includeContent);
|
|
540
504
|
continue;
|
|
541
505
|
}
|
|
542
506
|
if (!entry.isFile()) continue;
|
|
@@ -549,7 +513,7 @@ async function* iterateOfflineSyncSnapshotFileRecords(options) {
|
|
|
549
513
|
root,
|
|
550
514
|
relPath: relPosix,
|
|
551
515
|
filePath: abs,
|
|
552
|
-
includeContent
|
|
516
|
+
includeContent,
|
|
553
517
|
readFile: options.readFile,
|
|
554
518
|
readFileDigest: options.readFileDigest,
|
|
555
519
|
signal: options.signal
|
|
@@ -561,8 +525,20 @@ async function* iterateOfflineSyncSnapshotFileRecords(options) {
|
|
|
561
525
|
async function buildOfflineSyncSnapshot(options) {
|
|
562
526
|
throwIfOfflineSyncAborted(options.signal);
|
|
563
527
|
const includeTranscripts = options.includeTranscripts !== false;
|
|
528
|
+
const pushExcludes = options.excludeNodeLocalState !== false;
|
|
529
|
+
const normalizedDeletions = normalizeDeletionRevisions(options.deletions, "deletions");
|
|
530
|
+
const omission = pushExcludes ? await computeOmittedEmbeddingGenerationPaths({
|
|
531
|
+
rootAbs: path.resolve(options.root),
|
|
532
|
+
userExcludeRegexps: options.userExcludeRegexps,
|
|
533
|
+
excludeFile: options.excludeFile,
|
|
534
|
+
tombstonedPaths: (normalizedDeletions ?? []).map((deletion) => deletion.path),
|
|
535
|
+
isExcludedRelPath: (relPath) => shouldExcludePushRelPath(relPath, includeTranscripts, options.userExcludeRegexps)
|
|
536
|
+
}) : void 0;
|
|
564
537
|
const files = [];
|
|
565
|
-
for await (const file of iterateOfflineSyncSnapshotFileRecords(
|
|
538
|
+
for await (const file of iterateOfflineSyncSnapshotFileRecords({
|
|
539
|
+
...options,
|
|
540
|
+
skipEmbeddingGenerationPaths: omission?.omittedPaths
|
|
541
|
+
})) files.push(file);
|
|
566
542
|
throwIfOfflineSyncAborted(options.signal);
|
|
567
543
|
const sortedFiles = files.sort(compareByPath);
|
|
568
544
|
const deletions = snapshotBuilderDeletions({
|
|
@@ -570,7 +546,8 @@ async function buildOfflineSyncSnapshot(options) {
|
|
|
570
546
|
files: sortedFiles,
|
|
571
547
|
includeTranscripts,
|
|
572
548
|
excludeNodeLocalState: options.excludeNodeLocalState,
|
|
573
|
-
userExcludeRegexps: options.userExcludeRegexps
|
|
549
|
+
userExcludeRegexps: options.userExcludeRegexps,
|
|
550
|
+
omittedGenerationDirs: omission && omission.omittedDirs.length > 0 ? new Set(omission.omittedDirs) : void 0
|
|
574
551
|
});
|
|
575
552
|
return {
|
|
576
553
|
format: OFFLINE_SYNC_SNAPSHOT_FORMAT,
|
|
@@ -579,7 +556,8 @@ async function buildOfflineSyncSnapshot(options) {
|
|
|
579
556
|
sourceId: normalizeSourceId(options.sourceId, "sourceId"),
|
|
580
557
|
includeTranscripts,
|
|
581
558
|
files: sortedFiles,
|
|
582
|
-
...deletions === void 0 ? {} : { deletions }
|
|
559
|
+
...deletions === void 0 ? {} : { deletions },
|
|
560
|
+
...omission && omission.omittedDirs.length > 0 ? { omittedEmbeddingGenerationDirs: omission.omittedDirs } : {}
|
|
583
561
|
};
|
|
584
562
|
}
|
|
585
563
|
async function buildOfflineSyncSnapshotFromBase(options) {
|
|
@@ -593,6 +571,15 @@ async function buildOfflineSyncSnapshotFromBase(options) {
|
|
|
593
571
|
));
|
|
594
572
|
const rawBaseCapturedAtMs = options.baseCapturedAt?.getTime();
|
|
595
573
|
const baseCapturedAtMs = rawBaseCapturedAtMs !== void 0 && Number.isFinite(rawBaseCapturedAtMs) ? rawBaseCapturedAtMs : null;
|
|
574
|
+
const pushExcludes = options.excludeNodeLocalState !== false;
|
|
575
|
+
const normalizedDeletions = normalizeDeletionRevisions(options.deletions, "deletions");
|
|
576
|
+
const omission = pushExcludes ? await computeOmittedEmbeddingGenerationPaths({
|
|
577
|
+
rootAbs: root.abs,
|
|
578
|
+
userExcludeRegexps: options.userExcludeRegexps,
|
|
579
|
+
excludeFile: options.excludeFile,
|
|
580
|
+
tombstonedPaths: (normalizedDeletions ?? []).map((deletion) => deletion.path),
|
|
581
|
+
isExcludedRelPath: (relPath) => shouldExcludePushRelPath(relPath, includeTranscripts, options.userExcludeRegexps)
|
|
582
|
+
}) : void 0;
|
|
596
583
|
const files = [];
|
|
597
584
|
async function walk(dirAbs) {
|
|
598
585
|
throwIfOfflineSyncAborted(options.signal);
|
|
@@ -603,8 +590,22 @@ async function buildOfflineSyncSnapshotFromBase(options) {
|
|
|
603
590
|
const abs = path.join(dirAbs, entry.name);
|
|
604
591
|
const relPosix = path.relative(root.abs, abs).split(path.sep).join("/");
|
|
605
592
|
if (options.excludeNodeLocalState === false ? shouldExcludeRelPath(relPosix, includeTranscripts) : shouldExcludePushRelPath(relPosix, includeTranscripts, options.userExcludeRegexps)) continue;
|
|
593
|
+
if (omission?.omittedPaths.has(relPosix)) continue;
|
|
606
594
|
if (entry.isSymbolicLink()) continue;
|
|
607
595
|
if (entry.isDirectory()) {
|
|
596
|
+
if (isEmbeddingGenerationDirPath(relPosix)) {
|
|
597
|
+
await withEmbeddingGenerationLock(path.dirname(abs), async () => {
|
|
598
|
+
await assertEmbeddingGenerationStillIncluded(
|
|
599
|
+
root.abs,
|
|
600
|
+
relPosix,
|
|
601
|
+
options.excludeFile,
|
|
602
|
+
(rel) => shouldExcludePushRelPath(rel, includeTranscripts, options.userExcludeRegexps),
|
|
603
|
+
(normalizedDeletions ?? []).map((deletion) => deletion.path)
|
|
604
|
+
);
|
|
605
|
+
await walk(abs);
|
|
606
|
+
});
|
|
607
|
+
continue;
|
|
608
|
+
}
|
|
608
609
|
await walk(abs);
|
|
609
610
|
continue;
|
|
610
611
|
}
|
|
@@ -639,7 +640,8 @@ async function buildOfflineSyncSnapshotFromBase(options) {
|
|
|
639
640
|
files: sortedFiles,
|
|
640
641
|
includeTranscripts,
|
|
641
642
|
excludeNodeLocalState: options.excludeNodeLocalState,
|
|
642
|
-
userExcludeRegexps: options.userExcludeRegexps
|
|
643
|
+
userExcludeRegexps: options.userExcludeRegexps,
|
|
644
|
+
omittedGenerationDirs: omission && omission.omittedDirs.length > 0 ? new Set(omission.omittedDirs) : void 0
|
|
643
645
|
});
|
|
644
646
|
return {
|
|
645
647
|
format: OFFLINE_SYNC_SNAPSHOT_FORMAT,
|
|
@@ -648,7 +650,8 @@ async function buildOfflineSyncSnapshotFromBase(options) {
|
|
|
648
650
|
sourceId: normalizeSourceId(options.sourceId, "sourceId"),
|
|
649
651
|
includeTranscripts,
|
|
650
652
|
files: sortedFiles,
|
|
651
|
-
...deletions === void 0 ? {} : { deletions }
|
|
653
|
+
...deletions === void 0 ? {} : { deletions },
|
|
654
|
+
...omission && omission.omittedDirs.length > 0 ? { omittedEmbeddingGenerationDirs: omission.omittedDirs } : {}
|
|
652
655
|
};
|
|
653
656
|
}
|
|
654
657
|
async function buildOfflineSyncSnapshotForPaths(options) {
|
|
@@ -942,8 +945,9 @@ async function applyOfflineSyncSnapshot(options) {
|
|
|
942
945
|
));
|
|
943
946
|
const incomingMap = byPath(snapshot.files);
|
|
944
947
|
const deletionMtimeByPath = snapshot.deletions === void 0 ? void 0 : new Map(snapshot.deletions.map((deletion) => [deletion.path, deletion.mtimeMs]));
|
|
945
|
-
const incomingBuffers = verifyRecordContents(snapshot.files, "offline sync snapshot", {
|
|
946
|
-
requireContent: false
|
|
948
|
+
const incomingBuffers = await verifyRecordContents(snapshot.files, "offline sync snapshot", {
|
|
949
|
+
requireContent: false,
|
|
950
|
+
readIncomingFile: options.readIncomingFile
|
|
947
951
|
});
|
|
948
952
|
const root = await ensureSyncRoot(options.root, "applyOfflineSyncSnapshot");
|
|
949
953
|
const currentFiles = options.currentFiles ? filterBaseFilesForMode(normalizeFileStates(options.currentFiles), snapshot.includeTranscripts).sort(compareByPath) : (await buildOfflineSyncSnapshot({
|
|
@@ -956,10 +960,18 @@ async function applyOfflineSyncSnapshot(options) {
|
|
|
956
960
|
excludeNodeLocalState: false
|
|
957
961
|
})).files;
|
|
958
962
|
const currentMap = byPath(currentFiles);
|
|
959
|
-
const deferredPaths = new Set(
|
|
963
|
+
const deferredPaths = /* @__PURE__ */ new Set([
|
|
964
|
+
...options.deferredPaths ?? [],
|
|
965
|
+
...divergedEmbeddingGenerationDeferrals({
|
|
966
|
+
incomingFiles: snapshot.files,
|
|
967
|
+
baseFiles: [...baseMap.values()],
|
|
968
|
+
currentFiles
|
|
969
|
+
})
|
|
970
|
+
]);
|
|
971
|
+
const omittedGenerationDirs = new Set(snapshot.omittedEmbeddingGenerationDirs ?? []);
|
|
960
972
|
if (deletionMtimeByPath && options.recordDeletionRevision) {
|
|
961
973
|
for (const [relPath, mtimeMs] of deletionMtimeByPath) {
|
|
962
|
-
if (currentMap.has(relPath) || deferredPaths.has(relPath) || matchesOfflineSyncDefaultExclude(relPath)) {
|
|
974
|
+
if (currentMap.has(relPath) || deferredPaths.has(relPath) || omittedGenerationDirs.size > 0 && isPathInOmittedEmbeddingGeneration(relPath, omittedGenerationDirs) || matchesOfflineSyncDefaultExclude(relPath)) {
|
|
963
975
|
continue;
|
|
964
976
|
}
|
|
965
977
|
await options.recordDeletionRevision({
|
|
@@ -982,6 +994,133 @@ async function applyOfflineSyncSnapshot(options) {
|
|
|
982
994
|
if (buffer || options.allowMissingConflictContent === true) return buffer;
|
|
983
995
|
return requiredBuffer(incomingBuffers, relPath);
|
|
984
996
|
};
|
|
997
|
+
const incomingGenerations = detectIncomingEmbeddingGenerations(incomingMap.keys());
|
|
998
|
+
const generationDirs = /* @__PURE__ */ new Set([
|
|
999
|
+
...incomingGenerations.shardDirs,
|
|
1000
|
+
...incomingGenerations.legacyMarkerDirs
|
|
1001
|
+
]);
|
|
1002
|
+
const deferredGenerationDirs = /* @__PURE__ */ new Set();
|
|
1003
|
+
for (const deferredPath of deferredPaths) {
|
|
1004
|
+
const membership = embeddingGenerationMembership(deferredPath);
|
|
1005
|
+
if (membership) {
|
|
1006
|
+
deferredGenerationDirs.add(membership.shardDir);
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
const transactionResults = [];
|
|
1010
|
+
for (const shardDir of generationDirs) {
|
|
1011
|
+
if (omittedGenerationDirs.has(shardDir)) {
|
|
1012
|
+
throw new EmbeddingIndexStorageError(
|
|
1013
|
+
`offline sync snapshot both includes and omits embedding generation ${shardDir}; refusing to apply`
|
|
1014
|
+
);
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
if (generationDirs.size > 0 && (options.writeFile || options.readFile || options.readFileDigest || options.deleteFile) && !(options.writeStagingFile && options.readStagingFile)) {
|
|
1018
|
+
throw new EmbeddingIndexStorageError(
|
|
1019
|
+
"refusing to replace embedding generation: custom storage IO requires both writeStagingFile and readStagingFile hooks; unencrypted raw staging would plaintext-downgrade the index"
|
|
1020
|
+
);
|
|
1021
|
+
}
|
|
1022
|
+
for (const shardDir of generationDirs) {
|
|
1023
|
+
if (deferredGenerationDirs.has(shardDir)) continue;
|
|
1024
|
+
if (incomingGenerations.legacyMarkerDirs.has(shardDir) && !incomingGenerations.shardDirs.has(shardDir)) {
|
|
1025
|
+
const markerRel = [...incomingMap.keys()].find(
|
|
1026
|
+
(relPath) => embeddingMarkerDirOf(relPath) === shardDir.slice(0, -`/${EMBEDDING_SHARD_DIR_BASENAME}`.length)
|
|
1027
|
+
);
|
|
1028
|
+
if (!markerRel) continue;
|
|
1029
|
+
transactionResults.push(await applyEmbeddingGenerationTransaction({
|
|
1030
|
+
root,
|
|
1031
|
+
shardDirRel: shardDir,
|
|
1032
|
+
incomingShardPaths: [],
|
|
1033
|
+
incomingMarker: {
|
|
1034
|
+
path: markerRel,
|
|
1035
|
+
sha256: incomingMap.get(markerRel).sha256,
|
|
1036
|
+
buffer: incomingBuffers.get(markerRel) ?? null
|
|
1037
|
+
},
|
|
1038
|
+
incomingMarkerPresent: false,
|
|
1039
|
+
incomingShardStates: /* @__PURE__ */ new Map(),
|
|
1040
|
+
incomingBuffers,
|
|
1041
|
+
baseStates: baseMap,
|
|
1042
|
+
io: {
|
|
1043
|
+
readFile: options.readFile,
|
|
1044
|
+
writeStagingFile: options.writeStagingFile,
|
|
1045
|
+
readStagingFile: options.readStagingFile,
|
|
1046
|
+
deleteFile: options.deleteFile
|
|
1047
|
+
},
|
|
1048
|
+
now: Date.now()
|
|
1049
|
+
}));
|
|
1050
|
+
continue;
|
|
1051
|
+
}
|
|
1052
|
+
transactionResults.push(await applyEmbeddingGenerationTransaction({
|
|
1053
|
+
root,
|
|
1054
|
+
shardDirRel: shardDir,
|
|
1055
|
+
incomingShardPaths: [...incomingMap.keys()].filter((relPath) => embeddingShardDirOf(relPath) === shardDir).sort(),
|
|
1056
|
+
incomingMarker: null,
|
|
1057
|
+
incomingMarkerPresent: Boolean(
|
|
1058
|
+
incomingGenerations.legacyMarkerDirs.has(shardDir)
|
|
1059
|
+
),
|
|
1060
|
+
incomingShardStates: new Map(
|
|
1061
|
+
[...incomingMap.values()].filter((relPath) => embeddingShardDirOf(relPath.path) === shardDir).map((state) => [state.path, state])
|
|
1062
|
+
),
|
|
1063
|
+
incomingBuffers,
|
|
1064
|
+
baseStates: baseMap,
|
|
1065
|
+
io: {
|
|
1066
|
+
readFile: options.readFile,
|
|
1067
|
+
writeStagingFile: options.writeStagingFile,
|
|
1068
|
+
readStagingFile: options.readStagingFile,
|
|
1069
|
+
deleteFile: options.deleteFile
|
|
1070
|
+
},
|
|
1071
|
+
now: Date.now()
|
|
1072
|
+
}));
|
|
1073
|
+
}
|
|
1074
|
+
const localGenerationDirs = /* @__PURE__ */ new Set();
|
|
1075
|
+
for (const relPath of currentMap.keys()) {
|
|
1076
|
+
const membership = embeddingGenerationMembership(relPath);
|
|
1077
|
+
if (membership?.kind === "shard") localGenerationDirs.add(membership.shardDir);
|
|
1078
|
+
}
|
|
1079
|
+
for (const shardDir of localGenerationDirs) {
|
|
1080
|
+
if (generationDirs.has(shardDir) || deferredGenerationDirs.has(shardDir) || omittedGenerationDirs.has(shardDir)) {
|
|
1081
|
+
continue;
|
|
1082
|
+
}
|
|
1083
|
+
const localMembers = [...currentMap.keys()].filter(
|
|
1084
|
+
(relPath) => embeddingGenerationMembership(relPath)?.shardDir === shardDir
|
|
1085
|
+
);
|
|
1086
|
+
if (localMembers.length === 0) continue;
|
|
1087
|
+
const baseMembers = localMembers.filter((relPath) => baseMap.has(relPath));
|
|
1088
|
+
const tombstonedMembers = deletionMtimeByPath === void 0 ? [] : [...deletionMtimeByPath.keys()].filter(
|
|
1089
|
+
(relPath) => embeddingGenerationMembership(relPath)?.shardDir === shardDir
|
|
1090
|
+
);
|
|
1091
|
+
const tombstoneCovered = tombstonedMembers.length > 0;
|
|
1092
|
+
const baseEvidenced = baseMembers.length > 0 && baseMembers.every((relPath) => !incomingMap.has(relPath));
|
|
1093
|
+
if (!tombstoneCovered && !baseEvidenced) continue;
|
|
1094
|
+
transactionResults.push(await applyEmbeddingGenerationRemoval({
|
|
1095
|
+
root,
|
|
1096
|
+
shardDirRel: shardDir,
|
|
1097
|
+
io: { deleteFile: options.deleteFile, readFile: options.readFile },
|
|
1098
|
+
deletionMtimeByPath,
|
|
1099
|
+
baseStates: baseMap,
|
|
1100
|
+
now: Date.now()
|
|
1101
|
+
}));
|
|
1102
|
+
}
|
|
1103
|
+
const transactionHandled = /* @__PURE__ */ new Set();
|
|
1104
|
+
let generationUpserted = 0;
|
|
1105
|
+
let generationDeleted = 0;
|
|
1106
|
+
for (const result of transactionResults) {
|
|
1107
|
+
if (result.deferredLocalDivergence) {
|
|
1108
|
+
for (const relPath of result.handledPaths) deferredPaths.add(relPath);
|
|
1109
|
+
deferredGenerationDirs.add(result.shardDirRel);
|
|
1110
|
+
continue;
|
|
1111
|
+
}
|
|
1112
|
+
generationUpserted += result.upserted;
|
|
1113
|
+
generationDeleted += result.deleted;
|
|
1114
|
+
for (const relPath of result.handledPaths) transactionHandled.add(relPath);
|
|
1115
|
+
for (const [relPath, state] of result.writtenStates) {
|
|
1116
|
+
nextBase.set(relPath, state);
|
|
1117
|
+
transactionHandled.add(relPath);
|
|
1118
|
+
}
|
|
1119
|
+
for (const relPath of result.removedPaths) {
|
|
1120
|
+
nextBase.delete(relPath);
|
|
1121
|
+
transactionHandled.add(relPath);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
985
1124
|
for (const relPath of unionPaths(baseMap, incomingMap, currentMap)) {
|
|
986
1125
|
const base = baseMap.get(relPath);
|
|
987
1126
|
const incoming = incomingMap.get(relPath);
|
|
@@ -992,6 +1131,14 @@ async function applyOfflineSyncSnapshot(options) {
|
|
|
992
1131
|
skipped += 1;
|
|
993
1132
|
continue;
|
|
994
1133
|
}
|
|
1134
|
+
if (transactionHandled.has(relPath)) continue;
|
|
1135
|
+
const membership = embeddingGenerationMembership(relPath);
|
|
1136
|
+
if (membership && deferredGenerationDirs.has(membership.shardDir)) {
|
|
1137
|
+
if (base) nextBase.set(relPath, base);
|
|
1138
|
+
else nextBase.delete(relPath);
|
|
1139
|
+
skipped += 1;
|
|
1140
|
+
continue;
|
|
1141
|
+
}
|
|
995
1142
|
if (incoming) {
|
|
996
1143
|
if (currentEntry?.sha256 === incoming.sha256) {
|
|
997
1144
|
if (await setSafeFileMtime(root, relPath, incoming.mtimeMs)) {
|
|
@@ -1079,6 +1226,11 @@ async function applyOfflineSyncSnapshot(options) {
|
|
|
1079
1226
|
skipped += 1;
|
|
1080
1227
|
continue;
|
|
1081
1228
|
}
|
|
1229
|
+
if (shouldPreferIncomingOfflineRuntimeFile(relPath) && membership !== null && omittedGenerationDirs.has(membership.shardDir)) {
|
|
1230
|
+
pendingLocal += 1;
|
|
1231
|
+
skipped += 1;
|
|
1232
|
+
continue;
|
|
1233
|
+
}
|
|
1082
1234
|
if (shouldPreferIncomingOfflineRuntimeFile(relPath) && (base || shouldDeleteAbsentIncomingOfflineRuntimeFile(relPath))) {
|
|
1083
1235
|
await deleteSafeFile(
|
|
1084
1236
|
root,
|
|
@@ -1120,8 +1272,8 @@ async function applyOfflineSyncSnapshot(options) {
|
|
|
1120
1272
|
skipped += 1;
|
|
1121
1273
|
}
|
|
1122
1274
|
return {
|
|
1123
|
-
upserted,
|
|
1124
|
-
deleted,
|
|
1275
|
+
upserted: upserted + generationUpserted,
|
|
1276
|
+
deleted: deleted + generationDeleted,
|
|
1125
1277
|
skipped,
|
|
1126
1278
|
pendingLocal,
|
|
1127
1279
|
conflicts,
|
|
@@ -1140,7 +1292,7 @@ async function applyOfflineSyncChangeset(options) {
|
|
|
1140
1292
|
}
|
|
1141
1293
|
const root = await ensureSyncRoot(options.root, "applyOfflineSyncChangeset");
|
|
1142
1294
|
const records = changeset.changes.filter((change) => change.type === "upsert").map((change) => change.file);
|
|
1143
|
-
const incomingBuffers = verifyRecordContents(records, "offline sync changeset");
|
|
1295
|
+
const incomingBuffers = await verifyRecordContents(records, "offline sync changeset");
|
|
1144
1296
|
const currentFiles = options.currentFiles ? filterBaseFilesForMode(normalizeFileStates(options.currentFiles), changeset.includeTranscripts).sort(compareByPath) : (await buildOfflineSyncSnapshotForPaths({
|
|
1145
1297
|
root: root.abs,
|
|
1146
1298
|
sourceId: "local",
|
|
@@ -1251,10 +1403,25 @@ async function applyOfflineSyncChangeset(options) {
|
|
|
1251
1403
|
...options.returnCurrentFiles === false ? { currentFilesComplete: false } : {}
|
|
1252
1404
|
};
|
|
1253
1405
|
}
|
|
1254
|
-
function verifyRecordContents(records, context, options = {}) {
|
|
1406
|
+
async function verifyRecordContents(records, context, options = {}) {
|
|
1255
1407
|
const buffers = /* @__PURE__ */ new Map();
|
|
1256
1408
|
for (const record of records) {
|
|
1257
1409
|
if (typeof record.contentBase64 !== "string") {
|
|
1410
|
+
if (options.readIncomingFile) {
|
|
1411
|
+
const incoming = await options.readIncomingFile({
|
|
1412
|
+
path: record.path,
|
|
1413
|
+
sha256: record.sha256,
|
|
1414
|
+
bytes: record.bytes
|
|
1415
|
+
});
|
|
1416
|
+
if (incoming) {
|
|
1417
|
+
const digest2 = sha256Buffer(incoming);
|
|
1418
|
+
if (digest2.sha256 !== record.sha256 || digest2.bytes !== record.bytes) {
|
|
1419
|
+
throw new Error(`${context}: incoming content checksum mismatch for ${record.path}`);
|
|
1420
|
+
}
|
|
1421
|
+
buffers.set(record.path, incoming);
|
|
1422
|
+
continue;
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1258
1425
|
if (options.requireContent === false) continue;
|
|
1259
1426
|
throw new Error(`${context}: contentBase64 is required for ${record.path}`);
|
|
1260
1427
|
}
|
|
@@ -1332,25 +1499,6 @@ async function writeSafeFile(root, relPath, content, writeFileHook, mtimeMs) {
|
|
|
1332
1499
|
throw error;
|
|
1333
1500
|
}
|
|
1334
1501
|
}
|
|
1335
|
-
async function setSafeFileMtime(root, relPath, mtimeMs) {
|
|
1336
|
-
if (mtimeMs === void 0) return true;
|
|
1337
|
-
const target = await resolveSafeArchiveTarget(root, relPath);
|
|
1338
|
-
const targetStat = await lstat(target).catch((error) => {
|
|
1339
|
-
if (error.code === "ENOENT") return null;
|
|
1340
|
-
throw error;
|
|
1341
|
-
});
|
|
1342
|
-
if (!targetStat) return false;
|
|
1343
|
-
if (targetStat.isSymbolicLink()) {
|
|
1344
|
-
throw new Error(`offline sync target is a symlink: ${relPath}`);
|
|
1345
|
-
}
|
|
1346
|
-
const targetMtimeMs = assertOfflineSyncMtimeMs(mtimeMs, "mtimeMs");
|
|
1347
|
-
if (Math.abs(targetStat.mtimeMs - targetMtimeMs) <= OFFLINE_SYNC_FAST_BASE_MTIME_TOLERANCE_MS) {
|
|
1348
|
-
return true;
|
|
1349
|
-
}
|
|
1350
|
-
const mtime = new Date(targetMtimeMs);
|
|
1351
|
-
await utimes(target, mtime, mtime);
|
|
1352
|
-
return true;
|
|
1353
|
-
}
|
|
1354
1502
|
async function readLocalFileState(options) {
|
|
1355
1503
|
const filePath = await resolveSafeArchiveTarget(
|
|
1356
1504
|
await prepareSafeArchiveRoot(options.rootAbs, "readLocalFileState", "rootAbs"),
|
|
@@ -1562,204 +1710,6 @@ async function applyOfflineSyncFileContentChunk(options) {
|
|
|
1562
1710
|
});
|
|
1563
1711
|
}
|
|
1564
1712
|
}
|
|
1565
|
-
function offlineUploadRelPath(options) {
|
|
1566
|
-
const key = hashText([
|
|
1567
|
-
options.sourceId,
|
|
1568
|
-
options.relPath,
|
|
1569
|
-
options.sha256,
|
|
1570
|
-
String(options.bytes)
|
|
1571
|
-
].join("\0"));
|
|
1572
|
-
return `${SYNC_INTERNAL_DIR}/uploads/${key}.part`;
|
|
1573
|
-
}
|
|
1574
|
-
async function offlineUploadPath(root, options) {
|
|
1575
|
-
const relPath = offlineUploadRelPath(options);
|
|
1576
|
-
return {
|
|
1577
|
-
kind: "single",
|
|
1578
|
-
relPath,
|
|
1579
|
-
filePath: await resolveSafeArchiveTarget(root, relPath)
|
|
1580
|
-
};
|
|
1581
|
-
}
|
|
1582
|
-
async function offlineUploadChunkPath(root, options) {
|
|
1583
|
-
const uploadRelPath = offlineUploadRelPath(options);
|
|
1584
|
-
const relPath = `${uploadRelPath}/${String(options.offset).padStart(20, "0")}.part`;
|
|
1585
|
-
return {
|
|
1586
|
-
kind: "chunks",
|
|
1587
|
-
relPath,
|
|
1588
|
-
filePath: await resolveSafeArchiveTarget(root, relPath)
|
|
1589
|
-
};
|
|
1590
|
-
}
|
|
1591
|
-
async function writeOfflineUploadChunk(options) {
|
|
1592
|
-
if ((options.writeFile || options.writeStagingFile) && !options.readFile) {
|
|
1593
|
-
throw new Error("offline sync upload chunk storage hooks require readFile");
|
|
1594
|
-
}
|
|
1595
|
-
const uploadRoot = {
|
|
1596
|
-
...await offlineUploadPath(options.root, options),
|
|
1597
|
-
kind: "chunks"
|
|
1598
|
-
};
|
|
1599
|
-
if (options.offset === 0) {
|
|
1600
|
-
await rm(uploadRoot.filePath, { recursive: true, force: true }).catch(() => {
|
|
1601
|
-
});
|
|
1602
|
-
} else {
|
|
1603
|
-
const existing = await stat(uploadRoot.filePath).catch((error) => {
|
|
1604
|
-
if (error.code === "ENOENT") return null;
|
|
1605
|
-
throw error;
|
|
1606
|
-
});
|
|
1607
|
-
if (!existing || !existing.isDirectory()) {
|
|
1608
|
-
throw new Error(`offline sync upload is missing initial chunk for ${options.relPath}`);
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
const chunk = await offlineUploadChunkPath(options.root, { ...options, offset: options.offset });
|
|
1612
|
-
const writeStagingFile = options.writeStagingFile ?? options.writeFile;
|
|
1613
|
-
if (writeStagingFile) {
|
|
1614
|
-
await writeOfflineUploadContent({
|
|
1615
|
-
root: options.root,
|
|
1616
|
-
relPath: chunk.relPath,
|
|
1617
|
-
filePath: chunk.filePath,
|
|
1618
|
-
content: options.content,
|
|
1619
|
-
writeFile: writeStagingFile
|
|
1620
|
-
});
|
|
1621
|
-
return uploadRoot;
|
|
1622
|
-
}
|
|
1623
|
-
await mkdir(path.dirname(chunk.filePath), { recursive: true });
|
|
1624
|
-
const existingChunk = await lstat(chunk.filePath).catch((error) => {
|
|
1625
|
-
if (error.code === "ENOENT") return null;
|
|
1626
|
-
throw error;
|
|
1627
|
-
});
|
|
1628
|
-
if (existingChunk?.isSymbolicLink()) {
|
|
1629
|
-
throw new Error(`offline sync upload chunk is a symlink: ${chunk.relPath}`);
|
|
1630
|
-
}
|
|
1631
|
-
await writeFile(chunk.filePath, options.content, { mode: 384 });
|
|
1632
|
-
return uploadRoot;
|
|
1633
|
-
}
|
|
1634
|
-
async function pruneOfflineUploadStaging(root) {
|
|
1635
|
-
const uploadsRelPath = `${SYNC_INTERNAL_DIR}/uploads`;
|
|
1636
|
-
const uploadsPath = await resolveSafeArchiveTarget(root, uploadsRelPath);
|
|
1637
|
-
const entries = await readdir(uploadsPath, { withFileTypes: true }).catch((error) => {
|
|
1638
|
-
if (error.code === "ENOENT") return [];
|
|
1639
|
-
throw error;
|
|
1640
|
-
});
|
|
1641
|
-
const now = Date.now();
|
|
1642
|
-
await Promise.all(entries.map(async (entry) => {
|
|
1643
|
-
if (!/^[a-f0-9]{64}\.part$/i.test(entry.name)) return;
|
|
1644
|
-
const relPath = `${uploadsRelPath}/${entry.name}`;
|
|
1645
|
-
const filePath = await resolveSafeArchiveTarget(root, relPath);
|
|
1646
|
-
const info = await lstat(filePath).catch((error) => {
|
|
1647
|
-
if (error.code === "ENOENT") return null;
|
|
1648
|
-
throw error;
|
|
1649
|
-
});
|
|
1650
|
-
if (!info) return;
|
|
1651
|
-
if (now - info.mtimeMs <= OFFLINE_SYNC_UPLOAD_STAGING_MAX_AGE_MS) return;
|
|
1652
|
-
await rm(filePath, { recursive: true, force: true });
|
|
1653
|
-
}));
|
|
1654
|
-
}
|
|
1655
|
-
async function* readOfflineUploadStagingChunks(options) {
|
|
1656
|
-
if (options.upload.kind === "single") {
|
|
1657
|
-
yield await readOfflineUploadContent({
|
|
1658
|
-
root: options.root,
|
|
1659
|
-
relPath: options.upload.relPath,
|
|
1660
|
-
filePath: options.upload.filePath,
|
|
1661
|
-
readFile: options.readFile
|
|
1662
|
-
});
|
|
1663
|
-
return;
|
|
1664
|
-
}
|
|
1665
|
-
const entries = await readdir(options.upload.filePath);
|
|
1666
|
-
const chunkNames = entries.filter((entry) => /^\d{20}\.part$/.test(entry)).sort();
|
|
1667
|
-
if (chunkNames.length === 0) {
|
|
1668
|
-
throw new Error(`offline sync upload is missing chunks for ${options.upload.relPath}`);
|
|
1669
|
-
}
|
|
1670
|
-
let expectedOffset = 0;
|
|
1671
|
-
for (const chunkName of chunkNames) {
|
|
1672
|
-
const offset = Number(chunkName.slice(0, 20));
|
|
1673
|
-
if (!Number.isSafeInteger(offset) || offset !== expectedOffset) {
|
|
1674
|
-
throw new Error(
|
|
1675
|
-
`offline sync upload offset mismatch for ${options.upload.relPath}: expected ${expectedOffset}, got ${offset}`
|
|
1676
|
-
);
|
|
1677
|
-
}
|
|
1678
|
-
const relPath = `${options.upload.relPath}/${chunkName}`;
|
|
1679
|
-
const filePath = await resolveSafeArchiveTarget(options.root, relPath);
|
|
1680
|
-
const content = await readOfflineUploadContent({
|
|
1681
|
-
root: options.root,
|
|
1682
|
-
relPath,
|
|
1683
|
-
filePath,
|
|
1684
|
-
readFile: options.readFile
|
|
1685
|
-
});
|
|
1686
|
-
expectedOffset += content.length;
|
|
1687
|
-
yield content;
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
async function digestOfflineUploadStagingContent(options) {
|
|
1691
|
-
const hash = createHash("sha256");
|
|
1692
|
-
let bytes = 0;
|
|
1693
|
-
for await (const chunk of readOfflineUploadStagingChunks(options)) {
|
|
1694
|
-
hash.update(chunk);
|
|
1695
|
-
bytes += chunk.length;
|
|
1696
|
-
}
|
|
1697
|
-
return { sha256: hash.digest("hex"), bytes };
|
|
1698
|
-
}
|
|
1699
|
-
async function writeSafeFileFromUpload(root, relPath, upload, readFile2, writeFileChunks, mtimeMs) {
|
|
1700
|
-
const target = await resolveSafeArchiveTarget(root, relPath);
|
|
1701
|
-
const chunks = readOfflineUploadStagingChunks({ root, upload, readFile: readFile2 });
|
|
1702
|
-
if (writeFileChunks) {
|
|
1703
|
-
await writeFileChunks({ root: root.abs, path: relPath, filePath: target, chunks });
|
|
1704
|
-
await setSafeFileMtime(root, relPath, mtimeMs);
|
|
1705
|
-
return;
|
|
1706
|
-
}
|
|
1707
|
-
await mkdir(path.dirname(target), { recursive: true });
|
|
1708
|
-
const tmp = path.join(
|
|
1709
|
-
path.dirname(target),
|
|
1710
|
-
`.remnic-sync.${process.pid}.${randomUUID()}.tmp`
|
|
1711
|
-
);
|
|
1712
|
-
const handle = await open(tmp, "w", 384);
|
|
1713
|
-
try {
|
|
1714
|
-
for await (const chunk of chunks) {
|
|
1715
|
-
if (chunk.length > 0) await handle.write(chunk);
|
|
1716
|
-
}
|
|
1717
|
-
await handle.close();
|
|
1718
|
-
const targetStat = await lstat(target).catch((error) => {
|
|
1719
|
-
if (error.code === "ENOENT") return null;
|
|
1720
|
-
throw error;
|
|
1721
|
-
});
|
|
1722
|
-
if (targetStat?.isSymbolicLink()) {
|
|
1723
|
-
throw new Error(`offline sync target is a symlink: ${relPath}`);
|
|
1724
|
-
}
|
|
1725
|
-
await rename(tmp, target);
|
|
1726
|
-
await setSafeFileMtime(root, relPath, mtimeMs);
|
|
1727
|
-
} catch (error) {
|
|
1728
|
-
await handle.close().catch(() => {
|
|
1729
|
-
});
|
|
1730
|
-
await unlink(tmp).catch(() => {
|
|
1731
|
-
});
|
|
1732
|
-
throw error;
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
async function cleanupOfflineUpload(upload) {
|
|
1736
|
-
if (upload.kind === "chunks") {
|
|
1737
|
-
await rm(upload.filePath, { recursive: true, force: true });
|
|
1738
|
-
return;
|
|
1739
|
-
}
|
|
1740
|
-
await unlink(upload.filePath).catch((error) => {
|
|
1741
|
-
if (error.code === "ENOENT") return;
|
|
1742
|
-
throw error;
|
|
1743
|
-
});
|
|
1744
|
-
}
|
|
1745
|
-
async function readOfflineUploadContent(options) {
|
|
1746
|
-
if (options.readFile) {
|
|
1747
|
-
return options.readFile({
|
|
1748
|
-
root: options.root.abs,
|
|
1749
|
-
path: options.relPath,
|
|
1750
|
-
filePath: options.filePath
|
|
1751
|
-
});
|
|
1752
|
-
}
|
|
1753
|
-
return readFile(options.filePath);
|
|
1754
|
-
}
|
|
1755
|
-
async function writeOfflineUploadContent(options) {
|
|
1756
|
-
await options.writeFile({
|
|
1757
|
-
root: options.root.abs,
|
|
1758
|
-
path: options.relPath,
|
|
1759
|
-
filePath: options.filePath,
|
|
1760
|
-
content: options.content
|
|
1761
|
-
});
|
|
1762
|
-
}
|
|
1763
1713
|
async function deleteSafeFile(root, relPath, deleteFile, mtimeMs) {
|
|
1764
1714
|
const target = await resolveSafeArchiveTarget(root, relPath);
|
|
1765
1715
|
if (deleteFile) {
|
|
@@ -1869,14 +1819,10 @@ export {
|
|
|
1869
1819
|
OFFLINE_SYNC_APPLY_MAX_BODY_BYTES,
|
|
1870
1820
|
OFFLINE_SYNC_SNAPSHOT_BASE_MAX_BODY_BYTES,
|
|
1871
1821
|
OFFLINE_SYNC_MAX_MTIME_MS,
|
|
1872
|
-
globToRegExp,
|
|
1873
1822
|
filterOfflineSyncDeletionRevisions,
|
|
1874
1823
|
normalizeOfflineSyncSnapshot,
|
|
1875
1824
|
normalizeOfflineSyncChangeset,
|
|
1876
1825
|
isInternalRemnicStatePath,
|
|
1877
|
-
compileOfflineSyncExcludeGlobs,
|
|
1878
|
-
parseOfflineSyncExcludes,
|
|
1879
|
-
shouldPreferIncomingOfflineRuntimeFile,
|
|
1880
1826
|
iterateOfflineSyncSnapshotFileRecords,
|
|
1881
1827
|
buildOfflineSyncSnapshot,
|
|
1882
1828
|
buildOfflineSyncSnapshotFromBase,
|
|
@@ -1897,4 +1843,4 @@ export {
|
|
|
1897
1843
|
normalizeOfflineSyncState,
|
|
1898
1844
|
fileStatesFromSnapshot
|
|
1899
1845
|
};
|
|
1900
|
-
//# sourceMappingURL=chunk-
|
|
1846
|
+
//# sourceMappingURL=chunk-OCFXVDBZ.js.map
|