@camstack/addon-provider-dreame 0.2.133 → 0.2.135

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 +1398 -125
  2. package/dist/addon.mjs +1398 -125
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -44,7 +44,7 @@ let net = require("net");
44
44
  net = __toESM(net, 1);
45
45
  let zlib = require("zlib");
46
46
  zlib = __toESM(zlib, 1);
47
- //#region ../types/dist/event-category-C4hVnRo8.mjs
47
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
48
48
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
49
49
  EventCategory["SystemBoot"] = "system.boot";
50
50
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -108,6 +108,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
108
108
  * consumes this category and maps it to the `addon-crash-loop` kind.
109
109
  */
110
110
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
111
+ /**
112
+ * A runner whose addon refused to start with a typed reason (D877) - parked
113
+ * in `refused`, never counted by the crash breaker, retried on operator
114
+ * action. One event per refusal.
115
+ */
116
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
117
+ /**
118
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
119
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
120
+ * runner is still pending) and the alert centre (close a recovered runner).
121
+ */
122
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
123
+ /**
124
+ * The node's one-shot runner boot check (D877): planned runners against the
125
+ * process service, `degraded` when any is failed, refused or missing. The
126
+ * alert centre turns it into one alert and a direct critical push.
127
+ */
128
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
111
129
  EventCategory["AddonError"] = "addon.error";
112
130
  EventCategory["AddonPageReady"] = "addon.page-ready";
