@camstack/addon-provider-petkit 0.2.126 → 0.2.127

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +1318 -129
  2. package/dist/addon.mjs +1318 -129
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -1101,7 +1101,7 @@ var Nodepetkit = class {
1101
1101
  }
1102
1102
  };
1103
1103
  //#endregion
1104
- //#region ../types/dist/event-category-C4hVnRo8.mjs
1104
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
1105
1105
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
1106
1106
  EventCategory["SystemBoot"] = "system.boot";
1107
1107
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -1165,6 +1165,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1165
1165
  * consumes this category and maps it to the `addon-crash-loop` kind.
1166
1166
  */
1167
1167
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
1168
+ /**
1169
+ * A runner whose addon refused to start with a typed reason (D877) - parked
1170
+ * in `refused`, never counted by the crash breaker, retried on operator
1171
+ * action. One event per refusal.
1172
+ */
1173
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
1174
+ /**
1175
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
1176
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
1177
+ * runner is still pending) and the alert centre (close a recovered runner).
1178
+ */
1179
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
1180
+ /**
1181
+ * The node's one-shot runner boot check (D877): planned runners against the
1182
+ * process service, `degraded` when any is failed, refused or missing. The
1183
+ * alert centre turns it into one alert and a direct critical push.
1184
+ */
1185
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
1168
1186
  EventCategory["AddonError"] = "addon.error";
1169
1187
  EventCategory["AddonPageReady"] = "addon.page-ready";
