@camstack/system 1.2.378 → 1.2.380

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 (119) hide show
  1. package/assets/addon-pages-aggregator/icon.svg +5 -0
  2. package/assets/addon-widgets-aggregator/icon.svg +6 -0
  3. package/assets/alert-center/icon.svg +5 -0
  4. package/assets/autotrack/icon.svg +5 -0
  5. package/assets/backup-orchestrator/icon.svg +5 -0
  6. package/assets/calendars/icon.svg +5 -0
  7. package/assets/camera-grid/icon.svg +10 -0
  8. package/assets/composer/icon.svg +7 -0
  9. package/assets/console-logging/icon.svg +4 -0
  10. package/assets/core-blocks/icon.svg +6 -0
  11. package/assets/device-manager/icon.svg +6 -0
  12. package/assets/filesystem-storage/icon.svg +6 -0
  13. package/assets/hub-forwarder/icon.svg +7 -0
  14. package/assets/keychain/icon.svg +6 -0
  15. package/assets/liveness-monitor/icon.svg +4 -0
  16. package/assets/local-auth/icon.svg +5 -0
  17. package/assets/local-network/icon.svg +7 -0
  18. package/assets/loki-logging/icon.svg +7 -0
  19. package/assets/metrics-native/icon.svg +3 -0
  20. package/assets/platform-probe/icon.svg +5 -0
  21. package/assets/remote-access-orchestrator/icon.svg +5 -0
  22. package/assets/snapshot/icon.svg +4 -0
  23. package/assets/sqlite-settings/icon.svg +5 -0
  24. package/assets/storage-orchestrator/icon.svg +8 -0
  25. package/assets/system-config/icon.svg +4 -0
  26. package/assets/winston-logging/icon.svg +6 -0
  27. package/dist/addon-runner.js +1 -1
  28. package/dist/addon-runner.mjs +1 -1
  29. package/dist/addon-utils.js +1 -1
  30. package/dist/addon-utils.mjs +1 -1
  31. package/dist/auth/auth-manager.d.ts +10 -2
  32. package/dist/auth/jwt-signing-key.d.ts +42 -0
  33. package/dist/auth/user-manager.d.ts +19 -19
  34. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  35. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  36. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  37. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  38. package/dist/builtins/alerts/alerts.addon.js +1 -1
  39. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  40. package/dist/builtins/autotrack/index.js +1 -1
  41. package/dist/builtins/autotrack/index.mjs +1 -1
  42. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  43. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  44. package/dist/builtins/calendars/calendars.addon.js +1 -1
  45. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  46. package/dist/builtins/camera-grid/index.js +1 -1
  47. package/dist/builtins/camera-grid/index.mjs +1 -1
  48. package/dist/builtins/composer/composer.addon.js +2 -2
  49. package/dist/builtins/composer/composer.addon.mjs +2 -2
  50. package/dist/builtins/console-logging/index.js +1 -1
  51. package/dist/builtins/console-logging/index.mjs +1 -1
  52. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  53. package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  54. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  55. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  56. package/dist/builtins/hub-forwarder/index.js +1 -1
  57. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  58. package/dist/builtins/keychain/index.js +34 -4
  59. package/dist/builtins/keychain/index.mjs +34 -4
  60. package/dist/builtins/keychain/keychain-service.d.ts +14 -2
  61. package/dist/builtins/keychain/system-held-secrets.d.ts +11 -0
  62. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  63. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  64. package/dist/builtins/local-auth/admin-account-boot.d.ts +1 -1
  65. package/dist/builtins/local-auth/auth-config-reader.d.ts +9 -7
  66. package/dist/builtins/local-auth/jwt-signing-key-keeper.d.ts +30 -0
  67. package/dist/builtins/local-auth/local-auth.addon.d.ts +2 -6
  68. package/dist/builtins/local-auth/local-auth.addon.js +127 -221
  69. package/dist/builtins/local-auth/local-auth.addon.mjs +126 -220
  70. package/dist/builtins/local-network/local-network.addon.js +1 -1
  71. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  72. package/dist/builtins/loki-logging/index.js +1 -1
  73. package/dist/builtins/loki-logging/index.mjs +1 -1
  74. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  75. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  76. package/dist/builtins/platform-probe/index.js +1 -1
  77. package/dist/builtins/platform-probe/index.mjs +1 -1
  78. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  79. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  80. package/dist/builtins/snapshot/index.js +1 -1
  81. package/dist/builtins/snapshot/index.mjs +1 -1
  82. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  83. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  84. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  85. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  86. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  87. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  88. package/dist/builtins/system-config/cluster-secret-keeper.d.ts +36 -0
  89. package/dist/builtins/system-config/system-config.addon.d.ts +13 -0
  90. package/dist/builtins/system-config/system-config.addon.js +244 -53
  91. package/dist/builtins/system-config/system-config.addon.mjs +244 -54
  92. package/dist/builtins/winston-logging/index.js +1 -1
  93. package/dist/builtins/winston-logging/index.mjs +1 -1
  94. package/dist/{child-cap-dispatch-C9lmrWFT.js → child-cap-dispatch-CZeRUgYF.js} +1 -1
  95. package/dist/{child-cap-dispatch-DpHovtQd.mjs → child-cap-dispatch-CpjohToR.mjs} +1 -1
  96. package/dist/cluster-secret-BDue-uJj.mjs +83 -0
  97. package/dist/cluster-secret-Dg0OOOSr.js +148 -0
  98. package/dist/{composition-sources-CxhGdtdh.js → composition-sources-CHvLMrFI.js} +1 -1
  99. package/dist/{composition-sources-BLBd338N.mjs → composition-sources-DT_uJwI3.mjs} +1 -1
  100. package/dist/{dist-Bvl5JgNt.mjs → dist-B9oFw2jh.mjs} +58 -2
  101. package/dist/{dist-KxsOMQik.js → dist-Cc6KOdY-.js} +69 -1
  102. package/dist/{event-loop-stall-monitor-D8rqSWfW.mjs → event-loop-stall-monitor-anUH2IE1.mjs} +14 -14
  103. package/dist/{event-loop-stall-monitor-CbSmCWkp.js → event-loop-stall-monitor-mk6WGxir.js} +14 -14
  104. package/dist/index.d.ts +4 -2
  105. package/dist/index.js +192 -62
  106. package/dist/index.mjs +171 -55
  107. package/dist/jwt-signing-key-C2rE3wH6.js +174 -0
  108. package/dist/jwt-signing-key-Qhde8r82.mjs +127 -0
  109. package/dist/kernel/config-manager.d.ts +1 -1
  110. package/dist/kernel/config-schema.d.ts +4 -11
  111. package/dist/kernel/index.d.ts +2 -1
  112. package/dist/kernel/moleculer/broker-factory.d.ts +0 -2
  113. package/dist/kernel/moleculer/cluster-secret.d.ts +31 -0
  114. package/dist/kernel/moleculer/hub-service.d.ts +7 -4
  115. package/dist/kernel/moleculer/node-registry.d.ts +1 -1
  116. package/dist/kernel/system-settings-policy.d.ts +7 -9
  117. package/dist/{retired-settings-keys-BAcfvFtm.mjs → retired-settings-keys-DlZ3VV6x.mjs} +1 -1
  118. package/dist/{retired-settings-keys-gTsZfpmP.js → retired-settings-keys-YOOKLA3v.js} +1 -1
  119. package/package.json +55 -3
