@camstack/system 1.2.458 → 1.2.460

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.
Files changed (109) hide show
  1. package/dist/addon-runner.js +26 -11
  2. package/dist/addon-runner.mjs +26 -11
  3. package/dist/addon-utils.mjs +1 -1
  4. package/dist/{agent-https-DOELEug8.js → agent-https-Dnr_nIVx.js} +3 -723
  5. package/dist/{agent-https-CQA3W-3e.mjs → agent-https-Iw3RSQup.mjs} +4 -616
  6. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  7. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
  8. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  9. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +5 -5
  10. package/dist/builtins/alerts/alerts.addon.js +5 -7
  11. package/dist/builtins/alerts/alerts.addon.mjs +5 -7
  12. package/dist/builtins/alerts/record-kinds.d.ts +1 -1
  13. package/dist/builtins/autotrack/index.js +1 -1
  14. package/dist/builtins/autotrack/index.mjs +1 -1
  15. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +242 -4
  16. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +243 -5
  17. package/dist/builtins/calendars/calendars.addon.js +2 -10
  18. package/dist/builtins/calendars/calendars.addon.mjs +2 -3
  19. package/dist/builtins/calendars/record-kinds.d.ts +1 -1
  20. package/dist/builtins/camera-grid/index.js +1 -1
  21. package/dist/builtins/camera-grid/index.mjs +1 -1
  22. package/dist/builtins/composer/composer.addon.js +2 -2
  23. package/dist/builtins/composer/composer.addon.mjs +2 -2
  24. package/dist/builtins/console-logging/index.js +1 -1
  25. package/dist/builtins/console-logging/index.mjs +1 -1
  26. package/dist/builtins/core-blocks/core-blocks.addon.js +4 -6
  27. package/dist/builtins/core-blocks/core-blocks.addon.mjs +4 -6
  28. package/dist/builtins/device-history/device-history.addon.js +1 -1
  29. package/dist/builtins/device-history/device-history.addon.mjs +1 -1
  30. package/dist/builtins/device-manager/device-manager.addon.js +2 -4
  31. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -4
  32. package/dist/builtins/hub-forwarder/index.js +1 -1
  33. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  34. package/dist/builtins/keychain/index.js +41 -43
  35. package/dist/builtins/keychain/index.mjs +41 -43
  36. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  37. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  38. package/dist/builtins/local-auth/local-auth.addon.js +24 -40
  39. package/dist/builtins/local-auth/local-auth.addon.mjs +27 -43
  40. package/dist/builtins/local-network/local-network.addon.js +2 -2
  41. package/dist/builtins/local-network/local-network.addon.mjs +2 -2
  42. package/dist/builtins/loki-logging/index.js +1 -1
  43. package/dist/builtins/loki-logging/index.mjs +1 -1
  44. package/dist/builtins/native-metrics/native-metrics.addon.js +39 -4
  45. package/dist/builtins/native-metrics/native-metrics.addon.mjs +48 -13
  46. package/dist/builtins/native-metrics/node-metrics-history-recorder.d.ts +16 -2
  47. package/dist/builtins/platform-probe/coral-accelerators.d.ts +10 -1
  48. package/dist/builtins/platform-probe/index.js +7 -4
  49. package/dist/builtins/platform-probe/index.mjs +13 -10
  50. package/dist/builtins/platform-probe/platform-scorer.d.ts +4 -1
  51. package/dist/builtins/record-entries/index.js +1 -1
  52. package/dist/builtins/record-entries/index.mjs +1 -1
  53. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  54. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  55. package/dist/builtins/snapshot/index.js +1 -1
  56. package/dist/builtins/snapshot/index.mjs +1 -1
  57. package/dist/builtins/sqlite-storage/file-host-protocol.d.ts +0 -15
  58. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  59. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
  60. package/dist/builtins/sqlite-storage/index.js +1 -1
  61. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  62. package/dist/builtins/sqlite-storage/owned-sqlite-file.d.ts +0 -44
  63. package/dist/builtins/sqlite-storage/records/records-catalog.d.ts +0 -2
  64. package/dist/builtins/sqlite-storage/records/records-engine-types.d.ts +0 -21
  65. package/dist/builtins/sqlite-storage/records/records-engine.d.ts +3 -20
  66. package/dist/builtins/sqlite-storage/records/records-plan.d.ts +9 -4
  67. package/dist/builtins/sqlite-storage/records/records-provider.d.ts +4 -18
  68. package/dist/builtins/sqlite-storage/records/records-sql.d.ts +1 -1
  69. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +0 -17
  70. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +21 -196
  71. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +21 -196
  72. package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +6 -14
  73. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +2 -2
  74. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +7 -9
  75. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +7 -9
  76. package/dist/builtins/system-config/system-config.addon.js +667 -40
  77. package/dist/builtins/system-config/system-config.addon.mjs +737 -127
  78. package/dist/builtins/winston-logging/index.js +1 -1
  79. package/dist/builtins/winston-logging/index.mjs +1 -1
  80. package/dist/{composition-sources-BVguN7VV.mjs → composition-sources-DNRZWR1j.mjs} +1 -1
  81. package/dist/{composition-sources-DURQNDJ4.js → composition-sources-b0e_2I-D.js} +1 -1
  82. package/dist/{constants-Njka8Cv6.js → constants-6OeJiZgi.js} +1 -1
  83. package/dist/{constants-FGjnsE2x.mjs → constants-BnkOdj9Q.mjs} +1 -1
  84. package/dist/{coral-accelerators-DcnZvctM.mjs → coral-accelerators-Qhn5TOYZ.mjs} +18 -15
  85. package/dist/{coral-accelerators-Bi_c3Rft.js → coral-accelerators-oUXmmbc2.js} +13 -10
  86. package/dist/{custom-action-registry-stpC3Zy-.mjs → custom-action-registry-DStvrQKI.mjs} +37 -37
  87. package/dist/{device-ca-lEaAQ9Xi.mjs → device-ca-Bnkw8GyU.mjs} +1 -1
  88. package/dist/{device-ca-BrVK_5s3.js → device-ca-CPTDs--d.js} +1 -1
  89. package/dist/{dist-BZQjLPiz.js → dist-Bn-RNanh.js} +29 -130
  90. package/dist/{dist-B_GRPhnY.mjs → dist-Wy8cTxg6.mjs} +30 -113
  91. package/dist/file-host-worker.js +1 -1
  92. package/dist/file-host-worker.mjs +1 -1
  93. package/dist/{hub-mdns-ciao-Bg2HfTwP.mjs → hub-mdns-ciao-CJu0nhla.mjs} +2 -2
  94. package/dist/{hub-mdns-ciao-nce3TXs_.js → hub-mdns-ciao-CTBTlia4.js} +2 -2
  95. package/dist/index.d.ts +1 -0
  96. package/dist/index.js +56 -31
  97. package/dist/index.mjs +257 -233
  98. package/dist/kernel/deps/addon-deps-manager.d.ts +9 -0
  99. package/dist/{restore-archive-C7kLDI_0.mjs → restore-archive-CM23Pq9B.mjs} +177 -424
  100. package/dist/{restore-archive-FyfZ8YMC.js → restore-archive-DM1OBYq4.js} +89 -342
  101. package/dist/{wal-maintenance-Duejh7Lx.mjs → wal-maintenance-Bj_MmDkr.mjs} +0 -0
  102. package/dist/{wal-maintenance-DfSIOj24.js → wal-maintenance-CaJjuLHq.js} +0 -0
  103. package/package.json +1 -1
  104. package/dist/builtins/records/legacy-table-row-count.d.ts +0 -5
  105. package/dist/builtins/records/phase6-declare-gate.d.ts +0 -28
  106. package/dist/builtins/sqlite-storage/records/count-settings-array-legacy.d.ts +0 -5
  107. package/dist/builtins/sqlite-storage/records/count-settings-brokers-legacy.d.ts +0 -6
  108. package/dist/phase6-declare-gate-Dag1_WR2.js +0 -98
  109. package/dist/phase6-declare-gate-Lb-mrVvz.mjs +0 -93
