@camstack/server 1.2.798 → 1.2.799

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.
@@ -40,7 +40,7 @@ import { C as isModelDownloaded, E as setHuggingFaceReachabilityObserver, T as r
40
40
  import { A as retirePreviousLocalCa, C as checkUploadedCa, D as loadTlsCert, E as ensureTlsCert, F as closeLanHttp, I as readLanHttpState, L as registerLanHttpHandler, M as allFamiliesListenHost, N as applyLanHttp, O as reissueTlsLeaf, P as bindPendingLanHttp, S as chainsToPublicRoot, T as caReplacementMarkerFile, _ as readTlsMode, a as storeUploadedCertificate, b as writeTlsEnabled, c as leafFingerprintOf, d as servedHttpsLeafFingerprint, f as prepareBootTls, g as readTlsEnabled, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as DEFAULT_LAN_HTTP_PORT, k as replaceUnconstrainedLocalCa, l as registerHttpsListener, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, p as UPLOADED_CA_FILE, r as regenerateCertificate, s as clearHttpsListener, t as createCiaoPublisher, u as reloadHttpsListener, v as splitPemCertificates, w as validateUploadedTls, x as writeTlsMode, y as writeExtraSans } from "./hub-mdns-ciao-Bczd9NSt.mjs";
41
41
  import { n as getPlatformKeychainKey, r as setPlatformKeychainKey, t as clearPlatformKeychainKey } from "./platform-key-source-BWlq0jjn.mjs";
42
42
  import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-Di9daRwI.mjs";
43
- import { _ as backupRecordStoresOf, c as BackupDecryptError, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, h as readBackupEncryptionHeader, l as BackupKeyFormatError, r as prepareRestoreArchive, s as SystemBackupService, t as BackupKeyRequiredError, u as BackupKeyMismatchError } from "./restore-archive-DfFB1J2w.mjs";
43
+ import { _ as backupRecordStoresOf, c as BackupDecryptError, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, h as readBackupEncryptionHeader, l as BackupKeyFormatError, r as prepareRestoreArchive, s as SystemBackupService, t as BackupKeyRequiredError, u as BackupKeyMismatchError } from "./restore-archive-CXw4EaBA.mjs";
44
44
  import { r as nodeCoralFs, t as classifyCoralAccelerator } from "./coral-accelerators-DBlgWB8k.mjs";
45
45
  import { z } from "zod";
46
46
  import * as crypto$1 from "node:crypto";
@@ -1177,23 +1177,23 @@ function formatSocketPlane(window) {
1177
1177
  }
1178
1178
  //#endregion
1179
1179
  //#region src/kernel/moleculer/mesh-queue-report.ts
1180
- function isRecord$6(value) {
1180
+ function isRecord$7(value) {
1181
1181
  return typeof value === "object" && value !== null;
1182
1182
  }
1183
1183
  /** The shape `TcpWriter` keeps its sockets in. Anything else is not a mesh. */
1184
1184
  function writerSocketsOf(broker) {
1185
- if (!isRecord$6(broker)) return void 0;
1185
+ if (!isRecord$7(broker)) return void 0;
1186
1186
  const transit = broker["transit"];
1187
- if (!isRecord$6(transit)) return void 0;
1187
+ if (!isRecord$7(transit)) return void 0;
1188
1188
  const transporter = transit["tx"];
1189
- if (!isRecord$6(transporter)) return void 0;
1189
+ if (!isRecord$7(transporter)) return void 0;
1190
1190
  const writer = transporter["writer"];
1191
- if (!isRecord$6(writer)) return void 0;
1191
+ if (!isRecord$7(writer)) return void 0;
1192
1192
  const sockets = writer["sockets"];
1193
1193
  return sockets instanceof Map ? sockets : void 0;
1194
1194
  }
1195
1195
  function readSocket(nodeId, socket) {
1196
- if (typeof nodeId !== "string" || !isRecord$6(socket)) return void 0;
1196
+ if (typeof nodeId !== "string" || !isRecord$7(socket)) return void 0;
1197
1197
  const queuedBytes = socket["writableLength"];
1198
1198
  const bytesWritten = socket["bytesWritten"];
1199
1199
  if (typeof queuedBytes !== "number" || typeof bytesWritten !== "number") return void 0;
@@ -6243,7 +6243,7 @@ async function resolveUncached(options) {
6243
6243
  }
6244
6244
  //#endregion
6245
6245
  //#region src/kernel/addon-class-resolver.ts
6246
- function isRecord$5(value) {
6246
+ function isRecord$6(value) {
6247
6247
  return typeof value === "object" && value !== null && !Array.isArray(value);
6248
6248
  }
6249
6249
  /**
@@ -6267,14 +6267,14 @@ function isRecord$5(value) {
6267
6267
  function isAddonConstructor(fn) {
6268
6268
  if (typeof fn !== "function") return false;
6269
6269
  const proto = fn.prototype;
6270
- if (!isRecord$5(proto)) return false;
6270
+ if (!isRecord$6(proto)) return false;
6271
6271
  return typeof proto["initialize"] === "function";
6272
6272
  }
6273
6273
  function resolveAddonClass(mod) {
6274
6274
  let candidate = mod["default"];
6275
- if (isRecord$5(candidate) && "default" in candidate) candidate = candidate["default"];
6275
+ if (isRecord$6(candidate) && "default" in candidate) candidate = candidate["default"];
6276
6276
  if (isAddonConstructor(candidate)) return candidate;
6277
- if (isRecord$5(candidate)) {
6277
+ if (isRecord$6(candidate)) {
6278
6278
  const fn = Object.values(candidate).find(isAddonConstructor);
6279
6279
  if (fn) return fn;
6280
6280
  }
@@ -6283,7 +6283,7 @@ function resolveAddonClass(mod) {
6283
6283
  }
6284
6284
  //#endregion
6285
6285
  //#region src/kernel/addon-loader.ts
6286
- function isRecord$4(value) {
6286
+ function isRecord$5(value) {
6287
6287
  return typeof value === "object" && value !== null && !Array.isArray(value);
6288
6288
  }
6289
6289
  /**
@@ -6381,12 +6381,12 @@ async function importAddonModuleFresh(entryPath) {
6381
6381
  * AddonPackageManifest + AddonDeclaration.
6382
6382
  */
6383
6383
  function isAddonPackageManifest(value) {
6384
- if (!isRecord$4(value)) return false;
6384
+ if (!isRecord$5(value)) return false;
6385
6385
  if (!Array.isArray(value.addons)) return false;
6386
- return value.addons.every((a) => isRecord$4(a) && typeof a.id === "string");
6386
+ return value.addons.every((a) => isRecord$5(a) && typeof a.id === "string");
6387
6387
  }
6388
6388
  function toAddonPackageManifest(value) {
6389
- if (!isRecord$4(value)) return void 0;
6389
+ if (!isRecord$5(value)) return void 0;
6390
6390
  if (!isAddonPackageManifest(value)) return void 0;
6391
6391
  return value;
6392
6392
  }
@@ -6552,7 +6552,7 @@ var AddonLoader = class {
6552
6552
  }
6553
6553
  if (!fs$1.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
6554
6554
  const modUnknown = await importAddonModuleFresh(entryPath);
6555
- const mod = isRecord$4(modUnknown) ? modUnknown : {};
6555
+ const mod = isRecord$5(modUnknown) ? modUnknown : {};
6556
6556
  const AddonClass = resolveAddonClass(mod);
6557
6557
  if (!AddonClass) throw new Error(`No addon class in ${entryPath}`);
6558
6558
  this.addons.set(declaration.id, {
@@ -6568,7 +6568,7 @@ var AddonLoader = class {
6568
6568
  /** Load addon from a direct path (for development/testing) */
6569
6569
  async loadFromPath(addonId, modulePath, packageName, declaration, packageVersion = "0.0.0") {
6570
6570
  const modUnknown = await importAddonModuleFresh(modulePath);
6571
- const mod = isRecord$4(modUnknown) ? modUnknown : {};
6571
+ const mod = isRecord$5(modUnknown) ? modUnknown : {};
6572
6572
  const AddonClass = resolveAddonClass(mod);
6573
6573
  if (!AddonClass) throw new Error(`Module ${modulePath} has no default export`);
6574
6574
  this.addons.set(addonId, {
@@ -11844,11 +11844,11 @@ function createDeviceSettingsResolver(door, addonId) {
11844
11844
  }
11845
11845
  //#endregion
11846
11846
  //#region src/kernel/settings-door-view.ts
11847
- function isRecord$3(value) {
11847
+ function isRecord$4(value) {
11848
11848
  return typeof value === "object" && value !== null && !Array.isArray(value);
11849
11849
  }
11850
11850
  function asBlob(value) {
11851
- return isRecord$3(value) ? value : {};
11851
+ return isRecord$4(value) ? value : {};
11852
11852
  }
11853
11853
  /**
11854
11854
  * Every `system-settings` row under `prefix`, keyed by the suffix — or a throw.
@@ -14283,9 +14283,147 @@ var import_js_yaml = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((ex
14283
14283
  var { Type, Schema, FAILSAFE_SCHEMA, JSON_SCHEMA, CORE_SCHEMA, DEFAULT_SCHEMA, load, loadAll, dump, YAMLException, types, safeLoad, safeLoadAll, safeDump } = import_js_yaml.default;
14284
14284
  import_js_yaml.default;
14285
14285
  //#endregion
14286
+ //#region src/kernel/legacy-config-yaml.ts
14287
+ /**
14288
+ * TRANSITION — delete this module, its spec and the `js-yaml` dependency one
14289
+ * release after it ships (D1018).
14290
+ *
14291
+ * CamStack no longer has a `config.yaml`: the bootstrap config is the
14292
+ * environment plus built-in defaults. A node updated from a release that still
14293
+ * had the file must not change port, host or data directory silently, so for
14294
+ * ONE release the file is parsed here, only to compare: a key whose legacy value
14295
+ * differs from the effective env/default value, and whose environment variable
14296
+ * is not set, is still applied, with a warning naming the variable that
14297
+ * replaces it. A file that matches the defaults is ignored.
14298
+ *
14299
+ * Like `bootstrap-config.ts`, this runs before any logger exists, so the
14300
+ * `console.*` calls are the documented residual (see `ConfigManager`).
14301
+ */
14302
+ /** The former image default, searched after `CONFIG_PATH` so a recreated container still finds its volume. */
14303
+ var FORMER_IMAGE_CONFIG_PATH = "/config/config.yaml";
14304
+ /** The bootstrap keys a legacy file could still set, with the variable that now owns each. */
14305
+ var LEGACY_KEYS = [
14306
+ {
14307
+ key: "port",
14308
+ envVar: "CAMSTACK_PORT"
14309
+ },
14310
+ {
14311
+ key: "host",
14312
+ envVar: "CAMSTACK_HOST"
14313
+ },
14314
+ {
14315
+ key: "dataPath",
14316
+ envVar: "CAMSTACK_DATA"
14317
+ }
14318
+ ];
14319
+ var NO_LEGACY = {
14320
+ overrides: {},
14321
+ notes: []
14322
+ };
14323
+ function isRecord$3(value) {
14324
+ return typeof value === "object" && value !== null && !Array.isArray(value);
14325
+ }
14326
+ function isEnvSet(env, name) {
14327
+ const value = env[name];
14328
+ return value !== void 0 && value !== "";
14329
+ }
14330
+ /** Where the legacy file would be: `CONFIG_PATH`, the former image default, then under the data root. */
14331
+ function legacyConfigYamlCandidates(env) {
14332
+ const dataRoot = isEnvSet(env, "CAMSTACK_DATA") ? env["CAMSTACK_DATA"] ?? "camstack-data" : path$1.join(process.cwd(), DEFAULT_DATA_PATH);
14333
+ return [
14334
+ ...isEnvSet(env, "CONFIG_PATH") ? [env["CONFIG_PATH"] ?? ""] : [],
14335
+ FORMER_IMAGE_CONFIG_PATH,
14336
+ path$1.join(dataRoot, "config.yaml")
14337
+ ];
14338
+ }
14339
+ function findLegacyFile(env) {
14340
+ return legacyConfigYamlCandidates(env).find((candidate) => fs$1.existsSync(candidate));
14341
+ }
14342
+ /** The legacy value of a key when it is well-formed, else undefined. */
14343
+ function legacyValue(server, key) {
14344
+ const value = server[key];
14345
+ if (key === "port") return typeof value === "number" && Number.isInteger(value) && value > 0 && value < 65536 ? value : void 0;
14346
+ return typeof value === "string" && value !== "" ? value : void 0;
14347
+ }
14348
+ /** Retired-key notices the file used to earn at boot; they leave with the file. */
14349
+ function retiredKeyNotes(raw) {
14350
+ const notes = [];
14351
+ const section = raw["bootstrap"];
14352
+ if (isRecord$3(section) && "installSource" in section) notes.push({
14353
+ level: "warn",
14354
+ message: "bootstrap.installSource ignored — addons always install from npm; a workspace build reaches a node through `camstack deploy`."
14355
+ });
14356
+ if (isRecord$3(section) && "requiredAddons" in section) notes.push({
14357
+ level: "warn",
14358
+ message: "bootstrap.requiredAddons ignored — the first-boot addon set always comes from the server package."
14359
+ });
14360
+ const keychain = raw["keychain"];
14361
+ if (isRecord$3(keychain) && ("keyFile" in keychain || "previousKeyFile" in keychain)) notes.push({
14362
+ level: "warn",
14363
+ 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)."
14364
+ });
14365
+ return notes;
14366
+ }
14367
+ /**
14368
+ * Compare a legacy config.yaml, if one exists, with what env and defaults give.
14369
+ * Pure of side effects except for reading the file.
14370
+ */
14371
+ function reconcileLegacyConfigYaml(env, effective) {
14372
+ const file = findLegacyFile(env);
14373
+ if (file === void 0) return NO_LEGACY;
14374
+ let raw;
14375
+ try {
14376
+ raw = asJsonObject(load(fs$1.readFileSync(file, "utf-8"))) ?? {};
14377
+ } catch (err) {
14378
+ return {
14379
+ overrides: {},
14380
+ notes: [{
14381
+ level: "warn",
14382
+ message: `${file} could not be parsed (${err instanceof Error ? err.message : String(err)}) and is ignored — config.yaml is no longer read. Delete it.`
14383
+ }]
14384
+ };
14385
+ }
14386
+ const serverRaw = raw["server"];
14387
+ const server = isRecord$3(serverRaw) ? serverRaw : {};
14388
+ const overrides = {};
14389
+ const notes = [...retiredKeyNotes(raw)];
14390
+ for (const { key, envVar } of LEGACY_KEYS) {
14391
+ if (isEnvSet(env, envVar)) continue;
14392
+ const legacy = legacyValue(server, key);
14393
+ if (legacy === void 0 || legacy === effective[key]) continue;
14394
+ if (key === "port" && typeof legacy === "number") overrides.port = legacy;
14395
+ else if (key === "host" && typeof legacy === "string") overrides.host = legacy;
14396
+ else if (key === "dataPath" && typeof legacy === "string") overrides.dataPath = legacy;
14397
+ notes.push({
14398
+ level: "warn",
14399
+ message: `${file} is no longer read, but sets server.${key}=${String(legacy)}, still applied for this release: set ${envVar}=${String(legacy)} and delete ${file}.`
14400
+ });
14401
+ }
14402
+ if (!notes.some((n) => n.level === "warn")) notes.push({
14403
+ level: "info",
14404
+ message: `${file} is no longer read and matches the defaults: it can be deleted.`
14405
+ });
14406
+ return {
14407
+ overrides,
14408
+ notes
14409
+ };
14410
+ }
14411
+ /** Notes already printed by this process: the loader runs twice per boot (main.ts and ConfigManager). */
14412
+ var printedNotes = /* @__PURE__ */ new Set();
14413
+ /** Print each note once per process, the way the bootstrap prints everything else. */
14414
+ function logLegacyNotes(notes) {
14415
+ for (const note of notes) {
14416
+ const id = `${note.level}:${note.message}`;
14417
+ if (printedNotes.has(id)) continue;
14418
+ printedNotes.add(id);
14419
+ if (note.level === "warn") console.warn(`[Phase1] WARN ${note.message}`);
14420
+ else console.log(`[Phase1] ${note.message}`);
14421
+ }
14422
+ }
14423
+ //#endregion
14286
14424
  //#region src/kernel/bootstrap-config.ts
14287
14425
  /**
14288
- * config.yaml + env: loading —
14426
+ * Environment + defaults: loading —
14289
14427
  * `ConfigManager`'s bootstrap layer, split out of `config-manager.ts` (D675)
14290
14428
  * so that file stays one class. The `console.*` calls are the documented
14291
14429
  * residuals described on `ConfigManager` (no logger exists yet at boot).
@@ -14304,26 +14442,20 @@ var ENV_VAR_MAP = {
14304
14442
  CAMSTACK_DATA: "server.dataPath"
14305
14443
  };
14306
14444
  /**
14307
- * config.yaml, env overrides applied, parsed — THE bootstrap loader: the hub's
14308
- * `main.ts` and `ConfigManager` come through here, so a key is
14309
- * read in one place. Keys the schema does not name are stripped, not read.
14310
- */
14311
- function loadBootstrapConfig(configPath, options = {}) {
14312
- const raw = asJsonObject(loadYaml(configPath)) ?? {};
14313
- if (options.warnRetiredKeys === true) warnRetiredYamlKeys(raw);
14314
- return bootstrapSchema.parse(applyEnvOverrides(raw));
14315
- }
14316
- /**
14317
- * A yaml key that no longer exists is stripped by the schema; this names it
14318
- * once so an operator who still carries it is told. Addons always come from
14319
- * npm — a workspace build reaches a node through `camstack deploy`.
14320
- */
14321
- function warnRetiredYamlKeys(raw) {
14322
- const section = raw["bootstrap"];
14323
- 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.");
14324
- 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.");
14325
- const keychain = raw["keychain"];
14326
- 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.");
14445
+ * Built-in defaults with the environment applied — THE bootstrap loader: the
14446
+ * hub's `main.ts` and `ConfigManager` come through here, so a key is read in one
14447
+ * place. There is no config.yaml (D1018); the one release of transition for a
14448
+ * node that still has one lives in `legacy-config-yaml.ts`.
14449
+ */
14450
+ function loadBootstrapConfig(env = process.env) {
14451
+ const fromEnv = applyEnvOverrides({}, env);
14452
+ const envServer = isRecord$2(fromEnv["server"]) ? fromEnv["server"] : {};
14453
+ const legacy = reconcileLegacyConfigYaml(env, bootstrapSchema.parse(fromEnv).server);
14454
+ logLegacyNotes(legacy.notes);
14455
+ return bootstrapSchema.parse({ server: {
14456
+ ...envServer,
14457
+ ...legacy.overrides
14458
+ } });
14327
14459
  }
14328
14460
  /**
14329
14461
  * Deep-set a value in a nested plain object using a dot-notation path.
@@ -14344,13 +14476,13 @@ function setNested(obj, configPath, value) {
14344
14476
  };
14345
14477
  }
14346
14478
  /**
14347
- * Apply env var overrides onto the raw YAML object.
14479
+ * Apply env var overrides onto the raw object.
14348
14480
  * Only bootstrap-level env vars are applied.
14349
14481
  */
14350
- function applyEnvOverrides(raw) {
14482
+ function applyEnvOverrides(raw, env) {
14351
14483
  let result = { ...raw };
14352
14484
  for (const [envKey, configPath] of Object.entries(ENV_VAR_MAP)) {
14353
- const envValue = process.env[envKey];
14485
+ const envValue = env[envKey];
14354
14486
  if (envValue === void 0 || envValue === "") continue;
14355
14487
  const coerced = configPath === "server.port" ? Number(envValue) : envValue;
14356
14488
  result = setNested(result, configPath, coerced);
@@ -14358,15 +14490,6 @@ function applyEnvOverrides(raw) {
14358
14490
  }
14359
14491
  return result;
14360
14492
  }
14361
- function loadYaml(configPath) {
14362
- if (!fs$1.existsSync(configPath)) {
14363
- 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`);
14364
- return {};
14365
- }
14366
- const parsed = load(fs$1.readFileSync(configPath, "utf-8")) ?? {};
14367
- console.log(`[ConfigManager] Loaded config from: ${configPath}`);
14368
- return parsed;
14369
- }
14370
14493
  //#endregion
14371
14494
  //#region src/kernel/store-settings-view.ts
14372
14495
  function createStoreSettingsView(addonId, cm) {
@@ -14446,13 +14569,13 @@ function createStoreSettingsView(addonId, cm) {
14446
14569
  * the stale rows must still never answer: merging them back in would let a
14447
14570
  * stale DB copy stand in for a credential. The one-off ops script deletes them.
14448
14571
  *
14449
- * So a bootstrap-owned section is answered from env + config.yaml ONLY, and
14572
+ * So a bootstrap-owned section is answered from the environment and built-in defaults ONLY, and
14450
14573
  * the store may add exactly the keys in {@link STORE_READABLE_BOOTSTRAP_KEYS}:
14451
14574
  * the values the operator edits on System → Authentication (`auth.tokenExpiry`,
14452
14575
  * `auth.accessTokenExpiry`, `auth.trustedProxies`). Widening this list is a security decision, not a
14453
14576
  * convenience.
14454
14577
  */
14455
- /** Top-level sections whose authority is env + config.yaml (`bootstrapSchema`). */
14578
+ /** Top-level sections whose authority is the environment and built-in defaults (`bootstrapSchema`). */
14456
14579
  var BOOTSTRAP_OWNED_SECTIONS = new Set([
14457
14580
  "server",
14458
14581
  "auth",
@@ -14467,7 +14590,7 @@ var STORE_READABLE_BOOTSTRAP_KEYS = new Set([
14467
14590
  "auth.corsOrigins",
14468
14591
  "server.name"
14469
14592
  ]);
14470
- /** May the settings store answer `key`, or is it env + config.yaml only? */
14593
+ /** May the settings store answer `key`, or is it environment and defaults only? */
14471
14594
  function storeMayAnswer(key) {
14472
14595
  const dot = key.indexOf(".");
14473
14596
  const section = dot === -1 ? key : key.slice(0, dot);
@@ -14605,8 +14728,8 @@ var ConfigManager = class {
14605
14728
  settingsDoor = null;
14606
14729
  /** Boot-time mirror of the preloaded `system-settings` keys (door mode, D675). */
14607
14730
  systemMirror = new SystemSettingsMirror();
14608
- constructor(configPath) {
14609
- this.bootstrapConfig = loadBootstrapConfig(configPath);
14731
+ constructor() {
14732
+ this.bootstrapConfig = loadBootstrapConfig();
14610
14733
  }
14611
14734
  /**
14612
14735
  * Wire the settings-store backend. Called once, after the `settings-store`
@@ -14702,12 +14825,12 @@ var ConfigManager = class {
14702
14825
  *
14703
14826
  * Sources are merged in priority order (lowest → highest):
14704
14827
  * 1. RUNTIME_DEFAULTS — kernel constants.
14705
- * 2. Bootstrap config — values loaded from config.yaml at boot.
14828
+ * 2. Bootstrap config — values from the environment and built-in defaults at boot.
14706
14829
  * 3. Settings-store — runtime writes via the `settings-store` capability.
14707
14830
  *
14708
14831
  * Higher layers override earlier ones. Merging (instead of short-circuiting
14709
14832
  * on the first non-null source) prevents a single store-seeded key from
14710
- * shadowing the rest of the section that only lives in config.yaml.
14833
+ * shadowing the rest of the section that only lives in the bootstrap config.
14711
14834
  * The kernel is agnostic about the store backend — any `ISettingsStore`
14712
14835
  * implementation (sqlite, redis, in-memory, …) behaves identically here.
14713
14836
  *
@@ -14726,7 +14849,7 @@ var ConfigManager = class {
14726
14849
  }
14727
14850
  return merged;
14728
14851
  }
14729
- /** Runtime defaults, then config.yaml + env — the layers under the store. */
14852
+ /** Runtime defaults, then environment + defaults — the layers under the store. */
14730
14853
  sectionBase(section) {
14731
14854
  const merged = {};
14732
14855
  const defaults = asJsonObject(this.getFromRuntimeDefaults(section));
@@ -27889,14 +28012,14 @@ var en_default = {
27889
28012
  "providerInfo.s_filesystem-storage.title": "Filesystem",
27890
28013
  "providerInfo.s_filesystem-storage.basePath.label": "Base path",
27891
28014
  "providerInfo.s_filesystem-storage.basePath.description": "Absolute directory path where files are stored.",
27892
- "global.s_system-config-server.description": "The name of this server, and its connection settings (read-only, loaded from config.yaml at bootstrap).",
28015
+ "global.s_system-config-server.description": "The name of this server, and its connection settings (read-only, set by the environment).",
27893
28016
  "global.s_system-config-server.server-restart-note.label": "Restart required",
27894
28017
  "global.s_system-config-server.port.label": "Port",
27895
- "global.s_system-config-server.port.description": "Listening port",
28018
+ "global.s_system-config-server.port.description": "Listening port (CAMSTACK_PORT)",
27896
28019
  "global.s_system-config-server.host.label": "Host",
27897
- "global.s_system-config-server.host.description": "Bind address",
28020
+ "global.s_system-config-server.host.description": "Bind address (CAMSTACK_HOST)",
27898
28021
  "global.s_system-config-server.dataPath.label": "Data Path",
27899
- "global.s_system-config-server.dataPath.description": "Root data directory",
28022
+ "global.s_system-config-server.dataPath.description": "Root data directory (CAMSTACK_DATA)",
27900
28023
  "global.s_system-config-auth.description": "Token and session settings.",
27901
28024
  "global.s_system-config-auth.tokenExpiry.label": "Session lifetime",
27902
28025
  "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.",
@@ -28148,14 +28271,14 @@ var it_default = {
28148
28271
  "providerInfo.s_filesystem-storage.title": "File system",
28149
28272
  "providerInfo.s_filesystem-storage.basePath.label": "Percorso base",
28150
28273
  "providerInfo.s_filesystem-storage.basePath.description": "Percorso assoluto della cartella dove vengono salvati i file.",
28151
- "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).",
28274
+ "global.s_system-config-server.description": "Il nome di questo server e le sue impostazioni di connessione (sola lettura, impostate dall'ambiente).",
28152
28275
  "global.s_system-config-server.server-restart-note.label": "Riavvio necessario",
28153
28276
  "global.s_system-config-server.port.label": "Porta",
28154
- "global.s_system-config-server.port.description": "Porta di ascolto",
28277
+ "global.s_system-config-server.port.description": "Porta di ascolto (CAMSTACK_PORT)",
28155
28278
  "global.s_system-config-server.host.label": "Host",
28156
- "global.s_system-config-server.host.description": "Indirizzo di bind",
28279
+ "global.s_system-config-server.host.description": "Indirizzo di bind (CAMSTACK_HOST)",
28157
28280
  "global.s_system-config-server.dataPath.label": "Percorso dei dati",
28158
- "global.s_system-config-server.dataPath.description": "Cartella radice dei dati",
28281
+ "global.s_system-config-server.dataPath.description": "Cartella radice dei dati (CAMSTACK_DATA)",
28159
28282
  "global.s_system-config-auth.description": "Impostazioni di token e sessione.",
28160
28283
  "global.s_system-config-auth.tokenExpiry.label": "Durata della sessione",
28161
28284
  "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.",
@@ -1,9 +1,14 @@
1
+ /**
2
+ * Environment + defaults: loading —
3
+ * `ConfigManager`'s bootstrap layer, split out of `config-manager.ts` (D675)
4
+ * so that file stays one class. The `console.*` calls are the documented
5
+ * residuals described on `ConfigManager` (no logger exists yet at boot).
6
+ */
1
7
  import { type BootstrapConfig } from "./config-schema.js";
2
8
  /**
3
- * config.yaml, env overrides applied, parsed — THE bootstrap loader: the hub's
4
- * `main.ts` and `ConfigManager` come through here, so a key is
5
- * read in one place. Keys the schema does not name are stripped, not read.
9
+ * Built-in defaults with the environment applied — THE bootstrap loader: the
10
+ * hub's `main.ts` and `ConfigManager` come through here, so a key is read in one
11
+ * place. There is no config.yaml (D1018); the one release of transition for a
12
+ * node that still has one lives in `legacy-config-yaml.ts`.
6
13
  */
7
- export declare function loadBootstrapConfig(configPath: string, options?: {
8
- readonly warnRetiredKeys?: boolean;
9
- }): BootstrapConfig;
14
+ export declare function loadBootstrapConfig(env?: Readonly<Record<string, string | undefined>>): BootstrapConfig;
@@ -9,7 +9,7 @@ export declare class ConfigManager {
9
9
  private settingsDoor;
10
10
  /** Boot-time mirror of the preloaded `system-settings` keys (door mode, D675). */
11
11
  private readonly systemMirror;
12
- constructor(configPath: string);
12
+ constructor();
13
13
  /**
14
14
  * Wire the settings-store backend. Called once, after the `settings-store`
15
15
  * capability provider has registered (normally during Phase-1 infra boot).
@@ -70,12 +70,12 @@ export declare class ConfigManager {
70
70
  *
71
71
  * Sources are merged in priority order (lowest → highest):
72
72
  * 1. RUNTIME_DEFAULTS — kernel constants.
73
- * 2. Bootstrap config — values loaded from config.yaml at boot.
73
+ * 2. Bootstrap config — values from the environment and built-in defaults at boot.
74
74
  * 3. Settings-store — runtime writes via the `settings-store` capability.
75
75
  *
76
76
  * Higher layers override earlier ones. Merging (instead of short-circuiting
77
77
  * on the first non-null source) prevents a single store-seeded key from
78
- * shadowing the rest of the section that only lives in config.yaml.
78
+ * shadowing the rest of the section that only lives in the bootstrap config.
79
79
  * The kernel is agnostic about the store backend — any `ISettingsStore`
80
80
  * implementation (sqlite, redis, in-memory, …) behaves identically here.
81
81
  *
@@ -85,7 +85,7 @@ export declare class ConfigManager {
85
85
  * the door.
86
86
  */
87
87
  getSection(section: string): Record<string, unknown>;
88
- /** Runtime defaults, then config.yaml + env — the layers under the store. */
88
+ /** Runtime defaults, then environment + defaults — the layers under the store. */
89
89
  private sectionBase;
90
90
  /**
91
91
  * {@link getSection} through the async door — what the door-backed settings
@@ -153,7 +153,7 @@ export declare class ConfigManager {
153
153
  hasSyncStore(): boolean;
154
154
  /** Get a value from the parsed bootstrap config.
155
155
  * Generic overload is a documented type-level bridge — callers are responsible
156
- * for passing a T that matches the config.yaml shape. */
156
+ * for passing a T that matches the bootstrap config shape. */
157
157
  getBootstrap(configPath: string): unknown;
158
158
  getBootstrap<T>(configPath: string): T | undefined;
159
159
  /**
@@ -10,10 +10,9 @@ export type BootstrapServerConfig = {
10
10
  /** Bootstrap `bootstrap` section — see {@link bootstrapAddonsSchema}. */
11
11
  export type BootstrapAddonsConfig = Record<never, never>;
12
12
  /**
13
- * Bootstrap config — loaded from config.yaml (plus the three env overrides) ONLY
14
- * at startup, by `loadBootstrapConfig`, the one loader. A key not named here is
15
- * not read: an older yaml that still carries `mode`, `hub`, `agent`, `auth`,
16
- * `tls`, `keychain.keyFile` / `previousKeyFile` or `bootstrap.settingsStoreAddon` / `forceDisable` / `installSource` / `requiredAddons` boots with them ignored.
13
+ * Bootstrap config — the three env overrides over built-in defaults, ONLY, at
14
+ * startup, by `loadBootstrapConfig`, the one loader (D1018: there is no
15
+ * config.yaml). A key not named here is not read.
17
16
  */
18
17
  export type BootstrapConfig = {
19
18
  server: BootstrapServerConfig;
@@ -0,0 +1,37 @@
1
+ /** The bootstrap keys a legacy file could still set, with the variable that now owns each. */
2
+ declare const LEGACY_KEYS: readonly [{
3
+ readonly key: "port";
4
+ readonly envVar: "CAMSTACK_PORT";
5
+ }, {
6
+ readonly key: "host";
7
+ readonly envVar: "CAMSTACK_HOST";
8
+ }, {
9
+ readonly key: "dataPath";
10
+ readonly envVar: "CAMSTACK_DATA";
11
+ }];
12
+ export type LegacyBootstrapKey = (typeof LEGACY_KEYS)[number]["key"];
13
+ /** The effective value of each key, from env and defaults, before the legacy file is consulted. */
14
+ export interface EffectiveBootstrapValues {
15
+ readonly port: number;
16
+ readonly host: string;
17
+ readonly dataPath: string;
18
+ }
19
+ export interface LegacyNote {
20
+ readonly level: "info" | "warn";
21
+ readonly message: string;
22
+ }
23
+ export interface LegacyConfigYamlResult {
24
+ /** Values to apply under the environment: only keys whose env var is unset and whose legacy value differs. */
25
+ readonly overrides: Partial<EffectiveBootstrapValues>;
26
+ readonly notes: readonly LegacyNote[];
27
+ }
28
+ /** Where the legacy file would be: `CONFIG_PATH`, the former image default, then under the data root. */
29
+ export declare function legacyConfigYamlCandidates(env: Readonly<Record<string, string | undefined>>): readonly string[];
30
+ /**
31
+ * Compare a legacy config.yaml, if one exists, with what env and defaults give.
32
+ * Pure of side effects except for reading the file.
33
+ */
34
+ export declare function reconcileLegacyConfigYaml(env: Readonly<Record<string, string | undefined>>, effective: EffectiveBootstrapValues): LegacyConfigYamlResult;
35
+ /** Print each note once per process, the way the bootstrap prints everything else. */
36
+ export declare function logLegacyNotes(notes: readonly LegacyNote[]): void;
37
+ export {};
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * A section a bootstrap file owns (`auth`, `server`, ...) is answered only for
8
8
  * the keys the store may answer ({@link storeMayAnswer}); the rest of such a
9
- * section is env + config.yaml and lives in the hub process alone.
9
+ * section is the environment and built-in defaults and lives in the hub process alone.
10
10
  */
11
11
  import type { ISettingsStoreProvider } from "@camstack/types";
12
12
  /** The door slice sections need. */
@@ -1,6 +1,6 @@
1
1
  /** The only keys under a bootstrap-owned section the store may answer. */
2
2
  export declare const STORE_READABLE_BOOTSTRAP_KEYS: ReadonlySet<string>;
3
- /** May the settings store answer `key`, or is it env + config.yaml only? */
3
+ /** May the settings store answer `key`, or is it environment and defaults only? */
4
4
  export declare function storeMayAnswer(key: string): boolean;
5
5
  /**
6
6
  * Key prefixes loaded from the door into memory ONCE at boot, so the