@camstack/addon-provider-dreame 0.2.133 → 0.2.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +1312 -123
  2. package/dist/addon.mjs +1312 -123
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -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-BOjuyoPC.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({
@@ -39292,6 +39890,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39292
39890
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39293
39891
  kind: "mutation",
39294
39892
  auth: "admin"
39893
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
39894
+ kind: "mutation",
39895
+ auth: "admin"
39295
39896
  }), method(ProfileRefInputSchema, _void(), {
39296
39897
  kind: "mutation",
39297
39898
  auth: "admin"
@@ -49801,6 +50402,41 @@ var ServerRollbackInfoSchema = object({
49801
50402
  atMs: number(),
49802
50403
  reason: string()
49803
50404
  });
50405
+ /**
50406
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50407
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50408
+ * service holds, because only the hub plans) against the states the process
50409
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50410
+ * every boot, served on `getServerPackageStatus`.
50411
+ *
50412
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50413
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50414
+ * planned runner the process service has no entry for.
50415
+ */
50416
+ var RunnerRefusalSchema = object({
50417
+ runnerId: string(),
50418
+ addonIds: array(string()),
50419
+ reason: string()
50420
+ });
50421
+ var RunnerBootCheckSchema = object({
50422
+ checkedAtMs: number(),
50423
+ /** Runners planned for this node. */
50424
+ expected: number(),
50425
+ /** Planned runners whose process is `running`. */
50426
+ running: number(),
50427
+ failed: array(string()),
50428
+ refused: array(RunnerRefusalSchema),
50429
+ missing: array(string()),
50430
+ /**
50431
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50432
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50433
+ * pushed and the verdict is re-evaluated on the next runner state change.
50434
+ * Optional for version skew (absent = settled).
50435
+ */
50436
+ pending: array(string()).optional(),
50437
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50438
+ planKnown: boolean()
50439
+ });
49804
50440
  var ServerPackageStatusSchema = object({
49805
50441
  /** Root package name (`@camstack/server` on the hub). */
49806
50442
  packageName: string(),
@@ -49863,7 +50499,14 @@ var ServerPackageStatusSchema = object({
49863
50499
  * for version skew: an older provider's payload simply omits it, and an
49864
50500
  * absent wrapper is unknown — never `native`.
49865
50501
  */
49866
- wrapper: WrapperIdentitySchema.optional()
50502
+ wrapper: WrapperIdentitySchema.optional(),
50503
+ /**
50504
+ * What this node PLANNED to run against what its process service reports
50505
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50506
+ * on a provider that predates it. Absent is "not checked yet", never "all
50507
+ * well": a consumer that needs the answer treats it as pending.
50508
+ */
50509
+ runners: RunnerBootCheckSchema.optional()
49867
50510
  });
49868
50511
  var ServerUpdateCheckResultSchema = object({
49869
50512
  packageName: string(),
@@ -49914,6 +50557,13 @@ var ServerUpdateOutcomeSchema = _enum([
49914
50557
  "refused",
49915
50558
  "failed"
49916
50559
  ]);
50560
+ /** One addon the pre-flight found the target version would refuse (D877). */
50561
+ var UpdateBlockerSchema = object({
50562
+ addonId: string(),
50563
+ reason: string(),
50564
+ /** What the operator does about it. */
50565
+ remedy: string()
50566
+ });
49917
50567
  var ServerUpdateActionResultSchema = object({
49918
50568
  accepted: boolean(),
49919
50569
  targetVersion: string().nullable(),
@@ -49931,14 +50581,27 @@ var ServerUpdateActionResultSchema = object({
49931
50581
  * The failure itself, verbatim enough to act on (the npm output for a
49932
50582
  * staging install). Non-null only for `failed`.
49933
50583
  */
49934
- error: string().nullable().optional()
50584
+ error: string().nullable().optional(),
50585
+ /**
50586
+ * The addons the target version would refuse to start on this node's live
50587
+ * store (D877), present when the pre-flight refused the update
50588
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50589
+ */
50590
+ blockers: array(UpdateBlockerSchema).optional()
49935
50591
  });
49936
50592
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
49937
50593
  kind: "mutation",
49938
50594
  auth: "admin"
49939
- }), method(object({
49940
- /** Explicit target version; omitted = latest from the registry. */
49941
- version: string().optional() }), ServerUpdateActionResultSchema, {
50595
+ }), method(object({
50596
+ /** Explicit target version; omitted = latest from the registry. */
50597
+ version: string().optional(),
50598
+ /**
50599
+ * Apply even though the pre-flight (D877) found addons the target would
50600
+ * refuse to start. Off by default: those addons stay down until the
50601
+ * remedy is run, which is the incident this gate exists to prevent.
50602
+ */
50603
+ acknowledgeRefusals: boolean().optional()
50604
+ }), ServerUpdateActionResultSchema, {
49942
50605
  kind: "mutation",
49943
50606
  auth: "admin",
49944
50607
  timeoutMs: 16 * 6e4
@@ -52384,7 +53047,9 @@ var ManifestShapeSchema = object({
52384
53047
  var AddonProcessSchema = object({
52385
53048
  pid: number().optional(),
52386
53049
  mode: string(),
52387
- state: string()
53050
+ state: string(),
53051
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53052
+ reason: string().optional()
52388
53053
  });
52389
53054
  /**
52390
53055
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -53152,7 +53817,8 @@ var batteryCapability = {
53152
53817
  DeviceType.Button,
53153
53818
  DeviceType.Switch,
53154
53819
  DeviceType.PetFeeder,
53155
- DeviceType.Container
53820
+ DeviceType.Container,
53821
+ DeviceType.Thermostat
53156
53822
  ],
53157
53823
  methods: {
53158
53824
  /**
@@ -53790,6 +54456,12 @@ var ClimateControlStatusSchema = object({
53790
54456
  /** Horizontal louver swing on/off. Null when the device has no
53791
54457
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
53792
54458
  swingHorizontal: boolean().nullable(),
54459
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
54460
+ minTemp: number().nullable().optional(),
54461
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
54462
+ maxTemp: number().nullable().optional(),
54463
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
54464
+ tempStep: number().positive().nullable().optional(),
53793
54465
  /** Ms epoch when the slice was last updated (push or command). */
53794
54466
  lastFetchedAt: number()
53795
54467
  });
@@ -54644,6 +55316,125 @@ onStatusChanged: { data: object({
54644
55316
  * whether persisting is worth a SQLite commit. */
54645
55317
  volatileStateFields: ["lastChangedAt"]
54646
55318
  };
55319
+ /**
55320
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
55321
+ * consumable levels (salt, rinse aid) and common program options.
55322
+ *
55323
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
55324
+ * by any integration that exposes the same program / option surface.
55325
+ *
55326
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
55327
+ * provider refreshes the slice on an interval and eagerly after commands.
55328
+ */
55329
+ var DishwasherStateSchema = _enum([
55330
+ "idle",
55331
+ "running",
55332
+ "paused",
55333
+ "finished",
55334
+ "error",
55335
+ "unavailable"
55336
+ ]);
55337
+ var DishwasherConsumableLevelSchema = _enum([
55338
+ "ok",
55339
+ "low",
55340
+ "empty"
55341
+ ]);
55342
+ var DishwasherStatusSchema = object({
55343
+ state: DishwasherStateSchema,
55344
+ /** Active program id/name, or null when none selected / unknown. */
55345
+ program: string().nullable(),
55346
+ /** Program tokens the hardware accepts — drives the UI selector. */
55347
+ availablePrograms: array(string()),
55348
+ /** Minutes remaining on the active cycle, or null when not running. */
55349
+ remainingMinutes: number().int().nonnegative().nullable(),
55350
+ /** Cycle completion 0..100, or null when not applicable. */
55351
+ progressPercent: number().min(0).max(100).nullable(),
55352
+ /** True when the door is reported open. */
55353
+ doorOpen: boolean(),
55354
+ /** True when remote start is allowed (door closed, power on, etc.). */
55355
+ remoteStartAllowed: boolean(),
55356
+ /** Main power / switched-on state. */
55357
+ powerOn: boolean(),
55358
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
55359
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
55360
+ halfLoad: boolean(),
55361
+ hygienePlus: boolean(),
55362
+ errorCode: number().nullable(),
55363
+ errorLabel: string().nullable(),
55364
+ lastFetchedAt: number()
55365
+ });
55366
+ var dishwasherCapability = {
55367
+ name: "dishwasher",
55368
+ scope: "device",
55369
+ deviceNative: true,
55370
+ mode: "singleton",
55371
+ deviceTypes: [DeviceType.Dishwasher],
55372
+ methods: {
55373
+ start: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55374
+ kind: "mutation",
55375
+ auth: "protected"
55376
+ }),
55377
+ pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55378
+ kind: "mutation",
55379
+ auth: "protected"
55380
+ }),
55381
+ stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55382
+ kind: "mutation",
55383
+ auth: "protected"
55384
+ }),
55385
+ setProgram: method(object({
55386
+ deviceId: number().int().nonnegative(),
55387
+ program: string().min(1)
55388
+ }), _void(), {
55389
+ kind: "mutation",
55390
+ auth: "protected"
55391
+ }),
55392
+ setPower: method(object({
55393
+ deviceId: number().int().nonnegative(),
55394
+ on: boolean()
55395
+ }), _void(), {
55396
+ kind: "mutation",
55397
+ auth: "protected"
55398
+ }),
55399
+ setHalfLoad: method(object({
55400
+ deviceId: number().int().nonnegative(),
55401
+ on: boolean()
55402
+ }), _void(), {
55403
+ kind: "mutation",
55404
+ auth: "protected"
55405
+ }),
55406
+ setHygienePlus: method(object({
55407
+ deviceId: number().int().nonnegative(),
55408
+ on: boolean()
55409
+ }), _void(), {
55410
+ kind: "mutation",
55411
+ auth: "protected"
55412
+ }),
55413
+ setOption: method(object({
55414
+ deviceId: number().int().nonnegative(),
55415
+ key: string().min(1),
55416
+ value: union([
55417
+ boolean(),
55418
+ string(),
55419
+ number()
55420
+ ])
55421
+ }), _void(), {
55422
+ kind: "mutation",
55423
+ auth: "protected"
55424
+ })
55425
+ },
55426
+ status: {
55427
+ schema: DishwasherStatusSchema,
55428
+ kind: "poll"
55429
+ },
55430
+ runtimeState: DishwasherStatusSchema,
55431
+ durability: "session",
55432
+ history: { fields: { progressPercent: {
55433
+ kind: "gauge",
55434
+ unit: "%",
55435
+ deadband: 2
55436
+ } } }
55437
+ };
54647
55438
  var DoorbellStatusSchema = object({
54648
55439
  /** Ms epoch of the last press. null = never observed since this provider started. */
54649
55440
  lastPressedAt: number().nullable(),
@@ -55446,6 +56237,32 @@ var gasCapability = {
55446
56237
  * whether persisting is worth a SQLite commit. */
55447
56238
  volatileStateFields: ["lastChangedAt"]
55448
56239
  };
56240
+ var HeatingValveStatusSchema = object({
56241
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
56242
+ position: number().min(0).max(100).nullable(),
56243
+ /** Ms epoch when the slice was last updated (push or poll). */
56244
+ lastFetchedAt: number()
56245
+ });
56246
+ var heatingValveCapability = {
56247
+ name: "heating-valve",
56248
+ scope: "device",
56249
+ deviceNative: true,
56250
+ mode: "singleton",
56251
+ deviceTypes: [DeviceType.Thermostat],
56252
+ methods: {},
56253
+ status: {
56254
+ schema: HeatingValveStatusSchema,
56255
+ kind: "push"
56256
+ },
56257
+ runtimeState: HeatingValveStatusSchema,
56258
+ durability: "session",
56259
+ history: { fields: { position: {
56260
+ kind: "gauge",
56261
+ unit: "%",
56262
+ deadband: 1
56263
+ } } },
56264
+ volatileStateFields: ["lastFetchedAt"]
56265
+ };
55449
56266
  /**
55450
56267
  * Humidifier / dehumidifier cap. Models HA `humidifier.*` entities —
55451
56268
  * an on/off actuator with an optional target-humidity setpoint and an
@@ -56578,7 +57395,19 @@ var TlsStatusSchema = object({
56578
57395
  sans: array(string()),
56579
57396
  caCertPem: string().nullable(),
56580
57397
  reissueError: string().nullable(),
56581
- restartRequired: boolean()
57398
+ restartRequired: boolean(),
57399
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
57400
+ caMissing: boolean(),
57401
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
57402
+ localCaConstrained: boolean().nullable(),
57403
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
57404
+ caReplacedAt: string().nullable(),
57405
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
57406
+ storedUpload: object({
57407
+ leafFingerprintSha256: string(),
57408
+ validTo: string(),
57409
+ hasCa: boolean()
57410
+ }).nullable()
56582
57411
  });
56583
57412
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
56584
57413
  /**
@@ -56634,6 +57463,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
56634
57463
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
56635
57464
  kind: "mutation",
56636
57465
  auth: "admin"
57466
+ }), method(_void(), TlsStatusSchema, {
57467
+ kind: "mutation",
57468
+ auth: "admin"
56637
57469
  });
56638
57470
  var LockControlStatusSchema = object({
56639
57471
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -63275,7 +64107,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
63275
64107
  kind: "mutation",
63276
64108
  auth: "admin",
63277
64109
  access: "delete"
63278
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
64110
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
64111
+ kind: "mutation",
64112
+ auth: "admin",
64113
+ access: "create"
64114
+ }), method(object({
63279
64115
  userId: string(),
63280
64116
  code: string()
63281
64117
  }), object({ valid: boolean() }), {
@@ -64995,6 +65831,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
64995
65831
  dayNight: dayNightCapability,
64996
65832
  deviceDiscovery: deviceDiscoveryCapability,
64997
65833
  deviceStatus: deviceStatusCapability,
65834
+ dishwasher: dishwasherCapability,
64998
65835
  doorbell: doorbellCapability,
64999
65836
  enumSensor: enumSensorCapability,
65000
65837
  eventEmitter: eventEmitterCapability,
@@ -65002,6 +65839,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
65002
65839
  featureProbe: featureProbeCapability,
65003
65840
  flood: floodCapability,
65004
65841
  gas: gasCapability,
65842
+ heatingValve: heatingValveCapability,
65005
65843
  humidifier: humidifierCapability,
65006
65844
  humiditySensor: humiditySensorCapability,
65007
65845
  image: imageCapability,
@@ -65087,13 +65925,14 @@ var BaseDevice$1 = class {
65087
65925
  get state() {
65088
65926
  if (!this._stateProxyCache) {
65089
65927
  const cache = {};
65090
- const handler = { get: (_target, key) => {
65928
+ const handler = { get: (target, key) => {
65091
65929
  const k = key;
65092
- if (k in cache) return cache[k];
65930
+ const existing = Reflect.get(target, k);
65931
+ if (existing !== void 0) return existing;
65093
65932
  const cap = DEVICE_LOCAL_STATE_CAPS[k];
65094
65933
  if (!cap) return void 0;
65095
65934
  const proxy = this.sliceProxy(cap);
65096
- cache[k] = proxy;
65935
+ Reflect.set(target, k, proxy);
65097
65936
  return proxy;
65098
65937
  } };
65099
65938
  this._stateProxyCache = new Proxy(cache, handler);
@@ -65292,7 +66131,7 @@ var BaseDevice$1 = class {
65292
66131
  async updateSourceInfo(patch) {
65293
66132
  const next = mergeSourceInfo(this.sourceInfo, patch);
65294
66133
  this._sourceInfoCache = Object.freeze({ ...next });
65295
- const action = this.ctx.api?.deviceManager?.setMetadata;
66134
+ const action = this.ctx.api.deviceManager?.setMetadata;
65296
66135
  if (action) try {
65297
66136
  await action.mutate({
65298
66137
  deviceId: this.id,
@@ -65327,7 +66166,7 @@ var BaseDevice$1 = class {
65327
66166
  * device boot on a meta refresh.
65328
66167
  */
65329
66168
  async refreshFeatures() {
65330
- const action = this.ctx.api?.deviceManager?.registerDevice;
66169
+ const action = this.ctx.api.deviceManager?.registerDevice;
65331
66170
  if (!action) return;
65332
66171
  try {
65333
66172
  await action.mutate({
@@ -65726,6 +66565,12 @@ var BaseDeviceProvider = class extends BaseAddon {
65726
66565
  provider: this
65727
66566
  }];
65728
66567
  }
66568
+ /** Flatten `super.onInitialize()` whether it returned an array or an envelope. */
66569
+ providerRegistrationsFromSuper(result) {
66570
+ if (Array.isArray(result)) return result;
66571
+ if (result !== void 0 && result.providers !== void 0) return [...result.providers];
66572
+ return [];
66573
+ }
65729
66574
  async onShutdown() {
65730
66575
  this._restoreShuttingDown = true;
65731
66576
  this.cancelRestoreRetries();
@@ -66252,7 +67097,7 @@ var BaseDeviceProvider = class extends BaseAddon {
66252
67097
  return toDeviceSummary(device, this.addonId);
66253
67098
  }
66254
67099
  };
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;
67100
+ 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
67101
  new Set(Object.values(DeviceType));
66257
67102
  Object.freeze({
66258
67103
  "accessories.getStatus": {
@@ -67401,6 +68246,12 @@ Object.freeze({
67401
68246
  addonId: null,
67402
68247
  access: "view"
67403
68248
  },
68249
+ "coreBlocks.migrateRawSecrets": {
68250
+ capName: "core-blocks",
68251
+ capScope: "system",
68252
+ addonId: null,
68253
+ access: "create"
68254
+ },
67404
68255
  "coreBlocks.restart": {
67405
68256
  capName: "core-blocks",
67406
68257
  capScope: "system",
@@ -68667,6 +69518,60 @@ Object.freeze({
68667
69518
  addonId: null,
68668
69519
  access: "view"
68669
69520
  },
69521
+ "dishwasher.getStatus": {
69522
+ capName: "dishwasher",
69523
+ capScope: "device",
69524
+ addonId: null,
69525
+ access: "view"
69526
+ },
69527
+ "dishwasher.pause": {
69528
+ capName: "dishwasher",
69529
+ capScope: "device",
69530
+ addonId: null,
69531
+ access: "create"
69532
+ },
69533
+ "dishwasher.setHalfLoad": {
69534
+ capName: "dishwasher",
69535
+ capScope: "device",
69536
+ addonId: null,
69537
+ access: "create"
69538
+ },
69539
+ "dishwasher.setHygienePlus": {
69540
+ capName: "dishwasher",
69541
+ capScope: "device",
69542
+ addonId: null,
69543
+ access: "create"
69544
+ },
69545
+ "dishwasher.setOption": {
69546
+ capName: "dishwasher",
69547
+ capScope: "device",
69548
+ addonId: null,
69549
+ access: "create"
69550
+ },
69551
+ "dishwasher.setPower": {
69552
+ capName: "dishwasher",
69553
+ capScope: "device",
69554
+ addonId: null,
69555
+ access: "create"
69556
+ },
69557
+ "dishwasher.setProgram": {
69558
+ capName: "dishwasher",
69559
+ capScope: "device",
69560
+ addonId: null,
69561
+ access: "create"
69562
+ },
69563
+ "dishwasher.start": {
69564
+ capName: "dishwasher",
69565
+ capScope: "device",
69566
+ addonId: null,
69567
+ access: "create"
69568
+ },
69569
+ "dishwasher.stop": {
69570
+ capName: "dishwasher",
69571
+ capScope: "device",
69572
+ addonId: null,
69573
+ access: "create"
69574
+ },
68670
69575
  "doorbell.getStatus": {
68671
69576
  capName: "doorbell",
68672
69577
  capScope: "device",
@@ -68877,6 +69782,12 @@ Object.freeze({
68877
69782
  addonId: null,
68878
69783
  access: "view"
68879
69784
  },
69785
+ "heatingValve.getStatus": {
69786
+ capName: "heating-valve",
69787
+ capScope: "device",
69788
+ addonId: null,
69789
+ access: "view"
69790
+ },
68880
69791
  "humidifier.getStatus": {
68881
69792
  capName: "humidifier",
68882
69793
  capScope: "device",
@@ -69087,6 +69998,12 @@ Object.freeze({
69087
69998
  addonId: null,
69088
69999
  access: "create"
69089
70000
  },
70001
+ "keychainAdmin.importSecret": {
70002
+ capName: "keychain-admin",
70003
+ capScope: "system",
70004
+ addonId: null,
70005
+ access: "create"
70006
+ },
69090
70007
  "keychainAdmin.listAudit": {
69091
70008
  capName: "keychain-admin",
69092
70009
  capScope: "system",
@@ -69255,6 +70172,12 @@ Object.freeze({
69255
70172
  addonId: null,
69256
70173
  access: "view"
69257
70174
  },
70175
+ "llm.migrateRawSecrets": {
70176
+ capName: "llm",
70177
+ capScope: "system",
70178
+ addonId: null,
70179
+ access: "create"
70180
+ },
69258
70181
  "llm.resolveModelRef": {
69259
70182
  capName: "llm",
69260
70183
  capScope: "system",
@@ -69483,6 +70406,12 @@ Object.freeze({
69483
70406
  addonId: null,
69484
70407
  access: "create"
69485
70408
  },
70409
+ "localNetwork.useStoredUploadedCertificate": {
70410
+ capName: "local-network",
70411
+ capScope: "system",
70412
+ addonId: null,
70413
+ access: "create"
70414
+ },
69486
70415
  "lockControl.getStatus": {
69487
70416
  capName: "lock-control",
69488
70417
  capScope: "device",
@@ -72135,6 +73064,30 @@ Object.freeze({
72135
73064
  addonId: null,
72136
73065
  access: "create"
72137
73066
  },
73067
+ "recordEntries.deleteEntry": {
73068
+ capName: "record-entries",
73069
+ capScope: "system",
73070
+ addonId: null,
73071
+ access: "delete"
73072
+ },
73073
+ "recordEntries.listEntries": {
73074
+ capName: "record-entries",
73075
+ capScope: "system",
73076
+ addonId: null,
73077
+ access: "view"
73078
+ },
73079
+ "recordEntries.listEntryKinds": {
73080
+ capName: "record-entries",
73081
+ capScope: "system",
73082
+ addonId: null,
73083
+ access: "view"
73084
+ },
73085
+ "recordEntries.putEntry": {
73086
+ capName: "record-entries",
73087
+ capScope: "system",
73088
+ addonId: null,
73089
+ access: "create"
73090
+ },
72138
73091
  "recording.getAvailability": {
72139
73092
  capName: "recording",
72140
73093
  capScope: "device",
@@ -72435,6 +73388,102 @@ Object.freeze({
72435
73388
  addonId: null,
72436
73389
  access: "view"
72437
73390
  },
73391
+ "records.aggregate": {
73392
+ capName: "records",
73393
+ capScope: "system",
73394
+ addonId: null,
73395
+ access: "view"
73396
+ },
73397
+ "records.allocateId": {
73398
+ capName: "records",
73399
+ capScope: "system",
73400
+ addonId: null,
73401
+ access: "create"
73402
+ },
73403
+ "records.count": {
73404
+ capName: "records",
73405
+ capScope: "system",
73406
+ addonId: null,
73407
+ access: "view"
73408
+ },
73409
+ "records.declareKinds": {
73410
+ capName: "records",
73411
+ capScope: "system",
73412
+ addonId: null,
73413
+ access: "create"
73414
+ },
73415
+ "records.delete": {
73416
+ capName: "records",
73417
+ capScope: "system",
73418
+ addonId: null,
73419
+ access: "delete"
73420
+ },
73421
+ "records.deleteDevice": {
73422
+ capName: "records",
73423
+ capScope: "system",
73424
+ addonId: null,
73425
+ access: "delete"
73426
+ },
73427
+ "records.deleteMany": {
73428
+ capName: "records",
73429
+ capScope: "system",
73430
+ addonId: null,
73431
+ access: "delete"
73432
+ },
73433
+ "records.deleteWhere": {
73434
+ capName: "records",
73435
+ capScope: "system",
73436
+ addonId: null,
73437
+ access: "delete"
73438
+ },
73439
+ "records.get": {
73440
+ capName: "records",
73441
+ capScope: "system",
73442
+ addonId: null,
73443
+ access: "view"
73444
+ },
73445
+ "records.getMany": {
73446
+ capName: "records",
73447
+ capScope: "system",
73448
+ addonId: null,
73449
+ access: "view"
73450
+ },
73451
+ "records.histogram": {
73452
+ capName: "records",
73453
+ capScope: "system",
73454
+ addonId: null,
73455
+ access: "view"
73456
+ },
73457
+ "records.patch": {
73458
+ capName: "records",
73459
+ capScope: "system",
73460
+ addonId: null,
73461
+ access: "create"
73462
+ },
73463
+ "records.put": {
73464
+ capName: "records",
73465
+ capScope: "system",
73466
+ addonId: null,
73467
+ access: "create"
73468
+ },
73469
+ "records.putMany": {
73470
+ capName: "records",
73471
+ capScope: "system",
73472
+ addonId: null,
73473
+ access: "create"
73474
+ },
73475
+ "records.query": {
73476
+ capName: "records",
73477
+ capScope: "system",
73478
+ addonId: null,
73479
+ access: "view"
73480
+ },
73481
+ "records.secretRefs": {
73482
+ capName: "records",
73483
+ capScope: "system",
73484
+ addonId: null,
73485
+ access: "view"
73486
+ },
72438
73487
  "sceneMonitor.captureReference": {
72439
73488
  capName: "scene-monitor",
72440
73489
  capScope: "device",
@@ -72867,6 +73916,48 @@ Object.freeze({
72867
73916
  addonId: null,
72868
73917
  access: "create"
72869
73918
  },
73919
+ "storageAdmin.adoptRecords": {
73920
+ capName: "storage-admin",
73921
+ capScope: "system",
73922
+ addonId: null,
73923
+ access: "create"
73924
+ },
73925
+ "storageAdmin.dropCollection": {
73926
+ capName: "storage-admin",
73927
+ capScope: "system",
73928
+ addonId: null,
73929
+ access: "delete"
73930
+ },
73931
+ "storageAdmin.isAdoptedLegacyTable": {
73932
+ capName: "storage-admin",
73933
+ capScope: "system",
73934
+ addonId: null,
73935
+ access: "view"
73936
+ },
73937
+ "storageAdmin.listKinds": {
73938
+ capName: "storage-admin",
73939
+ capScope: "system",
73940
+ addonId: null,
73941
+ access: "view"
73942
+ },
73943
+ "storageAdmin.listTables": {
73944
+ capName: "storage-admin",
73945
+ capScope: "system",
73946
+ addonId: null,
73947
+ access: "view"
73948
+ },
73949
+ "storageAdmin.readLegacyCollection": {
73950
+ capName: "storage-admin",
73951
+ capScope: "system",
73952
+ addonId: null,
73953
+ access: "view"
73954
+ },
73955
+ "storageAdmin.readRecords": {
73956
+ capName: "storage-admin",
73957
+ capScope: "system",
73958
+ addonId: null,
73959
+ access: "view"
73960
+ },
72870
73961
  "storageEvictable.evict": {
72871
73962
  capName: "storage-evictable",
72872
73963
  capScope: "system",
@@ -73779,6 +74870,12 @@ Object.freeze({
73779
74870
  addonId: null,
73780
74871
  access: "view"
73781
74872
  },
74873
+ "userManagement.migrateRawSecrets": {
74874
+ capName: "user-management",
74875
+ capScope: "system",
74876
+ addonId: null,
74877
+ access: "create"
74878
+ },
73782
74879
  "userManagement.oauthExchangeCode": {
73783
74880
  capName: "user-management",
73784
74881
  capScope: "system",
@@ -74278,7 +75375,7 @@ Object.freeze({
74278
75375
  access: "create"
74279
75376
  }
74280
75377
  });
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;
75378
+ 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
75379
  DeviceFeature.BatteryOperated;
74283
75380
  Object.freeze({
74284
75381
  "accessories.getStatus": [{
@@ -75102,6 +76199,51 @@ Object.freeze({
75102
76199
  form: "single",
75103
76200
  optional: false
75104
76201
  }],
76202
+ "dishwasher.getStatus": [{
76203
+ name: "deviceId",
76204
+ form: "single",
76205
+ optional: false
76206
+ }],
76207
+ "dishwasher.pause": [{
76208
+ name: "deviceId",
76209
+ form: "single",
76210
+ optional: false
76211
+ }],
76212
+ "dishwasher.setHalfLoad": [{
76213
+ name: "deviceId",
76214
+ form: "single",
76215
+ optional: false
76216
+ }],
76217
+ "dishwasher.setHygienePlus": [{
76218
+ name: "deviceId",
76219
+ form: "single",
76220
+ optional: false
76221
+ }],
76222
+ "dishwasher.setOption": [{
76223
+ name: "deviceId",
76224
+ form: "single",
76225
+ optional: false
76226
+ }],
76227
+ "dishwasher.setPower": [{
76228
+ name: "deviceId",
76229
+ form: "single",
76230
+ optional: false
76231
+ }],
76232
+ "dishwasher.setProgram": [{
76233
+ name: "deviceId",
76234
+ form: "single",
76235
+ optional: false
76236
+ }],
76237
+ "dishwasher.start": [{
76238
+ name: "deviceId",
76239
+ form: "single",
76240
+ optional: false
76241
+ }],
76242
+ "dishwasher.stop": [{
76243
+ name: "deviceId",
76244
+ form: "single",
76245
+ optional: false
76246
+ }],
75105
76247
  "doorbell.getStatus": [{
75106
76248
  name: "deviceId",
75107
76249
  form: "single",
@@ -75171,6 +76313,11 @@ Object.freeze({
75171
76313
  form: "single",
75172
76314
  optional: false
75173
76315
  }],
76316
+ "heatingValve.getStatus": [{
76317
+ name: "deviceId",
76318
+ form: "single",
76319
+ optional: false
76320
+ }],
75174
76321
  "humidifier.getStatus": [{
75175
76322
  name: "deviceId",
75176
76323
  form: "single",
@@ -76455,6 +77602,37 @@ Object.freeze({
76455
77602
  form: "single",
76456
77603
  optional: false
76457
77604
  }],
77605
+ "records.count": [{
77606
+ name: "deviceId",
77607
+ form: "single",
77608
+ optional: true
77609
+ }],
77610
+ "records.deleteDevice": [{
77611
+ name: "deviceId",
77612
+ form: "single",
77613
+ optional: false
77614
+ }],
77615
+ "records.deleteWhere": [{
77616
+ name: "deviceId",
77617
+ form: "single",
77618
+ optional: true
77619
+ }],
77620
+ "records.histogram": [{
77621
+ name: "deviceId",
77622
+ form: "single",
77623
+ optional: true
77624
+ }],
77625
+ "records.putMany": [{
77626
+ name: "records",
77627
+ form: "object-array",
77628
+ optional: false,
77629
+ itemField: "deviceId"
77630
+ }],
77631
+ "records.query": [{
77632
+ name: "deviceId",
77633
+ form: "single",
77634
+ optional: true
77635
+ }],
76458
77636
  "sceneMonitor.captureReference": [{
76459
77637
  name: "deviceId",
76460
77638
  form: "single",
@@ -76571,6 +77749,17 @@ Object.freeze({
76571
77749
  form: "single",
76572
77750
  optional: false
76573
77751
  }],
77752
+ "storageAdmin.adoptRecords": [{
77753
+ name: "records",
77754
+ form: "object-array",
77755
+ optional: false,
77756
+ itemField: "deviceId"
77757
+ }],
77758
+ "storageAdmin.readRecords": [{
77759
+ name: "deviceId",
77760
+ form: "single",
77761
+ optional: true
77762
+ }],
76574
77763
  "streamBroker.acquireEgressTranscode": [{
76575
77764
  name: "deviceId",
76576
77765
  form: "single",
@@ -183469,7 +184658,7 @@ var DreameProviderAddon = class extends BaseDeviceProvider {
183469
184658
  super({});
183470
184659
  }
183471
184660
  async onInitialize() {
183472
- const regs = await super.onInitialize();
184661
+ const regs = this.providerRegistrationsFromSuper(await super.onInitialize());
183473
184662
  this.clients = new DreameClientRegistry(this.ctx.logger);
183474
184663
  this.clients.setOnConnected((integrationId) => {
183475
184664
  this.ctx.logger.info("Dreame: integration connected", { meta: { integrationId } });