@remnic/core 10.0.51 → 10.0.53
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 +24 -24
- package/dist/access-authorization-probe.js +25 -25
- package/dist/access-boundary.js +24 -24
- package/dist/access-cli.js +65 -65
- package/dist/access-extraction-force-flush.js +24 -24
- package/dist/access-http-briefing.js +25 -25
- package/dist/access-http-query.js +26 -26
- package/dist/access-http.js +40 -40
- package/dist/access-identity-continuity-surface.js +24 -24
- package/dist/access-lcm-surface.js +24 -24
- package/dist/access-mcp.js +33 -33
- package/dist/access-namespace-preflight.js +24 -24
- package/dist/access-observe-write-surface.js +24 -24
- package/dist/access-operations-batch.js +25 -25
- package/dist/access-operations.js +32 -32
- package/dist/access-recall-concurrency.js +24 -24
- package/dist/access-recall-response.js +24 -24
- package/dist/access-recall-surface.js +24 -24
- package/dist/access-service.js +24 -24
- package/dist/access-surface-catalog.js +26 -26
- package/dist/active-recall.js +9 -9
- package/dist/briefing.js +10 -10
- package/dist/buffer.js +5 -5
- package/dist/causal-consolidation.js +11 -11
- package/dist/{chunk-3NL4ALUP.js → chunk-24SIB3EW.js} +3 -3
- package/dist/{chunk-Y3T5KQCR.js → chunk-2EYCW2ET.js} +2 -2
- package/dist/{chunk-AHGOOZUC.js → chunk-34UVJNSG.js} +2 -2
- package/dist/{chunk-2EXF6IIB.js → chunk-3632XJMR.js} +2 -2
- package/dist/{chunk-KETS5A62.js → chunk-3H3PNQEF.js} +2 -2
- package/dist/{chunk-SFRBUBUZ.js → chunk-3LNAQLW4.js} +3 -3
- package/dist/{chunk-75BK4XGV.js → chunk-4BUJICMI.js} +10 -10
- package/dist/{chunk-KIWO4327.js → chunk-4W5B5Z6P.js} +2 -2
- package/dist/{chunk-B35EQQ7L.js → chunk-53OFDW3P.js} +3 -3
- package/dist/{chunk-2ONKXEC7.js → chunk-5LBBXI2A.js} +2 -2
- package/dist/{chunk-UCLJTGP3.js → chunk-65B5RFKQ.js} +2 -2
- package/dist/{chunk-KAJYSO3U.js → chunk-6CDNOREO.js} +2 -2
- package/dist/{chunk-POJRFSJM.js → chunk-7XGNGLAN.js} +2 -2
- package/dist/{chunk-A6JDT6QF.js → chunk-AO5ZOD32.js} +2 -2
- package/dist/{chunk-RA7YRL6H.js → chunk-AOSCGNIC.js} +3 -3
- package/dist/{chunk-LWMLBVGB.js → chunk-B43P3DTC.js} +2 -2
- package/dist/{chunk-SJD334AG.js → chunk-CA6X37OB.js} +217 -173
- package/dist/chunk-CA6X37OB.js.map +1 -0
- package/dist/{chunk-VUMWVYMR.js → chunk-CIMD2MUR.js} +3 -3
- package/dist/{chunk-XRFLR3XF.js → chunk-DLZGSZVC.js} +22 -9
- package/dist/chunk-DLZGSZVC.js.map +1 -0
- package/dist/{chunk-5CWH2LKL.js → chunk-DOJBV6WR.js} +29 -14
- package/dist/chunk-DOJBV6WR.js.map +1 -0
- package/dist/{chunk-44EUCSG4.js → chunk-FFQNNFHX.js} +2 -2
- package/dist/{chunk-HEF4BRMT.js → chunk-FZLZUDJJ.js} +2 -2
- package/dist/{chunk-L3EFYRYK.js → chunk-GGFQAGOT.js} +7 -7
- package/dist/{chunk-ZLCBLDJO.js → chunk-GIRWNTMV.js} +2 -2
- package/dist/{chunk-EC2KVA27.js → chunk-H4DWSOBQ.js} +169 -105
- package/dist/chunk-H4DWSOBQ.js.map +1 -0
- package/dist/{chunk-SHNM7RIT.js → chunk-HJ4X4BGS.js} +2 -2
- package/dist/{chunk-MUNYUSBU.js → chunk-HJQ4NKKO.js} +2 -2
- package/dist/{chunk-V6Z4NAJZ.js → chunk-HM3ZTDAX.js} +2 -2
- package/dist/{chunk-EZS6QJNC.js → chunk-IFOCK3OJ.js} +2 -2
- package/dist/{chunk-LXXIV7Y2.js → chunk-JEX2JL3U.js} +7 -2
- package/dist/{chunk-LXXIV7Y2.js.map → chunk-JEX2JL3U.js.map} +1 -1
- package/dist/{chunk-DF6ZF2BN.js → chunk-LIVNX7WK.js} +2 -2
- package/dist/{chunk-WY66J4PI.js → chunk-LRVFS4KA.js} +2 -2
- package/dist/{chunk-LMB47UM6.js → chunk-LTDK6HBV.js} +2 -2
- package/dist/{chunk-HCIRR3BA.js → chunk-M4U25HLR.js} +2 -2
- package/dist/{chunk-YK7ZJPQM.js → chunk-MGN2RQRG.js} +2 -2
- package/dist/{chunk-G26YNEOC.js → chunk-NWA6IXR3.js} +1 -1
- package/dist/{chunk-G26YNEOC.js.map → chunk-NWA6IXR3.js.map} +1 -1
- package/dist/{chunk-JIJAWTRK.js → chunk-OCXDZJL4.js} +264 -194
- package/dist/chunk-OCXDZJL4.js.map +1 -0
- package/dist/{chunk-IUQXRRJB.js → chunk-OMWQO7H6.js} +2 -2
- package/dist/{chunk-7VO6E5UD.js → chunk-OVZIYLBZ.js} +6 -2
- package/dist/chunk-OVZIYLBZ.js.map +1 -0
- package/dist/{chunk-SPTPBKZX.js → chunk-OWNAWY6D.js} +2 -2
- package/dist/{chunk-XKDQTDXN.js → chunk-PFUXPTBT.js} +36 -15
- package/dist/chunk-PFUXPTBT.js.map +1 -0
- package/dist/{chunk-DQOGZZJA.js → chunk-QAHP5SBG.js} +3 -3
- package/dist/{chunk-GBGU5OZP.js → chunk-QF5EJ5VP.js} +13 -13
- package/dist/{chunk-FT75AQ74.js → chunk-QS5DUSBM.js} +2 -2
- package/dist/{chunk-72CBJ5VP.js → chunk-R3WZ74B2.js} +3 -3
- package/dist/{chunk-PDTNQLPC.js → chunk-RG3I2663.js} +2 -2
- package/dist/{chunk-CK6GCGMX.js → chunk-RTJJPW3C.js} +2 -2
- package/dist/{chunk-RJDYDF5K.js → chunk-TRAOZ2WP.js} +2 -2
- package/dist/{chunk-6ZAU7LAR.js → chunk-TTTPTQ6S.js} +2 -2
- package/dist/{chunk-JS44PBCM.js → chunk-U2A56LLF.js} +6 -6
- package/dist/{chunk-MC7PXJDP.js → chunk-UBOWDOL5.js} +5 -5
- package/dist/{chunk-4FM35YIA.js → chunk-UQYBPPVC.js} +2 -2
- package/dist/{chunk-OCRLJJOV.js → chunk-V4VCBFAL.js} +3 -3
- package/dist/{chunk-FNNGWN3O.js → chunk-VGE4PUY6.js} +2 -2
- package/dist/{chunk-5DVOBBTV.js → chunk-VV73XT3A.js} +2 -2
- package/dist/{chunk-GE3ZX6YK.js → chunk-W7NKMRAF.js} +2 -2
- package/dist/{chunk-AJJPXUE6.js → chunk-WBN66HPI.js} +2 -2
- package/dist/{chunk-XWJUFER3.js → chunk-WGFEGBFB.js} +2 -2
- package/dist/{chunk-43TUWQNR.js → chunk-XDKEHZUC.js} +2 -2
- package/dist/{chunk-ROAKLYOL.js → chunk-XHEKS4UN.js} +2 -2
- package/dist/{chunk-ZKK3VMWU.js → chunk-XVTB6BZS.js} +2 -2
- package/dist/{chunk-AZLD4CKG.js → chunk-Y56D5FSD.js} +17 -17
- package/dist/{chunk-MPWOAIIH.js → chunk-YDT3OEYF.js} +2 -2
- package/dist/{chunk-IN6U2BS5.js → chunk-YJHOVA42.js} +2 -2
- package/dist/{chunk-TC55M5PO.js → chunk-YLN4ZQV4.js} +2 -2
- package/dist/cli.js +50 -50
- package/dist/coding/export-okf-codegraph.js +9 -9
- package/dist/compounding/engine.js +11 -11
- package/dist/config.js +9 -9
- package/dist/connectors/codex-materialize-runner.js +10 -10
- package/dist/connectors/index.js +10 -10
- package/dist/convergence-refresh.js +12 -12
- package/dist/corpus-watermark.js +12 -12
- package/dist/entity-retrieval.js +10 -10
- package/dist/external-wiki-access.js +25 -25
- package/dist/extraction.js +14 -14
- package/dist/harmonic-retrieval.js +10 -10
- package/dist/index.js +65 -65
- package/dist/location/index.js +12 -12
- package/dist/maintenance/memory-governance.js +10 -10
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +10 -10
- package/dist/maintenance/rebuild-memory-projection-runner.js +12 -12
- package/dist/maintenance/rebuild-memory-projection.js +11 -11
- package/dist/memory-browse-operations.js +25 -25
- package/dist/memory-browse.js +5 -5
- package/dist/namespaces/migrate.js +11 -11
- package/dist/namespaces/search.d.ts.map +1 -1
- package/dist/namespaces/search.js +8 -8
- package/dist/namespaces/storage.js +10 -10
- package/dist/operator-doctor-corpus.js +13 -13
- package/dist/operator-toolkit.js +18 -18
- package/dist/orchestration/extraction-persist-deps.d.ts +2 -0
- package/dist/orchestration/extraction-persist-deps.d.ts.map +1 -1
- package/dist/orchestration/extraction-persist-promotion.d.ts +40 -10
- package/dist/orchestration/extraction-persist-promotion.d.ts.map +1 -1
- package/dist/orchestration/extraction-persist.d.ts.map +1 -1
- package/dist/orchestration/lifecycle-pending-fallback-drain.d.ts +18 -0
- package/dist/orchestration/lifecycle-pending-fallback-drain.d.ts.map +1 -0
- package/dist/orchestration/maintenance.d.ts +11 -13
- package/dist/orchestration/maintenance.d.ts.map +1 -1
- package/dist/orchestration/maintenance.js +20 -20
- package/dist/orchestration/qmd-maintenance-completion.d.ts +20 -0
- package/dist/orchestration/qmd-maintenance-completion.d.ts.map +1 -0
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +65 -65
- package/dist/qmd.js +2 -2
- package/dist/recall-composition-decision.js +2 -2
- package/dist/recall-navigation-operations.js +25 -25
- package/dist/recall-navigation.js +24 -24
- package/dist/recall-state-view-admission.js +5 -5
- package/dist/recall-why-service.js +5 -5
- package/dist/resume-bundles.js +9 -9
- package/dist/search/factory.js +7 -7
- package/dist/search/index.js +7 -7
- package/dist/search/lancedb-backend.d.ts +3 -0
- package/dist/search/lancedb-backend.d.ts.map +1 -1
- package/dist/search/lancedb-backend.js +2 -2
- package/dist/search/meilisearch-backend.d.ts +3 -0
- package/dist/search/meilisearch-backend.d.ts.map +1 -1
- package/dist/search/meilisearch-backend.js +2 -2
- package/dist/search/orama-backend.d.ts +3 -0
- package/dist/search/orama-backend.d.ts.map +1 -1
- package/dist/search/orama-backend.js +2 -2
- package/dist/search/port.d.ts +7 -0
- package/dist/search/port.d.ts.map +1 -1
- package/dist/search/port.js +1 -1
- package/dist/search/remote-backend.d.ts +2 -0
- package/dist/search/remote-backend.d.ts.map +1 -1
- package/dist/search/remote-backend.js +2 -2
- package/dist/semantic-consolidation.js +11 -11
- package/dist/semantic-rule-promotion.js +10 -10
- package/dist/semantic-rule-verifier.js +10 -10
- package/dist/source-agent-qualifier.js +13 -13
- package/dist/standup/build.js +10 -10
- package/dist/storage/entity-canonical-id-migration-adapter.d.ts +7 -1
- package/dist/storage/entity-canonical-id-migration-adapter.d.ts.map +1 -1
- package/dist/storage/entity-migration-maintenance-pending.d.ts +31 -0
- package/dist/storage/entity-migration-maintenance-pending.d.ts.map +1 -0
- package/dist/storage.d.ts +2 -2
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +9 -9
- package/dist/support-passport/index.js +27 -27
- package/dist/transfer/export-okf.js +10 -10
- package/dist/verified-recall.js +10 -10
- package/dist/who-knows-cli.js +11 -11
- package/dist/who-knows.js +10 -10
- package/package.json +2 -2
- package/src/namespaces/search.test.ts +121 -0
- package/src/namespaces/search.ts +8 -0
- package/src/orchestration/extraction-persist-deps.ts +3 -0
- package/src/orchestration/extraction-persist-promotion.ts +104 -16
- package/src/orchestration/extraction-persist.ts +66 -77
- package/src/orchestration/lifecycle-pending-fallback-drain.ts +97 -0
- package/src/orchestration/maintenance.test.ts +443 -1
- package/src/orchestration/maintenance.ts +73 -95
- package/src/orchestration/qmd-maintenance-completion.ts +32 -0
- package/src/orchestrator-entity-write-failure.test.ts +370 -0
- package/src/orchestrator.ts +9 -1
- package/src/search/lancedb-backend.ts +29 -12
- package/src/search/meilisearch-backend.test.ts +148 -0
- package/src/search/meilisearch-backend.ts +41 -14
- package/src/search/orama-backend.test.ts +75 -1
- package/src/search/orama-backend.ts +22 -7
- package/src/search/port.ts +7 -0
- package/src/search/remote-backend.ts +4 -0
- package/src/storage/entity-canonical-id-migration-adapter.ts +44 -9
- package/src/storage/entity-migration-maintenance-pending-helpers.test.ts +87 -0
- package/src/storage/entity-migration-maintenance-pending.test.ts +242 -0
- package/src/storage/entity-migration-maintenance-pending.ts +89 -0
- package/src/storage.ts +2 -2
- package/dist/chunk-5CWH2LKL.js.map +0 -1
- package/dist/chunk-7VO6E5UD.js.map +0 -1
- package/dist/chunk-EC2KVA27.js.map +0 -1
- package/dist/chunk-JIJAWTRK.js.map +0 -1
- package/dist/chunk-SJD334AG.js.map +0 -1
- package/dist/chunk-XKDQTDXN.js.map +0 -1
- package/dist/chunk-XRFLR3XF.js.map +0 -1
- /package/dist/{chunk-3NL4ALUP.js.map → chunk-24SIB3EW.js.map} +0 -0
- /package/dist/{chunk-Y3T5KQCR.js.map → chunk-2EYCW2ET.js.map} +0 -0
- /package/dist/{chunk-AHGOOZUC.js.map → chunk-34UVJNSG.js.map} +0 -0
- /package/dist/{chunk-2EXF6IIB.js.map → chunk-3632XJMR.js.map} +0 -0
- /package/dist/{chunk-KETS5A62.js.map → chunk-3H3PNQEF.js.map} +0 -0
- /package/dist/{chunk-SFRBUBUZ.js.map → chunk-3LNAQLW4.js.map} +0 -0
- /package/dist/{chunk-75BK4XGV.js.map → chunk-4BUJICMI.js.map} +0 -0
- /package/dist/{chunk-KIWO4327.js.map → chunk-4W5B5Z6P.js.map} +0 -0
- /package/dist/{chunk-B35EQQ7L.js.map → chunk-53OFDW3P.js.map} +0 -0
- /package/dist/{chunk-2ONKXEC7.js.map → chunk-5LBBXI2A.js.map} +0 -0
- /package/dist/{chunk-UCLJTGP3.js.map → chunk-65B5RFKQ.js.map} +0 -0
- /package/dist/{chunk-KAJYSO3U.js.map → chunk-6CDNOREO.js.map} +0 -0
- /package/dist/{chunk-POJRFSJM.js.map → chunk-7XGNGLAN.js.map} +0 -0
- /package/dist/{chunk-A6JDT6QF.js.map → chunk-AO5ZOD32.js.map} +0 -0
- /package/dist/{chunk-RA7YRL6H.js.map → chunk-AOSCGNIC.js.map} +0 -0
- /package/dist/{chunk-LWMLBVGB.js.map → chunk-B43P3DTC.js.map} +0 -0
- /package/dist/{chunk-VUMWVYMR.js.map → chunk-CIMD2MUR.js.map} +0 -0
- /package/dist/{chunk-44EUCSG4.js.map → chunk-FFQNNFHX.js.map} +0 -0
- /package/dist/{chunk-HEF4BRMT.js.map → chunk-FZLZUDJJ.js.map} +0 -0
- /package/dist/{chunk-L3EFYRYK.js.map → chunk-GGFQAGOT.js.map} +0 -0
- /package/dist/{chunk-ZLCBLDJO.js.map → chunk-GIRWNTMV.js.map} +0 -0
- /package/dist/{chunk-SHNM7RIT.js.map → chunk-HJ4X4BGS.js.map} +0 -0
- /package/dist/{chunk-MUNYUSBU.js.map → chunk-HJQ4NKKO.js.map} +0 -0
- /package/dist/{chunk-V6Z4NAJZ.js.map → chunk-HM3ZTDAX.js.map} +0 -0
- /package/dist/{chunk-EZS6QJNC.js.map → chunk-IFOCK3OJ.js.map} +0 -0
- /package/dist/{chunk-DF6ZF2BN.js.map → chunk-LIVNX7WK.js.map} +0 -0
- /package/dist/{chunk-WY66J4PI.js.map → chunk-LRVFS4KA.js.map} +0 -0
- /package/dist/{chunk-LMB47UM6.js.map → chunk-LTDK6HBV.js.map} +0 -0
- /package/dist/{chunk-HCIRR3BA.js.map → chunk-M4U25HLR.js.map} +0 -0
- /package/dist/{chunk-YK7ZJPQM.js.map → chunk-MGN2RQRG.js.map} +0 -0
- /package/dist/{chunk-IUQXRRJB.js.map → chunk-OMWQO7H6.js.map} +0 -0
- /package/dist/{chunk-SPTPBKZX.js.map → chunk-OWNAWY6D.js.map} +0 -0
- /package/dist/{chunk-DQOGZZJA.js.map → chunk-QAHP5SBG.js.map} +0 -0
- /package/dist/{chunk-GBGU5OZP.js.map → chunk-QF5EJ5VP.js.map} +0 -0
- /package/dist/{chunk-FT75AQ74.js.map → chunk-QS5DUSBM.js.map} +0 -0
- /package/dist/{chunk-72CBJ5VP.js.map → chunk-R3WZ74B2.js.map} +0 -0
- /package/dist/{chunk-PDTNQLPC.js.map → chunk-RG3I2663.js.map} +0 -0
- /package/dist/{chunk-CK6GCGMX.js.map → chunk-RTJJPW3C.js.map} +0 -0
- /package/dist/{chunk-RJDYDF5K.js.map → chunk-TRAOZ2WP.js.map} +0 -0
- /package/dist/{chunk-6ZAU7LAR.js.map → chunk-TTTPTQ6S.js.map} +0 -0
- /package/dist/{chunk-JS44PBCM.js.map → chunk-U2A56LLF.js.map} +0 -0
- /package/dist/{chunk-MC7PXJDP.js.map → chunk-UBOWDOL5.js.map} +0 -0
- /package/dist/{chunk-4FM35YIA.js.map → chunk-UQYBPPVC.js.map} +0 -0
- /package/dist/{chunk-OCRLJJOV.js.map → chunk-V4VCBFAL.js.map} +0 -0
- /package/dist/{chunk-FNNGWN3O.js.map → chunk-VGE4PUY6.js.map} +0 -0
- /package/dist/{chunk-5DVOBBTV.js.map → chunk-VV73XT3A.js.map} +0 -0
- /package/dist/{chunk-GE3ZX6YK.js.map → chunk-W7NKMRAF.js.map} +0 -0
- /package/dist/{chunk-AJJPXUE6.js.map → chunk-WBN66HPI.js.map} +0 -0
- /package/dist/{chunk-XWJUFER3.js.map → chunk-WGFEGBFB.js.map} +0 -0
- /package/dist/{chunk-43TUWQNR.js.map → chunk-XDKEHZUC.js.map} +0 -0
- /package/dist/{chunk-ROAKLYOL.js.map → chunk-XHEKS4UN.js.map} +0 -0
- /package/dist/{chunk-ZKK3VMWU.js.map → chunk-XVTB6BZS.js.map} +0 -0
- /package/dist/{chunk-AZLD4CKG.js.map → chunk-Y56D5FSD.js.map} +0 -0
- /package/dist/{chunk-MPWOAIIH.js.map → chunk-YDT3OEYF.js.map} +0 -0
- /package/dist/{chunk-IN6U2BS5.js.map → chunk-YJHOVA42.js.map} +0 -0
- /package/dist/{chunk-TC55M5PO.js.map → chunk-YLN4ZQV4.js.map} +0 -0
|
@@ -9,26 +9,26 @@ import {
|
|
|
9
9
|
} from "./chunk-666A3MOW.js";
|
|
10
10
|
import {
|
|
11
11
|
PROJECTION_REBUILD_RUNNER_FLAG
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-B43P3DTC.js";
|
|
13
13
|
import {
|
|
14
14
|
startLocationAutoSync
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-6CDNOREO.js";
|
|
16
16
|
import {
|
|
17
17
|
CompoundingEngine,
|
|
18
18
|
isIsoWeekId,
|
|
19
19
|
msUntilNextIsoWeek,
|
|
20
20
|
previousIsoWeekId
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-53OFDW3P.js";
|
|
22
22
|
import {
|
|
23
23
|
rebuildMemoryLifecycleLedger
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-IFOCK3OJ.js";
|
|
25
25
|
import {
|
|
26
26
|
planNamespaceMaintenance,
|
|
27
27
|
runNamespaceMaintenanceBatchPlan
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-R3WZ74B2.js";
|
|
29
29
|
import {
|
|
30
30
|
rebuildMemoryProjection
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-QAHP5SBG.js";
|
|
32
32
|
import {
|
|
33
33
|
DEFAULT_TIMELINE_CATEGORIES,
|
|
34
34
|
TIMELINE_RESERVED_IDLE,
|
|
@@ -108,8 +108,8 @@ import {
|
|
|
108
108
|
|
|
109
109
|
// src/orchestration/maintenance.ts
|
|
110
110
|
import { existsSync as existsSync2 } from "fs";
|
|
111
|
-
import {
|
|
112
|
-
import
|
|
111
|
+
import { lstat as lstat2, readdir, realpath, stat } from "fs/promises";
|
|
112
|
+
import path8 from "path";
|
|
113
113
|
|
|
114
114
|
// src/maintenance/day-summary-cron.ts
|
|
115
115
|
function resolveDaySummaryCronModel(config) {
|
|
@@ -373,14 +373,85 @@ async function maybeRebuildMemoryProjectionScheduled(opts) {
|
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
+
// src/orchestration/lifecycle-pending-fallback-drain.ts
|
|
377
|
+
import { appendFile, mkdir, readFile, writeFile } from "fs/promises";
|
|
378
|
+
import path2 from "path";
|
|
379
|
+
async function drainPendingLifecycleAppendsForPath(memoryDir) {
|
|
380
|
+
const ledgerPath = path2.join(memoryDir, "state", "memory-lifecycle-ledger.jsonl");
|
|
381
|
+
const spillDir = pendingLifecycleLedgerDir(ledgerPath);
|
|
382
|
+
let spillFiles;
|
|
383
|
+
let claimedOrphans;
|
|
384
|
+
try {
|
|
385
|
+
spillFiles = await listContainedSpillFiles(spillDir);
|
|
386
|
+
claimedOrphans = await listContainedSpillFiles(spillDir, ".jsonl.claimed");
|
|
387
|
+
} catch (err) {
|
|
388
|
+
log.debug(`fallback lifecycle pending scan failed (non-fatal) for ${memoryDir}: ${err}`);
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
if (spillFiles.length === 0 && claimedOrphans.length === 0) return;
|
|
392
|
+
const io = {
|
|
393
|
+
writeSecure: async (filePath, payload) => {
|
|
394
|
+
await mkdir(path2.dirname(filePath), { recursive: true });
|
|
395
|
+
await writeFile(filePath, payload, "utf-8");
|
|
396
|
+
},
|
|
397
|
+
readSecure: async (filePath) => {
|
|
398
|
+
if (await probeEncryptedRegularFileHeader(filePath)) {
|
|
399
|
+
throw new Error(`fallback lifecycle drain deferred: encrypted spill at ${filePath}`);
|
|
400
|
+
}
|
|
401
|
+
return readFile(filePath, "utf-8");
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
try {
|
|
405
|
+
await drainPendingLifecycleLedgerIfAny(
|
|
406
|
+
ledgerPath,
|
|
407
|
+
io,
|
|
408
|
+
async (payload) => {
|
|
409
|
+
if (await probeEncryptedRegularFileHeader(ledgerPath)) {
|
|
410
|
+
throw new Error(`fallback lifecycle drain deferred: ledger became encrypted at ${ledgerPath}`);
|
|
411
|
+
}
|
|
412
|
+
await appendFile(ledgerPath, payload, "utf-8");
|
|
413
|
+
},
|
|
414
|
+
async () => {
|
|
415
|
+
await mkdir(path2.dirname(ledgerPath), { recursive: true });
|
|
416
|
+
}
|
|
417
|
+
);
|
|
418
|
+
} catch (err) {
|
|
419
|
+
log.debug(`fallback lifecycle pending drain failed (non-fatal) for ${memoryDir}: ${err}`);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// src/orchestration/qmd-maintenance-completion.ts
|
|
424
|
+
var QmdMaintenanceCompletion = class {
|
|
425
|
+
waiters = [];
|
|
426
|
+
/** Resolves true when a pass that started after this call completed successfully. */
|
|
427
|
+
wait() {
|
|
428
|
+
return new Promise((resolve) => this.waiters.push(resolve));
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* A pass is starting: take every waiter it will serve and return their settle function.
|
|
432
|
+
* `defer` keeps them waiting for a later pass (a pass that covered only part of the selection).
|
|
433
|
+
*/
|
|
434
|
+
claim() {
|
|
435
|
+
const claimed = this.waiters.splice(0);
|
|
436
|
+
return (served, defer = false) => {
|
|
437
|
+
if (defer) this.waiters.unshift(...claimed);
|
|
438
|
+
else claimed.forEach((resolve) => resolve(served));
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
/** The scheduler stopped: nothing will serve the waiters. */
|
|
442
|
+
abandon() {
|
|
443
|
+
this.claim()(false);
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
|
|
376
447
|
// src/compounding/weekly-scheduler.ts
|
|
377
448
|
import { lstat } from "fs/promises";
|
|
378
|
-
import
|
|
449
|
+
import path3 from "path";
|
|
379
450
|
function compoundingWeeklyDoneMarkerPath(memoryDir, weekId) {
|
|
380
451
|
if (!isIsoWeekId(weekId)) {
|
|
381
452
|
throw new Error("compounding weekly cron: week id must be YYYY-Www");
|
|
382
453
|
}
|
|
383
|
-
return
|
|
454
|
+
return path3.join(memoryDir, "compounding", "weekly", ".scheduler", `${weekId}.done`);
|
|
384
455
|
}
|
|
385
456
|
async function defaultWeekDone(memoryDir, weekId) {
|
|
386
457
|
try {
|
|
@@ -517,18 +588,18 @@ async function refreshActivityIndex(qmd, collection, signal) {
|
|
|
517
588
|
|
|
518
589
|
// src/activity/store.ts
|
|
519
590
|
import { mkdirSync } from "fs";
|
|
520
|
-
import { mkdir } from "fs/promises";
|
|
521
|
-
import
|
|
591
|
+
import { mkdir as mkdir2 } from "fs/promises";
|
|
592
|
+
import path4 from "path";
|
|
522
593
|
var ACTIVITY_SCHEMA_VERSION = 1;
|
|
523
594
|
var MAX_SEARCH_RESULTS = 100;
|
|
524
595
|
function activityDatabasePath(memoryDir) {
|
|
525
|
-
return
|
|
596
|
+
return path4.join(memoryDir, "state", "activity.sqlite");
|
|
526
597
|
}
|
|
527
598
|
async function ensureActivityStateDir(memoryDir) {
|
|
528
|
-
await
|
|
599
|
+
await mkdir2(path4.join(memoryDir, "state"), { recursive: true });
|
|
529
600
|
}
|
|
530
601
|
function openActivityDatabase(memoryDir) {
|
|
531
|
-
mkdirSync(
|
|
602
|
+
mkdirSync(path4.join(memoryDir, "state"), { recursive: true });
|
|
532
603
|
const db = openBetterSqlite3(activityDatabasePath(memoryDir));
|
|
533
604
|
db.pragma("journal_mode = WAL");
|
|
534
605
|
db.pragma("busy_timeout = 5000");
|
|
@@ -775,9 +846,9 @@ var ActivityStore = class _ActivityStore {
|
|
|
775
846
|
};
|
|
776
847
|
|
|
777
848
|
// src/activity/pipeline.ts
|
|
778
|
-
import { mkdir as
|
|
849
|
+
import { mkdir as mkdir3, readFile as readFile2, rename, writeFile as writeFile2 } from "fs/promises";
|
|
779
850
|
import { randomUUID } from "crypto";
|
|
780
|
-
import
|
|
851
|
+
import path5 from "path";
|
|
781
852
|
var MAX_SYNC_PAGES = 1e4;
|
|
782
853
|
function activityCursorKey(machine, date) {
|
|
783
854
|
return `${machine}\0${date}`;
|
|
@@ -812,13 +883,13 @@ function snapshotForMachine(snapshot, machine) {
|
|
|
812
883
|
async function writeDigestIfChanged(memoryDir, date, serialized) {
|
|
813
884
|
const target = activityDigestPath(memoryDir, date);
|
|
814
885
|
try {
|
|
815
|
-
if (await
|
|
886
|
+
if (await readFile2(target, "utf8") === serialized) return false;
|
|
816
887
|
} catch (error) {
|
|
817
888
|
if (!(error instanceof Error) || !("code" in error) || error.code !== "ENOENT") throw error;
|
|
818
889
|
}
|
|
819
|
-
await
|
|
890
|
+
await mkdir3(path5.dirname(target), { recursive: true, mode: 448 });
|
|
820
891
|
const temporary = `${target}.${process.pid}.${randomUUID()}.tmp`;
|
|
821
|
-
await
|
|
892
|
+
await writeFile2(temporary, serialized, { encoding: "utf8", mode: 384 });
|
|
822
893
|
await rename(temporary, target);
|
|
823
894
|
return true;
|
|
824
895
|
}
|
|
@@ -963,8 +1034,8 @@ function responsePage(value, machine) {
|
|
|
963
1034
|
nextCursor
|
|
964
1035
|
};
|
|
965
1036
|
}
|
|
966
|
-
function requestUrl(baseUrl,
|
|
967
|
-
const url = new URL(
|
|
1037
|
+
function requestUrl(baseUrl, path9, query) {
|
|
1038
|
+
const url = new URL(path9, baseUrl);
|
|
968
1039
|
const parts = Object.entries(query).filter((entry) => entry[1] !== void 0).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
|
|
969
1040
|
url.search = parts.join("&");
|
|
970
1041
|
return url.toString();
|
|
@@ -1019,13 +1090,13 @@ var ActivityHttpSourceClient = class {
|
|
|
1019
1090
|
// src/activity/timeline/regenerate.ts
|
|
1020
1091
|
import { randomBytes } from "crypto";
|
|
1021
1092
|
import { mkdirSync as mkdirSync3, readdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "fs";
|
|
1022
|
-
import
|
|
1093
|
+
import path7 from "path";
|
|
1023
1094
|
|
|
1024
1095
|
// src/activity/timeline/corrections.ts
|
|
1025
1096
|
import { mkdirSync as mkdirSync2 } from "fs";
|
|
1026
|
-
import
|
|
1097
|
+
import path6 from "path";
|
|
1027
1098
|
function timelineCorrectionDatabasePath(memoryDir) {
|
|
1028
|
-
return
|
|
1099
|
+
return path6.join(memoryDir, "state", "activity-timeline.sqlite");
|
|
1029
1100
|
}
|
|
1030
1101
|
function rowToCorrection(row) {
|
|
1031
1102
|
return {
|
|
@@ -1041,7 +1112,7 @@ var TimelineCorrectionStore = class _TimelineCorrectionStore {
|
|
|
1041
1112
|
this.db = db;
|
|
1042
1113
|
}
|
|
1043
1114
|
static open(memoryDir) {
|
|
1044
|
-
mkdirSync2(
|
|
1115
|
+
mkdirSync2(path6.join(memoryDir, "state"), { recursive: true });
|
|
1045
1116
|
const db = openBetterSqlite3(timelineCorrectionDatabasePath(memoryDir));
|
|
1046
1117
|
db.pragma("journal_mode = WAL");
|
|
1047
1118
|
db.pragma("busy_timeout = 5000");
|
|
@@ -1425,7 +1496,7 @@ async function runTimelineCardAnalysis(input) {
|
|
|
1425
1496
|
|
|
1426
1497
|
// src/activity/timeline/regenerate.ts
|
|
1427
1498
|
var TIMELINE_DAY_FORMAT_VERSION = 1;
|
|
1428
|
-
var TIMELINE_DAY_DIR =
|
|
1499
|
+
var TIMELINE_DAY_DIR = path7.join("activity", "timeline");
|
|
1429
1500
|
var inflight = /* @__PURE__ */ new Map();
|
|
1430
1501
|
function requireToken(value, name) {
|
|
1431
1502
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
@@ -1438,7 +1509,7 @@ function timelineDayPath(memoryDir, date) {
|
|
|
1438
1509
|
if (!isValidActivityDate(date)) {
|
|
1439
1510
|
throw new RangeError("date must be a real YYYY-MM-DD day");
|
|
1440
1511
|
}
|
|
1441
|
-
return
|
|
1512
|
+
return path7.join(path7.resolve(root), TIMELINE_DAY_DIR, `${date}.json`);
|
|
1442
1513
|
}
|
|
1443
1514
|
function snapshotToObservation(snapshot) {
|
|
1444
1515
|
if (typeof snapshot.id !== "number") return null;
|
|
@@ -1468,7 +1539,7 @@ function localDatesForUtcRange(fromMs, toMs, timezone) {
|
|
|
1468
1539
|
function listPersistedTimelineDates(memoryDir) {
|
|
1469
1540
|
let entries;
|
|
1470
1541
|
try {
|
|
1471
|
-
entries = readdirSync(
|
|
1542
|
+
entries = readdirSync(path7.join(path7.resolve(requireToken(memoryDir, "memoryDir")), TIMELINE_DAY_DIR));
|
|
1472
1543
|
} catch {
|
|
1473
1544
|
return [];
|
|
1474
1545
|
}
|
|
@@ -1562,7 +1633,7 @@ function persistDay(filePath, payload) {
|
|
|
1562
1633
|
throw error;
|
|
1563
1634
|
}
|
|
1564
1635
|
}
|
|
1565
|
-
mkdirSync3(
|
|
1636
|
+
mkdirSync3(path7.dirname(filePath), { recursive: true, mode: 448 });
|
|
1566
1637
|
const tmpPath = `${filePath}.${process.pid}.${randomBytes(8).toString("hex")}.tmp`;
|
|
1567
1638
|
writeFileSync(tmpPath, text, { encoding: "utf8", mode: 384 });
|
|
1568
1639
|
try {
|
|
@@ -1657,7 +1728,7 @@ async function regenerateUncached(input) {
|
|
|
1657
1728
|
}
|
|
1658
1729
|
}
|
|
1659
1730
|
async function regenerateTimelineDay(input) {
|
|
1660
|
-
const key = `${
|
|
1731
|
+
const key = `${path7.resolve(requireToken(input.memoryDir, "memoryDir"))}\0${input.date}`;
|
|
1661
1732
|
const pending = inflight.get(key);
|
|
1662
1733
|
if (pending !== void 0) return pending;
|
|
1663
1734
|
const run = regenerateUncached(input).finally(() => {
|
|
@@ -1965,6 +2036,9 @@ var MaintenanceScheduler = class {
|
|
|
1965
2036
|
qmdMaintenanceTimer = null;
|
|
1966
2037
|
qmdMaintenancePending = false;
|
|
1967
2038
|
qmdMaintenanceInFlight = false;
|
|
2039
|
+
qmdCompletion = new QmdMaintenanceCompletion();
|
|
2040
|
+
/** Namespaces that ran in passes of the request still waiting for full coverage. */
|
|
2041
|
+
qmdCoveredNamespaces = /* @__PURE__ */ new Set();
|
|
1968
2042
|
lastQmdEmbedAtMs = 0;
|
|
1969
2043
|
lastQmdEmbedAtMsByNamespace = /* @__PURE__ */ new Map();
|
|
1970
2044
|
// ── Lifecycle-ledger auto-compaction state (issue #1910) ──
|
|
@@ -2055,7 +2129,7 @@ var MaintenanceScheduler = class {
|
|
|
2055
2129
|
}
|
|
2056
2130
|
async autoRegisterDaySummaryCron() {
|
|
2057
2131
|
const home = resolveHomeDir();
|
|
2058
|
-
const jobsPath =
|
|
2132
|
+
const jobsPath = path8.join(home, ".openclaw", "cron", "jobs.json");
|
|
2059
2133
|
try {
|
|
2060
2134
|
if (!existsSync2(jobsPath)) {
|
|
2061
2135
|
log.debug("day-summary cron: jobs.json not found, skipping auto-register");
|
|
@@ -2085,7 +2159,7 @@ var MaintenanceScheduler = class {
|
|
|
2085
2159
|
}
|
|
2086
2160
|
async autoRegisterNightlyGovernanceCron() {
|
|
2087
2161
|
const home = resolveHomeDir();
|
|
2088
|
-
const jobsPath =
|
|
2162
|
+
const jobsPath = path8.join(home, ".openclaw", "cron", "jobs.json");
|
|
2089
2163
|
try {
|
|
2090
2164
|
if (!existsSync2(jobsPath)) {
|
|
2091
2165
|
log.debug("nightly governance cron: jobs.json not found, skipping auto-register");
|
|
@@ -2107,7 +2181,7 @@ var MaintenanceScheduler = class {
|
|
|
2107
2181
|
}
|
|
2108
2182
|
async autoRegisterProceduralMiningCron() {
|
|
2109
2183
|
const home = resolveHomeDir();
|
|
2110
|
-
const jobsPath =
|
|
2184
|
+
const jobsPath = path8.join(home, ".openclaw", "cron", "jobs.json");
|
|
2111
2185
|
try {
|
|
2112
2186
|
if (!existsSync2(jobsPath)) {
|
|
2113
2187
|
log.debug("procedural mining cron: jobs.json not found, skipping auto-register");
|
|
@@ -2127,7 +2201,7 @@ var MaintenanceScheduler = class {
|
|
|
2127
2201
|
}
|
|
2128
2202
|
async autoRegisterContradictionScanCron() {
|
|
2129
2203
|
const home = resolveHomeDir();
|
|
2130
|
-
const jobsPath =
|
|
2204
|
+
const jobsPath = path8.join(home, ".openclaw", "cron", "jobs.json");
|
|
2131
2205
|
try {
|
|
2132
2206
|
if (!existsSync2(jobsPath)) {
|
|
2133
2207
|
log.debug("contradiction scan cron: jobs.json not found, skipping auto-register");
|
|
@@ -2147,7 +2221,7 @@ var MaintenanceScheduler = class {
|
|
|
2147
2221
|
}
|
|
2148
2222
|
async autoRegisterPatternReinforcementCron() {
|
|
2149
2223
|
const home = resolveHomeDir();
|
|
2150
|
-
const jobsPath =
|
|
2224
|
+
const jobsPath = path8.join(home, ".openclaw", "cron", "jobs.json");
|
|
2151
2225
|
try {
|
|
2152
2226
|
if (!existsSync2(jobsPath)) {
|
|
2153
2227
|
log.debug("pattern reinforcement cron: jobs.json not found, skipping auto-register");
|
|
@@ -2167,7 +2241,7 @@ var MaintenanceScheduler = class {
|
|
|
2167
2241
|
}
|
|
2168
2242
|
async autoRegisterGraphEdgeDecayCron() {
|
|
2169
2243
|
const home = resolveHomeDir();
|
|
2170
|
-
const jobsPath =
|
|
2244
|
+
const jobsPath = path8.join(home, ".openclaw", "cron", "jobs.json");
|
|
2171
2245
|
try {
|
|
2172
2246
|
if (!existsSync2(jobsPath)) {
|
|
2173
2247
|
log.debug("graph edge decay cron: jobs.json not found, skipping auto-register");
|
|
@@ -2241,18 +2315,29 @@ var MaintenanceScheduler = class {
|
|
|
2241
2315
|
// ───────────────────────────────────────────────────────────────────────
|
|
2242
2316
|
// QMD maintenance scheduling (debounced + singleflight)
|
|
2243
2317
|
// ───────────────────────────────────────────────────────────────────────
|
|
2244
|
-
/** Internal: queue a debounced QMD maintenance pass. */
|
|
2318
|
+
/** Internal: queue a debounced QMD maintenance pass; false when nothing could be armed. */
|
|
2245
2319
|
requestQmdMaintenance() {
|
|
2246
|
-
if (!this.deps.getQmd().isAvailable()) return;
|
|
2247
|
-
if (!resolveQmdCapabilities(this.deps.config).qmdMaintenance) return;
|
|
2320
|
+
if (!this.deps.getQmd().isAvailable()) return false;
|
|
2321
|
+
if (!resolveQmdCapabilities(this.deps.config).qmdMaintenance) return false;
|
|
2248
2322
|
this.qmdMaintenancePending = true;
|
|
2249
|
-
if (this.qmdMaintenanceTimer) return;
|
|
2323
|
+
if (this.qmdMaintenanceTimer) return true;
|
|
2250
2324
|
this.qmdMaintenanceTimer = setTimeout(() => {
|
|
2251
2325
|
this.qmdMaintenanceTimer = null;
|
|
2252
2326
|
this.runQmdMaintenance().catch(
|
|
2253
2327
|
(err) => log.debug(`background qmd maintenance failed: ${err}`)
|
|
2254
2328
|
);
|
|
2255
2329
|
}, this.deps.config.qmdMaintenanceDebounceMs);
|
|
2330
|
+
return true;
|
|
2331
|
+
}
|
|
2332
|
+
/**
|
|
2333
|
+
* Like a maintenance request, but resolves true only once a pass that started
|
|
2334
|
+
* after it completed successfully. False when nothing could be armed (QMD
|
|
2335
|
+
* unavailable or maintenance off), the pass failed, or dispose() abandoned it,
|
|
2336
|
+
* so a caller that must not lose the re-index keeps owing it.
|
|
2337
|
+
*/
|
|
2338
|
+
requestQmdMaintenanceCompletion() {
|
|
2339
|
+
if (this.disposed || !this.requestQmdMaintenance()) return Promise.resolve(false);
|
|
2340
|
+
return this.qmdCompletion.wait();
|
|
2256
2341
|
}
|
|
2257
2342
|
/**
|
|
2258
2343
|
* Public entrypoint for tool-driven QMD maintenance requests.
|
|
@@ -2282,6 +2367,9 @@ var MaintenanceScheduler = class {
|
|
|
2282
2367
|
if (!this.qmdMaintenancePending) return;
|
|
2283
2368
|
this.qmdMaintenanceInFlight = true;
|
|
2284
2369
|
this.qmdMaintenancePending = false;
|
|
2370
|
+
const settle = this.qmdCompletion.claim();
|
|
2371
|
+
let served = false;
|
|
2372
|
+
let deferred = false;
|
|
2285
2373
|
try {
|
|
2286
2374
|
if (resolveNamespaceCapabilities(this.deps.config).namespaces) {
|
|
2287
2375
|
const plan = await this.namespaceMaintenancePlan("qmd");
|
|
@@ -2300,7 +2388,7 @@ var MaintenanceScheduler = class {
|
|
|
2300
2388
|
}
|
|
2301
2389
|
this.lastQmdEmbedAtMs = now;
|
|
2302
2390
|
};
|
|
2303
|
-
await runNamespaceMaintenanceBatchPlan(
|
|
2391
|
+
const summary = await runNamespaceMaintenanceBatchPlan(
|
|
2304
2392
|
this.deps.config,
|
|
2305
2393
|
plan,
|
|
2306
2394
|
async (candidates) => {
|
|
@@ -2347,8 +2435,34 @@ var MaintenanceScheduler = class {
|
|
|
2347
2435
|
skipReasonForError: qmdMaintenanceSkipReasonForError
|
|
2348
2436
|
}
|
|
2349
2437
|
);
|
|
2438
|
+
const covered = this.qmdCoveredNamespaces;
|
|
2439
|
+
const before = covered.size;
|
|
2440
|
+
for (const status of summary.statuses) {
|
|
2441
|
+
if (status.state === "ran") covered.add(status.namespace);
|
|
2442
|
+
}
|
|
2443
|
+
const uncovered = summary.statuses.some(
|
|
2444
|
+
(status) => status.state === "skipped" && (status.reason === "budget_exhausted" || status.reason === "lock_held") && !covered.has(status.namespace)
|
|
2445
|
+
);
|
|
2446
|
+
served = summary.ran > 0 && summary.failed === 0 && !uncovered;
|
|
2447
|
+
deferred = !served && summary.failed === 0 && covered.size > before && !this.disposed;
|
|
2350
2448
|
} else {
|
|
2351
|
-
|
|
2449
|
+
const qmd = this.deps.getQmd();
|
|
2450
|
+
if (qmd.updateCompleted) {
|
|
2451
|
+
try {
|
|
2452
|
+
served = await qmd.updateCompleted();
|
|
2453
|
+
} catch (err) {
|
|
2454
|
+
log.debug(`qmd maintenance update did not run: ${err}`);
|
|
2455
|
+
}
|
|
2456
|
+
} else if (qmd.updateStrict) {
|
|
2457
|
+
try {
|
|
2458
|
+
await qmd.updateStrict();
|
|
2459
|
+
served = true;
|
|
2460
|
+
} catch (err) {
|
|
2461
|
+
log.debug(`qmd maintenance update did not run: ${err}`);
|
|
2462
|
+
}
|
|
2463
|
+
} else {
|
|
2464
|
+
await qmd.update();
|
|
2465
|
+
}
|
|
2352
2466
|
const now = Date.now();
|
|
2353
2467
|
if (resolveQmdCapabilities(this.deps.config).qmdAutoEmbed && now - this.lastQmdEmbedAtMs >= this.deps.config.qmdEmbedMinIntervalMs) {
|
|
2354
2468
|
await this.deps.getQmd().embed();
|
|
@@ -2356,7 +2470,10 @@ var MaintenanceScheduler = class {
|
|
|
2356
2470
|
}
|
|
2357
2471
|
}
|
|
2358
2472
|
} finally {
|
|
2473
|
+
settle(served, deferred);
|
|
2474
|
+
if (!deferred) this.qmdCoveredNamespaces.clear();
|
|
2359
2475
|
this.qmdMaintenanceInFlight = false;
|
|
2476
|
+
if (deferred) this.qmdMaintenancePending = true;
|
|
2360
2477
|
if (this.qmdMaintenancePending) {
|
|
2361
2478
|
this.requestQmdMaintenance();
|
|
2362
2479
|
}
|
|
@@ -2439,7 +2556,7 @@ var MaintenanceScheduler = class {
|
|
|
2439
2556
|
*/
|
|
2440
2557
|
async hasOverCapEncryptedLifecycleLedger(targets) {
|
|
2441
2558
|
for (const target of targets) {
|
|
2442
|
-
const ledgerPath =
|
|
2559
|
+
const ledgerPath = path8.join(target.memoryDir, "state", "memory-lifecycle-ledger.jsonl");
|
|
2443
2560
|
let size;
|
|
2444
2561
|
try {
|
|
2445
2562
|
size = (await stat(ledgerPath)).size;
|
|
@@ -2466,7 +2583,7 @@ var MaintenanceScheduler = class {
|
|
|
2466
2583
|
if (target.storage) {
|
|
2467
2584
|
await this.drainPendingLifecycleAppends(target.storage);
|
|
2468
2585
|
} else {
|
|
2469
|
-
await
|
|
2586
|
+
await drainPendingLifecycleAppendsForPath(target.memoryDir);
|
|
2470
2587
|
}
|
|
2471
2588
|
}
|
|
2472
2589
|
/** Drain a target's durable pending lifecycle-append spill into its ledger
|
|
@@ -2479,60 +2596,6 @@ var MaintenanceScheduler = class {
|
|
|
2479
2596
|
log.debug(`lifecycle pending drain failed (non-fatal): ${err}`);
|
|
2480
2597
|
}
|
|
2481
2598
|
}
|
|
2482
|
-
/**
|
|
2483
|
-
* Drain a filesystem-fallback target's pending lifecycle-append spill when no
|
|
2484
|
-
* secure StorageManager is available (catalog-disabled namespace; issue
|
|
2485
|
-
* #2033). Uses the safe path-scoped PLAINTEXT context this fallback already
|
|
2486
|
-
* operates in: a keyless drain can only fold plaintext spills into a plaintext
|
|
2487
|
-
* ledger, so it refuses when the ledger or ANY spill is encrypted at rest,
|
|
2488
|
-
* leaving those pending for a keyed (catalog-path) drain — exactly mirroring
|
|
2489
|
-
* the fallback compaction's encrypted-ledger deferral. Non-fatal; a fast
|
|
2490
|
-
* no-op when nothing is pending. The shared spill lister enforces the symlink/
|
|
2491
|
-
* containment guard on every spill file it reads or deletes.
|
|
2492
|
-
*/
|
|
2493
|
-
async drainPendingLifecycleAppendsForPath(memoryDir) {
|
|
2494
|
-
const ledgerPath = path7.join(memoryDir, "state", "memory-lifecycle-ledger.jsonl");
|
|
2495
|
-
const spillDir = pendingLifecycleLedgerDir(ledgerPath);
|
|
2496
|
-
let spillFiles;
|
|
2497
|
-
let claimedOrphans;
|
|
2498
|
-
try {
|
|
2499
|
-
spillFiles = await listContainedSpillFiles(spillDir);
|
|
2500
|
-
claimedOrphans = await listContainedSpillFiles(spillDir, ".jsonl.claimed");
|
|
2501
|
-
} catch (err) {
|
|
2502
|
-
log.debug(`fallback lifecycle pending scan failed (non-fatal) for ${memoryDir}: ${err}`);
|
|
2503
|
-
return;
|
|
2504
|
-
}
|
|
2505
|
-
if (spillFiles.length === 0 && claimedOrphans.length === 0) return;
|
|
2506
|
-
const io = {
|
|
2507
|
-
writeSecure: async (filePath, payload) => {
|
|
2508
|
-
await mkdir3(path7.dirname(filePath), { recursive: true });
|
|
2509
|
-
await writeFile2(filePath, payload, "utf-8");
|
|
2510
|
-
},
|
|
2511
|
-
readSecure: async (filePath) => {
|
|
2512
|
-
if (await probeEncryptedRegularFileHeader(filePath)) {
|
|
2513
|
-
throw new Error(`fallback lifecycle drain deferred: encrypted spill at ${filePath}`);
|
|
2514
|
-
}
|
|
2515
|
-
return readFile2(filePath, "utf-8");
|
|
2516
|
-
}
|
|
2517
|
-
};
|
|
2518
|
-
try {
|
|
2519
|
-
await drainPendingLifecycleLedgerIfAny(
|
|
2520
|
-
ledgerPath,
|
|
2521
|
-
io,
|
|
2522
|
-
async (payload) => {
|
|
2523
|
-
if (await probeEncryptedRegularFileHeader(ledgerPath)) {
|
|
2524
|
-
throw new Error(`fallback lifecycle drain deferred: ledger became encrypted at ${ledgerPath}`);
|
|
2525
|
-
}
|
|
2526
|
-
await appendFile(ledgerPath, payload, "utf-8");
|
|
2527
|
-
},
|
|
2528
|
-
async () => {
|
|
2529
|
-
await mkdir3(path7.dirname(ledgerPath), { recursive: true });
|
|
2530
|
-
}
|
|
2531
|
-
);
|
|
2532
|
-
} catch (err) {
|
|
2533
|
-
log.debug(`fallback lifecycle pending drain failed (non-fatal) for ${memoryDir}: ${err}`);
|
|
2534
|
-
}
|
|
2535
|
-
}
|
|
2536
2599
|
/**
|
|
2537
2600
|
* Enumerate the lifecycle ledgers to consider for compaction: the root
|
|
2538
2601
|
* (through the secure-configured root storage when available) plus every
|
|
@@ -2544,7 +2607,7 @@ var MaintenanceScheduler = class {
|
|
|
2544
2607
|
const targets = [];
|
|
2545
2608
|
const seen = /* @__PURE__ */ new Set();
|
|
2546
2609
|
const addTarget = (memoryDir, storage) => {
|
|
2547
|
-
const key =
|
|
2610
|
+
const key = path8.resolve(memoryDir);
|
|
2548
2611
|
if (seen.has(key)) return;
|
|
2549
2612
|
seen.add(key);
|
|
2550
2613
|
targets.push({ memoryDir, storage });
|
|
@@ -2573,7 +2636,7 @@ var MaintenanceScheduler = class {
|
|
|
2573
2636
|
}
|
|
2574
2637
|
}
|
|
2575
2638
|
if (resolveNamespaceCapabilities(this.deps.config).namespaces) {
|
|
2576
|
-
const namespacesBase =
|
|
2639
|
+
const namespacesBase = path8.join(this.deps.config.memoryDir, "namespaces");
|
|
2577
2640
|
let memoryDirReal;
|
|
2578
2641
|
try {
|
|
2579
2642
|
memoryDirReal = await realpath(this.deps.config.memoryDir);
|
|
@@ -2598,7 +2661,7 @@ var MaintenanceScheduler = class {
|
|
|
2598
2661
|
}
|
|
2599
2662
|
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
2600
2663
|
if (!entry.isDirectory() || entry.isSymbolicLink()) continue;
|
|
2601
|
-
const childPath =
|
|
2664
|
+
const childPath = path8.join(namespacesBase, entry.name);
|
|
2602
2665
|
try {
|
|
2603
2666
|
assertPathInsideRoot(memoryDirReal, await realpath(childPath), childPath);
|
|
2604
2667
|
} catch (err) {
|
|
@@ -2610,7 +2673,7 @@ var MaintenanceScheduler = class {
|
|
|
2610
2673
|
if (resolveNamespaceStorage && routeNamespace !== null) {
|
|
2611
2674
|
try {
|
|
2612
2675
|
const storage = await resolveNamespaceStorage(routeNamespace);
|
|
2613
|
-
if (
|
|
2676
|
+
if (path8.resolve(storage.dir) === path8.resolve(childPath)) {
|
|
2614
2677
|
addTarget(storage.dir, storage);
|
|
2615
2678
|
continue;
|
|
2616
2679
|
}
|
|
@@ -2641,7 +2704,7 @@ var MaintenanceScheduler = class {
|
|
|
2641
2704
|
* an over-cap rewrite never arms the throttle.
|
|
2642
2705
|
*/
|
|
2643
2706
|
async compactLifecycleLedgerTarget(target, threshold) {
|
|
2644
|
-
const ledgerPath =
|
|
2707
|
+
const ledgerPath = path8.join(target.memoryDir, "state", "memory-lifecycle-ledger.jsonl");
|
|
2645
2708
|
let size = 0;
|
|
2646
2709
|
try {
|
|
2647
2710
|
size = (await stat(ledgerPath)).size;
|
|
@@ -2745,6 +2808,7 @@ var MaintenanceScheduler = class {
|
|
|
2745
2808
|
this.qmdMaintenanceTimer = null;
|
|
2746
2809
|
}
|
|
2747
2810
|
this.qmdMaintenancePending = false;
|
|
2811
|
+
this.qmdCompletion.abandon();
|
|
2748
2812
|
await activityDrain;
|
|
2749
2813
|
await locationDrain;
|
|
2750
2814
|
await weeklyDrain;
|
|
@@ -2793,4 +2857,4 @@ export {
|
|
|
2793
2857
|
ActivitySyncScheduler,
|
|
2794
2858
|
MaintenanceScheduler
|
|
2795
2859
|
};
|
|
2796
|
-
//# sourceMappingURL=chunk-
|
|
2860
|
+
//# sourceMappingURL=chunk-H4DWSOBQ.js.map
|