@camstack/server 1.2.798 → 1.2.800

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 (98) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/boot/boot-config.js +5 -6
  3. package/dist/main.js +6 -11
  4. package/dist/manual-boot.js +2 -4
  5. package/dist/pending-restore.js +8 -0
  6. package/package.json +7 -8
  7. package/system/dist/addon-runner.js +3 -3
  8. package/system/dist/addon-runner.mjs +3 -3
  9. package/system/dist/{agent-https-LDtzwOC3.mjs → agent-https-BAH8C9GM.mjs} +1 -1
  10. package/system/dist/{agent-https-dPSUE1iZ.js → agent-https-RIQ3lut4.js} +1 -1
  11. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  12. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  13. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  14. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  15. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  16. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  17. package/system/dist/builtins/autotrack/index.js +1 -1
  18. package/system/dist/builtins/autotrack/index.mjs +1 -1
  19. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  20. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  21. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  22. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  23. package/system/dist/builtins/camera-grid/index.js +1 -1
  24. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  25. package/system/dist/builtins/composer/composer.addon.js +3 -3
  26. package/system/dist/builtins/composer/composer.addon.mjs +3 -3
  27. package/system/dist/builtins/console-logging/index.js +1 -1
  28. package/system/dist/builtins/console-logging/index.mjs +1 -1
  29. package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
  30. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
  31. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  32. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  33. package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
  34. package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  35. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  36. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  37. package/system/dist/builtins/keychain/index.js +4 -4
  38. package/system/dist/builtins/keychain/index.mjs +4 -4
  39. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  40. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  41. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  42. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  43. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  44. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  45. package/system/dist/builtins/loki-logging/index.js +1 -1
  46. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  47. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  48. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  49. package/system/dist/builtins/platform-probe/index.js +1 -1
  50. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  51. package/system/dist/builtins/record-entries/index.js +1 -1
  52. package/system/dist/builtins/record-entries/index.mjs +1 -1
  53. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  54. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  55. package/system/dist/builtins/snapshot/index.js +1 -1
  56. package/system/dist/builtins/snapshot/index.mjs +1 -1
  57. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  58. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  59. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  60. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  61. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  62. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  63. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  64. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  65. package/system/dist/builtins/system-backup/system-backup.service.d.ts +1 -1
  66. package/system/dist/builtins/system-config/system-config.addon.js +9 -9
  67. package/system/dist/builtins/system-config/system-config.addon.mjs +9 -9
  68. package/system/dist/builtins/winston-logging/index.js +1 -1
  69. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  70. package/system/dist/{capture-engine-B-X0ZNPG.js → capture-engine-CQzuDOjQ.js} +1 -1
  71. package/system/dist/{capture-engine-ek8d0K7v.mjs → capture-engine-DjCOsYGG.mjs} +1 -1
  72. package/system/dist/{composition-sources-Dr69aWyC.mjs → composition-sources-CVANj84Y.mjs} +1 -1
  73. package/system/dist/{composition-sources-DGKK9sGT.js → composition-sources-DHd3GBBX.js} +1 -1
  74. package/system/dist/{constants-CAlOFVXO.mjs → constants-DKszZoAC.mjs} +1 -1
  75. package/system/dist/{constants-DuVFATnX.js → constants-DjZvX7em.js} +1 -1
  76. package/system/dist/{device-ca-CJyaKA2l.js → device-ca-DtYudkE1.js} +1 -1
  77. package/system/dist/{device-ca-FfLv_YPi.mjs → device-ca-XCnTGi5h.mjs} +1 -1
  78. package/system/dist/{dist-CJoLQeEj.js → dist-Z_rnH_d0.js} +5 -1
  79. package/system/dist/{dist-Dgkqkron.mjs → dist-o_M5WSYU.mjs} +5 -1
  80. package/system/dist/file-host-worker.js +1 -1
  81. package/system/dist/file-host-worker.mjs +1 -1
  82. package/system/dist/{hub-mdns-ciao-q3IAAxK6.js → hub-mdns-ciao-Bl5j8wrj.js} +2 -2
  83. package/system/dist/{hub-mdns-ciao-Bczd9NSt.mjs → hub-mdns-ciao-CA6iSuS1.mjs} +2 -2
  84. package/system/dist/index.js +198 -75
  85. package/system/dist/index.mjs +198 -75
  86. package/system/dist/kernel/bootstrap-config.d.ts +11 -6
  87. package/system/dist/kernel/config-manager.d.ts +5 -5
  88. package/system/dist/kernel/config-schema.d.ts +3 -4
  89. package/system/dist/kernel/legacy-config-yaml.d.ts +37 -0
  90. package/system/dist/kernel/sections-store.d.ts +1 -1
  91. package/system/dist/kernel/system-settings-policy.d.ts +1 -1
  92. package/system/dist/{legacy-integration-rows-door-CfpoIqz-.js → legacy-integration-rows-door-DoR0o565.js} +1 -1
  93. package/system/dist/{legacy-integration-rows-door-CTCq-5la.mjs → legacy-integration-rows-door-dQUzxTo_.mjs} +1 -1
  94. package/system/dist/{restore-archive-HS5O901O.js → restore-archive-CAAEnwaO.js} +1 -2
  95. package/system/dist/{restore-archive-DfFB1J2w.mjs → restore-archive-Cqm3OJpy.mjs} +1 -2
  96. package/system/dist/{wal-maintenance-DHtTtKh4.js → wal-maintenance-Cjg3kYzJ.js} +0 -0
  97. package/system/dist/{wal-maintenance-D5xF2jrM.mjs → wal-maintenance-UVhlv-i5.mjs} +0 -0
  98. package/system/package.json +1 -1
