@camstack/system 1.2.218 → 1.2.219
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/addon-runner.js +2 -2
- package/dist/addon-runner.mjs +2 -2
- package/dist/addon-utils.js +2 -2
- package/dist/addon-utils.mjs +2 -2
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
- package/dist/builtins/device-manager/device-manager.addon.js +2 -2
- package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
- package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
- package/dist/builtins/local-network/local-network.addon.js +2 -2
- package/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/gpu-probe.d.ts +18 -0
- package/dist/builtins/native-metrics/native-metrics-provider.d.ts +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.d.ts +26 -3
- package/dist/builtins/native-metrics/native-metrics.addon.js +1320 -1093
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1320 -1096
- package/dist/builtins/native-metrics/proc-process-table.d.ts +25 -0
- package/dist/builtins/platform-probe/index.js +3 -3
- package/dist/builtins/platform-probe/index.mjs +3 -3
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-pragmas.d.ts +23 -0
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +1 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
- package/dist/builtins/sqlite-storage/wal-checkpoint-policy.d.ts +115 -0
- package/dist/builtins/sqlite-storage/wal-checkpoint-worker.d.ts +1 -0
- package/dist/builtins/sqlite-storage/wal-checkpointer.d.ts +70 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/dist/builtins/system-config/system-config.addon.js +1 -1
- package/dist/builtins/system-config/system-config.addon.mjs +1 -1
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{custom-action-registry-CsONUlhC.mjs → custom-action-registry-B6gOtUWA.mjs} +1 -1
- package/dist/{custom-action-registry-BDwM5qAK.js → custom-action-registry-DKWhaWL1.js} +1 -1
- package/dist/{dist-BOlMCOeT.js → dist-B17W9ngu.js} +2 -2
- package/dist/{dist-DigmGsQS.mjs → dist-Cyz5_i7z.mjs} +2 -2
- package/dist/index.d.ts +6 -1
- package/dist/index.js +31 -36
- package/dist/index.mjs +23 -38
- package/dist/kernel/heap-watch.d.ts +24 -1
- package/dist/kernel/moleculer/mesh-queue-report.d.ts +51 -0
- package/dist/kernel/outbound-queue-watch.d.ts +94 -0
- package/dist/kernel/socket-plane-report.d.ts +75 -4
- package/dist/kernel/transport/cap-routing-hints.d.ts +21 -0
- package/dist/kernel/transport/child-cap-protocol.d.ts +28 -2
- package/dist/kernel/transport/frame-codec.d.ts +49 -0
- package/dist/kernel/transport/local-child-client.d.ts +7 -0
- package/dist/kernel/transport/local-child-registry.d.ts +36 -1
- package/dist/kernel/transport/local-transport.d.ts +45 -2
- package/dist/kernel/transport/socket-channel.d.ts +19 -1
- package/dist/{manifest-system-deps-D--wyMD9.mjs → manifest-system-deps-C7dihwWT.mjs} +1210 -682
- package/dist/{manifest-system-deps-Bo92lg5u.js → manifest-system-deps-g_nK0xsF.js} +1252 -664
- package/dist/process/proc-stat.d.ts +75 -0
- package/dist/process/resource-monitor.d.ts +9 -1
- package/dist/{resource-monitor-CdnzxBLP.js → resource-monitor-LVE1BoLs.js} +42 -23
- package/dist/{resource-monitor-BWmQ5i-o.mjs → resource-monitor-Vp0bPV3U.mjs} +42 -22
- package/dist/{retired-settings-keys-vK_U-CG2.mjs → retired-settings-keys-BCYUrdsA.mjs} +1 -1
- package/dist/{retired-settings-keys-xEAlYnv7.js → retired-settings-keys-CjvB7Etx.js} +1 -1
- package/dist/wal-checkpoint-policy-CAcg63o-.mjs +92 -0
- package/dist/wal-checkpoint-policy-CCJZngds.js +127 -0
- package/dist/wal-checkpoint-worker.js +138 -0
- package/dist/wal-checkpoint-worker.mjs +137 -0
- package/package.json +1 -1
- package/dist/{event-loop-stall-monitor-DM9OAzy8.js → event-loop-stall-monitor-CAsHdMwP.js} +1 -1
- package/dist/{event-loop-stall-monitor-B3CFd9tM.mjs → event-loop-stall-monitor-GPrVvx14.mjs} +1 -1
- package/dist/{tls-DOTmtLCW.mjs → tls-2xbgg78V.mjs} +2 -2
- package/dist/{tls-BxQlomxd.js → tls-BFs4PzoW.js} +2 -2
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { a as isWorkerStop, o as parseWalIndexHeader, r as decideCheckpoint } from "./wal-checkpoint-policy-CAcg63o-.mjs";
|
|
2
|
+
import { closeSync, openSync, readSync } from "node:fs";
|
|
3
|
+
import Database from "better-sqlite3";
|
|
4
|
+
import { parentPort, workerData } from "node:worker_threads";
|
|
5
|
+
//#region src/builtins/sqlite-storage/wal-checkpoint-worker.ts
|
|
6
|
+
/**
|
|
7
|
+
* The checkpoint worker — a thread of `hub/sqlite-settings` whose only job is
|
|
8
|
+
* `PRAGMA wal_checkpoint(PASSIVE)` over its own connection.
|
|
9
|
+
*
|
|
10
|
+
* Why it exists, the measurement, and the rule it follows are in
|
|
11
|
+
* `wal-checkpoint-policy.ts`. What this file adds is the mechanics:
|
|
12
|
+
*
|
|
13
|
+
* - Its OWN connection to the same file. A checkpoint's fsyncs happen on the
|
|
14
|
+
* thread that issues the pragma; issuing it here is what takes them off the
|
|
15
|
+
* settings thread. The connection is sized to do nothing but checkpoint —
|
|
16
|
+
* a 2 MiB page cache and no mmap — so it is not a second copy of the
|
|
17
|
+
* engine's working set.
|
|
18
|
+
* - PASSIVE, never FULL/RESTART/TRUNCATE. PASSIVE takes no writer lock and
|
|
19
|
+
* waits for nobody: it copies what it can and returns. The settings thread's
|
|
20
|
+
* writers and readers are never blocked by this thread. (The idle-gated
|
|
21
|
+
* TRUNCATE in `wal-maintenance.ts` is a different job — reclaiming a
|
|
22
|
+
* sidecar that outgrew its limit — and stays where it is.)
|
|
23
|
+
* - The wal-index header is read as bytes (`-shm`, 100 bytes, no lock) so the
|
|
24
|
+
* poll costs nothing; when it cannot be read the policy falls back to a
|
|
25
|
+
* fixed interval, so nothing here can turn "unreadable" into "nothing to do".
|
|
26
|
+
* - Every checkpoint is reported to the parent with its numbers. The parent
|
|
27
|
+
* decides what is worth a line.
|
|
28
|
+
*
|
|
29
|
+
* A worker entry is a separate bundle (`dist/wal-checkpoint-worker.js`, wired
|
|
30
|
+
* in `vite.config.ts` next to `addon-runner`). It imports nothing from the
|
|
31
|
+
* kernel: it must load in a bare thread with `better-sqlite3` and the policy
|
|
32
|
+
* module, nothing else.
|
|
33
|
+
*/
|
|
34
|
+
function isCheckpointRow(value) {
|
|
35
|
+
if (typeof value !== "object" || value === null) return false;
|
|
36
|
+
if (!("busy" in value) || !("log" in value) || !("checkpointed" in value)) return false;
|
|
37
|
+
return typeof value.busy === "number" && typeof value.log === "number" && typeof value.checkpointed === "number";
|
|
38
|
+
}
|
|
39
|
+
function readCheckpointRow(value) {
|
|
40
|
+
if (isCheckpointRow(value)) return value;
|
|
41
|
+
if (Array.isArray(value)) {
|
|
42
|
+
const [first] = value;
|
|
43
|
+
if (isCheckpointRow(first)) return first;
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
function isWorkerData(value) {
|
|
48
|
+
if (typeof value !== "object" || value === null) return false;
|
|
49
|
+
if (!("dbPath" in value) || !("pollMs" in value)) return false;
|
|
50
|
+
return typeof value.dbPath === "string" && typeof value.pollMs === "number";
|
|
51
|
+
}
|
|
52
|
+
/** The two wal-index counters, or nulls when the sidecar cannot be read. */
|
|
53
|
+
function readWalIndex(shmPath) {
|
|
54
|
+
let fd = null;
|
|
55
|
+
try {
|
|
56
|
+
fd = openSync(shmPath, "r");
|
|
57
|
+
const buffer = Buffer.alloc(100);
|
|
58
|
+
if (readSync(fd, buffer, 0, 100, 0) < 100) return {
|
|
59
|
+
mxFrame: null,
|
|
60
|
+
nBackfill: null
|
|
61
|
+
};
|
|
62
|
+
return parseWalIndexHeader(buffer) ?? {
|
|
63
|
+
mxFrame: null,
|
|
64
|
+
nBackfill: null
|
|
65
|
+
};
|
|
66
|
+
} catch {
|
|
67
|
+
return {
|
|
68
|
+
mxFrame: null,
|
|
69
|
+
nBackfill: null
|
|
70
|
+
};
|
|
71
|
+
} finally {
|
|
72
|
+
if (fd !== null) closeSync(fd);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function post(message) {
|
|
76
|
+
parentPort?.postMessage(message);
|
|
77
|
+
}
|
|
78
|
+
function run() {
|
|
79
|
+
const port = parentPort;
|
|
80
|
+
if (port === null) throw new Error("wal-checkpoint-worker: no parent port");
|
|
81
|
+
if (!isWorkerData(workerData)) throw new Error("wal-checkpoint-worker: bad workerData");
|
|
82
|
+
const { dbPath, pollMs } = workerData;
|
|
83
|
+
const shmPath = `${dbPath}-shm`;
|
|
84
|
+
const db = new Database(dbPath);
|
|
85
|
+
db.pragma("cache_size = -2048");
|
|
86
|
+
db.pragma("mmap_size = 0");
|
|
87
|
+
let lastRunAt = Date.now();
|
|
88
|
+
let timer = null;
|
|
89
|
+
let stopping = false;
|
|
90
|
+
const tick = () => {
|
|
91
|
+
if (stopping) return;
|
|
92
|
+
const decision = decideCheckpoint({
|
|
93
|
+
...readWalIndex(shmPath),
|
|
94
|
+
sinceLastRunMs: Date.now() - lastRunAt
|
|
95
|
+
});
|
|
96
|
+
if (decision.run) {
|
|
97
|
+
const startedAt = Date.now();
|
|
98
|
+
let raw;
|
|
99
|
+
try {
|
|
100
|
+
raw = db.pragma("wal_checkpoint(PASSIVE)");
|
|
101
|
+
} catch (err) {
|
|
102
|
+
post({
|
|
103
|
+
kind: "failed",
|
|
104
|
+
error: err instanceof Error ? err.message : String(err)
|
|
105
|
+
});
|
|
106
|
+
raw = null;
|
|
107
|
+
}
|
|
108
|
+
lastRunAt = Date.now();
|
|
109
|
+
const row = readCheckpointRow(raw);
|
|
110
|
+
if (row !== null) post({
|
|
111
|
+
kind: "checkpointed",
|
|
112
|
+
reason: decision.reason,
|
|
113
|
+
pendingFrames: decision.pendingFrames,
|
|
114
|
+
walFrames: row.log,
|
|
115
|
+
checkpointedFrames: row.checkpointed,
|
|
116
|
+
busy: row.busy !== 0,
|
|
117
|
+
ms: lastRunAt - startedAt
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
timer = setTimeout(tick, pollMs);
|
|
121
|
+
};
|
|
122
|
+
port.on("message", (message) => {
|
|
123
|
+
if (!isWorkerStop(message)) return;
|
|
124
|
+
stopping = true;
|
|
125
|
+
if (timer !== null) clearTimeout(timer);
|
|
126
|
+
try {
|
|
127
|
+
db.close();
|
|
128
|
+
} finally {
|
|
129
|
+
port.close();
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
post({ kind: "ready" });
|
|
133
|
+
timer = setTimeout(tick, pollMs);
|
|
134
|
+
}
|
|
135
|
+
run();
|
|
136
|
+
//#endregion
|
|
137
|
+
export {};
|
package/package.json
CHANGED
|
@@ -2,9 +2,9 @@ const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
|
2
2
|
let node_crypto = require("node:crypto");
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_chunk.__toESM(node_path);
|
|
5
|
-
let node_util = require("node:util");
|
|
6
5
|
let node_fs = require("node:fs");
|
|
7
6
|
node_fs = require_chunk.__toESM(node_fs);
|
|
7
|
+
let node_util = require("node:util");
|
|
8
8
|
let node_http = require("node:http");
|
|
9
9
|
let node_zlib = require("node:zlib");
|
|
10
10
|
let node_perf_hooks = require("node:perf_hooks");
|
package/dist/{event-loop-stall-monitor-B3CFd9tM.mjs → event-loop-stall-monitor-GPrVvx14.mjs}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import * as path$1 from "node:path";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { promisify } from "node:util";
|
|
5
4
|
import * as fs from "node:fs";
|
|
6
5
|
import { createReadStream, promises } from "node:fs";
|
|
6
|
+
import { promisify } from "node:util";
|
|
7
7
|
import { createServer } from "node:http";
|
|
8
8
|
import { brotliCompress, constants as constants$1, gzip } from "node:zlib";
|
|
9
9
|
import { PerformanceObserver } from "node:perf_hooks";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { X509Certificate, createPrivateKey, randomBytes } from "node:crypto";
|
|
2
2
|
import { chmod, copyFile, mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import { execFile } from "node:child_process";
|
|
5
|
-
import { promisify } from "node:util";
|
|
6
4
|
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { execFile } from "node:child_process";
|
|
7
6
|
import * as os from "node:os";
|
|
8
7
|
import { tmpdir } from "node:os";
|
|
8
|
+
import { promisify } from "node:util";
|
|
9
9
|
import { createServer } from "node:http";
|
|
10
10
|
import { isIP } from "node:net";
|
|
11
11
|
//#region src/http/lan-http-bind.ts
|
|
@@ -2,11 +2,11 @@ const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
|
2
2
|
let node_crypto = require("node:crypto");
|
|
3
3
|
let node_fs_promises = require("node:fs/promises");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
|
-
let node_child_process = require("node:child_process");
|
|
6
|
-
let node_util = require("node:util");
|
|
7
5
|
let node_fs = require("node:fs");
|
|
6
|
+
let node_child_process = require("node:child_process");
|
|
8
7
|
let node_os = require("node:os");
|
|
9
8
|
node_os = require_chunk.__toESM(node_os);
|
|
9
|
+
let node_util = require("node:util");
|
|
10
10
|
let node_http = require("node:http");
|
|
11
11
|
let node_net = require("node:net");
|
|
12
12
|
//#region src/http/lan-http-bind.ts
|