@camstack/addon-provider-amcrest 0.2.136 → 0.2.138

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 +1317 -124
  2. package/dist/addon.mjs +1317 -124
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -35,7 +35,7 @@ let node_stream_promises = require("node:stream/promises");
35
35
  let node_child_process = require("node:child_process");
36
36
  require("node:zlib");
37
37
  let node_os = require("node:os");
38
- //#region ../types/dist/event-category-C4hVnRo8.mjs
38
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
39
39
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
40
40
  EventCategory["SystemBoot"] = "system.boot";
41
41
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -99,6 +99,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
99
99
  * consumes this category and maps it to the `addon-crash-loop` kind.
100
100
  */
101
101
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
102
+ /**
103
+ * A runner whose addon refused to start with a typed reason (D877) - parked
104
+ * in `refused`, never counted by the crash breaker, retried on operator
105
+ * action. One event per refusal.
106
+ */
107
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
108
+ /**
109
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
110
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
111
+ * runner is still pending) and the alert centre (close a recovered runner).
112
+ */
113
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
114
+ /**
115
+ * The node's one-shot runner boot check (D877): planned runners against the
116
+ * process service, `degraded` when any is failed, refused or missing. The
117
+ * alert centre turns it into one alert and a direct critical push.
118
+ */
119
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
102
120
  EventCategory["AddonError"] = "addon.error";
103
121
  EventCategory["AddonPageReady"] = "addon.page-ready";
