@camstack/addon-provider-hikvision 1.2.151 → 1.2.153

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 +1323 -130
  2. package/dist/addon.mjs +1323 -130
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -34,7 +34,7 @@ let node_os = require("node:os");
34
34
  let node_net = require("node:net");
35
35
  let node_http = require("node:http");
36
36
  let node_https = require("node:https");
37
- //#region ../types/dist/event-category-C4hVnRo8.mjs
37
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
38
38
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
39
39
  EventCategory["SystemBoot"] = "system.boot";
40
40
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -98,6 +98,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
98
98
  * consumes this category and maps it to the `addon-crash-loop` kind.
99
99
  */
100
100
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
101
+ /**
102
+ * A runner whose addon refused to start with a typed reason (D877) - parked
103
+ * in `refused`, never counted by the crash breaker, retried on operator
104
+ * action. One event per refusal.
105
+ */
106
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
107
+ /**
108
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
109
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
110
+ * runner is still pending) and the alert centre (close a recovered runner).
111
+ */
112
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
113
+ /**
114
+ * The node's one-shot runner boot check (D877): planned runners against the
115
+ * process service, `degraded` when any is failed, refused or missing. The
116
+ * alert centre turns it into one alert and a direct critical push.
117
+ */
118
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
101
119
  EventCategory["AddonError"] = "addon.error";
102
120
  EventCategory["AddonPageReady"] = "addon.page-ready";
