@camstack/system 1.2.445 → 1.2.447

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 (90) hide show
  1. package/dist/{agent-https-CiOW0-sj.js → agent-https-5DYAOJMO.js} +2 -2
  2. package/dist/{agent-https-D4Q8iFNd.mjs → agent-https-BWUEf6ev.mjs} +2 -2
  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 +86 -6
  8. package/dist/builtins/alerts/alerts.addon.mjs +86 -6
  9. package/dist/builtins/alerts/critical-push.d.ts +4 -0
  10. package/dist/builtins/alerts/emit-alert-policy.d.ts +28 -0
  11. package/dist/builtins/autotrack/index.js +1 -1
  12. package/dist/builtins/autotrack/index.mjs +1 -1
  13. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  14. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  15. package/dist/builtins/calendars/calendars.addon.js +1 -1
  16. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  17. package/dist/builtins/camera-grid/index.js +1 -1
  18. package/dist/builtins/camera-grid/index.mjs +1 -1
  19. package/dist/builtins/composer/composer.addon.js +2 -2
  20. package/dist/builtins/composer/composer.addon.mjs +2 -2
  21. package/dist/builtins/console-logging/index.js +1 -1
  22. package/dist/builtins/console-logging/index.mjs +1 -1
  23. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  24. package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  25. package/dist/builtins/device-manager/device-manager.addon.js +1 -1
  26. package/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  27. package/dist/builtins/hub-forwarder/index.js +1 -1
  28. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  29. package/dist/builtins/keychain/index.js +4 -4
  30. package/dist/builtins/keychain/index.mjs +4 -4
  31. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  32. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  33. package/dist/builtins/local-auth/local-auth.addon.js +3 -3
  34. package/dist/builtins/local-auth/local-auth.addon.mjs +3 -3
  35. package/dist/builtins/local-network/local-network.addon.js +2 -2
  36. package/dist/builtins/local-network/local-network.addon.mjs +2 -2
  37. package/dist/builtins/loki-logging/index.js +1 -1
  38. package/dist/builtins/loki-logging/index.mjs +1 -1
  39. package/dist/builtins/native-metrics/container-memory-ring.d.ts +18 -0
  40. package/dist/builtins/native-metrics/load-series-config.d.ts +38 -1
  41. package/dist/builtins/native-metrics/load-series-reader.d.ts +3 -3
  42. package/dist/builtins/native-metrics/load-series-types.d.ts +14 -0
  43. package/dist/builtins/native-metrics/native-metrics.addon.d.ts +5 -7
  44. package/dist/builtins/native-metrics/native-metrics.addon.js +220 -974
  45. package/dist/builtins/native-metrics/native-metrics.addon.mjs +220 -974
  46. package/dist/builtins/native-metrics/node-load-ring.d.ts +3 -5
  47. package/dist/builtins/native-metrics/node-metrics-history-recorder.d.ts +70 -0
  48. package/dist/builtins/platform-probe/index.js +1 -1
  49. package/dist/builtins/platform-probe/index.mjs +1 -1
  50. package/dist/builtins/record-entries/index.js +1 -1
  51. package/dist/builtins/record-entries/index.mjs +1 -1
  52. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  53. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  54. package/dist/builtins/snapshot/index.js +1 -1
  55. package/dist/builtins/snapshot/index.mjs +1 -1
  56. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  57. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  58. package/dist/builtins/sqlite-storage/index.js +1 -1
  59. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  60. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
  61. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
  62. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  63. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  64. package/dist/builtins/system-config/system-config.addon.js +3 -3
  65. package/dist/builtins/system-config/system-config.addon.mjs +3 -3
  66. package/dist/builtins/winston-logging/index.js +1 -1
  67. package/dist/builtins/winston-logging/index.mjs +1 -1
  68. package/dist/{composition-sources-BMt5cFYb.mjs → composition-sources-BmC5jAUv.mjs} +1 -1
  69. package/dist/{composition-sources-D3fi9Xns.js → composition-sources-BwIIltnZ.js} +1 -1
  70. package/dist/{constants-BMHCxRzb.mjs → constants-6XHGmEUF.mjs} +1 -1
  71. package/dist/{constants-Br879Axi.js → constants-DA_tjzIk.js} +1 -1
  72. package/dist/{device-ca-T8osSMos.mjs → device-ca-Bh_ClxMO.mjs} +1 -1
  73. package/dist/{device-ca-CnJ_va7i.js → device-ca-CnbrgfmW.js} +1 -1
  74. package/dist/{dist-DgOG8flk.js → dist-BkNfEJKa.js} +292 -11
  75. package/dist/{dist-BNunRyXT.mjs → dist-CkZIrsAP.mjs} +292 -11
  76. package/dist/file-host-worker.js +1 -1
  77. package/dist/file-host-worker.mjs +1 -1
  78. package/dist/{hub-mdns-ciao-D16oRQ9K.mjs → hub-mdns-ciao-CoyIUWHC.mjs} +2 -2
  79. package/dist/{hub-mdns-ciao-BIkTHq-n.js → hub-mdns-ciao-m5LIr4oA.js} +2 -2
  80. package/dist/index.js +9 -8
  81. package/dist/index.mjs +9 -8
  82. package/dist/{phase6-declare-gate-tkKOEitw.mjs → phase6-declare-gate-BDWZuB2n.mjs} +1 -1
  83. package/dist/{phase6-declare-gate-Ci1-8uUn.js → phase6-declare-gate-Bl7KocEs.js} +1 -1
  84. package/dist/{restore-archive-DjJnCgap.js → restore-archive-B57xI5Ue.js} +1 -1
  85. package/dist/{restore-archive-DR9MtO7J.mjs → restore-archive-CMr4V7Fi.mjs} +1 -1
  86. package/dist/{wal-maintenance-CfvgtQ7C.mjs → wal-maintenance-Bqm4zrNA.mjs} +0 -0
  87. package/dist/{wal-maintenance-CODGqhKY.js → wal-maintenance-CuG1DUca.js} +0 -0
  88. package/package.json +1 -1
  89. package/dist/builtins/native-metrics/container-memory-series.d.ts +0 -260
  90. package/dist/builtins/native-metrics/load-series-store.d.ts +0 -293
