@camstack/addon-provider-homematic 1.2.128 → 1.2.130

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 +2044 -62
  2. package/dist/addon.mjs +2044 -62
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8,7 +8,7 @@ let http = require("http");
8
8
  let crypto$1 = require("crypto");
9
9
  let fs_promises = require("fs/promises");
10
10
  let path = require("path");
11
- //#region ../types/dist/event-category-B_0XEcLF.mjs
11
+ //#region ../types/dist/event-category-DaIZi00R.mjs
12
12
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
13
13
  EventCategory["SystemBoot"] = "system.boot";
14
14
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -87,6 +87,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
87
87
  */
88
88
  EventCategory["AddonLoadFailed"] = "addon.load-failed";
89
89
  /**
90
+ * A keychain value was stored or removed (D787). Carries the ref, its
91
+ * owner and the new version — NEVER the value. A process holding the ref
92
+ * drops its cached copy and the owning `BaseAddon` re-resolves its config.
93
+ * Telemetry (D8): a process that misses it still revalidates by version.
94
+ */
95
+ EventCategory["KeychainChanged"] = "keychain.changed";
96
+ /**
90
97
  * Addon recovered from a previous failure. Emitted when an addon
91
98
  * transitions from `failed` back to `healthy` (typically via the
92
99
  * monitor's auto-retry loop, or after manual `addons.retryLoad`).
@@ -5379,7 +5386,7 @@ var ZodIssueCode = {
5379
5386
  var ZodFirstPartyTypeKind;
5380
5387
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5381
5388
  //#endregion
5382
- //#region ../types/dist/sleep-BNeXenvr.mjs
5389
+ //#region ../types/dist/sleep-Cr5YOk3m.mjs
5383
5390
  /**
5384
5391
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5385
5392
  * window to float samples (D455).
@@ -5458,6 +5465,97 @@ function buildAlawTable() {
5458
5465
  }
5459
5466
  buildUlawTable();
5460
5467
  buildAlawTable();
5468
+ /** Is this field's stored value a credential? */
5469
+ function isSecretConfigField(field) {
5470
+ if (field.type === "password") return true;
5471
+ return "secret" in field && field.secret === true;
5472
+ }
5473
+ /**
5474
+ * Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
5475
+ * by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
5476
+ */
5477
+ function isKeychainStoredField(field) {
5478
+ if (!isSecretConfigField(field)) return false;
5479
+ if (field.type === "textarea" && field.isJson === true) return false;
5480
+ return !("storage" in field && field.storage === "inline");
5481
+ }
5482
+ /**
5483
+ * What a settings blob holds where a secret used to be.
5484
+ *
5485
+ * A keychain-stored field never holds its value. It holds a self-describing
5486
+ * MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
5487
+ * code can mistake it for a credential and no form can send it to a camera as
5488
+ * a password. The empty state is `null` / absent, never `''`.
5489
+ *
5490
+ * The same shapes travel to and from the admin UI:
5491
+ *
5492
+ * - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
5493
+ * (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
5494
+ * value is set, never the value.
5495
+ * - write: an untouched field submits the view back unchanged (KEEP); a typed
5496
+ * value is a plain non-empty string (CHANGE); the Clear button submits
5497
+ * {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
5498
+ * are KEEP — an empty string is what a defaults-fallback pushes back, and
5499
+ * treating it as "clear" is how a save destroyed a stored credential before.
5500
+ *
5501
+ * Pure and browser-safe.
5502
+ */
5503
+ var SECRET_CLEAR = { $secretClear: true };
5504
+ /** The `'***'` token D634 redaction writes for non-admins. */
5505
+ var LEGACY_DEVICE_REDACTION = "***";
5506
+ function isRecord$1(value) {
5507
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5508
+ }
5509
+ function makeSecretMarker(ref) {
5510
+ return {
5511
+ $secret: ref,
5512
+ v: 1
5513
+ };
5514
+ }
5515
+ /** A stored marker: an object whose `$secret` is a non-empty string. */
5516
+ function isSecretMarker(value) {
5517
+ if (!isRecord$1(value)) return false;
5518
+ const ref = value["$secret"];
5519
+ return typeof ref === "string" && ref.length > 0;
5520
+ }
5521
+ function isSecretClear(value) {
5522
+ return isRecord$1(value) && value["$secretClear"] === true;
5523
+ }
5524
+ /**
5525
+ * The UI view of a stored secret field value: a marker becomes "set", inline
5526
+ * plaintext becomes "set (inline)", nothing becomes `null`. A value never
5527
+ * survives this function.
5528
+ */
5529
+ function toSecretFieldView(stored) {
5530
+ if (isSecretMarker(stored)) return {
5531
+ $secret: stored.$secret,
5532
+ v: 1,
5533
+ set: true
5534
+ };
5535
+ if (typeof stored === "string" && stored.length > 0) return {
5536
+ $secret: null,
5537
+ v: 1,
5538
+ set: true,
5539
+ inline: true
5540
+ };
5541
+ return null;
5542
+ }
5543
+ /**
5544
+ * Classify an incoming value for a secret path. Only a non-empty string that is
5545
+ * not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
5546
+ * Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
5547
+ * `undefined`, a redaction token, a non-string — keeps what is stored.
5548
+ */
5549
+ function classifySecretWrite(incoming) {
5550
+ if (isSecretClear(incoming)) return { kind: "clear" };
5551
+ if (typeof incoming !== "string") return { kind: "keep" };
5552
+ if (incoming.length === 0) return { kind: "keep" };
5553
+ if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
5554
+ return {
5555
+ kind: "set",
5556
+ value: incoming
5557
+ };
5558
+ }
5461
5559
  Object.fromEntries([
5462
5560
  {
5463
5561
  id: "overview",
@@ -5629,33 +5727,19 @@ Object.fromEntries([
5629
5727
  function isValuelessField(field) {
5630
5728
  return field.type === "separator" || field.type === "info" || field.type === "qr-code" || field.type === "button" || field.type === "object-array" || field.type === "widget" || field.type === "addon-action-button" || field.type === "device-action-button";
5631
5729
  }
5632
- /**
5633
- * Merge a `ConfigUISchema` with a raw `values` record into a
5634
- * `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
5635
- * before returning to the admin UI. Groups are walked recursively.
5636
- *
5637
- * For each leaf field:
5638
- * - structural fields (`separator`, `info`, `button`) pass through unchanged
5639
- * - other fields get `value = values[key] ?? field.default ?? null`
5640
- *
5641
- * Unknown keys in `values` (keys not declared in the schema) are silently
5642
- * ignored — they don't contribute to the output. Missing keys fall back to
5643
- * the schema default or `null`. This mirrors the old backend behaviour where
5644
- * `FormBuilder` rendered `values[key] ?? field.default`.
5645
- */
5646
- function hydrateSchema(schema, values) {
5730
+ function hydrateSchema(schema, values, options = {}) {
5647
5731
  return {
5648
5732
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
5649
5733
  sections: schema.sections.map((section) => ({
5650
5734
  ...section,
5651
- fields: section.fields.map((field) => hydrateField(field, values))
5735
+ fields: section.fields.map((field) => hydrateField(field, values, options))
5652
5736
  }))
5653
5737
  };
5654
5738
  }
5655
- function hydrateField(field, values) {
5739
+ function hydrateField(field, values, options) {
5656
5740
  if (isValuelessField(field)) return field;
5657
5741
  if (field.type === "group") {
5658
- const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
5742
+ const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
5659
5743
  return {
5660
5744
  ...field,
5661
5745
  fields: hydratedChildren
@@ -5664,7 +5748,7 @@ function hydrateField(field, values) {
5664
5748
  if (field.type === "sub-tabs") {
5665
5749
  const hydratedTabs = field.tabs.map((tab) => ({
5666
5750
  ...tab,
5667
- fields: tab.fields.map((child) => hydrateField(child, values))
5751
+ fields: tab.fields.map((child) => hydrateField(child, values, options))
5668
5752
  }));
5669
5753
  return {
5670
5754
  ...field,
@@ -5674,6 +5758,33 @@ function hydrateField(field, values) {
5674
5758
  const key = field.key;
5675
5759
  const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
5676
5760
  const defaultValue = field.default;
5761
+ const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
5762
+ if (isKeychainStoredField(field) && asView(storedValue)) return {
5763
+ ...field,
5764
+ value: toSecretFieldView(storedValue)
5765
+ };
5766
+ if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
5767
+ ...field,
5768
+ value: null
5769
+ };
5770
+ if (field.type === "editable-array" && Array.isArray(storedValue)) {
5771
+ const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
5772
+ if (secretItemKeys.length > 0) {
5773
+ const rows = storedValue.map((row) => {
5774
+ if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
5775
+ const out = { ...row };
5776
+ for (const k of secretItemKeys) {
5777
+ const v = Reflect.get(row, k);
5778
+ if (asView(v)) out[k] = toSecretFieldView(v);
5779
+ }
5780
+ return out;
5781
+ });
5782
+ return {
5783
+ ...field,
5784
+ value: rows
5785
+ };
5786
+ }
5787
+ }
5677
5788
  if (field.multiple) {
5678
5789
  const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
5679
5790
  const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
@@ -5916,6 +6027,431 @@ function projectStore(store, perNodeKeys, nodeId) {
5916
6027
  }
5917
6028
  return out;
5918
6029
  }
6030
+ var GLOBAL_SCOPE = { kind: "global" };
6031
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6032
+ function globalSecretScope() {
6033
+ return GLOBAL_SCOPE;
6034
+ }
6035
+ function encodeSegment(value) {
6036
+ return encodeURIComponent(value);
6037
+ }
6038
+ /**
6039
+ * The field path of a value inside an array item, addressed by the item's id:
6040
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6041
+ * `providers[authentik].clientSecret`.
6042
+ */
6043
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6044
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6045
+ }
6046
+ /** A write to a secret path could not be stored in the keychain, so it was refused. */
6047
+ var KeychainWriteRefusedError = class extends Error {
6048
+ fieldPath;
6049
+ constructor(fieldPath, cause) {
6050
+ super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
6051
+ this.fieldPath = fieldPath;
6052
+ this.name = "KeychainWriteRefusedError";
6053
+ }
6054
+ };
6055
+ var KEEP = { kind: "keep" };
6056
+ function isRecord$2(value) {
6057
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6058
+ }
6059
+ function defaultMintId() {
6060
+ return globalThis.crypto.randomUUID();
6061
+ }
6062
+ /** Every marker ref anywhere under `value`. */
6063
+ function collectSecretMarkerRefs(value, out = []) {
6064
+ if (isSecretMarker(value)) {
6065
+ out.push(value.$secret);
6066
+ return out;
6067
+ }
6068
+ if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6069
+ else if (isRecord$2(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6070
+ return out;
6071
+ }
6072
+ async function storedValueEquals(secrets, marker, candidate) {
6073
+ const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
6074
+ return resolved?.kind === "value" && resolved.value === candidate;
6075
+ }
6076
+ async function writeLeaf(ctx, incoming, stored, fieldPath) {
6077
+ const intent = classifySecretWrite(incoming);
6078
+ const ref = ctx.secrets.ref(ctx.scope, fieldPath);
6079
+ const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
6080
+ if (intent.kind === "keep") return KEEP;
6081
+ if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
6082
+ if (intent.kind === "clear") {
6083
+ if (storedIsOurs) ctx.deletes.push(ref);
6084
+ return {
6085
+ kind: "value",
6086
+ value: null
6087
+ };
6088
+ }
6089
+ if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
6090
+ kind: "value",
6091
+ value: stored
6092
+ };
6093
+ try {
6094
+ await ctx.secrets.put(ref, intent.value);
6095
+ } catch (err) {
6096
+ throw new KeychainWriteRefusedError(fieldPath, err);
6097
+ }
6098
+ return {
6099
+ kind: "value",
6100
+ value: makeSecretMarker(ref)
6101
+ };
6102
+ }
6103
+ /** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
6104
+ function applyMember(out, key, result, storedParent) {
6105
+ if (result.kind === "value") {
6106
+ out[key] = result.value;
6107
+ return;
6108
+ }
6109
+ if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
6110
+ else delete out[key];
6111
+ }
6112
+ async function writeMembers(ctx, children, incoming, stored, pathOf) {
6113
+ const out = { ...incoming };
6114
+ for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
6115
+ return out;
6116
+ }
6117
+ function rowId(row, idKey) {
6118
+ const raw = row[idKey];
6119
+ if (typeof raw === "string" && raw.length > 0) return raw;
6120
+ if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
6121
+ return null;
6122
+ }
6123
+ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6124
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$2) : [];
6125
+ if (!Array.isArray(incoming)) {
6126
+ ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6127
+ return {
6128
+ kind: "value",
6129
+ value: incoming
6130
+ };
6131
+ }
6132
+ const storedById = /* @__PURE__ */ new Map();
6133
+ for (const row of storedRows) {
6134
+ const id = rowId(row, node.idKey);
6135
+ if (id !== null) storedById.set(id, row);
6136
+ }
6137
+ const kept = /* @__PURE__ */ new Set();
6138
+ const rows = [];
6139
+ for (const row of incoming) {
6140
+ if (!isRecord$2(row)) {
6141
+ rows.push(row);
6142
+ continue;
6143
+ }
6144
+ const id = rowId(row, node.idKey) ?? ctx.mintId();
6145
+ kept.add(id);
6146
+ const withId = {
6147
+ ...row,
6148
+ [node.idKey]: row[node.idKey] ?? id
6149
+ };
6150
+ if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
6151
+ const storedRow = storedById.get(id) ?? {};
6152
+ rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
6153
+ }
6154
+ for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
6155
+ return {
6156
+ kind: "value",
6157
+ value: rows
6158
+ };
6159
+ }
6160
+ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6161
+ switch (node.kind) {
6162
+ case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6163
+ case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6164
+ case "object": {
6165
+ if (!isRecord$2(incoming)) {
6166
+ if (incoming === void 0) return KEEP;
6167
+ ctx.deletes.push(...collectSecretMarkerRefs(stored));
6168
+ return {
6169
+ kind: "value",
6170
+ value: incoming
6171
+ };
6172
+ }
6173
+ const storedObj = isRecord$2(stored) ? stored : {};
6174
+ return {
6175
+ kind: "value",
6176
+ value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
6177
+ };
6178
+ }
6179
+ }
6180
+ }
6181
+ /** Split a perNode-scoped key (`key@nodeId`). */
6182
+ function splitNodeKey(key) {
6183
+ const at = key.indexOf("@");
6184
+ return at <= 0 ? {
6185
+ base: key,
6186
+ nodeId: null
6187
+ } : {
6188
+ base: key.slice(0, at),
6189
+ nodeId: key.slice(at + 1)
6190
+ };
6191
+ }
6192
+ /** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
6193
+ async function transformSecretWrite(input) {
6194
+ const deletes = [];
6195
+ const base = {
6196
+ secrets: input.secrets,
6197
+ mintId: input.mintId ?? defaultMintId,
6198
+ deletes,
6199
+ operatorWrite: input.operatorWrite === true
6200
+ };
6201
+ const out = {};
6202
+ for (const [key, incoming] of Object.entries(input.patch)) {
6203
+ const { base: baseKey, nodeId } = splitNodeKey(key);
6204
+ const node = input.tree.get(baseKey);
6205
+ if (node === void 0) {
6206
+ out[key] = incoming;
6207
+ continue;
6208
+ }
6209
+ const scope = nodeId !== null && nodeId.length > 0 ? {
6210
+ kind: "node",
6211
+ nodeId
6212
+ } : input.scope ?? globalSecretScope();
6213
+ const result = await writeNode({
6214
+ ...base,
6215
+ scope
6216
+ }, node, incoming, input.stored[key], baseKey);
6217
+ if (result.kind === "value") out[key] = result.value;
6218
+ }
6219
+ return {
6220
+ patch: out,
6221
+ afterWrite: async () => {
6222
+ if (deletes.length === 0) return { orphaned: [] };
6223
+ try {
6224
+ await input.secrets.delete([...new Set(deletes)]);
6225
+ return { orphaned: [] };
6226
+ } catch {
6227
+ return { orphaned: [...new Set(deletes)] };
6228
+ }
6229
+ }
6230
+ };
6231
+ }
6232
+ /**
6233
+ * Replace every marker in `value` with its keychain value. Returns the SAME
6234
+ * reference when there is no marker (no allocation, no keychain call).
6235
+ */
6236
+ async function resolveSecretMarkers(value, secrets) {
6237
+ const refs = collectSecretMarkerRefs(value);
6238
+ if (refs.length === 0) return {
6239
+ value,
6240
+ unresolved: []
6241
+ };
6242
+ const answers = await secrets.resolve(refs);
6243
+ const unresolved = [];
6244
+ for (const ref of new Set(refs)) {
6245
+ const answer = answers[ref];
6246
+ if (answer === void 0) unresolved.push({
6247
+ ref,
6248
+ reason: "not-initialized"
6249
+ });
6250
+ else if (answer.kind === "unavailable") unresolved.push({
6251
+ ref,
6252
+ reason: answer.reason
6253
+ });
6254
+ else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
6255
+ ref,
6256
+ reason: answer.kind
6257
+ });
6258
+ }
6259
+ const substitute = (v) => {
6260
+ if (isSecretMarker(v)) {
6261
+ const answer = answers[v.$secret];
6262
+ return answer?.kind === "value" ? {
6263
+ keep: true,
6264
+ value: answer.value
6265
+ } : {
6266
+ keep: false,
6267
+ value: void 0
6268
+ };
6269
+ }
6270
+ if (Array.isArray(v)) {
6271
+ const items = [];
6272
+ for (const item of v) {
6273
+ const s = substitute(item);
6274
+ if (s.keep) items.push(s.value);
6275
+ }
6276
+ return {
6277
+ keep: true,
6278
+ value: items
6279
+ };
6280
+ }
6281
+ if (isRecord$2(v)) {
6282
+ const out = {};
6283
+ for (const [k, child] of Object.entries(v)) {
6284
+ const s = substitute(child);
6285
+ if (s.keep) out[k] = s.value;
6286
+ }
6287
+ return {
6288
+ keep: true,
6289
+ value: out
6290
+ };
6291
+ }
6292
+ return {
6293
+ keep: true,
6294
+ value: v
6295
+ };
6296
+ };
6297
+ return {
6298
+ value: substitute(value).value,
6299
+ unresolved
6300
+ };
6301
+ }
6302
+ function touchesTree(tree, patch) {
6303
+ if (tree.size === 0) return false;
6304
+ for (const key of Object.keys(patch)) {
6305
+ const at = key.indexOf("@");
6306
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6307
+ }
6308
+ return false;
6309
+ }
6310
+ /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6311
+ async function readStoredAddonBlob(raw) {
6312
+ const threeWay = raw.readAddonStoreResult;
6313
+ if (threeWay === void 0) return raw.readAddonStore();
6314
+ const result = await threeWay.call(raw);
6315
+ if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6316
+ return result.kind === "missing" ? {} : result.value;
6317
+ }
6318
+ function createSecretAwareSettings(raw, opts) {
6319
+ const chains = /* @__PURE__ */ new Map();
6320
+ const serialize = (key, fn) => {
6321
+ const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
6322
+ const tail = next.catch(() => void 0);
6323
+ chains.set(key, tail);
6324
+ tail.then(() => {
6325
+ if (chains.get(key) === tail) chains.delete(key);
6326
+ });
6327
+ return next;
6328
+ };
6329
+ const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6330
+ if (!touchesTree(tree, patch)) return rawWrite(patch);
6331
+ return serialize(chainKey, async () => {
6332
+ const stored = await readStored();
6333
+ const result = await transformSecretWrite({
6334
+ tree,
6335
+ secrets: opts.secrets,
6336
+ patch,
6337
+ stored,
6338
+ ...scope !== void 0 ? { scope } : {},
6339
+ operatorWrite: opts.isOperatorWrite?.() === true
6340
+ });
6341
+ if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6342
+ const { orphaned } = await result.afterWrite();
6343
+ if (orphaned.length > 0) opts.onOrphaned(orphaned);
6344
+ });
6345
+ };
6346
+ const wrapped = {
6347
+ writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6348
+ writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6349
+ kind: "device",
6350
+ deviceId
6351
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6352
+ };
6353
+ return new Proxy(raw, { get(target, prop, receiver) {
6354
+ if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6355
+ if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6356
+ const value = Reflect.get(target, prop, receiver);
6357
+ return typeof value === "function" ? value.bind(target) : value;
6358
+ } });
6359
+ }
6360
+ /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6361
+ function withSecretAwareSettings(context, opts) {
6362
+ const raw = context.settings;
6363
+ if (raw === void 0) return context;
6364
+ const settings = createSecretAwareSettings(raw, opts);
6365
+ return new Proxy(context, { get(target, prop, receiver) {
6366
+ if (prop === "settings") return settings;
6367
+ return Reflect.get(target, prop, receiver);
6368
+ } });
6369
+ }
6370
+ var LEAF = { kind: "leaf" };
6371
+ var DEFAULT_ITEM_ID_KEY = "id";
6372
+ function collectFields(fields, out) {
6373
+ for (const field of fields) {
6374
+ if (field.type === "group") {
6375
+ collectFields(field.fields, out);
6376
+ continue;
6377
+ }
6378
+ if (field.type === "sub-tabs") {
6379
+ for (const tab of field.tabs) collectFields(tab.fields, out);
6380
+ continue;
6381
+ }
6382
+ if (field.type === "editable-array") {
6383
+ const item = /* @__PURE__ */ new Map();
6384
+ for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
6385
+ if (item.size > 0) out.set(field.key, {
6386
+ kind: "array",
6387
+ idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
6388
+ item
6389
+ });
6390
+ continue;
6391
+ }
6392
+ if (!("key" in field) || typeof field.key !== "string") continue;
6393
+ if (isKeychainStoredField(field)) out.set(field.key, LEAF);
6394
+ }
6395
+ }
6396
+ /** The secret tree a settings schema declares. */
6397
+ function secretTreeFromSchema(schema) {
6398
+ const out = /* @__PURE__ */ new Map();
6399
+ if (schema === null) return out;
6400
+ for (const section of schema.sections) collectFields(section.fields, out);
6401
+ return out;
6402
+ }
6403
+ /** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
6404
+ function parseSecretStatePath(path) {
6405
+ const segments = [];
6406
+ for (const raw of path.split(".")) {
6407
+ const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
6408
+ if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
6409
+ segments.push(m[2] !== void 0 ? {
6410
+ key: m[1],
6411
+ idKey: m[2]
6412
+ } : { key: m[1] });
6413
+ }
6414
+ if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
6415
+ if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
6416
+ return segments;
6417
+ }
6418
+ function insert(into, segments) {
6419
+ const [head, ...rest] = segments;
6420
+ if (head === void 0) return;
6421
+ if (rest.length === 0) {
6422
+ into.set(head.key, LEAF);
6423
+ return;
6424
+ }
6425
+ const existing = into.get(head.key);
6426
+ if (head.idKey !== void 0) {
6427
+ const item = new Map(existing?.kind === "array" ? existing.item : []);
6428
+ insert(item, rest);
6429
+ into.set(head.key, {
6430
+ kind: "array",
6431
+ idKey: head.idKey,
6432
+ item
6433
+ });
6434
+ return;
6435
+ }
6436
+ const children = new Map(existing?.kind === "object" ? existing.children : []);
6437
+ insert(children, rest);
6438
+ into.set(head.key, {
6439
+ kind: "object",
6440
+ children
6441
+ });
6442
+ }
6443
+ /** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
6444
+ function mergeSecretStatePaths(tree, paths) {
6445
+ if (paths.length === 0) return tree;
6446
+ const out = new Map(tree);
6447
+ for (const path of paths) insert(out, parseSecretStatePath(path));
6448
+ return out;
6449
+ }
6450
+ /** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
6451
+ var SECRET_RETRY_FIRST_MS = 5e3;
6452
+ var SECRET_RETRY_MAX_MS = 5 * 6e4;
6453
+ /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
6454
+ var SECRET_CHANGE_DEBOUNCE_MS = 250;
5919
6455
  /**
5920
6456
  * Base class for CamStack addons. Eliminates settings boilerplate:
5921
6457
  *
@@ -5985,6 +6521,25 @@ var BaseAddon = class {
5985
6521
  settingsStoreReady = false;
5986
6522
  /** Default config values. Provided via constructor. */
5987
6523
  defaults;
6524
+ /**
6525
+ * Hidden-state paths that hold secrets (D787) — values the addon writes
6526
+ * itself (`updateGlobalSettings`, `state()`) that no form field declares.
6527
+ * Stored in the keychain exactly like a `password` field. Syntax:
6528
+ * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
6529
+ * (`key[<id field>]` addresses array items by id, never by index).
6530
+ */
6531
+ secretStatePaths = [];
6532
+ _addonSecretTree = null;
6533
+ _deviceSecretTree = null;
6534
+ /** Refs the last resolved config pointed at — a change to one re-resolves. */
6535
+ _configSecretRefs = /* @__PURE__ */ new Set();
6536
+ _unresolvedSecrets = [];
6537
+ _secretRetryTimer = null;
6538
+ _secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
6539
+ _secretChangeTimer = null;
6540
+ _secretChangeUnsub = null;
6541
+ /** >0 while an OPERATOR's settings write is being applied. */
6542
+ _operatorWriteDepth = 0;
5988
6543
  constructor(defaults) {
5989
6544
  this.defaults = defaults;
5990
6545
  this._config = { ...defaults };
@@ -6020,8 +6575,18 @@ var BaseAddon = class {
6020
6575
  return this._config;
6021
6576
  }
6022
6577
  async initialize(context) {
6023
- this._ctx = context;
6578
+ const secrets = context.secrets;
6579
+ this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6580
+ secrets,
6581
+ addonTree: () => this.addonSecretTree(),
6582
+ deviceTree: () => this.deviceSecretTree(),
6583
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6584
+ isOperatorWrite: () => this._operatorWriteDepth > 0
6585
+ }) : context;
6024
6586
  await this.resolveConfig();
6587
+ if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6588
+ if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
6589
+ });
6025
6590
  const result = await this.onInitialize();
6026
6591
  this.emitLifecycle(EventCategory.AddonStarted);
6027
6592
  const normalized = normalizeAddonInitResult(result);
@@ -6054,6 +6619,12 @@ var BaseAddon = class {
6054
6619
  */
6055
6620
  async onHubReachable() {}
6056
6621
  async shutdown() {
6622
+ this._secretChangeUnsub?.();
6623
+ this._secretChangeUnsub = null;
6624
+ if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
6625
+ if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
6626
+ this._secretRetryTimer = null;
6627
+ this._secretChangeTimer = null;
6057
6628
  this.emitLifecycle(EventCategory.AddonStopped);
6058
6629
  if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
6059
6630
  await this.onShutdown();
@@ -6132,7 +6703,7 @@ var BaseAddon = class {
6132
6703
  return hydrateSchema(schema, overlay ? {
6133
6704
  ...projected,
6134
6705
  ...overlay
6135
- } : projected);
6706
+ } : projected, { inlineSecretsAsViews: true });
6136
6707
  }
6137
6708
  /**
6138
6709
  * The integration-level view of this addon's settings: exactly the sections
@@ -6181,7 +6752,7 @@ var BaseAddon = class {
6181
6752
  return hydrateSchema({
6182
6753
  ...schema,
6183
6754
  sections
6184
- }, projected);
6755
+ }, projected, { inlineSecretsAsViews: true });
6185
6756
  }
6186
6757
  /**
6187
6758
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -6235,18 +6806,50 @@ var BaseAddon = class {
6235
6806
  value: result.value[key]
6236
6807
  };
6237
6808
  }
6809
+ /**
6810
+ * The OPERATOR's write — a settings form or an admin API call, dispatched by
6811
+ * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
6812
+ * the operator sends is stored as sent even when it equals a pre-keychain
6813
+ * inline value: the operator re-entering a password is a change, an addon
6814
+ * writing back what it read is not (D787).
6815
+ */
6816
+ async updateGlobalSettingsAsOperator(patch, nodeId) {
6817
+ this._operatorWriteDepth++;
6818
+ try {
6819
+ await this.applyGlobalPatch(patch, nodeId);
6820
+ } finally {
6821
+ this._operatorWriteDepth--;
6822
+ }
6823
+ }
6238
6824
  async updateGlobalSettings(patch, nodeId) {
6825
+ await this.applyGlobalPatch(patch, nodeId);
6826
+ }
6827
+ /**
6828
+ * REMOVE stored secrets — their keychain values and their markers (D787).
6829
+ *
6830
+ * Writing `''` to a secret field KEEPS what is stored (an empty string is
6831
+ * what a defaults fallback writes back, and it must never destroy a
6832
+ * credential), so code that means "forget this token" says so here. Without
6833
+ * a keychain (an older kernel) it writes `''`, as such code always did.
6834
+ */
6835
+ async clearSecrets(keys, nodeId) {
6836
+ const tree = this.addonSecretTree();
6837
+ const keychain = this._ctx?.secrets !== void 0;
6838
+ const patch = {};
6839
+ for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
6840
+ await this.applyGlobalPatch(patch, nodeId);
6841
+ }
6842
+ async applyGlobalPatch(barePatch, nodeId) {
6239
6843
  const keys = this.perNodeKeys();
6240
6844
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6241
6845
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6242
- const barePatch = patch;
6243
6846
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6244
6847
  await this._ctx?.settings?.writeAddonStore(scoped);
6245
6848
  if (target !== localNode) return;
6246
6849
  await this.resolveConfig();
6247
6850
  await this.onConfigChanged();
6248
6851
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
6249
- this.maybeAutoRestart(patch, this.globalSettingsSchema());
6852
+ this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
6250
6853
  }
6251
6854
  /**
6252
6855
  * The set of field keys the global settings schema declares `perNode: true`
@@ -6271,7 +6874,7 @@ var BaseAddon = class {
6271
6874
  * time to return its response before the addon is torn down and
6272
6875
  * re-initialised by `AddonRegistryService.restartAddon`.
6273
6876
  */
6274
- maybeAutoRestart(patch, schema) {
6877
+ maybeAutoRestart(patchKeys, schema) {
6275
6878
  if (!schema) return;
6276
6879
  const restartKeys = /* @__PURE__ */ new Set();
6277
6880
  for (const section of schema.sections) for (const field of section.fields) {
@@ -6279,13 +6882,13 @@ var BaseAddon = class {
6279
6882
  if (field.requiresRestart) restartKeys.add(field.key);
6280
6883
  }
6281
6884
  if (restartKeys.size === 0) return;
6282
- if (!Object.keys(patch).some((k) => restartKeys.has(k))) return;
6885
+ if (!patchKeys.some((k) => restartKeys.has(k))) return;
6283
6886
  const ctx = this._ctx;
6284
6887
  if (!ctx) return;
6285
6888
  const addonId = ctx.id;
6286
6889
  setImmediate(() => {
6287
6890
  ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
6288
- ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: Object.keys(patch).filter((k) => restartKeys.has(k)) } });
6891
+ ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
6289
6892
  }).catch((err) => {
6290
6893
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
6291
6894
  });
@@ -6294,7 +6897,7 @@ var BaseAddon = class {
6294
6897
  async getDeviceSettings(deviceId) {
6295
6898
  const schema = this.deviceSettingsSchema();
6296
6899
  if (!schema) return { sections: [] };
6297
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
6900
+ return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6298
6901
  }
6299
6902
  async updateDeviceSettings(deviceId, patch) {
6300
6903
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -6424,7 +7027,7 @@ var BaseAddon = class {
6424
7027
  * selection at boot (absent scoped key ⇒ the constructor default wins).
6425
7028
  */
6426
7029
  async resolveConfig() {
6427
- const stored = await this.readAddonStoreWithRetry();
7030
+ const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
6428
7031
  const perNode = this.perNodeKeys();
6429
7032
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6430
7033
  const resolved = { ...this.defaults };
@@ -6449,7 +7052,7 @@ var BaseAddon = class {
6449
7052
  key,
6450
7053
  schema,
6451
7054
  fallback,
6452
- read: () => this.readAddonStoreWithRetry(),
7055
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
6453
7056
  write: async (patch) => {
6454
7057
  await this._ctx?.settings?.writeAddonStore(patch);
6455
7058
  },
@@ -6466,7 +7069,7 @@ var BaseAddon = class {
6466
7069
  key,
6467
7070
  schema,
6468
7071
  fallback,
6469
- read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
7072
+ read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
6470
7073
  write: async (patch) => {
6471
7074
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
6472
7075
  },
@@ -6478,6 +7081,70 @@ var BaseAddon = class {
6478
7081
  } })
6479
7082
  });
6480
7083
  }
7084
+ /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
7085
+ addonSecretTree() {
7086
+ this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
7087
+ return this._addonSecretTree;
7088
+ }
7089
+ deviceSecretTree() {
7090
+ this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7091
+ return this._deviceSecretTree;
7092
+ }
7093
+ /**
7094
+ * Secrets of this addon's stored config that could not be resolved on the
7095
+ * last read, with why. Non-empty means the addon is running WITHOUT them —
7096
+ * an addon whose function needs one should report itself degraded rather
7097
+ * than start on an empty credential.
7098
+ */
7099
+ get unresolvedSecrets() {
7100
+ return this._unresolvedSecrets;
7101
+ }
7102
+ /**
7103
+ * Substitute every keychain marker in a stored blob with its value. With no
7104
+ * keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
7105
+ * An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
7106
+ * value — and, when the cause can pass, retried with backoff. Nothing is
7107
+ * ever written back from here.
7108
+ */
7109
+ async resolveStoredSecrets(blob, trackForConfig = true) {
7110
+ const secrets = this._ctx?.secrets;
7111
+ if (secrets === void 0) return blob;
7112
+ const refs = collectSecretMarkerRefs(blob);
7113
+ if (trackForConfig) this._configSecretRefs = new Set(refs);
7114
+ if (refs.length === 0) {
7115
+ if (trackForConfig) this._unresolvedSecrets = [];
7116
+ return blob;
7117
+ }
7118
+ const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
7119
+ if (trackForConfig) {
7120
+ this._unresolvedSecrets = unresolved;
7121
+ if (unresolved.length > 0) {
7122
+ this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
7123
+ ref: u.ref,
7124
+ reason: u.reason
7125
+ })) } });
7126
+ if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
7127
+ this.scheduleSecretReresolve(this._secretRetryDelayMs);
7128
+ this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
7129
+ }
7130
+ } else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
7131
+ }
7132
+ return value;
7133
+ }
7134
+ /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7135
+ scheduleSecretReresolve(delayMs) {
7136
+ const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
7137
+ if (this[timerOf] !== null) return;
7138
+ const timer = setTimeout(() => {
7139
+ this[timerOf] = null;
7140
+ if (this._ctx === null) return;
7141
+ this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
7142
+ this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
7143
+ });
7144
+ }, delayMs);
7145
+ timer.unref?.();
7146
+ this[timerOf] = timer;
7147
+ }
6481
7148
  /**
6482
7149
  * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
6483
7150
  * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
@@ -7053,6 +7720,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
7053
7720
  kind: "mutation",
7054
7721
  auth: "admin"
7055
7722
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
7723
+ function defOf(schema) {
7724
+ return schema._zod?.def ?? {};
7725
+ }
7726
+ function declaredHere(schema) {
7727
+ return globalRegistry.get(schema)?.secret === true;
7728
+ }
7729
+ /** Wrapper kinds whose `innerType` is the field itself. */
7730
+ var WRAPPERS = new Set([
7731
+ "optional",
7732
+ "nullable",
7733
+ "default",
7734
+ "prefault",
7735
+ "catch",
7736
+ "readonly",
7737
+ "nonoptional"
7738
+ ]);
7739
+ /**
7740
+ * The schema layers that make up ONE field: the schema itself and every
7741
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
7742
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
7743
+ * `.transform` on `in`).
7744
+ */
7745
+ function layersOf(schema) {
7746
+ const out = [];
7747
+ const queue = [schema];
7748
+ while (queue.length > 0) {
7749
+ const s = queue.shift();
7750
+ if (!s || out.includes(s)) continue;
7751
+ out.push(s);
7752
+ const def = defOf(s);
7753
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
7754
+ if (def.type === "pipe") {
7755
+ if (def.in) queue.push(def.in);
7756
+ if (def.out) queue.push(def.out);
7757
+ }
7758
+ }
7759
+ return out;
7760
+ }
7761
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
7762
+ function isZodSecret(schema) {
7763
+ return layersOf(schema).some(declaredHere);
7764
+ }
7765
+ /**
7766
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
7767
+ * element of this array" (`connection.password`, `rows[].token`). A declared
7768
+ * object or array is reported as one path and not descended into — everything
7769
+ * under it is secret.
7770
+ */
7771
+ function collectZodSecretPaths(schema, prefix = "") {
7772
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
7773
+ const paths = [];
7774
+ for (const layer of layersOf(schema)) {
7775
+ const def = defOf(layer);
7776
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
7777
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
7778
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
7779
+ else if (def.type === "intersection") {
7780
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
7781
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
7782
+ }
7783
+ }
7784
+ return [...new Set(paths)];
7785
+ }
7056
7786
  //#endregion
