@camstack/addon-provider-wyze 0.2.137 → 0.2.139

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.mjs CHANGED
@@ -10,7 +10,7 @@ import { getCACertificates, setDefaultCACertificates } from "node:tls";
10
10
  //#region \0rolldown/runtime.js
11
11
  var __require$1 = /* @__PURE__ */ createRequire(import.meta.url);
12
12
  //#endregion
13
- //#region ../types/dist/event-category-C4hVnRo8.mjs
13
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
14
14
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
15
15
  EventCategory["SystemBoot"] = "system.boot";
16
16
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -74,6 +74,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
74
74
  * consumes this category and maps it to the `addon-crash-loop` kind.
75
75
  */
76
76
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
77
+ /**
78
+ * A runner whose addon refused to start with a typed reason (D877) - parked
79
+ * in `refused`, never counted by the crash breaker, retried on operator
80
+ * action. One event per refusal.
81
+ */
82
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
83
+ /**
84
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
85
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
86
+ * runner is still pending) and the alert centre (close a recovered runner).
87
+ */
88
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
89
+ /**
90
+ * The node's one-shot runner boot check (D877): planned runners against the
91
+ * process service, `degraded` when any is failed, refused or missing. The
92
+ * alert centre turns it into one alert and a direct critical push.
93
+ */
94
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
77
95
  EventCategory["AddonError"] = "addon.error";
78
96
  EventCategory["AddonPageReady"] = "addon.page-ready";