@@ -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-BZQjLPiz.js");
6
+ const require_dist = require("../../dist-Bn-RNanh.js");
7
7
  const require_log_read_filter = require("../../log-read-filter-Bi066jwU.js");
8
8
  let zod = require("zod");
9
9
  //#region src/builtins/loki-logging/loki-payload.ts
@@ -1,4 +1,4 @@
1
- import { ni as BaseAddon, zn as logDestinationCapability } from "../../dist-B_GRPhnY.mjs";
1
+ import { ni as BaseAddon, zn as logDestinationCapability } from "../../dist-Wy8cTxg6.mjs";
2
2
  import { n as compileLogFilter, o as lineMatches } from "../../log-read-filter-D7Ev3zm-.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/builtins/loki-logging/loki-payload.ts
@@ -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-BZQjLPiz.js");
6
+ const require_dist = require("../../dist-Bn-RNanh.js");
7
7
  let node_fs_promises = require("node:fs/promises");
8
8
  let node_util = require("node:util");
9
9
  let node_os = require("node:os");
@@ -1063,6 +1063,36 @@ var NODE_GPU_TEMPERATURE_KEY = keyOf("node-gpu-temperature");
1063
1063
  var NODE_CONTAINER_CURRENT_KEY = keyOf("container-current-mib");
1064
1064
  keyOf("process-cpu-percent");
1065
1065
  keyOf("process-rss-mib");
