@camstack/addon-matter-broker 0.2.126 → 0.2.128

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 +1749 -136
  2. package/dist/addon.mjs +1749 -136
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -13,7 +13,7 @@ let node_stream_promises = require("node:stream/promises");
13
13
  let node_net = require("node:net");
14
14
  let node_dgram = require("node:dgram");
15
15
  node_dgram = require_esm.__toESM(node_dgram, 1);
16
- //#region ../types/dist/event-category-C4hVnRo8.mjs
16
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
17
17
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
18
18
  EventCategory["SystemBoot"] = "system.boot";
19
19
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -77,6 +77,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
77
77
  * consumes this category and maps it to the `addon-crash-loop` kind.
78
78
  */
79
79
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
80
+ /**
81
+ * A runner whose addon refused to start with a typed reason (D877) - parked
82
+ * in `refused`, never counted by the crash breaker, retried on operator
83
+ * action. One event per refusal.
84
+ */
85
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
86
+ /**
87
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
88
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
89
+ * runner is still pending) and the alert centre (close a recovered runner).
90
+ */
91
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
92
+ /**
93
+ * The node's one-shot runner boot check (D877): planned runners against the
94
+ * process service, `degraded` when any is failed, refused or missing. The
95
+ * alert centre turns it into one alert and a direct critical push.
96
+ */
97
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
80
98
  EventCategory["AddonError"] = "addon.error";
81
99
  EventCategory["AddonPageReady"] = "addon.page-ready";
82
100
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -4119,6 +4137,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
4119
4137
  var booleanProcessor = (_schema, _ctx, json, _params) => {
4120
4138
  json.type = "boolean";
4121
4139
  };
4140
+ var bigintProcessor = (_schema, ctx, _json, _params) => {
4141
+ if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
4142
+ };
4143
+ var symbolProcessor = (_schema, ctx, _json, _params) => {
4144
+ if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
4145
+ };
4122
4146
  var nullProcessor = (_schema, ctx, json, _params) => {
4123
4147
  if (ctx.target === "openapi-3.0") {
4124
4148
  json.type = "string";
@@ -4126,12 +4150,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
4126
4150
  json.enum = [null];
4127
4151
  } else json.type = "null";
4128
4152
  };
4153
+ var undefinedProcessor = (_schema, ctx, _json, _params) => {
4154
+ if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
4155
+ };
4129
4156
  var voidProcessor = (_schema, ctx, _json, _params) => {
4130
4157
  if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
4131
4158
  };
4132
4159
  var neverProcessor = (_schema, _ctx, json, _params) => {
4133
4160
  json.not = {};
4134
4161
  };
4162
+ var anyProcessor = (_schema, _ctx, _json, _params) => {};
4163
+ var unknownProcessor = (_schema, _ctx, _json, _params) => {};
4135
4164
  var dateProcessor = (_schema, ctx, _json, _params) => {
4136
4165
  if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
4137
4166
  };
@@ -4163,12 +4192,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
4163
4192
  json.enum = vals;
4164
4193
  }
4165
4194
  };
4195
+ var nanProcessor = (_schema, ctx, _json, _params) => {
4196
+ if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
4197
+ };
4198
+ var templateLiteralProcessor = (schema, _ctx, json, _params) => {
4199
+ const _json = json;
4200
+ const pattern = schema._zod.pattern;
4201
+ if (!pattern) throw new Error("Pattern not found in template literal");
4202
+ _json.type = "string";
4203
+ _json.pattern = pattern.source;
4204
+ };
4205
+ var fileProcessor = (schema, _ctx, json, _params) => {
4206
+ const _json = json;
4207
+ const file = {
4208
+ type: "string",
4209
+ format: "binary",
4210
+ contentEncoding: "binary"
4211
+ };
4212
+ const { minimum, maximum, mime } = schema._zod.bag;
4213
+ if (minimum !== void 0) file.minLength = minimum;
4214
+ if (maximum !== void 0) file.maxLength = maximum;
4215
+ if (mime) if (mime.length === 1) {
4216
+ file.contentMediaType = mime[0];
4217
+ Object.assign(_json, file);
4218
+ } else {
4219
+ Object.assign(_json, file);
4220
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
4221
+ }
4222
+ else Object.assign(_json, file);
4223
+ };
4224
+ var successProcessor = (_schema, _ctx, json, _params) => {
4225
+ json.type = "boolean";
4226
+ };
4166
4227
  var customProcessor = (_schema, ctx, _json, _params) => {
4167
4228
  if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
4168
4229
  };
4230
+ var functionProcessor = (_schema, ctx, _json, _params) => {
4231
+ if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
4232
+ };
4169
4233
  var transformProcessor = (_schema, ctx, _json, _params) => {
4170
4234
  if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
4171
4235
  };
4236
+ var mapProcessor = (_schema, ctx, _json, _params) => {
4237
+ if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
4238
+ };
4239
+ var setProcessor = (_schema, ctx, _json, _params) => {
4240
+ if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
4241
+ };
4172
4242
  var arrayProcessor = (schema, ctx, _json, params) => {
4173
4243
  const json = _json;
4174
4244
  const def = schema._zod.def;
@@ -4373,6 +4443,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
4373
4443
  seen.ref = def.innerType;
4374
4444
  json.readOnly = true;
4375
4445
  };
4446
+ var promiseProcessor = (schema, ctx, _json, params) => {
4447
+ const def = schema._zod.def;
4448
+ process$1(def.innerType, ctx, params);
4449
+ const seen = ctx.seen.get(schema);
4450
+ seen.ref = def.innerType;
4451
+ };
4376
4452
  var optionalProcessor = (schema, ctx, _json, params) => {
4377
4453
  const def = schema._zod.def;
4378
4454
  process$1(def.innerType, ctx, params);
@@ -4385,6 +4461,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
4385
4461
  const seen = ctx.seen.get(schema);
4386
4462
  seen.ref = innerType;
4387
4463
  };
4464
+ var allProcessors = {
4465
+ string: stringProcessor,
4466
+ number: numberProcessor,
4467
+ boolean: booleanProcessor,
4468
+ bigint: bigintProcessor,
4469
+ symbol: symbolProcessor,
4470
+ null: nullProcessor,
4471
+ undefined: undefinedProcessor,
4472
+ void: voidProcessor,
4473
+ never: neverProcessor,
4474
+ any: anyProcessor,
4475
+ unknown: unknownProcessor,
4476
+ date: dateProcessor,
4477
+ enum: enumProcessor,
4478
+ literal: literalProcessor,
4479
+ nan: nanProcessor,
4480
+ template_literal: templateLiteralProcessor,
4481
+ file: fileProcessor,
4482
+ success: successProcessor,
4483
+ custom: customProcessor,
4484
+ function: functionProcessor,
4485
+ transform: transformProcessor,
4486
+ map: mapProcessor,
4487
+ set: setProcessor,
4488
+ array: arrayProcessor,
4489
+ object: objectProcessor,
4490
+ union: unionProcessor,
4491
+ intersection: intersectionProcessor,
4492
+ tuple: tupleProcessor,
4493
+ record: recordProcessor,
4494
+ nullable: nullableProcessor,
4495
+ nonoptional: nonoptionalProcessor,
4496
+ default: defaultProcessor,
4497
+ prefault: prefaultProcessor,
4498
+ catch: catchProcessor,
4499
+ pipe: pipeProcessor,
4500
+ readonly: readonlyProcessor,
4501
+ promise: promiseProcessor,
4502
+ optional: optionalProcessor,
4503
+ lazy: lazyProcessor
4504
+ };
4505
+ function toJSONSchema(input, params) {
4506
+ if ("_idmap" in input) {
4507
+ const registry = input;
4508
+ const ctx = initializeContext({
4509
+ ...params,
4510
+ processors: allProcessors
4511
+ });
4512
+ const defs = {};
4513
+ for (const entry of registry._idmap.entries()) {
4514
+ const [_, schema] = entry;
4515
+ process$1(schema, ctx);
4516
+ }
4517
+ const schemas = {};
4518
+ ctx.external = {
4519
+ registry,
4520
+ uri: params?.uri,
4521
+ defs
4522
+ };
4523
+ for (const entry of registry._idmap.entries()) {
4524
+ const [key, schema] = entry;
4525
+ extractDefs(ctx, schema);
4526
+ schemas[key] = finalize(ctx, schema);
4527
+ }
4528
+ if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
4529
+ return { schemas };
4530
+ }
4531
+ const ctx = initializeContext({
4532
+ ...params,
4533
+ processors: allProcessors
4534
+ });
4535
+ process$1(input, ctx);
4536
+ extractDefs(ctx, input);
4537
+ return finalize(ctx, input);
4538
+ }
4388
4539
  //#endregion
4389
4540
  //#region ../../node_modules/zod/v4/classic/iso.js
4390
4541
  var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