79
97
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -5398,7 +5416,7 @@ var ZodIssueCode = {
5398
5416
  var ZodFirstPartyTypeKind;
5399
5417
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5400
5418
  //#endregion
5401
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5419
+ //#region ../types/dist/sleep-BOjuyoPC.mjs
5402
5420
  /**
5403
5421
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5404
5422
  * window to float samples (D455).
@@ -5515,7 +5533,7 @@ function isKeychainStoredField(field) {
5515
5533
  var SECRET_CLEAR = { $secretClear: true };
5516
5534
  /** The `'***'` token D634 redaction writes for non-admins. */
5517
5535
  var LEGACY_DEVICE_REDACTION = "***";
5518
- function isRecord$2(value) {
5536
+ function isRecord$5(value) {
5519
5537
  return typeof value === "object" && value !== null && !Array.isArray(value);
5520
5538
  }
5521
5539
  function makeSecretMarker(ref) {
@@ -5526,12 +5544,12 @@ function makeSecretMarker(ref) {
5526
5544
  }
5527
5545
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5528
5546
  function isSecretMarker(value) {
5529
- if (!isRecord$2(value)) return false;
5547
+ if (!isRecord$5(value)) return false;
5530
5548
  const ref = value["$secret"];
5531
5549
  return typeof ref === "string" && ref.length > 0;
5532
5550
  }
5533
5551
  function isSecretClear(value) {
5534
- return isRecord$2(value) && value["$secretClear"] === true;
5552
+ return isRecord$5(value) && value["$secretClear"] === true;
5535
5553
  }
5536
5554
  /**
5537
5555
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6141,7 +6159,7 @@ var KeychainWriteRefusedError = class extends Error {
6141
6159
  }
6142
6160
  };
6143
6161
  var KEEP = { kind: "keep" };
6144
- function isRecord$1(value) {
6162
+ function isRecord$4(value) {
6145
6163
  return typeof value === "object" && value !== null && !Array.isArray(value);
6146
6164
  }
6147
6165
  function defaultMintId() {
@@ -6154,7 +6172,7 @@ function collectSecretMarkerRefs(value, out = []) {
6154
6172
  return out;
6155
6173
  }
6156
6174
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6157
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6175
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6158
6176
  return out;
6159
6177
  }
6160
6178
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6209,7 +6227,7 @@ function rowId(row, idKey) {
6209
6227
  return null;
6210
6228
  }
6211
6229
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6212
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6230
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6213
6231
  if (!Array.isArray(incoming)) {
6214
6232
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6215
6233
  return {
@@ -6225,7 +6243,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6225
6243
  const kept = /* @__PURE__ */ new Set();
6226
6244
  const rows = [];
6227
6245
  for (const row of incoming) {
6228
- if (!isRecord$1(row)) {
6246
+ if (!isRecord$4(row)) {
6229
6247
  rows.push(row);
6230
6248
  continue;
6231
6249
  }
@@ -6250,7 +6268,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6250
6268
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6251
6269
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6252
6270
  case "object": {
6253
- if (!isRecord$1(incoming)) {
6271
+ if (!isRecord$4(incoming)) {
6254
6272
  if (incoming === void 0) return KEEP;
6255
6273
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6256
6274
  return {
@@ -6258,7 +6276,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6258
6276
  value: incoming
6259
6277
  };
6260
6278
  }
6261
- const storedObj = isRecord$1(stored) ? stored : {};
6279
+ const storedObj = isRecord$4(stored) ? stored : {};
6262
6280
  return {
6263
6281
  kind: "value",
6264
6282
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6381,7 +6399,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6381
6399
  value: items
6382
6400
  };
6383
6401
  }
6384
- if (isRecord$1(v)) {
6402
+ if (isRecord$4(v)) {
6385
6403
  const out = {};
6386
6404
  for (const [k, child] of Object.entries(v)) {
6387
6405
  const s = substitute(child);
@@ -6413,7 +6431,7 @@ var SecretOverwriteRefusedError = class extends Error {
6413
6431
  this.name = "SecretOverwriteRefusedError";
6414
6432
  }
6415
6433
  };
6416
- function isRecord(value) {
6434
+ function isRecord$3(value) {
6417
6435
  return typeof value === "object" && value !== null && !Array.isArray(value);
6418
6436
  }
6419
6437
  function resolvedValue(pass, marker) {
@@ -6442,7 +6460,7 @@ function inArray(pass, incoming, stored) {
6442
6460
  return incoming.map((item, index) => {
6443
6461
  const twin = stored[index];
6444
6462
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6445
- if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6463
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6446
6464
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6447
6465
  return item;
6448
6466
  });
@@ -6453,7 +6471,7 @@ function inArrayRow(pass, incoming, stored) {
6453
6471
  const twin = stored[key];
6454
6472
  if (isSecretMarker(twin)) {
6455
6473
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6456
- } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6474
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6457
6475
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6458
6476
  }
6459
6477
  return out;
@@ -6461,7 +6479,7 @@ function inArrayRow(pass, incoming, stored) {
6461
6479
  async function walk(pass, incoming, stored) {
6462
6480
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6463
6481
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6464
- if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6482
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6465
6483
  const out = { ...incoming };
6466
6484
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6467
6485
  return out;
@@ -6492,7 +6510,7 @@ async function restoreUnchangedSecrets(input) {
6492
6510
  function isJsonEqual(a, b) {
6493
6511
  if (Object.is(a, b)) return true;
6494
6512
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6495
- if (isRecord(a) && isRecord(b)) {
6513
+ if (isRecord$3(a) && isRecord$3(b)) {
6496
6514
  const keys = Object.keys(a);
6497
6515
  if (keys.length !== Object.keys(b).length) return false;
6498
6516
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -6516,7 +6534,7 @@ function markerKeysOf(blob, owner) {
6516
6534
  }
6517
6535
  function nodeFromStored(value, owner) {
6518
6536
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6519
- if (!isRecord(value)) return null;
6537
+ if (!isRecord$3(value)) return null;
6520
6538
  const children = /* @__PURE__ */ new Map();
6521
6539
  for (const [key, child] of Object.entries(value)) {
6522
6540
  const node = nodeFromStored(child, owner);
@@ -6649,7 +6667,6 @@ function createHandle(raw, opts) {
6649
6667
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6650
6668
  const readAddonStoreResult = raw.readAddonStoreResult;
6651
6669
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6652
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6653
6670
  const overrides = {
6654
6671
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6655
6672
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6673,12 +6690,12 @@ function createHandle(raw, opts) {
6673
6690
  };
6674
6691
  } } : {},
6675
6692
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6676
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6677
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6693
+ readDeviceStoreBatch: async (deviceIds) => {
6694
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6678
6695
  const out = /* @__PURE__ */ new Map();
6679
6696
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6680
6697
  return out;
6681
- } } : {},
6698
+ },
6682
6699
  writeAddonStore: async (patch) => {
6683
6700
  await writeAddon(patch);
6684
6701
  },
@@ -7305,7 +7322,7 @@ var BaseAddon = class {
7305
7322
  if (!ctx) return;
7306
7323
  const addonId = ctx.id;
7307
7324
  setImmediate(() => {
7308
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7325
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7309
7326
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7310
7327
  }).catch((err) => {
7311
7328
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7505,7 +7522,7 @@ var BaseAddon = class {
7505
7522
  return this._addonSecretTree;
7506
7523
  }
7507
7524
  deviceSecretTree() {
7508
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7525
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7509
7526
  return this._deviceSecretTree;
7510
7527
  }
7511
7528
  /**
@@ -7581,42 +7598,135 @@ var BaseAddon = class {
7581
7598
  this[timerOf] = timer;
7582
7599
  }
7583
7600
  /**
7584
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7585
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7586
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7587
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7601
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7602
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7588
7603
  * addon permanently broken.
7589
7604
  *
7590
- * Retry only the two known infra fingerprints. Anything else propagates so
7591
- * real bugs surface immediately. After the budget expires we fall back to
7592
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7605
+ * Two kinds of outage, two budgets:
7606
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7607
+ * initialized`, `provider not available`): a short budget, then the addon
7608
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7609
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7610
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7611
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7612
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7613
+ * loop. A long, bounded budget; only after it the error propagates - the
7614
+ * addon never runs on defaults for a store it could not ask.
7615
+ * Anything else propagates immediately so real bugs surface.
7593
7616
  */
7594
7617
  async readAddonStoreWithRetry() {
7595
7618
  const settings = this.rawSettings();
7596
7619
  if (!settings) return {};
7597
- const delaysMs = [
7598
- 150,
7599
- 350,
7600
- 600,
7601
- 900
7602
- ];
7603
7620
  let lastErr;
7604
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7621
+ for (let attempt = 0;; attempt++) try {
7605
7622
  const stored = await settings.readAddonStore() ?? {};
7606
7623
  this.settingsStoreReady = true;
7607
7624
  return stored;
7608
7625
  } catch (err) {
7609
7626
  lastErr = err;
7610
- const msg = err instanceof Error ? err.message : String(err);
7611
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7612
- if (attempt === delaysMs.length) break;
7613
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7627
+ const kind = classifyStoreError(err);
7628
+ if (kind === "permanent") throw err;
7629
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7630
+ if (delay === void 0) {
7631
+ if (kind === "transport") throw err;
7632
+ break;
7633
+ }
7634
+ await new Promise((r) => setTimeout(r, delay));
7614
7635
  }
7615
7636
  this.settingsStoreReady = false;
7616
7637
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7617
7638
  return {};
7618
7639
  }
7619
7640
  };
7641
+ /** The settings store's own restart fingerprints. */
7642
+ var RESTART_RETRY_DELAYS_MS = [
7643
+ 150,
7644
+ 350,
7645
+ 600,
7646
+ 900
7647
+ ];
7648
+ /** A hub restarting under a booting runner: ~100 s in total. */
7649
+ var TRANSPORT_RETRY_DELAYS_MS = [
7650
+ 150,
7651
+ 350,
7652
+ 600,
7653
+ 900,
7654
+ 2e3,
7655
+ 5e3,
7656
+ 1e4,
7657
+ 2e4,
7658
+ 3e4,
7659
+ 3e4
7660
+ ];
7661
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7662
+ /** Node / socket error codes of a connection that did not happen or broke. */
7663
+ var TRANSPORT_CODES = new Set([
7664
+ "ECONNREFUSED",
7665
+ "ECONNRESET",
7666
+ "ETIMEDOUT",
7667
+ "EPIPE",
7668
+ "EHOSTUNREACH",
7669
+ "ENETUNREACH"
7670
+ ]);
7671
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7672
+ var UNAVAILABLE_TRPC_CODES = new Set([
7673
+ "TIMEOUT",
7674
+ "SERVICE_UNAVAILABLE",
7675
+ "BAD_GATEWAY",
7676
+ "GATEWAY_TIMEOUT"
7677
+ ]);
7678
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7679
+ var TRANSPORT_PHRASES = [
7680
+ "discovery deadline exceeded",
7681
+ "parent could not route child unowned cap call",
7682
+ "UDS request timed out after",
7683
+ "channel closed"
7684
+ ];
7685
+ /** Moleculer error `type`s of a call that could not be served right now. */
7686
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7687
+ "REQUEST_TIMEOUT",
7688
+ "SERVICE_NOT_FOUND",
7689
+ "SERVICE_NOT_AVAILABLE",
7690
+ "REQUEST_REJECTED",
7691
+ "BROKER_DISCONNECTED"
7692
+ ]);
7693
+ function stringProp(value, key) {
7694
+ if (typeof value !== "object" || value === null) return void 0;
7695
+ const found = Reflect.get(value, key);
7696
+ return typeof found === "string" ? found : void 0;
7697
+ }
7698
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7699
+ function errorCode(err) {
7700
+ const out = {};
7701
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7702
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7703
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7704
+ if (node !== void 0) out.node = node;
7705
+ const trpc = stringProp(data, "code");
7706
+ if (trpc !== void 0) out.trpc = trpc;
7707
+ return out;
7708
+ }
7709
+ /**
7710
+ * Is a settings read failure worth retrying, and with which budget? Only
7711
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7712
+ * one of the exact phrases our own transport raises. A message that merely
7713
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7714
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7715
+ */
7716
+ function classifyStoreError(err) {
7717
+ const message = err instanceof Error ? err.message : String(err);
7718
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7719
+ const code = errorCode(err);
7720
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7721
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7722
+ if (typeof err === "object" && err !== null) {
7723
+ if (Reflect.get(err, "retryable") === true) return "transport";
7724
+ const type = stringProp(err, "type");
7725
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7726
+ }
7727
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7728
+ return "permanent";
7729
+ }
7620
7730
  /**
7621
7731
  * Collect the keys of every field marked `perNode: true`, recursing into
7622
7732
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7706,6 +7816,156 @@ var PeerBytesTicketSchema = object({
7706
7816
  */
7707
7817
  declaredBytes: number().int().nonnegative().nullable()
7708
7818
  });
7819
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7820
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7821
+ var RECORD_DATABASES = ["settings", "events"];
7822
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7823
+ var RECORD_CLASSES = [
7824
+ "config",
7825
+ "ledger",
7826
+ "audit",
7827
+ "mirror",
7828
+ "ephemeral"
7829
+ ];
7830
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7831
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7832
+ var RECORD_BATCH_MAX = 1e3;
7833
+ var RECORD_QUERY_MAX = 1e3;
7834
+ function defOf(schema) {
7835
+ const zodBag = Reflect.get(schema, "_zod");
7836
+ if (typeof zodBag !== "object" || zodBag === null) return {};
7837
+ const def = Reflect.get(zodBag, "def");
7838
+ if (typeof def !== "object" || def === null) return {};
7839
+ return def;
7840
+ }
7841
+ function declaredHere(schema) {
7842
+ return globalRegistry.get(schema)?.secret === true;
7843
+ }
7844
+ /** Wrapper kinds whose `innerType` is the field itself. */
7845
+ var WRAPPERS = new Set([
7846
+ "optional",
7847
+ "nullable",
7848
+ "default",
7849
+ "prefault",
7850
+ "catch",
7851
+ "readonly",
7852
+ "nonoptional"
7853
+ ]);
7854
+ /**
7855
+ * The schema layers that make up ONE field: the schema itself and every
7856
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
7857
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
7858
+ * `.transform` on `in`).
7859
+ */
7860
+ function layersOf(schema) {
7861
+ const out = [];
7862
+ const queue = [schema];
7863
+ while (queue.length > 0) {
7864
+ const s = queue.shift();
7865
+ if (!s || out.includes(s)) continue;
7866
+ out.push(s);
7867
+ const def = defOf(s);
7868
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
7869
+ if (def.type === "pipe") {
7870
+ if (def.in) queue.push(def.in);
7871
+ if (def.out) queue.push(def.out);
7872
+ }
7873
+ }
7874
+ return out;
7875
+ }
7876
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
7877
+ function isZodSecret(schema) {
7878
+ return layersOf(schema).some(declaredHere);
7879
+ }
7880
+ /**
7881
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
7882
+ * element of this array" (`connection.password`, `rows[].token`). A declared
7883
+ * object or array is reported as one path and not descended into — everything
7884
+ * under it is secret.
7885
+ */
7886
+ function collectZodSecretPaths(schema, prefix = "") {
7887
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
7888
+ const paths = [];
7889
+ for (const layer of layersOf(schema)) {
7890
+ const def = defOf(layer);
7891
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
7892
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
7893
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
7894
+ else if (def.type === "intersection") {
7895
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
7896
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
7897
+ }
7898
+ }
7899
+ return [...new Set(paths)];
7900
+ }
7901
+ /**
7902
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
7903
+ * Zod row schema that describes it, and the helper that turns the two into the
7904
+ * JSON the engine stores.
7905
+ *
7906
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
7907
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
7908
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
7909
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
7910
+ * never a field name (D879).
7911
+ */
7912
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
7913
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
7914
+ var RecordIndexSchema = object({
7915
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
7916
+ fields: array(RecordFieldPathSchema).min(1).max(4),
7917
+ unique: boolean().optional()
7918
+ }).strict();
7919
+ var RecordRetentionSchema = union([
7920
+ object({
7921
+ ttlMs: number().int().positive(),
7922
+ from: _enum(["at", "write"])
7923
+ }).strict(),
7924
+ object({
7925
+ maxRows: number().int().positive().optional(),
7926
+ maxRowsPerDevice: number().int().positive().optional()
7927
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
7928
+ object({
7929
+ owner: string().min(1),
7930
+ reason: string().min(1)
7931
+ }).strict(),
7932
+ object({ none: string().min(1) }).strict()
7933
+ ]);
7934
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
7935
+ var EntryDescriptorSchema = object({
7936
+ title: string().min(1),
7937
+ /** The record body field shown as the entry's name. */
7938
+ nameField: string().min(1),
7939
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
7940
+ fields: record(string(), unknown())
7941
+ }).strict();
7942
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
7943
+ var RecordKindDeclarationSchema = object({
7944
+ database: _enum(RECORD_DATABASES).default("settings"),
7945
+ class: _enum(RECORD_CLASSES),
7946
+ writeTrigger: string().min(1),
7947
+ device: _enum([
7948
+ "required",
7949
+ "optional",
7950
+ "none"
7951
+ ]).default("none"),
7952
+ at: _enum(["required", "none"]).default("none"),
7953
+ indexes: array(RecordIndexSchema).max(8).default([]),
7954
+ retention: RecordRetentionSchema,
7955
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
7956
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
7957
+ /** Derived from the Zod schema; never written by hand. */
7958
+ secretPaths: array(string().min(1)).default([]),
7959
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
7960
+ secretArrayKeys: record(string(), string()).default({}),
7961
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
7962
+ adoptsFrom: string().min(1).optional(),
7963
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
7964
+ transactFamily: string().min(1).optional(),
7965
+ entry: EntryDescriptorSchema.optional()
7966
+ }).strict();
7967
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
7968
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
7709
7969
  /** Shared Zod schemas used across streaming capabilities. */
7710
7970
  var CamProfileSchema = _enum([
7711
7971
  "high",
@@ -8170,69 +8430,6 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8170
8430
  kind: "mutation",
8171
8431
  auth: "admin"
8172
8432
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
8173
- function defOf(schema) {
8174
- return schema._zod?.def ?? {};
8175
- }
8176
- function declaredHere(schema) {
8177
- return globalRegistry.get(schema)?.secret === true;
8178
- }
8179
- /** Wrapper kinds whose `innerType` is the field itself. */
8180
- var WRAPPERS = new Set([
8181
- "optional",
8182
- "nullable",
8183
- "default",
8184
- "prefault",
8185
- "catch",
8186
- "readonly",
8187
- "nonoptional"
8188
- ]);
8189
- /**
8190
- * The schema layers that make up ONE field: the schema itself and every
8191
- * wrapper below it (optional / default / nullable / readonly / catch), plus
8192
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8193
- * `.transform` on `in`).
8194
- */
8195
- function layersOf(schema) {
8196
- const out = [];
8197
- const queue = [schema];
8198
- while (queue.length > 0) {
8199
- const s = queue.shift();
8200
- if (!s || out.includes(s)) continue;
8201
- out.push(s);
8202
- const def = defOf(s);
8203
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8204
- if (def.type === "pipe") {
8205
- if (def.in) queue.push(def.in);
8206
- if (def.out) queue.push(def.out);
8207
- }
8208
- }
8209
- return out;
8210
- }
8211
- /** True when any layer of this field declares `.meta({ secret: true })`. */
8212
- function isZodSecret(schema) {
8213
- return layersOf(schema).some(declaredHere);
8214
- }
8215
- /**
8216
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
8217
- * element of this array" (`connection.password`, `rows[].token`). A declared
8218
- * object or array is reported as one path and not descended into — everything
8219
- * under it is secret.
8220
- */
8221
- function collectZodSecretPaths(schema, prefix = "") {
8222
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8223
- const paths = [];
8224
- for (const layer of layersOf(schema)) {
8225
- const def = defOf(layer);
8226
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8227
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8228
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8229
- else if (def.type === "intersection") {
8230
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8231
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8232
- }
8233
- }
8234
- return [...new Set(paths)];
8235
- }
8236
8433
  object({
8237
8434
  code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
8238
8435
  params: record(string(), union([string(), number()])).optional()
@@ -8252,7 +8449,7 @@ function userError(code, params, englishFallback) {
8252
8449
  return new CamstackError(code, params, englishFallback);
8253
8450
  }
8254
8451
  //#endregion
8255
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8452
+ //#region ../types/dist/err-msg-BXKzRBwg.mjs
8256
8453
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8257
8454
  DeviceType["Camera"] = "camera";
8258
8455
  DeviceType["Hub"] = "hub";
@@ -8344,6 +8541,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
8344
8541
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
8345
8542
  * integrations sharing the same food/desiccant/hopper surface. */
8346
8543
  DeviceType["PetFeeder"] = "pet-feeder";
8544
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
8545
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
8546
+ * Sources: native Bosch Home Connect, reusable by similar integrations. */
8547
+ DeviceType["Dishwasher"] = "dishwasher";
8347
8548
  return DeviceType;
8348
8549
  }({});
8349
8550
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -8521,6 +8722,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8521
8722
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8522
8723
  * real Switch device for UI rendering / export adapters. */
8523
8724
  DeviceRole["BinaryHelper"] = "binary-helper";
8725
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
8726
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
8727
+ DeviceRole["Outlet"] = "outlet";
8524
8728
  /** Generic motion / occupancy / moving event source. Distinct from
8525
8729
  * the camera accessory PirSensor role: that one is a camera child;
8526
8730
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8598,7 +8802,7 @@ function errMsg(err) {
8598
8802
  return String(err);
8599
8803
  }
8600
8804
  //#endregion
8601
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
8805
+ //#region ../types/dist/composition-CB6PMT9p.mjs
8602
8806
  /**
8603
8807
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8604
8808
  *
@@ -11822,11 +12026,10 @@ var ClipModelMetaSchema = object({
11822
12026
  /**
11823
12027
  * The `vector-store` index this model's vectors live in. ONE feature space
11824
12028
  * per index: two models share an index only when their vectors are ranked
11825
- * against each other, which for CLIP means never across families. MobileCLIP
11826
- * S1 and S2 share `object-clip` for history (separated by the row's
11827
- * `modelId`); any other model gets its own.
12029
+ * against each other, which for CLIP means never across families. Every
12030
+ * model gets its own.
11828
12031
  */
11829
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12032
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
11830
12033
  /**
11831
12034
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
11832
12035
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -13005,8 +13208,13 @@ var AlertSeveritySchema = _enum([
13005
13208
  "info",
13006
13209
  "success",
13007
13210
  "warning",
13008
- "error"
13211
+ "error",
13212
+ "critical"
13009
13213
  ]);
13214
+ var AlertActionSchema = object({
13215
+ label: string(),
13216
+ href: string().optional()
13217
+ });
13010
13218
  var AlertStatusSchema = _enum([
13011
13219
  "active",
13012
13220
  "in-progress",
@@ -13024,6 +13232,7 @@ var AlertSchema = object({
13024
13232
  severity: AlertSeveritySchema,
13025
13233
  title: string(),
13026
13234
  message: string(),
13235
+ action: AlertActionSchema.optional(),
13027
13236
  status: AlertStatusSchema,
13028
13237
  progress: number().optional(),
13029
13238
  read: boolean(),
@@ -15559,6 +15768,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15559
15768
  keyField: string()
15560
15769
  }).optional()
15561
15770
  })) });
15771
+ /**
15772
+ * The report of a one-shot "move this owner's plaintext secrets into the
15773
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
15774
+ *
15775
+ * The owner runs it on its own rows, through its own write path; an operator
15776
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
15777
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
15778
+ */
15779
+ var RawSecretMigrationInputSchema = object({
15780
+ /** `false` (the default of the script) = report only. */
15781
+ apply: boolean() });
15782
+ var RawSecretMigrationReportSchema = object({
15783
+ apply: boolean(),
15784
+ /** Rows that can carry a secret (a profile, an enrolment). */
15785
+ rows: number().int(),
15786
+ /** Rows whose secret was plaintext when the run started. */
15787
+ raw: number().int(),
15788
+ /** Rows that already held a keychain marker when the run started. */
15789
+ markers: number().int(),
15790
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
15791
+ migrated: number().int(),
15792
+ /** Plaintext rows left in place because the move or its read-back failed. */
15793
+ failed: number().int(),
15794
+ /** After the run: rows still holding plaintext. */
15795
+ remainingRaw: number().int(),
15796
+ /** After the run: markers the keychain could not resolve right now. */
15797
+ unresolvedMarkers: number().int(),
15798
+ /**
15799
+ * A second, redundant copy of the secrets' rows that the run found (and, on
15800
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
15801
+ */
15802
+ redundantCopies: number().int().optional(),
15803
+ /** True when nothing is raw and every marker resolves. */
15804
+ verified: boolean()
15805
+ });
15562
15806
  /** Where a block runs. The operator chooses — a block driving a device on an
15563
15807
  * agent is the reason placement is not fixed to the hub. */
15564
15808
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -15785,6 +16029,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
15785
16029
  }), SettingsUpdateResultSchema, {
15786
16030
  kind: "mutation",
15787
16031
  auth: "admin"
16032
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16033
+ kind: "mutation",
16034
+ auth: "admin"
15788
16035
  }), method(object({}), object({ libs: array(object({
15789
16036
  filePath: string(),
15790
16037
  content: string()
@@ -16048,6 +16295,347 @@ id: union([string(), number()]) }), {
16048
16295
  auth: "admin"
16049
16296
  });
16050
16297
  /**
16298
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16299
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16300
+ * (operator intent, D870) and device-history (numbers over time, D850).
16301
+ *
16302
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16303
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16304
+ * that with the addon id closed over). It is deliberately NOT in any input
16305
+ * schema, so a session can never supply it, and a call with no stamp is refused
16306
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16307
+ * addons go through the owner's capability.
16308
+ *
16309
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16310
+ * never `[]`. Secret fields are never on the wire: a read shows the
16311
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16312
+ * resolves itself, and a write may carry only a keychain marker bound to the
16313
+ * row's own ref.
16314
+ *
16315
+ * Internal: addons reach it through `ctx.records`, never directly.
16316
+ */
16317
+ var RecordIdSchema = string().min(1).max(256);
16318
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16319
+ var RecordBodySchema = record(string(), unknown());
16320
+ var RecordInputSchema = object({
16321
+ id: RecordIdSchema,
16322
+ /** The device this row belongs to (D865 removal, per-device reads). */
16323
+ deviceId: number().int().optional(),
16324
+ /** The domain clock, ms: observed / created / opened. */
16325
+ at: number().int().optional(),
16326
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16327
+ expiresAt: number().int().optional(),
16328
+ data: RecordBodySchema
16329
+ });
16330
+ var RecordViewSchema = object({
16331
+ id: string(),
16332
+ deviceId: number().int().nullable(),
16333
+ at: number().nullable(),
16334
+ expiresAt: number().nullable(),
16335
+ rev: number().int(),
16336
+ updatedAt: number(),
16337
+ data: RecordBodySchema
16338
+ });
16339
+ /** Declared index fields only. Anything else does not compile, by design. */
16340
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16341
+ string(),
16342
+ number(),
16343
+ boolean(),
16344
+ object({ in: array(union([
16345
+ string(),
16346
+ number(),
16347
+ boolean()
16348
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16349
+ object({
16350
+ gt: union([string(), number()]).optional(),
16351
+ gte: union([string(), number()]).optional(),
16352
+ lt: union([string(), number()]).optional(),
16353
+ lte: union([string(), number()]).optional()
16354
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16355
+ ]));
16356
+ var KindShape = { kind: RecordKindNameSchema };
16357
+ var TimeWindowShape = {
16358
+ deviceId: number().int().optional(),
16359
+ atFrom: number().optional(),
16360
+ atTo: number().optional()
16361
+ };
16362
+ var RecordQueryInputSchema = object({
16363
+ ...KindShape,
16364
+ ...TimeWindowShape,
16365
+ where: RecordWhereSchema.optional(),
16366
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16367
+ order: _enum(["at", "id"]).optional(),
16368
+ desc: boolean().optional(),
16369
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16370
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16371
+ cursor: string().min(1).optional()
16372
+ });
16373
+ var RecordQueryResultSchema = object({
16374
+ records: array(RecordViewSchema),
16375
+ nextCursor: string().nullable()
16376
+ });
16377
+ var RecordKindStateSchema = _enum([
16378
+ "created",
16379
+ "unchanged",
16380
+ "updated"
16381
+ ]);
16382
+ var DeclareKindResultSchema = object({
16383
+ kindId: number().int(),
16384
+ state: RecordKindStateSchema,
16385
+ createdIndexes: array(string()),
16386
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16387
+ adoptionPending: object({
16388
+ legacyTable: string(),
16389
+ legacyRows: number().int()
16390
+ }).nullable()
16391
+ });
16392
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16393
+ var SecretRefsList = array(string());
16394
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16395
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16396
+ kind: "mutation",
16397
+ auth: "admin"
16398
+ }), method(object({
16399
+ ...KindShape,
16400
+ id: RecordIdSchema
16401
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16402
+ ...KindShape,
16403
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16404
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16405
+ ...KindShape,
16406
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16407
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16408
+ ...KindShape,
16409
+ record: RecordInputSchema,
16410
+ /** Compare-and-set. `0` means "the row must not exist". */
16411
+ ifRev: number().int().min(0).optional()
16412
+ }), object({
16413
+ rev: number().int(),
16414
+ releasedRefs: SecretRefsList
16415
+ }), {
16416
+ kind: "mutation",
16417
+ auth: "admin"
16418
+ }), method(object({
16419
+ ...KindShape,
16420
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16421
+ }), object({
16422
+ count: number().int(),
16423
+ releasedRefs: SecretRefsList
16424
+ }), {
16425
+ kind: "mutation",
16426
+ auth: "admin"
16427
+ }), method(object({
16428
+ ...KindShape,
16429
+ id: RecordIdSchema,
16430
+ data: RecordBodySchema,
16431
+ at: number().int().nullable().optional(),
16432
+ expiresAt: number().int().nullable().optional(),
16433
+ ifRev: number().int().min(1).optional()
16434
+ }), object({
16435
+ rev: number().int(),
16436
+ releasedRefs: SecretRefsList
16437
+ }), {
16438
+ kind: "mutation",
16439
+ auth: "admin"
16440
+ }), method(object({
16441
+ ...KindShape,
16442
+ id: RecordIdSchema
16443
+ }), object({
16444
+ deleted: boolean(),
16445
+ secretRefs: SecretRefsList
16446
+ }), {
16447
+ kind: "mutation",
16448
+ auth: "admin"
16449
+ }), method(object({
16450
+ ...KindShape,
16451
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16452
+ }), object({
16453
+ deleted: number().int(),
16454
+ secretRefs: SecretRefsList
16455
+ }), {
16456
+ kind: "mutation",
16457
+ auth: "admin"
16458
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16459
+ ...KindShape,
16460
+ ...TimeWindowShape,
16461
+ where: RecordWhereSchema.optional()
16462
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16463
+ ...KindShape,
16464
+ deviceId: number().int().optional(),
16465
+ from: number(),
16466
+ to: number(),
16467
+ bucketMs: number().int().positive()
16468
+ }), object({ buckets: array(object({
16469
+ bucketStart: number(),
16470
+ count: number().int()
16471
+ })) }), { auth: "admin" }), method(object({
16472
+ ...KindShape,
16473
+ op: _enum([
16474
+ "sum",
16475
+ "min",
16476
+ "max",
16477
+ "count"
16478
+ ]),
16479
+ field: RecordFieldPathSchema.optional(),
16480
+ groupBy: RecordFieldPathSchema.optional(),
16481
+ where: RecordWhereSchema.optional()
16482
+ }), object({ rows: array(object({
16483
+ group: union([
16484
+ string(),
16485
+ number(),
16486
+ _null()
16487
+ ]),
16488
+ value: number().nullable()
16489
+ })) }), { auth: "admin" }), method(object({
16490
+ ...KindShape,
16491
+ deviceId: number().int().optional(),
16492
+ atBefore: number().optional(),
16493
+ where: RecordWhereSchema.optional()
16494
+ }), object({
16495
+ deleted: number().int(),
16496
+ secretRefs: SecretRefsList
16497
+ }), {
16498
+ kind: "mutation",
16499
+ auth: "admin"
16500
+ }), method(object({
16501
+ deviceId: number().int(),
16502
+ kinds: array(RecordKindNameSchema).optional()
16503
+ }), object({
16504
+ deleted: record(string(), number().int()),
16505
+ secretRefs: SecretRefsList
16506
+ }), {
16507
+ kind: "mutation",
16508
+ auth: "admin"
16509
+ }), method(object(KindShape), object({ id: number().int() }), {
16510
+ kind: "mutation",
16511
+ auth: "admin"
16512
+ });
16513
+ /** One table of the settings database. */
16514
+ var StorageTableSchema = object({
16515
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
16516
+ name: string(),
16517
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
16518
+ owner: string().nullable(),
16519
+ rows: number().int().nonnegative(),
16520
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
16521
+ bytes: number().int().nonnegative().nullable(),
16522
+ /** Declared by an addon since this engine process started (a running addon claims it). */
16523
+ declaredThisBoot: boolean()
16524
+ });
16525
+ /** One declared record kind (D881) as System -> Data shows it. */
16526
+ var StorageKindSchema = object({
16527
+ owner: string(),
16528
+ kind: string(),
16529
+ database: _enum(["settings", "events"]),
16530
+ class: string(),
16531
+ state: _enum([
16532
+ "declared",
16533
+ "orphaned",
16534
+ "dropped"
16535
+ ]),
16536
+ /** `null` when the caller asked for no counts (`counts: false`). */
16537
+ rows: number().int().nonnegative().nullable(),
16538
+ /** Rows x the average size of a sample; null for an empty kind. */
16539
+ bytesEstimate: number().int().nonnegative().nullable(),
16540
+ writeTrigger: string(),
16541
+ retention: RecordRetentionSchema,
16542
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16543
+ entry: boolean(),
16544
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16545
+ declaration: RecordKindDeclarationSchema
16546
+ });
16547
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16548
+ collection: string().min(1),
16549
+ expectRows: number().int().nonnegative()
16550
+ }), object({
16551
+ dropped: literal(true),
16552
+ rows: number().int().nonnegative()
16553
+ }), {
16554
+ kind: "mutation",
16555
+ auth: "admin"
16556
+ }), method(object({
16557
+ owner: string().min(1).optional(),
16558
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16559
+ counts: boolean().optional()
16560
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16561
+ owner: string().min(1),
16562
+ kind: RecordKindNameSchema
16563
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16564
+ owner: string().min(1),
16565
+ kind: RecordKindNameSchema,
16566
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16567
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16568
+ complete: boolean().optional()
16569
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16570
+ kind: "mutation",
16571
+ auth: "admin"
16572
+ }), method(object({
16573
+ collection: string().min(1),
16574
+ cursor: string().optional(),
16575
+ limit: number().int().min(1).max(1e3).optional()
16576
+ }), object({
16577
+ rows: array(object({
16578
+ id: string(),
16579
+ data: record(string(), unknown())
16580
+ })),
16581
+ nextCursor: string().nullable()
16582
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16583
+ /**
16584
+ * record-entries - the ONE admin surface for every list of user-created entries
16585
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16586
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16587
+ *
16588
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16589
+ * the entry body with `secret: true` on every credential field, so a password
16590
+ * field is derived from the schema and never from a name. `putEntry` takes the
16591
+ * redaction token for an untouched secret (the stored value is kept), a string
16592
+ * for a new one, and the clear instruction to remove one. A read never carries
16593
+ * a secret value, and a locked keychain refuses the write with
16594
+ * `records/secret-unavailable` instead of storing plaintext.
16595
+ *
16596
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16597
+ */
16598
+ var EntryKindInfoSchema = object({
16599
+ owner: string(),
16600
+ kind: RecordKindNameSchema,
16601
+ title: string(),
16602
+ nameField: string(),
16603
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16604
+ fields: record(string(), unknown()),
16605
+ secretPaths: array(string()),
16606
+ rows: number().int().nonnegative()
16607
+ });
16608
+ var EntryViewSchema = object({
16609
+ id: RecordIdSchema,
16610
+ name: string(),
16611
+ rev: number().int(),
16612
+ updatedAt: number(),
16613
+ /** Secret fields hold the redaction token. */
16614
+ data: RecordBodySchema
16615
+ });
16616
+ var EntryAddress = {
16617
+ owner: string().min(1),
16618
+ kind: RecordKindNameSchema
16619
+ };
16620
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16621
+ ...EntryAddress,
16622
+ id: RecordIdSchema.optional(),
16623
+ data: RecordBodySchema,
16624
+ ifRev: number().int().min(1).optional()
16625
+ }), object({
16626
+ id: string(),
16627
+ rev: number().int()
16628
+ }), {
16629
+ kind: "mutation",
16630
+ auth: "admin"
16631
+ }), method(object({
16632
+ ...EntryAddress,
16633
+ id: RecordIdSchema
16634
+ }), object({ deleted: boolean() }), {
16635
+ kind: "mutation",
16636
+ auth: "admin"
16637
+ });
16638
+ /**
16051
16639
  * `keychain` — the hub's encrypted store of secret values (D787).
16052
16640
  *
16053
16641
  * Settings blobs never hold a secret: they hold a marker
@@ -16588,6 +17176,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16588
17176
  kind: "mutation",
16589
17177
  auth: "admin",
16590
17178
  caller: "required"
17179
+ }), method(object({
17180
+ ref: string().min(1),
17181
+ value: string().min(1)
17182
+ }), object({
17183
+ ref: string(),
17184
+ version: number().int()
17185
+ }), {
17186
+ kind: "mutation",
17187
+ auth: "admin",
17188
+ caller: "required"
16591
17189
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16592
17190
  deleted: array(string()).readonly(),
16593
17191
  kept: array(object({
@@ -39266,6 +39864,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39266
39864
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39267
39865
  kind: "mutation",
39268
39866
  auth: "admin"
39867
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
39868
+ kind: "mutation",
39869
+ auth: "admin"
39269
39870
  }), method(ProfileRefInputSchema, _void(), {
39270
39871
  kind: "mutation",
39271
39872
  auth: "admin"
@@ -49775,6 +50376,41 @@ var ServerRollbackInfoSchema = object({
49775
50376
  atMs: number(),
49776
50377
  reason: string()
49777
50378
  });
50379
+ /**
50380
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50381
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50382
+ * service holds, because only the hub plans) against the states the process
50383
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50384
+ * every boot, served on `getServerPackageStatus`.
50385
+ *
50386
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50387
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50388
+ * planned runner the process service has no entry for.
50389
+ */
50390
+ var RunnerRefusalSchema = object({
50391
+ runnerId: string(),
50392
+ addonIds: array(string()),
50393
+ reason: string()
50394
+ });
50395
+ var RunnerBootCheckSchema = object({
50396
+ checkedAtMs: number(),
50397
+ /** Runners planned for this node. */
50398
+ expected: number(),
50399
+ /** Planned runners whose process is `running`. */
50400
+ running: number(),
50401
+ failed: array(string()),
50402
+ refused: array(RunnerRefusalSchema),
50403
+ missing: array(string()),
50404
+ /**
50405
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50406
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50407
+ * pushed and the verdict is re-evaluated on the next runner state change.
50408
+ * Optional for version skew (absent = settled).
50409
+ */
50410
+ pending: array(string()).optional(),
50411
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50412
+ planKnown: boolean()
50413
+ });
49778
50414
  var ServerPackageStatusSchema = object({
49779
50415
  /** Root package name (`@camstack/server` on the hub). */
49780
50416
  packageName: string(),
@@ -49837,7 +50473,14 @@ var ServerPackageStatusSchema = object({
49837
50473
  * for version skew: an older provider's payload simply omits it, and an
49838
50474
  * absent wrapper is unknown — never `native`.
49839
50475
  */
49840
- wrapper: WrapperIdentitySchema.optional()
50476
+ wrapper: WrapperIdentitySchema.optional(),
50477
+ /**
50478
+ * What this node PLANNED to run against what its process service reports
50479
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50480
+ * on a provider that predates it. Absent is "not checked yet", never "all
50481
+ * well": a consumer that needs the answer treats it as pending.
50482
+ */
50483
+ runners: RunnerBootCheckSchema.optional()
49841
50484
  });
49842
50485
  var ServerUpdateCheckResultSchema = object({
49843
50486
  packageName: string(),
@@ -49888,6 +50531,13 @@ var ServerUpdateOutcomeSchema = _enum([
49888
50531
  "refused",
49889
50532
  "failed"
49890
50533
  ]);
50534
+ /** One addon the pre-flight found the target version would refuse (D877). */
50535
+ var UpdateBlockerSchema = object({
50536
+ addonId: string(),
50537
+ reason: string(),
50538
+ /** What the operator does about it. */
50539
+ remedy: string()
50540
+ });
49891
50541
  var ServerUpdateActionResultSchema = object({
49892
50542
  accepted: boolean(),
49893
50543
  targetVersion: string().nullable(),
@@ -49905,14 +50555,27 @@ var ServerUpdateActionResultSchema = object({
49905
50555
  * The failure itself, verbatim enough to act on (the npm output for a
49906
50556
  * staging install). Non-null only for `failed`.
49907
50557
  */
49908
- error: string().nullable().optional()
50558
+ error: string().nullable().optional(),
50559
+ /**
50560
+ * The addons the target version would refuse to start on this node's live
50561
+ * store (D877), present when the pre-flight refused the update
50562
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50563
+ */
50564
+ blockers: array(UpdateBlockerSchema).optional()
49909
50565
  });
49910
50566
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
49911
50567
  kind: "mutation",
49912
50568
  auth: "admin"
49913
- }), method(object({
49914
- /** Explicit target version; omitted = latest from the registry. */
49915
- version: string().optional() }), ServerUpdateActionResultSchema, {
50569
+ }), method(object({
50570
+ /** Explicit target version; omitted = latest from the registry. */
50571
+ version: string().optional(),
50572
+ /**
50573
+ * Apply even though the pre-flight (D877) found addons the target would
50574
+ * refuse to start. Off by default: those addons stay down until the
50575
+ * remedy is run, which is the incident this gate exists to prevent.
50576
+ */
50577
+ acknowledgeRefusals: boolean().optional()
50578
+ }), ServerUpdateActionResultSchema, {
49916
50579
  kind: "mutation",
49917
50580
  auth: "admin",
49918
50581
  timeoutMs: 16 * 6e4
@@ -52462,7 +53125,9 @@ var ManifestShapeSchema = object({
52462
53125
  var AddonProcessSchema = object({
52463
53126
  pid: number().optional(),
52464
53127
  mode: string(),
52465
- state: string()
53128
+ state: string(),
53129
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53130
+ reason: string().optional()
52466
53131
  });
52467
53132
  /**
52468
53133
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -53230,7 +53895,8 @@ var batteryCapability = {
53230
53895
  DeviceType.Button,
53231
53896
  DeviceType.Switch,
53232
53897
  DeviceType.PetFeeder,
53233
- DeviceType.Container
53898
+ DeviceType.Container,
53899
+ DeviceType.Thermostat
53234
53900
  ],
53235
53901
  methods: {
53236
53902
  /**
@@ -53851,6 +54517,12 @@ var ClimateControlStatusSchema = object({
53851
54517
  /** Horizontal louver swing on/off. Null when the device has no
53852
54518
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
53853
54519
  swingHorizontal: boolean().nullable(),
54520
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
54521
+ minTemp: number().nullable().optional(),
54522
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
54523
+ maxTemp: number().nullable().optional(),
54524
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
54525
+ tempStep: number().positive().nullable().optional(),
53854
54526
  /** Ms epoch when the slice was last updated (push or command). */
53855
54527
  lastFetchedAt: number()
53856
54528
  });
@@ -54705,6 +55377,125 @@ onStatusChanged: { data: object({
54705
55377
  * whether persisting is worth a SQLite commit. */
54706
55378
  volatileStateFields: ["lastChangedAt"]
54707
55379
  };
55380
+ /**
55381
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
55382
+ * consumable levels (salt, rinse aid) and common program options.
55383
+ *
55384
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
55385
+ * by any integration that exposes the same program / option surface.
55386
+ *
55387
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
55388
+ * provider refreshes the slice on an interval and eagerly after commands.
55389
+ */
55390
+ var DishwasherStateSchema = _enum([
55391
+ "idle",
55392
+ "running",
55393
+ "paused",
55394
+ "finished",
55395
+ "error",
55396
+ "unavailable"
55397
+ ]);
55398
+ var DishwasherConsumableLevelSchema = _enum([
55399
+ "ok",
55400
+ "low",
55401
+ "empty"
55402
+ ]);
55403
+ var DishwasherStatusSchema = object({
55404
+ state: DishwasherStateSchema,
55405
+ /** Active program id/name, or null when none selected / unknown. */
55406
+ program: string().nullable(),
55407
+ /** Program tokens the hardware accepts — drives the UI selector. */
55408
+ availablePrograms: array(string()),
55409
+ /** Minutes remaining on the active cycle, or null when not running. */
55410
+ remainingMinutes: number().int().nonnegative().nullable(),
55411
+ /** Cycle completion 0..100, or null when not applicable. */
55412
+ progressPercent: number().min(0).max(100).nullable(),
55413
+ /** True when the door is reported open. */
55414
+ doorOpen: boolean(),
55415
+ /** True when remote start is allowed (door closed, power on, etc.). */
55416
+ remoteStartAllowed: boolean(),
55417
+ /** Main power / switched-on state. */
55418
+ powerOn: boolean(),
55419
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
55420
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
55421
+ halfLoad: boolean(),
55422
+ hygienePlus: boolean(),
55423
+ errorCode: number().nullable(),
55424
+ errorLabel: string().nullable(),
55425
+ lastFetchedAt: number()
55426
+ });
55427
+ var dishwasherCapability = {
55428
+ name: "dishwasher",
55429
+ scope: "device",
55430
+ deviceNative: true,
55431
+ mode: "singleton",
55432
+ deviceTypes: [DeviceType.Dishwasher],
55433
+ methods: {
55434
+ start: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55435
+ kind: "mutation",
55436
+ auth: "protected"
55437
+ }),
55438
+ pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55439
+ kind: "mutation",
55440
+ auth: "protected"
55441
+ }),
55442
+ stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55443
+ kind: "mutation",
55444
+ auth: "protected"
55445
+ }),
55446
+ setProgram: method(object({
55447
+ deviceId: number().int().nonnegative(),
55448
+ program: string().min(1)
55449
+ }), _void(), {
55450
+ kind: "mutation",
55451
+ auth: "protected"
55452
+ }),
55453
+ setPower: method(object({
55454
+ deviceId: number().int().nonnegative(),
55455
+ on: boolean()
55456
+ }), _void(), {
55457
+ kind: "mutation",
55458
+ auth: "protected"
55459
+ }),
55460
+ setHalfLoad: method(object({
55461
+ deviceId: number().int().nonnegative(),
55462
+ on: boolean()
55463
+ }), _void(), {
55464
+ kind: "mutation",
55465
+ auth: "protected"
55466
+ }),
55467
+ setHygienePlus: method(object({
55468
+ deviceId: number().int().nonnegative(),
55469
+ on: boolean()
55470
+ }), _void(), {
55471
+ kind: "mutation",
55472
+ auth: "protected"
55473
+ }),
55474
+ setOption: method(object({
55475
+ deviceId: number().int().nonnegative(),
55476
+ key: string().min(1),
55477
+ value: union([
55478
+ boolean(),
55479
+ string(),
55480
+ number()
55481
+ ])
55482
+ }), _void(), {
55483
+ kind: "mutation",
55484
+ auth: "protected"
55485
+ })
55486
+ },
55487
+ status: {
55488
+ schema: DishwasherStatusSchema,
55489
+ kind: "poll"
55490
+ },
55491
+ runtimeState: DishwasherStatusSchema,
55492
+ durability: "session",
55493
+ history: { fields: { progressPercent: {
55494
+ kind: "gauge",
55495
+ unit: "%",
55496
+ deadband: 2
55497
+ } } }
55498
+ };
54708
55499
  var DoorbellStatusSchema = object({
54709
55500
  /** Ms epoch of the last press. null = never observed since this provider started. */
54710
55501
  lastPressedAt: number().nullable(),
@@ -55507,6 +56298,32 @@ var gasCapability = {
55507
56298
  * whether persisting is worth a SQLite commit. */
55508
56299
  volatileStateFields: ["lastChangedAt"]
55509
56300
  };
56301
+ var HeatingValveStatusSchema = object({
56302
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
56303
+ position: number().min(0).max(100).nullable(),
56304
+ /** Ms epoch when the slice was last updated (push or poll). */
56305
+ lastFetchedAt: number()
56306
+ });
56307
+ var heatingValveCapability = {
56308
+ name: "heating-valve",
56309
+ scope: "device",
56310
+ deviceNative: true,
56311
+ mode: "singleton",
56312
+ deviceTypes: [DeviceType.Thermostat],
56313
+ methods: {},
56314
+ status: {
56315
+ schema: HeatingValveStatusSchema,
56316
+ kind: "push"
56317
+ },
56318
+ runtimeState: HeatingValveStatusSchema,
56319
+ durability: "session",
56320
+ history: { fields: { position: {
56321
+ kind: "gauge",
56322
+ unit: "%",
56323
+ deadband: 1
56324
+ } } },
56325
+ volatileStateFields: ["lastFetchedAt"]
56326
+ };
55510
56327
  /**
55511
56328
  * Humidifier / dehumidifier cap. Models HA `humidifier.*` entities —
55512
56329
  * an on/off actuator with an optional target-humidity setpoint and an
@@ -56639,7 +57456,19 @@ var TlsStatusSchema = object({
56639
57456
  sans: array(string()),
56640
57457
  caCertPem: string().nullable(),
56641
57458
  reissueError: string().nullable(),
56642
- restartRequired: boolean()
57459
+ restartRequired: boolean(),
57460
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
57461
+ caMissing: boolean(),
57462
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
57463
+ localCaConstrained: boolean().nullable(),
57464
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
57465
+ caReplacedAt: string().nullable(),
57466
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
57467
+ storedUpload: object({
57468
+ leafFingerprintSha256: string(),
57469
+ validTo: string(),
57470
+ hasCa: boolean()
57471
+ }).nullable()
56643
57472
  });
56644
57473
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
56645
57474
  /**
@@ -56695,6 +57524,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
56695
57524
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
56696
57525
  kind: "mutation",
56697
57526
  auth: "admin"
57527
+ }), method(_void(), TlsStatusSchema, {
57528
+ kind: "mutation",
57529
+ auth: "admin"
56698
57530
  });
56699
57531
  var LockControlStatusSchema = object({
56700
57532
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -63188,7 +64020,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
63188
64020
  kind: "mutation",
63189
64021
  auth: "admin",
63190
64022
  access: "delete"
63191
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
64023
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
64024
+ kind: "mutation",
64025
+ auth: "admin",
64026
+ access: "create"
64027
+ }), method(object({
63192
64028
  userId: string(),
63193
64029
  code: string()
63194
64030
  }), object({ valid: boolean() }), {
@@ -64908,6 +65744,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
64908
65744
  dayNight: dayNightCapability,
64909
65745
  deviceDiscovery: deviceDiscoveryCapability,
64910
65746
  deviceStatus: deviceStatusCapability,
65747
+ dishwasher: dishwasherCapability,
64911
65748
  doorbell: doorbellCapability,
64912
65749
  enumSensor: enumSensorCapability,
64913
65750
  eventEmitter: eventEmitterCapability,
@@ -64915,6 +65752,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
64915
65752
  featureProbe: featureProbeCapability,
64916
65753
  flood: floodCapability,
64917
65754
  gas: gasCapability,
65755
+ heatingValve: heatingValveCapability,
64918
65756
  humidifier: humidifierCapability,
64919
65757
  humiditySensor: humiditySensorCapability,
64920
65758
  image: imageCapability,
@@ -65000,13 +65838,14 @@ var BaseDevice = class {
65000
65838
  get state() {
65001
65839
  if (!this._stateProxyCache) {
65002
65840
  const cache = {};
65003
- const handler = { get: (_target, key) => {
65841
+ const handler = { get: (target, key) => {
65004
65842
  const k = key;
65005
- if (k in cache) return cache[k];
65843
+ const existing = Reflect.get(target, k);
65844
+ if (existing !== void 0) return existing;
65006
65845
  const cap = DEVICE_LOCAL_STATE_CAPS[k];
65007
65846
  if (!cap) return void 0;
65008
65847
  const proxy = this.sliceProxy(cap);
65009
- cache[k] = proxy;
65848
+ Reflect.set(target, k, proxy);
65010
65849
  return proxy;
65011
65850
  } };
65012
65851
  this._stateProxyCache = new Proxy(cache, handler);
@@ -65205,7 +66044,7 @@ var BaseDevice = class {
65205
66044
  async updateSourceInfo(patch) {
65206
66045
  const next = mergeSourceInfo(this.sourceInfo, patch);
65207
66046
  this._sourceInfoCache = Object.freeze({ ...next });
65208
- const action = this.ctx.api?.deviceManager?.setMetadata;
66047
+ const action = this.ctx.api.deviceManager?.setMetadata;
65209
66048
  if (action) try {
65210
66049
  await action.mutate({
65211
66050
  deviceId: this.id,
@@ -65240,7 +66079,7 @@ var BaseDevice = class {
65240
66079
  * device boot on a meta refresh.
65241
66080
  */
65242
66081
  async refreshFeatures() {
65243
- const action = this.ctx.api?.deviceManager?.registerDevice;
66082
+ const action = this.ctx.api.deviceManager?.registerDevice;
65244
66083
  if (!action) return;
65245
66084
  try {
65246
66085
  await action.mutate({
@@ -65639,6 +66478,12 @@ var BaseDeviceProvider = class extends BaseAddon {
65639
66478
  provider: this
65640
66479
  }];
65641
66480
  }
66481
+ /** Flatten `super.onInitialize()` whether it returned an array or an envelope. */
66482
+ providerRegistrationsFromSuper(result) {
66483
+ if (Array.isArray(result)) return result;
66484
+ if (result !== void 0 && result.providers !== void 0) return [...result.providers];
66485
+ return [];
66486
+ }
65642
66487
  async onShutdown() {
65643
66488
  this._restoreShuttingDown = true;
65644
66489
  this.cancelRestoreRetries();
@@ -66165,7 +67010,7 @@ var BaseDeviceProvider = class extends BaseAddon {
66165
67010
  return toDeviceSummary(device, this.addonId);
66166
67011
  }
66167
67012
  };
66168
- 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;
67013
+ 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;
66169
67014
  new Set(Object.values(DeviceType));
66170
67015
  Object.freeze({
66171
67016
  "accessories.getStatus": {
@@ -67314,6 +68159,12 @@ Object.freeze({
67314
68159
  addonId: null,
67315
68160
  access: "view"
67316
68161
  },
68162
+ "coreBlocks.migrateRawSecrets": {
68163
+ capName: "core-blocks",
68164
+ capScope: "system",
68165
+ addonId: null,
68166
+ access: "create"
68167
+ },
67317
68168
  "coreBlocks.restart": {
67318
68169
  capName: "core-blocks",
67319
68170
  capScope: "system",
@@ -68580,6 +69431,60 @@ Object.freeze({
68580
69431
  addonId: null,
68581
69432
  access: "view"
68582
69433
  },
69434
+ "dishwasher.getStatus": {
69435
+ capName: "dishwasher",
69436
+ capScope: "device",
69437
+ addonId: null,
69438
+ access: "view"
69439
+ },
69440
+ "dishwasher.pause": {
69441
+ capName: "dishwasher",
69442
+ capScope: "device",
69443
+ addonId: null,
69444
+ access: "create"
69445
+ },
69446
+ "dishwasher.setHalfLoad": {
69447
+ capName: "dishwasher",
69448
+ capScope: "device",
69449
+ addonId: null,
69450
+ access: "create"
69451
+ },
69452
+ "dishwasher.setHygienePlus": {
69453
+ capName: "dishwasher",
69454
+ capScope: "device",
69455
+ addonId: null,
69456
+ access: "create"
69457
+ },
69458
+ "dishwasher.setOption": {
69459
+ capName: "dishwasher",
69460
+ capScope: "device",
69461
+ addonId: null,
69462
+ access: "create"
69463
+ },
69464
+ "dishwasher.setPower": {
69465
+ capName: "dishwasher",
69466
+ capScope: "device",
69467
+ addonId: null,
69468
+ access: "create"
69469
+ },
69470
+ "dishwasher.setProgram": {
69471
+ capName: "dishwasher",
69472
+ capScope: "device",
69473
+ addonId: null,
69474
+ access: "create"
69475
+ },
69476
+ "dishwasher.start": {
69477
+ capName: "dishwasher",
69478
+ capScope: "device",
69479
+ addonId: null,
69480
+ access: "create"
69481
+ },
69482
+ "dishwasher.stop": {
69483
+ capName: "dishwasher",
69484
+ capScope: "device",
69485
+ addonId: null,
69486
+ access: "create"
69487
+ },
68583
69488
  "doorbell.getStatus": {
68584
69489
  capName: "doorbell",
68585
69490
  capScope: "device",
@@ -68790,6 +69695,12 @@ Object.freeze({
68790
69695
  addonId: null,
68791
69696
  access: "view"
68792
69697
  },
69698
+ "heatingValve.getStatus": {
69699
+ capName: "heating-valve",
69700
+ capScope: "device",
69701
+ addonId: null,
69702
+ access: "view"
69703
+ },
68793
69704
  "humidifier.getStatus": {
68794
69705
  capName: "humidifier",
68795
69706
  capScope: "device",
@@ -69000,6 +69911,12 @@ Object.freeze({
69000
69911
  addonId: null,
69001
69912
  access: "create"
69002
69913
  },
69914
+ "keychainAdmin.importSecret": {
69915
+ capName: "keychain-admin",
69916
+ capScope: "system",
69917
+ addonId: null,
69918
+ access: "create"
69919
+ },
69003
69920
  "keychainAdmin.listAudit": {
69004
69921
  capName: "keychain-admin",
69005
69922
  capScope: "system",
@@ -69168,6 +70085,12 @@ Object.freeze({
69168
70085
  addonId: null,
69169
70086
  access: "view"
69170
70087
  },
70088
+ "llm.migrateRawSecrets": {
70089
+ capName: "llm",
70090
+ capScope: "system",
70091
+ addonId: null,
70092
+ access: "create"
70093
+ },
69171
70094
  "llm.resolveModelRef": {
69172
70095
  capName: "llm",
69173
70096
  capScope: "system",
@@ -69396,6 +70319,12 @@ Object.freeze({
69396
70319
  addonId: null,
69397
70320
  access: "create"
69398
70321
  },
70322
+ "localNetwork.useStoredUploadedCertificate": {
70323
+ capName: "local-network",
70324
+ capScope: "system",
70325
+ addonId: null,
70326
+ access: "create"
70327
+ },
69399
70328
  "lockControl.getStatus": {
69400
70329
  capName: "lock-control",
69401
70330
  capScope: "device",
@@ -72048,6 +72977,30 @@ Object.freeze({
72048
72977
  addonId: null,
72049
72978
  access: "create"
72050
72979
  },
72980
+ "recordEntries.deleteEntry": {
72981
+ capName: "record-entries",
72982
+ capScope: "system",
72983
+ addonId: null,
72984
+ access: "delete"
72985
+ },
72986
+ "recordEntries.listEntries": {
72987
+ capName: "record-entries",
72988
+ capScope: "system",
72989
+ addonId: null,
72990
+ access: "view"
72991
+ },
72992
+ "recordEntries.listEntryKinds": {
72993
+ capName: "record-entries",
72994
+ capScope: "system",
72995
+ addonId: null,
72996
+ access: "view"
72997
+ },
72998
+ "recordEntries.putEntry": {
72999
+ capName: "record-entries",
73000
+ capScope: "system",
73001
+ addonId: null,
73002
+ access: "create"
73003
+ },
72051
73004
  "recording.getAvailability": {
72052
73005
  capName: "recording",
72053
73006
  capScope: "device",
@@ -72348,6 +73301,102 @@ Object.freeze({
72348
73301
  addonId: null,
72349
73302
  access: "view"
72350
73303
  },
73304
+ "records.aggregate": {
73305
+ capName: "records",
73306
+ capScope: "system",
73307
+ addonId: null,
73308
+ access: "view"
73309
+ },
73310
+ "records.allocateId": {
73311
+ capName: "records",
73312
+ capScope: "system",
73313
+ addonId: null,
73314
+ access: "create"
73315
+ },
73316
+ "records.count": {
73317
+ capName: "records",
73318
+ capScope: "system",
73319
+ addonId: null,
73320
+ access: "view"
73321
+ },
73322
+ "records.declareKinds": {
73323
+ capName: "records",
73324
+ capScope: "system",
73325
+ addonId: null,
73326
+ access: "create"
73327
+ },
73328
+ "records.delete": {
73329
+ capName: "records",
73330
+ capScope: "system",
73331
+ addonId: null,
73332
+ access: "delete"
73333
+ },
73334
+ "records.deleteDevice": {
73335
+ capName: "records",
73336
+ capScope: "system",
73337
+ addonId: null,
73338
+ access: "delete"
73339
+ },
73340
+ "records.deleteMany": {
73341
+ capName: "records",
73342
+ capScope: "system",
73343
+ addonId: null,
73344
+ access: "delete"
73345
+ },
73346
+ "records.deleteWhere": {
73347
+ capName: "records",
73348
+ capScope: "system",
73349
+ addonId: null,
73350
+ access: "delete"
73351
+ },
73352
+ "records.get": {
73353
+ capName: "records",
73354
+ capScope: "system",
73355
+ addonId: null,
73356
+ access: "view"
73357
+ },
73358
+ "records.getMany": {
73359
+ capName: "records",
73360
+ capScope: "system",
73361
+ addonId: null,
73362
+ access: "view"
73363
+ },
73364
+ "records.histogram": {
73365
+ capName: "records",
73366
+ capScope: "system",
73367
+ addonId: null,
73368
+ access: "view"
73369
+ },
73370
+ "records.patch": {
73371
+ capName: "records",
73372
+ capScope: "system",
73373
+ addonId: null,
73374
+ access: "create"
73375
+ },
73376
+ "records.put": {
73377
+ capName: "records",
73378
+ capScope: "system",
73379
+ addonId: null,
73380
+ access: "create"
73381
+ },
73382
+ "records.putMany": {
73383
+ capName: "records",
73384
+ capScope: "system",
73385
+ addonId: null,
73386
+ access: "create"
73387
+ },
73388
+ "records.query": {
73389
+ capName: "records",
73390
+ capScope: "system",
73391
+ addonId: null,
73392
+ access: "view"
73393
+ },
73394
+ "records.secretRefs": {
73395
+ capName: "records",
73396
+ capScope: "system",
73397
+ addonId: null,
73398
+ access: "view"
73399
+ },
72351
73400
  "sceneMonitor.captureReference": {
72352
73401
  capName: "scene-monitor",
72353
73402
  capScope: "device",
@@ -72780,6 +73829,48 @@ Object.freeze({
72780
73829
  addonId: null,
72781
73830
  access: "create"
72782
73831
  },
73832
+ "storageAdmin.adoptRecords": {
73833
+ capName: "storage-admin",
73834
+ capScope: "system",
73835
+ addonId: null,
73836
+ access: "create"
73837
+ },
73838
+ "storageAdmin.dropCollection": {
73839
+ capName: "storage-admin",
73840
+ capScope: "system",
73841
+ addonId: null,
73842
+ access: "delete"
73843
+ },
73844
+ "storageAdmin.isAdoptedLegacyTable": {
73845
+ capName: "storage-admin",
73846
+ capScope: "system",
73847
+ addonId: null,
73848
+ access: "view"
73849
+ },
73850
+ "storageAdmin.listKinds": {
73851
+ capName: "storage-admin",
73852
+ capScope: "system",
73853
+ addonId: null,
73854
+ access: "view"
73855
+ },
73856
+ "storageAdmin.listTables": {
73857
+ capName: "storage-admin",
73858
+ capScope: "system",
73859
+ addonId: null,
73860
+ access: "view"
73861
+ },
73862
+ "storageAdmin.readLegacyCollection": {
73863
+ capName: "storage-admin",
73864
+ capScope: "system",
73865
+ addonId: null,
73866
+ access: "view"
73867
+ },
73868
+ "storageAdmin.readRecords": {
73869
+ capName: "storage-admin",
73870
+ capScope: "system",
73871
+ addonId: null,
73872
+ access: "view"
73873
+ },
72783
73874
  "storageEvictable.evict": {
72784
73875
  capName: "storage-evictable",
72785
73876
  capScope: "system",
@@ -73692,6 +74783,12 @@ Object.freeze({
73692
74783
  addonId: null,
73693
74784
  access: "view"
73694
74785
  },
74786
+ "userManagement.migrateRawSecrets": {
74787
+ capName: "user-management",
74788
+ capScope: "system",
74789
+ addonId: null,
74790
+ access: "create"
74791
+ },
73695
74792
  "userManagement.oauthExchangeCode": {
73696
74793
  capName: "user-management",
73697
74794
  capScope: "system",
@@ -74191,7 +75288,7 @@ Object.freeze({
74191
75288
  access: "create"
74192
75289
  }
74193
75290
  });
74194
- 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;
75291
+ 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;
74195
75292
  DeviceFeature.BatteryOperated;
74196
75293
  Object.freeze({
74197
75294
  "accessories.getStatus": [{
@@ -75015,6 +76112,51 @@ Object.freeze({
75015
76112
  form: "single",
75016
76113
  optional: false
75017
76114
  }],
76115
+ "dishwasher.getStatus": [{
76116
+ name: "deviceId",
76117
+ form: "single",
76118
+ optional: false
76119
+ }],
76120
+ "dishwasher.pause": [{
76121
+ name: "deviceId",
76122
+ form: "single",
76123
+ optional: false
76124
+ }],
76125
+ "dishwasher.setHalfLoad": [{
76126
+ name: "deviceId",
76127
+ form: "single",
76128
+ optional: false
76129
+ }],
76130
+ "dishwasher.setHygienePlus": [{
76131
+ name: "deviceId",
76132
+ form: "single",
76133
+ optional: false
76134
+ }],
76135
+ "dishwasher.setOption": [{
76136
+ name: "deviceId",
76137
+ form: "single",
76138
+ optional: false
76139
+ }],
76140
+ "dishwasher.setPower": [{
76141
+ name: "deviceId",
76142
+ form: "single",
76143
+ optional: false
76144
+ }],
76145
+ "dishwasher.setProgram": [{
76146
+ name: "deviceId",
76147
+ form: "single",
76148
+ optional: false
76149
+ }],
76150
+ "dishwasher.start": [{
76151
+ name: "deviceId",
76152
+ form: "single",
76153
+ optional: false
76154
+ }],
76155
+ "dishwasher.stop": [{
76156
+ name: "deviceId",
76157
+ form: "single",
76158
+ optional: false
76159
+ }],
75018
76160
  "doorbell.getStatus": [{
75019
76161
  name: "deviceId",
75020
76162
  form: "single",
@@ -75084,6 +76226,11 @@ Object.freeze({
75084
76226
  form: "single",
75085
76227
  optional: false
75086
76228
  }],
76229
+ "heatingValve.getStatus": [{
76230
+ name: "deviceId",
76231
+ form: "single",
76232
+ optional: false
76233
+ }],
75087
76234
  "humidifier.getStatus": [{
75088
76235
  name: "deviceId",
75089
76236
  form: "single",
@@ -76368,6 +77515,37 @@ Object.freeze({
76368
77515
  form: "single",
76369
77516
  optional: false
76370
77517
  }],
77518
+ "records.count": [{
77519
+ name: "deviceId",
77520
+ form: "single",
77521
+ optional: true
77522
+ }],
77523
+ "records.deleteDevice": [{
77524
+ name: "deviceId",
77525
+ form: "single",
77526
+ optional: false
77527
+ }],
77528
+ "records.deleteWhere": [{
77529
+ name: "deviceId",
77530
+ form: "single",
77531
+ optional: true
77532
+ }],
77533
+ "records.histogram": [{
77534
+ name: "deviceId",
77535
+ form: "single",
77536
+ optional: true
77537
+ }],
77538
+ "records.putMany": [{
77539
+ name: "records",
77540
+ form: "object-array",
77541
+ optional: false,
77542
+ itemField: "deviceId"
77543
+ }],
77544
+ "records.query": [{
77545
+ name: "deviceId",
77546
+ form: "single",
77547
+ optional: true
77548
+ }],
76371
77549
  "sceneMonitor.captureReference": [{
76372
77550
  name: "deviceId",
76373
77551
  form: "single",
@@ -76484,6 +77662,17 @@ Object.freeze({
76484
77662
  form: "single",
76485
77663
  optional: false
76486
77664
  }],
77665
+ "storageAdmin.adoptRecords": [{
77666
+ name: "records",
77667
+ form: "object-array",
77668
+ optional: false,
77669
+ itemField: "deviceId"
77670
+ }],
77671
+ "storageAdmin.readRecords": [{
77672
+ name: "deviceId",
77673
+ form: "single",
77674
+ optional: true
77675
+ }],
76487
77676
  "streamBroker.acquireEgressTranscode": [{
76488
77677
  name: "deviceId",
76489
77678
  form: "single",
@@ -82782,7 +83971,7 @@ var WyzeProviderAddon = class extends BaseDeviceProvider {
82782
83971
  }
82783
83972
  async onInitialize() {
82784
83973
  applyWyzeCloudTlsTrust();
82785
- const regs = await super.onInitialize();
83974
+ const regs = this.providerRegistrationsFromSuper(await super.onInitialize());
82786
83975
  this.clients = new WyzeClientRegistry({
82787
83976
  dataDir: this.ctx.dataDir,
82788
83977
  logger: this.ctx.logger