@camstack/addon-provider-onvif 1.2.128 → 1.2.129

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 +966 -56
  2. package/dist/addon.mjs +966 -56
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -3,7 +3,7 @@ import { createRequire } from "node:module";
3
3
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
4
4
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
5
  //#endregion
6
- //#region ../types/dist/event-category-C4hVnRo8.mjs
6
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
7
7
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
8
8
  EventCategory["SystemBoot"] = "system.boot";
9
9
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -67,6 +67,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
67
67
  * consumes this category and maps it to the `addon-crash-loop` kind.
68
68
  */
69
69
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
70
+ /**
71
+ * A runner whose addon refused to start with a typed reason (D877) - parked
72
+ * in `refused`, never counted by the crash breaker, retried on operator
73
+ * action. One event per refusal.
74
+ */
75
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
76
+ /**
77
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
78
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
79
+ * runner is still pending) and the alert centre (close a recovered runner).
80
+ */
81
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
82
+ /**
83
+ * The node's one-shot runner boot check (D877): planned runners against the
84
+ * process service, `degraded` when any is failed, refused or missing. The
85
+ * alert centre turns it into one alert and a direct critical push.
86
+ */
87
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
70
88
  EventCategory["AddonError"] = "addon.error";
71
89
  EventCategory["AddonPageReady"] = "addon.page-ready";