@@ -1,10 +1,10 @@
1
1
  import { i as __require, o as __toESM, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
2
- import { Bi as makeSecretMarker, Di as defineRecordKinds, E as DEVICE_NONCE_TTL_MS, Li as isSecretMarker, Rr as BaseAddon, T as DEVICE_ENROLLMENT_TTL_MS, Vt as deviceCredentialsCapability, a as ApiKeyRecordSchema, ct as UserRecordSchema, et as ScopedTokenSchema, hr as userManagementCapability, nn as formatDeviceRevoker, nt as SsoBridgeClaimsSchema, pt as authProviderCapability, sa as userError, st as TokenScopeSchema, vt as buildDeviceEnrollmentLink, yt as buildDeviceSignatureMessage } from "../../dist-BNunRyXT.mjs";
2
+ import { Bi as makeSecretMarker, Di as defineRecordKinds, E as DEVICE_NONCE_TTL_MS, Li as isSecretMarker, Rr as BaseAddon, T as DEVICE_ENROLLMENT_TTL_MS, Vt as deviceCredentialsCapability, a as ApiKeyRecordSchema, ct as UserRecordSchema, et as ScopedTokenSchema, hr as userManagementCapability, nn as formatDeviceRevoker, nt as SsoBridgeClaimsSchema, pt as authProviderCapability, sa as userError, st as TokenScopeSchema, vt as buildDeviceEnrollmentLink, yt as buildDeviceSignatureMessage } from "../../dist-CkZIrsAP.mjs";
3
3
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
4
4
  import { t as require_safe_buffer } from "../../safe-buffer-B1OjL1I9.mjs";
5
5
  import { t as require_ms } from "../../ms-CgH2OFlD.mjs";
6
- import { _ as setProcessJwtSigningKey, a as importDevicePublicKey, c as rebuildDeviceCaCertificate, d as JWT_SIGNING_KEY_REF, g as processJwtSigningKey, h as loadJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, r as DEVICE_CA_SETTINGS_SECTION, s as loadDeviceCa, t as DEVICE_CA_FIELD, u as verifyDeviceSignature } from "../../device-ca-T8osSMos.mjs";
7
- import { t as resolvePhase6UseRecordsPathForHub } from "../../phase6-declare-gate-tkKOEitw.mjs";
6
+ import { _ as setProcessJwtSigningKey, a as importDevicePublicKey, c as rebuildDeviceCaCertificate, d as JWT_SIGNING_KEY_REF, g as processJwtSigningKey, h as loadJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, r as DEVICE_CA_SETTINGS_SECTION, s as loadDeviceCa, t as DEVICE_CA_FIELD, u as verifyDeviceSignature } from "../../device-ca-Bh_ClxMO.mjs";
7
+ import { t as resolvePhase6UseRecordsPathForHub } from "../../phase6-declare-gate-BDWZuB2n.mjs";
8
8
  import { z } from "zod";
9
9
  import * as crypto$1 from "node:crypto";
10
10
  import { X509Certificate, createHash, randomUUID, timingSafeEqual } from "node:crypto";
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-DgOG8flk.js");
4
- const require_hub_mdns_ciao = require("../../hub-mdns-ciao-BIkTHq-n.js");
3
+ const require_dist = require("../../dist-BkNfEJKa.js");
4
+ const require_hub_mdns_ciao = require("../../hub-mdns-ciao-m5LIr4oA.js");
5
5
  let zod = require("zod");
6
6
  let node_net = require("node:net");
7
7
  let node_os = require("node:os");
@@ -1,5 +1,5 @@
1
- import { Fn as pickAppLinkHub, Jn as resolveHubAddressRoles, L as HUB_MDNS_SERVICE_TYPE, R as HUB_MDNS_TXT_KEYS, Rr as BaseAddon, Wn as resolveAppConnections, Zn as resolveNotificationTapAddress, _r as validateCustomAddress, l as CAMSTACK_APP_LINK_ORIGIN, la as EventCategory, ln as isDefaultAppConnectionEndpoint, on as isAppLinkBase, q as NetworkTunnelStartedDataSchema, wt as checkRoleAddress, yn as localNetworkCapability } from "../../dist-BNunRyXT.mjs";
2
- import { P as readLanHttpState, a as storeUploadedCertificate, d as servedHttpsLeafFingerprint, g as readTlsMode, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as applyLanHttp, k as DEFAULT_LAN_HTTP_PORT, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, r as regenerateCertificate, t as createCiaoPublisher, v as writeExtraSans, w as ensureTlsCert } from "../../hub-mdns-ciao-D16oRQ9K.mjs";
1
+ import { Fn as pickAppLinkHub, Jn as resolveHubAddressRoles, L as HUB_MDNS_SERVICE_TYPE, R as HUB_MDNS_TXT_KEYS, Rr as BaseAddon, Wn as resolveAppConnections, Zn as resolveNotificationTapAddress, _r as validateCustomAddress, l as CAMSTACK_APP_LINK_ORIGIN, la as EventCategory, ln as isDefaultAppConnectionEndpoint, on as isAppLinkBase, q as NetworkTunnelStartedDataSchema, wt as checkRoleAddress, yn as localNetworkCapability } from "../../dist-CkZIrsAP.mjs";
2
+ import { P as readLanHttpState, a as storeUploadedCertificate, d as servedHttpsLeafFingerprint, g as readTlsMode, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as applyLanHttp, k as DEFAULT_LAN_HTTP_PORT, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, r as regenerateCertificate, t as createCiaoPublisher, v as writeExtraSans, w as ensureTlsCert } from "../../hub-mdns-ciao-CoyIUWHC.mjs";
3
3
  import { z } from "zod";
4
4
  import { isIP } from "node:net";
5
5
  import * as os$1 from "node:os";
@@ -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-DgOG8flk.js");
6
+ const require_dist = require("../../dist-BkNfEJKa.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 { Rr as BaseAddon, xn as logDestinationCapability } from "../../dist-BNunRyXT.mjs";
1
+ import { Rr as BaseAddon, xn as logDestinationCapability } from "../../dist-CkZIrsAP.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,18 @@
1
+ /**
2
+ * Hot-tier container memory readings — adapter over {@link NodeLoadRing}.
3
+ */
4
+ import type { ContainerMemoryPoint, ContainerMemorySnapshot } from "@camstack/types";
5
+ export declare const CONTAINER_MEMORY_SAMPLES_PER_NODE = 180;
6
+ export declare const CONTAINER_MEMORY_MAX_TOTAL_ROWS: number;
7
+ export interface ContainerMemoryRingOptions {
8
+ readonly samplesPerNode?: number;
9
+ readonly now?: () => number;
10
+ }
11
+ export declare class ContainerMemoryRing {
12
+ private readonly ring;
13
+ constructor(options?: ContainerMemoryRingOptions);
14
+ record(nodeId: string, atMs: number, snapshot: ContainerMemorySnapshot): boolean;
15
+ read(nodeId: string, sinceMs?: number): readonly ContainerMemoryPoint[];
16
+ }
17
+ export declare function reduceContainerMemory(points: readonly ContainerMemoryPoint[], bucketMs: number, origin: number): readonly ContainerMemoryPoint[];
18
+ export declare function mergeContainerMemory(cold: readonly ContainerMemoryPoint[], hot: readonly ContainerMemoryPoint[]): readonly ContainerMemoryPoint[];
@@ -1,3 +1,40 @@
1
+ /**
2
+ * The two knobs of the durable load series, and the arithmetic that makes them
3
+ * honest.
4
+ *
5
+ * ## Where they live, and why there
6
+ *
7
+ * In `native-metrics`'s OWN global settings document — the one that already
8
+ * exists and already carries `samplingIntervalMs`. Fields on a document, never
9
+ * a method per knob: `system.getLoggingSettings` / `setLoggingSettings` set
10
+ * that precedent and it holds here.
11
+ *
12
+ * They are NOT in the logging document, and that is a decision rather than an
13
+ * omission. That document is about levels and diagnostic windows; a metrics
14
+ * cadence and a table's retention are neither. Two documents that both claim a
15
+ * knob is how this repo has already shipped a switch nobody read.
16
+ *
17
+ * They are cluster-wide, not per-node. Every node emits on the same cadence or
18
+ * the fleet's series cannot be laid over each other, and the table is single
19
+ * and hub-resident, so a per-node retention would be a promise nothing could
20
+ * keep.
21
+ *
22
+ * ## Refused, not clamped
23
+ *
24
+ * A cadence outside 5-60 s is REFUSED. Clamping would silently store 10 when
25
+ * the operator typed 2 and then report 10 back as though it had been accepted
26
+ * — the failure mode where a knob and its readback agree on a value nobody
27
+ * chose. The schema advertises the bounds; this refuses anything else.
28
+ */
29
+ /** Measured bytes per row (legacy load table); still used for cost projection copy. */
30
+ export declare const MEASURED_BYTES_PER_ROW = 87;
31
+ export declare const MIN_CADENCE_SEC = 5;
32
+ export declare const MAX_CADENCE_SEC = 60;
33
+ export declare const DEFAULT_CADENCE_SEC = 10;
34
+ export declare const DEFAULT_RETENTION_HOURS = 6;
35
+ export declare const MIN_RETENTION_HOURS = 1;
36
+ export declare const MAX_RETENTION_HOURS = 72;
37
+ export declare const DEFAULT_MAX_ROWS = 5e5;
1
38
  /** The resolved, in-force configuration. */
2
39
  export interface LoadSeriesConfig {
3
40
  readonly cadenceSec: number;
@@ -35,7 +72,7 @@ export interface LoadSeriesProjection {
35
72
  * This is what makes the knob honest: an operator raising retention to three
36
73
  * days sees the row count and the megabytes BEFORE applying it, rather than
37
74
  * discovering them afterwards. `MEASURED_BYTES_PER_ROW` is measured, not
38
- * guessed — see `load-series-store.ts`.
75
+ * guessed — see `node-metrics-history-recorder.ts`.
39
76
  */
40
77
  export declare function projectLoadSeriesCost(input: {
41
78
  readonly config: LoadSeriesConfig;
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * The ONE reader over both retention tiers.
3
3
  *
4
- * The hot window is the in-memory ring; the cold one is
5
- * `metrics:node-load-samples`. A caller never learns which tier a point came
4
+ * The hot window is the in-memory ring; the cold one is device-history raw
5
+ * points. A caller never learns which tier a point came
6
6
  * from, and that is a hard requirement rather than a nicety: a second reader
7
7
  * is how two charts start disagreeing about the same node, and it is how "the
8
8
  * ring says X, the table says Y" becomes a question nobody can answer.
@@ -25,7 +25,7 @@
25
25
  * interval means one thing — nobody reported — and nothing here fills it in.
26
26
  */
27
27
  import { type LoadPoint } from "@camstack/types";
28
- import type { RetainedSample } from "./load-series-store.js";
28
+ import type { RetainedSample } from "./load-series-types.js";
29
29
  /** One function's assembled series, before it is shaped for the wire. */
30
30
  export interface FoldedSeries {
31
31
  readonly key: string;
@@ -0,0 +1,14 @@
1
+ /** Shared shapes for the load series reader (hot ring + device-history cold tier). */
2
+ export interface RetainedProcess {
3
+ readonly pid: number;
4
+ readonly addonId: string | null;
5
+ readonly classification: string;
6
+ readonly cpuPercent: number;
7
+ readonly memoryRssBytes: number;
8
+ readonly cpuMainPercent: number | null;
9
+ readonly cpuGcPercent: number | null;
10
+ }
11
+ export interface RetainedSample {
12
+ readonly atMs: number;
13
+ readonly processes: readonly RetainedProcess[];
14
+ }
@@ -7,8 +7,8 @@ interface NativeMetricsConfig {
7
7
  * outside — `load-series-config.ts` explains why refused and not clamped.
8
8
  */
9
9
  readonly loadSeriesCadenceSec: number;
10
- /** How long the durable series is KEPT, in hours. The intention; the row
11
- * cap in `load-series-store.ts` is the guarantee. */
10
+ /** How long the durable series is KEPT, in hours. Retention is enforced by
11
+ * device-history (see `node-metrics-history-recorder.ts`). */
12
12
  readonly loadSeriesRetentionHours: number;
13
13
  }
14
14
  /**
@@ -48,7 +48,7 @@ export default class NativeMetricsAddon extends BaseAddon<NativeMetricsConfig> {
48
48
  * the `settings-store` singleton would ship its rows over Moleculer, once
49
49
  * per sample, to reach that very same table.
50
50
  */
51
- private loadStore;
51
+ private metricsHistory;
52
52
  /**
53
53
  * The container's OWN memory, sampled on the process-snapshot tick.
54
54
  *
@@ -60,10 +60,8 @@ export default class NativeMetricsAddon extends BaseAddon<NativeMetricsConfig> {
60
60
  */
61
61
  private memoryProbe;
62
62
  private pidsProbe;
63
- /** Hot tier for the container reading. Bounds in `container-memory-series.ts`. */
63
+ /** Hot tier for the container reading. Bounds in `container-memory-ring.ts`. */
64
64
  private readonly memoryRing;
65
- /** Cold tier, HUB only — same reasoning as `loadStore`. */
66
- private memoryStore;
67
65
  /** The resolved knobs. Re-resolved on every settings write. */
68
66
  private loadConfig;
69
67
  /**
@@ -96,7 +94,7 @@ export default class NativeMetricsAddon extends BaseAddon<NativeMetricsConfig> {
96
94
  * this node has already delivered, and only an accepted sample reaches the
97
95
  * table. That is what makes the append idempotent without a unique index
98
96
  * over two million rows — the composite key it replaces was measured at ~40
99
- * bytes per row (`load-series-store.ts`).
97
+ * bytes per row (measured on the old SQLite tier; see D850).
100
98
  *
101
99
  * The durable append is fire-and-forget: a storage stall must cost a gap in
102
100
  * the cold window, never a blocked event-bus handler. Every failure logs.