@camstack/system 1.2.151 → 1.2.154

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 (66) hide show
  1. package/dist/addon-runner.js +14 -15
  2. package/dist/addon-runner.mjs +14 -14
  3. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/alerts/alerts.addon.js +1 -1
  8. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  11. package/dist/builtins/console-logging/index.js +1 -1
  12. package/dist/builtins/console-logging/index.mjs +1 -1
  13. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  14. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  15. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  16. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  17. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  18. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  19. package/dist/builtins/hub-forwarder/index.js +1 -1
  20. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  21. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  22. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  23. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  24. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  25. package/dist/builtins/local-network/local-network.addon.js +3 -3
  26. package/dist/builtins/local-network/local-network.addon.mjs +3 -3
  27. package/dist/builtins/loki-logging/index.js +1 -1
  28. package/dist/builtins/loki-logging/index.mjs +1 -1
  29. package/dist/builtins/native-metrics/cgroup-memory.d.ts +193 -0
  30. package/dist/builtins/native-metrics/container-memory-series.d.ts +226 -0
  31. package/dist/builtins/native-metrics/native-metrics.addon.d.ts +26 -0
  32. package/dist/builtins/native-metrics/native-metrics.addon.js +1536 -661
  33. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1536 -660
  34. package/dist/builtins/platform-probe/index.js +3 -3
  35. package/dist/builtins/platform-probe/index.mjs +2 -2
  36. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  37. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  38. package/dist/builtins/snapshot/index.js +1 -1
  39. package/dist/builtins/snapshot/index.mjs +1 -1
  40. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +2 -2
  41. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +2 -2
  42. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  43. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  44. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  45. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  46. package/dist/builtins/system-config/system-config.addon.js +1 -1
  47. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  48. package/dist/builtins/winston-logging/index.js +1 -1
  49. package/dist/builtins/winston-logging/index.mjs +1 -1
  50. package/dist/{dist-CImxMt5h.js → dist-BPlfW-CG.js} +96 -10
  51. package/dist/{dist-CbRciAbu.mjs → dist-D_NyUV6Y.mjs} +96 -10
  52. package/dist/index.d.ts +6 -2
  53. package/dist/index.js +24 -5
  54. package/dist/index.mjs +5 -5
  55. package/dist/kernel/event-plane-report.d.ts +202 -0
  56. package/dist/kernel/heap-spaces.d.ts +138 -0
  57. package/dist/kernel/heap-watch.d.ts +142 -5
  58. package/dist/kernel/index.d.ts +2 -0
  59. package/dist/kernel/transport/local-child-registry.d.ts +22 -0
  60. package/dist/{manifest-python-deps-DuQ3Uqoq.mjs → manifest-python-deps-BILJm2mI.mjs} +522 -15
  61. package/dist/{manifest-python-deps-BqWrDjSN.js → manifest-python-deps-COeSr7el.js} +636 -15
  62. package/dist/{retired-settings-keys-DhFPXIRD.mjs → retired-settings-keys-Bq1Tb84I.mjs} +1 -1
  63. package/dist/{retired-settings-keys-C7gLUS3x.js → retired-settings-keys-DBY6ebwV.js} +1 -1
  64. package/package.json +1 -1
  65. package/dist/{tls-u8QCJCFE.js → tls-BxQlomxd.js} +1 -1
  66. package/dist/{tls-CQhPGSJm.mjs → tls-DOTmtLCW.mjs} +1 -1
@@ -1,13 +1,11 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_manifest_python_deps = require("./manifest-python-deps-BqWrDjSN.js");
2
+ const require_manifest_python_deps = require("./manifest-python-deps-COeSr7el.js");
3
3
  const require_custom_action_registry = require("./custom-action-registry-jY0NOZK8.js");
4
4
  let node_path = require("node:path");
5
5
  node_path = require_chunk.__toESM(node_path);
6
6
  let node_fs = require("node:fs");
7
7
  node_fs = require_chunk.__toESM(node_fs);
8
8
  let node_module = require("node:module");
9
- let node_v8 = require("node:v8");
10
- node_v8 = require_chunk.__toESM(node_v8);
11
9
  let _camstack_types_addon = require("@camstack/types/addon");
12
10
  let node_url = require("node:url");
