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