7057
7787
  //#region ../types/dist/err-msg-DX6i_MY4.mjs
7058
7788
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
@@ -14132,6 +14862,196 @@ id: union([string(), number()]) }), {
14132
14862
  kind: "mutation",
14133
14863
  auth: "admin"
14134
14864
  });
14865
+ /**
14866
+ * `keychain` — the hub's encrypted store of secret values (D787).
14867
+ *
14868
+ * Settings blobs never hold a secret: they hold a marker
14869
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
14870
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
14871
+ * is the OWNER's door to its own values: every method is owner-checked
14872
+ * against the CALLER, never against anything the caller claims.
14873
+ *
14874
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
14875
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
14876
+ * connection, the agent from its child's connection carried in
14877
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
14878
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
14879
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
14880
+ * identity against BUGS and misrouting, not against a malicious addon (every
14881
+ * runner is the same OS user): see the threat model in
14882
+ * `docs/design/2026-10-08-secrets-keychain.md`.
14883
+ *
14884
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
14885
+ * parses the input, so a session can never supply it, and the internal mount
14886
+ * floors every method to admin anyway (D240).
14887
+ *
14888
+ * Internal: addons reach it through `ctx.secrets`, never directly.
14889
+ */
14890
+ /** Why a value cannot be served right now. Never folded into "missing". */
14891
+ var KeychainUnavailableReasonSchema = _enum([
14892
+ "key-missing",
14893
+ "wrong-key",
14894
+ "key-file-unreadable",
14895
+ "store-unavailable",
14896
+ "not-initialized",
14897
+ "decrypt-failed"
14898
+ ]);
14899
+ var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
14900
+ state: literal("locked"),
14901
+ reason: KeychainUnavailableReasonSchema
14902
+ })]);
14903
+ var KeychainResolveEntrySchema = discriminatedUnion("kind", [
14904
+ object({
14905
+ kind: literal("value"),
14906
+ value: string(),
14907
+ version: number().int()
14908
+ }),
14909
+ object({ kind: literal("missing") }),
14910
+ object({
14911
+ kind: literal("unavailable"),
14912
+ reason: KeychainUnavailableReasonSchema
14913
+ }),
14914
+ object({ kind: literal("forbidden") })
14915
+ ]);
14916
+ var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
14917
+ /** Metadata of one stored value — never the value. */
14918
+ var KeychainSecretMetaSchema = object({
14919
+ ref: string(),
14920
+ owner: string(),
14921
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
14922
+ scope: string(),
14923
+ fieldPath: string(),
14924
+ version: number().int(),
14925
+ createdAt: number(),
14926
+ updatedAt: number(),
14927
+ /** `addon:<id>` | `user:<id>` | `system`. */
14928
+ updatedBy: string(),
14929
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
14930
+ lastReadAt: number().nullable()
14931
+ });
14932
+ var RefListSchema = array(string().min(1)).max(512);
14933
+ method(object({
14934
+ ref: string().min(1),
14935
+ value: string().min(1)
14936
+ }), object({
14937
+ ref: string(),
14938
+ version: number().int()
14939
+ }), {
14940
+ kind: "mutation",
14941
+ auth: "admin"
14942
+ }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
14943
+ kind: "mutation",
14944
+ auth: "admin"
14945
+ }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
14946
+ var KeychainKeySourceSchema = object({
14947
+ kind: _enum([
14948
+ "config-file",
14949
+ "previous-config-file",
14950
+ "platform",
14951
+ "default-file"
14952
+ ]),
14953
+ /** File sources only — a path is not a secret. */
14954
+ path: string().optional(),
14955
+ /**
14956
+ * True when a whole-volume backup of the data directory carries this key
14957
+ * next to the database it protects (the default file). The page warns.
14958
+ */
14959
+ sharesBackupWithDatabase: boolean()
14960
+ });
14961
+ var KeychainStatusSchema = object({
14962
+ keychain: KeychainStateSchema,
14963
+ /** The source of the master key in use; `null` while locked. */
14964
+ keySource: KeychainKeySourceSchema.nullable(),
14965
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
14966
+ configuredSource: KeychainKeySourceSchema,
14967
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
14968
+ fingerprint: string().nullable(),
14969
+ activeKeyId: string().nullable(),
14970
+ /**
14971
+ * The keychain unlocked with a NON-primary source: the configured primary
14972
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
14973
+ */
14974
+ rotationPending: boolean(),
14975
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
14976
+ retiredWraps: number().int(),
14977
+ recoveryKeyDownloadedAt: number().nullable(),
14978
+ secretCount: number().int()
14979
+ });
14980
+ /**
14981
+ * Whether a stored value is still pointed at by its owner's settings.
14982
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
14983
+ * never reported as an orphan (and never deleted as one).
14984
+ */
14985
+ var KeychainSecretUsageSchema = _enum([
14986
+ "in-use",
14987
+ "orphan",
14988
+ "unknown"
14989
+ ]);
14990
+ var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
14991
+ var KeychainAuditActionSchema = _enum([
14992
+ "put",
14993
+ "delete",
14994
+ "reveal",
14995
+ "rotate-master-key",
14996
+ "purge-retired-keys",
14997
+ "download-recovery-key",
14998
+ "delete-orphans",
14999
+ "reset",
15000
+ "initialize"
15001
+ ]);
15002
+ var KeychainAuditEntrySchema = object({
15003
+ id: string(),
15004
+ at: number(),
15005
+ action: KeychainAuditActionSchema,
15006
+ /** `addon:<id>` | `user:<id>` | `system`. */
15007
+ actor: string(),
15008
+ ref: string().nullable(),
15009
+ detail: string().nullable()
15010
+ });
15011
+ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}), array(KeychainAdminSecretSchema).readonly(), { auth: "admin" }), method(object({ limit: number().int().min(1).max(500).optional() }), array(KeychainAuditEntrySchema).readonly(), { auth: "admin" }), method(object({ ref: string().min(1) }), object({
15012
+ value: string(),
15013
+ version: number().int()
15014
+ }), {
15015
+ kind: "mutation",
15016
+ auth: "admin",
15017
+ caller: "required"
15018
+ }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
15019
+ deleted: array(string()).readonly(),
15020
+ kept: array(object({
15021
+ ref: string(),
15022
+ usage: KeychainSecretUsageSchema
15023
+ })).readonly()
15024
+ }), {
15025
+ kind: "mutation",
15026
+ auth: "admin",
15027
+ caller: "required"
15028
+ }), method(object({}), object({
15029
+ fingerprint: string(),
15030
+ keySource: KeychainKeySourceSchema
15031
+ }), {
15032
+ kind: "mutation",
15033
+ auth: "admin",
15034
+ caller: "required"
15035
+ }), method(object({}), object({ purged: number().int() }), {
15036
+ kind: "mutation",
15037
+ auth: "admin",
15038
+ caller: "required"
15039
+ }), method(object({}), object({
15040
+ key: string(),
15041
+ fingerprint: string(),
15042
+ keySource: KeychainKeySourceSchema
15043
+ }), {
15044
+ kind: "mutation",
15045
+ auth: "admin",
15046
+ caller: "required"
15047
+ }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15048
+ archivedCollection: string().nullable(),
15049
+ archived: number().int()
15050
+ }), {
15051
+ kind: "mutation",
15052
+ auth: "admin",
15053
+ caller: "required"
15054
+ });
14135
15055
  method(_void(), object({
14136
15056
  id: string(),
14137
15057
  name: string(),
@@ -15267,6 +16187,10 @@ var DeviceInfoSchema = object({
15267
16187
  isCamera: boolean(),
15268
16188
  /** Current config values — serializable snapshot */
15269
16189
  config: record(string(), unknown()),
16190
+ /** Paths inside `config` the device's schema declares secret (D783) —
16191
+ * what the non-admin redaction withholds. Paths, never values. Absent
16192
+ * when the owning runner has not reported them. */
16193
+ secretConfigPaths: array(string()).optional(),
15270
16194
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
15271
16195
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
15272
16196
  metadata: record(string(), unknown()).nullable().optional(),
@@ -15472,12 +16396,22 @@ var DeviceRegisterPayloadSchema = object({
15472
16396
  * call (workers re-register on init), so probe-driven updates
15473
16397
  * (e.g. PTZ flag flipping after the abilities probe) propagate. */
15474
16398
  features: array(string()).optional(),
15475
- config: record(string(), unknown())
16399
+ config: record(string(), unknown()),
16400
+ /** Config paths the device's own schema DECLARES secret
16401
+ * (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
16402
+ * `connection.password`). Re-published on every register; the non-admin
16403
+ * redaction withholds them at any depth (D783). Optional: an older runner
16404
+ * omits it and the keyword backstop applies. */
16405
+ secretConfigPaths: array(string()).optional()
15476
16406
  });
15477
16407
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
15478
16408
  var DevicePersistConfigPayloadSchema = object({
15479
16409
  deviceId: number(),
15480
- data: record(string(), unknown())
16410
+ data: record(string(), unknown()),
16411
+ /** The paths the device's schema declares secret (D783), when the caller
16412
+ * knows them — those values are kept in the keychain, not the blob (D787).
16413
+ * Absent: the paths the device last reported at `registerDevice` apply. */
16414
+ secretConfigPaths: array(string()).optional()
15481
16415
  });
15482
16416
  /** What a migration actually did, per switch. `unreachable` is a first-class
15483
16417
  * answer: a camera that could not be asked is not a camera that was silenced. */
@@ -17131,7 +18065,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17131
18065
  icon: string().optional(),
17132
18066
  /** Addon-owned HTTP route the button navigates to (GET). */
17133
18067
  startUrl: string(),
17134
- stage: LoginStageEnum
18068
+ stage: LoginStageEnum,
18069
+ /**
18070
+ * The provider names an external identity a signed-in user can link to
18071
+ * their own account (D782): `auth.listLinkableProviders` /
18072
+ * `beginExternalLink` offer exactly the redirect methods that set this,
18073
+ * whatever their id. Absent / false — a login button only (magic-link).
18074
+ */
18075
+ linkable: boolean().optional()
17135
18076
  }),
17136
18077
  object({
17137
18078
  kind: literal("widget"),
@@ -22487,8 +23428,23 @@ var RetrainMacroClassSchema = _enum([
22487
23428
  ]);
22488
23429
  /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
22489
23430
  var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
22490
- /** Did a human draw this box, or did the assist propose it? */
22491
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
23431
+ /**
23432
+ * Where a box came from. A machine-sourced box is a DRAFT on the page until
23433
+ * the operator confirms it; once saved it keeps its source as provenance.
23434
+ *
23435
+ * - `operator` — drawn by hand.
23436
+ * - `assist` — proposed by a detector run on the copy (the camera's own
23437
+ * model, or a larger teacher model).
23438
+ * - `pipeline` — the box the live pipeline actually drew on that frame, read
23439
+ * back from the track store (never a re-run).
23440
+ * - `llm` — proposed by a vision-capable LLM profile.
23441
+ */
23442
+ var RetrainAnnotationSourceSchema = _enum([
23443
+ "operator",
23444
+ "assist",
23445
+ "pipeline",
23446
+ "llm"
23447
+ ]);
22492
23448
  /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
22493
23449
  var RetrainBboxSchema = object({
22494
23450
  x: number(),
@@ -22506,7 +23462,8 @@ var RetrainBboxSchema = object({
22506
23462
  */
22507
23463
  var RetrainAnnotationSchema = object({
22508
23464
  id: string(),
22509
- trackId: string(),
23465
+ /** The frame's track. Absent on a recording still, which has none. */
23466
+ trackId: string().optional(),
22510
23467
  deviceId: number(),
22511
23468
  /** The COPY in retrain storage — never the source track's media key. */
22512
23469
  mediaKey: string(),
@@ -22555,18 +23512,63 @@ var RetrainFrameCandidateSchema = object({
22555
23512
  * fail, whatever became of the original. */
22556
23513
  copied: boolean()
22557
23514
  });
23515
+ /**
23516
+ * One box the live pipeline drew on a copied frame — what a correction starts
23517
+ * from. Derived when the frame is listed, from the track store: the subject
23518
+ * box recorded on the source media row when there is one, else the track
23519
+ * position nearest the frame's capture time. Never stored as an annotation
23520
+ * until the operator confirms it.
23521
+ */
23522
+ var RetrainPipelineBoxSchema = object({
23523
+ /** Normalised `[0,1]` against the full frame. */
23524
+ bbox: RetrainBboxSchema,
23525
+ macroClass: RetrainMacroClassSchema,
23526
+ label: string().optional(),
23527
+ subLabel: string().optional(),
23528
+ /** The detection score of the position used, when it was recorded. */
23529
+ score: number().optional(),
23530
+ /** The root model that produced the track, when it was recorded. */
23531
+ modelId: string().optional(),
23532
+ trackId: string(),
23533
+ /** `subject-box`: recorded on this very frame. `position`: the track's
23534
+ * position nearest the capture time, `deltaMs` away. */
23535
+ basis: _enum(["subject-box", "position"]),
23536
+ deltaMs: number()
23537
+ });
23538
+ /**
23539
+ * Where a retrain frame came from: a TRACK's stored media (copy-on-select),
23540
+ * or the RECORDING at an instant — the frame a model saw nothing in has no
23541
+ * track at all.
23542
+ */
23543
+ var RetrainFrameOriginSchema = _enum(["track", "recording"]);
22558
23544
  /** A frame the dataset OWNS: bytes copied at selection time. */
22559
23545
  var RetrainFrameSchema = object({
22560
23546
  frameId: string(),
22561
23547
  deviceId: number(),
22562
- trackId: string(),
22563
- /** Provenance only. It may already point at nothing — that is expected. */
22564
- sourceMediaId: number().int(),
23548
+ origin: RetrainFrameOriginSchema,
23549
+ /** The track it was copied from. Absent on a recording still. */
23550
+ trackId: string().optional(),
23551
+ /** Provenance only. It may already point at nothing — that is expected.
23552
+ * Absent on a recording still. */
23553
+ sourceMediaId: number().int().optional(),
23554
+ /** A recording still: the playhead instant it was taken at. */
23555
+ epochMs: number().optional(),
22565
23556
  sourceKind: MediaFileKindEnum,
22566
23557
  sizeBytes: number().int(),
22567
23558
  width: number().int(),
22568
23559
  height: number().int(),
22569
- copiedAt: number()
23560
+ copiedAt: number(),
23561
+ /** When the CAMERA captured the frame. Absent on a copy taken before D785. */
23562
+ capturedAt: number().optional(),
23563
+ /** The operator's "every subject in this frame is boxed". Detector
23564
+ * evaluation keeps only complete frames: an unboxed subject would count as
23565
+ * a false positive. */
23566
+ complete: boolean(),
23567
+ /** The boxes the pipeline drew on this frame. Present on list answers;
23568
+ * empty when nothing the track store holds can be placed on it. */
23569
+ pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
23570
+ /** The named collections this frame belongs to. Present on list answers. */
23571
+ collectionIds: array(string()).readonly().optional()
22570
23572
  });
22571
23573
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
22572
23574
  var RetrainCopyRefusalSchema = _enum([
@@ -22587,6 +23589,53 @@ var RetrainFrameListSchema = object({
22587
23589
  /** What the page pre-selects — the native key frame when one survives. */
22588
23590
  autoPickMediaId: number().int().optional()
22589
23591
  });
23592
+ /**
23593
+ * Which frames an annotated export carries. Every field narrows; an empty
23594
+ * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23595
+ * list owned by whoever trains (the training orchestrator), so `frameIds` is
23596
+ * the primitive a version export uses; `batchId` re-selects what an earlier
23597
+ * export carried (`exportedInBatch`).
23598
+ */
23599
+ var RetrainExportFilterSchema = object({
23600
+ deviceIds: array(number()).optional(),
23601
+ frameIds: array(string()).max(2e4).optional(),
23602
+ /** Only frames in at least one of these named collections. */
23603
+ collectionIds: array(string()).max(200).optional(),
23604
+ batchId: string().optional(),
23605
+ /** Only frames the operator marked complete (all subjects boxed). */
23606
+ completeOnly: boolean().optional()
23607
+ });
23608
+ /**
23609
+ * `frames`: the full frame copies, boxes in `annotations.json`.
23610
+ * `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
23611
+ * convention — the classifier layout.
23612
+ */
23613
+ var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
23614
+ /**
23615
+ * Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
23616
+ * the archive, sent chunk by chunk. Covers a presigned PUT and a provider
23617
+ * addon's data-plane upload route alike. Headers are sent verbatim and never
23618
+ * logged.
23619
+ */
23620
+ var RetrainArchiveTargetSchema = object({
23621
+ kind: literal("http"),
23622
+ method: _enum(["PUT", "POST"]),
23623
+ url: string().url(),
23624
+ headers: record(string(), string()).optional()
23625
+ });
23626
+ var RetrainArchiveResultSchema = object({
23627
+ batchId: string(),
23628
+ frames: number().int(),
23629
+ crops: number().int(),
23630
+ annotations: number().int(),
23631
+ /** Frames planned but not shipped (unreadable copy, path too long). */
23632
+ missing: number().int(),
23633
+ bytes: number().int(),
23634
+ /** sha256 of the exact bytes sent. */
23635
+ sha256: string(),
23636
+ /** The target's HTTP status. */
23637
+ status: number().int()
23638
+ });
22590
23639
  /** What the operator asked the assist to look for. */
22591
23640
  var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
22592
23641
  kind: literal("package"),
@@ -22616,6 +23665,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
22616
23665
  reason: string(),
22617
23666
  detail: string().optional()
22618
23667
  })]);
23668
+ /** A named set over the retrain corpus — membership only, it owns no pixels. */
23669
+ var RetrainCollectionSchema = object({
23670
+ id: string(),
23671
+ name: string(),
23672
+ createdAt: number(),
23673
+ frameCount: number().int()
23674
+ });
23675
+ var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
23676
+ kind: literal("created"),
23677
+ collection: RetrainCollectionSchema
23678
+ }), object({
23679
+ kind: literal("refused"),
23680
+ reason: _enum(["empty-name", "duplicate-name"])
23681
+ })]);
23682
+ var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
23683
+ kind: literal("renamed"),
23684
+ collection: RetrainCollectionSchema
23685
+ }), object({
23686
+ kind: literal("refused"),
23687
+ reason: _enum([
23688
+ "empty-name",
23689
+ "duplicate-name",
23690
+ "unknown-collection"
23691
+ ])
23692
+ })]);
23693
+ /**
23694
+ * The outcome of adding the frame at a recording instant. Every refusal is
23695
+ * named: `still-unavailable` (not recording, a gap, or an undecodable frame —
23696
+ * `detail` says which), `still-busy` (the recorder is at its decode bound; try
23697
+ * again), `unreadable-image`, `write-failed`, `unknown-collection`.
23698
+ */
23699
+ var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
23700
+ kind: literal("added"),
23701
+ collectionId: string(),
23702
+ frame: RetrainFrameSchema,
23703
+ /** The moment was already in the dataset; nothing was decoded. */
23704
+ reused: boolean()
23705
+ }), object({
23706
+ kind: literal("refused"),
23707
+ reason: _enum([
23708
+ "unknown-collection",
23709
+ "still-unavailable",
23710
+ "still-busy",
23711
+ "unreadable-image",
23712
+ "write-failed"
23713
+ ]),
23714
+ detail: string().optional()
23715
+ })]);
23716
+ /** A vision LLM profile the AI assist may use, and where it sends the frame. */
23717
+ var RetrainAssistProfileSchema = object({
23718
+ id: string(),
23719
+ name: string(),
23720
+ model: string(),
23721
+ kind: string(),
23722
+ /** `true` when the frame would leave the house (a cloud vendor, or an
23723
+ * endpoint that is not on the local network). The page confirms each such
23724
+ * run, and the provider refuses one without `allowCloud`. */
23725
+ leavesHouse: boolean()
23726
+ });
23727
+ /** A box the AI assist proposed: a draft, plus the model's own reason. */
23728
+ var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
23729
+ /** What the AI assist said about a box that was already on the canvas. */
23730
+ var RetrainLlmReviewSchema = object({
23731
+ /** The `ref` the page sent the box under. */
23732
+ ref: string(),
23733
+ verdict: _enum([
23734
+ "confirmed",
23735
+ "wrong-class",
23736
+ "not-an-object",
23737
+ "uncertain"
23738
+ ]),
23739
+ suggestedClass: RetrainMacroClassSchema.optional(),
23740
+ reason: string()
23741
+ });
23742
+ /**
23743
+ * The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
23744
+ * model and its confidence) and reviews; items the model got wrong (a box off
23745
+ * the frame, an unasked class, an unknown ref) are dropped and counted in
23746
+ * `rejected`. A whole answer that is not the schema is `malformed-answer`.
23747
+ */
23748
+ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23749
+ kind: literal("proposed"),
23750
+ profileId: string(),
23751
+ model: string(),
23752
+ /** The frame was sent outside the house for this answer. */
23753
+ leftHouse: boolean(),
23754
+ proposals: array(RetrainLlmProposalSchema).readonly(),
23755
+ reviews: array(RetrainLlmReviewSchema).readonly(),
23756
+ rejected: number().int()
23757
+ }), object({
23758
+ kind: literal("refused"),
23759
+ reason: _enum([
23760
+ "unknown-frame",
23761
+ "unreadable-frame",
23762
+ "unknown-profile",
23763
+ "profile-disabled",
23764
+ "no-vision",
23765
+ "cloud-not-confirmed",
23766
+ "llm-error",
23767
+ "malformed-answer"
23768
+ ]),
23769
+ detail: string().optional()
23770
+ })]);
22619
23771
  /** The outcome of a lifecycle move owned by the retrain page. */
