@camstack/addon-provider-mqtt-ha 0.1.3 → 0.1.5

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 +1312 -123
  2. package/dist/addon.mjs +1312 -123
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -34,7 +34,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
36
36
  //#endregion
37
- //#region ../types/dist/event-category-C4hVnRo8.mjs
37
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
38
38
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
39
39
  EventCategory["SystemBoot"] = "system.boot";
40
40
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -98,6 +98,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
98
98
  * consumes this category and maps it to the `addon-crash-loop` kind.
99
99
  */
100
100
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
101
+ /**
102
+ * A runner whose addon refused to start with a typed reason (D877) - parked
103
+ * in `refused`, never counted by the crash breaker, retried on operator
104
+ * action. One event per refusal.
105
+ */
106
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
107
+ /**
108
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
109
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
110
+ * runner is still pending) and the alert centre (close a recovered runner).
111
+ */
112
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
113
+ /**
114
+ * The node's one-shot runner boot check (D877): planned runners against the
115
+ * process service, `degraded` when any is failed, refused or missing. The
116
+ * alert centre turns it into one alert and a direct critical push.
117
+ */
118
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
101
119
  EventCategory["AddonError"] = "addon.error";
102
120
  EventCategory["AddonPageReady"] = "addon.page-ready";
103
121
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -5422,7 +5440,7 @@ var ZodIssueCode = {
5422
5440
  var ZodFirstPartyTypeKind;
5423
5441
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5424
5442
  //#endregion
5425
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5443
+ //#region ../types/dist/sleep-BOjuyoPC.mjs
5426
5444
  /**
5427
5445
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5428
5446
  * window to float samples (D455).
@@ -5539,7 +5557,7 @@ function isKeychainStoredField(field) {
5539
5557
  var SECRET_CLEAR = { $secretClear: true };
5540
5558
  /** The `'***'` token D634 redaction writes for non-admins. */
5541
5559
  var LEGACY_DEVICE_REDACTION = "***";
5542
- function isRecord$2(value) {
5560
+ function isRecord$5(value) {
5543
5561
  return typeof value === "object" && value !== null && !Array.isArray(value);
5544
5562
  }
5545
5563
  function makeSecretMarker(ref) {
@@ -5550,12 +5568,12 @@ function makeSecretMarker(ref) {
5550
5568
  }
5551
5569
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5552
5570
  function isSecretMarker(value) {
5553
- if (!isRecord$2(value)) return false;
5571
+ if (!isRecord$5(value)) return false;
5554
5572
  const ref = value["$secret"];
5555
5573
  return typeof ref === "string" && ref.length > 0;
5556
5574
  }
5557
5575
  function isSecretClear(value) {
5558
- return isRecord$2(value) && value["$secretClear"] === true;
5576
+ return isRecord$5(value) && value["$secretClear"] === true;
5559
5577
  }
5560
5578
  /**
5561
5579
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6165,7 +6183,7 @@ var KeychainWriteRefusedError = class extends Error {
6165
6183
  }
6166
6184
  };
6167
6185
  var KEEP = { kind: "keep" };
6168
- function isRecord$1(value) {
6186
+ function isRecord$4(value) {
6169
6187
  return typeof value === "object" && value !== null && !Array.isArray(value);
6170
6188
  }
6171
6189
  function defaultMintId() {
@@ -6178,7 +6196,7 @@ function collectSecretMarkerRefs(value, out = []) {
6178
6196
  return out;
6179
6197
  }
6180
6198
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6181
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6199
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6182
6200
  return out;
6183
6201
  }
6184
6202
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6233,7 +6251,7 @@ function rowId(row, idKey) {
6233
6251
  return null;
6234
6252
  }
6235
6253
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6236
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6254
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6237
6255
  if (!Array.isArray(incoming)) {
6238
6256
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6239
6257
  return {
@@ -6249,7 +6267,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6249
6267
  const kept = /* @__PURE__ */ new Set();
6250
6268
  const rows = [];
6251
6269
  for (const row of incoming) {
6252
- if (!isRecord$1(row)) {
6270
+ if (!isRecord$4(row)) {
6253
6271
  rows.push(row);
6254
6272
  continue;
6255
6273
  }
@@ -6274,7 +6292,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6274
6292
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6275
6293
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6276
6294
  case "object": {
6277
- if (!isRecord$1(incoming)) {
6295
+ if (!isRecord$4(incoming)) {
6278
6296
  if (incoming === void 0) return KEEP;
6279
6297
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6280
6298
  return {
@@ -6282,7 +6300,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6282
6300
  value: incoming
6283
6301
  };
6284
6302
  }
6285
- const storedObj = isRecord$1(stored) ? stored : {};
6303
+ const storedObj = isRecord$4(stored) ? stored : {};
6286
6304
  return {
6287
6305
  kind: "value",
6288
6306
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6405,7 +6423,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6405
6423
  value: items
6406
6424
  };
6407
6425
  }
6408
- if (isRecord$1(v)) {
6426
+ if (isRecord$4(v)) {
6409
6427
  const out = {};
6410
6428
  for (const [k, child] of Object.entries(v)) {
6411
6429
  const s = substitute(child);
@@ -6673,7 +6691,6 @@ function createHandle(raw, opts) {
6673
6691
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6674
6692
  const readAddonStoreResult = raw.readAddonStoreResult;
6675
6693
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6676
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6677
6694
  const overrides = {
6678
6695
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6679
6696
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6697,12 +6714,12 @@ function createHandle(raw, opts) {
6697
6714
  };
6698
6715
  } } : {},
6699
6716
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6700
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6701
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6717
+ readDeviceStoreBatch: async (deviceIds) => {
6718
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6702
6719
  const out = /* @__PURE__ */ new Map();
6703
6720
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6704
6721
  return out;
6705
- } } : {},
6722
+ },
6706
6723
  writeAddonStore: async (patch) => {
6707
6724
  await writeAddon(patch);
6708
6725
  },
@@ -7329,7 +7346,7 @@ var BaseAddon = class {
7329
7346
  if (!ctx) return;
7330
7347
  const addonId = ctx.id;
7331
7348
  setImmediate(() => {
7332
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7349
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7333
7350
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7334
7351
  }).catch((err) => {
7335
7352
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7529,7 +7546,7 @@ var BaseAddon = class {
7529
7546
  return this._addonSecretTree;
7530
7547
  }
7531
7548
  deviceSecretTree() {
7532
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7549
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7533
7550
  return this._deviceSecretTree;
7534
7551
  }
7535
7552
  /**
@@ -7605,42 +7622,135 @@ var BaseAddon = class {
7605
7622
  this[timerOf] = timer;
7606
7623
  }
7607
7624
  /**
7608
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7609
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7610
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7611
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7625
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7626
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7612
7627
  * addon permanently broken.
7613
7628
  *
7614
- * Retry only the two known infra fingerprints. Anything else propagates so
7615
- * real bugs surface immediately. After the budget expires we fall back to
7616
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7629
+ * Two kinds of outage, two budgets:
7630
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7631
+ * initialized`, `provider not available`): a short budget, then the addon
7632
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7633
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7634
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7635
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7636
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7637
+ * loop. A long, bounded budget; only after it the error propagates - the
7638
+ * addon never runs on defaults for a store it could not ask.
7639
+ * Anything else propagates immediately so real bugs surface.
7617
7640
  */
7618
7641
  async readAddonStoreWithRetry() {
7619
7642
  const settings = this.rawSettings();
7620
7643
  if (!settings) return {};
7621
- const delaysMs = [
7622
- 150,
7623
- 350,
7624
- 600,
7625
- 900
7626
- ];
7627
7644
  let lastErr;
7628
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7645
+ for (let attempt = 0;; attempt++) try {
7629
7646
  const stored = await settings.readAddonStore() ?? {};
7630
7647
  this.settingsStoreReady = true;
7631
7648
  return stored;
7632
7649
  } catch (err) {
7633
7650
  lastErr = err;
7634
- const msg = err instanceof Error ? err.message : String(err);
7635
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7636
- if (attempt === delaysMs.length) break;
7637
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7651
+ const kind = classifyStoreError(err);
7652
+ if (kind === "permanent") throw err;
7653
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7654
+ if (delay === void 0) {
7655
+ if (kind === "transport") throw err;
7656
+ break;
7657
+ }
7658
+ await new Promise((r) => setTimeout(r, delay));
7638
7659
  }
7639
7660
  this.settingsStoreReady = false;
7640
7661
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7641
7662
  return {};
7642
7663
  }
7643
7664
  };
7665
+ /** The settings store's own restart fingerprints. */
7666
+ var RESTART_RETRY_DELAYS_MS = [
7667
+ 150,
7668
+ 350,
7669
+ 600,
7670
+ 900
7671
+ ];
7672
+ /** A hub restarting under a booting runner: ~100 s in total. */
7673
+ var TRANSPORT_RETRY_DELAYS_MS = [
7674
+ 150,
7675
+ 350,
7676
+ 600,
7677
+ 900,
7678
+ 2e3,
7679
+ 5e3,
7680
+ 1e4,
7681
+ 2e4,
7682
+ 3e4,
7683
+ 3e4
7684
+ ];
7685
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7686
+ /** Node / socket error codes of a connection that did not happen or broke. */
7687
+ var TRANSPORT_CODES = new Set([
7688
+ "ECONNREFUSED",
7689
+ "ECONNRESET",
7690
+ "ETIMEDOUT",
7691
+ "EPIPE",
7692
+ "EHOSTUNREACH",
7693
+ "ENETUNREACH"
7694
+ ]);
7695
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7696
+ var UNAVAILABLE_TRPC_CODES = new Set([
7697
+ "TIMEOUT",
7698
+ "SERVICE_UNAVAILABLE",
7699
+ "BAD_GATEWAY",
7700
+ "GATEWAY_TIMEOUT"
7701
+ ]);
7702
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7703
+ var TRANSPORT_PHRASES = [
7704
+ "discovery deadline exceeded",
7705
+ "parent could not route child unowned cap call",
7706
+ "UDS request timed out after",
7707
+ "channel closed"
7708
+ ];
7709
+ /** Moleculer error `type`s of a call that could not be served right now. */
7710
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7711
+ "REQUEST_TIMEOUT",
7712
+ "SERVICE_NOT_FOUND",
7713
+ "SERVICE_NOT_AVAILABLE",
7714
+ "REQUEST_REJECTED",
7715
+ "BROKER_DISCONNECTED"
7716
+ ]);
7717
+ function stringProp(value, key) {
7718
+ if (typeof value !== "object" || value === null) return void 0;
7719
+ const found = Reflect.get(value, key);
7720
+ return typeof found === "string" ? found : void 0;
7721
+ }
7722
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7723
+ function errorCode(err) {
7724
+ const out = {};
7725
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7726
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7727
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7728
+ if (node !== void 0) out.node = node;
7729
+ const trpc = stringProp(data, "code");
7730
+ if (trpc !== void 0) out.trpc = trpc;
7731
+ return out;
7732
+ }
7733
+ /**
7734
+ * Is a settings read failure worth retrying, and with which budget? Only
7735
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7736
+ * one of the exact phrases our own transport raises. A message that merely
7737
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7738
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7739
+ */
7740
+ function classifyStoreError(err) {
7741
+ const message = err instanceof Error ? err.message : String(err);
7742
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7743
+ const code = errorCode(err);
7744
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7745
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7746
+ if (typeof err === "object" && err !== null) {
7747
+ if (Reflect.get(err, "retryable") === true) return "transport";
7748
+ const type = stringProp(err, "type");
7749
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7750
+ }
7751
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7752
+ return "permanent";
7753
+ }
7644
7754
  /**
7645
7755
  * Collect the keys of every field marked `perNode: true`, recursing into
7646
7756
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7730,6 +7840,156 @@ var PeerBytesTicketSchema = object({
7730
7840
  */
7731
7841
  declaredBytes: number().int().nonnegative().nullable()
7732
7842
  });
7843
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7844
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7845
+ var RECORD_DATABASES = ["settings", "events"];
7846
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7847
+ var RECORD_CLASSES = [
7848
+ "config",
7849
+ "ledger",
7850
+ "audit",
7851
+ "mirror",
7852
+ "ephemeral"
7853
+ ];
7854
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7855
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7856
+ var RECORD_BATCH_MAX = 1e3;
7857
+ var RECORD_QUERY_MAX = 1e3;
7858
+ function defOf(schema) {
7859
+ const zodBag = Reflect.get(schema, "_zod");
7860
+ if (typeof zodBag !== "object" || zodBag === null) return {};
7861
+ const def = Reflect.get(zodBag, "def");
7862
+ if (typeof def !== "object" || def === null) return {};
7863
+ return def;
7864
+ }
7865
+ function declaredHere(schema) {
7866
+ return globalRegistry.get(schema)?.secret === true;
7867
+ }
7868
+ /** Wrapper kinds whose `innerType` is the field itself. */
7869
+ var WRAPPERS = new Set([
7870
+ "optional",
7871
+ "nullable",
7872
+ "default",
7873
+ "prefault",
7874
+ "catch",
7875
+ "readonly",
7876
+ "nonoptional"
7877
+ ]);
7878
+ /**
7879
+ * The schema layers that make up ONE field: the schema itself and every
7880
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
7881
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
7882
+ * `.transform` on `in`).
7883
+ */
7884
+ function layersOf(schema) {
7885
+ const out = [];
7886
+ const queue = [schema];
7887
+ while (queue.length > 0) {
7888
+ const s = queue.shift();
7889
+ if (!s || out.includes(s)) continue;
7890
+ out.push(s);
7891
+ const def = defOf(s);
7892
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
7893
+ if (def.type === "pipe") {
7894
+ if (def.in) queue.push(def.in);
7895
+ if (def.out) queue.push(def.out);
7896
+ }
7897
+ }
7898
+ return out;
7899
+ }
7900
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
7901
+ function isZodSecret(schema) {
7902
+ return layersOf(schema).some(declaredHere);
7903
+ }
7904
+ /**
7905
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
7906
+ * element of this array" (`connection.password`, `rows[].token`). A declared
7907
+ * object or array is reported as one path and not descended into — everything
7908
+ * under it is secret.
7909
+ */
7910
+ function collectZodSecretPaths(schema, prefix = "") {
7911
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
7912
+ const paths = [];
7913
+ for (const layer of layersOf(schema)) {
7914
+ const def = defOf(layer);
7915
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
7916
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
7917
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
7918
+ else if (def.type === "intersection") {
7919
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
7920
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
7921
+ }
7922
+ }
7923
+ return [...new Set(paths)];
7924
+ }
7925
+ /**
7926
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
7927
+ * Zod row schema that describes it, and the helper that turns the two into the
7928
+ * JSON the engine stores.
7929
+ *
7930
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
7931
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
7932
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
7933
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
7934
+ * never a field name (D879).
7935
+ */
7936
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
7937
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
7938
+ var RecordIndexSchema = object({
7939
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
7940
+ fields: array(RecordFieldPathSchema).min(1).max(4),
7941
+ unique: boolean().optional()
7942
+ }).strict();
7943
+ var RecordRetentionSchema = union([
7944
+ object({
7945
+ ttlMs: number().int().positive(),
7946
+ from: _enum(["at", "write"])
7947
+ }).strict(),
7948
+ object({
7949
+ maxRows: number().int().positive().optional(),
7950
+ maxRowsPerDevice: number().int().positive().optional()
7951
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
7952
+ object({
7953
+ owner: string().min(1),
7954
+ reason: string().min(1)
7955
+ }).strict(),
7956
+ object({ none: string().min(1) }).strict()
7957
+ ]);
7958
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
7959
+ var EntryDescriptorSchema = object({
7960
+ title: string().min(1),
7961
+ /** The record body field shown as the entry's name. */
7962
+ nameField: string().min(1),
7963
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
7964
+ fields: record(string(), unknown())
7965
+ }).strict();
7966
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
7967
+ var RecordKindDeclarationSchema = object({
7968
+ database: _enum(RECORD_DATABASES).default("settings"),
7969
+ class: _enum(RECORD_CLASSES),
7970
+ writeTrigger: string().min(1),
7971
+ device: _enum([
7972
+ "required",
7973
+ "optional",
7974
+ "none"
7975
+ ]).default("none"),
7976
+ at: _enum(["required", "none"]).default("none"),
7977
+ indexes: array(RecordIndexSchema).max(8).default([]),
7978
+ retention: RecordRetentionSchema,
7979
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
7980
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
7981
+ /** Derived from the Zod schema; never written by hand. */
7982
+ secretPaths: array(string().min(1)).default([]),
7983
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
7984
+ secretArrayKeys: record(string(), string()).default({}),
7985
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
7986
+ adoptsFrom: string().min(1).optional(),
7987
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
7988
+ transactFamily: string().min(1).optional(),
7989
+ entry: EntryDescriptorSchema.optional()
7990
+ }).strict();
7991
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
7992
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
7733
7993
  /** Shared Zod schemas used across streaming capabilities. */
7734
7994
  var CamProfileSchema = _enum([
7735
7995
  "high",
@@ -8194,75 +8454,12 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8194
8454
  kind: "mutation",
8195
8455
  auth: "admin"
8196
8456
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
8197
- function defOf(schema) {
8198
- return schema._zod?.def ?? {};
8199
- }
8200
- function declaredHere(schema) {
8201
- return globalRegistry.get(schema)?.secret === true;
8202
- }
8203
- /** Wrapper kinds whose `innerType` is the field itself. */
8204
- var WRAPPERS = new Set([
8205
- "optional",
8206
- "nullable",
8207
- "default",
8208
- "prefault",
8209
- "catch",
8210
- "readonly",
8211
- "nonoptional"
8212
- ]);
8213
- /**
8214
- * The schema layers that make up ONE field: the schema itself and every
8215
- * wrapper below it (optional / default / nullable / readonly / catch), plus
8216
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8217
- * `.transform` on `in`).
8218
- */
8219
- function layersOf(schema) {
8220
- const out = [];
8221
- const queue = [schema];
8222
- while (queue.length > 0) {
8223
- const s = queue.shift();
8224
- if (!s || out.includes(s)) continue;
8225
- out.push(s);
8226
- const def = defOf(s);
8227
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8228
- if (def.type === "pipe") {
8229
- if (def.in) queue.push(def.in);
8230
- if (def.out) queue.push(def.out);
8231
- }
8232
- }
8233
- return out;
8234
- }
8235
- /** True when any layer of this field declares `.meta({ secret: true })`. */
8236
- function isZodSecret(schema) {
8237
- return layersOf(schema).some(declaredHere);
8238
- }
8239
- /**
8240
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
8241
- * element of this array" (`connection.password`, `rows[].token`). A declared
8242
- * object or array is reported as one path and not descended into — everything
8243
- * under it is secret.
8244
- */
8245
- function collectZodSecretPaths(schema, prefix = "") {
8246
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8247
- const paths = [];
8248
- for (const layer of layersOf(schema)) {
8249
- const def = defOf(layer);
8250
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8251
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8252
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8253
- else if (def.type === "intersection") {
8254
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8255
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8256
- }
8257
- }
8258
- return [...new Set(paths)];
8259
- }
8260
8457
  object({
8261
8458
  code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
8262
8459
  params: record(string(), union([string(), number()])).optional()
8263
8460
  });
8264
8461
  //#endregion
8265
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8462
+ //#region ../types/dist/err-msg-BXKzRBwg.mjs
8266
8463
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8267
8464
  DeviceType["Camera"] = "camera";
8268
8465
  DeviceType["Hub"] = "hub";
@@ -8354,6 +8551,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
8354
8551
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
8355
8552
  * integrations sharing the same food/desiccant/hopper surface. */
8356
8553
  DeviceType["PetFeeder"] = "pet-feeder";
8554
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
8555
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
8556
+ * Sources: native Bosch Home Connect, reusable by similar integrations. */
8557
+ DeviceType["Dishwasher"] = "dishwasher";
8357
8558
  return DeviceType;
8358
8559
  }({});
8359
8560
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -8531,6 +8732,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8531
8732
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8532
8733
  * real Switch device for UI rendering / export adapters. */
8533
8734
  DeviceRole["BinaryHelper"] = "binary-helper";
8735
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
8736
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
8737
+ DeviceRole["Outlet"] = "outlet";
8534
8738
  /** Generic motion / occupancy / moving event source. Distinct from
8535
8739
  * the camera accessory PirSensor role: that one is a camera child;
8536
8740
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8608,7 +8812,7 @@ function errMsg(err) {
8608
8812
  return String(err);
8609
8813
  }
8610
8814
  //#endregion
8611
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
8815
+ //#region ../types/dist/composition-CB6PMT9p.mjs
8612
8816
  /**
8613
8817
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8614
8818
  *
@@ -11812,11 +12016,10 @@ var ClipModelMetaSchema = object({
11812
12016
  /**
11813
12017
  * The `vector-store` index this model's vectors live in. ONE feature space
11814
12018
  * per index: two models share an index only when their vectors are ranked
11815
- * against each other, which for CLIP means never across families. MobileCLIP
11816
- * S1 and S2 share `object-clip` for history (separated by the row's
11817
- * `modelId`); any other model gets its own.
12019
+ * against each other, which for CLIP means never across families. Every
12020
+ * model gets its own.
11818
12021
  */
11819
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12022
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
11820
12023
  /**
11821
12024
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
11822
12025
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -12995,8 +13198,13 @@ var AlertSeveritySchema = _enum([
12995
13198
  "info",
12996
13199
  "success",
12997
13200
  "warning",
12998
- "error"
13201
+ "error",
13202
+ "critical"
12999
13203
  ]);
13204
+ var AlertActionSchema = object({
13205
+ label: string(),
13206
+ href: string().optional()
13207
+ });
13000
13208
  var AlertStatusSchema = _enum([
13001
13209
  "active",
13002
13210
  "in-progress",
@@ -13014,6 +13222,7 @@ var AlertSchema = object({
13014
13222
  severity: AlertSeveritySchema,
13015
13223
  title: string(),
13016
13224
  message: string(),
13225
+ action: AlertActionSchema.optional(),
13017
13226
  status: AlertStatusSchema,
13018
13227
  progress: number().optional(),
13019
13228
  read: boolean(),
@@ -15549,6 +15758,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15549
15758
  keyField: string()
15550
15759
  }).optional()
15551
15760
  })) });
15761
+ /**
15762
+ * The report of a one-shot "move this owner's plaintext secrets into the
15763
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
15764
+ *
15765
+ * The owner runs it on its own rows, through its own write path; an operator
15766
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
15767
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
15768
+ */
15769
+ var RawSecretMigrationInputSchema = object({
15770
+ /** `false` (the default of the script) = report only. */
15771
+ apply: boolean() });
15772
+ var RawSecretMigrationReportSchema = object({
15773
+ apply: boolean(),
15774
+ /** Rows that can carry a secret (a profile, an enrolment). */
15775
+ rows: number().int(),
15776
+ /** Rows whose secret was plaintext when the run started. */
15777
+ raw: number().int(),
15778
+ /** Rows that already held a keychain marker when the run started. */
15779
+ markers: number().int(),
15780
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
15781
+ migrated: number().int(),
15782
+ /** Plaintext rows left in place because the move or its read-back failed. */
15783
+ failed: number().int(),
15784
+ /** After the run: rows still holding plaintext. */
15785
+ remainingRaw: number().int(),
15786
+ /** After the run: markers the keychain could not resolve right now. */
15787
+ unresolvedMarkers: number().int(),
15788
+ /**
15789
+ * A second, redundant copy of the secrets' rows that the run found (and, on
15790
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
15791
+ */
15792
+ redundantCopies: number().int().optional(),
15793
+ /** True when nothing is raw and every marker resolves. */
15794
+ verified: boolean()
15795
+ });
15552
15796
  /** Where a block runs. The operator chooses — a block driving a device on an
15553
15797
  * agent is the reason placement is not fixed to the hub. */
15554
15798
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -15775,6 +16019,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
15775
16019
  }), SettingsUpdateResultSchema, {
15776
16020
  kind: "mutation",
15777
16021
  auth: "admin"
16022
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16023
+ kind: "mutation",
16024
+ auth: "admin"
15778
16025
  }), method(object({}), object({ libs: array(object({
15779
16026
  filePath: string(),
15780
16027
  content: string()
@@ -16038,6 +16285,347 @@ id: union([string(), number()]) }), {
16038
16285
  auth: "admin"
16039
16286
  });
16040
16287
  /**
16288
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16289
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16290
+ * (operator intent, D870) and device-history (numbers over time, D850).
16291
+ *
16292
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16293
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16294
+ * that with the addon id closed over). It is deliberately NOT in any input
16295
+ * schema, so a session can never supply it, and a call with no stamp is refused
16296
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16297
+ * addons go through the owner's capability.
16298
+ *
16299
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16300
+ * never `[]`. Secret fields are never on the wire: a read shows the
16301
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16302
+ * resolves itself, and a write may carry only a keychain marker bound to the
16303
+ * row's own ref.
16304
+ *
16305
+ * Internal: addons reach it through `ctx.records`, never directly.
16306
+ */
16307
+ var RecordIdSchema = string().min(1).max(256);
16308
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16309
+ var RecordBodySchema = record(string(), unknown());
16310
+ var RecordInputSchema = object({
16311
+ id: RecordIdSchema,
16312
+ /** The device this row belongs to (D865 removal, per-device reads). */
16313
+ deviceId: number().int().optional(),
16314
+ /** The domain clock, ms: observed / created / opened. */
16315
+ at: number().int().optional(),
16316
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16317
+ expiresAt: number().int().optional(),
16318
+ data: RecordBodySchema
16319
+ });
16320
+ var RecordViewSchema = object({
16321
+ id: string(),
16322
+ deviceId: number().int().nullable(),
16323
+ at: number().nullable(),
16324
+ expiresAt: number().nullable(),
16325
+ rev: number().int(),
16326
+ updatedAt: number(),
16327
+ data: RecordBodySchema
16328
+ });
16329
+ /** Declared index fields only. Anything else does not compile, by design. */
16330
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16331
+ string(),
16332
+ number(),
16333
+ boolean(),
16334
+ object({ in: array(union([
16335
+ string(),
16336
+ number(),
16337
+ boolean()
16338
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16339
+ object({
16340
+ gt: union([string(), number()]).optional(),
16341
+ gte: union([string(), number()]).optional(),
16342
+ lt: union([string(), number()]).optional(),
16343
+ lte: union([string(), number()]).optional()
16344
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16345
+ ]));
16346
+ var KindShape = { kind: RecordKindNameSchema };
16347
+ var TimeWindowShape = {
16348
+ deviceId: number().int().optional(),
16349
+ atFrom: number().optional(),
16350
+ atTo: number().optional()
16351
+ };
16352
+ var RecordQueryInputSchema = object({
16353
+ ...KindShape,
16354
+ ...TimeWindowShape,
16355
+ where: RecordWhereSchema.optional(),
16356
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16357
+ order: _enum(["at", "id"]).optional(),
16358
+ desc: boolean().optional(),
16359
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16360
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16361
+ cursor: string().min(1).optional()
16362
+ });
16363
+ var RecordQueryResultSchema = object({
16364
+ records: array(RecordViewSchema),
16365
+ nextCursor: string().nullable()
16366
+ });
16367
+ var RecordKindStateSchema = _enum([
16368
+ "created",
16369
+ "unchanged",
16370
+ "updated"
16371
+ ]);
16372
+ var DeclareKindResultSchema = object({
16373
+ kindId: number().int(),
16374
+ state: RecordKindStateSchema,
16375
+ createdIndexes: array(string()),
16376
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16377
+ adoptionPending: object({
16378
+ legacyTable: string(),
16379
+ legacyRows: number().int()
16380
+ }).nullable()
16381
+ });
16382
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16383
+ var SecretRefsList = array(string());
16384
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16385
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16386
+ kind: "mutation",
16387
+ auth: "admin"
16388
+ }), method(object({
16389
+ ...KindShape,
16390
+ id: RecordIdSchema
16391
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16392
+ ...KindShape,
16393
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16394
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16395
+ ...KindShape,
16396
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16397
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16398
+ ...KindShape,
16399
+ record: RecordInputSchema,
16400
+ /** Compare-and-set. `0` means "the row must not exist". */
16401
+ ifRev: number().int().min(0).optional()
16402
+ }), object({
16403
+ rev: number().int(),
16404
+ releasedRefs: SecretRefsList
16405
+ }), {
16406
+ kind: "mutation",
16407
+ auth: "admin"
16408
+ }), method(object({
16409
+ ...KindShape,
16410
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16411
+ }), object({
16412
+ count: number().int(),
16413
+ releasedRefs: SecretRefsList
16414
+ }), {
16415
+ kind: "mutation",
16416
+ auth: "admin"
16417
+ }), method(object({
16418
+ ...KindShape,
16419
+ id: RecordIdSchema,
16420
+ data: RecordBodySchema,
16421
+ at: number().int().nullable().optional(),
16422
+ expiresAt: number().int().nullable().optional(),
16423
+ ifRev: number().int().min(1).optional()
16424
+ }), object({
16425
+ rev: number().int(),
16426
+ releasedRefs: SecretRefsList
16427
+ }), {
16428
+ kind: "mutation",
16429
+ auth: "admin"
16430
+ }), method(object({
16431
+ ...KindShape,
16432
+ id: RecordIdSchema
16433
+ }), object({
16434
+ deleted: boolean(),
16435
+ secretRefs: SecretRefsList
16436
+ }), {
16437
+ kind: "mutation",
16438
+ auth: "admin"
16439
+ }), method(object({
16440
+ ...KindShape,
16441
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16442
+ }), object({
16443
+ deleted: number().int(),
16444
+ secretRefs: SecretRefsList
16445
+ }), {
16446
+ kind: "mutation",
16447
+ auth: "admin"
16448
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16449
+ ...KindShape,
16450
+ ...TimeWindowShape,
16451
+ where: RecordWhereSchema.optional()
16452
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16453
+ ...KindShape,
16454
+ deviceId: number().int().optional(),
16455
+ from: number(),
16456
+ to: number(),
16457
+ bucketMs: number().int().positive()
16458
+ }), object({ buckets: array(object({
16459
+ bucketStart: number(),
16460
+ count: number().int()
16461
+ })) }), { auth: "admin" }), method(object({
16462
+ ...KindShape,
16463
+ op: _enum([
16464
+ "sum",
16465
+ "min",
16466
+ "max",
16467
+ "count"
16468
+ ]),
16469
+ field: RecordFieldPathSchema.optional(),
16470
+ groupBy: RecordFieldPathSchema.optional(),
16471
+ where: RecordWhereSchema.optional()
16472
+ }), object({ rows: array(object({
16473
+ group: union([
16474
+ string(),
16475
+ number(),
16476
+ _null()
16477
+ ]),
16478
+ value: number().nullable()
16479
+ })) }), { auth: "admin" }), method(object({
16480
+ ...KindShape,
16481
+ deviceId: number().int().optional(),
16482
+ atBefore: number().optional(),
16483
+ where: RecordWhereSchema.optional()
16484
+ }), object({
16485
+ deleted: number().int(),
16486
+ secretRefs: SecretRefsList
16487
+ }), {
16488
+ kind: "mutation",
16489
+ auth: "admin"
16490
+ }), method(object({
16491
+ deviceId: number().int(),
16492
+ kinds: array(RecordKindNameSchema).optional()
16493
+ }), object({
16494
+ deleted: record(string(), number().int()),
16495
+ secretRefs: SecretRefsList
16496
+ }), {
16497
+ kind: "mutation",
16498
+ auth: "admin"
16499
+ }), method(object(KindShape), object({ id: number().int() }), {
16500
+ kind: "mutation",
16501
+ auth: "admin"
16502
+ });
16503
+ /** One table of the settings database. */
16504
+ var StorageTableSchema = object({
16505
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
16506
+ name: string(),
16507
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
16508
+ owner: string().nullable(),
16509
+ rows: number().int().nonnegative(),
16510
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
16511
+ bytes: number().int().nonnegative().nullable(),
16512
+ /** Declared by an addon since this engine process started (a running addon claims it). */
16513
+ declaredThisBoot: boolean()
16514
+ });
16515
+ /** One declared record kind (D881) as System -> Data shows it. */
16516
+ var StorageKindSchema = object({
16517
+ owner: string(),
16518
+ kind: string(),
16519
+ database: _enum(["settings", "events"]),
16520
+ class: string(),
16521
+ state: _enum([
16522
+ "declared",
16523
+ "orphaned",
16524
+ "dropped"
16525
+ ]),
16526
+ /** `null` when the caller asked for no counts (`counts: false`). */
16527
+ rows: number().int().nonnegative().nullable(),
16528
+ /** Rows x the average size of a sample; null for an empty kind. */
16529
+ bytesEstimate: number().int().nonnegative().nullable(),
16530
+ writeTrigger: string(),
16531
+ retention: RecordRetentionSchema,
16532
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16533
+ entry: boolean(),
16534
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16535
+ declaration: RecordKindDeclarationSchema
16536
+ });
16537
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16538
+ collection: string().min(1),
16539
+ expectRows: number().int().nonnegative()
16540
+ }), object({
16541
+ dropped: literal(true),
16542
+ rows: number().int().nonnegative()
16543
+ }), {
16544
+ kind: "mutation",
16545
+ auth: "admin"
16546
+ }), method(object({
16547
+ owner: string().min(1).optional(),
16548
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16549
+ counts: boolean().optional()
16550
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16551
+ owner: string().min(1),
16552
+ kind: RecordKindNameSchema
16553
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16554
+ owner: string().min(1),
16555
+ kind: RecordKindNameSchema,
16556
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16557
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16558
+ complete: boolean().optional()
16559
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16560
+ kind: "mutation",
16561
+ auth: "admin"
16562
+ }), method(object({
16563
+ collection: string().min(1),
16564
+ cursor: string().optional(),
16565
+ limit: number().int().min(1).max(1e3).optional()
16566
+ }), object({
16567
+ rows: array(object({
16568
+ id: string(),
16569
+ data: record(string(), unknown())
16570
+ })),
16571
+ nextCursor: string().nullable()
16572
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16573
+ /**
16574
+ * record-entries - the ONE admin surface for every list of user-created entries
16575
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16576
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16577
+ *
16578
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16579
+ * the entry body with `secret: true` on every credential field, so a password
16580
+ * field is derived from the schema and never from a name. `putEntry` takes the
16581
+ * redaction token for an untouched secret (the stored value is kept), a string
16582
+ * for a new one, and the clear instruction to remove one. A read never carries
16583
+ * a secret value, and a locked keychain refuses the write with
16584
+ * `records/secret-unavailable` instead of storing plaintext.
16585
+ *
16586
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16587
+ */
16588
+ var EntryKindInfoSchema = object({
16589
+ owner: string(),
16590
+ kind: RecordKindNameSchema,
16591
+ title: string(),
16592
+ nameField: string(),
16593
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16594
+ fields: record(string(), unknown()),
16595
+ secretPaths: array(string()),
16596
+ rows: number().int().nonnegative()
16597
+ });
16598
+ var EntryViewSchema = object({
16599
+ id: RecordIdSchema,
16600
+ name: string(),
16601
+ rev: number().int(),
16602
+ updatedAt: number(),
16603
+ /** Secret fields hold the redaction token. */
16604
+ data: RecordBodySchema
16605
+ });
16606
+ var EntryAddress = {
16607
+ owner: string().min(1),
16608
+ kind: RecordKindNameSchema
16609
+ };
16610
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16611
+ ...EntryAddress,
16612
+ id: RecordIdSchema.optional(),
16613
+ data: RecordBodySchema,
16614
+ ifRev: number().int().min(1).optional()
16615
+ }), object({
16616
+ id: string(),
16617
+ rev: number().int()
16618
+ }), {
16619
+ kind: "mutation",
16620
+ auth: "admin"
16621
+ }), method(object({
16622
+ ...EntryAddress,
16623
+ id: RecordIdSchema
16624
+ }), object({ deleted: boolean() }), {
16625
+ kind: "mutation",
16626
+ auth: "admin"
16627
+ });
16628
+ /**
16041
16629
  * `keychain` — the hub's encrypted store of secret values (D787).
16042
16630
  *
16043
16631
  * Settings blobs never hold a secret: they hold a marker
@@ -16578,6 +17166,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16578
17166
  kind: "mutation",
16579
17167
  auth: "admin",
16580
17168
  caller: "required"
17169
+ }), method(object({
17170
+ ref: string().min(1),
17171
+ value: string().min(1)
17172
+ }), object({
17173
+ ref: string(),
17174
+ version: number().int()
17175
+ }), {
17176
+ kind: "mutation",
17177
+ auth: "admin",
17178
+ caller: "required"
16581
17179
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16582
17180
  deleted: array(string()).readonly(),
16583
17181
  kept: array(object({
@@ -39256,6 +39854,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39256
39854
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39257
39855
  kind: "mutation",
39258
39856
  auth: "admin"
39857
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
39858
+ kind: "mutation",
39859
+ auth: "admin"
39259
39860
  }), method(ProfileRefInputSchema, _void(), {
39260
39861
  kind: "mutation",
39261
39862
  auth: "admin"
@@ -49765,6 +50366,41 @@ var ServerRollbackInfoSchema = object({
49765
50366
  atMs: number(),
49766
50367
  reason: string()
49767
50368
  });
50369
+ /**
50370
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50371
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50372
+ * service holds, because only the hub plans) against the states the process
50373
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50374
+ * every boot, served on `getServerPackageStatus`.
50375
+ *
50376
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50377
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50378
+ * planned runner the process service has no entry for.
50379
+ */
50380
+ var RunnerRefusalSchema = object({
50381
+ runnerId: string(),
50382
+ addonIds: array(string()),
50383
+ reason: string()
50384
+ });
50385
+ var RunnerBootCheckSchema = object({
50386
+ checkedAtMs: number(),
50387
+ /** Runners planned for this node. */
50388
+ expected: number(),
50389
+ /** Planned runners whose process is `running`. */
50390
+ running: number(),
50391
+ failed: array(string()),
50392
+ refused: array(RunnerRefusalSchema),
50393
+ missing: array(string()),
50394
+ /**
50395
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50396
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50397
+ * pushed and the verdict is re-evaluated on the next runner state change.
50398
+ * Optional for version skew (absent = settled).
50399
+ */
50400
+ pending: array(string()).optional(),
50401
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50402
+ planKnown: boolean()
50403
+ });
49768
50404
  var ServerPackageStatusSchema = object({
49769
50405
  /** Root package name (`@camstack/server` on the hub). */
49770
50406
  packageName: string(),
@@ -49827,7 +50463,14 @@ var ServerPackageStatusSchema = object({
49827
50463
  * for version skew: an older provider's payload simply omits it, and an
49828
50464
  * absent wrapper is unknown — never `native`.
49829
50465
  */
49830
- wrapper: WrapperIdentitySchema.optional()
50466
+ wrapper: WrapperIdentitySchema.optional(),
50467
+ /**
50468
+ * What this node PLANNED to run against what its process service reports
50469
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50470
+ * on a provider that predates it. Absent is "not checked yet", never "all
50471
+ * well": a consumer that needs the answer treats it as pending.
50472
+ */
50473
+ runners: RunnerBootCheckSchema.optional()
49831
50474
  });
49832
50475
  var ServerUpdateCheckResultSchema = object({
49833
50476
  packageName: string(),
@@ -49878,6 +50521,13 @@ var ServerUpdateOutcomeSchema = _enum([
49878
50521
  "refused",
49879
50522
  "failed"
49880
50523
  ]);
50524
+ /** One addon the pre-flight found the target version would refuse (D877). */
50525
+ var UpdateBlockerSchema = object({
50526
+ addonId: string(),
50527
+ reason: string(),
50528
+ /** What the operator does about it. */
50529
+ remedy: string()
50530
+ });
49881
50531
  var ServerUpdateActionResultSchema = object({
49882
50532
  accepted: boolean(),
49883
50533
  targetVersion: string().nullable(),
@@ -49895,14 +50545,27 @@ var ServerUpdateActionResultSchema = object({
49895
50545
  * The failure itself, verbatim enough to act on (the npm output for a
49896
50546
  * staging install). Non-null only for `failed`.
49897
50547
  */
49898
- error: string().nullable().optional()
50548
+ error: string().nullable().optional(),
50549
+ /**
50550
+ * The addons the target version would refuse to start on this node's live
50551
+ * store (D877), present when the pre-flight refused the update
50552
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50553
+ */
50554
+ blockers: array(UpdateBlockerSchema).optional()
49899
50555
  });
49900
50556
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
49901
50557
  kind: "mutation",
49902
50558
  auth: "admin"
49903
- }), method(object({
49904
- /** Explicit target version; omitted = latest from the registry. */
49905
- version: string().optional() }), ServerUpdateActionResultSchema, {
50559
+ }), method(object({
50560
+ /** Explicit target version; omitted = latest from the registry. */
50561
+ version: string().optional(),
50562
+ /**
50563
+ * Apply even though the pre-flight (D877) found addons the target would
50564
+ * refuse to start. Off by default: those addons stay down until the
50565
+ * remedy is run, which is the incident this gate exists to prevent.
50566
+ */
50567
+ acknowledgeRefusals: boolean().optional()
50568
+ }), ServerUpdateActionResultSchema, {
49906
50569
  kind: "mutation",
49907
50570
  auth: "admin",
49908
50571
  timeoutMs: 16 * 6e4
@@ -52348,7 +53011,9 @@ var ManifestShapeSchema = object({
52348
53011
  var AddonProcessSchema = object({
52349
53012
  pid: number().optional(),
52350
53013
  mode: string(),
52351
- state: string()
53014
+ state: string(),
53015
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53016
+ reason: string().optional()
52352
53017
  });
52353
53018
  /**
52354
53019
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -53116,7 +53781,8 @@ var batteryCapability = {
53116
53781
  DeviceType.Button,
53117
53782
  DeviceType.Switch,
53118
53783
  DeviceType.PetFeeder,
53119
- DeviceType.Container
53784
+ DeviceType.Container,
53785
+ DeviceType.Thermostat
53120
53786
  ],
53121
53787
  methods: {
53122
53788
  /**
@@ -53737,6 +54403,12 @@ var ClimateControlStatusSchema = object({
53737
54403
  /** Horizontal louver swing on/off. Null when the device has no
53738
54404
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
53739
54405
  swingHorizontal: boolean().nullable(),
54406
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
54407
+ minTemp: number().nullable().optional(),
54408
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
54409
+ maxTemp: number().nullable().optional(),
54410
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
54411
+ tempStep: number().positive().nullable().optional(),
53740
54412
  /** Ms epoch when the slice was last updated (push or command). */
53741
54413
  lastFetchedAt: number()
53742
54414
  });
@@ -54583,6 +55255,125 @@ onStatusChanged: { data: object({
54583
55255
  * whether persisting is worth a SQLite commit. */
54584
55256
  volatileStateFields: ["lastChangedAt"]
54585
55257
  };
55258
+ /**
55259
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
55260
+ * consumable levels (salt, rinse aid) and common program options.
55261
+ *
55262
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
55263
+ * by any integration that exposes the same program / option surface.
55264
+ *
55265
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
55266
+ * provider refreshes the slice on an interval and eagerly after commands.
55267
+ */
55268
+ var DishwasherStateSchema = _enum([
55269
+ "idle",
55270
+ "running",
55271
+ "paused",
55272
+ "finished",
55273
+ "error",
55274
+ "unavailable"
55275
+ ]);
55276
+ var DishwasherConsumableLevelSchema = _enum([
55277
+ "ok",
55278
+ "low",
55279
+ "empty"
55280
+ ]);
55281
+ var DishwasherStatusSchema = object({
55282
+ state: DishwasherStateSchema,
55283
+ /** Active program id/name, or null when none selected / unknown. */
55284
+ program: string().nullable(),
55285
+ /** Program tokens the hardware accepts — drives the UI selector. */
55286
+ availablePrograms: array(string()),
55287
+ /** Minutes remaining on the active cycle, or null when not running. */
55288
+ remainingMinutes: number().int().nonnegative().nullable(),
55289
+ /** Cycle completion 0..100, or null when not applicable. */
55290
+ progressPercent: number().min(0).max(100).nullable(),
55291
+ /** True when the door is reported open. */
55292
+ doorOpen: boolean(),
55293
+ /** True when remote start is allowed (door closed, power on, etc.). */
55294
+ remoteStartAllowed: boolean(),
55295
+ /** Main power / switched-on state. */
55296
+ powerOn: boolean(),
55297
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
55298
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
55299
+ halfLoad: boolean(),
55300
+ hygienePlus: boolean(),
55301
+ errorCode: number().nullable(),
55302
+ errorLabel: string().nullable(),
55303
+ lastFetchedAt: number()
55304
+ });
55305
+ var dishwasherCapability = {
55306
+ name: "dishwasher",
55307
+ scope: "device",
55308
+ deviceNative: true,
55309
+ mode: "singleton",
55310
+ deviceTypes: [DeviceType.Dishwasher],
55311
+ methods: {
55312
+ start: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55313
+ kind: "mutation",
55314
+ auth: "protected"
55315
+ }),
55316
+ pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55317
+ kind: "mutation",
55318
+ auth: "protected"
55319
+ }),
55320
+ stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55321
+ kind: "mutation",
55322
+ auth: "protected"
55323
+ }),
55324
+ setProgram: method(object({
55325
+ deviceId: number().int().nonnegative(),
55326
+ program: string().min(1)
55327
+ }), _void(), {
55328
+ kind: "mutation",
55329
+ auth: "protected"
55330
+ }),
55331
+ setPower: method(object({
55332
+ deviceId: number().int().nonnegative(),
55333
+ on: boolean()
55334
+ }), _void(), {
55335
+ kind: "mutation",
55336
+ auth: "protected"
55337
+ }),
55338
+ setHalfLoad: method(object({
55339
+ deviceId: number().int().nonnegative(),
55340
+ on: boolean()
55341
+ }), _void(), {
55342
+ kind: "mutation",
55343
+ auth: "protected"
55344
+ }),
55345
+ setHygienePlus: method(object({
55346
+ deviceId: number().int().nonnegative(),
55347
+ on: boolean()
55348
+ }), _void(), {
55349
+ kind: "mutation",
55350
+ auth: "protected"
55351
+ }),
55352
+ setOption: method(object({
55353
+ deviceId: number().int().nonnegative(),
55354
+ key: string().min(1),
55355
+ value: union([
55356
+ boolean(),
55357
+ string(),
55358
+ number()
55359
+ ])
55360
+ }), _void(), {
55361
+ kind: "mutation",
55362
+ auth: "protected"
55363
+ })
55364
+ },
55365
+ status: {
55366
+ schema: DishwasherStatusSchema,
55367
+ kind: "poll"
55368
+ },
55369
+ runtimeState: DishwasherStatusSchema,
55370
+ durability: "session",
55371
+ history: { fields: { progressPercent: {
55372
+ kind: "gauge",
55373
+ unit: "%",
55374
+ deadband: 2
55375
+ } } }
55376
+ };
54586
55377
  var DoorbellStatusSchema = object({
54587
55378
  /** Ms epoch of the last press. null = never observed since this provider started. */
54588
55379
  lastPressedAt: number().nullable(),
@@ -55385,6 +56176,32 @@ var gasCapability = {
55385
56176
  * whether persisting is worth a SQLite commit. */
55386
56177
  volatileStateFields: ["lastChangedAt"]
55387
56178
  };
56179
+ var HeatingValveStatusSchema = object({
56180
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
56181
+ position: number().min(0).max(100).nullable(),
56182
+ /** Ms epoch when the slice was last updated (push or poll). */
56183
+ lastFetchedAt: number()
56184
+ });
56185
+ var heatingValveCapability = {
56186
+ name: "heating-valve",
56187
+ scope: "device",
56188
+ deviceNative: true,
56189
+ mode: "singleton",
56190
+ deviceTypes: [DeviceType.Thermostat],
56191
+ methods: {},
56192
+ status: {
56193
+ schema: HeatingValveStatusSchema,
56194
+ kind: "push"
56195
+ },
56196
+ runtimeState: HeatingValveStatusSchema,
56197
+ durability: "session",
56198
+ history: { fields: { position: {
56199
+ kind: "gauge",
56200
+ unit: "%",
56201
+ deadband: 1
56202
+ } } },
56203
+ volatileStateFields: ["lastFetchedAt"]
56204
+ };
55388
56205
  /**
55389
56206
  * Humidifier / dehumidifier cap. Models HA `humidifier.*` entities —
55390
56207
  * an on/off actuator with an optional target-humidity setpoint and an
@@ -56517,7 +57334,19 @@ var TlsStatusSchema = object({
56517
57334
  sans: array(string()),
56518
57335
  caCertPem: string().nullable(),
56519
57336
  reissueError: string().nullable(),
56520
- restartRequired: boolean()
57337
+ restartRequired: boolean(),
57338
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
57339
+ caMissing: boolean(),
57340
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
57341
+ localCaConstrained: boolean().nullable(),
57342
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
57343
+ caReplacedAt: string().nullable(),
57344
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
57345
+ storedUpload: object({
57346
+ leafFingerprintSha256: string(),
57347
+ validTo: string(),
57348
+ hasCa: boolean()
57349
+ }).nullable()
56521
57350
  });
56522
57351
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
56523
57352
  /**
@@ -56573,6 +57402,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
56573
57402
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
56574
57403
  kind: "mutation",
56575
57404
  auth: "admin"
57405
+ }), method(_void(), TlsStatusSchema, {
57406
+ kind: "mutation",
57407
+ auth: "admin"
56576
57408
  });
56577
57409
  var LockControlStatusSchema = object({
56578
57410
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -63066,7 +63898,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
63066
63898
  kind: "mutation",
63067
63899
  auth: "admin",
63068
63900
  access: "delete"
63069
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
63901
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
63902
+ kind: "mutation",
63903
+ auth: "admin",
63904
+ access: "create"
63905
+ }), method(object({
63070
63906
  userId: string(),
63071
63907
  code: string()
63072
63908
  }), object({ valid: boolean() }), {
@@ -64786,6 +65622,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
64786
65622
  dayNight: dayNightCapability,
64787
65623
  deviceDiscovery: deviceDiscoveryCapability,
64788
65624
  deviceStatus: deviceStatusCapability,
65625
+ dishwasher: dishwasherCapability,
64789
65626
  doorbell: doorbellCapability,
64790
65627
  enumSensor: enumSensorCapability,
64791
65628
  eventEmitter: eventEmitterCapability,
@@ -64793,6 +65630,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
64793
65630
  featureProbe: featureProbeCapability,
64794
65631
  flood: floodCapability,
64795
65632
  gas: gasCapability,
65633
+ heatingValve: heatingValveCapability,
64796
65634
  humidifier: humidifierCapability,
64797
65635
  humiditySensor: humiditySensorCapability,
64798
65636
  image: imageCapability,
@@ -64878,13 +65716,14 @@ var BaseDevice = class {
64878
65716
  get state() {
64879
65717
  if (!this._stateProxyCache) {
64880
65718
  const cache = {};
64881
- const handler = { get: (_target, key) => {
65719
+ const handler = { get: (target, key) => {
64882
65720
  const k = key;
64883
- if (k in cache) return cache[k];
65721
+ const existing = Reflect.get(target, k);
65722
+ if (existing !== void 0) return existing;
64884
65723
  const cap = DEVICE_LOCAL_STATE_CAPS[k];
64885
65724
  if (!cap) return void 0;
64886
65725
  const proxy = this.sliceProxy(cap);
64887
- cache[k] = proxy;
65726
+ Reflect.set(target, k, proxy);
64888
65727
  return proxy;
64889
65728
  } };
64890
65729
  this._stateProxyCache = new Proxy(cache, handler);
@@ -65083,7 +65922,7 @@ var BaseDevice = class {
65083
65922
  async updateSourceInfo(patch) {
65084
65923
  const next = mergeSourceInfo(this.sourceInfo, patch);
65085
65924
  this._sourceInfoCache = Object.freeze({ ...next });
65086
- const action = this.ctx.api?.deviceManager?.setMetadata;
65925
+ const action = this.ctx.api.deviceManager?.setMetadata;
65087
65926
  if (action) try {
65088
65927
  await action.mutate({
65089
65928
  deviceId: this.id,
@@ -65118,7 +65957,7 @@ var BaseDevice = class {
65118
65957
  * device boot on a meta refresh.
65119
65958
  */
65120
65959
  async refreshFeatures() {
65121
- const action = this.ctx.api?.deviceManager?.registerDevice;
65960
+ const action = this.ctx.api.deviceManager?.registerDevice;
65122
65961
  if (!action) return;
65123
65962
  try {
65124
65963
  await action.mutate({
@@ -65517,6 +66356,12 @@ var BaseDeviceProvider = class extends BaseAddon {
65517
66356
  provider: this
65518
66357
  }];
65519
66358
  }
66359
+ /** Flatten `super.onInitialize()` whether it returned an array or an envelope. */
66360
+ providerRegistrationsFromSuper(result) {
66361
+ if (Array.isArray(result)) return result;
66362
+ if (result !== void 0 && result.providers !== void 0) return [...result.providers];
66363
+ return [];
66364
+ }
65520
66365
  async onShutdown() {
65521
66366
  this._restoreShuttingDown = true;
65522
66367
  this.cancelRestoreRetries();
@@ -66043,7 +66888,7 @@ var BaseDeviceProvider = class extends BaseAddon {
66043
66888
  return toDeviceSummary(device, this.addonId);
66044
66889
  }
66045
66890
  };
66046
- 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;
66891
+ 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;
66047
66892
  new Set(Object.values(DeviceType));
66048
66893
  Object.freeze({
66049
66894
  "accessories.getStatus": {
@@ -67192,6 +68037,12 @@ Object.freeze({
67192
68037
  addonId: null,
67193
68038
  access: "view"
67194
68039
  },
68040
+ "coreBlocks.migrateRawSecrets": {
68041
+ capName: "core-blocks",
68042
+ capScope: "system",
68043
+ addonId: null,
68044
+ access: "create"
68045
+ },
67195
68046
  "coreBlocks.restart": {
67196
68047
  capName: "core-blocks",
67197
68048
  capScope: "system",
@@ -68458,6 +69309,60 @@ Object.freeze({
68458
69309
  addonId: null,
68459
69310
  access: "view"
68460
69311
  },
69312
+ "dishwasher.getStatus": {
69313
+ capName: "dishwasher",
69314
+ capScope: "device",
69315
+ addonId: null,
69316
+ access: "view"
69317
+ },
69318
+ "dishwasher.pause": {
69319
+ capName: "dishwasher",
69320
+ capScope: "device",
69321
+ addonId: null,
69322
+ access: "create"
69323
+ },
69324
+ "dishwasher.setHalfLoad": {
69325
+ capName: "dishwasher",
69326
+ capScope: "device",
69327
+ addonId: null,
69328
+ access: "create"
69329
+ },
69330
+ "dishwasher.setHygienePlus": {
69331
+ capName: "dishwasher",
69332
+ capScope: "device",
69333
+ addonId: null,
69334
+ access: "create"
69335
+ },
69336
+ "dishwasher.setOption": {
69337
+ capName: "dishwasher",
69338
+ capScope: "device",
69339
+ addonId: null,
69340
+ access: "create"
69341
+ },
69342
+ "dishwasher.setPower": {
69343
+ capName: "dishwasher",
69344
+ capScope: "device",
69345
+ addonId: null,
69346
+ access: "create"
69347
+ },
69348
+ "dishwasher.setProgram": {
69349
+ capName: "dishwasher",
69350
+ capScope: "device",
69351
+ addonId: null,
69352
+ access: "create"
69353
+ },
69354
+ "dishwasher.start": {
69355
+ capName: "dishwasher",
69356
+ capScope: "device",
69357
+ addonId: null,
69358
+ access: "create"
69359
+ },
69360
+ "dishwasher.stop": {
69361
+ capName: "dishwasher",
69362
+ capScope: "device",
69363
+ addonId: null,
69364
+ access: "create"
69365
+ },
68461
69366
  "doorbell.getStatus": {
68462
69367
  capName: "doorbell",
68463
69368
  capScope: "device",
@@ -68668,6 +69573,12 @@ Object.freeze({
68668
69573
  addonId: null,
68669
69574
  access: "view"
68670
69575
  },
69576
+ "heatingValve.getStatus": {
69577
+ capName: "heating-valve",
69578
+ capScope: "device",
69579
+ addonId: null,
69580
+ access: "view"
69581
+ },
68671
69582
  "humidifier.getStatus": {
68672
69583
  capName: "humidifier",
68673
69584
  capScope: "device",
@@ -68878,6 +69789,12 @@ Object.freeze({
68878
69789
  addonId: null,
68879
69790
  access: "create"
68880
69791
  },
69792
+ "keychainAdmin.importSecret": {
69793
+ capName: "keychain-admin",
69794
+ capScope: "system",
69795
+ addonId: null,
69796
+ access: "create"
69797
+ },
68881
69798
  "keychainAdmin.listAudit": {
68882
69799
  capName: "keychain-admin",
68883
69800
  capScope: "system",
@@ -69046,6 +69963,12 @@ Object.freeze({
69046
69963
  addonId: null,
69047
69964
  access: "view"
69048
69965
  },
69966
+ "llm.migrateRawSecrets": {
69967
+ capName: "llm",
69968
+ capScope: "system",
69969
+ addonId: null,
69970
+ access: "create"
69971
+ },
69049
69972
  "llm.resolveModelRef": {
69050
69973
  capName: "llm",
69051
69974
  capScope: "system",
@@ -69274,6 +70197,12 @@ Object.freeze({
69274
70197
  addonId: null,
69275
70198
  access: "create"
69276
70199
  },
70200
+ "localNetwork.useStoredUploadedCertificate": {
70201
+ capName: "local-network",
70202
+ capScope: "system",
70203
+ addonId: null,
70204
+ access: "create"
70205
+ },
69277
70206
  "lockControl.getStatus": {
69278
70207
  capName: "lock-control",
69279
70208
  capScope: "device",
@@ -71926,6 +72855,30 @@ Object.freeze({
71926
72855
  addonId: null,
71927
72856
  access: "create"
71928
72857
  },
72858
+ "recordEntries.deleteEntry": {
72859
+ capName: "record-entries",
72860
+ capScope: "system",
72861
+ addonId: null,
72862
+ access: "delete"
72863
+ },
72864
+ "recordEntries.listEntries": {
72865
+ capName: "record-entries",
72866
+ capScope: "system",
72867
+ addonId: null,
72868
+ access: "view"
72869
+ },
72870
+ "recordEntries.listEntryKinds": {
72871
+ capName: "record-entries",
72872
+ capScope: "system",
72873
+ addonId: null,
72874
+ access: "view"
72875
+ },
72876
+ "recordEntries.putEntry": {
72877
+ capName: "record-entries",
72878
+ capScope: "system",
72879
+ addonId: null,
72880
+ access: "create"
72881
+ },
71929
72882
  "recording.getAvailability": {
71930
72883
  capName: "recording",
71931
72884
  capScope: "device",
@@ -72226,6 +73179,102 @@ Object.freeze({
72226
73179
  addonId: null,
72227
73180
  access: "view"
72228
73181
  },
73182
+ "records.aggregate": {
73183
+ capName: "records",
73184
+ capScope: "system",
73185
+ addonId: null,
73186
+ access: "view"
73187
+ },
73188
+ "records.allocateId": {
73189
+ capName: "records",
73190
+ capScope: "system",
73191
+ addonId: null,
73192
+ access: "create"
73193
+ },
73194
+ "records.count": {
73195
+ capName: "records",
73196
+ capScope: "system",
73197
+ addonId: null,
73198
+ access: "view"
73199
+ },
73200
+ "records.declareKinds": {
73201
+ capName: "records",
73202
+ capScope: "system",
73203
+ addonId: null,
73204
+ access: "create"
73205
+ },
73206
+ "records.delete": {
73207
+ capName: "records",
73208
+ capScope: "system",
73209
+ addonId: null,
73210
+ access: "delete"
73211
+ },
73212
+ "records.deleteDevice": {
73213
+ capName: "records",
73214
+ capScope: "system",
73215
+ addonId: null,
73216
+ access: "delete"
73217
+ },
73218
+ "records.deleteMany": {
73219
+ capName: "records",
73220
+ capScope: "system",
73221
+ addonId: null,
73222
+ access: "delete"
73223
+ },
73224
+ "records.deleteWhere": {
73225
+ capName: "records",
73226
+ capScope: "system",
73227
+ addonId: null,
73228
+ access: "delete"
73229
+ },
73230
+ "records.get": {
73231
+ capName: "records",
73232
+ capScope: "system",
73233
+ addonId: null,
73234
+ access: "view"
73235
+ },
73236
+ "records.getMany": {
73237
+ capName: "records",
73238
+ capScope: "system",
73239
+ addonId: null,
73240
+ access: "view"
73241
+ },
73242
+ "records.histogram": {
73243
+ capName: "records",
73244
+ capScope: "system",
73245
+ addonId: null,
73246
+ access: "view"
73247
+ },
73248
+ "records.patch": {
73249
+ capName: "records",
73250
+ capScope: "system",
73251
+ addonId: null,
73252
+ access: "create"
73253
+ },
73254
+ "records.put": {
73255
+ capName: "records",
73256
+ capScope: "system",
73257
+ addonId: null,
73258
+ access: "create"
73259
+ },
73260
+ "records.putMany": {
73261
+ capName: "records",
73262
+ capScope: "system",
73263
+ addonId: null,
73264
+ access: "create"
73265
+ },
73266
+ "records.query": {
73267
+ capName: "records",
73268
+ capScope: "system",
73269
+ addonId: null,
73270
+ access: "view"
73271
+ },
73272
+ "records.secretRefs": {
73273
+ capName: "records",
73274
+ capScope: "system",
73275
+ addonId: null,
73276
+ access: "view"
73277
+ },
72229
73278
  "sceneMonitor.captureReference": {
72230
73279
  capName: "scene-monitor",
72231
73280
  capScope: "device",
@@ -72658,6 +73707,48 @@ Object.freeze({
72658
73707
  addonId: null,
72659
73708
  access: "create"
72660
73709
  },
73710
+ "storageAdmin.adoptRecords": {
73711
+ capName: "storage-admin",
73712
+ capScope: "system",
73713
+ addonId: null,
73714
+ access: "create"
73715
+ },
73716
+ "storageAdmin.dropCollection": {
73717
+ capName: "storage-admin",
73718
+ capScope: "system",
73719
+ addonId: null,
73720
+ access: "delete"
73721
+ },
73722
+ "storageAdmin.isAdoptedLegacyTable": {
73723
+ capName: "storage-admin",
73724
+ capScope: "system",
73725
+ addonId: null,
73726
+ access: "view"
73727
+ },
73728
+ "storageAdmin.listKinds": {
73729
+ capName: "storage-admin",
73730
+ capScope: "system",
73731
+ addonId: null,
73732
+ access: "view"
73733
+ },
73734
+ "storageAdmin.listTables": {
73735
+ capName: "storage-admin",
73736
+ capScope: "system",
73737
+ addonId: null,
73738
+ access: "view"
73739
+ },
73740
+ "storageAdmin.readLegacyCollection": {
73741
+ capName: "storage-admin",
73742
+ capScope: "system",
73743
+ addonId: null,
73744
+ access: "view"
73745
+ },
73746
+ "storageAdmin.readRecords": {
73747
+ capName: "storage-admin",
73748
+ capScope: "system",
73749
+ addonId: null,
73750
+ access: "view"
73751
+ },
72661
73752
  "storageEvictable.evict": {
72662
73753
  capName: "storage-evictable",
72663
73754
  capScope: "system",
@@ -73570,6 +74661,12 @@ Object.freeze({
73570
74661
  addonId: null,
73571
74662
  access: "view"
73572
74663
  },
74664
+ "userManagement.migrateRawSecrets": {
74665
+ capName: "user-management",
74666
+ capScope: "system",
74667
+ addonId: null,
74668
+ access: "create"
74669
+ },
73573
74670
  "userManagement.oauthExchangeCode": {
73574
74671
  capName: "user-management",
73575
74672
  capScope: "system",
@@ -74069,7 +75166,7 @@ Object.freeze({
74069
75166
  access: "create"
74070
75167
  }
74071
75168
  });
74072
- 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;
75169
+ 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;
74073
75170
  DeviceFeature.BatteryOperated;
74074
75171
  Object.freeze({
74075
75172
  "accessories.getStatus": [{
@@ -74893,6 +75990,51 @@ Object.freeze({
74893
75990
  form: "single",
74894
75991
  optional: false
74895
75992
  }],
75993
+ "dishwasher.getStatus": [{
75994
+ name: "deviceId",
75995
+ form: "single",
75996
+ optional: false
75997
+ }],
75998
+ "dishwasher.pause": [{
75999
+ name: "deviceId",
76000
+ form: "single",
76001
+ optional: false
76002
+ }],
76003
+ "dishwasher.setHalfLoad": [{
76004
+ name: "deviceId",
76005
+ form: "single",
76006
+ optional: false
76007
+ }],
76008
+ "dishwasher.setHygienePlus": [{
76009
+ name: "deviceId",
76010
+ form: "single",
76011
+ optional: false
76012
+ }],
76013
+ "dishwasher.setOption": [{
76014
+ name: "deviceId",
76015
+ form: "single",
76016
+ optional: false
76017
+ }],
76018
+ "dishwasher.setPower": [{
76019
+ name: "deviceId",
76020
+ form: "single",
76021
+ optional: false
76022
+ }],
76023
+ "dishwasher.setProgram": [{
76024
+ name: "deviceId",
76025
+ form: "single",
76026
+ optional: false
76027
+ }],
76028
+ "dishwasher.start": [{
76029
+ name: "deviceId",
76030
+ form: "single",
76031
+ optional: false
76032
+ }],
76033
+ "dishwasher.stop": [{
76034
+ name: "deviceId",
76035
+ form: "single",
76036
+ optional: false
76037
+ }],
74896
76038
  "doorbell.getStatus": [{
74897
76039
  name: "deviceId",
74898
76040
  form: "single",
@@ -74962,6 +76104,11 @@ Object.freeze({
74962
76104
  form: "single",
74963
76105
  optional: false
74964
76106
  }],
76107
+ "heatingValve.getStatus": [{
76108
+ name: "deviceId",
76109
+ form: "single",
76110
+ optional: false
76111
+ }],
74965
76112
  "humidifier.getStatus": [{
74966
76113
  name: "deviceId",
74967
76114
  form: "single",
@@ -76246,6 +77393,37 @@ Object.freeze({
76246
77393
  form: "single",
76247
77394
  optional: false
76248
77395
  }],
77396
+ "records.count": [{
77397
+ name: "deviceId",
77398
+ form: "single",
77399
+ optional: true
77400
+ }],
77401
+ "records.deleteDevice": [{
77402
+ name: "deviceId",
77403
+ form: "single",
77404
+ optional: false
77405
+ }],
77406
+ "records.deleteWhere": [{
77407
+ name: "deviceId",
77408
+ form: "single",
77409
+ optional: true
77410
+ }],
77411
+ "records.histogram": [{
77412
+ name: "deviceId",
77413
+ form: "single",
77414
+ optional: true
77415
+ }],
77416
+ "records.putMany": [{
77417
+ name: "records",
77418
+ form: "object-array",
77419
+ optional: false,
77420
+ itemField: "deviceId"
77421
+ }],
77422
+ "records.query": [{
77423
+ name: "deviceId",
77424
+ form: "single",
77425
+ optional: true
77426
+ }],
76249
77427
  "sceneMonitor.captureReference": [{
76250
77428
  name: "deviceId",
76251
77429
  form: "single",
@@ -76362,6 +77540,17 @@ Object.freeze({
76362
77540
  form: "single",
76363
77541
  optional: false
76364
77542
  }],
77543
+ "storageAdmin.adoptRecords": [{
77544
+ name: "records",
77545
+ form: "object-array",
77546
+ optional: false,
77547
+ itemField: "deviceId"
77548
+ }],
77549
+ "storageAdmin.readRecords": [{
77550
+ name: "deviceId",
77551
+ form: "single",
77552
+ optional: true
77553
+ }],
76365
77554
  "streamBroker.acquireEgressTranscode": [{
76366
77555
  name: "deviceId",
76367
77556
  form: "single",
@@ -102406,7 +103595,7 @@ var MqttHaProviderAddon = class extends BaseDeviceProvider {
102406
103595
  super({});
102407
103596
  }
102408
103597
  async onInitialize() {
102409
- const regs = await super.onInitialize();
103598
+ const regs = this.providerRegistrationsFromSuper(await super.onInitialize());
102410
103599
  wireMqttHaDiscoveryStore(this.discoveryStore);
102411
103600
  this.sessionManager = new MqttHaBrokerSessionManager({
102412
103601
  addonId: this.ctx.id,