@camstack/addon-provider-dreo 0.2.126 → 0.2.127

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 +1318 -129
  2. package/dist/addon.mjs +1318 -129
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -35,7 +35,7 @@ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["modu
35
35
  //#endregion
36
36
  let crypto$1 = require("crypto");
37
37
  let events = require("events");
38
- //#region ../types/dist/event-category-C4hVnRo8.mjs
38
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
39
39
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
40
40
  EventCategory["SystemBoot"] = "system.boot";
41
41
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -99,6 +99,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
99
99
  * consumes this category and maps it to the `addon-crash-loop` kind.
100
100
  */
101
101
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
102
+ /**
103
+ * A runner whose addon refused to start with a typed reason (D877) - parked
104
+ * in `refused`, never counted by the crash breaker, retried on operator
105
+ * action. One event per refusal.
106
+ */
107
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
108
+ /**
109
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
110
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
111
+ * runner is still pending) and the alert centre (close a recovered runner).
112
+ */
113
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
114
+ /**
115
+ * The node's one-shot runner boot check (D877): planned runners against the
116
+ * process service, `degraded` when any is failed, refused or missing. The
117
+ * alert centre turns it into one alert and a direct critical push.
118
+ */
119
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
102
120
  EventCategory["AddonError"] = "addon.error";
103
121
  EventCategory["AddonPageReady"] = "addon.page-ready";
104
122
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -5423,7 +5441,7 @@ var ZodIssueCode = {
5423
5441
  var ZodFirstPartyTypeKind;
5424
5442
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5425
5443
  //#endregion
5426
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5444
+ //#region ../types/dist/sleep-BOjuyoPC.mjs
5427
5445
  /**
5428
5446
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5429
5447
  * window to float samples (D455).
@@ -5540,7 +5558,7 @@ function isKeychainStoredField(field) {
5540
5558
  var SECRET_CLEAR = { $secretClear: true };
5541
5559
  /** The `'***'` token D634 redaction writes for non-admins. */
5542
5560
  var LEGACY_DEVICE_REDACTION = "***";
5543
- function isRecord$2(value) {
5561
+ function isRecord$5(value) {
5544
5562
  return typeof value === "object" && value !== null && !Array.isArray(value);
5545
5563
  }
5546
5564
  function makeSecretMarker(ref) {
@@ -5551,12 +5569,12 @@ function makeSecretMarker(ref) {
5551
5569
  }
5552
5570
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5553
5571
  function isSecretMarker(value) {
5554
- if (!isRecord$2(value)) return false;
5572
+ if (!isRecord$5(value)) return false;
5555
5573
  const ref = value["$secret"];
5556
5574
  return typeof ref === "string" && ref.length > 0;
5557
5575
  }
5558
5576
  function isSecretClear(value) {
5559
- return isRecord$2(value) && value["$secretClear"] === true;
5577
+ return isRecord$5(value) && value["$secretClear"] === true;
5560
5578
  }
5561
5579
  /**
5562
5580
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6166,7 +6184,7 @@ var KeychainWriteRefusedError = class extends Error {
6166
6184
  }
6167
6185
  };
6168
6186
  var KEEP = { kind: "keep" };
6169
- function isRecord$1(value) {
6187
+ function isRecord$4(value) {
6170
6188
  return typeof value === "object" && value !== null && !Array.isArray(value);
6171
6189
  }
6172
6190
  function defaultMintId() {
@@ -6179,7 +6197,7 @@ function collectSecretMarkerRefs(value, out = []) {
6179
6197
  return out;
6180
6198
  }
6181
6199
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6182
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6200
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6183
6201
  return out;
6184
6202
  }
6185
6203
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6234,7 +6252,7 @@ function rowId(row, idKey) {
6234
6252
  return null;
6235
6253
  }
6236
6254
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6237
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6255
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6238
6256
  if (!Array.isArray(incoming)) {
6239
6257
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6240
6258
  return {
@@ -6250,7 +6268,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6250
6268
  const kept = /* @__PURE__ */ new Set();
6251
6269
  const rows = [];
6252
6270
  for (const row of incoming) {
6253
- if (!isRecord$1(row)) {
6271
+ if (!isRecord$4(row)) {
6254
6272
  rows.push(row);
6255
6273
  continue;
6256
6274
  }
@@ -6275,7 +6293,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6275
6293
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6276
6294
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6277
6295
  case "object": {
6278
- if (!isRecord$1(incoming)) {
6296
+ if (!isRecord$4(incoming)) {
6279
6297
  if (incoming === void 0) return KEEP;
6280
6298
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6281
6299
  return {
@@ -6283,7 +6301,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6283
6301
  value: incoming
6284
6302
  };
6285
6303
  }
6286
- const storedObj = isRecord$1(stored) ? stored : {};
6304
+ const storedObj = isRecord$4(stored) ? stored : {};
6287
6305
  return {
6288
6306
  kind: "value",
6289
6307
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6406,7 +6424,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6406
6424
  value: items
6407
6425
  };
6408
6426
  }
6409
- if (isRecord$1(v)) {
6427
+ if (isRecord$4(v)) {
6410
6428
  const out = {};
6411
6429
  for (const [k, child] of Object.entries(v)) {
6412
6430
  const s = substitute(child);
@@ -6438,7 +6456,7 @@ var SecretOverwriteRefusedError = class extends Error {
6438
6456
  this.name = "SecretOverwriteRefusedError";
6439
6457
  }
6440
6458
  };
6441
- function isRecord(value) {
6459
+ function isRecord$3(value) {
6442
6460
  return typeof value === "object" && value !== null && !Array.isArray(value);
6443
6461
  }
6444
6462
  function resolvedValue(pass, marker) {
@@ -6467,7 +6485,7 @@ function inArray(pass, incoming, stored) {
6467
6485
  return incoming.map((item, index) => {
6468
6486
  const twin = stored[index];
6469
6487
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6470
- if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6488
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6471
6489
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6472
6490
  return item;
6473
6491
  });
@@ -6478,7 +6496,7 @@ function inArrayRow(pass, incoming, stored) {
6478
6496
  const twin = stored[key];
6479
6497
  if (isSecretMarker(twin)) {
6480
6498
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6481
- } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6499
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6482
6500
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6483
6501
  }
6484
6502
  return out;
@@ -6486,7 +6504,7 @@ function inArrayRow(pass, incoming, stored) {
6486
6504
  async function walk(pass, incoming, stored) {
6487
6505
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6488
6506
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6489
- if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6507
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6490
6508
  const out = { ...incoming };
6491
6509
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6492
6510
  return out;
@@ -6517,7 +6535,7 @@ async function restoreUnchangedSecrets(input) {
6517
6535
  function isJsonEqual(a, b) {
6518
6536
  if (Object.is(a, b)) return true;
6519
6537
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6520
- if (isRecord(a) && isRecord(b)) {
6538
+ if (isRecord$3(a) && isRecord$3(b)) {
6521
6539
  const keys = Object.keys(a);
6522
6540
  if (keys.length !== Object.keys(b).length) return false;
6523
6541
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -6541,7 +6559,7 @@ function markerKeysOf(blob, owner) {
6541
6559
  }
6542
6560
  function nodeFromStored(value, owner) {
6543
6561
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6544
- if (!isRecord(value)) return null;
6562
+ if (!isRecord$3(value)) return null;
6545
6563
  const children = /* @__PURE__ */ new Map();
6546
6564
  for (const [key, child] of Object.entries(value)) {
6547
6565
  const node = nodeFromStored(child, owner);
@@ -6674,7 +6692,6 @@ function createHandle(raw, opts) {
6674
6692
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6675
6693
  const readAddonStoreResult = raw.readAddonStoreResult;
6676
6694
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6677
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6678
6695
  const overrides = {
6679
6696
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6680
6697
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6698,12 +6715,12 @@ function createHandle(raw, opts) {
6698
6715
  };
6699
6716
  } } : {},
6700
6717
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6701
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6702
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6718
+ readDeviceStoreBatch: async (deviceIds) => {
6719
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6703
6720
  const out = /* @__PURE__ */ new Map();
6704
6721
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6705
6722
  return out;
6706
- } } : {},
6723
+ },
6707
6724
  writeAddonStore: async (patch) => {
6708
6725
  await writeAddon(patch);
6709
6726
  },
@@ -7330,7 +7347,7 @@ var BaseAddon = class {
7330
7347
  if (!ctx) return;
7331
7348
  const addonId = ctx.id;
7332
7349
  setImmediate(() => {
7333
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7350
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7334
7351
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7335
7352
  }).catch((err) => {
7336
7353
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7530,7 +7547,7 @@ var BaseAddon = class {
7530
7547
  return this._addonSecretTree;
7531
7548
  }
7532
7549
  deviceSecretTree() {
7533
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7550
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7534
7551
  return this._deviceSecretTree;
7535
7552
  }
7536
7553
  /**
@@ -7606,42 +7623,135 @@ var BaseAddon = class {
7606
7623
  this[timerOf] = timer;
7607
7624
  }
7608
7625
  /**
7609
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7610
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7611
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7612
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7626
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7627
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7613
7628
  * addon permanently broken.
7614
7629
  *
7615
- * Retry only the two known infra fingerprints. Anything else propagates so
7616
- * real bugs surface immediately. After the budget expires we fall back to
7617
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7630
+ * Two kinds of outage, two budgets:
7631
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7632
+ * initialized`, `provider not available`): a short budget, then the addon
7633
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7634
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7635
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7636
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7637
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7638
+ * loop. A long, bounded budget; only after it the error propagates - the
7639
+ * addon never runs on defaults for a store it could not ask.
7640
+ * Anything else propagates immediately so real bugs surface.
7618
7641
  */
7619
7642
  async readAddonStoreWithRetry() {
7620
7643
  const settings = this.rawSettings();
7621
7644
  if (!settings) return {};
7622
- const delaysMs = [
7623
- 150,
7624
- 350,
7625
- 600,
7626
- 900
7627
- ];
7628
7645
  let lastErr;
7629
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7646
+ for (let attempt = 0;; attempt++) try {
7630
7647
  const stored = await settings.readAddonStore() ?? {};
7631
7648
  this.settingsStoreReady = true;
7632
7649
  return stored;
7633
7650
  } catch (err) {
7634
7651
  lastErr = err;
7635
- const msg = err instanceof Error ? err.message : String(err);
7636
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7637
- if (attempt === delaysMs.length) break;
7638
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7652
+ const kind = classifyStoreError(err);
7653
+ if (kind === "permanent") throw err;
7654
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7655
+ if (delay === void 0) {
7656
+ if (kind === "transport") throw err;
7657
+ break;
7658
+ }
7659
+ await new Promise((r) => setTimeout(r, delay));
7639
7660
  }
7640
7661
  this.settingsStoreReady = false;
7641
7662
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7642
7663
  return {};
7643
7664
  }
7644
7665
  };
7666
+ /** The settings store's own restart fingerprints. */
7667
+ var RESTART_RETRY_DELAYS_MS = [
7668
+ 150,
7669
+ 350,
7670
+ 600,
7671
+ 900
7672
+ ];
7673
+ /** A hub restarting under a booting runner: ~100 s in total. */
7674
+ var TRANSPORT_RETRY_DELAYS_MS = [
7675
+ 150,
7676
+ 350,
7677
+ 600,
7678
+ 900,
7679
+ 2e3,
7680
+ 5e3,
7681
+ 1e4,
7682
+ 2e4,
7683
+ 3e4,
7684
+ 3e4
7685
+ ];
7686
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7687
+ /** Node / socket error codes of a connection that did not happen or broke. */
7688
+ var TRANSPORT_CODES = new Set([
7689
+ "ECONNREFUSED",
7690
+ "ECONNRESET",
7691
+ "ETIMEDOUT",
7692
+ "EPIPE",
7693
+ "EHOSTUNREACH",
7694
+ "ENETUNREACH"
7695
+ ]);
7696
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7697
+ var UNAVAILABLE_TRPC_CODES = new Set([
7698
+ "TIMEOUT",
7699
+ "SERVICE_UNAVAILABLE",
7700
+ "BAD_GATEWAY",
7701
+ "GATEWAY_TIMEOUT"
7702
+ ]);
7703
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7704
+ var TRANSPORT_PHRASES = [
7705
+ "discovery deadline exceeded",
7706
+ "parent could not route child unowned cap call",
7707
+ "UDS request timed out after",
7708
+ "channel closed"
7709
+ ];
7710
+ /** Moleculer error `type`s of a call that could not be served right now. */
7711
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7712
+ "REQUEST_TIMEOUT",
7713
+ "SERVICE_NOT_FOUND",
7714
+ "SERVICE_NOT_AVAILABLE",
7715
+ "REQUEST_REJECTED",
7716
+ "BROKER_DISCONNECTED"
7717
+ ]);
7718
+ function stringProp(value, key) {
7719
+ if (typeof value !== "object" || value === null) return void 0;
7720
+ const found = Reflect.get(value, key);
7721
+ return typeof found === "string" ? found : void 0;
7722
+ }
7723
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7724
+ function errorCode(err) {
7725
+ const out = {};
7726
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7727
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7728
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7729
+ if (node !== void 0) out.node = node;
7730
+ const trpc = stringProp(data, "code");
7731
+ if (trpc !== void 0) out.trpc = trpc;
7732
+ return out;
7733
+ }
7734
+ /**
7735
+ * Is a settings read failure worth retrying, and with which budget? Only
7736
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7737
+ * one of the exact phrases our own transport raises. A message that merely
7738
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7739
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7740
+ */
7741
+ function classifyStoreError(err) {
7742
+ const message = err instanceof Error ? err.message : String(err);
7743
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7744
+ const code = errorCode(err);
7745
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7746
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7747
+ if (typeof err === "object" && err !== null) {
7748
+ if (Reflect.get(err, "retryable") === true) return "transport";
7749
+ const type = stringProp(err, "type");
7750
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7751
+ }
7752
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7753
+ return "permanent";
7754
+ }
7645
7755
  /**
7646
7756
  * Collect the keys of every field marked `perNode: true`, recursing into
7647
7757
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7731,6 +7841,156 @@ var PeerBytesTicketSchema = object({
7731
7841
  */
7732
7842
  declaredBytes: number().int().nonnegative().nullable()
7733
7843
  });
7844
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7845
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7846
+ var RECORD_DATABASES = ["settings", "events"];
7847
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7848
+ var RECORD_CLASSES = [
7849
+ "config",
7850
+ "ledger",
7851
+ "audit",
7852
+ "mirror",
7853
+ "ephemeral"
7854
+ ];
7855
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7856
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7857
+ var RECORD_BATCH_MAX = 1e3;
7858
+ var RECORD_QUERY_MAX = 1e3;
7859
+ function defOf(schema) {
7860
+ const zodBag = Reflect.get(schema, "_zod");
7861
+ if (typeof zodBag !== "object" || zodBag === null) return {};
7862
+ const def = Reflect.get(zodBag, "def");
7863
+ if (typeof def !== "object" || def === null) return {};
7864
+ return def;
7865
+ }
7866
+ function declaredHere(schema) {
7867
+ return globalRegistry.get(schema)?.secret === true;
7868
+ }
7869
+ /** Wrapper kinds whose `innerType` is the field itself. */
7870
+ var WRAPPERS = new Set([
7871
+ "optional",
7872
+ "nullable",
7873
+ "default",
7874
+ "prefault",
7875
+ "catch",
7876
+ "readonly",
7877
+ "nonoptional"
7878
+ ]);
7879
+ /**
7880
+ * The schema layers that make up ONE field: the schema itself and every
7881
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
7882
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
7883
+ * `.transform` on `in`).
7884
+ */
7885
+ function layersOf(schema) {
7886
+ const out = [];
7887
+ const queue = [schema];
7888
+ while (queue.length > 0) {
7889
+ const s = queue.shift();
7890
+ if (!s || out.includes(s)) continue;
7891
+ out.push(s);
7892
+ const def = defOf(s);
7893
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
7894
+ if (def.type === "pipe") {
7895
+ if (def.in) queue.push(def.in);
7896
+ if (def.out) queue.push(def.out);
7897
+ }
7898
+ }
7899
+ return out;
7900
+ }
7901
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
7902
+ function isZodSecret(schema) {
7903
+ return layersOf(schema).some(declaredHere);
7904
+ }
7905
+ /**
7906
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
7907
+ * element of this array" (`connection.password`, `rows[].token`). A declared
7908
+ * object or array is reported as one path and not descended into — everything
7909
+ * under it is secret.
7910
+ */
7911
+ function collectZodSecretPaths(schema, prefix = "") {
7912
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
7913
+ const paths = [];
7914
+ for (const layer of layersOf(schema)) {
7915
+ const def = defOf(layer);
7916
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
7917
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
7918
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
7919
+ else if (def.type === "intersection") {
7920
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
7921
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
7922
+ }
7923
+ }
7924
+ return [...new Set(paths)];
7925
+ }
7926
+ /**
7927
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
7928
+ * Zod row schema that describes it, and the helper that turns the two into the
7929
+ * JSON the engine stores.
7930
+ *
7931
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
7932
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
7933
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
7934
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
7935
+ * never a field name (D879).
7936
+ */
7937
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
7938
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
7939
+ var RecordIndexSchema = object({
7940
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
7941
+ fields: array(RecordFieldPathSchema).min(1).max(4),
7942
+ unique: boolean().optional()
7943
+ }).strict();
7944
+ var RecordRetentionSchema = union([
7945
+ object({
7946
+ ttlMs: number().int().positive(),
7947
+ from: _enum(["at", "write"])
7948
+ }).strict(),
7949
+ object({
7950
+ maxRows: number().int().positive().optional(),
7951
+ maxRowsPerDevice: number().int().positive().optional()
7952
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
7953
+ object({
7954
+ owner: string().min(1),
7955
+ reason: string().min(1)
7956
+ }).strict(),
7957
+ object({ none: string().min(1) }).strict()
7958
+ ]);
7959
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
7960
+ var EntryDescriptorSchema = object({
7961
+ title: string().min(1),
7962
+ /** The record body field shown as the entry's name. */
7963
+ nameField: string().min(1),
7964
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
7965
+ fields: record(string(), unknown())
7966
+ }).strict();
7967
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
7968
+ var RecordKindDeclarationSchema = object({
7969
+ database: _enum(RECORD_DATABASES).default("settings"),
7970
+ class: _enum(RECORD_CLASSES),
7971
+ writeTrigger: string().min(1),
7972
+ device: _enum([
7973
+ "required",
7974
+ "optional",
7975
+ "none"
7976
+ ]).default("none"),
7977
+ at: _enum(["required", "none"]).default("none"),
7978
+ indexes: array(RecordIndexSchema).max(8).default([]),
7979
+ retention: RecordRetentionSchema,
7980
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
7981
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
7982
+ /** Derived from the Zod schema; never written by hand. */
7983
+ secretPaths: array(string().min(1)).default([]),
7984
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
7985
+ secretArrayKeys: record(string(), string()).default({}),
7986
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
7987
+ adoptsFrom: string().min(1).optional(),
7988
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
7989
+ transactFamily: string().min(1).optional(),
7990
+ entry: EntryDescriptorSchema.optional()
7991
+ }).strict();
7992
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
7993
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
7734
7994
  /** Shared Zod schemas used across streaming capabilities. */
7735
7995
  var CamProfileSchema = _enum([
7736
7996
  "high",
@@ -8195,75 +8455,12 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8195
8455
  kind: "mutation",
8196
8456
  auth: "admin"
8197
8457
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
8198
- function defOf(schema) {
8199
- return schema._zod?.def ?? {};
8200
- }
8201
- function declaredHere(schema) {
8202
- return globalRegistry.get(schema)?.secret === true;
8203
- }
8204
- /** Wrapper kinds whose `innerType` is the field itself. */
8205
- var WRAPPERS = new Set([
8206
- "optional",
8207
- "nullable",
8208
- "default",
8209
- "prefault",
8210
- "catch",
8211
- "readonly",
8212
- "nonoptional"
8213
- ]);
8214
- /**
8215
- * The schema layers that make up ONE field: the schema itself and every
8216
- * wrapper below it (optional / default / nullable / readonly / catch), plus
8217
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8218
- * `.transform` on `in`).
8219
- */
8220
- function layersOf(schema) {
8221
- const out = [];
8222
- const queue = [schema];
8223
- while (queue.length > 0) {
8224
- const s = queue.shift();
8225
- if (!s || out.includes(s)) continue;
8226
- out.push(s);
8227
- const def = defOf(s);
8228
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8229
- if (def.type === "pipe") {
8230
- if (def.in) queue.push(def.in);
8231
- if (def.out) queue.push(def.out);
8232
- }
8233
- }
8234
- return out;
8235
- }
8236
- /** True when any layer of this field declares `.meta({ secret: true })`. */
8237
- function isZodSecret(schema) {
8238
- return layersOf(schema).some(declaredHere);
8239
- }
8240
- /**
8241
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
8242
- * element of this array" (`connection.password`, `rows[].token`). A declared
8243
- * object or array is reported as one path and not descended into — everything
8244
- * under it is secret.
8245
- */
8246
- function collectZodSecretPaths(schema, prefix = "") {
8247
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8248
- const paths = [];
8249
- for (const layer of layersOf(schema)) {
8250
- const def = defOf(layer);
8251
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8252
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8253
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8254
- else if (def.type === "intersection") {
8255
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8256
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8257
- }
8258
- }
8259
- return [...new Set(paths)];
8260
- }
8261
8458
  object({
8262
8459
  code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
8263
8460
  params: record(string(), union([string(), number()])).optional()
8264
8461
  });
8265
8462
  //#endregion
8266
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8463
+ //#region ../types/dist/err-msg-BXKzRBwg.mjs
8267
8464
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8268
8465
  DeviceType["Camera"] = "camera";
8269
8466
  DeviceType["Hub"] = "hub";
@@ -8355,6 +8552,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
8355
8552
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
8356
8553
  * integrations sharing the same food/desiccant/hopper surface. */
8357
8554
  DeviceType["PetFeeder"] = "pet-feeder";
8555
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
8556
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
8557
+ * Sources: native Bosch Home Connect, reusable by similar integrations. */
8558
+ DeviceType["Dishwasher"] = "dishwasher";
8358
8559
  return DeviceType;
8359
8560
  }({});
8360
8561
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -8532,6 +8733,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8532
8733
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8533
8734
  * real Switch device for UI rendering / export adapters. */
8534
8735
  DeviceRole["BinaryHelper"] = "binary-helper";
8736
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
8737
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
8738
+ DeviceRole["Outlet"] = "outlet";
8535
8739
  /** Generic motion / occupancy / moving event source. Distinct from
8536
8740
  * the camera accessory PirSensor role: that one is a camera child;
8537
8741
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8609,7 +8813,7 @@ function errMsg(err) {
8609
8813
  return String(err);
8610
8814
  }
8611
8815
  //#endregion
8612
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
8816
+ //#region ../types/dist/composition-CB6PMT9p.mjs
8613
8817
  /**
8614
8818
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8615
8819
  *
@@ -11813,11 +12017,10 @@ var ClipModelMetaSchema = object({
11813
12017
  /**
11814
12018
  * The `vector-store` index this model's vectors live in. ONE feature space
11815
12019
  * per index: two models share an index only when their vectors are ranked
11816
- * against each other, which for CLIP means never across families. MobileCLIP
11817
- * S1 and S2 share `object-clip` for history (separated by the row's
11818
- * `modelId`); any other model gets its own.
12020
+ * against each other, which for CLIP means never across families. Every
12021
+ * model gets its own.
11819
12022
  */
11820
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12023
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
11821
12024
  /**
11822
12025
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
11823
12026
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -12996,8 +13199,13 @@ var AlertSeveritySchema = _enum([
12996
13199
  "info",
12997
13200
  "success",
12998
13201
  "warning",
12999
- "error"
13202
+ "error",
13203
+ "critical"
13000
13204
  ]);
13205
+ var AlertActionSchema = object({
13206
+ label: string(),
13207
+ href: string().optional()
13208
+ });
13001
13209
  var AlertStatusSchema = _enum([
13002
13210
  "active",
13003
13211
  "in-progress",
@@ -13015,6 +13223,7 @@ var AlertSchema = object({
13015
13223
  severity: AlertSeveritySchema,
13016
13224
  title: string(),
13017
13225
  message: string(),
13226
+ action: AlertActionSchema.optional(),
13018
13227
  status: AlertStatusSchema,
13019
13228
  progress: number().optional(),
13020
13229
  read: boolean(),
@@ -15550,6 +15759,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15550
15759
  keyField: string()
15551
15760
  }).optional()
15552
15761
  })) });
15762
+ /**
15763
+ * The report of a one-shot "move this owner's plaintext secrets into the
15764
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
15765
+ *
15766
+ * The owner runs it on its own rows, through its own write path; an operator
15767
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
15768
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
15769
+ */
15770
+ var RawSecretMigrationInputSchema = object({
15771
+ /** `false` (the default of the script) = report only. */
15772
+ apply: boolean() });
15773
+ var RawSecretMigrationReportSchema = object({
15774
+ apply: boolean(),
15775
+ /** Rows that can carry a secret (a profile, an enrolment). */
15776
+ rows: number().int(),
15777
+ /** Rows whose secret was plaintext when the run started. */
15778
+ raw: number().int(),
15779
+ /** Rows that already held a keychain marker when the run started. */
15780
+ markers: number().int(),
15781
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
15782
+ migrated: number().int(),
15783
+ /** Plaintext rows left in place because the move or its read-back failed. */
15784
+ failed: number().int(),
15785
+ /** After the run: rows still holding plaintext. */
15786
+ remainingRaw: number().int(),
15787
+ /** After the run: markers the keychain could not resolve right now. */
15788
+ unresolvedMarkers: number().int(),
15789
+ /**
15790
+ * A second, redundant copy of the secrets' rows that the run found (and, on
15791
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
15792
+ */
15793
+ redundantCopies: number().int().optional(),
15794
+ /** True when nothing is raw and every marker resolves. */
15795
+ verified: boolean()
15796
+ });
15553
15797
  /** Where a block runs. The operator chooses — a block driving a device on an
15554
15798
  * agent is the reason placement is not fixed to the hub. */
15555
15799
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -15776,6 +16020,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
15776
16020
  }), SettingsUpdateResultSchema, {
15777
16021
  kind: "mutation",
15778
16022
  auth: "admin"
16023
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16024
+ kind: "mutation",
16025
+ auth: "admin"
15779
16026
  }), method(object({}), object({ libs: array(object({
15780
16027
  filePath: string(),
15781
16028
  content: string()
@@ -16039,6 +16286,347 @@ id: union([string(), number()]) }), {
16039
16286
  auth: "admin"
16040
16287
  });
16041
16288
  /**
16289
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16290
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16291
+ * (operator intent, D870) and device-history (numbers over time, D850).
16292
+ *
16293
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16294
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16295
+ * that with the addon id closed over). It is deliberately NOT in any input
16296
+ * schema, so a session can never supply it, and a call with no stamp is refused
16297
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16298
+ * addons go through the owner's capability.
16299
+ *
16300
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16301
+ * never `[]`. Secret fields are never on the wire: a read shows the
16302
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16303
+ * resolves itself, and a write may carry only a keychain marker bound to the
16304
+ * row's own ref.
16305
+ *
16306
+ * Internal: addons reach it through `ctx.records`, never directly.
16307
+ */
16308
+ var RecordIdSchema = string().min(1).max(256);
16309
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16310
+ var RecordBodySchema = record(string(), unknown());
16311
+ var RecordInputSchema = object({
16312
+ id: RecordIdSchema,
16313
+ /** The device this row belongs to (D865 removal, per-device reads). */
16314
+ deviceId: number().int().optional(),
16315
+ /** The domain clock, ms: observed / created / opened. */
16316
+ at: number().int().optional(),
16317
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16318
+ expiresAt: number().int().optional(),
16319
+ data: RecordBodySchema
16320
+ });
16321
+ var RecordViewSchema = object({
16322
+ id: string(),
16323
+ deviceId: number().int().nullable(),
16324
+ at: number().nullable(),
16325
+ expiresAt: number().nullable(),
16326
+ rev: number().int(),
16327
+ updatedAt: number(),
16328
+ data: RecordBodySchema
16329
+ });
16330
+ /** Declared index fields only. Anything else does not compile, by design. */
16331
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16332
+ string(),
16333
+ number(),
16334
+ boolean(),
16335
+ object({ in: array(union([
16336
+ string(),
16337
+ number(),
16338
+ boolean()
16339
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16340
+ object({
16341
+ gt: union([string(), number()]).optional(),
16342
+ gte: union([string(), number()]).optional(),
16343
+ lt: union([string(), number()]).optional(),
16344
+ lte: union([string(), number()]).optional()
16345
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16346
+ ]));
16347
+ var KindShape = { kind: RecordKindNameSchema };
16348
+ var TimeWindowShape = {
16349
+ deviceId: number().int().optional(),
16350
+ atFrom: number().optional(),
16351
+ atTo: number().optional()
16352
+ };
16353
+ var RecordQueryInputSchema = object({
16354
+ ...KindShape,
16355
+ ...TimeWindowShape,
16356
+ where: RecordWhereSchema.optional(),
16357
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16358
+ order: _enum(["at", "id"]).optional(),
16359
+ desc: boolean().optional(),
16360
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16361
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16362
+ cursor: string().min(1).optional()
16363
+ });
16364
+ var RecordQueryResultSchema = object({
16365
+ records: array(RecordViewSchema),
16366
+ nextCursor: string().nullable()
16367
+ });
16368
+ var RecordKindStateSchema = _enum([
16369
+ "created",
16370
+ "unchanged",
16371
+ "updated"
16372
+ ]);
16373
+ var DeclareKindResultSchema = object({
16374
+ kindId: number().int(),
16375
+ state: RecordKindStateSchema,
16376
+ createdIndexes: array(string()),
16377
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16378
+ adoptionPending: object({
16379
+ legacyTable: string(),
16380
+ legacyRows: number().int()
16381
+ }).nullable()
16382
+ });
16383
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16384
+ var SecretRefsList = array(string());
16385
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16386
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16387
+ kind: "mutation",
16388
+ auth: "admin"
16389
+ }), method(object({
16390
+ ...KindShape,
16391
+ id: RecordIdSchema
16392
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16393
+ ...KindShape,
16394
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16395
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16396
+ ...KindShape,
16397
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16398
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16399
+ ...KindShape,
16400
+ record: RecordInputSchema,
16401
+ /** Compare-and-set. `0` means "the row must not exist". */
16402
+ ifRev: number().int().min(0).optional()
16403
+ }), object({
16404
+ rev: number().int(),
16405
+ releasedRefs: SecretRefsList
16406
+ }), {
16407
+ kind: "mutation",
16408
+ auth: "admin"
16409
+ }), method(object({
16410
+ ...KindShape,
16411
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16412
+ }), object({
16413
+ count: number().int(),
16414
+ releasedRefs: SecretRefsList
16415
+ }), {
16416
+ kind: "mutation",
16417
+ auth: "admin"
16418
+ }), method(object({
16419
+ ...KindShape,
16420
+ id: RecordIdSchema,
16421
+ data: RecordBodySchema,
16422
+ at: number().int().nullable().optional(),
16423
+ expiresAt: number().int().nullable().optional(),
16424
+ ifRev: number().int().min(1).optional()
16425
+ }), object({
16426
+ rev: number().int(),
16427
+ releasedRefs: SecretRefsList
16428
+ }), {
16429
+ kind: "mutation",
16430
+ auth: "admin"
16431
+ }), method(object({
16432
+ ...KindShape,
16433
+ id: RecordIdSchema
16434
+ }), object({
16435
+ deleted: boolean(),
16436
+ secretRefs: SecretRefsList
16437
+ }), {
16438
+ kind: "mutation",
16439
+ auth: "admin"
16440
+ }), method(object({
16441
+ ...KindShape,
16442
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16443
+ }), object({
16444
+ deleted: number().int(),
16445
+ secretRefs: SecretRefsList
16446
+ }), {
16447
+ kind: "mutation",
16448
+ auth: "admin"
16449
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16450
+ ...KindShape,
16451
+ ...TimeWindowShape,
16452
+ where: RecordWhereSchema.optional()
16453
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16454
+ ...KindShape,
16455
+ deviceId: number().int().optional(),
16456
+ from: number(),
16457
+ to: number(),
16458
+ bucketMs: number().int().positive()
16459
+ }), object({ buckets: array(object({
16460
+ bucketStart: number(),
16461
+ count: number().int()
16462
+ })) }), { auth: "admin" }), method(object({
16463
+ ...KindShape,
16464
+ op: _enum([
16465
+ "sum",
16466
+ "min",
16467
+ "max",
16468
+ "count"
16469
+ ]),
16470
+ field: RecordFieldPathSchema.optional(),
16471
+ groupBy: RecordFieldPathSchema.optional(),
16472
+ where: RecordWhereSchema.optional()
16473
+ }), object({ rows: array(object({
16474
+ group: union([
16475
+ string(),
16476
+ number(),
16477
+ _null()
16478
+ ]),
16479
+ value: number().nullable()
16480
+ })) }), { auth: "admin" }), method(object({
16481
+ ...KindShape,
16482
+ deviceId: number().int().optional(),
16483
+ atBefore: number().optional(),
16484
+ where: RecordWhereSchema.optional()
16485
+ }), object({
16486
+ deleted: number().int(),
16487
+ secretRefs: SecretRefsList
16488
+ }), {
16489
+ kind: "mutation",
16490
+ auth: "admin"
16491
+ }), method(object({
16492
+ deviceId: number().int(),
16493
+ kinds: array(RecordKindNameSchema).optional()
16494
+ }), object({
16495
+ deleted: record(string(), number().int()),
16496
+ secretRefs: SecretRefsList
16497
+ }), {
16498
+ kind: "mutation",
16499
+ auth: "admin"
16500
+ }), method(object(KindShape), object({ id: number().int() }), {
16501
+ kind: "mutation",
16502
+ auth: "admin"
16503
+ });
16504
+ /** One table of the settings database. */
16505
+ var StorageTableSchema = object({
16506
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
16507
+ name: string(),
16508
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
16509
+ owner: string().nullable(),
16510
+ rows: number().int().nonnegative(),
16511
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
16512
+ bytes: number().int().nonnegative().nullable(),
16513
+ /** Declared by an addon since this engine process started (a running addon claims it). */
16514
+ declaredThisBoot: boolean()
16515
+ });
16516
+ /** One declared record kind (D881) as System -> Data shows it. */
16517
+ var StorageKindSchema = object({
16518
+ owner: string(),
16519
+ kind: string(),
16520
+ database: _enum(["settings", "events"]),
16521
+ class: string(),
16522
+ state: _enum([
16523
+ "declared",
16524
+ "orphaned",
16525
+ "dropped"
16526
+ ]),
16527
+ /** `null` when the caller asked for no counts (`counts: false`). */
16528
+ rows: number().int().nonnegative().nullable(),
16529
+ /** Rows x the average size of a sample; null for an empty kind. */
16530
+ bytesEstimate: number().int().nonnegative().nullable(),
16531
+ writeTrigger: string(),
16532
+ retention: RecordRetentionSchema,
16533
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16534
+ entry: boolean(),
16535
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16536
+ declaration: RecordKindDeclarationSchema
16537
+ });
16538
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16539
+ collection: string().min(1),
16540
+ expectRows: number().int().nonnegative()
16541
+ }), object({
16542
+ dropped: literal(true),
16543
+ rows: number().int().nonnegative()
16544
+ }), {
16545
+ kind: "mutation",
16546
+ auth: "admin"
16547
+ }), method(object({
16548
+ owner: string().min(1).optional(),
16549
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16550
+ counts: boolean().optional()
16551
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16552
+ owner: string().min(1),
16553
+ kind: RecordKindNameSchema
16554
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16555
+ owner: string().min(1),
16556
+ kind: RecordKindNameSchema,
16557
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16558
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16559
+ complete: boolean().optional()
16560
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16561
+ kind: "mutation",
16562
+ auth: "admin"
16563
+ }), method(object({
16564
+ collection: string().min(1),
16565
+ cursor: string().optional(),
16566
+ limit: number().int().min(1).max(1e3).optional()
16567
+ }), object({
16568
+ rows: array(object({
16569
+ id: string(),
16570
+ data: record(string(), unknown())
16571
+ })),
16572
+ nextCursor: string().nullable()
16573
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16574
+ /**
16575
+ * record-entries - the ONE admin surface for every list of user-created entries
16576
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16577
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16578
+ *
16579
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16580
+ * the entry body with `secret: true` on every credential field, so a password
16581
+ * field is derived from the schema and never from a name. `putEntry` takes the
16582
+ * redaction token for an untouched secret (the stored value is kept), a string
16583
+ * for a new one, and the clear instruction to remove one. A read never carries
16584
+ * a secret value, and a locked keychain refuses the write with
16585
+ * `records/secret-unavailable` instead of storing plaintext.
16586
+ *
16587
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16588
+ */
16589
+ var EntryKindInfoSchema = object({
16590
+ owner: string(),
16591
+ kind: RecordKindNameSchema,
16592
+ title: string(),
16593
+ nameField: string(),
16594
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16595
+ fields: record(string(), unknown()),
16596
+ secretPaths: array(string()),
16597
+ rows: number().int().nonnegative()
16598
+ });
16599
+ var EntryViewSchema = object({
16600
+ id: RecordIdSchema,
16601
+ name: string(),
16602
+ rev: number().int(),
16603
+ updatedAt: number(),
16604
+ /** Secret fields hold the redaction token. */
16605
+ data: RecordBodySchema
16606
+ });
16607
+ var EntryAddress = {
16608
+ owner: string().min(1),
16609
+ kind: RecordKindNameSchema
16610
+ };
16611
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16612
+ ...EntryAddress,
16613
+ id: RecordIdSchema.optional(),
16614
+ data: RecordBodySchema,
16615
+ ifRev: number().int().min(1).optional()
16616
+ }), object({
16617
+ id: string(),
16618
+ rev: number().int()
16619
+ }), {
16620
+ kind: "mutation",
16621
+ auth: "admin"
16622
+ }), method(object({
16623
+ ...EntryAddress,
16624
+ id: RecordIdSchema
16625
+ }), object({ deleted: boolean() }), {
16626
+ kind: "mutation",
16627
+ auth: "admin"
16628
+ });
16629
+ /**
16042
16630
  * `keychain` — the hub's encrypted store of secret values (D787).
16043
16631
  *
16044
16632
  * Settings blobs never hold a secret: they hold a marker
@@ -16579,6 +17167,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16579
17167
  kind: "mutation",
16580
17168
  auth: "admin",
16581
17169
  caller: "required"
17170
+ }), method(object({
17171
+ ref: string().min(1),
17172
+ value: string().min(1)
17173
+ }), object({
17174
+ ref: string(),
17175
+ version: number().int()
17176
+ }), {
17177
+ kind: "mutation",
17178
+ auth: "admin",
17179
+ caller: "required"
16582
17180
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16583
17181
  deleted: array(string()).readonly(),
16584
17182
  kept: array(object({
@@ -39257,6 +39855,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39257
39855
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39258
39856
  kind: "mutation",
39259
39857
  auth: "admin"
39858
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
39859
+ kind: "mutation",
39860
+ auth: "admin"
39260
39861
  }), method(ProfileRefInputSchema, _void(), {
39261
39862
  kind: "mutation",
39262
39863
  auth: "admin"
@@ -49766,6 +50367,41 @@ var ServerRollbackInfoSchema = object({
49766
50367
  atMs: number(),
49767
50368
  reason: string()
49768
50369
  });
50370
+ /**
50371
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50372
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50373
+ * service holds, because only the hub plans) against the states the process
50374
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50375
+ * every boot, served on `getServerPackageStatus`.
50376
+ *
50377
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50378
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50379
+ * planned runner the process service has no entry for.
50380
+ */
50381
+ var RunnerRefusalSchema = object({
50382
+ runnerId: string(),
50383
+ addonIds: array(string()),
50384
+ reason: string()
50385
+ });
50386
+ var RunnerBootCheckSchema = object({
50387
+ checkedAtMs: number(),
50388
+ /** Runners planned for this node. */
50389
+ expected: number(),
50390
+ /** Planned runners whose process is `running`. */
50391
+ running: number(),
50392
+ failed: array(string()),
50393
+ refused: array(RunnerRefusalSchema),
50394
+ missing: array(string()),
50395
+ /**
50396
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50397
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50398
+ * pushed and the verdict is re-evaluated on the next runner state change.
50399
+ * Optional for version skew (absent = settled).
50400
+ */
50401
+ pending: array(string()).optional(),
50402
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50403
+ planKnown: boolean()
50404
+ });
49769
50405
  var ServerPackageStatusSchema = object({
49770
50406
  /** Root package name (`@camstack/server` on the hub). */
49771
50407
  packageName: string(),
@@ -49828,7 +50464,14 @@ var ServerPackageStatusSchema = object({
49828
50464
  * for version skew: an older provider's payload simply omits it, and an
49829
50465
  * absent wrapper is unknown — never `native`.
49830
50466
  */
49831
- wrapper: WrapperIdentitySchema.optional()
50467
+ wrapper: WrapperIdentitySchema.optional(),
50468
+ /**
50469
+ * What this node PLANNED to run against what its process service reports
50470
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50471
+ * on a provider that predates it. Absent is "not checked yet", never "all
50472
+ * well": a consumer that needs the answer treats it as pending.
50473
+ */
50474
+ runners: RunnerBootCheckSchema.optional()
49832
50475
  });
49833
50476
  var ServerUpdateCheckResultSchema = object({
49834
50477
  packageName: string(),
@@ -49879,6 +50522,13 @@ var ServerUpdateOutcomeSchema = _enum([
49879
50522
  "refused",
49880
50523
  "failed"
49881
50524
  ]);
50525
+ /** One addon the pre-flight found the target version would refuse (D877). */
50526
+ var UpdateBlockerSchema = object({
50527
+ addonId: string(),
50528
+ reason: string(),
50529
+ /** What the operator does about it. */
50530
+ remedy: string()
50531
+ });
49882
50532
  var ServerUpdateActionResultSchema = object({
49883
50533
  accepted: boolean(),
49884
50534
  targetVersion: string().nullable(),
@@ -49896,14 +50546,27 @@ var ServerUpdateActionResultSchema = object({
49896
50546
  * The failure itself, verbatim enough to act on (the npm output for a
49897
50547
  * staging install). Non-null only for `failed`.
49898
50548
  */
49899
- error: string().nullable().optional()
50549
+ error: string().nullable().optional(),
50550
+ /**
50551
+ * The addons the target version would refuse to start on this node's live
50552
+ * store (D877), present when the pre-flight refused the update
50553
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50554
+ */
50555
+ blockers: array(UpdateBlockerSchema).optional()
49900
50556
  });
49901
50557
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
49902
50558
  kind: "mutation",
49903
50559
  auth: "admin"
49904
- }), method(object({
49905
- /** Explicit target version; omitted = latest from the registry. */
49906
- version: string().optional() }), ServerUpdateActionResultSchema, {
50560
+ }), method(object({
50561
+ /** Explicit target version; omitted = latest from the registry. */
50562
+ version: string().optional(),
50563
+ /**
50564
+ * Apply even though the pre-flight (D877) found addons the target would
50565
+ * refuse to start. Off by default: those addons stay down until the
50566
+ * remedy is run, which is the incident this gate exists to prevent.
50567
+ */
50568
+ acknowledgeRefusals: boolean().optional()
50569
+ }), ServerUpdateActionResultSchema, {
49907
50570
  kind: "mutation",
49908
50571
  auth: "admin",
49909
50572
  timeoutMs: 16 * 6e4
@@ -52349,7 +53012,9 @@ var ManifestShapeSchema = object({
52349
53012
  var AddonProcessSchema = object({
52350
53013
  pid: number().optional(),
52351
53014
  mode: string(),
52352
- state: string()
53015
+ state: string(),
53016
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53017
+ reason: string().optional()
52353
53018
  });
52354
53019
  /**
52355
53020
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -53117,7 +53782,8 @@ var batteryCapability = {
53117
53782
  DeviceType.Button,
53118
53783
  DeviceType.Switch,
53119
53784
  DeviceType.PetFeeder,
53120
- DeviceType.Container
53785
+ DeviceType.Container,
53786
+ DeviceType.Thermostat
53121
53787
  ],
53122
53788
  methods: {
53123
53789
  /**
@@ -53738,6 +54404,12 @@ var ClimateControlStatusSchema = object({
53738
54404
  /** Horizontal louver swing on/off. Null when the device has no
53739
54405
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
53740
54406
  swingHorizontal: boolean().nullable(),
54407
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
54408
+ minTemp: number().nullable().optional(),
54409
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
54410
+ maxTemp: number().nullable().optional(),
54411
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
54412
+ tempStep: number().positive().nullable().optional(),
53741
54413
  /** Ms epoch when the slice was last updated (push or command). */
53742
54414
  lastFetchedAt: number()
53743
54415
  });
@@ -54592,6 +55264,125 @@ onStatusChanged: { data: object({
54592
55264
  * whether persisting is worth a SQLite commit. */
54593
55265
  volatileStateFields: ["lastChangedAt"]
54594
55266
  };
55267
+ /**
55268
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
55269
+ * consumable levels (salt, rinse aid) and common program options.
55270
+ *
55271
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
55272
+ * by any integration that exposes the same program / option surface.
55273
+ *
55274
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
55275
+ * provider refreshes the slice on an interval and eagerly after commands.
55276
+ */
55277
+ var DishwasherStateSchema = _enum([
55278
+ "idle",
55279
+ "running",
55280
+ "paused",
55281
+ "finished",
55282
+ "error",
55283
+ "unavailable"
55284
+ ]);
55285
+ var DishwasherConsumableLevelSchema = _enum([
55286
+ "ok",
55287
+ "low",
55288
+ "empty"
55289
+ ]);
55290
+ var DishwasherStatusSchema = object({
55291
+ state: DishwasherStateSchema,
55292
+ /** Active program id/name, or null when none selected / unknown. */
55293
+ program: string().nullable(),
55294
+ /** Program tokens the hardware accepts — drives the UI selector. */
55295
+ availablePrograms: array(string()),
55296
+ /** Minutes remaining on the active cycle, or null when not running. */
55297
+ remainingMinutes: number().int().nonnegative().nullable(),
55298
+ /** Cycle completion 0..100, or null when not applicable. */
55299
+ progressPercent: number().min(0).max(100).nullable(),
55300
+ /** True when the door is reported open. */
55301
+ doorOpen: boolean(),
55302
+ /** True when remote start is allowed (door closed, power on, etc.). */
55303
+ remoteStartAllowed: boolean(),
55304
+ /** Main power / switched-on state. */
55305
+ powerOn: boolean(),
55306
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
55307
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
55308
+ halfLoad: boolean(),
55309
+ hygienePlus: boolean(),
55310
+ errorCode: number().nullable(),
55311
+ errorLabel: string().nullable(),
55312
+ lastFetchedAt: number()
55313
+ });
55314
+ var dishwasherCapability = {
55315
+ name: "dishwasher",
55316
+ scope: "device",
55317
+ deviceNative: true,
55318
+ mode: "singleton",
55319
+ deviceTypes: [DeviceType.Dishwasher],
55320
+ methods: {
55321
+ start: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55322
+ kind: "mutation",
55323
+ auth: "protected"
55324
+ }),
55325
+ pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55326
+ kind: "mutation",
55327
+ auth: "protected"
55328
+ }),
55329
+ stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55330
+ kind: "mutation",
55331
+ auth: "protected"
55332
+ }),
55333
+ setProgram: method(object({
55334
+ deviceId: number().int().nonnegative(),
55335
+ program: string().min(1)
55336
+ }), _void(), {
55337
+ kind: "mutation",
55338
+ auth: "protected"
55339
+ }),
55340
+ setPower: method(object({
55341
+ deviceId: number().int().nonnegative(),
55342
+ on: boolean()
55343
+ }), _void(), {
55344
+ kind: "mutation",
55345
+ auth: "protected"
55346
+ }),
55347
+ setHalfLoad: method(object({
55348
+ deviceId: number().int().nonnegative(),
55349
+ on: boolean()
55350
+ }), _void(), {
55351
+ kind: "mutation",
55352
+ auth: "protected"
55353
+ }),
55354
+ setHygienePlus: method(object({
55355
+ deviceId: number().int().nonnegative(),
55356
+ on: boolean()
55357
+ }), _void(), {
55358
+ kind: "mutation",
55359
+ auth: "protected"
55360
+ }),
55361
+ setOption: method(object({
55362
+ deviceId: number().int().nonnegative(),
55363
+ key: string().min(1),
55364
+ value: union([
55365
+ boolean(),
55366
+ string(),
55367
+ number()
55368
+ ])
55369
+ }), _void(), {
55370
+ kind: "mutation",
55371
+ auth: "protected"
55372
+ })
55373
+ },
55374
+ status: {
55375
+ schema: DishwasherStatusSchema,
55376
+ kind: "poll"
55377
+ },
55378
+ runtimeState: DishwasherStatusSchema,
55379
+ durability: "session",
55380
+ history: { fields: { progressPercent: {
55381
+ kind: "gauge",
55382
+ unit: "%",
55383
+ deadband: 2
55384
+ } } }
55385
+ };
54595
55386
  var DoorbellStatusSchema = object({
54596
55387
  /** Ms epoch of the last press. null = never observed since this provider started. */
54597
55388
  lastPressedAt: number().nullable(),
@@ -55394,6 +56185,32 @@ var gasCapability = {
55394
56185
  * whether persisting is worth a SQLite commit. */
55395
56186
  volatileStateFields: ["lastChangedAt"]
55396
56187
  };
56188
+ var HeatingValveStatusSchema = object({
56189
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
56190
+ position: number().min(0).max(100).nullable(),
56191
+ /** Ms epoch when the slice was last updated (push or poll). */
56192
+ lastFetchedAt: number()
56193
+ });
56194
+ var heatingValveCapability = {
56195
+ name: "heating-valve",
56196
+ scope: "device",
56197
+ deviceNative: true,
56198
+ mode: "singleton",
56199
+ deviceTypes: [DeviceType.Thermostat],
56200
+ methods: {},
56201
+ status: {
56202
+ schema: HeatingValveStatusSchema,
56203
+ kind: "push"
56204
+ },
56205
+ runtimeState: HeatingValveStatusSchema,
56206
+ durability: "session",
56207
+ history: { fields: { position: {
56208
+ kind: "gauge",
56209
+ unit: "%",
56210
+ deadband: 1
56211
+ } } },
56212
+ volatileStateFields: ["lastFetchedAt"]
56213
+ };
55397
56214
  /**
55398
56215
  * Humidifier / dehumidifier cap. Models HA `humidifier.*` entities —
55399
56216
  * an on/off actuator with an optional target-humidity setpoint and an
@@ -56526,7 +57343,19 @@ var TlsStatusSchema = object({
56526
57343
  sans: array(string()),
56527
57344
  caCertPem: string().nullable(),
56528
57345
  reissueError: string().nullable(),
56529
- restartRequired: boolean()
57346
+ restartRequired: boolean(),
57347
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
57348
+ caMissing: boolean(),
57349
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
57350
+ localCaConstrained: boolean().nullable(),
57351
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
57352
+ caReplacedAt: string().nullable(),
57353
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
57354
+ storedUpload: object({
57355
+ leafFingerprintSha256: string(),
57356
+ validTo: string(),
57357
+ hasCa: boolean()
57358
+ }).nullable()
56530
57359
  });
56531
57360
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
56532
57361
  /**
@@ -56582,6 +57411,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
56582
57411
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
56583
57412
  kind: "mutation",
56584
57413
  auth: "admin"
57414
+ }), method(_void(), TlsStatusSchema, {
57415
+ kind: "mutation",
57416
+ auth: "admin"
56585
57417
  });
56586
57418
  var LockControlStatusSchema = object({
56587
57419
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -63075,7 +63907,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
63075
63907
  kind: "mutation",
63076
63908
  auth: "admin",
63077
63909
  access: "delete"
63078
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
63910
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
63911
+ kind: "mutation",
63912
+ auth: "admin",
63913
+ access: "create"
63914
+ }), method(object({
63079
63915
  userId: string(),
63080
63916
  code: string()
63081
63917
  }), object({ valid: boolean() }), {
@@ -64795,6 +65631,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
64795
65631
  dayNight: dayNightCapability,
64796
65632
  deviceDiscovery: deviceDiscoveryCapability,
64797
65633
  deviceStatus: deviceStatusCapability,
65634
+ dishwasher: dishwasherCapability,
64798
65635
  doorbell: doorbellCapability,
64799
65636
  enumSensor: enumSensorCapability,
64800
65637
  eventEmitter: eventEmitterCapability,
@@ -64802,6 +65639,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
64802
65639
  featureProbe: featureProbeCapability,
64803
65640
  flood: floodCapability,
64804
65641
  gas: gasCapability,
65642
+ heatingValve: heatingValveCapability,
64805
65643
  humidifier: humidifierCapability,
64806
65644
  humiditySensor: humiditySensorCapability,
64807
65645
  image: imageCapability,
@@ -64887,13 +65725,14 @@ var BaseDevice$1 = class {
64887
65725
  get state() {
64888
65726
  if (!this._stateProxyCache) {
64889
65727
  const cache = {};
64890
- const handler = { get: (_target, key) => {
65728
+ const handler = { get: (target, key) => {
64891
65729
  const k = key;
64892
- if (k in cache) return cache[k];
65730
+ const existing = Reflect.get(target, k);
65731
+ if (existing !== void 0) return existing;
64893
65732
  const cap = DEVICE_LOCAL_STATE_CAPS[k];
64894
65733
  if (!cap) return void 0;
64895
65734
  const proxy = this.sliceProxy(cap);
64896
- cache[k] = proxy;
65735
+ Reflect.set(target, k, proxy);
64897
65736
  return proxy;
64898
65737
  } };
64899
65738
  this._stateProxyCache = new Proxy(cache, handler);
@@ -65092,7 +65931,7 @@ var BaseDevice$1 = class {
65092
65931
  async updateSourceInfo(patch) {
65093
65932
  const next = mergeSourceInfo(this.sourceInfo, patch);
65094
65933
  this._sourceInfoCache = Object.freeze({ ...next });
65095
- const action = this.ctx.api?.deviceManager?.setMetadata;
65934
+ const action = this.ctx.api.deviceManager?.setMetadata;
65096
65935
  if (action) try {
65097
65936
  await action.mutate({
65098
65937
  deviceId: this.id,
@@ -65127,7 +65966,7 @@ var BaseDevice$1 = class {
65127
65966
  * device boot on a meta refresh.
65128
65967
  */
65129
65968
  async refreshFeatures() {
65130
- const action = this.ctx.api?.deviceManager?.registerDevice;
65969
+ const action = this.ctx.api.deviceManager?.registerDevice;
65131
65970
  if (!action) return;
65132
65971
  try {
65133
65972
  await action.mutate({
@@ -65526,6 +66365,12 @@ var BaseDeviceProvider = class extends BaseAddon {
65526
66365
  provider: this
65527
66366
  }];
65528
66367
  }
66368
+ /** Flatten `super.onInitialize()` whether it returned an array or an envelope. */
66369
+ providerRegistrationsFromSuper(result) {
66370
+ if (Array.isArray(result)) return result;
66371
+ if (result !== void 0 && result.providers !== void 0) return [...result.providers];
66372
+ return [];
66373
+ }
65529
66374
  async onShutdown() {
65530
66375
  this._restoreShuttingDown = true;
65531
66376
  this.cancelRestoreRetries();
@@ -66052,7 +66897,7 @@ var BaseDeviceProvider = class extends BaseAddon {
66052
66897
  return toDeviceSummary(device, this.addonId);
66053
66898
  }
66054
66899
  };
66055
- 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;
66900
+ 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;
66056
66901
  new Set(Object.values(DeviceType));
66057
66902
  Object.freeze({
66058
66903
  "accessories.getStatus": {
@@ -67201,6 +68046,12 @@ Object.freeze({
67201
68046
  addonId: null,
67202
68047
  access: "view"
67203
68048
  },
68049
+ "coreBlocks.migrateRawSecrets": {
68050
+ capName: "core-blocks",
68051
+ capScope: "system",
68052
+ addonId: null,
68053
+ access: "create"
68054
+ },
67204
68055
  "coreBlocks.restart": {
67205
68056
  capName: "core-blocks",
67206
68057
  capScope: "system",
@@ -68467,6 +69318,60 @@ Object.freeze({
68467
69318
  addonId: null,
68468
69319
  access: "view"
68469
69320
  },
69321
+ "dishwasher.getStatus": {
69322
+ capName: "dishwasher",
69323
+ capScope: "device",
69324
+ addonId: null,
69325
+ access: "view"
69326
+ },
69327
+ "dishwasher.pause": {
69328
+ capName: "dishwasher",
69329
+ capScope: "device",
69330
+ addonId: null,
69331
+ access: "create"
69332
+ },
69333
+ "dishwasher.setHalfLoad": {
69334
+ capName: "dishwasher",
69335
+ capScope: "device",
69336
+ addonId: null,
69337
+ access: "create"
69338
+ },
69339
+ "dishwasher.setHygienePlus": {
69340
+ capName: "dishwasher",
69341
+ capScope: "device",
69342
+ addonId: null,
69343
+ access: "create"
69344
+ },
69345
+ "dishwasher.setOption": {
69346
+ capName: "dishwasher",
69347
+ capScope: "device",
69348
+ addonId: null,
69349
+ access: "create"
69350
+ },
69351
+ "dishwasher.setPower": {
69352
+ capName: "dishwasher",
69353
+ capScope: "device",
69354
+ addonId: null,
69355
+ access: "create"
69356
+ },
69357
+ "dishwasher.setProgram": {
69358
+ capName: "dishwasher",
69359
+ capScope: "device",
69360
+ addonId: null,
69361
+ access: "create"
69362
+ },
69363
+ "dishwasher.start": {
69364
+ capName: "dishwasher",
69365
+ capScope: "device",
69366
+ addonId: null,
69367
+ access: "create"
69368
+ },
69369
+ "dishwasher.stop": {
69370
+ capName: "dishwasher",
69371
+ capScope: "device",
69372
+ addonId: null,
69373
+ access: "create"
69374
+ },
68470
69375
  "doorbell.getStatus": {
68471
69376
  capName: "doorbell",
68472
69377
  capScope: "device",
@@ -68677,6 +69582,12 @@ Object.freeze({
68677
69582
  addonId: null,
68678
69583
  access: "view"
68679
69584
  },
69585
+ "heatingValve.getStatus": {
69586
+ capName: "heating-valve",
69587
+ capScope: "device",
69588
+ addonId: null,
69589
+ access: "view"
69590
+ },
68680
69591
  "humidifier.getStatus": {
68681
69592
  capName: "humidifier",
68682
69593
  capScope: "device",
@@ -68887,6 +69798,12 @@ Object.freeze({
68887
69798
  addonId: null,
68888
69799
  access: "create"
68889
69800
  },
69801
+ "keychainAdmin.importSecret": {
69802
+ capName: "keychain-admin",
69803
+ capScope: "system",
69804
+ addonId: null,
69805
+ access: "create"
69806
+ },
68890
69807
  "keychainAdmin.listAudit": {
68891
69808
  capName: "keychain-admin",
68892
69809
  capScope: "system",
@@ -69055,6 +69972,12 @@ Object.freeze({
69055
69972
  addonId: null,
69056
69973
  access: "view"
69057
69974
  },
69975
+ "llm.migrateRawSecrets": {
69976
+ capName: "llm",
69977
+ capScope: "system",
69978
+ addonId: null,
69979
+ access: "create"
69980
+ },
69058
69981
  "llm.resolveModelRef": {
69059
69982
  capName: "llm",
69060
69983
  capScope: "system",
@@ -69283,6 +70206,12 @@ Object.freeze({
69283
70206
  addonId: null,
69284
70207
  access: "create"
69285
70208
  },
70209
+ "localNetwork.useStoredUploadedCertificate": {
70210
+ capName: "local-network",
70211
+ capScope: "system",
70212
+ addonId: null,
70213
+ access: "create"
70214
+ },
69286
70215
  "lockControl.getStatus": {
69287
70216
  capName: "lock-control",
69288
70217
  capScope: "device",
@@ -71935,6 +72864,30 @@ Object.freeze({
71935
72864
  addonId: null,
71936
72865
  access: "create"
71937
72866
  },
72867
+ "recordEntries.deleteEntry": {
72868
+ capName: "record-entries",
72869
+ capScope: "system",
72870
+ addonId: null,
72871
+ access: "delete"
72872
+ },
72873
+ "recordEntries.listEntries": {
72874
+ capName: "record-entries",
72875
+ capScope: "system",
72876
+ addonId: null,
72877
+ access: "view"
72878
+ },
72879
+ "recordEntries.listEntryKinds": {
72880
+ capName: "record-entries",
72881
+ capScope: "system",
72882
+ addonId: null,
72883
+ access: "view"
72884
+ },
72885
+ "recordEntries.putEntry": {
72886
+ capName: "record-entries",
72887
+ capScope: "system",
72888
+ addonId: null,
72889
+ access: "create"
72890
+ },
71938
72891
  "recording.getAvailability": {
71939
72892
  capName: "recording",
71940
72893
  capScope: "device",
@@ -72235,6 +73188,102 @@ Object.freeze({
72235
73188
  addonId: null,
72236
73189
  access: "view"
72237
73190
  },
73191
+ "records.aggregate": {
73192
+ capName: "records",
73193
+ capScope: "system",
73194
+ addonId: null,
73195
+ access: "view"
73196
+ },
73197
+ "records.allocateId": {
73198
+ capName: "records",
73199
+ capScope: "system",
73200
+ addonId: null,
73201
+ access: "create"
73202
+ },
73203
+ "records.count": {
73204
+ capName: "records",
73205
+ capScope: "system",
73206
+ addonId: null,
73207
+ access: "view"
73208
+ },
73209
+ "records.declareKinds": {
73210
+ capName: "records",
73211
+ capScope: "system",
73212
+ addonId: null,
73213
+ access: "create"
73214
+ },
73215
+ "records.delete": {
73216
+ capName: "records",
73217
+ capScope: "system",
73218
+ addonId: null,
73219
+ access: "delete"
73220
+ },
73221
+ "records.deleteDevice": {
73222
+ capName: "records",
73223
+ capScope: "system",
73224
+ addonId: null,
73225
+ access: "delete"
73226
+ },
73227
+ "records.deleteMany": {
73228
+ capName: "records",
73229
+ capScope: "system",
73230
+ addonId: null,
73231
+ access: "delete"
73232
+ },
73233
+ "records.deleteWhere": {
73234
+ capName: "records",
73235
+ capScope: "system",
73236
+ addonId: null,
73237
+ access: "delete"
73238
+ },
73239
+ "records.get": {
73240
+ capName: "records",
73241
+ capScope: "system",
73242
+ addonId: null,
73243
+ access: "view"
73244
+ },
73245
+ "records.getMany": {
73246
+ capName: "records",
73247
+ capScope: "system",
73248
+ addonId: null,
73249
+ access: "view"
73250
+ },
73251
+ "records.histogram": {
73252
+ capName: "records",
73253
+ capScope: "system",
73254
+ addonId: null,
73255
+ access: "view"
73256
+ },
73257
+ "records.patch": {
73258
+ capName: "records",
73259
+ capScope: "system",
73260
+ addonId: null,
73261
+ access: "create"
73262
+ },
73263
+ "records.put": {
73264
+ capName: "records",
73265
+ capScope: "system",
73266
+ addonId: null,
73267
+ access: "create"
73268
+ },
73269
+ "records.putMany": {
73270
+ capName: "records",
73271
+ capScope: "system",
73272
+ addonId: null,
73273
+ access: "create"
73274
+ },
73275
+ "records.query": {
73276
+ capName: "records",
73277
+ capScope: "system",
73278
+ addonId: null,
73279
+ access: "view"
73280
+ },
73281
+ "records.secretRefs": {
73282
+ capName: "records",
73283
+ capScope: "system",
73284
+ addonId: null,
73285
+ access: "view"
73286
+ },
72238
73287
  "sceneMonitor.captureReference": {
72239
73288
  capName: "scene-monitor",
72240
73289
  capScope: "device",
@@ -72667,6 +73716,48 @@ Object.freeze({
72667
73716
  addonId: null,
72668
73717
  access: "create"
72669
73718
  },
73719
+ "storageAdmin.adoptRecords": {
73720
+ capName: "storage-admin",
73721
+ capScope: "system",
73722
+ addonId: null,
73723
+ access: "create"
73724
+ },
73725
+ "storageAdmin.dropCollection": {
73726
+ capName: "storage-admin",
73727
+ capScope: "system",
73728
+ addonId: null,
73729
+ access: "delete"
73730
+ },
73731
+ "storageAdmin.isAdoptedLegacyTable": {
73732
+ capName: "storage-admin",
73733
+ capScope: "system",
73734
+ addonId: null,
73735
+ access: "view"
73736
+ },
73737
+ "storageAdmin.listKinds": {
73738
+ capName: "storage-admin",
73739
+ capScope: "system",
73740
+ addonId: null,
73741
+ access: "view"
73742
+ },
73743
+ "storageAdmin.listTables": {
73744
+ capName: "storage-admin",
73745
+ capScope: "system",
73746
+ addonId: null,
73747
+ access: "view"
73748
+ },
73749
+ "storageAdmin.readLegacyCollection": {
73750
+ capName: "storage-admin",
73751
+ capScope: "system",
73752
+ addonId: null,
73753
+ access: "view"
73754
+ },
73755
+ "storageAdmin.readRecords": {
73756
+ capName: "storage-admin",
73757
+ capScope: "system",
73758
+ addonId: null,
73759
+ access: "view"
73760
+ },
72670
73761
  "storageEvictable.evict": {
72671
73762
  capName: "storage-evictable",
72672
73763
  capScope: "system",
@@ -73579,6 +74670,12 @@ Object.freeze({
73579
74670
  addonId: null,
73580
74671
  access: "view"
73581
74672
  },
74673
+ "userManagement.migrateRawSecrets": {
74674
+ capName: "user-management",
74675
+ capScope: "system",
74676
+ addonId: null,
74677
+ access: "create"
74678
+ },
73582
74679
  "userManagement.oauthExchangeCode": {
73583
74680
  capName: "user-management",
73584
74681
  capScope: "system",
@@ -74078,7 +75175,7 @@ Object.freeze({
74078
75175
  access: "create"
74079
75176
  }
74080
75177
  });
74081
- 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;
75178
+ 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;
74082
75179
  DeviceFeature.BatteryOperated;
74083
75180
  Object.freeze({
74084
75181
  "accessories.getStatus": [{
@@ -74902,6 +75999,51 @@ Object.freeze({
74902
75999
  form: "single",
74903
76000
  optional: false
74904
76001
  }],
76002
+ "dishwasher.getStatus": [{
76003
+ name: "deviceId",
76004
+ form: "single",
76005
+ optional: false
76006
+ }],
76007
+ "dishwasher.pause": [{
76008
+ name: "deviceId",
76009
+ form: "single",
76010
+ optional: false
76011
+ }],
76012
+ "dishwasher.setHalfLoad": [{
76013
+ name: "deviceId",
76014
+ form: "single",
76015
+ optional: false
76016
+ }],
76017
+ "dishwasher.setHygienePlus": [{
76018
+ name: "deviceId",
76019
+ form: "single",
76020
+ optional: false
76021
+ }],
76022
+ "dishwasher.setOption": [{
76023
+ name: "deviceId",
76024
+ form: "single",
76025
+ optional: false
76026
+ }],
76027
+ "dishwasher.setPower": [{
76028
+ name: "deviceId",
76029
+ form: "single",
76030
+ optional: false
76031
+ }],
76032
+ "dishwasher.setProgram": [{
76033
+ name: "deviceId",
76034
+ form: "single",
76035
+ optional: false
76036
+ }],
76037
+ "dishwasher.start": [{
76038
+ name: "deviceId",
76039
+ form: "single",
76040
+ optional: false
76041
+ }],
76042
+ "dishwasher.stop": [{
76043
+ name: "deviceId",
76044
+ form: "single",
76045
+ optional: false
76046
+ }],
74905
76047
  "doorbell.getStatus": [{
74906
76048
  name: "deviceId",
74907
76049
  form: "single",
@@ -74971,6 +76113,11 @@ Object.freeze({
74971
76113
  form: "single",
74972
76114
  optional: false
74973
76115
  }],
76116
+ "heatingValve.getStatus": [{
76117
+ name: "deviceId",
76118
+ form: "single",
76119
+ optional: false
76120
+ }],
74974
76121
  "humidifier.getStatus": [{
74975
76122
  name: "deviceId",
74976
76123
  form: "single",
@@ -76255,6 +77402,37 @@ Object.freeze({
76255
77402
  form: "single",
76256
77403
  optional: false
76257
77404
  }],
77405
+ "records.count": [{
77406
+ name: "deviceId",
77407
+ form: "single",
77408
+ optional: true
77409
+ }],
77410
+ "records.deleteDevice": [{
77411
+ name: "deviceId",
77412
+ form: "single",
77413
+ optional: false
77414
+ }],
77415
+ "records.deleteWhere": [{
77416
+ name: "deviceId",
77417
+ form: "single",
77418
+ optional: true
77419
+ }],
77420
+ "records.histogram": [{
77421
+ name: "deviceId",
77422
+ form: "single",
77423
+ optional: true
77424
+ }],
77425
+ "records.putMany": [{
77426
+ name: "records",
77427
+ form: "object-array",
77428
+ optional: false,
77429
+ itemField: "deviceId"
77430
+ }],
77431
+ "records.query": [{
77432
+ name: "deviceId",
77433
+ form: "single",
77434
+ optional: true
77435
+ }],
76258
77436
  "sceneMonitor.captureReference": [{
76259
77437
  name: "deviceId",
76260
77438
  form: "single",
@@ -76371,6 +77549,17 @@ Object.freeze({
76371
77549
  form: "single",
76372
77550
  optional: false
76373
77551
  }],
77552
+ "storageAdmin.adoptRecords": [{
77553
+ name: "records",
77554
+ form: "object-array",
77555
+ optional: false,
77556
+ itemField: "deviceId"
77557
+ }],
77558
+ "storageAdmin.readRecords": [{
77559
+ name: "deviceId",
77560
+ form: "single",
77561
+ optional: true
77562
+ }],
76374
77563
  "streamBroker.acquireEgressTranscode": [{
76375
77564
  name: "deviceId",
76376
77565
  form: "single",
@@ -84087,7 +85276,7 @@ var DreoProviderAddon = class extends BaseDeviceProvider {
84087
85276
  super({});
84088
85277
  }
84089
85278
  async onInitialize() {
84090
- const regs = await super.onInitialize();
85279
+ const regs = this.providerRegistrationsFromSuper(await super.onInitialize());
84091
85280
  this.clients = new DreoClientRegistry(this.ctx.logger);
84092
85281
  this.clients.setOnConnected((integrationId) => {
84093
85282
  this.ctx.logger.info("Dreo: integration connected", { meta: { integrationId } });