@remnic/core 10.0.70 → 10.0.72
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 +14 -14
- package/dist/access-authorization-probe.js +15 -15
- package/dist/access-boundary.js +14 -14
- package/dist/access-cli.js +58 -58
- package/dist/access-extraction-force-flush.js +14 -14
- package/dist/access-http-briefing.js +15 -15
- package/dist/access-http-query.js +16 -16
- package/dist/access-http.js +31 -31
- package/dist/access-identity-continuity-surface.js +14 -14
- package/dist/access-lcm-surface.js +14 -14
- package/dist/access-mcp.js +24 -24
- package/dist/access-namespace-preflight.js +14 -14
- package/dist/access-observe-write-surface.js +14 -14
- package/dist/access-operations-batch.js +16 -16
- package/dist/access-operations.js +23 -23
- package/dist/access-recall-concurrency.js +14 -14
- package/dist/access-recall-response.js +14 -14
- package/dist/access-recall-surface.js +14 -14
- package/dist/access-service.js +14 -14
- package/dist/access-surface-catalog.js +16 -16
- package/dist/active-recall.js +3 -3
- package/dist/briefing.js +4 -4
- package/dist/buffer-turn-helpers.d.ts +10 -1
- package/dist/buffer-turn-helpers.d.ts.map +1 -1
- package/dist/buffer-turn-helpers.js +3 -1
- package/dist/buffer.d.ts +4 -0
- package/dist/buffer.d.ts.map +1 -1
- package/dist/buffer.js +3 -3
- package/dist/causal-consolidation.js +5 -5
- package/dist/{chunk-B7YAIHAV.js → chunk-23BA3USG.js} +10 -10
- package/dist/{chunk-3F7N4I5I.js → chunk-2R44BBPK.js} +2 -2
- package/dist/{chunk-BW33YTF3.js → chunk-2WPWEVAH.js} +2 -2
- package/dist/{chunk-EF3HNVL4.js → chunk-4PMFSYH7.js} +2 -2
- package/dist/{chunk-J5TVHCDG.js → chunk-5ORJHH43.js} +2 -2
- package/dist/{chunk-MK7HXGM6.js → chunk-6KBCUIZP.js} +2 -2
- package/dist/{chunk-OX6GY22Q.js → chunk-7P5VBRBS.js} +2 -2
- package/dist/{chunk-3AASGFR4.js → chunk-7WFY2L5J.js} +3 -3
- package/dist/{chunk-YLMTFRZR.js → chunk-AGRMXXVA.js} +2 -2
- package/dist/{chunk-WIW4LOZL.js → chunk-AZNE2H6D.js} +2 -2
- package/dist/{chunk-GT4G2S2Y.js → chunk-BCBY5GYZ.js} +2 -2
- package/dist/{chunk-EIZ4MK33.js → chunk-BTU77RB5.js} +2 -2
- package/dist/{chunk-ZS5LREUZ.js → chunk-DC3DWF2M.js} +2 -2
- package/dist/{chunk-LTST4R7U.js → chunk-DE4U5PTV.js} +49 -45
- package/dist/chunk-DE4U5PTV.js.map +1 -0
- package/dist/{chunk-OAQO5AZJ.js → chunk-DSSTOV5M.js} +440 -267
- package/dist/chunk-DSSTOV5M.js.map +1 -0
- package/dist/{chunk-VDYRXI3E.js → chunk-EGKDONTC.js} +9 -3
- package/dist/chunk-EGKDONTC.js.map +1 -0
- package/dist/{chunk-FM6UKZAE.js → chunk-EQ6EMJRG.js} +2 -2
- package/dist/{chunk-TSZP7GGJ.js → chunk-FGGLVCHI.js} +2 -2
- package/dist/{chunk-K7LLGCPH.js → chunk-GXAZ4Q2S.js} +2 -2
- package/dist/{chunk-2GV24KFD.js → chunk-H2X32F2K.js} +2 -2
- package/dist/{chunk-2YPIFJHL.js → chunk-ICBUTKLL.js} +2 -2
- package/dist/{chunk-3W37NITP.js → chunk-IQXQ3KWR.js} +2 -2
- package/dist/{chunk-HNF7IMYQ.js → chunk-J72ZY7NU.js} +2 -2
- package/dist/{chunk-6QS5NQJH.js → chunk-JGLZ46JS.js} +2 -2
- package/dist/{chunk-MRN2MKB7.js → chunk-JY4LXMZR.js} +2 -2
- package/dist/{chunk-UJ2FP2RV.js → chunk-KY3KJUNN.js} +2 -2
- package/dist/{chunk-64U42JL5.js → chunk-LHMCZ6VW.js} +10 -10
- package/dist/{chunk-YRMSHA7H.js → chunk-LN7CWLAU.js} +2 -2
- package/dist/{chunk-XR4QR3JT.js → chunk-LYOCAUI6.js} +3 -3
- package/dist/{chunk-VA3GNAWQ.js → chunk-LZIOY7ZU.js} +4 -5
- package/dist/chunk-LZIOY7ZU.js.map +1 -0
- package/dist/{chunk-GMSRLDVR.js → chunk-N2Y6COEM.js} +2 -2
- package/dist/{chunk-XDUP6SWG.js → chunk-OGQGDOYK.js} +2 -2
- package/dist/{chunk-U7MIMS2Y.js → chunk-OUBEJWVI.js} +17 -1
- package/dist/chunk-OUBEJWVI.js.map +1 -0
- package/dist/{chunk-5FMGPV34.js → chunk-OWZXDBV4.js} +2 -2
- package/dist/{chunk-SQO5SEKA.js → chunk-PJAMFIDE.js} +3 -3
- package/dist/{chunk-I6HRHJRA.js → chunk-QIOQI7QZ.js} +2 -2
- package/dist/{chunk-OAKOAOEG.js → chunk-QUPTDKSX.js} +22 -22
- package/dist/{chunk-MCFI6G7U.js → chunk-QVZZE6VH.js} +3 -3
- package/dist/{chunk-LYTKNK5O.js → chunk-S37O4S6E.js} +2 -2
- package/dist/{chunk-ILD7N3XC.js → chunk-S73ZVU37.js} +2 -2
- package/dist/{chunk-5VQSKBNF.js → chunk-U6IL4724.js} +2 -2
- package/dist/{chunk-D3AGBN6G.js → chunk-UAOJVQXC.js} +2 -2
- package/dist/{chunk-MKMIY3E7.js → chunk-UE5JYPU6.js} +7 -7
- package/dist/{chunk-K47G2CBP.js → chunk-USX5YIKB.js} +5 -5
- package/dist/{chunk-YIG4HPY4.js → chunk-VK5HKVQ7.js} +2 -2
- package/dist/{chunk-ZOBYTRBU.js → chunk-VNTQU6KB.js} +47 -2
- package/dist/chunk-VNTQU6KB.js.map +1 -0
- package/dist/{chunk-THFSCUFC.js → chunk-VSJ3ARFS.js} +2 -2
- package/dist/{chunk-4BOBW6H4.js → chunk-W4V7P5HP.js} +2 -2
- package/dist/{chunk-DM3UZUCN.js → chunk-WNQ3B3Q5.js} +2 -2
- package/dist/{chunk-MFKBYXBY.js → chunk-WYOHQJKC.js} +6 -6
- package/dist/{chunk-66PEACZP.js → chunk-X4DHAXFO.js} +3 -3
- package/dist/{chunk-ZYEWTVNQ.js → chunk-XPZM7GP6.js} +7 -7
- package/dist/{chunk-2BBMCMJS.js → chunk-YPYSC3TX.js} +2 -2
- package/dist/{chunk-JGQEF33K.js → chunk-ZBET3W26.js} +2 -2
- package/dist/chunk-ZODKV27J.js +443 -0
- package/dist/chunk-ZODKV27J.js.map +1 -0
- package/dist/cli.js +43 -43
- package/dist/coding/export-okf-codegraph.js +3 -3
- package/dist/compounding/engine.js +5 -5
- package/dist/config.js +3 -3
- package/dist/connectors/codex-materialize-runner.js +4 -4
- package/dist/connectors/index.js +4 -4
- package/dist/convergence-refresh.js +6 -6
- package/dist/corpus-watermark.js +6 -6
- package/dist/entity-retrieval.js +4 -4
- package/dist/external-wiki-access.js +15 -15
- package/dist/extraction-window-drain.d.ts.map +1 -1
- package/dist/extraction-window-drain.js +1 -1
- package/dist/extraction.js +7 -7
- package/dist/harmonic-retrieval.js +4 -4
- package/dist/index.js +58 -58
- package/dist/location/index.js +6 -6
- package/dist/maintenance/memory-governance.js +4 -4
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +4 -4
- package/dist/maintenance/rebuild-memory-projection-runner.js +6 -6
- package/dist/maintenance/rebuild-memory-projection.js +5 -5
- package/dist/memory-browse-operations.js +15 -15
- package/dist/namespaces/migrate.js +5 -5
- package/dist/namespaces/storage.js +4 -4
- package/dist/operator-doctor-corpus.js +7 -7
- package/dist/operator-toolkit.js +12 -12
- package/dist/orchestration/backlog-scheduler.d.ts +151 -0
- package/dist/orchestration/backlog-scheduler.d.ts.map +1 -0
- package/dist/orchestration/backlog-scheduler.js +891 -0
- package/dist/orchestration/backlog-scheduler.js.map +1 -0
- package/dist/orchestration/buffer-drain-runner.d.ts +31 -27
- package/dist/orchestration/buffer-drain-runner.d.ts.map +1 -1
- package/dist/orchestration/buffer-drain-runner.js +64 -269
- package/dist/orchestration/buffer-drain-runner.js.map +1 -1
- package/dist/orchestration/extraction-drain.d.ts +50 -17
- package/dist/orchestration/extraction-drain.d.ts.map +1 -1
- package/dist/orchestration/extraction-queue-coordinator.d.ts +19 -1
- package/dist/orchestration/extraction-queue-coordinator.d.ts.map +1 -1
- package/dist/orchestration/extraction-run.d.ts +8 -0
- package/dist/orchestration/extraction-run.d.ts.map +1 -1
- package/dist/orchestration/extraction-task-queueing.d.ts +44 -0
- package/dist/orchestration/extraction-task-queueing.d.ts.map +1 -0
- package/dist/orchestration/maintenance.js +14 -14
- package/dist/orchestration/turn-ingestion.d.ts +11 -5
- package/dist/orchestration/turn-ingestion.d.ts.map +1 -1
- package/dist/orchestrator.d.ts +13 -0
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +59 -59
- package/dist/recall-navigation-operations.js +15 -15
- package/dist/recall-navigation.js +14 -14
- package/dist/resume-bundles.js +3 -3
- package/dist/semantic-consolidation.js +5 -5
- package/dist/semantic-rule-promotion.js +4 -4
- package/dist/semantic-rule-verifier.js +4 -4
- package/dist/source-agent-qualifier.js +6 -6
- package/dist/standup/build.js +4 -4
- package/dist/storage/buffer-drain-claims.d.ts +15 -0
- package/dist/storage/buffer-drain-claims.d.ts.map +1 -1
- package/dist/storage/buffer-drain-claims.js +2 -2
- package/dist/storage/buffer-session-files.js +2 -2
- package/dist/storage.js +3 -3
- package/dist/support-passport/index.js +17 -17
- package/dist/transfer/export-okf.js +4 -4
- package/dist/verified-recall.js +4 -4
- package/dist/who-knows-cli.js +5 -5
- package/dist/who-knows.js +4 -4
- package/package.json +12 -2
- package/src/backlog-scheduler.test.ts +806 -0
- package/src/buffer-drain-handover.test.ts +363 -18
- package/src/buffer-drain-inprocess.test.ts +355 -0
- package/src/buffer-drain-model-boundary.test.ts +1062 -0
- package/src/buffer-drop-extraction-chunk.test.ts +237 -22
- package/src/buffer-turn-helpers.ts +26 -1
- package/src/buffer.ts +8 -0
- package/src/extraction-window-drain.ts +7 -7
- package/src/orchestration/backlog-scheduler.ts +481 -0
- package/src/orchestration/buffer-drain-runner.ts +545 -180
- package/src/orchestration/extraction-drain.ts +287 -108
- package/src/orchestration/extraction-queue-coordinator.ts +51 -3
- package/src/orchestration/extraction-run.test.ts +41 -0
- package/src/orchestration/extraction-run.ts +24 -5
- package/src/orchestration/extraction-task-queueing.ts +87 -0
- package/src/orchestration/turn-ingestion.ts +46 -59
- package/src/orchestrator-extraction-queue.test.ts +46 -2
- package/src/orchestrator-flush.test.ts +4 -1
- package/src/orchestrator.ts +47 -21
- package/src/storage/buffer-drain-claims.ts +55 -0
- package/dist/chunk-LTST4R7U.js.map +0 -1
- package/dist/chunk-OAQO5AZJ.js.map +0 -1
- package/dist/chunk-U7MIMS2Y.js.map +0 -1
- package/dist/chunk-VA3GNAWQ.js.map +0 -1
- package/dist/chunk-VDYRXI3E.js.map +0 -1
- package/dist/chunk-ZOBYTRBU.js.map +0 -1
- /package/dist/{chunk-B7YAIHAV.js.map → chunk-23BA3USG.js.map} +0 -0
- /package/dist/{chunk-3F7N4I5I.js.map → chunk-2R44BBPK.js.map} +0 -0
- /package/dist/{chunk-BW33YTF3.js.map → chunk-2WPWEVAH.js.map} +0 -0
- /package/dist/{chunk-EF3HNVL4.js.map → chunk-4PMFSYH7.js.map} +0 -0
- /package/dist/{chunk-J5TVHCDG.js.map → chunk-5ORJHH43.js.map} +0 -0
- /package/dist/{chunk-MK7HXGM6.js.map → chunk-6KBCUIZP.js.map} +0 -0
- /package/dist/{chunk-OX6GY22Q.js.map → chunk-7P5VBRBS.js.map} +0 -0
- /package/dist/{chunk-3AASGFR4.js.map → chunk-7WFY2L5J.js.map} +0 -0
- /package/dist/{chunk-YLMTFRZR.js.map → chunk-AGRMXXVA.js.map} +0 -0
- /package/dist/{chunk-WIW4LOZL.js.map → chunk-AZNE2H6D.js.map} +0 -0
- /package/dist/{chunk-GT4G2S2Y.js.map → chunk-BCBY5GYZ.js.map} +0 -0
- /package/dist/{chunk-EIZ4MK33.js.map → chunk-BTU77RB5.js.map} +0 -0
- /package/dist/{chunk-ZS5LREUZ.js.map → chunk-DC3DWF2M.js.map} +0 -0
- /package/dist/{chunk-FM6UKZAE.js.map → chunk-EQ6EMJRG.js.map} +0 -0
- /package/dist/{chunk-TSZP7GGJ.js.map → chunk-FGGLVCHI.js.map} +0 -0
- /package/dist/{chunk-K7LLGCPH.js.map → chunk-GXAZ4Q2S.js.map} +0 -0
- /package/dist/{chunk-2GV24KFD.js.map → chunk-H2X32F2K.js.map} +0 -0
- /package/dist/{chunk-2YPIFJHL.js.map → chunk-ICBUTKLL.js.map} +0 -0
- /package/dist/{chunk-3W37NITP.js.map → chunk-IQXQ3KWR.js.map} +0 -0
- /package/dist/{chunk-HNF7IMYQ.js.map → chunk-J72ZY7NU.js.map} +0 -0
- /package/dist/{chunk-6QS5NQJH.js.map → chunk-JGLZ46JS.js.map} +0 -0
- /package/dist/{chunk-MRN2MKB7.js.map → chunk-JY4LXMZR.js.map} +0 -0
- /package/dist/{chunk-UJ2FP2RV.js.map → chunk-KY3KJUNN.js.map} +0 -0
- /package/dist/{chunk-64U42JL5.js.map → chunk-LHMCZ6VW.js.map} +0 -0
- /package/dist/{chunk-YRMSHA7H.js.map → chunk-LN7CWLAU.js.map} +0 -0
- /package/dist/{chunk-XR4QR3JT.js.map → chunk-LYOCAUI6.js.map} +0 -0
- /package/dist/{chunk-GMSRLDVR.js.map → chunk-N2Y6COEM.js.map} +0 -0
- /package/dist/{chunk-XDUP6SWG.js.map → chunk-OGQGDOYK.js.map} +0 -0
- /package/dist/{chunk-5FMGPV34.js.map → chunk-OWZXDBV4.js.map} +0 -0
- /package/dist/{chunk-SQO5SEKA.js.map → chunk-PJAMFIDE.js.map} +0 -0
- /package/dist/{chunk-I6HRHJRA.js.map → chunk-QIOQI7QZ.js.map} +0 -0
- /package/dist/{chunk-OAKOAOEG.js.map → chunk-QUPTDKSX.js.map} +0 -0
- /package/dist/{chunk-MCFI6G7U.js.map → chunk-QVZZE6VH.js.map} +0 -0
- /package/dist/{chunk-LYTKNK5O.js.map → chunk-S37O4S6E.js.map} +0 -0
- /package/dist/{chunk-ILD7N3XC.js.map → chunk-S73ZVU37.js.map} +0 -0
- /package/dist/{chunk-5VQSKBNF.js.map → chunk-U6IL4724.js.map} +0 -0
- /package/dist/{chunk-D3AGBN6G.js.map → chunk-UAOJVQXC.js.map} +0 -0
- /package/dist/{chunk-MKMIY3E7.js.map → chunk-UE5JYPU6.js.map} +0 -0
- /package/dist/{chunk-K47G2CBP.js.map → chunk-USX5YIKB.js.map} +0 -0
- /package/dist/{chunk-YIG4HPY4.js.map → chunk-VK5HKVQ7.js.map} +0 -0
- /package/dist/{chunk-THFSCUFC.js.map → chunk-VSJ3ARFS.js.map} +0 -0
- /package/dist/{chunk-4BOBW6H4.js.map → chunk-W4V7P5HP.js.map} +0 -0
- /package/dist/{chunk-DM3UZUCN.js.map → chunk-WNQ3B3Q5.js.map} +0 -0
- /package/dist/{chunk-MFKBYXBY.js.map → chunk-WYOHQJKC.js.map} +0 -0
- /package/dist/{chunk-66PEACZP.js.map → chunk-X4DHAXFO.js.map} +0 -0
- /package/dist/{chunk-ZYEWTVNQ.js.map → chunk-XPZM7GP6.js.map} +0 -0
- /package/dist/{chunk-2BBMCMJS.js.map → chunk-YPYSC3TX.js.map} +0 -0
- /package/dist/{chunk-JGQEF33K.js.map → chunk-ZBET3W26.js.map} +0 -0
|
@@ -49,10 +49,10 @@ import {
|
|
|
49
49
|
} from "./chunk-KIUVEMBI.js";
|
|
50
50
|
import {
|
|
51
51
|
getOperation
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-23BA3USG.js";
|
|
53
53
|
import {
|
|
54
54
|
WHO_KNOWS_MCP_TOOLS
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-JGLZ46JS.js";
|
|
56
56
|
import {
|
|
57
57
|
PROMOTION_CANDIDATES_MCP_TOOLS
|
|
58
58
|
} from "./chunk-IZJQNDGI.js";
|
|
@@ -3986,4 +3986,4 @@ export {
|
|
|
3986
3986
|
MCP_MIGRATED_OPERATIONS,
|
|
3987
3987
|
EngramMcpServer
|
|
3988
3988
|
};
|
|
3989
|
-
//# sourceMappingURL=chunk-
|
|
3989
|
+
//# sourceMappingURL=chunk-PJAMFIDE.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
SupportPassportError,
|
|
3
3
|
SupportPassportOwnerCreateGrantRequestSchema,
|
|
4
4
|
getOperation
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-23BA3USG.js";
|
|
6
6
|
|
|
7
7
|
// src/support-passport/access-http.ts
|
|
8
8
|
var OWNER_ROOT = "/engram/v1/support-passport";
|
|
@@ -137,4 +137,4 @@ export {
|
|
|
137
137
|
SUPPORT_PASSPORT_OWNER_HTTP_ROUTES,
|
|
138
138
|
handleSupportPassportOwnerHttp
|
|
139
139
|
};
|
|
140
|
-
//# sourceMappingURL=chunk-
|
|
140
|
+
//# sourceMappingURL=chunk-QIOQI7QZ.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
claudeReplayNormalizer
|
|
3
|
+
} from "./chunk-54BGIBCR.js";
|
|
1
4
|
import {
|
|
2
5
|
openclawReplayNormalizer
|
|
3
6
|
} from "./chunk-H4CKS5B2.js";
|
|
4
7
|
import {
|
|
5
8
|
chatgptReplayNormalizer
|
|
6
9
|
} from "./chunk-MMACM5G2.js";
|
|
7
|
-
import {
|
|
8
|
-
claudeReplayNormalizer
|
|
9
|
-
} from "./chunk-54BGIBCR.js";
|
|
10
10
|
import {
|
|
11
11
|
exportOkfBundle,
|
|
12
12
|
parseIncludeStatus
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-S37O4S6E.js";
|
|
14
14
|
import {
|
|
15
15
|
exportSqlite
|
|
16
16
|
} from "./chunk-BV2TIZ4F.js";
|
|
@@ -29,12 +29,12 @@ import {
|
|
|
29
29
|
import {
|
|
30
30
|
backupMemoryDir
|
|
31
31
|
} from "./chunk-2NLLXCJG.js";
|
|
32
|
-
import {
|
|
33
|
-
exportJsonBundle
|
|
34
|
-
} from "./chunk-UP6MOYCB.js";
|
|
35
32
|
import {
|
|
36
33
|
exportMarkdownBundle
|
|
37
34
|
} from "./chunk-765K3SAT.js";
|
|
35
|
+
import {
|
|
36
|
+
exportJsonBundle
|
|
37
|
+
} from "./chunk-UP6MOYCB.js";
|
|
38
38
|
import {
|
|
39
39
|
RoutingRulesStore
|
|
40
40
|
} from "./chunk-TBUEE7XF.js";
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
} from "./chunk-EDR6CVWZ.js";
|
|
59
59
|
import {
|
|
60
60
|
rebuildMemoryLifecycleLedger
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-ICBUTKLL.js";
|
|
62
62
|
import {
|
|
63
63
|
rebuildObservations
|
|
64
64
|
} from "./chunk-WHCD4Z3D.js";
|
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
} from "./chunk-2524MOWK.js";
|
|
80
80
|
import {
|
|
81
81
|
searchVerifiedEpisodes
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-DC3DWF2M.js";
|
|
83
83
|
import {
|
|
84
84
|
getUtilityLearningStatus,
|
|
85
85
|
learnUtilityPromotionWeights
|
|
@@ -93,10 +93,10 @@ import {
|
|
|
93
93
|
} from "./chunk-VHSQU3RO.js";
|
|
94
94
|
import {
|
|
95
95
|
promoteSemanticRuleFromMemory
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-OGQGDOYK.js";
|
|
97
97
|
import {
|
|
98
98
|
searchVerifiedSemanticRules
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-BTU77RB5.js";
|
|
100
100
|
import {
|
|
101
101
|
buildResumeBundleFromState,
|
|
102
102
|
getResumeBundleStatus,
|
|
@@ -125,7 +125,7 @@ import {
|
|
|
125
125
|
runOperatorInventory,
|
|
126
126
|
runOperatorRepair,
|
|
127
127
|
runOperatorSetup
|
|
128
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-UE5JYPU6.js";
|
|
129
129
|
import {
|
|
130
130
|
analyzeSessionIntegrity,
|
|
131
131
|
applySessionRepair,
|
|
@@ -176,7 +176,7 @@ import {
|
|
|
176
176
|
rebuildMemoryProjection,
|
|
177
177
|
repairMemoryProjection,
|
|
178
178
|
verifyMemoryProjection
|
|
179
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-X4DHAXFO.js";
|
|
180
180
|
import {
|
|
181
181
|
buildConnectorRowsFromDefinitions,
|
|
182
182
|
parseConnectorsListOptions,
|
|
@@ -210,7 +210,7 @@ import {
|
|
|
210
210
|
import {
|
|
211
211
|
EngramAccessHttpServer,
|
|
212
212
|
MeetingsInputError
|
|
213
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-LHMCZ6VW.js";
|
|
214
214
|
import {
|
|
215
215
|
WearablesInputError
|
|
216
216
|
} from "./chunk-V7IZKJI3.js";
|
|
@@ -220,10 +220,10 @@ import {
|
|
|
220
220
|
loadChatSession,
|
|
221
221
|
processChatMessage,
|
|
222
222
|
sessionBelongsToPrincipal
|
|
223
|
-
} from "./chunk-
|
|
223
|
+
} from "./chunk-PJAMFIDE.js";
|
|
224
224
|
import {
|
|
225
225
|
EngramAccessService
|
|
226
|
-
} from "./chunk-
|
|
226
|
+
} from "./chunk-23BA3USG.js";
|
|
227
227
|
import {
|
|
228
228
|
WorkStorage
|
|
229
229
|
} from "./chunk-MPC7TYTZ.js";
|
|
@@ -243,13 +243,13 @@ import {
|
|
|
243
243
|
} from "./chunk-EWJZZDRG.js";
|
|
244
244
|
import {
|
|
245
245
|
readAggregateExtractionWatermark
|
|
246
|
-
} from "./chunk-
|
|
246
|
+
} from "./chunk-7P5VBRBS.js";
|
|
247
247
|
import {
|
|
248
248
|
journalPath
|
|
249
249
|
} from "./chunk-WGRAB3KB.js";
|
|
250
250
|
import {
|
|
251
251
|
searchHarmonicRetrieval
|
|
252
|
-
} from "./chunk-
|
|
252
|
+
} from "./chunk-JY4LXMZR.js";
|
|
253
253
|
import {
|
|
254
254
|
getCueAnchorStoreStatus
|
|
255
255
|
} from "./chunk-LXATZLSC.js";
|
|
@@ -258,12 +258,12 @@ import {
|
|
|
258
258
|
readMemoryGovernanceRunArtifact,
|
|
259
259
|
restoreMemoryGovernanceRun,
|
|
260
260
|
runMemoryGovernance
|
|
261
|
-
} from "./chunk-
|
|
261
|
+
} from "./chunk-U6IL4724.js";
|
|
262
262
|
import {
|
|
263
263
|
listNamespaces,
|
|
264
264
|
runNamespaceMigration,
|
|
265
265
|
verifyNamespaces
|
|
266
|
-
} from "./chunk-
|
|
266
|
+
} from "./chunk-ZBET3W26.js";
|
|
267
267
|
import {
|
|
268
268
|
analyzeGraphHealth
|
|
269
269
|
} from "./chunk-BFBS7OFQ.js";
|
|
@@ -300,7 +300,7 @@ import {
|
|
|
300
300
|
} from "./chunk-6L63IN3M.js";
|
|
301
301
|
import {
|
|
302
302
|
meetingIdDate
|
|
303
|
-
} from "./chunk-
|
|
303
|
+
} from "./chunk-S73ZVU37.js";
|
|
304
304
|
import {
|
|
305
305
|
isValidTranscriptDate
|
|
306
306
|
} from "./chunk-UHVXE24Y.js";
|
|
@@ -10140,4 +10140,4 @@ export {
|
|
|
10140
10140
|
listMemoryMarkdownFilePaths,
|
|
10141
10141
|
registerCli
|
|
10142
10142
|
};
|
|
10143
|
-
//# sourceMappingURL=chunk-
|
|
10143
|
+
//# sourceMappingURL=chunk-QUPTDKSX.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hasMemoryData
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2R44BBPK.js";
|
|
4
4
|
import {
|
|
5
5
|
resolveNamespaceStorageRoot
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UAOJVQXC.js";
|
|
7
7
|
import {
|
|
8
8
|
getConfiguredNamespaces
|
|
9
9
|
} from "./chunk-I6QGI65T.js";
|
|
@@ -726,4 +726,4 @@ export {
|
|
|
726
726
|
runNamespaceMaintenancePlan,
|
|
727
727
|
runNamespaceMaintenanceBatchPlan
|
|
728
728
|
};
|
|
729
|
-
//# sourceMappingURL=chunk-
|
|
729
|
+
//# sourceMappingURL=chunk-QVZZE6VH.js.map
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-3UXOZBHV.js";
|
|
15
15
|
import {
|
|
16
16
|
StorageManager
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-S73ZVU37.js";
|
|
18
18
|
import {
|
|
19
19
|
OKF_PROFILE_TYPE,
|
|
20
20
|
okfTypeForMemory
|
|
@@ -272,4 +272,4 @@ export {
|
|
|
272
272
|
exportOkfBundle,
|
|
273
273
|
firstHeading
|
|
274
274
|
};
|
|
275
|
-
//# sourceMappingURL=chunk-
|
|
275
|
+
//# sourceMappingURL=chunk-S37O4S6E.js.map
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./chunk-IGOW4TJE.js";
|
|
23
23
|
import {
|
|
24
24
|
BufferSessionFiles
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-VNTQU6KB.js";
|
|
26
26
|
import {
|
|
27
27
|
normalizeQmdResultPath,
|
|
28
28
|
resolveNamespaceResultPath
|
|
@@ -11039,4 +11039,4 @@ export {
|
|
|
11039
11039
|
isValidBufferSurpriseEvent,
|
|
11040
11040
|
StorageManager3 as StorageManager
|
|
11041
11041
|
};
|
|
11042
|
-
//# sourceMappingURL=chunk-
|
|
11042
|
+
//# sourceMappingURL=chunk-S73ZVU37.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorageManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-S73ZVU37.js";
|
|
4
4
|
import {
|
|
5
5
|
bumpMemoryCorpusVersionForDir
|
|
6
6
|
} from "./chunk-M5GVCJSJ.js";
|
|
@@ -769,4 +769,4 @@ export {
|
|
|
769
769
|
listMemoryGovernanceRuns,
|
|
770
770
|
readMemoryGovernanceRunArtifact
|
|
771
771
|
};
|
|
772
|
-
//# sourceMappingURL=chunk-
|
|
772
|
+
//# sourceMappingURL=chunk-U6IL4724.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorageManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-S73ZVU37.js";
|
|
4
4
|
import {
|
|
5
5
|
keyring_exports,
|
|
6
6
|
secureStoreDir
|
|
@@ -416,4 +416,4 @@ export {
|
|
|
416
416
|
resolveNamespaceStorageRoot,
|
|
417
417
|
NamespaceStorageRouter
|
|
418
418
|
};
|
|
419
|
-
//# sourceMappingURL=chunk-
|
|
419
|
+
//# sourceMappingURL=chunk-UAOJVQXC.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
readNamespaceMaintenanceLastRanStatuses,
|
|
4
4
|
readNamespaceMaintenanceStatuses,
|
|
5
5
|
runNamespaceMaintenancePlan
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QVZZE6VH.js";
|
|
7
7
|
import {
|
|
8
8
|
analyzeSessionIntegrity,
|
|
9
9
|
applySessionRepair,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-CMTINOFS.js";
|
|
15
15
|
import {
|
|
16
16
|
summarizeCorpusAndReplica
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-IQXQ3KWR.js";
|
|
18
18
|
import {
|
|
19
19
|
readJudgeVerdictStats
|
|
20
20
|
} from "./chunk-OZKOPQCM.js";
|
|
@@ -41,14 +41,14 @@ import {
|
|
|
41
41
|
} from "./chunk-T6T2RMWW.js";
|
|
42
42
|
import {
|
|
43
43
|
readAggregateExtractionWatermark
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-7P5VBRBS.js";
|
|
45
45
|
import {
|
|
46
46
|
listMemoryGovernanceRuns,
|
|
47
47
|
readMemoryGovernanceRunArtifact
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-U6IL4724.js";
|
|
49
49
|
import {
|
|
50
50
|
listNamespaces
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-ZBET3W26.js";
|
|
52
52
|
import {
|
|
53
53
|
analyzeGraphHealth
|
|
54
54
|
} from "./chunk-BFBS7OFQ.js";
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
} from "./chunk-AWD36R4D.js";
|
|
58
58
|
import {
|
|
59
59
|
StorageManager
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-S73ZVU37.js";
|
|
61
61
|
import {
|
|
62
62
|
lintWorkspaceFiles
|
|
63
63
|
} from "./chunk-DM2T26WE.js";
|
|
@@ -1683,4 +1683,4 @@ export {
|
|
|
1683
1683
|
runBenchmarkRecall,
|
|
1684
1684
|
runOperatorRepair
|
|
1685
1685
|
};
|
|
1686
|
-
//# sourceMappingURL=chunk-
|
|
1686
|
+
//# sourceMappingURL=chunk-UE5JYPU6.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildStandup,
|
|
3
3
|
parseStandupDate
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-H2X32F2K.js";
|
|
5
5
|
import {
|
|
6
6
|
backfillMemoryStorage,
|
|
7
7
|
runLocationBackfill,
|
|
@@ -9,16 +9,16 @@ import {
|
|
|
9
9
|
runLocationDay,
|
|
10
10
|
runLocationStatus,
|
|
11
11
|
runLocationSync
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7WFY2L5J.js";
|
|
13
13
|
import {
|
|
14
14
|
externalWikiSearchOperation
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WNQ3B3Q5.js";
|
|
16
16
|
import {
|
|
17
17
|
DECISION_SUBCOMMANDS,
|
|
18
18
|
DELTA_SUBCOMMANDS,
|
|
19
19
|
defineOperation,
|
|
20
20
|
isCodegraphToolName
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-23BA3USG.js";
|
|
22
22
|
import {
|
|
23
23
|
CorrectionContractError
|
|
24
24
|
} from "./chunk-ETSJD5IV.js";
|
|
@@ -1916,4 +1916,4 @@ export {
|
|
|
1916
1916
|
codegraphIngestTracesOperation,
|
|
1917
1917
|
REGISTERED_OPERATIONS
|
|
1918
1918
|
};
|
|
1919
|
-
//# sourceMappingURL=chunk-
|
|
1919
|
+
//# sourceMappingURL=chunk-USX5YIKB.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineOperation
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-23BA3USG.js";
|
|
4
4
|
import {
|
|
5
5
|
EngramAccessInputError
|
|
6
6
|
} from "./chunk-LGEH473S.js";
|
|
@@ -92,4 +92,4 @@ defineOperation({
|
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
|
-
//# sourceMappingURL=chunk-
|
|
95
|
+
//# sourceMappingURL=chunk-VK5HKVQ7.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bufferTurnsEqual,
|
|
3
3
|
subtractBufferTurns
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OUBEJWVI.js";
|
|
5
5
|
import {
|
|
6
6
|
withHeldFileLock
|
|
7
7
|
} from "./chunk-EBV6VXKF.js";
|
|
@@ -362,6 +362,7 @@ function parseLease(raw) {
|
|
|
362
362
|
leaseMs: lease.leaseMs
|
|
363
363
|
};
|
|
364
364
|
}
|
|
365
|
+
var LIST_PAGE_SCAN_FACTOR = 8;
|
|
365
366
|
var BufferDrainClaims = class {
|
|
366
367
|
constructor(stateDir, io) {
|
|
367
368
|
this.stateDir = stateDir;
|
|
@@ -655,6 +656,50 @@ var BufferDrainClaims = class {
|
|
|
655
656
|
}
|
|
656
657
|
return out;
|
|
657
658
|
}
|
|
659
|
+
/**
|
|
660
|
+
* Paged listing for bounded periodic scans: at most `limit` claims with
|
|
661
|
+
* pending turns, starting AFTER `afterName` (a raw entry name returned as
|
|
662
|
+
* `nextCursor` by a previous page — file-name order is stable, so a
|
|
663
|
+
* rotating cursor visits every claim fairly without ever materializing
|
|
664
|
+
* the whole directory's bodies). Empty tombstones never count toward the
|
|
665
|
+
* limit; the number of bodies read per call is bounded separately
|
|
666
|
+
* (`LIST_PAGE_SCAN_FACTOR` per requested entry), and the cursor advances
|
|
667
|
+
* past every scanned name so a long tombstone run is crossed over several
|
|
668
|
+
* pages instead of starving the pending claims behind it.
|
|
669
|
+
*/
|
|
670
|
+
async listPage(afterName, limit) {
|
|
671
|
+
let names;
|
|
672
|
+
try {
|
|
673
|
+
names = (await readdir2(this.dir)).filter((name) => name.endsWith(".json") && !name.endsWith(".lease.json")).sort();
|
|
674
|
+
} catch (err) {
|
|
675
|
+
const errno = err?.code;
|
|
676
|
+
if (errno === "ENOENT") return { entries: [] };
|
|
677
|
+
throw err;
|
|
678
|
+
}
|
|
679
|
+
const start = afterName === void 0 ? 0 : names.findIndex((name) => name > afterName);
|
|
680
|
+
const out = [];
|
|
681
|
+
let cursor;
|
|
682
|
+
const scanBudget = Math.max(limit, 1) * LIST_PAGE_SCAN_FACTOR;
|
|
683
|
+
let scanned = 0;
|
|
684
|
+
for (let index = start < 0 ? names.length : start; index < names.length; index += 1) {
|
|
685
|
+
if (out.length >= limit || scanned >= scanBudget) break;
|
|
686
|
+
const name = names[index];
|
|
687
|
+
scanned += 1;
|
|
688
|
+
cursor = name;
|
|
689
|
+
const claim = await this.readClaimBodyByKey(name);
|
|
690
|
+
if (!claim) continue;
|
|
691
|
+
const turnCount = claim.entry.turns.length + (claim.entry.retainedTurns?.length ?? 0);
|
|
692
|
+
if (turnCount <= 0) continue;
|
|
693
|
+
const lease = await this.readLease(claim.key);
|
|
694
|
+
out.push({
|
|
695
|
+
key: claim.key,
|
|
696
|
+
turnCount,
|
|
697
|
+
leased: lease !== null,
|
|
698
|
+
leaseExpired: lease !== null ? isLeaseExpired(lease) : true
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
return { entries: out, nextCursor: cursor };
|
|
702
|
+
}
|
|
658
703
|
async readClaimBodyByKey(name) {
|
|
659
704
|
try {
|
|
660
705
|
return parseBody(await this.io.read(path2.join(this.dir, name)));
|
|
@@ -671,4 +716,4 @@ export {
|
|
|
671
716
|
legacyStateToEntries,
|
|
672
717
|
BufferSessionFiles
|
|
673
718
|
};
|
|
674
|
-
//# sourceMappingURL=chunk-
|
|
719
|
+
//# sourceMappingURL=chunk-VNTQU6KB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/storage/buffer-drain-claims.ts","../src/storage/buffer-session-files.ts"],"sourcesContent":["/**\n * Durable drain claims for the extraction buffer (`remnic buffer drain`).\n *\n * A claim is the atomic handover of one session's buffered turns from the\n * live buffer (daemon or CLI process) to a drain worker, so extraction can\n * run out of process without a live buffer owner resurrecting or losing the\n * turns. Files under `<stateDir>/buffer/drain/`:\n *\n * s-<sha256(key)>.json claim content: { key, entry, claimedAt }\n * — the turns NOT yet extracted. Renamed into\n * place from the session file (atomic on one\n * filesystem), rewritten atomically as chunks\n * drain.\n * s-<sha256(key)>.lease.json { ownerId, pid, acquiredAt, heartbeatAt,\n * leaseMs } — created with exclusive-create so\n * exactly one drainer holds a key.\n *\n * Invariants (see the buffer-drain PR for the full protocol):\n * - At every instant the claim content file holds exactly the turns whose\n * extraction is not durably finished, so a kill at any point loses\n * nothing and the next run resumes.\n * - A live buffer owner that must persist a claimed session hands its\n * in-memory entry INTO the claim (merge, identity-deduped) instead of\n * writing a session file — it can never resurrect claimed turns.\n * - Claims are idempotent: re-claiming, double-draining, and two\n * concurrent drainers are all safe (per-key mutation lock + exclusive\n * lease; the lock also fences lease takeover and progress writes).\n *\n * All content reads/writes go through the storage's secure file I/O\n * (`BufferFileIo`); only lease/existence checks touch raw paths, and claim\n * rewrites serialize on a cross-process held file lock.\n */\n\nimport { hostname } from \"node:os\";\nimport { z } from \"zod\";\nimport { existsSync } from \"node:fs\";\nimport { mkdir, readdir, rename, unlink, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport { bufferSessionFileName, type BufferFileIo } from \"./buffer-session-files.js\";\nimport { bufferTurnsEqual, subtractBufferTurns } from \"../buffer-turn-helpers.js\";\nimport { log } from \"../logger.js\";\nimport { withHeldFileLock } from \"../utils/serialize-mutations.js\";\nimport type { BufferEntryState, BufferTurn } from \"../types.js\";\n\n/** Result of persisting one session's entry. */\nexport interface BufferSessionSaveOutcome {\n /** \"saved\": the session file holds the entry. \"handed_over\": the entry moved into a drain claim. */\n status: \"saved\" | \"handed_over\";\n /** Turns a drain already extracted (claim tombstone): the owner subtracts them from its copy. */\n drainedTurns?: BufferTurn[];\n}\n\nexport interface DrainLease {\n ownerId: string;\n pid: number;\n /** Host the owner runs on: a takeover may only judge liveness on that host. */\n host: string;\n acquiredAt: string;\n heartbeatAt: string;\n leaseMs: number;\n}\n\nexport interface DrainClaimFile {\n key: string;\n entry: BufferEntryState;\n claimedAt: string;\n /**\n * Turns the drain already extracted. Non-empty means the session was\n * drained and the claim is a TOMBSTONE: a live buffer owner subtracts\n * these from its (possibly stale) copy instead of writing them back, so\n * drained turns can never be resurrected.\n */\n drained?: BufferTurn[];\n /** Same tombstone for turns the drain extracted from `retainedTurns`. */\n drainedRetained?: BufferTurn[];\n}\n\nexport type ClaimFromSessionOutcome = \"claimed\" | \"empty\" | \"already_claimed\";\nexport type AdoptOutcome = \"adopted\" | \"busy\";\nexport type AckOutcome = \"acked\" | \"not_empty\" | \"busy\";\n\nexport interface DrainClaimListing {\n key: string;\n turnCount: number;\n leased: boolean;\n leaseExpired: boolean;\n}\n\n/** Lock while a claim is read-modify-written; released on settle. */\nconst CLAIM_LOCK_STALE_MS = 120_000;\nconst CLAIM_LOCK_MAX_WAIT_MS = 120_000;\n\nfunction emptyEntry(): BufferEntryState {\n return { turns: [], lastExtractionAt: null, extractionCount: 0 };\n}\n\n/** Identity-dedupe `incoming` turns into `existing` (they are the same turns a\n * live owner still held after claiming; only genuinely NEW turns append). */\nfunction mergeTurns<T>(existing: T[], incoming: readonly T[], isEqual: (a: T, b: T) => boolean): T[] {\n const merged = [...existing];\n for (const turn of incoming) {\n if (merged.some((kept) => isEqual(kept, turn))) continue;\n merged.push(turn);\n }\n return merged;\n}\n\nfunction mergeEntries(claim: DrainClaimFile, incoming: BufferEntryState): DrainClaimFile {\n const entry = emptyEntry();\n // Turns already extracted stay out of the pending entry even when the\n // owner's incoming copy is stale and still carries them (either tombstone\n // list counts — a turn in either one left the claim for good).\n const gone = [...(claim.drained ?? []), ...(claim.drainedRetained ?? [])];\n entry.turns = mergeTurns(\n subtractBufferTurns(claim.entry.turns, gone),\n subtractBufferTurns(incoming.turns, gone),\n bufferTurnsEqual,\n );\n const retained = [\n ...subtractBufferTurns(claim.entry.retainedTurns ?? [], gone),\n ...subtractBufferTurns(incoming.retainedTurns ?? [], gone),\n ];\n // SAFETY: an empty accumulator of the same element type.\n const dedupedRetained = mergeTurns([] as typeof retained, retained, bufferTurnsEqual);\n if (dedupedRetained.length > 0) entry.retainedTurns = dedupedRetained;\n const stamps = [claim.entry.lastExtractionAt, incoming.lastExtractionAt].filter(\n (value): value is string => value !== null && value !== undefined,\n );\n entry.lastExtractionAt = stamps.sort().at(-1) ?? null;\n entry.extractionCount = Math.max(claim.entry.extractionCount, incoming.extractionCount);\n return { ...claim, entry };\n}\n\n/**\n * Is the lease owner still running? Only decidable on the owner's host; a\n * lease from another host counts as alive (its expiry decides).\n */\nfunction isOwnerAlive(lease: DrainLease): boolean {\n if (lease.host !== hostname()) return true;\n if (!Number.isInteger(lease.pid) || lease.pid <= 0) return true;\n try {\n process.kill(lease.pid, 0);\n return true;\n } catch (err) {\n // EPERM: the process exists but belongs to another user.\n // SAFETY: the value comes from this module's own write path; the shape is checked above.\n return (err as NodeJS.ErrnoException)?.code === \"EPERM\";\n }\n}\n\nfunction isLeaseExpired(lease: DrainLease, now = Date.now()): boolean {\n const heartbeat = Date.parse(lease.heartbeatAt);\n return !Number.isFinite(heartbeat) || now - heartbeat > lease.leaseMs;\n}\n\nconst claimBodySchema = z.object({\n key: z.string().min(1),\n entry: z.object({\n turns: z.array(z.unknown()),\n retainedTurns: z.array(z.unknown()).optional(),\n lastExtractionAt: z.string().nullable().optional(),\n extractionCount: z.number().optional(),\n }).optional(),\n turns: z.array(z.unknown()).optional(),\n retainedTurns: z.array(z.unknown()).optional(),\n lastExtractionAt: z.string().nullable().optional(),\n extractionCount: z.number().optional(),\n claimedAt: z.string().optional(),\n drained: z.array(z.unknown()).optional(),\n drainedRetained: z.array(z.unknown()).optional(),\n});\n\nfunction parseBody(raw: string): DrainClaimFile | null {\n let body: z.infer<typeof claimBodySchema>;\n try {\n body = claimBodySchema.parse(JSON.parse(raw));\n } catch {\n return null;\n }\n // Two on-disk shapes, one format: a claim born from rename keeps the flat\n // session-file shape ({key, turns, ...}) until its first rewrite, which\n // nests under `entry`. Accept both.\n const source = body.entry && Array.isArray(body.entry.turns) ? body.entry : body;\n if (!Array.isArray(source.turns)) return null;\n const entry = emptyEntry();\n // SAFETY: the schema parsed these as an array of unknown; the claim file\n // is written only by this module (BufferSessionFiles.save), so the entries\n // are BufferTurn values.\n // SAFETY: the claim file is written only by this module, so the parsed\n // turn arrays hold BufferTurn values.\n // SAFETY: the value comes from this module's own write path; the shape is checked above.\n entry.turns = source.turns as BufferTurn[];\n if (source.retainedTurns) {\n // SAFETY: same boundary as the turns above (this module writes the file).\n entry.retainedTurns = source.retainedTurns as BufferTurn[];\n }\n entry.lastExtractionAt = source.lastExtractionAt ?? null;\n entry.extractionCount = Number.isFinite(source.extractionCount) ? Number(source.extractionCount) : 0;\n const claim: DrainClaimFile = {\n key: body.key,\n entry,\n claimedAt: body.claimedAt ?? new Date().toISOString(),\n };\n if (Array.isArray(body.drained)) {\n // SAFETY: same boundary as the turns above (this module writes the file).\n claim.drained = body.drained as BufferTurn[];\n }\n if (Array.isArray(body.drainedRetained)) {\n // SAFETY: same boundary as the turns above (this module writes the file).\n claim.drainedRetained = body.drainedRetained as BufferTurn[];\n }\n return claim;\n}\n\nconst leaseSchema = z.object({\n ownerId: z.string().min(1),\n pid: z.number().optional(),\n host: z.string().optional(),\n acquiredAt: z.string().optional(),\n heartbeatAt: z.string(),\n leaseMs: z.number(),\n});\n\nfunction parseLease(raw: string): DrainLease | null {\n let lease: z.infer<typeof leaseSchema>;\n try {\n lease = leaseSchema.parse(JSON.parse(raw));\n } catch {\n return null;\n }\n return {\n ownerId: lease.ownerId,\n pid: lease.pid ?? 0,\n host: lease.host ?? \"\",\n acquiredAt: lease.acquiredAt ?? lease.heartbeatAt,\n heartbeatAt: lease.heartbeatAt,\n leaseMs: lease.leaseMs,\n };\n}\n\n/** Claim bodies `listPage` may read per requested entry: bounds one scan's\n * I/O even when the directory is mostly empty tombstones. */\nconst LIST_PAGE_SCAN_FACTOR = 8;\n\nexport class BufferDrainClaims {\n constructor(\n private readonly stateDir: string,\n private readonly io: BufferFileIo,\n ) {}\n\n private get dir(): string {\n return path.join(this.stateDir, \"buffer\", \"drain\");\n }\n\n private fileFor(key: string): string {\n return path.join(this.dir, bufferSessionFileName(key));\n }\n\n private leaseFileFor(key: string): string {\n return `${this.fileFor(key)}.lease.json`;\n }\n\n private lockFileFor(key: string): string {\n return `${this.fileFor(key)}.lock`;\n }\n\n /** Sync existence check for hot-path gates (`SmartBuffer.isSessionClaimed`). */\n isClaimed(key: string): boolean {\n return existsSync(this.fileFor(key));\n }\n\n /** Test + CLI seam: the lease file path for direct inspection. */\n leasePathForTest(key: string): string {\n return this.leaseFileFor(key);\n }\n\n private async readClaimBody(key: string): Promise<DrainClaimFile | null> {\n try {\n return parseBody(await this.io.read(this.fileFor(key)));\n } catch {\n return null;\n }\n }\n\n /** The claim content for `key`, or null when the key is not claimed. */\n load(key: string): Promise<DrainClaimFile | null> {\n return this.readClaimBody(key);\n }\n\n private async writeClaimBody(key: string, claim: DrainClaimFile): Promise<void> {\n await mkdir(this.dir, { recursive: true });\n await this.io.write(this.fileFor(key), JSON.stringify({ ...claim, key }));\n }\n\n private async readLease(key: string): Promise<DrainLease | null> {\n try {\n return parseLease(await this.io.read(this.leaseFileFor(key)));\n } catch {\n return null;\n }\n }\n\n private async writeLease(key: string, lease: DrainLease): Promise<void> {\n await mkdir(this.dir, { recursive: true });\n await this.io.write(this.leaseFileFor(key), JSON.stringify(lease));\n }\n\n /**\n * Atomically move a session's persisted file into a claim. The rename is\n * the handover: after it settles the turns exist ONLY as a claim, so no\n * crash window can lose them or leave them in both places. Callers that\n * lose the race (`already_claimed`) simply skip the key.\n *\n * The whole handover runs under the claim's mutation lock, so a claim\n * create can never land on top of an existing claim (POSIX rename would\n * silently replace it) and the lease write cannot race an adopter.\n */\n async claimFromSessionFile(key: string, lease: DrainLease): Promise<ClaimFromSessionOutcome> {\n await mkdir(this.dir, { recursive: true });\n const sessionPath = path.join(this.stateDir, \"buffer\", bufferSessionFileName(key));\n if (existsSync(sessionPath)) {\n // Advisory pre-read: an empty live session belongs to its owner, not\n // the drain. A turn landing between this read and the rename is fine —\n // the rename moves whatever is there and the claim drains it.\n try {\n const seeded = parseBody(await this.io.read(sessionPath));\n if (seeded && seeded.entry.turns.length === 0 && (seeded.entry.retainedTurns?.length ?? 0) === 0) {\n return \"empty\";\n }\n } catch {\n // Unreadable live file: proceed with the rename and let the claim\n // path report it loudly, like the loader skips corrupt files.\n }\n }\n return await withHeldFileLock(\n this.lockFileFor(key),\n { staleMs: CLAIM_LOCK_STALE_MS, maxWaitMs: CLAIM_LOCK_MAX_WAIT_MS },\n async (acquired) => {\n if (!acquired) return \"already_claimed\";\n // Under the lock the claim check is authoritative: an existing claim\n // keeps its content and its lease; the session file stays with its\n // owner (their next save merges into the claim).\n if (this.isClaimed(key)) return \"already_claimed\";\n try {\n await rename(sessionPath, this.fileFor(key));\n } catch (err) {\n // The session file is gone: either it never existed, or another\n // drainer claimed it first.\n if (!existsSync(sessionPath)) {\n if (this.isClaimed(key)) return \"already_claimed\";\n return \"empty\";\n }\n throw err;\n }\n const claim = await this.readClaimBody(key);\n if (!claim || (claim.entry.turns.length === 0 && (claim.entry.retainedTurns?.length ?? 0) === 0)) {\n // Empty content: nothing to drain. Delete the moved file so the\n // empty entry keeps living with its owner, not as a stale claim.\n await unlink(this.fileFor(key)).catch(() => {});\n return \"empty\";\n }\n await this.writeLease(key, lease);\n return \"claimed\";\n },\n );\n }\n\n /**\n * Take over a claim whose lease is missing, expired, or whose owner died.\n * The whole judgement runs under the claim's mutation lock and re-reads\n * the lease inside it, so exactly one concurrent adopter wins: the loser\n * re-reads the winner's fresh lease and reports \"busy\" instead of\n * unlinking it. A lease whose owner died is taken over in the same call.\n */\n async adopt(key: string, lease: DrainLease): Promise<AdoptOutcome> {\n if (!this.isClaimed(key)) return \"busy\";\n return await withHeldFileLock(\n this.lockFileFor(key),\n { staleMs: CLAIM_LOCK_STALE_MS, maxWaitMs: CLAIM_LOCK_MAX_WAIT_MS },\n async (acquired) => {\n if (!acquired) return \"busy\";\n const existing = await this.readLease(key);\n if (existing && !isLeaseExpired(existing)) {\n if (existing.ownerId === lease.ownerId) {\n // The same drainer already holds it: renew the lease.\n await this.writeLease(key, { ...existing, heartbeatAt: new Date().toISOString(), leaseMs: lease.leaseMs });\n return \"adopted\";\n }\n if (isOwnerAlive(existing)) return \"busy\";\n // The owner died without releasing the claim (killed worker):\n // take it over now instead of waiting for the lease to expire.\n await unlink(this.leaseFileFor(key)).catch(() => {});\n } else if (existing) {\n // Expired lease: clear it before the exclusive create. We hold the\n // lock, so no concurrent adopter can interleave its own\n // unlink/create between these steps.\n await unlink(this.leaseFileFor(key)).catch(() => {});\n }\n try {\n await writeFile(this.leaseFileFor(key), JSON.stringify(lease), { flag: \"wx\" });\n } catch (err) {\n // The lease file exists: another drainer took it first.\n if (existsSync(this.leaseFileFor(key))) return \"busy\";\n throw err;\n }\n return \"adopted\";\n },\n );\n }\n\n /**\n * Merge a live owner's in-memory entry INTO the claim (the handover path a\n * buffer owner takes instead of persisting a claimed session). Serialized\n * against drainer progress writes on the same lock.\n */\n async mergeIntoClaim(key: string, incoming: BufferEntryState): Promise<void> {\n await withHeldFileLock(this.lockFileFor(key), { staleMs: CLAIM_LOCK_STALE_MS, maxWaitMs: CLAIM_LOCK_MAX_WAIT_MS }, async (acquired) => {\n if (!acquired) {\n // Never fall back to a session-file write behind a held claim lock:\n // that would resurrect claimed turns. Fail so the owner's save stays\n // pending and retries (SmartBuffer keeps pending state on failure).\n throw new Error(`buffer drain claim for ${key} is busy; retrying the save later`);\n }\n const claim = await this.readClaimBody(key);\n if (!claim) {\n // The claim vanished (acked between the isClaimed check and now):\n // nothing to hand over; the drain already owns everything.\n return;\n }\n await this.writeClaimBody(key, mergeEntries(claim, incoming));\n });\n }\n\n /** Drainer progress: replace the claim content with what is left to do.\n *\n * Fenced: `ownerId` must still match the claim's lease (checked under the\n * same lock), so a drainer that lost its lease cannot write progress that\n * would restore turns the new owner already extracted.\n *\n * `seen` is the entry the drainer LOADED (its snapshot of the claim). Only\n * turns that were in that snapshot and are absent from BOTH of the\n * drainer's lists were actually extracted and move to the tombstones — a\n * turn the drainer moved into `entry.retainedTurns` is retained for retry,\n * not extracted. Turns a live owner merged into the claim afterwards stay\n * pending. Without `seen` the pre-existing behavior is kept (every claim\n * turn missing from `entry` counts as extracted).\n */\n async writeEntry(key: string, ownerId: string, entry: BufferEntryState, seen?: BufferEntryState): Promise<void> {\n await withHeldFileLock(this.lockFileFor(key), { staleMs: CLAIM_LOCK_STALE_MS, maxWaitMs: CLAIM_LOCK_MAX_WAIT_MS }, async (acquired) => {\n if (!acquired) throw new Error(`buffer drain claim for ${key} is busy; progress write skipped`);\n const lease = await this.readLease(key);\n if (!lease || lease.ownerId !== ownerId) {\n throw new Error(`buffer drain claim for ${key} is no longer owned by ${ownerId}; progress write skipped`);\n }\n const claim = await this.readClaimBody(key);\n if (!claim) return;\n const seenTurns = seen?.turns ?? claim.entry.turns;\n const seenRetained = seen?.retainedTurns ?? claim.entry.retainedTurns ?? [];\n const entryRetained = entry.retainedTurns ?? [];\n // Still held by the drainer: in its remaining turns OR retained for retry.\n const kept = (turn: BufferTurn): boolean =>\n entry.turns.some((held) => bufferTurnsEqual(held, turn)) || entryRetained.some((held) => bufferTurnsEqual(held, turn));\n // Progress: the snapshot turns that vanished from the entry were extracted.\n const drained = [...(claim.drained ?? [])];\n for (const turn of claim.entry.turns) {\n const extracted =\n seenTurns.some((snapshot) => bufferTurnsEqual(snapshot, turn)) && !kept(turn);\n if (!extracted) continue;\n if (drained.some((gone) => bufferTurnsEqual(gone, turn))) continue;\n drained.push(turn);\n }\n const drainedRetained = [...(claim.drainedRetained ?? [])];\n for (const turn of claim.entry.retainedTurns ?? []) {\n const extracted =\n seenRetained.some((snapshot) => bufferTurnsEqual(snapshot, turn)) && !kept(turn);\n if (!extracted) continue;\n if (drained.some((gone) => bufferTurnsEqual(gone, turn)) || drainedRetained.some((gone) => bufferTurnsEqual(gone, turn))) continue;\n drainedRetained.push(turn);\n }\n // Turns merged in after the drainer loaded stay pending, in extraction\n // order behind the drainer's own remainder.\n const late = claim.entry.turns.filter(\n (turn) =>\n !seenTurns.some((snapshot) => bufferTurnsEqual(snapshot, turn)) && !kept(turn),\n );\n const next: BufferEntryState = { ...entry, turns: [...entry.turns, ...late] };\n const lateRetained = (claim.entry.retainedTurns ?? []).filter(\n (turn) =>\n !seenRetained.some((snapshot) => bufferTurnsEqual(snapshot, turn)) && !kept(turn),\n );\n if (lateRetained.length > 0) next.retainedTurns = mergeTurns(entryRetained, lateRetained, bufferTurnsEqual);\n await this.writeClaimBody(key, { ...claim, entry: next, drained, drainedRetained });\n });\n }\n\n /** Extend the lease. \"lost\" means another drainer took the claim over.\n * Serialized on the claim lock so a stale heartbeat can never overwrite a\n * new owner's lease mid-takeover; a contended lock just skips this tick\n * (usually the drainer's own progress write holds it). */\n async heartbeat(key: string, ownerId: string, leaseMs: number): Promise<\"ok\" | \"lost\"> {\n return await withHeldFileLock(this.lockFileFor(key), { staleMs: CLAIM_LOCK_STALE_MS, maxWaitMs: CLAIM_LOCK_MAX_WAIT_MS }, async (acquired) => {\n if (!acquired) return \"ok\";\n const lease = await this.readLease(key);\n if (!lease || lease.ownerId !== ownerId) return \"lost\";\n await this.writeLease(key, { ...lease, heartbeatAt: new Date().toISOString(), leaseMs });\n return \"ok\";\n });\n }\n\n /** Give the key back (content stays; the next run resumes it). */\n async releaseLease(key: string, ownerId: string): Promise<void> {\n const lease = await this.readLease(key);\n if (!lease || lease.ownerId !== ownerId) return;\n await unlink(this.leaseFileFor(key)).catch(() => {});\n }\n\n /**\n * Finish a claim: only its owner may ack, and only when nothing is left to\n * extract. Non-empty claims stay (deferred content is never dropped here).\n */\n async ack(key: string, ownerId: string): Promise<AckOutcome> {\n const lease = await this.readLease(key);\n if (!lease || lease.ownerId !== ownerId) return \"busy\";\n const claim = await this.readClaimBody(key);\n if (!claim) {\n await unlink(this.leaseFileFor(key)).catch(() => {});\n return \"acked\";\n }\n if (claim.entry.turns.length > 0 || (claim.entry.retainedTurns?.length ?? 0) > 0) return \"not_empty\";\n // Keep the (empty) claim file as a TOMBSTONE: a live buffer owner that\n // still holds a stale copy subtracts the drained turns instead of\n // writing them back. The owner consumes the tombstone on its next save.\n await unlink(this.leaseFileFor(key)).catch(() => {});\n return \"acked\";\n }\n\n /** The turns a drain already extracted for `key` (tombstone content). */\n async drainedTurns(key: string): Promise<BufferTurn[]> {\n const claim = await this.readClaimBody(key);\n return claim?.drained ?? [];\n }\n\n /**\n * Is the drain for `key` FINISHED (acked): the claim holds extracted turns\n * and nothing pending, and the drainer dropped its lease. A claim with\n * partial progress or a live lease is still being drained — its owner must\n * merge into it, never release it.\n */\n async isDrained(key: string): Promise<boolean> {\n const claim = await this.readClaimBody(key);\n if (!claim) return false;\n if ((claim.drained?.length ?? 0) === 0 && (claim.drainedRetained?.length ?? 0) === 0) return false;\n if (claim.entry.turns.length > 0 || (claim.entry.retainedTurns?.length ?? 0) > 0) return false;\n return (await this.readLease(key)) === null;\n }\n\n /** Drop the claim file entirely (its owner consumed the tombstone). */\n async release(key: string): Promise<void> {\n await unlink(this.fileFor(key)).catch(() => {});\n await unlink(this.leaseFileFor(key)).catch(() => {});\n }\n\n /** Every claim with its lease state (CLI scan + summaries). */\n async list(): Promise<DrainClaimListing[]> {\n let names: string[];\n try {\n names = (await readdir(this.dir)).filter((name) => name.endsWith(\".json\") && !name.endsWith(\".lease.json\"));\n } catch (err) {\n // SAFETY: the value comes from this module's own write path; the shape is checked above.\n if ((err as NodeJS.ErrnoException)?.code === \"ENOENT\") return [];\n throw err;\n }\n const out: DrainClaimListing[] = [];\n for (const name of names) {\n const claim = await this.readClaimBodyByKey(name);\n if (!claim) continue;\n const lease = await this.readLease(claim.key);\n out.push({\n key: claim.key,\n turnCount: claim.entry.turns.length + (claim.entry.retainedTurns?.length ?? 0),\n leased: lease !== null,\n leaseExpired: lease !== null ? isLeaseExpired(lease) : true,\n });\n }\n return out;\n }\n\n /**\n * Paged listing for bounded periodic scans: at most `limit` claims with\n * pending turns, starting AFTER `afterName` (a raw entry name returned as\n * `nextCursor` by a previous page — file-name order is stable, so a\n * rotating cursor visits every claim fairly without ever materializing\n * the whole directory's bodies). Empty tombstones never count toward the\n * limit; the number of bodies read per call is bounded separately\n * (`LIST_PAGE_SCAN_FACTOR` per requested entry), and the cursor advances\n * past every scanned name so a long tombstone run is crossed over several\n * pages instead of starving the pending claims behind it.\n */\n async listPage(afterName: string | undefined, limit: number): Promise<{ entries: DrainClaimListing[]; nextCursor?: string }> {\n let names: string[];\n try {\n names = (await readdir(this.dir)).filter((name) => name.endsWith(\".json\") && !name.endsWith(\".lease.json\")).sort();\n } catch (err) {\n // SAFETY: readdir rejects with NodeJS system errors; only the ENOENT\n // (no claims directory yet) case maps to an empty listing.\n const errno = (err as NodeJS.ErrnoException | undefined)?.code;\n if (errno === \"ENOENT\") return { entries: [] };\n throw err;\n }\n const start = afterName === undefined ? 0 : names.findIndex((name) => name > afterName);\n const out: DrainClaimListing[] = [];\n // The cursor is the LAST CONSUMED entry name: the next page starts\n // strictly after it, so the first unconsumed name is never skipped.\n // Returning the first unconsumed name instead would make every page\n // boundary permanently skip one claim.\n let cursor: string | undefined;\n const scanBudget = Math.max(limit, 1) * LIST_PAGE_SCAN_FACTOR;\n let scanned = 0;\n for (let index = start < 0 ? names.length : start; index < names.length; index += 1) {\n if (out.length >= limit || scanned >= scanBudget) break;\n const name = names[index]!;\n scanned += 1;\n cursor = name;\n const claim = await this.readClaimBodyByKey(name);\n if (!claim) continue;\n const turnCount = claim.entry.turns.length + (claim.entry.retainedTurns?.length ?? 0);\n if (turnCount <= 0) continue;\n const lease = await this.readLease(claim.key);\n out.push({\n key: claim.key,\n turnCount,\n leased: lease !== null,\n leaseExpired: lease !== null ? isLeaseExpired(lease) : true,\n });\n }\n return { entries: out, nextCursor: cursor };\n }\n\n private async readClaimBodyByKey(name: string): Promise<DrainClaimFile | null> {\n try {\n return parseBody(await this.io.read(path.join(this.dir, name)));\n } catch (err) {\n log.debug(`buffer drain: skipping unreadable claim file ${name}: ${err instanceof Error ? err.message : String(err)}`);\n return null;\n }\n }\n}\n","import { BufferDrainClaims, type BufferSessionSaveOutcome } from \"./buffer-drain-claims.js\";\nimport { createHash } from \"node:crypto\";\nimport type { Stats } from \"node:fs\";\nimport { lstat, readdir, unlink } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { subtractBufferTurns } from \"../buffer-turn-helpers.js\";\nimport { log } from \"../logger.js\";\nimport { SecureStoreDecryptError, SecureStoreLockedError } from \"../secure-store/secure-fs.js\";\nimport type { BufferEntryState, BufferState, BufferTurn } from \"../types.js\";\n\n/** The secure-store file I/O the owning StorageManager already provides. */\nexport interface BufferFileIo {\n read(filePath: string): Promise<string>;\n write(filePath: string, content: string): Promise<void>;\n}\n\ntype FsError = NodeJS.ErrnoException;\n\nfunction isMissing(err: FsError | null): boolean {\n return err?.code === \"ENOENT\";\n}\n\nfunction asFsError(err: Error): FsError {\n return err;\n}\n\n/**\n * Case-independent, collision-free file name for a buffer key: the lowercase\n * hex SHA-256 of the key under a fixed prefix. Hex has no case and no path\n * characters, so `Session-A` and `session-a` get different names even on\n * case-insensitive filesystems, every key (short or long) lives in the same\n * naming domain, and the key itself is stored inside the file (loading never\n * inverts the hash).\n */\nexport function bufferSessionFileName(key: string): string {\n return `s-${createHash(\"sha256\").update(key).digest(\"hex\")}.json`;\n}\n\n/** Flatten a legacy BufferState into per-session entries (top-level fields\n * are the legacy mirror of the \"default\" entry). */\nexport function legacyStateToEntries(state: BufferState): Map<string, BufferEntryState> {\n const entries = new Map<string, BufferEntryState>();\n for (const [key, value] of Object.entries(state.entries ?? {})) {\n if (value && Array.isArray(value.turns)) entries.set(key, value);\n }\n if (!entries.has(\"default\")) {\n entries.set(\"default\", {\n turns: Array.isArray(state.turns) ? state.turns : [],\n lastExtractionAt: state.lastExtractionAt ?? null,\n extractionCount: Number.isFinite(state.extractionCount) ? state.extractionCount : 0,\n });\n }\n return entries;\n}\n\n/** What a per-session file contains once parsed (written only by this module). */\ninterface SessionFileBody {\n key?: string;\n turns?: BufferTurn[];\n retainedTurns?: BufferTurn[];\n lastExtractionAt?: string | null;\n extractionCount?: number;\n}\n\nfunction entryFromBody(body: SessionFileBody): { key: string; entry: BufferEntryState } | null {\n if (!body || !Array.isArray(body.turns) || (body.key?.length ?? 0) === 0) return null;\n const entry: BufferEntryState = {\n turns: body.turns,\n lastExtractionAt: body.lastExtractionAt ?? null,\n extractionCount: Number.isFinite(body.extractionCount) ? Number(body.extractionCount) : 0,\n };\n if (Array.isArray(body.retainedTurns)) entry.retainedTurns = body.retainedTurns;\n return { key: String(body.key), entry };\n}\n\n/**\n * One file per buffer session under `<stateDir>/buffer/`, so the observe hot\n * path persists only the session that changed. All writes happen under\n * SmartBuffer's serialized mutation chain (one writer per process).\n *\n * Sessions claimed by `remnic buffer drain` (see buffer-drain-claims.ts) are\n * owned by the drain: `save` hands the in-memory entry INTO the claim\n * (identity-deduped merge) instead of writing a session file, so a live\n * buffer owner can never resurrect claimed turns.\n */\nexport class BufferSessionFiles {\n private dirVerified = false;\n private readonly claimsStore: BufferDrainClaims;\n\n constructor(\n private readonly stateDir: string,\n private readonly io: BufferFileIo,\n ) {\n this.claimsStore = new BufferDrainClaims(stateDir, io);\n }\n\n /** The drain-claim store for this state dir (CLI scan + claim ops). */\n get claims(): BufferDrainClaims {\n return this.claimsStore;\n }\n\n /** Sync gate check: is this session claimed by a buffer drain? */\n isClaimed(key: string): boolean {\n return this.claimsStore.isClaimed(key);\n }\n\n private get dir(): string {\n return path.join(this.stateDir, \"buffer\");\n }\n\n private fileFor(key: string): string {\n return path.join(this.dir, bufferSessionFileName(key));\n }\n\n /**\n * Refuse a symlinked buffer directory: following it would send buffered\n * conversation data (and deletions) outside the memory root. One lstat of\n * one directory, cached after it passes, so the observe path pays nothing\n * per write; the cache is dropped on any failure.\n */\n private async assertDirSafe(): Promise<void> {\n if (this.dirVerified) return;\n let stat: Stats | null = null;\n try {\n stat = await lstat(this.dir);\n } catch (err) {\n if (!(err instanceof Error) || !isMissing(asFsError(err))) throw err;\n }\n if (stat && (stat.isSymbolicLink() || !stat.isDirectory())) {\n throw new Error(`buffer session directory must be a real directory, not a symlink or file: ${this.dir}`);\n }\n this.dirVerified = stat !== null;\n }\n\n /** Persist ONE session atomically. Compact JSON: machine-read state, and\n * pretty-printing a large buffer costs CPU and bytes on every observe.\n * A drain-claimed session is handed over instead (see class doc). */\n async save(key: string, entry: BufferEntryState): Promise<BufferSessionSaveOutcome> {\n if (this.isClaimed(key)) {\n // Consume the tombstone ONLY when the drain finished (acked: extracted\n // turns recorded, nothing pending, no lease). Partial `drained` just\n // means chunks completed — the drainer may still be running, and\n // releasing here would unlink its claim and turn its later writes into\n // no-ops.\n if (await this.claimsStore.isDrained(key)) {\n const drained = await this.claimsStore.drainedTurns(key);\n // The drain finished this session: the claim is a tombstone. Write\n // the owner's fresh remainder back as a session file (the drained\n // turns are subtracted here too, so a caller that did not subtract\n // them cannot resurrect them) and release the tombstone.\n const fresh: BufferEntryState = { ...entry, turns: subtractBufferTurns(entry.turns, drained) };\n if (entry.retainedTurns && entry.retainedTurns.length > 0) {\n fresh.retainedTurns = subtractBufferTurns(entry.retainedTurns, drained);\n if (fresh.retainedTurns.length === 0) delete fresh.retainedTurns;\n }\n await this.assertDirSafe();\n await this.io.write(this.fileFor(key), JSON.stringify({ key, ...fresh }));\n await this.claimsStore.release(key);\n return { status: \"saved\", drainedTurns: drained };\n }\n await this.claimsStore.mergeIntoClaim(key, entry);\n return { status: \"handed_over\" };\n }\n await this.assertDirSafe();\n await this.io.write(this.fileFor(key), JSON.stringify({ key, ...entry }));\n return { status: \"saved\" };\n }\n\n /** Remove one session's file. Idempotent: an absent file is fine. */\n async remove(key: string): Promise<void> {\n await this.assertDirSafe();\n try {\n await unlink(this.fileFor(key));\n } catch (err) {\n if (!(err instanceof Error) || !isMissing(asFsError(err))) throw err;\n }\n }\n\n private async listFiles(): Promise<string[]> {\n await this.assertDirSafe();\n try {\n const dirents = await readdir(this.dir, { withFileTypes: true });\n // Regular files only: a symlink inside the directory is never followed.\n return dirents.filter((d) => d.isFile() && d.name.endsWith(\".json\")).map((d) => d.name);\n } catch (err) {\n if (err instanceof Error && isMissing(asFsError(err))) return [];\n throw err;\n }\n }\n\n /** Read every per-session file. Corrupt files are skipped (and logged) so\n * one bad file cannot nuke the other sessions' buffered turns. */\n private async readAll(): Promise<{ entries: Map<string, BufferEntryState>; fileCount: number }> {\n const names = await this.listFiles();\n const entries = new Map<string, BufferEntryState>();\n for (const name of names) {\n try {\n const body: SessionFileBody = JSON.parse(await this.io.read(path.join(this.dir, name)));\n const parsed = entryFromBody(body);\n if (!parsed) throw new Error(\"invalid buffer session file shape\");\n if (entries.has(parsed.key)) {\n log.warn(`buffer: duplicate session file for key ${parsed.key} (${name}); keeping the first`);\n continue;\n }\n entries.set(parsed.key, parsed.entry);\n } catch (err) {\n // A locked store or a wrong key is not a corrupt file: reading it as empty would let\n // later saves replace the real encrypted session.\n if (err instanceof SecureStoreLockedError || err instanceof SecureStoreDecryptError) throw err;\n log.warn(`buffer: skipping unreadable per-session buffer file ${name}: ${err instanceof Error ? err.message : String(err)}`);\n }\n }\n return { entries, fileCount: names.length };\n }\n\n /**\n * Read the legacy single-file buffer.json for migration. Null when absent,\n * or unreadable while session files exist (they are authoritative; a\n * corrupt leftover must not block startup). With no session files a corrupt\n * legacy file THROWS, preserving the old contract so callers can reset it.\n */\n private async readLegacy(hasSessionFiles: boolean): Promise<BufferState | null> {\n let raw: string;\n try {\n raw = await this.io.read(path.join(this.stateDir, \"buffer.json\"));\n } catch (err) {\n if (err instanceof SecureStoreLockedError) throw err;\n if (err instanceof Error && isMissing(asFsError(err))) return null;\n throw err;\n }\n try {\n const legacy: BufferState = JSON.parse(raw);\n return legacy;\n } catch (err) {\n if (!hasSessionFiles) throw err;\n log.warn(\n `buffer: legacy buffer.json is unreadable but per-session buffer files exist; ` +\n `ignoring the legacy file (${err instanceof Error ? err.message : String(err)})`,\n );\n return null;\n }\n }\n\n /**\n * Load the whole buffer, migrating a legacy buffer.json once. A per-session\n * file that parsed wins over the legacy snapshot (a crash mid-migration\n * leaves exactly that pair); legacy entries without a usable file are\n * written out, then the legacy file is retired. Both steps are idempotent.\n */\n async load(): Promise<BufferState> {\n const { entries, fileCount } = await this.readAll();\n const legacy = await this.readLegacy(fileCount > 0);\n if (legacy !== null) {\n for (const [key, entry] of legacyStateToEntries(legacy)) {\n if (entries.has(key)) continue;\n entries.set(key, entry);\n await this.save(key, entry);\n }\n try {\n await unlink(path.join(this.stateDir, \"buffer.json\"));\n } catch (err) {\n if (!(err instanceof Error) || !isMissing(asFsError(err))) throw err;\n }\n }\n const out: NonNullable<BufferState[\"entries\"]> = Object.create(null);\n for (const [key, entry] of entries) out[key] = entry;\n const def = entries.get(\"default\");\n return {\n turns: def?.turns ?? [],\n lastExtractionAt: def?.lastExtractionAt ?? null,\n extractionCount: def?.extractionCount ?? 0,\n entries: out,\n };\n }\n\n /**\n * Reconcile the files with a WHOLE buffer state: write every entry, then\n * delete files for keys no longer present. Writes first, deletes last: a\n * crash leaves stale extra files (removed by the next reconcile) but never\n * loses sessions the state says exist. Not on the observe hot path.\n */\n async reconcile(state: BufferState): Promise<void> {\n const entries = legacyStateToEntries(state);\n const existing = await this.listFiles();\n for (const [key, entry] of entries) await this.save(key, entry);\n const live = new Set([...entries.keys()].map((key) => bufferSessionFileName(key)));\n for (const name of existing) {\n if (live.has(name)) continue;\n try {\n await unlink(path.join(this.dir, name));\n } catch (err) {\n if (!(err instanceof Error) || !isMissing(asFsError(err))) throw err;\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,SAAS,gBAAgB;AACzB,SAAS,SAAS;AAClB,SAAS,kBAAkB;AAC3B,SAAS,OAAO,WAAAA,UAAS,QAAQ,UAAAC,SAAQ,iBAAiB;AAC1D,OAAOC,WAAU;;;ACpCjB,SAAS,kBAAkB;AAE3B,SAAS,OAAO,SAAS,cAAc;AACvC,OAAO,UAAU;AAcjB,SAAS,UAAU,KAA8B;AAC/C,SAAO,KAAK,SAAS;AACvB;AAEA,SAAS,UAAU,KAAqB;AACtC,SAAO;AACT;AAUO,SAAS,sBAAsB,KAAqB;AACzD,SAAO,KAAK,WAAW,QAAQ,EAAE,OAAO,GAAG,EAAE,OAAO,KAAK,CAAC;AAC5D;AAIO,SAAS,qBAAqB,OAAmD;AACtF,QAAM,UAAU,oBAAI,IAA8B;AAClD,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,WAAW,CAAC,CAAC,GAAG;AAC9D,QAAI,SAAS,MAAM,QAAQ,MAAM,KAAK,EAAG,SAAQ,IAAI,KAAK,KAAK;AAAA,EACjE;AACA,MAAI,CAAC,QAAQ,IAAI,SAAS,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AO;AAAA,IACT;AAAA,EACF;AACF;","names":["readdir","unlink","path","path","unlink","readdir"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runLocationSync
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7WFY2L5J.js";
|
|
4
4
|
import {
|
|
5
5
|
log
|
|
6
6
|
} from "./chunk-3WCASNQZ.js";
|
|
@@ -58,4 +58,4 @@ export {
|
|
|
58
58
|
LOCATION_SYNC_DEFAULT_INTERVAL_MS,
|
|
59
59
|
startLocationAutoSync
|
|
60
60
|
};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-VSJ3ARFS.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
WHO_KNOWS_DEFAULT_LIMIT,
|
|
3
3
|
WHO_KNOWS_MAX_LIMIT,
|
|
4
4
|
validateWhoKnowsInput
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-JGLZ46JS.js";
|
|
6
6
|
|
|
7
7
|
// src/who-knows-cli.ts
|
|
8
8
|
function extractWhoKnowsRawArgs(rest) {
|
|
@@ -74,4 +74,4 @@ export {
|
|
|
74
74
|
renderWhoKnowsText,
|
|
75
75
|
renderWhoKnows
|
|
76
76
|
};
|
|
77
|
-
//# sourceMappingURL=chunk-
|
|
77
|
+
//# sourceMappingURL=chunk-W4V7P5HP.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-7T4TOGMS.js";
|
|
4
4
|
import {
|
|
5
5
|
defineOperation
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-23BA3USG.js";
|
|
7
7
|
|
|
8
8
|
// src/external-wiki-access.ts
|
|
9
9
|
import { z } from "zod";
|
|
@@ -26,4 +26,4 @@ var externalWikiSearchOperation = defineOperation({
|
|
|
26
26
|
export {
|
|
27
27
|
externalWikiSearchOperation
|
|
28
28
|
};
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-WNQ3B3Q5.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
runGraphEdgeDecayMaintenanceAcrossNamespaces
|
|
3
|
-
} from "./chunk-K36RMINQ.js";
|
|
4
1
|
import {
|
|
5
2
|
normalizeDreamsStatusWindowHours
|
|
6
3
|
} from "./chunk-PQM3B54K.js";
|
|
4
|
+
import {
|
|
5
|
+
runGraphEdgeDecayMaintenanceAcrossNamespaces
|
|
6
|
+
} from "./chunk-K36RMINQ.js";
|
|
7
7
|
import {
|
|
8
8
|
executeResolution,
|
|
9
9
|
isValidResolutionVerb,
|
|
@@ -21,13 +21,13 @@ import {
|
|
|
21
21
|
defineOperation,
|
|
22
22
|
parseNamespacePreflightWriteOp,
|
|
23
23
|
resolveAuthorizedNamespaceWritablePreflight
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-23BA3USG.js";
|
|
25
25
|
import {
|
|
26
26
|
parseSharedWriteOutputControls
|
|
27
27
|
} from "./chunk-IFBSZGW3.js";
|
|
28
28
|
import {
|
|
29
29
|
validateBriefingFormat
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-N2Y6COEM.js";
|
|
31
31
|
import {
|
|
32
32
|
parseDeepRecallMaxSteps
|
|
33
33
|
} from "./chunk-AJG2TAMR.js";
|
|
@@ -618,4 +618,4 @@ defineOperation({ name: "graph_events", description: "SSE graph events.", schema
|
|
|
618
618
|
defineOperation({ name: "chat_message", description: "Chat message.", schema: strictSchema({ message: S.str, chatSessionId: S.str }), handler: async (_i, _ctx) => ({ result: { ok: true } }) });
|
|
619
619
|
defineOperation({ name: "chat_events", description: "SSE chat events.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { stream: "sse" } }) });
|
|
620
620
|
defineOperation({ name: "adapters_status", description: "Adapter registry metadata (issue #1850 round 5). Marker op: the HTTP transport builds the response from its own adapterRegistry, but the op still must be registered so it appears in listRegisteredOperations and enforceTokenOp can gate it for scoped tokens.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { ok: true } }) });
|
|
621
|
-
//# sourceMappingURL=chunk-
|
|
621
|
+
//# sourceMappingURL=chunk-WYOHQJKC.js.map
|