@camstack/addon-provider-hikvision 1.2.151 → 1.2.152

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 +1044 -125
  2. package/dist/addon.mjs +1044 -125
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -13,7 +13,7 @@ import { Agent as Agent$1, request as request$1 } from "node:https";
13
13
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
14
14
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
15
15
  //#endregion
16
- //#region ../types/dist/event-category-C4hVnRo8.mjs
16
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
17
17
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
18
18
  EventCategory["SystemBoot"] = "system.boot";
19
19
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -77,6 +77,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
77
77
  * consumes this category and maps it to the `addon-crash-loop` kind.
78
78
  */
79
79
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
80
+ /**
81
+ * A runner whose addon refused to start with a typed reason (D877) - parked
82
+ * in `refused`, never counted by the crash breaker, retried on operator
83
+ * action. One event per refusal.
84
+ */
85
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
86
+ /**
87
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
88
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
89
+ * runner is still pending) and the alert centre (close a recovered runner).
90
+ */
91
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
92
+ /**
93
+ * The node's one-shot runner boot check (D877): planned runners against the
94
+ * process service, `degraded` when any is failed, refused or missing. The
95
+ * alert centre turns it into one alert and a direct critical push.
96
+ */
97
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
80
98
  EventCategory["AddonError"] = "addon.error";
81
99
  EventCategory["AddonPageReady"] = "addon.page-ready";
