@camstack/addon-provider-reolink 1.2.186 → 1.2.188

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 +1313 -124
  2. package/dist/addon.mjs +1313 -124
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -28,7 +28,7 @@ import { URL as URL$1 } from "url";
28
28
  import { spawn as spawn$1 } from "node:child_process";
29
29
  import os, { tmpdir } from "node:os";
30
30
  import { createReadStream } from "node:fs";
31
- //#region ../types/dist/event-category-C4hVnRo8.mjs
31
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
32
32
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
33
33
  EventCategory["SystemBoot"] = "system.boot";
34
34
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -92,6 +92,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
92
92
  * consumes this category and maps it to the `addon-crash-loop` kind.
93
93
  */
94
94
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
95
+ /**
96
+ * A runner whose addon refused to start with a typed reason (D877) - parked
97
+ * in `refused`, never counted by the crash breaker, retried on operator
98
+ * action. One event per refusal.
99
+ */
100
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
101
+ /**
102
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
103
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
104
+ * runner is still pending) and the alert centre (close a recovered runner).
105
+ */
106
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
107
+ /**
108
+ * The node's one-shot runner boot check (D877): planned runners against the
109
+ * process service, `degraded` when any is failed, refused or missing. The
110
+ * alert centre turns it into one alert and a direct critical push.
111
+ */
112
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
95
113
  EventCategory["AddonError"] = "addon.error";
96
114
  EventCategory["AddonPageReady"] = "addon.page-ready";