@@ -5401,7 +5552,7 @@ var ZodIssueCode = {
5401
5552
  var ZodFirstPartyTypeKind;
5402
5553
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5403
5554
  //#endregion
5404
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5555
+ //#region ../types/dist/sleep-BOjuyoPC.mjs
5405
5556
  /**
5406
5557
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5407
5558
  * window to float samples (D455).
@@ -5518,7 +5669,7 @@ function isKeychainStoredField(field) {
5518
5669
  var SECRET_CLEAR = { $secretClear: true };
5519
5670
  /** The `'***'` token D634 redaction writes for non-admins. */
5520
5671
  var LEGACY_DEVICE_REDACTION = "***";
5521
- function isRecord$2(value) {
5672
+ function isRecord$5(value) {
5522
5673
  return typeof value === "object" && value !== null && !Array.isArray(value);
5523
5674
  }
5524
5675
  function makeSecretMarker(ref) {
@@ -5529,12 +5680,12 @@ function makeSecretMarker(ref) {
5529
5680
  }
5530
5681
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5531
5682
  function isSecretMarker(value) {
5532
- if (!isRecord$2(value)) return false;
5683
+ if (!isRecord$5(value)) return false;
5533
5684
  const ref = value["$secret"];
5534
5685
  return typeof ref === "string" && ref.length > 0;
5535
5686
  }
5536
5687
  function isSecretClear(value) {
5537
- return isRecord$2(value) && value["$secretClear"] === true;
5688
+ return isRecord$5(value) && value["$secretClear"] === true;
5538
5689
  }
5539
5690
  /**
5540
5691
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6144,7 +6295,7 @@ var KeychainWriteRefusedError = class extends Error {
6144
6295
  }
6145
6296
  };
6146
6297
  var KEEP = { kind: "keep" };
6147
- function isRecord$1$1(value) {
6298
+ function isRecord$4(value) {
6148
6299
  return typeof value === "object" && value !== null && !Array.isArray(value);
6149
6300
  }
6150
6301
  function defaultMintId() {
@@ -6157,7 +6308,7 @@ function collectSecretMarkerRefs(value, out = []) {
6157
6308
  return out;
6158
6309
  }
6159
6310
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6160
- else if (isRecord$1$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6311
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6161
6312
  return out;
6162
6313
  }
6163
6314
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6212,7 +6363,7 @@ function rowId(row, idKey) {
6212
6363
  return null;
6213
6364
  }
6214
6365
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6215
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1$1) : [];
6366
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6216
6367
  if (!Array.isArray(incoming)) {
6217
6368
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6218
6369
  return {
@@ -6228,7 +6379,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6228
6379
  const kept = /* @__PURE__ */ new Set();
6229
6380
  const rows = [];
6230
6381
  for (const row of incoming) {
6231
- if (!isRecord$1$1(row)) {
6382
+ if (!isRecord$4(row)) {
6232
6383
  rows.push(row);
6233
6384
  continue;
6234
6385
  }
@@ -6253,7 +6404,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6253
6404
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6254
6405
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6255
6406
  case "object": {
6256
- if (!isRecord$1$1(incoming)) {
6407
+ if (!isRecord$4(incoming)) {
6257
6408
  if (incoming === void 0) return KEEP;
6258
6409
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6259
6410
  return {
@@ -6261,7 +6412,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6261
6412
  value: incoming
6262
6413
  };
6263
6414
  }
6264
- const storedObj = isRecord$1$1(stored) ? stored : {};
6415
+ const storedObj = isRecord$4(stored) ? stored : {};
6265
6416
  return {
6266
6417
  kind: "value",
6267
6418
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6384,7 +6535,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6384
6535
  value: items
6385
6536
  };
6386
6537
  }
6387
- if (isRecord$1$1(v)) {
6538
+ if (isRecord$4(v)) {
6388
6539
  const out = {};
6389
6540
  for (const [k, child] of Object.entries(v)) {
6390
6541
  const s = substitute(child);
@@ -6652,7 +6803,6 @@ function createHandle(raw, opts) {
6652
6803
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6653
6804
  const readAddonStoreResult = raw.readAddonStoreResult;
6654
6805
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6655
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6656
6806
  const overrides = {
6657
6807
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6658
6808
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6676,12 +6826,12 @@ function createHandle(raw, opts) {
6676
6826
  };
6677
6827
  } } : {},
6678
6828
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6679
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6680
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6829
+ readDeviceStoreBatch: async (deviceIds) => {
6830
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6681
6831
  const out = /* @__PURE__ */ new Map();
6682
6832
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6683
6833
  return out;
6684
- } } : {},
6834
+ },
6685
6835
  writeAddonStore: async (patch) => {
6686
6836
  await writeAddon(patch);
6687
6837
  },
@@ -7308,7 +7458,7 @@ var BaseAddon = class {
7308
7458
  if (!ctx) return;
7309
7459
  const addonId = ctx.id;
7310
7460
  setImmediate(() => {
7311
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7461
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7312
7462
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7313
7463
  }).catch((err) => {
7314
7464
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7508,7 +7658,7 @@ var BaseAddon = class {
7508
7658
  return this._addonSecretTree;
7509
7659
  }
7510
7660
  deviceSecretTree() {
7511
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7661
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7512
7662
  return this._deviceSecretTree;
7513
7663
  }
7514
7664
  /**
@@ -7584,42 +7734,135 @@ var BaseAddon = class {
7584
7734
  this[timerOf] = timer;
7585
7735
  }
7586
7736
  /**
7587
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7588
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7589
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7590
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7737
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7738
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7591
7739
  * addon permanently broken.
7592
7740
  *
7593
- * Retry only the two known infra fingerprints. Anything else propagates so
7594
- * real bugs surface immediately. After the budget expires we fall back to
7595
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7741
+ * Two kinds of outage, two budgets:
7742
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7743
+ * initialized`, `provider not available`): a short budget, then the addon
7744
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7745
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7746
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7747
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7748
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7749
+ * loop. A long, bounded budget; only after it the error propagates - the
7750
+ * addon never runs on defaults for a store it could not ask.
7751
+ * Anything else propagates immediately so real bugs surface.
7596
7752
  */
7597
7753
  async readAddonStoreWithRetry() {
7598
7754
  const settings = this.rawSettings();
7599
7755
  if (!settings) return {};
7600
- const delaysMs = [
7601
- 150,
7602
- 350,
7603
- 600,
7604
- 900
7605
- ];
7606
7756
  let lastErr;
7607
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7757
+ for (let attempt = 0;; attempt++) try {
7608
7758
  const stored = await settings.readAddonStore() ?? {};
7609
7759
  this.settingsStoreReady = true;
7610
7760
  return stored;
7611
7761
  } catch (err) {
7612
7762
  lastErr = err;
7613
- const msg = err instanceof Error ? err.message : String(err);
7614
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7615
- if (attempt === delaysMs.length) break;
7616
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7763
+ const kind = classifyStoreError(err);
7764
+ if (kind === "permanent") throw err;
7765
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7766
+ if (delay === void 0) {
7767
+ if (kind === "transport") throw err;
7768
+ break;
7769
+ }
7770
+ await new Promise((r) => setTimeout(r, delay));
7617
7771
  }
7618
7772
  this.settingsStoreReady = false;
7619
7773
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7620
7774
  return {};
7621
7775
  }
7622
7776
  };
7777
+ /** The settings store's own restart fingerprints. */
7778
+ var RESTART_RETRY_DELAYS_MS = [
7779
+ 150,
7780
+ 350,
7781
+ 600,
7782
+ 900
7783
+ ];
7784
+ /** A hub restarting under a booting runner: ~100 s in total. */
7785
+ var TRANSPORT_RETRY_DELAYS_MS = [
7786
+ 150,
7787
+ 350,
7788
+ 600,
7789
+ 900,
7790
+ 2e3,
7791
+ 5e3,
7792
+ 1e4,
7793
+ 2e4,
7794
+ 3e4,
7795
+ 3e4
7796
+ ];
7797
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7798
+ /** Node / socket error codes of a connection that did not happen or broke. */
7799
+ var TRANSPORT_CODES = new Set([
7800
+ "ECONNREFUSED",
7801
+ "ECONNRESET",
7802
+ "ETIMEDOUT",
7803
+ "EPIPE",
7804
+ "EHOSTUNREACH",
7805
+ "ENETUNREACH"
7806
+ ]);
7807
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7808
+ var UNAVAILABLE_TRPC_CODES = new Set([
7809
+ "TIMEOUT",
7810
+ "SERVICE_UNAVAILABLE",
7811
+ "BAD_GATEWAY",
7812
+ "GATEWAY_TIMEOUT"
7813
+ ]);
7814
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7815
+ var TRANSPORT_PHRASES = [
7816
+ "discovery deadline exceeded",
7817
+ "parent could not route child unowned cap call",
7818
+ "UDS request timed out after",
7819
+ "channel closed"
7820
+ ];
7821
+ /** Moleculer error `type`s of a call that could not be served right now. */
7822
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7823
+ "REQUEST_TIMEOUT",
7824
+ "SERVICE_NOT_FOUND",
7825
+ "SERVICE_NOT_AVAILABLE",
7826
+ "REQUEST_REJECTED",
7827
+ "BROKER_DISCONNECTED"
7828
+ ]);
7829
+ function stringProp(value, key) {
7830
+ if (typeof value !== "object" || value === null) return void 0;
7831
+ const found = Reflect.get(value, key);
7832
+ return typeof found === "string" ? found : void 0;
7833
+ }
7834
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7835
+ function errorCode(err) {
7836
+ const out = {};
7837
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7838
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7839
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7840
+ if (node !== void 0) out.node = node;
7841
+ const trpc = stringProp(data, "code");
7842
+ if (trpc !== void 0) out.trpc = trpc;
7843
+ return out;
7844
+ }
7845
+ /**
7846
+ * Is a settings read failure worth retrying, and with which budget? Only
7847
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7848
+ * one of the exact phrases our own transport raises. A message that merely
7849
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7850
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7851
+ */
7852
+ function classifyStoreError(err) {
7853
+ const message = err instanceof Error ? err.message : String(err);
7854
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7855
+ const code = errorCode(err);
7856
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7857
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7858
+ if (typeof err === "object" && err !== null) {
7859
+ if (Reflect.get(err, "retryable") === true) return "transport";
7860
+ const type = stringProp(err, "type");
7861
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7862
+ }
7863
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7864
+ return "permanent";
7865
+ }
7623
7866
  /**
7624
7867
  * Collect the keys of every field marked `perNode: true`, recursing into
7625
7868
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7709,6 +7952,356 @@ var PeerBytesTicketSchema = object({
7709
7952
  */
7710
7953
  declaredBytes: number().int().nonnegative().nullable()
7711
7954
  });
7955
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7956
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7957
+ var RECORD_DATABASES = ["settings", "events"];
7958
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7959
+ var RECORD_CLASSES = [
7960
+ "config",
7961
+ "ledger",
7962
+ "audit",
7963
+ "mirror",
7964
+ "ephemeral"
7965
+ ];
7966
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7967
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7968
+ var RECORD_BATCH_MAX = 1e3;
7969
+ var RECORD_QUERY_MAX = 1e3;
7970
+ /** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
7971
+ var RECORD_SETTINGS_MAX_ROWS = 5e4;
7972
+ var PREFIX$1 = "records/";
7973
+ /** The base of every records failure. `detail` is the human part of the message. */
7974
+ var RecordsError = class extends Error {
7975
+ code;
7976
+ detail;
7977
+ constructor(code, detail) {
7978
+ super(`${PREFIX$1}${code}: ${detail}`);
7979
+ this.name = "RecordsError";
7980
+ this.code = code;
7981
+ this.detail = detail;
7982
+ }
7983
+ };
7984
+ /** The keychain could not store or serve a value: explicit, never an empty string. */
7985
+ var RecordSecretUnavailableError = class extends RecordsError {
7986
+ constructor(detail) {
7987
+ super("secret-unavailable", detail);
7988
+ this.name = "RecordSecretUnavailableError";
7989
+ }
7990
+ };
7991
+ var InvalidRecordError = class extends RecordsError {
7992
+ constructor(detail) {
7993
+ super("invalid-record", detail);
7994
+ this.name = "InvalidRecordError";
7995
+ }
7996
+ };
7997
+ /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
7998
+ var DeclarationRefusedError = class extends RecordsError {
7999
+ constructor(detail) {
8000
+ super("declaration-refused", detail);
8001
+ this.name = "DeclarationRefusedError";
8002
+ }
8003
+ };
8004
+ function defOf(schema) {
8005
+ const zodBag = Reflect.get(schema, "_zod");
8006
+ if (typeof zodBag !== "object" || zodBag === null) return {};
8007
+ const def = Reflect.get(zodBag, "def");
8008
+ if (typeof def !== "object" || def === null) return {};
8009
+ return def;
8010
+ }
8011
+ function declaredHere(schema) {
8012
+ return globalRegistry.get(schema)?.secret === true;
8013
+ }
8014
+ /** Wrapper kinds whose `innerType` is the field itself. */
8015
+ var WRAPPERS = new Set([
8016
+ "optional",
8017
+ "nullable",
8018
+ "default",
8019
+ "prefault",
8020
+ "catch",
8021
+ "readonly",
8022
+ "nonoptional"
8023
+ ]);
8024
+ /**
8025
+ * The schema layers that make up ONE field: the schema itself and every
8026
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
8027
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8028
+ * `.transform` on `in`).
8029
+ */
8030
+ function layersOf(schema) {
8031
+ const out = [];
8032
+ const queue = [schema];
8033
+ while (queue.length > 0) {
8034
+ const s = queue.shift();
8035
+ if (!s || out.includes(s)) continue;
8036
+ out.push(s);
8037
+ const def = defOf(s);
8038
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8039
+ if (def.type === "pipe") {
8040
+ if (def.in) queue.push(def.in);
8041
+ if (def.out) queue.push(def.out);
8042
+ }
8043
+ }
8044
+ return out;
8045
+ }
8046
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
8047
+ function isZodSecret(schema) {
8048
+ return layersOf(schema).some(declaredHere);
8049
+ }
8050
+ /**
8051
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
8052
+ * element of this array" (`connection.password`, `rows[].token`). A declared
8053
+ * object or array is reported as one path and not descended into — everything
8054
+ * under it is secret.
8055
+ */
8056
+ function collectZodSecretPaths(schema, prefix = "") {
8057
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8058
+ const paths = [];
8059
+ for (const layer of layersOf(schema)) {
8060
+ const def = defOf(layer);
8061
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8062
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8063
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8064
+ else if (def.type === "intersection") {
8065
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8066
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8067
+ }
8068
+ }
8069
+ return [...new Set(paths)];
8070
+ }
8071
+ /**
8072
+ * Secret fields of a record, addressed the way a Zod schema declares them
8073
+ * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
8074
+ * (`auth.accessToken`, `headers[].value`).
8075
+ *
8076
+ * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
8077
+ * `{ headers: 'name' }`), never by index, so reordering a list keeps every
8078
+ * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
8079
+ * leaf names its element: `headers[X-Api].value`.
8080
+ *
8081
+ * Pure and browser-safe. Nothing here mutates: every transform returns a new value.
8082
+ */
8083
+ /** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
8084
+ function parseSecretPath(path) {
8085
+ if (path.length === 0) throw new InvalidRecordError("an empty secret path");
8086
+ return path.split(".").map((raw) => {
8087
+ const each = raw.endsWith("[]");
8088
+ const key = each ? raw.slice(0, -2) : raw;
8089
+ if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
8090
+ return {
8091
+ key,
8092
+ each
8093
+ };
8094
+ });
8095
+ }
8096
+ /** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
8097
+ function secretArrayPrefixes(path) {
8098
+ const segments = parseSecretPath(path);
8099
+ const prefixes = [];
8100
+ const walked = [];
8101
+ for (const segment of segments) {
8102
+ walked.push(segment.key);
8103
+ if (segment.each) prefixes.push(walked.join("."));
8104
+ }
8105
+ return prefixes;
8106
+ }
8107
+ /**
8108
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
8109
+ * Zod row schema that describes it, and the helper that turns the two into the
8110
+ * JSON the engine stores.
8111
+ *
8112
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
8113
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
8114
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
8115
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
8116
+ * never a field name (D879).
8117
+ */
8118
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
8119
+ var RecordFieldPathSchema = string$2().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
8120
+ var RecordIndexSchema = object({
8121
+ name: string$2().regex(/^[a-z][a-z0-9_]{0,31}$/),
8122
+ fields: array(RecordFieldPathSchema).min(1).max(4),
8123
+ unique: boolean().optional()
8124
+ }).strict();
8125
+ var RecordRetentionSchema = union([
8126
+ object({
8127
+ ttlMs: number().int().positive(),
8128
+ from: _enum(["at", "write"])
8129
+ }).strict(),
8130
+ object({
8131
+ maxRows: number().int().positive().optional(),
8132
+ maxRowsPerDevice: number().int().positive().optional()
8133
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
8134
+ object({
8135
+ owner: string$2().min(1),
8136
+ reason: string$2().min(1)
8137
+ }).strict(),
8138
+ object({ none: string$2().min(1) }).strict()
8139
+ ]);
8140
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
8141
+ var EntryDescriptorSchema = object({
8142
+ title: string$2().min(1),
8143
+ /** The record body field shown as the entry's name. */
8144
+ nameField: string$2().min(1),
8145
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
8146
+ fields: record(string$2(), unknown())
8147
+ }).strict();
8148
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
8149
+ var RecordKindDeclarationSchema = object({
8150
+ database: _enum(RECORD_DATABASES).default("settings"),
8151
+ class: _enum(RECORD_CLASSES),
8152
+ writeTrigger: string$2().min(1),
8153
+ device: _enum([
8154
+ "required",
8155
+ "optional",
8156
+ "none"
8157
+ ]).default("none"),
8158
+ at: _enum(["required", "none"]).default("none"),
8159
+ indexes: array(RecordIndexSchema).max(8).default([]),
8160
+ retention: RecordRetentionSchema,
8161
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
8162
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
8163
+ /** Derived from the Zod schema; never written by hand. */
8164
+ secretPaths: array(string$2().min(1)).default([]),
8165
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
8166
+ secretArrayKeys: record(string$2(), string$2()).default({}),
8167
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
8168
+ adoptsFrom: string$2().min(1).optional(),
8169
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
8170
+ transactFamily: string$2().min(1).optional(),
8171
+ entry: EntryDescriptorSchema.optional()
8172
+ }).strict();
8173
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
8174
+ var RecordKindNameSchema = string$2().regex(/^[a-z][a-z0-9-]{0,47}$/);
8175
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
8176
+ function assertValidDeclaration(name, decl) {
8177
+ const refuse = (why) => {
8178
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
8179
+ };
8180
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
8181
+ const seen = /* @__PURE__ */ new Set();
8182
+ for (const index of decl.indexes) {
8183
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
8184
+ seen.add(index.name);
8185
+ }
8186
+ const { retention } = decl;
8187
+ const hasSecrets = decl.secretPaths.length > 0;
8188
+ if ("ttlMs" in retention) {
8189
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
8190
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
8191
+ }
8192
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
8193
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
8194
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
8195
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
8196
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
8197
+ 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)`);
8198
+ }
8199
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
8200
+ 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`);
8201
+ }
8202
+ function bodyFieldsOf(schema) {
8203
+ return { ...toJSONSchema(schema, {
8204
+ unrepresentable: "any",
8205
+ io: "input"
8206
+ }) };
8207
+ }
8208
+ function isRecordLike(value) {
8209
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8210
+ }
8211
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
8212
+ function hasNameField(json, field) {
8213
+ const branches = json["oneOf"] ?? json["anyOf"];
8214
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
8215
+ const properties = json["properties"];
8216
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
8217
+ }
8218
+ /**
8219
+ * Declare the kinds of a package. The keys are the kind names. The result is
8220
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
8221
+ * types its handle from.
8222
+ */
8223
+ function defineRecordKinds(specs) {
8224
+ const out = {};
8225
+ for (const [name, spec] of Object.entries(specs)) {
8226
+ const secretPaths = collectZodSecretPaths(spec.schema);
8227
+ const nameField = spec.entry?.nameField ?? "name";
8228
+ const fields = bodyFieldsOf(spec.schema);
8229
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
8230
+ const parsed = RecordKindDeclarationSchema.parse({
8231
+ database: spec.database,
8232
+ class: spec.class,
8233
+ writeTrigger: spec.writeTrigger,
8234
+ device: spec.device,
8235
+ at: spec.at,
8236
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
8237
+ retention: spec.retention,
8238
+ deviceRemoval: spec.deviceRemoval,
8239
+ maxDataBytes: spec.maxDataBytes,
8240
+ secretPaths: [...secretPaths],
8241
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
8242
+ adoptsFrom: spec.adoptsFrom,
8243
+ transactFamily: spec.transactFamily,
8244
+ entry: spec.entry === void 0 ? void 0 : {
8245
+ title: spec.entry.title,
8246
+ nameField,
8247
+ fields
8248
+ }
8249
+ });
8250
+ assertValidDeclaration(name, parsed);
8251
+ out[name] = {
8252
+ name,
8253
+ schema: spec.schema,
8254
+ declaration: parsed
8255
+ };
8256
+ }
8257
+ return out;
8258
+ }
8259
+ /**
8260
+ * Entry kinds (D881): every list of user-created entries (notification
8261
+ * targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
8262
+ * kind-specific body, and the admin UI lists/adds/edits/deletes all of them
8263
+ * through the `record-entries` capability with password fields derived from
8264
+ * the schema (`.meta({ secret: true })`).
8265
+ */
8266
+ /** The body of a plain entry: a name and the fields the kind adds. */
8267
+ function entryBody(shape) {
8268
+ return object({
8269
+ name: string$2().min(1),
8270
+ ...shape
8271
+ });
8272
+ }
8273
+ /**
8274
+ * Declare one entry kind. An entry is configuration: never trimmed by the
8275
+ * engine, never aged, belonging to no device.
8276
+ */
8277
+ function defineEntryKind(name, spec) {
8278
+ const defined = defineRecordKinds({ [name]: {
8279
+ schema: spec.schema,
8280
+ class: "config",
8281
+ writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
8282
+ retention: { none: "an entry goes only when the operator deletes it" },
8283
+ ...spec.database === void 0 ? {} : { database: spec.database },
8284
+ ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
8285
+ ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
8286
+ ...spec.adoptsFrom === void 0 ? {} : { adoptsFrom: spec.adoptsFrom },
8287
+ entry: {
8288
+ title: spec.title,
8289
+ ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
8290
+ }
8291
+ } })[name];
8292
+ if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
8293
+ return defined;
8294
+ }
8295
+ /**
8296
+ * Legacy source for broker entry adoption (B2): brokers live in addon-settings
8297
+ * as one row `<addonId>.brokers` whose value is an array until records-adopt
8298
+ * copies them into the entry kind.
8299
+ */
8300
+ var SETTINGS_BROKERS_ADOPTS_PREFIX = "@settings-brokers/";
8301
+ /** The `adoptsFrom` value for an addon's broker entry kind. */
8302
+ function settingsBrokersAdoptsFrom(addonId) {
8303
+ return `${SETTINGS_BROKERS_ADOPTS_PREFIX}${addonId}`;
8304
+ }
7712
8305
  /** Shared Zod schemas used across streaming capabilities. */
7713
8306
  var CamProfileSchema = _enum([
7714
8307
  "high",
@@ -8173,75 +8766,12 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8173
8766
  kind: "mutation",
8174
8767
  auth: "admin"
8175
8768
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
8176
- function defOf(schema) {
8177
- return schema._zod?.def ?? {};
8178
- }
8179
- function declaredHere(schema) {
8180
- return globalRegistry.get(schema)?.secret === true;
8181
- }
8182
- /** Wrapper kinds whose `innerType` is the field itself. */
8183
- var WRAPPERS = new Set([
8184
- "optional",
8185
- "nullable",
8186
- "default",
8187
- "prefault",
8188
- "catch",
8189
- "readonly",
8190
- "nonoptional"
8191
- ]);
8192
- /**
8193
- * The schema layers that make up ONE field: the schema itself and every
8194
- * wrapper below it (optional / default / nullable / readonly / catch), plus
8195
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8196
- * `.transform` on `in`).
8197
- */
8198
- function layersOf(schema) {
8199
- const out = [];
8200
- const queue = [schema];
8201
- while (queue.length > 0) {
8202
- const s = queue.shift();
8203
- if (!s || out.includes(s)) continue;
8204
- out.push(s);
8205
- const def = defOf(s);
8206
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8207
- if (def.type === "pipe") {
8208
- if (def.in) queue.push(def.in);
8209
- if (def.out) queue.push(def.out);
8210
- }
8211
- }
8212
- return out;
8213
- }
8214
- /** True when any layer of this field declares `.meta({ secret: true })`. */
8215
- function isZodSecret(schema) {
8216
- return layersOf(schema).some(declaredHere);
8217
- }
8218
- /**
8219
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
8220
- * element of this array" (`connection.password`, `rows[].token`). A declared
8221
- * object or array is reported as one path and not descended into — everything
8222
- * under it is secret.
8223
- */
8224
- function collectZodSecretPaths(schema, prefix = "") {
8225
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8226
- const paths = [];
8227
- for (const layer of layersOf(schema)) {
8228
- const def = defOf(layer);
8229
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8230
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8231
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8232
- else if (def.type === "intersection") {
8233
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8234
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8235
- }
8236
- }
8237
- return [...new Set(paths)];
8238
- }
8239
8769
  object({
8240
8770
  code: string$2().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
8241
8771
  params: record(string$2(), union([string$2(), number()])).optional()
8242
8772
  });
8243
8773
  //#endregion
8244
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8774
+ //#region ../types/dist/err-msg-BXKzRBwg.mjs
8245
8775
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8246
8776
  DeviceType["Camera"] = "camera";
8247
8777
  DeviceType["Hub"] = "hub";
@@ -8333,6 +8863,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
8333
8863
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
8334
8864
  * integrations sharing the same food/desiccant/hopper surface. */
8335
8865
  DeviceType["PetFeeder"] = "pet-feeder";
8866
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
8867
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
8868
+ * Sources: native Bosch Home Connect, reusable by similar integrations. */
8869
+ DeviceType["Dishwasher"] = "dishwasher";
8336
8870
  return DeviceType;
8337
8871
  }({});
8338
8872
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -8510,6 +9044,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8510
9044
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8511
9045
  * real Switch device for UI rendering / export adapters. */
8512
9046
  DeviceRole["BinaryHelper"] = "binary-helper";
9047
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
9048
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
9049
+ DeviceRole["Outlet"] = "outlet";
8513
9050
  /** Generic motion / occupancy / moving event source. Distinct from
8514
9051
  * the camera accessory PirSensor role: that one is a camera child;
8515
9052
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8587,7 +9124,7 @@ function errMsg(err) {
8587
9124
  return String(err);
8588
9125
  }
8589
9126
  //#endregion
8590
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
9127
+ //#region ../types/dist/composition-CB6PMT9p.mjs
8591
9128
  /**
8592
9129
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8593
9130
  *
@@ -11791,11 +12328,10 @@ var ClipModelMetaSchema = object({
11791
12328
  /**
11792
12329
  * The `vector-store` index this model's vectors live in. ONE feature space
11793
12330
  * per index: two models share an index only when their vectors are ranked
11794
- * against each other, which for CLIP means never across families. MobileCLIP
11795
- * S1 and S2 share `object-clip` for history (separated by the row's
11796
- * `modelId`); any other model gets its own.
12331
+ * against each other, which for CLIP means never across families. Every
12332
+ * model gets its own.
11797
12333
  */
11798
- vectorIndex: string$2().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12334
+ vectorIndex: string$2().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
11799
12335
  /**
11800
12336
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
11801
12337
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -12974,8 +13510,13 @@ var AlertSeveritySchema = _enum([
12974
13510
  "info",
12975
13511
  "success",
12976
13512
  "warning",
12977
- "error"
13513
+ "error",
13514
+ "critical"
12978
13515
  ]);
13516
+ var AlertActionSchema = object({
13517
+ label: string$2(),
13518
+ href: string$2().optional()
13519
+ });
12979
13520
  var AlertStatusSchema = _enum([
12980
13521
  "active",
12981
13522
  "in-progress",
@@ -12993,6 +13534,7 @@ var AlertSchema = object({
12993
13534
  severity: AlertSeveritySchema,
12994
13535
  title: string$2(),
12995
13536
  message: string$2(),
13537
+ action: AlertActionSchema.optional(),
12996
13538
  status: AlertStatusSchema,
12997
13539
  progress: number().optional(),
12998
13540
  read: boolean(),
@@ -15577,6 +16119,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15577
16119
  keyField: string$2()
15578
16120
  }).optional()
15579
16121
  })) });
16122
+ /**
16123
+ * The report of a one-shot "move this owner's plaintext secrets into the
16124
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
16125
+ *
16126
+ * The owner runs it on its own rows, through its own write path; an operator
16127
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
16128
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
16129
+ */
16130
+ var RawSecretMigrationInputSchema = object({
16131
+ /** `false` (the default of the script) = report only. */
16132
+ apply: boolean() });
16133
+ var RawSecretMigrationReportSchema = object({
16134
+ apply: boolean(),
16135
+ /** Rows that can carry a secret (a profile, an enrolment). */
16136
+ rows: number().int(),
16137
+ /** Rows whose secret was plaintext when the run started. */
16138
+ raw: number().int(),
16139
+ /** Rows that already held a keychain marker when the run started. */
16140
+ markers: number().int(),
16141
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
16142
+ migrated: number().int(),
16143
+ /** Plaintext rows left in place because the move or its read-back failed. */
16144
+ failed: number().int(),
16145
+ /** After the run: rows still holding plaintext. */
16146
+ remainingRaw: number().int(),
16147
+ /** After the run: markers the keychain could not resolve right now. */
16148
+ unresolvedMarkers: number().int(),
16149
+ /**
16150
+ * A second, redundant copy of the secrets' rows that the run found (and, on
16151
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
16152
+ */
16153
+ redundantCopies: number().int().optional(),
16154
+ /** True when nothing is raw and every marker resolves. */
16155
+ verified: boolean()
16156
+ });
15580
16157
  /** Where a block runs. The operator chooses — a block driving a device on an
15581
16158
  * agent is the reason placement is not fixed to the hub. */
15582
16159
  var CoreBlockPlacementSchema = union([literal("hub"), string$2().min(1)]);
@@ -15803,6 +16380,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
15803
16380
  }), SettingsUpdateResultSchema, {
15804
16381
  kind: "mutation",
15805
16382
  auth: "admin"
16383
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16384
+ kind: "mutation",
16385
+ auth: "admin"
15806
16386
  }), method(object({}), object({ libs: array(object({
15807
16387
  filePath: string$2(),
15808
16388
  content: string$2()
@@ -16066,6 +16646,347 @@ id: union([string$2(), number()]) }), {
16066
16646
  auth: "admin"
16067
16647
  });
16068
16648
  /**
16649
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16650
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16651
+ * (operator intent, D870) and device-history (numbers over time, D850).
16652
+ *
16653
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16654
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16655
+ * that with the addon id closed over). It is deliberately NOT in any input
16656
+ * schema, so a session can never supply it, and a call with no stamp is refused
16657
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16658
+ * addons go through the owner's capability.
16659
+ *
16660
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16661
+ * never `[]`. Secret fields are never on the wire: a read shows the
16662
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16663
+ * resolves itself, and a write may carry only a keychain marker bound to the
16664
+ * row's own ref.
16665
+ *
16666
+ * Internal: addons reach it through `ctx.records`, never directly.
16667
+ */
16668
+ var RecordIdSchema = string$2().min(1).max(256);
16669
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16670
+ var RecordBodySchema = record(string$2(), unknown());
16671
+ var RecordInputSchema = object({
16672
+ id: RecordIdSchema,
16673
+ /** The device this row belongs to (D865 removal, per-device reads). */
16674
+ deviceId: number().int().optional(),
16675
+ /** The domain clock, ms: observed / created / opened. */
16676
+ at: number().int().optional(),
16677
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16678
+ expiresAt: number().int().optional(),
16679
+ data: RecordBodySchema
16680
+ });
16681
+ var RecordViewSchema = object({
16682
+ id: string$2(),
16683
+ deviceId: number().int().nullable(),
16684
+ at: number().nullable(),
16685
+ expiresAt: number().nullable(),
16686
+ rev: number().int(),
16687
+ updatedAt: number(),
16688
+ data: RecordBodySchema
16689
+ });
16690
+ /** Declared index fields only. Anything else does not compile, by design. */
16691
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16692
+ string$2(),
16693
+ number(),
16694
+ boolean(),
16695
+ object({ in: array(union([
16696
+ string$2(),
16697
+ number(),
16698
+ boolean()
16699
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16700
+ object({
16701
+ gt: union([string$2(), number()]).optional(),
16702
+ gte: union([string$2(), number()]).optional(),
16703
+ lt: union([string$2(), number()]).optional(),
16704
+ lte: union([string$2(), number()]).optional()
16705
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16706
+ ]));
16707
+ var KindShape = { kind: RecordKindNameSchema };
16708
+ var TimeWindowShape = {
16709
+ deviceId: number().int().optional(),
16710
+ atFrom: number().optional(),
16711
+ atTo: number().optional()
16712
+ };
16713
+ var RecordQueryInputSchema = object({
16714
+ ...KindShape,
16715
+ ...TimeWindowShape,
16716
+ where: RecordWhereSchema.optional(),
16717
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16718
+ order: _enum(["at", "id"]).optional(),
16719
+ desc: boolean().optional(),
16720
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16721
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16722
+ cursor: string$2().min(1).optional()
16723
+ });
16724
+ var RecordQueryResultSchema = object({
16725
+ records: array(RecordViewSchema),
16726
+ nextCursor: string$2().nullable()
16727
+ });
16728
+ var RecordKindStateSchema = _enum([
16729
+ "created",
16730
+ "unchanged",
16731
+ "updated"
16732
+ ]);
16733
+ var DeclareKindResultSchema = object({
16734
+ kindId: number().int(),
16735
+ state: RecordKindStateSchema,
16736
+ createdIndexes: array(string$2()),
16737
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16738
+ adoptionPending: object({
16739
+ legacyTable: string$2(),
16740
+ legacyRows: number().int()
16741
+ }).nullable()
16742
+ });
16743
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16744
+ var SecretRefsList = array(string$2());
16745
+ var RecordSecretRefsSchema = record(string$2(), record(string$2(), string$2()));
16746
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string$2(), DeclareKindResultSchema) }), {
16747
+ kind: "mutation",
16748
+ auth: "admin"
16749
+ }), method(object({
16750
+ ...KindShape,
16751
+ id: RecordIdSchema
16752
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16753
+ ...KindShape,
16754
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16755
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16756
+ ...KindShape,
16757
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16758
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16759
+ ...KindShape,
16760
+ record: RecordInputSchema,
16761
+ /** Compare-and-set. `0` means "the row must not exist". */
16762
+ ifRev: number().int().min(0).optional()
16763
+ }), object({
16764
+ rev: number().int(),
16765
+ releasedRefs: SecretRefsList
16766
+ }), {
16767
+ kind: "mutation",
16768
+ auth: "admin"
16769
+ }), method(object({
16770
+ ...KindShape,
16771
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16772
+ }), object({
16773
+ count: number().int(),
16774
+ releasedRefs: SecretRefsList
16775
+ }), {
16776
+ kind: "mutation",
16777
+ auth: "admin"
16778
+ }), method(object({
16779
+ ...KindShape,
16780
+ id: RecordIdSchema,
16781
+ data: RecordBodySchema,
16782
+ at: number().int().nullable().optional(),
16783
+ expiresAt: number().int().nullable().optional(),
16784
+ ifRev: number().int().min(1).optional()
16785
+ }), object({
16786
+ rev: number().int(),
16787
+ releasedRefs: SecretRefsList
16788
+ }), {
16789
+ kind: "mutation",
16790
+ auth: "admin"
16791
+ }), method(object({
16792
+ ...KindShape,
16793
+ id: RecordIdSchema
16794
+ }), object({
16795
+ deleted: boolean(),
16796
+ secretRefs: SecretRefsList
16797
+ }), {
16798
+ kind: "mutation",
16799
+ auth: "admin"
16800
+ }), method(object({
16801
+ ...KindShape,
16802
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16803
+ }), object({
16804
+ deleted: number().int(),
16805
+ secretRefs: SecretRefsList
16806
+ }), {
16807
+ kind: "mutation",
16808
+ auth: "admin"
16809
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16810
+ ...KindShape,
16811
+ ...TimeWindowShape,
16812
+ where: RecordWhereSchema.optional()
16813
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16814
+ ...KindShape,
16815
+ deviceId: number().int().optional(),
16816
+ from: number(),
16817
+ to: number(),
16818
+ bucketMs: number().int().positive()
16819
+ }), object({ buckets: array(object({
16820
+ bucketStart: number(),
16821
+ count: number().int()
16822
+ })) }), { auth: "admin" }), method(object({
16823
+ ...KindShape,
16824
+ op: _enum([
16825
+ "sum",
16826
+ "min",
16827
+ "max",
16828
+ "count"
16829
+ ]),
16830
+ field: RecordFieldPathSchema.optional(),
16831
+ groupBy: RecordFieldPathSchema.optional(),
16832
+ where: RecordWhereSchema.optional()
16833
+ }), object({ rows: array(object({
16834
+ group: union([
16835
+ string$2(),
16836
+ number(),
16837
+ _null()
16838
+ ]),
16839
+ value: number().nullable()
16840
+ })) }), { auth: "admin" }), method(object({
16841
+ ...KindShape,
16842
+ deviceId: number().int().optional(),
16843
+ atBefore: number().optional(),
16844
+ where: RecordWhereSchema.optional()
16845
+ }), object({
16846
+ deleted: number().int(),
16847
+ secretRefs: SecretRefsList
16848
+ }), {
16849
+ kind: "mutation",
16850
+ auth: "admin"
16851
+ }), method(object({
16852
+ deviceId: number().int(),
16853
+ kinds: array(RecordKindNameSchema).optional()
16854
+ }), object({
16855
+ deleted: record(string$2(), number().int()),
16856
+ secretRefs: SecretRefsList
16857
+ }), {
16858
+ kind: "mutation",
16859
+ auth: "admin"
16860
+ }), method(object(KindShape), object({ id: number().int() }), {
16861
+ kind: "mutation",
16862
+ auth: "admin"
16863
+ });
16864
+ /** One table of the settings database. */
16865
+ var StorageTableSchema = object({
16866
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
16867
+ name: string$2(),
16868
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
16869
+ owner: string$2().nullable(),
16870
+ rows: number().int().nonnegative(),
16871
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
16872
+ bytes: number().int().nonnegative().nullable(),
16873
+ /** Declared by an addon since this engine process started (a running addon claims it). */
16874
+ declaredThisBoot: boolean()
16875
+ });
16876
+ /** One declared record kind (D881) as System -> Data shows it. */
16877
+ var StorageKindSchema = object({
16878
+ owner: string$2(),
16879
+ kind: string$2(),
16880
+ database: _enum(["settings", "events"]),
16881
+ class: string$2(),
16882
+ state: _enum([
16883
+ "declared",
16884
+ "orphaned",
16885
+ "dropped"
16886
+ ]),
16887
+ /** `null` when the caller asked for no counts (`counts: false`). */
16888
+ rows: number().int().nonnegative().nullable(),
16889
+ /** Rows x the average size of a sample; null for an empty kind. */
16890
+ bytesEstimate: number().int().nonnegative().nullable(),
16891
+ writeTrigger: string$2(),
16892
+ retention: RecordRetentionSchema,
16893
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16894
+ entry: boolean(),
16895
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16896
+ declaration: RecordKindDeclarationSchema
16897
+ });
16898
+ method(object({ ownerPrefix: string$2().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16899
+ collection: string$2().min(1),
16900
+ expectRows: number().int().nonnegative()
16901
+ }), object({
16902
+ dropped: literal(true),
16903
+ rows: number().int().nonnegative()
16904
+ }), {
16905
+ kind: "mutation",
16906
+ auth: "admin"
16907
+ }), method(object({
16908
+ owner: string$2().min(1).optional(),
16909
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16910
+ counts: boolean().optional()
16911
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16912
+ owner: string$2().min(1),
16913
+ kind: RecordKindNameSchema
16914
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16915
+ owner: string$2().min(1),
16916
+ kind: RecordKindNameSchema,
16917
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16918
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16919
+ complete: boolean().optional()
16920
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16921
+ kind: "mutation",
16922
+ auth: "admin"
16923
+ }), method(object({
16924
+ collection: string$2().min(1),
16925
+ cursor: string$2().optional(),
16926
+ limit: number().int().min(1).max(1e3).optional()
16927
+ }), object({
16928
+ rows: array(object({
16929
+ id: string$2(),
16930
+ data: record(string$2(), unknown())
16931
+ })),
16932
+ nextCursor: string$2().nullable()
16933
+ }), { auth: "admin" }), method(object({ collection: string$2().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16934
+ /**
16935
+ * record-entries - the ONE admin surface for every list of user-created entries
16936
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16937
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16938
+ *
16939
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16940
+ * the entry body with `secret: true` on every credential field, so a password
16941
+ * field is derived from the schema and never from a name. `putEntry` takes the
16942
+ * redaction token for an untouched secret (the stored value is kept), a string
16943
+ * for a new one, and the clear instruction to remove one. A read never carries
16944
+ * a secret value, and a locked keychain refuses the write with
16945
+ * `records/secret-unavailable` instead of storing plaintext.
16946
+ *
16947
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16948
+ */
16949
+ var EntryKindInfoSchema = object({
16950
+ owner: string$2(),
16951
+ kind: RecordKindNameSchema,
16952
+ title: string$2(),
16953
+ nameField: string$2(),
16954
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16955
+ fields: record(string$2(), unknown()),
16956
+ secretPaths: array(string$2()),
16957
+ rows: number().int().nonnegative()
16958
+ });
16959
+ var EntryViewSchema = object({
16960
+ id: RecordIdSchema,
16961
+ name: string$2(),
16962
+ rev: number().int(),
16963
+ updatedAt: number(),
16964
+ /** Secret fields hold the redaction token. */
16965
+ data: RecordBodySchema
16966
+ });
16967
+ var EntryAddress = {
16968
+ owner: string$2().min(1),
16969
+ kind: RecordKindNameSchema
16970
+ };
16971
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16972
+ ...EntryAddress,
16973
+ id: RecordIdSchema.optional(),
16974
+ data: RecordBodySchema,
16975
+ ifRev: number().int().min(1).optional()
16976
+ }), object({
16977
+ id: string$2(),
16978
+ rev: number().int()
16979
+ }), {
16980
+ kind: "mutation",
16981
+ auth: "admin"
16982
+ }), method(object({
16983
+ ...EntryAddress,
16984
+ id: RecordIdSchema
16985
+ }), object({ deleted: boolean() }), {
16986
+ kind: "mutation",
16987
+ auth: "admin"
16988
+ });
16989
+ /**
16069
16990
  * `keychain` — the hub's encrypted store of secret values (D787).
16070
16991
  *
16071
16992
  * Settings blobs never hold a secret: they hold a marker
@@ -16606,6 +17527,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16606
17527
  kind: "mutation",
16607
17528
  auth: "admin",
16608
17529
  caller: "required"
17530
+ }), method(object({
17531
+ ref: string$2().min(1),
17532
+ value: string$2().min(1)
17533
+ }), object({
17534
+ ref: string$2(),
17535
+ version: number().int()
17536
+ }), {
17537
+ kind: "mutation",
17538
+ auth: "admin",
17539
+ caller: "required"
16609
17540
  }), method(object({ refs: array(string$2().min(1)).max(1e3) }), object({
16610
17541
  deleted: array(string$2()).readonly(),
16611
17542
  kept: array(object({
@@ -39284,6 +40215,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39284
40215
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39285
40216
  kind: "mutation",
39286
40217
  auth: "admin"
40218
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
40219
+ kind: "mutation",
40220
+ auth: "admin"
39287
40221
  }), method(ProfileRefInputSchema, _void(), {
39288
40222
  kind: "mutation",
39289
40223
  auth: "admin"
@@ -49793,6 +50727,41 @@ var ServerRollbackInfoSchema = object({
49793
50727
  atMs: number(),
49794
50728
  reason: string$2()
49795
50729
  });
50730
+ /**
50731
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50732
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50733
+ * service holds, because only the hub plans) against the states the process
50734
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50735
+ * every boot, served on `getServerPackageStatus`.
50736
+ *
50737
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50738
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50739
+ * planned runner the process service has no entry for.
50740
+ */
50741
+ var RunnerRefusalSchema = object({
50742
+ runnerId: string$2(),
50743
+ addonIds: array(string$2()),
50744
+ reason: string$2()
50745
+ });
50746
+ var RunnerBootCheckSchema = object({
50747
+ checkedAtMs: number(),
50748
+ /** Runners planned for this node. */
50749
+ expected: number(),
50750
+ /** Planned runners whose process is `running`. */
50751
+ running: number(),
50752
+ failed: array(string$2()),
50753
+ refused: array(RunnerRefusalSchema),
50754
+ missing: array(string$2()),
50755
+ /**
50756
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50757
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50758
+ * pushed and the verdict is re-evaluated on the next runner state change.
50759
+ * Optional for version skew (absent = settled).
50760
+ */
50761
+ pending: array(string$2()).optional(),
50762
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50763
+ planKnown: boolean()
50764
+ });
49796
50765
  var ServerPackageStatusSchema = object({
49797
50766
  /** Root package name (`@camstack/server` on the hub). */
49798
50767
  packageName: string$2(),
@@ -49855,7 +50824,14 @@ var ServerPackageStatusSchema = object({
49855
50824
  * for version skew: an older provider's payload simply omits it, and an
49856
50825
  * absent wrapper is unknown — never `native`.
49857
50826
  */
49858
- wrapper: WrapperIdentitySchema.optional()
50827
+ wrapper: WrapperIdentitySchema.optional(),
50828
+ /**
50829
+ * What this node PLANNED to run against what its process service reports
50830
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50831
+ * on a provider that predates it. Absent is "not checked yet", never "all
50832
+ * well": a consumer that needs the answer treats it as pending.
50833
+ */
50834
+ runners: RunnerBootCheckSchema.optional()
49859
50835
  });
49860
50836
  var ServerUpdateCheckResultSchema = object({
49861
50837
  packageName: string$2(),
@@ -49906,6 +50882,13 @@ var ServerUpdateOutcomeSchema = _enum([
49906
50882
  "refused",
49907
50883
  "failed"
49908
50884
  ]);
50885
+ /** One addon the pre-flight found the target version would refuse (D877). */
50886
+ var UpdateBlockerSchema = object({
50887
+ addonId: string$2(),
50888
+ reason: string$2(),
50889
+ /** What the operator does about it. */
50890
+ remedy: string$2()
50891
+ });
49909
50892
  var ServerUpdateActionResultSchema = object({
49910
50893
  accepted: boolean(),
49911
50894
  targetVersion: string$2().nullable(),
@@ -49923,14 +50906,27 @@ var ServerUpdateActionResultSchema = object({
49923
50906
  * The failure itself, verbatim enough to act on (the npm output for a
49924
50907
  * staging install). Non-null only for `failed`.
49925
50908
  */
49926
- error: string$2().nullable().optional()
50909
+ error: string$2().nullable().optional(),
50910
+ /**
50911
+ * The addons the target version would refuse to start on this node's live
50912
+ * store (D877), present when the pre-flight refused the update
50913
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50914
+ */
50915
+ blockers: array(UpdateBlockerSchema).optional()
49927
50916
  });
49928
50917
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
49929
50918
  kind: "mutation",
49930
50919
  auth: "admin"
49931
- }), method(object({
49932
- /** Explicit target version; omitted = latest from the registry. */
49933
- version: string$2().optional() }), ServerUpdateActionResultSchema, {
50920
+ }), method(object({
50921
+ /** Explicit target version; omitted = latest from the registry. */
50922
+ version: string$2().optional(),
50923
+ /**
50924
+ * Apply even though the pre-flight (D877) found addons the target would
50925
+ * refuse to start. Off by default: those addons stay down until the
50926
+ * remedy is run, which is the incident this gate exists to prevent.
50927
+ */
50928
+ acknowledgeRefusals: boolean().optional()
50929
+ }), ServerUpdateActionResultSchema, {
49934
50930
  kind: "mutation",
49935
50931
  auth: "admin",
49936
50932
  timeoutMs: 16 * 6e4
@@ -52376,7 +53372,9 @@ var ManifestShapeSchema = object({
52376
53372
  var AddonProcessSchema = object({
52377
53373
  pid: number().optional(),
52378
53374
  mode: string$2(),
52379
- state: string$2()
53375
+ state: string$2(),
53376
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53377
+ reason: string$2().optional()
52380
53378
  });
52381
53379
  /**
52382
53380
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -53144,7 +54142,8 @@ var batteryCapability = {
53144
54142
  DeviceType.Button,
53145
54143
  DeviceType.Switch,
53146
54144
  DeviceType.PetFeeder,
53147
- DeviceType.Container
54145
+ DeviceType.Container,
54146
+ DeviceType.Thermostat
53148
54147
  ],
53149
54148
  methods: {
53150
54149
  /**
@@ -53782,6 +54781,12 @@ var ClimateControlStatusSchema = object({
53782
54781
  /** Horizontal louver swing on/off. Null when the device has no
53783
54782
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
53784
54783
  swingHorizontal: boolean().nullable(),
54784
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
54785
+ minTemp: number().nullable().optional(),
54786
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
54787
+ maxTemp: number().nullable().optional(),
54788
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
54789
+ tempStep: number().positive().nullable().optional(),
53785
54790
  /** Ms epoch when the slice was last updated (push or command). */
53786
54791
  lastFetchedAt: number()
53787
54792
  });
@@ -54628,6 +55633,125 @@ onStatusChanged: { data: object({
54628
55633
  * whether persisting is worth a SQLite commit. */
54629
55634
  volatileStateFields: ["lastChangedAt"]
54630
55635
  };
55636
+ /**
55637
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
55638
+ * consumable levels (salt, rinse aid) and common program options.
55639
+ *
55640
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
55641
+ * by any integration that exposes the same program / option surface.
55642
+ *
55643
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
55644
+ * provider refreshes the slice on an interval and eagerly after commands.
55645
+ */
55646
+ var DishwasherStateSchema = _enum([
55647
+ "idle",
55648
+ "running",
55649
+ "paused",
55650
+ "finished",
55651
+ "error",
55652
+ "unavailable"
55653
+ ]);
55654
+ var DishwasherConsumableLevelSchema = _enum([
55655
+ "ok",
55656
+ "low",
55657
+ "empty"
55658
+ ]);
55659
+ var DishwasherStatusSchema = object({
55660
+ state: DishwasherStateSchema,
55661
+ /** Active program id/name, or null when none selected / unknown. */
55662
+ program: string$2().nullable(),
55663
+ /** Program tokens the hardware accepts — drives the UI selector. */
55664
+ availablePrograms: array(string$2()),
55665
+ /** Minutes remaining on the active cycle, or null when not running. */
55666
+ remainingMinutes: number().int().nonnegative().nullable(),
55667
+ /** Cycle completion 0..100, or null when not applicable. */
55668
+ progressPercent: number().min(0).max(100).nullable(),
55669
+ /** True when the door is reported open. */
55670
+ doorOpen: boolean(),
55671
+ /** True when remote start is allowed (door closed, power on, etc.). */
55672
+ remoteStartAllowed: boolean(),
55673
+ /** Main power / switched-on state. */
55674
+ powerOn: boolean(),
55675
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
55676
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
55677
+ halfLoad: boolean(),
55678
+ hygienePlus: boolean(),
55679
+ errorCode: number().nullable(),
55680
+ errorLabel: string$2().nullable(),
55681
+ lastFetchedAt: number()
55682
+ });
55683
+ var dishwasherCapability = {
55684
+ name: "dishwasher",
55685
+ scope: "device",
55686
+ deviceNative: true,
55687
+ mode: "singleton",
55688
+ deviceTypes: [DeviceType.Dishwasher],
55689
+ methods: {
55690
+ start: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55691
+ kind: "mutation",
55692
+ auth: "protected"
55693
+ }),
55694
+ pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55695
+ kind: "mutation",
55696
+ auth: "protected"
55697
+ }),
55698
+ stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55699
+ kind: "mutation",
55700
+ auth: "protected"
55701
+ }),
55702
+ setProgram: method(object({
55703
+ deviceId: number().int().nonnegative(),
55704
+ program: string$2().min(1)
55705
+ }), _void(), {
55706
+ kind: "mutation",
55707
+ auth: "protected"
55708
+ }),
55709
+ setPower: method(object({
55710
+ deviceId: number().int().nonnegative(),
55711
+ on: boolean()
55712
+ }), _void(), {
55713
+ kind: "mutation",
55714
+ auth: "protected"
55715
+ }),
55716
+ setHalfLoad: method(object({
55717
+ deviceId: number().int().nonnegative(),
55718
+ on: boolean()
55719
+ }), _void(), {
55720
+ kind: "mutation",
55721
+ auth: "protected"
55722
+ }),
55723
+ setHygienePlus: method(object({
55724
+ deviceId: number().int().nonnegative(),
55725
+ on: boolean()
55726
+ }), _void(), {
55727
+ kind: "mutation",
55728
+ auth: "protected"
55729
+ }),
55730
+ setOption: method(object({
55731
+ deviceId: number().int().nonnegative(),
55732
+ key: string$2().min(1),
55733
+ value: union([
55734
+ boolean(),
55735
+ string$2(),
55736
+ number()
55737
+ ])
55738
+ }), _void(), {
55739
+ kind: "mutation",
55740
+ auth: "protected"
55741
+ })
55742
+ },
55743
+ status: {
55744
+ schema: DishwasherStatusSchema,
55745
+ kind: "poll"
55746
+ },
55747
+ runtimeState: DishwasherStatusSchema,
55748
+ durability: "session",
55749
+ history: { fields: { progressPercent: {
55750
+ kind: "gauge",
55751
+ unit: "%",
55752
+ deadband: 2
55753
+ } } }
55754
+ };
54631
55755
  var DoorbellStatusSchema = object({
54632
55756
  /** Ms epoch of the last press. null = never observed since this provider started. */
54633
55757
  lastPressedAt: number().nullable(),
@@ -55430,6 +56554,32 @@ var gasCapability = {
55430
56554
  * whether persisting is worth a SQLite commit. */
55431
56555
  volatileStateFields: ["lastChangedAt"]
55432
56556
  };
56557
+ var HeatingValveStatusSchema = object({
56558
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
56559
+ position: number().min(0).max(100).nullable(),
56560
+ /** Ms epoch when the slice was last updated (push or poll). */
56561
+ lastFetchedAt: number()
56562
+ });
56563
+ var heatingValveCapability = {
56564
+ name: "heating-valve",
56565
+ scope: "device",
56566
+ deviceNative: true,
56567
+ mode: "singleton",
56568
+ deviceTypes: [DeviceType.Thermostat],
56569
+ methods: {},
56570
+ status: {
56571
+ schema: HeatingValveStatusSchema,
56572
+ kind: "push"
56573
+ },
56574
+ runtimeState: HeatingValveStatusSchema,
56575
+ durability: "session",
56576
+ history: { fields: { position: {
56577
+ kind: "gauge",
56578
+ unit: "%",
56579
+ deadband: 1
56580
+ } } },
56581
+ volatileStateFields: ["lastFetchedAt"]
56582
+ };
55433
56583
  /**
55434
56584
  * Humidifier / dehumidifier cap. Models HA `humidifier.*` entities —
55435
56585
  * an on/off actuator with an optional target-humidity setpoint and an
@@ -56562,7 +57712,19 @@ var TlsStatusSchema = object({
56562
57712
  sans: array(string$2()),
56563
57713
  caCertPem: string$2().nullable(),
56564
57714
  reissueError: string$2().nullable(),
56565
- restartRequired: boolean()
57715
+ restartRequired: boolean(),
57716
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
57717
+ caMissing: boolean(),
57718
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
57719
+ localCaConstrained: boolean().nullable(),
57720
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
57721
+ caReplacedAt: string$2().nullable(),
57722
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
57723
+ storedUpload: object({
57724
+ leafFingerprintSha256: string$2(),
57725
+ validTo: string$2(),
57726
+ hasCa: boolean()
57727
+ }).nullable()
56566
57728
  });
56567
57729
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
56568
57730
  /**
@@ -56618,6 +57780,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
56618
57780
  }), method(_void(), object({ pem: string$2() })), method(_void(), TlsStatusSchema, {
56619
57781
  kind: "mutation",
56620
57782
  auth: "admin"
57783
+ }), method(_void(), TlsStatusSchema, {
57784
+ kind: "mutation",
57785
+ auth: "admin"
56621
57786
  });
56622
57787
  var LockControlStatusSchema = object({
56623
57788
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -63111,7 +64276,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
63111
64276
  kind: "mutation",
63112
64277
  auth: "admin",
63113
64278
  access: "delete"
63114
- }), method(object({ userId: string$2() }), TotpStatusSchema, { auth: "admin" }), method(object({
64279
+ }), method(object({ userId: string$2() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
64280
+ kind: "mutation",
64281
+ auth: "admin",
64282
+ access: "create"
64283
+ }), method(object({
63115
64284
  userId: string$2(),
63116
64285
  code: string$2()
63117
64286
  }), object({ valid: boolean() }), {
@@ -64831,6 +66000,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
64831
66000
  dayNight: dayNightCapability,
64832
66001
  deviceDiscovery: deviceDiscoveryCapability,
64833
66002
  deviceStatus: deviceStatusCapability,
66003
+ dishwasher: dishwasherCapability,
64834
66004
  doorbell: doorbellCapability,
64835
66005
  enumSensor: enumSensorCapability,
64836
66006
  eventEmitter: eventEmitterCapability,
@@ -64838,6 +66008,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
64838
66008
  featureProbe: featureProbeCapability,
64839
66009
  flood: floodCapability,
64840
66010
  gas: gasCapability,
66011
+ heatingValve: heatingValveCapability,
64841
66012
  humidifier: humidifierCapability,
64842
66013
  humiditySensor: humiditySensorCapability,
64843
66014
  image: imageCapability,
@@ -64923,13 +66094,14 @@ var BaseDevice = class {
64923
66094
  get state() {
64924
66095
  if (!this._stateProxyCache) {
64925
66096
  const cache = {};
64926
- const handler = { get: (_target, key) => {
66097
+ const handler = { get: (target, key) => {
64927
66098
  const k = key;
64928
- if (k in cache) return cache[k];
66099
+ const existing = Reflect.get(target, k);
66100
+ if (existing !== void 0) return existing;
64929
66101
  const cap = DEVICE_LOCAL_STATE_CAPS[k];
64930
66102
  if (!cap) return void 0;
64931
66103
  const proxy = this.sliceProxy(cap);
64932
- cache[k] = proxy;
66104
+ Reflect.set(target, k, proxy);
64933
66105
  return proxy;
64934
66106
  } };
64935
66107
  this._stateProxyCache = new Proxy(cache, handler);
@@ -65128,7 +66300,7 @@ var BaseDevice = class {
65128
66300
  async updateSourceInfo(patch) {
65129
66301
  const next = mergeSourceInfo(this.sourceInfo, patch);
65130
66302
  this._sourceInfoCache = Object.freeze({ ...next });
65131
- const action = this.ctx.api?.deviceManager?.setMetadata;
66303
+ const action = this.ctx.api.deviceManager?.setMetadata;
65132
66304
  if (action) try {
65133
66305
  await action.mutate({
65134
66306
  deviceId: this.id,
@@ -65163,7 +66335,7 @@ var BaseDevice = class {
65163
66335
  * device boot on a meta refresh.
65164
66336
  */
65165
66337
  async refreshFeatures() {
65166
- const action = this.ctx.api?.deviceManager?.registerDevice;
66338
+ const action = this.ctx.api.deviceManager?.registerDevice;
65167
66339
  if (!action) return;
65168
66340
  try {
65169
66341
  await action.mutate({
@@ -65562,6 +66734,12 @@ var BaseDeviceProvider = class extends BaseAddon {
65562
66734
  provider: this
65563
66735
  }];
65564
66736
  }
66737
+ /** Flatten `super.onInitialize()` whether it returned an array or an envelope. */
66738
+ providerRegistrationsFromSuper(result) {
66739
+ if (Array.isArray(result)) return result;
66740
+ if (result !== void 0 && result.providers !== void 0) return [...result.providers];
66741
+ return [];
66742
+ }
65565
66743
  async onShutdown() {
65566
66744
  this._restoreShuttingDown = true;
65567
66745
  this.cancelRestoreRetries();
@@ -66088,7 +67266,7 @@ var BaseDeviceProvider = class extends BaseAddon {
66088
67266
  return toDeviceSummary(device, this.addonId);
66089
67267
  }
66090
67268
  };
66091
- 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;
67269
+ 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;
66092
67270
  new Set(Object.values(DeviceType));
66093
67271
  Object.freeze({
66094
67272
  "accessories.getStatus": {
@@ -67237,6 +68415,12 @@ Object.freeze({
67237
68415
  addonId: null,
67238
68416
  access: "view"
67239
68417
  },
68418
+ "coreBlocks.migrateRawSecrets": {
68419
+ capName: "core-blocks",
68420
+ capScope: "system",
68421
+ addonId: null,
68422
+ access: "create"
68423
+ },
67240
68424
  "coreBlocks.restart": {
67241
68425
  capName: "core-blocks",
67242
68426
  capScope: "system",
@@ -68503,6 +69687,60 @@ Object.freeze({
68503
69687
  addonId: null,
68504
69688
  access: "view"
68505
69689
  },
69690
+ "dishwasher.getStatus": {
69691
+ capName: "dishwasher",
69692
+ capScope: "device",
69693
+ addonId: null,
69694
+ access: "view"
69695
+ },
69696
+ "dishwasher.pause": {
69697
+ capName: "dishwasher",
69698
+ capScope: "device",
69699
+ addonId: null,
69700
+ access: "create"
69701
+ },
69702
+ "dishwasher.setHalfLoad": {
69703
+ capName: "dishwasher",
69704
+ capScope: "device",
69705
+ addonId: null,
69706
+ access: "create"
69707
+ },
69708
+ "dishwasher.setHygienePlus": {
69709
+ capName: "dishwasher",
69710
+ capScope: "device",
69711
+ addonId: null,
69712
+ access: "create"
69713
+ },
69714
+ "dishwasher.setOption": {
69715
+ capName: "dishwasher",
69716
+ capScope: "device",
69717
+ addonId: null,
69718
+ access: "create"
69719
+ },
69720
+ "dishwasher.setPower": {
69721
+ capName: "dishwasher",
69722
+ capScope: "device",
69723
+ addonId: null,
69724
+ access: "create"
69725
+ },
69726
+ "dishwasher.setProgram": {
69727
+ capName: "dishwasher",
69728
+ capScope: "device",
69729
+ addonId: null,
69730
+ access: "create"
69731
+ },
69732
+ "dishwasher.start": {
69733
+ capName: "dishwasher",
69734
+ capScope: "device",
69735
+ addonId: null,
69736
+ access: "create"
69737
+ },
69738
+ "dishwasher.stop": {
69739
+ capName: "dishwasher",
69740
+ capScope: "device",
69741
+ addonId: null,
69742
+ access: "create"
69743
+ },
68506
69744
  "doorbell.getStatus": {
68507
69745
  capName: "doorbell",
68508
69746
  capScope: "device",
@@ -68713,6 +69951,12 @@ Object.freeze({
68713
69951
  addonId: null,
68714
69952
  access: "view"
68715
69953
  },
69954
+ "heatingValve.getStatus": {
69955
+ capName: "heating-valve",
69956
+ capScope: "device",
69957
+ addonId: null,
69958
+ access: "view"
69959
+ },
68716
69960
  "humidifier.getStatus": {
68717
69961
  capName: "humidifier",
68718
69962
  capScope: "device",
@@ -68923,6 +70167,12 @@ Object.freeze({
68923
70167
  addonId: null,
68924
70168
  access: "create"
68925
70169
  },
70170
+ "keychainAdmin.importSecret": {
70171
+ capName: "keychain-admin",
70172
+ capScope: "system",
70173
+ addonId: null,
70174
+ access: "create"
70175
+ },
68926
70176
  "keychainAdmin.listAudit": {
68927
70177
  capName: "keychain-admin",
68928
70178
  capScope: "system",
@@ -69091,6 +70341,12 @@ Object.freeze({
69091
70341
  addonId: null,
69092
70342
  access: "view"
69093
70343
  },
70344
+ "llm.migrateRawSecrets": {
70345
+ capName: "llm",
70346
+ capScope: "system",
70347
+ addonId: null,
70348
+ access: "create"
70349
+ },
69094
70350
  "llm.resolveModelRef": {
69095
70351
  capName: "llm",
69096
70352
  capScope: "system",
@@ -69319,6 +70575,12 @@ Object.freeze({
69319
70575
  addonId: null,
69320
70576
  access: "create"
69321
70577
  },
70578
+ "localNetwork.useStoredUploadedCertificate": {
70579
+ capName: "local-network",
70580
+ capScope: "system",
70581
+ addonId: null,
70582
+ access: "create"
70583
+ },
69322
70584
  "lockControl.getStatus": {
69323
70585
  capName: "lock-control",
69324
70586
  capScope: "device",
@@ -71971,6 +73233,30 @@ Object.freeze({
71971
73233
  addonId: null,
71972
73234
  access: "create"
71973
73235
  },
73236
+ "recordEntries.deleteEntry": {
73237
+ capName: "record-entries",
73238
+ capScope: "system",
73239
+ addonId: null,
73240
+ access: "delete"
73241
+ },
73242
+ "recordEntries.listEntries": {
73243
+ capName: "record-entries",
73244
+ capScope: "system",
73245
+ addonId: null,
73246
+ access: "view"
73247
+ },
73248
+ "recordEntries.listEntryKinds": {
73249
+ capName: "record-entries",
73250
+ capScope: "system",
73251
+ addonId: null,
73252
+ access: "view"
73253
+ },
73254
+ "recordEntries.putEntry": {
73255
+ capName: "record-entries",
73256
+ capScope: "system",
73257
+ addonId: null,
73258
+ access: "create"
73259
+ },
71974
73260
  "recording.getAvailability": {
71975
73261
  capName: "recording",
71976
73262
  capScope: "device",
@@ -72271,6 +73557,102 @@ Object.freeze({
72271
73557
  addonId: null,
72272
73558
  access: "view"
72273
73559
  },
73560
+ "records.aggregate": {
73561
+ capName: "records",
73562
+ capScope: "system",
73563
+ addonId: null,
73564
+ access: "view"
73565
+ },
73566
+ "records.allocateId": {
73567
+ capName: "records",
73568
+ capScope: "system",
73569
+ addonId: null,
73570
+ access: "create"
73571
+ },
73572
+ "records.count": {
73573
+ capName: "records",
73574
+ capScope: "system",
73575
+ addonId: null,
73576
+ access: "view"
73577
+ },
73578
+ "records.declareKinds": {
73579
+ capName: "records",
73580
+ capScope: "system",
73581
+ addonId: null,
73582
+ access: "create"
73583
+ },
73584
+ "records.delete": {
73585
+ capName: "records",
73586
+ capScope: "system",
73587
+ addonId: null,
73588
+ access: "delete"
73589
+ },
73590
+ "records.deleteDevice": {
73591
+ capName: "records",
73592
+ capScope: "system",
73593
+ addonId: null,
73594
+ access: "delete"
73595
+ },
73596
+ "records.deleteMany": {
73597
+ capName: "records",
73598
+ capScope: "system",
73599
+ addonId: null,
73600
+ access: "delete"
73601
+ },
73602
+ "records.deleteWhere": {
73603
+ capName: "records",
73604
+ capScope: "system",
73605
+ addonId: null,
73606
+ access: "delete"
73607
+ },
73608
+ "records.get": {
73609
+ capName: "records",
73610
+ capScope: "system",
73611
+ addonId: null,
73612
+ access: "view"
73613
+ },
73614
+ "records.getMany": {
73615
+ capName: "records",
73616
+ capScope: "system",
73617
+ addonId: null,
73618
+ access: "view"
73619
+ },
73620
+ "records.histogram": {
73621
+ capName: "records",
73622
+ capScope: "system",
73623
+ addonId: null,
73624
+ access: "view"
73625
+ },
73626
+ "records.patch": {
73627
+ capName: "records",
73628
+ capScope: "system",
73629
+ addonId: null,
73630
+ access: "create"
73631
+ },
73632
+ "records.put": {
73633
+ capName: "records",
73634
+ capScope: "system",
73635
+ addonId: null,
73636
+ access: "create"
73637
+ },
73638
+ "records.putMany": {
73639
+ capName: "records",
73640
+ capScope: "system",
73641
+ addonId: null,
73642
+ access: "create"
73643
+ },
73644
+ "records.query": {
73645
+ capName: "records",
73646
+ capScope: "system",
73647
+ addonId: null,
73648
+ access: "view"
73649
+ },
73650
+ "records.secretRefs": {
73651
+ capName: "records",
73652
+ capScope: "system",
73653
+ addonId: null,
73654
+ access: "view"
73655
+ },
72274
73656
  "sceneMonitor.captureReference": {
72275
73657
  capName: "scene-monitor",
72276
73658
  capScope: "device",
@@ -72703,6 +74085,48 @@ Object.freeze({
72703
74085
  addonId: null,
72704
74086
  access: "create"
72705
74087
  },
74088
+ "storageAdmin.adoptRecords": {
74089
+ capName: "storage-admin",
74090
+ capScope: "system",
74091
+ addonId: null,
74092
+ access: "create"
74093
+ },
74094
+ "storageAdmin.dropCollection": {
74095
+ capName: "storage-admin",
74096
+ capScope: "system",
74097
+ addonId: null,
74098
+ access: "delete"
74099
+ },
74100
+ "storageAdmin.isAdoptedLegacyTable": {
74101
+ capName: "storage-admin",
74102
+ capScope: "system",
74103
+ addonId: null,
74104
+ access: "view"
74105
+ },
74106
+ "storageAdmin.listKinds": {
74107
+ capName: "storage-admin",
74108
+ capScope: "system",
74109
+ addonId: null,
74110
+ access: "view"
74111
+ },
74112
+ "storageAdmin.listTables": {
74113
+ capName: "storage-admin",
74114
+ capScope: "system",
74115
+ addonId: null,
74116
+ access: "view"
74117
+ },
74118
+ "storageAdmin.readLegacyCollection": {
74119
+ capName: "storage-admin",
74120
+ capScope: "system",
74121
+ addonId: null,
74122
+ access: "view"
74123
+ },
74124
+ "storageAdmin.readRecords": {
74125
+ capName: "storage-admin",
74126
+ capScope: "system",
74127
+ addonId: null,
74128
+ access: "view"
74129
+ },
72706
74130
  "storageEvictable.evict": {
72707
74131
  capName: "storage-evictable",
72708
74132
  capScope: "system",
@@ -73615,6 +75039,12 @@ Object.freeze({
73615
75039
  addonId: null,
73616
75040
  access: "view"
73617
75041
  },
75042
+ "userManagement.migrateRawSecrets": {
75043
+ capName: "user-management",
75044
+ capScope: "system",
75045
+ addonId: null,
75046
+ access: "create"
75047
+ },
73618
75048
  "userManagement.oauthExchangeCode": {
73619
75049
  capName: "user-management",
73620
75050
  capScope: "system",
@@ -74114,7 +75544,7 @@ Object.freeze({
74114
75544
  access: "create"
74115
75545
  }
74116
75546
  });
74117
- 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;
75547
+ 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;
74118
75548
  DeviceFeature.BatteryOperated;
74119
75549
  Object.freeze({
74120
75550
  "accessories.getStatus": [{
@@ -74938,6 +76368,51 @@ Object.freeze({
74938
76368
  form: "single",
74939
76369
  optional: false
74940
76370
  }],
76371
+ "dishwasher.getStatus": [{
76372
+ name: "deviceId",
76373
+ form: "single",
76374
+ optional: false
76375
+ }],
76376
+ "dishwasher.pause": [{
76377
+ name: "deviceId",
76378
+ form: "single",
76379
+ optional: false
76380
+ }],
76381
+ "dishwasher.setHalfLoad": [{
76382
+ name: "deviceId",
76383
+ form: "single",
76384
+ optional: false
76385
+ }],
76386
+ "dishwasher.setHygienePlus": [{
76387
+ name: "deviceId",
76388
+ form: "single",
76389
+ optional: false
76390
+ }],
76391
+ "dishwasher.setOption": [{
76392
+ name: "deviceId",
76393
+ form: "single",
76394
+ optional: false
76395
+ }],
76396
+ "dishwasher.setPower": [{
76397
+ name: "deviceId",
76398
+ form: "single",
76399
+ optional: false
76400
+ }],
76401
+ "dishwasher.setProgram": [{
76402
+ name: "deviceId",
76403
+ form: "single",
76404
+ optional: false
76405
+ }],
76406
+ "dishwasher.start": [{
76407
+ name: "deviceId",
76408
+ form: "single",
76409
+ optional: false
76410
+ }],
76411
+ "dishwasher.stop": [{
76412
+ name: "deviceId",
76413
+ form: "single",
76414
+ optional: false
76415
+ }],
74941
76416
  "doorbell.getStatus": [{
74942
76417
  name: "deviceId",
74943
76418
  form: "single",
@@ -75007,6 +76482,11 @@ Object.freeze({
75007
76482
  form: "single",
75008
76483
  optional: false
75009
76484
  }],
76485
+ "heatingValve.getStatus": [{
76486
+ name: "deviceId",
76487
+ form: "single",
76488
+ optional: false
76489
+ }],
75010
76490
  "humidifier.getStatus": [{
75011
76491
  name: "deviceId",
75012
76492
  form: "single",
@@ -76291,6 +77771,37 @@ Object.freeze({
76291
77771
  form: "single",
76292
77772
  optional: false
76293
77773
  }],
77774
+ "records.count": [{
77775
+ name: "deviceId",
77776
+ form: "single",
77777
+ optional: true
77778
+ }],
77779
+ "records.deleteDevice": [{
77780
+ name: "deviceId",
77781
+ form: "single",
77782
+ optional: false
77783
+ }],
77784
+ "records.deleteWhere": [{
77785
+ name: "deviceId",
77786
+ form: "single",
77787
+ optional: true
77788
+ }],
77789
+ "records.histogram": [{
77790
+ name: "deviceId",
77791
+ form: "single",
77792
+ optional: true
77793
+ }],
77794
+ "records.putMany": [{
77795
+ name: "records",
77796
+ form: "object-array",
77797
+ optional: false,
77798
+ itemField: "deviceId"
77799
+ }],
77800
+ "records.query": [{
77801
+ name: "deviceId",
77802
+ form: "single",
77803
+ optional: true
77804
+ }],
76294
77805
  "sceneMonitor.captureReference": [{
76295
77806
  name: "deviceId",
76296
77807
  form: "single",
@@ -76407,6 +77918,17 @@ Object.freeze({
76407
77918
  form: "single",
76408
77919
  optional: false
76409
77920
  }],
77921
+ "storageAdmin.adoptRecords": [{
77922
+ name: "records",
77923
+ form: "object-array",
77924
+ optional: false,
77925
+ itemField: "deviceId"
77926
+ }],
77927
+ "storageAdmin.readRecords": [{
77928
+ name: "deviceId",
77929
+ form: "single",
77930
+ optional: true
77931
+ }],
76410
77932
  "streamBroker.acquireEgressTranscode": [{
76411
77933
  name: "deviceId",
76412
77934
  form: "single",
@@ -187812,13 +189334,15 @@ var matterConnectionSchema = object({
187812
189334
  /** PULL-reconcile interval for the commissioned-node inventory. */
187813
189335
  reconcileIntervalMs: preprocess((v) => v === "" || v === null ? void 0 : v, number().int().min(1e4).max(864e5).default(3e5)).describe("Node-inventory reconcile interval (ms)")
187814
189336
  });
187815
- /** Top-level addon config — an ordered list of broker entries (default empty). */
187816
- var matterAddonConfigSchema = object({ brokers: array(object({
189337
+ /** A single registered Matter fabric ("broker"). */
189338
+ var MatterBrokerEntrySchema = object({
187817
189339
  id: string$2().min(1),
187818
189340
  name: string$2().min(1),
187819
189341
  connection: matterConnectionSchema,
187820
189342
  integrationId: string$2().optional()
187821
- })).default([]) });
189343
+ });
189344
+ /** Top-level addon config — an ordered list of broker entries (default empty). */
189345
+ var matterAddonConfigSchema = object({ brokers: array(MatterBrokerEntrySchema).default([]) });
187822
189346
  /** Narrow an `unknown` to a shallow plain-object record (cast-free boundary). */
187823
189347
  function toRecord(value) {
187824
189348
  if (typeof value === "object" && value !== null && !Array.isArray(value)) return Object.fromEntries(Object.entries(value));
@@ -188793,6 +190317,70 @@ var MatterNodeDevice = class extends BaseDevice {
188793
190317
  return specs;
188794
190318
  }
188795
190319
  };
190320
+ var matterBrokersEntryKind = defineEntryKind("brokers", {
190321
+ title: "Matter brokers",
190322
+ schema: entryBody({
190323
+ connection: MatterBrokerEntrySchema.shape.connection,
190324
+ integrationId: string$2().optional()
190325
+ }),
190326
+ writeTrigger: "an operator adds, edits or removes a Matter fabric broker",
190327
+ adoptsFrom: settingsBrokersAdoptsFrom("matter-broker")
190328
+ });
190329
+ //#endregion
190330
+ //#region src/matter-broker-store.ts
190331
+ function rowToEntry(id, data) {
190332
+ const parsed = MatterBrokerEntrySchema.safeParse({
190333
+ id,
190334
+ name: data.name,
190335
+ connection: data.connection,
190336
+ integrationId: data.integrationId
190337
+ });
190338
+ return parsed.success ? parsed.data : null;
190339
+ }
190340
+ var MatterBrokerStore = class MatterBrokerStore {
190341
+ kind;
190342
+ constructor(kind) {
190343
+ this.kind = kind;
190344
+ }
190345
+ static of(records) {
190346
+ return new MatterBrokerStore(records.kind(matterBrokersEntryKind));
190347
+ }
190348
+ async listResolved() {
190349
+ const page = await this.kind.query({ limit: 1e3 });
190350
+ const out = [];
190351
+ for (const record of page.records) {
190352
+ let data = record.data;
190353
+ try {
190354
+ const resolved = await this.kind.getResolved(record.id);
190355
+ if (resolved !== null) data = resolved.data;
190356
+ } catch (err) {
190357
+ if (!(err instanceof RecordSecretUnavailableError)) throw err;
190358
+ }
190359
+ const entry = rowToEntry(record.id, data);
190360
+ if (entry !== null) out.push(entry);
190361
+ }
190362
+ return out;
190363
+ }
190364
+ async replaceAll(entries) {
190365
+ const page = await this.kind.query({ limit: 1e3 });
190366
+ const nextIds = new Set(entries.map((e) => e.id));
190367
+ for (const row of page.records) if (!nextIds.has(row.id)) await this.kind.delete(row.id);
190368
+ for (const entry of entries) {
190369
+ const { id, name, connection, integrationId } = entry;
190370
+ const body = {
190371
+ name,
190372
+ connection,
190373
+ ...integrationId === void 0 ? {} : { integrationId }
190374
+ };
190375
+ const parsed = matterBrokersEntryKind.schema.safeParse(body);
190376
+ if (!parsed.success) throw new Error(`invalid Matter broker '${id}': ${parsed.error.message}`);
190377
+ await this.kind.put({
190378
+ id,
190379
+ data: parsed.data
190380
+ });
190381
+ }
190382
+ }
190383
+ };
188796
190384
  //#endregion
188797
190385
  //#region src/addon.ts
188798
190386
  /** Default config — a fresh install starts with no fabric. */
@@ -188817,11 +190405,18 @@ var MatterBrokerAddon = class extends BaseDeviceProvider {
188817
190405
  providerName = "Matter";
188818
190406
  deviceClasses = { [DeviceType.Container]: MatterNodeDevice };
188819
190407
  registry = null;
190408
+ brokerStore = null;
190409
+ activeBrokers = [];
188820
190410
  constructor() {
188821
190411
  super({ ...DEFAULTS });
188822
190412
  }
188823
190413
  async onInitialize() {
188824
- const regs = await super.onInitialize();
190414
+ const regs = this.providerRegistrationsFromSuper(await super.onInitialize());
190415
+ const records = this.ctx.records;
190416
+ if (records === void 0) throw new Error("matter-broker: ctx.records is required (hub-only addon)");
190417
+ await records.declare({ brokers: matterBrokersEntryKind });
190418
+ this.brokerStore = MatterBrokerStore.of(records);
190419
+ this.activeBrokers = await this.loadPersistedBrokers();
188825
190420
  this.registry = new MatterBrokerRegistry(this.ctx.logger, {
188826
190421
  dataDir: this.ctx.dataDir,
188827
190422
  onBrokerConnected: (brokerId) => {
@@ -188839,8 +190434,8 @@ var MatterBrokerAddon = class extends BaseDeviceProvider {
188839
190434
  }
188840
190435
  });
188841
190436
  matterCommands.setDispatcher((brokerId, invocation) => this.requireRegistry().invokeCommand(brokerId, invocation));
188842
- await this.registry.restore(this.config.brokers);
188843
- this.ctx.logger.info("Matter: broker addon initialised", { meta: { brokerCount: this.config.brokers.length } });
190437
+ await this.registry.restore(this.activeBrokers);
190438
+ this.ctx.logger.info("Matter: broker addon initialised", { meta: { brokerCount: this.activeBrokers.length } });
188844
190439
  await this.reconcileIntegrationsToBrokers();
188845
190440
  this.subscribeIntegrationLifecycle();
188846
190441
  return [
@@ -188855,10 +190450,28 @@ var MatterBrokerAddon = class extends BaseDeviceProvider {
188855
190450
  }
188856
190451
  ];
188857
190452
  }
190453
+ async loadPersistedBrokers() {
190454
+ const store = this.brokerStore;
190455
+ if (store !== null) {
190456
+ const fromRecords = await store.listResolved();
190457
+ if (fromRecords.length > 0) return fromRecords;
190458
+ }
190459
+ return this.config.brokers;
190460
+ }
190461
+ async persistBrokerEntries(entries) {
190462
+ this.activeBrokers = [...entries];
190463
+ const store = this.brokerStore;
190464
+ if (store !== null) {
190465
+ await store.replaceAll(entries);
190466
+ return;
190467
+ }
190468
+ await this.updateGlobalSettings({ brokers: [...entries] });
190469
+ }
188858
190470
  async onConfigChanged() {
188859
190471
  const reg = this.registry;
188860
190472
  if (!reg) return;
188861
- const persisted = this.config.brokers;
190473
+ this.activeBrokers = await this.loadPersistedBrokers();
190474
+ const persisted = this.activeBrokers;
188862
190475
  const liveIds = new Set(reg.list().map((b) => b.id));
188863
190476
  const persistedIds = new Set(persisted.map((e) => e.id));
188864
190477
  for (const liveId of liveIds) if (!persistedIds.has(liveId)) try {
@@ -188889,7 +190502,7 @@ var MatterBrokerAddon = class extends BaseDeviceProvider {
188889
190502
  ...b,
188890
190503
  id: created.id
188891
190504
  } : b);
188892
- await this.updateGlobalSettings({ brokers: next });
190505
+ await this.persistBrokerEntries(next);
188893
190506
  }
188894
190507
  } catch (err) {
188895
190508
  this.ctx.logger.warn("Matter onConfigChanged: failed to start new broker", { meta: {
@@ -188970,8 +190583,8 @@ var MatterBrokerAddon = class extends BaseDeviceProvider {
188970
190583
  return buildMatterBrokerProvider({
188971
190584
  ownerAddonId: this.ctx.id,
188972
190585
  registry: this.requireRegistry(),
188973
- getBrokers: () => this.config.brokers,
188974
- persistBrokers: (brokers) => this.updateGlobalSettings({ brokers: [...brokers] }),
190586
+ getBrokers: () => this.activeBrokers,
190587
+ persistBrokers: (brokers) => this.persistBrokerEntries(brokers),
188975
190588
  cascadeRemoveDevices: (brokerId) => this.cascadeRemoveDevicesForBroker(brokerId),
188976
190589
  logger: this.ctx.logger
188977
190590
  });
@@ -188996,7 +190609,7 @@ var MatterBrokerAddon = class extends BaseDeviceProvider {
188996
190609
  const settings = await this.ctx.api.integrations.getSettings.query({ id: integration.id });
188997
190610
  const brokerId = typeof settings["brokerId"] === "string" ? settings["brokerId"] : void 0;
188998
190611
  if (brokerId === void 0) continue;
188999
- if (!this.config.brokers.some((b) => b.id === brokerId)) {
190612
+ if (!this.activeBrokers.some((b) => b.id === brokerId)) {
189000
190613
  this.ctx.logger.warn("Matter integration→broker: linked broker not found", { meta: {
189001
190614
  integrationId: integration.id,
189002
190615
  brokerId
@@ -189005,7 +190618,7 @@ var MatterBrokerAddon = class extends BaseDeviceProvider {
189005
190618
  }
189006
190619
  this.requireRegistry().linkIntegration(integration.id, brokerId);
189007
190620
  }
189008
- const toRemove = this.config.brokers.filter((b) => b.integrationId !== void 0 && !surviving.has(b.integrationId)).map((b) => b.id);
190621
+ const toRemove = this.activeBrokers.filter((b) => b.integrationId !== void 0 && !surviving.has(b.integrationId)).map((b) => b.id);
189009
190622
  if (toRemove.length === 0) return;
189010
190623
  for (const id of toRemove) try {
189011
190624
  await this.requireRegistry().removeEntry(id);
@@ -189016,8 +190629,8 @@ var MatterBrokerAddon = class extends BaseDeviceProvider {
189016
190629
  error: errMsg(err)
189017
190630
  } });
189018
190631
  }
189019
- const nextBrokers = this.config.brokers.filter((b) => !toRemove.includes(b.id));
189020
- await this.updateGlobalSettings({ brokers: nextBrokers });
190632
+ const nextBrokers = this.activeBrokers.filter((b) => !toRemove.includes(b.id));
190633
+ await this.persistBrokerEntries(nextBrokers);
189021
190634
  } catch (err) {
189022
190635
  this.ctx.logger.warn("Matter integration→broker reconcile failed", { meta: { error: errMsg(err) } });
189023
190636
  }