@@ -0,0 +1,127 @@
1
+ import { br as buildSecretRef } from "./dist-B9oFw2jh.mjs";
2
+ import { randomBytes } from "node:crypto";
3
+ //#region src/auth/jwt-signing-key.ts
4
+ /**
5
+ * The hub's session signing key — the HMAC key every JWT this hub mints
6
+ * (sessions, SSO bridge, TOTP challenges, service tokens) is signed with.
7
+ *
8
+ * It lives in the keychain, owner `system` ({@link JWT_SIGNING_KEY_REF}), and
9
+ * nowhere else: no environment variable, no `config.yaml` key (D797). The
10
+ * hub's `local-auth` builtin loads it after the keychain booted and registers
11
+ * it here; every `AuthManager` in the process asks this slot on every mint and
12
+ * every verify, so a key that arrives (or changes) after construction is used
13
+ * from the next call on.
14
+ *
15
+ * ## A locked keychain fails closed, visibly
16
+ *
17
+ * While the key cannot be read, sessions can be neither minted nor verified:
18
+ * {@link JwtSigningKeySource.current} throws {@link JwtSigningKeyUnavailableError}
19
+ * (a login answers that error, a bearer check reads it as "not authenticated").
20
+ * There is deliberately NO fallback — not an env var, and not a fresh random
21
+ * key, which would invalidate every session and every app token without
22
+ * anyone having asked for it. A key is generated ONLY when the keychain
23
+ * answers that none is stored (`missing`), i.e. on a fresh hub.
24
+ *
25
+ * Process-global through a registered symbol, like the desktop platform key,
26
+ * so a second copy of this module (an addon bundle) sees the same key.
27
+ */
28
+ /** The keychain owner of every system-held secret. */
29
+ var SYSTEM_SECRET_OWNER = "system";
30
+ /** `secret://system/global/jwtSigningKey`. */
31
+ var JWT_SIGNING_KEY_REF = buildSecretRef({
32
+ owner: SYSTEM_SECRET_OWNER,
33
+ scope: { kind: "global" },
34
+ fieldPath: "jwtSigningKey"
35
+ });
36
+ /** Sessions cannot be minted or verified: the signing key is not loaded. */
37
+ var JwtSigningKeyUnavailableError = class extends Error {
38
+ reason;
39
+ constructor(reason) {
40
+ super(`sessions are unavailable: the session signing key could not be read from the keychain (${reason}). Unlock the keychain (System → Secrets, or fix keychain.keyFile and restart).`);
41
+ this.reason = reason;
42
+ this.name = "JwtSigningKeyUnavailableError";
43
+ }
44
+ };
45
+ var SLOT = Symbol.for("camstack.auth.jwt-signing-key");
46
+ var NOT_LOADED = {
47
+ state: "unavailable",
48
+ reason: "not-loaded"
49
+ };
50
+ function isState(value) {
51
+ if (value === null || typeof value !== "object") return false;
52
+ const state = Reflect.get(value, "state");
53
+ if (state === "ready") return typeof Reflect.get(value, "key") === "string";
54
+ return state === "unavailable" && typeof Reflect.get(value, "reason") === "string";
55
+ }
56
+ /** Register the loaded (or unloadable) key. Called by the hub's `local-auth`. */
57
+ function setProcessJwtSigningKey(state) {
58
+ Reflect.set(globalThis, SLOT, state);
59
+ }
60
+ function getProcessJwtSigningKeyState() {
61
+ const value = Reflect.get(globalThis, SLOT);
62
+ return isState(value) ? value : NOT_LOADED;
63
+ }
64
+ /** The process slot — the default source of every `AuthManager`. */
65
+ var processJwtSigningKey = { current() {
66
+ const state = getProcessJwtSigningKeyState();
67
+ if (state.state === "ready") return state.key;
68
+ throw new JwtSigningKeyUnavailableError(state.reason);
69
+ } };
70
+ /** A fixed key — tests, and nothing else. */
71
+ function staticJwtSigningKey(key) {
72
+ return { current: () => key };
73
+ }
74
+ /** 32 random bytes, hex. */
75
+ function generateJwtSigningKey() {
76
+ return randomBytes(32).toString("hex");
77
+ }
78
+ /**
79
+ * Read the key from the keychain; generate and store one ONLY when the
80
+ * keychain answers that none exists. Never throws.
81
+ */
82
+ async function loadJwtSigningKey(deps) {
83
+ let entry;
84
+ try {
85
+ entry = (await deps.secrets.resolve([JWT_SIGNING_KEY_REF]))[JWT_SIGNING_KEY_REF];
86
+ } catch (err) {
87
+ return {
88
+ state: "unavailable",
89
+ reason: err instanceof Error ? err.message : String(err)
90
+ };
91
+ }
92
+ if (entry === void 0) return {
93
+ state: "unavailable",
94
+ reason: "no-answer"
95
+ };
96
+ switch (entry.kind) {
97
+ case "value": return {
98
+ state: "ready",
99
+ key: entry.value
100
+ };
101
+ case "unavailable": return {
102
+ state: "unavailable",
103
+ reason: entry.reason
104
+ };
105
+ case "forbidden": return {
106
+ state: "unavailable",
107
+ reason: "forbidden"
108
+ };
109
+ case "missing": {
110
+ const key = (deps.generate ?? generateJwtSigningKey)();
111
+ try {
112
+ await deps.secrets.put(JWT_SIGNING_KEY_REF, key);
113
+ } catch (err) {
114
+ return {
115
+ state: "unavailable",
116
+ reason: `could not store a new key: ${err instanceof Error ? err.message : String(err)}`
117
+ };
118
+ }
119
+ return {
120
+ state: "ready",
121
+ key
122
+ };
123
+ }
124
+ }
125
+ }
126
+ //#endregion
127
+ export { loadJwtSigningKey as a, staticJwtSigningKey as c, getProcessJwtSigningKeyState as i, JwtSigningKeyUnavailableError as n, processJwtSigningKey as o, SYSTEM_SECRET_OWNER as r, setProcessJwtSigningKey as s, JWT_SIGNING_KEY_REF as t };
@@ -82,7 +82,7 @@ export declare class ConfigManager {
82
82
  * implementation (sqlite, redis, in-memory, …) behaves identically here.
83
83
  *
84
84
  * D675: a bootstrap-owned section takes ONLY allow-listed keys from the
85
- * store (a stored `auth.jwtSecret` never replaces env), and with only the
85
+ * store (a stale stored `auth.jwtSecret` never answers), and with only the
86
86
  * door wired this sync read THROWS — the settings view's `getSection` reads
87
87
  * the door.
88
88
  */
@@ -1,11 +1,8 @@
1
1
  import { z } from 'zod';
2
2
  /** Default data directory — used when CAMSTACK_DATA env var is not set */
3
3
  export declare const DEFAULT_DATA_PATH = "camstack-data";
4
- /**
5
- * The admin password seeded on first boot when none is configured. A SEED
6
- * only: it never overwrites an existing account's password (`ensureAdminExists`).
7
- */
8
- export declare const DEFAULT_ADMIN_PASSWORD = "changeme";
4
+ /** `auth.*` keys a pre-D797 config.yaml may still carry; ignored, and warned about. */
5
+ export declare const RETIRED_AUTH_CONFIG_KEYS: readonly ["jwtSecret", "adminUsername", "adminPassword"];
9
6
  /** Bootstrap config -- loaded from config.yaml ONLY at startup.
10
7
  * All other settings live in SQL (system_settings table). */
11
8
  export declare const bootstrapSchema: z.ZodObject<{
@@ -19,11 +16,7 @@ export declare const bootstrapSchema: z.ZodObject<{
19
16
  dataPath: z.ZodDefault<z.ZodString>;
20
17
  corsOrigins: z.ZodDefault<z.ZodPreprocess<z.ZodArray<z.ZodString>>>;
21
18
  }, z.core.$strip>>;
22
- auth: z.ZodDefault<z.ZodObject<{
23
- jwtSecret: z.ZodDefault<z.ZodNullable<z.ZodString>>;
24
- adminUsername: z.ZodDefault<z.ZodString>;
25
- adminPassword: z.ZodDefault<z.ZodString>;
26
- }, z.core.$strip>>;
19
+ auth: z.ZodDefault<z.ZodObject<{}, z.core.$strip>>;
27
20
  hub: z.ZodDefault<z.ZodObject<{
28
21
  url: z.ZodDefault<z.ZodString>;
29
22
  token: z.ZodDefault<z.ZodString>;
@@ -38,8 +31,8 @@ export declare const bootstrapSchema: z.ZodObject<{
38
31
  bootstrap: z.ZodDefault<z.ZodObject<{
39
32
  settingsStoreAddon: z.ZodDefault<z.ZodString>;
40
33
  installSource: z.ZodOptional<z.ZodEnum<{
41
- npm: "npm";
42
34
  local: "local";
35
+ npm: "npm";
43
36
  symlink: "symlink";
44
37
  }>>;
45
38
  requiredAddons: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -52,7 +52,8 @@ export { HubNodeRegistry } from './moleculer/node-registry.js';
52
52
  export type { CallFn, NodeRootPackageInfo, RegisteredAddonManifest, RegisteredNativeCap, RegisterNodeParams, RegisterNodeResult, NodeCapEntry, NodeNativeCapEntry, } from './moleculer/node-registry.js';
53
53
  export { callRegisterNodeWithRetry, buildNodeManifest } from './moleculer/register-node-client.js';
54
54
  export type { RegisterNodeBroker, CallRegisterNodeOptions, } from './moleculer/register-node-client.js';
55
- export { hashClusterSecret, clusterSecretMatches, isClusterSecretMismatchError, CLUSTER_SECRET_MISMATCH_TYPE, CLUSTER_SECRET_REJECTED_EXIT_CODE, } from './moleculer/cluster-secret.js';
55
+ export { hashClusterSecret, clusterSecretMatches, isClusterSecretMismatchError, CLUSTER_SECRET_MISMATCH_TYPE, CLUSTER_SECRET_REJECTED_EXIT_CODE, CLUSTER_SECRET_REF, CLUSTER_SECRET_SETTINGS_KEY, CLUSTER_SECRET_UNAVAILABLE_TYPE, checkClusterSecret, getProcessClusterSecretGate, setProcessClusterSecretGate, } from './moleculer/cluster-secret.js';
56
+ export type { ClusterSecretGate, ClusterSecretVerdict } from './moleculer/cluster-secret.js';
56
57
  export { serializeTypedArrays } from './moleculer/typed-array-serde.js';
57
58
  export { createReadinessService, createReadinessServiceForRegistry, AGENT_READINESS_SERVICE_NAME, } from './moleculer/readiness-service.js';
58
59
  export type { ReadinessServiceDeps } from './moleculer/readiness-service.js';
@@ -4,8 +4,6 @@ interface BrokerConfig {
4
4
  readonly mode: 'hub' | 'agent' | 'test';
5
5
  readonly hubAddress?: string;
6
6
  readonly logLevel?: string;
7
- /** Shared secret — used as Moleculer namespace to isolate the cluster on the network */
8
- readonly secret?: string;
9
7
  /**
10
8
  * TCP port the hub listens on for cluster traffic.
11
9
  * Agents need a deterministic port to connect via `urls: 'hub@host:port'`
@@ -1,3 +1,7 @@
1
+ /** The keychain ref of the hub's cluster secret: `secret://system/global/clusterSecret`. */
2
+ export declare const CLUSTER_SECRET_REF: string;
3
+ /** The `system-settings` key whose value is the cluster secret's keychain marker. */
4
+ export declare const CLUSTER_SECRET_SETTINGS_KEY = "cluster.clusterSecret";
1
5
  /** Moleculer error `type` marking a registration rejected for a bad cluster secret. */
2
6
  export declare const CLUSTER_SECRET_MISMATCH_TYPE = "CLUSTER_SECRET_MISMATCH";
3
7
  /** Process exit code a runner uses when its registration is rejected for a bad secret. */
@@ -13,3 +17,30 @@ export declare function hashClusterSecret(secret: string): string;
13
17
  export declare function clusterSecretMatches(expectedHash: string | undefined, presentedHash: string | undefined): boolean;
14
18
  /** Recognises a cluster-secret rejection, including after a Moleculer RPC round-trip. */
15
19
  export declare function isClusterSecretMismatchError(err: unknown): boolean;
20
+ /** Moleculer error `type` of a registration refused because the hub cannot read its own secret yet. */
21
+ export declare const CLUSTER_SECRET_UNAVAILABLE_TYPE = "CLUSTER_SECRET_UNAVAILABLE";
22
+ /**
23
+ * What the hub knows about its own cluster secret:
24
+ * - `off`: none is set — every node may register (the behaviour of a hub
25
+ * that never had a secret);
26
+ * - `on`: set — a node must present the matching hash;
27
+ * - `unknown`: one is set (the marker exists) but the keychain cannot answer
28
+ * yet — registrations are refused with a RETRYABLE error until it does.
29
+ * Fail closed: a locked keychain never opens the gate.
30
+ */
31
+ export type ClusterSecretGate = {
32
+ readonly kind: 'off';
33
+ } | {
34
+ readonly kind: 'on';
35
+ readonly hash: string;
36
+ } | {
37
+ readonly kind: 'unknown';
38
+ readonly reason: string;
39
+ };
40
+ export type ClusterSecretVerdict = 'allow' | 'mismatch' | 'unavailable';
41
+ export declare function checkClusterSecret(gate: ClusterSecretGate, presentedHash: string | undefined): ClusterSecretVerdict;
42
+ /** Register the hub's gate. Called by `system-config`, which owns the field. */
43
+ export declare function setProcessClusterSecretGate(gate: ClusterSecretGate): void;
44
+ export declare function clearProcessClusterSecretGate(): void;
45
+ /** The hub's gate; `unknown` until `system-config` loaded it. */
46
+ export declare function getProcessClusterSecretGate(): ClusterSecretGate;
@@ -1,6 +1,7 @@
1
1
  import { ServiceSchema } from 'moleculer';
2
2
  import { LogTags } from '@camstack/types';
3
3
  import { RegisterNodeParams } from './node-registry.js';
4
+ import { ClusterSecretGate } from './cluster-secret.js';
4
5
  interface HubServiceDeps {
5
6
  readonly getAddonConfig: (addonId: string) => unknown;
6
7
  readonly getSettings: (scope: string, key?: string) => unknown;
@@ -24,11 +25,13 @@ interface HubServiceDeps {
24
25
  /** Explicit deregistration (graceful shutdown). `$node.disconnected` covers crashes. */
25
26
  readonly onUnregisterNode?: (nodeId: string) => void;
26
27
  /**
27
- * SHA-256 hash of the hub's own `CAMSTACK_CLUSTER_SECRET`, or `undefined`
28
- * when no secret is configured. When set, `$hub.registerNode` rejects any
29
- * node not presenting a matching `clusterSecretHash`. (Cluster-secret gate.)
28
+ * The hub's cluster-secret gate, read on EVERY registration (the secret
29
+ * lives in the keychain and may be set or changed at runtime — D797):
30
+ * `off` lets every node in, `on` requires the matching `clusterSecretHash`,
31
+ * `unknown` (the keychain cannot answer yet) refuses with a retryable error.
32
+ * Absent → `off` (test brokers); the hub always passes the keychain's gate.
30
33
  */
31
- readonly expectedClusterSecretHash?: string;
34
+ readonly clusterSecretGate?: () => ClusterSecretGate;
32
35
  }
33
36
  declare function createHubService(deps: HubServiceDeps): ServiceSchema;
34
37
  export { createHubService };
@@ -56,7 +56,7 @@ interface RegisterNodeParams {
56
56
  */
57
57
  readonly nativeCaps?: readonly RegisteredNativeCap[];
58
58
  /**
59
- * SHA-256 hash of the node's `CAMSTACK_CLUSTER_SECRET`. Optional — absent
59
+ * SHA-256 hash of the node's cluster secret. Optional — absent
60
60
  * when the node has no secret configured. Verified by the `registerNode`
61
61
  * receiver; never carries the raw secret. (Cluster-secret registration gate.)
62
62
  */
@@ -2,16 +2,14 @@
2
2
  * Which `system-settings` keys the STORE may answer, and which the kernel
3
3
  * loads from the door into memory at boot — D675.
4
4
  *
5
- * ## The store never outranks env + config.yaml for a bootstrap section
5
+ * ## The store never answers for a bootstrap section
6
6
  *
7
- * `system-settings` holds, among other things, `auth.jwtSecret`,
8
- * `auth.adminUsername` and `auth.adminPassword` — written there by
9
- * `local-auth` (and by older builds) next to `auth.tokenExpiry`. The live
10
- * container supplies the same three from env (`CAMSTACK_JWT_SECRET`,
11
- * `CAMSTACK_ADMIN_USER`, `CAMSTACK_ADMIN_PASS`). While the store layer was
12
- * skipped (every read since D231) env won by accident. Merging the store back
13
- * in "highest priority" would let a stale DB copy replace the JWT secret —
14
- * invalidating every token — and change the login password.
7
+ * `system-settings` may still hold `auth.jwtSecret`, `auth.adminUsername` and
8
+ * `auth.adminPassword` — written there by `local-auth` (and by older builds)
9
+ * next to `auth.tokenExpiry`. Since D797 none of the three is a setting at
10
+ * all (the signing key is the keychain's, the first-boot admin is fixed), and
11
+ * the stale rows must still never answer: merging them back in would let a
12
+ * stale DB copy stand in for a credential. The one-off ops script deletes them.
15
13
  *
16
14
  * So a bootstrap-owned section is answered from env + config.yaml ONLY, and
17
15
  * the store may add exactly the keys in {@link STORE_READABLE_BOOTSTRAP_KEYS}:
@@ -1,4 +1,4 @@
1
- import { _r as asJsonObject } from "./dist-Bvl5JgNt.mjs";
1
+ import { _r as asJsonObject } from "./dist-B9oFw2jh.mjs";
2
2
  //#region src/builtins/sqlite-storage/retired-settings-keys.ts
3
3
  /**
4
4
  * Is THIS node the one whose settings store is the cluster's authority?
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-KxsOMQik.js");
1
+ const require_dist = require("./dist-Cc6KOdY-.js");
2
2
  //#region src/builtins/sqlite-storage/retired-settings-keys.ts
3
3
  /**
4
4
  * Is THIS node the one whose settings store is the cluster's authority?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.2.378",
3
+ "version": "1.2.380",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",
@@ -38,6 +38,8 @@
38
38
  "id": "filesystem-storage",
39
39
  "category": "system",
40
40
  "name": "Filesystem Storage",
41
+ "icon": "assets/filesystem-storage/icon.svg",
42
+ "color": "#0d9488",
41
43
  "entry": "./dist/builtins/sqlite-storage/filesystem-storage.addon.js",
42
44
  "capabilities": [
43
45
  {
@@ -52,6 +54,8 @@
52
54
  "id": "sqlite-settings",
53
55
  "category": "system",
54
56
  "name": "SQLite Settings",
57
+ "icon": "assets/sqlite-settings/icon.svg",
58
+ "color": "#0d9488",
55
59
  "entry": "./dist/builtins/sqlite-storage/sqlite-settings.addon.js",
56
60
  "description": "The relational ENGINE behind the data door (SQLite WAL). Registers `data-store-provider`, an internal collection cap; the public `settings-store` door is owned by `storage-orchestrator`, which dispatches here. Callers never reach this addon directly — that is what makes the engine replaceable. It ALSO registers `vector-store` (sqlite-vec) from the same database file and the same open handle, and `database-snapshot`: the verified copy of its database that the nightly backup archives in place of the live files, written by this runner on a thread over its own connection. Runs in its OWN process (`execution.isolate`) — `better-sqlite3` `Statement.run` does not belong on the event loop that serves the API.",
57
61
  "execution": {
@@ -75,6 +79,8 @@
75
79
  "id": "winston-logging",
76
80
  "category": "system",
77
81
  "name": "Winston Logging",
82
+ "icon": "assets/winston-logging/icon.svg",
83
+ "color": "#64748b",
78
84
  "entry": "./dist/builtins/winston-logging/index.js",
79
85
  "capabilities": [
80
86
  {
@@ -86,6 +92,8 @@
86
92
  "id": "console-logging",
87
93
  "category": "system",
88
94
  "name": "Console Logging",
95
+ "icon": "assets/console-logging/icon.svg",
96
+ "color": "#64748b",
89
97
  "entry": "./dist/builtins/console-logging/index.js",
90
98
  "capabilities": [
91
99
  {
@@ -97,6 +105,8 @@
97
105
  "id": "loki-logging",
98
106
  "category": "system",
99
107
  "name": "Loki Logging",
108
+ "icon": "assets/loki-logging/icon.svg",
109
+ "color": "#64748b",
100
110
  "description": "Opt-in log destination — batches this node's log entries and pushes them to a Grafana Loki instance via /loki/api/v1/push. Registered always, inert until enabled with a URL.",
101
111
  "entry": "./dist/builtins/loki-logging/index.js",
102
112
  "capabilities": [
@@ -109,6 +119,8 @@
109
119
  "id": "hub-forwarder",
110
120
  "category": "system",
111
121
  "name": "Hub Log Forwarder",
122
+ "icon": "assets/hub-forwarder/icon.svg",
123
+ "color": "#64748b",
112
124
  "description": "Agent-only log destination — forwards every log entry to the hub via the cluster broker. Never runs on the hub itself (the hub already owns the log-receiver, registering hub-forwarder there would create a write→ingest→write feedback loop).",
113
125
  "entry": "./dist/builtins/hub-forwarder/index.js",
114
126
  "execution": {
@@ -124,6 +136,8 @@
124
136
  "id": "backup-orchestrator",
125
137
  "category": "system",
126
138
  "name": "Backup Orchestrator",
139
+ "icon": "assets/backup-orchestrator/icon.svg",
140
+ "color": "#0d9488",
127
141
  "description": "System singleton that owns the schedule, builds the archive once, and fans it out to every enabled `backup-destination` provider (local, S3, rsync, …). In-process on hub root — aggregator over a cluster collection, no native deps.",
128
142
  "entry": "./dist/builtins/backup-orchestrator/index.js",
129
143
  "protected": true,
@@ -147,6 +161,8 @@
147
161
  "id": "storage-orchestrator",
148
162
  "category": "system",
149
163
  "name": "Storage Orchestrator",
164
+ "icon": "assets/storage-orchestrator/icon.svg",
165
+ "color": "#0d9488",
150
166
  "description": "The single data door. Owns the consumer-facing `storage` cap for bytes — the `locationId → StorageLocation` map, `StorageLocationRef` resolution, dispatch to the matching `storage-provider` registrant (`filesystem-storage` today; SFTP / S3 / WebDAV plug in alongside) — AND the `settings-store` cap for rows, dispatching to the `data-store-provider` engine (`sqlite-settings` today; a vector engine plugs in alongside). Nothing reaches an engine except through this addon.",
151
167
  "entry": "./dist/builtins/storage-orchestrator/index.js",
152
168
  "protected": true,
@@ -166,6 +182,8 @@
166
182
  "id": "keychain",
167
183
  "category": "system",
168
184
  "name": "Keychain",
185
+ "icon": "assets/keychain/icon.svg",
186
+ "color": "#0d9488",
169
187
  "description": "Hub-only store of every secret value. Settings blobs hold a marker; the value lives here, AES-256-GCM under a data key wrapped by a master key whose location is configuration (config.yaml `keychain.keyFile`, the desktop OS keychain, else the data-dir default). Registers `keychain` (internal, owner-checked against the transport-stamped caller) and `keychain-admin` (System → Secrets). Boots in the infrastructure pass, right after the settings door.",
170
188
  "entry": "./dist/builtins/keychain/index.js",
171
189
  "protected": true,
@@ -182,6 +200,8 @@
182
200
  "id": "metrics-native",
183
201
  "category": "system",
184
202
  "name": "Native Metrics",
203
+ "icon": "assets/metrics-native/icon.svg",
204
+ "color": "#d97706",
185
205
  "entry": "./dist/builtins/native-metrics/native-metrics.addon.js",
186
206
  "capabilities": [
187
207
  {
@@ -193,6 +213,8 @@
193
213
  "id": "snapshot",
194
214
  "category": "system",
195
215
  "name": "Snapshot",
216
+ "icon": "assets/snapshot/icon.svg",
217
+ "color": "#7c3aed",
196
218
  "description": "Owns every camera's latest frame: the capture ladder (vendor native → ffmpeg keyframe grab off the stream-broker restream), the sharp resize, the courtesy frame for a camera that cannot answer, and the two HTTP planes the clients actually fetch bytes from. Runs in its OWN process (`execution.isolate`) — capture, transcode and byte caches do not belong on the event loop that serves the API.",
197
219
  "entry": "./dist/builtins/snapshot/index.js",
198
220
  "execution": {
@@ -210,6 +232,8 @@
210
232
  "id": "autotrack",
211
233
  "category": "system",
212
234
  "name": "PTZ Autotrack (emulated)",
235
+ "icon": "assets/autotrack/icon.svg",
236
+ "color": "#7c3aed",
213
237
  "description": "Wrapper over the `ptz-autotrack` cap — follows a subject with self-terminating `ptz.move` pulses on cameras whose firmware has no autotrack, driven by the detection pipeline's tracked boxes. The operator binds it per camera, then uses the SAME autotrack switch a native camera has: the binding chooses the implementation, never a second toggle. It refuses to move without a readable `moveImpulseMs`, and while a firmware autotrack on the same camera reports armed. Runs IN-PROCESS: it spawns nothing, carries no frames and issues a command every few seconds at most.",
214
238
  "entry": "./dist/builtins/autotrack/index.js",
215
239
  "capabilities": [
@@ -222,6 +246,8 @@
222
246
  "id": "alert-center",
223
247
  "category": "system",
224
248
  "name": "Alert Center",
249
+ "icon": "assets/alert-center/icon.svg",
250
+ "color": "#d97706",
225
251
  "entry": "./dist/builtins/alerts/index.js",
226
252
  "capabilities": [
227
253
  {
@@ -233,6 +259,8 @@
233
259
  "id": "liveness-monitor",
234
260
  "category": "system",
235
261
  "name": "Liveness Monitor",
262
+ "icon": "assets/liveness-monitor/icon.svg",
263
+ "color": "#d97706",
236
264
  "description": "Asserts that this node is actually working — it has devices, its cameras are online, and a camera that was recording has not silently stopped. Raises one persistent alert per fault and dismisses it on recovery. Exists because the hub once ran four hours with no devices and no recordings while every surface stayed quiet.",
237
265
  "entry": "./dist/builtins/liveness-monitor/index.js",
238
266
  "protected": true,
@@ -242,6 +270,8 @@
242
270
  "id": "system-config",
243
271
  "category": "system",
244
272
  "name": "System Config",
273
+ "icon": "assets/system-config/icon.svg",
274
+ "color": "#4f46e5",
245
275
  "description": "Exposes the cluster-wide yml-backed configuration sections (server, auth) via the three-level settings API. Hub-only.",
246
276
  "entry": "./dist/builtins/system-config/index.js",
247
277
  "protected": true
@@ -250,6 +280,8 @@
250
280
  "id": "calendars",
251
281
  "category": "system",
252
282
  "name": "Calendars",
283
+ "icon": "assets/calendars/icon.svg",
284
+ "color": "#4f46e5",
253
285
  "description": "Hub-only singleton that aggregates `calendar-source` providers (Home Assistant and future addon sources) and exposes listCalendars / listEvents / importFromHomeAssistant.",
254
286
  "entry": "./dist/builtins/calendars/index.js",
255
287
  "protected": true,
@@ -263,6 +295,8 @@
263
295
  "id": "addon-pages-aggregator",
264
296
  "category": "system",
265
297
  "name": "Addon Pages Aggregator",
298
+ "icon": "assets/addon-pages-aggregator/icon.svg",
299
+ "color": "#4f46e5",
266
300
  "description": "Hub-only singleton that aggregates `addon-pages-source` (collection) providers and emits the public `addon-pages.listPages` surface with versioned bundleUrls.",
267
301
  "entry": "./dist/builtins/addon-pages-aggregator/index.js",
268
302
  "protected": true,
@@ -276,6 +310,8 @@
276
310
  "id": "addon-widgets-aggregator",
277
311
  "category": "system",
278
312
  "name": "Addon Widgets Aggregator",
313
+ "icon": "assets/addon-widgets-aggregator/icon.svg",
314
+ "color": "#4f46e5",
279
315
  "description": "Hub-only singleton that aggregates `addon-widgets-source` (collection) providers and emits the public `addon-widgets.listWidgets` surface with versioned bundleUrls.",
280
316
  "entry": "./dist/builtins/addon-widgets-aggregator/index.js",
281
317
  "protected": true,
@@ -289,6 +325,8 @@
289
325
  "id": "device-manager",
290
326
  "category": "system",
291
327
  "name": "Device Manager",
328
+ "icon": "assets/device-manager/icon.svg",
329
+ "color": "#4f46e5",
292
330
  "description": "Hub-side singleton that unifies device persistence and management. Uses ctx.settings for storage — no direct SQLite access. Replaces device-persistence cap (Phase 2 will delete device-persistence once all consumers are migrated).",
293
331
  "entry": "./dist/builtins/device-manager/index.js",
294
332
  "protected": true,
@@ -308,6 +346,8 @@
308
346
  "id": "local-auth",
309
347
  "category": "system",
310
348
  "name": "Local Auth",
349
+ "icon": "assets/local-auth/icon.svg",
350
+ "color": "#e11d48",
311
351
  "description": "Built-in local username/password authentication. Implements the auth-provider capability as the default login path. OIDC and other providers can register alongside via the same capability.",
312
352
  "entry": "./dist/builtins/local-auth/index.js",
313
353
  "protected": true,
@@ -324,6 +364,8 @@
324
364
  "id": "platform-probe",
325
365
  "category": "system",
326
366
  "name": "Platform Probe (Native)",
367
+ "icon": "assets/platform-probe/icon.svg",
368
+ "color": "#d97706",
327
369
  "description": "Probes hardware and inference runtimes on the local node. Registers the `platform-probe` capability consumed by every inference addon on this node.",
328
370
  "entry": "./dist/builtins/platform-probe/index.js",
329
371
  "protected": true,
@@ -340,6 +382,8 @@
340
382
  "id": "local-network",
341
383
  "category": "system",
342
384
  "name": "Local Network",
385
+ "icon": "assets/local-network/icon.svg",
386
+ "color": "#2563eb",
343
387
  "description": "Enumerates the hub's network interfaces, classifies them (LAN / Wi-Fi / Docker / VPN / loopback), and ranks connection-endpoints for SDK clients. Hub-only — agents are not directly addressable.",
344
388
  "entry": "./dist/builtins/local-network/index.js",
345
389
  "protected": true,
@@ -353,6 +397,8 @@
353
397
  "id": "remote-access-orchestrator",
354
398
  "category": "system",
355
399
  "name": "Remote Access Orchestrator",
400
+ "icon": "assets/remote-access-orchestrator/icon.svg",
401
+ "color": "#2563eb",
356
402
  "description": "Hub-only singleton facade over the network-access collection (Cloudflare Tunnel, ngrok, …). Surfaces a unified provider list to the admin UI's Remote Access page.",
357
403
  "entry": "./dist/builtins/remote-access-orchestrator/index.js",
358
404
  "protected": true,
@@ -366,6 +412,8 @@
366
412
  "id": "core-blocks",
367
413
  "category": "system",
368
414
  "name": "Core Blocks",
415
+ "icon": "assets/core-blocks/icon.svg",
416
+ "color": "#ea580c",
369
417
  "description": "Store and type-check user-authored TypeScript that owns devices with an addon's own ctx. Admin-only: a block is a plugin with no review step, so it is process-isolated when it runs. This slice stores and serves; execution is the runner.",
370
418
  "entry": "./dist/builtins/core-blocks/index.js",
371
419
  "protected": true,
@@ -379,6 +427,8 @@
379
427
  "id": "composer",
380
428
  "category": "system",
381
429
  "name": "Composer",
430
+ "icon": "assets/composer/icon.svg",
431
+ "color": "#ea580c",
382
432
  "description": "Runs every DECLARATIVE composition (a core block whose source is `composition`): declares the composed device under the shared Blocks integration, registers its caps natively, and derives each field from other devices' state by `from` / expression — event-driven, no polling. Hub-only. Runs in its OWN runner (`execution.isolate` + `group: composer`): frame-free and low-crash, grouped with no device provider or data plane.",
383
433
  "entry": "./dist/builtins/composer/index.js",
384
434
  "protected": true,
@@ -398,9 +448,10 @@
398
448
  "id": "camera-grid",
399
449
  "category": "system",
400
450
  "name": "Camera Grids",
451
+ "icon": "assets/camera-grid/icon.svg",
452
+ "color": "#7c3aed",
401
453
  "description": "Composite cameras: several cameras composed into one fixed picture and emitted as an ordinary camera — recorded, played back and bound like any other. The composition runs only while something is consuming it; object detection is switched off on a new grid because the cameras it is composed from are already analysed. Runs in its OWN process (`execution.isolate`): it spawns an ffmpeg per live composition and relays its bytes, and neither belongs on the event loop that serves the API.",
402
454
  "entry": "./dist/builtins/camera-grid/index.js",
403
- "color": "#7c3aed",
404
455
  "instanceMode": "unique",
405
456
  "execution": {
406
457
  "isolate": true,
@@ -419,7 +470,8 @@
419
470
  ]
420
471
  },
421
472
  "files": [
422
- "dist"
473
+ "dist",
474
+ "assets"
423
475
  ],
424
476
  "scripts": {
425
477
  "copy:hook": "node -e \"const fs=require('fs'),p=require('path');const dst=p.join('dist');fs.mkdirSync(dst,{recursive:true});fs.copyFileSync(p.join('src','kernel','moleculer','framework-resolver-hook.mjs'),p.join(dst,'framework-resolver-hook.mjs'));console.log('copied framework-resolver-hook.mjs ->',dst)\"",