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