103
121
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -5422,7 +5440,7 @@ var ZodIssueCode = {
5422
5440
  var ZodFirstPartyTypeKind;
5423
5441
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5424
5442
  //#endregion
5425
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5443
+ //#region ../types/dist/sleep-BOjuyoPC.mjs
5426
5444
  /**
5427
5445
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5428
5446
  * window to float samples (D455).
@@ -5539,7 +5557,7 @@ function isKeychainStoredField(field) {
5539
5557
  var SECRET_CLEAR = { $secretClear: true };
5540
5558
  /** The `'***'` token D634 redaction writes for non-admins. */
5541
5559
  var LEGACY_DEVICE_REDACTION = "***";
5542
- function isRecord$2(value) {
5560
+ function isRecord$5(value) {
5543
5561
  return typeof value === "object" && value !== null && !Array.isArray(value);
5544
5562
  }
5545
5563
  function makeSecretMarker(ref) {
@@ -5550,12 +5568,12 @@ function makeSecretMarker(ref) {
5550
5568
  }
5551
5569
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5552
5570
  function isSecretMarker(value) {
5553
- if (!isRecord$2(value)) return false;
5571
+ if (!isRecord$5(value)) return false;
5554
5572
  const ref = value["$secret"];
5555
5573
  return typeof ref === "string" && ref.length > 0;
5556
5574
  }
5557
5575
  function isSecretClear(value) {
5558
- return isRecord$2(value) && value["$secretClear"] === true;
5576
+ return isRecord$5(value) && value["$secretClear"] === true;
5559
5577
  }
5560
5578
  /**
5561
5579
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6165,7 +6183,7 @@ var KeychainWriteRefusedError = class extends Error {
6165
6183
  }
6166
6184
  };
6167
6185
  var KEEP = { kind: "keep" };
6168
- function isRecord$1(value) {
6186
+ function isRecord$4(value) {
6169
6187
  return typeof value === "object" && value !== null && !Array.isArray(value);
6170
6188
  }
6171
6189
  function defaultMintId() {
@@ -6178,7 +6196,7 @@ function collectSecretMarkerRefs(value, out = []) {
6178
6196
  return out;
6179
6197
  }
6180
6198
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6181
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6199
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6182
6200
  return out;
6183
6201
  }
6184
6202
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6233,7 +6251,7 @@ function rowId(row, idKey) {
6233
6251
  return null;
6234
6252
  }
6235
6253
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6236
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6254
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6237
6255
  if (!Array.isArray(incoming)) {
6238
6256
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6239
6257
  return {
@@ -6249,7 +6267,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6249
6267
  const kept = /* @__PURE__ */ new Set();
6250
6268
  const rows = [];
6251
6269
  for (const row of incoming) {
6252
- if (!isRecord$1(row)) {
6270
+ if (!isRecord$4(row)) {
6253
6271
  rows.push(row);
6254
6272
  continue;
6255
6273
  }
@@ -6274,7 +6292,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6274
6292
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6275
6293
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6276
6294
  case "object": {
6277
- if (!isRecord$1(incoming)) {
6295
+ if (!isRecord$4(incoming)) {
6278
6296
  if (incoming === void 0) return KEEP;
6279
6297
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6280
6298
  return {
@@ -6282,7 +6300,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6282
6300
  value: incoming
6283
6301
  };
6284
6302
  }
6285
- const storedObj = isRecord$1(stored) ? stored : {};
6303
+ const storedObj = isRecord$4(stored) ? stored : {};
6286
6304
  return {
6287
6305
  kind: "value",
6288
6306
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6405,7 +6423,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6405
6423
  value: items
6406
6424
  };
6407
6425
  }
6408
- if (isRecord$1(v)) {
6426
+ if (isRecord$4(v)) {
6409
6427
  const out = {};
6410
6428
  for (const [k, child] of Object.entries(v)) {
6411
6429
  const s = substitute(child);
@@ -6437,7 +6455,7 @@ var SecretOverwriteRefusedError = class extends Error {
6437
6455
  this.name = "SecretOverwriteRefusedError";
6438
6456
  }
6439
6457
  };
6440
- function isRecord(value) {
6458
+ function isRecord$3(value) {
6441
6459
  return typeof value === "object" && value !== null && !Array.isArray(value);
6442
6460
  }
6443
6461
  function resolvedValue(pass, marker) {
@@ -6466,7 +6484,7 @@ function inArray(pass, incoming, stored) {
6466
6484
  return incoming.map((item, index) => {
6467
6485
  const twin = stored[index];
6468
6486
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6469
- if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6487
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6470
6488
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6471
6489
  return item;
6472
6490
  });
@@ -6477,7 +6495,7 @@ function inArrayRow(pass, incoming, stored) {
6477
6495
  const twin = stored[key];
6478
6496
  if (isSecretMarker(twin)) {
6479
6497
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6480
- } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6498
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6481
6499
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6482
6500
  }
6483
6501
  return out;
@@ -6485,7 +6503,7 @@ function inArrayRow(pass, incoming, stored) {
6485
6503
  async function walk(pass, incoming, stored) {
6486
6504
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6487
6505
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6488
- if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6506
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6489
6507
  const out = { ...incoming };
6490
6508
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6491
6509
  return out;
@@ -6516,7 +6534,7 @@ async function restoreUnchangedSecrets(input) {
6516
6534
  function isJsonEqual(a, b) {
6517
6535
  if (Object.is(a, b)) return true;
6518
6536
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6519
- if (isRecord(a) && isRecord(b)) {
6537
+ if (isRecord$3(a) && isRecord$3(b)) {
6520
6538
  const keys = Object.keys(a);
6521
6539
  if (keys.length !== Object.keys(b).length) return false;
6522
6540
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -6540,7 +6558,7 @@ function markerKeysOf(blob, owner) {
6540
6558
  }
6541
6559
  function nodeFromStored(value, owner) {
6542
6560
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6543
- if (!isRecord(value)) return null;
6561
+ if (!isRecord$3(value)) return null;
6544
6562
  const children = /* @__PURE__ */ new Map();
6545
6563
  for (const [key, child] of Object.entries(value)) {
6546
6564
  const node = nodeFromStored(child, owner);
@@ -6673,7 +6691,6 @@ function createHandle(raw, opts) {
6673
6691
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6674
6692
  const readAddonStoreResult = raw.readAddonStoreResult;
6675
6693
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6676
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6677
6694
  const overrides = {
6678
6695
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6679
6696
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6697,12 +6714,12 @@ function createHandle(raw, opts) {
6697
6714
  };
6698
6715
  } } : {},
6699
6716
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6700
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6701
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6717
+ readDeviceStoreBatch: async (deviceIds) => {
6718
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6702
6719
  const out = /* @__PURE__ */ new Map();
6703
6720
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6704
6721
  return out;
6705
- } } : {},
6722
+ },
6706
6723
  writeAddonStore: async (patch) => {
6707
6724
  await writeAddon(patch);
6708
6725
  },
@@ -7329,7 +7346,7 @@ var BaseAddon = class {
7329
7346
  if (!ctx) return;
7330
7347
  const addonId = ctx.id;
7331
7348
  setImmediate(() => {
7332
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7349
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7333
7350
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7334
7351
  }).catch((err) => {
7335
7352
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7529,7 +7546,7 @@ var BaseAddon = class {
7529
7546
  return this._addonSecretTree;
7530
7547
  }
7531
7548
  deviceSecretTree() {
7532
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7549
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7533
7550
  return this._deviceSecretTree;
7534
7551
  }
7535
7552
  /**
@@ -7605,42 +7622,135 @@ var BaseAddon = class {
7605
7622
  this[timerOf] = timer;
7606
7623
  }
7607
7624
  /**
7608
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7609
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7610
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7611
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7625
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7626
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7612
7627
  * addon permanently broken.
7613
7628
  *
7614
- * Retry only the two known infra fingerprints. Anything else propagates so
7615
- * real bugs surface immediately. After the budget expires we fall back to
7616
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7629
+ * Two kinds of outage, two budgets:
7630
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7631
+ * initialized`, `provider not available`): a short budget, then the addon
7632
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7633
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7634
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7635
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7636
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7637
+ * loop. A long, bounded budget; only after it the error propagates - the
7638
+ * addon never runs on defaults for a store it could not ask.
7639
+ * Anything else propagates immediately so real bugs surface.
7617
7640
  */
7618
7641
  async readAddonStoreWithRetry() {
7619
7642
  const settings = this.rawSettings();
7620
7643
  if (!settings) return {};
7621
- const delaysMs = [
7622
- 150,
7623
- 350,
7624
- 600,
7625
- 900
7626
- ];
7627
7644
  let lastErr;
7628
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7645
+ for (let attempt = 0;; attempt++) try {
7629
7646
  const stored = await settings.readAddonStore() ?? {};
7630
7647
  this.settingsStoreReady = true;
7631
7648
  return stored;
7632
7649
  } catch (err) {
7633
7650
  lastErr = err;
7634
- const msg = err instanceof Error ? err.message : String(err);
7635
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7636
- if (attempt === delaysMs.length) break;
7637
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7651
+ const kind = classifyStoreError(err);
7652
+ if (kind === "permanent") throw err;
7653
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7654
+ if (delay === void 0) {
7655
+ if (kind === "transport") throw err;
7656
+ break;
7657
+ }
7658
+ await new Promise((r) => setTimeout(r, delay));
7638
7659
  }
7639
7660
  this.settingsStoreReady = false;
7640
7661
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7641
7662
  return {};
7642
7663
  }
7643
7664
  };
7665
+ /** The settings store's own restart fingerprints. */
7666
+ var RESTART_RETRY_DELAYS_MS = [
7667
+ 150,
7668
+ 350,
7669
+ 600,
7670
+ 900
7671
+ ];
7672
+ /** A hub restarting under a booting runner: ~100 s in total. */
7673
+ var TRANSPORT_RETRY_DELAYS_MS = [
7674
+ 150,
7675
+ 350,
7676
+ 600,
7677
+ 900,
7678
+ 2e3,
7679
+ 5e3,
7680
+ 1e4,
7681
+ 2e4,
7682
+ 3e4,
7683
+ 3e4
7684
+ ];
7685
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7686
+ /** Node / socket error codes of a connection that did not happen or broke. */
7687
+ var TRANSPORT_CODES = new Set([
7688
+ "ECONNREFUSED",
7689
+ "ECONNRESET",
7690
+ "ETIMEDOUT",
7691
+ "EPIPE",
7692
+ "EHOSTUNREACH",
7693
+ "ENETUNREACH"
7694
+ ]);
7695
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7696
+ var UNAVAILABLE_TRPC_CODES = new Set([
7697
+ "TIMEOUT",
7698
+ "SERVICE_UNAVAILABLE",
7699
+ "BAD_GATEWAY",
7700
+ "GATEWAY_TIMEOUT"
7701
+ ]);
7702
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7703
+ var TRANSPORT_PHRASES = [
7704
+ "discovery deadline exceeded",
7705
+ "parent could not route child unowned cap call",
7706
+ "UDS request timed out after",
7707
+ "channel closed"
7708
+ ];
7709
+ /** Moleculer error `type`s of a call that could not be served right now. */
7710
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7711
+ "REQUEST_TIMEOUT",
7712
+ "SERVICE_NOT_FOUND",
7713
+ "SERVICE_NOT_AVAILABLE",
7714
+ "REQUEST_REJECTED",
7715
+ "BROKER_DISCONNECTED"
7716
+ ]);
7717
+ function stringProp(value, key) {
7718
+ if (typeof value !== "object" || value === null) return void 0;
7719
+ const found = Reflect.get(value, key);
7720
+ return typeof found === "string" ? found : void 0;
7721
+ }
7722
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7723
+ function errorCode(err) {
7724
+ const out = {};
7725
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7726
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7727
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7728
+ if (node !== void 0) out.node = node;
7729
+ const trpc = stringProp(data, "code");
7730
+ if (trpc !== void 0) out.trpc = trpc;
7731
+ return out;
7732
+ }
7733
+ /**
7734
+ * Is a settings read failure worth retrying, and with which budget? Only
7735
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7736
+ * one of the exact phrases our own transport raises. A message that merely
7737
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7738
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7739
+ */
7740
+ function classifyStoreError(err) {
7741
+ const message = err instanceof Error ? err.message : String(err);
7742
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7743
+ const code = errorCode(err);
7744
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7745
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7746
+ if (typeof err === "object" && err !== null) {
7747
+ if (Reflect.get(err, "retryable") === true) return "transport";
7748
+ const type = stringProp(err, "type");
7749
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7750
+ }
7751
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7752
+ return "permanent";
7753
+ }
7644
7754
  /**
7645
7755
  * Collect the keys of every field marked `perNode: true`, recursing into
7646
7756
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7730,6 +7840,156 @@ var PeerBytesTicketSchema = object({
7730
7840
  */
7731
7841
  declaredBytes: number().int().nonnegative().nullable()
7732
7842
  });
7843
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7844
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7845
+ var RECORD_DATABASES = ["settings", "events"];
7846
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7847
+ var RECORD_CLASSES = [
7848
+ "config",
7849
+ "ledger",
7850
+ "audit",
7851
+ "mirror",
7852
+ "ephemeral"
7853
+ ];
7854
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7855
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7856
+ var RECORD_BATCH_MAX = 1e3;
7857
+ var RECORD_QUERY_MAX = 1e3;
7858
+ function defOf(schema) {
7859
+ const zodBag = Reflect.get(schema, "_zod");
7860
+ if (typeof zodBag !== "object" || zodBag === null) return {};
7861
+ const def = Reflect.get(zodBag, "def");
7862
+ if (typeof def !== "object" || def === null) return {};
7863
+ return def;
7864
+ }
7865
+ function declaredHere(schema) {
7866
+ return globalRegistry.get(schema)?.secret === true;
7867
+ }
7868
+ /** Wrapper kinds whose `innerType` is the field itself. */
7869
+ var WRAPPERS = new Set([
7870
+ "optional",
7871
+ "nullable",
7872
+ "default",
7873
+ "prefault",
7874
+ "catch",
7875
+ "readonly",
7876
+ "nonoptional"
7877
+ ]);
7878
+ /**
7879
+ * The schema layers that make up ONE field: the schema itself and every
7880
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
7881
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
7882
+ * `.transform` on `in`).
7883
+ */
7884
+ function layersOf(schema) {
7885
+ const out = [];
7886
+ const queue = [schema];
7887
+ while (queue.length > 0) {
7888
+ const s = queue.shift();
7889
+ if (!s || out.includes(s)) continue;
7890
+ out.push(s);
7891
+ const def = defOf(s);
7892
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
7893
+ if (def.type === "pipe") {
7894
+ if (def.in) queue.push(def.in);
7895
+ if (def.out) queue.push(def.out);
7896
+ }
7897
+ }
7898
+ return out;
7899
+ }
7900
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
7901
+ function isZodSecret(schema) {
7902
+ return layersOf(schema).some(declaredHere);
7903
+ }
7904
+ /**
7905
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
7906
+ * element of this array" (`connection.password`, `rows[].token`). A declared
7907
+ * object or array is reported as one path and not descended into — everything
7908
+ * under it is secret.
7909
+ */
7910
+ function collectZodSecretPaths(schema, prefix = "") {
7911
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
7912
+ const paths = [];
7913
+ for (const layer of layersOf(schema)) {
7914
+ const def = defOf(layer);
7915
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
7916
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
7917
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
7918
+ else if (def.type === "intersection") {
7919
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
7920
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
7921
+ }
7922
+ }
7923
+ return [...new Set(paths)];
7924
+ }
7925
+ /**
7926
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
7927
+ * Zod row schema that describes it, and the helper that turns the two into the
7928
+ * JSON the engine stores.
7929
+ *
7930
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
7931
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
7932
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
7933
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
7934
+ * never a field name (D879).
7935
+ */
7936
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
7937
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
7938
+ var RecordIndexSchema = object({
7939
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
7940
+ fields: array(RecordFieldPathSchema).min(1).max(4),
7941
+ unique: boolean().optional()
7942
+ }).strict();
7943
+ var RecordRetentionSchema = union([
7944
+ object({
7945
+ ttlMs: number().int().positive(),
7946
+ from: _enum(["at", "write"])
7947
+ }).strict(),
7948
+ object({
7949
+ maxRows: number().int().positive().optional(),
7950
+ maxRowsPerDevice: number().int().positive().optional()
7951
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
7952
+ object({
7953
+ owner: string().min(1),
7954
+ reason: string().min(1)
7955
+ }).strict(),
7956
+ object({ none: string().min(1) }).strict()
7957
+ ]);
7958
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
7959
+ var EntryDescriptorSchema = object({
7960
+ title: string().min(1),
7961
+ /** The record body field shown as the entry's name. */
7962
+ nameField: string().min(1),
7963
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
7964
+ fields: record(string(), unknown())
7965
+ }).strict();
7966
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
7967
+ var RecordKindDeclarationSchema = object({
7968
+ database: _enum(RECORD_DATABASES).default("settings"),
7969
+ class: _enum(RECORD_CLASSES),
7970
+ writeTrigger: string().min(1),
7971
+ device: _enum([
7972
+ "required",
7973
+ "optional",
7974
+ "none"
7975
+ ]).default("none"),
7976
+ at: _enum(["required", "none"]).default("none"),
7977
+ indexes: array(RecordIndexSchema).max(8).default([]),
7978
+ retention: RecordRetentionSchema,
7979
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
7980
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
7981
+ /** Derived from the Zod schema; never written by hand. */
7982
+ secretPaths: array(string().min(1)).default([]),
7983
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
7984
+ secretArrayKeys: record(string(), string()).default({}),
7985
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
7986
+ adoptsFrom: string().min(1).optional(),
7987
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
7988
+ transactFamily: string().min(1).optional(),
7989
+ entry: EntryDescriptorSchema.optional()
7990
+ }).strict();
7991
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
7992
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
7733
7993
  /** Shared Zod schemas used across streaming capabilities. */
7734
7994
  var CamProfileSchema = _enum([
7735
7995
  "high",
@@ -8206,69 +8466,6 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8206
8466
  kind: "mutation",
8207
8467
  auth: "admin"
8208
8468
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
8209
- function defOf(schema) {
8210
- return schema._zod?.def ?? {};
8211
- }
8212
- function declaredHere(schema) {
8213
- return globalRegistry.get(schema)?.secret === true;
8214
- }
8215
- /** Wrapper kinds whose `innerType` is the field itself. */
8216
- var WRAPPERS = new Set([
8217
- "optional",
8218
- "nullable",
8219
- "default",
8220
- "prefault",
8221
- "catch",
8222
- "readonly",
8223
- "nonoptional"
8224
- ]);
8225
- /**
8226
- * The schema layers that make up ONE field: the schema itself and every
8227
- * wrapper below it (optional / default / nullable / readonly / catch), plus
8228
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8229
- * `.transform` on `in`).
8230
- */
8231
- function layersOf(schema) {
8232
- const out = [];
8233
- const queue = [schema];
8234
- while (queue.length > 0) {
8235
- const s = queue.shift();
8236
- if (!s || out.includes(s)) continue;
8237
- out.push(s);
8238
- const def = defOf(s);
8239
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8240
- if (def.type === "pipe") {
8241
- if (def.in) queue.push(def.in);
8242
- if (def.out) queue.push(def.out);
8243
- }
8244
- }
8245
- return out;
8246
- }
8247
- /** True when any layer of this field declares `.meta({ secret: true })`. */
8248
- function isZodSecret(schema) {
8249
- return layersOf(schema).some(declaredHere);
8250
- }
8251
- /**
8252
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
8253
- * element of this array" (`connection.password`, `rows[].token`). A declared
8254
- * object or array is reported as one path and not descended into — everything
8255
- * under it is secret.
8256
- */
8257
- function collectZodSecretPaths(schema, prefix = "") {
8258
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8259
- const paths = [];
8260
- for (const layer of layersOf(schema)) {
8261
- const def = defOf(layer);
8262
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8263
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8264
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8265
- else if (def.type === "intersection") {
8266
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8267
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8268
- }
8269
- }
8270
- return [...new Set(paths)];
8271
- }
8272
8469
  object({
8273
8470
  code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
8274
8471
  params: record(string(), union([string(), number()])).optional()
@@ -8288,7 +8485,7 @@ function userError(code, params, englishFallback) {
8288
8485
  return new CamstackError(code, params, englishFallback);
8289
8486
  }
8290
8487
  //#endregion
8291
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8488
+ //#region ../types/dist/err-msg-BXKzRBwg.mjs
8292
8489
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8293
8490
  DeviceType["Camera"] = "camera";
8294
8491
  DeviceType["Hub"] = "hub";
@@ -8380,6 +8577,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
8380
8577
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
8381
8578
  * integrations sharing the same food/desiccant/hopper surface. */
8382
8579
  DeviceType["PetFeeder"] = "pet-feeder";
8580
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
8581
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
8582
+ * Sources: native Bosch Home Connect, reusable by similar integrations. */
8583
+ DeviceType["Dishwasher"] = "dishwasher";
8383
8584
  return DeviceType;
8384
8585
  }({});
8385
8586
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -8557,6 +8758,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8557
8758
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8558
8759
  * real Switch device for UI rendering / export adapters. */
8559
8760
  DeviceRole["BinaryHelper"] = "binary-helper";
8761
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
8762
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
8763
+ DeviceRole["Outlet"] = "outlet";
8560
8764
  /** Generic motion / occupancy / moving event source. Distinct from
8561
8765
  * the camera accessory PirSensor role: that one is a camera child;
8562
8766
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8624,7 +8828,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8624
8828
  return DeviceRole;
8625
8829
  }({});
8626
8830
  //#endregion
8627
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
8831
+ //#region ../types/dist/composition-CB6PMT9p.mjs
8628
8832
  /**
8629
8833
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8630
8834
  *
@@ -12129,11 +12333,10 @@ var ClipModelMetaSchema = object({
12129
12333
  /**
12130
12334
  * The `vector-store` index this model's vectors live in. ONE feature space
12131
12335
  * per index: two models share an index only when their vectors are ranked
12132
- * against each other, which for CLIP means never across families. MobileCLIP
12133
- * S1 and S2 share `object-clip` for history (separated by the row's
12134
- * `modelId`); any other model gets its own.
12336
+ * against each other, which for CLIP means never across families. Every
12337
+ * model gets its own.
12135
12338
  */
12136
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12339
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
12137
12340
  /**
12138
12341
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
12139
12342
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -13312,8 +13515,13 @@ var AlertSeveritySchema = _enum([
13312
13515
  "info",
13313
13516
  "success",
13314
13517
  "warning",
13315
- "error"
13518
+ "error",
13519
+ "critical"
13316
13520
  ]);
13521
+ var AlertActionSchema = object({
13522
+ label: string(),
13523
+ href: string().optional()
13524
+ });
13317
13525
  var AlertStatusSchema = _enum([
13318
13526
  "active",
13319
13527
  "in-progress",
@@ -13331,6 +13539,7 @@ var AlertSchema = object({
13331
13539
  severity: AlertSeveritySchema,
13332
13540
  title: string(),
13333
13541
  message: string(),
13542
+ action: AlertActionSchema.optional(),
13334
13543
  status: AlertStatusSchema,
13335
13544
  progress: number().optional(),
13336
13545
  read: boolean(),
@@ -15866,6 +16075,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15866
16075
  keyField: string()
15867
16076
  }).optional()
15868
16077
  })) });
16078
+ /**
16079
+ * The report of a one-shot "move this owner's plaintext secrets into the
16080
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
16081
+ *
16082
+ * The owner runs it on its own rows, through its own write path; an operator
16083
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
16084
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
16085
+ */
16086
+ var RawSecretMigrationInputSchema = object({
16087
+ /** `false` (the default of the script) = report only. */
16088
+ apply: boolean() });
16089
+ var RawSecretMigrationReportSchema = object({
16090
+ apply: boolean(),
16091
+ /** Rows that can carry a secret (a profile, an enrolment). */
16092
+ rows: number().int(),
16093
+ /** Rows whose secret was plaintext when the run started. */
16094
+ raw: number().int(),
16095
+ /** Rows that already held a keychain marker when the run started. */
16096
+ markers: number().int(),
16097
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
16098
+ migrated: number().int(),
16099
+ /** Plaintext rows left in place because the move or its read-back failed. */
16100
+ failed: number().int(),
16101
+ /** After the run: rows still holding plaintext. */
16102
+ remainingRaw: number().int(),
16103
+ /** After the run: markers the keychain could not resolve right now. */
16104
+ unresolvedMarkers: number().int(),
16105
+ /**
16106
+ * A second, redundant copy of the secrets' rows that the run found (and, on
16107
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
16108
+ */
16109
+ redundantCopies: number().int().optional(),
16110
+ /** True when nothing is raw and every marker resolves. */
16111
+ verified: boolean()
16112
+ });
15869
16113
  /** Where a block runs. The operator chooses — a block driving a device on an
15870
16114
  * agent is the reason placement is not fixed to the hub. */
15871
16115
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -16092,6 +16336,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
16092
16336
  }), SettingsUpdateResultSchema, {
16093
16337
  kind: "mutation",
16094
16338
  auth: "admin"
16339
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16340
+ kind: "mutation",
16341
+ auth: "admin"
16095
16342
  }), method(object({}), object({ libs: array(object({
16096
16343
  filePath: string(),
16097
16344
  content: string()
@@ -16355,6 +16602,347 @@ id: union([string(), number()]) }), {
16355
16602
  auth: "admin"
16356
16603
  });
16357
16604
  /**
16605
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16606
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16607
+ * (operator intent, D870) and device-history (numbers over time, D850).
16608
+ *
16609
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16610
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16611
+ * that with the addon id closed over). It is deliberately NOT in any input
16612
+ * schema, so a session can never supply it, and a call with no stamp is refused
16613
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16614
+ * addons go through the owner's capability.
16615
+ *
16616
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16617
+ * never `[]`. Secret fields are never on the wire: a read shows the
16618
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16619
+ * resolves itself, and a write may carry only a keychain marker bound to the
16620
+ * row's own ref.
16621
+ *
16622
+ * Internal: addons reach it through `ctx.records`, never directly.
16623
+ */
16624
+ var RecordIdSchema = string().min(1).max(256);
16625
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16626
+ var RecordBodySchema = record(string(), unknown());
16627
+ var RecordInputSchema = object({
16628
+ id: RecordIdSchema,
16629
+ /** The device this row belongs to (D865 removal, per-device reads). */
16630
+ deviceId: number().int().optional(),
16631
+ /** The domain clock, ms: observed / created / opened. */
16632
+ at: number().int().optional(),
16633
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16634
+ expiresAt: number().int().optional(),
16635
+ data: RecordBodySchema
16636
+ });
16637
+ var RecordViewSchema = object({
16638
+ id: string(),
16639
+ deviceId: number().int().nullable(),
16640
+ at: number().nullable(),
16641
+ expiresAt: number().nullable(),
16642
+ rev: number().int(),
16643
+ updatedAt: number(),
16644
+ data: RecordBodySchema
16645
+ });
16646
+ /** Declared index fields only. Anything else does not compile, by design. */
16647
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16648
+ string(),
16649
+ number(),
16650
+ boolean(),
16651
+ object({ in: array(union([
16652
+ string(),
16653
+ number(),
16654
+ boolean()
16655
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16656
+ object({
16657
+ gt: union([string(), number()]).optional(),
16658
+ gte: union([string(), number()]).optional(),
16659
+ lt: union([string(), number()]).optional(),
16660
+ lte: union([string(), number()]).optional()
16661
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16662
+ ]));
16663
+ var KindShape = { kind: RecordKindNameSchema };
16664
+ var TimeWindowShape = {
16665
+ deviceId: number().int().optional(),
16666
+ atFrom: number().optional(),
16667
+ atTo: number().optional()
16668
+ };
16669
+ var RecordQueryInputSchema = object({
16670
+ ...KindShape,
16671
+ ...TimeWindowShape,
16672
+ where: RecordWhereSchema.optional(),
16673
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16674
+ order: _enum(["at", "id"]).optional(),
16675
+ desc: boolean().optional(),
16676
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16677
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16678
+ cursor: string().min(1).optional()
16679
+ });
16680
+ var RecordQueryResultSchema = object({
16681
+ records: array(RecordViewSchema),
16682
+ nextCursor: string().nullable()
16683
+ });
16684
+ var RecordKindStateSchema = _enum([
16685
+ "created",
16686
+ "unchanged",
16687
+ "updated"
16688
+ ]);
16689
+ var DeclareKindResultSchema = object({
16690
+ kindId: number().int(),
16691
+ state: RecordKindStateSchema,
16692
+ createdIndexes: array(string()),
16693
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16694
+ adoptionPending: object({
16695
+ legacyTable: string(),
16696
+ legacyRows: number().int()
16697
+ }).nullable()
16698
+ });
16699
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16700
+ var SecretRefsList = array(string());
16701
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16702
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16703
+ kind: "mutation",
16704
+ auth: "admin"
16705
+ }), method(object({
16706
+ ...KindShape,
16707
+ id: RecordIdSchema
16708
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16709
+ ...KindShape,
16710
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16711
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16712
+ ...KindShape,
16713
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16714
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16715
+ ...KindShape,
16716
+ record: RecordInputSchema,
16717
+ /** Compare-and-set. `0` means "the row must not exist". */
16718
+ ifRev: number().int().min(0).optional()
16719
+ }), object({
16720
+ rev: number().int(),
16721
+ releasedRefs: SecretRefsList
16722
+ }), {
16723
+ kind: "mutation",
16724
+ auth: "admin"
16725
+ }), method(object({
16726
+ ...KindShape,
16727
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16728
+ }), object({
16729
+ count: number().int(),
16730
+ releasedRefs: SecretRefsList
16731
+ }), {
16732
+ kind: "mutation",
16733
+ auth: "admin"
16734
+ }), method(object({
16735
+ ...KindShape,
16736
+ id: RecordIdSchema,
16737
+ data: RecordBodySchema,
16738
+ at: number().int().nullable().optional(),
16739
+ expiresAt: number().int().nullable().optional(),
16740
+ ifRev: number().int().min(1).optional()
16741
+ }), object({
16742
+ rev: number().int(),
16743
+ releasedRefs: SecretRefsList
16744
+ }), {
16745
+ kind: "mutation",
16746
+ auth: "admin"
16747
+ }), method(object({
16748
+ ...KindShape,
16749
+ id: RecordIdSchema
16750
+ }), object({
16751
+ deleted: boolean(),
16752
+ secretRefs: SecretRefsList
16753
+ }), {
16754
+ kind: "mutation",
16755
+ auth: "admin"
16756
+ }), method(object({
16757
+ ...KindShape,
16758
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16759
+ }), object({
16760
+ deleted: number().int(),
16761
+ secretRefs: SecretRefsList
16762
+ }), {
16763
+ kind: "mutation",
16764
+ auth: "admin"
16765
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16766
+ ...KindShape,
16767
+ ...TimeWindowShape,
16768
+ where: RecordWhereSchema.optional()
16769
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16770
+ ...KindShape,
16771
+ deviceId: number().int().optional(),
16772
+ from: number(),
16773
+ to: number(),
16774
+ bucketMs: number().int().positive()
16775
+ }), object({ buckets: array(object({
16776
+ bucketStart: number(),
16777
+ count: number().int()
16778
+ })) }), { auth: "admin" }), method(object({
16779
+ ...KindShape,
16780
+ op: _enum([
16781
+ "sum",
16782
+ "min",
16783
+ "max",
16784
+ "count"
16785
+ ]),
16786
+ field: RecordFieldPathSchema.optional(),
16787
+ groupBy: RecordFieldPathSchema.optional(),
16788
+ where: RecordWhereSchema.optional()
16789
+ }), object({ rows: array(object({
16790
+ group: union([
16791
+ string(),
16792
+ number(),
16793
+ _null()
16794
+ ]),
16795
+ value: number().nullable()
16796
+ })) }), { auth: "admin" }), method(object({
16797
+ ...KindShape,
16798
+ deviceId: number().int().optional(),
16799
+ atBefore: number().optional(),
16800
+ where: RecordWhereSchema.optional()
16801
+ }), object({
16802
+ deleted: number().int(),
16803
+ secretRefs: SecretRefsList
16804
+ }), {
16805
+ kind: "mutation",
16806
+ auth: "admin"
16807
+ }), method(object({
16808
+ deviceId: number().int(),
16809
+ kinds: array(RecordKindNameSchema).optional()
16810
+ }), object({
16811
+ deleted: record(string(), number().int()),
16812
+ secretRefs: SecretRefsList
16813
+ }), {
16814
+ kind: "mutation",
16815
+ auth: "admin"
16816
+ }), method(object(KindShape), object({ id: number().int() }), {
16817
+ kind: "mutation",
16818
+ auth: "admin"
16819
+ });
16820
+ /** One table of the settings database. */
16821
+ var StorageTableSchema = object({
16822
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
16823
+ name: string(),
16824
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
16825
+ owner: string().nullable(),
16826
+ rows: number().int().nonnegative(),
16827
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
16828
+ bytes: number().int().nonnegative().nullable(),
16829
+ /** Declared by an addon since this engine process started (a running addon claims it). */
16830
+ declaredThisBoot: boolean()
16831
+ });
16832
+ /** One declared record kind (D881) as System -> Data shows it. */
16833
+ var StorageKindSchema = object({
16834
+ owner: string(),
16835
+ kind: string(),
16836
+ database: _enum(["settings", "events"]),
16837
+ class: string(),
16838
+ state: _enum([
16839
+ "declared",
16840
+ "orphaned",
16841
+ "dropped"
16842
+ ]),
16843
+ /** `null` when the caller asked for no counts (`counts: false`). */
16844
+ rows: number().int().nonnegative().nullable(),
16845
+ /** Rows x the average size of a sample; null for an empty kind. */
16846
+ bytesEstimate: number().int().nonnegative().nullable(),
16847
+ writeTrigger: string(),
16848
+ retention: RecordRetentionSchema,
16849
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16850
+ entry: boolean(),
16851
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16852
+ declaration: RecordKindDeclarationSchema
16853
+ });
16854
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16855
+ collection: string().min(1),
16856
+ expectRows: number().int().nonnegative()
16857
+ }), object({
16858
+ dropped: literal(true),
16859
+ rows: number().int().nonnegative()
16860
+ }), {
16861
+ kind: "mutation",
16862
+ auth: "admin"
16863
+ }), method(object({
16864
+ owner: string().min(1).optional(),
16865
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16866
+ counts: boolean().optional()
16867
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16868
+ owner: string().min(1),
16869
+ kind: RecordKindNameSchema
16870
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16871
+ owner: string().min(1),
16872
+ kind: RecordKindNameSchema,
16873
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16874
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16875
+ complete: boolean().optional()
16876
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16877
+ kind: "mutation",
16878
+ auth: "admin"
16879
+ }), method(object({
16880
+ collection: string().min(1),
16881
+ cursor: string().optional(),
16882
+ limit: number().int().min(1).max(1e3).optional()
16883
+ }), object({
16884
+ rows: array(object({
16885
+ id: string(),
16886
+ data: record(string(), unknown())
16887
+ })),
16888
+ nextCursor: string().nullable()
16889
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16890
+ /**
16891
+ * record-entries - the ONE admin surface for every list of user-created entries
16892
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16893
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16894
+ *
16895
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16896
+ * the entry body with `secret: true` on every credential field, so a password
16897
+ * field is derived from the schema and never from a name. `putEntry` takes the
16898
+ * redaction token for an untouched secret (the stored value is kept), a string
16899
+ * for a new one, and the clear instruction to remove one. A read never carries
16900
+ * a secret value, and a locked keychain refuses the write with
16901
+ * `records/secret-unavailable` instead of storing plaintext.
16902
+ *
16903
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16904
+ */
16905
+ var EntryKindInfoSchema = object({
16906
+ owner: string(),
16907
+ kind: RecordKindNameSchema,
16908
+ title: string(),
16909
+ nameField: string(),
16910
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16911
+ fields: record(string(), unknown()),
16912
+ secretPaths: array(string()),
16913
+ rows: number().int().nonnegative()
16914
+ });
16915
+ var EntryViewSchema = object({
16916
+ id: RecordIdSchema,
16917
+ name: string(),
16918
+ rev: number().int(),
16919
+ updatedAt: number(),
16920
+ /** Secret fields hold the redaction token. */
16921
+ data: RecordBodySchema
16922
+ });
16923
+ var EntryAddress = {
16924
+ owner: string().min(1),
16925
+ kind: RecordKindNameSchema
16926
+ };
16927
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16928
+ ...EntryAddress,
16929
+ id: RecordIdSchema.optional(),
16930
+ data: RecordBodySchema,
16931
+ ifRev: number().int().min(1).optional()
16932
+ }), object({
16933
+ id: string(),
16934
+ rev: number().int()
16935
+ }), {
16936
+ kind: "mutation",
16937
+ auth: "admin"
16938
+ }), method(object({
16939
+ ...EntryAddress,
16940
+ id: RecordIdSchema
16941
+ }), object({ deleted: boolean() }), {
16942
+ kind: "mutation",
16943
+ auth: "admin"
16944
+ });
16945
+ /**
16358
16946
  * `keychain` — the hub's encrypted store of secret values (D787).
16359
16947
  *
16360
16948
  * Settings blobs never hold a secret: they hold a marker
@@ -16895,6 +17483,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16895
17483
  kind: "mutation",
16896
17484
  auth: "admin",
16897
17485
  caller: "required"
17486
+ }), method(object({
17487
+ ref: string().min(1),
17488
+ value: string().min(1)
17489
+ }), object({
17490
+ ref: string(),
17491
+ version: number().int()
17492
+ }), {
17493
+ kind: "mutation",
17494
+ auth: "admin",
17495
+ caller: "required"
16898
17496
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16899
17497
  deleted: array(string()).readonly(),
16900
17498
  kept: array(object({
@@ -39688,6 +40286,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39688
40286
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39689
40287
  kind: "mutation",
39690
40288
  auth: "admin"
40289
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
40290
+ kind: "mutation",
40291
+ auth: "admin"
39691
40292
  }), method(ProfileRefInputSchema, _void(), {
39692
40293
  kind: "mutation",
39693
40294
  auth: "admin"
@@ -50197,6 +50798,41 @@ var ServerRollbackInfoSchema = object({
50197
50798
  atMs: number(),
50198
50799
  reason: string()
50199
50800
  });
50801
+ /**
50802
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50803
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50804
+ * service holds, because only the hub plans) against the states the process
50805
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50806
+ * every boot, served on `getServerPackageStatus`.
50807
+ *
50808
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50809
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50810
+ * planned runner the process service has no entry for.
50811
+ */
50812
+ var RunnerRefusalSchema = object({
50813
+ runnerId: string(),
50814
+ addonIds: array(string()),
50815
+ reason: string()
50816
+ });
50817
+ var RunnerBootCheckSchema = object({
50818
+ checkedAtMs: number(),
50819
+ /** Runners planned for this node. */
50820
+ expected: number(),
50821
+ /** Planned runners whose process is `running`. */
50822
+ running: number(),
50823
+ failed: array(string()),
50824
+ refused: array(RunnerRefusalSchema),
50825
+ missing: array(string()),
50826
+ /**
50827
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50828
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50829
+ * pushed and the verdict is re-evaluated on the next runner state change.
50830
+ * Optional for version skew (absent = settled).
50831
+ */
50832
+ pending: array(string()).optional(),
50833
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50834
+ planKnown: boolean()
50835
+ });
50200
50836
  var ServerPackageStatusSchema = object({
50201
50837
  /** Root package name (`@camstack/server` on the hub). */
50202
50838
  packageName: string(),
@@ -50259,7 +50895,14 @@ var ServerPackageStatusSchema = object({
50259
50895
  * for version skew: an older provider's payload simply omits it, and an
50260
50896
  * absent wrapper is unknown — never `native`.
50261
50897
  */
50262
- wrapper: WrapperIdentitySchema.optional()
50898
+ wrapper: WrapperIdentitySchema.optional(),
50899
+ /**
50900
+ * What this node PLANNED to run against what its process service reports
50901
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50902
+ * on a provider that predates it. Absent is "not checked yet", never "all
50903
+ * well": a consumer that needs the answer treats it as pending.
50904
+ */
50905
+ runners: RunnerBootCheckSchema.optional()
50263
50906
  });
50264
50907
  var ServerUpdateCheckResultSchema = object({
50265
50908
  packageName: string(),
@@ -50310,6 +50953,13 @@ var ServerUpdateOutcomeSchema = _enum([
50310
50953
  "refused",
50311
50954
  "failed"
50312
50955
  ]);
50956
+ /** One addon the pre-flight found the target version would refuse (D877). */
50957
+ var UpdateBlockerSchema = object({
50958
+ addonId: string(),
50959
+ reason: string(),
50960
+ /** What the operator does about it. */
50961
+ remedy: string()
50962
+ });
50313
50963
  var ServerUpdateActionResultSchema = object({
50314
50964
  accepted: boolean(),
50315
50965
  targetVersion: string().nullable(),
@@ -50327,14 +50977,27 @@ var ServerUpdateActionResultSchema = object({
50327
50977
  * The failure itself, verbatim enough to act on (the npm output for a
50328
50978
  * staging install). Non-null only for `failed`.
50329
50979
  */
50330
- error: string().nullable().optional()
50980
+ error: string().nullable().optional(),
50981
+ /**
50982
+ * The addons the target version would refuse to start on this node's live
50983
+ * store (D877), present when the pre-flight refused the update
50984
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50985
+ */
50986
+ blockers: array(UpdateBlockerSchema).optional()
50331
50987
  });
50332
50988
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
50333
50989
  kind: "mutation",
50334
50990
  auth: "admin"
50335
- }), method(object({
50336
- /** Explicit target version; omitted = latest from the registry. */
50337
- version: string().optional() }), ServerUpdateActionResultSchema, {
50991
+ }), method(object({
50992
+ /** Explicit target version; omitted = latest from the registry. */
50993
+ version: string().optional(),
50994
+ /**
50995
+ * Apply even though the pre-flight (D877) found addons the target would
50996
+ * refuse to start. Off by default: those addons stay down until the
50997
+ * remedy is run, which is the incident this gate exists to prevent.
50998
+ */
50999
+ acknowledgeRefusals: boolean().optional()
51000
+ }), ServerUpdateActionResultSchema, {
50338
51001
  kind: "mutation",
50339
51002
  auth: "admin",
50340
51003
  timeoutMs: 16 * 6e4
@@ -53302,7 +53965,9 @@ var ManifestShapeSchema = object({
53302
53965
  var AddonProcessSchema = object({
53303
53966
  pid: number().optional(),
53304
53967
  mode: string(),
53305
- state: string()
53968
+ state: string(),
53969
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53970
+ reason: string().optional()
53306
53971
  });
53307
53972
  /**
53308
53973
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -54070,7 +54735,8 @@ var batteryCapability = {
54070
54735
  DeviceType.Button,
54071
54736
  DeviceType.Switch,
54072
54737
  DeviceType.PetFeeder,
54073
- DeviceType.Container
54738
+ DeviceType.Container,
54739
+ DeviceType.Thermostat
54074
54740
  ],
54075
54741
  methods: {
54076
54742
  /**
@@ -54691,6 +55357,12 @@ var ClimateControlStatusSchema = object({
54691
55357
  /** Horizontal louver swing on/off. Null when the device has no
54692
55358
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
54693
55359
  swingHorizontal: boolean().nullable(),
55360
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
55361
+ minTemp: number().nullable().optional(),
55362
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
55363
+ maxTemp: number().nullable().optional(),
55364
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
55365
+ tempStep: number().positive().nullable().optional(),
54694
55366
  /** Ms epoch when the slice was last updated (push or command). */
54695
55367
  lastFetchedAt: number()
54696
55368
  });
@@ -55537,6 +56209,125 @@ onStatusChanged: { data: object({
55537
56209
  * whether persisting is worth a SQLite commit. */
55538
56210
  volatileStateFields: ["lastChangedAt"]
55539
56211
  };
56212
+ /**
56213
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
56214
+ * consumable levels (salt, rinse aid) and common program options.
56215
+ *
56216
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
56217
+ * by any integration that exposes the same program / option surface.
56218
+ *
56219
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
56220
+ * provider refreshes the slice on an interval and eagerly after commands.
56221
+ */
56222
+ var DishwasherStateSchema = _enum([
56223
+ "idle",
56224
+ "running",
56225
+ "paused",
56226
+ "finished",
56227
+ "error",
56228
+ "unavailable"
56229
+ ]);
56230
+ var DishwasherConsumableLevelSchema = _enum([
56231
+ "ok",
56232
+ "low",
56233
+ "empty"
56234
+ ]);
56235
+ var DishwasherStatusSchema = object({
56236
+ state: DishwasherStateSchema,
56237
+ /** Active program id/name, or null when none selected / unknown. */
56238
+ program: string().nullable(),
56239
+ /** Program tokens the hardware accepts — drives the UI selector. */
56240
+ availablePrograms: array(string()),
56241
+ /** Minutes remaining on the active cycle, or null when not running. */
56242
+ remainingMinutes: number().int().nonnegative().nullable(),
56243
+ /** Cycle completion 0..100, or null when not applicable. */
56244
+ progressPercent: number().min(0).max(100).nullable(),
56245
+ /** True when the door is reported open. */
56246
+ doorOpen: boolean(),
56247
+ /** True when remote start is allowed (door closed, power on, etc.). */
56248
+ remoteStartAllowed: boolean(),
56249
+ /** Main power / switched-on state. */
56250
+ powerOn: boolean(),
56251
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
56252
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
56253
+ halfLoad: boolean(),
56254
+ hygienePlus: boolean(),
56255
+ errorCode: number().nullable(),
56256
+ errorLabel: string().nullable(),
56257
+ lastFetchedAt: number()
56258
+ });
56259
+ var dishwasherCapability = {
56260
+ name: "dishwasher",
56261
+ scope: "device",
56262
+ deviceNative: true,
56263
+ mode: "singleton",
56264
+ deviceTypes: [DeviceType.Dishwasher],
56265
+ methods: {
56266
+ start: method(object({ deviceId: number().int().nonnegative() }), _void(), {
56267
+ kind: "mutation",
56268
+ auth: "protected"
56269
+ }),
56270
+ pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
56271
+ kind: "mutation",
56272
+ auth: "protected"
56273
+ }),
56274
+ stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
56275
+ kind: "mutation",
56276
+ auth: "protected"
56277
+ }),
56278
+ setProgram: method(object({
56279
+ deviceId: number().int().nonnegative(),
56280
+ program: string().min(1)
56281
+ }), _void(), {
56282
+ kind: "mutation",
56283
+ auth: "protected"
56284
+ }),
56285
+ setPower: method(object({
56286
+ deviceId: number().int().nonnegative(),
56287
+ on: boolean()
56288
+ }), _void(), {
56289
+ kind: "mutation",
56290
+ auth: "protected"
56291
+ }),
56292
+ setHalfLoad: method(object({
56293
+ deviceId: number().int().nonnegative(),
56294
+ on: boolean()
56295
+ }), _void(), {
56296
+ kind: "mutation",
56297
+ auth: "protected"
56298
+ }),
56299
+ setHygienePlus: method(object({
56300
+ deviceId: number().int().nonnegative(),
56301
+ on: boolean()
56302
+ }), _void(), {
56303
+ kind: "mutation",
56304
+ auth: "protected"
56305
+ }),
56306
+ setOption: method(object({
56307
+ deviceId: number().int().nonnegative(),
56308
+ key: string().min(1),
56309
+ value: union([
56310
+ boolean(),
56311
+ string(),
56312
+ number()
56313
+ ])
56314
+ }), _void(), {
56315
+ kind: "mutation",
56316
+ auth: "protected"
56317
+ })
56318
+ },
56319
+ status: {
56320
+ schema: DishwasherStatusSchema,
56321
+ kind: "poll"
56322
+ },
56323
+ runtimeState: DishwasherStatusSchema,
56324
+ durability: "session",
56325
+ history: { fields: { progressPercent: {
56326
+ kind: "gauge",
56327
+ unit: "%",
56328
+ deadband: 2
56329
+ } } }
56330
+ };
55540
56331
  var DoorbellStatusSchema = object({
55541
56332
  /** Ms epoch of the last press. null = never observed since this provider started. */
55542
56333
  lastPressedAt: number().nullable(),
@@ -56339,6 +57130,32 @@ var gasCapability = {
56339
57130
  * whether persisting is worth a SQLite commit. */
56340
57131
  volatileStateFields: ["lastChangedAt"]
56341
57132
  };
57133
+ var HeatingValveStatusSchema = object({
57134
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
57135
+ position: number().min(0).max(100).nullable(),
57136
+ /** Ms epoch when the slice was last updated (push or poll). */
57137
+ lastFetchedAt: number()
57138
+ });
57139
+ var heatingValveCapability = {
57140
+ name: "heating-valve",
57141
+ scope: "device",
57142
+ deviceNative: true,
57143
+ mode: "singleton",
57144
+ deviceTypes: [DeviceType.Thermostat],
57145
+ methods: {},
57146
+ status: {
57147
+ schema: HeatingValveStatusSchema,
57148
+ kind: "push"
57149
+ },
57150
+ runtimeState: HeatingValveStatusSchema,
57151
+ durability: "session",
57152
+ history: { fields: { position: {
57153
+ kind: "gauge",
57154
+ unit: "%",
57155
+ deadband: 1
57156
+ } } },
57157
+ volatileStateFields: ["lastFetchedAt"]
57158
+ };
56342
57159
  /**
56343
57160
  * Humidifier / dehumidifier cap. Models HA `humidifier.*` entities —
56344
57161
  * an on/off actuator with an optional target-humidity setpoint and an
@@ -57471,7 +58288,19 @@ var TlsStatusSchema = object({
57471
58288
  sans: array(string()),
57472
58289
  caCertPem: string().nullable(),
57473
58290
  reissueError: string().nullable(),
57474
- restartRequired: boolean()
58291
+ restartRequired: boolean(),
58292
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
58293
+ caMissing: boolean(),
58294
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
58295
+ localCaConstrained: boolean().nullable(),
58296
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
58297
+ caReplacedAt: string().nullable(),
58298
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
58299
+ storedUpload: object({
58300
+ leafFingerprintSha256: string(),
58301
+ validTo: string(),
58302
+ hasCa: boolean()
58303
+ }).nullable()
57475
58304
  });
57476
58305
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
57477
58306
  /**
@@ -57527,6 +58356,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
57527
58356
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
57528
58357
  kind: "mutation",
57529
58358
  auth: "admin"
58359
+ }), method(_void(), TlsStatusSchema, {
58360
+ kind: "mutation",
58361
+ auth: "admin"
57530
58362
  });
57531
58363
  var LockControlStatusSchema = object({
57532
58364
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -64581,7 +65413,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64581
65413
  kind: "mutation",
64582
65414
  auth: "admin",
64583
65415
  access: "delete"
64584
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
65416
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
65417
+ kind: "mutation",
65418
+ auth: "admin",
65419
+ access: "create"
65420
+ }), method(object({
64585
65421
  userId: string(),
64586
65422
  code: string()
64587
65423
  }), object({ valid: boolean() }), {
@@ -66316,6 +67152,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
66316
67152
  dayNight: dayNightCapability,
66317
67153
  deviceDiscovery: deviceDiscoveryCapability,
66318
67154
  deviceStatus: deviceStatusCapability,
67155
+ dishwasher: dishwasherCapability,
66319
67156
  doorbell: doorbellCapability,
66320
67157
  enumSensor: enumSensorCapability,
66321
67158
  eventEmitter: eventEmitterCapability,
@@ -66323,6 +67160,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
66323
67160
  featureProbe: featureProbeCapability,
66324
67161
  flood: floodCapability,
66325
67162
  gas: gasCapability,
67163
+ heatingValve: heatingValveCapability,
66326
67164
  humidifier: humidifierCapability,
66327
67165
  humiditySensor: humiditySensorCapability,
66328
67166
  image: imageCapability,
@@ -66408,13 +67246,14 @@ var BaseDevice = class {
66408
67246
  get state() {
66409
67247
  if (!this._stateProxyCache) {
66410
67248
  const cache = {};
66411
- const handler = { get: (_target, key) => {
67249
+ const handler = { get: (target, key) => {
66412
67250
  const k = key;
66413
- if (k in cache) return cache[k];
67251
+ const existing = Reflect.get(target, k);
67252
+ if (existing !== void 0) return existing;
66414
67253
  const cap = DEVICE_LOCAL_STATE_CAPS[k];
66415
67254
  if (!cap) return void 0;
66416
67255
  const proxy = this.sliceProxy(cap);
66417
- cache[k] = proxy;
67256
+ Reflect.set(target, k, proxy);
66418
67257
  return proxy;
66419
67258
  } };
66420
67259
  this._stateProxyCache = new Proxy(cache, handler);
@@ -66613,7 +67452,7 @@ var BaseDevice = class {
66613
67452
  async updateSourceInfo(patch) {
66614
67453
  const next = mergeSourceInfo(this.sourceInfo, patch);
66615
67454
  this._sourceInfoCache = Object.freeze({ ...next });
66616
- const action = this.ctx.api?.deviceManager?.setMetadata;
67455
+ const action = this.ctx.api.deviceManager?.setMetadata;
66617
67456
  if (action) try {
66618
67457
  await action.mutate({
66619
67458
  deviceId: this.id,
@@ -66648,7 +67487,7 @@ var BaseDevice = class {
66648
67487
  * device boot on a meta refresh.
66649
67488
  */
66650
67489
  async refreshFeatures() {
66651
- const action = this.ctx.api?.deviceManager?.registerDevice;
67490
+ const action = this.ctx.api.deviceManager?.registerDevice;
66652
67491
  if (!action) return;
66653
67492
  try {
66654
67493
  await action.mutate({
@@ -67047,6 +67886,12 @@ var BaseDeviceProvider = class extends BaseAddon {
67047
67886
  provider: this
67048
67887
  }];
67049
67888
  }
67889
+ /** Flatten `super.onInitialize()` whether it returned an array or an envelope. */
67890
+ providerRegistrationsFromSuper(result) {
67891
+ if (Array.isArray(result)) return result;
67892
+ if (result !== void 0 && result.providers !== void 0) return [...result.providers];
67893
+ return [];
67894
+ }
67050
67895
  async onShutdown() {
67051
67896
  this._restoreShuttingDown = true;
67052
67897
  this.cancelRestoreRetries();
@@ -67573,7 +68418,11 @@ var BaseDeviceProvider = class extends BaseAddon {
67573
68418
  return toDeviceSummary(device, this.addonId);
67574
68419
  }
67575
68420
  };
67576
- 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;
68421
+ /** Map entry helper — concrete camera/hub classes widen to `DeviceConstructor<IDevice>`. */
68422
+ function widenDeviceConstructor(ctor) {
68423
+ return ctor;
68424
+ }
68425
+ 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;
67577
68426
  new Set(Object.values(DeviceType));
67578
68427
  Object.freeze({
67579
68428
  "accessories.getStatus": {
@@ -68722,6 +69571,12 @@ Object.freeze({
68722
69571
  addonId: null,
68723
69572
  access: "view"
68724
69573
  },
69574
+ "coreBlocks.migrateRawSecrets": {
69575
+ capName: "core-blocks",
69576
+ capScope: "system",
69577
+ addonId: null,
69578
+ access: "create"
69579
+ },
68725
69580
  "coreBlocks.restart": {
68726
69581
  capName: "core-blocks",
68727
69582
  capScope: "system",
@@ -69988,6 +70843,60 @@ Object.freeze({
69988
70843
  addonId: null,
69989
70844
  access: "view"
69990
70845
  },
70846
+ "dishwasher.getStatus": {
70847
+ capName: "dishwasher",
70848
+ capScope: "device",
70849
+ addonId: null,
70850
+ access: "view"
70851
+ },
70852
+ "dishwasher.pause": {
70853
+ capName: "dishwasher",
70854
+ capScope: "device",
70855
+ addonId: null,
70856
+ access: "create"
70857
+ },
70858
+ "dishwasher.setHalfLoad": {
70859
+ capName: "dishwasher",
70860
+ capScope: "device",
70861
+ addonId: null,
70862
+ access: "create"
70863
+ },
70864
+ "dishwasher.setHygienePlus": {
70865
+ capName: "dishwasher",
70866
+ capScope: "device",
70867
+ addonId: null,
70868
+ access: "create"
70869
+ },
70870
+ "dishwasher.setOption": {
70871
+ capName: "dishwasher",
70872
+ capScope: "device",
70873
+ addonId: null,
70874
+ access: "create"
70875
+ },
70876
+ "dishwasher.setPower": {
70877
+ capName: "dishwasher",
70878
+ capScope: "device",
70879
+ addonId: null,
70880
+ access: "create"
70881
+ },
70882
+ "dishwasher.setProgram": {
70883
+ capName: "dishwasher",
70884
+ capScope: "device",
70885
+ addonId: null,
70886
+ access: "create"
70887
+ },
70888
+ "dishwasher.start": {
70889
+ capName: "dishwasher",
70890
+ capScope: "device",
70891
+ addonId: null,
70892
+ access: "create"
70893
+ },
70894
+ "dishwasher.stop": {
70895
+ capName: "dishwasher",
70896
+ capScope: "device",
70897
+ addonId: null,
70898
+ access: "create"
70899
+ },
69991
70900
  "doorbell.getStatus": {
69992
70901
  capName: "doorbell",
69993
70902
  capScope: "device",
@@ -70198,6 +71107,12 @@ Object.freeze({
70198
71107
  addonId: null,
70199
71108
  access: "view"
70200
71109
  },
71110
+ "heatingValve.getStatus": {
71111
+ capName: "heating-valve",
71112
+ capScope: "device",
71113
+ addonId: null,
71114
+ access: "view"
71115
+ },
70201
71116
  "humidifier.getStatus": {
70202
71117
  capName: "humidifier",
70203
71118
  capScope: "device",
@@ -70408,6 +71323,12 @@ Object.freeze({
70408
71323
  addonId: null,
70409
71324
  access: "create"
70410
71325
  },
71326
+ "keychainAdmin.importSecret": {
71327
+ capName: "keychain-admin",
71328
+ capScope: "system",
71329
+ addonId: null,
71330
+ access: "create"
71331
+ },
70411
71332
  "keychainAdmin.listAudit": {
70412
71333
  capName: "keychain-admin",
70413
71334
  capScope: "system",
@@ -70576,6 +71497,12 @@ Object.freeze({
70576
71497
  addonId: null,
70577
71498
  access: "view"
70578
71499
  },
71500
+ "llm.migrateRawSecrets": {
71501
+ capName: "llm",
71502
+ capScope: "system",
71503
+ addonId: null,
71504
+ access: "create"
71505
+ },
70579
71506
  "llm.resolveModelRef": {
70580
71507
  capName: "llm",
70581
71508
  capScope: "system",
@@ -70804,6 +71731,12 @@ Object.freeze({
70804
71731
  addonId: null,
70805
71732
  access: "create"
70806
71733
  },
71734
+ "localNetwork.useStoredUploadedCertificate": {
71735
+ capName: "local-network",
71736
+ capScope: "system",
71737
+ addonId: null,
71738
+ access: "create"
71739
+ },
70807
71740
  "lockControl.getStatus": {
70808
71741
  capName: "lock-control",
70809
71742
  capScope: "device",
@@ -73456,6 +74389,30 @@ Object.freeze({
73456
74389
  addonId: null,
73457
74390
  access: "create"
73458
74391
  },
74392
+ "recordEntries.deleteEntry": {
74393
+ capName: "record-entries",
74394
+ capScope: "system",
74395
+ addonId: null,
74396
+ access: "delete"
74397
+ },
74398
+ "recordEntries.listEntries": {
74399
+ capName: "record-entries",
74400
+ capScope: "system",
74401
+ addonId: null,
74402
+ access: "view"
74403
+ },
74404
+ "recordEntries.listEntryKinds": {
74405
+ capName: "record-entries",
74406
+ capScope: "system",
74407
+ addonId: null,
74408
+ access: "view"
74409
+ },
74410
+ "recordEntries.putEntry": {
74411
+ capName: "record-entries",
74412
+ capScope: "system",
74413
+ addonId: null,
74414
+ access: "create"
74415
+ },
73459
74416
  "recording.getAvailability": {
73460
74417
  capName: "recording",
73461
74418
  capScope: "device",
@@ -73756,6 +74713,102 @@ Object.freeze({
73756
74713
  addonId: null,
73757
74714
  access: "view"
73758
74715
  },
74716
+ "records.aggregate": {
74717
+ capName: "records",
74718
+ capScope: "system",
74719
+ addonId: null,
74720
+ access: "view"
74721
+ },
74722
+ "records.allocateId": {
74723
+ capName: "records",
74724
+ capScope: "system",
74725
+ addonId: null,
74726
+ access: "create"
74727
+ },
74728
+ "records.count": {
74729
+ capName: "records",
74730
+ capScope: "system",
74731
+ addonId: null,
74732
+ access: "view"
74733
+ },
74734
+ "records.declareKinds": {
74735
+ capName: "records",
74736
+ capScope: "system",
74737
+ addonId: null,
74738
+ access: "create"
74739
+ },
74740
+ "records.delete": {
74741
+ capName: "records",
74742
+ capScope: "system",
74743
+ addonId: null,
74744
+ access: "delete"
74745
+ },
74746
+ "records.deleteDevice": {
74747
+ capName: "records",
74748
+ capScope: "system",
74749
+ addonId: null,
74750
+ access: "delete"
74751
+ },
74752
+ "records.deleteMany": {
74753
+ capName: "records",
74754
+ capScope: "system",
74755
+ addonId: null,
74756
+ access: "delete"
74757
+ },
74758
+ "records.deleteWhere": {
74759
+ capName: "records",
74760
+ capScope: "system",
74761
+ addonId: null,
74762
+ access: "delete"
74763
+ },
74764
+ "records.get": {
74765
+ capName: "records",
74766
+ capScope: "system",
74767
+ addonId: null,
74768
+ access: "view"
74769
+ },
74770
+ "records.getMany": {
74771
+ capName: "records",
74772
+ capScope: "system",
74773
+ addonId: null,
74774
+ access: "view"
74775
+ },
74776
+ "records.histogram": {
74777
+ capName: "records",
74778
+ capScope: "system",
74779
+ addonId: null,
74780
+ access: "view"
74781
+ },
74782
+ "records.patch": {
74783
+ capName: "records",
74784
+ capScope: "system",
74785
+ addonId: null,
74786
+ access: "create"
74787
+ },
74788
+ "records.put": {
74789
+ capName: "records",
74790
+ capScope: "system",
74791
+ addonId: null,
74792
+ access: "create"
74793
+ },
74794
+ "records.putMany": {
74795
+ capName: "records",
74796
+ capScope: "system",
74797
+ addonId: null,
74798
+ access: "create"
74799
+ },
74800
+ "records.query": {
74801
+ capName: "records",
74802
+ capScope: "system",
74803
+ addonId: null,
74804
+ access: "view"
74805
+ },
74806
+ "records.secretRefs": {
74807
+ capName: "records",
74808
+ capScope: "system",
74809
+ addonId: null,
74810
+ access: "view"
74811
+ },
73759
74812
  "sceneMonitor.captureReference": {
73760
74813
  capName: "scene-monitor",
73761
74814
  capScope: "device",
@@ -74188,6 +75241,48 @@ Object.freeze({
74188
75241
  addonId: null,
74189
75242
  access: "create"
74190
75243
  },
75244
+ "storageAdmin.adoptRecords": {
75245
+ capName: "storage-admin",
75246
+ capScope: "system",
75247
+ addonId: null,
75248
+ access: "create"
75249
+ },
75250
+ "storageAdmin.dropCollection": {
75251
+ capName: "storage-admin",
75252
+ capScope: "system",
75253
+ addonId: null,
75254
+ access: "delete"
75255
+ },
75256
+ "storageAdmin.isAdoptedLegacyTable": {
75257
+ capName: "storage-admin",
75258
+ capScope: "system",
75259
+ addonId: null,
75260
+ access: "view"
75261
+ },
75262
+ "storageAdmin.listKinds": {
75263
+ capName: "storage-admin",
75264
+ capScope: "system",
75265
+ addonId: null,
75266
+ access: "view"
75267
+ },
75268
+ "storageAdmin.listTables": {
75269
+ capName: "storage-admin",
75270
+ capScope: "system",
75271
+ addonId: null,
75272
+ access: "view"
75273
+ },
75274
+ "storageAdmin.readLegacyCollection": {
75275
+ capName: "storage-admin",
75276
+ capScope: "system",
75277
+ addonId: null,
75278
+ access: "view"
75279
+ },
75280
+ "storageAdmin.readRecords": {
75281
+ capName: "storage-admin",
75282
+ capScope: "system",
75283
+ addonId: null,
75284
+ access: "view"
75285
+ },
74191
75286
  "storageEvictable.evict": {
74192
75287
  capName: "storage-evictable",
74193
75288
  capScope: "system",
@@ -75100,6 +76195,12 @@ Object.freeze({
75100
76195
  addonId: null,
75101
76196
  access: "view"
75102
76197
  },
76198
+ "userManagement.migrateRawSecrets": {
76199
+ capName: "user-management",
76200
+ capScope: "system",
76201
+ addonId: null,
76202
+ access: "create"
76203
+ },
75103
76204
  "userManagement.oauthExchangeCode": {
75104
76205
  capName: "user-management",
75105
76206
  capScope: "system",
@@ -75599,7 +76700,7 @@ Object.freeze({
75599
76700
  access: "create"
75600
76701
  }
75601
76702
  });
75602
- 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;
76703
+ 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;
75603
76704
  DeviceFeature.BatteryOperated;
75604
76705
  /** Reject after `ms`; always clears its own timer. */
75605
76706
  async function withTimeout$1(promise, ms, label) {
@@ -76641,6 +77742,51 @@ Object.freeze({
76641
77742
  form: "single",
76642
77743
  optional: false
76643
77744
  }],
77745
+ "dishwasher.getStatus": [{
77746
+ name: "deviceId",
77747
+ form: "single",
77748
+ optional: false
77749
+ }],
77750
+ "dishwasher.pause": [{
77751
+ name: "deviceId",
77752
+ form: "single",
77753
+ optional: false
77754
+ }],
77755
+ "dishwasher.setHalfLoad": [{
77756
+ name: "deviceId",
77757
+ form: "single",
77758
+ optional: false
77759
+ }],
77760
+ "dishwasher.setHygienePlus": [{
77761
+ name: "deviceId",
77762
+ form: "single",
77763
+ optional: false
77764
+ }],
77765
+ "dishwasher.setOption": [{
77766
+ name: "deviceId",
77767
+ form: "single",
77768
+ optional: false
77769
+ }],
77770
+ "dishwasher.setPower": [{
77771
+ name: "deviceId",
77772
+ form: "single",
77773
+ optional: false
77774
+ }],
77775
+ "dishwasher.setProgram": [{
77776
+ name: "deviceId",
77777
+ form: "single",
77778
+ optional: false
77779
+ }],
77780
+ "dishwasher.start": [{
77781
+ name: "deviceId",
77782
+ form: "single",
77783
+ optional: false
77784
+ }],
77785
+ "dishwasher.stop": [{
77786
+ name: "deviceId",
77787
+ form: "single",
77788
+ optional: false
77789
+ }],
76644
77790
  "doorbell.getStatus": [{
76645
77791
  name: "deviceId",
76646
77792
  form: "single",
@@ -76710,6 +77856,11 @@ Object.freeze({
76710
77856
  form: "single",
76711
77857
  optional: false
76712
77858
  }],
77859
+ "heatingValve.getStatus": [{
77860
+ name: "deviceId",
77861
+ form: "single",
77862
+ optional: false
77863
+ }],
76713
77864
  "humidifier.getStatus": [{
76714
77865
  name: "deviceId",
76715
77866
  form: "single",
@@ -77994,6 +79145,37 @@ Object.freeze({
77994
79145
  form: "single",
77995
79146
  optional: false
77996
79147
  }],
79148
+ "records.count": [{
79149
+ name: "deviceId",
79150
+ form: "single",
79151
+ optional: true
79152
+ }],
79153
+ "records.deleteDevice": [{
79154
+ name: "deviceId",
79155
+ form: "single",
79156
+ optional: false
79157
+ }],
79158
+ "records.deleteWhere": [{
79159
+ name: "deviceId",
79160
+ form: "single",
79161
+ optional: true
79162
+ }],
79163
+ "records.histogram": [{
79164
+ name: "deviceId",
79165
+ form: "single",
79166
+ optional: true
79167
+ }],
79168
+ "records.putMany": [{
79169
+ name: "records",
79170
+ form: "object-array",
79171
+ optional: false,
79172
+ itemField: "deviceId"
79173
+ }],
79174
+ "records.query": [{
79175
+ name: "deviceId",
79176
+ form: "single",
79177
+ optional: true
79178
+ }],
77997
79179
  "sceneMonitor.captureReference": [{
77998
79180
  name: "deviceId",
77999
79181
  form: "single",
@@ -78110,6 +79292,17 @@ Object.freeze({
78110
79292
  form: "single",
78111
79293
  optional: false
78112
79294
  }],
79295
+ "storageAdmin.adoptRecords": [{
79296
+ name: "records",
79297
+ form: "object-array",
79298
+ optional: false,
79299
+ itemField: "deviceId"
79300
+ }],
79301
+ "storageAdmin.readRecords": [{
79302
+ name: "deviceId",
79303
+ form: "single",
79304
+ optional: true
79305
+ }],
78113
79306
  "streamBroker.acquireEgressTranscode": [{
78114
79307
  name: "deviceId",
78115
79308
  form: "single",
@@ -102216,7 +103409,7 @@ function isMeaningfulIdentifier(s) {
102216
103409
  var HikvisionProviderAddon = class extends BaseDeviceProvider {
102217
103410
  addonId = HIKVISION_ADDON_ID;
102218
103411
  providerName = "Hikvision";
102219
- deviceClasses = { [DeviceType.Camera]: HikvisionCamera };
103412
+ deviceClasses = { [DeviceType.Camera]: widenDeviceConstructor(HikvisionCamera) };
102220
103413
  constructor() {
102221
103414
  super({});
102222
103415
  }
@@ -102269,7 +103462,7 @@ var HikvisionProviderAddon = class extends BaseDeviceProvider {
102269
103462
  throw new Error(`Hikvision: ${reason}`);
102270
103463
  }
102271
103464
  async onInitialize() {
102272
- const regs = await super.onInitialize();
103465
+ const regs = this.providerRegistrationsFromSuper(await super.onInitialize());
102273
103466
  regs.push({
102274
103467
  capability: failureContributionCapability,
102275
103468
  provider: { list: () => intercomFailureReport.list() }