22620
23772
  var RetrainTransitionResultSchema = object({
22621
23773
  trackId: string(),
@@ -23333,7 +24485,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23333
24485
  auth: "admin"
23334
24486
  }), method(object({
23335
24487
  deviceId: number(),
23336
- trackId: string(),
24488
+ trackId: string().optional(),
23337
24489
  frameId: string()
23338
24490
  }), object({
23339
24491
  removed: boolean(),
@@ -23350,7 +24502,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23350
24502
  auth: "admin"
23351
24503
  }), method(object({
23352
24504
  deviceId: number(),
23353
- trackId: string(),
24505
+ /** The frame's track, when it has one — checked against the frame. */
24506
+ trackId: string().optional(),
23354
24507
  frameId: string(),
23355
24508
  subject: RetrainAssistSubjectSchema,
23356
24509
  /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
@@ -23358,12 +24511,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23358
24511
  }), RetrainAssistResultSchema, {
23359
24512
  kind: "mutation",
23360
24513
  auth: "admin"
23361
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
24514
+ }), method(object({
24515
+ trackId: string().optional(),
24516
+ frameIds: array(string()).max(2e3).optional()
24517
+ }), array(RetrainAnnotationSchema).readonly(), {
23362
24518
  kind: "query",
23363
24519
  auth: "admin"
23364
24520
  }), method(object({
23365
24521
  deviceId: number(),
23366
- trackId: string(),
24522
+ /** The frame's track, when it has one — checked against the frame. */
24523
+ trackId: string().optional(),
23367
24524
  frameId: string(),
23368
24525
  annotations: array(RetrainAnnotationDraftSchema)
23369
24526
  }), array(RetrainAnnotationSchema).readonly(), {
@@ -23381,7 +24538,91 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23381
24538
  }), RetrainTransitionResultSchema, {
23382
24539
  kind: "mutation",
23383
24540
  auth: "admin"
23384
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
24541
+ }), method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string() }), {
24542
+ kind: "query",
24543
+ auth: "admin"
24544
+ }), method(object({
24545
+ deviceId: number(),
24546
+ trackId: string().optional(),
24547
+ frameId: string(),
24548
+ complete: boolean()
24549
+ }), RetrainFrameSchema, {
24550
+ kind: "mutation",
24551
+ auth: "admin"
24552
+ }), method(object({
24553
+ filter: RetrainExportFilterSchema,
24554
+ layout: RetrainExportLayoutSchema,
24555
+ target: RetrainArchiveTargetSchema
24556
+ }), RetrainArchiveResultSchema, {
24557
+ kind: "mutation",
24558
+ auth: "admin",
24559
+ timeoutMs: 60 * 6e4
24560
+ }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24561
+ kind: "query",
24562
+ auth: "admin"
24563
+ }), method(object({
24564
+ deviceId: number(),
24565
+ trackId: string().optional(),
24566
+ frameId: string(),
24567
+ profileId: string(),
24568
+ classes: array(RetrainMacroClassSchema).min(1),
24569
+ boxes: array(object({
24570
+ ref: string(),
24571
+ bbox: RetrainBboxSchema,
24572
+ macroClass: RetrainMacroClassSchema,
24573
+ label: string().optional()
24574
+ })).max(50),
24575
+ allowCloud: boolean()
24576
+ }), RetrainLlmAssistResultSchema, {
24577
+ kind: "mutation",
24578
+ auth: "admin",
24579
+ timeoutMs: 18e4
24580
+ }), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
24581
+ kind: "mutation",
24582
+ auth: "admin"
24583
+ }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24584
+ kind: "query",
24585
+ auth: "admin"
24586
+ }), method(object({
24587
+ id: string(),
24588
+ name: string().max(120)
24589
+ }), RetrainCollectionRenameResultSchema, {
24590
+ kind: "mutation",
24591
+ auth: "admin"
24592
+ }), method(object({ id: string() }), object({
24593
+ deleted: boolean(),
24594
+ removedFrames: number().int()
24595
+ }), {
24596
+ kind: "mutation",
24597
+ auth: "admin"
24598
+ }), method(object({
24599
+ collectionId: string(),
24600
+ deviceId: number(),
24601
+ epochMs: number()
24602
+ }), AddRetrainFrameFromRecordingResultSchema, {
24603
+ kind: "mutation",
24604
+ auth: "admin",
24605
+ timeoutMs: 6e4
24606
+ }), method(object({
24607
+ collectionId: string(),
24608
+ frameIds: array(string()).min(1).max(500)
24609
+ }), object({
24610
+ added: number().int(),
24611
+ alreadyMember: number().int(),
24612
+ unknownFrameIds: array(string()).readonly()
24613
+ }), {
24614
+ kind: "mutation",
24615
+ auth: "admin"
24616
+ }), method(object({
24617
+ collectionId: string(),
24618
+ frameId: string()
24619
+ }), object({
24620
+ removed: boolean(),
24621
+ deletedFrame: boolean()
24622
+ }), {
24623
+ kind: "mutation",
24624
+ auth: "admin"
24625
+ }), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
23385
24626
  kind: "query",