13
11
  //#region src/kernel/moleculer/child-addon-call-dispatch.ts
@@ -705,18 +703,19 @@ async function main() {
705
703
  }
706
704
  });
707
705
  process.on("SIGUSR2", () => {
708
- const MB = (x) => Math.round(x / 1048576 * 10) / 10;
709
- try {
710
- const mu = process.memoryUsage();
711
- const spaces = node_v8.getHeapSpaceStatistics().filter((s) => s.space_used_size > 0).map((s) => `${s.space_name}=${MB(s.space_used_size)}`).join(" ");
712
- const addons = loaded.map((e) => e.addonId).join(",");
713
- runnerLog.info(`[mem] node="${nodeId}" addons=[${addons}] rss=${MB(mu.rss)} heapUsed=${MB(mu.heapUsed)} heapTotal=${MB(mu.heapTotal)} external=${MB(mu.external)} arrayBuffers=${MB(mu.arrayBuffers)} | ${spaces}`);
714
- const snapPath = `/tmp/heap-${nodeId.replace(/[^\w.-]/g, "_")}.heapsnapshot`;
715
- node_v8.writeHeapSnapshot(snapPath);
716
- runnerLog.info(`[mem] node="${nodeId}" heap snapshot written -> ${snapPath}`);
717
- } catch (err) {
718
- runnerLog.warn(`[mem] snapshot failed: ${(0, _camstack_types_addon.errMsg)(err)}`);
719
- }
706
+ require_manifest_python_deps.emitHeapDiagnosticReport({
707
+ label: nodeId,
708
+ addons: loaded.map((e) => e.addonId),
709
+ sink: {
710
+ info: (line) => {
711
+ runnerLog.info(line);
712
+ },
713
+ warn: (line) => {
714
+ runnerLog.warn(line);
715
+ }
716
+ },
717
+ snapshotPath: `/tmp/heap-${nodeId.replace(/[^\w.-]/g, "_")}.heapsnapshot`
718
+ });
720
719
  });
721
720
  const shutdown = async () => {
722
721
  shuttingDown = true;
@@ -1,9 +1,8 @@
1
- import { F as createUdsLoggerWithControl, I as LocalChildClient, Pt as RUNNER_RSS_BUDGET_ENV, Wt as startRunnerHeapWatch, bt as resolveAddonClass, i as createUdsAddonContext, it as setWorkerNativeCapsChangeListener, nt as getWorkerNativeCapSnapshot, ot as validateProviderRegistrations, t as installManifestPythonDeps, tt as getWorkerNativeCapProvider, yt as installManifestNativeDeps } from "./manifest-python-deps-DuQ3Uqoq.mjs";
1
+ import { F as createUdsLoggerWithControl, I as LocalChildClient, It as RUNNER_RSS_BUDGET_ENV, Yt as startRunnerHeapWatch, at as setWorkerNativeCapsChangeListener, bt as installManifestNativeDeps, en as emitHeapDiagnosticReport, i as createUdsAddonContext, nt as getWorkerNativeCapProvider, rt as getWorkerNativeCapSnapshot, st as validateProviderRegistrations, t as installManifestPythonDeps, xt as resolveAddonClass } from "./manifest-python-deps-BILJm2mI.mjs";
2
2
  import { t as CustomActionRegistry } from "./custom-action-registry-F__gp_VX.mjs";
3
3
  import { register } from "node:module";
4
4
  import * as path$1 from "node:path";
5
5
  import * as fs from "node:fs";
6
- import * as v8 from "node:v8";
7
6
  import { ReadinessRegistry, ReadinessTimeoutError, errMsg, isCollectionArrayMethodName, normalizeAddonInitResult } from "@camstack/types/addon";
8
7
  import { pathToFileURL } from "node:url";
9
8
  //#region src/kernel/moleculer/child-addon-call-dispatch.ts
@@ -701,18 +700,19 @@ async function main() {
701
700
  }
702
701
  });