82
100
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -5401,7 +5419,7 @@ var ZodIssueCode = {
5401
5419
  var ZodFirstPartyTypeKind;
5402
5420
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5403
5421
  //#endregion
5404
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5422
+ //#region ../types/dist/sleep-bZIhUvjd.mjs
5405
5423
  /**
5406
5424
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5407
5425
  * window to float samples (D455).
@@ -5518,7 +5536,7 @@ function isKeychainStoredField(field) {
5518
5536
  var SECRET_CLEAR = { $secretClear: true };
5519
5537
  /** The `'***'` token D634 redaction writes for non-admins. */
5520
5538
  var LEGACY_DEVICE_REDACTION = "***";
5521
- function isRecord$2(value) {
5539
+ function isRecord$5(value) {
5522
5540
  return typeof value === "object" && value !== null && !Array.isArray(value);
5523
5541
  }
5524
5542
  function makeSecretMarker(ref) {
@@ -5529,12 +5547,12 @@ function makeSecretMarker(ref) {
5529
5547
  }
5530
5548
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5531
5549
  function isSecretMarker(value) {
5532
- if (!isRecord$2(value)) return false;
5550
+ if (!isRecord$5(value)) return false;
5533
5551
  const ref = value["$secret"];
5534
5552
  return typeof ref === "string" && ref.length > 0;
5535
5553
  }
5536
5554
  function isSecretClear(value) {
5537
- return isRecord$2(value) && value["$secretClear"] === true;
5555
+ return isRecord$5(value) && value["$secretClear"] === true;
5538
5556
  }
5539
5557
  /**
5540
5558
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6144,7 +6162,7 @@ var KeychainWriteRefusedError = class extends Error {
6144
6162
  }
6145
6163
  };
6146
6164
  var KEEP = { kind: "keep" };
6147
- function isRecord$1(value) {
6165
+ function isRecord$4(value) {
6148
6166
  return typeof value === "object" && value !== null && !Array.isArray(value);
6149
6167
  }
6150
6168
  function defaultMintId() {
@@ -6157,7 +6175,7 @@ function collectSecretMarkerRefs(value, out = []) {
6157
6175
  return out;
6158
6176
  }
6159
6177
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6160
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6178
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6161
6179
  return out;
6162
6180
  }
6163
6181
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6212,7 +6230,7 @@ function rowId(row, idKey) {
6212
6230
  return null;
6213
6231
  }
6214
6232
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6215
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6233
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6216
6234
  if (!Array.isArray(incoming)) {
6217
6235
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6218
6236
  return {
@@ -6228,7 +6246,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6228
6246
  const kept = /* @__PURE__ */ new Set();
6229
6247
  const rows = [];
6230
6248
  for (const row of incoming) {
6231
- if (!isRecord$1(row)) {
6249
+ if (!isRecord$4(row)) {
6232
6250
  rows.push(row);
6233
6251
  continue;
6234
6252
  }
@@ -6253,7 +6271,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6253
6271
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6254
6272
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6255
6273
  case "object": {
6256
- if (!isRecord$1(incoming)) {
6274
+ if (!isRecord$4(incoming)) {
6257
6275
  if (incoming === void 0) return KEEP;
6258
6276
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6259
6277
  return {
@@ -6261,7 +6279,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6261
6279
  value: incoming
6262
6280
  };
6263
6281
  }
6264
- const storedObj = isRecord$1(stored) ? stored : {};
6282
+ const storedObj = isRecord$4(stored) ? stored : {};
6265
6283
  return {
6266
6284
  kind: "value",
6267
6285
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6384,7 +6402,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6384
6402
  value: items
6385
6403
  };
6386
6404
  }
6387
- if (isRecord$1(v)) {
6405
+ if (isRecord$4(v)) {
6388
6406
  const out = {};
6389
6407
  for (const [k, child] of Object.entries(v)) {
6390
6408
  const s = substitute(child);
@@ -6416,7 +6434,7 @@ var SecretOverwriteRefusedError = class extends Error {
6416
6434
  this.name = "SecretOverwriteRefusedError";
6417
6435
  }
6418
6436
  };
6419
- function isRecord(value) {
6437
+ function isRecord$3(value) {
6420
6438
  return typeof value === "object" && value !== null && !Array.isArray(value);
6421
6439
  }
6422
6440
  function resolvedValue(pass, marker) {
@@ -6445,7 +6463,7 @@ function inArray(pass, incoming, stored) {
6445
6463
  return incoming.map((item, index) => {
6446
6464
  const twin = stored[index];
6447
6465
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6448
- if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6466
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6449
6467
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6450
6468
  return item;
6451
6469
  });
@@ -6456,7 +6474,7 @@ function inArrayRow(pass, incoming, stored) {
6456
6474
  const twin = stored[key];
6457
6475
  if (isSecretMarker(twin)) {
6458
6476
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6459
- } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6477
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6460
6478
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6461
6479
  }
6462
6480
  return out;
@@ -6464,7 +6482,7 @@ function inArrayRow(pass, incoming, stored) {
6464
6482
  async function walk(pass, incoming, stored) {
6465
6483
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6466
6484
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6467
- if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6485
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6468
6486
  const out = { ...incoming };
6469
6487
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6470
6488
  return out;
@@ -6495,7 +6513,7 @@ async function restoreUnchangedSecrets(input) {
6495
6513
  function isJsonEqual(a, b) {
6496
6514
  if (Object.is(a, b)) return true;
6497
6515
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6498
- if (isRecord(a) && isRecord(b)) {
6516
+ if (isRecord$3(a) && isRecord$3(b)) {
6499
6517
  const keys = Object.keys(a);
6500
6518
  if (keys.length !== Object.keys(b).length) return false;
6501
6519
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -6519,7 +6537,7 @@ function markerKeysOf(blob, owner) {
6519
6537
  }
6520
6538
  function nodeFromStored(value, owner) {
6521
6539
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6522
- if (!isRecord(value)) return null;
6540
+ if (!isRecord$3(value)) return null;
6523
6541
  const children = /* @__PURE__ */ new Map();
6524
6542
  for (const [key, child] of Object.entries(value)) {
6525
6543
  const node = nodeFromStored(child, owner);
@@ -6652,7 +6670,6 @@ function createHandle(raw, opts) {
6652
6670
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6653
6671
  const readAddonStoreResult = raw.readAddonStoreResult;
6654
6672
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6655
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6656
6673
  const overrides = {
6657
6674
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6658
6675
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6676,12 +6693,12 @@ function createHandle(raw, opts) {
6676
6693
  };
6677
6694
  } } : {},
6678
6695
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6679
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6680
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6696
+ readDeviceStoreBatch: async (deviceIds) => {
6697
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6681
6698
  const out = /* @__PURE__ */ new Map();
6682
6699
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6683
6700
  return out;
6684
- } } : {},
6701
+ },
6685
6702
  writeAddonStore: async (patch) => {
6686
6703
  await writeAddon(patch);
6687
6704
  },
@@ -7308,7 +7325,7 @@ var BaseAddon = class {
7308
7325
  if (!ctx) return;
7309
7326
  const addonId = ctx.id;
7310
7327
  setImmediate(() => {
7311
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7328
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7312
7329
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7313
7330
  }).catch((err) => {
7314
7331
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7508,7 +7525,7 @@ var BaseAddon = class {
7508
7525
  return this._addonSecretTree;
7509
7526
  }
7510
7527
  deviceSecretTree() {
7511
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7528
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7512
7529
  return this._deviceSecretTree;
7513
7530
  }
7514
7531
  /**
@@ -7584,42 +7601,135 @@ var BaseAddon = class {
7584
7601
  this[timerOf] = timer;
7585
7602
  }
7586
7603
  /**
7587
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7588
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7589
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7590
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7604
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7605
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7591
7606
  * addon permanently broken.
7592
7607
  *
7593
- * Retry only the two known infra fingerprints. Anything else propagates so
7594
- * real bugs surface immediately. After the budget expires we fall back to
7595
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7608
+ * Two kinds of outage, two budgets:
7609
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7610
+ * initialized`, `provider not available`): a short budget, then the addon
7611
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7612
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7613
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7614
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7615
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7616
+ * loop. A long, bounded budget; only after it the error propagates - the
7617
+ * addon never runs on defaults for a store it could not ask.
7618
+ * Anything else propagates immediately so real bugs surface.
7596
7619
  */
7597
7620
  async readAddonStoreWithRetry() {
7598
7621
  const settings = this.rawSettings();
7599
7622
  if (!settings) return {};
7600
- const delaysMs = [
7601
- 150,
7602
- 350,
7603
- 600,
7604
- 900
7605
- ];
7606
7623
  let lastErr;
7607
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7624
+ for (let attempt = 0;; attempt++) try {
7608
7625
  const stored = await settings.readAddonStore() ?? {};
7609
7626
  this.settingsStoreReady = true;
7610
7627
  return stored;
7611
7628
  } catch (err) {
7612
7629
  lastErr = err;
7613
- const msg = err instanceof Error ? err.message : String(err);
7614
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7615
- if (attempt === delaysMs.length) break;
7616
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7630
+ const kind = classifyStoreError(err);
7631
+ if (kind === "permanent") throw err;
7632
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7633
+ if (delay === void 0) {
7634
+ if (kind === "transport") throw err;
7635
+ break;
7636
+ }
7637
+ await new Promise((r) => setTimeout(r, delay));
7617
7638
  }
7618
7639
  this.settingsStoreReady = false;
7619
7640
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7620
7641
  return {};
7621
7642
  }
7622
7643
  };
7644
+ /** The settings store's own restart fingerprints. */
7645
+ var RESTART_RETRY_DELAYS_MS = [
7646
+ 150,
7647
+ 350,
7648
+ 600,
7649
+ 900
7650
+ ];
7651
+ /** A hub restarting under a booting runner: ~100 s in total. */
7652
+ var TRANSPORT_RETRY_DELAYS_MS = [
7653
+ 150,
7654
+ 350,
7655
+ 600,
7656
+ 900,
7657
+ 2e3,
7658
+ 5e3,
7659
+ 1e4,
7660
+ 2e4,
7661
+ 3e4,
7662
+ 3e4
7663
+ ];
7664
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7665
+ /** Node / socket error codes of a connection that did not happen or broke. */
7666
+ var TRANSPORT_CODES = new Set([
7667
+ "ECONNREFUSED",
7668
+ "ECONNRESET",
7669
+ "ETIMEDOUT",
7670
+ "EPIPE",
7671
+ "EHOSTUNREACH",
7672
+ "ENETUNREACH"
7673
+ ]);
7674
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7675
+ var UNAVAILABLE_TRPC_CODES = new Set([
7676
+ "TIMEOUT",
7677
+ "SERVICE_UNAVAILABLE",
7678
+ "BAD_GATEWAY",
7679
+ "GATEWAY_TIMEOUT"
7680
+ ]);
7681
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7682
+ var TRANSPORT_PHRASES = [
7683
+ "discovery deadline exceeded",
7684
+ "parent could not route child unowned cap call",
7685
+ "UDS request timed out after",
7686
+ "channel closed"
7687
+ ];
7688
+ /** Moleculer error `type`s of a call that could not be served right now. */
7689
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7690
+ "REQUEST_TIMEOUT",
7691
+ "SERVICE_NOT_FOUND",
7692
+ "SERVICE_NOT_AVAILABLE",
7693
+ "REQUEST_REJECTED",
7694
+ "BROKER_DISCONNECTED"
7695
+ ]);
7696
+ function stringProp(value, key) {
7697
+ if (typeof value !== "object" || value === null) return void 0;
7698
+ const found = Reflect.get(value, key);
7699
+ return typeof found === "string" ? found : void 0;
7700
+ }
7701
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7702
+ function errorCode(err) {
7703
+ const out = {};
7704
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7705
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7706
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7707
+ if (node !== void 0) out.node = node;
7708
+ const trpc = stringProp(data, "code");
7709
+ if (trpc !== void 0) out.trpc = trpc;
7710
+ return out;
7711
+ }
7712
+ /**
7713
+ * Is a settings read failure worth retrying, and with which budget? Only
7714
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7715
+ * one of the exact phrases our own transport raises. A message that merely
7716
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7717
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7718
+ */
7719
+ function classifyStoreError(err) {
7720
+ const message = err instanceof Error ? err.message : String(err);
7721
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7722
+ const code = errorCode(err);
7723
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7724
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7725
+ if (typeof err === "object" && err !== null) {
7726
+ if (Reflect.get(err, "retryable") === true) return "transport";
7727
+ const type = stringProp(err, "type");
7728
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7729
+ }
7730
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7731
+ return "permanent";
7732
+ }
7623
7733
  /**
7624
7734
  * Collect the keys of every field marked `perNode: true`, recursing into
7625
7735
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7709,6 +7819,156 @@ var PeerBytesTicketSchema = object({
7709
7819
  */
7710
7820
  declaredBytes: number().int().nonnegative().nullable()
7711
7821
  });
7822
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7823
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7824
+ var RECORD_DATABASES = ["settings", "events"];
7825
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7826
+ var RECORD_CLASSES = [
7827
+ "config",
7828
+ "ledger",
7829
+ "audit",
7830
+ "mirror",
7831
+ "ephemeral"
7832
+ ];
7833
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7834
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7835
+ var RECORD_BATCH_MAX = 1e3;
7836
+ var RECORD_QUERY_MAX = 1e3;
7837
+ function defOf(schema) {
7838
+ const zodBag = Reflect.get(schema, "_zod");
7839
+ if (typeof zodBag !== "object" || zodBag === null) return {};
7840
+ const def = Reflect.get(zodBag, "def");
7841
+ if (typeof def !== "object" || def === null) return {};
7842
+ return def;
7843
+ }
7844
+ function declaredHere(schema) {
7845
+ return globalRegistry.get(schema)?.secret === true;
7846
+ }
7847
+ /** Wrapper kinds whose `innerType` is the field itself. */
7848
+ var WRAPPERS = new Set([
7849
+ "optional",
7850
+ "nullable",
7851
+ "default",
7852
+ "prefault",
7853
+ "catch",
7854
+ "readonly",
7855
+ "nonoptional"
7856
+ ]);
7857
+ /**
7858
+ * The schema layers that make up ONE field: the schema itself and every
7859
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
7860
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
7861
+ * `.transform` on `in`).
7862
+ */
7863
+ function layersOf(schema) {
7864
+ const out = [];
7865
+ const queue = [schema];
7866
+ while (queue.length > 0) {
7867
+ const s = queue.shift();
7868
+ if (!s || out.includes(s)) continue;
7869
+ out.push(s);
7870
+ const def = defOf(s);
7871
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
7872
+ if (def.type === "pipe") {
7873
+ if (def.in) queue.push(def.in);
7874
+ if (def.out) queue.push(def.out);
7875
+ }
7876
+ }
7877
+ return out;
7878
+ }
7879
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
7880
+ function isZodSecret(schema) {
7881
+ return layersOf(schema).some(declaredHere);
7882
+ }
7883
+ /**
7884
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
7885
+ * element of this array" (`connection.password`, `rows[].token`). A declared
7886
+ * object or array is reported as one path and not descended into — everything
7887
+ * under it is secret.
7888
+ */
7889
+ function collectZodSecretPaths(schema, prefix = "") {
7890
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
7891
+ const paths = [];
7892
+ for (const layer of layersOf(schema)) {
7893
+ const def = defOf(layer);
7894
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
7895
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
7896
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
7897
+ else if (def.type === "intersection") {
7898
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
7899
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
7900
+ }
7901
+ }
7902
+ return [...new Set(paths)];
7903
+ }
7904
+ /**
7905
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
7906
+ * Zod row schema that describes it, and the helper that turns the two into the
7907
+ * JSON the engine stores.
7908
+ *
7909
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
7910
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
7911
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
7912
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
7913
+ * never a field name (D879).
7914
+ */
7915
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
7916
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
7917
+ var RecordIndexSchema = object({
7918
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
7919
+ fields: array(RecordFieldPathSchema).min(1).max(4),
7920
+ unique: boolean().optional()
7921
+ }).strict();
7922
+ var RecordRetentionSchema = union([
7923
+ object({
7924
+ ttlMs: number().int().positive(),
7925
+ from: _enum(["at", "write"])
7926
+ }).strict(),
7927
+ object({
7928
+ maxRows: number().int().positive().optional(),
7929
+ maxRowsPerDevice: number().int().positive().optional()
7930
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
7931
+ object({
7932
+ owner: string().min(1),
7933
+ reason: string().min(1)
7934
+ }).strict(),
7935
+ object({ none: string().min(1) }).strict()
7936
+ ]);
7937
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
7938
+ var EntryDescriptorSchema = object({
7939
+ title: string().min(1),
7940
+ /** The record body field shown as the entry's name. */
7941
+ nameField: string().min(1),
7942
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
7943
+ fields: record(string(), unknown())
7944
+ }).strict();
7945
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
7946
+ var RecordKindDeclarationSchema = object({
7947
+ database: _enum(RECORD_DATABASES).default("settings"),
7948
+ class: _enum(RECORD_CLASSES),
7949
+ writeTrigger: string().min(1),
7950
+ device: _enum([
7951
+ "required",
7952
+ "optional",
7953
+ "none"
7954
+ ]).default("none"),
7955
+ at: _enum(["required", "none"]).default("none"),
7956
+ indexes: array(RecordIndexSchema).max(8).default([]),
7957
+ retention: RecordRetentionSchema,
7958
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
7959
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
7960
+ /** Derived from the Zod schema; never written by hand. */
7961
+ secretPaths: array(string().min(1)).default([]),
7962
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
7963
+ secretArrayKeys: record(string(), string()).default({}),
7964
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
7965
+ adoptsFrom: string().min(1).optional(),
7966
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
7967
+ transactFamily: string().min(1).optional(),
7968
+ entry: EntryDescriptorSchema.optional()
7969
+ }).strict();
7970
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
7971
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
7712
7972
  /** Shared Zod schemas used across streaming capabilities. */
7713
7973
  var CamProfileSchema = _enum([
7714
7974
  "high",
@@ -8185,69 +8445,6 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8185
8445
  kind: "mutation",
8186
8446
  auth: "admin"
8187
8447
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
8188
- function defOf(schema) {
8189
- return schema._zod?.def ?? {};
8190
- }
8191
- function declaredHere(schema) {
8192
- return globalRegistry.get(schema)?.secret === true;
8193
- }
8194
- /** Wrapper kinds whose `innerType` is the field itself. */
8195
- var WRAPPERS = new Set([
8196
- "optional",
8197
- "nullable",
8198
- "default",
8199
- "prefault",
8200
- "catch",
8201
- "readonly",
8202
- "nonoptional"
8203
- ]);
8204
- /**
8205
- * The schema layers that make up ONE field: the schema itself and every
8206
- * wrapper below it (optional / default / nullable / readonly / catch), plus
8207
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8208
- * `.transform` on `in`).
8209
- */
8210
- function layersOf(schema) {
8211
- const out = [];
8212
- const queue = [schema];
8213
- while (queue.length > 0) {
8214
- const s = queue.shift();
8215
- if (!s || out.includes(s)) continue;
8216
- out.push(s);
8217
- const def = defOf(s);
8218
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8219
- if (def.type === "pipe") {
8220
- if (def.in) queue.push(def.in);
8221
- if (def.out) queue.push(def.out);
8222
- }
8223
- }
8224
- return out;
8225
- }
8226
- /** True when any layer of this field declares `.meta({ secret: true })`. */
8227
- function isZodSecret(schema) {
8228
- return layersOf(schema).some(declaredHere);
8229
- }
8230
- /**
8231
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
8232
- * element of this array" (`connection.password`, `rows[].token`). A declared
8233
- * object or array is reported as one path and not descended into — everything
8234
- * under it is secret.
8235
- */
8236
- function collectZodSecretPaths(schema, prefix = "") {
8237
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8238
- const paths = [];
8239
- for (const layer of layersOf(schema)) {
8240
- const def = defOf(layer);
8241
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8242
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8243
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8244
- else if (def.type === "intersection") {
8245
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8246
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8247
- }
8248
- }
8249
- return [...new Set(paths)];
8250
- }
8251
8448
  object({
8252
8449
  code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
8253
8450
  params: record(string(), union([string(), number()])).optional()
@@ -8267,7 +8464,7 @@ function userError(code, params, englishFallback) {
8267
8464
  return new CamstackError(code, params, englishFallback);
8268
8465
  }
8269
8466
  //#endregion
8270
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8467
+ //#region ../types/dist/err-msg--2RrYiLO.mjs
8271
8468
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8272
8469
  DeviceType["Camera"] = "camera";
8273
8470
  DeviceType["Hub"] = "hub";
@@ -8536,6 +8733,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8536
8733
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8537
8734
  * real Switch device for UI rendering / export adapters. */
8538
8735
  DeviceRole["BinaryHelper"] = "binary-helper";
8736
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
8737
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
8738
+ DeviceRole["Outlet"] = "outlet";
8539
8739
  /** Generic motion / occupancy / moving event source. Distinct from
8540
8740
  * the camera accessory PirSensor role: that one is a camera child;
8541
8741
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8603,7 +8803,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8603
8803
  return DeviceRole;
8604
8804
  }({});
8605
8805
  //#endregion
8606
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
8806
+ //#region ../types/dist/composition-DOwQB_Ua.mjs
8607
8807
  /**
8608
8808
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8609
8809
  *
@@ -12108,11 +12308,10 @@ var ClipModelMetaSchema = object({
12108
12308
  /**
12109
12309
  * The `vector-store` index this model's vectors live in. ONE feature space
12110
12310
  * per index: two models share an index only when their vectors are ranked
12111
- * against each other, which for CLIP means never across families. MobileCLIP
12112
- * S1 and S2 share `object-clip` for history (separated by the row's
12113
- * `modelId`); any other model gets its own.
12311
+ * against each other, which for CLIP means never across families. Every
12312
+ * model gets its own.
12114
12313
  */
12115
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12314
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
12116
12315
  /**
12117
12316
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
12118
12317
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -15845,6 +16044,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15845
16044
  keyField: string()
15846
16045
  }).optional()
15847
16046
  })) });
16047
+ /**
16048
+ * The report of a one-shot "move this owner's plaintext secrets into the
16049
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
16050
+ *
16051
+ * The owner runs it on its own rows, through its own write path; an operator
16052
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
16053
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
16054
+ */
16055
+ var RawSecretMigrationInputSchema = object({
16056
+ /** `false` (the default of the script) = report only. */
16057
+ apply: boolean() });
16058
+ var RawSecretMigrationReportSchema = object({
16059
+ apply: boolean(),
16060
+ /** Rows that can carry a secret (a profile, an enrolment). */
16061
+ rows: number().int(),
16062
+ /** Rows whose secret was plaintext when the run started. */
16063
+ raw: number().int(),
16064
+ /** Rows that already held a keychain marker when the run started. */
16065
+ markers: number().int(),
16066
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
16067
+ migrated: number().int(),
16068
+ /** Plaintext rows left in place because the move or its read-back failed. */
16069
+ failed: number().int(),
16070
+ /** After the run: rows still holding plaintext. */
16071
+ remainingRaw: number().int(),
16072
+ /** After the run: markers the keychain could not resolve right now. */
16073
+ unresolvedMarkers: number().int(),
16074
+ /**
16075
+ * A second, redundant copy of the secrets' rows that the run found (and, on
16076
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
16077
+ */
16078
+ redundantCopies: number().int().optional(),
16079
+ /** True when nothing is raw and every marker resolves. */
16080
+ verified: boolean()
16081
+ });
15848
16082
  /** Where a block runs. The operator chooses — a block driving a device on an
15849
16083
  * agent is the reason placement is not fixed to the hub. */
15850
16084
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -16071,6 +16305,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
16071
16305
  }), SettingsUpdateResultSchema, {
16072
16306
  kind: "mutation",
16073
16307
  auth: "admin"
16308
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16309
+ kind: "mutation",
16310
+ auth: "admin"
16074
16311
  }), method(object({}), object({ libs: array(object({
16075
16312
  filePath: string(),
16076
16313
  content: string()
@@ -16334,6 +16571,347 @@ id: union([string(), number()]) }), {
16334
16571
  auth: "admin"
16335
16572
  });
16336
16573
  /**
16574
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16575
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16576
+ * (operator intent, D870) and device-history (numbers over time, D850).
16577
+ *
16578
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16579
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16580
+ * that with the addon id closed over). It is deliberately NOT in any input
16581
+ * schema, so a session can never supply it, and a call with no stamp is refused
16582
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16583
+ * addons go through the owner's capability.
16584
+ *
16585
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16586
+ * never `[]`. Secret fields are never on the wire: a read shows the
16587
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16588
+ * resolves itself, and a write may carry only a keychain marker bound to the
16589
+ * row's own ref.
16590
+ *
16591
+ * Internal: addons reach it through `ctx.records`, never directly.
16592
+ */
16593
+ var RecordIdSchema = string().min(1).max(256);
16594
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16595
+ var RecordBodySchema = record(string(), unknown());
16596
+ var RecordInputSchema = object({
16597
+ id: RecordIdSchema,
16598
+ /** The device this row belongs to (D865 removal, per-device reads). */
16599
+ deviceId: number().int().optional(),
16600
+ /** The domain clock, ms: observed / created / opened. */
16601
+ at: number().int().optional(),
16602
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16603
+ expiresAt: number().int().optional(),
16604
+ data: RecordBodySchema
16605
+ });
16606
+ var RecordViewSchema = object({
16607
+ id: string(),
16608
+ deviceId: number().int().nullable(),
16609
+ at: number().nullable(),
16610
+ expiresAt: number().nullable(),
16611
+ rev: number().int(),
16612
+ updatedAt: number(),
16613
+ data: RecordBodySchema
16614
+ });
16615
+ /** Declared index fields only. Anything else does not compile, by design. */
16616
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16617
+ string(),
16618
+ number(),
16619
+ boolean(),
16620
+ object({ in: array(union([
16621
+ string(),
16622
+ number(),
16623
+ boolean()
16624
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16625
+ object({
16626
+ gt: union([string(), number()]).optional(),
16627
+ gte: union([string(), number()]).optional(),
16628
+ lt: union([string(), number()]).optional(),
16629
+ lte: union([string(), number()]).optional()
16630
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16631
+ ]));
16632
+ var KindShape = { kind: RecordKindNameSchema };
16633
+ var TimeWindowShape = {
16634
+ deviceId: number().int().optional(),
16635
+ atFrom: number().optional(),
16636
+ atTo: number().optional()
16637
+ };
16638
+ var RecordQueryInputSchema = object({
16639
+ ...KindShape,
16640
+ ...TimeWindowShape,
16641
+ where: RecordWhereSchema.optional(),
16642
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16643
+ order: _enum(["at", "id"]).optional(),
16644
+ desc: boolean().optional(),
16645
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16646
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16647
+ cursor: string().min(1).optional()
16648
+ });
16649
+ var RecordQueryResultSchema = object({
16650
+ records: array(RecordViewSchema),
16651
+ nextCursor: string().nullable()
16652
+ });
16653
+ var RecordKindStateSchema = _enum([
16654
+ "created",
16655
+ "unchanged",
16656
+ "updated"
16657
+ ]);
16658
+ var DeclareKindResultSchema = object({
16659
+ kindId: number().int(),
16660
+ state: RecordKindStateSchema,
16661
+ createdIndexes: array(string()),
16662
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16663
+ adoptionPending: object({
16664
+ legacyTable: string(),
16665
+ legacyRows: number().int()
16666
+ }).nullable()
16667
+ });
16668
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16669
+ var SecretRefsList = array(string());
16670
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16671
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16672
+ kind: "mutation",
16673
+ auth: "admin"
16674
+ }), method(object({
16675
+ ...KindShape,
16676
+ id: RecordIdSchema
16677
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16678
+ ...KindShape,
16679
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16680
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16681
+ ...KindShape,
16682
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16683
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16684
+ ...KindShape,
16685
+ record: RecordInputSchema,
16686
+ /** Compare-and-set. `0` means "the row must not exist". */
16687
+ ifRev: number().int().min(0).optional()
16688
+ }), object({
16689
+ rev: number().int(),
16690
+ releasedRefs: SecretRefsList
16691
+ }), {
16692
+ kind: "mutation",
16693
+ auth: "admin"
16694
+ }), method(object({
16695
+ ...KindShape,
16696
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16697
+ }), object({
16698
+ count: number().int(),
16699
+ releasedRefs: SecretRefsList
16700
+ }), {
16701
+ kind: "mutation",
16702
+ auth: "admin"
16703
+ }), method(object({
16704
+ ...KindShape,
16705
+ id: RecordIdSchema,
16706
+ data: RecordBodySchema,
16707
+ at: number().int().nullable().optional(),
16708
+ expiresAt: number().int().nullable().optional(),
16709
+ ifRev: number().int().min(1).optional()
16710
+ }), object({
16711
+ rev: number().int(),
16712
+ releasedRefs: SecretRefsList
16713
+ }), {
16714
+ kind: "mutation",
16715
+ auth: "admin"
16716
+ }), method(object({
16717
+ ...KindShape,
16718
+ id: RecordIdSchema
16719
+ }), object({
16720
+ deleted: boolean(),
16721
+ secretRefs: SecretRefsList
16722
+ }), {
16723
+ kind: "mutation",
16724
+ auth: "admin"
16725
+ }), method(object({
16726
+ ...KindShape,
16727
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16728
+ }), object({
16729
+ deleted: number().int(),
16730
+ secretRefs: SecretRefsList
16731
+ }), {
16732
+ kind: "mutation",
16733
+ auth: "admin"
16734
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16735
+ ...KindShape,
16736
+ ...TimeWindowShape,
16737
+ where: RecordWhereSchema.optional()
16738
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16739
+ ...KindShape,
16740
+ deviceId: number().int().optional(),
16741
+ from: number(),
16742
+ to: number(),
16743
+ bucketMs: number().int().positive()
16744
+ }), object({ buckets: array(object({
16745
+ bucketStart: number(),
16746
+ count: number().int()
16747
+ })) }), { auth: "admin" }), method(object({
16748
+ ...KindShape,
16749
+ op: _enum([
16750
+ "sum",
16751
+ "min",
16752
+ "max",
16753
+ "count"
16754
+ ]),
16755
+ field: RecordFieldPathSchema.optional(),
16756
+ groupBy: RecordFieldPathSchema.optional(),
16757
+ where: RecordWhereSchema.optional()
16758
+ }), object({ rows: array(object({
16759
+ group: union([
16760
+ string(),
16761
+ number(),
16762
+ _null()
16763
+ ]),
16764
+ value: number().nullable()
16765
+ })) }), { auth: "admin" }), method(object({
16766
+ ...KindShape,
16767
+ deviceId: number().int().optional(),
16768
+ atBefore: number().optional(),
16769
+ where: RecordWhereSchema.optional()
16770
+ }), object({
16771
+ deleted: number().int(),
16772
+ secretRefs: SecretRefsList
16773
+ }), {
16774
+ kind: "mutation",
16775
+ auth: "admin"
16776
+ }), method(object({
16777
+ deviceId: number().int(),
16778
+ kinds: array(RecordKindNameSchema).optional()
16779
+ }), object({
16780
+ deleted: record(string(), number().int()),
16781
+ secretRefs: SecretRefsList
16782
+ }), {
16783
+ kind: "mutation",
16784
+ auth: "admin"
16785
+ }), method(object(KindShape), object({ id: number().int() }), {
16786
+ kind: "mutation",
16787
+ auth: "admin"
16788
+ });
16789
+ /** One table of the settings database. */
16790
+ var StorageTableSchema = object({
16791
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
16792
+ name: string(),
16793
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
16794
+ owner: string().nullable(),
16795
+ rows: number().int().nonnegative(),
16796
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
16797
+ bytes: number().int().nonnegative().nullable(),
16798
+ /** Declared by an addon since this engine process started (a running addon claims it). */
16799
+ declaredThisBoot: boolean()
16800
+ });
16801
+ /** One declared record kind (D881) as System -> Data shows it. */
16802
+ var StorageKindSchema = object({
16803
+ owner: string(),
16804
+ kind: string(),
16805
+ database: _enum(["settings", "events"]),
16806
+ class: string(),
16807
+ state: _enum([
16808
+ "declared",
16809
+ "orphaned",
16810
+ "dropped"
16811
+ ]),
16812
+ /** `null` when the caller asked for no counts (`counts: false`). */
16813
+ rows: number().int().nonnegative().nullable(),
16814
+ /** Rows x the average size of a sample; null for an empty kind. */
16815
+ bytesEstimate: number().int().nonnegative().nullable(),
16816
+ writeTrigger: string(),
16817
+ retention: RecordRetentionSchema,
16818
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16819
+ entry: boolean(),
16820
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16821
+ declaration: RecordKindDeclarationSchema
16822
+ });
16823
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16824
+ collection: string().min(1),
16825
+ expectRows: number().int().nonnegative()
16826
+ }), object({
16827
+ dropped: literal(true),
16828
+ rows: number().int().nonnegative()
16829
+ }), {
16830
+ kind: "mutation",
16831
+ auth: "admin"
16832
+ }), method(object({
16833
+ owner: string().min(1).optional(),
16834
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16835
+ counts: boolean().optional()
16836
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16837
+ owner: string().min(1),
16838
+ kind: RecordKindNameSchema
16839
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16840
+ owner: string().min(1),
16841
+ kind: RecordKindNameSchema,
16842
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16843
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16844
+ complete: boolean().optional()
16845
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16846
+ kind: "mutation",
16847
+ auth: "admin"
16848
+ }), method(object({
16849
+ collection: string().min(1),
16850
+ cursor: string().optional(),
16851
+ limit: number().int().min(1).max(1e3).optional()
16852
+ }), object({
16853
+ rows: array(object({
16854
+ id: string(),
16855
+ data: record(string(), unknown())
16856
+ })),
16857
+ nextCursor: string().nullable()
16858
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16859
+ /**
16860
+ * record-entries - the ONE admin surface for every list of user-created entries
16861
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16862
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16863
+ *
16864
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16865
+ * the entry body with `secret: true` on every credential field, so a password
16866
+ * field is derived from the schema and never from a name. `putEntry` takes the
16867
+ * redaction token for an untouched secret (the stored value is kept), a string
16868
+ * for a new one, and the clear instruction to remove one. A read never carries
16869
+ * a secret value, and a locked keychain refuses the write with
16870
+ * `records/secret-unavailable` instead of storing plaintext.
16871
+ *
16872
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16873
+ */
16874
+ var EntryKindInfoSchema = object({
16875
+ owner: string(),
16876
+ kind: RecordKindNameSchema,
16877
+ title: string(),
16878
+ nameField: string(),
16879
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16880
+ fields: record(string(), unknown()),
16881
+ secretPaths: array(string()),
16882
+ rows: number().int().nonnegative()
16883
+ });
16884
+ var EntryViewSchema = object({
16885
+ id: RecordIdSchema,
16886
+ name: string(),
16887
+ rev: number().int(),
16888
+ updatedAt: number(),
16889
+ /** Secret fields hold the redaction token. */
16890
+ data: RecordBodySchema
16891
+ });
16892
+ var EntryAddress = {
16893
+ owner: string().min(1),
16894
+ kind: RecordKindNameSchema
16895
+ };
16896
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16897
+ ...EntryAddress,
16898
+ id: RecordIdSchema.optional(),
16899
+ data: RecordBodySchema,
16900
+ ifRev: number().int().min(1).optional()
16901
+ }), object({
16902
+ id: string(),
16903
+ rev: number().int()
16904
+ }), {
16905
+ kind: "mutation",
16906
+ auth: "admin"
16907
+ }), method(object({
16908
+ ...EntryAddress,
16909
+ id: RecordIdSchema
16910
+ }), object({ deleted: boolean() }), {
16911
+ kind: "mutation",
16912
+ auth: "admin"
16913
+ });
16914
+ /**
16337
16915
  * `keychain` — the hub's encrypted store of secret values (D787).
16338
16916
  *
16339
16917
  * Settings blobs never hold a secret: they hold a marker
@@ -16874,6 +17452,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16874
17452
  kind: "mutation",
16875
17453
  auth: "admin",
16876
17454
  caller: "required"
17455
+ }), method(object({
17456
+ ref: string().min(1),
17457
+ value: string().min(1)
17458
+ }), object({
17459
+ ref: string(),
17460
+ version: number().int()
17461
+ }), {
17462
+ kind: "mutation",
17463
+ auth: "admin",
17464
+ caller: "required"
16877
17465
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16878
17466
  deleted: array(string()).readonly(),
16879
17467
  kept: array(object({
@@ -39667,6 +40255,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39667
40255
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39668
40256
  kind: "mutation",
39669
40257
  auth: "admin"
40258
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
40259
+ kind: "mutation",
40260
+ auth: "admin"
39670
40261
  }), method(ProfileRefInputSchema, _void(), {
39671
40262
  kind: "mutation",
39672
40263
  auth: "admin"
@@ -50176,6 +50767,41 @@ var ServerRollbackInfoSchema = object({
50176
50767
  atMs: number(),
50177
50768
  reason: string()
50178
50769
  });
50770
+ /**
50771
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50772
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50773
+ * service holds, because only the hub plans) against the states the process
50774
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50775
+ * every boot, served on `getServerPackageStatus`.
50776
+ *
50777
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50778
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50779
+ * planned runner the process service has no entry for.
50780
+ */
50781
+ var RunnerRefusalSchema = object({
50782
+ runnerId: string(),
50783
+ addonIds: array(string()),
50784
+ reason: string()
50785
+ });
50786
+ var RunnerBootCheckSchema = object({
50787
+ checkedAtMs: number(),
50788
+ /** Runners planned for this node. */
50789
+ expected: number(),
50790
+ /** Planned runners whose process is `running`. */
50791
+ running: number(),
50792
+ failed: array(string()),
50793
+ refused: array(RunnerRefusalSchema),
50794
+ missing: array(string()),
50795
+ /**
50796
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50797
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50798
+ * pushed and the verdict is re-evaluated on the next runner state change.
50799
+ * Optional for version skew (absent = settled).
50800
+ */
50801
+ pending: array(string()).optional(),
50802
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50803
+ planKnown: boolean()
50804
+ });
50179
50805
  var ServerPackageStatusSchema = object({
50180
50806
  /** Root package name (`@camstack/server` on the hub). */
50181
50807
  packageName: string(),
@@ -50238,7 +50864,14 @@ var ServerPackageStatusSchema = object({
50238
50864
  * for version skew: an older provider's payload simply omits it, and an
50239
50865
  * absent wrapper is unknown — never `native`.
50240
50866
  */
50241
- wrapper: WrapperIdentitySchema.optional()
50867
+ wrapper: WrapperIdentitySchema.optional(),
50868
+ /**
50869
+ * What this node PLANNED to run against what its process service reports
50870
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50871
+ * on a provider that predates it. Absent is "not checked yet", never "all
50872
+ * well": a consumer that needs the answer treats it as pending.
50873
+ */
50874
+ runners: RunnerBootCheckSchema.optional()
50242
50875
  });
50243
50876
  var ServerUpdateCheckResultSchema = object({
50244
50877
  packageName: string(),
@@ -50289,6 +50922,13 @@ var ServerUpdateOutcomeSchema = _enum([
50289
50922
  "refused",
50290
50923
  "failed"
50291
50924
  ]);
50925
+ /** One addon the pre-flight found the target version would refuse (D877). */
50926
+ var UpdateBlockerSchema = object({
50927
+ addonId: string(),
50928
+ reason: string(),
50929
+ /** What the operator does about it. */
50930
+ remedy: string()
50931
+ });
50292
50932
  var ServerUpdateActionResultSchema = object({
50293
50933
  accepted: boolean(),
50294
50934
  targetVersion: string().nullable(),
@@ -50306,14 +50946,27 @@ var ServerUpdateActionResultSchema = object({
50306
50946
  * The failure itself, verbatim enough to act on (the npm output for a
50307
50947
  * staging install). Non-null only for `failed`.
50308
50948
  */
50309
- error: string().nullable().optional()
50949
+ error: string().nullable().optional(),
50950
+ /**
50951
+ * The addons the target version would refuse to start on this node's live
50952
+ * store (D877), present when the pre-flight refused the update
50953
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50954
+ */
50955
+ blockers: array(UpdateBlockerSchema).optional()
50310
50956
  });
50311
50957
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
50312
50958
  kind: "mutation",
50313
50959
  auth: "admin"
50314
- }), method(object({
50315
- /** Explicit target version; omitted = latest from the registry. */
50316
- version: string().optional() }), ServerUpdateActionResultSchema, {
50960
+ }), method(object({
50961
+ /** Explicit target version; omitted = latest from the registry. */
50962
+ version: string().optional(),
50963
+ /**
50964
+ * Apply even though the pre-flight (D877) found addons the target would
50965
+ * refuse to start. Off by default: those addons stay down until the
50966
+ * remedy is run, which is the incident this gate exists to prevent.
50967
+ */
50968
+ acknowledgeRefusals: boolean().optional()
50969
+ }), ServerUpdateActionResultSchema, {
50317
50970
  kind: "mutation",
50318
50971
  auth: "admin",
50319
50972
  timeoutMs: 16 * 6e4
@@ -53281,7 +53934,9 @@ var ManifestShapeSchema = object({
53281
53934
  var AddonProcessSchema = object({
53282
53935
  pid: number().optional(),
53283
53936
  mode: string(),
53284
- state: string()
53937
+ state: string(),
53938
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53939
+ reason: string().optional()
53285
53940
  });
53286
53941
  /**
53287
53942
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -54670,6 +55325,12 @@ var ClimateControlStatusSchema = object({
54670
55325
  /** Horizontal louver swing on/off. Null when the device has no
54671
55326
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
54672
55327
  swingHorizontal: boolean().nullable(),
55328
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
55329
+ minTemp: number().nullable().optional(),
55330
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
55331
+ maxTemp: number().nullable().optional(),
55332
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
55333
+ tempStep: number().positive().nullable().optional(),
54673
55334
  /** Ms epoch when the slice was last updated (push or command). */
54674
55335
  lastFetchedAt: number()
54675
55336
  });
@@ -57450,7 +58111,19 @@ var TlsStatusSchema = object({
57450
58111
  sans: array(string()),
57451
58112
  caCertPem: string().nullable(),
57452
58113
  reissueError: string().nullable(),
57453
- restartRequired: boolean()
58114
+ restartRequired: boolean(),
58115
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
58116
+ caMissing: boolean(),
58117
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
58118
+ localCaConstrained: boolean().nullable(),
58119
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
58120
+ caReplacedAt: string().nullable(),
58121
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
58122
+ storedUpload: object({
58123
+ leafFingerprintSha256: string(),
58124
+ validTo: string(),
58125
+ hasCa: boolean()
58126
+ }).nullable()
57454
58127
  });
57455
58128
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
57456
58129
  /**
@@ -57506,6 +58179,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
57506
58179
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
57507
58180
  kind: "mutation",
57508
58181
  auth: "admin"
58182
+ }), method(_void(), TlsStatusSchema, {
58183
+ kind: "mutation",
58184
+ auth: "admin"
57509
58185
  });
57510
58186
  var LockControlStatusSchema = object({
57511
58187
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -64560,7 +65236,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64560
65236
  kind: "mutation",
64561
65237
  auth: "admin",
64562
65238
  access: "delete"
64563
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
65239
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
65240
+ kind: "mutation",
65241
+ auth: "admin",
65242
+ access: "create"
65243
+ }), method(object({
64564
65244
  userId: string(),
64565
65245
  code: string()
64566
65246
  }), object({ valid: boolean() }), {
@@ -66387,13 +67067,14 @@ var BaseDevice = class {
66387
67067
  get state() {
66388
67068
  if (!this._stateProxyCache) {
66389
67069
  const cache = {};
66390
- const handler = { get: (_target, key) => {
67070
+ const handler = { get: (target, key) => {
66391
67071
  const k = key;
66392
- if (k in cache) return cache[k];
67072
+ const existing = Reflect.get(target, k);
67073
+ if (existing !== void 0) return existing;
66393
67074
  const cap = DEVICE_LOCAL_STATE_CAPS[k];
66394
67075
  if (!cap) return void 0;
66395
67076
  const proxy = this.sliceProxy(cap);
66396
- cache[k] = proxy;
67077
+ Reflect.set(target, k, proxy);
66397
67078
  return proxy;
66398
67079
  } };
66399
67080
  this._stateProxyCache = new Proxy(cache, handler);
@@ -66592,7 +67273,7 @@ var BaseDevice = class {
66592
67273
  async updateSourceInfo(patch) {
66593
67274
  const next = mergeSourceInfo(this.sourceInfo, patch);
66594
67275
  this._sourceInfoCache = Object.freeze({ ...next });
66595
- const action = this.ctx.api?.deviceManager?.setMetadata;
67276
+ const action = this.ctx.api.deviceManager?.setMetadata;
66596
67277
  if (action) try {
66597
67278
  await action.mutate({
66598
67279
  deviceId: this.id,
@@ -66627,7 +67308,7 @@ var BaseDevice = class {
66627
67308
  * device boot on a meta refresh.
66628
67309
  */
66629
67310
  async refreshFeatures() {
66630
- const action = this.ctx.api?.deviceManager?.registerDevice;
67311
+ const action = this.ctx.api.deviceManager?.registerDevice;
66631
67312
  if (!action) return;
66632
67313
  try {
66633
67314
  await action.mutate({
@@ -67552,6 +68233,10 @@ var BaseDeviceProvider = class extends BaseAddon {
67552
68233
  return toDeviceSummary(device, this.addonId);
67553
68234
  }
67554
68235
  };
68236
+ /** Map entry helper — concrete camera/hub classes widen to `DeviceConstructor<IDevice>`. */
68237
+ function widenDeviceConstructor(ctor) {
68238
+ return ctor;
68239
+ }
67555
68240
  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;
67556
68241
  new Set(Object.values(DeviceType));
67557
68242
  Object.freeze({
@@ -68701,6 +69386,12 @@ Object.freeze({
68701
69386
  addonId: null,
68702
69387
  access: "view"
68703
69388
  },
69389
+ "coreBlocks.migrateRawSecrets": {
69390
+ capName: "core-blocks",
69391
+ capScope: "system",
69392
+ addonId: null,
69393
+ access: "create"
69394
+ },
68704
69395
  "coreBlocks.restart": {
68705
69396
  capName: "core-blocks",
68706
69397
  capScope: "system",
@@ -70387,6 +71078,12 @@ Object.freeze({
70387
71078
  addonId: null,
70388
71079
  access: "create"
70389
71080
  },
71081
+ "keychainAdmin.importSecret": {
71082
+ capName: "keychain-admin",
71083
+ capScope: "system",
71084
+ addonId: null,
71085
+ access: "create"
71086
+ },
70390
71087
  "keychainAdmin.listAudit": {
70391
71088
  capName: "keychain-admin",
70392
71089
  capScope: "system",
@@ -70555,6 +71252,12 @@ Object.freeze({
70555
71252
  addonId: null,
70556
71253
  access: "view"
70557
71254
  },
71255
+ "llm.migrateRawSecrets": {
71256
+ capName: "llm",
71257
+ capScope: "system",
71258
+ addonId: null,
71259
+ access: "create"
71260
+ },
70558
71261
  "llm.resolveModelRef": {
70559
71262
  capName: "llm",
70560
71263
  capScope: "system",
@@ -70783,6 +71486,12 @@ Object.freeze({
70783
71486
  addonId: null,
70784
71487
  access: "create"
70785
71488
  },
71489
+ "localNetwork.useStoredUploadedCertificate": {
71490
+ capName: "local-network",
71491
+ capScope: "system",
71492
+ addonId: null,
71493
+ access: "create"
71494
+ },
70786
71495
  "lockControl.getStatus": {
70787
71496
  capName: "lock-control",
70788
71497
  capScope: "device",
@@ -73435,6 +74144,30 @@ Object.freeze({
73435
74144
  addonId: null,
73436
74145
  access: "create"
73437
74146
  },
74147
+ "recordEntries.deleteEntry": {
74148
+ capName: "record-entries",
74149
+ capScope: "system",
74150
+ addonId: null,
74151
+ access: "delete"
74152
+ },
74153
+ "recordEntries.listEntries": {
74154
+ capName: "record-entries",
74155
+ capScope: "system",
74156
+ addonId: null,
74157
+ access: "view"
74158
+ },
74159
+ "recordEntries.listEntryKinds": {
74160
+ capName: "record-entries",
74161
+ capScope: "system",
74162
+ addonId: null,
74163
+ access: "view"
74164
+ },
74165
+ "recordEntries.putEntry": {
74166
+ capName: "record-entries",
74167
+ capScope: "system",
74168
+ addonId: null,
74169
+ access: "create"
74170
+ },
73438
74171
  "recording.getAvailability": {
73439
74172
  capName: "recording",
73440
74173
  capScope: "device",
@@ -73735,6 +74468,102 @@ Object.freeze({
73735
74468
  addonId: null,
73736
74469
  access: "view"
73737
74470
  },
74471
+ "records.aggregate": {
74472
+ capName: "records",
74473
+ capScope: "system",
74474
+ addonId: null,
74475
+ access: "view"
74476
+ },
74477
+ "records.allocateId": {
74478
+ capName: "records",
74479
+ capScope: "system",
74480
+ addonId: null,
74481
+ access: "create"
74482
+ },
74483
+ "records.count": {
74484
+ capName: "records",
74485
+ capScope: "system",
74486
+ addonId: null,
74487
+ access: "view"
74488
+ },
74489
+ "records.declareKinds": {
74490
+ capName: "records",
74491
+ capScope: "system",
74492
+ addonId: null,
74493
+ access: "create"
74494
+ },
74495
+ "records.delete": {
74496
+ capName: "records",
74497
+ capScope: "system",
74498
+ addonId: null,
74499
+ access: "delete"
74500
+ },
74501
+ "records.deleteDevice": {
74502
+ capName: "records",
74503
+ capScope: "system",
74504
+ addonId: null,
74505
+ access: "delete"
74506
+ },
74507
+ "records.deleteMany": {
74508
+ capName: "records",
74509
+ capScope: "system",
74510
+ addonId: null,
74511
+ access: "delete"
74512
+ },
74513
+ "records.deleteWhere": {
74514
+ capName: "records",
74515
+ capScope: "system",
74516
+ addonId: null,
74517
+ access: "delete"
74518
+ },
74519
+ "records.get": {
74520
+ capName: "records",
74521
+ capScope: "system",
74522
+ addonId: null,
74523
+ access: "view"
74524
+ },
74525
+ "records.getMany": {
74526
+ capName: "records",
74527
+ capScope: "system",
74528
+ addonId: null,
74529
+ access: "view"
74530
+ },
74531
+ "records.histogram": {
74532
+ capName: "records",
74533
+ capScope: "system",
74534
+ addonId: null,
74535
+ access: "view"
74536
+ },
74537
+ "records.patch": {
74538
+ capName: "records",
74539
+ capScope: "system",
74540
+ addonId: null,
74541
+ access: "create"
74542
+ },
74543
+ "records.put": {
74544
+ capName: "records",
74545
+ capScope: "system",
74546
+ addonId: null,
74547
+ access: "create"
74548
+ },
74549
+ "records.putMany": {
74550
+ capName: "records",
74551
+ capScope: "system",
74552
+ addonId: null,
74553
+ access: "create"
74554
+ },
74555
+ "records.query": {
74556
+ capName: "records",
74557
+ capScope: "system",
74558
+ addonId: null,
74559
+ access: "view"
74560
+ },
74561
+ "records.secretRefs": {
74562
+ capName: "records",
74563
+ capScope: "system",
74564
+ addonId: null,
74565
+ access: "view"
74566
+ },
73738
74567
  "sceneMonitor.captureReference": {
73739
74568
  capName: "scene-monitor",
73740
74569
  capScope: "device",
@@ -74167,6 +74996,48 @@ Object.freeze({
74167
74996
  addonId: null,
74168
74997
  access: "create"
74169
74998
  },
74999
+ "storageAdmin.adoptRecords": {
75000
+ capName: "storage-admin",
75001
+ capScope: "system",
75002
+ addonId: null,
75003
+ access: "create"
75004
+ },
75005
+ "storageAdmin.dropCollection": {
75006
+ capName: "storage-admin",
75007
+ capScope: "system",
75008
+ addonId: null,
75009
+ access: "delete"
75010
+ },
75011
+ "storageAdmin.isAdoptedLegacyTable": {
75012
+ capName: "storage-admin",
75013
+ capScope: "system",
75014
+ addonId: null,
75015
+ access: "view"
75016
+ },
75017
+ "storageAdmin.listKinds": {
75018
+ capName: "storage-admin",
75019
+ capScope: "system",
75020
+ addonId: null,
75021
+ access: "view"
75022
+ },
75023
+ "storageAdmin.listTables": {
75024
+ capName: "storage-admin",
75025
+ capScope: "system",
75026
+ addonId: null,
75027
+ access: "view"
75028
+ },
75029
+ "storageAdmin.readLegacyCollection": {
75030
+ capName: "storage-admin",
75031
+ capScope: "system",
75032
+ addonId: null,
75033
+ access: "view"
75034
+ },
75035
+ "storageAdmin.readRecords": {
75036
+ capName: "storage-admin",
75037
+ capScope: "system",
75038
+ addonId: null,
75039
+ access: "view"
75040
+ },
74170
75041
  "storageEvictable.evict": {
74171
75042
  capName: "storage-evictable",
74172
75043
  capScope: "system",
@@ -75079,6 +75950,12 @@ Object.freeze({
75079
75950
  addonId: null,
75080
75951
  access: "view"
75081
75952
  },
75953
+ "userManagement.migrateRawSecrets": {
75954
+ capName: "user-management",
75955
+ capScope: "system",
75956
+ addonId: null,
75957
+ access: "create"
75958
+ },
75082
75959
  "userManagement.oauthExchangeCode": {
75083
75960
  capName: "user-management",
75084
75961
  capScope: "system",
@@ -77973,6 +78850,37 @@ Object.freeze({
77973
78850
  form: "single",
77974
78851
  optional: false
77975
78852
  }],
78853
+ "records.count": [{
78854
+ name: "deviceId",
78855
+ form: "single",
78856
+ optional: true
78857
+ }],
78858
+ "records.deleteDevice": [{
78859
+ name: "deviceId",
78860
+ form: "single",
78861
+ optional: false
78862
+ }],
78863
+ "records.deleteWhere": [{
78864
+ name: "deviceId",
78865
+ form: "single",
78866
+ optional: true
78867
+ }],
78868
+ "records.histogram": [{
78869
+ name: "deviceId",
78870
+ form: "single",
78871
+ optional: true
78872
+ }],
78873
+ "records.putMany": [{
78874
+ name: "records",
78875
+ form: "object-array",
78876
+ optional: false,
78877
+ itemField: "deviceId"
78878
+ }],
78879
+ "records.query": [{
78880
+ name: "deviceId",
78881
+ form: "single",
78882
+ optional: true
78883
+ }],
77976
78884
  "sceneMonitor.captureReference": [{
77977
78885
  name: "deviceId",
77978
78886
  form: "single",
@@ -78089,6 +78997,17 @@ Object.freeze({
78089
78997
  form: "single",
78090
78998
  optional: false
78091
78999
  }],
79000
+ "storageAdmin.adoptRecords": [{
79001
+ name: "records",
79002
+ form: "object-array",
79003
+ optional: false,
79004
+ itemField: "deviceId"
79005
+ }],
79006
+ "storageAdmin.readRecords": [{
79007
+ name: "deviceId",
79008
+ form: "single",
79009
+ optional: true
79010
+ }],
78092
79011
  "streamBroker.acquireEgressTranscode": [{
78093
79012
  name: "deviceId",
78094
79013
  form: "single",
@@ -102195,7 +103114,7 @@ function isMeaningfulIdentifier(s) {
102195
103114
  var HikvisionProviderAddon = class extends BaseDeviceProvider {
102196
103115
  addonId = HIKVISION_ADDON_ID;
102197
103116
  providerName = "Hikvision";
102198
- deviceClasses = { [DeviceType.Camera]: HikvisionCamera };
103117
+ deviceClasses = { [DeviceType.Camera]: widenDeviceConstructor(HikvisionCamera) };
102199
103118
  constructor() {
102200
103119
  super({});
102201
103120
  }