23386
24627
  auth: "admin"
23387
24628
  }), method(object({
@@ -24007,13 +25248,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
24007
25248
  object({
24008
25249
  kind: literal("no-family-build"),
24009
25250
  format: ModelFormatSchema$1
25251
+ }),
25252
+ object({
25253
+ kind: literal("kept-custom-pin"),
25254
+ modelId: string(),
25255
+ deviceKey: string()
24010
25256
  })
24011
25257
  ]);
25258
+ /** Why a device is left exactly as it is, whatever the plan would pick (D786). */
25259
+ var KeptReasonSchema = _enum(["custom-pin"]);
25260
+ /**
25261
+ * Where a choice's latency came from (D791): this node's own benchmark
25262
+ * result, or the hardware-class table. Measured on the node beats the table.
25263
+ */
25264
+ var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
25265
+ kind: literal("node-benchmark"),
25266
+ resultId: string(),
25267
+ measuredAtMs: number()
25268
+ })]);
24012
25269
  var DeviceModelChoiceSchema = object({
24013
25270
  modelId: string(),
24014
25271
  p50Ms: number(),
24015
25272
  fps: number(),
24016
25273
  measured: boolean(),
25274
+ /** Absent on a plan from before D791 — read as the table. */
25275
+ source: LatencySourceSchema.optional(),
24017
25276
  /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
24018
25277
  capacitySessions: number(),
24019
25278
  personRecall: number()
@@ -24024,6 +25283,8 @@ var DeviceRecommendationSchema = object({
24024
25283
  enabled: boolean(),
24025
25284
  available: boolean(),
24026
25285
  chosen: DeviceModelChoiceSchema.nullable(),
25286
+ /** Present when the device is kept as is: Apply writes nothing on it. */
25287
+ kept: KeptReasonSchema.optional(),
24027
25288
  reasons: array(RecommendationReasonSchema).readonly()
24028
25289
  });
24029
25290
  var NodeRecommendationSchema = object({
@@ -24077,6 +25338,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
24077
25338
  kind: literal("coral-enabled"),
24078
25339
  nodeId: string(),
24079
25340
  deviceKey: string()
25341
+ }),
25342
+ object({
25343
+ kind: literal("custom-pin-kept"),
25344
+ nodeId: string(),
25345
+ deviceKey: string().nullable(),
25346
+ deviceId: number().nullable(),
25347
+ modelId: string()
25348
+ }),
25349
+ object({
25350
+ kind: literal("custom-registry-unreadable"),
25351
+ error: string()
24080
25352
  })
24081
25353
  ]);
