@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.js CHANGED
@@ -36,7 +36,7 @@ let node_os = require("node:os");
36
36
  node_os = require_chunk.__toESM(node_os, 1);
37
37
  let node_fs = require("node:fs");
38
38
  node_fs = require_chunk.__toESM(node_fs, 1);
39
- //#region ../types/dist/event-category-C4hVnRo8.mjs
39
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
40
40
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
41
41
  EventCategory["SystemBoot"] = "system.boot";
42
42
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -100,6 +100,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
100
100
  * consumes this category and maps it to the `addon-crash-loop` kind.
101
101
  */
102
102
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
103
+ /**
104
+ * A runner whose addon refused to start with a typed reason (D877) - parked
105
+ * in `refused`, never counted by the crash breaker, retried on operator
106
+ * action. One event per refusal.
107
+ */
108
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
109
+ /**
110
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
111
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
112
+ * runner is still pending) and the alert centre (close a recovered runner).
113
+ */
114
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
115
+ /**
116
+ * The node's one-shot runner boot check (D877): planned runners against the
117
+ * process service, `degraded` when any is failed, refused or missing. The
118
+ * alert centre turns it into one alert and a direct critical push.
119
+ */
120
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
103
121
  EventCategory["AddonError"] = "addon.error";
104
122
  EventCategory["AddonPageReady"] = "addon.page-ready";