97
115
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -5416,7 +5434,7 @@ var ZodIssueCode = {
5416
5434
  var ZodFirstPartyTypeKind;
5417
5435
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5418
5436
  //#endregion
5419
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5437
+ //#region ../types/dist/sleep-BOjuyoPC.mjs
5420
5438
  /**
5421
5439
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5422
5440
  * window to float samples (D455).
@@ -5533,7 +5551,7 @@ function isKeychainStoredField(field) {
5533
5551
  var SECRET_CLEAR = { $secretClear: true };
5534
5552
  /** The `'***'` token D634 redaction writes for non-admins. */
5535
5553
  var LEGACY_DEVICE_REDACTION = "***";
5536
- function isRecord$2(value) {
5554
+ function isRecord$5(value) {
5537
5555
  return typeof value === "object" && value !== null && !Array.isArray(value);
5538
5556
  }
5539
5557
  function makeSecretMarker(ref) {
@@ -5544,16 +5562,16 @@ function makeSecretMarker(ref) {
5544
5562
  }
5545
5563
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5546
5564
  function isSecretMarker(value) {
5547
- if (!isRecord$2(value)) return false;
5565
+ if (!isRecord$5(value)) return false;
5548
5566
  const ref = value["$secret"];
5549
5567
  return typeof ref === "string" && ref.length > 0;
5550
5568
  }
5551
5569
  /** Anything carrying a `$secret` key — a stored marker or a UI view of one. */
5552
5570
  function isSecretMarkerLike(value) {
5553
- return isRecord$2(value) && Object.prototype.hasOwnProperty.call(value, "$secret");
5571
+ return isRecord$5(value) && Object.prototype.hasOwnProperty.call(value, "$secret");
5554
5572
  }
5555
5573
  function isSecretClear(value) {
5556
- return isRecord$2(value) && value["$secretClear"] === true;
5574
+ return isRecord$5(value) && value["$secretClear"] === true;
5557
5575
  }
5558
5576
  /**
5559
5577
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6163,7 +6181,7 @@ var KeychainWriteRefusedError = class extends Error {
6163
6181
  }
6164
6182
  };
6165
6183
  var KEEP = { kind: "keep" };
6166
- function isRecord$1(value) {
6184
+ function isRecord$4(value) {
6167
6185
  return typeof value === "object" && value !== null && !Array.isArray(value);
6168
6186
  }
6169
6187
  function defaultMintId() {
@@ -6176,7 +6194,7 @@ function collectSecretMarkerRefs(value, out = []) {
6176
6194
  return out;
6177
6195
  }
6178
6196
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6179
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6197
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6180
6198
  return out;
6181
6199
  }
6182
6200
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6231,7 +6249,7 @@ function rowId(row, idKey) {
6231
6249
  return null;
6232
6250
  }
6233
6251
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6234
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6252
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6235
6253
  if (!Array.isArray(incoming)) {
6236
6254
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6237
6255
  return {
@@ -6247,7 +6265,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6247
6265
  const kept = /* @__PURE__ */ new Set();
6248
6266
  const rows = [];
6249
6267
  for (const row of incoming) {
6250
- if (!isRecord$1(row)) {
6268
+ if (!isRecord$4(row)) {
6251
6269
  rows.push(row);
6252
6270
  continue;
6253
6271
  }
@@ -6272,7 +6290,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6272
6290
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6273
6291
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6274
6292
  case "object": {
6275
- if (!isRecord$1(incoming)) {
6293
+ if (!isRecord$4(incoming)) {
6276
6294
  if (incoming === void 0) return KEEP;
6277
6295
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6278
6296
  return {
@@ -6280,7 +6298,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6280
6298
  value: incoming
6281
6299
  };
6282
6300
  }
6283
- const storedObj = isRecord$1(stored) ? stored : {};
6301
+ const storedObj = isRecord$4(stored) ? stored : {};
6284
6302
  return {
6285
6303
  kind: "value",
6286
6304
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6403,7 +6421,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6403
6421
  value: items
6404
6422
  };
6405
6423
  }
6406
- if (isRecord$1(v)) {
6424
+ if (isRecord$4(v)) {
6407
6425
  const out = {};
6408
6426
  for (const [k, child] of Object.entries(v)) {
6409
6427
  const s = substitute(child);
@@ -6671,7 +6689,6 @@ function createHandle(raw, opts) {
6671
6689
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6672
6690
  const readAddonStoreResult = raw.readAddonStoreResult;
6673
6691
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6674
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6675
6692
  const overrides = {
6676
6693
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6677
6694
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6695,12 +6712,12 @@ function createHandle(raw, opts) {
6695
6712
  };
6696
6713
  } } : {},
6697
6714
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6698
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6699
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6715
+ readDeviceStoreBatch: async (deviceIds) => {
6716
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6700
6717
  const out = /* @__PURE__ */ new Map();
6701
6718
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6702
6719
  return out;
6703
- } } : {},
6720
+ },
6704
6721
  writeAddonStore: async (patch) => {
6705
6722
  await writeAddon(patch);
6706
6723
  },
@@ -7327,7 +7344,7 @@ var BaseAddon = class {
7327
7344
  if (!ctx) return;
7328
7345
  const addonId = ctx.id;
7329
7346
  setImmediate(() => {
7330
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7347
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7331
7348
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7332
7349
  }).catch((err) => {
7333
7350
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7527,7 +7544,7 @@ var BaseAddon = class {
7527
7544
  return this._addonSecretTree;
7528
7545
  }
7529
7546
  deviceSecretTree() {
7530
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7547
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7531
7548
  return this._deviceSecretTree;
7532
7549
  }
7533
7550
  /**
@@ -7603,42 +7620,135 @@ var BaseAddon = class {
7603
7620
  this[timerOf] = timer;
7604
7621
  }
7605
7622
  /**
7606
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7607
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7608
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7609
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7623
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7624
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7610
7625
  * addon permanently broken.
7611
7626
  *
7612
- * Retry only the two known infra fingerprints. Anything else propagates so
7613
- * real bugs surface immediately. After the budget expires we fall back to
7614
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7627
+ * Two kinds of outage, two budgets:
7628
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7629
+ * initialized`, `provider not available`): a short budget, then the addon
7630
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7631
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7632
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7633
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7634
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7635
+ * loop. A long, bounded budget; only after it the error propagates - the
7636
+ * addon never runs on defaults for a store it could not ask.
7637
+ * Anything else propagates immediately so real bugs surface.
7615
7638
  */
7616
7639
  async readAddonStoreWithRetry() {
7617
7640
  const settings = this.rawSettings();
7618
7641
  if (!settings) return {};
7619
- const delaysMs = [
7620
- 150,
7621
- 350,
7622
- 600,
7623
- 900
7624
- ];
7625
7642
  let lastErr;
7626
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7643
+ for (let attempt = 0;; attempt++) try {
7627
7644
  const stored = await settings.readAddonStore() ?? {};
7628
7645
  this.settingsStoreReady = true;
7629
7646
  return stored;
7630
7647
  } catch (err) {
7631
7648
  lastErr = err;
7632
- const msg = err instanceof Error ? err.message : String(err);
7633
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7634
- if (attempt === delaysMs.length) break;
7635
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7649
+ const kind = classifyStoreError(err);
7650
+ if (kind === "permanent") throw err;
7651
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7652
+ if (delay === void 0) {
7653
+ if (kind === "transport") throw err;
7654
+ break;
7655
+ }
7656
+ await new Promise((r) => setTimeout(r, delay));
7636
7657
  }
7637
7658
  this.settingsStoreReady = false;
7638
7659
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7639
7660
  return {};
7640
7661
  }
7641
7662
  };
7663
+ /** The settings store's own restart fingerprints. */
7664
+ var RESTART_RETRY_DELAYS_MS = [
7665
+ 150,
7666
+ 350,
7667
+ 600,
7668
+ 900
7669
+ ];
7670
+ /** A hub restarting under a booting runner: ~100 s in total. */
7671
+ var TRANSPORT_RETRY_DELAYS_MS = [
7672
+ 150,
7673
+ 350,
7674
+ 600,
7675
+ 900,
7676
+ 2e3,
7677
+ 5e3,
7678
+ 1e4,
7679
+ 2e4,
7680
+ 3e4,
7681
+ 3e4
7682
+ ];
7683
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7684
+ /** Node / socket error codes of a connection that did not happen or broke. */
7685
+ var TRANSPORT_CODES = new Set([
7686
+ "ECONNREFUSED",
7687
+ "ECONNRESET",
7688
+ "ETIMEDOUT",
7689
+ "EPIPE",
7690
+ "EHOSTUNREACH",
7691
+ "ENETUNREACH"
7692
+ ]);
7693
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7694
+ var UNAVAILABLE_TRPC_CODES = new Set([
7695
+ "TIMEOUT",
7696
+ "SERVICE_UNAVAILABLE",
7697
+ "BAD_GATEWAY",
7698
+ "GATEWAY_TIMEOUT"
7699
+ ]);
7700
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7701
+ var TRANSPORT_PHRASES = [
7702
+ "discovery deadline exceeded",
7703
+ "parent could not route child unowned cap call",
7704
+ "UDS request timed out after",
7705
+ "channel closed"
7706
+ ];
7707
+ /** Moleculer error `type`s of a call that could not be served right now. */
7708
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7709
+ "REQUEST_TIMEOUT",
7710
+ "SERVICE_NOT_FOUND",
7711
+ "SERVICE_NOT_AVAILABLE",
7712
+ "REQUEST_REJECTED",
7713
+ "BROKER_DISCONNECTED"
7714
+ ]);
7715
+ function stringProp(value, key) {
7716
+ if (typeof value !== "object" || value === null) return void 0;
7717
+ const found = Reflect.get(value, key);
7718
+ return typeof found === "string" ? found : void 0;
7719
+ }
7720
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7721
+ function errorCode(err) {
7722
+ const out = {};
7723
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7724
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7725
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7726
+ if (node !== void 0) out.node = node;
7727
+ const trpc = stringProp(data, "code");
7728
+ if (trpc !== void 0) out.trpc = trpc;
7729
+ return out;
7730
+ }
7731
+ /**
7732
+ * Is a settings read failure worth retrying, and with which budget? Only
7733
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7734
+ * one of the exact phrases our own transport raises. A message that merely
7735
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7736
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7737
+ */
7738
+ function classifyStoreError(err) {
7739
+ const message = err instanceof Error ? err.message : String(err);
7740
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7741
+ const code = errorCode(err);
7742
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7743
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7744
+ if (typeof err === "object" && err !== null) {
7745
+ if (Reflect.get(err, "retryable") === true) return "transport";
7746
+ const type = stringProp(err, "type");
7747
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7748
+ }
7749
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7750
+ return "permanent";
7751
+ }
7642
7752
  /**
7643
7753
  * Collect the keys of every field marked `perNode: true`, recursing into
7644
7754
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7728,6 +7838,156 @@ var PeerBytesTicketSchema = object({
7728
7838
  */
7729
7839
  declaredBytes: number().int().nonnegative().nullable()
7730
7840
  });
7841
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7842
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7843
+ var RECORD_DATABASES = ["settings", "events"];
7844
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7845
+ var RECORD_CLASSES = [
7846
+ "config",
7847
+ "ledger",
7848
+ "audit",
7849
+ "mirror",
7850
+ "ephemeral"
7851
+ ];
7852
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7853
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7854
+ var RECORD_BATCH_MAX = 1e3;
7855
+ var RECORD_QUERY_MAX = 1e3;
7856
+ function defOf(schema) {
7857
+ const zodBag = Reflect.get(schema, "_zod");
7858
+ if (typeof zodBag !== "object" || zodBag === null) return {};
7859
+ const def = Reflect.get(zodBag, "def");
7860
+ if (typeof def !== "object" || def === null) return {};
7861
+ return def;
7862
+ }
7863
+ function declaredHere(schema) {
7864
+ return globalRegistry.get(schema)?.secret === true;
7865
+ }
7866
+ /** Wrapper kinds whose `innerType` is the field itself. */
7867
+ var WRAPPERS = new Set([
7868
+ "optional",
7869
+ "nullable",
7870
+ "default",
7871
+ "prefault",
7872
+ "catch",
7873
+ "readonly",
7874
+ "nonoptional"
7875
+ ]);
7876
+ /**
7877
+ * The schema layers that make up ONE field: the schema itself and every
7878
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
7879
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
7880
+ * `.transform` on `in`).
7881
+ */
7882
+ function layersOf(schema) {
7883
+ const out = [];
7884
+ const queue = [schema];
7885
+ while (queue.length > 0) {
7886
+ const s = queue.shift();
7887
+ if (!s || out.includes(s)) continue;
7888
+ out.push(s);
7889
+ const def = defOf(s);
7890
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
7891
+ if (def.type === "pipe") {
7892
+ if (def.in) queue.push(def.in);
7893
+ if (def.out) queue.push(def.out);
7894
+ }
7895
+ }
7896
+ return out;
7897
+ }
7898
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
7899
+ function isZodSecret(schema) {
7900
+ return layersOf(schema).some(declaredHere);
7901
+ }
7902
+ /**
7903
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
7904
+ * element of this array" (`connection.password`, `rows[].token`). A declared
7905
+ * object or array is reported as one path and not descended into — everything
7906
+ * under it is secret.
7907
+ */
7908
+ function collectZodSecretPaths(schema, prefix = "") {
7909
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
7910
+ const paths = [];
7911
+ for (const layer of layersOf(schema)) {
7912
+ const def = defOf(layer);
7913
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
7914
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
7915
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
7916
+ else if (def.type === "intersection") {
7917
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
7918
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
7919
+ }
7920
+ }
7921
+ return [...new Set(paths)];
7922
+ }
7923
+ /**
7924
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
7925
+ * Zod row schema that describes it, and the helper that turns the two into the
7926
+ * JSON the engine stores.
7927
+ *
7928
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
7929
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
7930
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
7931
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
7932
+ * never a field name (D879).
7933
+ */
7934
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
7935
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
7936
+ var RecordIndexSchema = object({
7937
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
7938
+ fields: array(RecordFieldPathSchema).min(1).max(4),
7939
+ unique: boolean().optional()
7940
+ }).strict();
7941
+ var RecordRetentionSchema = union([
7942
+ object({
7943
+ ttlMs: number().int().positive(),
7944
+ from: _enum(["at", "write"])
7945
+ }).strict(),
7946
+ object({
7947
+ maxRows: number().int().positive().optional(),
7948
+ maxRowsPerDevice: number().int().positive().optional()
7949
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
7950
+ object({
7951
+ owner: string().min(1),
7952
+ reason: string().min(1)
7953
+ }).strict(),
7954
+ object({ none: string().min(1) }).strict()
7955
+ ]);
7956
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
7957
+ var EntryDescriptorSchema = object({
7958
+ title: string().min(1),
7959
+ /** The record body field shown as the entry's name. */
7960
+ nameField: string().min(1),
7961
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
7962
+ fields: record(string(), unknown())
7963
+ }).strict();
7964
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
7965
+ var RecordKindDeclarationSchema = object({
7966
+ database: _enum(RECORD_DATABASES).default("settings"),
7967
+ class: _enum(RECORD_CLASSES),
7968
+ writeTrigger: string().min(1),
7969
+ device: _enum([
7970
+ "required",
7971
+ "optional",
7972
+ "none"
7973
+ ]).default("none"),
7974
+ at: _enum(["required", "none"]).default("none"),
7975
+ indexes: array(RecordIndexSchema).max(8).default([]),
7976
+ retention: RecordRetentionSchema,
7977
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
7978
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
7979
+ /** Derived from the Zod schema; never written by hand. */
7980
+ secretPaths: array(string().min(1)).default([]),
7981
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
7982
+ secretArrayKeys: record(string(), string()).default({}),
7983
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
7984
+ adoptsFrom: string().min(1).optional(),
7985
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
7986
+ transactFamily: string().min(1).optional(),
7987
+ entry: EntryDescriptorSchema.optional()
7988
+ }).strict();
7989
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
7990
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
7731
7991
  /** Shared Zod schemas used across streaming capabilities. */
7732
7992
  var CamProfileSchema = _enum([
7733
7993
  "high",
@@ -8226,69 +8486,6 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8226
8486
  kind: "mutation",
8227
8487
  auth: "admin"
8228
8488
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
8229
- function defOf(schema) {
8230
- return schema._zod?.def ?? {};
8231
- }
8232
- function declaredHere(schema) {
8233
- return globalRegistry.get(schema)?.secret === true;
8234
- }
8235
- /** Wrapper kinds whose `innerType` is the field itself. */
8236
- var WRAPPERS = new Set([
8237
- "optional",
8238
- "nullable",
8239
- "default",
8240
- "prefault",
8241
- "catch",
8242
- "readonly",
8243
- "nonoptional"
8244
- ]);
8245
- /**
8246
- * The schema layers that make up ONE field: the schema itself and every
8247
- * wrapper below it (optional / default / nullable / readonly / catch), plus
8248
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8249
- * `.transform` on `in`).
8250
- */
8251
- function layersOf(schema) {
8252
- const out = [];
8253
- const queue = [schema];
8254
- while (queue.length > 0) {
8255
- const s = queue.shift();
8256
- if (!s || out.includes(s)) continue;
8257
- out.push(s);
8258
- const def = defOf(s);
8259
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8260
- if (def.type === "pipe") {
8261
- if (def.in) queue.push(def.in);
8262
- if (def.out) queue.push(def.out);
8263
- }
8264
- }
8265
- return out;
8266
- }
8267
- /** True when any layer of this field declares `.meta({ secret: true })`. */
8268
- function isZodSecret(schema) {
8269
- return layersOf(schema).some(declaredHere);
8270
- }
8271
- /**
8272
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
8273
- * element of this array" (`connection.password`, `rows[].token`). A declared
8274
- * object or array is reported as one path and not descended into — everything
8275
- * under it is secret.
8276
- */
8277
- function collectZodSecretPaths(schema, prefix = "") {
8278
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8279
- const paths = [];
8280
- for (const layer of layersOf(schema)) {
8281
- const def = defOf(layer);
8282
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8283
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8284
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8285
- else if (def.type === "intersection") {
8286
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8287
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8288
- }
8289
- }
8290
- return [...new Set(paths)];
8291
- }
8292
8489
  object({
8293
8490
  code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
8294
8491
  params: record(string(), union([string(), number()])).optional()
@@ -8332,7 +8529,7 @@ function sleep$2(ms) {
8332
8529
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
8333
8530
  }
8334
8531
  //#endregion
8335
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8532
+ //#region ../types/dist/err-msg-BXKzRBwg.mjs
8336
8533
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8337
8534
  DeviceType["Camera"] = "camera";
8338
8535
  DeviceType["Hub"] = "hub";
@@ -8424,6 +8621,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
8424
8621
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
8425
8622
  * integrations sharing the same food/desiccant/hopper surface. */
8426
8623
  DeviceType["PetFeeder"] = "pet-feeder";
8624
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
8625
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
8626
+ * Sources: native Bosch Home Connect, reusable by similar integrations. */
8627
+ DeviceType["Dishwasher"] = "dishwasher";
8427
8628
  return DeviceType;
8428
8629
  }({});
8429
8630
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -8601,6 +8802,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8601
8802
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8602
8803
  * real Switch device for UI rendering / export adapters. */
8603
8804
  DeviceRole["BinaryHelper"] = "binary-helper";
8805
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
8806
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
8807
+ DeviceRole["Outlet"] = "outlet";
8604
8808
  /** Generic motion / occupancy / moving event source. Distinct from
8605
8809
  * the camera accessory PirSensor role: that one is a camera child;
8606
8810
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8668,7 +8872,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8668
8872
  return DeviceRole;
8669
8873
  }({});
8670
8874
  //#endregion
8671
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
8875
+ //#region ../types/dist/composition-CB6PMT9p.mjs
8672
8876
  /**
8673
8877
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8674
8878
  *
@@ -12424,11 +12628,10 @@ var ClipModelMetaSchema = object({
12424
12628
  /**
12425
12629
  * The `vector-store` index this model's vectors live in. ONE feature space
12426
12630
  * per index: two models share an index only when their vectors are ranked
12427
- * against each other, which for CLIP means never across families. MobileCLIP
12428
- * S1 and S2 share `object-clip` for history (separated by the row's
12429
- * `modelId`); any other model gets its own.
12631
+ * against each other, which for CLIP means never across families. Every
12632
+ * model gets its own.
12430
12633
  */
12431
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12634
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
12432
12635
  /**
12433
12636
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
12434
12637
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -13607,8 +13810,13 @@ var AlertSeveritySchema = _enum([
13607
13810
  "info",
13608
13811
  "success",
13609
13812
  "warning",
13610
- "error"
13813
+ "error",
13814
+ "critical"
13611
13815
  ]);
13816
+ var AlertActionSchema = object({
13817
+ label: string(),
13818
+ href: string().optional()
13819
+ });
13612
13820
  var AlertStatusSchema = _enum([
13613
13821
  "active",
13614
13822
  "in-progress",
@@ -13626,6 +13834,7 @@ var AlertSchema = object({
13626
13834
  severity: AlertSeveritySchema,
13627
13835
  title: string(),
13628
13836
  message: string(),
13837
+ action: AlertActionSchema.optional(),
13629
13838
  status: AlertStatusSchema,
13630
13839
  progress: number().optional(),
13631
13840
  read: boolean(),
@@ -16161,6 +16370,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
16161
16370
  keyField: string()
16162
16371
  }).optional()
16163
16372
  })) });
16373
+ /**
16374
+ * The report of a one-shot "move this owner's plaintext secrets into the
16375
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
16376
+ *
16377
+ * The owner runs it on its own rows, through its own write path; an operator
16378
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
16379
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
16380
+ */
16381
+ var RawSecretMigrationInputSchema = object({
16382
+ /** `false` (the default of the script) = report only. */
16383
+ apply: boolean() });
16384
+ var RawSecretMigrationReportSchema = object({
16385
+ apply: boolean(),
16386
+ /** Rows that can carry a secret (a profile, an enrolment). */
16387
+ rows: number().int(),
16388
+ /** Rows whose secret was plaintext when the run started. */
16389
+ raw: number().int(),
16390
+ /** Rows that already held a keychain marker when the run started. */
16391
+ markers: number().int(),
16392
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
16393
+ migrated: number().int(),
16394
+ /** Plaintext rows left in place because the move or its read-back failed. */
16395
+ failed: number().int(),
16396
+ /** After the run: rows still holding plaintext. */
16397
+ remainingRaw: number().int(),
16398
+ /** After the run: markers the keychain could not resolve right now. */
16399
+ unresolvedMarkers: number().int(),
16400
+ /**
16401
+ * A second, redundant copy of the secrets' rows that the run found (and, on
16402
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
16403
+ */
16404
+ redundantCopies: number().int().optional(),
16405
+ /** True when nothing is raw and every marker resolves. */
16406
+ verified: boolean()
16407
+ });
16164
16408
  /** Where a block runs. The operator chooses — a block driving a device on an
16165
16409
  * agent is the reason placement is not fixed to the hub. */
16166
16410
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -16387,6 +16631,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
16387
16631
  }), SettingsUpdateResultSchema, {
16388
16632
  kind: "mutation",
16389
16633
  auth: "admin"
16634
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16635
+ kind: "mutation",
16636
+ auth: "admin"
16390
16637
  }), method(object({}), object({ libs: array(object({
16391
16638
  filePath: string(),
16392
16639
  content: string()
@@ -16650,6 +16897,347 @@ id: union([string(), number()]) }), {
16650
16897
  auth: "admin"
16651
16898
  });
16652
16899
  /**
16900
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16901
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16902
+ * (operator intent, D870) and device-history (numbers over time, D850).
16903
+ *
16904
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16905
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16906
+ * that with the addon id closed over). It is deliberately NOT in any input
16907
+ * schema, so a session can never supply it, and a call with no stamp is refused
16908
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16909
+ * addons go through the owner's capability.
16910
+ *
16911
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16912
+ * never `[]`. Secret fields are never on the wire: a read shows the
16913
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16914
+ * resolves itself, and a write may carry only a keychain marker bound to the
16915
+ * row's own ref.
16916
+ *
16917
+ * Internal: addons reach it through `ctx.records`, never directly.
16918
+ */
16919
+ var RecordIdSchema = string().min(1).max(256);
16920
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16921
+ var RecordBodySchema = record(string(), unknown());
16922
+ var RecordInputSchema = object({
16923
+ id: RecordIdSchema,
16924
+ /** The device this row belongs to (D865 removal, per-device reads). */
16925
+ deviceId: number().int().optional(),
16926
+ /** The domain clock, ms: observed / created / opened. */
16927
+ at: number().int().optional(),
16928
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16929
+ expiresAt: number().int().optional(),
16930
+ data: RecordBodySchema
16931
+ });
16932
+ var RecordViewSchema = object({
16933
+ id: string(),
16934
+ deviceId: number().int().nullable(),
16935
+ at: number().nullable(),
16936
+ expiresAt: number().nullable(),
16937
+ rev: number().int(),
16938
+ updatedAt: number(),
16939
+ data: RecordBodySchema
16940
+ });
16941
+ /** Declared index fields only. Anything else does not compile, by design. */
16942
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16943
+ string(),
16944
+ number(),
16945
+ boolean(),
16946
+ object({ in: array(union([
16947
+ string(),
16948
+ number(),
16949
+ boolean()
16950
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16951
+ object({
16952
+ gt: union([string(), number()]).optional(),
16953
+ gte: union([string(), number()]).optional(),
16954
+ lt: union([string(), number()]).optional(),
16955
+ lte: union([string(), number()]).optional()
16956
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16957
+ ]));
16958
+ var KindShape = { kind: RecordKindNameSchema };
16959
+ var TimeWindowShape = {
16960
+ deviceId: number().int().optional(),
16961
+ atFrom: number().optional(),
16962
+ atTo: number().optional()
16963
+ };
16964
+ var RecordQueryInputSchema = object({
16965
+ ...KindShape,
16966
+ ...TimeWindowShape,
16967
+ where: RecordWhereSchema.optional(),
16968
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16969
+ order: _enum(["at", "id"]).optional(),
16970
+ desc: boolean().optional(),
16971
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16972
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16973
+ cursor: string().min(1).optional()
16974
+ });
16975
+ var RecordQueryResultSchema = object({
16976
+ records: array(RecordViewSchema),
16977
+ nextCursor: string().nullable()
16978
+ });
16979
+ var RecordKindStateSchema = _enum([
16980
+ "created",
16981
+ "unchanged",
16982
+ "updated"
16983
+ ]);
16984
+ var DeclareKindResultSchema = object({
16985
+ kindId: number().int(),
16986
+ state: RecordKindStateSchema,
16987
+ createdIndexes: array(string()),
16988
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16989
+ adoptionPending: object({
16990
+ legacyTable: string(),
16991
+ legacyRows: number().int()
16992
+ }).nullable()
16993
+ });
16994
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16995
+ var SecretRefsList = array(string());
16996
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16997
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16998
+ kind: "mutation",
16999
+ auth: "admin"
17000
+ }), method(object({
17001
+ ...KindShape,
17002
+ id: RecordIdSchema
17003
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
17004
+ ...KindShape,
17005
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
17006
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
17007
+ ...KindShape,
17008
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
17009
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
17010
+ ...KindShape,
17011
+ record: RecordInputSchema,
17012
+ /** Compare-and-set. `0` means "the row must not exist". */
17013
+ ifRev: number().int().min(0).optional()
17014
+ }), object({
17015
+ rev: number().int(),
17016
+ releasedRefs: SecretRefsList
17017
+ }), {
17018
+ kind: "mutation",
17019
+ auth: "admin"
17020
+ }), method(object({
17021
+ ...KindShape,
17022
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
17023
+ }), object({
17024
+ count: number().int(),
17025
+ releasedRefs: SecretRefsList
17026
+ }), {
17027
+ kind: "mutation",
17028
+ auth: "admin"
17029
+ }), method(object({
17030
+ ...KindShape,
17031
+ id: RecordIdSchema,
17032
+ data: RecordBodySchema,
17033
+ at: number().int().nullable().optional(),
17034
+ expiresAt: number().int().nullable().optional(),
17035
+ ifRev: number().int().min(1).optional()
17036
+ }), object({
17037
+ rev: number().int(),
17038
+ releasedRefs: SecretRefsList
17039
+ }), {
17040
+ kind: "mutation",
17041
+ auth: "admin"
17042
+ }), method(object({
17043
+ ...KindShape,
17044
+ id: RecordIdSchema
17045
+ }), object({
17046
+ deleted: boolean(),
17047
+ secretRefs: SecretRefsList
17048
+ }), {
17049
+ kind: "mutation",
17050
+ auth: "admin"
17051
+ }), method(object({
17052
+ ...KindShape,
17053
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
17054
+ }), object({
17055
+ deleted: number().int(),
17056
+ secretRefs: SecretRefsList
17057
+ }), {
17058
+ kind: "mutation",
17059
+ auth: "admin"
17060
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
17061
+ ...KindShape,
17062
+ ...TimeWindowShape,
17063
+ where: RecordWhereSchema.optional()
17064
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
17065
+ ...KindShape,
17066
+ deviceId: number().int().optional(),
17067
+ from: number(),
17068
+ to: number(),
17069
+ bucketMs: number().int().positive()
17070
+ }), object({ buckets: array(object({
17071
+ bucketStart: number(),
17072
+ count: number().int()
17073
+ })) }), { auth: "admin" }), method(object({
17074
+ ...KindShape,
17075
+ op: _enum([
17076
+ "sum",
17077
+ "min",
17078
+ "max",
17079
+ "count"
17080
+ ]),
17081
+ field: RecordFieldPathSchema.optional(),
17082
+ groupBy: RecordFieldPathSchema.optional(),
17083
+ where: RecordWhereSchema.optional()
17084
+ }), object({ rows: array(object({
17085
+ group: union([
17086
+ string(),
17087
+ number(),
17088
+ _null()
17089
+ ]),
17090
+ value: number().nullable()
17091
+ })) }), { auth: "admin" }), method(object({
17092
+ ...KindShape,
17093
+ deviceId: number().int().optional(),
17094
+ atBefore: number().optional(),
17095
+ where: RecordWhereSchema.optional()
17096
+ }), object({
17097
+ deleted: number().int(),
17098
+ secretRefs: SecretRefsList
17099
+ }), {
17100
+ kind: "mutation",
17101
+ auth: "admin"
17102
+ }), method(object({
17103
+ deviceId: number().int(),
17104
+ kinds: array(RecordKindNameSchema).optional()
17105
+ }), object({
17106
+ deleted: record(string(), number().int()),
17107
+ secretRefs: SecretRefsList
17108
+ }), {
17109
+ kind: "mutation",
17110
+ auth: "admin"
17111
+ }), method(object(KindShape), object({ id: number().int() }), {
17112
+ kind: "mutation",
17113
+ auth: "admin"
17114
+ });
17115
+ /** One table of the settings database. */
17116
+ var StorageTableSchema = object({
17117
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
17118
+ name: string(),
17119
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
17120
+ owner: string().nullable(),
17121
+ rows: number().int().nonnegative(),
17122
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
17123
+ bytes: number().int().nonnegative().nullable(),
17124
+ /** Declared by an addon since this engine process started (a running addon claims it). */
17125
+ declaredThisBoot: boolean()
17126
+ });
17127
+ /** One declared record kind (D881) as System -> Data shows it. */
17128
+ var StorageKindSchema = object({
17129
+ owner: string(),
17130
+ kind: string(),
17131
+ database: _enum(["settings", "events"]),
17132
+ class: string(),
17133
+ state: _enum([
17134
+ "declared",
17135
+ "orphaned",
17136
+ "dropped"
17137
+ ]),
17138
+ /** `null` when the caller asked for no counts (`counts: false`). */
17139
+ rows: number().int().nonnegative().nullable(),
17140
+ /** Rows x the average size of a sample; null for an empty kind. */
17141
+ bytesEstimate: number().int().nonnegative().nullable(),
17142
+ writeTrigger: string(),
17143
+ retention: RecordRetentionSchema,
17144
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
17145
+ entry: boolean(),
17146
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
17147
+ declaration: RecordKindDeclarationSchema
17148
+ });
17149
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
17150
+ collection: string().min(1),
17151
+ expectRows: number().int().nonnegative()
17152
+ }), object({
17153
+ dropped: literal(true),
17154
+ rows: number().int().nonnegative()
17155
+ }), {
17156
+ kind: "mutation",
17157
+ auth: "admin"
17158
+ }), method(object({
17159
+ owner: string().min(1).optional(),
17160
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
17161
+ counts: boolean().optional()
17162
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
17163
+ owner: string().min(1),
17164
+ kind: RecordKindNameSchema
17165
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
17166
+ owner: string().min(1),
17167
+ kind: RecordKindNameSchema,
17168
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
17169
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
17170
+ complete: boolean().optional()
17171
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
17172
+ kind: "mutation",
17173
+ auth: "admin"
17174
+ }), method(object({
17175
+ collection: string().min(1),
17176
+ cursor: string().optional(),
17177
+ limit: number().int().min(1).max(1e3).optional()
17178
+ }), object({
17179
+ rows: array(object({
17180
+ id: string(),
17181
+ data: record(string(), unknown())
17182
+ })),
17183
+ nextCursor: string().nullable()
17184
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
17185
+ /**
17186
+ * record-entries - the ONE admin surface for every list of user-created entries
17187
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
17188
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
17189
+ *
17190
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
17191
+ * the entry body with `secret: true` on every credential field, so a password
17192
+ * field is derived from the schema and never from a name. `putEntry` takes the
17193
+ * redaction token for an untouched secret (the stored value is kept), a string
17194
+ * for a new one, and the clear instruction to remove one. A read never carries
17195
+ * a secret value, and a locked keychain refuses the write with
17196
+ * `records/secret-unavailable` instead of storing plaintext.
17197
+ *
17198
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
17199
+ */
17200
+ var EntryKindInfoSchema = object({
17201
+ owner: string(),
17202
+ kind: RecordKindNameSchema,
17203
+ title: string(),
17204
+ nameField: string(),
17205
+ /** JSON Schema of the body; `secret: true` marks a password field. */
17206
+ fields: record(string(), unknown()),
17207
+ secretPaths: array(string()),
17208
+ rows: number().int().nonnegative()
17209
+ });
17210
+ var EntryViewSchema = object({
17211
+ id: RecordIdSchema,
17212
+ name: string(),
17213
+ rev: number().int(),
17214
+ updatedAt: number(),
17215
+ /** Secret fields hold the redaction token. */
17216
+ data: RecordBodySchema
17217
+ });
17218
+ var EntryAddress = {
17219
+ owner: string().min(1),
17220
+ kind: RecordKindNameSchema
17221
+ };
17222
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
17223
+ ...EntryAddress,
17224
+ id: RecordIdSchema.optional(),
17225
+ data: RecordBodySchema,
17226
+ ifRev: number().int().min(1).optional()
17227
+ }), object({
17228
+ id: string(),
17229
+ rev: number().int()
17230
+ }), {
17231
+ kind: "mutation",
17232
+ auth: "admin"
17233
+ }), method(object({
17234
+ ...EntryAddress,
17235
+ id: RecordIdSchema
17236
+ }), object({ deleted: boolean() }), {
17237
+ kind: "mutation",
17238
+ auth: "admin"
17239
+ });
17240
+ /**
16653
17241
  * `keychain` — the hub's encrypted store of secret values (D787).
16654
17242
  *
16655
17243
  * Settings blobs never hold a secret: they hold a marker
@@ -17190,6 +17778,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
17190
17778
  kind: "mutation",
17191
17779
  auth: "admin",
17192
17780
  caller: "required"
17781
+ }), method(object({
17782
+ ref: string().min(1),
17783
+ value: string().min(1)
17784
+ }), object({
17785
+ ref: string(),
17786
+ version: number().int()
17787
+ }), {
17788
+ kind: "mutation",
17789
+ auth: "admin",
17790
+ caller: "required"
17193
17791
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
17194
17792
  deleted: array(string()).readonly(),
17195
17793
  kept: array(object({
@@ -39983,6 +40581,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39983
40581
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39984
40582
  kind: "mutation",
39985
40583
  auth: "admin"
40584
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
40585
+ kind: "mutation",
40586
+ auth: "admin"
39986
40587
  }), method(ProfileRefInputSchema, _void(), {
39987
40588
  kind: "mutation",
39988
40589
  auth: "admin"
@@ -50513,6 +51114,41 @@ var ServerRollbackInfoSchema = object({
50513
51114
  atMs: number(),
50514
51115
  reason: string()
50515
51116
  });
51117
+ /**
51118
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
51119
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
51120
+ * service holds, because only the hub plans) against the states the process
51121
+ * service reports. Kept in memory, recomputed by the same one-shot check after
51122
+ * every boot, served on `getServerPackageStatus`.
51123
+ *
51124
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
51125
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
51126
+ * planned runner the process service has no entry for.
51127
+ */
51128
+ var RunnerRefusalSchema = object({
51129
+ runnerId: string(),
51130
+ addonIds: array(string()),
51131
+ reason: string()
51132
+ });
51133
+ var RunnerBootCheckSchema = object({
51134
+ checkedAtMs: number(),
51135
+ /** Runners planned for this node. */
51136
+ expected: number(),
51137
+ /** Planned runners whose process is `running`. */
51138
+ running: number(),
51139
+ failed: array(string()),
51140
+ refused: array(RunnerRefusalSchema),
51141
+ missing: array(string()),
51142
+ /**
51143
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
51144
+ * respawn. The check is FINAL only when this is empty; until then nothing is
51145
+ * pushed and the verdict is re-evaluated on the next runner state change.
51146
+ * Optional for version skew (absent = settled).
51147
+ */
51148
+ pending: array(string()).optional(),
51149
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
51150
+ planKnown: boolean()
51151
+ });
50516
51152
  var ServerPackageStatusSchema = object({
50517
51153
  /** Root package name (`@camstack/server` on the hub). */
50518
51154
  packageName: string(),
@@ -50575,7 +51211,14 @@ var ServerPackageStatusSchema = object({
50575
51211
  * for version skew: an older provider's payload simply omits it, and an
50576
51212
  * absent wrapper is unknown — never `native`.
50577
51213
  */
50578
- wrapper: WrapperIdentitySchema.optional()
51214
+ wrapper: WrapperIdentitySchema.optional(),
51215
+ /**
51216
+ * What this node PLANNED to run against what its process service reports
51217
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
51218
+ * on a provider that predates it. Absent is "not checked yet", never "all
51219
+ * well": a consumer that needs the answer treats it as pending.
51220
+ */
51221
+ runners: RunnerBootCheckSchema.optional()
50579
51222
  });
50580
51223
  var ServerUpdateCheckResultSchema = object({
50581
51224
  packageName: string(),
@@ -50626,6 +51269,13 @@ var ServerUpdateOutcomeSchema = _enum([
50626
51269
  "refused",
50627
51270
  "failed"
50628
51271
  ]);
51272
+ /** One addon the pre-flight found the target version would refuse (D877). */
51273
+ var UpdateBlockerSchema = object({
51274
+ addonId: string(),
51275
+ reason: string(),
51276
+ /** What the operator does about it. */
51277
+ remedy: string()
51278
+ });
50629
51279
  var ServerUpdateActionResultSchema = object({
50630
51280
  accepted: boolean(),
50631
51281
  targetVersion: string().nullable(),
@@ -50643,14 +51293,27 @@ var ServerUpdateActionResultSchema = object({
50643
51293
  * The failure itself, verbatim enough to act on (the npm output for a
50644
51294
  * staging install). Non-null only for `failed`.
50645
51295
  */
50646
- error: string().nullable().optional()
51296
+ error: string().nullable().optional(),
51297
+ /**
51298
+ * The addons the target version would refuse to start on this node's live
51299
+ * store (D877), present when the pre-flight refused the update
51300
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
51301
+ */
51302
+ blockers: array(UpdateBlockerSchema).optional()
50647
51303
  });
50648
51304
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
50649
51305
  kind: "mutation",
50650
51306
  auth: "admin"
50651
- }), method(object({
50652
- /** Explicit target version; omitted = latest from the registry. */
50653
- version: string().optional() }), ServerUpdateActionResultSchema, {
51307
+ }), method(object({
51308
+ /** Explicit target version; omitted = latest from the registry. */
51309
+ version: string().optional(),
51310
+ /**
51311
+ * Apply even though the pre-flight (D877) found addons the target would
51312
+ * refuse to start. Off by default: those addons stay down until the
51313
+ * remedy is run, which is the incident this gate exists to prevent.
51314
+ */
51315
+ acknowledgeRefusals: boolean().optional()
51316
+ }), ServerUpdateActionResultSchema, {
50654
51317
  kind: "mutation",
50655
51318
  auth: "admin",
50656
51319
  timeoutMs: 16 * 6e4
@@ -53618,7 +54281,9 @@ var ManifestShapeSchema = object({
53618
54281
  var AddonProcessSchema = object({
53619
54282
  pid: number().optional(),
53620
54283
  mode: string(),
53621
- state: string()
54284
+ state: string(),
54285
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
54286
+ reason: string().optional()
53622
54287
  });
53623
54288
  /**
53624
54289
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -54386,7 +55051,8 @@ var batteryCapability = {
54386
55051
  DeviceType.Button,
54387
55052
  DeviceType.Switch,
54388
55053
  DeviceType.PetFeeder,
54389
- DeviceType.Container
55054
+ DeviceType.Container,
55055
+ DeviceType.Thermostat
54390
55056
  ],
54391
55057
  methods: {
54392
55058
  /**
@@ -55007,6 +55673,12 @@ var ClimateControlStatusSchema = object({
55007
55673
  /** Horizontal louver swing on/off. Null when the device has no
55008
55674
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
55009
55675
  swingHorizontal: boolean().nullable(),
55676
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
55677
+ minTemp: number().nullable().optional(),
55678
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
55679
+ maxTemp: number().nullable().optional(),
55680
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
55681
+ tempStep: number().positive().nullable().optional(),
55010
55682
  /** Ms epoch when the slice was last updated (push or command). */
55011
55683
  lastFetchedAt: number()
55012
55684
  });
@@ -55853,6 +56525,125 @@ onStatusChanged: { data: object({
55853
56525
  * whether persisting is worth a SQLite commit. */
55854
56526
  volatileStateFields: ["lastChangedAt"]
55855
56527
  };
56528
+ /**
56529
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
56530
+ * consumable levels (salt, rinse aid) and common program options.
56531
+ *
56532
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
56533
+ * by any integration that exposes the same program / option surface.
56534
+ *
56535
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
56536
+ * provider refreshes the slice on an interval and eagerly after commands.
56537
+ */
56538
+ var DishwasherStateSchema = _enum([
56539
+ "idle",
56540
+ "running",
56541
+ "paused",
56542
+ "finished",
56543
+ "error",
56544
+ "unavailable"
56545
+ ]);
56546
+ var DishwasherConsumableLevelSchema = _enum([
56547
+ "ok",
56548
+ "low",
56549
+ "empty"
56550
+ ]);
56551
+ var DishwasherStatusSchema = object({
56552
+ state: DishwasherStateSchema,
56553
+ /** Active program id/name, or null when none selected / unknown. */
56554
+ program: string().nullable(),
56555
+ /** Program tokens the hardware accepts — drives the UI selector. */
56556
+ availablePrograms: array(string()),
56557
+ /** Minutes remaining on the active cycle, or null when not running. */
56558
+ remainingMinutes: number().int().nonnegative().nullable(),
56559
+ /** Cycle completion 0..100, or null when not applicable. */
56560
+ progressPercent: number().min(0).max(100).nullable(),
56561
+ /** True when the door is reported open. */
56562
+ doorOpen: boolean(),
56563
+ /** True when remote start is allowed (door closed, power on, etc.). */
56564
+ remoteStartAllowed: boolean(),
56565
+ /** Main power / switched-on state. */
56566
+ powerOn: boolean(),
56567
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
56568
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
56569
+ halfLoad: boolean(),
56570
+ hygienePlus: boolean(),
56571
+ errorCode: number().nullable(),
56572
+ errorLabel: string().nullable(),
56573
+ lastFetchedAt: number()
56574
+ });
56575
+ var dishwasherCapability = {
56576
+ name: "dishwasher",
56577
+ scope: "device",
56578
+ deviceNative: true,
56579
+ mode: "singleton",
56580
+ deviceTypes: [DeviceType.Dishwasher],
56581
+ methods: {
56582
+ start: method(object({ deviceId: number().int().nonnegative() }), _void(), {
56583
+ kind: "mutation",
56584
+ auth: "protected"
56585
+ }),
56586
+ pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
56587
+ kind: "mutation",
56588
+ auth: "protected"
56589
+ }),
56590
+ stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
56591
+ kind: "mutation",
56592
+ auth: "protected"
56593
+ }),
56594
+ setProgram: method(object({
56595
+ deviceId: number().int().nonnegative(),
56596
+ program: string().min(1)
56597
+ }), _void(), {
56598
+ kind: "mutation",
56599
+ auth: "protected"
56600
+ }),
56601
+ setPower: method(object({
56602
+ deviceId: number().int().nonnegative(),
56603
+ on: boolean()
56604
+ }), _void(), {
56605
+ kind: "mutation",
56606
+ auth: "protected"
56607
+ }),
56608
+ setHalfLoad: method(object({
56609
+ deviceId: number().int().nonnegative(),
56610
+ on: boolean()
56611
+ }), _void(), {
56612
+ kind: "mutation",
56613
+ auth: "protected"
56614
+ }),
56615
+ setHygienePlus: method(object({
56616
+ deviceId: number().int().nonnegative(),
56617
+ on: boolean()
56618
+ }), _void(), {
56619
+ kind: "mutation",
56620
+ auth: "protected"
56621
+ }),
56622
+ setOption: method(object({
56623
+ deviceId: number().int().nonnegative(),
56624
+ key: string().min(1),
56625
+ value: union([
56626
+ boolean(),
56627
+ string(),
56628
+ number()
56629
+ ])
56630
+ }), _void(), {
56631
+ kind: "mutation",
56632
+ auth: "protected"
56633
+ })
56634
+ },
56635
+ status: {
56636
+ schema: DishwasherStatusSchema,
56637
+ kind: "poll"
56638
+ },
56639
+ runtimeState: DishwasherStatusSchema,
56640
+ durability: "session",
56641
+ history: { fields: { progressPercent: {
56642
+ kind: "gauge",
56643
+ unit: "%",
56644
+ deadband: 2
56645
+ } } }
56646
+ };
55856
56647
  var DoorbellStatusSchema = object({
55857
56648
  /** Ms epoch of the last press. null = never observed since this provider started. */
55858
56649
  lastPressedAt: number().nullable(),
@@ -56655,6 +57446,32 @@ var gasCapability = {
56655
57446
  * whether persisting is worth a SQLite commit. */
56656
57447
  volatileStateFields: ["lastChangedAt"]
56657
57448
  };
57449
+ var HeatingValveStatusSchema = object({
57450
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
57451
+ position: number().min(0).max(100).nullable(),
57452
+ /** Ms epoch when the slice was last updated (push or poll). */
57453
+ lastFetchedAt: number()
57454
+ });
57455
+ var heatingValveCapability = {
57456
+ name: "heating-valve",
57457
+ scope: "device",
57458
+ deviceNative: true,
57459
+ mode: "singleton",
57460
+ deviceTypes: [DeviceType.Thermostat],
57461
+ methods: {},
57462
+ status: {
57463
+ schema: HeatingValveStatusSchema,
57464
+ kind: "push"
57465
+ },
57466
+ runtimeState: HeatingValveStatusSchema,
57467
+ durability: "session",
57468
+ history: { fields: { position: {
57469
+ kind: "gauge",
57470
+ unit: "%",
57471
+ deadband: 1
57472
+ } } },
57473
+ volatileStateFields: ["lastFetchedAt"]
57474
+ };
56658
57475
  /**
56659
57476
  * Humidifier / dehumidifier cap. Models HA `humidifier.*` entities —
56660
57477
  * an on/off actuator with an optional target-humidity setpoint and an
@@ -57787,7 +58604,19 @@ var TlsStatusSchema = object({
57787
58604
  sans: array(string()),
57788
58605
  caCertPem: string().nullable(),
57789
58606
  reissueError: string().nullable(),
57790
- restartRequired: boolean()
58607
+ restartRequired: boolean(),
58608
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
58609
+ caMissing: boolean(),
58610
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
58611
+ localCaConstrained: boolean().nullable(),
58612
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
58613
+ caReplacedAt: string().nullable(),
58614
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
58615
+ storedUpload: object({
58616
+ leafFingerprintSha256: string(),
58617
+ validTo: string(),
58618
+ hasCa: boolean()
58619
+ }).nullable()
57791
58620
  });
57792
58621
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
57793
58622
  /**
@@ -57843,6 +58672,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
57843
58672
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
57844
58673
  kind: "mutation",
57845
58674
  auth: "admin"
58675
+ }), method(_void(), TlsStatusSchema, {
58676
+ kind: "mutation",
58677
+ auth: "admin"
57846
58678
  });
57847
58679
  var LockControlStatusSchema = object({
57848
58680
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -64906,7 +65738,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64906
65738
  kind: "mutation",
64907
65739
  auth: "admin",
64908
65740
  access: "delete"
64909
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
65741
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
65742
+ kind: "mutation",
65743
+ auth: "admin",
65744
+ access: "create"
65745
+ }), method(object({
64910
65746
  userId: string(),
64911
65747
  code: string()
64912
65748
  }), object({ valid: boolean() }), {
@@ -66641,6 +67477,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
66641
67477
  dayNight: dayNightCapability,
66642
67478
  deviceDiscovery: deviceDiscoveryCapability,
66643
67479
  deviceStatus: deviceStatusCapability,
67480
+ dishwasher: dishwasherCapability,
66644
67481
  doorbell: doorbellCapability,
66645
67482
  enumSensor: enumSensorCapability,
66646
67483
  eventEmitter: eventEmitterCapability,
@@ -66648,6 +67485,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
66648
67485
  featureProbe: featureProbeCapability,
66649
67486
  flood: floodCapability,
66650
67487
  gas: gasCapability,
67488
+ heatingValve: heatingValveCapability,
66651
67489
  humidifier: humidifierCapability,
66652
67490
  humiditySensor: humiditySensorCapability,
66653
67491
  image: imageCapability,
@@ -66733,13 +67571,14 @@ var BaseDevice = class {
66733
67571
  get state() {
66734
67572
  if (!this._stateProxyCache) {
66735
67573
  const cache = {};
66736
- const handler = { get: (_target, key) => {
67574
+ const handler = { get: (target, key) => {
66737
67575
  const k = key;
66738
- if (k in cache) return cache[k];
67576
+ const existing = Reflect.get(target, k);
67577
+ if (existing !== void 0) return existing;
66739
67578
  const cap = DEVICE_LOCAL_STATE_CAPS[k];
66740
67579
  if (!cap) return void 0;
66741
67580
  const proxy = this.sliceProxy(cap);
66742
- cache[k] = proxy;
67581
+ Reflect.set(target, k, proxy);
66743
67582
  return proxy;
66744
67583
  } };
66745
67584
  this._stateProxyCache = new Proxy(cache, handler);
@@ -66938,7 +67777,7 @@ var BaseDevice = class {
66938
67777
  async updateSourceInfo(patch) {
66939
67778
  const next = mergeSourceInfo(this.sourceInfo, patch);
66940
67779
  this._sourceInfoCache = Object.freeze({ ...next });
66941
- const action = this.ctx.api?.deviceManager?.setMetadata;
67780
+ const action = this.ctx.api.deviceManager?.setMetadata;
66942
67781
  if (action) try {
66943
67782
  await action.mutate({
66944
67783
  deviceId: this.id,
@@ -66973,7 +67812,7 @@ var BaseDevice = class {
66973
67812
  * device boot on a meta refresh.
66974
67813
  */
66975
67814
  async refreshFeatures() {
66976
- const action = this.ctx.api?.deviceManager?.registerDevice;
67815
+ const action = this.ctx.api.deviceManager?.registerDevice;
66977
67816
  if (!action) return;
66978
67817
  try {
66979
67818
  await action.mutate({
@@ -67372,6 +68211,12 @@ var BaseDeviceProvider = class extends BaseAddon {
67372
68211
  provider: this
67373
68212
  }];
67374
68213
  }
68214
+ /** Flatten `super.onInitialize()` whether it returned an array or an envelope. */
68215
+ providerRegistrationsFromSuper(result) {
68216
+ if (Array.isArray(result)) return result;
68217
+ if (result !== void 0 && result.providers !== void 0) return [...result.providers];
68218
+ return [];
68219
+ }
67375
68220
  async onShutdown() {
67376
68221
  this._restoreShuttingDown = true;
67377
68222
  this.cancelRestoreRetries();
@@ -67898,7 +68743,7 @@ var BaseDeviceProvider = class extends BaseAddon {
67898
68743
  return toDeviceSummary(device, this.addonId);
67899
68744
  }
67900
68745
  };
67901
- 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;
68746
+ 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;
67902
68747
  new Set(Object.values(DeviceType));
67903
68748
  Object.freeze({
67904
68749
  "accessories.getStatus": {
@@ -69047,6 +69892,12 @@ Object.freeze({
69047
69892
  addonId: null,
69048
69893
  access: "view"
69049
69894
  },
69895
+ "coreBlocks.migrateRawSecrets": {
69896
+ capName: "core-blocks",
69897
+ capScope: "system",
69898
+ addonId: null,
69899
+ access: "create"
69900
+ },
69050
69901
  "coreBlocks.restart": {
69051
69902
  capName: "core-blocks",
69052
69903
  capScope: "system",
@@ -70313,6 +71164,60 @@ Object.freeze({
70313
71164
  addonId: null,
70314
71165
  access: "view"
70315
71166
  },
71167
+ "dishwasher.getStatus": {
71168
+ capName: "dishwasher",
71169
+ capScope: "device",
71170
+ addonId: null,
71171
+ access: "view"
71172
+ },
71173
+ "dishwasher.pause": {
71174
+ capName: "dishwasher",
71175
+ capScope: "device",
71176
+ addonId: null,
71177
+ access: "create"
71178
+ },
71179
+ "dishwasher.setHalfLoad": {
71180
+ capName: "dishwasher",
71181
+ capScope: "device",
71182
+ addonId: null,
71183
+ access: "create"
71184
+ },
71185
+ "dishwasher.setHygienePlus": {
71186
+ capName: "dishwasher",
71187
+ capScope: "device",
71188
+ addonId: null,
71189
+ access: "create"
71190
+ },
71191
+ "dishwasher.setOption": {
71192
+ capName: "dishwasher",
71193
+ capScope: "device",
71194
+ addonId: null,
71195
+ access: "create"
71196
+ },
71197
+ "dishwasher.setPower": {
71198
+ capName: "dishwasher",
71199
+ capScope: "device",
71200
+ addonId: null,
71201
+ access: "create"
71202
+ },
71203
+ "dishwasher.setProgram": {
71204
+ capName: "dishwasher",
71205
+ capScope: "device",
71206
+ addonId: null,
71207
+ access: "create"
71208
+ },
71209
+ "dishwasher.start": {
71210
+ capName: "dishwasher",
71211
+ capScope: "device",
71212
+ addonId: null,
71213
+ access: "create"
71214
+ },
71215
+ "dishwasher.stop": {
71216
+ capName: "dishwasher",
71217
+ capScope: "device",
71218
+ addonId: null,
71219
+ access: "create"
71220
+ },
70316
71221
  "doorbell.getStatus": {
70317
71222
  capName: "doorbell",
70318
71223
  capScope: "device",
@@ -70523,6 +71428,12 @@ Object.freeze({
70523
71428
  addonId: null,
70524
71429
  access: "view"
70525
71430
  },
71431
+ "heatingValve.getStatus": {
71432
+ capName: "heating-valve",
71433
+ capScope: "device",
71434
+ addonId: null,
71435
+ access: "view"
71436
+ },
70526
71437
  "humidifier.getStatus": {
70527
71438
  capName: "humidifier",
70528
71439
  capScope: "device",
@@ -70733,6 +71644,12 @@ Object.freeze({
70733
71644
  addonId: null,
70734
71645
  access: "create"
70735
71646
  },
71647
+ "keychainAdmin.importSecret": {
71648
+ capName: "keychain-admin",
71649
+ capScope: "system",
71650
+ addonId: null,
71651
+ access: "create"
71652
+ },
70736
71653
  "keychainAdmin.listAudit": {
70737
71654
  capName: "keychain-admin",
70738
71655
  capScope: "system",
@@ -70901,6 +71818,12 @@ Object.freeze({
70901
71818
  addonId: null,
70902
71819
  access: "view"
70903
71820
  },
71821
+ "llm.migrateRawSecrets": {
71822
+ capName: "llm",
71823
+ capScope: "system",
71824
+ addonId: null,
71825
+ access: "create"
71826
+ },
70904
71827
  "llm.resolveModelRef": {
70905
71828
  capName: "llm",
70906
71829
  capScope: "system",
@@ -71129,6 +72052,12 @@ Object.freeze({
71129
72052
  addonId: null,
71130
72053
  access: "create"
71131
72054
  },
72055
+ "localNetwork.useStoredUploadedCertificate": {
72056
+ capName: "local-network",
72057
+ capScope: "system",
72058
+ addonId: null,
72059
+ access: "create"
72060
+ },
71132
72061
  "lockControl.getStatus": {
71133
72062
  capName: "lock-control",
71134
72063
  capScope: "device",
@@ -73781,6 +74710,30 @@ Object.freeze({
73781
74710
  addonId: null,
73782
74711
  access: "create"
73783
74712
  },
74713
+ "recordEntries.deleteEntry": {
74714
+ capName: "record-entries",
74715
+ capScope: "system",
74716
+ addonId: null,
74717
+ access: "delete"
74718
+ },
74719
+ "recordEntries.listEntries": {
74720
+ capName: "record-entries",
74721
+ capScope: "system",
74722
+ addonId: null,
74723
+ access: "view"
74724
+ },
74725
+ "recordEntries.listEntryKinds": {
74726
+ capName: "record-entries",
74727
+ capScope: "system",
74728
+ addonId: null,
74729
+ access: "view"
74730
+ },
74731
+ "recordEntries.putEntry": {
74732
+ capName: "record-entries",
74733
+ capScope: "system",
74734
+ addonId: null,
74735
+ access: "create"
74736
+ },
73784
74737
  "recording.getAvailability": {
73785
74738
  capName: "recording",
73786
74739
  capScope: "device",
@@ -74081,6 +75034,102 @@ Object.freeze({
74081
75034
  addonId: null,
74082
75035
  access: "view"
74083
75036
  },
75037
+ "records.aggregate": {
75038
+ capName: "records",
75039
+ capScope: "system",
75040
+ addonId: null,
75041
+ access: "view"
75042
+ },
75043
+ "records.allocateId": {
75044
+ capName: "records",
75045
+ capScope: "system",
75046
+ addonId: null,
75047
+ access: "create"
75048
+ },
75049
+ "records.count": {
75050
+ capName: "records",
75051
+ capScope: "system",
75052
+ addonId: null,
75053
+ access: "view"
75054
+ },
75055
+ "records.declareKinds": {
75056
+ capName: "records",
75057
+ capScope: "system",
75058
+ addonId: null,
75059
+ access: "create"
75060
+ },
75061
+ "records.delete": {
75062
+ capName: "records",
75063
+ capScope: "system",
75064
+ addonId: null,
75065
+ access: "delete"
75066
+ },
75067
+ "records.deleteDevice": {
75068
+ capName: "records",
75069
+ capScope: "system",
75070
+ addonId: null,
75071
+ access: "delete"
75072
+ },
75073
+ "records.deleteMany": {
75074
+ capName: "records",
75075
+ capScope: "system",
75076
+ addonId: null,
75077
+ access: "delete"
75078
+ },
75079
+ "records.deleteWhere": {
75080
+ capName: "records",
75081
+ capScope: "system",
75082
+ addonId: null,
75083
+ access: "delete"
75084
+ },
75085
+ "records.get": {
75086
+ capName: "records",
75087
+ capScope: "system",
75088
+ addonId: null,
75089
+ access: "view"
75090
+ },
75091
+ "records.getMany": {
75092
+ capName: "records",
75093
+ capScope: "system",
75094
+ addonId: null,
75095
+ access: "view"
75096
+ },
75097
+ "records.histogram": {
75098
+ capName: "records",
75099
+ capScope: "system",
75100
+ addonId: null,
75101
+ access: "view"
75102
+ },
75103
+ "records.patch": {
75104
+ capName: "records",
75105
+ capScope: "system",
75106
+ addonId: null,
75107
+ access: "create"
75108
+ },
75109
+ "records.put": {
75110
+ capName: "records",
75111
+ capScope: "system",
75112
+ addonId: null,
75113
+ access: "create"
75114
+ },
75115
+ "records.putMany": {
75116
+ capName: "records",
75117
+ capScope: "system",
75118
+ addonId: null,
75119
+ access: "create"
75120
+ },
75121
+ "records.query": {
75122
+ capName: "records",
75123
+ capScope: "system",
75124
+ addonId: null,
75125
+ access: "view"
75126
+ },
75127
+ "records.secretRefs": {
75128
+ capName: "records",
75129
+ capScope: "system",
75130
+ addonId: null,
75131
+ access: "view"
75132
+ },
74084
75133
  "sceneMonitor.captureReference": {
74085
75134
  capName: "scene-monitor",
74086
75135
  capScope: "device",
@@ -74513,6 +75562,48 @@ Object.freeze({
74513
75562
  addonId: null,
74514
75563
  access: "create"
74515
75564
  },
75565
+ "storageAdmin.adoptRecords": {
75566
+ capName: "storage-admin",
75567
+ capScope: "system",
75568
+ addonId: null,
75569
+ access: "create"
75570
+ },
75571
+ "storageAdmin.dropCollection": {
75572
+ capName: "storage-admin",
75573
+ capScope: "system",
75574
+ addonId: null,
75575
+ access: "delete"
75576
+ },
75577
+ "storageAdmin.isAdoptedLegacyTable": {
75578
+ capName: "storage-admin",
75579
+ capScope: "system",
75580
+ addonId: null,
75581
+ access: "view"
75582
+ },
75583
+ "storageAdmin.listKinds": {
75584
+ capName: "storage-admin",
75585
+ capScope: "system",
75586
+ addonId: null,
75587
+ access: "view"
75588
+ },
75589
+ "storageAdmin.listTables": {
75590
+ capName: "storage-admin",
75591
+ capScope: "system",
75592
+ addonId: null,
75593
+ access: "view"
75594
+ },
75595
+ "storageAdmin.readLegacyCollection": {
75596
+ capName: "storage-admin",
75597
+ capScope: "system",
75598
+ addonId: null,
75599
+ access: "view"
75600
+ },
75601
+ "storageAdmin.readRecords": {
75602
+ capName: "storage-admin",
75603
+ capScope: "system",
75604
+ addonId: null,
75605
+ access: "view"
75606
+ },
74516
75607
  "storageEvictable.evict": {
74517
75608
  capName: "storage-evictable",
74518
75609
  capScope: "system",
@@ -75425,6 +76516,12 @@ Object.freeze({
75425
76516
  addonId: null,
75426
76517
  access: "view"
75427
76518
  },
76519
+ "userManagement.migrateRawSecrets": {
76520
+ capName: "user-management",
76521
+ capScope: "system",
76522
+ addonId: null,
76523
+ access: "create"
76524
+ },
75428
76525
  "userManagement.oauthExchangeCode": {
75429
76526
  capName: "user-management",
75430
76527
  capScope: "system",
@@ -75924,7 +77021,7 @@ Object.freeze({
75924
77021
  access: "create"
75925
77022
  }
75926
77023
  });
75927
- 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;
77024
+ 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;
75928
77025
  DeviceFeature.BatteryOperated;
75929
77026
  var LAST_FETCHED_FIELD = "lastFetchedAt";
75930
77027
  /**
@@ -76900,6 +77997,51 @@ Object.freeze({
76900
77997
  form: "single",
76901
77998
  optional: false
76902
77999
  }],
78000
+ "dishwasher.getStatus": [{
78001
+ name: "deviceId",
78002
+ form: "single",
78003
+ optional: false
78004
+ }],
78005
+ "dishwasher.pause": [{
78006
+ name: "deviceId",
78007
+ form: "single",
78008
+ optional: false
78009
+ }],
78010
+ "dishwasher.setHalfLoad": [{
78011
+ name: "deviceId",
78012
+ form: "single",
78013
+ optional: false
78014
+ }],
78015
+ "dishwasher.setHygienePlus": [{
78016
+ name: "deviceId",
78017
+ form: "single",
78018
+ optional: false
78019
+ }],
78020
+ "dishwasher.setOption": [{
78021
+ name: "deviceId",
78022
+ form: "single",
78023
+ optional: false
78024
+ }],
78025
+ "dishwasher.setPower": [{
78026
+ name: "deviceId",
78027
+ form: "single",
78028
+ optional: false
78029
+ }],
78030
+ "dishwasher.setProgram": [{
78031
+ name: "deviceId",
78032
+ form: "single",
78033
+ optional: false
78034
+ }],
78035
+ "dishwasher.start": [{
78036
+ name: "deviceId",
78037
+ form: "single",
78038
+ optional: false
78039
+ }],
78040
+ "dishwasher.stop": [{
78041
+ name: "deviceId",
78042
+ form: "single",
78043
+ optional: false
78044
+ }],
76903
78045
  "doorbell.getStatus": [{
76904
78046
  name: "deviceId",
76905
78047
  form: "single",
@@ -76969,6 +78111,11 @@ Object.freeze({
76969
78111
  form: "single",
76970
78112
  optional: false
76971
78113
  }],
78114
+ "heatingValve.getStatus": [{
78115
+ name: "deviceId",
78116
+ form: "single",
78117
+ optional: false
78118
+ }],
76972
78119
  "humidifier.getStatus": [{
76973
78120
  name: "deviceId",
76974
78121
  form: "single",
@@ -78253,6 +79400,37 @@ Object.freeze({
78253
79400
  form: "single",
78254
79401
  optional: false
78255
79402
  }],
79403
+ "records.count": [{
79404
+ name: "deviceId",
79405
+ form: "single",
79406
+ optional: true
79407
+ }],
79408
+ "records.deleteDevice": [{
79409
+ name: "deviceId",
79410
+ form: "single",
79411
+ optional: false
79412
+ }],
79413
+ "records.deleteWhere": [{
79414
+ name: "deviceId",
79415
+ form: "single",
79416
+ optional: true
79417
+ }],
79418
+ "records.histogram": [{
79419
+ name: "deviceId",
79420
+ form: "single",
79421
+ optional: true
79422
+ }],
79423
+ "records.putMany": [{
79424
+ name: "records",
79425
+ form: "object-array",
79426
+ optional: false,
79427
+ itemField: "deviceId"
79428
+ }],
79429
+ "records.query": [{
79430
+ name: "deviceId",
79431
+ form: "single",
79432
+ optional: true
79433
+ }],
78256
79434
  "sceneMonitor.captureReference": [{
78257
79435
  name: "deviceId",
78258
79436
  form: "single",
@@ -78369,6 +79547,17 @@ Object.freeze({
78369
79547
  form: "single",
78370
79548
  optional: false
78371
79549
  }],
79550
+ "storageAdmin.adoptRecords": [{
79551
+ name: "records",
79552
+ form: "object-array",
79553
+ optional: false,
79554
+ itemField: "deviceId"
79555
+ }],
79556
+ "storageAdmin.readRecords": [{
79557
+ name: "deviceId",
79558
+ form: "single",
79559
+ optional: true
79560
+ }],
78372
79561
  "streamBroker.acquireEgressTranscode": [{
78373
79562
  name: "deviceId",
78374
79563
  form: "single",
@@ -202247,7 +203436,7 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
202247
203436
  return [...EMAIL_PUSH_SECTION_IDS, ...BAICHUAN_WEBHOOK_SECTION_IDS];
202248
203437
  }
202249
203438
  async onInitialize() {
202250
- const regs = await super.onInitialize();
203439
+ const regs = this.providerRegistrationsFromSuper(await super.onInitialize());
202251
203440
  this.logChannels = createLogChannelsProvider(this.ctx.logger.child("log-channels"));
202252
203441
  regs.push({
202253
203442
  capability: logChannelsCapability,