@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.js CHANGED
@@ -34,7 +34,7 @@ let node_os = require("node:os");
34
34
  let node_net = require("node:net");
35
35
  let node_http = require("node:http");
36
36
  let node_https = require("node:https");
37
- //#region ../types/dist/event-category-C4hVnRo8.mjs
37
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
38
38
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
39
39
  EventCategory["SystemBoot"] = "system.boot";
40
40
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -98,6 +98,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
98
98
  * consumes this category and maps it to the `addon-crash-loop` kind.
99
99
  */
100
100
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
101
+ /**
102
+ * A runner whose addon refused to start with a typed reason (D877) - parked
103
+ * in `refused`, never counted by the crash breaker, retried on operator
104
+ * action. One event per refusal.
105
+ */
106
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
107
+ /**
108
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
109
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
110
+ * runner is still pending) and the alert centre (close a recovered runner).
111
+ */
112
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
113
+ /**
114
+ * The node's one-shot runner boot check (D877): planned runners against the
115
+ * process service, `degraded` when any is failed, refused or missing. The
116
+ * alert centre turns it into one alert and a direct critical push.
117
+ */
118
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
101
119
  EventCategory["AddonError"] = "addon.error";
102
120
  EventCategory["AddonPageReady"] = "addon.page-ready";
103
121
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -5422,7 +5440,7 @@ var ZodIssueCode = {
5422
5440
  var ZodFirstPartyTypeKind;
5423
5441
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5424
5442
  //#endregion
5425
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5443
+ //#region ../types/dist/sleep-bZIhUvjd.mjs
5426
5444
  /**
5427
5445
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5428
5446
  * window to float samples (D455).
@@ -5539,7 +5557,7 @@ function isKeychainStoredField(field) {
5539
5557
  var SECRET_CLEAR = { $secretClear: true };
5540
5558
  /** The `'***'` token D634 redaction writes for non-admins. */
5541
5559
  var LEGACY_DEVICE_REDACTION = "***";
5542
- function isRecord$2(value) {
5560
+ function isRecord$5(value) {
5543
5561
  return typeof value === "object" && value !== null && !Array.isArray(value);
5544
5562
  }
5545
5563
  function makeSecretMarker(ref) {
@@ -5550,12 +5568,12 @@ function makeSecretMarker(ref) {
5550
5568
  }
5551
5569
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5552
5570
  function isSecretMarker(value) {
5553
- if (!isRecord$2(value)) return false;
5571
+ if (!isRecord$5(value)) return false;
5554
5572
  const ref = value["$secret"];
5555
5573
  return typeof ref === "string" && ref.length > 0;
5556
5574
  }
5557
5575
  function isSecretClear(value) {
5558
- return isRecord$2(value) && value["$secretClear"] === true;
5576
+ return isRecord$5(value) && value["$secretClear"] === true;
5559
5577
  }
5560
5578
  /**
5561
5579
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6165,7 +6183,7 @@ var KeychainWriteRefusedError = class extends Error {
6165
6183
  }
6166
6184
  };
6167
6185
  var KEEP = { kind: "keep" };
6168
- function isRecord$1(value) {
6186
+ function isRecord$4(value) {
6169
6187
  return typeof value === "object" && value !== null && !Array.isArray(value);
6170
6188
  }
6171
6189
  function defaultMintId() {
@@ -6178,7 +6196,7 @@ function collectSecretMarkerRefs(value, out = []) {
6178
6196
  return out;
6179
6197
  }
6180
6198
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6181
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6199
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6182
6200
  return out;
6183
6201
  }
6184
6202
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6233,7 +6251,7 @@ function rowId(row, idKey) {
6233
6251
  return null;
6234
6252
  }
6235
6253
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6236
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6254
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6237
6255
  if (!Array.isArray(incoming)) {
6238
6256
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6239
6257
  return {
@@ -6249,7 +6267,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6249
6267
  const kept = /* @__PURE__ */ new Set();
6250
6268
  const rows = [];
6251
6269
  for (const row of incoming) {
6252
- if (!isRecord$1(row)) {
6270
+ if (!isRecord$4(row)) {
6253
6271
  rows.push(row);
6254
6272
  continue;
6255
6273
  }
@@ -6274,7 +6292,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6274
6292
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6275
6293
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6276
6294
  case "object": {
6277
- if (!isRecord$1(incoming)) {
6295
+ if (!isRecord$4(incoming)) {
6278
6296
  if (incoming === void 0) return KEEP;
6279
6297
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6280
6298
  return {
@@ -6282,7 +6300,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6282
6300
  value: incoming
6283
6301
  };
6284
6302
  }
6285
- const storedObj = isRecord$1(stored) ? stored : {};
6303
+ const storedObj = isRecord$4(stored) ? stored : {};
6286
6304
  return {
6287
6305
  kind: "value",
6288
6306
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6405,7 +6423,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6405
6423
  value: items
6406
6424
  };
6407
6425
  }
6408
- if (isRecord$1(v)) {
6426
+ if (isRecord$4(v)) {
6409
6427
  const out = {};
6410
6428
  for (const [k, child] of Object.entries(v)) {
6411
6429
  const s = substitute(child);
@@ -6437,7 +6455,7 @@ var SecretOverwriteRefusedError = class extends Error {
6437
6455
  this.name = "SecretOverwriteRefusedError";
6438
6456
  }
6439
6457
  };
6440
- function isRecord(value) {
6458
+ function isRecord$3(value) {
6441
6459
  return typeof value === "object" && value !== null && !Array.isArray(value);
6442
6460
  }
6443
6461
  function resolvedValue(pass, marker) {
@@ -6466,7 +6484,7 @@ function inArray(pass, incoming, stored) {
6466
6484
  return incoming.map((item, index) => {
6467
6485
  const twin = stored[index];
6468
6486
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6469
- if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6487
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6470
6488
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6471
6489
  return item;
6472
6490
  });
@@ -6477,7 +6495,7 @@ function inArrayRow(pass, incoming, stored) {
6477
6495
  const twin = stored[key];
6478
6496
  if (isSecretMarker(twin)) {
6479
6497
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6480
- } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6498
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6481
6499
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6482
6500
  }
6483
6501
  return out;
@@ -6485,7 +6503,7 @@ function inArrayRow(pass, incoming, stored) {
6485
6503
  async function walk(pass, incoming, stored) {
6486
6504
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6487
6505
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6488
- if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6506
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6489
6507
  const out = { ...incoming };
6490
6508
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6491
6509
  return out;
@@ -6516,7 +6534,7 @@ async function restoreUnchangedSecrets(input) {
6516
6534
  function isJsonEqual(a, b) {
6517
6535
  if (Object.is(a, b)) return true;
6518
6536
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6519
- if (isRecord(a) && isRecord(b)) {
6537
+ if (isRecord$3(a) && isRecord$3(b)) {
6520
6538
  const keys = Object.keys(a);
6521
6539
  if (keys.length !== Object.keys(b).length) return false;
6522
6540
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -6540,7 +6558,7 @@ function markerKeysOf(blob, owner) {
6540
6558
  }
6541
6559
  function nodeFromStored(value, owner) {
6542
6560
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6543
- if (!isRecord(value)) return null;
6561
+ if (!isRecord$3(value)) return null;
6544
6562
  const children = /* @__PURE__ */ new Map();
6545
6563
  for (const [key, child] of Object.entries(value)) {
6546
6564
  const node = nodeFromStored(child, owner);
@@ -6673,7 +6691,6 @@ function createHandle(raw, opts) {
6673
6691
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6674
6692
  const readAddonStoreResult = raw.readAddonStoreResult;
6675
6693
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6676
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6677
6694
  const overrides = {
6678
6695
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6679
6696
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6697,12 +6714,12 @@ function createHandle(raw, opts) {
6697
6714
  };
6698
6715
  } } : {},
6699
6716
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6700
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6701
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6717
+ readDeviceStoreBatch: async (deviceIds) => {
6718
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6702
6719
  const out = /* @__PURE__ */ new Map();
6703
6720
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6704
6721
  return out;
6705
- } } : {},
6722
+ },
6706
6723
  writeAddonStore: async (patch) => {
6707
6724
  await writeAddon(patch);
6708
6725
  },
@@ -7329,7 +7346,7 @@ var BaseAddon = class {
7329
7346
  if (!ctx) return;
7330
7347
  const addonId = ctx.id;
7331
7348
  setImmediate(() => {
7332
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7349
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7333
7350
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7334
7351
  }).catch((err) => {
7335
7352
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7529,7 +7546,7 @@ var BaseAddon = class {
7529
7546
  return this._addonSecretTree;
7530
7547
  }
7531
7548
  deviceSecretTree() {
7532
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7549
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7533
7550
  return this._deviceSecretTree;
7534
7551
  }
7535
7552
  /**
@@ -7605,42 +7622,135 @@ var BaseAddon = class {
7605
7622
  this[timerOf] = timer;
7606
7623
  }
7607
7624
  /**
7608
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7609
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7610
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7611
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7625
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7626
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7612
7627
  * addon permanently broken.
7613
7628
  *
7614
- * Retry only the two known infra fingerprints. Anything else propagates so
7615
- * real bugs surface immediately. After the budget expires we fall back to
7616
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7629
+ * Two kinds of outage, two budgets:
7630
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7631
+ * initialized`, `provider not available`): a short budget, then the addon
7632
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7633
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7634
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7635
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7636
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7637
+ * loop. A long, bounded budget; only after it the error propagates - the
7638
+ * addon never runs on defaults for a store it could not ask.
7639
+ * Anything else propagates immediately so real bugs surface.
7617
7640
  */
7618
7641
  async readAddonStoreWithRetry() {
7619
7642
  const settings = this.rawSettings();
7620
7643
  if (!settings) return {};
7621
- const delaysMs = [
7622
- 150,
7623
- 350,
7624
- 600,
7625
- 900
7626
- ];
7627
7644
  let lastErr;
7628
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7645
+ for (let attempt = 0;; attempt++) try {
7629
7646
  const stored = await settings.readAddonStore() ?? {};
7630
7647
  this.settingsStoreReady = true;
7631
7648
  return stored;
7632
7649
  } catch (err) {
7633
7650
  lastErr = err;
7634
- const msg = err instanceof Error ? err.message : String(err);
7635
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7636
- if (attempt === delaysMs.length) break;
7637
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7651
+ const kind = classifyStoreError(err);
7652
+ if (kind === "permanent") throw err;
7653
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7654
+ if (delay === void 0) {
7655
+ if (kind === "transport") throw err;
7656
+ break;
7657
+ }
7658
+ await new Promise((r) => setTimeout(r, delay));
7638
7659
  }
7639
7660
  this.settingsStoreReady = false;
7640
7661
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7641
7662
  return {};
7642
7663
  }
7643
7664
  };
7665
+ /** The settings store's own restart fingerprints. */
7666
+ var RESTART_RETRY_DELAYS_MS = [
7667
+ 150,
7668
+ 350,
7669
+ 600,
7670
+ 900
7671
+ ];
7672
+ /** A hub restarting under a booting runner: ~100 s in total. */
7673
+ var TRANSPORT_RETRY_DELAYS_MS = [
7674
+ 150,
7675
+ 350,
7676
+ 600,
7677
+ 900,
7678
+ 2e3,
7679
+ 5e3,
7680
+ 1e4,
7681
+ 2e4,
7682
+ 3e4,
7683
+ 3e4
7684
+ ];
7685
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7686
+ /** Node / socket error codes of a connection that did not happen or broke. */
7687
+ var TRANSPORT_CODES = new Set([
7688
+ "ECONNREFUSED",
7689
+ "ECONNRESET",
7690
+ "ETIMEDOUT",
7691
+ "EPIPE",
7692
+ "EHOSTUNREACH",
7693
+ "ENETUNREACH"
7694
+ ]);
7695
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7696
+ var UNAVAILABLE_TRPC_CODES = new Set([
7697
+ "TIMEOUT",
7698
+ "SERVICE_UNAVAILABLE",
7699
+ "BAD_GATEWAY",
7700
+ "GATEWAY_TIMEOUT"
7701
+ ]);
7702
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7703
+ var TRANSPORT_PHRASES = [
7704
+ "discovery deadline exceeded",
7705
+ "parent could not route child unowned cap call",
7706
+ "UDS request timed out after",
7707
+ "channel closed"
7708
+ ];
7709
+ /** Moleculer error `type`s of a call that could not be served right now. */
7710
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7711
+ "REQUEST_TIMEOUT",
7712
+ "SERVICE_NOT_FOUND",
7713
+ "SERVICE_NOT_AVAILABLE",
7714
+ "REQUEST_REJECTED",
7715
+ "BROKER_DISCONNECTED"
7716
+ ]);
7717
+ function stringProp(value, key) {
7718
+ if (typeof value !== "object" || value === null) return void 0;
7719
+ const found = Reflect.get(value, key);
7720
+ return typeof found === "string" ? found : void 0;
7721
+ }
7722
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7723
+ function errorCode(err) {
7724
+ const out = {};
7725
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7726
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7727
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7728
+ if (node !== void 0) out.node = node;
7729
+ const trpc = stringProp(data, "code");
7730
+ if (trpc !== void 0) out.trpc = trpc;
7731
+ return out;
7732
+ }
7733
+ /**
7734
+ * Is a settings read failure worth retrying, and with which budget? Only
7735
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7736
+ * one of the exact phrases our own transport raises. A message that merely
7737
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7738
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7739
+ */
7740
+ function classifyStoreError(err) {
7741
+ const message = err instanceof Error ? err.message : String(err);
7742
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7743
+ const code = errorCode(err);
7744
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7745
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7746
+ if (typeof err === "object" && err !== null) {
7747
+ if (Reflect.get(err, "retryable") === true) return "transport";
7748
+ const type = stringProp(err, "type");
7749
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7750
+ }
7751
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7752
+ return "permanent";
7753
+ }
7644
7754
  /**
7645
7755
  * Collect the keys of every field marked `perNode: true`, recursing into
7646
7756
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7730,6 +7840,156 @@ var PeerBytesTicketSchema = object({
7730
7840
  */
7731
7841
  declaredBytes: number().int().nonnegative().nullable()
7732
7842
  });
7843
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7844
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7845
+ var RECORD_DATABASES = ["settings", "events"];
7846
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7847
+ var RECORD_CLASSES = [
7848
+ "config",
7849
+ "ledger",
7850
+ "audit",
7851
+ "mirror",
7852
+ "ephemeral"
7853
+ ];
7854
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7855
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7856
+ var RECORD_BATCH_MAX = 1e3;
7857
+ var RECORD_QUERY_MAX = 1e3;
7858
+ function defOf(schema) {
7859
+ const zodBag = Reflect.get(schema, "_zod");
7860
+ if (typeof zodBag !== "object" || zodBag === null) return {};
7861
+ const def = Reflect.get(zodBag, "def");
7862
+ if (typeof def !== "object" || def === null) return {};
7863
+ return def;
7864
+ }
7865
+ function declaredHere(schema) {
7866
+ return globalRegistry.get(schema)?.secret === true;
7867
+ }
7868
+ /** Wrapper kinds whose `innerType` is the field itself. */
7869
+ var WRAPPERS = new Set([
7870
+ "optional",
7871
+ "nullable",
7872
+ "default",
7873
+ "prefault",
7874
+ "catch",
7875
+ "readonly",
7876
+ "nonoptional"
7877
+ ]);
7878
+ /**
7879
+ * The schema layers that make up ONE field: the schema itself and every
7880
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
7881
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
7882
+ * `.transform` on `in`).
7883
+ */
7884
+ function layersOf(schema) {
7885
+ const out = [];
7886
+ const queue = [schema];
7887
+ while (queue.length > 0) {
7888
+ const s = queue.shift();
7889
+ if (!s || out.includes(s)) continue;
7890
+ out.push(s);
7891
+ const def = defOf(s);
7892
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
7893
+ if (def.type === "pipe") {
7894
+ if (def.in) queue.push(def.in);
7895
+ if (def.out) queue.push(def.out);
7896
+ }
7897
+ }
7898
+ return out;
7899
+ }
7900
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
7901
+ function isZodSecret(schema) {
7902
+ return layersOf(schema).some(declaredHere);
7903
+ }
7904
+ /**
7905
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
7906
+ * element of this array" (`connection.password`, `rows[].token`). A declared
7907
+ * object or array is reported as one path and not descended into — everything
7908
+ * under it is secret.
7909
+ */
7910
+ function collectZodSecretPaths(schema, prefix = "") {
7911
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
7912
+ const paths = [];
7913
+ for (const layer of layersOf(schema)) {
7914
+ const def = defOf(layer);
7915
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
7916
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
7917
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
7918
+ else if (def.type === "intersection") {
7919
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
7920
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
7921
+ }
7922
+ }
7923
+ return [...new Set(paths)];
7924
+ }
7925
+ /**
7926
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
7927
+ * Zod row schema that describes it, and the helper that turns the two into the
7928
+ * JSON the engine stores.
7929
+ *
7930
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
7931
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
7932
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
7933
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
7934
+ * never a field name (D879).
7935
+ */
7936
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
7937
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
7938
+ var RecordIndexSchema = object({
7939
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
7940
+ fields: array(RecordFieldPathSchema).min(1).max(4),
7941
+ unique: boolean().optional()
7942
+ }).strict();
7943
+ var RecordRetentionSchema = union([
7944
+ object({
7945
+ ttlMs: number().int().positive(),
7946
+ from: _enum(["at", "write"])
7947
+ }).strict(),
7948
+ object({
7949
+ maxRows: number().int().positive().optional(),
7950
+ maxRowsPerDevice: number().int().positive().optional()
7951
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
7952
+ object({
7953
+ owner: string().min(1),
7954
+ reason: string().min(1)
7955
+ }).strict(),
7956
+ object({ none: string().min(1) }).strict()
7957
+ ]);
7958
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
7959
+ var EntryDescriptorSchema = object({
7960
+ title: string().min(1),
7961
+ /** The record body field shown as the entry's name. */
7962
+ nameField: string().min(1),
7963
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
7964
+ fields: record(string(), unknown())
7965
+ }).strict();
7966
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
7967
+ var RecordKindDeclarationSchema = object({
7968
+ database: _enum(RECORD_DATABASES).default("settings"),
7969
+ class: _enum(RECORD_CLASSES),
7970
+ writeTrigger: string().min(1),
7971
+ device: _enum([
7972
+ "required",
7973
+ "optional",
7974
+ "none"
7975
+ ]).default("none"),
7976
+ at: _enum(["required", "none"]).default("none"),
7977
+ indexes: array(RecordIndexSchema).max(8).default([]),
7978
+ retention: RecordRetentionSchema,
7979
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
7980
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
7981
+ /** Derived from the Zod schema; never written by hand. */
7982
+ secretPaths: array(string().min(1)).default([]),
7983
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
7984
+ secretArrayKeys: record(string(), string()).default({}),
7985
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
7986
+ adoptsFrom: string().min(1).optional(),
7987
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
7988
+ transactFamily: string().min(1).optional(),
7989
+ entry: EntryDescriptorSchema.optional()
7990
+ }).strict();
7991
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
7992
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
7733
7993
  /** Shared Zod schemas used across streaming capabilities. */
7734
7994
  var CamProfileSchema = _enum([
7735
7995
  "high",
@@ -8206,69 +8466,6 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8206
8466
  kind: "mutation",
8207
8467
  auth: "admin"
8208
8468
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
8209
- function defOf(schema) {
8210
- return schema._zod?.def ?? {};
8211
- }
8212
- function declaredHere(schema) {
8213
- return globalRegistry.get(schema)?.secret === true;
8214
- }
8215
- /** Wrapper kinds whose `innerType` is the field itself. */
8216
- var WRAPPERS = new Set([
8217
- "optional",
8218
- "nullable",
8219
- "default",
8220
- "prefault",
8221
- "catch",
8222
- "readonly",
8223
- "nonoptional"
8224
- ]);
8225
- /**
8226
- * The schema layers that make up ONE field: the schema itself and every
8227
- * wrapper below it (optional / default / nullable / readonly / catch), plus
8228
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8229
- * `.transform` on `in`).
8230
- */
8231
- function layersOf(schema) {
8232
- const out = [];
8233
- const queue = [schema];
8234
- while (queue.length > 0) {
8235
- const s = queue.shift();
8236
- if (!s || out.includes(s)) continue;
8237
- out.push(s);
8238
- const def = defOf(s);
8239
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8240
- if (def.type === "pipe") {
8241
- if (def.in) queue.push(def.in);
8242
- if (def.out) queue.push(def.out);
8243
- }
8244
- }
8245
- return out;
8246
- }
8247
- /** True when any layer of this field declares `.meta({ secret: true })`. */
8248
- function isZodSecret(schema) {
8249
- return layersOf(schema).some(declaredHere);
8250
- }
8251
- /**
8252
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
8253
- * element of this array" (`connection.password`, `rows[].token`). A declared
8254
- * object or array is reported as one path and not descended into — everything
8255
- * under it is secret.
8256
- */
8257
- function collectZodSecretPaths(schema, prefix = "") {
8258
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8259
- const paths = [];
8260
- for (const layer of layersOf(schema)) {
8261
- const def = defOf(layer);
8262
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8263
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8264
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8265
- else if (def.type === "intersection") {
8266
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8267
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8268
- }
8269
- }
8270
- return [...new Set(paths)];
8271
- }
8272
8469
  object({
8273
8470
  code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
8274
8471
  params: record(string(), union([string(), number()])).optional()
@@ -8288,7 +8485,7 @@ function userError(code, params, englishFallback) {
8288
8485
  return new CamstackError(code, params, englishFallback);
8289
8486
  }
8290
8487
  //#endregion
8291
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8488
+ //#region ../types/dist/err-msg--2RrYiLO.mjs
8292
8489
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8293
8490
  DeviceType["Camera"] = "camera";
8294
8491
  DeviceType["Hub"] = "hub";
@@ -8557,6 +8754,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8557
8754
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8558
8755
  * real Switch device for UI rendering / export adapters. */
8559
8756
  DeviceRole["BinaryHelper"] = "binary-helper";
8757
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
8758
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
8759
+ DeviceRole["Outlet"] = "outlet";
8560
8760
  /** Generic motion / occupancy / moving event source. Distinct from
8561
8761
  * the camera accessory PirSensor role: that one is a camera child;
8562
8762
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8624,7 +8824,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8624
8824
  return DeviceRole;
8625
8825
  }({});
8626
8826
  //#endregion
8627
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
8827
+ //#region ../types/dist/composition-DOwQB_Ua.mjs
8628
8828
  /**
8629
8829
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8630
8830
  *
@@ -12129,11 +12329,10 @@ var ClipModelMetaSchema = object({
12129
12329
  /**
12130
12330
  * The `vector-store` index this model's vectors live in. ONE feature space
12131
12331
  * per index: two models share an index only when their vectors are ranked
12132
- * against each other, which for CLIP means never across families. MobileCLIP
12133
- * S1 and S2 share `object-clip` for history (separated by the row's
12134
- * `modelId`); any other model gets its own.
12332
+ * against each other, which for CLIP means never across families. Every
12333
+ * model gets its own.
12135
12334
  */
12136
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12335
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
12137
12336
  /**
12138
12337
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
12139
12338
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -15866,6 +16065,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15866
16065
  keyField: string()
15867
16066
  }).optional()
15868
16067
  })) });
16068
+ /**
16069
+ * The report of a one-shot "move this owner's plaintext secrets into the
16070
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
16071
+ *
16072
+ * The owner runs it on its own rows, through its own write path; an operator
16073
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
16074
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
16075
+ */
16076
+ var RawSecretMigrationInputSchema = object({
16077
+ /** `false` (the default of the script) = report only. */
16078
+ apply: boolean() });
16079
+ var RawSecretMigrationReportSchema = object({
16080
+ apply: boolean(),
16081
+ /** Rows that can carry a secret (a profile, an enrolment). */
16082
+ rows: number().int(),
16083
+ /** Rows whose secret was plaintext when the run started. */
16084
+ raw: number().int(),
16085
+ /** Rows that already held a keychain marker when the run started. */
16086
+ markers: number().int(),
16087
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
16088
+ migrated: number().int(),
16089
+ /** Plaintext rows left in place because the move or its read-back failed. */
16090
+ failed: number().int(),
16091
+ /** After the run: rows still holding plaintext. */
16092
+ remainingRaw: number().int(),
16093
+ /** After the run: markers the keychain could not resolve right now. */
16094
+ unresolvedMarkers: number().int(),
16095
+ /**
16096
+ * A second, redundant copy of the secrets' rows that the run found (and, on
16097
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
16098
+ */
16099
+ redundantCopies: number().int().optional(),
16100
+ /** True when nothing is raw and every marker resolves. */
16101
+ verified: boolean()
16102
+ });
15869
16103
  /** Where a block runs. The operator chooses — a block driving a device on an
15870
16104
  * agent is the reason placement is not fixed to the hub. */
15871
16105
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -16092,6 +16326,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
16092
16326
  }), SettingsUpdateResultSchema, {
16093
16327
  kind: "mutation",
16094
16328
  auth: "admin"
16329
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16330
+ kind: "mutation",
16331
+ auth: "admin"
16095
16332
  }), method(object({}), object({ libs: array(object({
16096
16333
  filePath: string(),
16097
16334
  content: string()
@@ -16355,6 +16592,347 @@ id: union([string(), number()]) }), {
16355
16592
  auth: "admin"
16356
16593
  });
16357
16594
  /**
16595
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16596
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16597
+ * (operator intent, D870) and device-history (numbers over time, D850).
16598
+ *
16599
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16600
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16601
+ * that with the addon id closed over). It is deliberately NOT in any input
16602
+ * schema, so a session can never supply it, and a call with no stamp is refused
16603
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16604
+ * addons go through the owner's capability.
16605
+ *
16606
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16607
+ * never `[]`. Secret fields are never on the wire: a read shows the
16608
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16609
+ * resolves itself, and a write may carry only a keychain marker bound to the
16610
+ * row's own ref.
16611
+ *
16612
+ * Internal: addons reach it through `ctx.records`, never directly.
16613
+ */
16614
+ var RecordIdSchema = string().min(1).max(256);
16615
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16616
+ var RecordBodySchema = record(string(), unknown());
16617
+ var RecordInputSchema = object({
16618
+ id: RecordIdSchema,
16619
+ /** The device this row belongs to (D865 removal, per-device reads). */
16620
+ deviceId: number().int().optional(),
16621
+ /** The domain clock, ms: observed / created / opened. */
16622
+ at: number().int().optional(),
16623
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16624
+ expiresAt: number().int().optional(),
16625
+ data: RecordBodySchema
16626
+ });
16627
+ var RecordViewSchema = object({
16628
+ id: string(),
16629
+ deviceId: number().int().nullable(),
16630
+ at: number().nullable(),
16631
+ expiresAt: number().nullable(),
16632
+ rev: number().int(),
16633
+ updatedAt: number(),
16634
+ data: RecordBodySchema
16635
+ });
16636
+ /** Declared index fields only. Anything else does not compile, by design. */
16637
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16638
+ string(),
16639
+ number(),
16640
+ boolean(),
16641
+ object({ in: array(union([
16642
+ string(),
16643
+ number(),
16644
+ boolean()
16645
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16646
+ object({
16647
+ gt: union([string(), number()]).optional(),
16648
+ gte: union([string(), number()]).optional(),
16649
+ lt: union([string(), number()]).optional(),
16650
+ lte: union([string(), number()]).optional()
16651
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16652
+ ]));
16653
+ var KindShape = { kind: RecordKindNameSchema };
16654
+ var TimeWindowShape = {
16655
+ deviceId: number().int().optional(),
16656
+ atFrom: number().optional(),
16657
+ atTo: number().optional()
16658
+ };
16659
+ var RecordQueryInputSchema = object({
16660
+ ...KindShape,
16661
+ ...TimeWindowShape,
16662
+ where: RecordWhereSchema.optional(),
16663
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16664
+ order: _enum(["at", "id"]).optional(),
16665
+ desc: boolean().optional(),
16666
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16667
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16668
+ cursor: string().min(1).optional()
16669
+ });
16670
+ var RecordQueryResultSchema = object({
16671
+ records: array(RecordViewSchema),
16672
+ nextCursor: string().nullable()
16673
+ });
16674
+ var RecordKindStateSchema = _enum([
16675
+ "created",
16676
+ "unchanged",
16677
+ "updated"
16678
+ ]);
16679
+ var DeclareKindResultSchema = object({
16680
+ kindId: number().int(),
16681
+ state: RecordKindStateSchema,
16682
+ createdIndexes: array(string()),
16683
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16684
+ adoptionPending: object({
16685
+ legacyTable: string(),
16686
+ legacyRows: number().int()
16687
+ }).nullable()
16688
+ });
16689
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16690
+ var SecretRefsList = array(string());
16691
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16692
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16693
+ kind: "mutation",
16694
+ auth: "admin"
16695
+ }), method(object({
16696
+ ...KindShape,
16697
+ id: RecordIdSchema
16698
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16699
+ ...KindShape,
16700
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16701
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16702
+ ...KindShape,
16703
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16704
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16705
+ ...KindShape,
16706
+ record: RecordInputSchema,
16707
+ /** Compare-and-set. `0` means "the row must not exist". */
16708
+ ifRev: number().int().min(0).optional()
16709
+ }), object({
16710
+ rev: number().int(),
16711
+ releasedRefs: SecretRefsList
16712
+ }), {
16713
+ kind: "mutation",
16714
+ auth: "admin"
16715
+ }), method(object({
16716
+ ...KindShape,
16717
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16718
+ }), object({
16719
+ count: number().int(),
16720
+ releasedRefs: SecretRefsList
16721
+ }), {
16722
+ kind: "mutation",
16723
+ auth: "admin"
16724
+ }), method(object({
16725
+ ...KindShape,
16726
+ id: RecordIdSchema,
16727
+ data: RecordBodySchema,
16728
+ at: number().int().nullable().optional(),
16729
+ expiresAt: number().int().nullable().optional(),
16730
+ ifRev: number().int().min(1).optional()
16731
+ }), object({
16732
+ rev: number().int(),
16733
+ releasedRefs: SecretRefsList
16734
+ }), {
16735
+ kind: "mutation",
16736
+ auth: "admin"
16737
+ }), method(object({
16738
+ ...KindShape,
16739
+ id: RecordIdSchema
16740
+ }), object({
16741
+ deleted: boolean(),
16742
+ secretRefs: SecretRefsList
16743
+ }), {
16744
+ kind: "mutation",
16745
+ auth: "admin"
16746
+ }), method(object({
16747
+ ...KindShape,
16748
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16749
+ }), object({
16750
+ deleted: number().int(),
16751
+ secretRefs: SecretRefsList
16752
+ }), {
16753
+ kind: "mutation",
16754
+ auth: "admin"
16755
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16756
+ ...KindShape,
16757
+ ...TimeWindowShape,
16758
+ where: RecordWhereSchema.optional()
16759
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16760
+ ...KindShape,
16761
+ deviceId: number().int().optional(),
16762
+ from: number(),
16763
+ to: number(),
16764
+ bucketMs: number().int().positive()
16765
+ }), object({ buckets: array(object({
16766
+ bucketStart: number(),
16767
+ count: number().int()
16768
+ })) }), { auth: "admin" }), method(object({
16769
+ ...KindShape,
16770
+ op: _enum([
16771
+ "sum",
16772
+ "min",
16773
+ "max",
16774
+ "count"
16775
+ ]),
16776
+ field: RecordFieldPathSchema.optional(),
16777
+ groupBy: RecordFieldPathSchema.optional(),
16778
+ where: RecordWhereSchema.optional()
16779
+ }), object({ rows: array(object({
16780
+ group: union([
16781
+ string(),
16782
+ number(),
16783
+ _null()
16784
+ ]),
16785
+ value: number().nullable()
16786
+ })) }), { auth: "admin" }), method(object({
16787
+ ...KindShape,
16788
+ deviceId: number().int().optional(),
16789
+ atBefore: number().optional(),
16790
+ where: RecordWhereSchema.optional()
16791
+ }), object({
16792
+ deleted: number().int(),
16793
+ secretRefs: SecretRefsList
16794
+ }), {
16795
+ kind: "mutation",
16796
+ auth: "admin"
16797
+ }), method(object({
16798
+ deviceId: number().int(),
16799
+ kinds: array(RecordKindNameSchema).optional()
16800
+ }), object({
16801
+ deleted: record(string(), number().int()),
16802
+ secretRefs: SecretRefsList
16803
+ }), {
16804
+ kind: "mutation",
16805
+ auth: "admin"
16806
+ }), method(object(KindShape), object({ id: number().int() }), {
16807
+ kind: "mutation",
16808
+ auth: "admin"
16809
+ });
16810
+ /** One table of the settings database. */
16811
+ var StorageTableSchema = object({
16812
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
16813
+ name: string(),
16814
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
16815
+ owner: string().nullable(),
16816
+ rows: number().int().nonnegative(),
16817
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
16818
+ bytes: number().int().nonnegative().nullable(),
16819
+ /** Declared by an addon since this engine process started (a running addon claims it). */
16820
+ declaredThisBoot: boolean()
16821
+ });
16822
+ /** One declared record kind (D881) as System -> Data shows it. */
16823
+ var StorageKindSchema = object({
16824
+ owner: string(),
16825
+ kind: string(),
16826
+ database: _enum(["settings", "events"]),
16827
+ class: string(),
16828
+ state: _enum([
16829
+ "declared",
16830
+ "orphaned",
16831
+ "dropped"
16832
+ ]),
16833
+ /** `null` when the caller asked for no counts (`counts: false`). */
16834
+ rows: number().int().nonnegative().nullable(),
16835
+ /** Rows x the average size of a sample; null for an empty kind. */
16836
+ bytesEstimate: number().int().nonnegative().nullable(),
16837
+ writeTrigger: string(),
16838
+ retention: RecordRetentionSchema,
16839
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16840
+ entry: boolean(),
16841
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16842
+ declaration: RecordKindDeclarationSchema
16843
+ });
16844
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16845
+ collection: string().min(1),
16846
+ expectRows: number().int().nonnegative()
16847
+ }), object({
16848
+ dropped: literal(true),
16849
+ rows: number().int().nonnegative()
16850
+ }), {
16851
+ kind: "mutation",
16852
+ auth: "admin"
16853
+ }), method(object({
16854
+ owner: string().min(1).optional(),
16855
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16856
+ counts: boolean().optional()
16857
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16858
+ owner: string().min(1),
16859
+ kind: RecordKindNameSchema
16860
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16861
+ owner: string().min(1),
16862
+ kind: RecordKindNameSchema,
16863
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16864
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16865
+ complete: boolean().optional()
16866
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16867
+ kind: "mutation",
16868
+ auth: "admin"
16869
+ }), method(object({
16870
+ collection: string().min(1),
16871
+ cursor: string().optional(),
16872
+ limit: number().int().min(1).max(1e3).optional()
16873
+ }), object({
16874
+ rows: array(object({
16875
+ id: string(),
16876
+ data: record(string(), unknown())
16877
+ })),
16878
+ nextCursor: string().nullable()
16879
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16880
+ /**
16881
+ * record-entries - the ONE admin surface for every list of user-created entries
16882
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16883
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16884
+ *
16885
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16886
+ * the entry body with `secret: true` on every credential field, so a password
16887
+ * field is derived from the schema and never from a name. `putEntry` takes the
16888
+ * redaction token for an untouched secret (the stored value is kept), a string
16889
+ * for a new one, and the clear instruction to remove one. A read never carries
16890
+ * a secret value, and a locked keychain refuses the write with
16891
+ * `records/secret-unavailable` instead of storing plaintext.
16892
+ *
16893
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16894
+ */
16895
+ var EntryKindInfoSchema = object({
16896
+ owner: string(),
16897
+ kind: RecordKindNameSchema,
16898
+ title: string(),
16899
+ nameField: string(),
16900
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16901
+ fields: record(string(), unknown()),
16902
+ secretPaths: array(string()),
16903
+ rows: number().int().nonnegative()
16904
+ });
16905
+ var EntryViewSchema = object({
16906
+ id: RecordIdSchema,
16907
+ name: string(),
16908
+ rev: number().int(),
16909
+ updatedAt: number(),
16910
+ /** Secret fields hold the redaction token. */
16911
+ data: RecordBodySchema
16912
+ });
16913
+ var EntryAddress = {
16914
+ owner: string().min(1),
16915
+ kind: RecordKindNameSchema
16916
+ };
16917
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16918
+ ...EntryAddress,
16919
+ id: RecordIdSchema.optional(),
16920
+ data: RecordBodySchema,
16921
+ ifRev: number().int().min(1).optional()
16922
+ }), object({
16923
+ id: string(),
16924
+ rev: number().int()
16925
+ }), {
16926
+ kind: "mutation",
16927
+ auth: "admin"
16928
+ }), method(object({
16929
+ ...EntryAddress,
16930
+ id: RecordIdSchema
16931
+ }), object({ deleted: boolean() }), {
16932
+ kind: "mutation",
16933
+ auth: "admin"
16934
+ });
16935
+ /**
16358
16936
  * `keychain` — the hub's encrypted store of secret values (D787).
16359
16937
  *
16360
16938
  * Settings blobs never hold a secret: they hold a marker
@@ -16895,6 +17473,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16895
17473
  kind: "mutation",
16896
17474
  auth: "admin",
16897
17475
  caller: "required"
17476
+ }), method(object({
17477
+ ref: string().min(1),
17478
+ value: string().min(1)
17479
+ }), object({
17480
+ ref: string(),
17481
+ version: number().int()
17482
+ }), {
17483
+ kind: "mutation",
17484
+ auth: "admin",
17485
+ caller: "required"
16898
17486
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16899
17487
  deleted: array(string()).readonly(),
16900
17488
  kept: array(object({
@@ -39688,6 +40276,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39688
40276
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39689
40277
  kind: "mutation",
39690
40278
  auth: "admin"
40279
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
40280
+ kind: "mutation",
40281
+ auth: "admin"
39691
40282
  }), method(ProfileRefInputSchema, _void(), {
39692
40283
  kind: "mutation",
39693
40284
  auth: "admin"
@@ -50197,6 +50788,41 @@ var ServerRollbackInfoSchema = object({
50197
50788
  atMs: number(),
50198
50789
  reason: string()
50199
50790
  });
50791
+ /**
50792
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50793
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50794
+ * service holds, because only the hub plans) against the states the process
50795
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50796
+ * every boot, served on `getServerPackageStatus`.
50797
+ *
50798
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50799
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50800
+ * planned runner the process service has no entry for.
50801
+ */
50802
+ var RunnerRefusalSchema = object({
50803
+ runnerId: string(),
50804
+ addonIds: array(string()),
50805
+ reason: string()
50806
+ });
50807
+ var RunnerBootCheckSchema = object({
50808
+ checkedAtMs: number(),
50809
+ /** Runners planned for this node. */
50810
+ expected: number(),
50811
+ /** Planned runners whose process is `running`. */
50812
+ running: number(),
50813
+ failed: array(string()),
50814
+ refused: array(RunnerRefusalSchema),
50815
+ missing: array(string()),
50816
+ /**
50817
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50818
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50819
+ * pushed and the verdict is re-evaluated on the next runner state change.
50820
+ * Optional for version skew (absent = settled).
50821
+ */
50822
+ pending: array(string()).optional(),
50823
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50824
+ planKnown: boolean()
50825
+ });
50200
50826
  var ServerPackageStatusSchema = object({
50201
50827
  /** Root package name (`@camstack/server` on the hub). */
50202
50828
  packageName: string(),
@@ -50259,7 +50885,14 @@ var ServerPackageStatusSchema = object({
50259
50885
  * for version skew: an older provider's payload simply omits it, and an
50260
50886
  * absent wrapper is unknown — never `native`.
50261
50887
  */
50262
- wrapper: WrapperIdentitySchema.optional()
50888
+ wrapper: WrapperIdentitySchema.optional(),
50889
+ /**
50890
+ * What this node PLANNED to run against what its process service reports
50891
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50892
+ * on a provider that predates it. Absent is "not checked yet", never "all
50893
+ * well": a consumer that needs the answer treats it as pending.
50894
+ */
50895
+ runners: RunnerBootCheckSchema.optional()
50263
50896
  });
50264
50897
  var ServerUpdateCheckResultSchema = object({
50265
50898
  packageName: string(),
@@ -50310,6 +50943,13 @@ var ServerUpdateOutcomeSchema = _enum([
50310
50943
  "refused",
50311
50944
  "failed"
50312
50945
  ]);
50946
+ /** One addon the pre-flight found the target version would refuse (D877). */
50947
+ var UpdateBlockerSchema = object({
50948
+ addonId: string(),
50949
+ reason: string(),
50950
+ /** What the operator does about it. */
50951
+ remedy: string()
50952
+ });
50313
50953
  var ServerUpdateActionResultSchema = object({
50314
50954
  accepted: boolean(),
50315
50955
  targetVersion: string().nullable(),
@@ -50327,14 +50967,27 @@ var ServerUpdateActionResultSchema = object({
50327
50967
  * The failure itself, verbatim enough to act on (the npm output for a
50328
50968
  * staging install). Non-null only for `failed`.
50329
50969
  */
50330
- error: string().nullable().optional()
50970
+ error: string().nullable().optional(),
50971
+ /**
50972
+ * The addons the target version would refuse to start on this node's live
50973
+ * store (D877), present when the pre-flight refused the update
50974
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50975
+ */
50976
+ blockers: array(UpdateBlockerSchema).optional()
50331
50977
  });
50332
50978
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
50333
50979
  kind: "mutation",
50334
50980
  auth: "admin"
50335
- }), method(object({
50336
- /** Explicit target version; omitted = latest from the registry. */
50337
- version: string().optional() }), ServerUpdateActionResultSchema, {
50981
+ }), method(object({
50982
+ /** Explicit target version; omitted = latest from the registry. */
50983
+ version: string().optional(),
50984
+ /**
50985
+ * Apply even though the pre-flight (D877) found addons the target would
50986
+ * refuse to start. Off by default: those addons stay down until the
50987
+ * remedy is run, which is the incident this gate exists to prevent.
50988
+ */
50989
+ acknowledgeRefusals: boolean().optional()
50990
+ }), ServerUpdateActionResultSchema, {
50338
50991
  kind: "mutation",
50339
50992
  auth: "admin",
50340
50993
  timeoutMs: 16 * 6e4
@@ -53302,7 +53955,9 @@ var ManifestShapeSchema = object({
53302
53955
  var AddonProcessSchema = object({
53303
53956
  pid: number().optional(),
53304
53957
  mode: string(),
53305
- state: string()
53958
+ state: string(),
53959
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53960
+ reason: string().optional()
53306
53961
  });
53307
53962
  /**
53308
53963
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -54691,6 +55346,12 @@ var ClimateControlStatusSchema = object({
54691
55346
  /** Horizontal louver swing on/off. Null when the device has no
54692
55347
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
54693
55348
  swingHorizontal: boolean().nullable(),
55349
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
55350
+ minTemp: number().nullable().optional(),
55351
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
55352
+ maxTemp: number().nullable().optional(),
55353
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
55354
+ tempStep: number().positive().nullable().optional(),
54694
55355
  /** Ms epoch when the slice was last updated (push or command). */
54695
55356
  lastFetchedAt: number()
54696
55357
  });
@@ -57471,7 +58132,19 @@ var TlsStatusSchema = object({
57471
58132
  sans: array(string()),
57472
58133
  caCertPem: string().nullable(),
57473
58134
  reissueError: string().nullable(),
57474
- restartRequired: boolean()
58135
+ restartRequired: boolean(),
58136
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
58137
+ caMissing: boolean(),
58138
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
58139
+ localCaConstrained: boolean().nullable(),
58140
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
58141
+ caReplacedAt: string().nullable(),
58142
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
58143
+ storedUpload: object({
58144
+ leafFingerprintSha256: string(),
58145
+ validTo: string(),
58146
+ hasCa: boolean()
58147
+ }).nullable()
57475
58148
  });
57476
58149
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
57477
58150
  /**
@@ -57527,6 +58200,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
57527
58200
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
57528
58201
  kind: "mutation",
57529
58202
  auth: "admin"
58203
+ }), method(_void(), TlsStatusSchema, {
58204
+ kind: "mutation",
58205
+ auth: "admin"
57530
58206
  });
57531
58207
  var LockControlStatusSchema = object({
57532
58208
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -64581,7 +65257,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64581
65257
  kind: "mutation",
64582
65258
  auth: "admin",
64583
65259
  access: "delete"
64584
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
65260
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
65261
+ kind: "mutation",
65262
+ auth: "admin",
65263
+ access: "create"
65264
+ }), method(object({
64585
65265
  userId: string(),
64586
65266
  code: string()
64587
65267
  }), object({ valid: boolean() }), {
@@ -66408,13 +67088,14 @@ var BaseDevice = class {
66408
67088
  get state() {
66409
67089
  if (!this._stateProxyCache) {
66410
67090
  const cache = {};
66411
- const handler = { get: (_target, key) => {
67091
+ const handler = { get: (target, key) => {
66412
67092
  const k = key;
66413
- if (k in cache) return cache[k];
67093
+ const existing = Reflect.get(target, k);
67094
+ if (existing !== void 0) return existing;
66414
67095
  const cap = DEVICE_LOCAL_STATE_CAPS[k];
66415
67096
  if (!cap) return void 0;
66416
67097
  const proxy = this.sliceProxy(cap);
66417
- cache[k] = proxy;
67098
+ Reflect.set(target, k, proxy);
66418
67099
  return proxy;
66419
67100
  } };
66420
67101
  this._stateProxyCache = new Proxy(cache, handler);
@@ -66613,7 +67294,7 @@ var BaseDevice = class {
66613
67294
  async updateSourceInfo(patch) {
66614
67295
  const next = mergeSourceInfo(this.sourceInfo, patch);
66615
67296
  this._sourceInfoCache = Object.freeze({ ...next });
66616
- const action = this.ctx.api?.deviceManager?.setMetadata;
67297
+ const action = this.ctx.api.deviceManager?.setMetadata;
66617
67298
  if (action) try {
66618
67299
  await action.mutate({
66619
67300
  deviceId: this.id,
@@ -66648,7 +67329,7 @@ var BaseDevice = class {
66648
67329
  * device boot on a meta refresh.
66649
67330
  */
66650
67331
  async refreshFeatures() {
66651
- const action = this.ctx.api?.deviceManager?.registerDevice;
67332
+ const action = this.ctx.api.deviceManager?.registerDevice;
66652
67333
  if (!action) return;
66653
67334
  try {
66654
67335
  await action.mutate({
@@ -67573,6 +68254,10 @@ var BaseDeviceProvider = class extends BaseAddon {
67573
68254
  return toDeviceSummary(device, this.addonId);
67574
68255
  }
67575
68256
  };
68257
+ /** Map entry helper — concrete camera/hub classes widen to `DeviceConstructor<IDevice>`. */
68258
+ function widenDeviceConstructor(ctor) {
68259
+ return ctor;
68260
+ }
67576
68261
  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;
67577
68262
  new Set(Object.values(DeviceType));
67578
68263
  Object.freeze({
@@ -68722,6 +69407,12 @@ Object.freeze({
68722
69407
  addonId: null,
68723
69408
  access: "view"
68724
69409
  },
69410
+ "coreBlocks.migrateRawSecrets": {
69411
+ capName: "core-blocks",
69412
+ capScope: "system",
69413
+ addonId: null,
69414
+ access: "create"
69415
+ },
68725
69416
  "coreBlocks.restart": {
68726
69417
  capName: "core-blocks",
68727
69418
  capScope: "system",
@@ -70408,6 +71099,12 @@ Object.freeze({
70408
71099
  addonId: null,
70409
71100
  access: "create"
70410
71101
  },
71102
+ "keychainAdmin.importSecret": {
71103
+ capName: "keychain-admin",
71104
+ capScope: "system",
71105
+ addonId: null,
71106
+ access: "create"
71107
+ },
70411
71108
  "keychainAdmin.listAudit": {
70412
71109
  capName: "keychain-admin",
70413
71110
  capScope: "system",
@@ -70576,6 +71273,12 @@ Object.freeze({
70576
71273
  addonId: null,
70577
71274
  access: "view"
70578
71275
  },
71276
+ "llm.migrateRawSecrets": {
71277
+ capName: "llm",
71278
+ capScope: "system",
71279
+ addonId: null,
71280
+ access: "create"
71281
+ },
70579
71282
  "llm.resolveModelRef": {
70580
71283
  capName: "llm",
70581
71284
  capScope: "system",
@@ -70804,6 +71507,12 @@ Object.freeze({
70804
71507
  addonId: null,
70805
71508
  access: "create"
70806
71509
  },
71510
+ "localNetwork.useStoredUploadedCertificate": {
71511
+ capName: "local-network",
71512
+ capScope: "system",
71513
+ addonId: null,
71514
+ access: "create"
71515
+ },
70807
71516
  "lockControl.getStatus": {
70808
71517
  capName: "lock-control",
70809
71518
  capScope: "device",
@@ -73456,6 +74165,30 @@ Object.freeze({
73456
74165
  addonId: null,
73457
74166
  access: "create"
73458
74167
  },
74168
+ "recordEntries.deleteEntry": {
74169
+ capName: "record-entries",
74170
+ capScope: "system",
74171
+ addonId: null,
74172
+ access: "delete"
74173
+ },
74174
+ "recordEntries.listEntries": {
74175
+ capName: "record-entries",
74176
+ capScope: "system",
74177
+ addonId: null,
74178
+ access: "view"
74179
+ },
74180
+ "recordEntries.listEntryKinds": {
74181
+ capName: "record-entries",
74182
+ capScope: "system",
74183
+ addonId: null,
74184
+ access: "view"
74185
+ },
74186
+ "recordEntries.putEntry": {
74187
+ capName: "record-entries",
74188
+ capScope: "system",
74189
+ addonId: null,
74190
+ access: "create"
74191
+ },
73459
74192
  "recording.getAvailability": {
73460
74193
  capName: "recording",
73461
74194
  capScope: "device",
@@ -73756,6 +74489,102 @@ Object.freeze({
73756
74489
  addonId: null,
73757
74490
  access: "view"
73758
74491
  },
74492
+ "records.aggregate": {
74493
+ capName: "records",
74494
+ capScope: "system",
74495
+ addonId: null,
74496
+ access: "view"
74497
+ },
74498
+ "records.allocateId": {
74499
+ capName: "records",
74500
+ capScope: "system",
74501
+ addonId: null,
74502
+ access: "create"
74503
+ },
74504
+ "records.count": {
74505
+ capName: "records",
74506
+ capScope: "system",
74507
+ addonId: null,
74508
+ access: "view"
74509
+ },
74510
+ "records.declareKinds": {
74511
+ capName: "records",
74512
+ capScope: "system",
74513
+ addonId: null,
74514
+ access: "create"
74515
+ },
74516
+ "records.delete": {
74517
+ capName: "records",
74518
+ capScope: "system",
74519
+ addonId: null,
74520
+ access: "delete"
74521
+ },
74522
+ "records.deleteDevice": {
74523
+ capName: "records",
74524
+ capScope: "system",
74525
+ addonId: null,
74526
+ access: "delete"
74527
+ },
74528
+ "records.deleteMany": {
74529
+ capName: "records",
74530
+ capScope: "system",
74531
+ addonId: null,
74532
+ access: "delete"
74533
+ },
74534
+ "records.deleteWhere": {
74535
+ capName: "records",
74536
+ capScope: "system",
74537
+ addonId: null,
74538
+ access: "delete"
74539
+ },
74540
+ "records.get": {
74541
+ capName: "records",
74542
+ capScope: "system",
74543
+ addonId: null,
74544
+ access: "view"
74545
+ },
74546
+ "records.getMany": {
74547
+ capName: "records",
74548
+ capScope: "system",
74549
+ addonId: null,
74550
+ access: "view"
74551
+ },
74552
+ "records.histogram": {
74553
+ capName: "records",
74554
+ capScope: "system",
74555
+ addonId: null,
74556
+ access: "view"
74557
+ },
74558
+ "records.patch": {
74559
+ capName: "records",
74560
+ capScope: "system",
74561
+ addonId: null,
74562
+ access: "create"
74563
+ },
74564
+ "records.put": {
74565
+ capName: "records",
74566
+ capScope: "system",
74567
+ addonId: null,
74568
+ access: "create"
74569
+ },
74570
+ "records.putMany": {
74571
+ capName: "records",
74572
+ capScope: "system",
74573
+ addonId: null,
74574
+ access: "create"
74575
+ },
74576
+ "records.query": {
74577
+ capName: "records",
74578
+ capScope: "system",
74579
+ addonId: null,
74580
+ access: "view"
74581
+ },
74582
+ "records.secretRefs": {
74583
+ capName: "records",
74584
+ capScope: "system",
74585
+ addonId: null,
74586
+ access: "view"
74587
+ },
73759
74588
  "sceneMonitor.captureReference": {
73760
74589
  capName: "scene-monitor",
73761
74590
  capScope: "device",
@@ -74188,6 +75017,48 @@ Object.freeze({
74188
75017
  addonId: null,
74189
75018
  access: "create"
74190
75019
  },
75020
+ "storageAdmin.adoptRecords": {
75021
+ capName: "storage-admin",
75022
+ capScope: "system",
75023
+ addonId: null,
75024
+ access: "create"
75025
+ },
75026
+ "storageAdmin.dropCollection": {
75027
+ capName: "storage-admin",
75028
+ capScope: "system",
75029
+ addonId: null,
75030
+ access: "delete"
75031
+ },
75032
+ "storageAdmin.isAdoptedLegacyTable": {
75033
+ capName: "storage-admin",
75034
+ capScope: "system",
75035
+ addonId: null,
75036
+ access: "view"
75037
+ },
75038
+ "storageAdmin.listKinds": {
75039
+ capName: "storage-admin",
75040
+ capScope: "system",
75041
+ addonId: null,
75042
+ access: "view"
75043
+ },
75044
+ "storageAdmin.listTables": {
75045
+ capName: "storage-admin",
75046
+ capScope: "system",
75047
+ addonId: null,
75048
+ access: "view"
75049
+ },
75050
+ "storageAdmin.readLegacyCollection": {
75051
+ capName: "storage-admin",
75052
+ capScope: "system",
75053
+ addonId: null,
75054
+ access: "view"
75055
+ },
75056
+ "storageAdmin.readRecords": {
75057
+ capName: "storage-admin",
75058
+ capScope: "system",
75059
+ addonId: null,
75060
+ access: "view"
75061
+ },
74191
75062
  "storageEvictable.evict": {
74192
75063
  capName: "storage-evictable",
74193
75064
  capScope: "system",
@@ -75100,6 +75971,12 @@ Object.freeze({
75100
75971
  addonId: null,
75101
75972
  access: "view"
75102
75973
  },
75974
+ "userManagement.migrateRawSecrets": {
75975
+ capName: "user-management",
75976
+ capScope: "system",
75977
+ addonId: null,
75978
+ access: "create"
75979
+ },
75103
75980
  "userManagement.oauthExchangeCode": {
75104
75981
  capName: "user-management",
75105
75982
  capScope: "system",
@@ -77994,6 +78871,37 @@ Object.freeze({
77994
78871
  form: "single",
77995
78872
  optional: false
77996
78873
  }],
78874
+ "records.count": [{
78875
+ name: "deviceId",
78876
+ form: "single",
78877
+ optional: true
78878
+ }],
78879
+ "records.deleteDevice": [{
78880
+ name: "deviceId",
78881
+ form: "single",
78882
+ optional: false
78883
+ }],
78884
+ "records.deleteWhere": [{
78885
+ name: "deviceId",
78886
+ form: "single",
78887
+ optional: true
78888
+ }],
78889
+ "records.histogram": [{
78890
+ name: "deviceId",
78891
+ form: "single",
78892
+ optional: true
78893
+ }],
78894
+ "records.putMany": [{
78895
+ name: "records",
78896
+ form: "object-array",
78897
+ optional: false,
78898
+ itemField: "deviceId"
78899
+ }],
78900
+ "records.query": [{
78901
+ name: "deviceId",
78902
+ form: "single",
78903
+ optional: true
78904
+ }],
77997
78905
  "sceneMonitor.captureReference": [{
77998
78906
  name: "deviceId",
77999
78907
  form: "single",
@@ -78110,6 +79018,17 @@ Object.freeze({
78110
79018
  form: "single",
78111
79019
  optional: false
78112
79020
  }],
79021
+ "storageAdmin.adoptRecords": [{
79022
+ name: "records",
79023
+ form: "object-array",
79024
+ optional: false,
79025
+ itemField: "deviceId"
79026
+ }],
79027
+ "storageAdmin.readRecords": [{
79028
+ name: "deviceId",
79029
+ form: "single",
79030
+ optional: true
79031
+ }],
78113
79032
  "streamBroker.acquireEgressTranscode": [{
78114
79033
  name: "deviceId",
78115
79034
  form: "single",
@@ -102216,7 +103135,7 @@ function isMeaningfulIdentifier(s) {
102216
103135
  var HikvisionProviderAddon = class extends BaseDeviceProvider {
102217
103136
  addonId = HIKVISION_ADDON_ID;
102218
103137
  providerName = "Hikvision";
102219
- deviceClasses = { [DeviceType.Camera]: HikvisionCamera };
103138
+ deviceClasses = { [DeviceType.Camera]: widenDeviceConstructor(HikvisionCamera) };
102220
103139
  constructor() {
102221
103140
  super({});
102222
103141
  }