@camstack/addon-provider-homematic 1.2.135 → 1.2.137

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 (3) hide show
  1. package/dist/addon.js +1759 -141
  2. package/dist/addon.mjs +1759 -141
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8,7 +8,7 @@ let http = require("http");
8
8
  let crypto$1 = require("crypto");
9
9
  let fs_promises = require("fs/promises");
10
10
  let path = require("path");
11
- //#region ../types/dist/event-category-C4hVnRo8.mjs
11
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
12
12
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
13
13
  EventCategory["SystemBoot"] = "system.boot";
14
14
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -72,6 +72,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
72
72
  * consumes this category and maps it to the `addon-crash-loop` kind.
73
73
  */
74
74
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
75
+ /**
76
+ * A runner whose addon refused to start with a typed reason (D877) - parked
77
+ * in `refused`, never counted by the crash breaker, retried on operator
78
+ * action. One event per refusal.
79
+ */
80
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
81
+ /**
82
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
83
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
84
+ * runner is still pending) and the alert centre (close a recovered runner).
85
+ */
86
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
87
+ /**
88
+ * The node's one-shot runner boot check (D877): planned runners against the
89
+ * process service, `degraded` when any is failed, refused or missing. The
90
+ * alert centre turns it into one alert and a direct critical push.
91
+ */
92
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
75
93
  EventCategory["AddonError"] = "addon.error";
76
94
  EventCategory["AddonPageReady"] = "addon.page-ready";
77
95
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -4114,6 +4132,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
4114
4132
  var booleanProcessor = (_schema, _ctx, json, _params) => {
4115
4133
  json.type = "boolean";
4116
4134
  };
4135
+ var bigintProcessor = (_schema, ctx, _json, _params) => {
4136
+ if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
4137
+ };
4138
+ var symbolProcessor = (_schema, ctx, _json, _params) => {
4139
+ if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
4140
+ };
4117
4141
  var nullProcessor = (_schema, ctx, json, _params) => {
4118
4142
  if (ctx.target === "openapi-3.0") {
4119
4143
  json.type = "string";
@@ -4121,12 +4145,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
4121
4145
  json.enum = [null];
4122
4146
  } else json.type = "null";
4123
4147
  };
4148
+ var undefinedProcessor = (_schema, ctx, _json, _params) => {
4149
+ if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
4150
+ };
4124
4151
  var voidProcessor = (_schema, ctx, _json, _params) => {
4125
4152
  if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
4126
4153
  };
4127
4154
  var neverProcessor = (_schema, _ctx, json, _params) => {
4128
4155
  json.not = {};
4129
4156
  };
4157
+ var anyProcessor = (_schema, _ctx, _json, _params) => {};
4158
+ var unknownProcessor = (_schema, _ctx, _json, _params) => {};
4130
4159
  var dateProcessor = (_schema, ctx, _json, _params) => {
4131
4160
  if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
4132
4161
  };
@@ -4158,12 +4187,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
4158
4187
  json.enum = vals;
4159
4188
  }
4160
4189
  };
4190
+ var nanProcessor = (_schema, ctx, _json, _params) => {
4191
+ if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
4192
+ };
4193
+ var templateLiteralProcessor = (schema, _ctx, json, _params) => {
4194
+ const _json = json;
4195
+ const pattern = schema._zod.pattern;
4196
+ if (!pattern) throw new Error("Pattern not found in template literal");
4197
+ _json.type = "string";
4198
+ _json.pattern = pattern.source;
4199
+ };
4200
+ var fileProcessor = (schema, _ctx, json, _params) => {
4201
+ const _json = json;
4202
+ const file = {
4203
+ type: "string",
4204
+ format: "binary",
4205
+ contentEncoding: "binary"
4206
+ };
4207
+ const { minimum, maximum, mime } = schema._zod.bag;
4208
+ if (minimum !== void 0) file.minLength = minimum;
4209
+ if (maximum !== void 0) file.maxLength = maximum;
4210
+ if (mime) if (mime.length === 1) {
4211
+ file.contentMediaType = mime[0];
4212
+ Object.assign(_json, file);
4213
+ } else {
4214
+ Object.assign(_json, file);
4215
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
4216
+ }
4217
+ else Object.assign(_json, file);
4218
+ };
4219
+ var successProcessor = (_schema, _ctx, json, _params) => {
4220
+ json.type = "boolean";
4221
+ };
4161
4222
  var customProcessor = (_schema, ctx, _json, _params) => {
4162
4223
  if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
4163
4224
  };
4225
+ var functionProcessor = (_schema, ctx, _json, _params) => {
4226
+ if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
4227
+ };
4164
4228
  var transformProcessor = (_schema, ctx, _json, _params) => {
4165
4229
  if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
4166
4230
  };
4231
+ var mapProcessor = (_schema, ctx, _json, _params) => {
4232
+ if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
4233
+ };
4234
+ var setProcessor = (_schema, ctx, _json, _params) => {
4235
+ if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
4236
+ };
4167
4237
  var arrayProcessor = (schema, ctx, _json, params) => {
4168
4238
  const json = _json;
4169
4239
  const def = schema._zod.def;
@@ -4368,6 +4438,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
4368
4438
  seen.ref = def.innerType;
4369
4439
  json.readOnly = true;
4370
4440
  };
4441
+ var promiseProcessor = (schema, ctx, _json, params) => {
4442
+ const def = schema._zod.def;
4443
+ process$1(def.innerType, ctx, params);
4444
+ const seen = ctx.seen.get(schema);
4445
+ seen.ref = def.innerType;
4446
+ };
4371
4447
  var optionalProcessor = (schema, ctx, _json, params) => {
4372
4448
  const def = schema._zod.def;
4373
4449
  process$1(def.innerType, ctx, params);
@@ -4380,6 +4456,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
4380
4456
  const seen = ctx.seen.get(schema);
4381
4457
  seen.ref = innerType;
4382
4458
  };
4459
+ var allProcessors = {
4460
+ string: stringProcessor,
4461
+ number: numberProcessor,
4462
+ boolean: booleanProcessor,
4463
+ bigint: bigintProcessor,
4464
+ symbol: symbolProcessor,
4465
+ null: nullProcessor,
4466
+ undefined: undefinedProcessor,
4467
+ void: voidProcessor,
4468
+ never: neverProcessor,
4469
+ any: anyProcessor,
4470
+ unknown: unknownProcessor,
4471
+ date: dateProcessor,
4472
+ enum: enumProcessor,
4473
+ literal: literalProcessor,
4474
+ nan: nanProcessor,
4475
+ template_literal: templateLiteralProcessor,
4476
+ file: fileProcessor,
4477
+ success: successProcessor,
4478
+ custom: customProcessor,
4479
+ function: functionProcessor,
4480
+ transform: transformProcessor,
4481
+ map: mapProcessor,
4482
+ set: setProcessor,
4483
+ array: arrayProcessor,
4484
+ object: objectProcessor,
4485
+ union: unionProcessor,
4486
+ intersection: intersectionProcessor,
4487
+ tuple: tupleProcessor,
4488
+ record: recordProcessor,
4489
+ nullable: nullableProcessor,
4490
+ nonoptional: nonoptionalProcessor,
4491
+ default: defaultProcessor,
4492
+ prefault: prefaultProcessor,
4493
+ catch: catchProcessor,
4494
+ pipe: pipeProcessor,
4495
+ readonly: readonlyProcessor,
4496
+ promise: promiseProcessor,
4497
+ optional: optionalProcessor,
4498
+ lazy: lazyProcessor
4499
+ };
4500
+ function toJSONSchema(input, params) {
4501
+ if ("_idmap" in input) {
4502
+ const registry = input;
4503
+ const ctx = initializeContext({
4504
+ ...params,
4505
+ processors: allProcessors
4506
+ });
4507
+ const defs = {};
4508
+ for (const entry of registry._idmap.entries()) {
4509
+ const [_, schema] = entry;
4510
+ process$1(schema, ctx);
4511
+ }
4512
+ const schemas = {};
4513
+ ctx.external = {
4514
+ registry,
4515
+ uri: params?.uri,
4516
+ defs
4517
+ };
4518
+ for (const entry of registry._idmap.entries()) {
4519
+ const [key, schema] = entry;
4520
+ extractDefs(ctx, schema);
4521
+ schemas[key] = finalize(ctx, schema);
4522
+ }
4523
+ if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
4524
+ return { schemas };
4525
+ }
4526
+ const ctx = initializeContext({
4527
+ ...params,
4528
+ processors: allProcessors
4529
+ });
4530
+ process$1(input, ctx);
4531
+ extractDefs(ctx, input);
4532
+ return finalize(ctx, input);
4533
+ }
4383
4534
  //#endregion
4384
4535
  //#region ../../node_modules/zod/v4/classic/iso.js
4385
4536
  var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