703
702
  process.on("SIGUSR2", () => {
704
- const MB = (x) => Math.round(x / 1048576 * 10) / 10;
705
- try {
706
- const mu = process.memoryUsage();
707
- const spaces = v8.getHeapSpaceStatistics().filter((s) => s.space_used_size > 0).map((s) => `${s.space_name}=${MB(s.space_used_size)}`).join(" ");
708
- const addons = loaded.map((e) => e.addonId).join(",");
709
- runnerLog.info(`[mem] node="${nodeId}" addons=[${addons}] rss=${MB(mu.rss)} heapUsed=${MB(mu.heapUsed)} heapTotal=${MB(mu.heapTotal)} external=${MB(mu.external)} arrayBuffers=${MB(mu.arrayBuffers)} | ${spaces}`);
710
- const snapPath = `/tmp/heap-${nodeId.replace(/[^\w.-]/g, "_")}.heapsnapshot`;
711
- v8.writeHeapSnapshot(snapPath);
712
- runnerLog.info(`[mem] node="${nodeId}" heap snapshot written -> ${snapPath}`);
713
- } catch (err) {
714
- runnerLog.warn(`[mem] snapshot failed: ${errMsg(err)}`);
715
- }
703
+ emitHeapDiagnosticReport({
704
+ label: nodeId,
705
+ addons: loaded.map((e) => e.addonId),
706
+ sink: {
707
+ info: (line) => {
708
+ runnerLog.info(line);
709
+ },
710
+ warn: (line) => {
711
+ runnerLog.warn(line);
712
+ }
713
+ },
714
+ snapshotPath: `/tmp/heap-${nodeId.replace(/[^\w.-]/g, "_")}.heapsnapshot`
715
+ });
716
716
  });