105
123
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -5424,7 +5442,7 @@ var ZodIssueCode = {
5424
5442
  var ZodFirstPartyTypeKind;
5425
5443
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5426
5444
  //#endregion
5427
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5445
+ //#region ../types/dist/sleep-BOjuyoPC.mjs
5428
5446
  /**
5429
5447
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5430
5448
  * window to float samples (D455).
@@ -5541,7 +5559,7 @@ function isKeychainStoredField(field) {
5541
5559
  var SECRET_CLEAR = { $secretClear: true };
5542
5560
  /** The `'***'` token D634 redaction writes for non-admins. */
5543
5561
  var LEGACY_DEVICE_REDACTION = "***";
5544
- function isRecord$2(value) {
5562
+ function isRecord$5(value) {
5545
5563
  return typeof value === "object" && value !== null && !Array.isArray(value);
5546
5564
  }
5547
5565
  function makeSecretMarker(ref) {
@@ -5552,16 +5570,16 @@ function makeSecretMarker(ref) {
5552
5570
  }
5553
5571
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5554
5572
  function isSecretMarker(value) {
5555
- if (!isRecord$2(value)) return false;
5573
+ if (!isRecord$5(value)) return false;
5556
5574
  const ref = value["$secret"];
5557
5575
  return typeof ref === "string" && ref.length > 0;
5558
5576
  }
5559
5577
  /** Anything carrying a `$secret` key — a stored marker or a UI view of one. */
5560
5578
  function isSecretMarkerLike(value) {
5561
- return isRecord$2(value) && Object.prototype.hasOwnProperty.call(value, "$secret");
5579
+ return isRecord$5(value) && Object.prototype.hasOwnProperty.call(value, "$secret");
5562
5580
  }
5563
5581
  function isSecretClear(value) {
5564
- return isRecord$2(value) && value["$secretClear"] === true;
5582
+ return isRecord$5(value) && value["$secretClear"] === true;
5565
5583
  }
5566
5584
  /**
5567
5585
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6171,7 +6189,7 @@ var KeychainWriteRefusedError = class extends Error {
6171
6189
  }
6172
6190
  };
6173
6191
  var KEEP = { kind: "keep" };
6174
- function isRecord$1(value) {
6192
+ function isRecord$4(value) {
6175
6193
  return typeof value === "object" && value !== null && !Array.isArray(value);
6176
6194
  }
6177
6195
  function defaultMintId() {
@@ -6184,7 +6202,7 @@ function collectSecretMarkerRefs(value, out = []) {
6184
6202
  return out;
6185
6203
  }
6186
6204
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6187
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6205
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6188
6206
  return out;
6189
6207
  }
6190
6208
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6239,7 +6257,7 @@ function rowId(row, idKey) {
6239
6257
  return null;
6240
6258
  }
6241
6259
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6242
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6260
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6243
6261
  if (!Array.isArray(incoming)) {
6244
6262
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6245
6263
  return {
@@ -6255,7 +6273,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6255
6273
  const kept = /* @__PURE__ */ new Set();
6256
6274
  const rows = [];
6257
6275
  for (const row of incoming) {
6258
- if (!isRecord$1(row)) {
6276
+ if (!isRecord$4(row)) {
6259
6277
  rows.push(row);
6260
6278
  continue;
6261
6279
  }
@@ -6280,7 +6298,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6280
6298
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6281
6299
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6282
6300
  case "object": {
6283
- if (!isRecord$1(incoming)) {
6301
+ if (!isRecord$4(incoming)) {
6284
6302
  if (incoming === void 0) return KEEP;
6285
6303
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6286
6304
  return {
@@ -6288,7 +6306,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6288
6306
  value: incoming
6289
6307
  };
6290
6308
  }
6291
- const storedObj = isRecord$1(stored) ? stored : {};
6309
+ const storedObj = isRecord$4(stored) ? stored : {};
6292
6310
  return {
6293
6311
  kind: "value",
6294
6312
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6411,7 +6429,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6411
6429
  value: items
6412
6430
  };
6413
6431
  }
6414
- if (isRecord$1(v)) {
6432
+ if (isRecord$4(v)) {
6415
6433
  const out = {};
6416
6434
  for (const [k, child] of Object.entries(v)) {
6417
6435
  const s = substitute(child);
@@ -6679,7 +6697,6 @@ function createHandle(raw, opts) {
6679
6697
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6680
6698
  const readAddonStoreResult = raw.readAddonStoreResult;
6681
6699
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6682
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6683
6700
  const overrides = {
6684
6701
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6685
6702
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6703,12 +6720,12 @@ function createHandle(raw, opts) {
6703
6720
  };
6704
6721
  } } : {},
6705
6722
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6706
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6707
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6723
+ readDeviceStoreBatch: async (deviceIds) => {
6724
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6708
6725
  const out = /* @__PURE__ */ new Map();
6709
6726
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6710
6727
  return out;
6711
- } } : {},
6728
+ },
6712
6729
  writeAddonStore: async (patch) => {
6713
6730
  await writeAddon(patch);
6714
6731
  },
@@ -7335,7 +7352,7 @@ var BaseAddon = class {
7335
7352
  if (!ctx) return;
7336
7353
  const addonId = ctx.id;
7337
7354
  setImmediate(() => {
7338
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7355
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7339
7356
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7340
7357
  }).catch((err) => {
7341
7358
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7535,7 +7552,7 @@ var BaseAddon = class {
7535
7552
  return this._addonSecretTree;
7536
7553
  }
7537
7554
  deviceSecretTree() {
7538
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7555
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7539
7556
  return this._deviceSecretTree;
7540
7557
  }
7541
7558
  /**
@@ -7611,42 +7628,135 @@ var BaseAddon = class {
7611
7628
  this[timerOf] = timer;
7612
7629
  }
7613
7630
  /**
7614
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7615
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7616
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7617
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7631
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7632
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7618
7633
  * addon permanently broken.
7619
7634
  *
7620
- * Retry only the two known infra fingerprints. Anything else propagates so
7621
- * real bugs surface immediately. After the budget expires we fall back to
7622
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7635
+ * Two kinds of outage, two budgets:
7636
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7637
+ * initialized`, `provider not available`): a short budget, then the addon
7638
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7639
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7640
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7641
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7642
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7643
+ * loop. A long, bounded budget; only after it the error propagates - the
7644
+ * addon never runs on defaults for a store it could not ask.
7645
+ * Anything else propagates immediately so real bugs surface.
7623
7646
  */
7624
7647
  async readAddonStoreWithRetry() {
7625
7648
  const settings = this.rawSettings();
7626
7649
  if (!settings) return {};
7627
- const delaysMs = [
7628
- 150,
7629
- 350,
7630
- 600,
7631
- 900
7632
- ];
7633
7650
  let lastErr;
7634
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7651
+ for (let attempt = 0;; attempt++) try {
7635
7652
  const stored = await settings.readAddonStore() ?? {};
7636
7653
  this.settingsStoreReady = true;
7637
7654
  return stored;
7638
7655
  } catch (err) {
7639
7656
  lastErr = err;
7640
- const msg = err instanceof Error ? err.message : String(err);
7641
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7642
- if (attempt === delaysMs.length) break;
7643
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7657
+ const kind = classifyStoreError(err);
7658
+ if (kind === "permanent") throw err;
7659
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7660
+ if (delay === void 0) {
7661
+ if (kind === "transport") throw err;
7662
+ break;
7663
+ }
7664
+ await new Promise((r) => setTimeout(r, delay));
7644
7665
  }
7645
7666
  this.settingsStoreReady = false;
7646
7667
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7647
7668
  return {};
7648
7669
  }
7649
7670
  };
7671
+ /** The settings store's own restart fingerprints. */
7672
+ var RESTART_RETRY_DELAYS_MS = [
7673
+ 150,
7674
+ 350,
7675
+ 600,
7676
+ 900
7677
+ ];
7678
+ /** A hub restarting under a booting runner: ~100 s in total. */
7679
+ var TRANSPORT_RETRY_DELAYS_MS = [
7680
+ 150,
7681
+ 350,
7682
+ 600,
7683
+ 900,
7684
+ 2e3,
7685
+ 5e3,
7686
+ 1e4,
7687
+ 2e4,
7688
+ 3e4,
7689
+ 3e4
7690
+ ];
7691
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7692
+ /** Node / socket error codes of a connection that did not happen or broke. */
7693
+ var TRANSPORT_CODES = new Set([
7694
+ "ECONNREFUSED",
7695
+ "ECONNRESET",
7696
+ "ETIMEDOUT",
7697
+ "EPIPE",
7698
+ "EHOSTUNREACH",
7699
+ "ENETUNREACH"
7700
+ ]);
7701
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7702
+ var UNAVAILABLE_TRPC_CODES = new Set([
7703
+ "TIMEOUT",
7704
+ "SERVICE_UNAVAILABLE",
7705
+ "BAD_GATEWAY",
7706
+ "GATEWAY_TIMEOUT"
7707
+ ]);
7708
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7709
+ var TRANSPORT_PHRASES = [
7710
+ "discovery deadline exceeded",
7711
+ "parent could not route child unowned cap call",
7712
+ "UDS request timed out after",
7713
+ "channel closed"
7714
+ ];
7715
+ /** Moleculer error `type`s of a call that could not be served right now. */
7716
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7717
+ "REQUEST_TIMEOUT",
7718
+ "SERVICE_NOT_FOUND",
7719
+ "SERVICE_NOT_AVAILABLE",
7720
+ "REQUEST_REJECTED",
7721
+ "BROKER_DISCONNECTED"
7722
+ ]);
7723
+ function stringProp(value, key) {
7724
+ if (typeof value !== "object" || value === null) return void 0;
7725
+ const found = Reflect.get(value, key);
7726
+ return typeof found === "string" ? found : void 0;
7727
+ }
7728
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7729
+ function errorCode(err) {
7730
+ const out = {};
7731
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7732
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7733
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7734
+ if (node !== void 0) out.node = node;
7735
+ const trpc = stringProp(data, "code");
7736
+ if (trpc !== void 0) out.trpc = trpc;
7737
+ return out;
7738
+ }
7739
+ /**
7740
+ * Is a settings read failure worth retrying, and with which budget? Only
7741
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7742
+ * one of the exact phrases our own transport raises. A message that merely
7743
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7744
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7745
+ */
7746
+ function classifyStoreError(err) {
7747
+ const message = err instanceof Error ? err.message : String(err);
7748
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7749
+ const code = errorCode(err);
7750
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7751
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7752
+ if (typeof err === "object" && err !== null) {
7753
+ if (Reflect.get(err, "retryable") === true) return "transport";
7754
+ const type = stringProp(err, "type");
7755
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7756
+ }
7757
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7758
+ return "permanent";
7759
+ }
7650
7760
  /**
7651
7761
  * Collect the keys of every field marked `perNode: true`, recursing into
7652
7762
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7736,6 +7846,156 @@ var PeerBytesTicketSchema = object({
7736
7846
  */
7737
7847
  declaredBytes: number().int().nonnegative().nullable()
7738
7848
  });
7849
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7850
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7851
+ var RECORD_DATABASES = ["settings", "events"];
7852
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7853
+ var RECORD_CLASSES = [
7854
+ "config",
7855
+ "ledger",
7856
+ "audit",
7857
+ "mirror",
7858
+ "ephemeral"
7859
+ ];
7860
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7861
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7862
+ var RECORD_BATCH_MAX = 1e3;
7863
+ var RECORD_QUERY_MAX = 1e3;
7864
+ function defOf(schema) {
7865
+ const zodBag = Reflect.get(schema, "_zod");
7866
+ if (typeof zodBag !== "object" || zodBag === null) return {};
7867
+ const def = Reflect.get(zodBag, "def");
7868
+ if (typeof def !== "object" || def === null) return {};
7869
+ return def;
7870
+ }
7871
+ function declaredHere(schema) {
7872
+ return globalRegistry.get(schema)?.secret === true;
7873
+ }
7874
+ /** Wrapper kinds whose `innerType` is the field itself. */
7875
+ var WRAPPERS = new Set([
7876
+ "optional",
7877
+ "nullable",
7878
+ "default",
7879
+ "prefault",
7880
+ "catch",
7881
+ "readonly",
7882
+ "nonoptional"
7883
+ ]);
7884
+ /**
7885
+ * The schema layers that make up ONE field: the schema itself and every
7886
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
7887
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
7888
+ * `.transform` on `in`).
7889
+ */
7890
+ function layersOf(schema) {
7891
+ const out = [];
7892
+ const queue = [schema];
7893
+ while (queue.length > 0) {
7894
+ const s = queue.shift();
7895
+ if (!s || out.includes(s)) continue;
7896
+ out.push(s);
7897
+ const def = defOf(s);
7898
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
7899
+ if (def.type === "pipe") {
7900
+ if (def.in) queue.push(def.in);
7901
+ if (def.out) queue.push(def.out);
7902
+ }
7903
+ }
7904
+ return out;
7905
+ }
7906
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
7907
+ function isZodSecret(schema) {
7908
+ return layersOf(schema).some(declaredHere);
7909
+ }
7910
+ /**
7911
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
7912
+ * element of this array" (`connection.password`, `rows[].token`). A declared
7913
+ * object or array is reported as one path and not descended into — everything
7914
+ * under it is secret.
7915
+ */
7916
+ function collectZodSecretPaths(schema, prefix = "") {
7917
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
7918
+ const paths = [];
7919
+ for (const layer of layersOf(schema)) {
7920
+ const def = defOf(layer);
7921
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
7922
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
7923
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
7924
+ else if (def.type === "intersection") {
7925
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
7926
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
7927
+ }
7928
+ }
7929
+ return [...new Set(paths)];
7930
+ }
7931
+ /**
7932
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
7933
+ * Zod row schema that describes it, and the helper that turns the two into the
7934
+ * JSON the engine stores.
7935
+ *
7936
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
7937
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
7938
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
7939
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
7940
+ * never a field name (D879).
7941
+ */
7942
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
7943
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
7944
+ var RecordIndexSchema = object({
7945
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
7946
+ fields: array(RecordFieldPathSchema).min(1).max(4),
7947
+ unique: boolean().optional()
7948
+ }).strict();
7949
+ var RecordRetentionSchema = union([
7950
+ object({
7951
+ ttlMs: number().int().positive(),
7952
+ from: _enum(["at", "write"])
7953
+ }).strict(),
7954
+ object({
7955
+ maxRows: number().int().positive().optional(),
7956
+ maxRowsPerDevice: number().int().positive().optional()
7957
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
7958
+ object({
7959
+ owner: string().min(1),
7960
+ reason: string().min(1)
7961
+ }).strict(),
7962
+ object({ none: string().min(1) }).strict()
7963
+ ]);
7964
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
7965
+ var EntryDescriptorSchema = object({
7966
+ title: string().min(1),
7967
+ /** The record body field shown as the entry's name. */
7968
+ nameField: string().min(1),
7969
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
7970
+ fields: record(string(), unknown())
7971
+ }).strict();
7972
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
7973
+ var RecordKindDeclarationSchema = object({
7974
+ database: _enum(RECORD_DATABASES).default("settings"),
7975
+ class: _enum(RECORD_CLASSES),
7976
+ writeTrigger: string().min(1),
7977
+ device: _enum([
7978
+ "required",
7979
+ "optional",
7980
+ "none"
7981
+ ]).default("none"),
7982
+ at: _enum(["required", "none"]).default("none"),
7983
+ indexes: array(RecordIndexSchema).max(8).default([]),
7984
+ retention: RecordRetentionSchema,
7985
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
7986
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
7987
+ /** Derived from the Zod schema; never written by hand. */
7988
+ secretPaths: array(string().min(1)).default([]),
7989
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
7990
+ secretArrayKeys: record(string(), string()).default({}),
7991
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
7992
+ adoptsFrom: string().min(1).optional(),
7993
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
7994
+ transactFamily: string().min(1).optional(),
7995
+ entry: EntryDescriptorSchema.optional()
7996
+ }).strict();
7997
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
7998
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
7739
7999
  /** Shared Zod schemas used across streaming capabilities. */
7740
8000
  var CamProfileSchema = _enum([
7741
8001
  "high",
@@ -8234,69 +8494,6 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8234
8494
  kind: "mutation",
8235
8495
  auth: "admin"
8236
8496
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
8237
- function defOf(schema) {
8238
- return schema._zod?.def ?? {};
8239
- }
8240
- function declaredHere(schema) {
8241
- return globalRegistry.get(schema)?.secret === true;
8242
- }
8243
- /** Wrapper kinds whose `innerType` is the field itself. */
8244
- var WRAPPERS = new Set([
8245
- "optional",
8246
- "nullable",
8247
- "default",
8248
- "prefault",
8249
- "catch",
8250
- "readonly",
8251
- "nonoptional"
8252
- ]);
8253
- /**
8254
- * The schema layers that make up ONE field: the schema itself and every
8255
- * wrapper below it (optional / default / nullable / readonly / catch), plus
8256
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8257
- * `.transform` on `in`).
8258
- */
8259
- function layersOf(schema) {
8260
- const out = [];
8261
- const queue = [schema];
8262
- while (queue.length > 0) {
8263
- const s = queue.shift();
8264
- if (!s || out.includes(s)) continue;
8265
- out.push(s);
8266
- const def = defOf(s);
8267
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8268
- if (def.type === "pipe") {
8269
- if (def.in) queue.push(def.in);
8270
- if (def.out) queue.push(def.out);
8271
- }
8272
- }
8273
- return out;
8274
- }
8275
- /** True when any layer of this field declares `.meta({ secret: true })`. */
8276
- function isZodSecret(schema) {
8277
- return layersOf(schema).some(declaredHere);
8278
- }
8279
- /**
8280
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
8281
- * element of this array" (`connection.password`, `rows[].token`). A declared
8282
- * object or array is reported as one path and not descended into — everything
8283
- * under it is secret.
8284
- */
8285
- function collectZodSecretPaths(schema, prefix = "") {
8286
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8287
- const paths = [];
8288
- for (const layer of layersOf(schema)) {
8289
- const def = defOf(layer);
8290
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8291
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8292
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8293
- else if (def.type === "intersection") {
8294
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8295
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8296
- }
8297
- }
8298
- return [...new Set(paths)];
8299
- }
8300
8497
  object({
8301
8498
  code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
8302
8499
  params: record(string(), union([string(), number()])).optional()
@@ -8340,7 +8537,7 @@ function sleep$2(ms) {
8340
8537
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
8341
8538
  }
8342
8539
  //#endregion
8343
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8540
+ //#region ../types/dist/err-msg-BXKzRBwg.mjs
8344
8541
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8345
8542
  DeviceType["Camera"] = "camera";
8346
8543
  DeviceType["Hub"] = "hub";
@@ -8432,6 +8629,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
8432
8629
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
8433
8630
  * integrations sharing the same food/desiccant/hopper surface. */
8434
8631
  DeviceType["PetFeeder"] = "pet-feeder";
8632
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
8633
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
8634
+ * Sources: native Bosch Home Connect, reusable by similar integrations. */
8635
+ DeviceType["Dishwasher"] = "dishwasher";
8435
8636
  return DeviceType;
8436
8637
  }({});
8437
8638
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -8609,6 +8810,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8609
8810
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8610
8811
  * real Switch device for UI rendering / export adapters. */
8611
8812
  DeviceRole["BinaryHelper"] = "binary-helper";
8813
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
8814
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
8815
+ DeviceRole["Outlet"] = "outlet";
8612
8816
  /** Generic motion / occupancy / moving event source. Distinct from
8613
8817
  * the camera accessory PirSensor role: that one is a camera child;
8614
8818
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8676,7 +8880,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8676
8880
  return DeviceRole;
8677
8881
  }({});
8678
8882
  //#endregion
8679
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
8883
+ //#region ../types/dist/composition-CB6PMT9p.mjs
8680
8884
  /**
8681
8885
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8682
8886
  *
@@ -12432,11 +12636,10 @@ var ClipModelMetaSchema = object({
12432
12636
  /**
12433
12637
  * The `vector-store` index this model's vectors live in. ONE feature space
12434
12638
  * per index: two models share an index only when their vectors are ranked
12435
- * against each other, which for CLIP means never across families. MobileCLIP
12436
- * S1 and S2 share `object-clip` for history (separated by the row's
12437
- * `modelId`); any other model gets its own.
12639
+ * against each other, which for CLIP means never across families. Every
12640
+ * model gets its own.
12438
12641
  */
12439
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12642
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
12440
12643
  /**
12441
12644
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
12442
12645
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -13615,8 +13818,13 @@ var AlertSeveritySchema = _enum([
13615
13818
  "info",
13616
13819
  "success",
13617
13820
  "warning",
13618
- "error"
13821
+ "error",
13822
+ "critical"
13619
13823
  ]);
13824
+ var AlertActionSchema = object({
13825
+ label: string(),
13826
+ href: string().optional()
13827
+ });
13620
13828
  var AlertStatusSchema = _enum([
13621
13829
  "active",
13622
13830
  "in-progress",
@@ -13634,6 +13842,7 @@ var AlertSchema = object({
13634
13842
  severity: AlertSeveritySchema,
13635
13843
  title: string(),
13636
13844
  message: string(),
13845
+ action: AlertActionSchema.optional(),
13637
13846
  status: AlertStatusSchema,
13638
13847
  progress: number().optional(),
13639
13848
  read: boolean(),
@@ -16169,6 +16378,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
16169
16378
  keyField: string()
16170
16379
  }).optional()
16171
16380
  })) });
16381
+ /**
16382
+ * The report of a one-shot "move this owner's plaintext secrets into the
16383
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
16384
+ *
16385
+ * The owner runs it on its own rows, through its own write path; an operator
16386
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
16387
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
16388
+ */
16389
+ var RawSecretMigrationInputSchema = object({
16390
+ /** `false` (the default of the script) = report only. */
16391
+ apply: boolean() });
16392
+ var RawSecretMigrationReportSchema = object({
16393
+ apply: boolean(),
16394
+ /** Rows that can carry a secret (a profile, an enrolment). */
16395
+ rows: number().int(),
16396
+ /** Rows whose secret was plaintext when the run started. */
16397
+ raw: number().int(),
16398
+ /** Rows that already held a keychain marker when the run started. */
16399
+ markers: number().int(),
16400
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
16401
+ migrated: number().int(),
16402
+ /** Plaintext rows left in place because the move or its read-back failed. */
16403
+ failed: number().int(),
16404
+ /** After the run: rows still holding plaintext. */
16405
+ remainingRaw: number().int(),
16406
+ /** After the run: markers the keychain could not resolve right now. */
16407
+ unresolvedMarkers: number().int(),
16408
+ /**
16409
+ * A second, redundant copy of the secrets' rows that the run found (and, on
16410
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
16411
+ */
16412
+ redundantCopies: number().int().optional(),
16413
+ /** True when nothing is raw and every marker resolves. */
16414
+ verified: boolean()
16415
+ });
16172
16416
  /** Where a block runs. The operator chooses — a block driving a device on an
16173
16417
  * agent is the reason placement is not fixed to the hub. */
16174
16418
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -16395,6 +16639,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
16395
16639
  }), SettingsUpdateResultSchema, {
16396
16640
  kind: "mutation",
16397
16641
  auth: "admin"
16642
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16643
+ kind: "mutation",
16644
+ auth: "admin"
16398
16645
  }), method(object({}), object({ libs: array(object({
16399
16646
  filePath: string(),
16400
16647
  content: string()
@@ -16658,6 +16905,347 @@ id: union([string(), number()]) }), {
16658
16905
  auth: "admin"
16659
16906
  });
16660
16907
  /**
16908
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16909
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16910
+ * (operator intent, D870) and device-history (numbers over time, D850).
16911
+ *
16912
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16913
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16914
+ * that with the addon id closed over). It is deliberately NOT in any input
16915
+ * schema, so a session can never supply it, and a call with no stamp is refused
16916
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16917
+ * addons go through the owner's capability.
16918
+ *
16919
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16920
+ * never `[]`. Secret fields are never on the wire: a read shows the
16921
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16922
+ * resolves itself, and a write may carry only a keychain marker bound to the
16923
+ * row's own ref.
16924
+ *
16925
+ * Internal: addons reach it through `ctx.records`, never directly.
16926
+ */
16927
+ var RecordIdSchema = string().min(1).max(256);
16928
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16929
+ var RecordBodySchema = record(string(), unknown());
16930
+ var RecordInputSchema = object({
16931
+ id: RecordIdSchema,
16932
+ /** The device this row belongs to (D865 removal, per-device reads). */
16933
+ deviceId: number().int().optional(),
16934
+ /** The domain clock, ms: observed / created / opened. */
16935
+ at: number().int().optional(),
16936
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16937
+ expiresAt: number().int().optional(),
16938
+ data: RecordBodySchema
16939
+ });
16940
+ var RecordViewSchema = object({
16941
+ id: string(),
16942
+ deviceId: number().int().nullable(),
16943
+ at: number().nullable(),
16944
+ expiresAt: number().nullable(),
16945
+ rev: number().int(),
16946
+ updatedAt: number(),
16947
+ data: RecordBodySchema
16948
+ });
16949
+ /** Declared index fields only. Anything else does not compile, by design. */
16950
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16951
+ string(),
16952
+ number(),
16953
+ boolean(),
16954
+ object({ in: array(union([
16955
+ string(),
16956
+ number(),
16957
+ boolean()
16958
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16959
+ object({
16960
+ gt: union([string(), number()]).optional(),
16961
+ gte: union([string(), number()]).optional(),
16962
+ lt: union([string(), number()]).optional(),
16963
+ lte: union([string(), number()]).optional()
16964
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16965
+ ]));
16966
+ var KindShape = { kind: RecordKindNameSchema };
16967
+ var TimeWindowShape = {
16968
+ deviceId: number().int().optional(),
16969
+ atFrom: number().optional(),
16970
+ atTo: number().optional()
16971
+ };
16972
+ var RecordQueryInputSchema = object({
16973
+ ...KindShape,
16974
+ ...TimeWindowShape,
16975
+ where: RecordWhereSchema.optional(),
16976
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16977
+ order: _enum(["at", "id"]).optional(),
16978
+ desc: boolean().optional(),
16979
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16980
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16981
+ cursor: string().min(1).optional()
16982
+ });
16983
+ var RecordQueryResultSchema = object({
16984
+ records: array(RecordViewSchema),
16985
+ nextCursor: string().nullable()
16986
+ });
16987
+ var RecordKindStateSchema = _enum([
16988
+ "created",
16989
+ "unchanged",
16990
+ "updated"
16991
+ ]);
16992
+ var DeclareKindResultSchema = object({
16993
+ kindId: number().int(),
16994
+ state: RecordKindStateSchema,
16995
+ createdIndexes: array(string()),
16996
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16997
+ adoptionPending: object({
16998
+ legacyTable: string(),
16999
+ legacyRows: number().int()
17000
+ }).nullable()
17001
+ });
17002
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
17003
+ var SecretRefsList = array(string());
17004
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
17005
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
17006
+ kind: "mutation",
17007
+ auth: "admin"
17008
+ }), method(object({
17009
+ ...KindShape,
17010
+ id: RecordIdSchema
17011
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
17012
+ ...KindShape,
17013
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
17014
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
17015
+ ...KindShape,
17016
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
17017
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
17018
+ ...KindShape,
17019
+ record: RecordInputSchema,
17020
+ /** Compare-and-set. `0` means "the row must not exist". */
17021
+ ifRev: number().int().min(0).optional()
17022
+ }), object({
17023
+ rev: number().int(),
17024
+ releasedRefs: SecretRefsList
17025
+ }), {
17026
+ kind: "mutation",
17027
+ auth: "admin"
17028
+ }), method(object({
17029
+ ...KindShape,
17030
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
17031
+ }), object({
17032
+ count: number().int(),
17033
+ releasedRefs: SecretRefsList
17034
+ }), {
17035
+ kind: "mutation",
17036
+ auth: "admin"
17037
+ }), method(object({
17038
+ ...KindShape,
17039
+ id: RecordIdSchema,
17040
+ data: RecordBodySchema,
17041
+ at: number().int().nullable().optional(),
17042
+ expiresAt: number().int().nullable().optional(),
17043
+ ifRev: number().int().min(1).optional()
17044
+ }), object({
17045
+ rev: number().int(),
17046
+ releasedRefs: SecretRefsList
17047
+ }), {
17048
+ kind: "mutation",
17049
+ auth: "admin"
17050
+ }), method(object({
17051
+ ...KindShape,
17052
+ id: RecordIdSchema
17053
+ }), object({
17054
+ deleted: boolean(),
17055
+ secretRefs: SecretRefsList
17056
+ }), {
17057
+ kind: "mutation",
17058
+ auth: "admin"
17059
+ }), method(object({
17060
+ ...KindShape,
17061
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
17062
+ }), object({
17063
+ deleted: number().int(),
17064
+ secretRefs: SecretRefsList
17065
+ }), {
17066
+ kind: "mutation",
17067
+ auth: "admin"
17068
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
17069
+ ...KindShape,
17070
+ ...TimeWindowShape,
17071
+ where: RecordWhereSchema.optional()
17072
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
17073
+ ...KindShape,
17074
+ deviceId: number().int().optional(),
17075
+ from: number(),
17076
+ to: number(),
17077
+ bucketMs: number().int().positive()
17078
+ }), object({ buckets: array(object({
17079
+ bucketStart: number(),
17080
+ count: number().int()
17081
+ })) }), { auth: "admin" }), method(object({
17082
+ ...KindShape,
17083
+ op: _enum([
17084
+ "sum",
17085
+ "min",
17086
+ "max",
17087
+ "count"
17088
+ ]),
17089
+ field: RecordFieldPathSchema.optional(),
17090
+ groupBy: RecordFieldPathSchema.optional(),
17091
+ where: RecordWhereSchema.optional()
17092
+ }), object({ rows: array(object({
17093
+ group: union([
17094
+ string(),
17095
+ number(),
17096
+ _null()
17097
+ ]),
17098
+ value: number().nullable()
17099
+ })) }), { auth: "admin" }), method(object({
17100
+ ...KindShape,
17101
+ deviceId: number().int().optional(),
17102
+ atBefore: number().optional(),
17103
+ where: RecordWhereSchema.optional()
17104
+ }), object({
17105
+ deleted: number().int(),
17106
+ secretRefs: SecretRefsList
17107
+ }), {
17108
+ kind: "mutation",
17109
+ auth: "admin"
17110
+ }), method(object({
17111
+ deviceId: number().int(),
17112
+ kinds: array(RecordKindNameSchema).optional()
17113
+ }), object({
17114
+ deleted: record(string(), number().int()),
17115
+ secretRefs: SecretRefsList
17116
+ }), {
17117
+ kind: "mutation",
17118
+ auth: "admin"
17119
+ }), method(object(KindShape), object({ id: number().int() }), {
17120
+ kind: "mutation",
17121
+ auth: "admin"
17122
+ });
17123
+ /** One table of the settings database. */
17124
+ var StorageTableSchema = object({
17125
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
17126
+ name: string(),
17127
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
17128
+ owner: string().nullable(),
17129
+ rows: number().int().nonnegative(),
17130
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
17131
+ bytes: number().int().nonnegative().nullable(),
17132
+ /** Declared by an addon since this engine process started (a running addon claims it). */
17133
+ declaredThisBoot: boolean()
17134
+ });
17135
+ /** One declared record kind (D881) as System -> Data shows it. */
17136
+ var StorageKindSchema = object({
17137
+ owner: string(),
17138
+ kind: string(),
17139
+ database: _enum(["settings", "events"]),
17140
+ class: string(),
17141
+ state: _enum([
17142
+ "declared",
17143
+ "orphaned",
17144
+ "dropped"
17145
+ ]),
17146
+ /** `null` when the caller asked for no counts (`counts: false`). */
17147
+ rows: number().int().nonnegative().nullable(),
17148
+ /** Rows x the average size of a sample; null for an empty kind. */
17149
+ bytesEstimate: number().int().nonnegative().nullable(),
17150
+ writeTrigger: string(),
17151
+ retention: RecordRetentionSchema,
17152
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
17153
+ entry: boolean(),
17154
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
17155
+ declaration: RecordKindDeclarationSchema
17156
+ });
17157
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
17158
+ collection: string().min(1),
17159
+ expectRows: number().int().nonnegative()
17160
+ }), object({
17161
+ dropped: literal(true),
17162
+ rows: number().int().nonnegative()
17163
+ }), {
17164
+ kind: "mutation",
17165
+ auth: "admin"
17166
+ }), method(object({
17167
+ owner: string().min(1).optional(),
17168
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
17169
+ counts: boolean().optional()
17170
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
17171
+ owner: string().min(1),
17172
+ kind: RecordKindNameSchema
17173
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
17174
+ owner: string().min(1),
17175
+ kind: RecordKindNameSchema,
17176
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
17177
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
17178
+ complete: boolean().optional()
17179
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
17180
+ kind: "mutation",
17181
+ auth: "admin"
17182
+ }), method(object({
17183
+ collection: string().min(1),
17184
+ cursor: string().optional(),
17185
+ limit: number().int().min(1).max(1e3).optional()
17186
+ }), object({
17187
+ rows: array(object({
17188
+ id: string(),
17189
+ data: record(string(), unknown())
17190
+ })),
17191
+ nextCursor: string().nullable()
17192
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
17193
+ /**
17194
+ * record-entries - the ONE admin surface for every list of user-created entries
17195
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
17196
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
17197
+ *
17198
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
17199
+ * the entry body with `secret: true` on every credential field, so a password
17200
+ * field is derived from the schema and never from a name. `putEntry` takes the
17201
+ * redaction token for an untouched secret (the stored value is kept), a string
17202
+ * for a new one, and the clear instruction to remove one. A read never carries
17203
+ * a secret value, and a locked keychain refuses the write with
17204
+ * `records/secret-unavailable` instead of storing plaintext.
17205
+ *
17206
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
17207
+ */
17208
+ var EntryKindInfoSchema = object({
17209
+ owner: string(),
17210
+ kind: RecordKindNameSchema,
17211
+ title: string(),
17212
+ nameField: string(),
17213
+ /** JSON Schema of the body; `secret: true` marks a password field. */
17214
+ fields: record(string(), unknown()),
17215
+ secretPaths: array(string()),
17216
+ rows: number().int().nonnegative()
17217
+ });
17218
+ var EntryViewSchema = object({
17219
+ id: RecordIdSchema,
17220
+ name: string(),
17221
+ rev: number().int(),
17222
+ updatedAt: number(),
17223
+ /** Secret fields hold the redaction token. */
17224
+ data: RecordBodySchema
17225
+ });
17226
+ var EntryAddress = {
17227
+ owner: string().min(1),
17228
+ kind: RecordKindNameSchema
17229
+ };
17230
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
17231
+ ...EntryAddress,
17232
+ id: RecordIdSchema.optional(),
17233
+ data: RecordBodySchema,
17234
+ ifRev: number().int().min(1).optional()
17235
+ }), object({
17236
+ id: string(),
17237
+ rev: number().int()
17238
+ }), {
17239
+ kind: "mutation",
17240
+ auth: "admin"
17241
+ }), method(object({
17242
+ ...EntryAddress,
17243
+ id: RecordIdSchema
17244
+ }), object({ deleted: boolean() }), {
17245
+ kind: "mutation",
17246
+ auth: "admin"
17247
+ });
17248
+ /**
16661
17249
  * `keychain` — the hub's encrypted store of secret values (D787).
16662
17250
  *
16663
17251
  * Settings blobs never hold a secret: they hold a marker
@@ -17198,6 +17786,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
17198
17786
  kind: "mutation",
17199
17787
  auth: "admin",
17200
17788
  caller: "required"
17789
+ }), method(object({
17790
+ ref: string().min(1),
17791
+ value: string().min(1)
17792
+ }), object({
17793
+ ref: string(),
17794
+ version: number().int()
17795
+ }), {
17796
+ kind: "mutation",
17797
+ auth: "admin",
17798
+ caller: "required"
17201
17799
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
17202
17800
  deleted: array(string()).readonly(),
17203
17801
  kept: array(object({
@@ -39991,6 +40589,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39991
40589
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39992
40590
  kind: "mutation",
39993
40591
  auth: "admin"
40592
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
40593
+ kind: "mutation",
40594
+ auth: "admin"
39994
40595
  }), method(ProfileRefInputSchema, _void(), {
39995
40596
  kind: "mutation",
39996
40597
  auth: "admin"
@@ -50521,6 +51122,41 @@ var ServerRollbackInfoSchema = object({
50521
51122
  atMs: number(),
50522
51123
  reason: string()
50523
51124
  });
51125
+ /**
51126
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
51127
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
51128
+ * service holds, because only the hub plans) against the states the process
51129
+ * service reports. Kept in memory, recomputed by the same one-shot check after
51130
+ * every boot, served on `getServerPackageStatus`.
51131
+ *
51132
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
51133
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
51134
+ * planned runner the process service has no entry for.
51135
+ */
51136
+ var RunnerRefusalSchema = object({
51137
+ runnerId: string(),
51138
+ addonIds: array(string()),
51139
+ reason: string()
51140
+ });
51141
+ var RunnerBootCheckSchema = object({
51142
+ checkedAtMs: number(),
51143
+ /** Runners planned for this node. */
51144
+ expected: number(),
51145
+ /** Planned runners whose process is `running`. */
51146
+ running: number(),
51147
+ failed: array(string()),
51148
+ refused: array(RunnerRefusalSchema),
51149
+ missing: array(string()),
51150
+ /**
51151
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
51152
+ * respawn. The check is FINAL only when this is empty; until then nothing is
51153
+ * pushed and the verdict is re-evaluated on the next runner state change.
51154
+ * Optional for version skew (absent = settled).
51155
+ */
51156
+ pending: array(string()).optional(),
51157
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
51158
+ planKnown: boolean()
51159
+ });
50524
51160
  var ServerPackageStatusSchema = object({
50525
51161
  /** Root package name (`@camstack/server` on the hub). */
50526
51162
  packageName: string(),
@@ -50583,7 +51219,14 @@ var ServerPackageStatusSchema = object({
50583
51219
  * for version skew: an older provider's payload simply omits it, and an
50584
51220
  * absent wrapper is unknown — never `native`.
50585
51221
  */
50586
- wrapper: WrapperIdentitySchema.optional()
51222
+ wrapper: WrapperIdentitySchema.optional(),
51223
+ /**
51224
+ * What this node PLANNED to run against what its process service reports
51225
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
51226
+ * on a provider that predates it. Absent is "not checked yet", never "all
51227
+ * well": a consumer that needs the answer treats it as pending.
51228
+ */
51229
+ runners: RunnerBootCheckSchema.optional()
50587
51230
  });
50588
51231
  var ServerUpdateCheckResultSchema = object({
50589
51232
  packageName: string(),
@@ -50634,6 +51277,13 @@ var ServerUpdateOutcomeSchema = _enum([
50634
51277
  "refused",
50635
51278
  "failed"
50636
51279
  ]);
51280
+ /** One addon the pre-flight found the target version would refuse (D877). */
51281
+ var UpdateBlockerSchema = object({
51282
+ addonId: string(),
51283
+ reason: string(),
51284
+ /** What the operator does about it. */
51285
+ remedy: string()
51286
+ });
50637
51287
  var ServerUpdateActionResultSchema = object({
50638
51288
  accepted: boolean(),
50639
51289
  targetVersion: string().nullable(),
@@ -50651,14 +51301,27 @@ var ServerUpdateActionResultSchema = object({
50651
51301
  * The failure itself, verbatim enough to act on (the npm output for a
50652
51302
  * staging install). Non-null only for `failed`.
50653
51303
  */
50654
- error: string().nullable().optional()
51304
+ error: string().nullable().optional(),
51305
+ /**
51306
+ * The addons the target version would refuse to start on this node's live
51307
+ * store (D877), present when the pre-flight refused the update
51308
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
51309
+ */
51310
+ blockers: array(UpdateBlockerSchema).optional()
50655
51311
  });
50656
51312
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
50657
51313
  kind: "mutation",
50658
51314
  auth: "admin"
50659
- }), method(object({
50660
- /** Explicit target version; omitted = latest from the registry. */
50661
- version: string().optional() }), ServerUpdateActionResultSchema, {
51315
+ }), method(object({
51316
+ /** Explicit target version; omitted = latest from the registry. */
51317
+ version: string().optional(),
51318
+ /**
51319
+ * Apply even though the pre-flight (D877) found addons the target would
51320
+ * refuse to start. Off by default: those addons stay down until the
51321
+ * remedy is run, which is the incident this gate exists to prevent.
51322
+ */
51323
+ acknowledgeRefusals: boolean().optional()
51324
+ }), ServerUpdateActionResultSchema, {
50662
51325
  kind: "mutation",
50663
51326
  auth: "admin",
50664
51327
  timeoutMs: 16 * 6e4
@@ -53626,7 +54289,9 @@ var ManifestShapeSchema = object({
53626
54289
  var AddonProcessSchema = object({
53627
54290
  pid: number().optional(),
53628
54291
  mode: string(),
53629
- state: string()
54292
+ state: string(),
54293
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
54294
+ reason: string().optional()
53630
54295
  });
53631
54296
  /**
53632
54297
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -54394,7 +55059,8 @@ var batteryCapability = {
54394
55059
  DeviceType.Button,
54395
55060
  DeviceType.Switch,
54396
55061
  DeviceType.PetFeeder,
54397
- DeviceType.Container
55062
+ DeviceType.Container,
55063
+ DeviceType.Thermostat
54398
55064
  ],
54399
55065
  methods: {
54400
55066
  /**
@@ -55015,6 +55681,12 @@ var ClimateControlStatusSchema = object({
55015
55681
  /** Horizontal louver swing on/off. Null when the device has no
55016
55682
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
55017
55683
  swingHorizontal: boolean().nullable(),
55684
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
55685
+ minTemp: number().nullable().optional(),
55686
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
55687
+ maxTemp: number().nullable().optional(),
55688
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
55689
+ tempStep: number().positive().nullable().optional(),
55018
55690
  /** Ms epoch when the slice was last updated (push or command). */
55019
55691
  lastFetchedAt: number()
55020
55692
  });
@@ -55861,6 +56533,125 @@ onStatusChanged: { data: object({
55861
56533
  * whether persisting is worth a SQLite commit. */
55862
56534
  volatileStateFields: ["lastChangedAt"]
55863
56535
  };
56536
+ /**
56537
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
56538
+ * consumable levels (salt, rinse aid) and common program options.
56539
+ *
56540
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
56541
+ * by any integration that exposes the same program / option surface.
56542
+ *
56543
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
56544
+ * provider refreshes the slice on an interval and eagerly after commands.
56545
+ */
56546
+ var DishwasherStateSchema = _enum([
56547
+ "idle",
56548
+ "running",
56549
+ "paused",
56550
+ "finished",
56551
+ "error",
56552
+ "unavailable"
56553
+ ]);
56554
+ var DishwasherConsumableLevelSchema = _enum([
56555
+ "ok",
56556
+ "low",
56557
+ "empty"
56558
+ ]);
56559
+ var DishwasherStatusSchema = object({
56560
+ state: DishwasherStateSchema,
56561
+ /** Active program id/name, or null when none selected / unknown. */
56562
+ program: string().nullable(),
56563
+ /** Program tokens the hardware accepts — drives the UI selector. */
56564
+ availablePrograms: array(string()),
56565
+ /** Minutes remaining on the active cycle, or null when not running. */
56566
+ remainingMinutes: number().int().nonnegative().nullable(),
56567
+ /** Cycle completion 0..100, or null when not applicable. */
56568
+ progressPercent: number().min(0).max(100).nullable(),
56569
+ /** True when the door is reported open. */
56570
+ doorOpen: boolean(),
56571
+ /** True when remote start is allowed (door closed, power on, etc.). */
56572
+ remoteStartAllowed: boolean(),
56573
+ /** Main power / switched-on state. */
56574
+ powerOn: boolean(),
56575
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
56576
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
56577
+ halfLoad: boolean(),
56578
+ hygienePlus: boolean(),
56579
+ errorCode: number().nullable(),
56580
+ errorLabel: string().nullable(),
56581
+ lastFetchedAt: number()
56582
+ });
56583
+ var dishwasherCapability = {
56584
+ name: "dishwasher",
56585
+ scope: "device",
56586
+ deviceNative: true,
56587
+ mode: "singleton",
56588
+ deviceTypes: [DeviceType.Dishwasher],
56589
+ methods: {
56590
+ start: method(object({ deviceId: number().int().nonnegative() }), _void(), {
56591
+ kind: "mutation",
56592
+ auth: "protected"
56593
+ }),
56594
+ pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
56595
+ kind: "mutation",
56596
+ auth: "protected"
56597
+ }),
56598
+ stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
56599
+ kind: "mutation",
56600
+ auth: "protected"
56601
+ }),
56602
+ setProgram: method(object({
56603
+ deviceId: number().int().nonnegative(),
56604
+ program: string().min(1)
56605
+ }), _void(), {
56606
+ kind: "mutation",
56607
+ auth: "protected"
56608
+ }),
56609
+ setPower: method(object({
56610
+ deviceId: number().int().nonnegative(),
56611
+ on: boolean()
56612
+ }), _void(), {
56613
+ kind: "mutation",
56614
+ auth: "protected"
56615
+ }),
56616
+ setHalfLoad: method(object({
56617
+ deviceId: number().int().nonnegative(),
56618
+ on: boolean()
56619
+ }), _void(), {
56620
+ kind: "mutation",
56621
+ auth: "protected"
56622
+ }),
56623
+ setHygienePlus: method(object({
56624
+ deviceId: number().int().nonnegative(),
56625
+ on: boolean()
56626
+ }), _void(), {
56627
+ kind: "mutation",
56628
+ auth: "protected"
56629
+ }),
56630
+ setOption: method(object({
56631
+ deviceId: number().int().nonnegative(),
56632
+ key: string().min(1),
56633
+ value: union([
56634
+ boolean(),
56635
+ string(),
56636
+ number()
56637
+ ])
56638
+ }), _void(), {
56639
+ kind: "mutation",
56640
+ auth: "protected"
56641
+ })
56642
+ },
56643
+ status: {
56644
+ schema: DishwasherStatusSchema,
56645
+ kind: "poll"
56646
+ },
56647
+ runtimeState: DishwasherStatusSchema,
56648
+ durability: "session",
56649
+ history: { fields: { progressPercent: {
56650
+ kind: "gauge",
56651
+ unit: "%",
56652
+ deadband: 2
56653
+ } } }
56654
+ };
55864
56655
  var DoorbellStatusSchema = object({
55865
56656
  /** Ms epoch of the last press. null = never observed since this provider started. */
55866
56657
  lastPressedAt: number().nullable(),
@@ -56663,6 +57454,32 @@ var gasCapability = {
56663
57454
  * whether persisting is worth a SQLite commit. */
56664
57455
  volatileStateFields: ["lastChangedAt"]
56665
57456
  };
57457
+ var HeatingValveStatusSchema = object({
57458
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
57459
+ position: number().min(0).max(100).nullable(),
57460
+ /** Ms epoch when the slice was last updated (push or poll). */
57461
+ lastFetchedAt: number()
57462
+ });
57463
+ var heatingValveCapability = {
57464
+ name: "heating-valve",
57465
+ scope: "device",
57466
+ deviceNative: true,
57467
+ mode: "singleton",
57468
+ deviceTypes: [DeviceType.Thermostat],
57469
+ methods: {},
57470
+ status: {
57471
+ schema: HeatingValveStatusSchema,
57472
+ kind: "push"
57473
+ },
57474
+ runtimeState: HeatingValveStatusSchema,
57475
+ durability: "session",
57476
+ history: { fields: { position: {
57477
+ kind: "gauge",
57478
+ unit: "%",
57479
+ deadband: 1
57480
+ } } },
57481
+ volatileStateFields: ["lastFetchedAt"]
57482
+ };
56666
57483
  /**
56667
57484
  * Humidifier / dehumidifier cap. Models HA `humidifier.*` entities —
56668
57485
  * an on/off actuator with an optional target-humidity setpoint and an
@@ -57795,7 +58612,19 @@ var TlsStatusSchema = object({
57795
58612
  sans: array(string()),
57796
58613
  caCertPem: string().nullable(),
57797
58614
  reissueError: string().nullable(),
57798
- restartRequired: boolean()
58615
+ restartRequired: boolean(),
58616
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
58617
+ caMissing: boolean(),
58618
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
58619
+ localCaConstrained: boolean().nullable(),
58620
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
58621
+ caReplacedAt: string().nullable(),
58622
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
58623
+ storedUpload: object({
58624
+ leafFingerprintSha256: string(),
58625
+ validTo: string(),
58626
+ hasCa: boolean()
58627
+ }).nullable()
57799
58628
  });
57800
58629
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
57801
58630
  /**
@@ -57851,6 +58680,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
57851
58680
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
57852
58681
  kind: "mutation",
57853
58682
  auth: "admin"
58683
+ }), method(_void(), TlsStatusSchema, {
58684
+ kind: "mutation",
58685
+ auth: "admin"
57854
58686
  });
57855
58687
  var LockControlStatusSchema = object({
57856
58688
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -64914,7 +65746,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64914
65746
  kind: "mutation",
64915
65747
  auth: "admin",
64916
65748
  access: "delete"
64917
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
65749
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
65750
+ kind: "mutation",
65751
+ auth: "admin",
65752
+ access: "create"
65753
+ }), method(object({
64918
65754
  userId: string(),
64919
65755
  code: string()
64920
65756
  }), object({ valid: boolean() }), {
@@ -66649,6 +67485,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
66649
67485
  dayNight: dayNightCapability,
66650
67486
  deviceDiscovery: deviceDiscoveryCapability,
66651
67487
  deviceStatus: deviceStatusCapability,
67488
+ dishwasher: dishwasherCapability,
66652
67489
  doorbell: doorbellCapability,
66653
67490
  enumSensor: enumSensorCapability,
66654
67491
  eventEmitter: eventEmitterCapability,
@@ -66656,6 +67493,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
66656
67493
  featureProbe: featureProbeCapability,
66657
67494
  flood: floodCapability,
66658
67495
  gas: gasCapability,
67496
+ heatingValve: heatingValveCapability,
66659
67497
  humidifier: humidifierCapability,
66660
67498
  humiditySensor: humiditySensorCapability,
66661
67499
  image: imageCapability,
@@ -66741,13 +67579,14 @@ var BaseDevice = class {
66741
67579
  get state() {
66742
67580
  if (!this._stateProxyCache) {
66743
67581
  const cache = {};
66744
- const handler = { get: (_target, key) => {
67582
+ const handler = { get: (target, key) => {
66745
67583
  const k = key;
66746
- if (k in cache) return cache[k];
67584
+ const existing = Reflect.get(target, k);
67585
+ if (existing !== void 0) return existing;
66747
67586
  const cap = DEVICE_LOCAL_STATE_CAPS[k];
66748
67587
  if (!cap) return void 0;
66749
67588
  const proxy = this.sliceProxy(cap);
66750
- cache[k] = proxy;
67589
+ Reflect.set(target, k, proxy);
66751
67590
  return proxy;
66752
67591
  } };
66753
67592
  this._stateProxyCache = new Proxy(cache, handler);
@@ -66946,7 +67785,7 @@ var BaseDevice = class {
66946
67785
  async updateSourceInfo(patch) {
66947
67786
  const next = mergeSourceInfo(this.sourceInfo, patch);
66948
67787
  this._sourceInfoCache = Object.freeze({ ...next });
66949
- const action = this.ctx.api?.deviceManager?.setMetadata;
67788
+ const action = this.ctx.api.deviceManager?.setMetadata;
66950
67789
  if (action) try {
66951
67790
  await action.mutate({
66952
67791
  deviceId: this.id,
@@ -66981,7 +67820,7 @@ var BaseDevice = class {
66981
67820
  * device boot on a meta refresh.
66982
67821
  */
66983
67822
  async refreshFeatures() {
66984
- const action = this.ctx.api?.deviceManager?.registerDevice;
67823
+ const action = this.ctx.api.deviceManager?.registerDevice;
66985
67824
  if (!action) return;
66986
67825
  try {
66987
67826
  await action.mutate({
@@ -67380,6 +68219,12 @@ var BaseDeviceProvider = class extends BaseAddon {
67380
68219
  provider: this
67381
68220
  }];
67382
68221
  }
68222
+ /** Flatten `super.onInitialize()` whether it returned an array or an envelope. */
68223
+ providerRegistrationsFromSuper(result) {
68224
+ if (Array.isArray(result)) return result;
68225
+ if (result !== void 0 && result.providers !== void 0) return [...result.providers];
68226
+ return [];
68227
+ }
67383
68228
  async onShutdown() {
67384
68229
  this._restoreShuttingDown = true;
67385
68230
  this.cancelRestoreRetries();
@@ -67906,7 +68751,7 @@ var BaseDeviceProvider = class extends BaseAddon {
67906
68751
  return toDeviceSummary(device, this.addonId);
67907
68752
  }
67908
68753
  };
67909
- 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;
68754
+ 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;
67910
68755
  new Set(Object.values(DeviceType));
67911
68756
  Object.freeze({
67912
68757
  "accessories.getStatus": {
@@ -69055,6 +69900,12 @@ Object.freeze({
69055
69900
  addonId: null,
69056
69901
  access: "view"
69057
69902
  },
69903
+ "coreBlocks.migrateRawSecrets": {
69904
+ capName: "core-blocks",
69905
+ capScope: "system",
69906
+ addonId: null,
69907
+ access: "create"
69908
+ },
69058
69909
  "coreBlocks.restart": {
69059
69910
  capName: "core-blocks",
69060
69911
  capScope: "system",
@@ -70321,6 +71172,60 @@ Object.freeze({
70321
71172
  addonId: null,
70322
71173
  access: "view"
70323
71174
  },
71175
+ "dishwasher.getStatus": {
71176
+ capName: "dishwasher",
71177
+ capScope: "device",
71178
+ addonId: null,
71179
+ access: "view"
71180
+ },
71181
+ "dishwasher.pause": {
71182
+ capName: "dishwasher",
71183
+ capScope: "device",
71184
+ addonId: null,
71185
+ access: "create"
71186
+ },
71187
+ "dishwasher.setHalfLoad": {
71188
+ capName: "dishwasher",
71189
+ capScope: "device",
71190
+ addonId: null,
71191
+ access: "create"
71192
+ },
71193
+ "dishwasher.setHygienePlus": {
71194
+ capName: "dishwasher",
71195
+ capScope: "device",
71196
+ addonId: null,
71197
+ access: "create"
71198
+ },
71199
+ "dishwasher.setOption": {
71200
+ capName: "dishwasher",
71201
+ capScope: "device",
71202
+ addonId: null,
71203
+ access: "create"
71204
+ },
71205
+ "dishwasher.setPower": {
71206
+ capName: "dishwasher",
71207
+ capScope: "device",
71208
+ addonId: null,
71209
+ access: "create"
71210
+ },
71211
+ "dishwasher.setProgram": {
71212
+ capName: "dishwasher",
71213
+ capScope: "device",
71214
+ addonId: null,
71215
+ access: "create"
71216
+ },
71217
+ "dishwasher.start": {
71218
+ capName: "dishwasher",
71219
+ capScope: "device",
71220
+ addonId: null,
71221
+ access: "create"
71222
+ },
71223
+ "dishwasher.stop": {
71224
+ capName: "dishwasher",
71225
+ capScope: "device",
71226
+ addonId: null,
71227
+ access: "create"
71228
+ },
70324
71229
  "doorbell.getStatus": {
70325
71230
  capName: "doorbell",
70326
71231
  capScope: "device",
@@ -70531,6 +71436,12 @@ Object.freeze({
70531
71436
  addonId: null,
70532
71437
  access: "view"
70533
71438
  },
71439
+ "heatingValve.getStatus": {
71440
+ capName: "heating-valve",
71441
+ capScope: "device",
71442
+ addonId: null,
71443
+ access: "view"
71444
+ },
70534
71445
  "humidifier.getStatus": {
70535
71446
  capName: "humidifier",
70536
71447
  capScope: "device",
@@ -70741,6 +71652,12 @@ Object.freeze({
70741
71652
  addonId: null,
70742
71653
  access: "create"
70743
71654
  },
71655
+ "keychainAdmin.importSecret": {
71656
+ capName: "keychain-admin",
71657
+ capScope: "system",
71658
+ addonId: null,
71659
+ access: "create"
71660
+ },
70744
71661
  "keychainAdmin.listAudit": {
70745
71662
  capName: "keychain-admin",
70746
71663
  capScope: "system",
@@ -70909,6 +71826,12 @@ Object.freeze({
70909
71826
  addonId: null,
70910
71827
  access: "view"
70911
71828
  },
71829
+ "llm.migrateRawSecrets": {
71830
+ capName: "llm",
71831
+ capScope: "system",
71832
+ addonId: null,
71833
+ access: "create"
71834
+ },
70912
71835
  "llm.resolveModelRef": {
70913
71836
  capName: "llm",
70914
71837
  capScope: "system",
@@ -71137,6 +72060,12 @@ Object.freeze({
71137
72060
  addonId: null,
71138
72061
  access: "create"
71139
72062
  },
72063
+ "localNetwork.useStoredUploadedCertificate": {
72064
+ capName: "local-network",
72065
+ capScope: "system",
72066
+ addonId: null,
72067
+ access: "create"
72068
+ },
71140
72069
  "lockControl.getStatus": {
71141
72070
  capName: "lock-control",
71142
72071
  capScope: "device",
@@ -73789,6 +74718,30 @@ Object.freeze({
73789
74718
  addonId: null,
73790
74719
  access: "create"
73791
74720
  },
74721
+ "recordEntries.deleteEntry": {
74722
+ capName: "record-entries",
74723
+ capScope: "system",
74724
+ addonId: null,
74725
+ access: "delete"
74726
+ },
74727
+ "recordEntries.listEntries": {
74728
+ capName: "record-entries",
74729
+ capScope: "system",
74730
+ addonId: null,
74731
+ access: "view"
74732
+ },
74733
+ "recordEntries.listEntryKinds": {
74734
+ capName: "record-entries",
74735
+ capScope: "system",
74736
+ addonId: null,
74737
+ access: "view"
74738
+ },
74739
+ "recordEntries.putEntry": {
74740
+ capName: "record-entries",
74741
+ capScope: "system",
74742
+ addonId: null,
74743
+ access: "create"
74744
+ },
73792
74745
  "recording.getAvailability": {
73793
74746
  capName: "recording",
73794
74747
  capScope: "device",
@@ -74089,6 +75042,102 @@ Object.freeze({
74089
75042
  addonId: null,
74090
75043
  access: "view"
74091
75044
  },
75045
+ "records.aggregate": {
75046
+ capName: "records",
75047
+ capScope: "system",
75048
+ addonId: null,
75049
+ access: "view"
75050
+ },
75051
+ "records.allocateId": {
75052
+ capName: "records",
75053
+ capScope: "system",
75054
+ addonId: null,
75055
+ access: "create"
75056
+ },
75057
+ "records.count": {
75058
+ capName: "records",
75059
+ capScope: "system",
75060
+ addonId: null,
75061
+ access: "view"
75062
+ },
75063
+ "records.declareKinds": {
75064
+ capName: "records",
75065
+ capScope: "system",
75066
+ addonId: null,
75067
+ access: "create"
75068
+ },
75069
+ "records.delete": {
75070
+ capName: "records",
75071
+ capScope: "system",
75072
+ addonId: null,
75073
+ access: "delete"
75074
+ },
75075
+ "records.deleteDevice": {
75076
+ capName: "records",
75077
+ capScope: "system",
75078
+ addonId: null,
75079
+ access: "delete"
75080
+ },
75081
+ "records.deleteMany": {
75082
+ capName: "records",
75083
+ capScope: "system",
75084
+ addonId: null,
75085
+ access: "delete"
75086
+ },
75087
+ "records.deleteWhere": {
75088
+ capName: "records",
75089
+ capScope: "system",
75090
+ addonId: null,
75091
+ access: "delete"
75092
+ },
75093
+ "records.get": {
75094
+ capName: "records",
75095
+ capScope: "system",
75096
+ addonId: null,
75097
+ access: "view"
75098
+ },
75099
+ "records.getMany": {
75100
+ capName: "records",
75101
+ capScope: "system",
75102
+ addonId: null,
75103
+ access: "view"
75104
+ },
75105
+ "records.histogram": {
75106
+ capName: "records",
75107
+ capScope: "system",
75108
+ addonId: null,
75109
+ access: "view"
75110
+ },
75111
+ "records.patch": {
75112
+ capName: "records",
75113
+ capScope: "system",
75114
+ addonId: null,
75115
+ access: "create"
75116
+ },
75117
+ "records.put": {
75118
+ capName: "records",
75119
+ capScope: "system",
75120
+ addonId: null,
75121
+ access: "create"
75122
+ },
75123
+ "records.putMany": {
75124
+ capName: "records",
75125
+ capScope: "system",
75126
+ addonId: null,
75127
+ access: "create"
75128
+ },
75129
+ "records.query": {
75130
+ capName: "records",
75131
+ capScope: "system",
75132
+ addonId: null,
75133
+ access: "view"
75134
+ },
75135
+ "records.secretRefs": {
75136
+ capName: "records",
75137
+ capScope: "system",
75138
+ addonId: null,
75139
+ access: "view"
75140
+ },
74092
75141
  "sceneMonitor.captureReference": {
74093
75142
  capName: "scene-monitor",
74094
75143
  capScope: "device",
@@ -74521,6 +75570,48 @@ Object.freeze({
74521
75570
  addonId: null,
74522
75571
  access: "create"
74523
75572
  },
75573
+ "storageAdmin.adoptRecords": {
75574
+ capName: "storage-admin",
75575
+ capScope: "system",
75576
+ addonId: null,
75577
+ access: "create"
75578
+ },
75579
+ "storageAdmin.dropCollection": {
75580
+ capName: "storage-admin",
75581
+ capScope: "system",
75582
+ addonId: null,
75583
+ access: "delete"
75584
+ },
75585
+ "storageAdmin.isAdoptedLegacyTable": {
75586
+ capName: "storage-admin",
75587
+ capScope: "system",
75588
+ addonId: null,
75589
+ access: "view"
75590
+ },
75591
+ "storageAdmin.listKinds": {
75592
+ capName: "storage-admin",
75593
+ capScope: "system",
75594
+ addonId: null,
75595
+ access: "view"
75596
+ },
75597
+ "storageAdmin.listTables": {
75598
+ capName: "storage-admin",
75599
+ capScope: "system",
75600
+ addonId: null,
75601
+ access: "view"
75602
+ },
75603
+ "storageAdmin.readLegacyCollection": {
75604
+ capName: "storage-admin",
75605
+ capScope: "system",
75606
+ addonId: null,
75607
+ access: "view"
75608
+ },
75609
+ "storageAdmin.readRecords": {
75610
+ capName: "storage-admin",
75611
+ capScope: "system",
75612
+ addonId: null,
75613
+ access: "view"
75614
+ },
74524
75615
  "storageEvictable.evict": {
74525
75616
  capName: "storage-evictable",
74526
75617
  capScope: "system",
@@ -75433,6 +76524,12 @@ Object.freeze({
75433
76524
  addonId: null,
75434
76525
  access: "view"
75435
76526
  },
76527
+ "userManagement.migrateRawSecrets": {
76528
+ capName: "user-management",
76529
+ capScope: "system",
76530
+ addonId: null,
76531
+ access: "create"
76532
+ },
75436
76533
  "userManagement.oauthExchangeCode": {
75437
76534
  capName: "user-management",
75438
76535
  capScope: "system",
@@ -75932,7 +77029,7 @@ Object.freeze({
75932
77029
  access: "create"
75933
77030
  }
75934
77031
  });
75935
- 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;
77032
+ 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;
75936
77033
  DeviceFeature.BatteryOperated;
75937
77034
  var LAST_FETCHED_FIELD = "lastFetchedAt";
75938
77035
  /**
@@ -76908,6 +78005,51 @@ Object.freeze({
76908
78005
  form: "single",
76909
78006
  optional: false
76910
78007
  }],
78008
+ "dishwasher.getStatus": [{
78009
+ name: "deviceId",
78010
+ form: "single",
78011
+ optional: false
78012
+ }],
78013
+ "dishwasher.pause": [{
78014
+ name: "deviceId",
78015
+ form: "single",
78016
+ optional: false
78017
+ }],
78018
+ "dishwasher.setHalfLoad": [{
78019
+ name: "deviceId",
78020
+ form: "single",
78021
+ optional: false
78022
+ }],
78023
+ "dishwasher.setHygienePlus": [{
78024
+ name: "deviceId",
78025
+ form: "single",
78026
+ optional: false
78027
+ }],
78028
+ "dishwasher.setOption": [{
78029
+ name: "deviceId",
78030
+ form: "single",
78031
+ optional: false
78032
+ }],
78033
+ "dishwasher.setPower": [{
78034
+ name: "deviceId",
78035
+ form: "single",
78036
+ optional: false
78037
+ }],
78038
+ "dishwasher.setProgram": [{
78039
+ name: "deviceId",
78040
+ form: "single",
78041
+ optional: false
78042
+ }],
78043
+ "dishwasher.start": [{
78044
+ name: "deviceId",
78045
+ form: "single",
78046
+ optional: false
78047
+ }],
78048
+ "dishwasher.stop": [{
78049
+ name: "deviceId",
78050
+ form: "single",
78051
+ optional: false
78052
+ }],
76911
78053
  "doorbell.getStatus": [{
76912
78054
  name: "deviceId",
76913
78055
  form: "single",
@@ -76977,6 +78119,11 @@ Object.freeze({
76977
78119
  form: "single",
76978
78120
  optional: false
76979
78121
  }],
78122
+ "heatingValve.getStatus": [{
78123
+ name: "deviceId",
78124
+ form: "single",
78125
+ optional: false
78126
+ }],
76980
78127
  "humidifier.getStatus": [{
76981
78128
  name: "deviceId",
76982
78129
  form: "single",
@@ -78261,6 +79408,37 @@ Object.freeze({
78261
79408
  form: "single",
78262
79409
  optional: false
78263
79410
  }],
79411
+ "records.count": [{
79412
+ name: "deviceId",
79413
+ form: "single",
79414
+ optional: true
79415
+ }],
79416
+ "records.deleteDevice": [{
79417
+ name: "deviceId",
79418
+ form: "single",
79419
+ optional: false
79420
+ }],
79421
+ "records.deleteWhere": [{
79422
+ name: "deviceId",
79423
+ form: "single",
79424
+ optional: true
79425
+ }],
79426
+ "records.histogram": [{
79427
+ name: "deviceId",
79428
+ form: "single",
79429
+ optional: true
79430
+ }],
79431
+ "records.putMany": [{
79432
+ name: "records",
79433
+ form: "object-array",
79434
+ optional: false,
79435
+ itemField: "deviceId"
79436
+ }],
79437
+ "records.query": [{
79438
+ name: "deviceId",
79439
+ form: "single",
79440
+ optional: true
79441
+ }],
78264
79442
  "sceneMonitor.captureReference": [{
78265
79443
  name: "deviceId",
78266
79444
  form: "single",
@@ -78377,6 +79555,17 @@ Object.freeze({
78377
79555
  form: "single",
78378
79556
  optional: false
78379
79557
  }],
79558
+ "storageAdmin.adoptRecords": [{
79559
+ name: "records",
79560
+ form: "object-array",
79561
+ optional: false,
79562
+ itemField: "deviceId"
79563
+ }],
79564
+ "storageAdmin.readRecords": [{
79565
+ name: "deviceId",
79566
+ form: "single",
79567
+ optional: true
79568
+ }],
78380
79569
  "streamBroker.acquireEgressTranscode": [{
78381
79570
  name: "deviceId",
78382
79571
  form: "single",
@@ -202255,7 +203444,7 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
202255
203444
  return [...EMAIL_PUSH_SECTION_IDS, ...BAICHUAN_WEBHOOK_SECTION_IDS];
202256
203445
  }
202257
203446
  async onInitialize() {
202258
- const regs = await super.onInitialize();
203447
+ const regs = this.providerRegistrationsFromSuper(await super.onInitialize());
202259
203448
  this.logChannels = createLogChannelsProvider(this.ctx.logger.child("log-channels"));
202260
203449
  regs.push({
202261
203450
  capability: logChannelsCapability,