@camstack/server 1.2.867 → 1.2.869
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/CHANGELOG.md +14 -0
- package/dist/api/trpc/generated-cap-routers.js +64 -0
- package/package.json +20 -9
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +5 -5
- package/system/dist/builtins/alerts/alerts.addon.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +3 -3
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -5
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +4 -4
- package/system/dist/builtins/composer/composer.addon.mjs +4 -4
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +29 -63
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +29 -63
- package/system/dist/builtins/core-blocks/remote-service.d.ts +11 -8
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +4 -4
- package/system/dist/builtins/keychain/index.mjs +4 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +5 -5
- package/system/dist/builtins/local-network/local-network.addon.js +3 -3
- package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
- package/system/dist/builtins/loki-logging/index.js +1 -1
- package/system/dist/builtins/loki-logging/index.mjs +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +10 -10
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
- package/system/dist/builtins/storage-orchestrator/drain-ratchet.d.ts +8 -0
- package/system/dist/builtins/storage-orchestrator/storage-drain-event-monitor.d.ts +63 -0
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +14 -0
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +152 -2
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +152 -2
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +115 -115
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{capture-engine-BCB1OMc_.js → capture-engine-Bwhwpy3T.js} +1 -1
- package/system/dist/{capture-engine-5g4lu_OQ.mjs → capture-engine-hLbiQm2r.mjs} +1 -1
- package/system/dist/{composition-sources-VkBsGWZh.mjs → composition-sources-CXd5ydxk.mjs} +1 -1
- package/system/dist/{composition-sources-1yTVou3a.js → composition-sources-DqGVEx12.js} +1 -1
- package/system/dist/{constants-D1lf-y38.mjs → constants-BxOTlPMv.mjs} +1 -1
- package/system/dist/{constants-r86Qr7xE.js → constants-hVovxKZz.js} +1 -1
- package/system/dist/{coral-accelerators-BW3OcrLD.mjs → coral-accelerators-DBlgWB8k.mjs} +6 -6
- package/system/dist/{custom-action-registry-N7flBDwT.mjs → custom-action-registry-B9zFBNVa.mjs} +37 -37
- package/system/dist/{device-ca-Bs_oj8y_.js → device-ca-1vqFIP_t.js} +1 -1
- package/system/dist/{device-ca-aWcNrAeB.mjs → device-ca-B-yM5jiy.mjs} +1 -1
- package/system/dist/{dist-BeM3jcMe.mjs → dist-D1LOSOS0.mjs} +364 -14
- package/system/dist/{dist-CtlwobAt.js → dist-uTbt3Yxy.js} +364 -14
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-identity-CoyjSGzP.mjs → hub-identity-Dx3Jbhnp.mjs} +10 -10
- package/system/dist/{hub-identity-C_3WvvUh.js → hub-identity-TBo0Xrxk.js} +1 -1
- package/system/dist/{hub-mdns-ciao-MJdhRgSK.mjs → hub-mdns-ciao-Br5Vlcf0.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-DrpNoAbD.js → hub-mdns-ciao-C0xzb8jM.js} +2 -2
- package/system/dist/index.js +8 -8
- package/system/dist/index.mjs +217 -217
- package/system/dist/{legacy-integration-rows-door-DwD_6A21.mjs → legacy-integration-rows-door-CqsM5HcW.mjs} +1 -1
- package/system/dist/{legacy-integration-rows-door-DknPUCvT.js → legacy-integration-rows-door-c8pHSqwA.js} +1 -1
- package/system/dist/{rename-composition-block-B7ZEwdvM.mjs → rename-composition-block-Bbu4W1mg.mjs} +1 -1
- package/system/dist/{rename-composition-block-VNSmpCSW.js → rename-composition-block-DNgRnLHV.js} +1 -1
- package/system/dist/{restore-archive-CizGJ-13.js → restore-archive-D48JPP0d.js} +1 -1
- package/system/dist/{restore-archive-3-Gd66TK.mjs → restore-archive-DcS4GDfw.mjs} +94 -94
- package/system/dist/{wal-maintenance-CMKws6du.mjs → wal-maintenance-BoxO0tlN.mjs} +0 -0
- package/system/dist/{wal-maintenance-cI0DBU7k.js → wal-maintenance-D3s8jnax.js} +0 -0
- package/system/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { o as __toESM, r as __exportAll } from "../../chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import { Bc as emitReadiness, Il as errMsg, Is as BaseAddon, Lr as enumerateInferenceDevices, Rl as EventCategory, _a as platformProbeCapability, lo as scoreRuntimes, ua as parseAcceleratorFactsJson } from "../../dist-
|
|
3
|
-
import { n as detectCoralAccelerator, r as nodeCoralFs } from "../../coral-accelerators-
|
|
4
|
-
import * as fs from "node:fs";
|
|
2
|
+
import { Bc as emitReadiness, Il as errMsg, Is as BaseAddon, Lr as enumerateInferenceDevices, Rl as EventCategory, _a as platformProbeCapability, lo as scoreRuntimes, ua as parseAcceleratorFactsJson } from "../../dist-D1LOSOS0.mjs";
|
|
3
|
+
import { n as detectCoralAccelerator, r as nodeCoralFs } from "../../coral-accelerators-DBlgWB8k.mjs";
|
|
4
|
+
import * as fs$1 from "node:fs";
|
|
5
5
|
import * as path$1 from "node:path";
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
7
|
import * as os$1 from "node:os";
|
|
@@ -492,14 +492,14 @@ var PlatformScorer = class {
|
|
|
492
492
|
if (nvidia) gpu = nvidia;
|
|
493
493
|
const listRenderNodes = () => {
|
|
494
494
|
try {
|
|
495
|
-
return fs.readdirSync("/dev/dri").filter((n) => n.startsWith("renderD")).map((n) => `/dev/dri/${n}`);
|
|
495
|
+
return fs$1.readdirSync("/dev/dri").filter((n) => n.startsWith("renderD")).map((n) => `/dev/dri/${n}`);
|
|
496
496
|
} catch {
|
|
497
497
|
return [];
|
|
498
498
|
}
|
|
499
499
|
};
|
|
500
500
|
const readDrmAttr = (node, attr) => {
|
|
501
501
|
try {
|
|
502
|
-
return fs.readFileSync(`/sys/class/drm/${node.split("/").pop()}/device/${attr}`, "utf8");
|
|
502
|
+
return fs$1.readFileSync(`/sys/class/drm/${node.split("/").pop()}/device/${attr}`, "utf8");
|
|
503
503
|
} catch {
|
|
504
504
|
return "";
|
|
505
505
|
}
|
|
@@ -525,12 +525,12 @@ var PlatformScorer = class {
|
|
|
525
525
|
}
|
|
526
526
|
const listDir = (p) => {
|
|
527
527
|
try {
|
|
528
|
-
return fs.readdirSync(p);
|
|
528
|
+
return fs$1.readdirSync(p);
|
|
529
529
|
} catch {
|
|
530
530
|
return [];
|
|
531
531
|
}
|
|
532
532
|
};
|
|
533
|
-
const exists = (p) => fs.existsSync(p);
|
|
533
|
+
const exists = (p) => fs$1.existsSync(p);
|
|
534
534
|
if (!npu) {
|
|
535
535
|
const { classifyIntelNpu } = await import("../../intel-npu-C8HKvRQF.mjs");
|
|
536
536
|
npu = classifyIntelNpu({
|
|
@@ -558,7 +558,7 @@ var PlatformScorer = class {
|
|
|
558
558
|
exists,
|
|
559
559
|
readFile: (p) => {
|
|
560
560
|
try {
|
|
561
|
-
return fs.readFileSync(p, "utf8");
|
|
561
|
+
return fs$1.readFileSync(p, "utf8");
|
|
562
562
|
} catch {
|
|
563
563
|
return "";
|
|
564
564
|
}
|
|
@@ -844,7 +844,7 @@ function jsonValue(text) {
|
|
|
844
844
|
function readPublishedAcceleratorFacts(filePath) {
|
|
845
845
|
let text;
|
|
846
846
|
try {
|
|
847
|
-
text = fs.readFileSync(filePath, "utf8");
|
|
847
|
+
text = fs$1.readFileSync(filePath, "utf8");
|
|
848
848
|
} catch {
|
|
849
849
|
return null;
|
|
850
850
|
}
|
|
@@ -859,7 +859,7 @@ function findAcceleratorFactsScript(dataDir, cwd = process.cwd()) {
|
|
|
859
859
|
const candidates = [];
|
|
860
860
|
if (typeof dataDir === "string" && dataDir !== "") candidates.push(path$1.join(dataDir, "addons", "@camstack", "addon-pipeline", "python", "accelerator_facts.py"));
|
|
861
861
|
candidates.push(path$1.join(cwd, "packages", "addon-pipeline", "python", "accelerator_facts.py"));
|
|
862
|
-
for (const candidate of candidates) if (fs.existsSync(candidate)) return candidate;
|
|
862
|
+
for (const candidate of candidates) if (fs$1.existsSync(candidate)) return candidate;
|
|
863
863
|
return null;
|
|
864
864
|
}
|
|
865
865
|
async function defaultExec(command, args, timeoutMs) {
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-uTbt3Yxy.js");
|
|
7
7
|
let zod = require("zod");
|
|
8
8
|
let node_crypto = require("node:crypto");
|
|
9
9
|
//#region src/builtins/record-entries/entries-service.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Cl as secretViewsOf, Is as BaseAddon, Ma as recordEntriesCapability, gc as UnknownRecordKindError, qs as InvalidRecordError } from "../../dist-
|
|
1
|
+
import { Cl as secretViewsOf, Is as BaseAddon, Ma as recordEntriesCapability, gc as UnknownRecordKindError, qs as InvalidRecordError } from "../../dist-D1LOSOS0.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
//#region src/builtins/record-entries/entries-service.ts
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-uTbt3Yxy.js");
|
|
7
7
|
let zod = require("zod");
|
|
8
8
|
//#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
|
|
9
9
|
/**
|
package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Is as BaseAddon, Rl as EventCategory } from "../../dist-
|
|
1
|
+
import { Is as BaseAddon, Rl as EventCategory } from "../../dist-D1LOSOS0.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
|
|
4
4
|
/**
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-uTbt3Yxy.js");
|
|
7
7
|
const require_snapshot_courtesy = require("../../snapshot-courtesy-D_C5-nC0.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fl as DeviceType, Fn as batteryCapability, Il as errMsg, Is as BaseAddon, Ji as memoizePinnedFfmpeg, Nl as DeviceFeature, Oo as streamQualityLabel, Pn as bareAddonId, Rl as EventCategory, ll as nodePin, wr as deriveBatteryPresence, y as BatteryStatusSchema, yo as snapshotCapability } from "../../dist-
|
|
1
|
+
import { Fl as DeviceType, Fn as batteryCapability, Il as errMsg, Is as BaseAddon, Ji as memoizePinnedFfmpeg, Nl as DeviceFeature, Oo as streamQualityLabel, Pn as bareAddonId, Rl as EventCategory, ll as nodePin, wr as deriveBatteryPresence, y as BatteryStatusSchema, yo as snapshotCapability } from "../../dist-D1LOSOS0.mjs";
|
|
2
2
|
import { i as renderCourtesyOverlayJpeg, n as courtesyCacheKey, r as renderCourtesyJpeg } from "../../snapshot-courtesy-CyFs1M3I.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-uTbt3Yxy.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $r as filesystemBrowseCapability, Eo as storageProviderCapability, Is as BaseAddon } from "../../dist-
|
|
1
|
+
import { $r as filesystemBrowseCapability, Eo as storageProviderCapability, Is as BaseAddon } from "../../dist-D1LOSOS0.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
|
-
import * as fs from "node:fs";
|
|
3
|
+
import * as fs$1 from "node:fs";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
5
5
|
import { basename, dirname, isAbsolute, join, resolve, sep } from "node:path";
|
|
6
6
|
import { mkdir, readdir, realpath, statfs } from "node:fs/promises";
|
|
@@ -169,16 +169,16 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
|
|
|
169
169
|
error: "config.basePath must be a non-empty string"
|
|
170
170
|
};
|
|
171
171
|
try {
|
|
172
|
-
const stat = await fs.promises.stat(basePath).catch(() => null);
|
|
172
|
+
const stat = await fs$1.promises.stat(basePath).catch(() => null);
|
|
173
173
|
if (stat) {
|
|
174
174
|
if (!stat.isDirectory()) return {
|
|
175
175
|
ok: false,
|
|
176
176
|
error: `Path "${basePath}" exists but is not a directory`
|
|
177
177
|
};
|
|
178
|
-
await fs.promises.access(basePath, fs.constants.W_OK);
|
|
178
|
+
await fs$1.promises.access(basePath, fs$1.constants.W_OK);
|
|
179
179
|
return { ok: true };
|
|
180
180
|
}
|
|
181
|
-
await fs.promises.mkdir(basePath, { recursive: true });
|
|
181
|
+
await fs$1.promises.mkdir(basePath, { recursive: true });
|
|
182
182
|
return { ok: true };
|
|
183
183
|
} catch (err) {
|
|
184
184
|
return {
|
|
@@ -192,12 +192,12 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
|
|
|
192
192
|
}
|
|
193
193
|
async write({ location, relativePath, data }) {
|
|
194
194
|
const filePath = safeResolve(getBasePath(location), relativePath);
|
|
195
|
-
await fs.promises.mkdir(path$1.dirname(filePath), { recursive: true });
|
|
196
|
-
await fs.promises.writeFile(filePath, data);
|
|
195
|
+
await fs$1.promises.mkdir(path$1.dirname(filePath), { recursive: true });
|
|
196
|
+
await fs$1.promises.writeFile(filePath, data);
|
|
197
197
|
}
|
|
198
198
|
async read({ location, relativePath }) {
|
|
199
199
|
const filePath = safeResolve(getBasePath(location), relativePath);
|
|
200
|
-
const buf = await fs.promises.readFile(filePath);
|
|
200
|
+
const buf = await fs$1.promises.readFile(filePath);
|
|
201
201
|
const out = new Uint8Array(new ArrayBuffer(buf.byteLength));
|
|
202
202
|
out.set(buf);
|
|
203
203
|
return out;
|
|
@@ -205,7 +205,7 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
|
|
|
205
205
|
async exists({ location, relativePath }) {
|
|
206
206
|
const filePath = safeResolve(getBasePath(location), relativePath);
|
|
207
207
|
try {
|
|
208
|
-
await fs.promises.access(filePath);
|
|
208
|
+
await fs$1.promises.access(filePath);
|
|
209
209
|
return true;
|
|
210
210
|
} catch {
|
|
211
211
|
return false;
|
|
@@ -215,25 +215,25 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
|
|
|
215
215
|
const base = getBasePath(location);
|
|
216
216
|
const dir = prefix ? safeResolve(base, prefix) : path$1.resolve(base);
|
|
217
217
|
try {
|
|
218
|
-
return (await fs.promises.readdir(dir, { withFileTypes: true })).map((e) => prefix ? `${prefix}/${e.name}` : e.name);
|
|
218
|
+
return (await fs$1.promises.readdir(dir, { withFileTypes: true })).map((e) => prefix ? `${prefix}/${e.name}` : e.name);
|
|
219
219
|
} catch {
|
|
220
220
|
return [];
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
async delete({ location, relativePath }) {
|
|
224
224
|
const filePath = safeResolve(getBasePath(location), relativePath);
|
|
225
|
-
await fs.promises.rm(filePath, { force: true });
|
|
225
|
+
await fs$1.promises.rm(filePath, { force: true });
|
|
226
226
|
}
|
|
227
227
|
async getAvailableSpace({ location }) {
|
|
228
228
|
const base = path$1.resolve(getBasePath(location));
|
|
229
229
|
try {
|
|
230
230
|
let target = base;
|
|
231
|
-
while (!fs.existsSync(target)) {
|
|
231
|
+
while (!fs$1.existsSync(target)) {
|
|
232
232
|
const parent = path$1.dirname(target);
|
|
233
233
|
if (!parent || parent === target) return null;
|
|
234
234
|
target = parent;
|
|
235
235
|
}
|
|
236
|
-
const stats = await fs.promises.statfs(target);
|
|
236
|
+
const stats = await fs$1.promises.statfs(target);
|
|
237
237
|
return stats.bavail * stats.bsize;
|
|
238
238
|
} catch {
|
|
239
239
|
return null;
|
|
@@ -242,9 +242,9 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
|
|
|
242
242
|
async beginUpload({ location, relativePath }) {
|
|
243
243
|
const target = safeResolve(getBasePath(location), relativePath);
|
|
244
244
|
const partial = `${target}.partial`;
|
|
245
|
-
await fs.promises.mkdir(path$1.dirname(target), { recursive: true });
|
|
246
|
-
await fs.promises.unlink(partial).catch(() => {});
|
|
247
|
-
const stream = fs.createWriteStream(partial);
|
|
245
|
+
await fs$1.promises.mkdir(path$1.dirname(target), { recursive: true });
|
|
246
|
+
await fs$1.promises.unlink(partial).catch(() => {});
|
|
247
|
+
const stream = fs$1.createWriteStream(partial);
|
|
248
248
|
const uploadId = randomUUID();
|
|
249
249
|
const session = {
|
|
250
250
|
stream,
|
|
@@ -285,7 +285,7 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
|
|
|
285
285
|
session.stream.end(() => resolve());
|
|
286
286
|
session.stream.on("error", reject);
|
|
287
287
|
});
|
|
288
|
-
await fs.promises.rename(session.partial, session.target);
|
|
288
|
+
await fs$1.promises.rename(session.partial, session.target);
|
|
289
289
|
clearTimeout(session.timer);
|
|
290
290
|
this.uploads.delete(uploadId);
|
|
291
291
|
}
|
|
@@ -295,14 +295,14 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
|
|
|
295
295
|
try {
|
|
296
296
|
session.stream.destroy();
|
|
297
297
|
} catch {}
|
|
298
|
-
await fs.promises.unlink(session.partial).catch(() => {});
|
|
298
|
+
await fs$1.promises.unlink(session.partial).catch(() => {});
|
|
299
299
|
clearTimeout(session.timer);
|
|
300
300
|
this.uploads.delete(uploadId);
|
|
301
301
|
}
|
|
302
302
|
async beginDownload({ location, relativePath }) {
|
|
303
303
|
const target = safeResolve(getBasePath(location), relativePath);
|
|
304
|
-
const stat = await fs.promises.stat(target);
|
|
305
|
-
const fd = await fs.promises.open(target, "r");
|
|
304
|
+
const stat = await fs$1.promises.stat(target);
|
|
305
|
+
const fd = await fs$1.promises.open(target, "r");
|
|
306
306
|
const downloadId = randomUUID();
|
|
307
307
|
const session = {
|
|
308
308
|
fd,
|
|
@@ -4,7 +4,7 @@ Object.defineProperties(exports, {
|
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
6
|
const require_builtins_sqlite_storage_filesystem_storage_addon = require("./filesystem-storage.addon.js");
|
|
7
|
-
const require_wal_maintenance = require("../../wal-maintenance-
|
|
7
|
+
const require_wal_maintenance = require("../../wal-maintenance-D3s8jnax.js");
|
|
8
8
|
const require_builtins_sqlite_storage_sqlite_settings_addon = require("./sqlite-settings.addon.js");
|
|
9
9
|
//#region src/builtins/sqlite-storage/config-store.ts
|
|
10
10
|
var ConfigStore = class {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./filesystem-storage.addon.mjs";
|
|
2
|
-
import { B as SQLITE_ENGINE_STORM_WALL_SHARE, F as SQLITE_MMAP_FLOOR_BYTES, G as SqliteOpProfiler, H as SQLITE_PROFILE_REPORT_INTERVAL_MS, I as SQLITE_PAGE_CACHE_CEILING_KIB, K as sqliteEngineStorm, L as SQLITE_PAGE_CACHE_FLOOR_KIB, N as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, P as SQLITE_MMAP_CEILING_BYTES, R as sqliteMmapSizeFor, U as SQLITE_PROFILE_TOP_N, V as SQLITE_PROFILE_REPORT_FLOOR_MS, W as SQLITE_SLOW_CALL_MS, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as sqlitePageCacheKibFor } from "../../wal-maintenance-
|
|
2
|
+
import { B as SQLITE_ENGINE_STORM_WALL_SHARE, F as SQLITE_MMAP_FLOOR_BYTES, G as SqliteOpProfiler, H as SQLITE_PROFILE_REPORT_INTERVAL_MS, I as SQLITE_PAGE_CACHE_CEILING_KIB, K as sqliteEngineStorm, L as SQLITE_PAGE_CACHE_FLOOR_KIB, N as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, P as SQLITE_MMAP_CEILING_BYTES, R as sqliteMmapSizeFor, U as SQLITE_PROFILE_TOP_N, V as SQLITE_PROFILE_REPORT_FLOOR_MS, W as SQLITE_SLOW_CALL_MS, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as sqlitePageCacheKibFor } from "../../wal-maintenance-BoxO0tlN.mjs";
|
|
3
3
|
import { SqliteSettingsAddon } from "./sqlite-settings.addon.mjs";
|
|
4
4
|
//#region src/builtins/sqlite-storage/config-store.ts
|
|
5
5
|
var ConfigStore = class {
|
|
@@ -3,12 +3,12 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-uTbt3Yxy.js");
|
|
7
7
|
const require_retired_settings_keys = require("../../retired-settings-keys-C8nOOr5H.js");
|
|
8
|
-
const require_wal_maintenance = require("../../wal-maintenance-
|
|
8
|
+
const require_wal_maintenance = require("../../wal-maintenance-D3s8jnax.js");
|
|
9
9
|
const require_sqlite_snapshot_protocol = require("../../sqlite-snapshot-protocol-B9OndqZv.js");
|
|
10
10
|
const require_wal_checkpoint_policy = require("../../wal-checkpoint-policy-d2z2qPqx.js");
|
|
11
|
-
const require_legacy_integration_rows_door = require("../../legacy-integration-rows-door-
|
|
11
|
+
const require_legacy_integration_rows_door = require("../../legacy-integration-rows-door-c8pHSqwA.js");
|
|
12
12
|
let zod = require("zod");
|
|
13
13
|
let node_crypto = require("node:crypto");
|
|
14
14
|
let node_fs = require("node:fs");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $a as resolveRunnerId, F as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, Hs as DeclarationRefusedError, I as DATABASE_SNAPSHOT_SUFFIX, Ic as defineCustomActions, Il as errMsg$1, Is as BaseAddon, Js as NoCallerError, L as DATABASE_SNAPSHOT_TIMEOUT_MS, Lt as MigrationMetaSchema, Mt as MIGRATION_API_V1_METHODS, Na as recordsCapability, Pc as customAction, Pn as bareAddonId, R as DATA_STORE_DATABASES, Rl as EventCategory, So as storageAdminCapability, Yn as catalogueIssues, Zi as migrationsCapability, dl as normalizeSecretOwner, ec as RECORD_SWEEP_INTERVAL_MS, gc as UnknownRecordKindError, kc as collectSecretMarkerRefs, la as orderMigrations, mc as TransactRefusedError, qo as vectorStoreCapability, qs as InvalidRecordError, rc as RUNTIME_DEFAULTS, sc as RecordKindDeclarationSchema, vr as dataStoreProviderCapability, yr as databaseSnapshotCapability } from "../../dist-
|
|
1
|
+
import { $a as resolveRunnerId, F as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, Hs as DeclarationRefusedError, I as DATABASE_SNAPSHOT_SUFFIX, Ic as defineCustomActions, Il as errMsg$1, Is as BaseAddon, Js as NoCallerError, L as DATABASE_SNAPSHOT_TIMEOUT_MS, Lt as MigrationMetaSchema, Mt as MIGRATION_API_V1_METHODS, Na as recordsCapability, Pc as customAction, Pn as bareAddonId, R as DATA_STORE_DATABASES, Rl as EventCategory, So as storageAdminCapability, Yn as catalogueIssues, Zi as migrationsCapability, dl as normalizeSecretOwner, ec as RECORD_SWEEP_INTERVAL_MS, gc as UnknownRecordKindError, kc as collectSecretMarkerRefs, la as orderMigrations, mc as TransactRefusedError, qo as vectorStoreCapability, qs as InvalidRecordError, rc as RUNTIME_DEFAULTS, sc as RecordKindDeclarationSchema, vr as dataStoreProviderCapability, yr as databaseSnapshotCapability } from "../../dist-D1LOSOS0.mjs";
|
|
2
2
|
import { r as retiredKeyStoreOf, t as purgeRetiredSettingsKeys } from "../../retired-settings-keys-u6xQA6r7.mjs";
|
|
3
|
-
import { A as callRecords, D as RecordsEngine, E as databaseOfStore, M as controlTargetOf, O as callControl, T as trustResult, _ as rehydrateError, a as WalMaintenance, b as collectTransferables, c as vectorProviderOfOwnedFile, d as callMigrate, f as migrateTargetOf, g as DuplicatePlacementError, h as DatabaseBusyError, j as callVector, k as callData, l as SqliteSettingsBackend, m as CrossDatabaseTransactError, o as createVectorIndex, p as CollectionPlacementError, s as vectorProviderOf, u as HUB_MIGRATIONS, x as isFileHostMessage } from "../../wal-maintenance-
|
|
3
|
+
import { A as callRecords, D as RecordsEngine, E as databaseOfStore, M as controlTargetOf, O as callControl, T as trustResult, _ as rehydrateError, a as WalMaintenance, b as collectTransferables, c as vectorProviderOfOwnedFile, d as callMigrate, f as migrateTargetOf, g as DuplicatePlacementError, h as DatabaseBusyError, j as callVector, k as callData, l as SqliteSettingsBackend, m as CrossDatabaseTransactError, o as createVectorIndex, p as CollectionPlacementError, s as vectorProviderOf, u as HUB_MIGRATIONS, x as isFileHostMessage } from "../../wal-maintenance-BoxO0tlN.mjs";
|
|
4
4
|
import { r as isSnapshotWorkerMessage } from "../../sqlite-snapshot-protocol-2QaTouWV.mjs";
|
|
5
5
|
import { a as isWorkerMessage, t as WAL_CHECKPOINT_LARGE_PASS_FRAMES } from "../../wal-checkpoint-policy-BahrTtyD.mjs";
|
|
6
|
-
import { a as patchLegacyIntegrationRows, i as legacyIntegrationAddonId, n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows, r as deleteLegacyIntegrationRowKeys } from "../../legacy-integration-rows-door-
|
|
6
|
+
import { a as patchLegacyIntegrationRows, i as legacyIntegrationAddonId, n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows, r as deleteLegacyIntegrationRowKeys } from "../../legacy-integration-rows-door-CqsM5HcW.mjs";
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
@@ -90,6 +90,14 @@ export interface DrainProgress {
|
|
|
90
90
|
* believe the screen.
|
|
91
91
|
*/
|
|
92
92
|
readonly estimatedEmptyAtMs: number | null;
|
|
93
|
+
/**
|
|
94
|
+
* The observed cede rate, bytes per millisecond, or `null` on the same
|
|
95
|
+
* condition as {@link estimatedEmptyAtMs} — no growth measured yet. #538's
|
|
96
|
+
* progress event reports this rather than re-deriving it from the other two
|
|
97
|
+
* fields, so a reader never has to reconstruct a rate the ratchet already
|
|
98
|
+
* computed.
|
|
99
|
+
*/
|
|
100
|
+
readonly rateBytesPerMs: number | null;
|
|
93
101
|
}
|
|
94
102
|
/** The state a drain starts from. No deletion happens on this sweep. */
|
|
95
103
|
export declare function beginDrain(observation: DrainObservation): DrainState;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StorageDrainEventMonitor — the operator-facing cadence for a drain's
|
|
3
|
+
* progress (#538).
|
|
4
|
+
*
|
|
5
|
+
* A `drain` location (D385) and the pruning eviction that paces it (D386) ran
|
|
6
|
+
* with no signal at all: an operator who put a disk into drain had to poll
|
|
7
|
+
* `storage.listDrainProgress` by hand to learn it was still moving. This
|
|
8
|
+
* decides WHEN a system event fires, not what it says — the sweep already
|
|
9
|
+
* computed the figures (`drainProgressOf`); this only throttles them to the
|
|
10
|
+
* cadence an operator can read without being paged every sweep.
|
|
11
|
+
*
|
|
12
|
+
* Two rules, no operator knob:
|
|
13
|
+
*
|
|
14
|
+
* - PROGRESS fires once immediately (drain start, or this process's first
|
|
15
|
+
* sweep after a restart) and then at most once per `cadenceMs` — the named
|
|
16
|
+
* constant {@link DRAIN_PROGRESS_EVENT_INTERVAL_MS}, 15 minutes.
|
|
17
|
+
* - COMPLETE fires exactly once, the first sweep that reports the location
|
|
18
|
+
* drained — never again for the same location until it drains again.
|
|
19
|
+
*
|
|
20
|
+
* A sweep whose occupancy read failed is NOT skipped: the sample's bytes/
|
|
21
|
+
* rate/ETA are `null` (D393 — never folded to 0) and the cadence still
|
|
22
|
+
* applies, so the operator sees "still draining, figures unknown" rather than
|
|
23
|
+
* silence that reads as "the drain stopped reporting".
|
|
24
|
+
*
|
|
25
|
+
* Pure except for the injected clock — same shape as
|
|
26
|
+
* `StorageLocationBandMonitor`, stateful across `observe()` calls, one
|
|
27
|
+
* transition per sweep.
|
|
28
|
+
*/
|
|
29
|
+
/** No operator-facing rate knob (#538): the cadence is this one constant. */
|
|
30
|
+
export declare const DRAIN_PROGRESS_EVENT_INTERVAL_MS: number;
|
|
31
|
+
export interface StorageDrainEventSample {
|
|
32
|
+
readonly locationId: string;
|
|
33
|
+
readonly locationName: string;
|
|
34
|
+
readonly nodeId?: string;
|
|
35
|
+
/** `null` when this sweep's occupancy read failed — never folded to 0 (D393). */
|
|
36
|
+
readonly bytesRemaining: number | null;
|
|
37
|
+
readonly rateBytesPerMs: number | null;
|
|
38
|
+
readonly estimatedEmptyAtMs: number | null;
|
|
39
|
+
readonly drained: boolean;
|
|
40
|
+
}
|
|
41
|
+
export type StorageDrainEventKind = "progress" | "complete";
|
|
42
|
+
export interface StorageDrainEvent {
|
|
43
|
+
readonly kind: StorageDrainEventKind;
|
|
44
|
+
readonly locationId: string;
|
|
45
|
+
readonly locationName: string;
|
|
46
|
+
readonly nodeId?: string;
|
|
47
|
+
readonly bytesRemaining: number | null;
|
|
48
|
+
readonly rateBytesPerMs: number | null;
|
|
49
|
+
readonly estimatedEmptyAtMs: number | null;
|
|
50
|
+
}
|
|
51
|
+
export declare class StorageDrainEventMonitor {
|
|
52
|
+
private readonly cadenceMs;
|
|
53
|
+
private readonly now;
|
|
54
|
+
private readonly state;
|
|
55
|
+
constructor(cadenceMs?: number, now?: () => number);
|
|
56
|
+
/**
|
|
57
|
+
* Observe one sweep of draining locations. A location missing from `samples`
|
|
58
|
+
* (switched back to `readonly`/`active`, or deleted) drops its schedule
|
|
59
|
+
* silently: a later re-drain starts a fresh "begin" event rather than
|
|
60
|
+
* resuming the old cadence clock.
|
|
61
|
+
*/
|
|
62
|
+
observe(samples: readonly StorageDrainEventSample[]): readonly StorageDrainEvent[];
|
|
63
|
+
}
|
|
@@ -9,6 +9,8 @@ export declare class StorageOrchestratorAddon extends BaseAddon<StorageOrchestra
|
|
|
9
9
|
private service;
|
|
10
10
|
private pressureManager;
|
|
11
11
|
private readonly locationBandMonitor;
|
|
12
|
+
/** Drain progress/completion cadence (#538) — a named constant, no operator knob. */
|
|
13
|
+
private readonly drainEventMonitor;
|
|
12
14
|
/**
|
|
13
15
|
* How much of each location CamStack itself holds (D388).
|
|
14
16
|
*
|
|
@@ -154,6 +156,18 @@ export declare class StorageOrchestratorAddon extends BaseAddon<StorageOrchestra
|
|
|
154
156
|
/** Drain progress for every draining location, as of the last sweep. */
|
|
155
157
|
private drainProgress;
|
|
156
158
|
/**
|
|
159
|
+
* Regular system events for drain and pruning progress (#538) — a progress
|
|
160
|
+
* ping on the named cadence (plus on drain start), and the completion
|
|
161
|
+
* event once a location empties.
|
|
162
|
+
*
|
|
163
|
+
* The sample set is the drain PLAN (`resolveDrainPlan`, which locations the
|
|
164
|
+
* operator put into `drain`), not the progress snapshot: a sweep whose
|
|
165
|
+
* occupancy read failed for a location is still draining and must still be
|
|
166
|
+
* sampled, with `null` figures (D393 — never folded to 0), so the cadence
|
|
167
|
+
* clock keeps ticking instead of restarting as if the drain had just begun.
|
|
168
|
+
*/
|
|
169
|
+
private emitDrainEvents;
|
|
170
|
+
/**
|
|
157
171
|
* What the provider's own schema declared secret, or `undefined` when this
|
|
158
172
|
* node has never heard from that provider. The distinction is the whole
|
|
159
173
|
* point — see `secretKeysForConfig`, which fails CLOSED on `undefined`.
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-uTbt3Yxy.js");
|
|
7
7
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
@@ -4082,7 +4082,8 @@ function drainProgressOf(state, usedBytes, nowMs) {
|
|
|
4082
4082
|
startBytes: state.startBytes,
|
|
4083
4083
|
bytesRemaining,
|
|
4084
4084
|
drained: bytesRemaining <= 0,
|
|
4085
|
-
estimatedEmptyAtMs: rateBytesPerMs === null || bytesRemaining <= 0 ? null : nowMs + Math.ceil(bytesRemaining / rateBytesPerMs)
|
|
4085
|
+
estimatedEmptyAtMs: rateBytesPerMs === null || bytesRemaining <= 0 ? null : nowMs + Math.ceil(bytesRemaining / rateBytesPerMs),
|
|
4086
|
+
rateBytesPerMs
|
|
4086
4087
|
};
|
|
4087
4088
|
}
|
|
4088
4089
|
//#endregion
|
|
@@ -4461,6 +4462,91 @@ var StorageLocationBandMonitor = class {
|
|
|
4461
4462
|
}
|
|
4462
4463
|
};
|
|
4463
4464
|
//#endregion
|
|
4465
|
+
//#region src/builtins/storage-orchestrator/storage-drain-event-monitor.ts
|
|
4466
|
+
/**
|
|
4467
|
+
* StorageDrainEventMonitor — the operator-facing cadence for a drain's
|
|
4468
|
+
* progress (#538).
|
|
4469
|
+
*
|
|
4470
|
+
* A `drain` location (D385) and the pruning eviction that paces it (D386) ran
|
|
4471
|
+
* with no signal at all: an operator who put a disk into drain had to poll
|
|
4472
|
+
* `storage.listDrainProgress` by hand to learn it was still moving. This
|
|
4473
|
+
* decides WHEN a system event fires, not what it says — the sweep already
|
|
4474
|
+
* computed the figures (`drainProgressOf`); this only throttles them to the
|
|
4475
|
+
* cadence an operator can read without being paged every sweep.
|
|
4476
|
+
*
|
|
4477
|
+
* Two rules, no operator knob:
|
|
4478
|
+
*
|
|
4479
|
+
* - PROGRESS fires once immediately (drain start, or this process's first
|
|
4480
|
+
* sweep after a restart) and then at most once per `cadenceMs` — the named
|
|
4481
|
+
* constant {@link DRAIN_PROGRESS_EVENT_INTERVAL_MS}, 15 minutes.
|
|
4482
|
+
* - COMPLETE fires exactly once, the first sweep that reports the location
|
|
4483
|
+
* drained — never again for the same location until it drains again.
|
|
4484
|
+
*
|
|
4485
|
+
* A sweep whose occupancy read failed is NOT skipped: the sample's bytes/
|
|
4486
|
+
* rate/ETA are `null` (D393 — never folded to 0) and the cadence still
|
|
4487
|
+
* applies, so the operator sees "still draining, figures unknown" rather than
|
|
4488
|
+
* silence that reads as "the drain stopped reporting".
|
|
4489
|
+
*
|
|
4490
|
+
* Pure except for the injected clock — same shape as
|
|
4491
|
+
* `StorageLocationBandMonitor`, stateful across `observe()` calls, one
|
|
4492
|
+
* transition per sweep.
|
|
4493
|
+
*/
|
|
4494
|
+
/** No operator-facing rate knob (#538): the cadence is this one constant. */
|
|
4495
|
+
var DRAIN_PROGRESS_EVENT_INTERVAL_MS = 15 * 6e4;
|
|
4496
|
+
function toEvent(kind, sample) {
|
|
4497
|
+
return {
|
|
4498
|
+
kind,
|
|
4499
|
+
locationId: sample.locationId,
|
|
4500
|
+
locationName: sample.locationName,
|
|
4501
|
+
...sample.nodeId !== void 0 ? { nodeId: sample.nodeId } : {},
|
|
4502
|
+
bytesRemaining: sample.bytesRemaining,
|
|
4503
|
+
rateBytesPerMs: sample.rateBytesPerMs,
|
|
4504
|
+
estimatedEmptyAtMs: sample.estimatedEmptyAtMs
|
|
4505
|
+
};
|
|
4506
|
+
}
|
|
4507
|
+
var StorageDrainEventMonitor = class {
|
|
4508
|
+
cadenceMs;
|
|
4509
|
+
now;
|
|
4510
|
+
state = /* @__PURE__ */ new Map();
|
|
4511
|
+
constructor(cadenceMs = DRAIN_PROGRESS_EVENT_INTERVAL_MS, now = Date.now) {
|
|
4512
|
+
this.cadenceMs = cadenceMs;
|
|
4513
|
+
this.now = now;
|
|
4514
|
+
}
|
|
4515
|
+
/**
|
|
4516
|
+
* Observe one sweep of draining locations. A location missing from `samples`
|
|
4517
|
+
* (switched back to `readonly`/`active`, or deleted) drops its schedule
|
|
4518
|
+
* silently: a later re-drain starts a fresh "begin" event rather than
|
|
4519
|
+
* resuming the old cadence clock.
|
|
4520
|
+
*/
|
|
4521
|
+
observe(samples) {
|
|
4522
|
+
const nowMs = this.now();
|
|
4523
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4524
|
+
const out = [];
|
|
4525
|
+
for (const sample of samples) {
|
|
4526
|
+
seen.add(sample.locationId);
|
|
4527
|
+
const previous = this.state.get(sample.locationId);
|
|
4528
|
+
if (sample.drained) {
|
|
4529
|
+
if (previous?.completedEmitted !== true) {
|
|
4530
|
+
this.state.set(sample.locationId, {
|
|
4531
|
+
lastEmittedAtMs: nowMs,
|
|
4532
|
+
completedEmitted: true
|
|
4533
|
+
});
|
|
4534
|
+
out.push(toEvent("complete", sample));
|
|
4535
|
+
}
|
|
4536
|
+
continue;
|
|
4537
|
+
}
|
|
4538
|
+
if (!(previous === void 0 || nowMs - previous.lastEmittedAtMs >= this.cadenceMs)) continue;
|
|
4539
|
+
this.state.set(sample.locationId, {
|
|
4540
|
+
lastEmittedAtMs: nowMs,
|
|
4541
|
+
completedEmitted: false
|
|
4542
|
+
});
|
|
4543
|
+
out.push(toEvent("progress", sample));
|
|
4544
|
+
}
|
|
4545
|
+
for (const id of this.state.keys()) if (!seen.has(id)) this.state.delete(id);
|
|
4546
|
+
return out;
|
|
4547
|
+
}
|
|
4548
|
+
};
|
|
4549
|
+
//#endregion
|
|
4464
4550
|
//#region src/builtins/storage-orchestrator/location-history-recorder.ts
|
|
4465
4551
|
var LOCATION_HISTORY_NAMES = {
|
|
4466
4552
|
usedPercent: "location-used-percent",
|
|
@@ -4612,6 +4698,8 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
4612
4698
|
service = null;
|
|
4613
4699
|
pressureManager = null;
|
|
4614
4700
|
locationBandMonitor = new StorageLocationBandMonitor();
|
|
4701
|
+
/** Drain progress/completion cadence (#538) — a named constant, no operator knob. */
|
|
4702
|
+
drainEventMonitor = new StorageDrainEventMonitor();
|
|
4615
4703
|
/**
|
|
4616
4704
|
* How much of each location CamStack itself holds (D388).
|
|
4617
4705
|
*
|
|
@@ -5185,6 +5273,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5185
5273
|
try {
|
|
5186
5274
|
await this.pressureManager.sweep();
|
|
5187
5275
|
await this.emitLocationBandEvents();
|
|
5276
|
+
this.emitDrainEvents();
|
|
5188
5277
|
} catch (err) {
|
|
5189
5278
|
this.ctxIfReady?.logger.warn("storage pressure sweep failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
5190
5279
|
} finally {
|
|
@@ -5355,6 +5444,67 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5355
5444
|
return this.pressureManager?.drainProgressSnapshot() ?? [];
|
|
5356
5445
|
}
|
|
5357
5446
|
/**
|
|
5447
|
+
* Regular system events for drain and pruning progress (#538) — a progress
|
|
5448
|
+
* ping on the named cadence (plus on drain start), and the completion
|
|
5449
|
+
* event once a location empties.
|
|
5450
|
+
*
|
|
5451
|
+
* The sample set is the drain PLAN (`resolveDrainPlan`, which locations the
|
|
5452
|
+
* operator put into `drain`), not the progress snapshot: a sweep whose
|
|
5453
|
+
* occupancy read failed for a location is still draining and must still be
|
|
5454
|
+
* sampled, with `null` figures (D393 — never folded to 0), so the cadence
|
|
5455
|
+
* clock keeps ticking instead of restarting as if the drain had just begun.
|
|
5456
|
+
*/
|
|
5457
|
+
emitDrainEvents() {
|
|
5458
|
+
const svc = this.service;
|
|
5459
|
+
const ctx = this.ctxIfReady;
|
|
5460
|
+
if (!svc || !ctx) return;
|
|
5461
|
+
const plan = this.resolveDrainPlan();
|
|
5462
|
+
if (plan.length === 0) return;
|
|
5463
|
+
const byId = new Map(svc.listLocations().map((loc) => [loc.id, loc]));
|
|
5464
|
+
const progressById = new Map(this.drainProgress().map((p) => [p.locationId, p]));
|
|
5465
|
+
const samples = plan.map((entry) => {
|
|
5466
|
+
const loc = byId.get(entry.locationId);
|
|
5467
|
+
const progress = progressById.get(entry.locationId);
|
|
5468
|
+
if (progress === void 0) ctx.logger.debug("storage drain: no progress figures from this sweep — reporting unknown rather than 0", { meta: { locationId: entry.locationId } });
|
|
5469
|
+
return {
|
|
5470
|
+
locationId: entry.locationId,
|
|
5471
|
+
locationName: loc?.displayName ?? entry.locationId,
|
|
5472
|
+
...loc?.nodeId !== void 0 ? { nodeId: loc.nodeId } : {},
|
|
5473
|
+
bytesRemaining: progress?.bytesRemaining ?? null,
|
|
5474
|
+
rateBytesPerMs: progress?.rateBytesPerMs ?? null,
|
|
5475
|
+
estimatedEmptyAtMs: progress?.estimatedEmptyAtMs ?? null,
|
|
5476
|
+
drained: progress?.drained ?? false
|
|
5477
|
+
};
|
|
5478
|
+
});
|
|
5479
|
+
for (const event of this.drainEventMonitor.observe(samples)) {
|
|
5480
|
+
const category = event.kind === "complete" ? require_dist.EventCategory.StorageDrainComplete : require_dist.EventCategory.StorageDrainProgress;
|
|
5481
|
+
ctx.logger.info("storage drain: event", { meta: {
|
|
5482
|
+
locationId: event.locationId,
|
|
5483
|
+
kind: event.kind,
|
|
5484
|
+
bytesRemaining: event.bytesRemaining,
|
|
5485
|
+
rateBytesPerMs: event.rateBytesPerMs,
|
|
5486
|
+
estimatedEmptyAtMs: event.estimatedEmptyAtMs
|
|
5487
|
+
} });
|
|
5488
|
+
ctx.eventBus.emit({
|
|
5489
|
+
id: (0, node_crypto.randomUUID)(),
|
|
5490
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
5491
|
+
source: {
|
|
5492
|
+
type: "addon",
|
|
5493
|
+
id: this.ctx.id
|
|
5494
|
+
},
|
|
5495
|
+
category,
|
|
5496
|
+
data: {
|
|
5497
|
+
locationId: event.locationId,
|
|
5498
|
+
locationName: event.locationName,
|
|
5499
|
+
...event.nodeId !== void 0 ? { nodeId: event.nodeId } : {},
|
|
5500
|
+
bytesRemaining: event.bytesRemaining,
|
|
5501
|
+
rateBytesPerMs: event.rateBytesPerMs,
|
|
5502
|
+
estimatedEmptyAtMs: event.estimatedEmptyAtMs
|
|
5503
|
+
}
|
|
5504
|
+
});
|
|
5505
|
+
}
|
|
5506
|
+
}
|
|
5507
|
+
/**
|
|
5358
5508
|
* What the provider's own schema declared secret, or `undefined` when this
|
|
5359
5509
|
* node has never heard from that provider. The distinction is the whole
|
|
5360
5510
|
* point — see `secretKeysForConfig`, which fails CLOSED on `undefined`.
|