72
90
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -5391,7 +5409,7 @@ var ZodIssueCode = {
5391
5409
  var ZodFirstPartyTypeKind;
5392
5410
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5393
5411
  //#endregion
5394
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5412
+ //#region ../types/dist/sleep-bZIhUvjd.mjs
5395
5413
  /**
5396
5414
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5397
5415
  * window to float samples (D455).
@@ -5508,7 +5526,7 @@ function isKeychainStoredField(field) {
5508
5526
  var SECRET_CLEAR = { $secretClear: true };
5509
5527
  /** The `'***'` token D634 redaction writes for non-admins. */
5510
5528
  var LEGACY_DEVICE_REDACTION = "***";
5511
- function isRecord$2(value) {
5529
+ function isRecord$5(value) {
5512
5530
  return typeof value === "object" && value !== null && !Array.isArray(value);
5513
5531
  }
5514
5532
  function makeSecretMarker(ref) {
@@ -5519,12 +5537,12 @@ function makeSecretMarker(ref) {
5519
5537
  }
5520
5538
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5521
5539
  function isSecretMarker(value) {
5522
- if (!isRecord$2(value)) return false;
5540
+ if (!isRecord$5(value)) return false;
5523
5541
  const ref = value["$secret"];
5524
5542
  return typeof ref === "string" && ref.length > 0;
5525
5543
  }
5526
5544
  function isSecretClear(value) {
5527
- return isRecord$2(value) && value["$secretClear"] === true;
5545
+ return isRecord$5(value) && value["$secretClear"] === true;
5528
5546
  }
5529
5547
  /**
5530
5548
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6134,7 +6152,7 @@ var KeychainWriteRefusedError = class extends Error {
6134
6152
  }
6135
6153
  };
6136
6154
  var KEEP = { kind: "keep" };
6137
- function isRecord$1(value) {
6155
+ function isRecord$4(value) {
6138
6156
  return typeof value === "object" && value !== null && !Array.isArray(value);
6139
6157
  }
6140
6158
  function defaultMintId() {
@@ -6147,7 +6165,7 @@ function collectSecretMarkerRefs(value, out = []) {
6147
6165
  return out;
6148
6166
  }
6149
6167
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6150
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6168
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6151
6169
  return out;
6152
6170
  }
6153
6171
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6202,7 +6220,7 @@ function rowId(row, idKey) {
6202
6220
  return null;
6203
6221
  }
6204
6222
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6205
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6223
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6206
6224
  if (!Array.isArray(incoming)) {
6207
6225
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6208
6226
  return {
@@ -6218,7 +6236,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6218
6236
  const kept = /* @__PURE__ */ new Set();
6219
6237
  const rows = [];
6220
6238
  for (const row of incoming) {
6221
- if (!isRecord$1(row)) {
6239
+ if (!isRecord$4(row)) {
6222
6240
  rows.push(row);
6223
6241
  continue;
6224
6242
  }
@@ -6243,7 +6261,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6243
6261
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6244
6262
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6245
6263
  case "object": {
6246
- if (!isRecord$1(incoming)) {
6264
+ if (!isRecord$4(incoming)) {
6247
6265
  if (incoming === void 0) return KEEP;
6248
6266
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6249
6267
  return {
@@ -6251,7 +6269,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6251
6269
  value: incoming
6252
6270
  };
6253
6271
  }
6254
- const storedObj = isRecord$1(stored) ? stored : {};
6272
+ const storedObj = isRecord$4(stored) ? stored : {};
6255
6273
  return {
6256
6274
  kind: "value",
6257
6275
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6374,7 +6392,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6374
6392
  value: items
6375
6393
  };
6376
6394
  }
6377
- if (isRecord$1(v)) {
6395
+ if (isRecord$4(v)) {
6378
6396
  const out = {};
6379
6397
  for (const [k, child] of Object.entries(v)) {
6380
6398
  const s = substitute(child);
@@ -6406,7 +6424,7 @@ var SecretOverwriteRefusedError = class extends Error {
6406
6424
  this.name = "SecretOverwriteRefusedError";
6407
6425
  }
6408
6426
  };
6409
- function isRecord(value) {
6427
+ function isRecord$3(value) {
6410
6428
  return typeof value === "object" && value !== null && !Array.isArray(value);
6411
6429
  }
6412
6430
  function resolvedValue(pass, marker) {
@@ -6435,7 +6453,7 @@ function inArray(pass, incoming, stored) {
6435
6453
  return incoming.map((item, index) => {
6436
6454
  const twin = stored[index];
6437
6455
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6438
- if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6456
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6439
6457
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6440
6458
  return item;
6441
6459
  });
@@ -6446,7 +6464,7 @@ function inArrayRow(pass, incoming, stored) {
6446
6464
  const twin = stored[key];
6447
6465
  if (isSecretMarker(twin)) {
6448
6466
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6449
- } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6467
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6450
6468
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6451
6469
  }
6452
6470
  return out;
@@ -6454,7 +6472,7 @@ function inArrayRow(pass, incoming, stored) {
6454
6472
  async function walk(pass, incoming, stored) {
6455
6473
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6456
6474
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6457
- if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6475
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6458
6476
  const out = { ...incoming };
6459
6477
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6460
6478
  return out;
@@ -6485,7 +6503,7 @@ async function restoreUnchangedSecrets(input) {
6485
6503
  function isJsonEqual(a, b) {
6486
6504
  if (Object.is(a, b)) return true;
6487
6505
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6488
- if (isRecord(a) && isRecord(b)) {
6506
+ if (isRecord$3(a) && isRecord$3(b)) {
6489
6507
  const keys = Object.keys(a);
6490
6508
  if (keys.length !== Object.keys(b).length) return false;
6491
6509
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -6509,7 +6527,7 @@ function markerKeysOf(blob, owner) {
6509
6527
  }
6510
6528
  function nodeFromStored(value, owner) {
6511
6529
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6512
- if (!isRecord(value)) return null;
6530
+ if (!isRecord$3(value)) return null;
6513
6531
  const children = /* @__PURE__ */ new Map();
6514
6532
  for (const [key, child] of Object.entries(value)) {
6515
6533
  const node = nodeFromStored(child, owner);
@@ -6642,7 +6660,6 @@ function createHandle(raw, opts) {
6642
6660
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6643
6661
  const readAddonStoreResult = raw.readAddonStoreResult;
6644
6662
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6645
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6646
6663
  const overrides = {
6647
6664
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6648
6665
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6666,12 +6683,12 @@ function createHandle(raw, opts) {
6666
6683
  };
6667
6684
  } } : {},
6668
6685
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6669
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6670
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6686
+ readDeviceStoreBatch: async (deviceIds) => {
6687
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6671
6688
  const out = /* @__PURE__ */ new Map();
6672
6689
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6673
6690
  return out;
6674
- } } : {},
6691
+ },
6675
6692
  writeAddonStore: async (patch) => {
6676
6693
  await writeAddon(patch);
6677
6694
  },
@@ -7298,7 +7315,7 @@ var BaseAddon = class {
7298
7315
  if (!ctx) return;
7299
7316
  const addonId = ctx.id;
7300
7317
  setImmediate(() => {
7301
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7318
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7302
7319
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7303
7320
  }).catch((err) => {
7304
7321
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7498,7 +7515,7 @@ var BaseAddon = class {
7498
7515
  return this._addonSecretTree;
7499
7516
  }
7500
7517
  deviceSecretTree() {
7501
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7518
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7502
7519
  return this._deviceSecretTree;
7503
7520
  }
7504
7521
  /**
@@ -7574,42 +7591,135 @@ var BaseAddon = class {
7574
7591
  this[timerOf] = timer;
7575
7592
  }
7576
7593
  /**
7577
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7578
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7579
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7580
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7594
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7595
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7581
7596
  * addon permanently broken.
7582
7597
  *
7583
- * Retry only the two known infra fingerprints. Anything else propagates so
7584
- * real bugs surface immediately. After the budget expires we fall back to
7585
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7598
+ * Two kinds of outage, two budgets:
7599
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7600
+ * initialized`, `provider not available`): a short budget, then the addon
7601
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7602
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7603
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7604
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7605
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7606
+ * loop. A long, bounded budget; only after it the error propagates - the
7607
+ * addon never runs on defaults for a store it could not ask.
7608
+ * Anything else propagates immediately so real bugs surface.
7586
7609
  */
7587
7610
  async readAddonStoreWithRetry() {
7588
7611
  const settings = this.rawSettings();
7589
7612
  if (!settings) return {};
7590
- const delaysMs = [
7591
- 150,
7592
- 350,
7593
- 600,
7594
- 900
7595
- ];
7596
7613
  let lastErr;
7597
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7614
+ for (let attempt = 0;; attempt++) try {
7598
7615
  const stored = await settings.readAddonStore() ?? {};
7599
7616
  this.settingsStoreReady = true;
7600
7617
  return stored;
7601
7618
  } catch (err) {
7602
7619
  lastErr = err;
7603
- const msg = err instanceof Error ? err.message : String(err);
7604
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7605
- if (attempt === delaysMs.length) break;
7606
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7620
+ const kind = classifyStoreError(err);
7621
+ if (kind === "permanent") throw err;
7622
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7623
+ if (delay === void 0) {
7624
+ if (kind === "transport") throw err;
7625
+ break;
7626
+ }
7627
+ await new Promise((r) => setTimeout(r, delay));
7607
7628
  }
7608
7629
  this.settingsStoreReady = false;
7609
7630
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7610
7631
  return {};
7611
7632
  }
7612
7633
  };
7634
+ /** The settings store's own restart fingerprints. */
7635
+ var RESTART_RETRY_DELAYS_MS = [
7636
+ 150,
7637
+ 350,
7638
+ 600,
7639
+ 900
7640
+ ];
7641
+ /** A hub restarting under a booting runner: ~100 s in total. */
7642
+ var TRANSPORT_RETRY_DELAYS_MS = [
7643
+ 150,
7644
+ 350,
7645
+ 600,
7646
+ 900,
7647
+ 2e3,
7648
+ 5e3,
7649
+ 1e4,
7650
+ 2e4,
7651
+ 3e4,
7652
+ 3e4
7653
+ ];
7654
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7655
+ /** Node / socket error codes of a connection that did not happen or broke. */
7656
+ var TRANSPORT_CODES = new Set([
7657
+ "ECONNREFUSED",
7658
+ "ECONNRESET",
7659
+ "ETIMEDOUT",
7660
+ "EPIPE",
7661
+ "EHOSTUNREACH",
7662
+ "ENETUNREACH"
7663
+ ]);
7664
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7665
+ var UNAVAILABLE_TRPC_CODES = new Set([
7666
+ "TIMEOUT",
7667
+ "SERVICE_UNAVAILABLE",
7668
+ "BAD_GATEWAY",
7669
+ "GATEWAY_TIMEOUT"
7670
+ ]);
7671
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7672
+ var TRANSPORT_PHRASES = [
7673
+ "discovery deadline exceeded",
7674
+ "parent could not route child unowned cap call",
7675
+ "UDS request timed out after",
7676
+ "channel closed"
7677
+ ];
7678
+ /** Moleculer error `type`s of a call that could not be served right now. */
7679
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7680
+ "REQUEST_TIMEOUT",
7681
+ "SERVICE_NOT_FOUND",
7682
+ "SERVICE_NOT_AVAILABLE",
7683
+ "REQUEST_REJECTED",
7684
+ "BROKER_DISCONNECTED"
7685
+ ]);
7686
+ function stringProp(value, key) {
7687
+ if (typeof value !== "object" || value === null) return void 0;
7688
+ const found = Reflect.get(value, key);
7689
+ return typeof found === "string" ? found : void 0;
7690
+ }
7691
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7692
+ function errorCode(err) {
7693
+ const out = {};
7694
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7695
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7696
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7697
+ if (node !== void 0) out.node = node;
7698
+ const trpc = stringProp(data, "code");
7699
+ if (trpc !== void 0) out.trpc = trpc;
7700
+ return out;
7701
+ }
7702
+ /**
7703
+ * Is a settings read failure worth retrying, and with which budget? Only
7704
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7705
+ * one of the exact phrases our own transport raises. A message that merely
7706
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7707
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7708
+ */
7709
+ function classifyStoreError(err) {
7710
+ const message = err instanceof Error ? err.message : String(err);
7711
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7712
+ const code = errorCode(err);
7713
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7714
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7715
+ if (typeof err === "object" && err !== null) {
7716
+ if (Reflect.get(err, "retryable") === true) return "transport";
7717
+ const type = stringProp(err, "type");
7718
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7719
+ }
7720
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7721
+ return "permanent";
7722
+ }
7613
7723
  /**
7614
7724
  * Collect the keys of every field marked `perNode: true`, recursing into
7615
7725
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7699,6 +7809,89 @@ var PeerBytesTicketSchema = object({
7699
7809
  */
7700
7810
  declaredBytes: number().int().nonnegative().nullable()
7701
7811
  });
7812
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7813
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7814
+ var RECORD_DATABASES = ["settings", "events"];
7815
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7816
+ var RECORD_CLASSES = [
7817
+ "config",
7818
+ "ledger",
7819
+ "audit",
7820
+ "mirror",
7821
+ "ephemeral"
7822
+ ];
7823
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7824
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7825
+ var RECORD_BATCH_MAX = 1e3;
7826
+ var RECORD_QUERY_MAX = 1e3;
7827
+ /**
7828
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
7829
+ * Zod row schema that describes it, and the helper that turns the two into the
7830
+ * JSON the engine stores.
7831
+ *
7832
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
7833
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
7834
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
7835
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
7836
+ * never a field name (D879).
7837
+ */
7838
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
7839
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
7840
+ var RecordIndexSchema = object({
7841
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
7842
+ fields: array(RecordFieldPathSchema).min(1).max(4),
7843
+ unique: boolean().optional()
7844
+ }).strict();
7845
+ var RecordRetentionSchema = union([
7846
+ object({
7847
+ ttlMs: number().int().positive(),
7848
+ from: _enum(["at", "write"])
7849
+ }).strict(),
7850
+ object({
7851
+ maxRows: number().int().positive().optional(),
7852
+ maxRowsPerDevice: number().int().positive().optional()
7853
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
7854
+ object({
7855
+ owner: string().min(1),
7856
+ reason: string().min(1)
7857
+ }).strict(),
7858
+ object({ none: string().min(1) }).strict()
7859
+ ]);
7860
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
7861
+ var EntryDescriptorSchema = object({
7862
+ title: string().min(1),
7863
+ /** The record body field shown as the entry's name. */
7864
+ nameField: string().min(1),
7865
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
7866
+ fields: record(string(), unknown())
7867
+ }).strict();
7868
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
7869
+ var RecordKindDeclarationSchema = object({
7870
+ database: _enum(RECORD_DATABASES).default("settings"),
7871
+ class: _enum(RECORD_CLASSES),
7872
+ writeTrigger: string().min(1),
7873
+ device: _enum([
7874
+ "required",
7875
+ "optional",
7876
+ "none"
7877
+ ]).default("none"),
7878
+ at: _enum(["required", "none"]).default("none"),
7879
+ indexes: array(RecordIndexSchema).max(8).default([]),
7880
+ retention: RecordRetentionSchema,
7881
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
7882
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
7883
+ /** Derived from the Zod schema; never written by hand. */
7884
+ secretPaths: array(string().min(1)).default([]),
7885
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
7886
+ secretArrayKeys: record(string(), string()).default({}),
7887
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
7888
+ adoptsFrom: string().min(1).optional(),
7889
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
7890
+ transactFamily: string().min(1).optional(),
7891
+ entry: EntryDescriptorSchema.optional()
7892
+ }).strict();
7893
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
7894
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
7702
7895
  /** Shared Zod schemas used across streaming capabilities. */
7703
7896
  var CamProfileSchema = _enum([
7704
7897
  "high",
@@ -8164,7 +8357,7 @@ object({
8164
8357
  params: record(string(), union([string(), number()])).optional()
8165
8358
  });
8166
8359
  //#endregion
8167
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8360
+ //#region ../types/dist/err-msg--2RrYiLO.mjs
8168
8361
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8169
8362
  DeviceType["Camera"] = "camera";
8170
8363
  DeviceType["Hub"] = "hub";
@@ -8433,6 +8626,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8433
8626
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8434
8627
  * real Switch device for UI rendering / export adapters. */
8435
8628
  DeviceRole["BinaryHelper"] = "binary-helper";
8629
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
8630
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
8631
+ DeviceRole["Outlet"] = "outlet";
8436
8632
  /** Generic motion / occupancy / moving event source. Distinct from
8437
8633
  * the camera accessory PirSensor role: that one is a camera child;
8438
8634
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8510,7 +8706,7 @@ function errMsg(err) {
8510
8706
  return String(err);
8511
8707
  }
8512
8708
  //#endregion
8513
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
8709
+ //#region ../types/dist/composition-DOwQB_Ua.mjs
8514
8710
  /**
8515
8711
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8516
8712
  *
@@ -11714,11 +11910,10 @@ var ClipModelMetaSchema = object({
11714
11910
  /**
11715
11911
  * The `vector-store` index this model's vectors live in. ONE feature space
11716
11912
  * per index: two models share an index only when their vectors are ranked
11717
- * against each other, which for CLIP means never across families. MobileCLIP
11718
- * S1 and S2 share `object-clip` for history (separated by the row's
11719
- * `modelId`); any other model gets its own.
11913
+ * against each other, which for CLIP means never across families. Every
11914
+ * model gets its own.
11720
11915
  */
11721
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
11916
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
11722
11917
  /**
11723
11918
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
11724
11919
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -15345,6 +15540,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15345
15540
  keyField: string()
15346
15541
  }).optional()
15347
15542
  })) });
15543
+ /**
15544
+ * The report of a one-shot "move this owner's plaintext secrets into the
15545
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
15546
+ *
15547
+ * The owner runs it on its own rows, through its own write path; an operator
15548
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
15549
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
15550
+ */
15551
+ var RawSecretMigrationInputSchema = object({
15552
+ /** `false` (the default of the script) = report only. */
15553
+ apply: boolean() });
15554
+ var RawSecretMigrationReportSchema = object({
15555
+ apply: boolean(),
15556
+ /** Rows that can carry a secret (a profile, an enrolment). */
15557
+ rows: number().int(),
15558
+ /** Rows whose secret was plaintext when the run started. */
15559
+ raw: number().int(),
15560
+ /** Rows that already held a keychain marker when the run started. */
15561
+ markers: number().int(),
15562
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
15563
+ migrated: number().int(),
15564
+ /** Plaintext rows left in place because the move or its read-back failed. */
15565
+ failed: number().int(),
15566
+ /** After the run: rows still holding plaintext. */
15567
+ remainingRaw: number().int(),
15568
+ /** After the run: markers the keychain could not resolve right now. */
15569
+ unresolvedMarkers: number().int(),
15570
+ /**
15571
+ * A second, redundant copy of the secrets' rows that the run found (and, on
15572
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
15573
+ */
15574
+ redundantCopies: number().int().optional(),
15575
+ /** True when nothing is raw and every marker resolves. */
15576
+ verified: boolean()
15577
+ });
15348
15578
  /** Where a block runs. The operator chooses — a block driving a device on an
15349
15579
  * agent is the reason placement is not fixed to the hub. */
15350
15580
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -15571,6 +15801,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
15571
15801
  }), SettingsUpdateResultSchema, {
15572
15802
  kind: "mutation",
15573
15803
  auth: "admin"
15804
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
15805
+ kind: "mutation",
15806
+ auth: "admin"
15574
15807
  }), method(object({}), object({ libs: array(object({
15575
15808
  filePath: string(),
15576
15809
  content: string()
@@ -15834,6 +16067,347 @@ id: union([string(), number()]) }), {
15834
16067
  auth: "admin"
15835
16068
  });
15836
16069
  /**
16070
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16071
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16072
+ * (operator intent, D870) and device-history (numbers over time, D850).
16073
+ *
16074
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16075
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16076
+ * that with the addon id closed over). It is deliberately NOT in any input
16077
+ * schema, so a session can never supply it, and a call with no stamp is refused
16078
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16079
+ * addons go through the owner's capability.
16080
+ *
16081
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16082
+ * never `[]`. Secret fields are never on the wire: a read shows the
16083
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16084
+ * resolves itself, and a write may carry only a keychain marker bound to the
16085
+ * row's own ref.
16086
+ *
16087
+ * Internal: addons reach it through `ctx.records`, never directly.
16088
+ */
16089
+ var RecordIdSchema = string().min(1).max(256);
16090
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16091
+ var RecordBodySchema = record(string(), unknown());
16092
+ var RecordInputSchema = object({
16093
+ id: RecordIdSchema,
16094
+ /** The device this row belongs to (D865 removal, per-device reads). */
16095
+ deviceId: number().int().optional(),
16096
+ /** The domain clock, ms: observed / created / opened. */
16097
+ at: number().int().optional(),
16098
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16099
+ expiresAt: number().int().optional(),
16100
+ data: RecordBodySchema
16101
+ });
16102
+ var RecordViewSchema = object({
16103
+ id: string(),
16104
+ deviceId: number().int().nullable(),
16105
+ at: number().nullable(),
16106
+ expiresAt: number().nullable(),
16107
+ rev: number().int(),
16108
+ updatedAt: number(),
16109
+ data: RecordBodySchema
16110
+ });
16111
+ /** Declared index fields only. Anything else does not compile, by design. */
16112
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16113
+ string(),
16114
+ number(),
16115
+ boolean(),
16116
+ object({ in: array(union([
16117
+ string(),
16118
+ number(),
16119
+ boolean()
16120
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16121
+ object({
16122
+ gt: union([string(), number()]).optional(),
16123
+ gte: union([string(), number()]).optional(),
16124
+ lt: union([string(), number()]).optional(),
16125
+ lte: union([string(), number()]).optional()
16126
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16127
+ ]));
16128
+ var KindShape = { kind: RecordKindNameSchema };
16129
+ var TimeWindowShape = {
16130
+ deviceId: number().int().optional(),
16131
+ atFrom: number().optional(),
16132
+ atTo: number().optional()
16133
+ };
16134
+ var RecordQueryInputSchema = object({
16135
+ ...KindShape,
16136
+ ...TimeWindowShape,
16137
+ where: RecordWhereSchema.optional(),
16138
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16139
+ order: _enum(["at", "id"]).optional(),
16140
+ desc: boolean().optional(),
16141
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16142
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16143
+ cursor: string().min(1).optional()
16144
+ });
16145
+ var RecordQueryResultSchema = object({
16146
+ records: array(RecordViewSchema),
16147
+ nextCursor: string().nullable()
16148
+ });
16149
+ var RecordKindStateSchema = _enum([
16150
+ "created",
16151
+ "unchanged",
16152
+ "updated"
16153
+ ]);
16154
+ var DeclareKindResultSchema = object({
16155
+ kindId: number().int(),
16156
+ state: RecordKindStateSchema,
16157
+ createdIndexes: array(string()),
16158
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16159
+ adoptionPending: object({
16160
+ legacyTable: string(),
16161
+ legacyRows: number().int()
16162
+ }).nullable()
16163
+ });
16164
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16165
+ var SecretRefsList = array(string());
16166
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16167
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16168
+ kind: "mutation",
16169
+ auth: "admin"
16170
+ }), method(object({
16171
+ ...KindShape,
16172
+ id: RecordIdSchema
16173
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16174
+ ...KindShape,
16175
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16176
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16177
+ ...KindShape,
16178
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16179
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16180
+ ...KindShape,
16181
+ record: RecordInputSchema,
16182
+ /** Compare-and-set. `0` means "the row must not exist". */
16183
+ ifRev: number().int().min(0).optional()
16184
+ }), object({
16185
+ rev: number().int(),
16186
+ releasedRefs: SecretRefsList
16187
+ }), {
16188
+ kind: "mutation",
16189
+ auth: "admin"
16190
+ }), method(object({
16191
+ ...KindShape,
16192
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16193
+ }), object({
16194
+ count: number().int(),
16195
+ releasedRefs: SecretRefsList
16196
+ }), {
16197
+ kind: "mutation",
16198
+ auth: "admin"
16199
+ }), method(object({
16200
+ ...KindShape,
16201
+ id: RecordIdSchema,
16202
+ data: RecordBodySchema,
16203
+ at: number().int().nullable().optional(),
16204
+ expiresAt: number().int().nullable().optional(),
16205
+ ifRev: number().int().min(1).optional()
16206
+ }), object({
16207
+ rev: number().int(),
16208
+ releasedRefs: SecretRefsList
16209
+ }), {
16210
+ kind: "mutation",
16211
+ auth: "admin"
16212
+ }), method(object({
16213
+ ...KindShape,
16214
+ id: RecordIdSchema
16215
+ }), object({
16216
+ deleted: boolean(),
16217
+ secretRefs: SecretRefsList
16218
+ }), {
16219
+ kind: "mutation",
16220
+ auth: "admin"
16221
+ }), method(object({
16222
+ ...KindShape,
16223
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16224
+ }), object({
16225
+ deleted: number().int(),
16226
+ secretRefs: SecretRefsList
16227
+ }), {
16228
+ kind: "mutation",
16229
+ auth: "admin"
16230
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16231
+ ...KindShape,
16232
+ ...TimeWindowShape,
16233
+ where: RecordWhereSchema.optional()
16234
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16235
+ ...KindShape,
16236
+ deviceId: number().int().optional(),
16237
+ from: number(),
16238
+ to: number(),
16239
+ bucketMs: number().int().positive()
16240
+ }), object({ buckets: array(object({
16241
+ bucketStart: number(),
16242
+ count: number().int()
16243
+ })) }), { auth: "admin" }), method(object({
16244
+ ...KindShape,
16245
+ op: _enum([
16246
+ "sum",
16247
+ "min",
16248
+ "max",
16249
+ "count"
16250
+ ]),
16251
+ field: RecordFieldPathSchema.optional(),
16252
+ groupBy: RecordFieldPathSchema.optional(),
16253
+ where: RecordWhereSchema.optional()
16254
+ }), object({ rows: array(object({
16255
+ group: union([
16256
+ string(),
16257
+ number(),
16258
+ _null()
16259
+ ]),
16260
+ value: number().nullable()
16261
+ })) }), { auth: "admin" }), method(object({
16262
+ ...KindShape,
16263
+ deviceId: number().int().optional(),
16264
+ atBefore: number().optional(),
16265
+ where: RecordWhereSchema.optional()
16266
+ }), object({
16267
+ deleted: number().int(),
16268
+ secretRefs: SecretRefsList
16269
+ }), {
16270
+ kind: "mutation",
16271
+ auth: "admin"
16272
+ }), method(object({
16273
+ deviceId: number().int(),
16274
+ kinds: array(RecordKindNameSchema).optional()
16275
+ }), object({
16276
+ deleted: record(string(), number().int()),
16277
+ secretRefs: SecretRefsList
16278
+ }), {
16279
+ kind: "mutation",
16280
+ auth: "admin"
16281
+ }), method(object(KindShape), object({ id: number().int() }), {
16282
+ kind: "mutation",
16283
+ auth: "admin"
16284
+ });
16285
+ /** One table of the settings database. */
16286
+ var StorageTableSchema = object({
16287
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
16288
+ name: string(),
16289
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
16290
+ owner: string().nullable(),
16291
+ rows: number().int().nonnegative(),
16292
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
16293
+ bytes: number().int().nonnegative().nullable(),
16294
+ /** Declared by an addon since this engine process started (a running addon claims it). */
16295
+ declaredThisBoot: boolean()
16296
+ });
16297
+ /** One declared record kind (D881) as System -> Data shows it. */
16298
+ var StorageKindSchema = object({
16299
+ owner: string(),
16300
+ kind: string(),
16301
+ database: _enum(["settings", "events"]),
16302
+ class: string(),
16303
+ state: _enum([
16304
+ "declared",
16305
+ "orphaned",
16306
+ "dropped"
16307
+ ]),
16308
+ /** `null` when the caller asked for no counts (`counts: false`). */
16309
+ rows: number().int().nonnegative().nullable(),
16310
+ /** Rows x the average size of a sample; null for an empty kind. */
16311
+ bytesEstimate: number().int().nonnegative().nullable(),
16312
+ writeTrigger: string(),
16313
+ retention: RecordRetentionSchema,
16314
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16315
+ entry: boolean(),
16316
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16317
+ declaration: RecordKindDeclarationSchema
16318
+ });
16319
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16320
+ collection: string().min(1),
16321
+ expectRows: number().int().nonnegative()
16322
+ }), object({
16323
+ dropped: literal(true),
16324
+ rows: number().int().nonnegative()
16325
+ }), {
16326
+ kind: "mutation",
16327
+ auth: "admin"
16328
+ }), method(object({
16329
+ owner: string().min(1).optional(),
16330
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16331
+ counts: boolean().optional()
16332
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16333
+ owner: string().min(1),
16334
+ kind: RecordKindNameSchema
16335
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16336
+ owner: string().min(1),
16337
+ kind: RecordKindNameSchema,
16338
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16339
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16340
+ complete: boolean().optional()
16341
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16342
+ kind: "mutation",
16343
+ auth: "admin"
16344
+ }), method(object({
16345
+ collection: string().min(1),
16346
+ cursor: string().optional(),
16347
+ limit: number().int().min(1).max(1e3).optional()
16348
+ }), object({
16349
+ rows: array(object({
16350
+ id: string(),
16351
+ data: record(string(), unknown())
16352
+ })),
16353
+ nextCursor: string().nullable()
16354
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16355
+ /**
16356
+ * record-entries - the ONE admin surface for every list of user-created entries
16357
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16358
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16359
+ *
16360
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16361
+ * the entry body with `secret: true` on every credential field, so a password
16362
+ * field is derived from the schema and never from a name. `putEntry` takes the
16363
+ * redaction token for an untouched secret (the stored value is kept), a string
16364
+ * for a new one, and the clear instruction to remove one. A read never carries
16365
+ * a secret value, and a locked keychain refuses the write with
16366
+ * `records/secret-unavailable` instead of storing plaintext.
16367
+ *
16368
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16369
+ */
16370
+ var EntryKindInfoSchema = object({
16371
+ owner: string(),
16372
+ kind: RecordKindNameSchema,
16373
+ title: string(),
16374
+ nameField: string(),
16375
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16376
+ fields: record(string(), unknown()),
16377
+ secretPaths: array(string()),
16378
+ rows: number().int().nonnegative()
16379
+ });
16380
+ var EntryViewSchema = object({
16381
+ id: RecordIdSchema,
16382
+ name: string(),
16383
+ rev: number().int(),
16384
+ updatedAt: number(),
16385
+ /** Secret fields hold the redaction token. */
16386
+ data: RecordBodySchema
16387
+ });
16388
+ var EntryAddress = {
16389
+ owner: string().min(1),
16390
+ kind: RecordKindNameSchema
16391
+ };
16392
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16393
+ ...EntryAddress,
16394
+ id: RecordIdSchema.optional(),
16395
+ data: RecordBodySchema,
16396
+ ifRev: number().int().min(1).optional()
16397
+ }), object({
16398
+ id: string(),
16399
+ rev: number().int()
16400
+ }), {
16401
+ kind: "mutation",
16402
+ auth: "admin"
16403
+ }), method(object({
16404
+ ...EntryAddress,
16405
+ id: RecordIdSchema
16406
+ }), object({ deleted: boolean() }), {
16407
+ kind: "mutation",
16408
+ auth: "admin"
16409
+ });
16410
+ /**
15837
16411
  * `keychain` — the hub's encrypted store of secret values (D787).
15838
16412
  *
15839
16413
  * Settings blobs never hold a secret: they hold a marker
@@ -16374,6 +16948,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16374
16948
  kind: "mutation",
16375
16949
  auth: "admin",
16376
16950
  caller: "required"
16951
+ }), method(object({
16952
+ ref: string().min(1),
16953
+ value: string().min(1)
16954
+ }), object({
16955
+ ref: string(),
16956
+ version: number().int()
16957
+ }), {
16958
+ kind: "mutation",
16959
+ auth: "admin",
16960
+ caller: "required"
16377
16961
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16378
16962
  deleted: array(string()).readonly(),
16379
16963
  kept: array(object({
@@ -39037,6 +39621,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39037
39621
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39038
39622
  kind: "mutation",
39039
39623
  auth: "admin"
39624
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
39625
+ kind: "mutation",
39626
+ auth: "admin"
39040
39627
  }), method(ProfileRefInputSchema, _void(), {
39041
39628
  kind: "mutation",
39042
39629
  auth: "admin"
@@ -49460,6 +50047,41 @@ var ServerRollbackInfoSchema = object({
49460
50047
  atMs: number(),
49461
50048
  reason: string()
49462
50049
  });
50050
+ /**
50051
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50052
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50053
+ * service holds, because only the hub plans) against the states the process
50054
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50055
+ * every boot, served on `getServerPackageStatus`.
50056
+ *
50057
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50058
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50059
+ * planned runner the process service has no entry for.
50060
+ */
50061
+ var RunnerRefusalSchema = object({
50062
+ runnerId: string(),
50063
+ addonIds: array(string()),
50064
+ reason: string()
50065
+ });
50066
+ var RunnerBootCheckSchema = object({
50067
+ checkedAtMs: number(),
50068
+ /** Runners planned for this node. */
50069
+ expected: number(),
50070
+ /** Planned runners whose process is `running`. */
50071
+ running: number(),
50072
+ failed: array(string()),
50073
+ refused: array(RunnerRefusalSchema),
50074
+ missing: array(string()),
50075
+ /**
50076
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50077
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50078
+ * pushed and the verdict is re-evaluated on the next runner state change.
50079
+ * Optional for version skew (absent = settled).
50080
+ */
50081
+ pending: array(string()).optional(),
50082
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50083
+ planKnown: boolean()
50084
+ });
49463
50085
  var ServerPackageStatusSchema = object({
49464
50086
  /** Root package name (`@camstack/server` on the hub). */
49465
50087
  packageName: string(),
@@ -49522,7 +50144,14 @@ var ServerPackageStatusSchema = object({
49522
50144
  * for version skew: an older provider's payload simply omits it, and an
49523
50145
  * absent wrapper is unknown — never `native`.
49524
50146
  */
49525
- wrapper: WrapperIdentitySchema.optional()
50147
+ wrapper: WrapperIdentitySchema.optional(),
50148
+ /**
50149
+ * What this node PLANNED to run against what its process service reports
50150
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50151
+ * on a provider that predates it. Absent is "not checked yet", never "all
50152
+ * well": a consumer that needs the answer treats it as pending.
50153
+ */
50154
+ runners: RunnerBootCheckSchema.optional()
49526
50155
  });
49527
50156
  var ServerUpdateCheckResultSchema = object({
49528
50157
  packageName: string(),
@@ -49573,6 +50202,13 @@ var ServerUpdateOutcomeSchema = _enum([
49573
50202
  "refused",
49574
50203
  "failed"
49575
50204
  ]);
50205
+ /** One addon the pre-flight found the target version would refuse (D877). */
50206
+ var UpdateBlockerSchema = object({
50207
+ addonId: string(),
50208
+ reason: string(),
50209
+ /** What the operator does about it. */
50210
+ remedy: string()
50211
+ });
49576
50212
  var ServerUpdateActionResultSchema = object({
49577
50213
  accepted: boolean(),
49578
50214
  targetVersion: string().nullable(),
@@ -49590,14 +50226,27 @@ var ServerUpdateActionResultSchema = object({
49590
50226
  * The failure itself, verbatim enough to act on (the npm output for a
49591
50227
  * staging install). Non-null only for `failed`.
49592
50228
  */
49593
- error: string().nullable().optional()
50229
+ error: string().nullable().optional(),
50230
+ /**
50231
+ * The addons the target version would refuse to start on this node's live
50232
+ * store (D877), present when the pre-flight refused the update
50233
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50234
+ */
50235
+ blockers: array(UpdateBlockerSchema).optional()
49594
50236
  });
49595
50237
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
49596
50238
  kind: "mutation",
49597
50239
  auth: "admin"
49598
- }), method(object({
49599
- /** Explicit target version; omitted = latest from the registry. */
49600
- version: string().optional() }), ServerUpdateActionResultSchema, {
50240
+ }), method(object({
50241
+ /** Explicit target version; omitted = latest from the registry. */
50242
+ version: string().optional(),
50243
+ /**
50244
+ * Apply even though the pre-flight (D877) found addons the target would
50245
+ * refuse to start. Off by default: those addons stay down until the
50246
+ * remedy is run, which is the incident this gate exists to prevent.
50247
+ */
50248
+ acknowledgeRefusals: boolean().optional()
50249
+ }), ServerUpdateActionResultSchema, {
49601
50250
  kind: "mutation",
49602
50251
  auth: "admin",
49603
50252
  timeoutMs: 16 * 6e4
@@ -52114,7 +52763,9 @@ var ManifestShapeSchema = object({
52114
52763
  var AddonProcessSchema = object({
52115
52764
  pid: number().optional(),
52116
52765
  mode: string(),
52117
- state: string()
52766
+ state: string(),
52767
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
52768
+ reason: string().optional()
52118
52769
  });
52119
52770
  /**
52120
52771
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -53117,6 +53768,12 @@ object({
53117
53768
  /** Horizontal louver swing on/off. Null when the device has no
53118
53769
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
53119
53770
  swingHorizontal: boolean().nullable(),
53771
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
53772
+ minTemp: number().nullable().optional(),
53773
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
53774
+ maxTemp: number().nullable().optional(),
53775
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
53776
+ tempStep: number().positive().nullable().optional(),
53120
53777
  /** Ms epoch when the slice was last updated (push or command). */
53121
53778
  lastFetchedAt: number()
53122
53779
  });
@@ -54937,7 +55594,19 @@ var TlsStatusSchema = object({
54937
55594
  sans: array(string()),
54938
55595
  caCertPem: string().nullable(),
54939
55596
  reissueError: string().nullable(),
54940
- restartRequired: boolean()
55597
+ restartRequired: boolean(),
55598
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
55599
+ caMissing: boolean(),
55600
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
55601
+ localCaConstrained: boolean().nullable(),
55602
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
55603
+ caReplacedAt: string().nullable(),
55604
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
55605
+ storedUpload: object({
55606
+ leafFingerprintSha256: string(),
55607
+ validTo: string(),
55608
+ hasCa: boolean()
55609
+ }).nullable()
54941
55610
  });
54942
55611
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
54943
55612
  /**
@@ -54993,6 +55662,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
54993
55662
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
54994
55663
  kind: "mutation",
54995
55664
  auth: "admin"
55665
+ }), method(_void(), TlsStatusSchema, {
55666
+ kind: "mutation",
55667
+ auth: "admin"
54996
55668
  });
54997
55669
  object({
54998
55670
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -60214,7 +60886,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
60214
60886
  kind: "mutation",
60215
60887
  auth: "admin",
60216
60888
  access: "delete"
60217
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
60889
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
60890
+ kind: "mutation",
60891
+ auth: "admin",
60892
+ access: "create"
60893
+ }), method(object({
60218
60894
  userId: string(),
60219
60895
  code: string()
60220
60896
  }), object({ valid: boolean() }), {
@@ -63234,6 +63910,12 @@ Object.freeze({
63234
63910
  addonId: null,
63235
63911
  access: "view"
63236
63912
  },
63913
+ "coreBlocks.migrateRawSecrets": {
63914
+ capName: "core-blocks",
63915
+ capScope: "system",
63916
+ addonId: null,
63917
+ access: "create"
63918
+ },
63237
63919
  "coreBlocks.restart": {
63238
63920
  capName: "core-blocks",
63239
63921
  capScope: "system",
@@ -64920,6 +65602,12 @@ Object.freeze({
64920
65602
  addonId: null,
64921
65603
  access: "create"
64922
65604
  },
65605
+ "keychainAdmin.importSecret": {
65606
+ capName: "keychain-admin",
65607
+ capScope: "system",
65608
+ addonId: null,
65609
+ access: "create"
65610
+ },
64923
65611
  "keychainAdmin.listAudit": {
64924
65612
  capName: "keychain-admin",
64925
65613
  capScope: "system",
@@ -65088,6 +65776,12 @@ Object.freeze({
65088
65776
  addonId: null,
65089
65777
  access: "view"
65090
65778
  },
65779
+ "llm.migrateRawSecrets": {
65780
+ capName: "llm",
65781
+ capScope: "system",
65782
+ addonId: null,
65783
+ access: "create"
65784
+ },
65091
65785
  "llm.resolveModelRef": {
65092
65786
  capName: "llm",
65093
65787
  capScope: "system",
@@ -65316,6 +66010,12 @@ Object.freeze({
65316
66010
  addonId: null,
65317
66011
  access: "create"
65318
66012
  },
66013
+ "localNetwork.useStoredUploadedCertificate": {
66014
+ capName: "local-network",
66015
+ capScope: "system",
66016
+ addonId: null,
66017
+ access: "create"
66018
+ },
65319
66019
  "lockControl.getStatus": {
65320
66020
  capName: "lock-control",
65321
66021
  capScope: "device",
@@ -67968,6 +68668,30 @@ Object.freeze({
67968
68668
  addonId: null,
67969
68669
  access: "create"
67970
68670
  },
68671
+ "recordEntries.deleteEntry": {
68672
+ capName: "record-entries",
68673
+ capScope: "system",
68674
+ addonId: null,
68675
+ access: "delete"
68676
+ },
68677
+ "recordEntries.listEntries": {
68678
+ capName: "record-entries",
68679
+ capScope: "system",
68680
+ addonId: null,
68681
+ access: "view"
68682
+ },
68683
+ "recordEntries.listEntryKinds": {
68684
+ capName: "record-entries",
68685
+ capScope: "system",
68686
+ addonId: null,
68687
+ access: "view"
68688
+ },
68689
+ "recordEntries.putEntry": {
68690
+ capName: "record-entries",
68691
+ capScope: "system",
68692
+ addonId: null,
68693
+ access: "create"
68694
+ },
67971
68695
  "recording.getAvailability": {
67972
68696
  capName: "recording",
67973
68697
  capScope: "device",
@@ -68268,6 +68992,102 @@ Object.freeze({
68268
68992
  addonId: null,
68269
68993
  access: "view"
68270
68994
  },
68995
+ "records.aggregate": {
68996
+ capName: "records",
68997
+ capScope: "system",
68998
+ addonId: null,
68999
+ access: "view"
69000
+ },
69001
+ "records.allocateId": {
69002
+ capName: "records",
69003
+ capScope: "system",
69004
+ addonId: null,
69005
+ access: "create"
69006
+ },
69007
+ "records.count": {
69008
+ capName: "records",
69009
+ capScope: "system",
69010
+ addonId: null,
69011
+ access: "view"
69012
+ },
69013
+ "records.declareKinds": {
69014
+ capName: "records",
69015
+ capScope: "system",
69016
+ addonId: null,
69017
+ access: "create"
69018
+ },
69019
+ "records.delete": {
69020
+ capName: "records",
69021
+ capScope: "system",
69022
+ addonId: null,
69023
+ access: "delete"
69024
+ },
69025
+ "records.deleteDevice": {
69026
+ capName: "records",
69027
+ capScope: "system",
69028
+ addonId: null,
69029
+ access: "delete"
69030
+ },
69031
+ "records.deleteMany": {
69032
+ capName: "records",
69033
+ capScope: "system",
69034
+ addonId: null,
69035
+ access: "delete"
69036
+ },
69037
+ "records.deleteWhere": {
69038
+ capName: "records",
69039
+ capScope: "system",
69040
+ addonId: null,
69041
+ access: "delete"
69042
+ },
69043
+ "records.get": {
69044
+ capName: "records",
69045
+ capScope: "system",
69046
+ addonId: null,
69047
+ access: "view"
69048
+ },
69049
+ "records.getMany": {
69050
+ capName: "records",
69051
+ capScope: "system",
69052
+ addonId: null,
69053
+ access: "view"
69054
+ },
69055
+ "records.histogram": {
69056
+ capName: "records",
69057
+ capScope: "system",
69058
+ addonId: null,
69059
+ access: "view"
69060
+ },
69061
+ "records.patch": {
69062
+ capName: "records",
69063
+ capScope: "system",
69064
+ addonId: null,
69065
+ access: "create"
69066
+ },
69067
+ "records.put": {
69068
+ capName: "records",
69069
+ capScope: "system",
69070
+ addonId: null,
69071
+ access: "create"
69072
+ },
69073
+ "records.putMany": {
69074
+ capName: "records",
69075
+ capScope: "system",
69076
+ addonId: null,
69077
+ access: "create"
69078
+ },
69079
+ "records.query": {
69080
+ capName: "records",
69081
+ capScope: "system",
69082
+ addonId: null,
69083
+ access: "view"
69084
+ },
69085
+ "records.secretRefs": {
69086
+ capName: "records",
69087
+ capScope: "system",
69088
+ addonId: null,
69089
+ access: "view"
69090
+ },
68271
69091
  "sceneMonitor.captureReference": {
68272
69092
  capName: "scene-monitor",
68273
69093
  capScope: "device",
@@ -68700,6 +69520,48 @@ Object.freeze({
68700
69520
  addonId: null,
68701
69521
  access: "create"
68702
69522
  },
69523
+ "storageAdmin.adoptRecords": {
69524
+ capName: "storage-admin",
69525
+ capScope: "system",
69526
+ addonId: null,
69527
+ access: "create"
69528
+ },
69529
+ "storageAdmin.dropCollection": {
69530
+ capName: "storage-admin",
69531
+ capScope: "system",
69532
+ addonId: null,
69533
+ access: "delete"
69534
+ },
69535
+ "storageAdmin.isAdoptedLegacyTable": {
69536
+ capName: "storage-admin",
69537
+ capScope: "system",
69538
+ addonId: null,
69539
+ access: "view"
69540
+ },
69541
+ "storageAdmin.listKinds": {
69542
+ capName: "storage-admin",
69543
+ capScope: "system",
69544
+ addonId: null,
69545
+ access: "view"
69546
+ },
69547
+ "storageAdmin.listTables": {
69548
+ capName: "storage-admin",
69549
+ capScope: "system",
69550
+ addonId: null,
69551
+ access: "view"
69552
+ },
69553
+ "storageAdmin.readLegacyCollection": {
69554
+ capName: "storage-admin",
69555
+ capScope: "system",
69556
+ addonId: null,
69557
+ access: "view"
69558
+ },
69559
+ "storageAdmin.readRecords": {
69560
+ capName: "storage-admin",
69561
+ capScope: "system",
69562
+ addonId: null,
69563
+ access: "view"
69564
+ },
68703
69565
  "storageEvictable.evict": {
68704
69566
  capName: "storage-evictable",
68705
69567
  capScope: "system",
@@ -69612,6 +70474,12 @@ Object.freeze({
69612
70474
  addonId: null,
69613
70475
  access: "view"
69614
70476
  },
70477
+ "userManagement.migrateRawSecrets": {
70478
+ capName: "user-management",
70479
+ capScope: "system",
70480
+ addonId: null,
70481
+ access: "create"
70482
+ },
69615
70483
  "userManagement.oauthExchangeCode": {
69616
70484
  capName: "user-management",
69617
70485
  capScope: "system",
@@ -72354,6 +73222,37 @@ Object.freeze({
72354
73222
  form: "single",
72355
73223
  optional: false
72356
73224
  }],
73225
+ "records.count": [{
73226
+ name: "deviceId",
73227
+ form: "single",
73228
+ optional: true
73229
+ }],
73230
+ "records.deleteDevice": [{
73231
+ name: "deviceId",
73232
+ form: "single",
73233
+ optional: false
73234
+ }],
73235
+ "records.deleteWhere": [{
73236
+ name: "deviceId",
73237
+ form: "single",
73238
+ optional: true
73239
+ }],
73240
+ "records.histogram": [{
73241
+ name: "deviceId",
73242
+ form: "single",
73243
+ optional: true
73244
+ }],
73245
+ "records.putMany": [{
73246
+ name: "records",
73247
+ form: "object-array",
73248
+ optional: false,
73249
+ itemField: "deviceId"
73250
+ }],
73251
+ "records.query": [{
73252
+ name: "deviceId",
73253
+ form: "single",
73254
+ optional: true
73255
+ }],
72357
73256
  "sceneMonitor.captureReference": [{
72358
73257
  name: "deviceId",
72359
73258
  form: "single",
@@ -72470,6 +73369,17 @@ Object.freeze({
72470
73369
  form: "single",
72471
73370
  optional: false
72472
73371
  }],
73372
+ "storageAdmin.adoptRecords": [{
73373
+ name: "records",
73374
+ form: "object-array",
73375
+ optional: false,
73376
+ itemField: "deviceId"
73377
+ }],
73378
+ "storageAdmin.readRecords": [{
73379
+ name: "deviceId",
73380
+ form: "single",
73381
+ optional: true
73382
+ }],
72473
73383
  "streamBroker.acquireEgressTranscode": [{
72474
73384
  name: "deviceId",
72475
73385
  form: "single",