@remnic/core 9.69.87 → 9.69.89
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 +56 -49
- package/dist/access-authorization-probe.js +57 -50
- package/dist/access-boundary.js +56 -49
- package/dist/access-citation-namespace.js +2 -2
- package/dist/access-cli.js +129 -122
- package/dist/access-cli.js.map +1 -1
- package/dist/access-extraction-force-flush.js +56 -49
- package/dist/access-http-briefing.js +57 -50
- 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 +58 -51
- package/dist/access-http.js +78 -71
- package/dist/access-identity-continuity-surface.js +56 -49
- package/dist/access-lcm-surface.js +56 -49
- package/dist/access-mcp-output-schemas.d.ts.map +1 -1
- package/dist/access-mcp-output-schemas.js +1 -1
- package/dist/access-mcp.js +69 -62
- package/dist/access-namespace-preflight.js +56 -49
- package/dist/access-observe-write-category.js +20 -13
- package/dist/access-observe-write-surface.js +56 -49
- package/dist/access-offline-manifest.js +16 -10
- package/dist/access-operations-batch.js +60 -53
- package/dist/access-operations.js +67 -60
- package/dist/access-recall-concurrency.js +56 -49
- package/dist/access-recall-response.js +56 -49
- package/dist/access-recall-surface.js +56 -49
- package/dist/access-schema.js +16 -7
- package/dist/access-service.d.ts.map +1 -1
- package/dist/access-service.js +56 -49
- package/dist/access-surface-catalog.js +58 -51
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/active-recall.js +24 -18
- package/dist/active-recall.js.map +1 -1
- package/dist/{auto-sync-6IPX2BAC.js → auto-sync-U5N3CB5Y.js} +7 -7
- package/dist/briefing.js +11 -11
- package/dist/buffer.js +7 -7
- package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-GWVG7LGC.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 +14 -14
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.js +2 -2
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-JE334SIA.js → chunk-22DYJLFN.js} +2 -2
- package/dist/{chunk-YTQGGO3K.js → chunk-22LMCQ5B.js} +85 -82
- package/dist/{chunk-YTQGGO3K.js.map → chunk-22LMCQ5B.js.map} +1 -1
- package/dist/{chunk-JGSQ6P4D.js → chunk-2FX374UI.js} +2 -2
- package/dist/{chunk-SY5KDWGU.js → chunk-2WLMWP2T.js} +2 -2
- package/dist/{chunk-6TT6HRE4.js → chunk-3AGHSQPM.js} +2 -2
- package/dist/{chunk-P6WFK4ZJ.js → chunk-3O5BB45T.js} +4 -4
- package/dist/{chunk-3C3J243X.js → chunk-3QKO4QN7.js} +3 -3
- package/dist/{chunk-KFCMMDHH.js → chunk-3YD44CH2.js} +2 -2
- package/dist/{chunk-FRCESVV6.js → chunk-4HUCP4R4.js} +18 -18
- package/dist/chunk-4HUCP4R4.js.map +1 -0
- 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-GDYU6VF4.js → chunk-5AYUHSAU.js} +2 -2
- package/dist/{chunk-ICZQG4XE.js → chunk-5FAGCOZD.js} +4 -4
- package/dist/{chunk-VKQI47DJ.js → chunk-5FNZ3G6X.js} +4 -4
- 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-VQNONC4E.js → chunk-5STPRPE7.js} +2 -2
- package/dist/{chunk-52II7PB6.js → chunk-645WOU5I.js} +4 -4
- package/dist/{chunk-SRZW7FNU.js → chunk-64ZUALXK.js} +2 -2
- package/dist/{chunk-4BZP2B4U.js → chunk-6MNKDTDI.js} +2 -2
- package/dist/{chunk-DUJYRVUD.js → chunk-6O2VUWV6.js} +3 -3
- package/dist/chunk-75PT4N7Q.js +75 -0
- package/dist/chunk-75PT4N7Q.js.map +1 -0
- package/dist/{chunk-HESDNYRB.js → chunk-76M5OK7V.js} +2 -2
- package/dist/{chunk-FAN73COB.js → chunk-7D7OUO5W.js} +2 -2
- package/dist/{chunk-DZ525SNQ.js → chunk-7QE46QXI.js} +1 -1
- package/dist/{chunk-VX6GCKBS.js → chunk-7WBSMXGC.js} +4 -4
- package/dist/{chunk-VVDWZRZG.js → chunk-A6RVIHHK.js} +3 -3
- package/dist/{chunk-M536WNTQ.js → chunk-AEJ3TE5H.js} +2 -2
- package/dist/{chunk-72JNNJJJ.js → chunk-AXC4WSF3.js} +3 -3
- package/dist/chunk-AXGJMDBS.js +684 -0
- package/dist/chunk-AXGJMDBS.js.map +1 -0
- package/dist/{chunk-UA5DX5C3.js → chunk-AZIOEOK4.js} +2 -2
- package/dist/{chunk-N4S4NUX5.js → chunk-B3O3IRZN.js} +1 -1
- package/dist/{chunk-XTYX6V52.js → chunk-BJVO4H5C.js} +2 -2
- package/dist/{chunk-7LCGFUMB.js → chunk-BUKK5SWA.js} +4 -4
- package/dist/{chunk-TM3RXL4G.js → chunk-BUQKSQXL.js} +2 -2
- package/dist/chunk-C6HPNPNK.js +64 -0
- package/dist/chunk-C6HPNPNK.js.map +1 -0
- package/dist/{chunk-RB776UH3.js → chunk-C7V3KPKJ.js} +235 -93
- package/dist/chunk-C7V3KPKJ.js.map +1 -0
- package/dist/{chunk-FOH7AMMI.js → chunk-CALBQ2NG.js} +71 -72
- package/dist/chunk-CALBQ2NG.js.map +1 -0
- package/dist/{chunk-37S3IMYB.js → chunk-DGS34QSY.js} +2 -2
- package/dist/{chunk-4IEOGIPB.js → chunk-DO4C4AXD.js} +2 -2
- package/dist/{chunk-SPSRGEDQ.js → chunk-EAQQ2FD3.js} +9 -9
- 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-YITN5WXI.js → chunk-FC52YWAO.js} +2 -2
- package/dist/{chunk-ZI7QA4MK.js → chunk-FEIXG5FA.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-TDYAIXHK.js → chunk-H36X4NRH.js} +5 -5
- package/dist/{chunk-3GQC3NMB.js → chunk-H56VY4BY.js} +5 -5
- package/dist/{chunk-PUKTBULQ.js → chunk-HWLIMQE2.js} +2 -2
- package/dist/{chunk-V2ES4WCZ.js → chunk-IIARQTZ2.js} +2 -2
- package/dist/{chunk-QEV26L2F.js → chunk-IKDRGVVJ.js} +2 -2
- package/dist/{chunk-WQZZDN5M.js → chunk-IVEHY2VT.js} +254 -377
- package/dist/chunk-IVEHY2VT.js.map +1 -0
- package/dist/{chunk-LS3XH3UE.js → chunk-IYIBGSHJ.js} +2 -2
- package/dist/{chunk-YSJTCOHR.js → chunk-J27JML5O.js} +2 -2
- package/dist/{chunk-AQK54Q7O.js → chunk-JB56XYHP.js} +2 -2
- package/dist/{chunk-NE6PHPLG.js → chunk-JBH26P62.js} +10 -10
- package/dist/{chunk-CWHV574S.js → chunk-JUT3OR2L.js} +6 -6
- package/dist/{chunk-6ET2VII7.js → chunk-JYG2334B.js} +2 -2
- package/dist/{chunk-LF5IGOOD.js → chunk-JYM4Y6SO.js} +16 -16
- package/dist/{chunk-FB64XE3R.js → chunk-JZ4TJHR2.js} +2 -2
- package/dist/{chunk-EHS5MJEF.js → chunk-KTKHO3UI.js} +3 -3
- package/dist/{chunk-WIKO4SCR.js → chunk-LHRQBMJN.js} +2 -2
- package/dist/{chunk-K4J4E7WV.js → chunk-LO4UKPKX.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-6NQ4LSMS.js → chunk-MGZMC6WN.js} +47 -47
- package/dist/chunk-MSAI3Q7D.js +372 -0
- package/dist/chunk-MSAI3Q7D.js.map +1 -0
- 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-L6UZEAID.js → chunk-NJVR724O.js} +4 -4
- package/dist/{chunk-VLLD4TOB.js → chunk-NMZVDRVP.js} +2 -2
- package/dist/{chunk-P2WZHLUF.js → chunk-NOL7SEWN.js} +2 -2
- package/dist/{chunk-2NLLXCJG.js → chunk-OWHERGF2.js} +2 -2
- package/dist/{chunk-6L3PBSAR.js → chunk-PMNLL2TL.js} +2 -2
- package/dist/{chunk-VYCOJKSX.js → chunk-PO7NXNGC.js} +2 -2
- package/dist/{chunk-4IIMMZZK.js → chunk-PULDSMCJ.js} +10 -10
- package/dist/{chunk-G6SVZWPB.js → chunk-PZX3AQLF.js} +44 -1
- package/dist/chunk-PZX3AQLF.js.map +1 -0
- package/dist/{chunk-HBBHL4YF.js → chunk-QOXNTKXB.js} +2 -2
- package/dist/{chunk-CUCWX3MO.js → chunk-QZLCVO2V.js} +2 -2
- package/dist/{chunk-NE7I2RCT.js → chunk-R3X2T2LP.js} +2 -2
- package/dist/{chunk-S7GCT7NU.js → chunk-RBITPCMK.js} +8 -8
- package/dist/{chunk-EVBI7S4J.js → chunk-RMDGAAZF.js} +4 -4
- package/dist/{chunk-BJRAELDH.js → chunk-SCXURCVT.js} +3 -3
- package/dist/{chunk-EQ6YOIKO.js → chunk-ST2RQUXC.js} +3 -3
- package/dist/{chunk-CS52MFDV.js → chunk-SZG4WFAG.js} +2 -2
- package/dist/{chunk-BFO3IR56.js → chunk-TPEZ2SHV.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-W4AOR52H.js → chunk-UQDC3W77.js} +2 -2
- package/dist/{chunk-X7Y7WX73.js → chunk-UVYI6VIX.js} +1 -1
- package/dist/{chunk-D5F7TKMH.js → chunk-V4JZCTMK.js} +2 -2
- package/dist/{chunk-MQJL6CDZ.js → chunk-VA4O3U7U.js} +4 -4
- package/dist/{chunk-4CDYONWO.js → chunk-VDO32NLK.js} +3 -3
- package/dist/{chunk-SOZUJCME.js → chunk-VHDKPGMG.js} +6 -6
- package/dist/{chunk-QWW2JDDX.js → chunk-WNRTXEWW.js} +6 -6
- package/dist/{chunk-NR2ASHBL.js → chunk-XOV7NRY5.js} +2 -2
- package/dist/{chunk-KP7SANCF.js → chunk-YPI4RQWV.js} +2 -2
- package/dist/{chunk-JKMHZF3Q.js → chunk-YSWJXOOL.js} +2 -2
- package/dist/{chunk-LQG5O5EP.js → chunk-Z3O53WZR.js} +2 -2
- package/dist/{chunk-QVS22WTO.js → chunk-ZG5DWWKK.js} +2 -2
- package/dist/cli.js +99 -92
- package/dist/coding/export-okf-codegraph.js +12 -12
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compounding/engine.js +12 -12
- package/dist/config.js +24 -18
- package/dist/connectors/codex-materialize-runner.js +11 -11
- package/dist/connectors/index.js +11 -11
- package/dist/console/state.d.ts +30 -0
- package/dist/console/state.d.ts.map +1 -1
- package/dist/contradiction/index.js +5 -5
- package/dist/convergence-refresh.js +13 -13
- package/dist/corpus-watermark.js +13 -13
- package/dist/dashboard-runtime.js +2 -2
- package/dist/deep-recall-http-glue.js +16 -8
- 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 +12 -12
- package/dist/event-order-recall.js +3 -3
- package/dist/explicit-capture.js +6 -6
- package/dist/external-wiki-access.js +57 -50
- package/dist/extraction.js +17 -17
- package/dist/{first-start-migration-7OATHJKB.js → first-start-migration-GAT7G733.js} +4 -4
- package/dist/{graph-edge-decay-KQGS3L3B.js → graph-edge-decay-MKIRZ762.js} +5 -5
- package/dist/graph-jsonl.js +3 -3
- package/dist/graph-snapshot.js +3 -3
- package/dist/graph.js +2 -2
- 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 +195 -164
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.js +5 -5
- package/dist/local-llm.js +2 -2
- package/dist/location/index.js +14 -14
- package/dist/maintenance/memory-governance.js +11 -11
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +11 -11
- package/dist/maintenance/rebuild-memory-projection.js +12 -12
- package/dist/memory-browse-operations.js +57 -50
- package/dist/memory-subject.js +3 -3
- package/dist/namespaces/migrate.js +12 -12
- package/dist/namespaces/storage.js +11 -11
- package/dist/offline-sync-changeset-generations.d.ts +82 -0
- package/dist/offline-sync-changeset-generations.d.ts.map +1 -0
- package/dist/offline-sync-changeset-generations.js +21 -0
- package/dist/offline-sync-embedding-generation.d.ts +257 -0
- package/dist/offline-sync-embedding-generation.d.ts.map +1 -0
- package/dist/offline-sync-embedding-generation.js +44 -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 +29 -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 +58 -28
- package/dist/offline-sync.d.ts.map +1 -1
- package/dist/offline-sync.js +22 -8
- package/dist/operator-doctor-corpus.js +14 -14
- package/dist/operator-toolkit.js +35 -29
- package/dist/orchestration/maintenance.js +22 -22
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +129 -122
- package/dist/recall-navigation-operations.js +57 -50
- package/dist/recall-navigation.js +56 -49
- package/dist/reconcile/manifest.js +4 -4
- package/dist/{resolution-DNX7FO7A.js → resolution-K4A3VPKZ.js} +6 -6
- package/dist/resolution-K4A3VPKZ.js.map +1 -0
- package/dist/resume-bundles.js +25 -19
- package/dist/salvage-envelope.js +5 -5
- 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 +12 -12
- package/dist/semantic-rule-promotion.js +11 -11
- package/dist/semantic-rule-verifier.js +11 -11
- package/dist/source-agent-qualifier.js +14 -14
- package/dist/standup/build.js +11 -11
- 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 +10 -10
- package/dist/subject-config.js +4 -4
- package/dist/summarizer.js +3 -3
- package/dist/support-passport/index.js +59 -52
- package/dist/support-passport/offline-sync-guard.d.ts +6 -2
- package/dist/support-passport/offline-sync-guard.d.ts.map +1 -1
- 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 +12 -12
- package/dist/{tui-55UJMJX7.js → tui-2Z5WOV7L.js} +3 -3
- package/dist/tui-2Z5WOV7L.js.map +1 -0
- package/dist/verified-recall.js +11 -11
- package/dist/who-knows-cli.js +12 -12
- package/dist/who-knows.js +11 -11
- package/dist/write-envelope.js +4 -4
- package/package.json +2 -2
- package/src/access-http-offline-stream.ts +3 -0
- package/src/access-mcp-output-schemas.ts +1 -0
- package/src/access-service.ts +7 -18
- package/src/console/state.test.ts +56 -0
- package/src/console/state.ts +83 -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/index.ts +3 -3
- package/src/offline-sync-changeset-generations.test.ts +962 -0
- package/src/offline-sync-changeset-generations.ts +549 -0
- package/src/offline-sync-embedding-generation.test.ts +2173 -0
- package/src/offline-sync-embedding-generation.ts +1153 -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 +372 -454
- package/src/orchestrator.ts +2 -1
- package/src/secure-store/secure-fs.ts +26 -6
- package/src/storage.ts +11 -6
- package/src/support-passport/offline-sync-guard.ts +16 -2
- package/dist/chunk-3BTFBQLO.js.map +0 -1
- package/dist/chunk-AREGMX2J.js +0 -50
- package/dist/chunk-AREGMX2J.js.map +0 -1
- package/dist/chunk-FOH7AMMI.js.map +0 -1
- package/dist/chunk-FRCESVV6.js.map +0 -1
- package/dist/chunk-G6SVZWPB.js.map +0 -1
- package/dist/chunk-JN72EPOE.js.map +0 -1
- package/dist/chunk-RB776UH3.js.map +0 -1
- package/dist/chunk-WQZZDN5M.js.map +0 -1
- /package/dist/{auto-sync-6IPX2BAC.js.map → auto-sync-U5N3CB5Y.js.map} +0 -0
- /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-GWVG7LGC.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-JGSQ6P4D.js.map → chunk-2FX374UI.js.map} +0 -0
- /package/dist/{chunk-SY5KDWGU.js.map → chunk-2WLMWP2T.js.map} +0 -0
- /package/dist/{chunk-6TT6HRE4.js.map → chunk-3AGHSQPM.js.map} +0 -0
- /package/dist/{chunk-P6WFK4ZJ.js.map → chunk-3O5BB45T.js.map} +0 -0
- /package/dist/{chunk-3C3J243X.js.map → chunk-3QKO4QN7.js.map} +0 -0
- /package/dist/{chunk-KFCMMDHH.js.map → chunk-3YD44CH2.js.map} +0 -0
- /package/dist/{chunk-7DE2NOON.js.map → chunk-4O4XCBOS.js.map} +0 -0
- /package/dist/{chunk-GDYU6VF4.js.map → chunk-5AYUHSAU.js.map} +0 -0
- /package/dist/{chunk-ICZQG4XE.js.map → chunk-5FAGCOZD.js.map} +0 -0
- /package/dist/{chunk-VKQI47DJ.js.map → chunk-5FNZ3G6X.js.map} +0 -0
- /package/dist/{chunk-VQNONC4E.js.map → chunk-5STPRPE7.js.map} +0 -0
- /package/dist/{chunk-52II7PB6.js.map → chunk-645WOU5I.js.map} +0 -0
- /package/dist/{chunk-SRZW7FNU.js.map → chunk-64ZUALXK.js.map} +0 -0
- /package/dist/{chunk-4BZP2B4U.js.map → chunk-6MNKDTDI.js.map} +0 -0
- /package/dist/{chunk-DUJYRVUD.js.map → chunk-6O2VUWV6.js.map} +0 -0
- /package/dist/{chunk-HESDNYRB.js.map → chunk-76M5OK7V.js.map} +0 -0
- /package/dist/{chunk-FAN73COB.js.map → chunk-7D7OUO5W.js.map} +0 -0
- /package/dist/{chunk-DZ525SNQ.js.map → chunk-7QE46QXI.js.map} +0 -0
- /package/dist/{chunk-VX6GCKBS.js.map → chunk-7WBSMXGC.js.map} +0 -0
- /package/dist/{chunk-VVDWZRZG.js.map → chunk-A6RVIHHK.js.map} +0 -0
- /package/dist/{chunk-M536WNTQ.js.map → chunk-AEJ3TE5H.js.map} +0 -0
- /package/dist/{chunk-72JNNJJJ.js.map → chunk-AXC4WSF3.js.map} +0 -0
- /package/dist/{chunk-UA5DX5C3.js.map → chunk-AZIOEOK4.js.map} +0 -0
- /package/dist/{chunk-N4S4NUX5.js.map → chunk-B3O3IRZN.js.map} +0 -0
- /package/dist/{chunk-XTYX6V52.js.map → chunk-BJVO4H5C.js.map} +0 -0
- /package/dist/{chunk-7LCGFUMB.js.map → chunk-BUKK5SWA.js.map} +0 -0
- /package/dist/{chunk-TM3RXL4G.js.map → chunk-BUQKSQXL.js.map} +0 -0
- /package/dist/{chunk-37S3IMYB.js.map → chunk-DGS34QSY.js.map} +0 -0
- /package/dist/{chunk-4IEOGIPB.js.map → chunk-DO4C4AXD.js.map} +0 -0
- /package/dist/{chunk-SPSRGEDQ.js.map → chunk-EAQQ2FD3.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-YITN5WXI.js.map → chunk-FC52YWAO.js.map} +0 -0
- /package/dist/{chunk-ZI7QA4MK.js.map → chunk-FEIXG5FA.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-TDYAIXHK.js.map → chunk-H36X4NRH.js.map} +0 -0
- /package/dist/{chunk-3GQC3NMB.js.map → chunk-H56VY4BY.js.map} +0 -0
- /package/dist/{chunk-PUKTBULQ.js.map → chunk-HWLIMQE2.js.map} +0 -0
- /package/dist/{chunk-V2ES4WCZ.js.map → chunk-IIARQTZ2.js.map} +0 -0
- /package/dist/{chunk-QEV26L2F.js.map → chunk-IKDRGVVJ.js.map} +0 -0
- /package/dist/{chunk-LS3XH3UE.js.map → chunk-IYIBGSHJ.js.map} +0 -0
- /package/dist/{chunk-YSJTCOHR.js.map → chunk-J27JML5O.js.map} +0 -0
- /package/dist/{chunk-AQK54Q7O.js.map → chunk-JB56XYHP.js.map} +0 -0
- /package/dist/{chunk-NE6PHPLG.js.map → chunk-JBH26P62.js.map} +0 -0
- /package/dist/{chunk-CWHV574S.js.map → chunk-JUT3OR2L.js.map} +0 -0
- /package/dist/{chunk-6ET2VII7.js.map → chunk-JYG2334B.js.map} +0 -0
- /package/dist/{chunk-LF5IGOOD.js.map → chunk-JYM4Y6SO.js.map} +0 -0
- /package/dist/{chunk-FB64XE3R.js.map → chunk-JZ4TJHR2.js.map} +0 -0
- /package/dist/{chunk-EHS5MJEF.js.map → chunk-KTKHO3UI.js.map} +0 -0
- /package/dist/{chunk-WIKO4SCR.js.map → chunk-LHRQBMJN.js.map} +0 -0
- /package/dist/{chunk-K4J4E7WV.js.map → chunk-LO4UKPKX.js.map} +0 -0
- /package/dist/{chunk-6NQ4LSMS.js.map → chunk-MGZMC6WN.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-L6UZEAID.js.map → chunk-NJVR724O.js.map} +0 -0
- /package/dist/{chunk-VLLD4TOB.js.map → chunk-NMZVDRVP.js.map} +0 -0
- /package/dist/{chunk-P2WZHLUF.js.map → chunk-NOL7SEWN.js.map} +0 -0
- /package/dist/{chunk-2NLLXCJG.js.map → chunk-OWHERGF2.js.map} +0 -0
- /package/dist/{chunk-6L3PBSAR.js.map → chunk-PMNLL2TL.js.map} +0 -0
- /package/dist/{chunk-VYCOJKSX.js.map → chunk-PO7NXNGC.js.map} +0 -0
- /package/dist/{chunk-4IIMMZZK.js.map → chunk-PULDSMCJ.js.map} +0 -0
- /package/dist/{chunk-HBBHL4YF.js.map → chunk-QOXNTKXB.js.map} +0 -0
- /package/dist/{chunk-CUCWX3MO.js.map → chunk-QZLCVO2V.js.map} +0 -0
- /package/dist/{chunk-NE7I2RCT.js.map → chunk-R3X2T2LP.js.map} +0 -0
- /package/dist/{chunk-S7GCT7NU.js.map → chunk-RBITPCMK.js.map} +0 -0
- /package/dist/{chunk-EVBI7S4J.js.map → chunk-RMDGAAZF.js.map} +0 -0
- /package/dist/{chunk-BJRAELDH.js.map → chunk-SCXURCVT.js.map} +0 -0
- /package/dist/{chunk-EQ6YOIKO.js.map → chunk-ST2RQUXC.js.map} +0 -0
- /package/dist/{chunk-CS52MFDV.js.map → chunk-SZG4WFAG.js.map} +0 -0
- /package/dist/{chunk-BFO3IR56.js.map → chunk-TPEZ2SHV.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-W4AOR52H.js.map → chunk-UQDC3W77.js.map} +0 -0
- /package/dist/{chunk-X7Y7WX73.js.map → chunk-UVYI6VIX.js.map} +0 -0
- /package/dist/{chunk-D5F7TKMH.js.map → chunk-V4JZCTMK.js.map} +0 -0
- /package/dist/{chunk-MQJL6CDZ.js.map → chunk-VA4O3U7U.js.map} +0 -0
- /package/dist/{chunk-4CDYONWO.js.map → chunk-VDO32NLK.js.map} +0 -0
- /package/dist/{chunk-SOZUJCME.js.map → chunk-VHDKPGMG.js.map} +0 -0
- /package/dist/{chunk-QWW2JDDX.js.map → chunk-WNRTXEWW.js.map} +0 -0
- /package/dist/{chunk-NR2ASHBL.js.map → chunk-XOV7NRY5.js.map} +0 -0
- /package/dist/{chunk-KP7SANCF.js.map → chunk-YPI4RQWV.js.map} +0 -0
- /package/dist/{chunk-JKMHZF3Q.js.map → chunk-YSWJXOOL.js.map} +0 -0
- /package/dist/{chunk-LQG5O5EP.js.map → chunk-Z3O53WZR.js.map} +0 -0
- /package/dist/{chunk-QVS22WTO.js.map → chunk-ZG5DWWKK.js.map} +0 -0
- /package/dist/{graph-edge-decay-KQGS3L3B.js.map → embedding-generation-lock.js.map} +0 -0
- /package/dist/{resolution-DNX7FO7A.js.map → embedding-index-storage.js.map} +0 -0
- /package/dist/{first-start-migration-7OATHJKB.js.map → first-start-migration-GAT7G733.js.map} +0 -0
- /package/dist/{state-ITXJKXRE.js.map → graph-edge-decay-MKIRZ762.js.map} +0 -0
- /package/dist/{tui-55UJMJX7.js.map → offline-sync-changeset-generations.js.map} +0 -0
- /package/dist/{trace-ZFVRH4GO.js.map → trace-LXXCMZJA.js.map} +0 -0
|
@@ -2,24 +2,57 @@ 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
|
+
applyChangesetEmbeddingGenerations,
|
|
14
|
+
normalizeChangesetGenerations
|
|
15
|
+
} from "./chunk-MSAI3Q7D.js";
|
|
16
|
+
import {
|
|
17
|
+
applyIncomingEmbeddingGenerations,
|
|
18
|
+
assertEmbeddingGenerationStillIncluded,
|
|
19
|
+
computeOmittedEmbeddingGenerationPaths,
|
|
20
|
+
divergedEmbeddingGenerationDeferrals,
|
|
21
|
+
embeddingGenerationMembership,
|
|
22
|
+
isEmbeddingGenerationDirPath,
|
|
23
|
+
isPathInOmittedEmbeddingGeneration
|
|
24
|
+
} from "./chunk-AXGJMDBS.js";
|
|
10
25
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
26
|
+
isCanonicalRuntimeStatePath,
|
|
27
|
+
shouldDeleteAbsentIncomingOfflineRuntimeFile,
|
|
28
|
+
shouldPreferIncomingOfflineRuntimeFile
|
|
29
|
+
} from "./chunk-TYT4TEQV.js";
|
|
13
30
|
import {
|
|
31
|
+
matchesOfflineSyncDefaultExclude
|
|
32
|
+
} from "./chunk-4NSLQ7EU.js";
|
|
33
|
+
import {
|
|
34
|
+
OFFLINE_SYNC_FAST_BASE_MTIME_TOLERANCE_MS,
|
|
35
|
+
SYNC_INTERNAL_DIR,
|
|
36
|
+
assertOfflineSyncMtimeMs,
|
|
14
37
|
isEncryptedOfflineSyncFile,
|
|
15
38
|
plainFileDigest,
|
|
16
39
|
readPlainOfflineSyncFileChunk,
|
|
40
|
+
setSafeFileMtime,
|
|
17
41
|
sha256OfflineSyncFile,
|
|
18
42
|
shouldExcludeOfflineSyncFile
|
|
19
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-EFHNFTWB.js";
|
|
44
|
+
import {
|
|
45
|
+
prepareSafeArchiveRoot,
|
|
46
|
+
resolveSafeArchiveTarget,
|
|
47
|
+
sha256Bytes,
|
|
48
|
+
validateArchiveRelativePath
|
|
49
|
+
} from "./chunk-GCGJW34D.js";
|
|
50
|
+
import {
|
|
51
|
+
withEmbeddingGenerationLock,
|
|
52
|
+
withEmbeddingGenerationLockIter
|
|
53
|
+
} from "./chunk-75PT4N7Q.js";
|
|
20
54
|
import {
|
|
21
55
|
CENSUS_MAX_MTIME_MS,
|
|
22
|
-
isCensusMtimeMs,
|
|
23
56
|
isSha256Hex
|
|
24
57
|
} from "./chunk-LQWOFU6L.js";
|
|
25
58
|
import {
|
|
@@ -27,18 +60,15 @@ import {
|
|
|
27
60
|
} from "./chunk-P7FMDTKL.js";
|
|
28
61
|
|
|
29
62
|
// src/offline-sync.ts
|
|
30
|
-
import {
|
|
63
|
+
import { randomUUID } from "crypto";
|
|
31
64
|
import {
|
|
32
65
|
lstat,
|
|
33
66
|
mkdir,
|
|
34
|
-
open,
|
|
35
67
|
readdir,
|
|
36
68
|
readFile,
|
|
37
69
|
rename,
|
|
38
|
-
rm,
|
|
39
70
|
stat,
|
|
40
71
|
unlink,
|
|
41
|
-
utimes,
|
|
42
72
|
writeFile
|
|
43
73
|
} from "fs/promises";
|
|
44
74
|
import path from "path";
|
|
@@ -50,9 +80,6 @@ var OFFLINE_SYNC_FILE_CONTENT_TRANSFER_CHUNK_BYTES = 8 * 1024 * 1024;
|
|
|
50
80
|
var OFFLINE_SYNC_APPLY_MAX_BODY_BYTES = 16 * 1024 * 1024;
|
|
51
81
|
var OFFLINE_SYNC_SNAPSHOT_BASE_MAX_BODY_BYTES = 64 * 1024 * 1024;
|
|
52
82
|
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
83
|
var OFFLINE_SYNC_FAST_BASE_CTIME_TOLERANCE_MS = 1;
|
|
57
84
|
var EXCLUDED_FILE_NAMES = /* @__PURE__ */ new Set([
|
|
58
85
|
".sync-state.json"
|
|
@@ -61,45 +88,6 @@ var EXCLUDED_FILE_PREFIXES = [
|
|
|
61
88
|
".remnic-sync.",
|
|
62
89
|
".remnic-sync-state."
|
|
63
90
|
];
|
|
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
91
|
function sha256Buffer(buffer) {
|
|
104
92
|
return sha256Bytes(buffer);
|
|
105
93
|
}
|
|
@@ -122,19 +110,6 @@ function assertNonNegativeInteger(value, field) {
|
|
|
122
110
|
}
|
|
123
111
|
return value;
|
|
124
112
|
}
|
|
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
113
|
function assertBoolean(value, field) {
|
|
139
114
|
if (typeof value !== "boolean") {
|
|
140
115
|
throw new Error(`${field} must be a boolean`);
|
|
@@ -206,12 +181,17 @@ function snapshotBuilderDeletions(options) {
|
|
|
206
181
|
if (deletions.length === 0) return deletions;
|
|
207
182
|
const presentPaths = new Set(options.files.map((file) => file.path.toLowerCase()));
|
|
208
183
|
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(
|
|
184
|
+
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
185
|
deletion.path,
|
|
211
186
|
options.includeTranscripts,
|
|
212
187
|
options.userExcludeRegexps
|
|
213
188
|
)));
|
|
214
189
|
}
|
|
190
|
+
function isDeletionInOmittedGeneration(relPath, omittedGenerationDirs) {
|
|
191
|
+
if (!omittedGenerationDirs || omittedGenerationDirs.size === 0) return false;
|
|
192
|
+
const membership = embeddingGenerationMembership(relPath);
|
|
193
|
+
return membership !== null && omittedGenerationDirs.has(membership.shardDir);
|
|
194
|
+
}
|
|
215
195
|
async function filterOfflineSyncDeletionRevisions(options) {
|
|
216
196
|
const deletions = normalizeDeletionRevisions(options.deletions, "deletions");
|
|
217
197
|
if (deletions === void 0) throw new Error("deletions must be an array");
|
|
@@ -222,9 +202,16 @@ async function filterOfflineSyncDeletionRevisions(options) {
|
|
|
222
202
|
"root"
|
|
223
203
|
);
|
|
224
204
|
const includeTranscripts = options.includeTranscripts !== false;
|
|
205
|
+
const omission = await computeOmittedEmbeddingGenerationPaths({
|
|
206
|
+
rootAbs: root.abs,
|
|
207
|
+
userExcludeRegexps: options.userExcludeRegexps,
|
|
208
|
+
excludeFile: options.excludeFile,
|
|
209
|
+
isExcludedRelPath: (relPath) => shouldExcludePushRelPath(relPath, includeTranscripts, options.userExcludeRegexps)
|
|
210
|
+
});
|
|
211
|
+
const omittedDirs = new Set(omission.omittedDirs);
|
|
225
212
|
const filtered = [];
|
|
226
213
|
for (const deletion of deletions) {
|
|
227
|
-
if (shouldExcludePushRelPath(deletion.path, includeTranscripts, options.userExcludeRegexps)) {
|
|
214
|
+
if (shouldExcludePushRelPath(deletion.path, includeTranscripts, options.userExcludeRegexps) || isDeletionInOmittedGeneration(deletion.path, omittedDirs)) {
|
|
228
215
|
continue;
|
|
229
216
|
}
|
|
230
217
|
const filePath = path.join(root.abs, ...deletion.path.split("/"));
|
|
@@ -272,6 +259,22 @@ function normalizeOfflineSyncSnapshot(input, options = {}) {
|
|
|
272
259
|
if (excludedPath) {
|
|
273
260
|
throw new Error(`offline sync snapshot contains excluded path: ${excludedPath}`);
|
|
274
261
|
}
|
|
262
|
+
let omittedEmbeddingGenerationDirs;
|
|
263
|
+
if (obj.omittedEmbeddingGenerationDirs !== void 0) {
|
|
264
|
+
if (!Array.isArray(obj.omittedEmbeddingGenerationDirs)) {
|
|
265
|
+
throw new Error("offline sync snapshot omittedEmbeddingGenerationDirs must be an array");
|
|
266
|
+
}
|
|
267
|
+
const seenDirs = /* @__PURE__ */ new Set();
|
|
268
|
+
for (const [index, entry] of obj.omittedEmbeddingGenerationDirs.entries()) {
|
|
269
|
+
if (typeof entry !== "string" || !isEmbeddingGenerationDirPath(entry) || seenDirs.has(entry)) {
|
|
270
|
+
throw new Error(
|
|
271
|
+
`omittedEmbeddingGenerationDirs[${index}] must be a unique canonical embeddings generation dir`
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
seenDirs.add(entry);
|
|
275
|
+
}
|
|
276
|
+
omittedEmbeddingGenerationDirs = [...seenDirs].sort((left, right) => left.localeCompare(right));
|
|
277
|
+
}
|
|
275
278
|
return {
|
|
276
279
|
format: OFFLINE_SYNC_SNAPSHOT_FORMAT,
|
|
277
280
|
schemaVersion: 1,
|
|
@@ -279,7 +282,8 @@ function normalizeOfflineSyncSnapshot(input, options = {}) {
|
|
|
279
282
|
sourceId,
|
|
280
283
|
includeTranscripts,
|
|
281
284
|
files,
|
|
282
|
-
...deletions === void 0 ? {} : { deletions }
|
|
285
|
+
...deletions === void 0 ? {} : { deletions },
|
|
286
|
+
...omittedEmbeddingGenerationDirs === void 0 ? {} : { omittedEmbeddingGenerationDirs }
|
|
283
287
|
};
|
|
284
288
|
}
|
|
285
289
|
function normalizeOfflineSyncChangeset(input) {
|
|
@@ -347,13 +351,15 @@ function normalizeOfflineSyncChangeset(input) {
|
|
|
347
351
|
if (excludedPath) {
|
|
348
352
|
throw new Error(`offline sync changeset contains excluded path: ${excludedPath}`);
|
|
349
353
|
}
|
|
354
|
+
const embeddingGenerations = normalizeChangesetGenerations(obj.embeddingGenerations, changes);
|
|
350
355
|
return {
|
|
351
356
|
format: OFFLINE_SYNC_CHANGESET_FORMAT,
|
|
352
357
|
schemaVersion: 1,
|
|
353
358
|
createdAt,
|
|
354
359
|
sourceId,
|
|
355
360
|
includeTranscripts,
|
|
356
|
-
changes: changes.sort(compareByPath)
|
|
361
|
+
changes: changes.sort(compareByPath),
|
|
362
|
+
...embeddingGenerations === void 0 ? {} : { embeddingGenerations }
|
|
357
363
|
};
|
|
358
364
|
}
|
|
359
365
|
function normalizeIsoString(input, field) {
|
|
@@ -404,79 +410,12 @@ function shouldExcludePushRelPath(relPosix, includeTranscripts, userExcludeRegex
|
|
|
404
410
|
if (userExcludeRegexps && userExcludeRegexps.some((re) => re.test(relPosix))) return true;
|
|
405
411
|
return false;
|
|
406
412
|
}
|
|
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
413
|
function shouldIgnoreIncomingRuntimePath(relPosix) {
|
|
443
414
|
if (isInternalRemnicStatePath(relPosix)) return true;
|
|
444
415
|
const parts = relPosix.split("/");
|
|
445
416
|
const basename = parts[parts.length - 1] ?? "";
|
|
446
417
|
return isCanonicalRuntimeStatePath(parts) && basename.includes(".tmp-");
|
|
447
418
|
}
|
|
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
419
|
function filterBaseFilesForMode(files, includeTranscripts) {
|
|
481
420
|
return files.filter((file) => !shouldExcludeRelPath(file.path, includeTranscripts));
|
|
482
421
|
}
|
|
@@ -526,7 +465,14 @@ async function* iterateOfflineSyncSnapshotFileRecords(options) {
|
|
|
526
465
|
const rootAbs = path.resolve(options.root);
|
|
527
466
|
const root = await prepareSafeArchiveRoot(rootAbs, "iterateOfflineSyncSnapshotFileRecords", "root");
|
|
528
467
|
const includeTranscripts = options.includeTranscripts !== false;
|
|
529
|
-
|
|
468
|
+
const pushExcludes = options.excludeNodeLocalState !== false;
|
|
469
|
+
const skipGenerationPaths = options.skipEmbeddingGenerationPaths ?? (pushExcludes ? (await computeOmittedEmbeddingGenerationPaths({
|
|
470
|
+
rootAbs: root.abs,
|
|
471
|
+
userExcludeRegexps: options.userExcludeRegexps,
|
|
472
|
+
excludeFile: options.excludeFile,
|
|
473
|
+
isExcludedRelPath: (relPath) => shouldExcludePushRelPath(relPath, includeTranscripts, options.userExcludeRegexps)
|
|
474
|
+
})).omittedPaths : void 0);
|
|
475
|
+
async function* walk(dirAbs, includeContent = options.includeContent === true) {
|
|
530
476
|
throwIfOfflineSyncAborted(options.signal);
|
|
531
477
|
let entries = await readdir(dirAbs, { withFileTypes: true });
|
|
532
478
|
entries = entries.sort((left, right) => left.name.localeCompare(right.name));
|
|
@@ -534,9 +480,25 @@ async function* iterateOfflineSyncSnapshotFileRecords(options) {
|
|
|
534
480
|
const abs = path.join(dirAbs, entry.name);
|
|
535
481
|
const relPosix = path.relative(root.abs, abs).split(path.sep).join("/");
|
|
536
482
|
if (options.excludeNodeLocalState === false ? shouldExcludeRelPath(relPosix, includeTranscripts) : shouldExcludePushRelPath(relPosix, includeTranscripts, options.userExcludeRegexps)) continue;
|
|
483
|
+
if (skipGenerationPaths?.has(relPosix)) continue;
|
|
537
484
|
if (entry.isSymbolicLink()) continue;
|
|
538
485
|
if (entry.isDirectory()) {
|
|
539
|
-
|
|
486
|
+
if (isEmbeddingGenerationDirPath(relPosix)) {
|
|
487
|
+
yield* withEmbeddingGenerationLockIter(
|
|
488
|
+
path.dirname(abs),
|
|
489
|
+
(content) => walk(abs, content),
|
|
490
|
+
includeContent,
|
|
491
|
+
() => assertEmbeddingGenerationStillIncluded(
|
|
492
|
+
root.abs,
|
|
493
|
+
relPosix,
|
|
494
|
+
options.excludeFile,
|
|
495
|
+
(rel) => shouldExcludePushRelPath(rel, includeTranscripts, options.userExcludeRegexps),
|
|
496
|
+
[]
|
|
497
|
+
)
|
|
498
|
+
);
|
|
499
|
+
continue;
|
|
500
|
+
}
|
|
501
|
+
yield* walk(abs, includeContent);
|
|
540
502
|
continue;
|
|
541
503
|
}
|
|
542
504
|
if (!entry.isFile()) continue;
|
|
@@ -549,7 +511,7 @@ async function* iterateOfflineSyncSnapshotFileRecords(options) {
|
|
|
549
511
|
root,
|
|
550
512
|
relPath: relPosix,
|
|
551
513
|
filePath: abs,
|
|
552
|
-
includeContent
|
|
514
|
+
includeContent,
|
|
553
515
|
readFile: options.readFile,
|
|
554
516
|
readFileDigest: options.readFileDigest,
|
|
555
517
|
signal: options.signal
|
|
@@ -561,8 +523,20 @@ async function* iterateOfflineSyncSnapshotFileRecords(options) {
|
|
|
561
523
|
async function buildOfflineSyncSnapshot(options) {
|
|
562
524
|
throwIfOfflineSyncAborted(options.signal);
|
|
563
525
|
const includeTranscripts = options.includeTranscripts !== false;
|
|
526
|
+
const pushExcludes = options.excludeNodeLocalState !== false;
|
|
527
|
+
const normalizedDeletions = normalizeDeletionRevisions(options.deletions, "deletions");
|
|
528
|
+
const omission = pushExcludes ? await computeOmittedEmbeddingGenerationPaths({
|
|
529
|
+
rootAbs: path.resolve(options.root),
|
|
530
|
+
userExcludeRegexps: options.userExcludeRegexps,
|
|
531
|
+
excludeFile: options.excludeFile,
|
|
532
|
+
tombstonedPaths: (normalizedDeletions ?? []).map((deletion) => deletion.path),
|
|
533
|
+
isExcludedRelPath: (relPath) => shouldExcludePushRelPath(relPath, includeTranscripts, options.userExcludeRegexps)
|
|
534
|
+
}) : void 0;
|
|
564
535
|
const files = [];
|
|
565
|
-
for await (const file of iterateOfflineSyncSnapshotFileRecords(
|
|
536
|
+
for await (const file of iterateOfflineSyncSnapshotFileRecords({
|
|
537
|
+
...options,
|
|
538
|
+
skipEmbeddingGenerationPaths: omission?.omittedPaths
|
|
539
|
+
})) files.push(file);
|
|
566
540
|
throwIfOfflineSyncAborted(options.signal);
|
|
567
541
|
const sortedFiles = files.sort(compareByPath);
|
|
568
542
|
const deletions = snapshotBuilderDeletions({
|
|
@@ -570,7 +544,8 @@ async function buildOfflineSyncSnapshot(options) {
|
|
|
570
544
|
files: sortedFiles,
|
|
571
545
|
includeTranscripts,
|
|
572
546
|
excludeNodeLocalState: options.excludeNodeLocalState,
|
|
573
|
-
userExcludeRegexps: options.userExcludeRegexps
|
|
547
|
+
userExcludeRegexps: options.userExcludeRegexps,
|
|
548
|
+
omittedGenerationDirs: omission && omission.omittedDirs.length > 0 ? new Set(omission.omittedDirs) : void 0
|
|
574
549
|
});
|
|
575
550
|
return {
|
|
576
551
|
format: OFFLINE_SYNC_SNAPSHOT_FORMAT,
|
|
@@ -579,7 +554,8 @@ async function buildOfflineSyncSnapshot(options) {
|
|
|
579
554
|
sourceId: normalizeSourceId(options.sourceId, "sourceId"),
|
|
580
555
|
includeTranscripts,
|
|
581
556
|
files: sortedFiles,
|
|
582
|
-
...deletions === void 0 ? {} : { deletions }
|
|
557
|
+
...deletions === void 0 ? {} : { deletions },
|
|
558
|
+
...omission && omission.omittedDirs.length > 0 ? { omittedEmbeddingGenerationDirs: omission.omittedDirs } : {}
|
|
583
559
|
};
|
|
584
560
|
}
|
|
585
561
|
async function buildOfflineSyncSnapshotFromBase(options) {
|
|
@@ -593,6 +569,15 @@ async function buildOfflineSyncSnapshotFromBase(options) {
|
|
|
593
569
|
));
|
|
594
570
|
const rawBaseCapturedAtMs = options.baseCapturedAt?.getTime();
|
|
595
571
|
const baseCapturedAtMs = rawBaseCapturedAtMs !== void 0 && Number.isFinite(rawBaseCapturedAtMs) ? rawBaseCapturedAtMs : null;
|
|
572
|
+
const pushExcludes = options.excludeNodeLocalState !== false;
|
|
573
|
+
const normalizedDeletions = normalizeDeletionRevisions(options.deletions, "deletions");
|
|
574
|
+
const omission = pushExcludes ? await computeOmittedEmbeddingGenerationPaths({
|
|
575
|
+
rootAbs: root.abs,
|
|
576
|
+
userExcludeRegexps: options.userExcludeRegexps,
|
|
577
|
+
excludeFile: options.excludeFile,
|
|
578
|
+
tombstonedPaths: (normalizedDeletions ?? []).map((deletion) => deletion.path),
|
|
579
|
+
isExcludedRelPath: (relPath) => shouldExcludePushRelPath(relPath, includeTranscripts, options.userExcludeRegexps)
|
|
580
|
+
}) : void 0;
|
|
596
581
|
const files = [];
|
|
597
582
|
async function walk(dirAbs) {
|
|
598
583
|
throwIfOfflineSyncAborted(options.signal);
|
|
@@ -603,8 +588,22 @@ async function buildOfflineSyncSnapshotFromBase(options) {
|
|
|
603
588
|
const abs = path.join(dirAbs, entry.name);
|
|
604
589
|
const relPosix = path.relative(root.abs, abs).split(path.sep).join("/");
|
|
605
590
|
if (options.excludeNodeLocalState === false ? shouldExcludeRelPath(relPosix, includeTranscripts) : shouldExcludePushRelPath(relPosix, includeTranscripts, options.userExcludeRegexps)) continue;
|
|
591
|
+
if (omission?.omittedPaths.has(relPosix)) continue;
|
|
606
592
|
if (entry.isSymbolicLink()) continue;
|
|
607
593
|
if (entry.isDirectory()) {
|
|
594
|
+
if (isEmbeddingGenerationDirPath(relPosix)) {
|
|
595
|
+
await withEmbeddingGenerationLock(path.dirname(abs), async () => {
|
|
596
|
+
await assertEmbeddingGenerationStillIncluded(
|
|
597
|
+
root.abs,
|
|
598
|
+
relPosix,
|
|
599
|
+
options.excludeFile,
|
|
600
|
+
(rel) => shouldExcludePushRelPath(rel, includeTranscripts, options.userExcludeRegexps),
|
|
601
|
+
(normalizedDeletions ?? []).map((deletion) => deletion.path)
|
|
602
|
+
);
|
|
603
|
+
await walk(abs);
|
|
604
|
+
});
|
|
605
|
+
continue;
|
|
606
|
+
}
|
|
608
607
|
await walk(abs);
|
|
609
608
|
continue;
|
|
610
609
|
}
|
|
@@ -639,7 +638,8 @@ async function buildOfflineSyncSnapshotFromBase(options) {
|
|
|
639
638
|
files: sortedFiles,
|
|
640
639
|
includeTranscripts,
|
|
641
640
|
excludeNodeLocalState: options.excludeNodeLocalState,
|
|
642
|
-
userExcludeRegexps: options.userExcludeRegexps
|
|
641
|
+
userExcludeRegexps: options.userExcludeRegexps,
|
|
642
|
+
omittedGenerationDirs: omission && omission.omittedDirs.length > 0 ? new Set(omission.omittedDirs) : void 0
|
|
643
643
|
});
|
|
644
644
|
return {
|
|
645
645
|
format: OFFLINE_SYNC_SNAPSHOT_FORMAT,
|
|
@@ -648,7 +648,8 @@ async function buildOfflineSyncSnapshotFromBase(options) {
|
|
|
648
648
|
sourceId: normalizeSourceId(options.sourceId, "sourceId"),
|
|
649
649
|
includeTranscripts,
|
|
650
650
|
files: sortedFiles,
|
|
651
|
-
...deletions === void 0 ? {} : { deletions }
|
|
651
|
+
...deletions === void 0 ? {} : { deletions },
|
|
652
|
+
...omission && omission.omittedDirs.length > 0 ? { omittedEmbeddingGenerationDirs: omission.omittedDirs } : {}
|
|
652
653
|
};
|
|
653
654
|
}
|
|
654
655
|
async function buildOfflineSyncSnapshotForPaths(options) {
|
|
@@ -942,8 +943,9 @@ async function applyOfflineSyncSnapshot(options) {
|
|
|
942
943
|
));
|
|
943
944
|
const incomingMap = byPath(snapshot.files);
|
|
944
945
|
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
|
|
946
|
+
const incomingBuffers = await verifyRecordContents(snapshot.files, "offline sync snapshot", {
|
|
947
|
+
requireContent: false,
|
|
948
|
+
readIncomingFile: options.readIncomingFile
|
|
947
949
|
});
|
|
948
950
|
const root = await ensureSyncRoot(options.root, "applyOfflineSyncSnapshot");
|
|
949
951
|
const currentFiles = options.currentFiles ? filterBaseFilesForMode(normalizeFileStates(options.currentFiles), snapshot.includeTranscripts).sort(compareByPath) : (await buildOfflineSyncSnapshot({
|
|
@@ -956,10 +958,18 @@ async function applyOfflineSyncSnapshot(options) {
|
|
|
956
958
|
excludeNodeLocalState: false
|
|
957
959
|
})).files;
|
|
958
960
|
const currentMap = byPath(currentFiles);
|
|
959
|
-
const deferredPaths = new Set(
|
|
961
|
+
const deferredPaths = /* @__PURE__ */ new Set([
|
|
962
|
+
...options.deferredPaths ?? [],
|
|
963
|
+
...divergedEmbeddingGenerationDeferrals({
|
|
964
|
+
incomingFiles: snapshot.files,
|
|
965
|
+
baseFiles: [...baseMap.values()],
|
|
966
|
+
currentFiles
|
|
967
|
+
})
|
|
968
|
+
]);
|
|
969
|
+
const omittedGenerationDirs = new Set(snapshot.omittedEmbeddingGenerationDirs ?? []);
|
|
960
970
|
if (deletionMtimeByPath && options.recordDeletionRevision) {
|
|
961
971
|
for (const [relPath, mtimeMs] of deletionMtimeByPath) {
|
|
962
|
-
if (currentMap.has(relPath) || deferredPaths.has(relPath) || matchesOfflineSyncDefaultExclude(relPath)) {
|
|
972
|
+
if (currentMap.has(relPath) || deferredPaths.has(relPath) || omittedGenerationDirs.size > 0 && isPathInOmittedEmbeddingGeneration(relPath, omittedGenerationDirs) || matchesOfflineSyncDefaultExclude(relPath)) {
|
|
963
973
|
continue;
|
|
964
974
|
}
|
|
965
975
|
await options.recordDeletionRevision({
|
|
@@ -982,6 +992,45 @@ async function applyOfflineSyncSnapshot(options) {
|
|
|
982
992
|
if (buffer || options.allowMissingConflictContent === true) return buffer;
|
|
983
993
|
return requiredBuffer(incomingBuffers, relPath);
|
|
984
994
|
};
|
|
995
|
+
const { transactionResults, deferredGenerationDirs } = await applyIncomingEmbeddingGenerations({
|
|
996
|
+
root,
|
|
997
|
+
incomingMap,
|
|
998
|
+
incomingBuffers,
|
|
999
|
+
baseMap,
|
|
1000
|
+
currentMap,
|
|
1001
|
+
deferredPaths,
|
|
1002
|
+
omittedGenerationDirs,
|
|
1003
|
+
deletionMtimeByPath,
|
|
1004
|
+
io: {
|
|
1005
|
+
readFile: options.readFile,
|
|
1006
|
+
writeStagingFile: options.writeStagingFile,
|
|
1007
|
+
readStagingFile: options.readStagingFile,
|
|
1008
|
+
deleteFile: options.deleteFile
|
|
1009
|
+
},
|
|
1010
|
+
customIoPresent: Boolean(options.writeFile || options.readFile || options.readFileDigest || options.deleteFile),
|
|
1011
|
+
now: Date.now()
|
|
1012
|
+
});
|
|
1013
|
+
const transactionHandled = /* @__PURE__ */ new Set();
|
|
1014
|
+
let generationUpserted = 0;
|
|
1015
|
+
let generationDeleted = 0;
|
|
1016
|
+
for (const result of transactionResults) {
|
|
1017
|
+
if (result.deferredLocalDivergence) {
|
|
1018
|
+
for (const relPath of result.handledPaths) deferredPaths.add(relPath);
|
|
1019
|
+
deferredGenerationDirs.add(result.shardDirRel);
|
|
1020
|
+
continue;
|
|
1021
|
+
}
|
|
1022
|
+
generationUpserted += result.upserted;
|
|
1023
|
+
generationDeleted += result.deleted;
|
|
1024
|
+
for (const relPath of result.handledPaths) transactionHandled.add(relPath);
|
|
1025
|
+
for (const [relPath, state] of result.writtenStates) {
|
|
1026
|
+
nextBase.set(relPath, state);
|
|
1027
|
+
transactionHandled.add(relPath);
|
|
1028
|
+
}
|
|
1029
|
+
for (const relPath of result.removedPaths) {
|
|
1030
|
+
nextBase.delete(relPath);
|
|
1031
|
+
transactionHandled.add(relPath);
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
985
1034
|
for (const relPath of unionPaths(baseMap, incomingMap, currentMap)) {
|
|
986
1035
|
const base = baseMap.get(relPath);
|
|
987
1036
|
const incoming = incomingMap.get(relPath);
|
|
@@ -992,6 +1041,14 @@ async function applyOfflineSyncSnapshot(options) {
|
|
|
992
1041
|
skipped += 1;
|
|
993
1042
|
continue;
|
|
994
1043
|
}
|
|
1044
|
+
if (transactionHandled.has(relPath)) continue;
|
|
1045
|
+
const membership = embeddingGenerationMembership(relPath);
|
|
1046
|
+
if (membership && deferredGenerationDirs.has(membership.shardDir)) {
|
|
1047
|
+
if (base) nextBase.set(relPath, base);
|
|
1048
|
+
else nextBase.delete(relPath);
|
|
1049
|
+
skipped += 1;
|
|
1050
|
+
continue;
|
|
1051
|
+
}
|
|
995
1052
|
if (incoming) {
|
|
996
1053
|
if (currentEntry?.sha256 === incoming.sha256) {
|
|
997
1054
|
if (await setSafeFileMtime(root, relPath, incoming.mtimeMs)) {
|
|
@@ -1079,6 +1136,11 @@ async function applyOfflineSyncSnapshot(options) {
|
|
|
1079
1136
|
skipped += 1;
|
|
1080
1137
|
continue;
|
|
1081
1138
|
}
|
|
1139
|
+
if (shouldPreferIncomingOfflineRuntimeFile(relPath) && membership !== null && omittedGenerationDirs.has(membership.shardDir)) {
|
|
1140
|
+
pendingLocal += 1;
|
|
1141
|
+
skipped += 1;
|
|
1142
|
+
continue;
|
|
1143
|
+
}
|
|
1082
1144
|
if (shouldPreferIncomingOfflineRuntimeFile(relPath) && (base || shouldDeleteAbsentIncomingOfflineRuntimeFile(relPath))) {
|
|
1083
1145
|
await deleteSafeFile(
|
|
1084
1146
|
root,
|
|
@@ -1120,8 +1182,8 @@ async function applyOfflineSyncSnapshot(options) {
|
|
|
1120
1182
|
skipped += 1;
|
|
1121
1183
|
}
|
|
1122
1184
|
return {
|
|
1123
|
-
upserted,
|
|
1124
|
-
deleted,
|
|
1185
|
+
upserted: upserted + generationUpserted,
|
|
1186
|
+
deleted: deleted + generationDeleted,
|
|
1125
1187
|
skipped,
|
|
1126
1188
|
pendingLocal,
|
|
1127
1189
|
conflicts,
|
|
@@ -1140,7 +1202,7 @@ async function applyOfflineSyncChangeset(options) {
|
|
|
1140
1202
|
}
|
|
1141
1203
|
const root = await ensureSyncRoot(options.root, "applyOfflineSyncChangeset");
|
|
1142
1204
|
const records = changeset.changes.filter((change) => change.type === "upsert").map((change) => change.file);
|
|
1143
|
-
const incomingBuffers = verifyRecordContents(records, "offline sync changeset");
|
|
1205
|
+
const incomingBuffers = await verifyRecordContents(records, "offline sync changeset");
|
|
1144
1206
|
const currentFiles = options.currentFiles ? filterBaseFilesForMode(normalizeFileStates(options.currentFiles), changeset.includeTranscripts).sort(compareByPath) : (await buildOfflineSyncSnapshotForPaths({
|
|
1145
1207
|
root: root.abs,
|
|
1146
1208
|
sourceId: "local",
|
|
@@ -1156,7 +1218,26 @@ async function applyOfflineSyncChangeset(options) {
|
|
|
1156
1218
|
let appliedUpserts = 0;
|
|
1157
1219
|
let appliedDeletes = 0;
|
|
1158
1220
|
let skipped = 0;
|
|
1221
|
+
const generationRouting = await applyChangesetEmbeddingGenerations({
|
|
1222
|
+
root,
|
|
1223
|
+
changeset,
|
|
1224
|
+
incomingBuffers,
|
|
1225
|
+
currentMap,
|
|
1226
|
+
io: {
|
|
1227
|
+
readFile: options.readFile,
|
|
1228
|
+
writeStagingFile: options.writeStagingFile,
|
|
1229
|
+
readStagingFile: options.readStagingFile,
|
|
1230
|
+
deleteFile: options.deleteFile
|
|
1231
|
+
},
|
|
1232
|
+
customIoPresent: Boolean(options.writeFile || options.readFile || options.readFileDigest || options.deleteFile),
|
|
1233
|
+
now: Date.now()
|
|
1234
|
+
});
|
|
1235
|
+
appliedUpserts += generationRouting.appliedUpserts;
|
|
1236
|
+
appliedDeletes += generationRouting.appliedDeletes;
|
|
1237
|
+
conflicts.push(...generationRouting.conflicts);
|
|
1159
1238
|
for (const change of changeset.changes) {
|
|
1239
|
+
if (generationRouting.conflictedPaths.has(change.path)) continue;
|
|
1240
|
+
if (generationRouting.transactionHandled.has(change.path)) continue;
|
|
1160
1241
|
const currentEntry = currentMap.get(change.path);
|
|
1161
1242
|
if (change.type === "upsert") {
|
|
1162
1243
|
if (currentEntry?.sha256 === change.file.sha256) {
|
|
@@ -1234,6 +1315,8 @@ async function applyOfflineSyncChangeset(options) {
|
|
|
1234
1315
|
localSha256: currentEntry.sha256
|
|
1235
1316
|
});
|
|
1236
1317
|
}
|
|
1318
|
+
for (const [relPath, state] of generationRouting.writtenStates) currentMap.set(relPath, state);
|
|
1319
|
+
for (const relPath of generationRouting.removedPaths) currentMap.delete(relPath);
|
|
1237
1320
|
return {
|
|
1238
1321
|
appliedUpserts,
|
|
1239
1322
|
appliedDeletes,
|
|
@@ -1251,10 +1334,25 @@ async function applyOfflineSyncChangeset(options) {
|
|
|
1251
1334
|
...options.returnCurrentFiles === false ? { currentFilesComplete: false } : {}
|
|
1252
1335
|
};
|
|
1253
1336
|
}
|
|
1254
|
-
function verifyRecordContents(records, context, options = {}) {
|
|
1337
|
+
async function verifyRecordContents(records, context, options = {}) {
|
|
1255
1338
|
const buffers = /* @__PURE__ */ new Map();
|
|
1256
1339
|
for (const record of records) {
|
|
1257
1340
|
if (typeof record.contentBase64 !== "string") {
|
|
1341
|
+
if (options.readIncomingFile) {
|
|
1342
|
+
const incoming = await options.readIncomingFile({
|
|
1343
|
+
path: record.path,
|
|
1344
|
+
sha256: record.sha256,
|
|
1345
|
+
bytes: record.bytes
|
|
1346
|
+
});
|
|
1347
|
+
if (incoming) {
|
|
1348
|
+
const digest2 = sha256Buffer(incoming);
|
|
1349
|
+
if (digest2.sha256 !== record.sha256 || digest2.bytes !== record.bytes) {
|
|
1350
|
+
throw new Error(`${context}: incoming content checksum mismatch for ${record.path}`);
|
|
1351
|
+
}
|
|
1352
|
+
buffers.set(record.path, incoming);
|
|
1353
|
+
continue;
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1258
1356
|
if (options.requireContent === false) continue;
|
|
1259
1357
|
throw new Error(`${context}: contentBase64 is required for ${record.path}`);
|
|
1260
1358
|
}
|
|
@@ -1332,25 +1430,6 @@ async function writeSafeFile(root, relPath, content, writeFileHook, mtimeMs) {
|
|
|
1332
1430
|
throw error;
|
|
1333
1431
|
}
|
|
1334
1432
|
}
|
|
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
1433
|
async function readLocalFileState(options) {
|
|
1355
1434
|
const filePath = await resolveSafeArchiveTarget(
|
|
1356
1435
|
await prepareSafeArchiveRoot(options.rootAbs, "readLocalFileState", "rootAbs"),
|
|
@@ -1562,204 +1641,6 @@ async function applyOfflineSyncFileContentChunk(options) {
|
|
|
1562
1641
|
});
|
|
1563
1642
|
}
|
|
1564
1643
|
}
|
|
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
1644
|
async function deleteSafeFile(root, relPath, deleteFile, mtimeMs) {
|
|
1764
1645
|
const target = await resolveSafeArchiveTarget(root, relPath);
|
|
1765
1646
|
if (deleteFile) {
|
|
@@ -1869,14 +1750,10 @@ export {
|
|
|
1869
1750
|
OFFLINE_SYNC_APPLY_MAX_BODY_BYTES,
|
|
1870
1751
|
OFFLINE_SYNC_SNAPSHOT_BASE_MAX_BODY_BYTES,
|
|
1871
1752
|
OFFLINE_SYNC_MAX_MTIME_MS,
|
|
1872
|
-
globToRegExp,
|
|
1873
1753
|
filterOfflineSyncDeletionRevisions,
|
|
1874
1754
|
normalizeOfflineSyncSnapshot,
|
|
1875
1755
|
normalizeOfflineSyncChangeset,
|
|
1876
1756
|
isInternalRemnicStatePath,
|
|
1877
|
-
compileOfflineSyncExcludeGlobs,
|
|
1878
|
-
parseOfflineSyncExcludes,
|
|
1879
|
-
shouldPreferIncomingOfflineRuntimeFile,
|
|
1880
1757
|
iterateOfflineSyncSnapshotFileRecords,
|
|
1881
1758
|
buildOfflineSyncSnapshot,
|
|
1882
1759
|
buildOfflineSyncSnapshotFromBase,
|
|
@@ -1897,4 +1774,4 @@ export {
|
|
|
1897
1774
|
normalizeOfflineSyncState,
|
|
1898
1775
|
fileStatesFromSnapshot
|
|
1899
1776
|
};
|
|
1900
|
-
//# sourceMappingURL=chunk-
|
|
1777
|
+
//# sourceMappingURL=chunk-IVEHY2VT.js.map
|