717
717
  const shutdown = async () => {
718
718
  shuttingDown = true;
@@ -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-CImxMt5h.js");
6
+ const require_dist = require("../../dist-BPlfW-CG.js");
7
7
  const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
8
8
  let node_crypto = require("node:crypto");
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { Ot as errMsg, S as addonPagesCapability, kt as BaseAddon, tn as EventCategory } from "../../dist-CbRciAbu.mjs";
1
+ import { Ot as errMsg, S as addonPagesCapability, kt as BaseAddon, tn as EventCategory } from "../../dist-D_NyUV6Y.mjs";
2
2
  import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import * as path$1 from "node:path";
@@ -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-CImxMt5h.js");
6
+ const require_dist = require("../../dist-BPlfW-CG.js");
7
7
  const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
8
8
  let node_crypto = require("node:crypto");
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { Ot as errMsg, kt as BaseAddon, tn as EventCategory, w as addonWidgetsCapability } from "../../dist-CbRciAbu.mjs";
1
+ import { Ot as errMsg, kt as BaseAddon, tn as EventCategory, w as addonWidgetsCapability } from "../../dist-D_NyUV6Y.mjs";
2
2
  import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import * as path$1 from "node:path";
@@ -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-CImxMt5h.js");
6
+ const require_dist = require("../../dist-BPlfW-CG.js");
7
7
  //#region src/builtins/alerts/prune-policy.ts
8
8
  /**
9
9
  * Ids older than `cutoffMs`, oldest first.
@@ -1,4 +1,4 @@
1
- import { Ht as createEvent, Ot as errMsg, T as alertsCapability, kt as BaseAddon, n as AlertSchema, tn as EventCategory } from "../../dist-CbRciAbu.mjs";
1
+ import { Ht as createEvent, Ot as errMsg, T as alertsCapability, kt as BaseAddon, n as AlertSchema, tn as EventCategory } from "../../dist-D_NyUV6Y.mjs";
2
2
  //#region src/builtins/alerts/prune-policy.ts
3
3
  /**
4
4
  * Ids older than `cutoffMs`, oldest first.
@@ -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-CImxMt5h.js");
6
+ const require_dist = require("../../dist-BPlfW-CG.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  let buffer = require("buffer");
9
9
  let node_fs_promises = require("node:fs/promises");
@@ -1,4 +1,4 @@
1
- import { D as backupCapability, kt as BaseAddon, tn as EventCategory } from "../../dist-CbRciAbu.mjs";
1
+ import { D as backupCapability, kt as BaseAddon, tn as EventCategory } from "../../dist-D_NyUV6Y.mjs";
2
2
  import { randomBytes, randomUUID } from "node:crypto";
3
3
  import { Buffer as Buffer$1 } from "buffer";
4
4
  import * as fsp from "node:fs/promises";
@@ -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-CImxMt5h.js");
6
+ const require_dist = require("../../dist-BPlfW-CG.js");
7
7
  const require_formatter = require("../../formatter-DqAKDlvN.js");
8
8
  //#region src/builtins/console-logging/console-destination.ts
9
9
  var LEVEL_RANK = {
@@ -1,4 +1,4 @@
1
- import { kt as BaseAddon, rt as logDestinationCapability } from "../../dist-CbRciAbu.mjs";
1
+ import { kt as BaseAddon, rt as logDestinationCapability } from "../../dist-D_NyUV6Y.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
3
3
  //#region src/builtins/console-logging/console-destination.ts
4
4
  var LEVEL_RANK = {
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-CImxMt5h.js");
3
+ const require_dist = require("../../dist-BPlfW-CG.js");
4
4
  let node_crypto = require("node:crypto");
5
5
  let node_fs_promises = require("node:fs/promises");
6
6
  node_fs_promises = require_chunk.__toESM(node_fs_promises);
@@ -1,4 +1,4 @@
1
- import { M as coreBlockIdFromAddonId, N as coreBlocksCapability, Ot as errMsg, c as CoreBlockSchema, j as coreBlockAddonId, kt as BaseAddon, o as CORE_BLOCKS_ADDON_ID, s as CORE_BLOCK_ADDON_PREFIX, u as DeclaredDevices } from "../../dist-CbRciAbu.mjs";
1
+ import { M as coreBlockIdFromAddonId, N as coreBlocksCapability, Ot as errMsg, c as CoreBlockSchema, j as coreBlockAddonId, kt as BaseAddon, o as CORE_BLOCKS_ADDON_ID, s as CORE_BLOCK_ADDON_PREFIX, u as DeclaredDevices } from "../../dist-D_NyUV6Y.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import * as fs from "node:fs/promises";
4
4
  import * as path$1 from "node:path";
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CImxMt5h.js");
7
- const require_retired_settings_keys = require("../../retired-settings-keys-C7gLUS3x.js");
6
+ const require_dist = require("../../dist-BPlfW-CG.js");
7
+ const require_retired_settings_keys = require("../../retired-settings-keys-DBY6ebwV.js");
8
8
  let node_crypto = require("node:crypto");
9
9
  let _camstack_types_node = require("@camstack/types/node");
10
10
  //#region src/builtins/device-manager/adoption-job-engine.ts
@@ -1,5 +1,5 @@
1
- import { A as buildStreamParamsConfigSchema, Ft as DeviceType, H as enumerateItemArrayFields, L as deviceManagerCapability, Nt as DeviceFeature, Ot as errMsg, Pt as DeviceRole, R as deviceStateCapability, Rt as WELL_KNOWN_TAB_MAP, U as enumerateSchemaFields, _ as STREAM_PROFILE_META, a as CAP_NAMES_WITH_STATUS, d as DeviceStatusSchema, en as sleep, ht as runtimeStatePolicyFor, kt as BaseAddon, lt as parseStreamParamsFormPatch, qt as isDeviceConfigCap, st as normalizeUnit, t as ALL_CAPABILITY_DEFINITIONS, tn as EventCategory, z as deviceStatusCapability } from "../../dist-CbRciAbu.mjs";
2
- import { n as purgeRetiredSettingsRows } from "../../retired-settings-keys-DhFPXIRD.mjs";
1
+ import { A as buildStreamParamsConfigSchema, Ft as DeviceType, H as enumerateItemArrayFields, L as deviceManagerCapability, Nt as DeviceFeature, Ot as errMsg, Pt as DeviceRole, R as deviceStateCapability, Rt as WELL_KNOWN_TAB_MAP, U as enumerateSchemaFields, _ as STREAM_PROFILE_META, a as CAP_NAMES_WITH_STATUS, d as DeviceStatusSchema, en as sleep, ht as runtimeStatePolicyFor, kt as BaseAddon, lt as parseStreamParamsFormPatch, qt as isDeviceConfigCap, st as normalizeUnit, t as ALL_CAPABILITY_DEFINITIONS, tn as EventCategory, z as deviceStatusCapability } from "../../dist-D_NyUV6Y.mjs";
2
+ import { n as purgeRetiredSettingsRows } from "../../retired-settings-keys-Bq1Tb84I.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { canonicalDeviceFingerprint } from "@camstack/types/node";
5
5
  //#region src/builtins/device-manager/adoption-job-engine.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-CImxMt5h.js");
6
+ const require_dist = require("../../dist-BPlfW-CG.js");
7
7
  //#region src/builtins/doorbell/trigger-engine.ts
8
8
  /**
9
9
  * Pure trigger logic for the virtual-doorbell builtin — edge detection over
@@ -1,4 +1,4 @@
1
- import { B as doorbellCapability, Ft as DeviceType, Ht as createEvent, O as bareAddonId, Ot as errMsg, Q as isSourceCap, W as evaluateSensorEdge, Z as isSameAddonId, g as SOURCE_DEVICE_TYPES, h as SOURCE_CAPS, kt as BaseAddon, tn as EventCategory } from "../../dist-CbRciAbu.mjs";
1
+ import { B as doorbellCapability, Ft as DeviceType, Ht as createEvent, O as bareAddonId, Ot as errMsg, Q as isSourceCap, W as evaluateSensorEdge, Z as isSameAddonId, g as SOURCE_DEVICE_TYPES, h as SOURCE_CAPS, kt as BaseAddon, tn as EventCategory } from "../../dist-D_NyUV6Y.mjs";
2
2
  //#region src/builtins/doorbell/trigger-engine.ts
3
3
  /**
4
4
  * Pure trigger logic for the virtual-doorbell builtin — edge detection over
@@ -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-CImxMt5h.js");
6
+ const require_dist = require("../../dist-BPlfW-CG.js");
7
7
  const require_formatter = require("../../formatter-DqAKDlvN.js");
8
8
  //#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
9
9
  var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
@@ -1,4 +1,4 @@
1
- import { kt as BaseAddon, rt as logDestinationCapability } from "../../dist-CbRciAbu.mjs";
1
+ import { kt as BaseAddon, rt as logDestinationCapability } from "../../dist-D_NyUV6Y.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
3
3
  //#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
4
4
  var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-CImxMt5h.js");
3
+ const require_dist = require("../../dist-BPlfW-CG.js");
4
4
  //#region src/builtins/liveness-monitor/liveness-checks.ts
5
5
  var NO_DEVICES = "liveness:no-devices";
6
6
  var ALL_OFFLINE = "liveness:all-devices-offline";
@@ -1,4 +1,4 @@
1
- import { Ht as createEvent, Ot as errMsg, kt as BaseAddon, tn as EventCategory } from "../../dist-CbRciAbu.mjs";
1
+ import { Ht as createEvent, Ot as errMsg, kt as BaseAddon, tn as EventCategory } from "../../dist-D_NyUV6Y.mjs";
2
2
  //#region src/builtins/liveness-monitor/liveness-checks.ts
3
3
  var NO_DEVICES = "liveness:no-devices";
4
4
  var ALL_OFFLINE = "liveness:all-devices-offline";
@@ -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-CImxMt5h.js");
6
+ const require_dist = require("../../dist-BPlfW-CG.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  node_crypto = require_chunk.__toESM(node_crypto);
9
9
  let crypto$1 = require("crypto");
@@ -1,5 +1,5 @@
1
1
  import { i as __require, o as __toESM, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
2
- import { E as authProviderCapability, Tt as userManagementCapability, kt as BaseAddon, r as ApiKeyRecordSchema, v as ScopedTokenSchema, x as UserRecordSchema } from "../../dist-CbRciAbu.mjs";
2
+ import { E as authProviderCapability, Tt as userManagementCapability, kt as BaseAddon, r as ApiKeyRecordSchema, v as ScopedTokenSchema, x as UserRecordSchema } from "../../dist-D_NyUV6Y.mjs";
3
3
  import * as crypto$2 from "node:crypto";
4
4
  import { createHash, randomUUID, timingSafeEqual } from "node:crypto";
5
5
  import nodeCrypto from "crypto";
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-CImxMt5h.js");
4
- const require_tls = require("../../tls-u8QCJCFE.js");
3
+ const require_dist = require("../../dist-BPlfW-CG.js");
4
+ const require_tls = require("../../tls-BxQlomxd.js");
5
5
  let node_fs_promises = require("node:fs/promises");
6
6
  let node_path = require("node:path");
7
+ let node_fs = require("node:fs");
7
8
  let node_os = require("node:os");
8
9
  node_os = require_chunk.__toESM(node_os);
9
- let node_fs = require("node:fs");
10
10
  let node_net = require("node:net");
11
11
  //#region src/builtins/local-network/local-hostname.ts
12
12
  var DNS_NAME = /^(?=.{1,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])$/;
@@ -1,9 +1,9 @@
1
- import { kt as BaseAddon, nt as localNetworkCapability, tn as EventCategory } from "../../dist-CbRciAbu.mjs";
2
- import { S as readLanHttpState, _ as DEFAULT_LAN_HTTP_PORT, a as writeTlsMode, i as writeExtraSans, l as reissueTlsLeaf, n as readTlsAccessStatus, o as validateUploadedTls, r as readTlsMode, s as ensureTlsCert, t as readExtraSans, y as applyLanHttp } from "../../tls-CQhPGSJm.mjs";
1
+ import { kt as BaseAddon, nt as localNetworkCapability, tn as EventCategory } from "../../dist-D_NyUV6Y.mjs";
2
+ import { S as readLanHttpState, _ as DEFAULT_LAN_HTTP_PORT, a as writeTlsMode, i as writeExtraSans, l as reissueTlsLeaf, n as readTlsAccessStatus, o as validateUploadedTls, r as readTlsMode, s as ensureTlsCert, t as readExtraSans, y as applyLanHttp } from "../../tls-DOTmtLCW.mjs";
3
3
  import { mkdir, writeFile } from "node:fs/promises";
4
4
  import { join } from "node:path";
5
- import * as os from "node:os";
6
5
  import { readFileSync } from "node:fs";
6
+ import * as os from "node:os";
7
7
  import { isIP } from "node:net";
8
8
  //#region src/builtins/local-network/local-hostname.ts
9
9
  var DNS_NAME = /^(?=.{1,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])$/;
@@ -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-CImxMt5h.js");
6
+ const require_dist = require("../../dist-BPlfW-CG.js");
7
7
  //#region src/builtins/loki-logging/loki-payload.ts
8
8
  /**
9
9
  * Loki rejects a label name that is not a valid Prometheus label
@@ -1,4 +1,4 @@
1
- import { kt as BaseAddon, rt as logDestinationCapability } from "../../dist-CbRciAbu.mjs";
1
+ import { kt as BaseAddon, rt as logDestinationCapability } from "../../dist-D_NyUV6Y.mjs";
2
2
  //#region src/builtins/loki-logging/loki-payload.ts
3
3
  /**
4
4
  * Loki rejects a label name that is not a valid Prometheus label
@@ -0,0 +1,193 @@
1
+ import { ContainerMemorySnapshot, IScopedLogger } from '@camstack/types';
2
+ /**
3
+ * Which hierarchy answered. Reported so a reading is never ambiguous.
4
+ *
5
+ * Narrowed from {@link ContainerMemorySnapshot}'s own field rather than
6
+ * re-declared: the shape is the capability's Zod schema and this file must not
7
+ * own a second copy of it.
8
+ */
9
+ export type CgroupMemorySource = ContainerMemorySnapshot['source'];
10
+ /** The one impure surface. Returns `null` for anything unreadable. */
11
+ export interface CgroupFileReader {
12
+ read(path: string): string | null;
13
+ }
14
+ /** `readFileSync`, with every failure flattened to `null`. */
15
+ export declare const nodeCgroupFileReader: CgroupFileReader;
16
+ /** Where the v2 unified hierarchy is mounted, and where v1 hangs its controllers. */
17
+ export declare const CGROUP_MOUNT_ROOT = "/sys/fs/cgroup";
18
+ /**
19
+ * The i915 GEM accounting file.
20
+ *
21
+ * **debugfs, and it is not mounted in our containers.** Verified on the live
22
+ * hub on 2026-08-29: readable on the Unraid host (`6014 shrinkable [0 free]
23
+ * objects, 1194934272 bytes`), `ENOENT` inside the `CamStack` container where
24
+ * `native-metrics` actually runs. It is probed ONCE per process and latched —
25
+ * a bind mount cannot appear under a running container — so an absent file
26
+ * costs one failed `open` for the life of the runner and one log line, never a
27
+ * failure per tick.
28
+ *
29
+ * Making it populate is a one-line change on the container, not here:
30
+ * mounting `/sys/kernel/debug` read-only into `CamStack` fills this field on
31
+ * the next sample with no code change.
32
+ */
33
+ export declare const I915_GEM_OBJECTS_PATH = "/sys/kernel/debug/dri/0/i915_gem_objects";
34
+ /** Where the numbers for one hierarchy live, once resolved. */
35
+ export interface CgroupMemoryLayout {
36
+ readonly source: CgroupMemorySource;
37
+ /** Directory the three files below sit in. Kept for the resolution log line. */
38
+ readonly directory: string;
39
+ readonly currentPath: string;
40
+ readonly limitPath: string;
41
+ readonly statPath: string;
42
+ }
43
+ /** What `/proc/self/cgroup` says about this process. */
44
+ export interface CgroupSelfEntry {
45
+ readonly version: 'v2' | 'v1';
46
+ /** Path RELATIVE to the hierarchy root, always leading-slashed. */
47
+ readonly path: string;
48
+ }
49
+ /**
50
+ * Parse `/proc/self/cgroup`.
51
+ *
52
+ * Two formats, and the file may contain both on a hybrid host:
53
+ *
54
+ * ```
55
+ * 0::/ ← v2 unified
56
+ * 5:memory:/docker/9f3c… ← v1, memory controller
57
+ * 4:cpu,cpuacct:/docker/9f3c… ← v1, other controllers
58
+ * ```
59
+ *
60
+ * v2 wins when present: on a hybrid host the unified hierarchy is the one
61
+ * carrying `memory.current`, and every camstack deployment is v2 (verified on
62
+ * the live hub, which reports the single line `0::/`).
63
+ *
64
+ * Returns `null` when the file names no memory hierarchy at all — which is
65
+ * also what a non-Linux host produces, because there is no file to read.
66
+ */
67
+ export declare function parseCgroupSelf(text: string): CgroupSelfEntry | null;
68
+ /**
69
+ * Parse a `memory.stat` file — v1 or v2, both are `key value` per line.
70
+ *
71
+ * Unknown keys are KEPT rather than refused: a v2 `memory.stat` carries ~50
72
+ * fields and we read five of them, and a kernel that adds a sixth must not
73
+ * turn into a parse failure. A malformed line is skipped, not thrown on.
74
+ */
75
+ export declare function parseCgroupStat(text: string): ReadonlyMap<string, number>;
76
+ /**
77
+ * Parse a single-scalar cgroup file (`memory.current`, `memory.max`, …).
78
+ *
79
+ * `max` — v2's word for "no limit" — and v1's `V1_UNLIMITED_SENTINEL` both
80
+ * become `null`, because a ceiling nothing can reach is not a ceiling and
81
+ * charting it as 8 exabytes would flatten every real series to zero.
82
+ */
83
+ export declare function parseCgroupScalar(text: string): number | null;
84
+ /**
85
+ * Parse the first line of `i915_gem_objects`.
86
+ *
87
+ * ```
88
+ * 6014 shrinkable [0 free] objects, 1194934272 bytes
89
+ * ```
90
+ *
91
+ * Only the byte total is taken. The format has changed across kernel releases
92
+ * more than once, so a line that does not match reads `null` — an unrecognised
93
+ * format is UNKNOWN, never zero.
94
+ */
95
+ export declare function parseI915GemObjects(text: string): number | null;
96
+ /**
97
+ * Find the cgroup from INSIDE this process — never a hard-coded path.
98
+ *
99
+ * The path the hub happens to have (`/sys/fs/cgroup/docker/<id>/memory.stat`
100
+ * as seen from the Unraid host) is an artefact of where you are standing. From
101
+ * inside the container the same cgroup is at the mount ROOT, because Docker
102
+ * gives the container its own cgroup namespace and `/proc/self/cgroup` reports
103
+ * `0::/`. Hard-coding either one breaks the other.
104
+ *
105
+ * So the resolution is: ask `/proc/self/cgroup` which hierarchy and which
106
+ * path, then take the FIRST candidate directory that actually publishes the
107
+ * usage file.
108
+ *
109
+ * - **v2** — `<mount><path>` then `<mount>`. The second candidate is the
110
+ * namespaced case and the one that answers on our hub; the first is the
111
+ * un-namespaced case (a host process, or `--cgroupns=host`).
112
+ * - **v1** — `<mount>/memory<path>` then `<mount>/memory`, same reasoning.
113
+ * - **neither** — `null`. macOS has no `/proc/self/cgroup` at all, so a
114
+ * developer Mac lands here and reports nothing, which is the truth.
115
+ */
116
+ export declare function resolveCgroupMemoryLayout(fs: CgroupFileReader): CgroupMemoryLayout | null;
117
+ /**
118
+ * Turn one layout's three files into a snapshot.
119
+ *
120
+ * Pure over the text, so the whole mapping — including a v2 `memory.stat` full
121
+ * of fields we do not read — is testable against a real fixture.
122
+ *
123
+ * v1's `memory.stat` names the same quantities differently and publishes fewer
124
+ * of them: `rss` is the anonymous charge, `cache` is the page cache, and there
125
+ * is no slab accounting at all. Mapping them onto the same field names is what
126
+ * makes a v1 node and a v2 node comparable; reporting `slabBytes: null` on v1
127
+ * is what stops that comparison from lying.
128
+ */
129
+ export declare function buildContainerMemorySnapshot(input: {
130
+ readonly source: CgroupMemorySource;
131
+ readonly currentText: string;
132
+ readonly limitText: string | null;
133
+ readonly statText: string | null;
134
+ readonly gpuShmemBytes: number | null;
135
+ }): ContainerMemorySnapshot | null;
136
+ export interface ContainerMemoryProbeDeps {
137
+ readonly logger: IScopedLogger;
138
+ readonly fs?: CgroupFileReader;
139
+ /** Set `false` to skip the debugfs probe entirely. Default `true`. */
140
+ readonly readGpu?: boolean;
141
+ }
142
+ /**
143
+ * The sampler. Resolves once, latches, and logs TRANSITIONS only.
144
+ *
145
+ * Three states are worth a line and none of them is worth one per tick:
146
+ *
147
+ * 1. **Resolution** — once, at the first sample. Either the layout that
148
+ * answered, or "no cgroup on this node", which is a fact about the node and
149
+ * not an error.
150
+ * 2. **GPU probe** — once, at the first sample. Absent debugfs is the normal
151
+ * case inside a container and is stated as such, then never retried: a bind
152
+ * mount cannot appear under a running container.
153
+ * 3. **Read failing / recovering** — a cgroup that resolved and then stopped
154
+ * answering is a real change and says so, once in each direction. A tick
155
+ * that fails while already failing is silent, because the first line
156
+ * already said it.
157
+ *
158
+ * The silence is bounded by design: at the 10 s snapshot cadence a per-tick
159
+ * warning would be 8 640 lines a day on a node that simply is not Linux.
160
+ */
161
+ export declare class ContainerMemoryProbe {
162
+ private readonly logger;
163
+ private readonly fs;
164
+ private readonly wantGpu;
165
+ private resolved;
166
+ private layout;
167
+ private gpuProbed;
168
+ private gpuReadable;
169
+ /** `null` until the first sample — so the FIRST outcome is a transition too. */
170
+ private lastReadOk;
171
+ constructor(deps: ContainerMemoryProbeDeps);
172
+ /** Did this node resolve a cgroup at all? Absent is a reportable fact. */
173
+ get available(): boolean;
174
+ /**
175
+ * One reading, or `null` when this node has no cgroup or the cgroup stopped
176
+ * answering. `null` is ABSENT — the caller contributes no point, and no
177
+ * point is what a chart must show, never a zero.
178
+ */
179
+ sample(): ContainerMemorySnapshot | null;
180
+ /** Resolve on first use and never again — a cgroup does not move under a pid. */
181
+ private resolveOnce;
182
+ /**
183
+ * The GPU number, probed once.
184
+ *
185
+ * It is host-wide and lives in debugfs, so it is absent far more often than
186
+ * it is present — inside every camstack container today. One `open` decides
187
+ * it for the life of the process; after that an unreadable file costs
188
+ * nothing at all, not even a syscall.
189
+ */
190
+ private readGpuShmem;
191
+ /** Log a read outcome only when it CHANGES. Never once per tick. */
192
+ private noteRead;
193
+ }