@@ -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-CJoLQeEj.js");
4
- const require_device_ca = require("./device-ca-CJyaKA2l.js");
3
+ const require_dist = require("./dist-Z_rnH_d0.js");
4
+ const require_device_ca = require("./device-ca-DtYudkE1.js");
5
5
  const require_read_all_rows$1 = require("./read-all-rows-CVoO1ONM.js");
6
6
  const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
7
7
  require("./builtins/alerts/index.js");
@@ -26,22 +26,22 @@ const require_builtins_loki_logging_index = require("./builtins/loki-logging/ind
26
26
  const require_builtins_native_metrics_native_metrics_addon = require("./builtins/native-metrics/native-metrics.addon.js");
27
27
  const require_builtins_device_history_device_history_addon = require("./builtins/device-history/device-history.addon.js");
28
28
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./builtins/sqlite-storage/filesystem-storage.addon.js");
29
- const require_wal_maintenance = require("./wal-maintenance-DHtTtKh4.js");
30
- const require_legacy_integration_rows_door = require("./legacy-integration-rows-door-CfpoIqz-.js");
29
+ const require_wal_maintenance = require("./wal-maintenance-Cjg3kYzJ.js");
30
+ const require_legacy_integration_rows_door = require("./legacy-integration-rows-door-DoR0o565.js");
31
31
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./builtins/sqlite-storage/sqlite-settings.addon.js");
32
32
  const require_builtins_sqlite_storage_index = require("./builtins/sqlite-storage/index.js");
33
33
  const require_builtins_storage_orchestrator_storage_orchestrator_addon = require("./builtins/storage-orchestrator/storage-orchestrator.addon.js");
34
34
  require("./builtins/storage-orchestrator/index.js");
35
- const require_agent_https = require("./agent-https-dPSUE1iZ.js");
36
- const require_constants = require("./constants-DuVFATnX.js");
35
+ const require_agent_https = require("./agent-https-RIQ3lut4.js");
36
+ const require_constants = require("./constants-DjZvX7em.js");
37
37
  const require_builtins_system_config_system_config_addon = require("./builtins/system-config/system-config.addon.js");
38
38
  require("./builtins/system-config/index.js");
39
39
  const require_builtins_winston_logging_index = require("./builtins/winston-logging/index.js");
40
40
  const require_custom_action_registry = require("./custom-action-registry-CmWpSeMS.js");
41
- const require_hub_mdns_ciao = require("./hub-mdns-ciao-q3IAAxK6.js");
41
+ const require_hub_mdns_ciao = require("./hub-mdns-ciao-Bl5j8wrj.js");
42
42
  const require_platform_key_source = require("./platform-key-source-Di7HrlGR.js");
43
43
  const require_resource_monitor = require("./resource-monitor-mio9dSCT.js");
44
- const require_restore_archive = require("./restore-archive-HS5O901O.js");
44
+ const require_restore_archive = require("./restore-archive-CAAEnwaO.js");
45
45
  const require_coral_accelerators = require("./coral-accelerators-BSVsBVzt.js");
46
46
  let zod = require("zod");
47
47
  let node_crypto = require("node:crypto");
@@ -1180,23 +1180,23 @@ function formatSocketPlane(window) {
1180
1180
  }
1181
1181
  //#endregion
1182
1182
  //#region src/kernel/moleculer/mesh-queue-report.ts
1183
- function isRecord$6(value) {
1183
+ function isRecord$7(value) {
1184
1184
  return typeof value === "object" && value !== null;
1185
1185
  }
1186
1186
  /** The shape `TcpWriter` keeps its sockets in. Anything else is not a mesh. */
1187
1187
  function writerSocketsOf(broker) {
1188
- if (!isRecord$6(broker)) return void 0;
1188
+ if (!isRecord$7(broker)) return void 0;
1189
1189
  const transit = broker["transit"];
1190
- if (!isRecord$6(transit)) return void 0;
1190
+ if (!isRecord$7(transit)) return void 0;
1191
1191
  const transporter = transit["tx"];
1192
- if (!isRecord$6(transporter)) return void 0;
1192
+ if (!isRecord$7(transporter)) return void 0;
1193
1193
  const writer = transporter["writer"];
1194
- if (!isRecord$6(writer)) return void 0;
1194
+ if (!isRecord$7(writer)) return void 0;
1195
1195
  const sockets = writer["sockets"];
1196
1196
  return sockets instanceof Map ? sockets : void 0;
1197
1197
  }
1198
1198
  function readSocket(nodeId, socket) {
1199
- if (typeof nodeId !== "string" || !isRecord$6(socket)) return void 0;
1199
+ if (typeof nodeId !== "string" || !isRecord$7(socket)) return void 0;
1200
1200
  const queuedBytes = socket["writableLength"];
1201
1201
  const bytesWritten = socket["bytesWritten"];
1202
1202
  if (typeof queuedBytes !== "number" || typeof bytesWritten !== "number") return void 0;
@@ -6247,7 +6247,7 @@ async function resolveUncached(options) {
6247
6247
  }
6248
6248
  //#endregion
6249
6249
  //#region src/kernel/addon-class-resolver.ts
6250
- function isRecord$5(value) {
6250
+ function isRecord$6(value) {
6251
6251
  return typeof value === "object" && value !== null && !Array.isArray(value);
6252
6252
  }
6253
6253
  /**
@@ -6271,14 +6271,14 @@ function isRecord$5(value) {
6271
6271
  function isAddonConstructor(fn) {
6272
6272
  if (typeof fn !== "function") return false;
6273
6273
  const proto = fn.prototype;
6274
- if (!isRecord$5(proto)) return false;
6274
+ if (!isRecord$6(proto)) return false;
6275
6275
  return typeof proto["initialize"] === "function";
6276
6276
  }
6277
6277
  function resolveAddonClass(mod) {
6278
6278
  let candidate = mod["default"];
6279
- if (isRecord$5(candidate) && "default" in candidate) candidate = candidate["default"];
6279
+ if (isRecord$6(candidate) && "default" in candidate) candidate = candidate["default"];
6280
6280
  if (isAddonConstructor(candidate)) return candidate;
6281
- if (isRecord$5(candidate)) {
6281
+ if (isRecord$6(candidate)) {
6282
6282
  const fn = Object.values(candidate).find(isAddonConstructor);
6283
6283
  if (fn) return fn;
6284
6284
  }
@@ -6287,7 +6287,7 @@ function resolveAddonClass(mod) {
6287
6287
  }
6288
6288
  //#endregion
6289
6289
  //#region src/kernel/addon-loader.ts
6290
- function isRecord$4(value) {
6290
+ function isRecord$5(value) {
6291
6291
  return typeof value === "object" && value !== null && !Array.isArray(value);
6292
6292
  }
6293
6293
  /**
@@ -6385,12 +6385,12 @@ async function importAddonModuleFresh(entryPath) {
6385
6385
  * AddonPackageManifest + AddonDeclaration.
6386
6386
  */
6387
6387
  function isAddonPackageManifest(value) {
6388
- if (!isRecord$4(value)) return false;
6388
+ if (!isRecord$5(value)) return false;
6389
6389
  if (!Array.isArray(value.addons)) return false;
6390
- return value.addons.every((a) => isRecord$4(a) && typeof a.id === "string");
6390
+ return value.addons.every((a) => isRecord$5(a) && typeof a.id === "string");
6391
6391
  }
6392
6392
  function toAddonPackageManifest(value) {
6393
- if (!isRecord$4(value)) return void 0;
6393
+ if (!isRecord$5(value)) return void 0;
6394
6394
  if (!isAddonPackageManifest(value)) return void 0;
6395
6395
  return value;
6396
6396
  }
@@ -6556,7 +6556,7 @@ var AddonLoader = class {
6556
6556
  }
6557
6557
  if (!node_fs.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
6558
6558
  const modUnknown = await importAddonModuleFresh(entryPath);
6559
- const mod = isRecord$4(modUnknown) ? modUnknown : {};
6559
+ const mod = isRecord$5(modUnknown) ? modUnknown : {};
6560
6560
  const AddonClass = resolveAddonClass(mod);
6561
6561
  if (!AddonClass) throw new Error(`No addon class in ${entryPath}`);
6562
6562
  this.addons.set(declaration.id, {
@@ -6572,7 +6572,7 @@ var AddonLoader = class {
6572
6572
  /** Load addon from a direct path (for development/testing) */
6573
6573
  async loadFromPath(addonId, modulePath, packageName, declaration, packageVersion = "0.0.0") {
6574
6574
  const modUnknown = await importAddonModuleFresh(modulePath);
6575
- const mod = isRecord$4(modUnknown) ? modUnknown : {};
6575
+ const mod = isRecord$5(modUnknown) ? modUnknown : {};
6576
6576
  const AddonClass = resolveAddonClass(mod);
6577
6577
  if (!AddonClass) throw new Error(`Module ${modulePath} has no default export`);
6578
6578
  this.addons.set(addonId, {
@@ -11848,11 +11848,11 @@ function createDeviceSettingsResolver(door, addonId) {
11848
11848
  }
11849
11849
  //#endregion
11850
11850
  //#region src/kernel/settings-door-view.ts
11851
- function isRecord$3(value) {
11851
+ function isRecord$4(value) {
11852
11852
  return typeof value === "object" && value !== null && !Array.isArray(value);
11853
11853
  }
11854
11854
  function asBlob(value) {
11855
- return isRecord$3(value) ? value : {};
11855
+ return isRecord$4(value) ? value : {};
11856
11856
  }
11857
11857
  /**
11858
11858
  * Every `system-settings` row under `prefix`, keyed by the suffix — or a throw.
@@ -14287,9 +14287,147 @@ var import_js_yaml = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((ex
14287
14287
  var { Type, Schema, FAILSAFE_SCHEMA, JSON_SCHEMA, CORE_SCHEMA, DEFAULT_SCHEMA, load, loadAll, dump, YAMLException, types, safeLoad, safeLoadAll, safeDump } = import_js_yaml.default;
14288
14288
  import_js_yaml.default;
14289
14289
  //#endregion
14290
+ //#region src/kernel/legacy-config-yaml.ts
14291
+ /**
14292
+ * TRANSITION — delete this module, its spec and the `js-yaml` dependency one
14293
+ * release after it ships (D1018).
14294
+ *
14295
+ * CamStack no longer has a `config.yaml`: the bootstrap config is the
14296
+ * environment plus built-in defaults. A node updated from a release that still
14297
+ * had the file must not change port, host or data directory silently, so for
14298
+ * ONE release the file is parsed here, only to compare: a key whose legacy value
14299
+ * differs from the effective env/default value, and whose environment variable
14300
+ * is not set, is still applied, with a warning naming the variable that
14301
+ * replaces it. A file that matches the defaults is ignored.
14302
+ *
14303
+ * Like `bootstrap-config.ts`, this runs before any logger exists, so the
14304
+ * `console.*` calls are the documented residual (see `ConfigManager`).
14305
+ */
14306
+ /** The former image default, searched after `CONFIG_PATH` so a recreated container still finds its volume. */
14307
+ var FORMER_IMAGE_CONFIG_PATH = "/config/config.yaml";
14308
+ /** The bootstrap keys a legacy file could still set, with the variable that now owns each. */
14309
+ var LEGACY_KEYS = [
14310
+ {
14311
+ key: "port",
14312
+ envVar: "CAMSTACK_PORT"
14313
+ },
14314
+ {
14315
+ key: "host",
14316
+ envVar: "CAMSTACK_HOST"
14317
+ },
14318
+ {
14319
+ key: "dataPath",
14320
+ envVar: "CAMSTACK_DATA"
14321
+ }
14322
+ ];
14323
+ var NO_LEGACY = {
14324
+ overrides: {},
14325
+ notes: []
14326
+ };
14327
+ function isRecord$3(value) {
14328
+ return typeof value === "object" && value !== null && !Array.isArray(value);
14329
+ }
14330
+ function isEnvSet(env, name) {
14331
+ const value = env[name];
14332
+ return value !== void 0 && value !== "";
14333
+ }
14334
+ /** Where the legacy file would be: `CONFIG_PATH`, the former image default, then under the data root. */
14335
+ function legacyConfigYamlCandidates(env) {
14336
+ const dataRoot = isEnvSet(env, "CAMSTACK_DATA") ? env["CAMSTACK_DATA"] ?? "camstack-data" : node_path.join(process.cwd(), DEFAULT_DATA_PATH);
14337
+ return [
14338
+ ...isEnvSet(env, "CONFIG_PATH") ? [env["CONFIG_PATH"] ?? ""] : [],
14339
+ FORMER_IMAGE_CONFIG_PATH,
14340
+ node_path.join(dataRoot, "config.yaml")
14341
+ ];
14342
+ }
14343
+ function findLegacyFile(env) {
14344
+ return legacyConfigYamlCandidates(env).find((candidate) => node_fs.existsSync(candidate));
14345
+ }
14346
+ /** The legacy value of a key when it is well-formed, else undefined. */
14347
+ function legacyValue(server, key) {
14348
+ const value = server[key];
14349
+ if (key === "port") return typeof value === "number" && Number.isInteger(value) && value > 0 && value < 65536 ? value : void 0;
14350
+ return typeof value === "string" && value !== "" ? value : void 0;
14351
+ }
14352
+ /** Retired-key notices the file used to earn at boot; they leave with the file. */
14353
+ function retiredKeyNotes(raw) {
14354
+ const notes = [];
14355
+ const section = raw["bootstrap"];
14356
+ if (isRecord$3(section) && "installSource" in section) notes.push({
14357
+ level: "warn",
14358
+ message: "bootstrap.installSource ignored — addons always install from npm; a workspace build reaches a node through `camstack deploy`."
14359
+ });
14360
+ if (isRecord$3(section) && "requiredAddons" in section) notes.push({
14361
+ level: "warn",
14362
+ message: "bootstrap.requiredAddons ignored — the first-boot addon set always comes from the server package."
14363
+ });
14364
+ const keychain = raw["keychain"];
14365
+ if (isRecord$3(keychain) && ("keyFile" in keychain || "previousKeyFile" in keychain)) notes.push({
14366
+ level: "warn",
14367
+ message: "keychain.keyFile / keychain.previousKeyFile ignored — the external master key is a fixed mounted path: mount the file at /run/secrets/camstack-master-key (the key being rotated away from at /run/secrets/camstack-master-key.previous)."
14368
+ });
14369
+ return notes;
14370
+ }
14371
+ /**
14372
+ * Compare a legacy config.yaml, if one exists, with what env and defaults give.
14373
+ * Pure of side effects except for reading the file.
14374
+ */
14375
+ function reconcileLegacyConfigYaml(env, effective) {
14376
+ const file = findLegacyFile(env);
14377
+ if (file === void 0) return NO_LEGACY;
14378
+ let raw;
14379
+ try {
14380
+ raw = (0, _camstack_types_addon.asJsonObject)(load(node_fs.readFileSync(file, "utf-8"))) ?? {};
14381
+ } catch (err) {
14382
+ return {
14383
+ overrides: {},
14384
+ notes: [{
14385
+ level: "warn",
14386
+ message: `${file} could not be parsed (${err instanceof Error ? err.message : String(err)}) and is ignored — config.yaml is no longer read. Delete it.`
14387
+ }]
14388
+ };
14389
+ }
14390
+ const serverRaw = raw["server"];
14391
+ const server = isRecord$3(serverRaw) ? serverRaw : {};
14392
+ const overrides = {};
14393
+ const notes = [...retiredKeyNotes(raw)];
14394
+ for (const { key, envVar } of LEGACY_KEYS) {
14395
+ if (isEnvSet(env, envVar)) continue;
14396
+ const legacy = legacyValue(server, key);
14397
+ if (legacy === void 0 || legacy === effective[key]) continue;
14398
+ if (key === "port" && typeof legacy === "number") overrides.port = legacy;
14399
+ else if (key === "host" && typeof legacy === "string") overrides.host = legacy;
14400
+ else if (key === "dataPath" && typeof legacy === "string") overrides.dataPath = legacy;
14401
+ notes.push({
14402
+ level: "warn",
14403
+ message: `${file} is no longer read, but sets server.${key}=${String(legacy)}, still applied for this release: set ${envVar}=${String(legacy)} and delete ${file}.`
14404
+ });
14405
+ }
14406
+ if (!notes.some((n) => n.level === "warn")) notes.push({
14407
+ level: "info",
14408
+ message: `${file} is no longer read and matches the defaults: it can be deleted.`
14409
+ });
14410
+ return {
14411
+ overrides,
14412
+ notes
14413
+ };
14414
+ }
14415
+ /** Notes already printed by this process: the loader runs twice per boot (main.ts and ConfigManager). */
14416
+ var printedNotes = /* @__PURE__ */ new Set();
14417
+ /** Print each note once per process, the way the bootstrap prints everything else. */
14418
+ function logLegacyNotes(notes) {
14419
+ for (const note of notes) {
14420
+ const id = `${note.level}:${note.message}`;
14421
+ if (printedNotes.has(id)) continue;
14422
+ printedNotes.add(id);
14423
+ if (note.level === "warn") console.warn(`[Phase1] WARN ${note.message}`);
14424
+ else console.log(`[Phase1] ${note.message}`);
14425
+ }
14426
+ }
14427
+ //#endregion
14290
14428
  //#region src/kernel/bootstrap-config.ts
14291
14429
  /**
14292
- * config.yaml + env: loading —
14430
+ * Environment + defaults: loading —
14293
14431
  * `ConfigManager`'s bootstrap layer, split out of `config-manager.ts` (D675)
14294
14432
  * so that file stays one class. The `console.*` calls are the documented
14295
14433
  * residuals described on `ConfigManager` (no logger exists yet at boot).
@@ -14308,26 +14446,20 @@ var ENV_VAR_MAP = {
14308
14446
  CAMSTACK_DATA: "server.dataPath"
14309
14447
  };
14310
14448
  /**
14311
- * config.yaml, env overrides applied, parsed — THE bootstrap loader: the hub's
14312
- * `main.ts` and `ConfigManager` come through here, so a key is
14313
- * read in one place. Keys the schema does not name are stripped, not read.
14314
- */
14315
- function loadBootstrapConfig(configPath, options = {}) {
14316
- const raw = (0, _camstack_types_addon.asJsonObject)(loadYaml(configPath)) ?? {};
14317
- if (options.warnRetiredKeys === true) warnRetiredYamlKeys(raw);
14318
- return bootstrapSchema.parse(applyEnvOverrides(raw));
14319
- }
14320
- /**
14321
- * A yaml key that no longer exists is stripped by the schema; this names it
14322
- * once so an operator who still carries it is told. Addons always come from
14323
- * npm — a workspace build reaches a node through `camstack deploy`.
14324
- */
14325
- function warnRetiredYamlKeys(raw) {
14326
- const section = raw["bootstrap"];
14327
- if (isRecord$2(section) && "installSource" in section) console.warn("[Phase1] WARN bootstrap.installSource ignored — addons always install from npm; a workspace build reaches a node through `camstack deploy`. Remove the key.");
14328
- if (isRecord$2(section) && "requiredAddons" in section) console.warn("[Phase1] WARN bootstrap.requiredAddons ignored — the first-boot addon set always comes from the server package. Remove the key.");
14329
- const keychain = raw["keychain"];
14330
- if (isRecord$2(keychain) && ("keyFile" in keychain || "previousKeyFile" in keychain)) console.warn("[Phase1] WARN keychain.keyFile / keychain.previousKeyFile ignored — the external master key is a fixed mounted path: mount the file at /run/secrets/camstack-master-key (the key being rotated away from at /run/secrets/camstack-master-key.previous). Remove the keys.");
14449
+ * Built-in defaults with the environment applied — THE bootstrap loader: the
14450
+ * hub's `main.ts` and `ConfigManager` come through here, so a key is read in one
14451
+ * place. There is no config.yaml (D1018); the one release of transition for a
14452
+ * node that still has one lives in `legacy-config-yaml.ts`.
14453
+ */
14454
+ function loadBootstrapConfig(env = process.env) {
14455
+ const fromEnv = applyEnvOverrides({}, env);
14456
+ const envServer = isRecord$2(fromEnv["server"]) ? fromEnv["server"] : {};
14457
+ const legacy = reconcileLegacyConfigYaml(env, bootstrapSchema.parse(fromEnv).server);
14458
+ logLegacyNotes(legacy.notes);
14459
+ return bootstrapSchema.parse({ server: {
14460
+ ...envServer,
14461
+ ...legacy.overrides
14462
+ } });
14331
14463
  }
14332
14464
  /**
14333
14465
  * Deep-set a value in a nested plain object using a dot-notation path.
@@ -14348,13 +14480,13 @@ function setNested(obj, configPath, value) {
14348
14480
  };
14349
14481
  }
14350
14482
  /**
14351
- * Apply env var overrides onto the raw YAML object.
14483
+ * Apply env var overrides onto the raw object.
14352
14484
  * Only bootstrap-level env vars are applied.
14353
14485
  */
14354
- function applyEnvOverrides(raw) {
14486
+ function applyEnvOverrides(raw, env) {
14355
14487
  let result = { ...raw };
14356
14488
  for (const [envKey, configPath] of Object.entries(ENV_VAR_MAP)) {
14357
- const envValue = process.env[envKey];
14489
+ const envValue = env[envKey];
14358
14490
  if (envValue === void 0 || envValue === "") continue;
14359
14491
  const coerced = configPath === "server.port" ? Number(envValue) : envValue;
14360
14492
  result = setNested(result, configPath, coerced);
@@ -14362,15 +14494,6 @@ function applyEnvOverrides(raw) {
14362
14494
  }
14363
14495
  return result;
14364
14496
  }
14365
- function loadYaml(configPath) {
14366
- if (!node_fs.existsSync(configPath)) {
14367
- console.warn(`[ConfigManager] Config file not found at: ${configPath}\n → Using built-in defaults. Set CONFIG_PATH env var or create the file.\n → Example path from project root: ./server/backend/data/config.yaml`);
14368
- return {};
14369
- }
14370
- const parsed = load(node_fs.readFileSync(configPath, "utf-8")) ?? {};
14371
- console.log(`[ConfigManager] Loaded config from: ${configPath}`);
14372
- return parsed;
14373
- }
14374
14497
  //#endregion
14375
14498
  //#region src/kernel/store-settings-view.ts
14376
14499
  function createStoreSettingsView(addonId, cm) {
@@ -14450,13 +14573,13 @@ function createStoreSettingsView(addonId, cm) {
14450
14573
  * the stale rows must still never answer: merging them back in would let a
14451
14574
  * stale DB copy stand in for a credential. The one-off ops script deletes them.
14452
14575
  *
14453
- * So a bootstrap-owned section is answered from env + config.yaml ONLY, and
14576
+ * So a bootstrap-owned section is answered from the environment and built-in defaults ONLY, and
14454
14577
  * the store may add exactly the keys in {@link STORE_READABLE_BOOTSTRAP_KEYS}:
14455
14578
  * the values the operator edits on System → Authentication (`auth.tokenExpiry`,
14456
14579
  * `auth.accessTokenExpiry`, `auth.trustedProxies`). Widening this list is a security decision, not a
14457
14580
  * convenience.
14458
14581
  */
14459
- /** Top-level sections whose authority is env + config.yaml (`bootstrapSchema`). */
14582
+ /** Top-level sections whose authority is the environment and built-in defaults (`bootstrapSchema`). */
14460
14583
  var BOOTSTRAP_OWNED_SECTIONS = new Set([
14461
14584
  "server",
14462
14585
  "auth",
@@ -14471,7 +14594,7 @@ var STORE_READABLE_BOOTSTRAP_KEYS = new Set([
14471
14594
  "auth.corsOrigins",
14472
14595
  "server.name"
14473
14596
  ]);
14474
- /** May the settings store answer `key`, or is it env + config.yaml only? */
14597
+ /** May the settings store answer `key`, or is it environment and defaults only? */
14475
14598
  function storeMayAnswer(key) {
14476
14599
  const dot = key.indexOf(".");
14477
14600
  const section = dot === -1 ? key : key.slice(0, dot);
@@ -14609,8 +14732,8 @@ var ConfigManager = class {
14609
14732
  settingsDoor = null;
14610
14733
  /** Boot-time mirror of the preloaded `system-settings` keys (door mode, D675). */
14611
14734
  systemMirror = new SystemSettingsMirror();
14612
- constructor(configPath) {
14613
- this.bootstrapConfig = loadBootstrapConfig(configPath);
14735
+ constructor() {
14736
+ this.bootstrapConfig = loadBootstrapConfig();
14614
14737
  }
14615
14738
  /**
14616
14739
  * Wire the settings-store backend. Called once, after the `settings-store`
@@ -14706,12 +14829,12 @@ var ConfigManager = class {
14706
14829
  *
14707
14830
  * Sources are merged in priority order (lowest → highest):
14708
14831
  * 1. RUNTIME_DEFAULTS — kernel constants.
14709
- * 2. Bootstrap config — values loaded from config.yaml at boot.
14832
+ * 2. Bootstrap config — values from the environment and built-in defaults at boot.
14710
14833
  * 3. Settings-store — runtime writes via the `settings-store` capability.
14711
14834
  *
14712
14835
  * Higher layers override earlier ones. Merging (instead of short-circuiting
14713
14836
  * on the first non-null source) prevents a single store-seeded key from
14714
- * shadowing the rest of the section that only lives in config.yaml.
14837
+ * shadowing the rest of the section that only lives in the bootstrap config.
14715
14838
  * The kernel is agnostic about the store backend — any `ISettingsStore`
14716
14839
  * implementation (sqlite, redis, in-memory, …) behaves identically here.
14717
14840
  *
@@ -14730,7 +14853,7 @@ var ConfigManager = class {
14730
14853
  }
14731
14854
  return merged;
14732
14855
  }
14733
- /** Runtime defaults, then config.yaml + env — the layers under the store. */
14856
+ /** Runtime defaults, then environment + defaults — the layers under the store. */
14734
14857
  sectionBase(section) {
14735
14858
  const merged = {};
14736
14859
  const defaults = (0, _camstack_types_addon.asJsonObject)(this.getFromRuntimeDefaults(section));
@@ -27893,14 +28016,14 @@ var en_default = {
27893
28016
  "providerInfo.s_filesystem-storage.title": "Filesystem",
27894
28017
  "providerInfo.s_filesystem-storage.basePath.label": "Base path",
27895
28018
  "providerInfo.s_filesystem-storage.basePath.description": "Absolute directory path where files are stored.",
27896
- "global.s_system-config-server.description": "The name of this server, and its connection settings (read-only, loaded from config.yaml at bootstrap).",
28019
+ "global.s_system-config-server.description": "The name of this server, and its connection settings (read-only, set by the environment).",
27897
28020
  "global.s_system-config-server.server-restart-note.label": "Restart required",
27898
28021
  "global.s_system-config-server.port.label": "Port",
27899
- "global.s_system-config-server.port.description": "Listening port",
28022
+ "global.s_system-config-server.port.description": "Listening port (CAMSTACK_PORT)",
27900
28023
  "global.s_system-config-server.host.label": "Host",
27901
- "global.s_system-config-server.host.description": "Bind address",
28024
+ "global.s_system-config-server.host.description": "Bind address (CAMSTACK_HOST)",
27902
28025
  "global.s_system-config-server.dataPath.label": "Data Path",
27903
- "global.s_system-config-server.dataPath.description": "Root data directory",
28026
+ "global.s_system-config-server.dataPath.description": "Root data directory (CAMSTACK_DATA)",
27904
28027
  "global.s_system-config-auth.description": "Token and session settings.",
27905
28028
  "global.s_system-config-auth.tokenExpiry.label": "Session lifetime",
27906
28029
  "global.s_system-config-auth.tokenExpiry.description": "How long a sign-in lasts without being used, as a duration string (e.g. 7d, 30d). Every refresh starts it again, so a device in use stays signed in; one left unopened this long must sign in again. A bare number is rejected — it would be read as milliseconds. Applies from the next sign-in or refresh.",
@@ -28152,14 +28275,14 @@ var it_default = {
28152
28275
  "providerInfo.s_filesystem-storage.title": "File system",
28153
28276
  "providerInfo.s_filesystem-storage.basePath.label": "Percorso base",
28154
28277
  "providerInfo.s_filesystem-storage.basePath.description": "Percorso assoluto della cartella dove vengono salvati i file.",
28155
- "global.s_system-config-server.description": "Il nome di questo server e le sue impostazioni di connessione (sola lettura, caricate da config.yaml all'avvio).",
28278
+ "global.s_system-config-server.description": "Il nome di questo server e le sue impostazioni di connessione (sola lettura, impostate dall'ambiente).",
28156
28279
  "global.s_system-config-server.server-restart-note.label": "Riavvio necessario",
28157
28280
  "global.s_system-config-server.port.label": "Porta",
28158
- "global.s_system-config-server.port.description": "Porta di ascolto",
28281
+ "global.s_system-config-server.port.description": "Porta di ascolto (CAMSTACK_PORT)",
28159
28282
  "global.s_system-config-server.host.label": "Host",
28160
- "global.s_system-config-server.host.description": "Indirizzo di bind",
28283
+ "global.s_system-config-server.host.description": "Indirizzo di bind (CAMSTACK_HOST)",
28161
28284
  "global.s_system-config-server.dataPath.label": "Percorso dei dati",
28162
- "global.s_system-config-server.dataPath.description": "Cartella radice dei dati",
28285
+ "global.s_system-config-server.dataPath.description": "Cartella radice dei dati (CAMSTACK_DATA)",
28163
28286
  "global.s_system-config-auth.description": "Impostazioni di token e sessione.",
28164
28287
  "global.s_system-config-auth.tokenExpiry.label": "Durata della sessione",
28165
28288
  "global.s_system-config-auth.tokenExpiry.description": "Per quanto tempo resta valido un accesso senza essere usato, come stringa di durata (ad es. 7d, 30d). Ogni rinnovo lo fa ripartire, quindi un dispositivo in uso resta connesso; uno lasciato inutilizzato per questo tempo deve accedere di nuovo. Un numero senza unità viene rifiutato: sarebbe letto come millisecondi. Si applica dal prossimo accesso o rinnovo.",