@@ -5396,7 +5547,7 @@ var ZodIssueCode = {
5396
5547
  var ZodFirstPartyTypeKind;
5397
5548
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5398
5549
  //#endregion
5399
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5550
+ //#region ../types/dist/sleep-BOjuyoPC.mjs
5400
5551
  /**
5401
5552
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5402
5553
  * window to float samples (D455).
@@ -5513,7 +5664,7 @@ function isKeychainStoredField(field) {
5513
5664
  var SECRET_CLEAR = { $secretClear: true };
5514
5665
  /** The `'***'` token D634 redaction writes for non-admins. */
5515
5666
  var LEGACY_DEVICE_REDACTION = "***";
5516
- function isRecord$2(value) {
5667
+ function isRecord$5(value) {
5517
5668
  return typeof value === "object" && value !== null && !Array.isArray(value);
5518
5669
  }
5519
5670
  function makeSecretMarker(ref) {
@@ -5524,12 +5675,12 @@ function makeSecretMarker(ref) {
5524
5675
  }
5525
5676
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5526
5677
  function isSecretMarker(value) {
5527
- if (!isRecord$2(value)) return false;
5678
+ if (!isRecord$5(value)) return false;
5528
5679
  const ref = value["$secret"];
5529
5680
  return typeof ref === "string" && ref.length > 0;
5530
5681
  }
5531
5682
  function isSecretClear(value) {
5532
- return isRecord$2(value) && value["$secretClear"] === true;
5683
+ return isRecord$5(value) && value["$secretClear"] === true;
5533
5684
  }
5534
5685
  /**
5535
5686
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6139,7 +6290,7 @@ var KeychainWriteRefusedError = class extends Error {
6139
6290
  }
6140
6291
  };
6141
6292
  var KEEP = { kind: "keep" };
6142
- function isRecord$1(value) {
6293
+ function isRecord$4(value) {
6143
6294
  return typeof value === "object" && value !== null && !Array.isArray(value);
6144
6295
  }
6145
6296
  function defaultMintId() {
@@ -6152,7 +6303,7 @@ function collectSecretMarkerRefs(value, out = []) {
6152
6303
  return out;
6153
6304
  }
6154
6305
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6155
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6306
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6156
6307
  return out;
6157
6308
  }
6158
6309
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6207,7 +6358,7 @@ function rowId(row, idKey) {
6207
6358
  return null;
6208
6359
  }
6209
6360
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6210
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6361
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6211
6362
  if (!Array.isArray(incoming)) {
6212
6363
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6213
6364
  return {
@@ -6223,7 +6374,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6223
6374
  const kept = /* @__PURE__ */ new Set();
6224
6375
  const rows = [];
6225
6376
  for (const row of incoming) {
6226
- if (!isRecord$1(row)) {
6377
+ if (!isRecord$4(row)) {
6227
6378
  rows.push(row);
6228
6379
  continue;
6229
6380
  }
@@ -6248,7 +6399,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6248
6399
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6249
6400
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6250
6401
  case "object": {
6251
- if (!isRecord$1(incoming)) {
6402
+ if (!isRecord$4(incoming)) {
6252
6403
  if (incoming === void 0) return KEEP;
6253
6404
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6254
6405
  return {
@@ -6256,7 +6407,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6256
6407
  value: incoming
6257
6408
  };
6258
6409
  }
6259
- const storedObj = isRecord$1(stored) ? stored : {};
6410
+ const storedObj = isRecord$4(stored) ? stored : {};
6260
6411
  return {
6261
6412
  kind: "value",
6262
6413
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6379,7 +6530,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6379
6530
  value: items
6380
6531
  };
6381
6532
  }
6382
- if (isRecord$1(v)) {
6533
+ if (isRecord$4(v)) {
6383
6534
  const out = {};
6384
6535
  for (const [k, child] of Object.entries(v)) {
6385
6536
  const s = substitute(child);
@@ -6647,7 +6798,6 @@ function createHandle(raw, opts) {
6647
6798
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6648
6799
  const readAddonStoreResult = raw.readAddonStoreResult;
6649
6800
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6650
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6651
6801
  const overrides = {
6652
6802
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6653
6803
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6671,12 +6821,12 @@ function createHandle(raw, opts) {
6671
6821
  };
6672
6822
  } } : {},
6673
6823
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6674
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6675
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6824
+ readDeviceStoreBatch: async (deviceIds) => {
6825
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6676
6826
  const out = /* @__PURE__ */ new Map();
6677
6827
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6678
6828
  return out;
6679
- } } : {},
6829
+ },
6680
6830
  writeAddonStore: async (patch) => {
6681
6831
  await writeAddon(patch);
6682
6832
  },
@@ -7303,7 +7453,7 @@ var BaseAddon = class {
7303
7453
  if (!ctx) return;
7304
7454
  const addonId = ctx.id;
7305
7455
  setImmediate(() => {
7306
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7456
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7307
7457
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7308
7458
  }).catch((err) => {
7309
7459
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7503,7 +7653,7 @@ var BaseAddon = class {
7503
7653
  return this._addonSecretTree;
7504
7654
  }
7505
7655
  deviceSecretTree() {
7506
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7656
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7507
7657
  return this._deviceSecretTree;
7508
7658
  }
7509
7659
  /**
@@ -7579,42 +7729,135 @@ var BaseAddon = class {
7579
7729
  this[timerOf] = timer;
7580
7730
  }
7581
7731
  /**
7582
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7583
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7584
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7585
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7732
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7733
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7586
7734
  * addon permanently broken.
7587
7735
  *
7588
- * Retry only the two known infra fingerprints. Anything else propagates so
7589
- * real bugs surface immediately. After the budget expires we fall back to
7590
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7736
+ * Two kinds of outage, two budgets:
7737
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7738
+ * initialized`, `provider not available`): a short budget, then the addon
7739
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7740
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7741
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7742
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7743
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7744
+ * loop. A long, bounded budget; only after it the error propagates - the
7745
+ * addon never runs on defaults for a store it could not ask.
7746
+ * Anything else propagates immediately so real bugs surface.
7591
7747
  */
7592
7748
  async readAddonStoreWithRetry() {
7593
7749
  const settings = this.rawSettings();
7594
7750
  if (!settings) return {};
7595
- const delaysMs = [
7596
- 150,
7597
- 350,
7598
- 600,
7599
- 900
7600
- ];
7601
7751
  let lastErr;
7602
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7752
+ for (let attempt = 0;; attempt++) try {
7603
7753
  const stored = await settings.readAddonStore() ?? {};
7604
7754
  this.settingsStoreReady = true;
7605
7755
  return stored;
7606
7756
  } catch (err) {
7607
7757
  lastErr = err;
7608
- const msg = err instanceof Error ? err.message : String(err);
7609
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7610
- if (attempt === delaysMs.length) break;
7611
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7758
+ const kind = classifyStoreError(err);
7759
+ if (kind === "permanent") throw err;
7760
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7761
+ if (delay === void 0) {
7762
+ if (kind === "transport") throw err;
7763
+ break;
7764
+ }
7765
+ await new Promise((r) => setTimeout(r, delay));
7612
7766
  }
7613
7767
  this.settingsStoreReady = false;
7614
7768
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7615
7769
  return {};
7616
7770
  }
7617
7771
  };
7772
+ /** The settings store's own restart fingerprints. */
7773
+ var RESTART_RETRY_DELAYS_MS = [
7774
+ 150,
7775
+ 350,
7776
+ 600,
7777
+ 900
7778
+ ];
7779
+ /** A hub restarting under a booting runner: ~100 s in total. */
7780
+ var TRANSPORT_RETRY_DELAYS_MS = [
7781
+ 150,
7782
+ 350,
7783
+ 600,
7784
+ 900,
7785
+ 2e3,
7786
+ 5e3,
7787
+ 1e4,
7788
+ 2e4,
7789
+ 3e4,
7790
+ 3e4
7791
+ ];
7792
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7793
+ /** Node / socket error codes of a connection that did not happen or broke. */
7794
+ var TRANSPORT_CODES = new Set([
7795
+ "ECONNREFUSED",
7796
+ "ECONNRESET",
7797
+ "ETIMEDOUT",
7798
+ "EPIPE",
7799
+ "EHOSTUNREACH",
7800
+ "ENETUNREACH"
7801
+ ]);
7802
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7803
+ var UNAVAILABLE_TRPC_CODES = new Set([
7804
+ "TIMEOUT",
7805
+ "SERVICE_UNAVAILABLE",
7806
+ "BAD_GATEWAY",
7807
+ "GATEWAY_TIMEOUT"
7808
+ ]);
7809
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7810
+ var TRANSPORT_PHRASES = [
7811
+ "discovery deadline exceeded",
7812
+ "parent could not route child unowned cap call",
7813
+ "UDS request timed out after",
7814
+ "channel closed"
7815
+ ];
7816
+ /** Moleculer error `type`s of a call that could not be served right now. */
7817
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7818
+ "REQUEST_TIMEOUT",
7819
+ "SERVICE_NOT_FOUND",
7820
+ "SERVICE_NOT_AVAILABLE",
7821
+ "REQUEST_REJECTED",
7822
+ "BROKER_DISCONNECTED"
7823
+ ]);
7824
+ function stringProp(value, key) {
7825
+ if (typeof value !== "object" || value === null) return void 0;
7826
+ const found = Reflect.get(value, key);
7827
+ return typeof found === "string" ? found : void 0;
7828
+ }
7829
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7830
+ function errorCode(err) {
7831
+ const out = {};
7832
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7833
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7834
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7835
+ if (node !== void 0) out.node = node;
7836
+ const trpc = stringProp(data, "code");
7837
+ if (trpc !== void 0) out.trpc = trpc;
7838
+ return out;
7839
+ }
7840
+ /**
7841
+ * Is a settings read failure worth retrying, and with which budget? Only
7842
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7843
+ * one of the exact phrases our own transport raises. A message that merely
7844
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7845
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7846
+ */
7847
+ function classifyStoreError(err) {
7848
+ const message = err instanceof Error ? err.message : String(err);
7849
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7850
+ const code = errorCode(err);
7851
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7852
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7853
+ if (typeof err === "object" && err !== null) {
7854
+ if (Reflect.get(err, "retryable") === true) return "transport";
7855
+ const type = stringProp(err, "type");
7856
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7857
+ }
7858
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7859
+ return "permanent";
7860
+ }
7618
7861
  /**
7619
7862
  * Collect the keys of every field marked `perNode: true`, recursing into
7620
7863
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7704,6 +7947,356 @@ var PeerBytesTicketSchema = object({
7704
7947
  */
7705
7948
  declaredBytes: number().int().nonnegative().nullable()
7706
7949
  });
7950
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7951
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7952
+ var RECORD_DATABASES = ["settings", "events"];
7953
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7954
+ var RECORD_CLASSES = [
7955
+ "config",
7956
+ "ledger",
7957
+ "audit",
7958
+ "mirror",
7959
+ "ephemeral"
7960
+ ];
7961
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7962
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7963
+ var RECORD_BATCH_MAX = 1e3;
7964
+ var RECORD_QUERY_MAX = 1e3;
7965
+ /** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
7966
+ var RECORD_SETTINGS_MAX_ROWS = 5e4;
7967
+ var PREFIX = "records/";
7968
+ /** The base of every records failure. `detail` is the human part of the message. */
7969
+ var RecordsError = class extends Error {
7970
+ code;
7971
+ detail;
7972
+ constructor(code, detail) {
7973
+ super(`${PREFIX}${code}: ${detail}`);
7974
+ this.name = "RecordsError";
7975
+ this.code = code;
7976
+ this.detail = detail;
7977
+ }
7978
+ };
7979
+ /** The keychain could not store or serve a value: explicit, never an empty string. */
7980
+ var RecordSecretUnavailableError = class extends RecordsError {
7981
+ constructor(detail) {
7982
+ super("secret-unavailable", detail);
7983
+ this.name = "RecordSecretUnavailableError";
7984
+ }
7985
+ };
7986
+ var InvalidRecordError = class extends RecordsError {
7987
+ constructor(detail) {
7988
+ super("invalid-record", detail);
7989
+ this.name = "InvalidRecordError";
7990
+ }
7991
+ };
7992
+ /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
7993
+ var DeclarationRefusedError = class extends RecordsError {
7994
+ constructor(detail) {
7995
+ super("declaration-refused", detail);
7996
+ this.name = "DeclarationRefusedError";
7997
+ }
7998
+ };
7999
+ function defOf(schema) {
8000
+ const zodBag = Reflect.get(schema, "_zod");
8001
+ if (typeof zodBag !== "object" || zodBag === null) return {};
8002
+ const def = Reflect.get(zodBag, "def");
8003
+ if (typeof def !== "object" || def === null) return {};
8004
+ return def;
8005
+ }
8006
+ function declaredHere(schema) {
8007
+ return globalRegistry.get(schema)?.secret === true;
8008
+ }
8009
+ /** Wrapper kinds whose `innerType` is the field itself. */
8010
+ var WRAPPERS = new Set([
8011
+ "optional",
8012
+ "nullable",
8013
+ "default",
8014
+ "prefault",
8015
+ "catch",
8016
+ "readonly",
8017
+ "nonoptional"
8018
+ ]);
8019
+ /**
8020
+ * The schema layers that make up ONE field: the schema itself and every
8021
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
8022
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8023
+ * `.transform` on `in`).
8024
+ */
8025
+ function layersOf(schema) {
8026
+ const out = [];
8027
+ const queue = [schema];
8028
+ while (queue.length > 0) {
8029
+ const s = queue.shift();
8030
+ if (!s || out.includes(s)) continue;
8031
+ out.push(s);
8032
+ const def = defOf(s);
8033
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8034
+ if (def.type === "pipe") {
8035
+ if (def.in) queue.push(def.in);
8036
+ if (def.out) queue.push(def.out);
8037
+ }
8038
+ }
8039
+ return out;
8040
+ }
8041
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
8042
+ function isZodSecret(schema) {
8043
+ return layersOf(schema).some(declaredHere);
8044
+ }
8045
+ /**
8046
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
8047
+ * element of this array" (`connection.password`, `rows[].token`). A declared
8048
+ * object or array is reported as one path and not descended into — everything
8049
+ * under it is secret.
8050
+ */
8051
+ function collectZodSecretPaths(schema, prefix = "") {
8052
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8053
+ const paths = [];
8054
+ for (const layer of layersOf(schema)) {
8055
+ const def = defOf(layer);
8056
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8057
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8058
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8059
+ else if (def.type === "intersection") {
8060
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8061
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8062
+ }
8063
+ }
8064
+ return [...new Set(paths)];
8065
+ }
8066
+ /**
8067
+ * Secret fields of a record, addressed the way a Zod schema declares them
8068
+ * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
8069
+ * (`auth.accessToken`, `headers[].value`).
8070
+ *
8071
+ * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
8072
+ * `{ headers: 'name' }`), never by index, so reordering a list keeps every
8073
+ * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
8074
+ * leaf names its element: `headers[X-Api].value`.
8075
+ *
8076
+ * Pure and browser-safe. Nothing here mutates: every transform returns a new value.
8077
+ */
8078
+ /** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
8079
+ function parseSecretPath(path) {
8080
+ if (path.length === 0) throw new InvalidRecordError("an empty secret path");
8081
+ return path.split(".").map((raw) => {
8082
+ const each = raw.endsWith("[]");
8083
+ const key = each ? raw.slice(0, -2) : raw;
8084
+ if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
8085
+ return {
8086
+ key,
8087
+ each
8088
+ };
8089
+ });
8090
+ }
8091
+ /** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
8092
+ function secretArrayPrefixes(path) {
8093
+ const segments = parseSecretPath(path);
8094
+ const prefixes = [];
8095
+ const walked = [];
8096
+ for (const segment of segments) {
8097
+ walked.push(segment.key);
8098
+ if (segment.each) prefixes.push(walked.join("."));
8099
+ }
8100
+ return prefixes;
8101
+ }
8102
+ /**
8103
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
8104
+ * Zod row schema that describes it, and the helper that turns the two into the
8105
+ * JSON the engine stores.
8106
+ *
8107
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
8108
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
8109
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
8110
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
8111
+ * never a field name (D879).
8112
+ */
8113
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
8114
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
8115
+ var RecordIndexSchema = object({
8116
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
8117
+ fields: array(RecordFieldPathSchema).min(1).max(4),
8118
+ unique: boolean().optional()
8119
+ }).strict();
8120
+ var RecordRetentionSchema = union([
8121
+ object({
8122
+ ttlMs: number().int().positive(),
8123
+ from: _enum(["at", "write"])
8124
+ }).strict(),
8125
+ object({
8126
+ maxRows: number().int().positive().optional(),
8127
+ maxRowsPerDevice: number().int().positive().optional()
8128
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
8129
+ object({
8130
+ owner: string().min(1),
8131
+ reason: string().min(1)
8132
+ }).strict(),
8133
+ object({ none: string().min(1) }).strict()
8134
+ ]);
8135
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
8136
+ var EntryDescriptorSchema = object({
8137
+ title: string().min(1),
8138
+ /** The record body field shown as the entry's name. */
8139
+ nameField: string().min(1),
8140
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
8141
+ fields: record(string(), unknown())
8142
+ }).strict();
8143
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
8144
+ var RecordKindDeclarationSchema = object({
8145
+ database: _enum(RECORD_DATABASES).default("settings"),
8146
+ class: _enum(RECORD_CLASSES),
8147
+ writeTrigger: string().min(1),
8148
+ device: _enum([
8149
+ "required",
8150
+ "optional",
8151
+ "none"
8152
+ ]).default("none"),
8153
+ at: _enum(["required", "none"]).default("none"),
8154
+ indexes: array(RecordIndexSchema).max(8).default([]),
8155
+ retention: RecordRetentionSchema,
8156
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
8157
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
8158
+ /** Derived from the Zod schema; never written by hand. */
8159
+ secretPaths: array(string().min(1)).default([]),
8160
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
8161
+ secretArrayKeys: record(string(), string()).default({}),
8162
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
8163
+ adoptsFrom: string().min(1).optional(),
8164
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
8165
+ transactFamily: string().min(1).optional(),
8166
+ entry: EntryDescriptorSchema.optional()
8167
+ }).strict();
8168
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
8169
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
8170
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
8171
+ function assertValidDeclaration(name, decl) {
8172
+ const refuse = (why) => {
8173
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
8174
+ };
8175
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
8176
+ const seen = /* @__PURE__ */ new Set();
8177
+ for (const index of decl.indexes) {
8178
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
8179
+ seen.add(index.name);
8180
+ }
8181
+ const { retention } = decl;
8182
+ const hasSecrets = decl.secretPaths.length > 0;
8183
+ if ("ttlMs" in retention) {
8184
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
8185
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
8186
+ }
8187
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
8188
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
8189
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
8190
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
8191
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
8192
+ if (decl.database === "settings" && bound > 5e4) refuse(`a row bound above ${RECORD_SETTINGS_MAX_ROWS} belongs in database: "events" (a big delete on the settings thread stalls every configuration read)`);
8193
+ }
8194
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
8195
+ for (const path of decl.secretPaths) for (const prefix of secretArrayPrefixes(path)) if (decl.secretArrayKeys[prefix] === void 0) refuse(`secret path "${path}" crosses the array "${prefix}": declare its id key in secretArrayKeys`);
8196
+ }
8197
+ function bodyFieldsOf(schema) {
8198
+ return { ...toJSONSchema(schema, {
8199
+ unrepresentable: "any",
8200
+ io: "input"
8201
+ }) };
8202
+ }
8203
+ function isRecordLike(value) {
8204
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8205
+ }
8206
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
8207
+ function hasNameField(json, field) {
8208
+ const branches = json["oneOf"] ?? json["anyOf"];
8209
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
8210
+ const properties = json["properties"];
8211
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
8212
+ }
8213
+ /**
8214
+ * Declare the kinds of a package. The keys are the kind names. The result is
8215
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
8216
+ * types its handle from.
8217
+ */
8218
+ function defineRecordKinds(specs) {
8219
+ const out = {};
8220
+ for (const [name, spec] of Object.entries(specs)) {
8221
+ const secretPaths = collectZodSecretPaths(spec.schema);
8222
+ const nameField = spec.entry?.nameField ?? "name";
8223
+ const fields = bodyFieldsOf(spec.schema);
8224
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
8225
+ const parsed = RecordKindDeclarationSchema.parse({
8226
+ database: spec.database,
8227
+ class: spec.class,
8228
+ writeTrigger: spec.writeTrigger,
8229
+ device: spec.device,
8230
+ at: spec.at,
8231
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
8232
+ retention: spec.retention,
8233
+ deviceRemoval: spec.deviceRemoval,
8234
+ maxDataBytes: spec.maxDataBytes,
8235
+ secretPaths: [...secretPaths],
8236
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
8237
+ adoptsFrom: spec.adoptsFrom,
8238
+ transactFamily: spec.transactFamily,
8239
+ entry: spec.entry === void 0 ? void 0 : {
8240
+ title: spec.entry.title,
8241
+ nameField,
8242
+ fields
8243
+ }
8244
+ });
8245
+ assertValidDeclaration(name, parsed);
8246
+ out[name] = {
8247
+ name,
8248
+ schema: spec.schema,
8249
+ declaration: parsed
8250
+ };
8251
+ }
8252
+ return out;
8253
+ }
8254
+ /**
8255
+ * Entry kinds (D881): every list of user-created entries (notification
8256
+ * targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
8257
+ * kind-specific body, and the admin UI lists/adds/edits/deletes all of them
8258
+ * through the `record-entries` capability with password fields derived from
8259
+ * the schema (`.meta({ secret: true })`).
8260
+ */
8261
+ /** The body of a plain entry: a name and the fields the kind adds. */
8262
+ function entryBody(shape) {
8263
+ return object({
8264
+ name: string().min(1),
8265
+ ...shape
8266
+ });
8267
+ }
8268
+ /**
8269
+ * Declare one entry kind. An entry is configuration: never trimmed by the
8270
+ * engine, never aged, belonging to no device.
8271
+ */
8272
+ function defineEntryKind(name, spec) {
8273
+ const defined = defineRecordKinds({ [name]: {
8274
+ schema: spec.schema,
8275
+ class: "config",
8276
+ writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
8277
+ retention: { none: "an entry goes only when the operator deletes it" },
8278
+ ...spec.database === void 0 ? {} : { database: spec.database },
8279
+ ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
8280
+ ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
8281
+ ...spec.adoptsFrom === void 0 ? {} : { adoptsFrom: spec.adoptsFrom },
8282
+ entry: {
8283
+ title: spec.title,
8284
+ ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
8285
+ }
8286
+ } })[name];
8287
+ if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
8288
+ return defined;
8289
+ }
8290
+ /**
8291
+ * Legacy source for broker entry adoption (B2): brokers live in addon-settings
8292
+ * as one row `<addonId>.brokers` whose value is an array until records-adopt
8293
+ * copies them into the entry kind.
8294
+ */
8295
+ var SETTINGS_BROKERS_ADOPTS_PREFIX = "@settings-brokers/";
8296
+ /** The `adoptsFrom` value for an addon's broker entry kind. */
8297
+ function settingsBrokersAdoptsFrom(addonId) {
8298
+ return `${SETTINGS_BROKERS_ADOPTS_PREFIX}${addonId}`;
8299
+ }
7707
8300
  /** Shared Zod schemas used across streaming capabilities. */
7708
8301
  var CamProfileSchema = _enum([
7709
8302
  "high",
@@ -8168,75 +8761,12 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8168
8761
  kind: "mutation",
8169
8762
  auth: "admin"
8170
8763
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
8171
- function defOf(schema) {
8172
- return schema._zod?.def ?? {};
8173
- }
8174
- function declaredHere(schema) {
8175
- return globalRegistry.get(schema)?.secret === true;
8176
- }
8177
- /** Wrapper kinds whose `innerType` is the field itself. */
8178
- var WRAPPERS = new Set([
8179
- "optional",
8180
- "nullable",
8181
- "default",
8182
- "prefault",
8183
- "catch",
8184
- "readonly",
8185
- "nonoptional"
8186
- ]);
8187
- /**
8188
- * The schema layers that make up ONE field: the schema itself and every
8189
- * wrapper below it (optional / default / nullable / readonly / catch), plus
8190
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8191
- * `.transform` on `in`).
8192
- */
8193
- function layersOf(schema) {
8194
- const out = [];
8195
- const queue = [schema];
8196
- while (queue.length > 0) {
8197
- const s = queue.shift();
8198
- if (!s || out.includes(s)) continue;
8199
- out.push(s);
8200
- const def = defOf(s);
8201
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8202
- if (def.type === "pipe") {
8203
- if (def.in) queue.push(def.in);
8204
- if (def.out) queue.push(def.out);
8205
- }
8206
- }
8207
- return out;
8208
- }
8209
- /** True when any layer of this field declares `.meta({ secret: true })`. */
8210
- function isZodSecret(schema) {
8211
- return layersOf(schema).some(declaredHere);
8212
- }
8213
- /**
8214
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
8215
- * element of this array" (`connection.password`, `rows[].token`). A declared
8216
- * object or array is reported as one path and not descended into — everything
8217
- * under it is secret.
8218
- */
8219
- function collectZodSecretPaths(schema, prefix = "") {
8220
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8221
- const paths = [];
8222
- for (const layer of layersOf(schema)) {
8223
- const def = defOf(layer);
8224
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8225
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8226
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8227
- else if (def.type === "intersection") {
8228
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8229
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8230
- }
8231
- }
8232
- return [...new Set(paths)];
8233
- }
8234
8764
  object({
8235
8765
  code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
8236
8766
  params: record(string(), union([string(), number()])).optional()
8237
8767
  });
8238
8768
  //#endregion
8239
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8769
+ //#region ../types/dist/err-msg-BXKzRBwg.mjs
8240
8770
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8241
8771
  DeviceType["Camera"] = "camera";
8242
8772
  DeviceType["Hub"] = "hub";
@@ -8328,6 +8858,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
8328
8858
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
8329
8859
  * integrations sharing the same food/desiccant/hopper surface. */
8330
8860
  DeviceType["PetFeeder"] = "pet-feeder";
8861
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
8862
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
8863
+ * Sources: native Bosch Home Connect, reusable by similar integrations. */
8864
+ DeviceType["Dishwasher"] = "dishwasher";
8331
8865
  return DeviceType;
8332
8866
  }({});
8333
8867
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -8505,6 +9039,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8505
9039
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8506
9040
  * real Switch device for UI rendering / export adapters. */
8507
9041
  DeviceRole["BinaryHelper"] = "binary-helper";
9042
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
9043
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
9044
+ DeviceRole["Outlet"] = "outlet";
8508
9045
  /** Generic motion / occupancy / moving event source. Distinct from
8509
9046
  * the camera accessory PirSensor role: that one is a camera child;
8510
9047
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8582,7 +9119,7 @@ function errMsg(err) {
8582
9119
  return String(err);
8583
9120
  }
8584
9121
  //#endregion
8585
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
9122
+ //#region ../types/dist/composition-CB6PMT9p.mjs
8586
9123
  /**
8587
9124
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8588
9125
  *
@@ -11786,11 +12323,10 @@ var ClipModelMetaSchema = object({
11786
12323
  /**
11787
12324
  * The `vector-store` index this model's vectors live in. ONE feature space
11788
12325
  * per index: two models share an index only when their vectors are ranked
11789
- * against each other, which for CLIP means never across families. MobileCLIP
11790
- * S1 and S2 share `object-clip` for history (separated by the row's
11791
- * `modelId`); any other model gets its own.
12326
+ * against each other, which for CLIP means never across families. Every
12327
+ * model gets its own.
11792
12328
  */
11793
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12329
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
11794
12330
  /**
11795
12331
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
11796
12332
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -12969,8 +13505,13 @@ var AlertSeveritySchema = _enum([
12969
13505
  "info",
12970
13506
  "success",
12971
13507
  "warning",
12972
- "error"
13508
+ "error",
13509
+ "critical"
12973
13510
  ]);
13511
+ var AlertActionSchema = object({
13512
+ label: string(),
13513
+ href: string().optional()
13514
+ });
12974
13515
  var AlertStatusSchema = _enum([
12975
13516
  "active",
12976
13517
  "in-progress",
@@ -12988,6 +13529,7 @@ var AlertSchema = object({
12988
13529
  severity: AlertSeveritySchema,
12989
13530
  title: string(),
12990
13531
  message: string(),
13532
+ action: AlertActionSchema.optional(),
12991
13533
  status: AlertStatusSchema,
12992
13534
  progress: number().optional(),
12993
13535
  read: boolean(),
@@ -15572,6 +16114,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15572
16114
  keyField: string()
15573
16115
  }).optional()
15574
16116
  })) });
16117
+ /**
16118
+ * The report of a one-shot "move this owner's plaintext secrets into the
16119
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
16120
+ *
16121
+ * The owner runs it on its own rows, through its own write path; an operator
16122
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
16123
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
16124
+ */
16125
+ var RawSecretMigrationInputSchema = object({
16126
+ /** `false` (the default of the script) = report only. */
16127
+ apply: boolean() });
16128
+ var RawSecretMigrationReportSchema = object({
16129
+ apply: boolean(),
16130
+ /** Rows that can carry a secret (a profile, an enrolment). */
16131
+ rows: number().int(),
16132
+ /** Rows whose secret was plaintext when the run started. */
16133
+ raw: number().int(),
16134
+ /** Rows that already held a keychain marker when the run started. */
16135
+ markers: number().int(),
16136
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
16137
+ migrated: number().int(),
16138
+ /** Plaintext rows left in place because the move or its read-back failed. */
16139
+ failed: number().int(),
16140
+ /** After the run: rows still holding plaintext. */
16141
+ remainingRaw: number().int(),
16142
+ /** After the run: markers the keychain could not resolve right now. */
16143
+ unresolvedMarkers: number().int(),
16144
+ /**
16145
+ * A second, redundant copy of the secrets' rows that the run found (and, on
16146
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
16147
+ */
16148
+ redundantCopies: number().int().optional(),
16149
+ /** True when nothing is raw and every marker resolves. */
16150
+ verified: boolean()
16151
+ });
15575
16152
  /** Where a block runs. The operator chooses — a block driving a device on an
15576
16153
  * agent is the reason placement is not fixed to the hub. */
15577
16154
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -15798,6 +16375,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
15798
16375
  }), SettingsUpdateResultSchema, {
15799
16376
  kind: "mutation",
15800
16377
  auth: "admin"
16378
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16379
+ kind: "mutation",
16380
+ auth: "admin"
15801
16381
  }), method(object({}), object({ libs: array(object({
15802
16382
  filePath: string(),
15803
16383
  content: string()
@@ -16061,6 +16641,347 @@ id: union([string(), number()]) }), {
16061
16641
  auth: "admin"
16062
16642
  });
16063
16643
  /**
16644
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16645
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16646
+ * (operator intent, D870) and device-history (numbers over time, D850).
16647
+ *
16648
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16649
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16650
+ * that with the addon id closed over). It is deliberately NOT in any input
16651
+ * schema, so a session can never supply it, and a call with no stamp is refused
16652
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16653
+ * addons go through the owner's capability.
16654
+ *
16655
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16656
+ * never `[]`. Secret fields are never on the wire: a read shows the
16657
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16658
+ * resolves itself, and a write may carry only a keychain marker bound to the
16659
+ * row's own ref.
16660
+ *
16661
+ * Internal: addons reach it through `ctx.records`, never directly.
16662
+ */
16663
+ var RecordIdSchema = string().min(1).max(256);
16664
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16665
+ var RecordBodySchema = record(string(), unknown());
16666
+ var RecordInputSchema = object({
16667
+ id: RecordIdSchema,
16668
+ /** The device this row belongs to (D865 removal, per-device reads). */
16669
+ deviceId: number().int().optional(),
16670
+ /** The domain clock, ms: observed / created / opened. */
16671
+ at: number().int().optional(),
16672
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16673
+ expiresAt: number().int().optional(),
16674
+ data: RecordBodySchema
16675
+ });
16676
+ var RecordViewSchema = object({
16677
+ id: string(),
16678
+ deviceId: number().int().nullable(),
16679
+ at: number().nullable(),
16680
+ expiresAt: number().nullable(),
16681
+ rev: number().int(),
16682
+ updatedAt: number(),
16683
+ data: RecordBodySchema
16684
+ });
16685
+ /** Declared index fields only. Anything else does not compile, by design. */
16686
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16687
+ string(),
16688
+ number(),
16689
+ boolean(),
16690
+ object({ in: array(union([
16691
+ string(),
16692
+ number(),
16693
+ boolean()
16694
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16695
+ object({
16696
+ gt: union([string(), number()]).optional(),
16697
+ gte: union([string(), number()]).optional(),
16698
+ lt: union([string(), number()]).optional(),
16699
+ lte: union([string(), number()]).optional()
16700
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16701
+ ]));
16702
+ var KindShape = { kind: RecordKindNameSchema };
16703
+ var TimeWindowShape = {
16704
+ deviceId: number().int().optional(),
16705
+ atFrom: number().optional(),
16706
+ atTo: number().optional()
16707
+ };
16708
+ var RecordQueryInputSchema = object({
16709
+ ...KindShape,
16710
+ ...TimeWindowShape,
16711
+ where: RecordWhereSchema.optional(),
16712
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16713
+ order: _enum(["at", "id"]).optional(),
16714
+ desc: boolean().optional(),
16715
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16716
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16717
+ cursor: string().min(1).optional()
16718
+ });
16719
+ var RecordQueryResultSchema = object({
16720
+ records: array(RecordViewSchema),
16721
+ nextCursor: string().nullable()
16722
+ });
16723
+ var RecordKindStateSchema = _enum([
16724
+ "created",
16725
+ "unchanged",
16726
+ "updated"
16727
+ ]);
16728
+ var DeclareKindResultSchema = object({
16729
+ kindId: number().int(),
16730
+ state: RecordKindStateSchema,
16731
+ createdIndexes: array(string()),
16732
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16733
+ adoptionPending: object({
16734
+ legacyTable: string(),
16735
+ legacyRows: number().int()
16736
+ }).nullable()
16737
+ });
16738
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16739
+ var SecretRefsList = array(string());
16740
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16741
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16742
+ kind: "mutation",
16743
+ auth: "admin"
16744
+ }), method(object({
16745
+ ...KindShape,
16746
+ id: RecordIdSchema
16747
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16748
+ ...KindShape,
16749
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16750
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16751
+ ...KindShape,
16752
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16753
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16754
+ ...KindShape,
16755
+ record: RecordInputSchema,
16756
+ /** Compare-and-set. `0` means "the row must not exist". */
16757
+ ifRev: number().int().min(0).optional()
16758
+ }), object({
16759
+ rev: number().int(),
16760
+ releasedRefs: SecretRefsList
16761
+ }), {
16762
+ kind: "mutation",
16763
+ auth: "admin"
16764
+ }), method(object({
16765
+ ...KindShape,
16766
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16767
+ }), object({
16768
+ count: number().int(),
16769
+ releasedRefs: SecretRefsList
16770
+ }), {
16771
+ kind: "mutation",
16772
+ auth: "admin"
16773
+ }), method(object({
16774
+ ...KindShape,
16775
+ id: RecordIdSchema,
16776
+ data: RecordBodySchema,
16777
+ at: number().int().nullable().optional(),
16778
+ expiresAt: number().int().nullable().optional(),
16779
+ ifRev: number().int().min(1).optional()
16780
+ }), object({
16781
+ rev: number().int(),
16782
+ releasedRefs: SecretRefsList
16783
+ }), {
16784
+ kind: "mutation",
16785
+ auth: "admin"
16786
+ }), method(object({
16787
+ ...KindShape,
16788
+ id: RecordIdSchema
16789
+ }), object({
16790
+ deleted: boolean(),
16791
+ secretRefs: SecretRefsList
16792
+ }), {
16793
+ kind: "mutation",
16794
+ auth: "admin"
16795
+ }), method(object({
16796
+ ...KindShape,
16797
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16798
+ }), object({
16799
+ deleted: number().int(),
16800
+ secretRefs: SecretRefsList
16801
+ }), {
16802
+ kind: "mutation",
16803
+ auth: "admin"
16804
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16805
+ ...KindShape,
16806
+ ...TimeWindowShape,
16807
+ where: RecordWhereSchema.optional()
16808
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16809
+ ...KindShape,
16810
+ deviceId: number().int().optional(),
16811
+ from: number(),
16812
+ to: number(),
16813
+ bucketMs: number().int().positive()
16814
+ }), object({ buckets: array(object({
16815
+ bucketStart: number(),
16816
+ count: number().int()
16817
+ })) }), { auth: "admin" }), method(object({
16818
+ ...KindShape,
16819
+ op: _enum([
16820
+ "sum",
16821
+ "min",
16822
+ "max",
16823
+ "count"
16824
+ ]),
16825
+ field: RecordFieldPathSchema.optional(),
16826
+ groupBy: RecordFieldPathSchema.optional(),
16827
+ where: RecordWhereSchema.optional()
16828
+ }), object({ rows: array(object({
16829
+ group: union([
16830
+ string(),
16831
+ number(),
16832
+ _null()
16833
+ ]),
16834
+ value: number().nullable()
16835
+ })) }), { auth: "admin" }), method(object({
16836
+ ...KindShape,
16837
+ deviceId: number().int().optional(),
16838
+ atBefore: number().optional(),
16839
+ where: RecordWhereSchema.optional()
16840
+ }), object({
16841
+ deleted: number().int(),
16842
+ secretRefs: SecretRefsList
16843
+ }), {
16844
+ kind: "mutation",
16845
+ auth: "admin"
16846
+ }), method(object({
16847
+ deviceId: number().int(),
16848
+ kinds: array(RecordKindNameSchema).optional()
16849
+ }), object({
16850
+ deleted: record(string(), number().int()),
16851
+ secretRefs: SecretRefsList
16852
+ }), {
16853
+ kind: "mutation",
16854
+ auth: "admin"
16855
+ }), method(object(KindShape), object({ id: number().int() }), {
16856
+ kind: "mutation",
16857
+ auth: "admin"
16858
+ });
16859
+ /** One table of the settings database. */
16860
+ var StorageTableSchema = object({
16861
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
16862
+ name: string(),
16863
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
16864
+ owner: string().nullable(),
16865
+ rows: number().int().nonnegative(),
16866
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
16867
+ bytes: number().int().nonnegative().nullable(),
16868
+ /** Declared by an addon since this engine process started (a running addon claims it). */
16869
+ declaredThisBoot: boolean()
16870
+ });
16871
+ /** One declared record kind (D881) as System -> Data shows it. */
16872
+ var StorageKindSchema = object({
16873
+ owner: string(),
16874
+ kind: string(),
16875
+ database: _enum(["settings", "events"]),
16876
+ class: string(),
16877
+ state: _enum([
16878
+ "declared",
16879
+ "orphaned",
16880
+ "dropped"
16881
+ ]),
16882
+ /** `null` when the caller asked for no counts (`counts: false`). */
16883
+ rows: number().int().nonnegative().nullable(),
16884
+ /** Rows x the average size of a sample; null for an empty kind. */
16885
+ bytesEstimate: number().int().nonnegative().nullable(),
16886
+ writeTrigger: string(),
16887
+ retention: RecordRetentionSchema,
16888
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16889
+ entry: boolean(),
16890
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16891
+ declaration: RecordKindDeclarationSchema
16892
+ });
16893
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16894
+ collection: string().min(1),
16895
+ expectRows: number().int().nonnegative()
16896
+ }), object({
16897
+ dropped: literal(true),
16898
+ rows: number().int().nonnegative()
16899
+ }), {
16900
+ kind: "mutation",
16901
+ auth: "admin"
16902
+ }), method(object({
16903
+ owner: string().min(1).optional(),
16904
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16905
+ counts: boolean().optional()
16906
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16907
+ owner: string().min(1),
16908
+ kind: RecordKindNameSchema
16909
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16910
+ owner: string().min(1),
16911
+ kind: RecordKindNameSchema,
16912
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16913
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16914
+ complete: boolean().optional()
16915
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16916
+ kind: "mutation",
16917
+ auth: "admin"
16918
+ }), method(object({
16919
+ collection: string().min(1),
16920
+ cursor: string().optional(),
16921
+ limit: number().int().min(1).max(1e3).optional()
16922
+ }), object({
16923
+ rows: array(object({
16924
+ id: string(),
16925
+ data: record(string(), unknown())
16926
+ })),
16927
+ nextCursor: string().nullable()
16928
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16929
+ /**
16930
+ * record-entries - the ONE admin surface for every list of user-created entries
16931
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16932
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16933
+ *
16934
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16935
+ * the entry body with `secret: true` on every credential field, so a password
16936
+ * field is derived from the schema and never from a name. `putEntry` takes the
16937
+ * redaction token for an untouched secret (the stored value is kept), a string
16938
+ * for a new one, and the clear instruction to remove one. A read never carries
16939
+ * a secret value, and a locked keychain refuses the write with
16940
+ * `records/secret-unavailable` instead of storing plaintext.
16941
+ *
16942
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16943
+ */
16944
+ var EntryKindInfoSchema = object({
16945
+ owner: string(),
16946
+ kind: RecordKindNameSchema,
16947
+ title: string(),
16948
+ nameField: string(),
16949
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16950
+ fields: record(string(), unknown()),
16951
+ secretPaths: array(string()),
16952
+ rows: number().int().nonnegative()
16953
+ });
16954
+ var EntryViewSchema = object({
16955
+ id: RecordIdSchema,
16956
+ name: string(),
16957
+ rev: number().int(),
16958
+ updatedAt: number(),
16959
+ /** Secret fields hold the redaction token. */
16960
+ data: RecordBodySchema
16961
+ });
16962
+ var EntryAddress = {
16963
+ owner: string().min(1),
16964
+ kind: RecordKindNameSchema
16965
+ };
16966
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16967
+ ...EntryAddress,
16968
+ id: RecordIdSchema.optional(),
16969
+ data: RecordBodySchema,
16970
+ ifRev: number().int().min(1).optional()
16971
+ }), object({
16972
+ id: string(),
16973
+ rev: number().int()
16974
+ }), {
16975
+ kind: "mutation",
16976
+ auth: "admin"
16977
+ }), method(object({
16978
+ ...EntryAddress,
16979
+ id: RecordIdSchema
16980
+ }), object({ deleted: boolean() }), {
16981
+ kind: "mutation",
16982
+ auth: "admin"
16983
+ });
16984
+ /**
16064
16985
  * `keychain` — the hub's encrypted store of secret values (D787).
16065
16986
  *
16066
16987
  * Settings blobs never hold a secret: they hold a marker
@@ -16601,6 +17522,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16601
17522
  kind: "mutation",
16602
17523
  auth: "admin",
16603
17524
  caller: "required"
17525
+ }), method(object({
17526
+ ref: string().min(1),
17527
+ value: string().min(1)
17528
+ }), object({
17529
+ ref: string(),
17530
+ version: number().int()
17531
+ }), {
17532
+ kind: "mutation",
17533
+ auth: "admin",
17534
+ caller: "required"
16604
17535
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16605
17536
  deleted: array(string()).readonly(),
16606
17537
  kept: array(object({
@@ -39392,6 +40323,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39392
40323
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39393
40324
  kind: "mutation",
39394
40325
  auth: "admin"
40326
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
40327
+ kind: "mutation",
40328
+ auth: "admin"
39395
40329
  }), method(ProfileRefInputSchema, _void(), {
39396
40330
  kind: "mutation",
39397
40331
  auth: "admin"
@@ -49901,6 +50835,41 @@ var ServerRollbackInfoSchema = object({
49901
50835
  atMs: number(),
49902
50836
  reason: string()
49903
50837
  });
50838
+ /**
50839
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50840
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50841
+ * service holds, because only the hub plans) against the states the process
50842
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50843
+ * every boot, served on `getServerPackageStatus`.
50844
+ *
50845
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50846
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50847
+ * planned runner the process service has no entry for.
50848
+ */
50849
+ var RunnerRefusalSchema = object({
50850
+ runnerId: string(),
50851
+ addonIds: array(string()),
50852
+ reason: string()
50853
+ });
50854
+ var RunnerBootCheckSchema = object({
50855
+ checkedAtMs: number(),
50856
+ /** Runners planned for this node. */
50857
+ expected: number(),
50858
+ /** Planned runners whose process is `running`. */
50859
+ running: number(),
50860
+ failed: array(string()),
50861
+ refused: array(RunnerRefusalSchema),
50862
+ missing: array(string()),
50863
+ /**
50864
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50865
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50866
+ * pushed and the verdict is re-evaluated on the next runner state change.
50867
+ * Optional for version skew (absent = settled).
50868
+ */
50869
+ pending: array(string()).optional(),
50870
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50871
+ planKnown: boolean()
50872
+ });
49904
50873
  var ServerPackageStatusSchema = object({
49905
50874
  /** Root package name (`@camstack/server` on the hub). */
49906
50875
  packageName: string(),
@@ -49963,7 +50932,14 @@ var ServerPackageStatusSchema = object({
49963
50932
  * for version skew: an older provider's payload simply omits it, and an
49964
50933
  * absent wrapper is unknown — never `native`.
49965
50934
  */
49966
- wrapper: WrapperIdentitySchema.optional()
50935
+ wrapper: WrapperIdentitySchema.optional(),
50936
+ /**
50937
+ * What this node PLANNED to run against what its process service reports
50938
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50939
+ * on a provider that predates it. Absent is "not checked yet", never "all
50940
+ * well": a consumer that needs the answer treats it as pending.
50941
+ */
50942
+ runners: RunnerBootCheckSchema.optional()
49967
50943
  });
49968
50944
  var ServerUpdateCheckResultSchema = object({
49969
50945
  packageName: string(),
@@ -50014,6 +50990,13 @@ var ServerUpdateOutcomeSchema = _enum([
50014
50990
  "refused",
50015
50991
  "failed"
50016
50992
  ]);
50993
+ /** One addon the pre-flight found the target version would refuse (D877). */
50994
+ var UpdateBlockerSchema = object({
50995
+ addonId: string(),
50996
+ reason: string(),
50997
+ /** What the operator does about it. */
50998
+ remedy: string()
50999
+ });
50017
51000
  var ServerUpdateActionResultSchema = object({
50018
51001
  accepted: boolean(),
50019
51002
  targetVersion: string().nullable(),
@@ -50031,14 +51014,27 @@ var ServerUpdateActionResultSchema = object({
50031
51014
  * The failure itself, verbatim enough to act on (the npm output for a
50032
51015
  * staging install). Non-null only for `failed`.
50033
51016
  */
50034
- error: string().nullable().optional()
51017
+ error: string().nullable().optional(),
51018
+ /**
51019
+ * The addons the target version would refuse to start on this node's live
51020
+ * store (D877), present when the pre-flight refused the update
51021
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
51022
+ */
51023
+ blockers: array(UpdateBlockerSchema).optional()
50035
51024
  });
50036
51025
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
50037
51026
  kind: "mutation",
50038
51027
  auth: "admin"
50039
- }), method(object({
50040
- /** Explicit target version; omitted = latest from the registry. */
50041
- version: string().optional() }), ServerUpdateActionResultSchema, {
51028
+ }), method(object({
51029
+ /** Explicit target version; omitted = latest from the registry. */
51030
+ version: string().optional(),
51031
+ /**
51032
+ * Apply even though the pre-flight (D877) found addons the target would
51033
+ * refuse to start. Off by default: those addons stay down until the
51034
+ * remedy is run, which is the incident this gate exists to prevent.
51035
+ */
51036
+ acknowledgeRefusals: boolean().optional()
51037
+ }), ServerUpdateActionResultSchema, {
50042
51038
  kind: "mutation",
50043
51039
  auth: "admin",
50044
51040
  timeoutMs: 16 * 6e4
@@ -52484,7 +53480,9 @@ var ManifestShapeSchema = object({
52484
53480
  var AddonProcessSchema = object({
52485
53481
  pid: number().optional(),
52486
53482
  mode: string(),
52487
- state: string()
53483
+ state: string(),
53484
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53485
+ reason: string().optional()
52488
53486
  });
52489
53487
  /**
52490
53488
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -53252,7 +54250,8 @@ var batteryCapability = {
53252
54250
  DeviceType.Button,
53253
54251
  DeviceType.Switch,
53254
54252
  DeviceType.PetFeeder,
53255
- DeviceType.Container
54253
+ DeviceType.Container,
54254
+ DeviceType.Thermostat
53256
54255
  ],
53257
54256
  methods: {
53258
54257
  /**
@@ -53873,6 +54872,12 @@ var ClimateControlStatusSchema = object({
53873
54872
  /** Horizontal louver swing on/off. Null when the device has no
53874
54873
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
53875
54874
  swingHorizontal: boolean().nullable(),
54875
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
54876
+ minTemp: number().nullable().optional(),
54877
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
54878
+ maxTemp: number().nullable().optional(),
54879
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
54880
+ tempStep: number().positive().nullable().optional(),
53876
54881
  /** Ms epoch when the slice was last updated (push or command). */
53877
54882
  lastFetchedAt: number()
53878
54883
  });
@@ -54719,6 +55724,125 @@ onStatusChanged: { data: object({
54719
55724
  * whether persisting is worth a SQLite commit. */
54720
55725
  volatileStateFields: ["lastChangedAt"]
54721
55726
  };
55727
+ /**
55728
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
55729
+ * consumable levels (salt, rinse aid) and common program options.
55730
+ *
55731
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
55732
+ * by any integration that exposes the same program / option surface.
55733
+ *
55734
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
55735
+ * provider refreshes the slice on an interval and eagerly after commands.
55736
+ */
55737
+ var DishwasherStateSchema = _enum([
55738
+ "idle",
55739
+ "running",
55740
+ "paused",
55741
+ "finished",
55742
+ "error",
55743
+ "unavailable"
55744
+ ]);
55745
+ var DishwasherConsumableLevelSchema = _enum([
55746
+ "ok",
55747
+ "low",
55748
+ "empty"
55749
+ ]);
55750
+ var DishwasherStatusSchema = object({
55751
+ state: DishwasherStateSchema,
55752
+ /** Active program id/name, or null when none selected / unknown. */
55753
+ program: string().nullable(),
55754
+ /** Program tokens the hardware accepts — drives the UI selector. */
55755
+ availablePrograms: array(string()),
55756
+ /** Minutes remaining on the active cycle, or null when not running. */
55757
+ remainingMinutes: number().int().nonnegative().nullable(),
55758
+ /** Cycle completion 0..100, or null when not applicable. */
55759
+ progressPercent: number().min(0).max(100).nullable(),
55760
+ /** True when the door is reported open. */
55761
+ doorOpen: boolean(),
55762
+ /** True when remote start is allowed (door closed, power on, etc.). */
55763
+ remoteStartAllowed: boolean(),
55764
+ /** Main power / switched-on state. */
55765
+ powerOn: boolean(),
55766
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
55767
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
55768
+ halfLoad: boolean(),
55769
+ hygienePlus: boolean(),
55770
+ errorCode: number().nullable(),
55771
+ errorLabel: string().nullable(),
55772
+ lastFetchedAt: number()
55773
+ });
55774
+ var dishwasherCapability = {
55775
+ name: "dishwasher",
55776
+ scope: "device",
55777
+ deviceNative: true,
55778
+ mode: "singleton",
55779
+ deviceTypes: [DeviceType.Dishwasher],
55780
+ methods: {
55781
+ start: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55782
+ kind: "mutation",
55783
+ auth: "protected"
55784
+ }),
55785
+ pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55786
+ kind: "mutation",
55787
+ auth: "protected"
55788
+ }),
55789
+ stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55790
+ kind: "mutation",
55791
+ auth: "protected"
55792
+ }),
55793
+ setProgram: method(object({
55794
+ deviceId: number().int().nonnegative(),
55795
+ program: string().min(1)
55796
+ }), _void(), {
55797
+ kind: "mutation",
55798
+ auth: "protected"
55799
+ }),
55800
+ setPower: method(object({
55801
+ deviceId: number().int().nonnegative(),
55802
+ on: boolean()
55803
+ }), _void(), {
55804
+ kind: "mutation",
55805
+ auth: "protected"
55806
+ }),
55807
+ setHalfLoad: method(object({
55808
+ deviceId: number().int().nonnegative(),
55809
+ on: boolean()
55810
+ }), _void(), {
55811
+ kind: "mutation",
55812
+ auth: "protected"
55813
+ }),
55814
+ setHygienePlus: method(object({
55815
+ deviceId: number().int().nonnegative(),
55816
+ on: boolean()
55817
+ }), _void(), {
55818
+ kind: "mutation",
55819
+ auth: "protected"
55820
+ }),
55821
+ setOption: method(object({
55822
+ deviceId: number().int().nonnegative(),
55823
+ key: string().min(1),
55824
+ value: union([
55825
+ boolean(),
55826
+ string(),
55827
+ number()
55828
+ ])
55829
+ }), _void(), {
55830
+ kind: "mutation",
55831
+ auth: "protected"
55832
+ })
55833
+ },
55834
+ status: {
55835
+ schema: DishwasherStatusSchema,
55836
+ kind: "poll"
55837
+ },
55838
+ runtimeState: DishwasherStatusSchema,
55839
+ durability: "session",
55840
+ history: { fields: { progressPercent: {
55841
+ kind: "gauge",
55842
+ unit: "%",
55843
+ deadband: 2
55844
+ } } }
55845
+ };
54722
55846
  var DoorbellStatusSchema = object({
54723
55847
  /** Ms epoch of the last press. null = never observed since this provider started. */
54724
55848
  lastPressedAt: number().nullable(),
@@ -55521,6 +56645,32 @@ var gasCapability = {
55521
56645
  * whether persisting is worth a SQLite commit. */
55522
56646
  volatileStateFields: ["lastChangedAt"]
55523
56647
  };
56648
+ var HeatingValveStatusSchema = object({
56649
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
56650
+ position: number().min(0).max(100).nullable(),
56651
+ /** Ms epoch when the slice was last updated (push or poll). */
56652
+ lastFetchedAt: number()
56653
+ });
56654
+ var heatingValveCapability = {
56655
+ name: "heating-valve",
56656
+ scope: "device",
56657
+ deviceNative: true,
56658
+ mode: "singleton",
56659
+ deviceTypes: [DeviceType.Thermostat],
56660
+ methods: {},
56661
+ status: {
56662
+ schema: HeatingValveStatusSchema,
56663
+ kind: "push"
56664
+ },
56665
+ runtimeState: HeatingValveStatusSchema,
56666
+ durability: "session",
56667
+ history: { fields: { position: {
56668
+ kind: "gauge",
56669
+ unit: "%",
56670
+ deadband: 1
56671
+ } } },
56672
+ volatileStateFields: ["lastFetchedAt"]
56673
+ };
55524
56674
  /**
55525
56675
  * Humidifier / dehumidifier cap. Models HA `humidifier.*` entities —
55526
56676
  * an on/off actuator with an optional target-humidity setpoint and an
@@ -56653,7 +57803,19 @@ var TlsStatusSchema = object({
56653
57803
  sans: array(string()),
56654
57804
  caCertPem: string().nullable(),
56655
57805
  reissueError: string().nullable(),
56656
- restartRequired: boolean()
57806
+ restartRequired: boolean(),
57807
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
57808
+ caMissing: boolean(),
57809
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
57810
+ localCaConstrained: boolean().nullable(),
57811
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
57812
+ caReplacedAt: string().nullable(),
57813
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
57814
+ storedUpload: object({
57815
+ leafFingerprintSha256: string(),
57816
+ validTo: string(),
57817
+ hasCa: boolean()
57818
+ }).nullable()
56657
57819
  });
56658
57820
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
56659
57821
  /**
@@ -56709,6 +57871,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
56709
57871
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
56710
57872
  kind: "mutation",
56711
57873
  auth: "admin"
57874
+ }), method(_void(), TlsStatusSchema, {
57875
+ kind: "mutation",
57876
+ auth: "admin"
56712
57877
  });
56713
57878
  var LockControlStatusSchema = object({
56714
57879
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -63202,7 +64367,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
63202
64367
  kind: "mutation",
63203
64368
  auth: "admin",
63204
64369
  access: "delete"
63205
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
64370
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
64371
+ kind: "mutation",
64372
+ auth: "admin",
64373
+ access: "create"
64374
+ }), method(object({
63206
64375
  userId: string(),
63207
64376
  code: string()
63208
64377
  }), object({ valid: boolean() }), {
@@ -64922,6 +66091,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
64922
66091
  dayNight: dayNightCapability,
64923
66092
  deviceDiscovery: deviceDiscoveryCapability,
64924
66093
  deviceStatus: deviceStatusCapability,
66094
+ dishwasher: dishwasherCapability,
64925
66095
  doorbell: doorbellCapability,
64926
66096
  enumSensor: enumSensorCapability,
64927
66097
  eventEmitter: eventEmitterCapability,
@@ -64929,6 +66099,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
64929
66099
  featureProbe: featureProbeCapability,
64930
66100
  flood: floodCapability,
64931
66101
  gas: gasCapability,
66102
+ heatingValve: heatingValveCapability,
64932
66103
  humidifier: humidifierCapability,
64933
66104
  humiditySensor: humiditySensorCapability,
64934
66105
  image: imageCapability,
@@ -65014,13 +66185,14 @@ var BaseDevice = class {
65014
66185
  get state() {
65015
66186
  if (!this._stateProxyCache) {
65016
66187
  const cache = {};
65017
- const handler = { get: (_target, key) => {
66188
+ const handler = { get: (target, key) => {
65018
66189
  const k = key;
65019
- if (k in cache) return cache[k];
66190
+ const existing = Reflect.get(target, k);
66191
+ if (existing !== void 0) return existing;
65020
66192
  const cap = DEVICE_LOCAL_STATE_CAPS[k];
65021
66193
  if (!cap) return void 0;
65022
66194
  const proxy = this.sliceProxy(cap);
65023
- cache[k] = proxy;
66195
+ Reflect.set(target, k, proxy);
65024
66196
  return proxy;
65025
66197
  } };
65026
66198
  this._stateProxyCache = new Proxy(cache, handler);
@@ -65219,7 +66391,7 @@ var BaseDevice = class {
65219
66391
  async updateSourceInfo(patch) {
65220
66392
  const next = mergeSourceInfo(this.sourceInfo, patch);
65221
66393
  this._sourceInfoCache = Object.freeze({ ...next });
65222
- const action = this.ctx.api?.deviceManager?.setMetadata;
66394
+ const action = this.ctx.api.deviceManager?.setMetadata;
65223
66395
  if (action) try {
65224
66396
  await action.mutate({
65225
66397
  deviceId: this.id,
@@ -65254,7 +66426,7 @@ var BaseDevice = class {
65254
66426
  * device boot on a meta refresh.
65255
66427
  */
65256
66428
  async refreshFeatures() {
65257
- const action = this.ctx.api?.deviceManager?.registerDevice;
66429
+ const action = this.ctx.api.deviceManager?.registerDevice;
65258
66430
  if (!action) return;
65259
66431
  try {
65260
66432
  await action.mutate({
@@ -65653,6 +66825,12 @@ var BaseDeviceProvider = class extends BaseAddon {
65653
66825
  provider: this
65654
66826
  }];
65655
66827
  }
66828
+ /** Flatten `super.onInitialize()` whether it returned an array or an envelope. */
66829
+ providerRegistrationsFromSuper(result) {
66830
+ if (Array.isArray(result)) return result;
66831
+ if (result !== void 0 && result.providers !== void 0) return [...result.providers];
66832
+ return [];
66833
+ }
65656
66834
  async onShutdown() {
65657
66835
  this._restoreShuttingDown = true;
65658
66836
  this.cancelRestoreRetries();
@@ -66179,7 +67357,7 @@ var BaseDeviceProvider = class extends BaseAddon {
66179
67357
  return toDeviceSummary(device, this.addonId);
66180
67358
  }
66181
67359
  };
66182
- DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder;
67360
+ DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher;
66183
67361
  new Set(Object.values(DeviceType));
66184
67362
  Object.freeze({
66185
67363
  "accessories.getStatus": {
@@ -67328,6 +68506,12 @@ Object.freeze({
67328
68506
  addonId: null,
67329
68507
  access: "view"
67330
68508
  },
68509
+ "coreBlocks.migrateRawSecrets": {
68510
+ capName: "core-blocks",
68511
+ capScope: "system",
68512
+ addonId: null,
68513
+ access: "create"
68514
+ },
67331
68515
  "coreBlocks.restart": {
67332
68516
  capName: "core-blocks",
67333
68517
  capScope: "system",
@@ -68594,6 +69778,60 @@ Object.freeze({
68594
69778
  addonId: null,
68595
69779
  access: "view"
68596
69780
  },
69781
+ "dishwasher.getStatus": {
69782
+ capName: "dishwasher",
69783
+ capScope: "device",
69784
+ addonId: null,
69785
+ access: "view"
69786
+ },
69787
+ "dishwasher.pause": {
69788
+ capName: "dishwasher",
69789
+ capScope: "device",
69790
+ addonId: null,
69791
+ access: "create"
69792
+ },
69793
+ "dishwasher.setHalfLoad": {
69794
+ capName: "dishwasher",
69795
+ capScope: "device",
69796
+ addonId: null,
69797
+ access: "create"
69798
+ },
69799
+ "dishwasher.setHygienePlus": {
69800
+ capName: "dishwasher",
69801
+ capScope: "device",
69802
+ addonId: null,
69803
+ access: "create"
69804
+ },
69805
+ "dishwasher.setOption": {
69806
+ capName: "dishwasher",
69807
+ capScope: "device",
69808
+ addonId: null,
69809
+ access: "create"
69810
+ },
69811
+ "dishwasher.setPower": {
69812
+ capName: "dishwasher",
69813
+ capScope: "device",
69814
+ addonId: null,
69815
+ access: "create"
69816
+ },
69817
+ "dishwasher.setProgram": {
69818
+ capName: "dishwasher",
69819
+ capScope: "device",
69820
+ addonId: null,
69821
+ access: "create"
69822
+ },
69823
+ "dishwasher.start": {
69824
+ capName: "dishwasher",
69825
+ capScope: "device",
69826
+ addonId: null,
69827
+ access: "create"
69828
+ },
69829
+ "dishwasher.stop": {
69830
+ capName: "dishwasher",
69831
+ capScope: "device",
69832
+ addonId: null,
69833
+ access: "create"
69834
+ },
68597
69835
  "doorbell.getStatus": {
68598
69836
  capName: "doorbell",
68599
69837
  capScope: "device",
@@ -68804,6 +70042,12 @@ Object.freeze({
68804
70042
  addonId: null,
68805
70043
  access: "view"
68806
70044
  },
70045
+ "heatingValve.getStatus": {
70046
+ capName: "heating-valve",
70047
+ capScope: "device",
70048
+ addonId: null,
70049
+ access: "view"
70050
+ },
68807
70051
  "humidifier.getStatus": {
68808
70052
  capName: "humidifier",
68809
70053
  capScope: "device",
@@ -69014,6 +70258,12 @@ Object.freeze({
69014
70258
  addonId: null,
69015
70259
  access: "create"
69016
70260
  },
70261
+ "keychainAdmin.importSecret": {
70262
+ capName: "keychain-admin",
70263
+ capScope: "system",
70264
+ addonId: null,
70265
+ access: "create"
70266
+ },
69017
70267
  "keychainAdmin.listAudit": {
69018
70268
  capName: "keychain-admin",
69019
70269
  capScope: "system",
@@ -69182,6 +70432,12 @@ Object.freeze({
69182
70432
  addonId: null,
69183
70433
  access: "view"
69184
70434
  },
70435
+ "llm.migrateRawSecrets": {
70436
+ capName: "llm",
70437
+ capScope: "system",
70438
+ addonId: null,
70439
+ access: "create"
70440
+ },
69185
70441
  "llm.resolveModelRef": {
69186
70442
  capName: "llm",
69187
70443
  capScope: "system",
@@ -69410,6 +70666,12 @@ Object.freeze({
69410
70666
  addonId: null,
69411
70667
  access: "create"
69412
70668
  },
70669
+ "localNetwork.useStoredUploadedCertificate": {
70670
+ capName: "local-network",
70671
+ capScope: "system",
70672
+ addonId: null,
70673
+ access: "create"
70674
+ },
69413
70675
  "lockControl.getStatus": {
69414
70676
  capName: "lock-control",
69415
70677
  capScope: "device",
@@ -72062,6 +73324,30 @@ Object.freeze({
72062
73324
  addonId: null,
72063
73325
  access: "create"
72064
73326
  },
73327
+ "recordEntries.deleteEntry": {
73328
+ capName: "record-entries",
73329
+ capScope: "system",
73330
+ addonId: null,
73331
+ access: "delete"
73332
+ },
73333
+ "recordEntries.listEntries": {
73334
+ capName: "record-entries",
73335
+ capScope: "system",
73336
+ addonId: null,
73337
+ access: "view"
73338
+ },
73339
+ "recordEntries.listEntryKinds": {
73340
+ capName: "record-entries",
73341
+ capScope: "system",
73342
+ addonId: null,
73343
+ access: "view"
73344
+ },
73345
+ "recordEntries.putEntry": {
73346
+ capName: "record-entries",
73347
+ capScope: "system",
73348
+ addonId: null,
73349
+ access: "create"
73350
+ },
72065
73351
  "recording.getAvailability": {
72066
73352
  capName: "recording",
72067
73353
  capScope: "device",
@@ -72362,6 +73648,102 @@ Object.freeze({
72362
73648
  addonId: null,
72363
73649
  access: "view"
72364
73650
  },
73651
+ "records.aggregate": {
73652
+ capName: "records",
73653
+ capScope: "system",
73654
+ addonId: null,
73655
+ access: "view"
73656
+ },
73657
+ "records.allocateId": {
73658
+ capName: "records",
73659
+ capScope: "system",
73660
+ addonId: null,
73661
+ access: "create"
73662
+ },
73663
+ "records.count": {
73664
+ capName: "records",
73665
+ capScope: "system",
73666
+ addonId: null,
73667
+ access: "view"
73668
+ },
73669
+ "records.declareKinds": {
73670
+ capName: "records",
73671
+ capScope: "system",
73672
+ addonId: null,
73673
+ access: "create"
73674
+ },
73675
+ "records.delete": {
73676
+ capName: "records",
73677
+ capScope: "system",
73678
+ addonId: null,
73679
+ access: "delete"
73680
+ },
73681
+ "records.deleteDevice": {
73682
+ capName: "records",
73683
+ capScope: "system",
73684
+ addonId: null,
73685
+ access: "delete"
73686
+ },
73687
+ "records.deleteMany": {
73688
+ capName: "records",
73689
+ capScope: "system",
73690
+ addonId: null,
73691
+ access: "delete"
73692
+ },
73693
+ "records.deleteWhere": {
73694
+ capName: "records",
73695
+ capScope: "system",
73696
+ addonId: null,
73697
+ access: "delete"
73698
+ },
73699
+ "records.get": {
73700
+ capName: "records",
73701
+ capScope: "system",
73702
+ addonId: null,
73703
+ access: "view"
73704
+ },
73705
+ "records.getMany": {
73706
+ capName: "records",
73707
+ capScope: "system",
73708
+ addonId: null,
73709
+ access: "view"
73710
+ },
73711
+ "records.histogram": {
73712
+ capName: "records",
73713
+ capScope: "system",
73714
+ addonId: null,
73715
+ access: "view"
73716
+ },
73717
+ "records.patch": {
73718
+ capName: "records",
73719
+ capScope: "system",
73720
+ addonId: null,
73721
+ access: "create"
73722
+ },
73723
+ "records.put": {
73724
+ capName: "records",
73725
+ capScope: "system",
73726
+ addonId: null,
73727
+ access: "create"
73728
+ },
73729
+ "records.putMany": {
73730
+ capName: "records",
73731
+ capScope: "system",
73732
+ addonId: null,
73733
+ access: "create"
73734
+ },
73735
+ "records.query": {
73736
+ capName: "records",
73737
+ capScope: "system",
73738
+ addonId: null,
73739
+ access: "view"
73740
+ },
73741
+ "records.secretRefs": {
73742
+ capName: "records",
73743
+ capScope: "system",
73744
+ addonId: null,
73745
+ access: "view"
73746
+ },
72365
73747
  "sceneMonitor.captureReference": {
72366
73748
  capName: "scene-monitor",
72367
73749
  capScope: "device",
@@ -72794,6 +74176,48 @@ Object.freeze({
72794
74176
  addonId: null,
72795
74177
  access: "create"
72796
74178
  },
74179
+ "storageAdmin.adoptRecords": {
74180
+ capName: "storage-admin",
74181
+ capScope: "system",
74182
+ addonId: null,
74183
+ access: "create"
74184
+ },
74185
+ "storageAdmin.dropCollection": {
74186
+ capName: "storage-admin",
74187
+ capScope: "system",
74188
+ addonId: null,
74189
+ access: "delete"
74190
+ },
74191
+ "storageAdmin.isAdoptedLegacyTable": {
74192
+ capName: "storage-admin",
74193
+ capScope: "system",
74194
+ addonId: null,
74195
+ access: "view"
74196
+ },
74197
+ "storageAdmin.listKinds": {
74198
+ capName: "storage-admin",
74199
+ capScope: "system",
74200
+ addonId: null,
74201
+ access: "view"
74202
+ },
74203
+ "storageAdmin.listTables": {
74204
+ capName: "storage-admin",
74205
+ capScope: "system",
74206
+ addonId: null,
74207
+ access: "view"
74208
+ },
74209
+ "storageAdmin.readLegacyCollection": {
74210
+ capName: "storage-admin",
74211
+ capScope: "system",
74212
+ addonId: null,
74213
+ access: "view"
74214
+ },
74215
+ "storageAdmin.readRecords": {
74216
+ capName: "storage-admin",
74217
+ capScope: "system",
74218
+ addonId: null,
74219
+ access: "view"
74220
+ },
72797
74221
  "storageEvictable.evict": {
72798
74222
  capName: "storage-evictable",
72799
74223
  capScope: "system",
@@ -73706,6 +75130,12 @@ Object.freeze({
73706
75130
  addonId: null,
73707
75131
  access: "view"
73708
75132
  },
75133
+ "userManagement.migrateRawSecrets": {
75134
+ capName: "user-management",
75135
+ capScope: "system",
75136
+ addonId: null,
75137
+ access: "create"
75138
+ },
73709
75139
  "userManagement.oauthExchangeCode": {
73710
75140
  capName: "user-management",
73711
75141
  capScope: "system",
@@ -74205,7 +75635,7 @@ Object.freeze({
74205
75635
  access: "create"
74206
75636
  }
74207
75637
  });
74208
- DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder;
75638
+ DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher;
74209
75639
  DeviceFeature.BatteryOperated;
74210
75640
  Object.freeze({
74211
75641
  "accessories.getStatus": [{
@@ -75029,6 +76459,51 @@ Object.freeze({
75029
76459
  form: "single",
75030
76460
  optional: false
75031
76461
  }],
76462
+ "dishwasher.getStatus": [{
76463
+ name: "deviceId",
76464
+ form: "single",
76465
+ optional: false
76466
+ }],
76467
+ "dishwasher.pause": [{
76468
+ name: "deviceId",
76469
+ form: "single",
76470
+ optional: false
76471
+ }],
76472
+ "dishwasher.setHalfLoad": [{
76473
+ name: "deviceId",
76474
+ form: "single",
76475
+ optional: false
76476
+ }],
76477
+ "dishwasher.setHygienePlus": [{
76478
+ name: "deviceId",
76479
+ form: "single",
76480
+ optional: false
76481
+ }],
76482
+ "dishwasher.setOption": [{
76483
+ name: "deviceId",
76484
+ form: "single",
76485
+ optional: false
76486
+ }],
76487
+ "dishwasher.setPower": [{
76488
+ name: "deviceId",
76489
+ form: "single",
76490
+ optional: false
76491
+ }],
76492
+ "dishwasher.setProgram": [{
76493
+ name: "deviceId",
76494
+ form: "single",
76495
+ optional: false
76496
+ }],
76497
+ "dishwasher.start": [{
76498
+ name: "deviceId",
76499
+ form: "single",
76500
+ optional: false
76501
+ }],
76502
+ "dishwasher.stop": [{
76503
+ name: "deviceId",
76504
+ form: "single",
76505
+ optional: false
76506
+ }],
75032
76507
  "doorbell.getStatus": [{
75033
76508
  name: "deviceId",
75034
76509
  form: "single",
@@ -75098,6 +76573,11 @@ Object.freeze({
75098
76573
  form: "single",
75099
76574
  optional: false
75100
76575
  }],
76576
+ "heatingValve.getStatus": [{
76577
+ name: "deviceId",
76578
+ form: "single",
76579
+ optional: false
76580
+ }],
75101
76581
  "humidifier.getStatus": [{
75102
76582
  name: "deviceId",
75103
76583
  form: "single",
@@ -76382,6 +77862,37 @@ Object.freeze({
76382
77862
  form: "single",
76383
77863
  optional: false
76384
77864
  }],
77865
+ "records.count": [{
77866
+ name: "deviceId",
77867
+ form: "single",
77868
+ optional: true
77869
+ }],
77870
+ "records.deleteDevice": [{
77871
+ name: "deviceId",
77872
+ form: "single",
77873
+ optional: false
77874
+ }],
77875
+ "records.deleteWhere": [{
77876
+ name: "deviceId",
77877
+ form: "single",
77878
+ optional: true
77879
+ }],
77880
+ "records.histogram": [{
77881
+ name: "deviceId",
77882
+ form: "single",
77883
+ optional: true
77884
+ }],
77885
+ "records.putMany": [{
77886
+ name: "records",
77887
+ form: "object-array",
77888
+ optional: false,
77889
+ itemField: "deviceId"
77890
+ }],
77891
+ "records.query": [{
77892
+ name: "deviceId",
77893
+ form: "single",
77894
+ optional: true
77895
+ }],
76385
77896
  "sceneMonitor.captureReference": [{
76386
77897
  name: "deviceId",
76387
77898
  form: "single",
@@ -76498,6 +78009,17 @@ Object.freeze({
76498
78009
  form: "single",
76499
78010
  optional: false
76500
78011
  }],
78012
+ "storageAdmin.adoptRecords": [{
78013
+ name: "records",
78014
+ form: "object-array",
78015
+ optional: false,
78016
+ itemField: "deviceId"
78017
+ }],
78018
+ "storageAdmin.readRecords": [{
78019
+ name: "deviceId",
78020
+ form: "single",
78021
+ optional: true
78022
+ }],
76501
78023
  "streamBroker.acquireEgressTranscode": [{
76502
78024
  name: "deviceId",
76503
78025
  form: "single",
@@ -78082,12 +79604,12 @@ function toHomematicOptions(config) {
78082
79604
  };
78083
79605
  }
78084
79606
  /**
78085
- * Top-level addon config that replaces the old single-CCU
78086
- * `{connection: HomematicConfig|null}` shape. Holds an ordered list of
78087
- * broker entries; the list defaults to empty so a fresh install requires
78088
- * no explicit initialisation.
79607
+ * A single registered Homematic CCU hub ("broker"). One broker entry maps
79608
+ * 1-to-1 with an operator-added integration and holds the validated CCU
79609
+ * connection settings plus an optional back-reference to the spawning
79610
+ * integration (used for cascade-delete when the integration is removed).
78089
79611
  */
78090
- var homematicAddonConfigSchema = object({ brokers: array(object({
79612
+ var HmBrokerEntrySchema = object({
78091
79613
  /** Stable opaque identifier — e.g. 'hm_001', 'hm_002'. */
78092
79614
  id: string().min(1),
78093
79615
  /** Human-readable label shown in the admin UI. */
@@ -78096,7 +79618,14 @@ var homematicAddonConfigSchema = object({ brokers: array(object({
78096
79618
  connection: homematicConfigSchema,
78097
79619
  /** FK to the spawning integration — auto-cleanup on integration delete. */
78098
79620
  integrationId: string().optional()
78099
- })).default([]) });
79621
+ });
79622
+ /**
79623
+ * Top-level addon config that replaces the old single-CCU
79624
+ * `{connection: HomematicConfig|null}` shape. Holds an ordered list of
79625
+ * broker entries; the list defaults to empty so a fresh install requires
79626
+ * no explicit initialisation.
79627
+ */
79628
+ var homematicAddonConfigSchema = object({ brokers: array(HmBrokerEntrySchema).default([]) });
78100
79629
  /**
78101
79630
  * Coerce a loose settings blob (e.g. from the broker `add`/`setSettings`
78102
79631
  * cap) through the connection schema, applying all schema defaults. Throws
@@ -78255,6 +79784,70 @@ function buildConnectionFormSchema() {
78255
79784
  }
78256
79785
  ] };
78257
79786
  }
79787
+ var hmBrokersEntryKind = defineEntryKind("brokers", {
79788
+ title: "Homematic brokers",
79789
+ schema: entryBody({
79790
+ connection: HmBrokerEntrySchema.shape.connection,
79791
+ integrationId: string().optional()
79792
+ }),
79793
+ writeTrigger: "an operator adds, edits or removes a Homematic CCU broker connection",
79794
+ adoptsFrom: settingsBrokersAdoptsFrom("provider-homematic")
79795
+ });
79796
+ //#endregion
79797
+ //#region src/hm-broker-store.ts
79798
+ function rowToEntry(id, data) {
79799
+ const parsed = HmBrokerEntrySchema.safeParse({
79800
+ id,
79801
+ name: data.name,
79802
+ connection: data.connection,
79803
+ integrationId: data.integrationId
79804
+ });
79805
+ return parsed.success ? parsed.data : null;
79806
+ }
79807
+ var HmBrokerStore = class HmBrokerStore {
79808
+ kind;
79809
+ constructor(kind) {
79810
+ this.kind = kind;
79811
+ }
79812
+ static of(records) {
79813
+ return new HmBrokerStore(records.kind(hmBrokersEntryKind));
79814
+ }
79815
+ async listResolved() {
79816
+ const page = await this.kind.query({ limit: 1e3 });
79817
+ const out = [];
79818
+ for (const record of page.records) {
79819
+ let data = record.data;
79820
+ try {
79821
+ const resolved = await this.kind.getResolved(record.id);
79822
+ if (resolved !== null) data = resolved.data;
79823
+ } catch (err) {
79824
+ if (!(err instanceof RecordSecretUnavailableError)) throw err;
79825
+ }
79826
+ const entry = rowToEntry(record.id, data);
79827
+ if (entry !== null) out.push(entry);
79828
+ }
79829
+ return out;
79830
+ }
79831
+ async replaceAll(entries) {
79832
+ const page = await this.kind.query({ limit: 1e3 });
79833
+ const nextIds = new Set(entries.map((e) => e.id));
79834
+ for (const row of page.records) if (!nextIds.has(row.id)) await this.kind.delete(row.id);
79835
+ for (const entry of entries) {
79836
+ const { id, name, connection, integrationId } = entry;
79837
+ const body = {
79838
+ name,
79839
+ connection,
79840
+ ...integrationId === void 0 ? {} : { integrationId }
79841
+ };
79842
+ const parsed = hmBrokersEntryKind.schema.safeParse(body);
79843
+ if (!parsed.success) throw new Error(`invalid HM broker '${id}': ${parsed.error.message}`);
79844
+ await this.kind.put({
79845
+ id,
79846
+ data: parsed.data
79847
+ });
79848
+ }
79849
+ }
79850
+ };
78258
79851
  //#endregion
78259
79852
  //#region ../../node_modules/nodehomematic/node_modules/undici/lib/core/symbols.js
78260
79853
  var require_symbols$4 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -103990,13 +105583,20 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
103990
105583
  deviceClasses = { [DeviceType.Container]: HmContainerDevice };
103991
105584
  /** Live multi-broker registry, or null before init / after shutdown. */
103992
105585
  registry = null;
105586
+ brokerStore = null;
105587
+ activeBrokers = [];
103993
105588
  constructor() {
103994
105589
  super({ ...DEFAULTS });
103995
105590
  }
103996
105591
  async onInitialize() {
103997
- const regs = await super.onInitialize();
105592
+ const regs = this.providerRegistrationsFromSuper(await super.onInitialize());
103998
105593
  const migrated = migrateLegacyConfig(await this.resolveGlobalStore());
103999
105594
  if (this.brokersDiffer(migrated.brokers, this.config.brokers)) await this.updateGlobalSettings({ brokers: migrated.brokers });
105595
+ const records = this.ctx.records;
105596
+ if (records === void 0) throw new Error("provider-homematic: ctx.records is required (hub-only addon)");
105597
+ await records.declare({ brokers: hmBrokersEntryKind });
105598
+ this.brokerStore = HmBrokerStore.of(records);
105599
+ this.activeBrokers = await this.loadPersistedBrokers();
104000
105600
  this.registry = new HmBrokerRegistry(this.ctx.logger);
104001
105601
  this.registry.setOnBrokerConnected((brokerId) => {
104002
105602
  this.ctx.logger.info("Homematic: broker connected", { meta: { brokerId } });
@@ -104006,8 +105606,8 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
104006
105606
  this.registry.setOnBrokerDisconnected((brokerId) => {
104007
105607
  this.setBrokerDevicesOnline(brokerId, false);
104008
105608
  });
104009
- await this.registry.restore(this.config.brokers);
104010
- this.ctx.logger.info("Homematic: provider initialised", { meta: { brokerCount: this.config.brokers.length } });
105609
+ await this.registry.restore(this.activeBrokers);
105610
+ this.ctx.logger.info("Homematic: provider initialised", { meta: { brokerCount: this.activeBrokers.length } });
104011
105611
  await this.reconcileIntegrationsToBrokers();
104012
105612
  this.subscribeIntegrationLifecycle();
104013
105613
  return [
@@ -104029,10 +105629,28 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
104029
105629
  * (persisting the registry-allocated id back when it differs), and apply
104030
105630
  * connection updates to existing rows.
104031
105631
  */
105632
+ async loadPersistedBrokers() {
105633
+ const store = this.brokerStore;
105634
+ if (store !== null) {
105635
+ const fromRecords = await store.listResolved();
105636
+ if (fromRecords.length > 0) return fromRecords;
105637
+ }
105638
+ return this.config.brokers;
105639
+ }
105640
+ async persistBrokerEntries(entries) {
105641
+ this.activeBrokers = [...entries];
105642
+ const store = this.brokerStore;
105643
+ if (store !== null) {
105644
+ await store.replaceAll(entries);
105645
+ return;
105646
+ }
105647
+ await this.updateGlobalSettings({ brokers: [...entries] });
105648
+ }
104032
105649
  async onConfigChanged() {
104033
105650
  const reg = this.registry;
104034
105651
  if (!reg) return;
104035
- const persisted = this.config.brokers;
105652
+ this.activeBrokers = await this.loadPersistedBrokers();
105653
+ const persisted = this.activeBrokers;
104036
105654
  const liveIds = new Set(reg.list().map((b) => b.id));
104037
105655
  const persistedIds = new Set(persisted.map((e) => e.id));
104038
105656
  for (const liveId of liveIds) if (!persistedIds.has(liveId)) try {
@@ -104063,7 +105681,7 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
104063
105681
  ...b,
104064
105682
  id: created.id
104065
105683
  } : b);
104066
- await this.updateGlobalSettings({ brokers: next });
105684
+ await this.persistBrokerEntries(next);
104067
105685
  }
104068
105686
  } catch (err) {
104069
105687
  this.ctx.logger.warn("Homematic onConfigChanged: failed to start new broker", { meta: {
@@ -104128,8 +105746,8 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
104128
105746
  return buildHmBrokerProvider({
104129
105747
  ownerAddonId: this.ctx.id,
104130
105748
  registry: this.requireRegistry(),
104131
- getBrokers: () => this.config.brokers,
104132
- persistBrokers: (brokers) => this.updateGlobalSettings({ brokers: [...brokers] }),
105749
+ getBrokers: () => this.activeBrokers,
105750
+ persistBrokers: (brokers) => this.persistBrokerEntries([...brokers]),
104133
105751
  cascadeRemoveDevices: (brokerId) => this.cascadeRemoveDevicesForBroker(brokerId),
104134
105752
  logger: this.ctx.logger
104135
105753
  });
@@ -104186,7 +105804,7 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
104186
105804
  brokerId
104187
105805
  });
104188
105806
  if (brokerId === void 0) continue;
104189
- if (!this.config.brokers.some((b) => b.id === brokerId)) {
105807
+ if (!this.activeBrokers.some((b) => b.id === brokerId)) {
104190
105808
  this.ctx.logger.warn("Homematic integration→broker: linked broker not found", { meta: {
104191
105809
  integrationId: integration.id,
104192
105810
  brokerId
@@ -104195,9 +105813,9 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
104195
105813
  }
104196
105814
  this.requireRegistry().linkIntegration(integration.id, brokerId);
104197
105815
  }
104198
- const linked = linkBrokersToIntegrations(this.config.brokers, integrations);
104199
- if (linked.some((b, i) => b !== this.config.brokers[i])) await this.updateGlobalSettings({ brokers: linked });
104200
- const toRemove = computeBrokerCleanup(this.config.brokers, survivingIntegrationIds);
105816
+ const linked = linkBrokersToIntegrations(this.activeBrokers, integrations);
105817
+ if (linked.some((b, i) => b !== this.activeBrokers[i])) await this.persistBrokerEntries(linked);
105818
+ const toRemove = computeBrokerCleanup(this.activeBrokers, survivingIntegrationIds);
104201
105819
  if (toRemove.length === 0) return;
104202
105820
  for (const id of toRemove) try {
104203
105821
  await this.requireRegistry().removeEntry(id);
@@ -104208,8 +105826,8 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
104208
105826
  error: errMsg(err)
104209
105827
  } });
104210
105828
  }
104211
- const nextBrokers = this.config.brokers.filter((b) => !toRemove.includes(b.id));
104212
- await this.updateGlobalSettings({ brokers: nextBrokers });
105829
+ const nextBrokers = this.activeBrokers.filter((b) => !toRemove.includes(b.id));
105830
+ await this.persistBrokerEntries(nextBrokers);
104213
105831
  this.ctx.logger.info("Homematic integration→broker reconcile", { meta: {
104214
105832
  brokerCount: nextBrokers.length,
104215
105833
  integrationCount: mine.length,