113
131
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -5432,7 +5450,7 @@ var ZodIssueCode$1 = {
5432
5450
  var ZodFirstPartyTypeKind$1;
5433
5451
  ZodFirstPartyTypeKind$1 || (ZodFirstPartyTypeKind$1 = {});
5434
5452
  //#endregion
5435
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5453
+ //#region ../types/dist/sleep-BegKjwUu.mjs
5436
5454
  /**
5437
5455
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5438
5456
  * window to float samples (D455).
@@ -5549,7 +5567,7 @@ function isKeychainStoredField(field) {
5549
5567
  var SECRET_CLEAR = { $secretClear: true };
5550
5568
  /** The `'***'` token D634 redaction writes for non-admins. */
5551
5569
  var LEGACY_DEVICE_REDACTION = "***";
5552
- function isRecord$2(value) {
5570
+ function isRecord$5(value) {
5553
5571
  return typeof value === "object" && value !== null && !Array.isArray(value);
5554
5572
  }
5555
5573
  function makeSecretMarker(ref) {
@@ -5560,12 +5578,12 @@ function makeSecretMarker(ref) {
5560
5578
  }
5561
5579
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5562
5580
  function isSecretMarker(value) {
5563
- if (!isRecord$2(value)) return false;
5581
+ if (!isRecord$5(value)) return false;
5564
5582
  const ref = value["$secret"];
5565
5583
  return typeof ref === "string" && ref.length > 0;
5566
5584
  }
5567
5585
  function isSecretClear(value) {
5568
- return isRecord$2(value) && value["$secretClear"] === true;
5586
+ return isRecord$5(value) && value["$secretClear"] === true;
5569
5587
  }
5570
5588
  /**
5571
5589
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6175,7 +6193,7 @@ var KeychainWriteRefusedError = class extends Error {
6175
6193
  }
6176
6194
  };
6177
6195
  var KEEP = { kind: "keep" };
6178
- function isRecord$1(value) {
6196
+ function isRecord$4(value) {
6179
6197
  return typeof value === "object" && value !== null && !Array.isArray(value);
6180
6198
  }
6181
6199
  function defaultMintId() {
@@ -6188,7 +6206,7 @@ function collectSecretMarkerRefs(value, out = []) {
6188
6206
  return out;
6189
6207
  }
6190
6208
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6191
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6209
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6192
6210
  return out;
6193
6211
  }
6194
6212
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6243,7 +6261,7 @@ function rowId(row, idKey) {
6243
6261
  return null;
6244
6262
  }
6245
6263
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6246
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6264
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6247
6265
  if (!Array.isArray(incoming)) {
6248
6266
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6249
6267
  return {
@@ -6259,7 +6277,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6259
6277
  const kept = /* @__PURE__ */ new Set();
6260
6278
  const rows = [];
6261
6279
  for (const row of incoming) {
6262
- if (!isRecord$1(row)) {
6280
+ if (!isRecord$4(row)) {
6263
6281
  rows.push(row);
6264
6282
  continue;
6265
6283
  }
@@ -6284,7 +6302,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6284
6302
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6285
6303
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6286
6304
  case "object": {
6287
- if (!isRecord$1(incoming)) {
6305
+ if (!isRecord$4(incoming)) {
6288
6306
  if (incoming === void 0) return KEEP;
6289
6307
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6290
6308
  return {
@@ -6292,7 +6310,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6292
6310
  value: incoming
6293
6311
  };
6294
6312
  }
6295
- const storedObj = isRecord$1(stored) ? stored : {};
6313
+ const storedObj = isRecord$4(stored) ? stored : {};
6296
6314
  return {
6297
6315
  kind: "value",
6298
6316
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6415,7 +6433,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6415
6433
  value: items
6416
6434
  };
6417
6435
  }
6418
- if (isRecord$1(v)) {
6436
+ if (isRecord$4(v)) {
6419
6437
  const out = {};
6420
6438
  for (const [k, child] of Object.entries(v)) {
6421
6439
  const s = substitute(child);
@@ -6683,7 +6701,6 @@ function createHandle(raw, opts) {
6683
6701
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6684
6702
  const readAddonStoreResult = raw.readAddonStoreResult;
6685
6703
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6686
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6687
6704
  const overrides = {
6688
6705
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6689
6706
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6707,12 +6724,12 @@ function createHandle(raw, opts) {
6707
6724
  };
6708
6725
  } } : {},
6709
6726
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6710
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6711
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6727
+ readDeviceStoreBatch: async (deviceIds) => {
6728
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6712
6729
  const out = /* @__PURE__ */ new Map();
6713
6730
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6714
6731
  return out;
6715
- } } : {},
6732
+ },
6716
6733
  writeAddonStore: async (patch) => {
6717
6734
  await writeAddon(patch);
6718
6735
  },
@@ -7339,7 +7356,7 @@ var BaseAddon = class {
7339
7356
  if (!ctx) return;
7340
7357
  const addonId = ctx.id;
7341
7358
  setImmediate(() => {
7342
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7359
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7343
7360
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7344
7361
  }).catch((err) => {
7345
7362
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7539,7 +7556,7 @@ var BaseAddon = class {
7539
7556
  return this._addonSecretTree;
7540
7557
  }
7541
7558
  deviceSecretTree() {
7542
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7559
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7543
7560
  return this._deviceSecretTree;
7544
7561
  }
7545
7562
  /**
@@ -7615,42 +7632,135 @@ var BaseAddon = class {
7615
7632
  this[timerOf] = timer;
7616
7633
  }
7617
7634
  /**
7618
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7619
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7620
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7621
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7635
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7636
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7622
7637
  * addon permanently broken.
7623
7638
  *
7624
- * Retry only the two known infra fingerprints. Anything else propagates so
7625
- * real bugs surface immediately. After the budget expires we fall back to
7626
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7639
+ * Two kinds of outage, two budgets:
7640
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7641
+ * initialized`, `provider not available`): a short budget, then the addon
7642
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7643
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7644
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7645
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7646
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7647
+ * loop. A long, bounded budget; only after it the error propagates - the
7648
+ * addon never runs on defaults for a store it could not ask.
7649
+ * Anything else propagates immediately so real bugs surface.
7627
7650
  */
7628
7651
  async readAddonStoreWithRetry() {
7629
7652
  const settings = this.rawSettings();
7630
7653
  if (!settings) return {};
7631
- const delaysMs = [
7632
- 150,
7633
- 350,
7634
- 600,
7635
- 900
7636
- ];
7637
7654
  let lastErr;
7638
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7655
+ for (let attempt = 0;; attempt++) try {
7639
7656
  const stored = await settings.readAddonStore() ?? {};
7640
7657
  this.settingsStoreReady = true;
7641
7658
  return stored;
7642
7659
  } catch (err) {
7643
7660
  lastErr = err;
7644
- const msg = err instanceof Error ? err.message : String(err);
7645
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7646
- if (attempt === delaysMs.length) break;
7647
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7661
+ const kind = classifyStoreError(err);
7662
+ if (kind === "permanent") throw err;
7663
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7664
+ if (delay === void 0) {
7665
+ if (kind === "transport") throw err;
7666
+ break;
7667
+ }
7668
+ await new Promise((r) => setTimeout(r, delay));
7648
7669
  }
7649
7670
  this.settingsStoreReady = false;
7650
7671
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7651
7672
  return {};
7652
7673
  }
7653
7674
  };
7675
+ /** The settings store's own restart fingerprints. */
7676
+ var RESTART_RETRY_DELAYS_MS = [
7677
+ 150,
7678
+ 350,
7679
+ 600,
7680
+ 900
7681
+ ];
7682
+ /** A hub restarting under a booting runner: ~100 s in total. */
7683
+ var TRANSPORT_RETRY_DELAYS_MS = [
7684
+ 150,
7685
+ 350,
7686
+ 600,
7687
+ 900,
7688
+ 2e3,
7689
+ 5e3,
7690
+ 1e4,
7691
+ 2e4,
7692
+ 3e4,
7693
+ 3e4
7694
+ ];
7695
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7696
+ /** Node / socket error codes of a connection that did not happen or broke. */
7697
+ var TRANSPORT_CODES = new Set([
7698
+ "ECONNREFUSED",
7699
+ "ECONNRESET",
7700
+ "ETIMEDOUT",
7701
+ "EPIPE",
7702
+ "EHOSTUNREACH",
7703
+ "ENETUNREACH"
7704
+ ]);
7705
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7706
+ var UNAVAILABLE_TRPC_CODES = new Set([
7707
+ "TIMEOUT",
7708
+ "SERVICE_UNAVAILABLE",
7709
+ "BAD_GATEWAY",
7710
+ "GATEWAY_TIMEOUT"
7711
+ ]);
7712
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7713
+ var TRANSPORT_PHRASES = [
7714
+ "discovery deadline exceeded",
7715
+ "parent could not route child unowned cap call",
7716
+ "UDS request timed out after",
7717
+ "channel closed"
7718
+ ];
7719
+ /** Moleculer error `type`s of a call that could not be served right now. */
7720
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7721
+ "REQUEST_TIMEOUT",
7722
+ "SERVICE_NOT_FOUND",
7723
+ "SERVICE_NOT_AVAILABLE",
7724
+ "REQUEST_REJECTED",
7725
+ "BROKER_DISCONNECTED"
7726
+ ]);
7727
+ function stringProp(value, key) {
7728
+ if (typeof value !== "object" || value === null) return void 0;
7729
+ const found = Reflect.get(value, key);
7730
+ return typeof found === "string" ? found : void 0;
7731
+ }
7732
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7733
+ function errorCode(err) {
7734
+ const out = {};
7735
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7736
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7737
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7738
+ if (node !== void 0) out.node = node;
7739
+ const trpc = stringProp(data, "code");
7740
+ if (trpc !== void 0) out.trpc = trpc;
7741
+ return out;
7742
+ }
7743
+ /**
7744
+ * Is a settings read failure worth retrying, and with which budget? Only
7745
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7746
+ * one of the exact phrases our own transport raises. A message that merely
7747
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7748
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7749
+ */
7750
+ function classifyStoreError(err) {
7751
+ const message = err instanceof Error ? err.message : String(err);
7752
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7753
+ const code = errorCode(err);
7754
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7755
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7756
+ if (typeof err === "object" && err !== null) {
7757
+ if (Reflect.get(err, "retryable") === true) return "transport";
7758
+ const type = stringProp(err, "type");
7759
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7760
+ }
7761
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7762
+ return "permanent";
7763
+ }
7654
7764
  /**
7655
7765
  * Collect the keys of every field marked `perNode: true`, recursing into
7656
7766
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7740,6 +7850,156 @@ var PeerBytesTicketSchema = object({
7740
7850
  */
7741
7851
  declaredBytes: number().int().nonnegative().nullable()
7742
7852
  });
7853
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7854
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7855
+ var RECORD_DATABASES = ["settings", "events"];
7856
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7857
+ var RECORD_CLASSES = [
7858
+ "config",
7859
+ "ledger",
7860
+ "audit",
7861
+ "mirror",
7862
+ "ephemeral"
7863
+ ];
7864
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7865
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7866
+ var RECORD_BATCH_MAX = 1e3;
7867
+ var RECORD_QUERY_MAX = 1e3;
7868
+ function defOf(schema) {
7869
+ const zodBag = Reflect.get(schema, "_zod");
7870
+ if (typeof zodBag !== "object" || zodBag === null) return {};
7871
+ const def = Reflect.get(zodBag, "def");
7872
+ if (typeof def !== "object" || def === null) return {};
7873
+ return def;
7874
+ }
7875
+ function declaredHere(schema) {
7876
+ return globalRegistry.get(schema)?.secret === true;
7877
+ }
7878
+ /** Wrapper kinds whose `innerType` is the field itself. */
7879
+ var WRAPPERS = new Set([
7880
+ "optional",
7881
+ "nullable",
7882
+ "default",
7883
+ "prefault",
7884
+ "catch",
7885
+ "readonly",
7886
+ "nonoptional"
7887
+ ]);
7888
+ /**
7889
+ * The schema layers that make up ONE field: the schema itself and every
7890
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
7891
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
7892
+ * `.transform` on `in`).
7893
+ */
7894
+ function layersOf(schema) {
7895
+ const out = [];
7896
+ const queue = [schema];
7897
+ while (queue.length > 0) {
7898
+ const s = queue.shift();
7899
+ if (!s || out.includes(s)) continue;
7900
+ out.push(s);
7901
+ const def = defOf(s);
7902
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
7903
+ if (def.type === "pipe") {
7904
+ if (def.in) queue.push(def.in);
7905
+ if (def.out) queue.push(def.out);
7906
+ }
7907
+ }
7908
+ return out;
7909
+ }
7910
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
7911
+ function isZodSecret(schema) {
7912
+ return layersOf(schema).some(declaredHere);
7913
+ }
7914
+ /**
7915
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
7916
+ * element of this array" (`connection.password`, `rows[].token`). A declared
7917
+ * object or array is reported as one path and not descended into — everything
7918
+ * under it is secret.
7919
+ */
7920
+ function collectZodSecretPaths(schema, prefix = "") {
7921
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
7922
+ const paths = [];
7923
+ for (const layer of layersOf(schema)) {
7924
+ const def = defOf(layer);
7925
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
7926
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
7927
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
7928
+ else if (def.type === "intersection") {
7929
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
7930
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
7931
+ }
7932
+ }
7933
+ return [...new Set(paths)];
7934
+ }
7935
+ /**
7936
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
7937
+ * Zod row schema that describes it, and the helper that turns the two into the
7938
+ * JSON the engine stores.
7939
+ *
7940
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
7941
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
7942
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
7943
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
7944
+ * never a field name (D879).
7945
+ */
7946
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
7947
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
7948
+ var RecordIndexSchema = object({
7949
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
7950
+ fields: array(RecordFieldPathSchema).min(1).max(4),
7951
+ unique: boolean().optional()
7952
+ }).strict();
7953
+ var RecordRetentionSchema = union([
7954
+ object({
7955
+ ttlMs: number().int().positive(),
7956
+ from: _enum(["at", "write"])
7957
+ }).strict(),
7958
+ object({
7959
+ maxRows: number().int().positive().optional(),
7960
+ maxRowsPerDevice: number().int().positive().optional()
7961
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
7962
+ object({
7963
+ owner: string().min(1),
7964
+ reason: string().min(1)
7965
+ }).strict(),
7966
+ object({ none: string().min(1) }).strict()
7967
+ ]);
7968
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
7969
+ var EntryDescriptorSchema = object({
7970
+ title: string().min(1),
7971
+ /** The record body field shown as the entry's name. */
7972
+ nameField: string().min(1),
7973
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
7974
+ fields: record(string(), unknown())
7975
+ }).strict();
7976
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
7977
+ var RecordKindDeclarationSchema = object({
7978
+ database: _enum(RECORD_DATABASES).default("settings"),
7979
+ class: _enum(RECORD_CLASSES),
7980
+ writeTrigger: string().min(1),
7981
+ device: _enum([
7982
+ "required",
7983
+ "optional",
7984
+ "none"
7985
+ ]).default("none"),
7986
+ at: _enum(["required", "none"]).default("none"),
7987
+ indexes: array(RecordIndexSchema).max(8).default([]),
7988
+ retention: RecordRetentionSchema,
7989
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
7990
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
7991
+ /** Derived from the Zod schema; never written by hand. */
7992
+ secretPaths: array(string().min(1)).default([]),
7993
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
7994
+ secretArrayKeys: record(string(), string()).default({}),
7995
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
7996
+ adoptsFrom: string().min(1).optional(),
7997
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
7998
+ transactFamily: string().min(1).optional(),
7999
+ entry: EntryDescriptorSchema.optional()
8000
+ }).strict();
8001
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
8002
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
7743
8003
  /** Shared Zod schemas used across streaming capabilities. */
7744
8004
  var CamProfileSchema = _enum([
7745
8005
  "high",
@@ -8204,69 +8464,6 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8204
8464
  kind: "mutation",
8205
8465
  auth: "admin"
8206
8466
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
8207
- function defOf(schema) {
8208
- return schema._zod?.def ?? {};
8209
- }
8210
- function declaredHere(schema) {
8211
- return globalRegistry.get(schema)?.secret === true;
8212
- }
8213
- /** Wrapper kinds whose `innerType` is the field itself. */
8214
- var WRAPPERS = new Set([
8215
- "optional",
8216
- "nullable",
8217
- "default",
8218
- "prefault",
8219
- "catch",
8220
- "readonly",
8221
- "nonoptional"
8222
- ]);
8223
- /**
8224
- * The schema layers that make up ONE field: the schema itself and every
8225
- * wrapper below it (optional / default / nullable / readonly / catch), plus
8226
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8227
- * `.transform` on `in`).
8228
- */
8229
- function layersOf(schema) {
8230
- const out = [];
8231
- const queue = [schema];
8232
- while (queue.length > 0) {
8233
- const s = queue.shift();
8234
- if (!s || out.includes(s)) continue;
8235
- out.push(s);
8236
- const def = defOf(s);
8237
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8238
- if (def.type === "pipe") {
8239
- if (def.in) queue.push(def.in);
8240
- if (def.out) queue.push(def.out);
8241
- }
8242
- }
8243
- return out;
8244
- }
8245
- /** True when any layer of this field declares `.meta({ secret: true })`. */
8246
- function isZodSecret(schema) {
8247
- return layersOf(schema).some(declaredHere);
8248
- }
8249
- /**
8250
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
8251
- * element of this array" (`connection.password`, `rows[].token`). A declared
8252
- * object or array is reported as one path and not descended into — everything
8253
- * under it is secret.
8254
- */
8255
- function collectZodSecretPaths(schema, prefix = "") {
8256
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8257
- const paths = [];
8258
- for (const layer of layersOf(schema)) {
8259
- const def = defOf(layer);
8260
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8261
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8262
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8263
- else if (def.type === "intersection") {
8264
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8265
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8266
- }
8267
- }
8268
- return [...new Set(paths)];
8269
- }
8270
8467
  object({
8271
8468
  code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
8272
8469
  params: record(string(), union([string(), number()])).optional()
@@ -8286,7 +8483,7 @@ function userError(code, params, englishFallback) {
8286
8483
  return new CamstackError(code, params, englishFallback);
8287
8484
  }
8288
8485
  //#endregion
8289
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8486
+ //#region ../types/dist/err-msg-BXKzRBwg.mjs
8290
8487
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8291
8488
  DeviceType["Camera"] = "camera";
8292
8489
  DeviceType["Hub"] = "hub";
@@ -8378,6 +8575,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
8378
8575
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
8379
8576
  * integrations sharing the same food/desiccant/hopper surface. */
8380
8577
  DeviceType["PetFeeder"] = "pet-feeder";
8578
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
8579
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
8580
+ * Sources: native Bosch Home Connect, reusable by similar integrations. */
8581
+ DeviceType["Dishwasher"] = "dishwasher";
8381
8582
  return DeviceType;
8382
8583
  }({});
8383
8584
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -8555,6 +8756,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8555
8756
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8556
8757
  * real Switch device for UI rendering / export adapters. */
8557
8758
  DeviceRole["BinaryHelper"] = "binary-helper";
8759
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
8760
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
8761
+ DeviceRole["Outlet"] = "outlet";
8558
8762
  /** Generic motion / occupancy / moving event source. Distinct from
8559
8763
  * the camera accessory PirSensor role: that one is a camera child;
8560
8764
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8632,7 +8836,7 @@ function errMsg(err) {
8632
8836
  return String(err);
8633
8837
  }
8634
8838
  //#endregion
8635
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
8839
+ //#region ../types/dist/composition-CB6PMT9p.mjs
8636
8840
  /**
8637
8841
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8638
8842
  *
@@ -11836,11 +12040,10 @@ var ClipModelMetaSchema = object({
11836
12040
  /**
11837
12041
  * The `vector-store` index this model's vectors live in. ONE feature space
11838
12042
  * per index: two models share an index only when their vectors are ranked
11839
- * against each other, which for CLIP means never across families. MobileCLIP
11840
- * S1 and S2 share `object-clip` for history (separated by the row's
11841
- * `modelId`); any other model gets its own.
12043
+ * against each other, which for CLIP means never across families. Every
12044
+ * model gets its own.
11842
12045
  */
11843
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12046
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
11844
12047
  /**
11845
12048
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
11846
12049
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -13019,8 +13222,13 @@ var AlertSeveritySchema = _enum([
13019
13222
  "info",
13020
13223
  "success",
13021
13224
  "warning",
13022
- "error"
13225
+ "error",
13226
+ "critical"
13023
13227
  ]);
13228
+ var AlertActionSchema = object({
13229
+ label: string(),
13230
+ href: string().optional()
13231
+ });
13024
13232
  var AlertStatusSchema = _enum([
13025
13233
  "active",
13026
13234
  "in-progress",
@@ -13038,6 +13246,7 @@ var AlertSchema = object({
13038
13246
  severity: AlertSeveritySchema,
13039
13247
  title: string(),
13040
13248
  message: string(),
13249
+ action: AlertActionSchema.optional(),
13041
13250
  status: AlertStatusSchema,
13042
13251
  progress: number().optional(),
13043
13252
  read: boolean(),
@@ -15573,6 +15782,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15573
15782
  keyField: string()
15574
15783
  }).optional()
15575
15784
  })) });
15785
+ /**
15786
+ * The report of a one-shot "move this owner's plaintext secrets into the
15787
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
15788
+ *
15789
+ * The owner runs it on its own rows, through its own write path; an operator
15790
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
15791
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
15792
+ */
15793
+ var RawSecretMigrationInputSchema = object({
15794
+ /** `false` (the default of the script) = report only. */
15795
+ apply: boolean() });
15796
+ var RawSecretMigrationReportSchema = object({
15797
+ apply: boolean(),
15798
+ /** Rows that can carry a secret (a profile, an enrolment). */
15799
+ rows: number().int(),
15800
+ /** Rows whose secret was plaintext when the run started. */
15801
+ raw: number().int(),
15802
+ /** Rows that already held a keychain marker when the run started. */
15803
+ markers: number().int(),
15804
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
15805
+ migrated: number().int(),
15806
+ /** Plaintext rows left in place because the move or its read-back failed. */
15807
+ failed: number().int(),
15808
+ /** After the run: rows still holding plaintext. */
15809
+ remainingRaw: number().int(),
15810
+ /** After the run: markers the keychain could not resolve right now. */
15811
+ unresolvedMarkers: number().int(),
15812
+ /**
15813
+ * A second, redundant copy of the secrets' rows that the run found (and, on
15814
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
15815
+ */
15816
+ redundantCopies: number().int().optional(),
15817
+ /** True when nothing is raw and every marker resolves. */
15818
+ verified: boolean()
15819
+ });
15576
15820
  /** Where a block runs. The operator chooses — a block driving a device on an
15577
15821
  * agent is the reason placement is not fixed to the hub. */
15578
15822
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -15799,6 +16043,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
15799
16043
  }), SettingsUpdateResultSchema, {
15800
16044
  kind: "mutation",
15801
16045
  auth: "admin"
16046
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16047
+ kind: "mutation",
16048
+ auth: "admin"
15802
16049
  }), method(object({}), object({ libs: array(object({
15803
16050
  filePath: string(),
15804
16051
  content: string()
@@ -16062,6 +16309,347 @@ id: union([string(), number()]) }), {
16062
16309
  auth: "admin"
16063
16310
  });
16064
16311
  /**
16312
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16313
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16314
+ * (operator intent, D870) and device-history (numbers over time, D850).
16315
+ *
16316
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16317
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16318
+ * that with the addon id closed over). It is deliberately NOT in any input
16319
+ * schema, so a session can never supply it, and a call with no stamp is refused
16320
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16321
+ * addons go through the owner's capability.
16322
+ *
16323
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16324
+ * never `[]`. Secret fields are never on the wire: a read shows the
16325
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16326
+ * resolves itself, and a write may carry only a keychain marker bound to the
16327
+ * row's own ref.
16328
+ *
16329
+ * Internal: addons reach it through `ctx.records`, never directly.
16330
+ */
16331
+ var RecordIdSchema = string().min(1).max(256);
16332
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16333
+ var RecordBodySchema = record(string(), unknown());
16334
+ var RecordInputSchema = object({
16335
+ id: RecordIdSchema,
16336
+ /** The device this row belongs to (D865 removal, per-device reads). */
16337
+ deviceId: number().int().optional(),
16338
+ /** The domain clock, ms: observed / created / opened. */
16339
+ at: number().int().optional(),
16340
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16341
+ expiresAt: number().int().optional(),
16342
+ data: RecordBodySchema
16343
+ });
16344
+ var RecordViewSchema = object({
16345
+ id: string(),
16346
+ deviceId: number().int().nullable(),
16347
+ at: number().nullable(),
16348
+ expiresAt: number().nullable(),
16349
+ rev: number().int(),
16350
+ updatedAt: number(),
16351
+ data: RecordBodySchema
16352
+ });
16353
+ /** Declared index fields only. Anything else does not compile, by design. */
16354
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16355
+ string(),
16356
+ number(),
16357
+ boolean(),
16358
+ object({ in: array(union([
16359
+ string(),
16360
+ number(),
16361
+ boolean()
16362
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16363
+ object({
16364
+ gt: union([string(), number()]).optional(),
16365
+ gte: union([string(), number()]).optional(),
16366
+ lt: union([string(), number()]).optional(),
16367
+ lte: union([string(), number()]).optional()
16368
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16369
+ ]));
16370
+ var KindShape = { kind: RecordKindNameSchema };
16371
+ var TimeWindowShape = {
16372
+ deviceId: number().int().optional(),
16373
+ atFrom: number().optional(),
16374
+ atTo: number().optional()
16375
+ };
16376
+ var RecordQueryInputSchema = object({
16377
+ ...KindShape,
16378
+ ...TimeWindowShape,
16379
+ where: RecordWhereSchema.optional(),
16380
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16381
+ order: _enum(["at", "id"]).optional(),
16382
+ desc: boolean().optional(),
16383
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16384
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16385
+ cursor: string().min(1).optional()
16386
+ });
16387
+ var RecordQueryResultSchema = object({
16388
+ records: array(RecordViewSchema),
16389
+ nextCursor: string().nullable()
16390
+ });
16391
+ var RecordKindStateSchema = _enum([
16392
+ "created",
16393
+ "unchanged",
16394
+ "updated"
16395
+ ]);
16396
+ var DeclareKindResultSchema = object({
16397
+ kindId: number().int(),
16398
+ state: RecordKindStateSchema,
16399
+ createdIndexes: array(string()),
16400
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16401
+ adoptionPending: object({
16402
+ legacyTable: string(),
16403
+ legacyRows: number().int()
16404
+ }).nullable()
16405
+ });
16406
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16407
+ var SecretRefsList = array(string());
16408
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16409
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16410
+ kind: "mutation",
16411
+ auth: "admin"
16412
+ }), method(object({
16413
+ ...KindShape,
16414
+ id: RecordIdSchema
16415
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16416
+ ...KindShape,
16417
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16418
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16419
+ ...KindShape,
16420
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16421
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16422
+ ...KindShape,
16423
+ record: RecordInputSchema,
16424
+ /** Compare-and-set. `0` means "the row must not exist". */
16425
+ ifRev: number().int().min(0).optional()
16426
+ }), object({
16427
+ rev: number().int(),
16428
+ releasedRefs: SecretRefsList
16429
+ }), {
16430
+ kind: "mutation",
16431
+ auth: "admin"
16432
+ }), method(object({
16433
+ ...KindShape,
16434
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16435
+ }), object({
16436
+ count: number().int(),
16437
+ releasedRefs: SecretRefsList
16438
+ }), {
16439
+ kind: "mutation",
16440
+ auth: "admin"
16441
+ }), method(object({
16442
+ ...KindShape,
16443
+ id: RecordIdSchema,
16444
+ data: RecordBodySchema,
16445
+ at: number().int().nullable().optional(),
16446
+ expiresAt: number().int().nullable().optional(),
16447
+ ifRev: number().int().min(1).optional()
16448
+ }), object({
16449
+ rev: number().int(),
16450
+ releasedRefs: SecretRefsList
16451
+ }), {
16452
+ kind: "mutation",
16453
+ auth: "admin"
16454
+ }), method(object({
16455
+ ...KindShape,
16456
+ id: RecordIdSchema
16457
+ }), object({
16458
+ deleted: boolean(),
16459
+ secretRefs: SecretRefsList
16460
+ }), {
16461
+ kind: "mutation",
16462
+ auth: "admin"
16463
+ }), method(object({
16464
+ ...KindShape,
16465
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16466
+ }), object({
16467
+ deleted: number().int(),
16468
+ secretRefs: SecretRefsList
16469
+ }), {
16470
+ kind: "mutation",
16471
+ auth: "admin"
16472
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16473
+ ...KindShape,
16474
+ ...TimeWindowShape,
16475
+ where: RecordWhereSchema.optional()
16476
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16477
+ ...KindShape,
16478
+ deviceId: number().int().optional(),
16479
+ from: number(),
16480
+ to: number(),
16481
+ bucketMs: number().int().positive()
16482
+ }), object({ buckets: array(object({
16483
+ bucketStart: number(),
16484
+ count: number().int()
16485
+ })) }), { auth: "admin" }), method(object({
16486
+ ...KindShape,
16487
+ op: _enum([
16488
+ "sum",
16489
+ "min",
16490
+ "max",
16491
+ "count"
16492
+ ]),
16493
+ field: RecordFieldPathSchema.optional(),
16494
+ groupBy: RecordFieldPathSchema.optional(),
16495
+ where: RecordWhereSchema.optional()
16496
+ }), object({ rows: array(object({
16497
+ group: union([
16498
+ string(),
16499
+ number(),
16500
+ _null()
16501
+ ]),
16502
+ value: number().nullable()
16503
+ })) }), { auth: "admin" }), method(object({
16504
+ ...KindShape,
16505
+ deviceId: number().int().optional(),
16506
+ atBefore: number().optional(),
16507
+ where: RecordWhereSchema.optional()
16508
+ }), object({
16509
+ deleted: number().int(),
16510
+ secretRefs: SecretRefsList
16511
+ }), {
16512
+ kind: "mutation",
16513
+ auth: "admin"
16514
+ }), method(object({
16515
+ deviceId: number().int(),
16516
+ kinds: array(RecordKindNameSchema).optional()
16517
+ }), object({
16518
+ deleted: record(string(), number().int()),
16519
+ secretRefs: SecretRefsList
16520
+ }), {
16521
+ kind: "mutation",
16522
+ auth: "admin"
16523
+ }), method(object(KindShape), object({ id: number().int() }), {
16524
+ kind: "mutation",
16525
+ auth: "admin"
16526
+ });
16527
+ /** One table of the settings database. */
16528
+ var StorageTableSchema = object({
16529
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
16530
+ name: string(),
16531
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
16532
+ owner: string().nullable(),
16533
+ rows: number().int().nonnegative(),
16534
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
16535
+ bytes: number().int().nonnegative().nullable(),
16536
+ /** Declared by an addon since this engine process started (a running addon claims it). */
16537
+ declaredThisBoot: boolean()
16538
+ });
16539
+ /** One declared record kind (D881) as System -> Data shows it. */
16540
+ var StorageKindSchema = object({
16541
+ owner: string(),
16542
+ kind: string(),
16543
+ database: _enum(["settings", "events"]),
16544
+ class: string(),
16545
+ state: _enum([
16546
+ "declared",
16547
+ "orphaned",
16548
+ "dropped"
16549
+ ]),
16550
+ /** `null` when the caller asked for no counts (`counts: false`). */
16551
+ rows: number().int().nonnegative().nullable(),
16552
+ /** Rows x the average size of a sample; null for an empty kind. */
16553
+ bytesEstimate: number().int().nonnegative().nullable(),
16554
+ writeTrigger: string(),
16555
+ retention: RecordRetentionSchema,
16556
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16557
+ entry: boolean(),
16558
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16559
+ declaration: RecordKindDeclarationSchema
16560
+ });
16561
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16562
+ collection: string().min(1),
16563
+ expectRows: number().int().nonnegative()
16564
+ }), object({
16565
+ dropped: literal(true),
16566
+ rows: number().int().nonnegative()
16567
+ }), {
16568
+ kind: "mutation",
16569
+ auth: "admin"
16570
+ }), method(object({
16571
+ owner: string().min(1).optional(),
16572
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16573
+ counts: boolean().optional()
16574
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16575
+ owner: string().min(1),
16576
+ kind: RecordKindNameSchema
16577
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16578
+ owner: string().min(1),
16579
+ kind: RecordKindNameSchema,
16580
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16581
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16582
+ complete: boolean().optional()
16583
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16584
+ kind: "mutation",
16585
+ auth: "admin"
16586
+ }), method(object({
16587
+ collection: string().min(1),
16588
+ cursor: string().optional(),
16589
+ limit: number().int().min(1).max(1e3).optional()
16590
+ }), object({
16591
+ rows: array(object({
16592
+ id: string(),
16593
+ data: record(string(), unknown())
16594
+ })),
16595
+ nextCursor: string().nullable()
16596
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16597
+ /**
16598
+ * record-entries - the ONE admin surface for every list of user-created entries
16599
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16600
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16601
+ *
16602
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16603
+ * the entry body with `secret: true` on every credential field, so a password
16604
+ * field is derived from the schema and never from a name. `putEntry` takes the
16605
+ * redaction token for an untouched secret (the stored value is kept), a string
16606
+ * for a new one, and the clear instruction to remove one. A read never carries
16607
+ * a secret value, and a locked keychain refuses the write with
16608
+ * `records/secret-unavailable` instead of storing plaintext.
16609
+ *
16610
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16611
+ */
16612
+ var EntryKindInfoSchema = object({
16613
+ owner: string(),
16614
+ kind: RecordKindNameSchema,
16615
+ title: string(),
16616
+ nameField: string(),
16617
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16618
+ fields: record(string(), unknown()),
16619
+ secretPaths: array(string()),
16620
+ rows: number().int().nonnegative()
16621
+ });
16622
+ var EntryViewSchema = object({
16623
+ id: RecordIdSchema,
16624
+ name: string(),
16625
+ rev: number().int(),
16626
+ updatedAt: number(),
16627
+ /** Secret fields hold the redaction token. */
16628
+ data: RecordBodySchema
16629
+ });
16630
+ var EntryAddress = {
16631
+ owner: string().min(1),
16632
+ kind: RecordKindNameSchema
16633
+ };
16634
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16635
+ ...EntryAddress,
16636
+ id: RecordIdSchema.optional(),
16637
+ data: RecordBodySchema,
16638
+ ifRev: number().int().min(1).optional()
16639
+ }), object({
16640
+ id: string(),
16641
+ rev: number().int()
16642
+ }), {
16643
+ kind: "mutation",
16644
+ auth: "admin"
16645
+ }), method(object({
16646
+ ...EntryAddress,
16647
+ id: RecordIdSchema
16648
+ }), object({ deleted: boolean() }), {
16649
+ kind: "mutation",
16650
+ auth: "admin"
16651
+ });
16652
+ /**
16065
16653
  * `keychain` — the hub's encrypted store of secret values (D787).
16066
16654
  *
16067
16655
  * Settings blobs never hold a secret: they hold a marker
@@ -16602,6 +17190,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16602
17190
  kind: "mutation",
16603
17191
  auth: "admin",
16604
17192
  caller: "required"
17193
+ }), method(object({
17194
+ ref: string().min(1),
17195
+ value: string().min(1)
17196
+ }), object({
17197
+ ref: string(),
17198
+ version: number().int()
17199
+ }), {
17200
+ kind: "mutation",
17201
+ auth: "admin",
17202
+ caller: "required"
16605
17203
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16606
17204
  deleted: array(string()).readonly(),
16607
17205
  kept: array(object({
@@ -17010,7 +17608,11 @@ var deviceDiscoveryCapability = {
17010
17608
  };
17011
17609
  /**
17012
17610
  * `device-adoption` — generic discovery + adoption surface,
17013
- * system-scoped singleton. The de-HA-ified successor to `ha-discovery`:
17611
+ * system-scoped collection (one provider per integration addon), routed
17612
+ * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
17613
+ * pin model as `connection-test`. The admin UI keeps using
17614
+ * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
17615
+ * successor to `ha-discovery`:
17014
17616
  * keyed by `integrationId` (the addon resolves integrationId → broker
17015
17617
  * internally) rather than a connection-specific `brokerId`, and it
17016
17618
  * REUSES the shared `DiscoveredChildDevice` candidate type from
@@ -17175,7 +17777,7 @@ var ResyncResultSchema = object({
17175
17777
  var deviceAdoptionCapability = {
17176
17778
  name: "device-adoption",
17177
17779
  scope: "system",
17178
- mode: "singleton",
17780
+ mode: "collection",
17179
17781
  status: {
17180
17782
  schema: AdoptionStatusSchema,
17181
17783
  kind: "poll"
@@ -39292,6 +39894,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39292
39894
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39293
39895
  kind: "mutation",
39294
39896
  auth: "admin"
39897
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
39898
+ kind: "mutation",
39899
+ auth: "admin"
39295
39900
  }), method(ProfileRefInputSchema, _void(), {
39296
39901
  kind: "mutation",
39297
39902
  auth: "admin"
@@ -49801,6 +50406,41 @@ var ServerRollbackInfoSchema = object({
49801
50406
  atMs: number(),
49802
50407
  reason: string()
49803
50408
  });
50409
+ /**
50410
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50411
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50412
+ * service holds, because only the hub plans) against the states the process
50413
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50414
+ * every boot, served on `getServerPackageStatus`.
50415
+ *
50416
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50417
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50418
+ * planned runner the process service has no entry for.
50419
+ */
50420
+ var RunnerRefusalSchema = object({
50421
+ runnerId: string(),
50422
+ addonIds: array(string()),
50423
+ reason: string()
50424
+ });
50425
+ var RunnerBootCheckSchema = object({
50426
+ checkedAtMs: number(),
50427
+ /** Runners planned for this node. */
50428
+ expected: number(),
50429
+ /** Planned runners whose process is `running`. */
50430
+ running: number(),
50431
+ failed: array(string()),
50432
+ refused: array(RunnerRefusalSchema),
50433
+ missing: array(string()),
50434
+ /**
50435
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50436
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50437
+ * pushed and the verdict is re-evaluated on the next runner state change.
50438
+ * Optional for version skew (absent = settled).
50439
+ */
50440
+ pending: array(string()).optional(),
50441
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50442
+ planKnown: boolean()
50443
+ });
49804
50444
  var ServerPackageStatusSchema = object({
49805
50445
  /** Root package name (`@camstack/server` on the hub). */
49806
50446
  packageName: string(),
@@ -49863,7 +50503,14 @@ var ServerPackageStatusSchema = object({
49863
50503
  * for version skew: an older provider's payload simply omits it, and an
49864
50504
  * absent wrapper is unknown — never `native`.
49865
50505
  */
49866
- wrapper: WrapperIdentitySchema.optional()
50506
+ wrapper: WrapperIdentitySchema.optional(),
50507
+ /**
50508
+ * What this node PLANNED to run against what its process service reports
50509
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50510
+ * on a provider that predates it. Absent is "not checked yet", never "all
50511
+ * well": a consumer that needs the answer treats it as pending.
50512
+ */
50513
+ runners: RunnerBootCheckSchema.optional()
49867
50514
  });
49868
50515
  var ServerUpdateCheckResultSchema = object({
49869
50516
  packageName: string(),
@@ -49914,6 +50561,13 @@ var ServerUpdateOutcomeSchema = _enum([
49914
50561
  "refused",
49915
50562
  "failed"
49916
50563
  ]);
50564
+ /** One addon the pre-flight found the target version would refuse (D877). */
50565
+ var UpdateBlockerSchema = object({
50566
+ addonId: string(),
50567
+ reason: string(),
50568
+ /** What the operator does about it. */
50569
+ remedy: string()
50570
+ });
49917
50571
  var ServerUpdateActionResultSchema = object({
49918
50572
  accepted: boolean(),
49919
50573
  targetVersion: string().nullable(),
@@ -49931,14 +50585,27 @@ var ServerUpdateActionResultSchema = object({
49931
50585
  * The failure itself, verbatim enough to act on (the npm output for a
49932
50586
  * staging install). Non-null only for `failed`.
49933
50587
  */
49934
- error: string().nullable().optional()
50588
+ error: string().nullable().optional(),
50589
+ /**
50590
+ * The addons the target version would refuse to start on this node's live
50591
+ * store (D877), present when the pre-flight refused the update
50592
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50593
+ */
50594
+ blockers: array(UpdateBlockerSchema).optional()
49935
50595
  });
49936
50596
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
49937
50597
  kind: "mutation",
49938
50598
  auth: "admin"
49939
- }), method(object({
49940
- /** Explicit target version; omitted = latest from the registry. */
49941
- version: string().optional() }), ServerUpdateActionResultSchema, {
50599
+ }), method(object({
50600
+ /** Explicit target version; omitted = latest from the registry. */
50601
+ version: string().optional(),
50602
+ /**
50603
+ * Apply even though the pre-flight (D877) found addons the target would
50604
+ * refuse to start. Off by default: those addons stay down until the
50605
+ * remedy is run, which is the incident this gate exists to prevent.
50606
+ */
50607
+ acknowledgeRefusals: boolean().optional()
50608
+ }), ServerUpdateActionResultSchema, {
49942
50609
  kind: "mutation",
49943
50610
  auth: "admin",
49944
50611
  timeoutMs: 16 * 6e4
@@ -52384,7 +53051,9 @@ var ManifestShapeSchema = object({
52384
53051
  var AddonProcessSchema = object({
52385
53052
  pid: number().optional(),
52386
53053
  mode: string(),
52387
- state: string()
53054
+ state: string(),
53055
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53056
+ reason: string().optional()
52388
53057
  });
52389
53058
  /**
52390
53059
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -53152,7 +53821,8 @@ var batteryCapability = {
53152
53821
  DeviceType.Button,
53153
53822
  DeviceType.Switch,
53154
53823
  DeviceType.PetFeeder,
53155
- DeviceType.Container
53824
+ DeviceType.Container,
53825
+ DeviceType.Thermostat
53156
53826
  ],
53157
53827
  methods: {
53158
53828
  /**
@@ -53790,6 +54460,12 @@ var ClimateControlStatusSchema = object({
53790
54460
  /** Horizontal louver swing on/off. Null when the device has no
53791
54461
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
53792
54462
  swingHorizontal: boolean().nullable(),
54463
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
54464
+ minTemp: number().nullable().optional(),
54465
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
54466
+ maxTemp: number().nullable().optional(),
54467
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
54468
+ tempStep: number().positive().nullable().optional(),
53793
54469
  /** Ms epoch when the slice was last updated (push or command). */
53794
54470
  lastFetchedAt: number()
53795
54471
  });
@@ -54644,6 +55320,161 @@ onStatusChanged: { data: object({
54644
55320
  * whether persisting is worth a SQLite commit. */
54645
55321
  volatileStateFields: ["lastChangedAt"]
54646
55322
  };
55323
+ /**
55324
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
55325
+ * consumable levels (salt, rinse aid) and common program options.
55326
+ *
55327
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
55328
+ * by any integration that exposes the same program / option surface.
55329
+ *
55330
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
55331
+ * provider refreshes the slice on an interval and eagerly after commands.
55332
+ */
55333
+ var DishwasherStateSchema = _enum([
55334
+ "idle",
55335
+ "running",
55336
+ "paused",
55337
+ "finished",
55338
+ "error",
55339
+ "unavailable"
55340
+ ]);
55341
+ var DishwasherConsumableLevelSchema = _enum([
55342
+ "ok",
55343
+ "low",
55344
+ "empty"
55345
+ ]);
55346
+ var DishwasherStatusSchema = object({
55347
+ state: DishwasherStateSchema,
55348
+ /** Active program id/name, or null when none selected / unknown. */
55349
+ program: string().nullable(),
55350
+ /** Program tokens the hardware accepts — drives the UI selector. */
55351
+ availablePrograms: array(string()),
55352
+ /** Minutes remaining on the active cycle, or null when not running. */
55353
+ remainingMinutes: number().int().nonnegative().nullable(),
55354
+ /** Cycle completion 0..100, or null when not applicable. */
55355
+ progressPercent: number().min(0).max(100).nullable(),
55356
+ /** True when the door is reported open. */
55357
+ doorOpen: boolean(),
55358
+ /** True when remote start is allowed (door closed, power on, etc.). */
55359
+ remoteStartAllowed: boolean(),
55360
+ /** Main power / switched-on state. */
55361
+ powerOn: boolean(),
55362
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
55363
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
55364
+ halfLoad: boolean(),
55365
+ hygienePlus: boolean(),
55366
+ /** Extra dry option when the appliance exposes it. */
55367
+ extraDry: boolean(),
55368
+ /** Intensive zone (lower basket) when the appliance exposes it. */
55369
+ intensiveZone: boolean(),
55370
+ /** VarioSpeed / VarioSpeed+ when the appliance exposes it. */
55371
+ varioSpeedPlus: boolean(),
55372
+ /** Child lock (controls disabled on the appliance). */
55373
+ childLock: boolean(),
55374
+ errorCode: number().nullable(),
55375
+ errorLabel: string().nullable(),
55376
+ lastFetchedAt: number()
55377
+ });
55378
+ var dishwasherCapability = {
55379
+ name: "dishwasher",
55380
+ scope: "device",
55381
+ deviceNative: true,
55382
+ mode: "singleton",
55383
+ deviceTypes: [DeviceType.Dishwasher],
55384
+ methods: {
55385
+ start: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55386
+ kind: "mutation",
55387
+ auth: "protected"
55388
+ }),
55389
+ pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55390
+ kind: "mutation",
55391
+ auth: "protected"
55392
+ }),
55393
+ stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55394
+ kind: "mutation",
55395
+ auth: "protected"
55396
+ }),
55397
+ setProgram: method(object({
55398
+ deviceId: number().int().nonnegative(),
55399
+ program: string().min(1)
55400
+ }), _void(), {
55401
+ kind: "mutation",
55402
+ auth: "protected"
55403
+ }),
55404
+ setPower: method(object({
55405
+ deviceId: number().int().nonnegative(),
55406
+ on: boolean()
55407
+ }), _void(), {
55408
+ kind: "mutation",
55409
+ auth: "protected"
55410
+ }),
55411
+ setHalfLoad: method(object({
55412
+ deviceId: number().int().nonnegative(),
55413
+ on: boolean()
55414
+ }), _void(), {
55415
+ kind: "mutation",
55416
+ auth: "protected"
55417
+ }),
55418
+ setHygienePlus: method(object({
55419
+ deviceId: number().int().nonnegative(),
55420
+ on: boolean()
55421
+ }), _void(), {
55422
+ kind: "mutation",
55423
+ auth: "protected"
55424
+ }),
55425
+ setExtraDry: method(object({
55426
+ deviceId: number().int().nonnegative(),
55427
+ on: boolean()
55428
+ }), _void(), {
55429
+ kind: "mutation",
55430
+ auth: "protected"
55431
+ }),
55432
+ setIntensiveZone: method(object({
55433
+ deviceId: number().int().nonnegative(),
55434
+ on: boolean()
55435
+ }), _void(), {
55436
+ kind: "mutation",
55437
+ auth: "protected"
55438
+ }),
55439
+ setVarioSpeedPlus: method(object({
55440
+ deviceId: number().int().nonnegative(),
55441
+ on: boolean()
55442
+ }), _void(), {
55443
+ kind: "mutation",
55444
+ auth: "protected"
55445
+ }),
55446
+ setChildLock: method(object({
55447
+ deviceId: number().int().nonnegative(),
55448
+ on: boolean()
55449
+ }), _void(), {
55450
+ kind: "mutation",
55451
+ auth: "protected"
55452
+ }),
55453
+ setOption: method(object({
55454
+ deviceId: number().int().nonnegative(),
55455
+ key: string().min(1),
55456
+ value: union([
55457
+ boolean(),
55458
+ string(),
55459
+ number()
55460
+ ])
55461
+ }), _void(), {
55462
+ kind: "mutation",
55463
+ auth: "protected"
55464
+ })
55465
+ },
55466
+ status: {
55467
+ schema: DishwasherStatusSchema,
55468
+ kind: "poll"
55469
+ },
55470
+ runtimeState: DishwasherStatusSchema,
55471
+ durability: "session",
55472
+ history: { fields: { progressPercent: {
55473
+ kind: "gauge",
55474
+ unit: "%",
55475
+ deadband: 2
55476
+ } } }
55477
+ };
54647
55478
  var DoorbellStatusSchema = object({
54648
55479
  /** Ms epoch of the last press. null = never observed since this provider started. */
54649
55480
  lastPressedAt: number().nullable(),
@@ -55446,6 +56277,32 @@ var gasCapability = {
55446
56277
  * whether persisting is worth a SQLite commit. */
55447
56278
  volatileStateFields: ["lastChangedAt"]
55448
56279
  };
56280
+ var HeatingValveStatusSchema = object({
56281
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
56282
+ position: number().min(0).max(100).nullable(),
56283
+ /** Ms epoch when the slice was last updated (push or poll). */
56284
+ lastFetchedAt: number()
56285
+ });
56286
+ var heatingValveCapability = {
56287
+ name: "heating-valve",
56288
+ scope: "device",
56289
+ deviceNative: true,
56290
+ mode: "singleton",
56291
+ deviceTypes: [DeviceType.Thermostat],
56292
+ methods: {},
56293
+ status: {
56294
+ schema: HeatingValveStatusSchema,
56295
+ kind: "push"
56296
+ },
56297
+ runtimeState: HeatingValveStatusSchema,
56298
+ durability: "session",
56299
+ history: { fields: { position: {
56300
+ kind: "gauge",
56301
+ unit: "%",
56302
+ deadband: 1
56303
+ } } },
56304
+ volatileStateFields: ["lastFetchedAt"]
56305
+ };
55449
56306
  /**
55450
56307
  * Humidifier / dehumidifier cap. Models HA `humidifier.*` entities —
55451
56308
  * an on/off actuator with an optional target-humidity setpoint and an
@@ -56578,7 +57435,19 @@ var TlsStatusSchema = object({
56578
57435
  sans: array(string()),
56579
57436
  caCertPem: string().nullable(),
56580
57437
  reissueError: string().nullable(),
56581
- restartRequired: boolean()
57438
+ restartRequired: boolean(),
57439
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
57440
+ caMissing: boolean(),
57441
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
57442
+ localCaConstrained: boolean().nullable(),
57443
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
57444
+ caReplacedAt: string().nullable(),
57445
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
57446
+ storedUpload: object({
57447
+ leafFingerprintSha256: string(),
57448
+ validTo: string(),
57449
+ hasCa: boolean()
57450
+ }).nullable()
56582
57451
  });
56583
57452
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
56584
57453
  /**
@@ -56634,6 +57503,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
56634
57503
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
56635
57504
  kind: "mutation",
56636
57505
  auth: "admin"
57506
+ }), method(_void(), TlsStatusSchema, {
57507
+ kind: "mutation",
57508
+ auth: "admin"
56637
57509
  });
56638
57510
  var LockControlStatusSchema = object({
56639
57511
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -63275,7 +64147,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
63275
64147
  kind: "mutation",
63276
64148
  auth: "admin",
63277
64149
  access: "delete"
63278
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
64150
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
64151
+ kind: "mutation",
64152
+ auth: "admin",
64153
+ access: "create"
64154
+ }), method(object({
63279
64155
  userId: string(),
63280
64156
  code: string()
63281
64157
  }), object({ valid: boolean() }), {
@@ -64995,6 +65871,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
64995
65871
  dayNight: dayNightCapability,
64996
65872
  deviceDiscovery: deviceDiscoveryCapability,
64997
65873
  deviceStatus: deviceStatusCapability,
65874
+ dishwasher: dishwasherCapability,
64998
65875
  doorbell: doorbellCapability,
64999
65876
  enumSensor: enumSensorCapability,
65000
65877
  eventEmitter: eventEmitterCapability,
@@ -65002,6 +65879,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
65002
65879
  featureProbe: featureProbeCapability,
65003
65880
  flood: floodCapability,
65004
65881
  gas: gasCapability,
65882
+ heatingValve: heatingValveCapability,
65005
65883
  humidifier: humidifierCapability,
65006
65884
  humiditySensor: humiditySensorCapability,
65007
65885
  image: imageCapability,
@@ -65087,13 +65965,14 @@ var BaseDevice$1 = class {
65087
65965
  get state() {
65088
65966
  if (!this._stateProxyCache) {
65089
65967
  const cache = {};
65090
- const handler = { get: (_target, key) => {
65968
+ const handler = { get: (target, key) => {
65091
65969
  const k = key;
65092
- if (k in cache) return cache[k];
65970
+ const existing = Reflect.get(target, k);
65971
+ if (existing !== void 0) return existing;
65093
65972
  const cap = DEVICE_LOCAL_STATE_CAPS[k];
65094
65973
  if (!cap) return void 0;
65095
65974
  const proxy = this.sliceProxy(cap);
65096
- cache[k] = proxy;
65975
+ Reflect.set(target, k, proxy);
65097
65976
  return proxy;
65098
65977
  } };
65099
65978
  this._stateProxyCache = new Proxy(cache, handler);
@@ -65292,7 +66171,7 @@ var BaseDevice$1 = class {
65292
66171
  async updateSourceInfo(patch) {
65293
66172
  const next = mergeSourceInfo(this.sourceInfo, patch);
65294
66173
  this._sourceInfoCache = Object.freeze({ ...next });
65295
- const action = this.ctx.api?.deviceManager?.setMetadata;
66174
+ const action = this.ctx.api.deviceManager?.setMetadata;
65296
66175
  if (action) try {
65297
66176
  await action.mutate({
65298
66177
  deviceId: this.id,
@@ -65327,7 +66206,7 @@ var BaseDevice$1 = class {
65327
66206
  * device boot on a meta refresh.
65328
66207
  */
65329
66208
  async refreshFeatures() {
65330
- const action = this.ctx.api?.deviceManager?.registerDevice;
66209
+ const action = this.ctx.api.deviceManager?.registerDevice;
65331
66210
  if (!action) return;
65332
66211
  try {
65333
66212
  await action.mutate({
@@ -65726,6 +66605,12 @@ var BaseDeviceProvider = class extends BaseAddon {
65726
66605
  provider: this
65727
66606
  }];
65728
66607
  }
66608
+ /** Flatten `super.onInitialize()` whether it returned an array or an envelope. */
66609
+ providerRegistrationsFromSuper(result) {
66610
+ if (Array.isArray(result)) return result;
66611
+ if (result !== void 0 && result.providers !== void 0) return [...result.providers];
66612
+ return [];
66613
+ }
65729
66614
  async onShutdown() {
65730
66615
  this._restoreShuttingDown = true;
65731
66616
  this.cancelRestoreRetries();
@@ -66252,7 +67137,7 @@ var BaseDeviceProvider = class extends BaseAddon {
66252
67137
  return toDeviceSummary(device, this.addonId);
66253
67138
  }
66254
67139
  };
66255
- 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;
67140
+ 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;
66256
67141
  new Set(Object.values(DeviceType));
66257
67142
  Object.freeze({
66258
67143
  "accessories.getStatus": {
@@ -67401,6 +68286,12 @@ Object.freeze({
67401
68286
  addonId: null,
67402
68287
  access: "view"
67403
68288
  },
68289
+ "coreBlocks.migrateRawSecrets": {
68290
+ capName: "core-blocks",
68291
+ capScope: "system",
68292
+ addonId: null,
68293
+ access: "create"
68294
+ },
67404
68295
  "coreBlocks.restart": {
67405
68296
  capName: "core-blocks",
67406
68297
  capScope: "system",
@@ -68667,6 +69558,84 @@ Object.freeze({
68667
69558
  addonId: null,
68668
69559
  access: "view"
68669
69560
  },
69561
+ "dishwasher.getStatus": {
69562
+ capName: "dishwasher",
69563
+ capScope: "device",
69564
+ addonId: null,
69565
+ access: "view"
69566
+ },
69567
+ "dishwasher.pause": {
69568
+ capName: "dishwasher",
69569
+ capScope: "device",
69570
+ addonId: null,
69571
+ access: "create"
69572
+ },
69573
+ "dishwasher.setChildLock": {
69574
+ capName: "dishwasher",
69575
+ capScope: "device",
69576
+ addonId: null,
69577
+ access: "create"
69578
+ },
69579
+ "dishwasher.setExtraDry": {
69580
+ capName: "dishwasher",
69581
+ capScope: "device",
69582
+ addonId: null,
69583
+ access: "create"
69584
+ },
69585
+ "dishwasher.setHalfLoad": {
69586
+ capName: "dishwasher",
69587
+ capScope: "device",
69588
+ addonId: null,
69589
+ access: "create"
69590
+ },
69591
+ "dishwasher.setHygienePlus": {
69592
+ capName: "dishwasher",
69593
+ capScope: "device",
69594
+ addonId: null,
69595
+ access: "create"
69596
+ },
69597
+ "dishwasher.setIntensiveZone": {
69598
+ capName: "dishwasher",
69599
+ capScope: "device",
69600
+ addonId: null,
69601
+ access: "create"
69602
+ },
69603
+ "dishwasher.setOption": {
69604
+ capName: "dishwasher",
69605
+ capScope: "device",
69606
+ addonId: null,
69607
+ access: "create"
69608
+ },
69609
+ "dishwasher.setPower": {
69610
+ capName: "dishwasher",
69611
+ capScope: "device",
69612
+ addonId: null,
69613
+ access: "create"
69614
+ },
69615
+ "dishwasher.setProgram": {
69616
+ capName: "dishwasher",
69617
+ capScope: "device",
69618
+ addonId: null,
69619
+ access: "create"
69620
+ },
69621
+ "dishwasher.setVarioSpeedPlus": {
69622
+ capName: "dishwasher",
69623
+ capScope: "device",
69624
+ addonId: null,
69625
+ access: "create"
69626
+ },
69627
+ "dishwasher.start": {
69628
+ capName: "dishwasher",
69629
+ capScope: "device",
69630
+ addonId: null,
69631
+ access: "create"
69632
+ },
69633
+ "dishwasher.stop": {
69634
+ capName: "dishwasher",
69635
+ capScope: "device",
69636
+ addonId: null,
69637
+ access: "create"
69638
+ },
68670
69639
  "doorbell.getStatus": {
68671
69640
  capName: "doorbell",
68672
69641
  capScope: "device",
@@ -68877,6 +69846,12 @@ Object.freeze({
68877
69846
  addonId: null,
68878
69847
  access: "view"
68879
69848
  },
69849
+ "heatingValve.getStatus": {
69850
+ capName: "heating-valve",
69851
+ capScope: "device",
69852
+ addonId: null,
69853
+ access: "view"
69854
+ },
68880
69855
  "humidifier.getStatus": {
68881
69856
  capName: "humidifier",
68882
69857
  capScope: "device",
@@ -69087,6 +70062,12 @@ Object.freeze({
69087
70062
  addonId: null,
69088
70063
  access: "create"
69089
70064
  },
70065
+ "keychainAdmin.importSecret": {
70066
+ capName: "keychain-admin",
70067
+ capScope: "system",
70068
+ addonId: null,
70069
+ access: "create"
70070
+ },
69090
70071
  "keychainAdmin.listAudit": {
69091
70072
  capName: "keychain-admin",
69092
70073
  capScope: "system",
@@ -69255,6 +70236,12 @@ Object.freeze({
69255
70236
  addonId: null,
69256
70237
  access: "view"
69257
70238
  },
70239
+ "llm.migrateRawSecrets": {
70240
+ capName: "llm",
70241
+ capScope: "system",
70242
+ addonId: null,
70243
+ access: "create"
70244
+ },
69258
70245
  "llm.resolveModelRef": {
69259
70246
  capName: "llm",
69260
70247
  capScope: "system",
@@ -69483,6 +70470,12 @@ Object.freeze({
69483
70470
  addonId: null,
69484
70471
  access: "create"
69485
70472
  },
70473
+ "localNetwork.useStoredUploadedCertificate": {
70474
+ capName: "local-network",
70475
+ capScope: "system",
70476
+ addonId: null,
70477
+ access: "create"
70478
+ },
69486
70479
  "lockControl.getStatus": {
69487
70480
  capName: "lock-control",
69488
70481
  capScope: "device",
@@ -72135,6 +73128,30 @@ Object.freeze({
72135
73128
  addonId: null,
72136
73129
  access: "create"
72137
73130
  },
73131
+ "recordEntries.deleteEntry": {
73132
+ capName: "record-entries",
73133
+ capScope: "system",
73134
+ addonId: null,
73135
+ access: "delete"
73136
+ },
73137
+ "recordEntries.listEntries": {
73138
+ capName: "record-entries",
73139
+ capScope: "system",
73140
+ addonId: null,
73141
+ access: "view"
73142
+ },
73143
+ "recordEntries.listEntryKinds": {
73144
+ capName: "record-entries",
73145
+ capScope: "system",
73146
+ addonId: null,
73147
+ access: "view"
73148
+ },
73149
+ "recordEntries.putEntry": {
73150
+ capName: "record-entries",
73151
+ capScope: "system",
73152
+ addonId: null,
73153
+ access: "create"
73154
+ },
72138
73155
  "recording.getAvailability": {
72139
73156
  capName: "recording",
72140
73157
  capScope: "device",
@@ -72435,6 +73452,102 @@ Object.freeze({
72435
73452
  addonId: null,
72436
73453
  access: "view"
72437
73454
  },
73455
+ "records.aggregate": {
73456
+ capName: "records",
73457
+ capScope: "system",
73458
+ addonId: null,
73459
+ access: "view"
73460
+ },
73461
+ "records.allocateId": {
73462
+ capName: "records",
73463
+ capScope: "system",
73464
+ addonId: null,
73465
+ access: "create"
73466
+ },
73467
+ "records.count": {
73468
+ capName: "records",
73469
+ capScope: "system",
73470
+ addonId: null,
73471
+ access: "view"
73472
+ },
73473
+ "records.declareKinds": {
73474
+ capName: "records",
73475
+ capScope: "system",
73476
+ addonId: null,
73477
+ access: "create"
73478
+ },
73479
+ "records.delete": {
73480
+ capName: "records",
73481
+ capScope: "system",
73482
+ addonId: null,
73483
+ access: "delete"
73484
+ },
73485
+ "records.deleteDevice": {
73486
+ capName: "records",
73487
+ capScope: "system",
73488
+ addonId: null,
73489
+ access: "delete"
73490
+ },
73491
+ "records.deleteMany": {
73492
+ capName: "records",
73493
+ capScope: "system",
73494
+ addonId: null,
73495
+ access: "delete"
73496
+ },
73497
+ "records.deleteWhere": {
73498
+ capName: "records",
73499
+ capScope: "system",
73500
+ addonId: null,
73501
+ access: "delete"
73502
+ },
73503
+ "records.get": {
73504
+ capName: "records",
73505
+ capScope: "system",
73506
+ addonId: null,
73507
+ access: "view"
73508
+ },
73509
+ "records.getMany": {
73510
+ capName: "records",
73511
+ capScope: "system",
73512
+ addonId: null,
73513
+ access: "view"
73514
+ },
73515
+ "records.histogram": {
73516
+ capName: "records",
73517
+ capScope: "system",
73518
+ addonId: null,
73519
+ access: "view"
73520
+ },
73521
+ "records.patch": {
73522
+ capName: "records",
73523
+ capScope: "system",
73524
+ addonId: null,
73525
+ access: "create"
73526
+ },
73527
+ "records.put": {
73528
+ capName: "records",
73529
+ capScope: "system",
73530
+ addonId: null,
73531
+ access: "create"
73532
+ },
73533
+ "records.putMany": {
73534
+ capName: "records",
73535
+ capScope: "system",
73536
+ addonId: null,
73537
+ access: "create"
73538
+ },
73539
+ "records.query": {
73540
+ capName: "records",
73541
+ capScope: "system",
73542
+ addonId: null,
73543
+ access: "view"
73544
+ },
73545
+ "records.secretRefs": {
73546
+ capName: "records",
73547
+ capScope: "system",
73548
+ addonId: null,
73549
+ access: "view"
73550
+ },
72438
73551
  "sceneMonitor.captureReference": {
72439
73552
  capName: "scene-monitor",
72440
73553
  capScope: "device",
@@ -72867,6 +73980,48 @@ Object.freeze({
72867
73980
  addonId: null,
72868
73981
  access: "create"
72869
73982
  },
73983
+ "storageAdmin.adoptRecords": {
73984
+ capName: "storage-admin",
73985
+ capScope: "system",
73986
+ addonId: null,
73987
+ access: "create"
73988
+ },
73989
+ "storageAdmin.dropCollection": {
73990
+ capName: "storage-admin",
73991
+ capScope: "system",
73992
+ addonId: null,
73993
+ access: "delete"
73994
+ },
73995
+ "storageAdmin.isAdoptedLegacyTable": {
73996
+ capName: "storage-admin",
73997
+ capScope: "system",
73998
+ addonId: null,
73999
+ access: "view"
74000
+ },
74001
+ "storageAdmin.listKinds": {
74002
+ capName: "storage-admin",
74003
+ capScope: "system",
74004
+ addonId: null,
74005
+ access: "view"
74006
+ },
74007
+ "storageAdmin.listTables": {
74008
+ capName: "storage-admin",
74009
+ capScope: "system",
74010
+ addonId: null,
74011
+ access: "view"
74012
+ },
74013
+ "storageAdmin.readLegacyCollection": {
74014
+ capName: "storage-admin",
74015
+ capScope: "system",
74016
+ addonId: null,
74017
+ access: "view"
74018
+ },
74019
+ "storageAdmin.readRecords": {
74020
+ capName: "storage-admin",
74021
+ capScope: "system",
74022
+ addonId: null,
74023
+ access: "view"
74024
+ },
72870
74025
  "storageEvictable.evict": {
72871
74026
  capName: "storage-evictable",
72872
74027
  capScope: "system",
@@ -73779,6 +74934,12 @@ Object.freeze({
73779
74934
  addonId: null,
73780
74935
  access: "view"
73781
74936
  },
74937
+ "userManagement.migrateRawSecrets": {
74938
+ capName: "user-management",
74939
+ capScope: "system",
74940
+ addonId: null,
74941
+ access: "create"
74942
+ },
73782
74943
  "userManagement.oauthExchangeCode": {
73783
74944
  capName: "user-management",
73784
74945
  capScope: "system",
@@ -74278,7 +75439,7 @@ Object.freeze({
74278
75439
  access: "create"
74279
75440
  }
74280
75441
  });
74281
- 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;
75442
+ 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;
74282
75443
  DeviceFeature.BatteryOperated;
74283
75444
  Object.freeze({
74284
75445
  "accessories.getStatus": [{
@@ -75102,6 +76263,71 @@ Object.freeze({
75102
76263
  form: "single",
75103
76264
  optional: false
75104
76265
  }],
76266
+ "dishwasher.getStatus": [{
76267
+ name: "deviceId",
76268
+ form: "single",
76269
+ optional: false
76270
+ }],
76271
+ "dishwasher.pause": [{
76272
+ name: "deviceId",
76273
+ form: "single",
76274
+ optional: false
76275
+ }],
76276
+ "dishwasher.setChildLock": [{
76277
+ name: "deviceId",
76278
+ form: "single",
76279
+ optional: false
76280
+ }],
76281
+ "dishwasher.setExtraDry": [{
76282
+ name: "deviceId",
76283
+ form: "single",
76284
+ optional: false
76285
+ }],
76286
+ "dishwasher.setHalfLoad": [{
76287
+ name: "deviceId",
76288
+ form: "single",
76289
+ optional: false
76290
+ }],
76291
+ "dishwasher.setHygienePlus": [{
76292
+ name: "deviceId",
76293
+ form: "single",
76294
+ optional: false
76295
+ }],
76296
+ "dishwasher.setIntensiveZone": [{
76297
+ name: "deviceId",
76298
+ form: "single",
76299
+ optional: false
76300
+ }],
76301
+ "dishwasher.setOption": [{
76302
+ name: "deviceId",
76303
+ form: "single",
76304
+ optional: false
76305
+ }],
76306
+ "dishwasher.setPower": [{
76307
+ name: "deviceId",
76308
+ form: "single",
76309
+ optional: false
76310
+ }],
76311
+ "dishwasher.setProgram": [{
76312
+ name: "deviceId",
76313
+ form: "single",
76314
+ optional: false
76315
+ }],
76316
+ "dishwasher.setVarioSpeedPlus": [{
76317
+ name: "deviceId",
76318
+ form: "single",
76319
+ optional: false
76320
+ }],
76321
+ "dishwasher.start": [{
76322
+ name: "deviceId",
76323
+ form: "single",
76324
+ optional: false
76325
+ }],
76326
+ "dishwasher.stop": [{
76327
+ name: "deviceId",
76328
+ form: "single",
76329
+ optional: false
76330
+ }],
75105
76331
  "doorbell.getStatus": [{
75106
76332
  name: "deviceId",
75107
76333
  form: "single",
@@ -75171,6 +76397,11 @@ Object.freeze({
75171
76397
  form: "single",
75172
76398
  optional: false
75173
76399
  }],
76400
+ "heatingValve.getStatus": [{
76401
+ name: "deviceId",
76402
+ form: "single",
76403
+ optional: false
76404
+ }],
75174
76405
  "humidifier.getStatus": [{
75175
76406
  name: "deviceId",
75176
76407
  form: "single",
@@ -76455,6 +77686,37 @@ Object.freeze({
76455
77686
  form: "single",
76456
77687
  optional: false
76457
77688
  }],
77689
+ "records.count": [{
77690
+ name: "deviceId",
77691
+ form: "single",
77692
+ optional: true
77693
+ }],
77694
+ "records.deleteDevice": [{
77695
+ name: "deviceId",
77696
+ form: "single",
77697
+ optional: false
77698
+ }],
77699
+ "records.deleteWhere": [{
77700
+ name: "deviceId",
77701
+ form: "single",
77702
+ optional: true
77703
+ }],
77704
+ "records.histogram": [{
77705
+ name: "deviceId",
77706
+ form: "single",
77707
+ optional: true
77708
+ }],
77709
+ "records.putMany": [{
77710
+ name: "records",
77711
+ form: "object-array",
77712
+ optional: false,
77713
+ itemField: "deviceId"
77714
+ }],
77715
+ "records.query": [{
77716
+ name: "deviceId",
77717
+ form: "single",
77718
+ optional: true
77719
+ }],
76458
77720
  "sceneMonitor.captureReference": [{
76459
77721
  name: "deviceId",
76460
77722
  form: "single",
@@ -76571,6 +77833,17 @@ Object.freeze({
76571
77833
  form: "single",
76572
77834
  optional: false
76573
77835
  }],
77836
+ "storageAdmin.adoptRecords": [{
77837
+ name: "records",
77838
+ form: "object-array",
77839
+ optional: false,
77840
+ itemField: "deviceId"
77841
+ }],
77842
+ "storageAdmin.readRecords": [{
77843
+ name: "deviceId",
77844
+ form: "single",
77845
+ optional: true
77846
+ }],
76574
77847
  "streamBroker.acquireEgressTranscode": [{
76575
77848
  name: "deviceId",
76576
77849
  form: "single",
@@ -183469,7 +184742,7 @@ var DreameProviderAddon = class extends BaseDeviceProvider {
183469
184742
  super({});
183470
184743
  }
183471
184744
  async onInitialize() {
183472
- const regs = await super.onInitialize();
184745
+ const regs = this.providerRegistrationsFromSuper(await super.onInitialize());
183473
184746
  this.clients = new DreameClientRegistry(this.ctx.logger);
183474
184747
  this.clients.setOnConnected((integrationId) => {
183475
184748
  this.ctx.logger.info("Dreame: integration connected", { meta: { integrationId } });