24082
25354
  var AutoTuneOptionsSchema = object({
@@ -24255,13 +25527,14 @@ var SuggestSharesResultSchema = object({
24255
25527
  nodes: array(SuggestedNodeShareSchema).readonly()
24256
25528
  });
24257
25529
  /**
24258
- * Where the node and device shares come from (D750, D755).
24259
- * - `hardware` (default) — computed by the system from each node's static
24260
- * capacity (its accelerators at their Auto tune models, from the measured
24261
- * latency table), recomputed whenever a node or device joins, leaves, is
24262
- * switched on or off, or changes model. No load input.
24263
- * - `benchmark` — the same, from each node's measured capacity (node
24264
- * benchmark results); a node without results falls back to `hardware`.
25530
+ * Where the node and device shares come from (D750, D755, D791).
25531
+ * - `benchmark` (default since D791) — each node's capacity as its own node
25532
+ * benchmark measured it; a node without fresh results is sized from
25533
+ * `hardware` and says so. Measured on the node beats the table.
25534
+ * - `hardware` — computed from each node's static capacity only (its
25535
+ * accelerators at their Auto tune models, from the latency table).
25536
+ * Both are recomputed whenever a node or device joins, leaves, is switched
25537
+ * on or off, changes model, or a benchmark result is written. No load input.
24265
25538
  * - `manual` — the operator's stored sliders.
24266
25539
  * Either way a node or device that cannot take sessions gives its share to
24267
25540
  * the others in proportion; the stored values are never rewritten for that.
@@ -24310,6 +25583,362 @@ var EffectiveSharesSchema = object({
24310
25583
  nodeWeights: record(string(), number()),
24311
25584
  deviceWeights: record(string(), record(string(), number()))
24312
25585
  });
25586
+ /**
25587
+ * Wire shapes of the node benchmark (D791): the operator's plan, the
25588
+ * preflight the confirmation shows, the run the orchestrator owns, what the
25589
+ * measuring runner reports, and the result rows Auto tune and the automatic
25590
+ * shares read.
25591
+ *
25592
+ * ONE node at a time, owned by the pipeline orchestrator. While a run is
25593
+ * active the cluster is in BENCHMARK MODE for that node: it is not a
25594
+ * detection candidate, camera pins naming it are ignored so its sessions move
25595
+ * elsewhere, and both come back when the mode ends — after a crash or a hub
25596
+ * restart too (a persisted manifest, reconciled against the registry).
25597
+ *
25598
+ * Two measurements, both on the node, driven by its own runner (frames never
25599
+ * cross a process at frame rate, D9):
25600
+ * - `device` — one accelerator × one candidate detector, root only, open
25601
+ * loop: how many streams at the camera rate it carries inside the frame
25602
+ * interval;
25603
+ * - `pipeline` — the chosen detector plus the operator's detail steps
25604
+ * (faces, plates, classifiers, CLIP…), on varied frames from the bench
25605
+ * clip: how many parallel sessions the node carries before latency, drops,
25606
+ * CPU, RAM or the event loop give out.
25607
+ */
25608
+ /** Defaults and bounds, one place. */
25609
+ var NODE_BENCHMARK_DEFAULTS = {
25610
+ fpsPerStream: 10,
25611
+ budgetMinutes: 45,
25612
+ minBudgetMinutes: 10,
25613
+ maxBudgetMinutes: 120,
25614
+ /** A result older than this no longer beats the table. */
25615
+ staleAfterDays: 30,
25616
+ /** Warm-in per ramp step (not accounted). */
25617
+ settleSec: 5,
25618
+ /** Accounted window per ramp step. */
25619
+ measureSec: 20,
25620
+ /** Longest the drain may take before the run is refused. */
25621
+ drainTimeoutSec: 120,
25622
+ /** Candidate models per device in one run. */
25623
+ maxModelsPerDevice: 6
25624
+ };
25625
+ /** The two measurements a run can make. */
25626
+ var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
25627
+ var NodeBenchmarkDevicePlanSchema = object({
25628
+ /** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
25629
+ deviceKey: string().min(1),
25630
+ /**
25631
+ * Root detector candidates for the `device` measurement, in the order
25632
+ * measured. The FIRST is the one the `pipeline` measurement runs.
25633
+ */
25634
+ modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
25635
+ });
25636
+ /** What the operator confirmed. */
25637
+ var NodeBenchmarkPlanSchema = object({
25638
+ nodeId: string().min(1),
25639
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25640
+ /** Which measurements run. At least one. */
25641
+ phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
25642
+ /**
25643
+ * Detail steps (catalog step ids under the root: faces, plates,
25644
+ * classifiers, CLIP…) the `pipeline` measurement enables. The root
25645
+ * detector always runs.
25646
+ */
25647
+ steps: array(string().min(1)).default([]),
25648
+ /** Offered rate of one stream / session. */
25649
+ fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
25650
+ /** Hard deadline: the mode ends and the cluster is restored when it passes. */
25651
+ budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
25652
+ /** Keep the models the run downloaded (default: delete what was not installed before). */
25653
+ keepDownloadedModels: boolean().default(false),
25654
+ /** Start although the other nodes' capacity does not cover the sessions running now. */
25655
+ acceptInsufficientHeadroom: boolean().default(false)
25656
+ });
25657
+ var NodeBenchmarkRefusalSchema = object({
25658
+ kind: _enum([
25659
+ "benchmark-active",
25660
+ "node-offline",
25661
+ "unknown-device",
25662
+ "no-phase",
25663
+ "insufficient-headroom"
25664
+ ]),
25665
+ detail: string(),
25666
+ overridable: boolean()
25667
+ });
25668
+ /** A camera whose detection leaves the node for the run. */
25669
+ var NodeBenchmarkMovingCameraSchema = object({
25670
+ deviceId: number(),
25671
+ /** Placed on the node now (a standing attach or a running session). */
25672
+ placedOnNode: boolean(),
25673
+ /** A node pin naming this node, ignored for the run. */
25674
+ pinnedToNode: boolean()
25675
+ });
25676
+ /** A camera that cannot leave: no other node can obtain its frames. */
25677
+ var NodeBenchmarkStayingCameraSchema = object({
25678
+ deviceId: number(),
25679
+ reason: literal("only-frame-source")
25680
+ });
25681
+ var NodeBenchmarkPreflightSchema = object({
25682
+ nodeId: string(),
25683
+ online: boolean(),
25684
+ moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
25685
+ /** Keep running on the node during the run; the result is flagged contaminated. */
25686
+ staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
25687
+ estimatedDurationMs: number(),
25688
+ /** The run ends and the cluster is restored at the latest after this long. */
25689
+ budgetMs: number(),
25690
+ phases: array(NodeBenchmarkPhaseSchema).readonly(),
25691
+ steps: array(string()).readonly(),
25692
+ devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
25693
+ /** Parallel sessions the cluster runs now, and what the other nodes can carry. */
25694
+ headroom: object({
25695
+ sessionsNow: number(),
25696
+ otherNodesCapacitySessions: number().nullable()
25697
+ }),
25698
+ refusals: array(NodeBenchmarkRefusalSchema).readonly(),
25699
+ canStart: boolean()
25700
+ });
25701
+ /** Where the measuring runner is. */
25702
+ var NodeBenchProgressSchema = object({
25703
+ phase: _enum([
25704
+ "preparing",
25705
+ "device",
25706
+ "pipeline",
25707
+ "cleanup"
25708
+ ]),
25709
+ deviceKey: string().nullable(),
25710
+ modelId: string().nullable(),
25711
+ /** Streams (device) or sessions (pipeline) of the step running now. */
25712
+ load: number().nullable(),
25713
+ cellsDone: number(),
25714
+ cellsTotal: number(),
25715
+ message: string()
25716
+ });
25717
+ /** What limited a ramp. `none` = the ramp ran out of steps still passing. */
25718
+ var NodeBenchLimitSchema = _enum([
25719
+ "p95",
25720
+ "drops",
25721
+ "errors",
25722
+ "stall",
25723
+ "cpu",
25724
+ "ram",
25725
+ "none"
25726
+ ]);
25727
+ var NodeBenchRampStepSchema = object({
25728
+ load: number(),
25729
+ pass: boolean(),
25730
+ p95Ms: number(),
25731
+ dropRatio: number(),
25732
+ /** Completed frames per second over the accounted window. */
25733
+ fps: number(),
25734
+ cpuPct: number().nullable(),
25735
+ ramFreePct: number().nullable(),
25736
+ failReasons: array(string()).readonly()
25737
+ });
25738
+ var NodeBenchCellSchema = discriminatedUnion("phase", [object({
25739
+ phase: literal("device"),
25740
+ deviceKey: string(),
25741
+ modelId: string(),
25742
+ /** Single-stream latency (the K = 1 step). */
25743
+ p50Ms: number(),
25744
+ p95Ms: number(),
25745
+ p99Ms: number(),
25746
+ /** Frames per second sustained at the last passing step. */
25747
+ fps: number(),
25748
+ /** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
25749
+ kMax: number(),
25750
+ limitedBy: NodeBenchLimitSchema,
25751
+ /** First call (model load + warm-up). */
25752
+ warmupMs: number(),
25753
+ ramp: array(NodeBenchRampStepSchema).readonly()
25754
+ }), object({
25755
+ phase: literal("pipeline"),
25756
+ deviceKey: string(),
25757
+ modelId: string(),
25758
+ steps: array(string()).readonly(),
25759
+ /** Parallel sessions at the camera rate the node carried; 0 = not even one. */
25760
+ maxSessions: number(),
25761
+ limitedBy: NodeBenchLimitSchema,
25762
+ /** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
25763
+ stepsFired: array(string()).readonly(),
25764
+ warmupMs: number(),
25765
+ ramp: array(NodeBenchRampStepSchema).readonly()
25766
+ })]);
25767
+ /**
25768
+ * What a result was measured ON. A result whose fingerprint no longer matches
25769
+ * the node no longer beats the table.
25770
+ */
25771
+ var NodeBenchFingerprintSchema = object({
25772
+ pipelineVersion: string().nullable(),
25773
+ cpuModel: string().nullable(),
25774
+ ramGb: number().nullable(),
25775
+ os: string().nullable(),
25776
+ /** Per device: the pool the cells ran on (runtime + tuning). */
25777
+ pools: record(string(), object({
25778
+ runtime: string(),
25779
+ numWorkers: number(),
25780
+ concurrency: number(),
25781
+ batchMode: string()
25782
+ })).default({})
25783
+ });
25784
+ /** The frames the run used. */
25785
+ var NodeBenchClipSchema = object({
25786
+ /** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
25787
+ id: string(),
25788
+ revision: string().nullable(),
25789
+ frames: number(),
25790
+ width: number(),
25791
+ height: number()
25792
+ });
25793
+ var NodeBenchRunnerInputSchema = object({
25794
+ runId: string().min(1),
25795
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25796
+ phases: array(NodeBenchmarkPhaseSchema).min(1),
25797
+ /** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
25798
+ steps: array(string()).default([]),
25799
+ fpsPerStream: number().int().min(1).max(30),
25800
+ /** The runner stops on its own past this instant, whatever the hub does. */
25801
+ deadlineAtMs: number(),
25802
+ settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
25803
+ measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
25804
+ keepDownloadedModels: boolean().default(false)
25805
+ });
25806
+ var NodeBenchRunnerStateSchema = _enum([
25807
+ "running",
25808
+ "done",
25809
+ "failed",
25810
+ "aborted"
25811
+ ]);
25812
+ var NodeBenchRunnerStatusSchema = object({
25813
+ runId: string(),
25814
+ nodeId: string(),
25815
+ state: NodeBenchRunnerStateSchema,
25816
+ progress: NodeBenchProgressSchema.nullable(),
25817
+ /** Every finished cell so far — a run stopped half way keeps what it measured. */
25818
+ cells: array(NodeBenchCellSchema).readonly(),
25819
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25820
+ clip: NodeBenchClipSchema.nullable(),
25821
+ /** Cameras seen running on the node during the run (they share its pools). */
25822
+ activeCameraIds: array(number()).readonly(),
25823
+ /** Models the run downloaded and then deleted (not installed before). */
25824
+ deletedModels: array(string()).readonly(),
25825
+ error: string().nullable(),
25826
+ startedAtMs: number(),
25827
+ finishedAtMs: number().nullable()
25828
+ });
25829
+ var NodeBenchmarkStateSchema = _enum([
25830
+ "draining",
25831
+ "measuring",
25832
+ "restoring",
25833
+ "done",
25834
+ "failed",
25835
+ "aborted"
25836
+ ]);
25837
+ /** Why a run ended. */
25838
+ var NodeBenchmarkEndReasonSchema = _enum([
25839
+ "completed",
25840
+ "operator-abort",
25841
+ "deadline",
25842
+ "node-lost",
25843
+ "runner-lost",
25844
+ "hub-restart",
25845
+ "drain-timeout",
25846
+ "failed"
25847
+ ]);
25848
+ var NodeBenchmarkRunSchema = object({
25849
+ runId: string(),
25850
+ nodeId: string(),
25851
+ state: NodeBenchmarkStateSchema,
25852
+ plan: NodeBenchmarkPlanSchema,
25853
+ startedAtMs: number(),
25854
+ deadlineAtMs: number(),
25855
+ finishedAtMs: number().nullable(),
25856
+ endReason: NodeBenchmarkEndReasonSchema.nullable(),
25857
+ error: string().nullable(),
25858
+ /** Cameras moved off the node for the run. */
25859
+ moved: array(number()).readonly(),
25860
+ /** Cameras that stayed (their only frame source is the node). */
25861
+ staying: array(number()).readonly(),
25862
+ /** Something else ran on the node's pools during the run. */
25863
+ contaminated: boolean(),
25864
+ progress: NodeBenchProgressSchema.nullable(),
25865
+ resultIds: array(string()).readonly()
25866
+ });
25867
+ /** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
25868
+ var NodeBenchmarkStatusSchema = object({
25869
+ /** The node the cluster is in benchmark mode for; null = none. */
25870
+ modeNodeId: string().nullable(),
25871
+ run: NodeBenchmarkRunSchema.nullable()
25872
+ });
25873
+ /**
25874
+ * One stored measurement — the only authority Auto tune and the automatic
25875
+ * shares read measured capacity from. Written by the orchestrator when a run
25876
+ * ends, never by anyone else.
25877
+ */
25878
+ var NodeBenchmarkResultSchema = object({
25879
+ id: string(),
25880
+ runId: string(),
25881
+ nodeId: string(),
25882
+ cell: NodeBenchCellSchema,
25883
+ fpsPerStream: number(),
25884
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25885
+ clip: NodeBenchClipSchema.nullable(),
25886
+ /** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
25887
+ contaminated: boolean(),
25888
+ stayingCameras: array(number()).readonly(),
25889
+ /** The run ended early; the cell itself completed. */
25890
+ partialRun: boolean(),
25891
+ measuredAtMs: number()
25892
+ });
25893
+ var ListNodeBenchmarkResultsInputSchema = object({
25894
+ nodeId: string().optional(),
25895
+ deviceKey: string().optional()
25896
+ });
25897
+ /** A result with its standing today: does it still beat the table? */
25898
+ var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
25899
+ /** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
25900
+ standing: _enum([
25901
+ "fresh",
25902
+ "stale",
25903
+ "superseded"
25904
+ ]),
25905
+ staleWhy: _enum([
25906
+ "age",
25907
+ "runtime",
25908
+ "pool-tuning"
25909
+ ]).nullable()
25910
+ });
25911
+ object({
25912
+ runId: string(),
25913
+ nodeId: string(),
25914
+ startedAtMs: number(),
25915
+ deadlineAtMs: number(),
25916
+ plan: NodeBenchmarkPlanSchema,
25917
+ moved: array(number()).readonly(),
25918
+ staying: array(number()).readonly()
25919
+ });
25920
+ /** Candidate detectors per device, for the plan editor. */
25921
+ var NodeBenchmarkCandidatesSchema = object({
25922
+ nodeId: string(),
25923
+ reachable: boolean(),
25924
+ devices: array(object({
25925
+ deviceKey: string(),
25926
+ enabled: boolean(),
25927
+ available: boolean(),
25928
+ /** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
25929
+ suggested: array(string()).readonly(),
25930
+ /** Every root detector the device has a build for. */
25931
+ all: array(string()).readonly(),
25932
+ /** The model the device runs now, when pinned. */
25933
+ currentModelId: string().nullable()
25934
+ })).readonly(),
25935
+ /** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
25936
+ steps: array(object({
25937
+ id: string(),
25938
+ name: string(),
25939
+ slot: string()
25940
+ })).readonly()
25941
+ });
24313
25942
  object({
24314
25943
  activeCameras: number(),
24315
25944
  throttledCameras: number(),
@@ -25438,7 +27067,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
25438
27067
  }), ParkedTrackFrameSchema.nullable()), method(object({
25439
27068
  deviceId: number(),
25440
27069
  trackId: string()
25441
- }), object({ released: number().int().nonnegative() }), { kind: "mutation" });
27070
+ }), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
27071
+ accepted: literal(true),
27072
+ runId: string()
27073
+ }), {
27074
+ kind: "mutation",
27075
+ auth: "admin"
27076
+ }), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
27077
+ kind: "mutation",
27078
+ auth: "admin"
27079
+ });
25442
27080
  var CameraPipelineConfigSchema = object({
25443
27081
  engine: PipelineEngineChoiceSchema.optional(),
25444
27082
  steps: array(PipelineStepInputSchema).readonly(),
@@ -26077,6 +27715,21 @@ method(object({
26077
27715
  }), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
26078
27716
  kind: "mutation",
26079
27717
  auth: "admin"
27718
+ }), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
27719
+ kind: literal("started"),
27720
+ runId: string()
27721
+ }), object({
27722
+ kind: literal("refused"),
27723
+ preflight: NodeBenchmarkPreflightSchema
27724
+ })]), {
27725
+ kind: "mutation",
27726
+ auth: "admin"
27727
+ }), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
27728
+ kind: "mutation",
27729
+ auth: "admin"
27730
+ }), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
27731
+ kind: "mutation",
27732
+ auth: "admin"
26080
27733
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
26081
27734
  deviceId: number(),
26082
27735
  addonId: string(),
@@ -26713,7 +28366,19 @@ var SsoBridgeClaimsSchema = object({
26713
28366
  * editing a descriptor must not retroactively extend or shorten a link the
26714
28367
  * operator already consented to.
26715
28368
  */
26716
- refreshTtl: union([number().int().positive(), literal("never")]).optional()
28369
+ refreshTtl: union([number().int().positive(), literal("never")]).optional(),
28370
+ /**
28371
+ * Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
28372
+ * that was started from a signed-in user's "Link" button: the finish then
28373
+ * links this identity to the intent's user instead of signing anyone in.
28374
+ * The handle carries no user id — the hub resolves it, single-use.
28375
+ */
28376
+ linkIntent: string().optional(),
28377
+ /**
28378
+ * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28379
+ * subject is unique only per issuer, so a link is bound to it.
28380
+ */
28381
+ issuer: string().optional()
26717
28382
  });
26718
28383
  method(object({
26719
28384
  claims: SsoBridgeClaimsSchema,
@@ -28648,7 +30313,22 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
28648
30313
  * field their hints were silently stripped by the schema and the
28649
30314
  * adaptive ladder started blind on the client's display size.
28650
30315
  */
28651
- hints: webrtcClientHintsSchema.optional()
30316
+ hints: webrtcClientHintsSchema.optional(),
30317
+ /**
30318
+ * Talk-back (D771): relay the PEER's audio to the device's speaker
30319
+ * through the `intercom` cap's push-talk triple. When `true` and the
30320
+ * offer lets the peer send audio, the answer's audio is `sendrecv`
30321
+ * and every inbound frame goes to `intercom.pushTalkAudio` for this
30322
+ * `deviceId`; absent/false answers `sendonly`, as for every viewer.
30323
+ *
30324
+ * TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
30325
+ * with `intercom`, when the linked user may control that camera. The
30326
+ * hub STRIPS it from every request-bound call (a browser), exactly as
30327
+ * it overwrites `relayOnly` — a viewer's talk permission is the
30328
+ * intercom cap's own surface (share tokens gate it there), and this
30329
+ * flag must not become a second door to the camera's speaker.
30330
+ */
30331
+ talkback: boolean().optional()
28652
30332
  }), object({
28653
30333
  sessionId: string(),
28654
30334
  sdpAnswer: string()
@@ -32157,6 +33837,9 @@ var CreateIntegrationInputSchema = object({
32157
33837
  enabled: boolean().optional(),
32158
33838
  info: record(string(), unknown()).optional(),
32159
33839
  settings: record(string(), unknown()).optional(),
33840
+ /** Keys of `settings` the form's schema declares secret (by type) — kept in
33841
+ * the keychain, not the table (D787). */
33842
+ secretKeys: array(string()).optional(),
32160
33843
  skipRestart: boolean().optional()
32161
33844
  });
32162
33845
  var UpdateIntegrationInputSchema = object({
@@ -32180,7 +33863,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
32180
33863
  auth: "admin"
32181
33864
  }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
32182
33865
  id: string(),
32183
- settings: record(string(), unknown())
33866
+ settings: record(string(), unknown()),
33867
+ /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
33868
+ secretKeys: array(string()).optional()
32184
33869
  }), object({ success: boolean() }), {
32185
33870
  kind: "mutation",
32186
33871
  auth: "admin"
@@ -39002,6 +40687,32 @@ var TotpStatusSchema = object({
39002
40687
  /** Null when no row exists OR the row is still pending confirmation. */
39003
40688
  confirmedAt: number().nullable()
39004
40689
  });
40690
+ /**
40691
+ * user-management — singleton capability for user accounts, API keys,
40692
+ * and scoped tokens.
40693
+ *
40694
+ * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
40695
+ * — the subset check on `setUserScopes` / `createScopedToken` is moot
40696
+ * because non-admins never reach these. If/when we open non-admin
40697
+ * delegation, structural caller-scope subset check goes inside the
40698
+ * provider.
40699
+ */
40700
+ var ExternalIdentitySchema = object({
40701
+ /** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
40702
+ provider: string(),
40703
+ /** The IdP's stable subject (`sub`) for this account. */
40704
+ subject: string(),
40705
+ /** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
40706
+ issuer: string(),
40707
+ userId: string(),
40708
+ /** What the IdP called the account at link time (username / email) — display only. */
40709
+ label: string().optional(),
40710
+ linkedAt: number()
40711
+ });
40712
+ var ExternalIdentityKeySchema = object({
40713
+ provider: string().min(1),
40714
+ subject: string().min(1)
40715
+ });
39005
40716
  method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
39006
40717
  kind: "mutation",
39007
40718
  auth: "admin",
@@ -39115,7 +40826,22 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
39115
40826
  userId: string(),
39116
40827
  username: string(),
39117
40828
  scopes: array(TokenScopeSchema)
39118
- }).nullable(), { access: "view" }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
40829
+ }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
40830
+ userId: string(),
40831
+ issuer: string()
40832
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
40833
+ userId: string(),
40834
+ issuer: string().min(1),
40835
+ label: string().optional()
40836
+ }), object({ success: literal(true) }), {
40837
+ kind: "mutation",
40838
+ auth: "admin",
40839
+ access: "create"
40840
+ }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
40841
+ kind: "mutation",
40842
+ auth: "admin",
40843
+ access: "delete"
40844
+ }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
39119
40845
  kind: "mutation",
39120
40846
  auth: "admin",
39121
40847
  access: "delete"
@@ -40302,7 +42028,8 @@ var BaseDevice = class {
40302
42028
  this.role = options.role;
40303
42029
  this.parentDeviceId = ctx.parentDeviceId;
40304
42030
  const seedData = ctx.persistedConfig ?? {};
40305
- this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data), seedData, ({ droppedKeys, issues }) => {
42031
+ const declaredSecretPaths = collectZodSecretPaths(schema);
42032
+ this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
40306
42033
  ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
40307
42034
  tags: {
40308
42035
  deviceId: ctx.id,
@@ -43991,6 +45718,90 @@ Object.freeze({
43991
45718
  addonId: null,
43992
45719
  access: "create"
43993
45720
  },
45721
+ "keychain.delete": {
45722
+ capName: "keychain",
45723
+ capScope: "system",
45724
+ addonId: null,
45725
+ access: "delete"
45726
+ },
45727
+ "keychain.getState": {
45728
+ capName: "keychain",
45729
+ capScope: "system",
45730
+ addonId: null,
45731
+ access: "view"
45732
+ },
45733
+ "keychain.listMeta": {
45734
+ capName: "keychain",
45735
+ capScope: "system",
45736
+ addonId: null,
45737
+ access: "view"
45738
+ },
45739
+ "keychain.put": {
45740
+ capName: "keychain",
45741
+ capScope: "system",
45742
+ addonId: null,
45743
+ access: "create"
45744
+ },
45745
+ "keychain.resolve": {
45746
+ capName: "keychain",
45747
+ capScope: "system",
45748
+ addonId: null,
45749
+ access: "view"
45750
+ },
45751
+ "keychainAdmin.deleteOrphans": {
45752
+ capName: "keychain-admin",
45753
+ capScope: "system",
45754
+ addonId: null,
45755
+ access: "delete"
45756
+ },
45757
+ "keychainAdmin.downloadRecoveryKey": {
45758
+ capName: "keychain-admin",
45759
+ capScope: "system",
45760
+ addonId: null,
45761
+ access: "create"
45762
+ },
45763
+ "keychainAdmin.listAudit": {
45764
+ capName: "keychain-admin",
45765
+ capScope: "system",
45766
+ addonId: null,
45767
+ access: "view"
45768
+ },
45769
+ "keychainAdmin.listSecrets": {
45770
+ capName: "keychain-admin",
45771
+ capScope: "system",
45772
+ addonId: null,
45773
+ access: "view"
45774
+ },
45775
+ "keychainAdmin.purgeRetiredKeys": {
45776
+ capName: "keychain-admin",
45777
+ capScope: "system",
45778
+ addonId: null,
45779
+ access: "delete"
45780
+ },
45781
+ "keychainAdmin.resetKeychain": {
45782
+ capName: "keychain-admin",
45783
+ capScope: "system",
45784
+ addonId: null,
45785
+ access: "delete"
45786
+ },
45787
+ "keychainAdmin.reveal": {
45788
+ capName: "keychain-admin",
45789
+ capScope: "system",
45790
+ addonId: null,
45791
+ access: "create"
45792
+ },
45793
+ "keychainAdmin.rotateMasterKey": {
45794
+ capName: "keychain-admin",
45795
+ capScope: "system",
45796
+ addonId: null,
45797
+ access: "create"
45798
+ },
45799
+ "keychainAdmin.status": {
45800
+ capName: "keychain-admin",
45801
+ capScope: "system",
45802
+ addonId: null,
45803
+ access: "view"
45804
+ },
43994
45805
  "lawnMowerControl.dock": {
43995
45806
  capName: "lawn-mower-control",
43996
45807
  capScope: "device",
@@ -45365,6 +47176,18 @@ Object.freeze({
45365
47176
  addonId: null,
45366
47177
  access: "create"
45367
47178
  },
47179
+ "pipelineAnalytics.addRetrainFrameFromRecording": {
47180
+ capName: "pipeline-analytics",
47181
+ capScope: "device",
47182
+ addonId: null,
47183
+ access: "create"
47184
+ },
47185
+ "pipelineAnalytics.addRetrainFramesToCollection": {
47186
+ capName: "pipeline-analytics",
47187
+ capScope: "device",
47188
+ addonId: null,
47189
+ access: "create"
47190
+ },
45368
47191
  "pipelineAnalytics.applyDeviceSettingsPatch": {
45369
47192
  capName: "pipeline-analytics",
45370
47193
  capScope: "device",
@@ -45413,12 +47236,24 @@ Object.freeze({
45413
47236
  addonId: null,
45414
47237
  access: "view"
45415
47238
  },
47239
+ "pipelineAnalytics.createRetrainCollection": {
47240
+ capName: "pipeline-analytics",
47241
+ capScope: "device",
47242
+ addonId: null,
47243
+ access: "create"
47244
+ },
45416
47245
  "pipelineAnalytics.deleteDeviceEvents": {
45417
47246
  capName: "pipeline-analytics",
45418
47247
  capScope: "device",
45419
47248
  addonId: null,
45420
47249
  access: "delete"
45421
47250
  },
47251
+ "pipelineAnalytics.deleteRetrainCollection": {
47252
+ capName: "pipeline-analytics",
47253
+ capScope: "device",
47254
+ addonId: null,
47255
+ access: "delete"
47256
+ },
45422
47257
  "pipelineAnalytics.deleteTracks": {
45423
47258
  capName: "pipeline-analytics",
45424
47259
  capScope: "device",
@@ -45623,6 +47458,24 @@ Object.freeze({
45623
47458
  addonId: null,
45624
47459
  access: "view"
45625
47460
  },
47461
+ "pipelineAnalytics.listRetrainAssistProfiles": {
47462
+ capName: "pipeline-analytics",
47463
+ capScope: "device",
47464
+ addonId: null,
47465
+ access: "view"
47466
+ },
47467
+ "pipelineAnalytics.listRetrainCollectionFrames": {
47468
+ capName: "pipeline-analytics",
47469
+ capScope: "device",
47470
+ addonId: null,
47471
+ access: "view"
47472
+ },
47473
+ "pipelineAnalytics.listRetrainCollections": {
47474
+ capName: "pipeline-analytics",
47475
+ capScope: "device",
47476
+ addonId: null,
47477
+ access: "view"
47478
+ },
45626
47479
  "pipelineAnalytics.listRetrainFrames": {
45627
47480
  capName: "pipeline-analytics",
45628
47481
  capScope: "device",
@@ -45671,6 +47524,12 @@ Object.freeze({
45671
47524
  addonId: null,
45672
47525
  access: "create"
45673
47526
  },
47527
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
47528
+ capName: "pipeline-analytics",
47529
+ capScope: "device",
47530
+ addonId: null,
47531
+ access: "create"
47532
+ },
45674
47533
  "pipelineAnalytics.pruneEvents": {
45675
47534
  capName: "pipeline-analytics",
45676
47535
  capScope: "device",
@@ -45725,6 +47584,18 @@ Object.freeze({
45725
47584
  addonId: null,
45726
47585
  access: "create"
45727
47586
  },
47587
+ "pipelineAnalytics.removeRetrainFrameFromCollection": {
47588
+ capName: "pipeline-analytics",
47589
+ capScope: "device",
47590
+ addonId: null,
47591
+ access: "delete"
47592
+ },
47593
+ "pipelineAnalytics.renameRetrainCollection": {
47594
+ capName: "pipeline-analytics",
47595
+ capScope: "device",
47596
+ addonId: null,
47597
+ access: "create"
47598
+ },
45728
47599
  "pipelineAnalytics.restageRetrainTrack": {
45729
47600
  capName: "pipeline-analytics",
45730
47601
  capScope: "device",
@@ -45755,6 +47626,12 @@ Object.freeze({
45755
47626
  addonId: null,
45756
47627
  access: "create"
45757
47628
  },
47629
+ "pipelineAnalytics.setRetrainFrameComplete": {
47630
+ capName: "pipeline-analytics",
47631
+ capScope: "device",
47632
+ addonId: null,
47633
+ access: "create"
47634
+ },
45758
47635
  "pipelineAnalytics.setTrackFlags": {
45759
47636
  capName: "pipeline-analytics",
45760
47637
  capScope: "device",
@@ -45791,6 +47668,12 @@ Object.freeze({
45791
47668
  addonId: null,
45792
47669
  access: "delete"
45793
47670
  },
47671
+ "pipelineAnalytics.writeRetrainArchive": {
47672
+ capName: "pipeline-analytics",
47673
+ capScope: "device",
47674
+ addonId: null,
47675
+ access: "create"
47676
+ },
45794
47677
  "pipelineExecutor.cacheFrameInPool": {
45795
47678
  capName: "pipeline-executor",
45796
47679
  capScope: "system",
@@ -46001,6 +47884,12 @@ Object.freeze({
46001
47884
  addonId: null,
46002
47885
  access: "view"
46003
47886
  },
47887
+ "pipelineOrchestrator.abortNodeBenchmark": {
47888
+ capName: "pipeline-orchestrator",
47889
+ capScope: "system",
47890
+ addonId: null,
47891
+ access: "create"
47892
+ },
46004
47893
  "pipelineOrchestrator.applyAutoTune": {
46005
47894
  capName: "pipeline-orchestrator",
46006
47895
  capScope: "system",
@@ -46025,6 +47914,12 @@ Object.freeze({
46025
47914
  addonId: null,
46026
47915
  access: "create"
46027
47916
  },
47917
+ "pipelineOrchestrator.deleteNodeBenchmarkResult": {
47918
+ capName: "pipeline-orchestrator",
47919
+ capScope: "system",
47920
+ addonId: null,
47921
+ access: "delete"
47922
+ },
46028
47923
  "pipelineOrchestrator.getAgentLoad": {
46029
47924
  capName: "pipeline-orchestrator",
46030
47925
  capScope: "system",
@@ -46133,6 +48028,24 @@ Object.freeze({
46133
48028
  addonId: null,
46134
48029
  access: "view"
46135
48030
  },
48031
+ "pipelineOrchestrator.getNodeBenchmarkCandidates": {
48032
+ capName: "pipeline-orchestrator",
48033
+ capScope: "system",
48034
+ addonId: null,
48035
+ access: "view"
48036
+ },
48037
+ "pipelineOrchestrator.getNodeBenchmarkPreflight": {
48038
+ capName: "pipeline-orchestrator",
48039
+ capScope: "system",
48040
+ addonId: null,
48041
+ access: "view"
48042
+ },
48043
+ "pipelineOrchestrator.getNodeBenchmarkStatus": {
48044
+ capName: "pipeline-orchestrator",
48045
+ capScope: "system",
48046
+ addonId: null,
48047
+ access: "view"
48048
+ },
46136
48049
  "pipelineOrchestrator.getNodeInferenceDevices": {
46137
48050
  capName: "pipeline-orchestrator",
46138
48051
  capScope: "system",
@@ -46175,6 +48088,12 @@ Object.freeze({
46175
48088
  addonId: null,
46176
48089
  access: "view"
46177
48090
  },
48091
+ "pipelineOrchestrator.listNodeBenchmarkResults": {
48092
+ capName: "pipeline-orchestrator",
48093
+ capScope: "system",
48094
+ addonId: null,
48095
+ access: "view"
48096
+ },
46178
48097
  "pipelineOrchestrator.pauseForStorageMigration": {
46179
48098
  capName: "pipeline-orchestrator",
46180
48099
  capScope: "system",
@@ -46319,6 +48238,12 @@ Object.freeze({
46319
48238
  addonId: null,
46320
48239
  access: "create"
46321
48240
  },
48241
+ "pipelineOrchestrator.startNodeBenchmark": {
48242
+ capName: "pipeline-orchestrator",
48243
+ capScope: "system",
48244
+ addonId: null,
48245
+ access: "create"
48246
+ },
46322
48247
  "pipelineOrchestrator.suggestShares": {
46323
48248
  capName: "pipeline-orchestrator",
46324
48249
  capScope: "system",
@@ -46337,6 +48262,12 @@ Object.freeze({
46337
48262
  addonId: null,
46338
48263
  access: "create"
46339
48264
  },
48265
+ "pipelineRunner.abortNodeBench": {
48266
+ capName: "pipeline-runner",
48267
+ capScope: "system",
48268
+ addonId: null,
48269
+ access: "create"
48270
+ },
46340
48271
  "pipelineRunner.attachCamera": {
46341
48272
  capName: "pipeline-runner",
46342
48273
  capScope: "system",
@@ -46385,6 +48316,12 @@ Object.freeze({
46385
48316
  addonId: null,
46386
48317
  access: "view"
46387
48318
  },
48319
+ "pipelineRunner.getNodeBenchStatus": {
48320
+ capName: "pipeline-runner",
48321
+ capScope: "system",
48322
+ addonId: null,
48323
+ access: "view"
48324
+ },
46388
48325
  "pipelineRunner.getParkedTrackFrame": {
46389
48326
  capName: "pipeline-runner",
46390
48327
  capScope: "system",
@@ -46427,6 +48364,12 @@ Object.freeze({
46427
48364
  addonId: null,
46428
48365
  access: "create"
46429
48366
  },
48367
+ "pipelineRunner.startNodeBench": {
48368
+ capName: "pipeline-runner",
48369
+ capScope: "system",
48370
+ addonId: null,
48371
+ access: "create"
48372
+ },
46430
48373
  "plateGallery.assignPlate": {
46431
48374
  capName: "plate-gallery",
46432
48375
  capScope: "system",
@@ -48143,18 +50086,36 @@ Object.freeze({
48143
50086
  addonId: null,
48144
50087
  access: "delete"
48145
50088
  },
50089
+ "userManagement.findUserByExternalIdentity": {
50090
+ capName: "user-management",
50091
+ capScope: "system",
50092
+ addonId: null,
50093
+ access: "view"
50094
+ },
48146
50095
  "userManagement.getTotpStatus": {
48147
50096
  capName: "user-management",
48148
50097
  capScope: "system",
48149
50098
  addonId: null,
48150
50099
  access: "view"
48151
50100
  },
50101
+ "userManagement.linkExternalIdentity": {
50102
+ capName: "user-management",
50103
+ capScope: "system",
50104
+ addonId: null,
50105
+ access: "create"
50106
+ },
48152
50107
  "userManagement.listApiKeys": {
48153
50108
  capName: "user-management",
48154
50109
  capScope: "system",
48155
50110
  addonId: null,
48156
50111
  access: "view"
48157
50112
  },
50113
+ "userManagement.listExternalIdentities": {
50114
+ capName: "user-management",
50115
+ capScope: "system",
50116
+ addonId: null,
50117
+ access: "view"
50118
+ },
48158
50119
  "userManagement.listOauthSessions": {
48159
50120
  capName: "user-management",
48160
50121
  capScope: "system",
@@ -48233,6 +50194,12 @@ Object.freeze({
48233
50194
  addonId: null,
48234
50195
  access: "create"
48235
50196
  },
50197
+ "userManagement.unlinkExternalIdentity": {
50198
+ capName: "user-management",
50199
+ capScope: "system",
50200
+ addonId: null,
50201
+ access: "delete"
50202
+ },
48236
50203
  "userManagement.updateUser": {
48237
50204
  capName: "user-management",
48238
50205
  capScope: "system",
@@ -51332,6 +53299,11 @@ Object.freeze({
51332
53299
  form: "single",
51333
53300
  optional: false
51334
53301
  }],
53302
+ "pipelineAnalytics.addRetrainFrameFromRecording": [{
53303
+ name: "deviceId",
53304
+ form: "single",
53305
+ optional: false
53306
+ }],
51335
53307
  "pipelineAnalytics.applyDeviceSettingsPatch": [{
51336
53308
  name: "deviceId",
51337
53309
  form: "single",
@@ -51522,6 +53494,11 @@ Object.freeze({
51522
53494
  form: "single",
51523
53495
  optional: false
51524
53496
  }],
53497
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
53498
+ name: "deviceId",
53499
+ form: "single",
53500
+ optional: false
53501
+ }],
51525
53502
  "pipelineAnalytics.pruneEventsBefore": [{
51526
53503
  name: "deviceId",
51527
53504
  form: "single",
@@ -51572,6 +53549,11 @@ Object.freeze({
51572
53549
  form: "single",
51573
53550
  optional: false
51574
53551
  }],
53552
+ "pipelineAnalytics.setRetrainFrameComplete": [{
53553
+ name: "deviceId",
53554
+ form: "single",
53555
+ optional: false
53556
+ }],
51575
53557
  "pipelineAnalytics.setTrackFlags": [{
51576
53558
  name: "deviceId",
51577
53559
  form: "single",
@@ -53723,7 +55705,7 @@ var homematicConfigSchema = object({
53723
55705
  enableGroups: boolean().default(true).describe("Enable groups (heating groups / VirtualDevices)"),
53724
55706
  enableBidcosWired: boolean().default(false).describe("Enable BidCos-Wired (HM-Wired)"),
53725
55707
  username: string().default("").describe("WebUI username (optional — enables names / rooms / sysvars)"),
53726
- password: string().default("").describe("WebUI password (optional)"),
55708
+ password: string().default("").describe("WebUI password (optional)").meta({ secret: true }),
53727
55709
  callbackHost: string().default("").describe("Address the CCU calls back to for event push (this hub LAN IP)"),
53728
55710
  callbackPort: preprocess((v) => v === "" || v === null ? void 0 : v, number().int().min(1).max(65535).default(2128)).describe("Local XML-RPC callback server port"),
53729
55711
  tls: boolean().default(false).describe("Use TLS for the CCU transport")