1170
1188
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -6489,7 +6507,7 @@ var ZodIssueCode = {
6489
6507
  var ZodFirstPartyTypeKind;
6490
6508
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6491
6509
  //#endregion
6492
- //#region ../types/dist/sleep-DRqxtc0C.mjs
6510
+ //#region ../types/dist/sleep-BOjuyoPC.mjs
6493
6511
  /**
6494
6512
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6495
6513
  * window to float samples (D455).
@@ -6606,7 +6624,7 @@ function isKeychainStoredField(field) {
6606
6624
  var SECRET_CLEAR = { $secretClear: true };
6607
6625
  /** The `'***'` token D634 redaction writes for non-admins. */
6608
6626
  var LEGACY_DEVICE_REDACTION = "***";
6609
- function isRecord$2(value) {
6627
+ function isRecord$5(value) {
6610
6628
  return typeof value === "object" && value !== null && !Array.isArray(value);
6611
6629
  }
6612
6630
  function makeSecretMarker(ref) {
@@ -6617,12 +6635,12 @@ function makeSecretMarker(ref) {
6617
6635
  }
6618
6636
  /** A stored marker: an object whose `$secret` is a non-empty string. */
6619
6637
  function isSecretMarker(value) {
6620
- if (!isRecord$2(value)) return false;
6638
+ if (!isRecord$5(value)) return false;
6621
6639
  const ref = value["$secret"];
6622
6640
  return typeof ref === "string" && ref.length > 0;
6623
6641
  }
6624
6642
  function isSecretClear(value) {
6625
- return isRecord$2(value) && value["$secretClear"] === true;
6643
+ return isRecord$5(value) && value["$secretClear"] === true;
6626
6644
  }
6627
6645
  /**
6628
6646
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -7232,7 +7250,7 @@ var KeychainWriteRefusedError = class extends Error {
7232
7250
  }
7233
7251
  };
7234
7252
  var KEEP = { kind: "keep" };
7235
- function isRecord$1(value) {
7253
+ function isRecord$4(value) {
7236
7254
  return typeof value === "object" && value !== null && !Array.isArray(value);
7237
7255
  }
7238
7256
  function defaultMintId() {
@@ -7245,7 +7263,7 @@ function collectSecretMarkerRefs(value, out = []) {
7245
7263
  return out;
7246
7264
  }
7247
7265
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
7248
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
7266
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
7249
7267
  return out;
7250
7268
  }
7251
7269
  async function storedValueEquals(secrets, marker, candidate) {
@@ -7300,7 +7318,7 @@ function rowId(row, idKey) {
7300
7318
  return null;
7301
7319
  }
7302
7320
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
7303
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
7321
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
7304
7322
  if (!Array.isArray(incoming)) {
7305
7323
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
7306
7324
  return {
@@ -7316,7 +7334,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
7316
7334
  const kept = /* @__PURE__ */ new Set();
7317
7335
  const rows = [];
7318
7336
  for (const row of incoming) {
7319
- if (!isRecord$1(row)) {
7337
+ if (!isRecord$4(row)) {
7320
7338
  rows.push(row);
7321
7339
  continue;
7322
7340
  }
@@ -7341,7 +7359,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
7341
7359
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
7342
7360
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
7343
7361
  case "object": {
7344
- if (!isRecord$1(incoming)) {
7362
+ if (!isRecord$4(incoming)) {
7345
7363
  if (incoming === void 0) return KEEP;
7346
7364
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
7347
7365
  return {
@@ -7349,7 +7367,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
7349
7367
  value: incoming
7350
7368
  };
7351
7369
  }
7352
- const storedObj = isRecord$1(stored) ? stored : {};
7370
+ const storedObj = isRecord$4(stored) ? stored : {};
7353
7371
  return {
7354
7372
  kind: "value",
7355
7373
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -7472,7 +7490,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
7472
7490
  value: items
7473
7491
  };
7474
7492
  }
7475
- if (isRecord$1(v)) {
7493
+ if (isRecord$4(v)) {
7476
7494
  const out = {};
7477
7495
  for (const [k, child] of Object.entries(v)) {
7478
7496
  const s = substitute(child);
@@ -7504,7 +7522,7 @@ var SecretOverwriteRefusedError = class extends Error {
7504
7522
  this.name = "SecretOverwriteRefusedError";
7505
7523
  }
7506
7524
  };
7507
- function isRecord(value) {
7525
+ function isRecord$3(value) {
7508
7526
  return typeof value === "object" && value !== null && !Array.isArray(value);
7509
7527
  }
7510
7528
  function resolvedValue(pass, marker) {
@@ -7533,7 +7551,7 @@ function inArray(pass, incoming, stored) {
7533
7551
  return incoming.map((item, index) => {
7534
7552
  const twin = stored[index];
7535
7553
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
7536
- if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
7554
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
7537
7555
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
7538
7556
  return item;
7539
7557
  });
@@ -7544,7 +7562,7 @@ function inArrayRow(pass, incoming, stored) {
7544
7562
  const twin = stored[key];
7545
7563
  if (isSecretMarker(twin)) {
7546
7564
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
7547
- } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
7565
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
7548
7566
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
7549
7567
  }
7550
7568
  return out;
@@ -7552,7 +7570,7 @@ function inArrayRow(pass, incoming, stored) {
7552
7570
  async function walk(pass, incoming, stored) {
7553
7571
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
7554
7572
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
7555
- if (!isRecord(incoming) || !isRecord(stored)) return incoming;
7573
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
7556
7574
  const out = { ...incoming };
7557
7575
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
7558
7576
  return out;
@@ -7583,7 +7601,7 @@ async function restoreUnchangedSecrets(input) {
7583
7601
  function isJsonEqual(a, b) {
7584
7602
  if (Object.is(a, b)) return true;
7585
7603
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
7586
- if (isRecord(a) && isRecord(b)) {
7604
+ if (isRecord$3(a) && isRecord$3(b)) {
7587
7605
  const keys = Object.keys(a);
7588
7606
  if (keys.length !== Object.keys(b).length) return false;
7589
7607
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -7607,7 +7625,7 @@ function markerKeysOf(blob, owner) {
7607
7625
  }
7608
7626
  function nodeFromStored(value, owner) {
7609
7627
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
7610
- if (!isRecord(value)) return null;
7628
+ if (!isRecord$3(value)) return null;
7611
7629
  const children = /* @__PURE__ */ new Map();
7612
7630
  for (const [key, child] of Object.entries(value)) {
7613
7631
  const node = nodeFromStored(child, owner);
@@ -7740,7 +7758,6 @@ function createHandle(raw, opts) {
7740
7758
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
7741
7759
  const readAddonStoreResult = raw.readAddonStoreResult;
7742
7760
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
7743
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
7744
7761
  const overrides = {
7745
7762
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
7746
7763
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -7764,12 +7781,12 @@ function createHandle(raw, opts) {
7764
7781
  };
7765
7782
  } } : {},
7766
7783
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
7767
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
7768
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
7784
+ readDeviceStoreBatch: async (deviceIds) => {
7785
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
7769
7786
  const out = /* @__PURE__ */ new Map();
7770
7787
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
7771
7788
  return out;
7772
- } } : {},
7789
+ },
7773
7790
  writeAddonStore: async (patch) => {
7774
7791
  await writeAddon(patch);
7775
7792
  },
@@ -8396,7 +8413,7 @@ var BaseAddon = class {
8396
8413
  if (!ctx) return;
8397
8414
  const addonId = ctx.id;
8398
8415
  setImmediate(() => {
8399
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
8416
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
8400
8417
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
8401
8418
  }).catch((err) => {
8402
8419
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -8596,7 +8613,7 @@ var BaseAddon = class {
8596
8613
  return this._addonSecretTree;
8597
8614
  }
8598
8615
  deviceSecretTree() {
8599
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
8616
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
8600
8617
  return this._deviceSecretTree;
8601
8618
  }
8602
8619
  /**
@@ -8672,42 +8689,135 @@ var BaseAddon = class {
8672
8689
  this[timerOf] = timer;
8673
8690
  }
8674
8691
  /**
8675
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
8676
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
8677
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
8678
- * re-initialize) doesn't propagate up into `initialize()` and leave the
8692
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
8693
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
8679
8694
  * addon permanently broken.
8680
8695
  *
8681
- * Retry only the two known infra fingerprints. Anything else propagates so
8682
- * real bugs surface immediately. After the budget expires we fall back to
8683
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
8696
+ * Two kinds of outage, two budgets:
8697
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
8698
+ * initialized`, `provider not available`): a short budget, then the addon
8699
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
8700
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
8701
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
8702
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
8703
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
8704
+ * loop. A long, bounded budget; only after it the error propagates - the
8705
+ * addon never runs on defaults for a store it could not ask.
8706
+ * Anything else propagates immediately so real bugs surface.
8684
8707
  */
8685
8708
  async readAddonStoreWithRetry() {
8686
8709
  const settings = this.rawSettings();
8687
8710
  if (!settings) return {};
8688
- const delaysMs = [
8689
- 150,
8690
- 350,
8691
- 600,
8692
- 900
8693
- ];
8694
8711
  let lastErr;
8695
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
8712
+ for (let attempt = 0;; attempt++) try {
8696
8713
  const stored = await settings.readAddonStore() ?? {};
8697
8714
  this.settingsStoreReady = true;
8698
8715
  return stored;
8699
8716
  } catch (err) {
8700
8717
  lastErr = err;
8701
- const msg = err instanceof Error ? err.message : String(err);
8702
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
8703
- if (attempt === delaysMs.length) break;
8704
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
8718
+ const kind = classifyStoreError(err);
8719
+ if (kind === "permanent") throw err;
8720
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
8721
+ if (delay === void 0) {
8722
+ if (kind === "transport") throw err;
8723
+ break;
8724
+ }
8725
+ await new Promise((r) => setTimeout(r, delay));
8705
8726
  }
8706
8727
  this.settingsStoreReady = false;
8707
8728
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
8708
8729
  return {};
8709
8730
  }
8710
8731
  };
8732
+ /** The settings store's own restart fingerprints. */
8733
+ var RESTART_RETRY_DELAYS_MS = [
8734
+ 150,
8735
+ 350,
8736
+ 600,
8737
+ 900
8738
+ ];
8739
+ /** A hub restarting under a booting runner: ~100 s in total. */
8740
+ var TRANSPORT_RETRY_DELAYS_MS = [
8741
+ 150,
8742
+ 350,
8743
+ 600,
8744
+ 900,
8745
+ 2e3,
8746
+ 5e3,
8747
+ 1e4,
8748
+ 2e4,
8749
+ 3e4,
8750
+ 3e4
8751
+ ];
8752
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
8753
+ /** Node / socket error codes of a connection that did not happen or broke. */
8754
+ var TRANSPORT_CODES = new Set([
8755
+ "ECONNREFUSED",
8756
+ "ECONNRESET",
8757
+ "ETIMEDOUT",
8758
+ "EPIPE",
8759
+ "EHOSTUNREACH",
8760
+ "ENETUNREACH"
8761
+ ]);
8762
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
8763
+ var UNAVAILABLE_TRPC_CODES = new Set([
8764
+ "TIMEOUT",
8765
+ "SERVICE_UNAVAILABLE",
8766
+ "BAD_GATEWAY",
8767
+ "GATEWAY_TIMEOUT"
8768
+ ]);
8769
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
8770
+ var TRANSPORT_PHRASES = [
8771
+ "discovery deadline exceeded",
8772
+ "parent could not route child unowned cap call",
8773
+ "UDS request timed out after",
8774
+ "channel closed"
8775
+ ];
8776
+ /** Moleculer error `type`s of a call that could not be served right now. */
8777
+ var MOLECULER_TRANSIENT_TYPES = new Set([
8778
+ "REQUEST_TIMEOUT",
8779
+ "SERVICE_NOT_FOUND",
8780
+ "SERVICE_NOT_AVAILABLE",
8781
+ "REQUEST_REJECTED",
8782
+ "BROKER_DISCONNECTED"
8783
+ ]);
8784
+ function stringProp(value, key) {
8785
+ if (typeof value !== "object" || value === null) return void 0;
8786
+ const found = Reflect.get(value, key);
8787
+ return typeof found === "string" ? found : void 0;
8788
+ }
8789
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
8790
+ function errorCode(err) {
8791
+ const out = {};
8792
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
8793
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
8794
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
8795
+ if (node !== void 0) out.node = node;
8796
+ const trpc = stringProp(data, "code");
8797
+ if (trpc !== void 0) out.trpc = trpc;
8798
+ return out;
8799
+ }
8800
+ /**
8801
+ * Is a settings read failure worth retrying, and with which budget? Only
8802
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
8803
+ * one of the exact phrases our own transport raises. A message that merely
8804
+ * contains "timed out" or "unreachable" is not evidence of anything, and
8805
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
8806
+ */
8807
+ function classifyStoreError(err) {
8808
+ const message = err instanceof Error ? err.message : String(err);
8809
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
8810
+ const code = errorCode(err);
8811
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
8812
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
8813
+ if (typeof err === "object" && err !== null) {
8814
+ if (Reflect.get(err, "retryable") === true) return "transport";
8815
+ const type = stringProp(err, "type");
8816
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
8817
+ }
8818
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
8819
+ return "permanent";
8820
+ }
8711
8821
  /**
8712
8822
  * Collect the keys of every field marked `perNode: true`, recursing into
8713
8823
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -8797,6 +8907,156 @@ var PeerBytesTicketSchema = object({
8797
8907
  */
8798
8908
  declaredBytes: number().int().nonnegative().nullable()
8799
8909
  });
8910
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
8911
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
8912
+ var RECORD_DATABASES = ["settings", "events"];
8913
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
8914
+ var RECORD_CLASSES = [
8915
+ "config",
8916
+ "ledger",
8917
+ "audit",
8918
+ "mirror",
8919
+ "ephemeral"
8920
+ ];
8921
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
8922
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
8923
+ var RECORD_BATCH_MAX = 1e3;
8924
+ var RECORD_QUERY_MAX = 1e3;
8925
+ function defOf(schema) {
8926
+ const zodBag = Reflect.get(schema, "_zod");
8927
+ if (typeof zodBag !== "object" || zodBag === null) return {};
8928
+ const def = Reflect.get(zodBag, "def");
8929
+ if (typeof def !== "object" || def === null) return {};
8930
+ return def;
8931
+ }
8932
+ function declaredHere(schema) {
8933
+ return globalRegistry.get(schema)?.secret === true;
8934
+ }
8935
+ /** Wrapper kinds whose `innerType` is the field itself. */
8936
+ var WRAPPERS = new Set([
8937
+ "optional",
8938
+ "nullable",
8939
+ "default",
8940
+ "prefault",
8941
+ "catch",
8942
+ "readonly",
8943
+ "nonoptional"
8944
+ ]);
8945
+ /**
8946
+ * The schema layers that make up ONE field: the schema itself and every
8947
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
8948
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8949
+ * `.transform` on `in`).
8950
+ */
8951
+ function layersOf(schema) {
8952
+ const out = [];
8953
+ const queue = [schema];
8954
+ while (queue.length > 0) {
8955
+ const s = queue.shift();
8956
+ if (!s || out.includes(s)) continue;
8957
+ out.push(s);
8958
+ const def = defOf(s);
8959
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8960
+ if (def.type === "pipe") {
8961
+ if (def.in) queue.push(def.in);
8962
+ if (def.out) queue.push(def.out);
8963
+ }
8964
+ }
8965
+ return out;
8966
+ }
8967
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
8968
+ function isZodSecret(schema) {
8969
+ return layersOf(schema).some(declaredHere);
8970
+ }
8971
+ /**
8972
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
8973
+ * element of this array" (`connection.password`, `rows[].token`). A declared
8974
+ * object or array is reported as one path and not descended into — everything
8975
+ * under it is secret.
8976
+ */
8977
+ function collectZodSecretPaths(schema, prefix = "") {
8978
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8979
+ const paths = [];
8980
+ for (const layer of layersOf(schema)) {
8981
+ const def = defOf(layer);
8982
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8983
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8984
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8985
+ else if (def.type === "intersection") {
8986
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8987
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8988
+ }
8989
+ }
8990
+ return [...new Set(paths)];
8991
+ }
8992
+ /**
8993
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
8994
+ * Zod row schema that describes it, and the helper that turns the two into the
8995
+ * JSON the engine stores.
8996
+ *
8997
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
8998
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
8999
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
9000
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
9001
+ * never a field name (D879).
9002
+ */
9003
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
9004
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
9005
+ var RecordIndexSchema = object({
9006
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
9007
+ fields: array(RecordFieldPathSchema).min(1).max(4),
9008
+ unique: boolean().optional()
9009
+ }).strict();
9010
+ var RecordRetentionSchema = union([
9011
+ object({
9012
+ ttlMs: number().int().positive(),
9013
+ from: _enum(["at", "write"])
9014
+ }).strict(),
9015
+ object({
9016
+ maxRows: number().int().positive().optional(),
9017
+ maxRowsPerDevice: number().int().positive().optional()
9018
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
9019
+ object({
9020
+ owner: string().min(1),
9021
+ reason: string().min(1)
9022
+ }).strict(),
9023
+ object({ none: string().min(1) }).strict()
9024
+ ]);
9025
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
9026
+ var EntryDescriptorSchema = object({
9027
+ title: string().min(1),
9028
+ /** The record body field shown as the entry's name. */
9029
+ nameField: string().min(1),
9030
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
9031
+ fields: record(string(), unknown())
9032
+ }).strict();
9033
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
9034
+ var RecordKindDeclarationSchema = object({
9035
+ database: _enum(RECORD_DATABASES).default("settings"),
9036
+ class: _enum(RECORD_CLASSES),
9037
+ writeTrigger: string().min(1),
9038
+ device: _enum([
9039
+ "required",
9040
+ "optional",
9041
+ "none"
9042
+ ]).default("none"),
9043
+ at: _enum(["required", "none"]).default("none"),
9044
+ indexes: array(RecordIndexSchema).max(8).default([]),
9045
+ retention: RecordRetentionSchema,
9046
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
9047
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
9048
+ /** Derived from the Zod schema; never written by hand. */
9049
+ secretPaths: array(string().min(1)).default([]),
9050
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
9051
+ secretArrayKeys: record(string(), string()).default({}),
9052
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
9053
+ adoptsFrom: string().min(1).optional(),
9054
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
9055
+ transactFamily: string().min(1).optional(),
9056
+ entry: EntryDescriptorSchema.optional()
9057
+ }).strict();
9058
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
9059
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
8800
9060
  /** Shared Zod schemas used across streaming capabilities. */
8801
9061
  var CamProfileSchema = _enum([
8802
9062
  "high",
@@ -9261,75 +9521,12 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
9261
9521
  kind: "mutation",
9262
9522
  auth: "admin"
9263
9523
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
9264
- function defOf(schema) {
9265
- return schema._zod?.def ?? {};
9266
- }
9267
- function declaredHere(schema) {
9268
- return globalRegistry.get(schema)?.secret === true;
9269
- }
9270
- /** Wrapper kinds whose `innerType` is the field itself. */
9271
- var WRAPPERS = new Set([
9272
- "optional",
9273
- "nullable",
9274
- "default",
9275
- "prefault",
9276
- "catch",
9277
- "readonly",
9278
- "nonoptional"
9279
- ]);
9280
- /**
9281
- * The schema layers that make up ONE field: the schema itself and every
9282
- * wrapper below it (optional / default / nullable / readonly / catch), plus
9283
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
9284
- * `.transform` on `in`).
9285
- */
9286
- function layersOf(schema) {
9287
- const out = [];
9288
- const queue = [schema];
9289
- while (queue.length > 0) {
9290
- const s = queue.shift();
9291
- if (!s || out.includes(s)) continue;
9292
- out.push(s);
9293
- const def = defOf(s);
9294
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
9295
- if (def.type === "pipe") {
9296
- if (def.in) queue.push(def.in);
9297
- if (def.out) queue.push(def.out);
9298
- }
9299
- }
9300
- return out;
9301
- }
9302
- /** True when any layer of this field declares `.meta({ secret: true })`. */
9303
- function isZodSecret(schema) {
9304
- return layersOf(schema).some(declaredHere);
9305
- }
9306
- /**
9307
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
9308
- * element of this array" (`connection.password`, `rows[].token`). A declared
9309
- * object or array is reported as one path and not descended into — everything
9310
- * under it is secret.
9311
- */
9312
- function collectZodSecretPaths(schema, prefix = "") {
9313
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
9314
- const paths = [];
9315
- for (const layer of layersOf(schema)) {
9316
- const def = defOf(layer);
9317
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
9318
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
9319
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
9320
- else if (def.type === "intersection") {
9321
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
9322
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
9323
- }
9324
- }
9325
- return [...new Set(paths)];
9326
- }
9327
9524
  object({
9328
9525
  code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
9329
9526
  params: record(string(), union([string(), number()])).optional()
9330
9527
  });
9331
9528
  //#endregion
9332
- //#region ../types/dist/err-msg-DLerKiVO.mjs
9529
+ //#region ../types/dist/err-msg-BXKzRBwg.mjs
9333
9530
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
9334
9531
  DeviceType["Camera"] = "camera";
9335
9532
  DeviceType["Hub"] = "hub";
@@ -9421,6 +9618,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
9421
9618
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
9422
9619
  * integrations sharing the same food/desiccant/hopper surface. */
9423
9620
  DeviceType["PetFeeder"] = "pet-feeder";
9621
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
9622
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
9623
+ * Sources: native Bosch Home Connect, reusable by similar integrations. */
9624
+ DeviceType["Dishwasher"] = "dishwasher";
9424
9625
  return DeviceType;
9425
9626
  }({});
9426
9627
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -9598,6 +9799,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
9598
9799
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
9599
9800
  * real Switch device for UI rendering / export adapters. */
9600
9801
  DeviceRole["BinaryHelper"] = "binary-helper";
9802
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
9803
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
9804
+ DeviceRole["Outlet"] = "outlet";
9601
9805
  /** Generic motion / occupancy / moving event source. Distinct from
9602
9806
  * the camera accessory PirSensor role: that one is a camera child;
9603
9807
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -9675,7 +9879,7 @@ function errMsg(err) {
9675
9879
  return String(err);
9676
9880
  }
9677
9881
  //#endregion
9678
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
9882
+ //#region ../types/dist/composition-CB6PMT9p.mjs
9679
9883
  /**
9680
9884
  * The ffmpeg build every CamStack node downloads, per platform and arch.
9681
9885
  *
@@ -12879,11 +13083,10 @@ var ClipModelMetaSchema = object({
12879
13083
  /**
12880
13084
  * The `vector-store` index this model's vectors live in. ONE feature space
12881
13085
  * per index: two models share an index only when their vectors are ranked
12882
- * against each other, which for CLIP means never across families. MobileCLIP
12883
- * S1 and S2 share `object-clip` for history (separated by the row's
12884
- * `modelId`); any other model gets its own.
13086
+ * against each other, which for CLIP means never across families. Every
13087
+ * model gets its own.
12885
13088
  */
12886
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
13089
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
12887
13090
  /**
12888
13091
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
12889
13092
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -14062,8 +14265,13 @@ var AlertSeveritySchema = _enum([
14062
14265
  "info",
14063
14266
  "success",
14064
14267
  "warning",
14065
- "error"
14268
+ "error",
14269
+ "critical"
14066
14270
  ]);
14271
+ var AlertActionSchema = object({
14272
+ label: string(),
14273
+ href: string().optional()
14274
+ });
14067
14275
  var AlertStatusSchema = _enum([
14068
14276
  "active",
14069
14277
  "in-progress",
@@ -14081,6 +14289,7 @@ var AlertSchema = object({
14081
14289
  severity: AlertSeveritySchema,
14082
14290
  title: string(),
14083
14291
  message: string(),
14292
+ action: AlertActionSchema.optional(),
14084
14293
  status: AlertStatusSchema,
14085
14294
  progress: number().optional(),
14086
14295
  read: boolean(),
@@ -16616,6 +16825,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
16616
16825
  keyField: string()
16617
16826
  }).optional()
16618
16827
  })) });
16828
+ /**
16829
+ * The report of a one-shot "move this owner's plaintext secrets into the
16830
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
16831
+ *
16832
+ * The owner runs it on its own rows, through its own write path; an operator
16833
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
16834
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
16835
+ */
16836
+ var RawSecretMigrationInputSchema = object({
16837
+ /** `false` (the default of the script) = report only. */
16838
+ apply: boolean() });
16839
+ var RawSecretMigrationReportSchema = object({
16840
+ apply: boolean(),
16841
+ /** Rows that can carry a secret (a profile, an enrolment). */
16842
+ rows: number().int(),
16843
+ /** Rows whose secret was plaintext when the run started. */
16844
+ raw: number().int(),
16845
+ /** Rows that already held a keychain marker when the run started. */
16846
+ markers: number().int(),
16847
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
16848
+ migrated: number().int(),
16849
+ /** Plaintext rows left in place because the move or its read-back failed. */
16850
+ failed: number().int(),
16851
+ /** After the run: rows still holding plaintext. */
16852
+ remainingRaw: number().int(),
16853
+ /** After the run: markers the keychain could not resolve right now. */
16854
+ unresolvedMarkers: number().int(),
16855
+ /**
16856
+ * A second, redundant copy of the secrets' rows that the run found (and, on
16857
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
16858
+ */
16859
+ redundantCopies: number().int().optional(),
16860
+ /** True when nothing is raw and every marker resolves. */
16861
+ verified: boolean()
16862
+ });
16619
16863
  /** Where a block runs. The operator chooses — a block driving a device on an
16620
16864
  * agent is the reason placement is not fixed to the hub. */
16621
16865
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -16842,6 +17086,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
16842
17086
  }), SettingsUpdateResultSchema, {
16843
17087
  kind: "mutation",
16844
17088
  auth: "admin"
17089
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
17090
+ kind: "mutation",
17091
+ auth: "admin"
16845
17092
  }), method(object({}), object({ libs: array(object({
16846
17093
  filePath: string(),
16847
17094
  content: string()
@@ -17105,6 +17352,347 @@ id: union([string(), number()]) }), {
17105
17352
  auth: "admin"
17106
17353
  });
17107
17354
  /**
17355
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
17356
+ * config documents, mirrors. The third storage API next to `ctx.settings`
17357
+ * (operator intent, D870) and device-history (numbers over time, D850).
17358
+ *
17359
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
17360
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
17361
+ * that with the addon id closed over). It is deliberately NOT in any input
17362
+ * schema, so a session can never supply it, and a call with no stamp is refused
17363
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
17364
+ * addons go through the owner's capability.
17365
+ *
17366
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
17367
+ * never `[]`. Secret fields are never on the wire: a read shows the
17368
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
17369
+ * resolves itself, and a write may carry only a keychain marker bound to the
17370
+ * row's own ref.
17371
+ *
17372
+ * Internal: addons reach it through `ctx.records`, never directly.
17373
+ */
17374
+ var RecordIdSchema = string().min(1).max(256);
17375
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
17376
+ var RecordBodySchema = record(string(), unknown());
17377
+ var RecordInputSchema = object({
17378
+ id: RecordIdSchema,
17379
+ /** The device this row belongs to (D865 removal, per-device reads). */
17380
+ deviceId: number().int().optional(),
17381
+ /** The domain clock, ms: observed / created / opened. */
17382
+ at: number().int().optional(),
17383
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
17384
+ expiresAt: number().int().optional(),
17385
+ data: RecordBodySchema
17386
+ });
17387
+ var RecordViewSchema = object({
17388
+ id: string(),
17389
+ deviceId: number().int().nullable(),
17390
+ at: number().nullable(),
17391
+ expiresAt: number().nullable(),
17392
+ rev: number().int(),
17393
+ updatedAt: number(),
17394
+ data: RecordBodySchema
17395
+ });
17396
+ /** Declared index fields only. Anything else does not compile, by design. */
17397
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
17398
+ string(),
17399
+ number(),
17400
+ boolean(),
17401
+ object({ in: array(union([
17402
+ string(),
17403
+ number(),
17404
+ boolean()
17405
+ ])).min(1).max(RECORD_BATCH_MAX) }),
17406
+ object({
17407
+ gt: union([string(), number()]).optional(),
17408
+ gte: union([string(), number()]).optional(),
17409
+ lt: union([string(), number()]).optional(),
17410
+ lte: union([string(), number()]).optional()
17411
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
17412
+ ]));
17413
+ var KindShape = { kind: RecordKindNameSchema };
17414
+ var TimeWindowShape = {
17415
+ deviceId: number().int().optional(),
17416
+ atFrom: number().optional(),
17417
+ atTo: number().optional()
17418
+ };
17419
+ var RecordQueryInputSchema = object({
17420
+ ...KindShape,
17421
+ ...TimeWindowShape,
17422
+ where: RecordWhereSchema.optional(),
17423
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
17424
+ order: _enum(["at", "id"]).optional(),
17425
+ desc: boolean().optional(),
17426
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
17427
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
17428
+ cursor: string().min(1).optional()
17429
+ });
17430
+ var RecordQueryResultSchema = object({
17431
+ records: array(RecordViewSchema),
17432
+ nextCursor: string().nullable()
17433
+ });
17434
+ var RecordKindStateSchema = _enum([
17435
+ "created",
17436
+ "unchanged",
17437
+ "updated"
17438
+ ]);
17439
+ var DeclareKindResultSchema = object({
17440
+ kindId: number().int(),
17441
+ state: RecordKindStateSchema,
17442
+ createdIndexes: array(string()),
17443
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
17444
+ adoptionPending: object({
17445
+ legacyTable: string(),
17446
+ legacyRows: number().int()
17447
+ }).nullable()
17448
+ });
17449
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
17450
+ var SecretRefsList = array(string());
17451
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
17452
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
17453
+ kind: "mutation",
17454
+ auth: "admin"
17455
+ }), method(object({
17456
+ ...KindShape,
17457
+ id: RecordIdSchema
17458
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
17459
+ ...KindShape,
17460
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
17461
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
17462
+ ...KindShape,
17463
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
17464
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
17465
+ ...KindShape,
17466
+ record: RecordInputSchema,
17467
+ /** Compare-and-set. `0` means "the row must not exist". */
17468
+ ifRev: number().int().min(0).optional()
17469
+ }), object({
17470
+ rev: number().int(),
17471
+ releasedRefs: SecretRefsList
17472
+ }), {
17473
+ kind: "mutation",
17474
+ auth: "admin"
17475
+ }), method(object({
17476
+ ...KindShape,
17477
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
17478
+ }), object({
17479
+ count: number().int(),
17480
+ releasedRefs: SecretRefsList
17481
+ }), {
17482
+ kind: "mutation",
17483
+ auth: "admin"
17484
+ }), method(object({
17485
+ ...KindShape,
17486
+ id: RecordIdSchema,
17487
+ data: RecordBodySchema,
17488
+ at: number().int().nullable().optional(),
17489
+ expiresAt: number().int().nullable().optional(),
17490
+ ifRev: number().int().min(1).optional()
17491
+ }), object({
17492
+ rev: number().int(),
17493
+ releasedRefs: SecretRefsList
17494
+ }), {
17495
+ kind: "mutation",
17496
+ auth: "admin"
17497
+ }), method(object({
17498
+ ...KindShape,
17499
+ id: RecordIdSchema
17500
+ }), object({
17501
+ deleted: boolean(),
17502
+ secretRefs: SecretRefsList
17503
+ }), {
17504
+ kind: "mutation",
17505
+ auth: "admin"
17506
+ }), method(object({
17507
+ ...KindShape,
17508
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
17509
+ }), object({
17510
+ deleted: number().int(),
17511
+ secretRefs: SecretRefsList
17512
+ }), {
17513
+ kind: "mutation",
17514
+ auth: "admin"
17515
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
17516
+ ...KindShape,
17517
+ ...TimeWindowShape,
17518
+ where: RecordWhereSchema.optional()
17519
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
17520
+ ...KindShape,
17521
+ deviceId: number().int().optional(),
17522
+ from: number(),
17523
+ to: number(),
17524
+ bucketMs: number().int().positive()
17525
+ }), object({ buckets: array(object({
17526
+ bucketStart: number(),
17527
+ count: number().int()
17528
+ })) }), { auth: "admin" }), method(object({
17529
+ ...KindShape,
17530
+ op: _enum([
17531
+ "sum",
17532
+ "min",
17533
+ "max",
17534
+ "count"
17535
+ ]),
17536
+ field: RecordFieldPathSchema.optional(),
17537
+ groupBy: RecordFieldPathSchema.optional(),
17538
+ where: RecordWhereSchema.optional()
17539
+ }), object({ rows: array(object({
17540
+ group: union([
17541
+ string(),
17542
+ number(),
17543
+ _null()
17544
+ ]),
17545
+ value: number().nullable()
17546
+ })) }), { auth: "admin" }), method(object({
17547
+ ...KindShape,
17548
+ deviceId: number().int().optional(),
17549
+ atBefore: number().optional(),
17550
+ where: RecordWhereSchema.optional()
17551
+ }), object({
17552
+ deleted: number().int(),
17553
+ secretRefs: SecretRefsList
17554
+ }), {
17555
+ kind: "mutation",
17556
+ auth: "admin"
17557
+ }), method(object({
17558
+ deviceId: number().int(),
17559
+ kinds: array(RecordKindNameSchema).optional()
17560
+ }), object({
17561
+ deleted: record(string(), number().int()),
17562
+ secretRefs: SecretRefsList
17563
+ }), {
17564
+ kind: "mutation",
17565
+ auth: "admin"
17566
+ }), method(object(KindShape), object({ id: number().int() }), {
17567
+ kind: "mutation",
17568
+ auth: "admin"
17569
+ });
17570
+ /** One table of the settings database. */
17571
+ var StorageTableSchema = object({
17572
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
17573
+ name: string(),
17574
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
17575
+ owner: string().nullable(),
17576
+ rows: number().int().nonnegative(),
17577
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
17578
+ bytes: number().int().nonnegative().nullable(),
17579
+ /** Declared by an addon since this engine process started (a running addon claims it). */
17580
+ declaredThisBoot: boolean()
17581
+ });
17582
+ /** One declared record kind (D881) as System -> Data shows it. */
17583
+ var StorageKindSchema = object({
17584
+ owner: string(),
17585
+ kind: string(),
17586
+ database: _enum(["settings", "events"]),
17587
+ class: string(),
17588
+ state: _enum([
17589
+ "declared",
17590
+ "orphaned",
17591
+ "dropped"
17592
+ ]),
17593
+ /** `null` when the caller asked for no counts (`counts: false`). */
17594
+ rows: number().int().nonnegative().nullable(),
17595
+ /** Rows x the average size of a sample; null for an empty kind. */
17596
+ bytesEstimate: number().int().nonnegative().nullable(),
17597
+ writeTrigger: string(),
17598
+ retention: RecordRetentionSchema,
17599
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
17600
+ entry: boolean(),
17601
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
17602
+ declaration: RecordKindDeclarationSchema
17603
+ });
17604
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
17605
+ collection: string().min(1),
17606
+ expectRows: number().int().nonnegative()
17607
+ }), object({
17608
+ dropped: literal(true),
17609
+ rows: number().int().nonnegative()
17610
+ }), {
17611
+ kind: "mutation",
17612
+ auth: "admin"
17613
+ }), method(object({
17614
+ owner: string().min(1).optional(),
17615
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
17616
+ counts: boolean().optional()
17617
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
17618
+ owner: string().min(1),
17619
+ kind: RecordKindNameSchema
17620
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
17621
+ owner: string().min(1),
17622
+ kind: RecordKindNameSchema,
17623
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
17624
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
17625
+ complete: boolean().optional()
17626
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
17627
+ kind: "mutation",
17628
+ auth: "admin"
17629
+ }), method(object({
17630
+ collection: string().min(1),
17631
+ cursor: string().optional(),
17632
+ limit: number().int().min(1).max(1e3).optional()
17633
+ }), object({
17634
+ rows: array(object({
17635
+ id: string(),
17636
+ data: record(string(), unknown())
17637
+ })),
17638
+ nextCursor: string().nullable()
17639
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
17640
+ /**
17641
+ * record-entries - the ONE admin surface for every list of user-created entries
17642
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
17643
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
17644
+ *
17645
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
17646
+ * the entry body with `secret: true` on every credential field, so a password
17647
+ * field is derived from the schema and never from a name. `putEntry` takes the
17648
+ * redaction token for an untouched secret (the stored value is kept), a string
17649
+ * for a new one, and the clear instruction to remove one. A read never carries
17650
+ * a secret value, and a locked keychain refuses the write with
17651
+ * `records/secret-unavailable` instead of storing plaintext.
17652
+ *
17653
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
17654
+ */
17655
+ var EntryKindInfoSchema = object({
17656
+ owner: string(),
17657
+ kind: RecordKindNameSchema,
17658
+ title: string(),
17659
+ nameField: string(),
17660
+ /** JSON Schema of the body; `secret: true` marks a password field. */
17661
+ fields: record(string(), unknown()),
17662
+ secretPaths: array(string()),
17663
+ rows: number().int().nonnegative()
17664
+ });
17665
+ var EntryViewSchema = object({
17666
+ id: RecordIdSchema,
17667
+ name: string(),
17668
+ rev: number().int(),
17669
+ updatedAt: number(),
17670
+ /** Secret fields hold the redaction token. */
17671
+ data: RecordBodySchema
17672
+ });
17673
+ var EntryAddress = {
17674
+ owner: string().min(1),
17675
+ kind: RecordKindNameSchema
17676
+ };
17677
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
17678
+ ...EntryAddress,
17679
+ id: RecordIdSchema.optional(),
17680
+ data: RecordBodySchema,
17681
+ ifRev: number().int().min(1).optional()
17682
+ }), object({
17683
+ id: string(),
17684
+ rev: number().int()
17685
+ }), {
17686
+ kind: "mutation",
17687
+ auth: "admin"
17688
+ }), method(object({
17689
+ ...EntryAddress,
17690
+ id: RecordIdSchema
17691
+ }), object({ deleted: boolean() }), {
17692
+ kind: "mutation",
17693
+ auth: "admin"
17694
+ });
17695
+ /**
17108
17696
  * `keychain` — the hub's encrypted store of secret values (D787).
17109
17697
  *
17110
17698
  * Settings blobs never hold a secret: they hold a marker
@@ -17645,6 +18233,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
17645
18233
  kind: "mutation",
17646
18234
  auth: "admin",
17647
18235
  caller: "required"
18236
+ }), method(object({
18237
+ ref: string().min(1),
18238
+ value: string().min(1)
18239
+ }), object({
18240
+ ref: string(),
18241
+ version: number().int()
18242
+ }), {
18243
+ kind: "mutation",
18244
+ auth: "admin",
18245
+ caller: "required"
17648
18246
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
17649
18247
  deleted: array(string()).readonly(),
17650
18248
  kept: array(object({
@@ -40323,6 +40921,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40323
40921
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
40324
40922
  kind: "mutation",
40325
40923
  auth: "admin"
40924
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
40925
+ kind: "mutation",
40926
+ auth: "admin"
40326
40927
  }), method(ProfileRefInputSchema, _void(), {
40327
40928
  kind: "mutation",
40328
40929
  auth: "admin"
@@ -50832,6 +51433,41 @@ var ServerRollbackInfoSchema = object({
50832
51433
  atMs: number(),
50833
51434
  reason: string()
50834
51435
  });
51436
+ /**
51437
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
51438
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
51439
+ * service holds, because only the hub plans) against the states the process
51440
+ * service reports. Kept in memory, recomputed by the same one-shot check after
51441
+ * every boot, served on `getServerPackageStatus`.
51442
+ *
51443
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
51444
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
51445
+ * planned runner the process service has no entry for.
51446
+ */
51447
+ var RunnerRefusalSchema = object({
51448
+ runnerId: string(),
51449
+ addonIds: array(string()),
51450
+ reason: string()
51451
+ });
51452
+ var RunnerBootCheckSchema = object({
51453
+ checkedAtMs: number(),
51454
+ /** Runners planned for this node. */
51455
+ expected: number(),
51456
+ /** Planned runners whose process is `running`. */
51457
+ running: number(),
51458
+ failed: array(string()),
51459
+ refused: array(RunnerRefusalSchema),
51460
+ missing: array(string()),
51461
+ /**
51462
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
51463
+ * respawn. The check is FINAL only when this is empty; until then nothing is
51464
+ * pushed and the verdict is re-evaluated on the next runner state change.
51465
+ * Optional for version skew (absent = settled).
51466
+ */
51467
+ pending: array(string()).optional(),
51468
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
51469
+ planKnown: boolean()
51470
+ });
50835
51471
  var ServerPackageStatusSchema = object({
50836
51472
  /** Root package name (`@camstack/server` on the hub). */
50837
51473
  packageName: string(),
@@ -50894,7 +51530,14 @@ var ServerPackageStatusSchema = object({
50894
51530
  * for version skew: an older provider's payload simply omits it, and an
50895
51531
  * absent wrapper is unknown — never `native`.
50896
51532
  */
50897
- wrapper: WrapperIdentitySchema.optional()
51533
+ wrapper: WrapperIdentitySchema.optional(),
51534
+ /**
51535
+ * What this node PLANNED to run against what its process service reports
51536
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
51537
+ * on a provider that predates it. Absent is "not checked yet", never "all
51538
+ * well": a consumer that needs the answer treats it as pending.
51539
+ */
51540
+ runners: RunnerBootCheckSchema.optional()
50898
51541
  });
50899
51542
  var ServerUpdateCheckResultSchema = object({
50900
51543
  packageName: string(),
@@ -50945,6 +51588,13 @@ var ServerUpdateOutcomeSchema = _enum([
50945
51588
  "refused",
50946
51589
  "failed"
50947
51590
  ]);
51591
+ /** One addon the pre-flight found the target version would refuse (D877). */
51592
+ var UpdateBlockerSchema = object({
51593
+ addonId: string(),
51594
+ reason: string(),
51595
+ /** What the operator does about it. */
51596
+ remedy: string()
51597
+ });
50948
51598
  var ServerUpdateActionResultSchema = object({
50949
51599
  accepted: boolean(),
50950
51600
  targetVersion: string().nullable(),
@@ -50962,14 +51612,27 @@ var ServerUpdateActionResultSchema = object({
50962
51612
  * The failure itself, verbatim enough to act on (the npm output for a
50963
51613
  * staging install). Non-null only for `failed`.
50964
51614
  */
50965
- error: string().nullable().optional()
51615
+ error: string().nullable().optional(),
51616
+ /**
51617
+ * The addons the target version would refuse to start on this node's live
51618
+ * store (D877), present when the pre-flight refused the update
51619
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
51620
+ */
51621
+ blockers: array(UpdateBlockerSchema).optional()
50966
51622
  });
50967
51623
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
50968
51624
  kind: "mutation",
50969
51625
  auth: "admin"
50970
- }), method(object({
50971
- /** Explicit target version; omitted = latest from the registry. */
50972
- version: string().optional() }), ServerUpdateActionResultSchema, {
51626
+ }), method(object({
51627
+ /** Explicit target version; omitted = latest from the registry. */
51628
+ version: string().optional(),
51629
+ /**
51630
+ * Apply even though the pre-flight (D877) found addons the target would
51631
+ * refuse to start. Off by default: those addons stay down until the
51632
+ * remedy is run, which is the incident this gate exists to prevent.
51633
+ */
51634
+ acknowledgeRefusals: boolean().optional()
51635
+ }), ServerUpdateActionResultSchema, {
50973
51636
  kind: "mutation",
50974
51637
  auth: "admin",
50975
51638
  timeoutMs: 16 * 6e4
@@ -53415,7 +54078,9 @@ var ManifestShapeSchema = object({
53415
54078
  var AddonProcessSchema = object({
53416
54079
  pid: number().optional(),
53417
54080
  mode: string(),
53418
- state: string()
54081
+ state: string(),
54082
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
54083
+ reason: string().optional()
53419
54084
  });
53420
54085
  /**
53421
54086
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -54183,7 +54848,8 @@ var batteryCapability = {
54183
54848
  DeviceType.Button,
54184
54849
  DeviceType.Switch,
54185
54850
  DeviceType.PetFeeder,
54186
- DeviceType.Container
54851
+ DeviceType.Container,
54852
+ DeviceType.Thermostat
54187
54853
  ],
54188
54854
  methods: {
54189
54855
  /**
@@ -54804,6 +55470,12 @@ var ClimateControlStatusSchema = object({
54804
55470
  /** Horizontal louver swing on/off. Null when the device has no
54805
55471
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
54806
55472
  swingHorizontal: boolean().nullable(),
55473
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
55474
+ minTemp: number().nullable().optional(),
55475
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
55476
+ maxTemp: number().nullable().optional(),
55477
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
55478
+ tempStep: number().positive().nullable().optional(),
54807
55479
  /** Ms epoch when the slice was last updated (push or command). */
54808
55480
  lastFetchedAt: number()
54809
55481
  });
@@ -55658,6 +56330,125 @@ onStatusChanged: { data: object({
55658
56330
  * whether persisting is worth a SQLite commit. */
55659
56331
  volatileStateFields: ["lastChangedAt"]
55660
56332
  };
56333
+ /**
56334
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
56335
+ * consumable levels (salt, rinse aid) and common program options.
56336
+ *
56337
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
56338
+ * by any integration that exposes the same program / option surface.
56339
+ *
56340
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
56341
+ * provider refreshes the slice on an interval and eagerly after commands.
56342
+ */
56343
+ var DishwasherStateSchema = _enum([
56344
+ "idle",
56345
+ "running",
56346
+ "paused",
56347
+ "finished",
56348
+ "error",
56349
+ "unavailable"
56350
+ ]);
56351
+ var DishwasherConsumableLevelSchema = _enum([
56352
+ "ok",
56353
+ "low",
56354
+ "empty"
56355
+ ]);
56356
+ var DishwasherStatusSchema = object({
56357
+ state: DishwasherStateSchema,
56358
+ /** Active program id/name, or null when none selected / unknown. */
56359
+ program: string().nullable(),
56360
+ /** Program tokens the hardware accepts — drives the UI selector. */
56361
+ availablePrograms: array(string()),
56362
+ /** Minutes remaining on the active cycle, or null when not running. */
56363
+ remainingMinutes: number().int().nonnegative().nullable(),
56364
+ /** Cycle completion 0..100, or null when not applicable. */
56365
+ progressPercent: number().min(0).max(100).nullable(),
56366
+ /** True when the door is reported open. */
56367
+ doorOpen: boolean(),
56368
+ /** True when remote start is allowed (door closed, power on, etc.). */
56369
+ remoteStartAllowed: boolean(),
56370
+ /** Main power / switched-on state. */
56371
+ powerOn: boolean(),
56372
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
56373
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
56374
+ halfLoad: boolean(),
56375
+ hygienePlus: boolean(),
56376
+ errorCode: number().nullable(),
56377
+ errorLabel: string().nullable(),
56378
+ lastFetchedAt: number()
56379
+ });
56380
+ var dishwasherCapability = {
56381
+ name: "dishwasher",
56382
+ scope: "device",
56383
+ deviceNative: true,
56384
+ mode: "singleton",
56385
+ deviceTypes: [DeviceType.Dishwasher],
56386
+ methods: {
56387
+ start: method(object({ deviceId: number().int().nonnegative() }), _void(), {
56388
+ kind: "mutation",
56389
+ auth: "protected"
56390
+ }),
56391
+ pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
56392
+ kind: "mutation",
56393
+ auth: "protected"
56394
+ }),
56395
+ stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
56396
+ kind: "mutation",
56397
+ auth: "protected"
56398
+ }),
56399
+ setProgram: method(object({
56400
+ deviceId: number().int().nonnegative(),
56401
+ program: string().min(1)
56402
+ }), _void(), {
56403
+ kind: "mutation",
56404
+ auth: "protected"
56405
+ }),
56406
+ setPower: method(object({
56407
+ deviceId: number().int().nonnegative(),
56408
+ on: boolean()
56409
+ }), _void(), {
56410
+ kind: "mutation",
56411
+ auth: "protected"
56412
+ }),
56413
+ setHalfLoad: method(object({
56414
+ deviceId: number().int().nonnegative(),
56415
+ on: boolean()
56416
+ }), _void(), {
56417
+ kind: "mutation",
56418
+ auth: "protected"
56419
+ }),
56420
+ setHygienePlus: method(object({
56421
+ deviceId: number().int().nonnegative(),
56422
+ on: boolean()
56423
+ }), _void(), {
56424
+ kind: "mutation",
56425
+ auth: "protected"
56426
+ }),
56427
+ setOption: method(object({
56428
+ deviceId: number().int().nonnegative(),
56429
+ key: string().min(1),
56430
+ value: union([
56431
+ boolean(),
56432
+ string(),
56433
+ number()
56434
+ ])
56435
+ }), _void(), {
56436
+ kind: "mutation",
56437
+ auth: "protected"
56438
+ })
56439
+ },
56440
+ status: {
56441
+ schema: DishwasherStatusSchema,
56442
+ kind: "poll"
56443
+ },
56444
+ runtimeState: DishwasherStatusSchema,
56445
+ durability: "session",
56446
+ history: { fields: { progressPercent: {
56447
+ kind: "gauge",
56448
+ unit: "%",
56449
+ deadband: 2
56450
+ } } }
56451
+ };
55661
56452
  var DoorbellStatusSchema = object({
55662
56453
  /** Ms epoch of the last press. null = never observed since this provider started. */
55663
56454
  lastPressedAt: number().nullable(),
@@ -56460,6 +57251,32 @@ var gasCapability = {
56460
57251
  * whether persisting is worth a SQLite commit. */
56461
57252
  volatileStateFields: ["lastChangedAt"]
56462
57253
  };
57254
+ var HeatingValveStatusSchema = object({
57255
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
57256
+ position: number().min(0).max(100).nullable(),
57257
+ /** Ms epoch when the slice was last updated (push or poll). */
57258
+ lastFetchedAt: number()
57259
+ });
57260
+ var heatingValveCapability = {
57261
+ name: "heating-valve",
57262
+ scope: "device",
57263
+ deviceNative: true,
57264
+ mode: "singleton",
57265
+ deviceTypes: [DeviceType.Thermostat],
57266
+ methods: {},
57267
+ status: {
57268
+ schema: HeatingValveStatusSchema,
57269
+ kind: "push"
57270
+ },
57271
+ runtimeState: HeatingValveStatusSchema,
57272
+ durability: "session",
57273
+ history: { fields: { position: {
57274
+ kind: "gauge",
57275
+ unit: "%",
57276
+ deadband: 1
57277
+ } } },
57278
+ volatileStateFields: ["lastFetchedAt"]
57279
+ };
56463
57280
  /**
56464
57281
  * Humidifier / dehumidifier cap. Models HA `humidifier.*` entities —
56465
57282
  * an on/off actuator with an optional target-humidity setpoint and an
@@ -57592,7 +58409,19 @@ var TlsStatusSchema = object({
57592
58409
  sans: array(string()),
57593
58410
  caCertPem: string().nullable(),
57594
58411
  reissueError: string().nullable(),
57595
- restartRequired: boolean()
58412
+ restartRequired: boolean(),
58413
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
58414
+ caMissing: boolean(),
58415
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
58416
+ localCaConstrained: boolean().nullable(),
58417
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
58418
+ caReplacedAt: string().nullable(),
58419
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
58420
+ storedUpload: object({
58421
+ leafFingerprintSha256: string(),
58422
+ validTo: string(),
58423
+ hasCa: boolean()
58424
+ }).nullable()
57596
58425
  });
57597
58426
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
57598
58427
  /**
@@ -57648,6 +58477,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
57648
58477
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
57649
58478
  kind: "mutation",
57650
58479
  auth: "admin"
58480
+ }), method(_void(), TlsStatusSchema, {
58481
+ kind: "mutation",
58482
+ auth: "admin"
57651
58483
  });
57652
58484
  var LockControlStatusSchema = object({
57653
58485
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -64141,7 +64973,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64141
64973
  kind: "mutation",
64142
64974
  auth: "admin",
64143
64975
  access: "delete"
64144
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
64976
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
64977
+ kind: "mutation",
64978
+ auth: "admin",
64979
+ access: "create"
64980
+ }), method(object({
64145
64981
  userId: string(),
64146
64982
  code: string()
64147
64983
  }), object({ valid: boolean() }), {
@@ -65861,6 +66697,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
65861
66697
  dayNight: dayNightCapability,
65862
66698
  deviceDiscovery: deviceDiscoveryCapability,
65863
66699
  deviceStatus: deviceStatusCapability,
66700
+ dishwasher: dishwasherCapability,
65864
66701
  doorbell: doorbellCapability,
65865
66702
  enumSensor: enumSensorCapability,
65866
66703
  eventEmitter: eventEmitterCapability,
@@ -65868,6 +66705,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
65868
66705
  featureProbe: featureProbeCapability,
65869
66706
  flood: floodCapability,
65870
66707
  gas: gasCapability,
66708
+ heatingValve: heatingValveCapability,
65871
66709
  humidifier: humidifierCapability,
65872
66710
  humiditySensor: humiditySensorCapability,
65873
66711
  image: imageCapability,
@@ -65953,13 +66791,14 @@ var BaseDevice = class {
65953
66791
  get state() {
65954
66792
  if (!this._stateProxyCache) {
65955
66793
  const cache = {};
65956
- const handler = { get: (_target, key) => {
66794
+ const handler = { get: (target, key) => {
65957
66795
  const k = key;
65958
- if (k in cache) return cache[k];
66796
+ const existing = Reflect.get(target, k);
66797
+ if (existing !== void 0) return existing;
65959
66798
  const cap = DEVICE_LOCAL_STATE_CAPS[k];
65960
66799
  if (!cap) return void 0;
65961
66800
  const proxy = this.sliceProxy(cap);
65962
- cache[k] = proxy;
66801
+ Reflect.set(target, k, proxy);
65963
66802
  return proxy;
65964
66803
  } };
65965
66804
  this._stateProxyCache = new Proxy(cache, handler);
@@ -66158,7 +66997,7 @@ var BaseDevice = class {
66158
66997
  async updateSourceInfo(patch) {
66159
66998
  const next = mergeSourceInfo(this.sourceInfo, patch);
66160
66999
  this._sourceInfoCache = Object.freeze({ ...next });
66161
- const action = this.ctx.api?.deviceManager?.setMetadata;
67000
+ const action = this.ctx.api.deviceManager?.setMetadata;
66162
67001
  if (action) try {
66163
67002
  await action.mutate({
66164
67003
  deviceId: this.id,
@@ -66193,7 +67032,7 @@ var BaseDevice = class {
66193
67032
  * device boot on a meta refresh.
66194
67033
  */
66195
67034
  async refreshFeatures() {
66196
- const action = this.ctx.api?.deviceManager?.registerDevice;
67035
+ const action = this.ctx.api.deviceManager?.registerDevice;
66197
67036
  if (!action) return;
66198
67037
  try {
66199
67038
  await action.mutate({
@@ -66592,6 +67431,12 @@ var BaseDeviceProvider = class extends BaseAddon {
66592
67431
  provider: this
66593
67432
  }];
66594
67433
  }
67434
+ /** Flatten `super.onInitialize()` whether it returned an array or an envelope. */
67435
+ providerRegistrationsFromSuper(result) {
67436
+ if (Array.isArray(result)) return result;
67437
+ if (result !== void 0 && result.providers !== void 0) return [...result.providers];
67438
+ return [];
67439
+ }
66595
67440
  async onShutdown() {
66596
67441
  this._restoreShuttingDown = true;
66597
67442
  this.cancelRestoreRetries();
@@ -67118,7 +67963,7 @@ var BaseDeviceProvider = class extends BaseAddon {
67118
67963
  return toDeviceSummary(device, this.addonId);
67119
67964
  }
67120
67965
  };
67121
- 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;
67966
+ 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;
67122
67967
  new Set(Object.values(DeviceType));
67123
67968
  Object.freeze({
67124
67969
  "accessories.getStatus": {
@@ -68267,6 +69112,12 @@ Object.freeze({
68267
69112
  addonId: null,
68268
69113
  access: "view"
68269
69114
  },
69115
+ "coreBlocks.migrateRawSecrets": {
69116
+ capName: "core-blocks",
69117
+ capScope: "system",
69118
+ addonId: null,
69119
+ access: "create"
69120
+ },
68270
69121
  "coreBlocks.restart": {
68271
69122
  capName: "core-blocks",
68272
69123
  capScope: "system",
@@ -69533,6 +70384,60 @@ Object.freeze({
69533
70384
  addonId: null,
69534
70385
  access: "view"
69535
70386
  },
70387
+ "dishwasher.getStatus": {
70388
+ capName: "dishwasher",
70389
+ capScope: "device",
70390
+ addonId: null,
70391
+ access: "view"
70392
+ },
70393
+ "dishwasher.pause": {
70394
+ capName: "dishwasher",
70395
+ capScope: "device",
70396
+ addonId: null,
70397
+ access: "create"
70398
+ },
70399
+ "dishwasher.setHalfLoad": {
70400
+ capName: "dishwasher",
70401
+ capScope: "device",
70402
+ addonId: null,
70403
+ access: "create"
70404
+ },
70405
+ "dishwasher.setHygienePlus": {
70406
+ capName: "dishwasher",
70407
+ capScope: "device",
70408
+ addonId: null,
70409
+ access: "create"
70410
+ },
70411
+ "dishwasher.setOption": {
70412
+ capName: "dishwasher",
70413
+ capScope: "device",
70414
+ addonId: null,
70415
+ access: "create"
70416
+ },
70417
+ "dishwasher.setPower": {
70418
+ capName: "dishwasher",
70419
+ capScope: "device",
70420
+ addonId: null,
70421
+ access: "create"
70422
+ },
70423
+ "dishwasher.setProgram": {
70424
+ capName: "dishwasher",
70425
+ capScope: "device",
70426
+ addonId: null,
70427
+ access: "create"
70428
+ },
70429
+ "dishwasher.start": {
70430
+ capName: "dishwasher",
70431
+ capScope: "device",
70432
+ addonId: null,
70433
+ access: "create"
70434
+ },
70435
+ "dishwasher.stop": {
70436
+ capName: "dishwasher",
70437
+ capScope: "device",
70438
+ addonId: null,
70439
+ access: "create"
70440
+ },
69536
70441
  "doorbell.getStatus": {
69537
70442
  capName: "doorbell",
69538
70443
  capScope: "device",
@@ -69743,6 +70648,12 @@ Object.freeze({
69743
70648
  addonId: null,
69744
70649
  access: "view"
69745
70650
  },
70651
+ "heatingValve.getStatus": {
70652
+ capName: "heating-valve",
70653
+ capScope: "device",
70654
+ addonId: null,
70655
+ access: "view"
70656
+ },
69746
70657
  "humidifier.getStatus": {
69747
70658
  capName: "humidifier",
69748
70659
  capScope: "device",
@@ -69953,6 +70864,12 @@ Object.freeze({
69953
70864
  addonId: null,
69954
70865
  access: "create"
69955
70866
  },
70867
+ "keychainAdmin.importSecret": {
70868
+ capName: "keychain-admin",
70869
+ capScope: "system",
70870
+ addonId: null,
70871
+ access: "create"
70872
+ },
69956
70873
  "keychainAdmin.listAudit": {
69957
70874
  capName: "keychain-admin",
69958
70875
  capScope: "system",
@@ -70121,6 +71038,12 @@ Object.freeze({
70121
71038
  addonId: null,
70122
71039
  access: "view"
70123
71040
  },
71041
+ "llm.migrateRawSecrets": {
71042
+ capName: "llm",
71043
+ capScope: "system",
71044
+ addonId: null,
71045
+ access: "create"
71046
+ },
70124
71047
  "llm.resolveModelRef": {
70125
71048
  capName: "llm",
70126
71049
  capScope: "system",
@@ -70349,6 +71272,12 @@ Object.freeze({
70349
71272
  addonId: null,
70350
71273
  access: "create"
70351
71274
  },
71275
+ "localNetwork.useStoredUploadedCertificate": {
71276
+ capName: "local-network",
71277
+ capScope: "system",
71278
+ addonId: null,
71279
+ access: "create"
71280
+ },
70352
71281
  "lockControl.getStatus": {
70353
71282
  capName: "lock-control",
70354
71283
  capScope: "device",
@@ -73001,6 +73930,30 @@ Object.freeze({
73001
73930
  addonId: null,
73002
73931
  access: "create"
73003
73932
  },
73933
+ "recordEntries.deleteEntry": {
73934
+ capName: "record-entries",
73935
+ capScope: "system",
73936
+ addonId: null,
73937
+ access: "delete"
73938
+ },
73939
+ "recordEntries.listEntries": {
73940
+ capName: "record-entries",
73941
+ capScope: "system",
73942
+ addonId: null,
73943
+ access: "view"
73944
+ },
73945
+ "recordEntries.listEntryKinds": {
73946
+ capName: "record-entries",
73947
+ capScope: "system",
73948
+ addonId: null,
73949
+ access: "view"
73950
+ },
73951
+ "recordEntries.putEntry": {
73952
+ capName: "record-entries",
73953
+ capScope: "system",
73954
+ addonId: null,
73955
+ access: "create"
73956
+ },
73004
73957
  "recording.getAvailability": {
73005
73958
  capName: "recording",
73006
73959
  capScope: "device",
@@ -73301,6 +74254,102 @@ Object.freeze({
73301
74254
  addonId: null,
73302
74255
  access: "view"
73303
74256
  },
74257
+ "records.aggregate": {
74258
+ capName: "records",
74259
+ capScope: "system",
74260
+ addonId: null,
74261
+ access: "view"
74262
+ },
74263
+ "records.allocateId": {
74264
+ capName: "records",
74265
+ capScope: "system",
74266
+ addonId: null,
74267
+ access: "create"
74268
+ },
74269
+ "records.count": {
74270
+ capName: "records",
74271
+ capScope: "system",
74272
+ addonId: null,
74273
+ access: "view"
74274
+ },
74275
+ "records.declareKinds": {
74276
+ capName: "records",
74277
+ capScope: "system",
74278
+ addonId: null,
74279
+ access: "create"
74280
+ },
74281
+ "records.delete": {
74282
+ capName: "records",
74283
+ capScope: "system",
74284
+ addonId: null,
74285
+ access: "delete"
74286
+ },
74287
+ "records.deleteDevice": {
74288
+ capName: "records",
74289
+ capScope: "system",
74290
+ addonId: null,
74291
+ access: "delete"
74292
+ },
74293
+ "records.deleteMany": {
74294
+ capName: "records",
74295
+ capScope: "system",
74296
+ addonId: null,
74297
+ access: "delete"
74298
+ },
74299
+ "records.deleteWhere": {
74300
+ capName: "records",
74301
+ capScope: "system",
74302
+ addonId: null,
74303
+ access: "delete"
74304
+ },
74305
+ "records.get": {
74306
+ capName: "records",
74307
+ capScope: "system",
74308
+ addonId: null,
74309
+ access: "view"
74310
+ },
74311
+ "records.getMany": {
74312
+ capName: "records",
74313
+ capScope: "system",
74314
+ addonId: null,
74315
+ access: "view"
74316
+ },
74317
+ "records.histogram": {
74318
+ capName: "records",
74319
+ capScope: "system",
74320
+ addonId: null,
74321
+ access: "view"
74322
+ },
74323
+ "records.patch": {
74324
+ capName: "records",
74325
+ capScope: "system",
74326
+ addonId: null,
74327
+ access: "create"
74328
+ },
74329
+ "records.put": {
74330
+ capName: "records",
74331
+ capScope: "system",
74332
+ addonId: null,
74333
+ access: "create"
74334
+ },
74335
+ "records.putMany": {
74336
+ capName: "records",
74337
+ capScope: "system",
74338
+ addonId: null,
74339
+ access: "create"
74340
+ },
74341
+ "records.query": {
74342
+ capName: "records",
74343
+ capScope: "system",
74344
+ addonId: null,
74345
+ access: "view"
74346
+ },
74347
+ "records.secretRefs": {
74348
+ capName: "records",
74349
+ capScope: "system",
74350
+ addonId: null,
74351
+ access: "view"
74352
+ },
73304
74353
  "sceneMonitor.captureReference": {
73305
74354
  capName: "scene-monitor",
73306
74355
  capScope: "device",
@@ -73733,6 +74782,48 @@ Object.freeze({
73733
74782
  addonId: null,
73734
74783
  access: "create"
73735
74784
  },
74785
+ "storageAdmin.adoptRecords": {
74786
+ capName: "storage-admin",
74787
+ capScope: "system",
74788
+ addonId: null,
74789
+ access: "create"
74790
+ },
74791
+ "storageAdmin.dropCollection": {
74792
+ capName: "storage-admin",
74793
+ capScope: "system",
74794
+ addonId: null,
74795
+ access: "delete"
74796
+ },
74797
+ "storageAdmin.isAdoptedLegacyTable": {
74798
+ capName: "storage-admin",
74799
+ capScope: "system",
74800
+ addonId: null,
74801
+ access: "view"
74802
+ },
74803
+ "storageAdmin.listKinds": {
74804
+ capName: "storage-admin",
74805
+ capScope: "system",
74806
+ addonId: null,
74807
+ access: "view"
74808
+ },
74809
+ "storageAdmin.listTables": {
74810
+ capName: "storage-admin",
74811
+ capScope: "system",
74812
+ addonId: null,
74813
+ access: "view"
74814
+ },
74815
+ "storageAdmin.readLegacyCollection": {
74816
+ capName: "storage-admin",
74817
+ capScope: "system",
74818
+ addonId: null,
74819
+ access: "view"
74820
+ },
74821
+ "storageAdmin.readRecords": {
74822
+ capName: "storage-admin",
74823
+ capScope: "system",
74824
+ addonId: null,
74825
+ access: "view"
74826
+ },
73736
74827
  "storageEvictable.evict": {
73737
74828
  capName: "storage-evictable",
73738
74829
  capScope: "system",
@@ -74645,6 +75736,12 @@ Object.freeze({
74645
75736
  addonId: null,
74646
75737
  access: "view"
74647
75738
  },
75739
+ "userManagement.migrateRawSecrets": {
75740
+ capName: "user-management",
75741
+ capScope: "system",
75742
+ addonId: null,
75743
+ access: "create"
75744
+ },
74648
75745
  "userManagement.oauthExchangeCode": {
74649
75746
  capName: "user-management",
74650
75747
  capScope: "system",
@@ -75144,7 +76241,7 @@ Object.freeze({
75144
76241
  access: "create"
75145
76242
  }
75146
76243
  });
75147
- 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;
76244
+ 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;
75148
76245
  DeviceFeature.BatteryOperated;
75149
76246
  Object.freeze({
75150
76247
  "accessories.getStatus": [{
@@ -75968,6 +77065,51 @@ Object.freeze({
75968
77065
  form: "single",
75969
77066
  optional: false
75970
77067
  }],
77068
+ "dishwasher.getStatus": [{
77069
+ name: "deviceId",
77070
+ form: "single",
77071
+ optional: false
77072
+ }],
77073
+ "dishwasher.pause": [{
77074
+ name: "deviceId",
77075
+ form: "single",
77076
+ optional: false
77077
+ }],
77078
+ "dishwasher.setHalfLoad": [{
77079
+ name: "deviceId",
77080
+ form: "single",
77081
+ optional: false
77082
+ }],
77083
+ "dishwasher.setHygienePlus": [{
77084
+ name: "deviceId",
77085
+ form: "single",
77086
+ optional: false
77087
+ }],
77088
+ "dishwasher.setOption": [{
77089
+ name: "deviceId",
77090
+ form: "single",
77091
+ optional: false
77092
+ }],
77093
+ "dishwasher.setPower": [{
77094
+ name: "deviceId",
77095
+ form: "single",
77096
+ optional: false
77097
+ }],
77098
+ "dishwasher.setProgram": [{
77099
+ name: "deviceId",
77100
+ form: "single",
77101
+ optional: false
77102
+ }],
77103
+ "dishwasher.start": [{
77104
+ name: "deviceId",
77105
+ form: "single",
77106
+ optional: false
77107
+ }],
77108
+ "dishwasher.stop": [{
77109
+ name: "deviceId",
77110
+ form: "single",
77111
+ optional: false
77112
+ }],
75971
77113
  "doorbell.getStatus": [{
75972
77114
  name: "deviceId",
75973
77115
  form: "single",
@@ -76037,6 +77179,11 @@ Object.freeze({
76037
77179
  form: "single",
76038
77180
  optional: false
76039
77181
  }],
77182
+ "heatingValve.getStatus": [{
77183
+ name: "deviceId",
77184
+ form: "single",
77185
+ optional: false
77186
+ }],
76040
77187
  "humidifier.getStatus": [{
76041
77188
  name: "deviceId",
76042
77189
  form: "single",
@@ -77321,6 +78468,37 @@ Object.freeze({
77321
78468
  form: "single",
77322
78469
  optional: false
77323
78470
  }],
78471
+ "records.count": [{
78472
+ name: "deviceId",
78473
+ form: "single",
78474
+ optional: true
78475
+ }],
78476
+ "records.deleteDevice": [{
78477
+ name: "deviceId",
78478
+ form: "single",
78479
+ optional: false
78480
+ }],
78481
+ "records.deleteWhere": [{
78482
+ name: "deviceId",
78483
+ form: "single",
78484
+ optional: true
78485
+ }],
78486
+ "records.histogram": [{
78487
+ name: "deviceId",
78488
+ form: "single",
78489
+ optional: true
78490
+ }],
78491
+ "records.putMany": [{
78492
+ name: "records",
78493
+ form: "object-array",
78494
+ optional: false,
78495
+ itemField: "deviceId"
78496
+ }],
78497
+ "records.query": [{
78498
+ name: "deviceId",
78499
+ form: "single",
78500
+ optional: true
78501
+ }],
77324
78502
  "sceneMonitor.captureReference": [{
77325
78503
  name: "deviceId",
77326
78504
  form: "single",
@@ -77437,6 +78615,17 @@ Object.freeze({
77437
78615
  form: "single",
77438
78616
  optional: false
77439
78617
  }],
78618
+ "storageAdmin.adoptRecords": [{
78619
+ name: "records",
78620
+ form: "object-array",
78621
+ optional: false,
78622
+ itemField: "deviceId"
78623
+ }],
78624
+ "storageAdmin.readRecords": [{
78625
+ name: "deviceId",
78626
+ form: "single",
78627
+ optional: true
78628
+ }],
77440
78629
  "streamBroker.acquireEgressTranscode": [{
77441
78630
  name: "deviceId",
77442
78631
  form: "single",
@@ -79962,7 +81151,7 @@ var PetkitProviderAddon = class extends BaseDeviceProvider {
79962
81151
  super({});
79963
81152
  }
79964
81153
  async onInitialize() {
79965
- const regs = await super.onInitialize();
81154
+ const regs = this.providerRegistrationsFromSuper(await super.onInitialize());
79966
81155
  this.clients = new PetkitClientRegistry(this.ctx.logger);
79967
81156
  this.clients.setOnConnected((integrationId) => {
79968
81157
  this.ctx.logger.info("PetKit: integration connected", { meta: { integrationId } });