1066
+ /**
1067
+ * The per-runner series are downsampled to device-history's point cadence:
1068
+ * one point per series per this many ms, sustained. Process snapshots arrive
1069
+ * at the load-series cadence (5–60 s, `load-series-config.ts`), and at 5 s
1070
+ * writing each one has every other batch refused whole for `rate`.
1071
+ *
1072
+ * These two numbers MIRROR `RECORD_MIN_INTERVAL_MS` / `RECORD_RATE_SLACK_MS`
1073
+ * of the ingest door (`device-history/ingest/producer-ingest.ts`) — a builtin
1074
+ * does not import another — and `node-metrics-history-cadence.spec.ts` pins
1075
+ * them equal, so the door moving fails a spec instead of a day of history.
1076
+ */
1077
+ var RUNNER_SAMPLE_MIN_INTERVAL_MS = 1e4;
1078
+ var RUNNER_SAMPLE_RATE_SLACK_MS = 1e3;
1079
+ /** True when the door would take a point at `ts` after `slot`. */
1080
+ function sampleIsDue(slot, ts) {
1081
+ if (slot === void 0 || ts < slot.lastTs) return true;
1082
+ return ts >= slot.nextDue - RUNNER_SAMPLE_RATE_SLACK_MS;
1083
+ }
1084
+ /** The slot after a batch at `ts` was accepted — the door's own grid rule. */
1085
+ function nextSampleSlot(slot, ts) {
1086
+ if (slot === void 0) return {
1087
+ lastTs: ts,
1088
+ nextDue: ts + RUNNER_SAMPLE_MIN_INTERVAL_MS
1089
+ };
1090
+ if (ts < slot.lastTs) return slot;
1091
+ return {
1092
+ lastTs: ts,
1093
+ nextDue: Math.max(slot.nextDue, ts) + RUNNER_SAMPLE_MIN_INTERVAL_MS
1094
+ };
1095
+ }
1066
1096
  var DECLARATIONS = [
1067
1097
  {
1068
1098
  name: "runner-cpu-main-percent",
@@ -1153,6 +1183,8 @@ var NodeMetricsHistoryRecorder = class {
1153
1183
  deps;
1154
1184
  declared = false;
1155
1185
  lastTotalsAt = /* @__PURE__ */ new Map();
1186
+ /** Per node: the door's slot for the per-runner batch (see {@link sampleIsDue}). */
1187
+ sampleSlots = /* @__PURE__ */ new Map();
1156
1188
  /** A not-ready skip was logged and device-history has not been ready since. */
1157
1189
  waitLogged = false;
1158
1190
  constructor(deps) {
@@ -1172,6 +1204,7 @@ var NodeMetricsHistoryRecorder = class {
1172
1204
  }
1173
1205
  /** One process snapshot: per-runner sums plus the container's memory. */
1174
1206
  async recordSample(nodeId, atMs, processes, containerMemory) {
1207
+ if (!sampleIsDue(this.sampleSlots.get(nodeId), atMs)) return;
1175
1208
  const subject = {
1176
1209
  kind: "node",
1177
1210
  nodeId
@@ -1215,7 +1248,7 @@ var NodeMetricsHistoryRecorder = class {
1215
1248
  points.push(point(RUNNER_PROCESSES_KEY, scope, t.count));
1216
1249
  }
1217
1250
  if (containerMemory !== null) points.push(point(NODE_CONTAINER_CURRENT_KEY, "", Math.round(containerMemory.currentBytes / MIB)));
1218
- await this.write(nodeId, atMs, points);
1251
+ if (await this.write(nodeId, atMs, points) > 0) this.sampleSlots.set(nodeId, nextSampleSlot(this.sampleSlots.get(nodeId), atMs));
1219
1252
  }
1220
1253
  /** One resources snapshot: the node's totals, at most every {@link NODE_TOTALS_MIN_INTERVAL_MS}. */
1221
1254
  async recordTotals(nodeId, atMs, snapshot) {
@@ -1245,8 +1278,8 @@ var NodeMetricsHistoryRecorder = class {
1245
1278
  await this.write(nodeId, atMs, points);
1246
1279
  }
1247
1280
  async write(nodeId, atMs, points) {
1248
- if (points.length === 0) return;
1249
- if (!await this.ensureDeclared()) return;
1281
+ if (points.length === 0) return 0;
1282
+ if (!await this.ensureDeclared()) return 0;
1250
1283
  try {
1251
1284
  const result = await this.deps.deviceHistory.record({ points });
1252
1285
  if (result.refused.length > 0) {
@@ -1257,12 +1290,14 @@ var NodeMetricsHistoryRecorder = class {
1257
1290
  refused: refusalCounts(result)
1258
1291
  } });
1259
1292
  }
1293
+ return result.accepted;
1260
1294
  } catch (err) {
1261
1295
  this.deps.logger.warn("node metrics history sample not stored", { meta: {
1262
1296
  nodeId,
1263
1297
  atMs,
1264
1298
  error: err instanceof Error ? err.message : String(err)
1265
1299
  } });
1300
+ return 0;
1266
1301
  }
1267
1302
  }
1268
1303
  async readContainerPoints(nodeId, sinceMs, maxPoints) {
@@ -1,9 +1,9 @@
1
- import { Gn as metricsProviderCapability, Hi as createEvent, Oa as EventCategory, _t as UNATTRIBUTED_BUCKET_KEY, gn as foldSnapshotByFunction, lr as resolveBucketMs, ni as BaseAddon, or as reducePoints, rt as ROOT_BUCKET_KEY, ti as errMsg } from "../../dist-B_GRPhnY.mjs";
1
+ import { Gn as metricsProviderCapability, Hi as createEvent, Ta as EventCategory, _t as UNATTRIBUTED_BUCKET_KEY, gn as foldSnapshotByFunction, lr as resolveBucketMs, ni as BaseAddon, or as reducePoints, rt as ROOT_BUCKET_KEY, ti as errMsg } from "../../dist-Wy8cTxg6.mjs";
2
2
  import { access, readFile, readdir } from "node:fs/promises";
3
3
  import { promisify } from "node:util";
4
4
  import * as os$1 from "node:os";
5
5
  import { platform } from "node:os";
6
- import * as fs from "node:fs";
6
+ import * as fs$1 from "node:fs";
7
7
  import { constants, readFileSync } from "node:fs";
8
8
  import { execFile, execFileSync } from "node:child_process";
9
9
  //#region src/builtins/native-metrics/cgroup-memory.ts
@@ -1058,6 +1058,36 @@ var NODE_GPU_TEMPERATURE_KEY = keyOf("node-gpu-temperature");
1058
1058
  var NODE_CONTAINER_CURRENT_KEY = keyOf("container-current-mib");
1059
1059
  keyOf("process-cpu-percent");
1060
1060
  keyOf("process-rss-mib");
1061
+ /**
1062
+ * The per-runner series are downsampled to device-history's point cadence:
1063
+ * one point per series per this many ms, sustained. Process snapshots arrive
1064
+ * at the load-series cadence (5–60 s, `load-series-config.ts`), and at 5 s
1065
+ * writing each one has every other batch refused whole for `rate`.
1066
+ *
1067
+ * These two numbers MIRROR `RECORD_MIN_INTERVAL_MS` / `RECORD_RATE_SLACK_MS`
1068
+ * of the ingest door (`device-history/ingest/producer-ingest.ts`) — a builtin
1069
+ * does not import another — and `node-metrics-history-cadence.spec.ts` pins
1070
+ * them equal, so the door moving fails a spec instead of a day of history.
1071
+ */
1072
+ var RUNNER_SAMPLE_MIN_INTERVAL_MS = 1e4;
1073
+ var RUNNER_SAMPLE_RATE_SLACK_MS = 1e3;
1074
+ /** True when the door would take a point at `ts` after `slot`. */
1075
+ function sampleIsDue(slot, ts) {
1076
+ if (slot === void 0 || ts < slot.lastTs) return true;
1077
+ return ts >= slot.nextDue - RUNNER_SAMPLE_RATE_SLACK_MS;
1078
+ }
1079
+ /** The slot after a batch at `ts` was accepted — the door's own grid rule. */
1080
+ function nextSampleSlot(slot, ts) {
1081
+ if (slot === void 0) return {
1082
+ lastTs: ts,
1083
+ nextDue: ts + RUNNER_SAMPLE_MIN_INTERVAL_MS
1084
+ };
1085
+ if (ts < slot.lastTs) return slot;
1086
+ return {
1087
+ lastTs: ts,
1088
+ nextDue: Math.max(slot.nextDue, ts) + RUNNER_SAMPLE_MIN_INTERVAL_MS
1089
+ };
1090
+ }
1061
1091
  var DECLARATIONS = [
1062
1092
  {
1063
1093
  name: "runner-cpu-main-percent",
@@ -1148,6 +1178,8 @@ var NodeMetricsHistoryRecorder = class {
1148
1178
  deps;
1149
1179
  declared = false;
1150
1180
  lastTotalsAt = /* @__PURE__ */ new Map();
1181
+ /** Per node: the door's slot for the per-runner batch (see {@link sampleIsDue}). */
1182
+ sampleSlots = /* @__PURE__ */ new Map();
1151
1183
  /** A not-ready skip was logged and device-history has not been ready since. */
1152
1184
  waitLogged = false;
1153
1185
  constructor(deps) {
@@ -1167,6 +1199,7 @@ var NodeMetricsHistoryRecorder = class {
1167
1199
  }
1168
1200
  /** One process snapshot: per-runner sums plus the container's memory. */
1169
1201
  async recordSample(nodeId, atMs, processes, containerMemory) {
1202
+ if (!sampleIsDue(this.sampleSlots.get(nodeId), atMs)) return;
1170
1203
  const subject = {
1171
1204
  kind: "node",
1172
1205
  nodeId
@@ -1210,7 +1243,7 @@ var NodeMetricsHistoryRecorder = class {
1210
1243
  points.push(point(RUNNER_PROCESSES_KEY, scope, t.count));
1211
1244
  }
1212
1245
  if (containerMemory !== null) points.push(point(NODE_CONTAINER_CURRENT_KEY, "", Math.round(containerMemory.currentBytes / MIB)));
1213
- await this.write(nodeId, atMs, points);
1246
+ if (await this.write(nodeId, atMs, points) > 0) this.sampleSlots.set(nodeId, nextSampleSlot(this.sampleSlots.get(nodeId), atMs));
1214
1247
  }
1215
1248
  /** One resources snapshot: the node's totals, at most every {@link NODE_TOTALS_MIN_INTERVAL_MS}. */
1216
1249
  async recordTotals(nodeId, atMs, snapshot) {
@@ -1240,8 +1273,8 @@ var NodeMetricsHistoryRecorder = class {
1240
1273
  await this.write(nodeId, atMs, points);
1241
1274
  }
1242
1275
  async write(nodeId, atMs, points) {
1243
- if (points.length === 0) return;
1244
- if (!await this.ensureDeclared()) return;
1276
+ if (points.length === 0) return 0;
1277
+ if (!await this.ensureDeclared()) return 0;
1245
1278
  try {
1246
1279
  const result = await this.deps.deviceHistory.record({ points });
1247
1280
  if (result.refused.length > 0) {
@@ -1252,12 +1285,14 @@ var NodeMetricsHistoryRecorder = class {
1252
1285
  refused: refusalCounts(result)
1253
1286
  } });
1254
1287
  }
1288
+ return result.accepted;
1255
1289
  } catch (err) {
1256
1290
  this.deps.logger.warn("node metrics history sample not stored", { meta: {
1257
1291
  nodeId,
1258
1292
  atMs,
1259
1293
  error: err instanceof Error ? err.message : String(err)
1260
1294
  } });
1295
+ return 0;
1261
1296
  }
1262
1297
  }
1263
1298
  async readContainerPoints(nodeId, sinceMs, maxPoints) {
@@ -1607,7 +1642,7 @@ var NativeMetricsProvider = class {
1607
1642
  let swapUsedBytes = 0;
1608
1643
  let swapTotalBytes = 0;
1609
1644
  if (IS_LINUX) try {
1610
- const meminfo = fs.readFileSync("/proc/meminfo", "utf-8");
1645
+ const meminfo = fs$1.readFileSync("/proc/meminfo", "utf-8");
1611
1646
  const swapTotal = parseInt(meminfo.match(/SwapTotal:\s+(\d+)/)?.[1] ?? "0", 10) * 1024;
1612
1647
  const swapFree = parseInt(meminfo.match(/SwapFree:\s+(\d+)/)?.[1] ?? "0", 10) * 1024;
1613
1648
  swapTotalBytes = swapTotal;
@@ -1685,7 +1720,7 @@ function sampleMacMemory(provider) {
1685
1720
  }
1686
1721
  function getDiskSpaceInternal(dirPath) {
1687
1722
  return new Promise((resolve, reject) => {
1688
- fs.statfs(dirPath, (err, stats) => {
1723
+ fs$1.statfs(dirPath, (err, stats) => {
1689
1724
  if (err) return reject(err);
1690
1725
  const totalBytes = stats.blocks * stats.bsize;
1691
1726
  const availableBytes = stats.bavail * stats.bsize;
@@ -1703,7 +1738,7 @@ function getDiskSpaceInternal(dirPath) {
1703
1738
  async function takeDiskIoSnapshot() {
1704
1739
  const now = Date.now();
1705
1740
  if (IS_LINUX) try {
1706
- const data = fs.readFileSync("/proc/diskstats", "utf-8");
1741
+ const data = fs$1.readFileSync("/proc/diskstats", "utf-8");
1707
1742
  let readOps = 0, readBytes = 0, writeOps = 0, writeBytes = 0;
1708
1743
  for (const line of data.split("\n")) {
1709
1744
  const parts = line.trim().split(/\s+/);
@@ -1734,7 +1769,7 @@ async function takeDiskIoSnapshot() {
1734
1769
  async function takeNetworkIoSnapshot() {
1735
1770
  const now = Date.now();
1736
1771
  if (IS_LINUX) try {
1737
- const data = fs.readFileSync("/proc/net/dev", "utf-8");
1772
+ const data = fs$1.readFileSync("/proc/net/dev", "utf-8");
1738
1773
  let rxBytes = 0, txBytes = 0, rxPackets = 0, txPackets = 0, rxErrors = 0, txErrors = 0;
1739
1774
  for (const line of data.split("\n")) {
1740
1775
  const match = line.match(/^\s*(\w+):\s+(.+)$/);
@@ -1795,7 +1830,7 @@ async function takeNetworkIoSnapshot() {
1795
1830
  }
1796
1831
  async function getCpuTemperatureInternal() {
1797
1832
  if (IS_LINUX) for (const p of ["/sys/class/thermal/thermal_zone0/temp", "/sys/class/hwmon/hwmon0/temp1_input"]) try {
1798
- const raw = fs.readFileSync(p, "utf-8").trim();
1833
+ const raw = fs$1.readFileSync(p, "utf-8").trim();
1799
1834
  const millideg = parseInt(raw, 10);
1800
1835
  if (!isNaN(millideg)) return Math.round(millideg / 100) / 10;
1801
1836
  } catch {
@@ -1846,10 +1881,10 @@ function getProcessResources() {
1846
1881
  let threadCount = 0;
1847
1882
  if (IS_LINUX) {
1848
1883
  try {
1849
- openFds = fs.readdirSync(`/proc/${process.pid}/fd`).length;
1884
+ openFds = fs$1.readdirSync(`/proc/${process.pid}/fd`).length;
1850
1885
  } catch {}
1851
1886
  try {
1852
- const match = fs.readFileSync(`/proc/${process.pid}/status`, "utf-8").match(/Threads:\s+(\d+)/);
1887
+ const match = fs$1.readFileSync(`/proc/${process.pid}/status`, "utf-8").match(/Threads:\s+(\d+)/);
1853
1888
  if (match) threadCount = parseInt(match[1], 10);
1854
1889
  } catch {}
1855
1890
  }
@@ -1864,7 +1899,7 @@ function getProcessResources() {
1864
1899
  function getPressure(resource) {
1865
1900
  if (!IS_LINUX) return null;
1866
1901
  try {
1867
- const data = fs.readFileSync(`/proc/pressure/${resource}`, "utf-8");
1902
+ const data = fs$1.readFileSync(`/proc/pressure/${resource}`, "utf-8");
1868
1903
  const parseLine = (prefix) => {
1869
1904
  const match = data.match(new RegExp(`${prefix} avg10=(\\d+\\.\\d+) avg60=(\\d+\\.\\d+) avg300=(\\d+\\.\\d+)`));
1870
1905
  if (!match) return null;
@@ -35,8 +35,7 @@ export declare const NODE_GPU_TEMPERATURE_KEY: MetricsKey<"node-gpu-temperature"
35
35
  export declare const NODE_CONTAINER_CURRENT_KEY: MetricsKey<"container-current-mib">;
36
36
  /**
37
37
  * The PID-scoped keys of the earlier build. NOT written any more; kept only so
38
- * the one-shot split-database migration (`scripts/ops/split-databases`) still
39
- * names what it once wrote.
38
+ * a spec can pin that nothing writes them again.
40
39
  */
41
40
  export declare const NODE_PROCESS_CPU_KEY: MetricsKey<"process-cpu-percent">;
42
41
  export declare const NODE_PROCESS_RSS_KEY: MetricsKey<"process-rss-mib">;
@@ -46,6 +45,19 @@ export declare const NODE_PROCESS_RSS_KEY: MetricsKey<"process-rss-mib">;
46
45
  * point closer than 10 s to the previous one of its series (`rate`).
47
46
  */
48
47
  export declare const NODE_TOTALS_MIN_INTERVAL_MS = 15e3;
48
+ /**
49
+ * The per-runner series are downsampled to device-history's point cadence:
50
+ * one point per series per this many ms, sustained. Process snapshots arrive
51
+ * at the load-series cadence (5–60 s, `load-series-config.ts`), and at 5 s
52
+ * writing each one has every other batch refused whole for `rate`.
53
+ *
54
+ * These two numbers MIRROR `RECORD_MIN_INTERVAL_MS` / `RECORD_RATE_SLACK_MS`
55
+ * of the ingest door (`device-history/ingest/producer-ingest.ts`) — a builtin
56
+ * does not import another — and `node-metrics-history-cadence.spec.ts` pins
57
+ * them equal, so the door moving fails a spec instead of a day of history.
58
+ */
59
+ export declare const RUNNER_SAMPLE_MIN_INTERVAL_MS = 1e4;
60
+ export declare const RUNNER_SAMPLE_RATE_SLACK_MS = 1e3;
49
61
  export interface NodeHistoryPoint {
50
62
  readonly key: string;
51
63
  readonly subject: {
@@ -108,6 +120,8 @@ export declare class NodeMetricsHistoryRecorder {
108
120
  private readonly deps;
109
121
  private declared;
110
122
  private readonly lastTotalsAt;
123
+ /** Per node: the door's slot for the per-runner batch (see {@link sampleIsDue}). */
124
+ private readonly sampleSlots;
111
125
  /** A not-ready skip was logged and device-history has not been ready since. */
112
126
  private waitLogged;
113
127
  constructor(deps: NodeMetricsHistoryRecorderDeps);
@@ -1,4 +1,5 @@
1
1
  import type { CoralInfo } from "@camstack/types";
2
+ import { type EdgetpuDelegateLookup } from "@camstack/types/node";
2
3
  /**
3
4
  * Filesystem seam for Coral Edge TPU detection (USB and PCIe/M.2) — mirrors
4
5
  * the `AcceleratorFs` pattern in `intel-accelerators.ts` so the classifier
@@ -21,6 +22,14 @@ export interface CoralFs {
21
22
  exists(path: string): boolean;
22
23
  }
23
24
  /**
25
+ * Where this node would find the libedgetpu delegate — the same lookup the
26
+ * Python pool runs (`edgetpu_device.edgetpu_library_path`): the
27
+ * `CAMSTACK_EDGETPU_LIB` override, the copy the deps downloader staged under
28
+ * `<CAMSTACK_DATA>/deps/edgetpu/lib/`, the hub's historical
29
+ * `/data/deps/edgetpu/lib/libedgetpu.so.1`.
30
+ */
31
+ export type EdgetpuDelegateHost = Omit<EdgetpuDelegateLookup, "exists">;
32
+ /**
24
33
  * Detect Coral Edge TPUs on USB and PCIe/M.2.
25
34
  *
26
35
  * - USB: every matching USB device counts (multiple Corals run concurrently).
@@ -34,6 +43,6 @@ export interface CoralFs {
34
43
  * Returns `null` only when no Coral was found at all; a present-but-unusable
35
44
  * Coral is reported with its typed reason, never as absent (D393/D315).
36
45
  */
37
- export declare function classifyCoralAccelerator(fsx: CoralFs): CoralInfo | null;
46
+ export declare function classifyCoralAccelerator(fsx: CoralFs, delegateHost?: EdgetpuDelegateHost): CoralInfo | null;
38
47
  /** The real filesystem view: `/sys` for enumeration, `/dev` for access. */
39
48
  export declare const nodeCoralFs: CoralFs;
@@ -3,8 +3,8 @@ 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-BZQjLPiz.js");
7
- const require_coral_accelerators = require("../../coral-accelerators-Bi_c3Rft.js");
6
+ const require_dist = require("../../dist-Bn-RNanh.js");
7
+ const require_coral_accelerators = require("../../coral-accelerators-oUXmmbc2.js");
8
8
  let node_util = require("node:util");
9
9
  let node_os = require("node:os");
10
10
  node_os = require_chunk.__toESM(node_os);
@@ -329,9 +329,12 @@ var PlatformScorer = class {
329
329
  * lookup (dev / agent environments where Python is on PATH).
330
330
  */
331
331
  embeddedPythonPath;
332
- constructor(logger = noopLogger, embeddedPythonPath = null) {
332
+ /** Where the Coral scan reads `/sys` and `/dev` (the host's, unless a spec fakes one). */
333
+ coralFs;
334
+ constructor(logger = noopLogger, embeddedPythonPath = null, coralFs = require_coral_accelerators.nodeCoralFs) {
333
335
  this.logger = logger;
334
336
  this.embeddedPythonPath = embeddedPythonPath;
337
+ this.coralFs = coralFs;
335
338
  }
336
339
  /**
337
340
  * Probe hardware + derive scores from pure rules and score all backend combos.
@@ -414,7 +417,7 @@ var PlatformScorer = class {
414
417
  } });
415
418
  let gpu = null;
416
419
  let npu = null;
417
- const coral = require_coral_accelerators.classifyCoralAccelerator(require_coral_accelerators.nodeCoralFs);
420
+ const coral = require_coral_accelerators.classifyCoralAccelerator(this.coralFs);
418
421
  if (coral) {
419
422
  if ((coral.units ?? []).length > 0) this.logger.info("Coral Edge TPU detected", { meta: { units: coral.units } });
420
423
  for (const unavailable of coral.unavailable ?? []) this.logger.warn("Coral Edge TPU present but unusable", { meta: {
@@ -1,9 +1,9 @@
1
1
  import { o as __toESM, r as __exportAll } from "../../chunk-CNf5ZN-e.mjs";
2
- import { Ji as emitReadiness, Oa as EventCategory, ni as BaseAddon, sn as enumerateInferenceDevices, ti as errMsg, tr as platformProbeCapability, yr as scoreRuntimes } from "../../dist-B_GRPhnY.mjs";
3
- import { n as nodeCoralFs, t as classifyCoralAccelerator } from "../../coral-accelerators-DcnZvctM.mjs";
2
+ import { Ta as EventCategory, ni as BaseAddon, qi as emitReadiness, sn as enumerateInferenceDevices, ti as errMsg, tr as platformProbeCapability, yr as scoreRuntimes } from "../../dist-Wy8cTxg6.mjs";
3
+ import { n as nodeCoralFs, t as classifyCoralAccelerator } from "../../coral-accelerators-Qhn5TOYZ.mjs";
4
4
  import { promisify } from "node:util";
5
5
  import * as os$1 from "node:os";
6
- import * as fs from "node:fs";
6
+ import * as fs$1 from "node:fs";
7
7
  import { execFile } from "node:child_process";
8
8
  //#region src/builtins/platform-probe/amd-npu.ts
9
9
  var amd_npu_exports = /* @__PURE__ */ __exportAll({
@@ -323,9 +323,12 @@ var PlatformScorer = class {
323
323
  * lookup (dev / agent environments where Python is on PATH).
324
324
  */
325
325
  embeddedPythonPath;
326
- constructor(logger = noopLogger, embeddedPythonPath = null) {
326
+ /** Where the Coral scan reads `/sys` and `/dev` (the host's, unless a spec fakes one). */
327
+ coralFs;
328
+ constructor(logger = noopLogger, embeddedPythonPath = null, coralFs = nodeCoralFs) {
327
329
  this.logger = logger;
328
330
  this.embeddedPythonPath = embeddedPythonPath;
331
+ this.coralFs = coralFs;
329
332
  }
330
333
  /**
331
334
  * Probe hardware + derive scores from pure rules and score all backend combos.
@@ -408,7 +411,7 @@ var PlatformScorer = class {
408
411
  } });
409
412
  let gpu = null;
410
413
  let npu = null;
411
- const coral = classifyCoralAccelerator(nodeCoralFs);
414
+ const coral = classifyCoralAccelerator(this.coralFs);
412
415
  if (coral) {
413
416
  if ((coral.units ?? []).length > 0) this.logger.info("Coral Edge TPU detected", { meta: { units: coral.units } });
414
417
  for (const unavailable of coral.unavailable ?? []) this.logger.warn("Coral Edge TPU present but unusable", { meta: {
@@ -445,14 +448,14 @@ var PlatformScorer = class {
445
448
  if (nvidia) gpu = nvidia;
446
449
  const listRenderNodes = () => {
447
450
  try {
448
- return fs.readdirSync("/dev/dri").filter((n) => n.startsWith("renderD")).map((n) => `/dev/dri/${n}`);
451
+ return fs$1.readdirSync("/dev/dri").filter((n) => n.startsWith("renderD")).map((n) => `/dev/dri/${n}`);
449
452
  } catch {
450
453
  return [];
451
454
  }
452
455
  };
453
456
  const readDrmAttr = (node, attr) => {
454
457
  try {
455
- return fs.readFileSync(`/sys/class/drm/${node.split("/").pop()}/device/${attr}`, "utf8");
458
+ return fs$1.readFileSync(`/sys/class/drm/${node.split("/").pop()}/device/${attr}`, "utf8");
456
459
  } catch {
457
460
  return "";
458
461
  }
@@ -478,12 +481,12 @@ var PlatformScorer = class {
478
481
  }
479
482
  const listDir = (p) => {
480
483
  try {
481
- return fs.readdirSync(p);
484
+ return fs$1.readdirSync(p);
482
485
  } catch {
483
486
  return [];
484
487
  }
485
488
  };
486
- const exists = (p) => fs.existsSync(p);
489
+ const exists = (p) => fs$1.existsSync(p);
487
490
  if (!npu) {
488
491
  const { classifyIntelNpu } = await import("../../intel-npu-C8HKvRQF.mjs");
489
492
  npu = classifyIntelNpu({
@@ -511,7 +514,7 @@ var PlatformScorer = class {
511
514
  exists,
512
515
  readFile: (p) => {
513
516
  try {
514
- return fs.readFileSync(p, "utf8");
517
+ return fs$1.readFileSync(p, "utf8");
515
518
  } catch {
516
519
  return "";
517
520
  }
@@ -1,4 +1,5 @@
1
1
  import type { HardwareInfo, PlatformCapabilities, IScopedLogger } from "@camstack/types";
2
+ import { type CoralFs } from "./coral-accelerators.js";
2
3
  export declare class PlatformScorer {
3
4
  private cached;
4
5
  private readonly logger;
@@ -11,7 +12,9 @@ export declare class PlatformScorer {
11
12
  * lookup (dev / agent environments where Python is on PATH).
12
13
  */
13
14
  private readonly embeddedPythonPath;
14
- constructor(logger?: IScopedLogger, embeddedPythonPath?: string | null);
15
+ /** Where the Coral scan reads `/sys` and `/dev` (the host's, unless a spec fakes one). */
16
+ private readonly coralFs;
17
+ constructor(logger?: IScopedLogger, embeddedPythonPath?: string | null, coralFs?: CoralFs);
15
18
  /**
16
19
  * Probe hardware + derive scores from pure rules and score all backend combos.
17
20
  *
@@ -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-BZQjLPiz.js");
6
+ const require_dist = require("../../dist-Bn-RNanh.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 { fi as InvalidRecordError, ga as recordSecretRef, ir as recordEntriesCapability, ji as UnknownRecordKindError, ni as BaseAddon, oa as mapSecretLeaves } from "../../dist-B_GRPhnY.mjs";
1
+ import { aa as mapSecretLeaves, fi as InvalidRecordError, ir as recordEntriesCapability, ji as UnknownRecordKindError, ni as BaseAddon, pa as recordSecretRef } from "../../dist-Wy8cTxg6.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-BZQjLPiz.js");
6
+ const require_dist = require("../../dist-Bn-RNanh.js");
7
7
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
8
8
  /**
9
9
  * Reconcile the durable `enabledProviders` set against authoritative
@@ -1,4 +1,4 @@
1
- import { Oa as EventCategory, ni as BaseAddon } from "../../dist-B_GRPhnY.mjs";
1
+ import { Ta as EventCategory, ni as BaseAddon } from "../../dist-Wy8cTxg6.mjs";
2
2
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
3
3
  /**
4
4
  * Reconcile the durable `enabledProviders` set against authoritative
@@ -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-BZQjLPiz.js");
6
+ const require_dist = require("../../dist-Bn-RNanh.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 { Cr as snapshotCapability, Oa as EventCategory, Ot as bareAddonId, Qr as DeviceFeature, Qt as deriveBatteryPresence, Wn as memoizePinnedFfmpeg, ei as DeviceType, jr as streamQualityLabel, kt as batteryCapability, ni as BaseAddon, s as BatteryStatusSchema, sa as nodePin, ti as errMsg } from "../../dist-B_GRPhnY.mjs";
1
+ import { Cr as snapshotCapability, Ot as bareAddonId, Qr as DeviceFeature, Qt as deriveBatteryPresence, Ta as EventCategory, Wn as memoizePinnedFfmpeg, ei as DeviceType, jr as streamQualityLabel, kt as batteryCapability, ni as BaseAddon, oa as nodePin, s as BatteryStatusSchema, ti as errMsg } from "../../dist-Wy8cTxg6.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";
@@ -67,21 +67,6 @@ export interface ControlOps {
67
67
  readonly declaredThisBoot: boolean;
68
68
  }[];
69
69
  };
70
- /** Paginated `(id, data)` read of a legacy table in this file. */
71
- readonly readLegacyCollection: {
72
- readonly input: {
73
- readonly collection: string;
74
- readonly cursor?: string | undefined;
75
- readonly limit?: number | undefined;
76
- };
77
- readonly output: {
78
- readonly rows: readonly {
79
- readonly id: string;
80
- readonly data: Record<string, unknown>;
81
- }[];
82
- readonly nextCursor: string | null;
83
- };
84
- };
85
70
  }
86
71
  export type ControlOp = keyof ControlOps;
87
72
  /** At most this many calls in flight per worker; beyond it a call is refused, never queued. */
@@ -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-BZQjLPiz.js");
6
+ const require_dist = require("../../dist-Bn-RNanh.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  let node_fs_promises = require("node:fs/promises");
9
9
  let node_path = require("node:path");