104
122
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -5423,7 +5441,7 @@ var ZodIssueCode = {
5423
5441
  var ZodFirstPartyTypeKind;
5424
5442
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5425
5443
  //#endregion
5426
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5444
+ //#region ../types/dist/sleep-BOjuyoPC.mjs
5427
5445
  /**
5428
5446
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5429
5447
  * window to float samples (D455).
@@ -5540,7 +5558,7 @@ function isKeychainStoredField(field) {
5540
5558
  var SECRET_CLEAR = { $secretClear: true };
5541
5559
  /** The `'***'` token D634 redaction writes for non-admins. */
5542
5560
  var LEGACY_DEVICE_REDACTION = "***";
5543
- function isRecord$2(value) {
5561
+ function isRecord$5(value) {
5544
5562
  return typeof value === "object" && value !== null && !Array.isArray(value);
5545
5563
  }
5546
5564
  function makeSecretMarker(ref) {
@@ -5551,12 +5569,12 @@ function makeSecretMarker(ref) {
5551
5569
  }
5552
5570
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5553
5571
  function isSecretMarker(value) {
5554
- if (!isRecord$2(value)) return false;
5572
+ if (!isRecord$5(value)) return false;
5555
5573
  const ref = value["$secret"];
5556
5574
  return typeof ref === "string" && ref.length > 0;
5557
5575
  }
5558
5576
  function isSecretClear(value) {
5559
- return isRecord$2(value) && value["$secretClear"] === true;
5577
+ return isRecord$5(value) && value["$secretClear"] === true;
5560
5578
  }
5561
5579
  /**
5562
5580
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6166,7 +6184,7 @@ var KeychainWriteRefusedError = class extends Error {
6166
6184
  }
6167
6185
  };
6168
6186
  var KEEP = { kind: "keep" };
6169
- function isRecord$1$1(value) {
6187
+ function isRecord$4(value) {
6170
6188
  return typeof value === "object" && value !== null && !Array.isArray(value);
6171
6189
  }
6172
6190
  function defaultMintId() {
@@ -6179,7 +6197,7 @@ function collectSecretMarkerRefs(value, out = []) {
6179
6197
  return out;
6180
6198
  }
6181
6199
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6182
- else if (isRecord$1$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6200
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6183
6201
  return out;
6184
6202
  }
6185
6203
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6234,7 +6252,7 @@ function rowId(row, idKey) {
6234
6252
  return null;
6235
6253
  }
6236
6254
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6237
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1$1) : [];
6255
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6238
6256
  if (!Array.isArray(incoming)) {
6239
6257
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6240
6258
  return {
@@ -6250,7 +6268,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6250
6268
  const kept = /* @__PURE__ */ new Set();
6251
6269
  const rows = [];
6252
6270
  for (const row of incoming) {
6253
- if (!isRecord$1$1(row)) {
6271
+ if (!isRecord$4(row)) {
6254
6272
  rows.push(row);
6255
6273
  continue;
6256
6274
  }
@@ -6275,7 +6293,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6275
6293
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6276
6294
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6277
6295
  case "object": {
6278
- if (!isRecord$1$1(incoming)) {
6296
+ if (!isRecord$4(incoming)) {
6279
6297
  if (incoming === void 0) return KEEP;
6280
6298
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6281
6299
  return {
@@ -6283,7 +6301,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6283
6301
  value: incoming
6284
6302
  };
6285
6303
  }
6286
- const storedObj = isRecord$1$1(stored) ? stored : {};
6304
+ const storedObj = isRecord$4(stored) ? stored : {};
6287
6305
  return {
6288
6306
  kind: "value",
6289
6307
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6406,7 +6424,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6406
6424
  value: items
6407
6425
  };
6408
6426
  }
6409
- if (isRecord$1$1(v)) {
6427
+ if (isRecord$4(v)) {
6410
6428
  const out = {};
6411
6429
  for (const [k, child] of Object.entries(v)) {
6412
6430
  const s = substitute(child);
@@ -6674,7 +6692,6 @@ function createHandle(raw, opts) {
6674
6692
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6675
6693
  const readAddonStoreResult = raw.readAddonStoreResult;
6676
6694
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6677
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6678
6695
  const overrides = {
6679
6696
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6680
6697
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6698,12 +6715,12 @@ function createHandle(raw, opts) {
6698
6715
  };
6699
6716
  } } : {},
6700
6717
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6701
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6702
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6718
+ readDeviceStoreBatch: async (deviceIds) => {
6719
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6703
6720
  const out = /* @__PURE__ */ new Map();
6704
6721
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6705
6722
  return out;
6706
- } } : {},
6723
+ },
6707
6724
  writeAddonStore: async (patch) => {
6708
6725
  await writeAddon(patch);
6709
6726
  },
@@ -7330,7 +7347,7 @@ var BaseAddon = class {
7330
7347
  if (!ctx) return;
7331
7348
  const addonId = ctx.id;
7332
7349
  setImmediate(() => {
7333
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7350
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7334
7351
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7335
7352
  }).catch((err) => {
7336
7353
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7530,7 +7547,7 @@ var BaseAddon = class {
7530
7547
  return this._addonSecretTree;
7531
7548
  }
7532
7549
  deviceSecretTree() {
7533
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7550
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7534
7551
  return this._deviceSecretTree;
7535
7552
  }
7536
7553
  /**
@@ -7606,42 +7623,135 @@ var BaseAddon = class {
7606
7623
  this[timerOf] = timer;
7607
7624
  }
7608
7625
  /**
7609
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7610
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7611
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7612
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7626
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7627
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7613
7628
  * addon permanently broken.
7614
7629
  *
7615
- * Retry only the two known infra fingerprints. Anything else propagates so
7616
- * real bugs surface immediately. After the budget expires we fall back to
7617
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7630
+ * Two kinds of outage, two budgets:
7631
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7632
+ * initialized`, `provider not available`): a short budget, then the addon
7633
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7634
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7635
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7636
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7637
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7638
+ * loop. A long, bounded budget; only after it the error propagates - the
7639
+ * addon never runs on defaults for a store it could not ask.
7640
+ * Anything else propagates immediately so real bugs surface.
7618
7641
  */
7619
7642
  async readAddonStoreWithRetry() {
7620
7643
  const settings = this.rawSettings();
7621
7644
  if (!settings) return {};
7622
- const delaysMs = [
7623
- 150,
7624
- 350,
7625
- 600,
7626
- 900
7627
- ];
7628
7645
  let lastErr;
7629
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7646
+ for (let attempt = 0;; attempt++) try {
7630
7647
  const stored = await settings.readAddonStore() ?? {};
7631
7648
  this.settingsStoreReady = true;
7632
7649
  return stored;
7633
7650
  } catch (err) {
7634
7651
  lastErr = err;
7635
- const msg = err instanceof Error ? err.message : String(err);
7636
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7637
- if (attempt === delaysMs.length) break;
7638
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7652
+ const kind = classifyStoreError(err);
7653
+ if (kind === "permanent") throw err;
7654
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7655
+ if (delay === void 0) {
7656
+ if (kind === "transport") throw err;
7657
+ break;
7658
+ }
7659
+ await new Promise((r) => setTimeout(r, delay));
7639
7660
  }
7640
7661
  this.settingsStoreReady = false;
7641
7662
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7642
7663
  return {};
7643
7664
  }
7644
7665
  };
7666
+ /** The settings store's own restart fingerprints. */
7667
+ var RESTART_RETRY_DELAYS_MS = [
7668
+ 150,
7669
+ 350,
7670
+ 600,
7671
+ 900
7672
+ ];
7673
+ /** A hub restarting under a booting runner: ~100 s in total. */
7674
+ var TRANSPORT_RETRY_DELAYS_MS = [
7675
+ 150,
7676
+ 350,
7677
+ 600,
7678
+ 900,
7679
+ 2e3,
7680
+ 5e3,
7681
+ 1e4,
7682
+ 2e4,
7683
+ 3e4,
7684
+ 3e4
7685
+ ];
7686
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7687
+ /** Node / socket error codes of a connection that did not happen or broke. */
7688
+ var TRANSPORT_CODES = new Set([
7689
+ "ECONNREFUSED",
7690
+ "ECONNRESET",
7691
+ "ETIMEDOUT",
7692
+ "EPIPE",
7693
+ "EHOSTUNREACH",
7694
+ "ENETUNREACH"
7695
+ ]);
7696
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7697
+ var UNAVAILABLE_TRPC_CODES = new Set([
7698
+ "TIMEOUT",
7699
+ "SERVICE_UNAVAILABLE",
7700
+ "BAD_GATEWAY",
7701
+ "GATEWAY_TIMEOUT"
7702
+ ]);
7703
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7704
+ var TRANSPORT_PHRASES = [
7705
+ "discovery deadline exceeded",
7706
+ "parent could not route child unowned cap call",
7707
+ "UDS request timed out after",
7708
+ "channel closed"
7709
+ ];
7710
+ /** Moleculer error `type`s of a call that could not be served right now. */
7711
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7712
+ "REQUEST_TIMEOUT",
7713
+ "SERVICE_NOT_FOUND",
7714
+ "SERVICE_NOT_AVAILABLE",
7715
+ "REQUEST_REJECTED",
7716
+ "BROKER_DISCONNECTED"
7717
+ ]);
7718
+ function stringProp(value, key) {
7719
+ if (typeof value !== "object" || value === null) return void 0;
7720
+ const found = Reflect.get(value, key);
7721
+ return typeof found === "string" ? found : void 0;
7722
+ }
7723
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7724
+ function errorCode(err) {
7725
+ const out = {};
7726
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7727
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7728
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7729
+ if (node !== void 0) out.node = node;
7730
+ const trpc = stringProp(data, "code");
7731
+ if (trpc !== void 0) out.trpc = trpc;
7732
+ return out;
7733
+ }
7734
+ /**
7735
+ * Is a settings read failure worth retrying, and with which budget? Only
7736
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7737
+ * one of the exact phrases our own transport raises. A message that merely
7738
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7739
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7740
+ */
7741
+ function classifyStoreError(err) {
7742
+ const message = err instanceof Error ? err.message : String(err);
7743
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7744
+ const code = errorCode(err);
7745
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7746
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7747
+ if (typeof err === "object" && err !== null) {
7748
+ if (Reflect.get(err, "retryable") === true) return "transport";
7749
+ const type = stringProp(err, "type");
7750
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7751
+ }
7752
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7753
+ return "permanent";
7754
+ }
7645
7755
  /**
7646
7756
  * Collect the keys of every field marked `perNode: true`, recursing into
7647
7757
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7731,6 +7841,156 @@ var PeerBytesTicketSchema = object({
7731
7841
  */
7732
7842
  declaredBytes: number().int().nonnegative().nullable()
7733
7843
  });
7844
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7845
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7846
+ var RECORD_DATABASES = ["settings", "events"];
7847
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7848
+ var RECORD_CLASSES = [
7849
+ "config",
7850
+ "ledger",
7851
+ "audit",
7852
+ "mirror",
7853
+ "ephemeral"
7854
+ ];
7855
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7856
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7857
+ var RECORD_BATCH_MAX = 1e3;
7858
+ var RECORD_QUERY_MAX = 1e3;
7859
+ function defOf(schema) {
7860
+ const zodBag = Reflect.get(schema, "_zod");
7861
+ if (typeof zodBag !== "object" || zodBag === null) return {};
7862
+ const def = Reflect.get(zodBag, "def");
7863
+ if (typeof def !== "object" || def === null) return {};
7864
+ return def;
7865
+ }
7866
+ function declaredHere(schema) {
7867
+ return globalRegistry.get(schema)?.secret === true;
7868
+ }
7869
+ /** Wrapper kinds whose `innerType` is the field itself. */
7870
+ var WRAPPERS = new Set([
7871
+ "optional",
7872
+ "nullable",
7873
+ "default",
7874
+ "prefault",
7875
+ "catch",
7876
+ "readonly",
7877
+ "nonoptional"
7878
+ ]);
7879
+ /**
7880
+ * The schema layers that make up ONE field: the schema itself and every
7881
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
7882
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
7883
+ * `.transform` on `in`).
7884
+ */
7885
+ function layersOf(schema) {
7886
+ const out = [];
7887
+ const queue = [schema];
7888
+ while (queue.length > 0) {
7889
+ const s = queue.shift();
7890
+ if (!s || out.includes(s)) continue;
7891
+ out.push(s);
7892
+ const def = defOf(s);
7893
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
7894
+ if (def.type === "pipe") {
7895
+ if (def.in) queue.push(def.in);
7896
+ if (def.out) queue.push(def.out);
7897
+ }
7898
+ }
7899
+ return out;
7900
+ }
7901
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
7902
+ function isZodSecret(schema) {
7903
+ return layersOf(schema).some(declaredHere);
7904
+ }
7905
+ /**
7906
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
7907
+ * element of this array" (`connection.password`, `rows[].token`). A declared
7908
+ * object or array is reported as one path and not descended into — everything
7909
+ * under it is secret.
7910
+ */
7911
+ function collectZodSecretPaths(schema, prefix = "") {
7912
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
7913
+ const paths = [];
7914
+ for (const layer of layersOf(schema)) {
7915
+ const def = defOf(layer);
7916
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
7917
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
7918
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
7919
+ else if (def.type === "intersection") {
7920
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
7921
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
7922
+ }
7923
+ }
7924
+ return [...new Set(paths)];
7925
+ }
7926
+ /**
7927
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
7928
+ * Zod row schema that describes it, and the helper that turns the two into the
7929
+ * JSON the engine stores.
7930
+ *
7931
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
7932
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
7933
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
7934
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
7935
+ * never a field name (D879).
7936
+ */
7937
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
7938
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
7939
+ var RecordIndexSchema = object({
7940
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
7941
+ fields: array(RecordFieldPathSchema).min(1).max(4),
7942
+ unique: boolean().optional()
7943
+ }).strict();
7944
+ var RecordRetentionSchema = union([
7945
+ object({
7946
+ ttlMs: number().int().positive(),
7947
+ from: _enum(["at", "write"])
7948
+ }).strict(),
7949
+ object({
7950
+ maxRows: number().int().positive().optional(),
7951
+ maxRowsPerDevice: number().int().positive().optional()
7952
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
7953
+ object({
7954
+ owner: string().min(1),
7955
+ reason: string().min(1)
7956
+ }).strict(),
7957
+ object({ none: string().min(1) }).strict()
7958
+ ]);
7959
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
7960
+ var EntryDescriptorSchema = object({
7961
+ title: string().min(1),
7962
+ /** The record body field shown as the entry's name. */
7963
+ nameField: string().min(1),
7964
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
7965
+ fields: record(string(), unknown())
7966
+ }).strict();
7967
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
7968
+ var RecordKindDeclarationSchema = object({
7969
+ database: _enum(RECORD_DATABASES).default("settings"),
7970
+ class: _enum(RECORD_CLASSES),
7971
+ writeTrigger: string().min(1),
7972
+ device: _enum([
7973
+ "required",
7974
+ "optional",
7975
+ "none"
7976
+ ]).default("none"),
7977
+ at: _enum(["required", "none"]).default("none"),
7978
+ indexes: array(RecordIndexSchema).max(8).default([]),
7979
+ retention: RecordRetentionSchema,
7980
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
7981
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
7982
+ /** Derived from the Zod schema; never written by hand. */
7983
+ secretPaths: array(string().min(1)).default([]),
7984
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
7985
+ secretArrayKeys: record(string(), string()).default({}),
7986
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
7987
+ adoptsFrom: string().min(1).optional(),
7988
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
7989
+ transactFamily: string().min(1).optional(),
7990
+ entry: EntryDescriptorSchema.optional()
7991
+ }).strict();
7992
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
7993
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
7734
7994
  /** Shared Zod schemas used across streaming capabilities. */
7735
7995
  var CamProfileSchema = _enum([
7736
7996
  "high",
@@ -8195,69 +8455,6 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8195
8455
  kind: "mutation",
8196
8456
  auth: "admin"
8197
8457
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
8198
- function defOf(schema) {
8199
- return schema._zod?.def ?? {};
8200
- }
8201
- function declaredHere(schema) {
8202
- return globalRegistry.get(schema)?.secret === true;
8203
- }
8204
- /** Wrapper kinds whose `innerType` is the field itself. */
8205
- var WRAPPERS = new Set([
8206
- "optional",
8207
- "nullable",
8208
- "default",
8209
- "prefault",
8210
- "catch",
8211
- "readonly",
8212
- "nonoptional"
8213
- ]);
8214
- /**
8215
- * The schema layers that make up ONE field: the schema itself and every
8216
- * wrapper below it (optional / default / nullable / readonly / catch), plus
8217
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8218
- * `.transform` on `in`).
8219
- */
8220
- function layersOf(schema) {
8221
- const out = [];
8222
- const queue = [schema];
8223
- while (queue.length > 0) {
8224
- const s = queue.shift();
8225
- if (!s || out.includes(s)) continue;
8226
- out.push(s);
8227
- const def = defOf(s);
8228
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8229
- if (def.type === "pipe") {
8230
- if (def.in) queue.push(def.in);
8231
- if (def.out) queue.push(def.out);
8232
- }
8233
- }
8234
- return out;
8235
- }
8236
- /** True when any layer of this field declares `.meta({ secret: true })`. */
8237
- function isZodSecret(schema) {
8238
- return layersOf(schema).some(declaredHere);
8239
- }
8240
- /**
8241
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
8242
- * element of this array" (`connection.password`, `rows[].token`). A declared
8243
- * object or array is reported as one path and not descended into — everything
8244
- * under it is secret.
8245
- */
8246
- function collectZodSecretPaths(schema, prefix = "") {
8247
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8248
- const paths = [];
8249
- for (const layer of layersOf(schema)) {
8250
- const def = defOf(layer);
8251
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8252
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8253
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8254
- else if (def.type === "intersection") {
8255
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8256
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8257
- }
8258
- }
8259
- return [...new Set(paths)];
8260
- }
8261
8458
  object({
8262
8459
  code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
8263
8460
  params: record(string(), union([string(), number()])).optional()
@@ -8277,7 +8474,7 @@ function userError(code, params, englishFallback) {
8277
8474
  return new CamstackError(code, params, englishFallback);
8278
8475
  }
8279
8476
  //#endregion
8280
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8477
+ //#region ../types/dist/err-msg-BXKzRBwg.mjs
8281
8478
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8282
8479
  DeviceType["Camera"] = "camera";
8283
8480
  DeviceType["Hub"] = "hub";
@@ -8369,6 +8566,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
8369
8566
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
8370
8567
  * integrations sharing the same food/desiccant/hopper surface. */
8371
8568
  DeviceType["PetFeeder"] = "pet-feeder";
8569
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
8570
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
8571
+ * Sources: native Bosch Home Connect, reusable by similar integrations. */
8572
+ DeviceType["Dishwasher"] = "dishwasher";
8372
8573
  return DeviceType;
8373
8574
  }({});
8374
8575
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -8546,6 +8747,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8546
8747
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8547
8748
  * real Switch device for UI rendering / export adapters. */
8548
8749
  DeviceRole["BinaryHelper"] = "binary-helper";
8750
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
8751
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
8752
+ DeviceRole["Outlet"] = "outlet";
8549
8753
  /** Generic motion / occupancy / moving event source. Distinct from
8550
8754
  * the camera accessory PirSensor role: that one is a camera child;
8551
8755
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8613,7 +8817,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8613
8817
  return DeviceRole;
8614
8818
  }({});
8615
8819
  //#endregion
8616
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
8820
+ //#region ../types/dist/composition-CB6PMT9p.mjs
8617
8821
  /**
8618
8822
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8619
8823
  *
@@ -11837,11 +12041,10 @@ var ClipModelMetaSchema = object({
11837
12041
  /**
11838
12042
  * The `vector-store` index this model's vectors live in. ONE feature space
11839
12043
  * per index: two models share an index only when their vectors are ranked
11840
- * against each other, which for CLIP means never across families. MobileCLIP
11841
- * S1 and S2 share `object-clip` for history (separated by the row's
11842
- * `modelId`); any other model gets its own.
12044
+ * against each other, which for CLIP means never across families. Every
12045
+ * model gets its own.
11843
12046
  */
11844
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12047
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
11845
12048
  /**
11846
12049
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
11847
12050
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -13020,8 +13223,13 @@ var AlertSeveritySchema = _enum([
13020
13223
  "info",
13021
13224
  "success",
13022
13225
  "warning",
13023
- "error"
13226
+ "error",
13227
+ "critical"
13024
13228
  ]);
13229
+ var AlertActionSchema = object({
13230
+ label: string(),
13231
+ href: string().optional()
13232
+ });
13025
13233
  var AlertStatusSchema = _enum([
13026
13234
  "active",
13027
13235
  "in-progress",
@@ -13039,6 +13247,7 @@ var AlertSchema = object({
13039
13247
  severity: AlertSeveritySchema,
13040
13248
  title: string(),
13041
13249
  message: string(),
13250
+ action: AlertActionSchema.optional(),
13042
13251
  status: AlertStatusSchema,
13043
13252
  progress: number().optional(),
13044
13253
  read: boolean(),
@@ -15574,6 +15783,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15574
15783
  keyField: string()
15575
15784
  }).optional()
15576
15785
  })) });
15786
+ /**
15787
+ * The report of a one-shot "move this owner's plaintext secrets into the
15788
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
15789
+ *
15790
+ * The owner runs it on its own rows, through its own write path; an operator
15791
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
15792
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
15793
+ */
15794
+ var RawSecretMigrationInputSchema = object({
15795
+ /** `false` (the default of the script) = report only. */
15796
+ apply: boolean() });
15797
+ var RawSecretMigrationReportSchema = object({
15798
+ apply: boolean(),
15799
+ /** Rows that can carry a secret (a profile, an enrolment). */
15800
+ rows: number().int(),
15801
+ /** Rows whose secret was plaintext when the run started. */
15802
+ raw: number().int(),
15803
+ /** Rows that already held a keychain marker when the run started. */
15804
+ markers: number().int(),
15805
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
15806
+ migrated: number().int(),
15807
+ /** Plaintext rows left in place because the move or its read-back failed. */
15808
+ failed: number().int(),
15809
+ /** After the run: rows still holding plaintext. */
15810
+ remainingRaw: number().int(),
15811
+ /** After the run: markers the keychain could not resolve right now. */
15812
+ unresolvedMarkers: number().int(),
15813
+ /**
15814
+ * A second, redundant copy of the secrets' rows that the run found (and, on
15815
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
15816
+ */
15817
+ redundantCopies: number().int().optional(),
15818
+ /** True when nothing is raw and every marker resolves. */
15819
+ verified: boolean()
15820
+ });
15577
15821
  /** Where a block runs. The operator chooses — a block driving a device on an
15578
15822
  * agent is the reason placement is not fixed to the hub. */
15579
15823
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -15800,6 +16044,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
15800
16044
  }), SettingsUpdateResultSchema, {
15801
16045
  kind: "mutation",
15802
16046
  auth: "admin"
16047
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16048
+ kind: "mutation",
16049
+ auth: "admin"
15803
16050
  }), method(object({}), object({ libs: array(object({
15804
16051
  filePath: string(),
15805
16052
  content: string()
@@ -16063,6 +16310,347 @@ id: union([string(), number()]) }), {
16063
16310
  auth: "admin"
16064
16311
  });
16065
16312
  /**
16313
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16314
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16315
+ * (operator intent, D870) and device-history (numbers over time, D850).
16316
+ *
16317
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16318
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16319
+ * that with the addon id closed over). It is deliberately NOT in any input
16320
+ * schema, so a session can never supply it, and a call with no stamp is refused
16321
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16322
+ * addons go through the owner's capability.
16323
+ *
16324
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16325
+ * never `[]`. Secret fields are never on the wire: a read shows the
16326
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16327
+ * resolves itself, and a write may carry only a keychain marker bound to the
16328
+ * row's own ref.
16329
+ *
16330
+ * Internal: addons reach it through `ctx.records`, never directly.
16331
+ */
16332
+ var RecordIdSchema = string().min(1).max(256);
16333
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16334
+ var RecordBodySchema = record(string(), unknown());
16335
+ var RecordInputSchema = object({
16336
+ id: RecordIdSchema,
16337
+ /** The device this row belongs to (D865 removal, per-device reads). */
16338
+ deviceId: number().int().optional(),
16339
+ /** The domain clock, ms: observed / created / opened. */
16340
+ at: number().int().optional(),
16341
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16342
+ expiresAt: number().int().optional(),
16343
+ data: RecordBodySchema
16344
+ });
16345
+ var RecordViewSchema = object({
16346
+ id: string(),
16347
+ deviceId: number().int().nullable(),
16348
+ at: number().nullable(),
16349
+ expiresAt: number().nullable(),
16350
+ rev: number().int(),
16351
+ updatedAt: number(),
16352
+ data: RecordBodySchema
16353
+ });
16354
+ /** Declared index fields only. Anything else does not compile, by design. */
16355
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16356
+ string(),
16357
+ number(),
16358
+ boolean(),
16359
+ object({ in: array(union([
16360
+ string(),
16361
+ number(),
16362
+ boolean()
16363
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16364
+ object({
16365
+ gt: union([string(), number()]).optional(),
16366
+ gte: union([string(), number()]).optional(),
16367
+ lt: union([string(), number()]).optional(),
16368
+ lte: union([string(), number()]).optional()
16369
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16370
+ ]));
16371
+ var KindShape = { kind: RecordKindNameSchema };
16372
+ var TimeWindowShape = {
16373
+ deviceId: number().int().optional(),
16374
+ atFrom: number().optional(),
16375
+ atTo: number().optional()
16376
+ };
16377
+ var RecordQueryInputSchema = object({
16378
+ ...KindShape,
16379
+ ...TimeWindowShape,
16380
+ where: RecordWhereSchema.optional(),
16381
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16382
+ order: _enum(["at", "id"]).optional(),
16383
+ desc: boolean().optional(),
16384
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16385
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16386
+ cursor: string().min(1).optional()
16387
+ });
16388
+ var RecordQueryResultSchema = object({
16389
+ records: array(RecordViewSchema),
16390
+ nextCursor: string().nullable()
16391
+ });
16392
+ var RecordKindStateSchema = _enum([
16393
+ "created",
16394
+ "unchanged",
16395
+ "updated"
16396
+ ]);
16397
+ var DeclareKindResultSchema = object({
16398
+ kindId: number().int(),
16399
+ state: RecordKindStateSchema,
16400
+ createdIndexes: array(string()),
16401
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16402
+ adoptionPending: object({
16403
+ legacyTable: string(),
16404
+ legacyRows: number().int()
16405
+ }).nullable()
16406
+ });
16407
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16408
+ var SecretRefsList = array(string());
16409
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16410
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16411
+ kind: "mutation",
16412
+ auth: "admin"
16413
+ }), method(object({
16414
+ ...KindShape,
16415
+ id: RecordIdSchema
16416
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16417
+ ...KindShape,
16418
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16419
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16420
+ ...KindShape,
16421
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16422
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16423
+ ...KindShape,
16424
+ record: RecordInputSchema,
16425
+ /** Compare-and-set. `0` means "the row must not exist". */
16426
+ ifRev: number().int().min(0).optional()
16427
+ }), object({
16428
+ rev: number().int(),
16429
+ releasedRefs: SecretRefsList
16430
+ }), {
16431
+ kind: "mutation",
16432
+ auth: "admin"
16433
+ }), method(object({
16434
+ ...KindShape,
16435
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16436
+ }), object({
16437
+ count: number().int(),
16438
+ releasedRefs: SecretRefsList
16439
+ }), {
16440
+ kind: "mutation",
16441
+ auth: "admin"
16442
+ }), method(object({
16443
+ ...KindShape,
16444
+ id: RecordIdSchema,
16445
+ data: RecordBodySchema,
16446
+ at: number().int().nullable().optional(),
16447
+ expiresAt: number().int().nullable().optional(),
16448
+ ifRev: number().int().min(1).optional()
16449
+ }), object({
16450
+ rev: number().int(),
16451
+ releasedRefs: SecretRefsList
16452
+ }), {
16453
+ kind: "mutation",
16454
+ auth: "admin"
16455
+ }), method(object({
16456
+ ...KindShape,
16457
+ id: RecordIdSchema
16458
+ }), object({
16459
+ deleted: boolean(),
16460
+ secretRefs: SecretRefsList
16461
+ }), {
16462
+ kind: "mutation",
16463
+ auth: "admin"
16464
+ }), method(object({
16465
+ ...KindShape,
16466
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16467
+ }), object({
16468
+ deleted: number().int(),
16469
+ secretRefs: SecretRefsList
16470
+ }), {
16471
+ kind: "mutation",
16472
+ auth: "admin"
16473
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16474
+ ...KindShape,
16475
+ ...TimeWindowShape,
16476
+ where: RecordWhereSchema.optional()
16477
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16478
+ ...KindShape,
16479
+ deviceId: number().int().optional(),
16480
+ from: number(),
16481
+ to: number(),
16482
+ bucketMs: number().int().positive()
16483
+ }), object({ buckets: array(object({
16484
+ bucketStart: number(),
16485
+ count: number().int()
16486
+ })) }), { auth: "admin" }), method(object({
16487
+ ...KindShape,
16488
+ op: _enum([
16489
+ "sum",
16490
+ "min",
16491
+ "max",
16492
+ "count"
16493
+ ]),
16494
+ field: RecordFieldPathSchema.optional(),
16495
+ groupBy: RecordFieldPathSchema.optional(),
16496
+ where: RecordWhereSchema.optional()
16497
+ }), object({ rows: array(object({
16498
+ group: union([
16499
+ string(),
16500
+ number(),
16501
+ _null()
16502
+ ]),
16503
+ value: number().nullable()
16504
+ })) }), { auth: "admin" }), method(object({
16505
+ ...KindShape,
16506
+ deviceId: number().int().optional(),
16507
+ atBefore: number().optional(),
16508
+ where: RecordWhereSchema.optional()
16509
+ }), object({
16510
+ deleted: number().int(),
16511
+ secretRefs: SecretRefsList
16512
+ }), {
16513
+ kind: "mutation",
16514
+ auth: "admin"
16515
+ }), method(object({
16516
+ deviceId: number().int(),
16517
+ kinds: array(RecordKindNameSchema).optional()
16518
+ }), object({
16519
+ deleted: record(string(), number().int()),
16520
+ secretRefs: SecretRefsList
16521
+ }), {
16522
+ kind: "mutation",
16523
+ auth: "admin"
16524
+ }), method(object(KindShape), object({ id: number().int() }), {
16525
+ kind: "mutation",
16526
+ auth: "admin"
16527
+ });
16528
+ /** One table of the settings database. */
16529
+ var StorageTableSchema = object({
16530
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
16531
+ name: string(),
16532
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
16533
+ owner: string().nullable(),
16534
+ rows: number().int().nonnegative(),
16535
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
16536
+ bytes: number().int().nonnegative().nullable(),
16537
+ /** Declared by an addon since this engine process started (a running addon claims it). */
16538
+ declaredThisBoot: boolean()
16539
+ });
16540
+ /** One declared record kind (D881) as System -> Data shows it. */
16541
+ var StorageKindSchema = object({
16542
+ owner: string(),
16543
+ kind: string(),
16544
+ database: _enum(["settings", "events"]),
16545
+ class: string(),
16546
+ state: _enum([
16547
+ "declared",
16548
+ "orphaned",
16549
+ "dropped"
16550
+ ]),
16551
+ /** `null` when the caller asked for no counts (`counts: false`). */
16552
+ rows: number().int().nonnegative().nullable(),
16553
+ /** Rows x the average size of a sample; null for an empty kind. */
16554
+ bytesEstimate: number().int().nonnegative().nullable(),
16555
+ writeTrigger: string(),
16556
+ retention: RecordRetentionSchema,
16557
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16558
+ entry: boolean(),
16559
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16560
+ declaration: RecordKindDeclarationSchema
16561
+ });
16562
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16563
+ collection: string().min(1),
16564
+ expectRows: number().int().nonnegative()
16565
+ }), object({
16566
+ dropped: literal(true),
16567
+ rows: number().int().nonnegative()
16568
+ }), {
16569
+ kind: "mutation",
16570
+ auth: "admin"
16571
+ }), method(object({
16572
+ owner: string().min(1).optional(),
16573
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16574
+ counts: boolean().optional()
16575
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16576
+ owner: string().min(1),
16577
+ kind: RecordKindNameSchema
16578
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16579
+ owner: string().min(1),
16580
+ kind: RecordKindNameSchema,
16581
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16582
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16583
+ complete: boolean().optional()
16584
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16585
+ kind: "mutation",
16586
+ auth: "admin"
16587
+ }), method(object({
16588
+ collection: string().min(1),
16589
+ cursor: string().optional(),
16590
+ limit: number().int().min(1).max(1e3).optional()
16591
+ }), object({
16592
+ rows: array(object({
16593
+ id: string(),
16594
+ data: record(string(), unknown())
16595
+ })),
16596
+ nextCursor: string().nullable()
16597
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16598
+ /**
16599
+ * record-entries - the ONE admin surface for every list of user-created entries
16600
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16601
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16602
+ *
16603
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16604
+ * the entry body with `secret: true` on every credential field, so a password
16605
+ * field is derived from the schema and never from a name. `putEntry` takes the
16606
+ * redaction token for an untouched secret (the stored value is kept), a string
16607
+ * for a new one, and the clear instruction to remove one. A read never carries
16608
+ * a secret value, and a locked keychain refuses the write with
16609
+ * `records/secret-unavailable` instead of storing plaintext.
16610
+ *
16611
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16612
+ */
16613
+ var EntryKindInfoSchema = object({
16614
+ owner: string(),
16615
+ kind: RecordKindNameSchema,
16616
+ title: string(),
16617
+ nameField: string(),
16618
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16619
+ fields: record(string(), unknown()),
16620
+ secretPaths: array(string()),
16621
+ rows: number().int().nonnegative()
16622
+ });
16623
+ var EntryViewSchema = object({
16624
+ id: RecordIdSchema,
16625
+ name: string(),
16626
+ rev: number().int(),
16627
+ updatedAt: number(),
16628
+ /** Secret fields hold the redaction token. */
16629
+ data: RecordBodySchema
16630
+ });
16631
+ var EntryAddress = {
16632
+ owner: string().min(1),
16633
+ kind: RecordKindNameSchema
16634
+ };
16635
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16636
+ ...EntryAddress,
16637
+ id: RecordIdSchema.optional(),
16638
+ data: RecordBodySchema,
16639
+ ifRev: number().int().min(1).optional()
16640
+ }), object({
16641
+ id: string(),
16642
+ rev: number().int()
16643
+ }), {
16644
+ kind: "mutation",
16645
+ auth: "admin"
16646
+ }), method(object({
16647
+ ...EntryAddress,
16648
+ id: RecordIdSchema
16649
+ }), object({ deleted: boolean() }), {
16650
+ kind: "mutation",
16651
+ auth: "admin"
16652
+ });
16653
+ /**
16066
16654
  * `keychain` — the hub's encrypted store of secret values (D787).
16067
16655
  *
16068
16656
  * Settings blobs never hold a secret: they hold a marker
@@ -16603,6 +17191,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16603
17191
  kind: "mutation",
16604
17192
  auth: "admin",
16605
17193
  caller: "required"
17194
+ }), method(object({
17195
+ ref: string().min(1),
17196
+ value: string().min(1)
17197
+ }), object({
17198
+ ref: string(),
17199
+ version: number().int()
17200
+ }), {
17201
+ kind: "mutation",
17202
+ auth: "admin",
17203
+ caller: "required"
16606
17204
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16607
17205
  deleted: array(string()).readonly(),
16608
17206
  kept: array(object({
@@ -39377,6 +39975,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39377
39975
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39378
39976
  kind: "mutation",
39379
39977
  auth: "admin"
39978
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
39979
+ kind: "mutation",
39980
+ auth: "admin"
39380
39981
  }), method(ProfileRefInputSchema, _void(), {
39381
39982
  kind: "mutation",
39382
39983
  auth: "admin"
@@ -49886,6 +50487,41 @@ var ServerRollbackInfoSchema = object({
49886
50487
  atMs: number(),
49887
50488
  reason: string()
49888
50489
  });
50490
+ /**
50491
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50492
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50493
+ * service holds, because only the hub plans) against the states the process
50494
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50495
+ * every boot, served on `getServerPackageStatus`.
50496
+ *
50497
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50498
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50499
+ * planned runner the process service has no entry for.
50500
+ */
50501
+ var RunnerRefusalSchema = object({
50502
+ runnerId: string(),
50503
+ addonIds: array(string()),
50504
+ reason: string()
50505
+ });
50506
+ var RunnerBootCheckSchema = object({
50507
+ checkedAtMs: number(),
50508
+ /** Runners planned for this node. */
50509
+ expected: number(),
50510
+ /** Planned runners whose process is `running`. */
50511
+ running: number(),
50512
+ failed: array(string()),
50513
+ refused: array(RunnerRefusalSchema),
50514
+ missing: array(string()),
50515
+ /**
50516
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50517
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50518
+ * pushed and the verdict is re-evaluated on the next runner state change.
50519
+ * Optional for version skew (absent = settled).
50520
+ */
50521
+ pending: array(string()).optional(),
50522
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50523
+ planKnown: boolean()
50524
+ });
49889
50525
  var ServerPackageStatusSchema = object({
49890
50526
  /** Root package name (`@camstack/server` on the hub). */
49891
50527
  packageName: string(),
@@ -49948,7 +50584,14 @@ var ServerPackageStatusSchema = object({
49948
50584
  * for version skew: an older provider's payload simply omits it, and an
49949
50585
  * absent wrapper is unknown — never `native`.
49950
50586
  */
49951
- wrapper: WrapperIdentitySchema.optional()
50587
+ wrapper: WrapperIdentitySchema.optional(),
50588
+ /**
50589
+ * What this node PLANNED to run against what its process service reports
50590
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50591
+ * on a provider that predates it. Absent is "not checked yet", never "all
50592
+ * well": a consumer that needs the answer treats it as pending.
50593
+ */
50594
+ runners: RunnerBootCheckSchema.optional()
49952
50595
  });
49953
50596
  var ServerUpdateCheckResultSchema = object({
49954
50597
  packageName: string(),
@@ -49999,6 +50642,13 @@ var ServerUpdateOutcomeSchema = _enum([
49999
50642
  "refused",
50000
50643
  "failed"
50001
50644
  ]);
50645
+ /** One addon the pre-flight found the target version would refuse (D877). */
50646
+ var UpdateBlockerSchema = object({
50647
+ addonId: string(),
50648
+ reason: string(),
50649
+ /** What the operator does about it. */
50650
+ remedy: string()
50651
+ });
50002
50652
  var ServerUpdateActionResultSchema = object({
50003
50653
  accepted: boolean(),
50004
50654
  targetVersion: string().nullable(),
@@ -50016,14 +50666,27 @@ var ServerUpdateActionResultSchema = object({
50016
50666
  * The failure itself, verbatim enough to act on (the npm output for a
50017
50667
  * staging install). Non-null only for `failed`.
50018
50668
  */
50019
- error: string().nullable().optional()
50669
+ error: string().nullable().optional(),
50670
+ /**
50671
+ * The addons the target version would refuse to start on this node's live
50672
+ * store (D877), present when the pre-flight refused the update
50673
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50674
+ */
50675
+ blockers: array(UpdateBlockerSchema).optional()
50020
50676
  });
50021
50677
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
50022
50678
  kind: "mutation",
50023
50679
  auth: "admin"
50024
- }), method(object({
50025
- /** Explicit target version; omitted = latest from the registry. */
50026
- version: string().optional() }), ServerUpdateActionResultSchema, {
50680
+ }), method(object({
50681
+ /** Explicit target version; omitted = latest from the registry. */
50682
+ version: string().optional(),
50683
+ /**
50684
+ * Apply even though the pre-flight (D877) found addons the target would
50685
+ * refuse to start. Off by default: those addons stay down until the
50686
+ * remedy is run, which is the incident this gate exists to prevent.
50687
+ */
50688
+ acknowledgeRefusals: boolean().optional()
50689
+ }), ServerUpdateActionResultSchema, {
50027
50690
  kind: "mutation",
50028
50691
  auth: "admin",
50029
50692
  timeoutMs: 16 * 6e4
@@ -52982,7 +53645,9 @@ var ManifestShapeSchema = object({
52982
53645
  var AddonProcessSchema = object({
52983
53646
  pid: number().optional(),
52984
53647
  mode: string(),
52985
- state: string()
53648
+ state: string(),
53649
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53650
+ reason: string().optional()
52986
53651
  });
52987
53652
  /**
52988
53653
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -53750,7 +54415,8 @@ var batteryCapability = {
53750
54415
  DeviceType.Button,
53751
54416
  DeviceType.Switch,
53752
54417
  DeviceType.PetFeeder,
53753
- DeviceType.Container
54418
+ DeviceType.Container,
54419
+ DeviceType.Thermostat
53754
54420
  ],
53755
54421
  methods: {
53756
54422
  /**
@@ -54371,6 +55037,12 @@ var ClimateControlStatusSchema = object({
54371
55037
  /** Horizontal louver swing on/off. Null when the device has no
54372
55038
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
54373
55039
  swingHorizontal: boolean().nullable(),
55040
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
55041
+ minTemp: number().nullable().optional(),
55042
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
55043
+ maxTemp: number().nullable().optional(),
55044
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
55045
+ tempStep: number().positive().nullable().optional(),
54374
55046
  /** Ms epoch when the slice was last updated (push or command). */
54375
55047
  lastFetchedAt: number()
54376
55048
  });
@@ -55217,6 +55889,125 @@ onStatusChanged: { data: object({
55217
55889
  * whether persisting is worth a SQLite commit. */
55218
55890
  volatileStateFields: ["lastChangedAt"]
55219
55891
  };
55892
+ /**
55893
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
55894
+ * consumable levels (salt, rinse aid) and common program options.
55895
+ *
55896
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
55897
+ * by any integration that exposes the same program / option surface.
55898
+ *
55899
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
55900
+ * provider refreshes the slice on an interval and eagerly after commands.
55901
+ */
55902
+ var DishwasherStateSchema = _enum([
55903
+ "idle",
55904
+ "running",
55905
+ "paused",
55906
+ "finished",
55907
+ "error",
55908
+ "unavailable"
55909
+ ]);
55910
+ var DishwasherConsumableLevelSchema = _enum([
55911
+ "ok",
55912
+ "low",
55913
+ "empty"
55914
+ ]);
55915
+ var DishwasherStatusSchema = object({
55916
+ state: DishwasherStateSchema,
55917
+ /** Active program id/name, or null when none selected / unknown. */
55918
+ program: string().nullable(),
55919
+ /** Program tokens the hardware accepts — drives the UI selector. */
55920
+ availablePrograms: array(string()),
55921
+ /** Minutes remaining on the active cycle, or null when not running. */
55922
+ remainingMinutes: number().int().nonnegative().nullable(),
55923
+ /** Cycle completion 0..100, or null when not applicable. */
55924
+ progressPercent: number().min(0).max(100).nullable(),
55925
+ /** True when the door is reported open. */
55926
+ doorOpen: boolean(),
55927
+ /** True when remote start is allowed (door closed, power on, etc.). */
55928
+ remoteStartAllowed: boolean(),
55929
+ /** Main power / switched-on state. */
55930
+ powerOn: boolean(),
55931
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
55932
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
55933
+ halfLoad: boolean(),
55934
+ hygienePlus: boolean(),
55935
+ errorCode: number().nullable(),
55936
+ errorLabel: string().nullable(),
55937
+ lastFetchedAt: number()
55938
+ });
55939
+ var dishwasherCapability = {
55940
+ name: "dishwasher",
55941
+ scope: "device",
55942
+ deviceNative: true,
55943
+ mode: "singleton",
55944
+ deviceTypes: [DeviceType.Dishwasher],
55945
+ methods: {
55946
+ start: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55947
+ kind: "mutation",
55948
+ auth: "protected"
55949
+ }),
55950
+ pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55951
+ kind: "mutation",
55952
+ auth: "protected"
55953
+ }),
55954
+ stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
55955
+ kind: "mutation",
55956
+ auth: "protected"
55957
+ }),
55958
+ setProgram: method(object({
55959
+ deviceId: number().int().nonnegative(),
55960
+ program: string().min(1)
55961
+ }), _void(), {
55962
+ kind: "mutation",
55963
+ auth: "protected"
55964
+ }),
55965
+ setPower: method(object({
55966
+ deviceId: number().int().nonnegative(),
55967
+ on: boolean()
55968
+ }), _void(), {
55969
+ kind: "mutation",
55970
+ auth: "protected"
55971
+ }),
55972
+ setHalfLoad: method(object({
55973
+ deviceId: number().int().nonnegative(),
55974
+ on: boolean()
55975
+ }), _void(), {
55976
+ kind: "mutation",
55977
+ auth: "protected"
55978
+ }),
55979
+ setHygienePlus: method(object({
55980
+ deviceId: number().int().nonnegative(),
55981
+ on: boolean()
55982
+ }), _void(), {
55983
+ kind: "mutation",
55984
+ auth: "protected"
55985
+ }),
55986
+ setOption: method(object({
55987
+ deviceId: number().int().nonnegative(),
55988
+ key: string().min(1),
55989
+ value: union([
55990
+ boolean(),
55991
+ string(),
55992
+ number()
55993
+ ])
55994
+ }), _void(), {
55995
+ kind: "mutation",
55996
+ auth: "protected"
55997
+ })
55998
+ },
55999
+ status: {
56000
+ schema: DishwasherStatusSchema,
56001
+ kind: "poll"
56002
+ },
56003
+ runtimeState: DishwasherStatusSchema,
56004
+ durability: "session",
56005
+ history: { fields: { progressPercent: {
56006
+ kind: "gauge",
56007
+ unit: "%",
56008
+ deadband: 2
56009
+ } } }
56010
+ };
55220
56011
  var DoorbellStatusSchema = object({
55221
56012
  /** Ms epoch of the last press. null = never observed since this provider started. */
55222
56013
  lastPressedAt: number().nullable(),
@@ -56019,6 +56810,32 @@ var gasCapability = {
56019
56810
  * whether persisting is worth a SQLite commit. */
56020
56811
  volatileStateFields: ["lastChangedAt"]
56021
56812
  };
56813
+ var HeatingValveStatusSchema = object({
56814
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
56815
+ position: number().min(0).max(100).nullable(),
56816
+ /** Ms epoch when the slice was last updated (push or poll). */
56817
+ lastFetchedAt: number()
56818
+ });
56819
+ var heatingValveCapability = {
56820
+ name: "heating-valve",
56821
+ scope: "device",
56822
+ deviceNative: true,
56823
+ mode: "singleton",
56824
+ deviceTypes: [DeviceType.Thermostat],
56825
+ methods: {},
56826
+ status: {
56827
+ schema: HeatingValveStatusSchema,
56828
+ kind: "push"
56829
+ },
56830
+ runtimeState: HeatingValveStatusSchema,
56831
+ durability: "session",
56832
+ history: { fields: { position: {
56833
+ kind: "gauge",
56834
+ unit: "%",
56835
+ deadband: 1
56836
+ } } },
56837
+ volatileStateFields: ["lastFetchedAt"]
56838
+ };
56022
56839
  /**
56023
56840
  * Humidifier / dehumidifier cap. Models HA `humidifier.*` entities —
56024
56841
  * an on/off actuator with an optional target-humidity setpoint and an
@@ -57151,7 +57968,19 @@ var TlsStatusSchema = object({
57151
57968
  sans: array(string()),
57152
57969
  caCertPem: string().nullable(),
57153
57970
  reissueError: string().nullable(),
57154
- restartRequired: boolean()
57971
+ restartRequired: boolean(),
57972
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
57973
+ caMissing: boolean(),
57974
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
57975
+ localCaConstrained: boolean().nullable(),
57976
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
57977
+ caReplacedAt: string().nullable(),
57978
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
57979
+ storedUpload: object({
57980
+ leafFingerprintSha256: string(),
57981
+ validTo: string(),
57982
+ hasCa: boolean()
57983
+ }).nullable()
57155
57984
  });
57156
57985
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
57157
57986
  /**
@@ -57207,6 +58036,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
57207
58036
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
57208
58037
  kind: "mutation",
57209
58038
  auth: "admin"
58039
+ }), method(_void(), TlsStatusSchema, {
58040
+ kind: "mutation",
58041
+ auth: "admin"
57210
58042
  });
57211
58043
  var LockControlStatusSchema = object({
57212
58044
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -64162,7 +64994,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64162
64994
  kind: "mutation",
64163
64995
  auth: "admin",
64164
64996
  access: "delete"
64165
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
64997
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
64998
+ kind: "mutation",
64999
+ auth: "admin",
65000
+ access: "create"
65001
+ }), method(object({
64166
65002
  userId: string(),
64167
65003
  code: string()
64168
65004
  }), object({ valid: boolean() }), {
@@ -65882,6 +66718,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
65882
66718
  dayNight: dayNightCapability,
65883
66719
  deviceDiscovery: deviceDiscoveryCapability,
65884
66720
  deviceStatus: deviceStatusCapability,
66721
+ dishwasher: dishwasherCapability,
65885
66722
  doorbell: doorbellCapability,
65886
66723
  enumSensor: enumSensorCapability,
65887
66724
  eventEmitter: eventEmitterCapability,
@@ -65889,6 +66726,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
65889
66726
  featureProbe: featureProbeCapability,
65890
66727
  flood: floodCapability,
65891
66728
  gas: gasCapability,
66729
+ heatingValve: heatingValveCapability,
65892
66730
  humidifier: humidifierCapability,
65893
66731
  humiditySensor: humiditySensorCapability,
65894
66732
  image: imageCapability,
@@ -65974,13 +66812,14 @@ var BaseDevice = class {
65974
66812
  get state() {
65975
66813
  if (!this._stateProxyCache) {
65976
66814
  const cache = {};
65977
- const handler = { get: (_target, key) => {
66815
+ const handler = { get: (target, key) => {
65978
66816
  const k = key;
65979
- if (k in cache) return cache[k];
66817
+ const existing = Reflect.get(target, k);
66818
+ if (existing !== void 0) return existing;
65980
66819
  const cap = DEVICE_LOCAL_STATE_CAPS[k];
65981
66820
  if (!cap) return void 0;
65982
66821
  const proxy = this.sliceProxy(cap);
65983
- cache[k] = proxy;
66822
+ Reflect.set(target, k, proxy);
65984
66823
  return proxy;
65985
66824
  } };
65986
66825
  this._stateProxyCache = new Proxy(cache, handler);
@@ -66179,7 +67018,7 @@ var BaseDevice = class {
66179
67018
  async updateSourceInfo(patch) {
66180
67019
  const next = mergeSourceInfo(this.sourceInfo, patch);
66181
67020
  this._sourceInfoCache = Object.freeze({ ...next });
66182
- const action = this.ctx.api?.deviceManager?.setMetadata;
67021
+ const action = this.ctx.api.deviceManager?.setMetadata;
66183
67022
  if (action) try {
66184
67023
  await action.mutate({
66185
67024
  deviceId: this.id,
@@ -66214,7 +67053,7 @@ var BaseDevice = class {
66214
67053
  * device boot on a meta refresh.
66215
67054
  */
66216
67055
  async refreshFeatures() {
66217
- const action = this.ctx.api?.deviceManager?.registerDevice;
67056
+ const action = this.ctx.api.deviceManager?.registerDevice;
66218
67057
  if (!action) return;
66219
67058
  try {
66220
67059
  await action.mutate({
@@ -66613,6 +67452,12 @@ var BaseDeviceProvider = class extends BaseAddon {
66613
67452
  provider: this
66614
67453
  }];
66615
67454
  }
67455
+ /** Flatten `super.onInitialize()` whether it returned an array or an envelope. */
67456
+ providerRegistrationsFromSuper(result) {
67457
+ if (Array.isArray(result)) return result;
67458
+ if (result !== void 0 && result.providers !== void 0) return [...result.providers];
67459
+ return [];
67460
+ }
66616
67461
  async onShutdown() {
66617
67462
  this._restoreShuttingDown = true;
66618
67463
  this.cancelRestoreRetries();
@@ -67139,7 +67984,11 @@ var BaseDeviceProvider = class extends BaseAddon {
67139
67984
  return toDeviceSummary(device, this.addonId);
67140
67985
  }
67141
67986
  };
67142
- 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;
67987
+ /** Map entry helper — concrete camera/hub classes widen to `DeviceConstructor<IDevice>`. */
67988
+ function widenDeviceConstructor(ctor) {
67989
+ return ctor;
67990
+ }
67991
+ 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;
67143
67992
  new Set(Object.values(DeviceType));
67144
67993
  Object.freeze({
67145
67994
  "accessories.getStatus": {
@@ -68288,6 +69137,12 @@ Object.freeze({
68288
69137
  addonId: null,
68289
69138
  access: "view"
68290
69139
  },
69140
+ "coreBlocks.migrateRawSecrets": {
69141
+ capName: "core-blocks",
69142
+ capScope: "system",
69143
+ addonId: null,
69144
+ access: "create"
69145
+ },
68291
69146
  "coreBlocks.restart": {
68292
69147
  capName: "core-blocks",
68293
69148
  capScope: "system",
@@ -69554,6 +70409,60 @@ Object.freeze({
69554
70409
  addonId: null,
69555
70410
  access: "view"
69556
70411
  },
70412
+ "dishwasher.getStatus": {
70413
+ capName: "dishwasher",
70414
+ capScope: "device",
70415
+ addonId: null,
70416
+ access: "view"
70417
+ },
70418
+ "dishwasher.pause": {
70419
+ capName: "dishwasher",
70420
+ capScope: "device",
70421
+ addonId: null,
70422
+ access: "create"
70423
+ },
70424
+ "dishwasher.setHalfLoad": {
70425
+ capName: "dishwasher",
70426
+ capScope: "device",
70427
+ addonId: null,
70428
+ access: "create"
70429
+ },
70430
+ "dishwasher.setHygienePlus": {
70431
+ capName: "dishwasher",
70432
+ capScope: "device",
70433
+ addonId: null,
70434
+ access: "create"
70435
+ },
70436
+ "dishwasher.setOption": {
70437
+ capName: "dishwasher",
70438
+ capScope: "device",
70439
+ addonId: null,
70440
+ access: "create"
70441
+ },
70442
+ "dishwasher.setPower": {
70443
+ capName: "dishwasher",
70444
+ capScope: "device",
70445
+ addonId: null,
70446
+ access: "create"
70447
+ },
70448
+ "dishwasher.setProgram": {
70449
+ capName: "dishwasher",
70450
+ capScope: "device",
70451
+ addonId: null,
70452
+ access: "create"
70453
+ },
70454
+ "dishwasher.start": {
70455
+ capName: "dishwasher",
70456
+ capScope: "device",
70457
+ addonId: null,
70458
+ access: "create"
70459
+ },
70460
+ "dishwasher.stop": {
70461
+ capName: "dishwasher",
70462
+ capScope: "device",
70463
+ addonId: null,
70464
+ access: "create"
70465
+ },
69557
70466
  "doorbell.getStatus": {
69558
70467
  capName: "doorbell",
69559
70468
  capScope: "device",
@@ -69764,6 +70673,12 @@ Object.freeze({
69764
70673
  addonId: null,
69765
70674
  access: "view"
69766
70675
  },
70676
+ "heatingValve.getStatus": {
70677
+ capName: "heating-valve",
70678
+ capScope: "device",
70679
+ addonId: null,
70680
+ access: "view"
70681
+ },
69767
70682
  "humidifier.getStatus": {
69768
70683
  capName: "humidifier",
69769
70684
  capScope: "device",
@@ -69974,6 +70889,12 @@ Object.freeze({
69974
70889
  addonId: null,
69975
70890
  access: "create"
69976
70891
  },
70892
+ "keychainAdmin.importSecret": {
70893
+ capName: "keychain-admin",
70894
+ capScope: "system",
70895
+ addonId: null,
70896
+ access: "create"
70897
+ },
69977
70898
  "keychainAdmin.listAudit": {
69978
70899
  capName: "keychain-admin",
69979
70900
  capScope: "system",
@@ -70142,6 +71063,12 @@ Object.freeze({
70142
71063
  addonId: null,
70143
71064
  access: "view"
70144
71065
  },
71066
+ "llm.migrateRawSecrets": {
71067
+ capName: "llm",
71068
+ capScope: "system",
71069
+ addonId: null,
71070
+ access: "create"
71071
+ },
70145
71072
  "llm.resolveModelRef": {
70146
71073
  capName: "llm",
70147
71074
  capScope: "system",
@@ -70370,6 +71297,12 @@ Object.freeze({
70370
71297
  addonId: null,
70371
71298
  access: "create"
70372
71299
  },
71300
+ "localNetwork.useStoredUploadedCertificate": {
71301
+ capName: "local-network",
71302
+ capScope: "system",
71303
+ addonId: null,
71304
+ access: "create"
71305
+ },
70373
71306
  "lockControl.getStatus": {
70374
71307
  capName: "lock-control",
70375
71308
  capScope: "device",
@@ -73022,6 +73955,30 @@ Object.freeze({
73022
73955
  addonId: null,
73023
73956
  access: "create"
73024
73957
  },
73958
+ "recordEntries.deleteEntry": {
73959
+ capName: "record-entries",
73960
+ capScope: "system",
73961
+ addonId: null,
73962
+ access: "delete"
73963
+ },
73964
+ "recordEntries.listEntries": {
73965
+ capName: "record-entries",
73966
+ capScope: "system",
73967
+ addonId: null,
73968
+ access: "view"
73969
+ },
73970
+ "recordEntries.listEntryKinds": {
73971
+ capName: "record-entries",
73972
+ capScope: "system",
73973
+ addonId: null,
73974
+ access: "view"
73975
+ },
73976
+ "recordEntries.putEntry": {
73977
+ capName: "record-entries",
73978
+ capScope: "system",
73979
+ addonId: null,
73980
+ access: "create"
73981
+ },
73025
73982
  "recording.getAvailability": {
73026
73983
  capName: "recording",
73027
73984
  capScope: "device",
@@ -73322,6 +74279,102 @@ Object.freeze({
73322
74279
  addonId: null,
73323
74280
  access: "view"
73324
74281
  },
74282
+ "records.aggregate": {
74283
+ capName: "records",
74284
+ capScope: "system",
74285
+ addonId: null,
74286
+ access: "view"
74287
+ },
74288
+ "records.allocateId": {
74289
+ capName: "records",
74290
+ capScope: "system",
74291
+ addonId: null,
74292
+ access: "create"
74293
+ },
74294
+ "records.count": {
74295
+ capName: "records",
74296
+ capScope: "system",
74297
+ addonId: null,
74298
+ access: "view"
74299
+ },
74300
+ "records.declareKinds": {
74301
+ capName: "records",
74302
+ capScope: "system",
74303
+ addonId: null,
74304
+ access: "create"
74305
+ },
74306
+ "records.delete": {
74307
+ capName: "records",
74308
+ capScope: "system",
74309
+ addonId: null,
74310
+ access: "delete"
74311
+ },
74312
+ "records.deleteDevice": {
74313
+ capName: "records",
74314
+ capScope: "system",
74315
+ addonId: null,
74316
+ access: "delete"
74317
+ },
74318
+ "records.deleteMany": {
74319
+ capName: "records",
74320
+ capScope: "system",
74321
+ addonId: null,
74322
+ access: "delete"
74323
+ },
74324
+ "records.deleteWhere": {
74325
+ capName: "records",
74326
+ capScope: "system",
74327
+ addonId: null,
74328
+ access: "delete"
74329
+ },
74330
+ "records.get": {
74331
+ capName: "records",
74332
+ capScope: "system",
74333
+ addonId: null,
74334
+ access: "view"
74335
+ },
74336
+ "records.getMany": {
74337
+ capName: "records",
74338
+ capScope: "system",
74339
+ addonId: null,
74340
+ access: "view"
74341
+ },
74342
+ "records.histogram": {
74343
+ capName: "records",
74344
+ capScope: "system",
74345
+ addonId: null,
74346
+ access: "view"
74347
+ },
74348
+ "records.patch": {
74349
+ capName: "records",
74350
+ capScope: "system",
74351
+ addonId: null,
74352
+ access: "create"
74353
+ },
74354
+ "records.put": {
74355
+ capName: "records",
74356
+ capScope: "system",
74357
+ addonId: null,
74358
+ access: "create"
74359
+ },
74360
+ "records.putMany": {
74361
+ capName: "records",
74362
+ capScope: "system",
74363
+ addonId: null,
74364
+ access: "create"
74365
+ },
74366
+ "records.query": {
74367
+ capName: "records",
74368
+ capScope: "system",
74369
+ addonId: null,
74370
+ access: "view"
74371
+ },
74372
+ "records.secretRefs": {
74373
+ capName: "records",
74374
+ capScope: "system",
74375
+ addonId: null,
74376
+ access: "view"
74377
+ },
73325
74378
  "sceneMonitor.captureReference": {
73326
74379
  capName: "scene-monitor",
73327
74380
  capScope: "device",
@@ -73754,6 +74807,48 @@ Object.freeze({
73754
74807
  addonId: null,
73755
74808
  access: "create"
73756
74809
  },
74810
+ "storageAdmin.adoptRecords": {
74811
+ capName: "storage-admin",
74812
+ capScope: "system",
74813
+ addonId: null,
74814
+ access: "create"
74815
+ },
74816
+ "storageAdmin.dropCollection": {
74817
+ capName: "storage-admin",
74818
+ capScope: "system",
74819
+ addonId: null,
74820
+ access: "delete"
74821
+ },
74822
+ "storageAdmin.isAdoptedLegacyTable": {
74823
+ capName: "storage-admin",
74824
+ capScope: "system",
74825
+ addonId: null,
74826
+ access: "view"
74827
+ },
74828
+ "storageAdmin.listKinds": {
74829
+ capName: "storage-admin",
74830
+ capScope: "system",
74831
+ addonId: null,
74832
+ access: "view"
74833
+ },
74834
+ "storageAdmin.listTables": {
74835
+ capName: "storage-admin",
74836
+ capScope: "system",
74837
+ addonId: null,
74838
+ access: "view"
74839
+ },
74840
+ "storageAdmin.readLegacyCollection": {
74841
+ capName: "storage-admin",
74842
+ capScope: "system",
74843
+ addonId: null,
74844
+ access: "view"
74845
+ },
74846
+ "storageAdmin.readRecords": {
74847
+ capName: "storage-admin",
74848
+ capScope: "system",
74849
+ addonId: null,
74850
+ access: "view"
74851
+ },
73757
74852
  "storageEvictable.evict": {
73758
74853
  capName: "storage-evictable",
73759
74854
  capScope: "system",
@@ -74666,6 +75761,12 @@ Object.freeze({
74666
75761
  addonId: null,
74667
75762
  access: "view"
74668
75763
  },
75764
+ "userManagement.migrateRawSecrets": {
75765
+ capName: "user-management",
75766
+ capScope: "system",
75767
+ addonId: null,
75768
+ access: "create"
75769
+ },
74669
75770
  "userManagement.oauthExchangeCode": {
74670
75771
  capName: "user-management",
74671
75772
  capScope: "system",
@@ -75165,7 +76266,7 @@ Object.freeze({
75165
76266
  access: "create"
75166
76267
  }
75167
76268
  });
75168
- 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;
76269
+ 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;
75169
76270
  DeviceFeature.BatteryOperated;
75170
76271
  /** Reject after `ms`; always clears its own timer. */
75171
76272
  async function withTimeout$1(promise, ms, label) {
@@ -76195,6 +77296,51 @@ Object.freeze({
76195
77296
  form: "single",
76196
77297
  optional: false
76197
77298
  }],
77299
+ "dishwasher.getStatus": [{
77300
+ name: "deviceId",
77301
+ form: "single",
77302
+ optional: false
77303
+ }],
77304
+ "dishwasher.pause": [{
77305
+ name: "deviceId",
77306
+ form: "single",
77307
+ optional: false
77308
+ }],
77309
+ "dishwasher.setHalfLoad": [{
77310
+ name: "deviceId",
77311
+ form: "single",
77312
+ optional: false
77313
+ }],
77314
+ "dishwasher.setHygienePlus": [{
77315
+ name: "deviceId",
77316
+ form: "single",
77317
+ optional: false
77318
+ }],
77319
+ "dishwasher.setOption": [{
77320
+ name: "deviceId",
77321
+ form: "single",
77322
+ optional: false
77323
+ }],
77324
+ "dishwasher.setPower": [{
77325
+ name: "deviceId",
77326
+ form: "single",
77327
+ optional: false
77328
+ }],
77329
+ "dishwasher.setProgram": [{
77330
+ name: "deviceId",
77331
+ form: "single",
77332
+ optional: false
77333
+ }],
77334
+ "dishwasher.start": [{
77335
+ name: "deviceId",
77336
+ form: "single",
77337
+ optional: false
77338
+ }],
77339
+ "dishwasher.stop": [{
77340
+ name: "deviceId",
77341
+ form: "single",
77342
+ optional: false
77343
+ }],
76198
77344
  "doorbell.getStatus": [{
76199
77345
  name: "deviceId",
76200
77346
  form: "single",
@@ -76264,6 +77410,11 @@ Object.freeze({
76264
77410
  form: "single",
76265
77411
  optional: false
76266
77412
  }],
77413
+ "heatingValve.getStatus": [{
77414
+ name: "deviceId",
77415
+ form: "single",
77416
+ optional: false
77417
+ }],
76267
77418
  "humidifier.getStatus": [{
76268
77419
  name: "deviceId",
76269
77420
  form: "single",
@@ -77548,6 +78699,37 @@ Object.freeze({
77548
78699
  form: "single",
77549
78700
  optional: false
77550
78701
  }],
78702
+ "records.count": [{
78703
+ name: "deviceId",
78704
+ form: "single",
78705
+ optional: true
78706
+ }],
78707
+ "records.deleteDevice": [{
78708
+ name: "deviceId",
78709
+ form: "single",
78710
+ optional: false
78711
+ }],
78712
+ "records.deleteWhere": [{
78713
+ name: "deviceId",
78714
+ form: "single",
78715
+ optional: true
78716
+ }],
78717
+ "records.histogram": [{
78718
+ name: "deviceId",
78719
+ form: "single",
78720
+ optional: true
78721
+ }],
78722
+ "records.putMany": [{
78723
+ name: "records",
78724
+ form: "object-array",
78725
+ optional: false,
78726
+ itemField: "deviceId"
78727
+ }],
78728
+ "records.query": [{
78729
+ name: "deviceId",
78730
+ form: "single",
78731
+ optional: true
78732
+ }],
77551
78733
  "sceneMonitor.captureReference": [{
77552
78734
  name: "deviceId",
77553
78735
  form: "single",
@@ -77664,6 +78846,17 @@ Object.freeze({
77664
78846
  form: "single",
77665
78847
  optional: false
77666
78848
  }],
78849
+ "storageAdmin.adoptRecords": [{
78850
+ name: "records",
78851
+ form: "object-array",
78852
+ optional: false,
78853
+ itemField: "deviceId"
78854
+ }],
78855
+ "storageAdmin.readRecords": [{
78856
+ name: "deviceId",
78857
+ form: "single",
78858
+ optional: true
78859
+ }],
77667
78860
  "streamBroker.acquireEgressTranscode": [{
77668
78861
  name: "deviceId",
77669
78862
  form: "single",
@@ -96002,7 +97195,7 @@ function isMeaningfulIdentifier(s) {
96002
97195
  var AmcrestProviderAddon = class extends BaseDeviceProvider {
96003
97196
  addonId = AMCREST_ADDON_ID;
96004
97197
  providerName = "Amcrest";
96005
- deviceClasses = { [DeviceType.Camera]: AmcrestCamera };
97198
+ deviceClasses = { [DeviceType.Camera]: widenDeviceConstructor(AmcrestCamera) };
96006
97199
  constructor() {
96007
97200
  super({});
96008
97201
  }
@@ -96025,7 +97218,7 @@ var AmcrestProviderAddon = class extends BaseDeviceProvider {
96025
97218
  throw new Error(`Amcrest: probe on ${host || "(unknown host)"} resolved neither mac nor host address — cannot persist a stable row key. Verify network reachability + credentials, then retry.`);
96026
97219
  }
96027
97220
  async onInitialize() {
96028
- const regs = await super.onInitialize();
97221
+ const regs = this.providerRegistrationsFromSuper(await super.onInitialize());
96029
97222
  this.clipService = createClipService({
96030
97223
  dataDir: this.ctx.dataDir,
96031
97224
  logger: this.ctx.logger,