@camstack/addon-provider-dreo 0.2.121 → 0.2.123

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
@@ -35,7 +35,7 @@ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["modu
35
35
  //#endregion
36
36
  let crypto$1 = require("crypto");
37
37
  let events = require("events");
38
- //#region ../types/dist/event-category-B_0XEcLF.mjs
38
+ //#region ../types/dist/event-category-DaIZi00R.mjs
39
39
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
40
40
  EventCategory["SystemBoot"] = "system.boot";
41
41
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -114,6 +114,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
114
114
  */
115
115
  EventCategory["AddonLoadFailed"] = "addon.load-failed";
116
116
  /**
117
+ * A keychain value was stored or removed (D787). Carries the ref, its
118
+ * owner and the new version — NEVER the value. A process holding the ref
119
+ * drops its cached copy and the owning `BaseAddon` re-resolves its config.
120
+ * Telemetry (D8): a process that misses it still revalidates by version.
121
+ */
122
+ EventCategory["KeychainChanged"] = "keychain.changed";
123
+ /**
117
124
  * Addon recovered from a previous failure. Emitted when an addon
118
125
  * transitions from `failed` back to `healthy` (typically via the
119
126
  * monitor's auto-retry loop, or after manual `addons.retryLoad`).
@@ -5406,7 +5413,7 @@ var ZodIssueCode = {
5406
5413
  var ZodFirstPartyTypeKind;
5407
5414
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5408
5415
  //#endregion
5409
- //#region ../types/dist/sleep-BNeXenvr.mjs
5416
+ //#region ../types/dist/sleep-Cr5YOk3m.mjs
5410
5417
  /**
5411
5418
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5412
5419
  * window to float samples (D455).
@@ -5485,6 +5492,97 @@ function buildAlawTable() {
5485
5492
  }
5486
5493
  buildUlawTable();
5487
5494
  buildAlawTable();
5495
+ /** Is this field's stored value a credential? */
5496
+ function isSecretConfigField(field) {
5497
+ if (field.type === "password") return true;
5498
+ return "secret" in field && field.secret === true;
5499
+ }
5500
+ /**
5501
+ * Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
5502
+ * by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
5503
+ */
5504
+ function isKeychainStoredField(field) {
5505
+ if (!isSecretConfigField(field)) return false;
5506
+ if (field.type === "textarea" && field.isJson === true) return false;
5507
+ return !("storage" in field && field.storage === "inline");
5508
+ }
5509
+ /**
5510
+ * What a settings blob holds where a secret used to be.
5511
+ *
5512
+ * A keychain-stored field never holds its value. It holds a self-describing
5513
+ * MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
5514
+ * code can mistake it for a credential and no form can send it to a camera as
5515
+ * a password. The empty state is `null` / absent, never `''`.
5516
+ *
5517
+ * The same shapes travel to and from the admin UI:
5518
+ *
5519
+ * - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
5520
+ * (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
5521
+ * value is set, never the value.
5522
+ * - write: an untouched field submits the view back unchanged (KEEP); a typed
5523
+ * value is a plain non-empty string (CHANGE); the Clear button submits
5524
+ * {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
5525
+ * are KEEP — an empty string is what a defaults-fallback pushes back, and
5526
+ * treating it as "clear" is how a save destroyed a stored credential before.
5527
+ *
5528
+ * Pure and browser-safe.
5529
+ */
5530
+ var SECRET_CLEAR = { $secretClear: true };
5531
+ /** The `'***'` token D634 redaction writes for non-admins. */
5532
+ var LEGACY_DEVICE_REDACTION = "***";
5533
+ function isRecord$1(value) {
5534
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5535
+ }
5536
+ function makeSecretMarker(ref) {
5537
+ return {
5538
+ $secret: ref,
5539
+ v: 1
5540
+ };
5541
+ }
5542
+ /** A stored marker: an object whose `$secret` is a non-empty string. */
5543
+ function isSecretMarker(value) {
5544
+ if (!isRecord$1(value)) return false;
5545
+ const ref = value["$secret"];
5546
+ return typeof ref === "string" && ref.length > 0;
5547
+ }
5548
+ function isSecretClear(value) {
5549
+ return isRecord$1(value) && value["$secretClear"] === true;
5550
+ }
5551
+ /**
5552
+ * The UI view of a stored secret field value: a marker becomes "set", inline
5553
+ * plaintext becomes "set (inline)", nothing becomes `null`. A value never
5554
+ * survives this function.
5555
+ */
5556
+ function toSecretFieldView(stored) {
5557
+ if (isSecretMarker(stored)) return {
5558
+ $secret: stored.$secret,
5559
+ v: 1,
5560
+ set: true
5561
+ };
5562
+ if (typeof stored === "string" && stored.length > 0) return {
5563
+ $secret: null,
5564
+ v: 1,
5565
+ set: true,
5566
+ inline: true
5567
+ };
5568
+ return null;
5569
+ }
5570
+ /**
5571
+ * Classify an incoming value for a secret path. Only a non-empty string that is
5572
+ * not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
5573
+ * Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
5574
+ * `undefined`, a redaction token, a non-string — keeps what is stored.
5575
+ */
5576
+ function classifySecretWrite(incoming) {
5577
+ if (isSecretClear(incoming)) return { kind: "clear" };
5578
+ if (typeof incoming !== "string") return { kind: "keep" };
5579
+ if (incoming.length === 0) return { kind: "keep" };
5580
+ if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
5581
+ return {
5582
+ kind: "set",
5583
+ value: incoming
5584
+ };
5585
+ }
5488
5586
  Object.fromEntries([
5489
5587
  {
5490
5588
  id: "overview",
@@ -5656,33 +5754,19 @@ Object.fromEntries([
5656
5754
  function isValuelessField(field) {
5657
5755
  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";
5658
5756
  }
5659
- /**
5660
- * Merge a `ConfigUISchema` with a raw `values` record into a
5661
- * `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
5662
- * before returning to the admin UI. Groups are walked recursively.
5663
- *
5664
- * For each leaf field:
5665
- * - structural fields (`separator`, `info`, `button`) pass through unchanged
5666
- * - other fields get `value = values[key] ?? field.default ?? null`
5667
- *
5668
- * Unknown keys in `values` (keys not declared in the schema) are silently
5669
- * ignored — they don't contribute to the output. Missing keys fall back to
5670
- * the schema default or `null`. This mirrors the old backend behaviour where
5671
- * `FormBuilder` rendered `values[key] ?? field.default`.
5672
- */
5673
- function hydrateSchema(schema, values) {
5757
+ function hydrateSchema(schema, values, options = {}) {
5674
5758
  return {
5675
5759
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
5676
5760
  sections: schema.sections.map((section) => ({
5677
5761
  ...section,
5678
- fields: section.fields.map((field) => hydrateField(field, values))
5762
+ fields: section.fields.map((field) => hydrateField(field, values, options))
5679
5763
  }))
5680
5764
  };
5681
5765
  }
5682
- function hydrateField(field, values) {
5766
+ function hydrateField(field, values, options) {
5683
5767
  if (isValuelessField(field)) return field;
5684
5768
  if (field.type === "group") {
5685
- const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
5769
+ const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
5686
5770
  return {
5687
5771
  ...field,
5688
5772
  fields: hydratedChildren
@@ -5691,7 +5775,7 @@ function hydrateField(field, values) {
5691
5775
  if (field.type === "sub-tabs") {
5692
5776
  const hydratedTabs = field.tabs.map((tab) => ({
5693
5777
  ...tab,
5694
- fields: tab.fields.map((child) => hydrateField(child, values))
5778
+ fields: tab.fields.map((child) => hydrateField(child, values, options))
5695
5779
  }));
5696
5780
  return {
5697
5781
  ...field,
@@ -5701,6 +5785,33 @@ function hydrateField(field, values) {
5701
5785
  const key = field.key;
5702
5786
  const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
5703
5787
  const defaultValue = field.default;
5788
+ const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
5789
+ if (isKeychainStoredField(field) && asView(storedValue)) return {
5790
+ ...field,
5791
+ value: toSecretFieldView(storedValue)
5792
+ };
5793
+ if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
5794
+ ...field,
5795
+ value: null
5796
+ };
5797
+ if (field.type === "editable-array" && Array.isArray(storedValue)) {
5798
+ const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
5799
+ if (secretItemKeys.length > 0) {
5800
+ const rows = storedValue.map((row) => {
5801
+ if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
5802
+ const out = { ...row };
5803
+ for (const k of secretItemKeys) {
5804
+ const v = Reflect.get(row, k);
5805
+ if (asView(v)) out[k] = toSecretFieldView(v);
5806
+ }
5807
+ return out;
5808
+ });
5809
+ return {
5810
+ ...field,
5811
+ value: rows
5812
+ };
5813
+ }
5814
+ }
5704
5815
  if (field.multiple) {
5705
5816
  const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
5706
5817
  const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
@@ -5943,6 +6054,431 @@ function projectStore(store, perNodeKeys, nodeId) {
5943
6054
  }
5944
6055
  return out;
5945
6056
  }
6057
+ var GLOBAL_SCOPE = { kind: "global" };
6058
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6059
+ function globalSecretScope() {
6060
+ return GLOBAL_SCOPE;
6061
+ }
6062
+ function encodeSegment(value) {
6063
+ return encodeURIComponent(value);
6064
+ }
6065
+ /**
6066
+ * The field path of a value inside an array item, addressed by the item's id:
6067
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6068
+ * `providers[authentik].clientSecret`.
6069
+ */
6070
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6071
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6072
+ }
6073
+ /** A write to a secret path could not be stored in the keychain, so it was refused. */
6074
+ var KeychainWriteRefusedError = class extends Error {
6075
+ fieldPath;
6076
+ constructor(fieldPath, cause) {
6077
+ super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
6078
+ this.fieldPath = fieldPath;
6079
+ this.name = "KeychainWriteRefusedError";
6080
+ }
6081
+ };
6082
+ var KEEP = { kind: "keep" };
6083
+ function isRecord(value) {
6084
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6085
+ }
6086
+ function defaultMintId() {
6087
+ return globalThis.crypto.randomUUID();
6088
+ }
6089
+ /** Every marker ref anywhere under `value`. */
6090
+ function collectSecretMarkerRefs(value, out = []) {
6091
+ if (isSecretMarker(value)) {
6092
+ out.push(value.$secret);
6093
+ return out;
6094
+ }
6095
+ if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6096
+ else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6097
+ return out;
6098
+ }
6099
+ async function storedValueEquals(secrets, marker, candidate) {
6100
+ const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
6101
+ return resolved?.kind === "value" && resolved.value === candidate;
6102
+ }
6103
+ async function writeLeaf(ctx, incoming, stored, fieldPath) {
6104
+ const intent = classifySecretWrite(incoming);
6105
+ const ref = ctx.secrets.ref(ctx.scope, fieldPath);
6106
+ const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
6107
+ if (intent.kind === "keep") return KEEP;
6108
+ if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
6109
+ if (intent.kind === "clear") {
6110
+ if (storedIsOurs) ctx.deletes.push(ref);
6111
+ return {
6112
+ kind: "value",
6113
+ value: null
6114
+ };
6115
+ }
6116
+ if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
6117
+ kind: "value",
6118
+ value: stored
6119
+ };
6120
+ try {
6121
+ await ctx.secrets.put(ref, intent.value);
6122
+ } catch (err) {
6123
+ throw new KeychainWriteRefusedError(fieldPath, err);
6124
+ }
6125
+ return {
6126
+ kind: "value",
6127
+ value: makeSecretMarker(ref)
6128
+ };
6129
+ }
6130
+ /** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
6131
+ function applyMember(out, key, result, storedParent) {
6132
+ if (result.kind === "value") {
6133
+ out[key] = result.value;
6134
+ return;
6135
+ }
6136
+ if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
6137
+ else delete out[key];
6138
+ }
6139
+ async function writeMembers(ctx, children, incoming, stored, pathOf) {
6140
+ const out = { ...incoming };
6141
+ for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
6142
+ return out;
6143
+ }
6144
+ function rowId(row, idKey) {
6145
+ const raw = row[idKey];
6146
+ if (typeof raw === "string" && raw.length > 0) return raw;
6147
+ if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
6148
+ return null;
6149
+ }
6150
+ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6151
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6152
+ if (!Array.isArray(incoming)) {
6153
+ ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6154
+ return {
6155
+ kind: "value",
6156
+ value: incoming
6157
+ };
6158
+ }
6159
+ const storedById = /* @__PURE__ */ new Map();
6160
+ for (const row of storedRows) {
6161
+ const id = rowId(row, node.idKey);
6162
+ if (id !== null) storedById.set(id, row);
6163
+ }
6164
+ const kept = /* @__PURE__ */ new Set();
6165
+ const rows = [];
6166
+ for (const row of incoming) {
6167
+ if (!isRecord(row)) {
6168
+ rows.push(row);
6169
+ continue;
6170
+ }
6171
+ const id = rowId(row, node.idKey) ?? ctx.mintId();
6172
+ kept.add(id);
6173
+ const withId = {
6174
+ ...row,
6175
+ [node.idKey]: row[node.idKey] ?? id
6176
+ };
6177
+ if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
6178
+ const storedRow = storedById.get(id) ?? {};
6179
+ rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
6180
+ }
6181
+ for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
6182
+ return {
6183
+ kind: "value",
6184
+ value: rows
6185
+ };
6186
+ }
6187
+ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6188
+ switch (node.kind) {
6189
+ case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6190
+ case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6191
+ case "object": {
6192
+ if (!isRecord(incoming)) {
6193
+ if (incoming === void 0) return KEEP;
6194
+ ctx.deletes.push(...collectSecretMarkerRefs(stored));
6195
+ return {
6196
+ kind: "value",
6197
+ value: incoming
6198
+ };
6199
+ }
6200
+ const storedObj = isRecord(stored) ? stored : {};
6201
+ return {
6202
+ kind: "value",
6203
+ value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
6204
+ };
6205
+ }
6206
+ }
6207
+ }
6208
+ /** Split a perNode-scoped key (`key@nodeId`). */
6209
+ function splitNodeKey(key) {
6210
+ const at = key.indexOf("@");
6211
+ return at <= 0 ? {
6212
+ base: key,
6213
+ nodeId: null
6214
+ } : {
6215
+ base: key.slice(0, at),
6216
+ nodeId: key.slice(at + 1)
6217
+ };
6218
+ }
6219
+ /** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
6220
+ async function transformSecretWrite(input) {
6221
+ const deletes = [];
6222
+ const base = {
6223
+ secrets: input.secrets,
6224
+ mintId: input.mintId ?? defaultMintId,
6225
+ deletes,
6226
+ operatorWrite: input.operatorWrite === true
6227
+ };
6228
+ const out = {};
6229
+ for (const [key, incoming] of Object.entries(input.patch)) {
6230
+ const { base: baseKey, nodeId } = splitNodeKey(key);
6231
+ const node = input.tree.get(baseKey);
6232
+ if (node === void 0) {
6233
+ out[key] = incoming;
6234
+ continue;
6235
+ }
6236
+ const scope = nodeId !== null && nodeId.length > 0 ? {
6237
+ kind: "node",
6238
+ nodeId
6239
+ } : input.scope ?? globalSecretScope();
6240
+ const result = await writeNode({
6241
+ ...base,
6242
+ scope
6243
+ }, node, incoming, input.stored[key], baseKey);
6244
+ if (result.kind === "value") out[key] = result.value;
6245
+ }
6246
+ return {
6247
+ patch: out,
6248
+ afterWrite: async () => {
6249
+ if (deletes.length === 0) return { orphaned: [] };
6250
+ try {
6251
+ await input.secrets.delete([...new Set(deletes)]);
6252
+ return { orphaned: [] };
6253
+ } catch {
6254
+ return { orphaned: [...new Set(deletes)] };
6255
+ }
6256
+ }
6257
+ };
6258
+ }
6259
+ /**
6260
+ * Replace every marker in `value` with its keychain value. Returns the SAME
6261
+ * reference when there is no marker (no allocation, no keychain call).
6262
+ */
6263
+ async function resolveSecretMarkers(value, secrets) {
6264
+ const refs = collectSecretMarkerRefs(value);
6265
+ if (refs.length === 0) return {
6266
+ value,
6267
+ unresolved: []
6268
+ };
6269
+ const answers = await secrets.resolve(refs);
6270
+ const unresolved = [];
6271
+ for (const ref of new Set(refs)) {
6272
+ const answer = answers[ref];
6273
+ if (answer === void 0) unresolved.push({
6274
+ ref,
6275
+ reason: "not-initialized"
6276
+ });
6277
+ else if (answer.kind === "unavailable") unresolved.push({
6278
+ ref,
6279
+ reason: answer.reason
6280
+ });
6281
+ else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
6282
+ ref,
6283
+ reason: answer.kind
6284
+ });
6285
+ }
6286
+ const substitute = (v) => {
6287
+ if (isSecretMarker(v)) {
6288
+ const answer = answers[v.$secret];
6289
+ return answer?.kind === "value" ? {
6290
+ keep: true,
6291
+ value: answer.value
6292
+ } : {
6293
+ keep: false,
6294
+ value: void 0
6295
+ };
6296
+ }
6297
+ if (Array.isArray(v)) {
6298
+ const items = [];
6299
+ for (const item of v) {
6300
+ const s = substitute(item);
6301
+ if (s.keep) items.push(s.value);
6302
+ }
6303
+ return {
6304
+ keep: true,
6305
+ value: items
6306
+ };
6307
+ }
6308
+ if (isRecord(v)) {
6309
+ const out = {};
6310
+ for (const [k, child] of Object.entries(v)) {
6311
+ const s = substitute(child);
6312
+ if (s.keep) out[k] = s.value;
6313
+ }
6314
+ return {
6315
+ keep: true,
6316
+ value: out
6317
+ };
6318
+ }
6319
+ return {
6320
+ keep: true,
6321
+ value: v
6322
+ };
6323
+ };
6324
+ return {
6325
+ value: substitute(value).value,
6326
+ unresolved
6327
+ };
6328
+ }
6329
+ function touchesTree(tree, patch) {
6330
+ if (tree.size === 0) return false;
6331
+ for (const key of Object.keys(patch)) {
6332
+ const at = key.indexOf("@");
6333
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6334
+ }
6335
+ return false;
6336
+ }
6337
+ /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6338
+ async function readStoredAddonBlob(raw) {
6339
+ const threeWay = raw.readAddonStoreResult;
6340
+ if (threeWay === void 0) return raw.readAddonStore();
6341
+ const result = await threeWay.call(raw);
6342
+ if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6343
+ return result.kind === "missing" ? {} : result.value;
6344
+ }
6345
+ function createSecretAwareSettings(raw, opts) {
6346
+ const chains = /* @__PURE__ */ new Map();
6347
+ const serialize = (key, fn) => {
6348
+ const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
6349
+ const tail = next.catch(() => void 0);
6350
+ chains.set(key, tail);
6351
+ tail.then(() => {
6352
+ if (chains.get(key) === tail) chains.delete(key);
6353
+ });
6354
+ return next;
6355
+ };
6356
+ const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6357
+ if (!touchesTree(tree, patch)) return rawWrite(patch);
6358
+ return serialize(chainKey, async () => {
6359
+ const stored = await readStored();
6360
+ const result = await transformSecretWrite({
6361
+ tree,
6362
+ secrets: opts.secrets,
6363
+ patch,
6364
+ stored,
6365
+ ...scope !== void 0 ? { scope } : {},
6366
+ operatorWrite: opts.isOperatorWrite?.() === true
6367
+ });
6368
+ if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6369
+ const { orphaned } = await result.afterWrite();
6370
+ if (orphaned.length > 0) opts.onOrphaned(orphaned);
6371
+ });
6372
+ };
6373
+ const wrapped = {
6374
+ writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6375
+ writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6376
+ kind: "device",
6377
+ deviceId
6378
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6379
+ };
6380
+ return new Proxy(raw, { get(target, prop, receiver) {
6381
+ if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6382
+ if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6383
+ const value = Reflect.get(target, prop, receiver);
6384
+ return typeof value === "function" ? value.bind(target) : value;
6385
+ } });
6386
+ }
6387
+ /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6388
+ function withSecretAwareSettings(context, opts) {
6389
+ const raw = context.settings;
6390
+ if (raw === void 0) return context;
6391
+ const settings = createSecretAwareSettings(raw, opts);
6392
+ return new Proxy(context, { get(target, prop, receiver) {
6393
+ if (prop === "settings") return settings;
6394
+ return Reflect.get(target, prop, receiver);
6395
+ } });
6396
+ }
6397
+ var LEAF = { kind: "leaf" };
6398
+ var DEFAULT_ITEM_ID_KEY = "id";
6399
+ function collectFields(fields, out) {
6400
+ for (const field of fields) {
6401
+ if (field.type === "group") {
6402
+ collectFields(field.fields, out);
6403
+ continue;
6404
+ }
6405
+ if (field.type === "sub-tabs") {
6406
+ for (const tab of field.tabs) collectFields(tab.fields, out);
6407
+ continue;
6408
+ }
6409
+ if (field.type === "editable-array") {
6410
+ const item = /* @__PURE__ */ new Map();
6411
+ for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
6412
+ if (item.size > 0) out.set(field.key, {
6413
+ kind: "array",
6414
+ idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
6415
+ item
6416
+ });
6417
+ continue;
6418
+ }
6419
+ if (!("key" in field) || typeof field.key !== "string") continue;
6420
+ if (isKeychainStoredField(field)) out.set(field.key, LEAF);
6421
+ }
6422
+ }
6423
+ /** The secret tree a settings schema declares. */
6424
+ function secretTreeFromSchema(schema) {
6425
+ const out = /* @__PURE__ */ new Map();
6426
+ if (schema === null) return out;
6427
+ for (const section of schema.sections) collectFields(section.fields, out);
6428
+ return out;
6429
+ }
6430
+ /** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
6431
+ function parseSecretStatePath(path) {
6432
+ const segments = [];
6433
+ for (const raw of path.split(".")) {
6434
+ const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
6435
+ if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
6436
+ segments.push(m[2] !== void 0 ? {
6437
+ key: m[1],
6438
+ idKey: m[2]
6439
+ } : { key: m[1] });
6440
+ }
6441
+ if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
6442
+ if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
6443
+ return segments;
6444
+ }
6445
+ function insert(into, segments) {
6446
+ const [head, ...rest] = segments;
6447
+ if (head === void 0) return;
6448
+ if (rest.length === 0) {
6449
+ into.set(head.key, LEAF);
6450
+ return;
6451
+ }
6452
+ const existing = into.get(head.key);
6453
+ if (head.idKey !== void 0) {
6454
+ const item = new Map(existing?.kind === "array" ? existing.item : []);
6455
+ insert(item, rest);
6456
+ into.set(head.key, {
6457
+ kind: "array",
6458
+ idKey: head.idKey,
6459
+ item
6460
+ });
6461
+ return;
6462
+ }
6463
+ const children = new Map(existing?.kind === "object" ? existing.children : []);
6464
+ insert(children, rest);
6465
+ into.set(head.key, {
6466
+ kind: "object",
6467
+ children
6468
+ });
6469
+ }
6470
+ /** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
6471
+ function mergeSecretStatePaths(tree, paths) {
6472
+ if (paths.length === 0) return tree;
6473
+ const out = new Map(tree);
6474
+ for (const path of paths) insert(out, parseSecretStatePath(path));
6475
+ return out;
6476
+ }
6477
+ /** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
6478
+ var SECRET_RETRY_FIRST_MS = 5e3;
6479
+ var SECRET_RETRY_MAX_MS = 5 * 6e4;
6480
+ /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
6481
+ var SECRET_CHANGE_DEBOUNCE_MS = 250;
5946
6482
  /**
5947
6483
  * Base class for CamStack addons. Eliminates settings boilerplate:
5948
6484
  *
@@ -6012,6 +6548,25 @@ var BaseAddon = class {
6012
6548
  settingsStoreReady = false;
6013
6549
  /** Default config values. Provided via constructor. */
6014
6550
  defaults;
6551
+ /**
6552
+ * Hidden-state paths that hold secrets (D787) — values the addon writes
6553
+ * itself (`updateGlobalSettings`, `state()`) that no form field declares.
6554
+ * Stored in the keychain exactly like a `password` field. Syntax:
6555
+ * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
6556
+ * (`key[<id field>]` addresses array items by id, never by index).
6557
+ */
6558
+ secretStatePaths = [];
6559
+ _addonSecretTree = null;
6560
+ _deviceSecretTree = null;
6561
+ /** Refs the last resolved config pointed at — a change to one re-resolves. */
6562
+ _configSecretRefs = /* @__PURE__ */ new Set();
6563
+ _unresolvedSecrets = [];
6564
+ _secretRetryTimer = null;
6565
+ _secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
6566
+ _secretChangeTimer = null;
6567
+ _secretChangeUnsub = null;
6568
+ /** >0 while an OPERATOR's settings write is being applied. */
6569
+ _operatorWriteDepth = 0;
6015
6570
  constructor(defaults) {
6016
6571
  this.defaults = defaults;
6017
6572
  this._config = { ...defaults };
@@ -6047,8 +6602,18 @@ var BaseAddon = class {
6047
6602
  return this._config;
6048
6603
  }
6049
6604
  async initialize(context) {
6050
- this._ctx = context;
6605
+ const secrets = context.secrets;
6606
+ this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6607
+ secrets,
6608
+ addonTree: () => this.addonSecretTree(),
6609
+ deviceTree: () => this.deviceSecretTree(),
6610
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6611
+ isOperatorWrite: () => this._operatorWriteDepth > 0
6612
+ }) : context;
6051
6613
  await this.resolveConfig();
6614
+ if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6615
+ if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
6616
+ });
6052
6617
  const result = await this.onInitialize();
6053
6618
  this.emitLifecycle(EventCategory.AddonStarted);
6054
6619
  const normalized = normalizeAddonInitResult(result);
@@ -6081,6 +6646,12 @@ var BaseAddon = class {
6081
6646
  */
6082
6647
  async onHubReachable() {}
6083
6648
  async shutdown() {
6649
+ this._secretChangeUnsub?.();
6650
+ this._secretChangeUnsub = null;
6651
+ if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
6652
+ if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
6653
+ this._secretRetryTimer = null;
6654
+ this._secretChangeTimer = null;
6084
6655
  this.emitLifecycle(EventCategory.AddonStopped);
6085
6656
  if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
6086
6657
  await this.onShutdown();
@@ -6159,7 +6730,7 @@ var BaseAddon = class {
6159
6730
  return hydrateSchema(schema, overlay ? {
6160
6731
  ...projected,
6161
6732
  ...overlay
6162
- } : projected);
6733
+ } : projected, { inlineSecretsAsViews: true });
6163
6734
  }
6164
6735
  /**
6165
6736
  * The integration-level view of this addon's settings: exactly the sections
@@ -6208,7 +6779,7 @@ var BaseAddon = class {
6208
6779
  return hydrateSchema({
6209
6780
  ...schema,
6210
6781
  sections
6211
- }, projected);
6782
+ }, projected, { inlineSecretsAsViews: true });
6212
6783
  }
6213
6784
  /**
6214
6785
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -6262,18 +6833,50 @@ var BaseAddon = class {
6262
6833
  value: result.value[key]
6263
6834
  };
6264
6835
  }
6836
+ /**
6837
+ * The OPERATOR's write — a settings form or an admin API call, dispatched by
6838
+ * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
6839
+ * the operator sends is stored as sent even when it equals a pre-keychain
6840
+ * inline value: the operator re-entering a password is a change, an addon
6841
+ * writing back what it read is not (D787).
6842
+ */
6843
+ async updateGlobalSettingsAsOperator(patch, nodeId) {
6844
+ this._operatorWriteDepth++;
6845
+ try {
6846
+ await this.applyGlobalPatch(patch, nodeId);
6847
+ } finally {
6848
+ this._operatorWriteDepth--;
6849
+ }
6850
+ }
6265
6851
  async updateGlobalSettings(patch, nodeId) {
6852
+ await this.applyGlobalPatch(patch, nodeId);
6853
+ }
6854
+ /**
6855
+ * REMOVE stored secrets — their keychain values and their markers (D787).
6856
+ *
6857
+ * Writing `''` to a secret field KEEPS what is stored (an empty string is
6858
+ * what a defaults fallback writes back, and it must never destroy a
6859
+ * credential), so code that means "forget this token" says so here. Without
6860
+ * a keychain (an older kernel) it writes `''`, as such code always did.
6861
+ */
6862
+ async clearSecrets(keys, nodeId) {
6863
+ const tree = this.addonSecretTree();
6864
+ const keychain = this._ctx?.secrets !== void 0;
6865
+ const patch = {};
6866
+ for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
6867
+ await this.applyGlobalPatch(patch, nodeId);
6868
+ }
6869
+ async applyGlobalPatch(barePatch, nodeId) {
6266
6870
  const keys = this.perNodeKeys();
6267
6871
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6268
6872
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6269
- const barePatch = patch;
6270
6873
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6271
6874
  await this._ctx?.settings?.writeAddonStore(scoped);
6272
6875
  if (target !== localNode) return;
6273
6876
  await this.resolveConfig();
6274
6877
  await this.onConfigChanged();
6275
6878
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
6276
- this.maybeAutoRestart(patch, this.globalSettingsSchema());
6879
+ this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
6277
6880
  }
6278
6881
  /**
6279
6882
  * The set of field keys the global settings schema declares `perNode: true`
@@ -6298,7 +6901,7 @@ var BaseAddon = class {
6298
6901
  * time to return its response before the addon is torn down and
6299
6902
  * re-initialised by `AddonRegistryService.restartAddon`.
6300
6903
  */
6301
- maybeAutoRestart(patch, schema) {
6904
+ maybeAutoRestart(patchKeys, schema) {
6302
6905
  if (!schema) return;
6303
6906
  const restartKeys = /* @__PURE__ */ new Set();
6304
6907
  for (const section of schema.sections) for (const field of section.fields) {
@@ -6306,13 +6909,13 @@ var BaseAddon = class {
6306
6909
  if (field.requiresRestart) restartKeys.add(field.key);
6307
6910
  }
6308
6911
  if (restartKeys.size === 0) return;
6309
- if (!Object.keys(patch).some((k) => restartKeys.has(k))) return;
6912
+ if (!patchKeys.some((k) => restartKeys.has(k))) return;
6310
6913
  const ctx = this._ctx;
6311
6914
  if (!ctx) return;
6312
6915
  const addonId = ctx.id;
6313
6916
  setImmediate(() => {
6314
6917
  ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
6315
- ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: Object.keys(patch).filter((k) => restartKeys.has(k)) } });
6918
+ ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
6316
6919
  }).catch((err) => {
6317
6920
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
6318
6921
  });
@@ -6321,7 +6924,7 @@ var BaseAddon = class {
6321
6924
  async getDeviceSettings(deviceId) {
6322
6925
  const schema = this.deviceSettingsSchema();
6323
6926
  if (!schema) return { sections: [] };
6324
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
6927
+ return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6325
6928
  }
6326
6929
  async updateDeviceSettings(deviceId, patch) {
6327
6930
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -6451,7 +7054,7 @@ var BaseAddon = class {
6451
7054
  * selection at boot (absent scoped key ⇒ the constructor default wins).
6452
7055
  */
6453
7056
  async resolveConfig() {
6454
- const stored = await this.readAddonStoreWithRetry();
7057
+ const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
6455
7058
  const perNode = this.perNodeKeys();
6456
7059
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6457
7060
  const resolved = { ...this.defaults };
@@ -6476,7 +7079,7 @@ var BaseAddon = class {
6476
7079
  key,
6477
7080
  schema,
6478
7081
  fallback,
6479
- read: () => this.readAddonStoreWithRetry(),
7082
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
6480
7083
  write: async (patch) => {
6481
7084
  await this._ctx?.settings?.writeAddonStore(patch);
6482
7085
  },
@@ -6493,7 +7096,7 @@ var BaseAddon = class {
6493
7096
  key,
6494
7097
  schema,
6495
7098
  fallback,
6496
- read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
7099
+ read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
6497
7100
  write: async (patch) => {
6498
7101
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
6499
7102
  },
@@ -6505,6 +7108,70 @@ var BaseAddon = class {
6505
7108
  } })
6506
7109
  });
6507
7110
  }
7111
+ /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
7112
+ addonSecretTree() {
7113
+ this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
7114
+ return this._addonSecretTree;
7115
+ }
7116
+ deviceSecretTree() {
7117
+ this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7118
+ return this._deviceSecretTree;
7119
+ }
7120
+ /**
7121
+ * Secrets of this addon's stored config that could not be resolved on the
7122
+ * last read, with why. Non-empty means the addon is running WITHOUT them —
7123
+ * an addon whose function needs one should report itself degraded rather
7124
+ * than start on an empty credential.
7125
+ */
7126
+ get unresolvedSecrets() {
7127
+ return this._unresolvedSecrets;
7128
+ }
7129
+ /**
7130
+ * Substitute every keychain marker in a stored blob with its value. With no
7131
+ * keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
7132
+ * An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
7133
+ * value — and, when the cause can pass, retried with backoff. Nothing is
7134
+ * ever written back from here.
7135
+ */
7136
+ async resolveStoredSecrets(blob, trackForConfig = true) {
7137
+ const secrets = this._ctx?.secrets;
7138
+ if (secrets === void 0) return blob;
7139
+ const refs = collectSecretMarkerRefs(blob);
7140
+ if (trackForConfig) this._configSecretRefs = new Set(refs);
7141
+ if (refs.length === 0) {
7142
+ if (trackForConfig) this._unresolvedSecrets = [];
7143
+ return blob;
7144
+ }
7145
+ const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
7146
+ if (trackForConfig) {
7147
+ this._unresolvedSecrets = unresolved;
7148
+ if (unresolved.length > 0) {
7149
+ this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
7150
+ ref: u.ref,
7151
+ reason: u.reason
7152
+ })) } });
7153
+ if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
7154
+ this.scheduleSecretReresolve(this._secretRetryDelayMs);
7155
+ this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
7156
+ }
7157
+ } else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
7158
+ }
7159
+ return value;
7160
+ }
7161
+ /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7162
+ scheduleSecretReresolve(delayMs) {
7163
+ const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
7164
+ if (this[timerOf] !== null) return;
7165
+ const timer = setTimeout(() => {
7166
+ this[timerOf] = null;
7167
+ if (this._ctx === null) return;
7168
+ this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
7169
+ this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
7170
+ });
7171
+ }, delayMs);
7172
+ timer.unref?.();
7173
+ this[timerOf] = timer;
7174
+ }
6508
7175
  /**
6509
7176
  * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
6510
7177
  * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
@@ -7080,6 +7747,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
7080
7747
  kind: "mutation",
7081
7748
  auth: "admin"
7082
7749
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
7750
+ function defOf(schema) {
7751
+ return schema._zod?.def ?? {};
7752
+ }
7753
+ function declaredHere(schema) {
7754
+ return globalRegistry.get(schema)?.secret === true;
7755
+ }
7756
+ /** Wrapper kinds whose `innerType` is the field itself. */
7757
+ var WRAPPERS = new Set([
7758
+ "optional",
7759
+ "nullable",
7760
+ "default",
7761
+ "prefault",
7762
+ "catch",
7763
+ "readonly",
7764
+ "nonoptional"
7765
+ ]);
7766
+ /**
7767
+ * The schema layers that make up ONE field: the schema itself and every
7768
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
7769
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
7770
+ * `.transform` on `in`).
7771
+ */
7772
+ function layersOf(schema) {
7773
+ const out = [];
7774
+ const queue = [schema];
7775
+ while (queue.length > 0) {
7776
+ const s = queue.shift();
7777
+ if (!s || out.includes(s)) continue;
7778
+ out.push(s);
7779
+ const def = defOf(s);
7780
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
7781
+ if (def.type === "pipe") {
7782
+ if (def.in) queue.push(def.in);
7783
+ if (def.out) queue.push(def.out);
7784
+ }
7785
+ }
7786
+ return out;
7787
+ }
7788
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
7789
+ function isZodSecret(schema) {
7790
+ return layersOf(schema).some(declaredHere);
7791
+ }
7792
+ /**
7793
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
7794
+ * element of this array" (`connection.password`, `rows[].token`). A declared
7795
+ * object or array is reported as one path and not descended into — everything
7796
+ * under it is secret.
7797
+ */
7798
+ function collectZodSecretPaths(schema, prefix = "") {
7799
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
7800
+ const paths = [];
7801
+ for (const layer of layersOf(schema)) {
7802
+ const def = defOf(layer);
7803
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
7804
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
7805
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
7806
+ else if (def.type === "intersection") {
7807
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
7808
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
7809
+ }
7810
+ }
7811
+ return [...new Set(paths)];
7812
+ }
7083
7813
  //#endregion
7084
7814
  //#region ../types/dist/err-msg-DX6i_MY4.mjs
7085
7815
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
@@ -14110,6 +14840,196 @@ id: union([string(), number()]) }), {
14110
14840
  kind: "mutation",
14111
14841
  auth: "admin"
14112
14842
  });
14843
+ /**
14844
+ * `keychain` — the hub's encrypted store of secret values (D787).
14845
+ *
14846
+ * Settings blobs never hold a secret: they hold a marker
14847
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
14848
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
14849
+ * is the OWNER's door to its own values: every method is owner-checked
14850
+ * against the CALLER, never against anything the caller claims.
14851
+ *
14852
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
14853
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
14854
+ * connection, the agent from its child's connection carried in
14855
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
14856
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
14857
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
14858
+ * identity against BUGS and misrouting, not against a malicious addon (every
14859
+ * runner is the same OS user): see the threat model in
14860
+ * `docs/design/2026-10-08-secrets-keychain.md`.
14861
+ *
14862
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
14863
+ * parses the input, so a session can never supply it, and the internal mount
14864
+ * floors every method to admin anyway (D240).
14865
+ *
14866
+ * Internal: addons reach it through `ctx.secrets`, never directly.
14867
+ */
14868
+ /** Why a value cannot be served right now. Never folded into "missing". */
14869
+ var KeychainUnavailableReasonSchema = _enum([
14870
+ "key-missing",
14871
+ "wrong-key",
14872
+ "key-file-unreadable",
14873
+ "store-unavailable",
14874
+ "not-initialized",
14875
+ "decrypt-failed"
14876
+ ]);
14877
+ var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
14878
+ state: literal("locked"),
14879
+ reason: KeychainUnavailableReasonSchema
14880
+ })]);
14881
+ var KeychainResolveEntrySchema = discriminatedUnion("kind", [
14882
+ object({
14883
+ kind: literal("value"),
14884
+ value: string(),
14885
+ version: number().int()
14886
+ }),
14887
+ object({ kind: literal("missing") }),
14888
+ object({
14889
+ kind: literal("unavailable"),
14890
+ reason: KeychainUnavailableReasonSchema
14891
+ }),
14892
+ object({ kind: literal("forbidden") })
14893
+ ]);
14894
+ var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
14895
+ /** Metadata of one stored value — never the value. */
14896
+ var KeychainSecretMetaSchema = object({
14897
+ ref: string(),
14898
+ owner: string(),
14899
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
14900
+ scope: string(),
14901
+ fieldPath: string(),
14902
+ version: number().int(),
14903
+ createdAt: number(),
14904
+ updatedAt: number(),
14905
+ /** `addon:<id>` | `user:<id>` | `system`. */
14906
+ updatedBy: string(),
14907
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
14908
+ lastReadAt: number().nullable()
14909
+ });
14910
+ var RefListSchema = array(string().min(1)).max(512);
14911
+ method(object({
14912
+ ref: string().min(1),
14913
+ value: string().min(1)
14914
+ }), object({
14915
+ ref: string(),
14916
+ version: number().int()
14917
+ }), {
14918
+ kind: "mutation",
14919
+ auth: "admin"
14920
+ }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
14921
+ kind: "mutation",
14922
+ auth: "admin"
14923
+ }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
14924
+ var KeychainKeySourceSchema = object({
14925
+ kind: _enum([
14926
+ "config-file",
14927
+ "previous-config-file",
14928
+ "platform",
14929
+ "default-file"
14930
+ ]),
14931
+ /** File sources only — a path is not a secret. */
14932
+ path: string().optional(),
14933
+ /**
14934
+ * True when a whole-volume backup of the data directory carries this key
14935
+ * next to the database it protects (the default file). The page warns.
14936
+ */
14937
+ sharesBackupWithDatabase: boolean()
14938
+ });
14939
+ var KeychainStatusSchema = object({
14940
+ keychain: KeychainStateSchema,
14941
+ /** The source of the master key in use; `null` while locked. */
14942
+ keySource: KeychainKeySourceSchema.nullable(),
14943
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
14944
+ configuredSource: KeychainKeySourceSchema,
14945
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
14946
+ fingerprint: string().nullable(),
14947
+ activeKeyId: string().nullable(),
14948
+ /**
14949
+ * The keychain unlocked with a NON-primary source: the configured primary
14950
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
14951
+ */
14952
+ rotationPending: boolean(),
14953
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
14954
+ retiredWraps: number().int(),
14955
+ recoveryKeyDownloadedAt: number().nullable(),
14956
+ secretCount: number().int()
14957
+ });
14958
+ /**
14959
+ * Whether a stored value is still pointed at by its owner's settings.
14960
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
14961
+ * never reported as an orphan (and never deleted as one).
14962
+ */
14963
+ var KeychainSecretUsageSchema = _enum([
14964
+ "in-use",
14965
+ "orphan",
14966
+ "unknown"
14967
+ ]);
14968
+ var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
14969
+ var KeychainAuditActionSchema = _enum([
14970
+ "put",
14971
+ "delete",
14972
+ "reveal",
14973
+ "rotate-master-key",
14974
+ "purge-retired-keys",
14975
+ "download-recovery-key",
14976
+ "delete-orphans",
14977
+ "reset",
14978
+ "initialize"
14979
+ ]);
14980
+ var KeychainAuditEntrySchema = object({
14981
+ id: string(),
14982
+ at: number(),
14983
+ action: KeychainAuditActionSchema,
14984
+ /** `addon:<id>` | `user:<id>` | `system`. */
14985
+ actor: string(),
14986
+ ref: string().nullable(),
14987
+ detail: string().nullable()
14988
+ });
14989
+ 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({
14990
+ value: string(),
14991
+ version: number().int()
14992
+ }), {
14993
+ kind: "mutation",
14994
+ auth: "admin",
14995
+ caller: "required"
14996
+ }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
14997
+ deleted: array(string()).readonly(),
14998
+ kept: array(object({
14999
+ ref: string(),
15000
+ usage: KeychainSecretUsageSchema
15001
+ })).readonly()
15002
+ }), {
15003
+ kind: "mutation",
15004
+ auth: "admin",
15005
+ caller: "required"
15006
+ }), method(object({}), object({
15007
+ fingerprint: string(),
15008
+ keySource: KeychainKeySourceSchema
15009
+ }), {
15010
+ kind: "mutation",
15011
+ auth: "admin",
15012
+ caller: "required"
15013
+ }), method(object({}), object({ purged: number().int() }), {
15014
+ kind: "mutation",
15015
+ auth: "admin",
15016
+ caller: "required"
15017
+ }), method(object({}), object({
15018
+ key: string(),
15019
+ fingerprint: string(),
15020
+ keySource: KeychainKeySourceSchema
15021
+ }), {
15022
+ kind: "mutation",
15023
+ auth: "admin",
15024
+ caller: "required"
15025
+ }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15026
+ archivedCollection: string().nullable(),
15027
+ archived: number().int()
15028
+ }), {
15029
+ kind: "mutation",
15030
+ auth: "admin",
15031
+ caller: "required"
15032
+ });
14113
15033
  method(_void(), object({
14114
15034
  id: string(),
14115
15035
  name: string(),
@@ -15132,6 +16052,10 @@ var DeviceInfoSchema = object({
15132
16052
  isCamera: boolean(),
15133
16053
  /** Current config values — serializable snapshot */
15134
16054
  config: record(string(), unknown()),
16055
+ /** Paths inside `config` the device's schema declares secret (D783) —
16056
+ * what the non-admin redaction withholds. Paths, never values. Absent
16057
+ * when the owning runner has not reported them. */
16058
+ secretConfigPaths: array(string()).optional(),
15135
16059
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
15136
16060
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
15137
16061
  metadata: record(string(), unknown()).nullable().optional(),
@@ -15337,12 +16261,22 @@ var DeviceRegisterPayloadSchema = object({
15337
16261
  * call (workers re-register on init), so probe-driven updates
15338
16262
  * (e.g. PTZ flag flipping after the abilities probe) propagate. */
15339
16263
  features: array(string()).optional(),
15340
- config: record(string(), unknown())
16264
+ config: record(string(), unknown()),
16265
+ /** Config paths the device's own schema DECLARES secret
16266
+ * (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
16267
+ * `connection.password`). Re-published on every register; the non-admin
16268
+ * redaction withholds them at any depth (D783). Optional: an older runner
16269
+ * omits it and the keyword backstop applies. */
16270
+ secretConfigPaths: array(string()).optional()
15341
16271
  });
15342
16272
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
15343
16273
  var DevicePersistConfigPayloadSchema = object({
15344
16274
  deviceId: number(),
15345
- data: record(string(), unknown())
16275
+ data: record(string(), unknown()),
16276
+ /** The paths the device's schema declares secret (D783), when the caller
16277
+ * knows them — those values are kept in the keychain, not the blob (D787).
16278
+ * Absent: the paths the device last reported at `registerDevice` apply. */
16279
+ secretConfigPaths: array(string()).optional()
15346
16280
  });
15347
16281
  /** What a migration actually did, per switch. `unreachable` is a first-class
15348
16282
  * answer: a camera that could not be asked is not a camera that was silenced. */
@@ -16996,7 +17930,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
16996
17930
  icon: string().optional(),
16997
17931
  /** Addon-owned HTTP route the button navigates to (GET). */
16998
17932
  startUrl: string(),
16999
- stage: LoginStageEnum
17933
+ stage: LoginStageEnum,
17934
+ /**
17935
+ * The provider names an external identity a signed-in user can link to
17936
+ * their own account (D782): `auth.listLinkableProviders` /
17937
+ * `beginExternalLink` offer exactly the redirect methods that set this,
17938
+ * whatever their id. Absent / false — a login button only (magic-link).
17939
+ */
17940
+ linkable: boolean().optional()
17000
17941
  }),
17001
17942
  object({
17002
17943
  kind: literal("widget"),
@@ -22352,8 +23293,23 @@ var RetrainMacroClassSchema = _enum([
22352
23293
  ]);
22353
23294
  /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
22354
23295
  var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
22355
- /** Did a human draw this box, or did the assist propose it? */
22356
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
23296
+ /**
23297
+ * Where a box came from. A machine-sourced box is a DRAFT on the page until
23298
+ * the operator confirms it; once saved it keeps its source as provenance.
23299
+ *
23300
+ * - `operator` — drawn by hand.
23301
+ * - `assist` — proposed by a detector run on the copy (the camera's own
23302
+ * model, or a larger teacher model).
23303
+ * - `pipeline` — the box the live pipeline actually drew on that frame, read
23304
+ * back from the track store (never a re-run).
23305
+ * - `llm` — proposed by a vision-capable LLM profile.
23306
+ */
23307
+ var RetrainAnnotationSourceSchema = _enum([
23308
+ "operator",
23309
+ "assist",
23310
+ "pipeline",
23311
+ "llm"
23312
+ ]);
22357
23313
  /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
22358
23314
  var RetrainBboxSchema = object({
22359
23315
  x: number(),
@@ -22371,7 +23327,8 @@ var RetrainBboxSchema = object({
22371
23327
  */
22372
23328
  var RetrainAnnotationSchema = object({
22373
23329
  id: string(),
22374
- trackId: string(),
23330
+ /** The frame's track. Absent on a recording still, which has none. */
23331
+ trackId: string().optional(),
22375
23332
  deviceId: number(),
22376
23333
  /** The COPY in retrain storage — never the source track's media key. */
22377
23334
  mediaKey: string(),
@@ -22420,18 +23377,63 @@ var RetrainFrameCandidateSchema = object({
22420
23377
  * fail, whatever became of the original. */
22421
23378
  copied: boolean()
22422
23379
  });
23380
+ /**
23381
+ * One box the live pipeline drew on a copied frame — what a correction starts
23382
+ * from. Derived when the frame is listed, from the track store: the subject
23383
+ * box recorded on the source media row when there is one, else the track
23384
+ * position nearest the frame's capture time. Never stored as an annotation
23385
+ * until the operator confirms it.
23386
+ */
23387
+ var RetrainPipelineBoxSchema = object({
23388
+ /** Normalised `[0,1]` against the full frame. */
23389
+ bbox: RetrainBboxSchema,
23390
+ macroClass: RetrainMacroClassSchema,
23391
+ label: string().optional(),
23392
+ subLabel: string().optional(),
23393
+ /** The detection score of the position used, when it was recorded. */
23394
+ score: number().optional(),
23395
+ /** The root model that produced the track, when it was recorded. */
23396
+ modelId: string().optional(),
23397
+ trackId: string(),
23398
+ /** `subject-box`: recorded on this very frame. `position`: the track's
23399
+ * position nearest the capture time, `deltaMs` away. */
23400
+ basis: _enum(["subject-box", "position"]),
23401
+ deltaMs: number()
23402
+ });
23403
+ /**
23404
+ * Where a retrain frame came from: a TRACK's stored media (copy-on-select),
23405
+ * or the RECORDING at an instant — the frame a model saw nothing in has no
23406
+ * track at all.
23407
+ */
23408
+ var RetrainFrameOriginSchema = _enum(["track", "recording"]);
22423
23409
  /** A frame the dataset OWNS: bytes copied at selection time. */
22424
23410
  var RetrainFrameSchema = object({
22425
23411
  frameId: string(),
22426
23412
  deviceId: number(),
22427
- trackId: string(),
22428
- /** Provenance only. It may already point at nothing — that is expected. */
22429
- sourceMediaId: number().int(),
23413
+ origin: RetrainFrameOriginSchema,
23414
+ /** The track it was copied from. Absent on a recording still. */
23415
+ trackId: string().optional(),
23416
+ /** Provenance only. It may already point at nothing — that is expected.
23417
+ * Absent on a recording still. */
23418
+ sourceMediaId: number().int().optional(),
23419
+ /** A recording still: the playhead instant it was taken at. */
23420
+ epochMs: number().optional(),
22430
23421
  sourceKind: MediaFileKindEnum,
22431
23422
  sizeBytes: number().int(),
22432
23423
  width: number().int(),
22433
23424
  height: number().int(),
22434
- copiedAt: number()
23425
+ copiedAt: number(),
23426
+ /** When the CAMERA captured the frame. Absent on a copy taken before D785. */
23427
+ capturedAt: number().optional(),
23428
+ /** The operator's "every subject in this frame is boxed". Detector
23429
+ * evaluation keeps only complete frames: an unboxed subject would count as
23430
+ * a false positive. */
23431
+ complete: boolean(),
23432
+ /** The boxes the pipeline drew on this frame. Present on list answers;
23433
+ * empty when nothing the track store holds can be placed on it. */
23434
+ pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
23435
+ /** The named collections this frame belongs to. Present on list answers. */
23436
+ collectionIds: array(string()).readonly().optional()
22435
23437
  });
22436
23438
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
22437
23439
  var RetrainCopyRefusalSchema = _enum([
@@ -22452,6 +23454,53 @@ var RetrainFrameListSchema = object({
22452
23454
  /** What the page pre-selects — the native key frame when one survives. */
22453
23455
  autoPickMediaId: number().int().optional()
22454
23456
  });
23457
+ /**
23458
+ * Which frames an annotated export carries. Every field narrows; an empty
23459
+ * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23460
+ * list owned by whoever trains (the training orchestrator), so `frameIds` is
23461
+ * the primitive a version export uses; `batchId` re-selects what an earlier
23462
+ * export carried (`exportedInBatch`).
23463
+ */
23464
+ var RetrainExportFilterSchema = object({
23465
+ deviceIds: array(number()).optional(),
23466
+ frameIds: array(string()).max(2e4).optional(),
23467
+ /** Only frames in at least one of these named collections. */
23468
+ collectionIds: array(string()).max(200).optional(),
23469
+ batchId: string().optional(),
23470
+ /** Only frames the operator marked complete (all subjects boxed). */
23471
+ completeOnly: boolean().optional()
23472
+ });
23473
+ /**
23474
+ * `frames`: the full frame copies, boxes in `annotations.json`.
23475
+ * `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
23476
+ * convention — the classifier layout.
23477
+ */
23478
+ var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
23479
+ /**
23480
+ * Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
23481
+ * the archive, sent chunk by chunk. Covers a presigned PUT and a provider
23482
+ * addon's data-plane upload route alike. Headers are sent verbatim and never
23483
+ * logged.
23484
+ */
23485
+ var RetrainArchiveTargetSchema = object({
23486
+ kind: literal("http"),
23487
+ method: _enum(["PUT", "POST"]),
23488
+ url: string().url(),
23489
+ headers: record(string(), string()).optional()
23490
+ });
23491
+ var RetrainArchiveResultSchema = object({
23492
+ batchId: string(),
23493
+ frames: number().int(),
23494
+ crops: number().int(),
23495
+ annotations: number().int(),
23496
+ /** Frames planned but not shipped (unreadable copy, path too long). */
23497
+ missing: number().int(),
23498
+ bytes: number().int(),
23499
+ /** sha256 of the exact bytes sent. */
23500
+ sha256: string(),
23501
+ /** The target's HTTP status. */
23502
+ status: number().int()
23503
+ });
22455
23504
  /** What the operator asked the assist to look for. */
22456
23505
  var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
22457
23506
  kind: literal("package"),
@@ -22481,6 +23530,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
22481
23530
  reason: string(),
22482
23531
  detail: string().optional()
22483
23532
  })]);
23533
+ /** A named set over the retrain corpus — membership only, it owns no pixels. */
23534
+ var RetrainCollectionSchema = object({
23535
+ id: string(),
23536
+ name: string(),
23537
+ createdAt: number(),
23538
+ frameCount: number().int()
23539
+ });
23540
+ var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
23541
+ kind: literal("created"),
23542
+ collection: RetrainCollectionSchema
23543
+ }), object({
23544
+ kind: literal("refused"),
23545
+ reason: _enum(["empty-name", "duplicate-name"])
23546
+ })]);
23547
+ var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
23548
+ kind: literal("renamed"),
23549
+ collection: RetrainCollectionSchema
23550
+ }), object({
23551
+ kind: literal("refused"),
23552
+ reason: _enum([
23553
+ "empty-name",
23554
+ "duplicate-name",
23555
+ "unknown-collection"
23556
+ ])
23557
+ })]);
23558
+ /**
23559
+ * The outcome of adding the frame at a recording instant. Every refusal is
23560
+ * named: `still-unavailable` (not recording, a gap, or an undecodable frame —
23561
+ * `detail` says which), `still-busy` (the recorder is at its decode bound; try
23562
+ * again), `unreadable-image`, `write-failed`, `unknown-collection`.
23563
+ */
23564
+ var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
23565
+ kind: literal("added"),
23566
+ collectionId: string(),
23567
+ frame: RetrainFrameSchema,
23568
+ /** The moment was already in the dataset; nothing was decoded. */
23569
+ reused: boolean()
23570
+ }), object({
23571
+ kind: literal("refused"),
23572
+ reason: _enum([
23573
+ "unknown-collection",
23574
+ "still-unavailable",
23575
+ "still-busy",
23576
+ "unreadable-image",
23577
+ "write-failed"
23578
+ ]),
23579
+ detail: string().optional()
23580
+ })]);
23581
+ /** A vision LLM profile the AI assist may use, and where it sends the frame. */
23582
+ var RetrainAssistProfileSchema = object({
23583
+ id: string(),
23584
+ name: string(),
23585
+ model: string(),
23586
+ kind: string(),
23587
+ /** `true` when the frame would leave the house (a cloud vendor, or an
23588
+ * endpoint that is not on the local network). The page confirms each such
23589
+ * run, and the provider refuses one without `allowCloud`. */
23590
+ leavesHouse: boolean()
23591
+ });
23592
+ /** A box the AI assist proposed: a draft, plus the model's own reason. */
23593
+ var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
23594
+ /** What the AI assist said about a box that was already on the canvas. */
23595
+ var RetrainLlmReviewSchema = object({
23596
+ /** The `ref` the page sent the box under. */
23597
+ ref: string(),
23598
+ verdict: _enum([
23599
+ "confirmed",
23600
+ "wrong-class",
23601
+ "not-an-object",
23602
+ "uncertain"
23603
+ ]),
23604
+ suggestedClass: RetrainMacroClassSchema.optional(),
23605
+ reason: string()
23606
+ });
23607
+ /**
23608
+ * The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
23609
+ * model and its confidence) and reviews; items the model got wrong (a box off
23610
+ * the frame, an unasked class, an unknown ref) are dropped and counted in
23611
+ * `rejected`. A whole answer that is not the schema is `malformed-answer`.
23612
+ */
23613
+ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23614
+ kind: literal("proposed"),
23615
+ profileId: string(),
23616
+ model: string(),
23617
+ /** The frame was sent outside the house for this answer. */
23618
+ leftHouse: boolean(),
23619
+ proposals: array(RetrainLlmProposalSchema).readonly(),
23620
+ reviews: array(RetrainLlmReviewSchema).readonly(),
23621
+ rejected: number().int()
23622
+ }), object({
23623
+ kind: literal("refused"),
23624
+ reason: _enum([
23625
+ "unknown-frame",
23626
+ "unreadable-frame",
23627
+ "unknown-profile",
23628
+ "profile-disabled",
23629
+ "no-vision",
23630
+ "cloud-not-confirmed",
23631
+ "llm-error",
23632
+ "malformed-answer"
23633
+ ]),
23634
+ detail: string().optional()
23635
+ })]);
22484
23636
  /** The outcome of a lifecycle move owned by the retrain page. */
22485
23637
  var RetrainTransitionResultSchema = object({
22486
23638
  trackId: string(),
@@ -23198,7 +24350,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23198
24350
  auth: "admin"
23199
24351
  }), method(object({
23200
24352
  deviceId: number(),
23201
- trackId: string(),
24353
+ trackId: string().optional(),
23202
24354
  frameId: string()
23203
24355
  }), object({
23204
24356
  removed: boolean(),
@@ -23215,7 +24367,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23215
24367
  auth: "admin"
23216
24368
  }), method(object({
23217
24369
  deviceId: number(),
23218
- trackId: string(),
24370
+ /** The frame's track, when it has one — checked against the frame. */
24371
+ trackId: string().optional(),
23219
24372
  frameId: string(),
23220
24373
  subject: RetrainAssistSubjectSchema,
23221
24374
  /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
@@ -23223,12 +24376,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23223
24376
  }), RetrainAssistResultSchema, {
23224
24377
  kind: "mutation",
23225
24378
  auth: "admin"
23226
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
24379
+ }), method(object({
24380
+ trackId: string().optional(),
24381
+ frameIds: array(string()).max(2e3).optional()
24382
+ }), array(RetrainAnnotationSchema).readonly(), {
23227
24383
  kind: "query",
23228
24384
  auth: "admin"
23229
24385
  }), method(object({
23230
24386
  deviceId: number(),
23231
- trackId: string(),
24387
+ /** The frame's track, when it has one — checked against the frame. */
24388
+ trackId: string().optional(),
23232
24389
  frameId: string(),
23233
24390
  annotations: array(RetrainAnnotationDraftSchema)
23234
24391
  }), array(RetrainAnnotationSchema).readonly(), {
@@ -23246,7 +24403,91 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23246
24403
  }), RetrainTransitionResultSchema, {
23247
24404
  kind: "mutation",
23248
24405
  auth: "admin"
23249
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
24406
+ }), method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string() }), {
24407
+ kind: "query",
24408
+ auth: "admin"
24409
+ }), method(object({
24410
+ deviceId: number(),
24411
+ trackId: string().optional(),
24412
+ frameId: string(),
24413
+ complete: boolean()
24414
+ }), RetrainFrameSchema, {
24415
+ kind: "mutation",
24416
+ auth: "admin"
24417
+ }), method(object({
24418
+ filter: RetrainExportFilterSchema,
24419
+ layout: RetrainExportLayoutSchema,
24420
+ target: RetrainArchiveTargetSchema
24421
+ }), RetrainArchiveResultSchema, {
24422
+ kind: "mutation",
24423
+ auth: "admin",
24424
+ timeoutMs: 60 * 6e4
24425
+ }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24426
+ kind: "query",
24427
+ auth: "admin"
24428
+ }), method(object({
24429
+ deviceId: number(),
24430
+ trackId: string().optional(),
24431
+ frameId: string(),
24432
+ profileId: string(),
24433
+ classes: array(RetrainMacroClassSchema).min(1),
24434
+ boxes: array(object({
24435
+ ref: string(),
24436
+ bbox: RetrainBboxSchema,
24437
+ macroClass: RetrainMacroClassSchema,
24438
+ label: string().optional()
24439
+ })).max(50),
24440
+ allowCloud: boolean()
24441
+ }), RetrainLlmAssistResultSchema, {
24442
+ kind: "mutation",
24443
+ auth: "admin",
24444
+ timeoutMs: 18e4
24445
+ }), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
24446
+ kind: "mutation",
24447
+ auth: "admin"
24448
+ }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24449
+ kind: "query",
24450
+ auth: "admin"
24451
+ }), method(object({
24452
+ id: string(),
24453
+ name: string().max(120)
24454
+ }), RetrainCollectionRenameResultSchema, {
24455
+ kind: "mutation",
24456
+ auth: "admin"
24457
+ }), method(object({ id: string() }), object({
24458
+ deleted: boolean(),
24459
+ removedFrames: number().int()
24460
+ }), {
24461
+ kind: "mutation",
24462
+ auth: "admin"
24463
+ }), method(object({
24464
+ collectionId: string(),
24465
+ deviceId: number(),
24466
+ epochMs: number()
24467
+ }), AddRetrainFrameFromRecordingResultSchema, {
24468
+ kind: "mutation",
24469
+ auth: "admin",
24470
+ timeoutMs: 6e4
24471
+ }), method(object({
24472
+ collectionId: string(),
24473
+ frameIds: array(string()).min(1).max(500)
24474
+ }), object({
24475
+ added: number().int(),
24476
+ alreadyMember: number().int(),
24477
+ unknownFrameIds: array(string()).readonly()
24478
+ }), {
24479
+ kind: "mutation",
24480
+ auth: "admin"
24481
+ }), method(object({
24482
+ collectionId: string(),
24483
+ frameId: string()
24484
+ }), object({
24485
+ removed: boolean(),
24486
+ deletedFrame: boolean()
24487
+ }), {
24488
+ kind: "mutation",
24489
+ auth: "admin"
24490
+ }), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
23250
24491
  kind: "query",
23251
24492
  auth: "admin"
23252
24493
  }), method(object({
@@ -23872,13 +25113,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
23872
25113
  object({
23873
25114
  kind: literal("no-family-build"),
23874
25115
  format: ModelFormatSchema$1
25116
+ }),
25117
+ object({
25118
+ kind: literal("kept-custom-pin"),
25119
+ modelId: string(),
25120
+ deviceKey: string()
23875
25121
  })
23876
25122
  ]);
25123
+ /** Why a device is left exactly as it is, whatever the plan would pick (D786). */
25124
+ var KeptReasonSchema = _enum(["custom-pin"]);
25125
+ /**
25126
+ * Where a choice's latency came from (D791): this node's own benchmark
25127
+ * result, or the hardware-class table. Measured on the node beats the table.
25128
+ */
25129
+ var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
25130
+ kind: literal("node-benchmark"),
25131
+ resultId: string(),
25132
+ measuredAtMs: number()
25133
+ })]);
23877
25134
  var DeviceModelChoiceSchema = object({
23878
25135
  modelId: string(),
23879
25136
  p50Ms: number(),
23880
25137
  fps: number(),
23881
25138
  measured: boolean(),
25139
+ /** Absent on a plan from before D791 — read as the table. */
25140
+ source: LatencySourceSchema.optional(),
23882
25141
  /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
23883
25142
  capacitySessions: number(),
23884
25143
  personRecall: number()
@@ -23889,6 +25148,8 @@ var DeviceRecommendationSchema = object({
23889
25148
  enabled: boolean(),
23890
25149
  available: boolean(),
23891
25150
  chosen: DeviceModelChoiceSchema.nullable(),
25151
+ /** Present when the device is kept as is: Apply writes nothing on it. */
25152
+ kept: KeptReasonSchema.optional(),
23892
25153
  reasons: array(RecommendationReasonSchema).readonly()
23893
25154
  });
23894
25155
  var NodeRecommendationSchema = object({
@@ -23942,6 +25203,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
23942
25203
  kind: literal("coral-enabled"),
23943
25204
  nodeId: string(),
23944
25205
  deviceKey: string()
25206
+ }),
25207
+ object({
25208
+ kind: literal("custom-pin-kept"),
25209
+ nodeId: string(),
25210
+ deviceKey: string().nullable(),
25211
+ deviceId: number().nullable(),
25212
+ modelId: string()
25213
+ }),
25214
+ object({
25215
+ kind: literal("custom-registry-unreadable"),
25216
+ error: string()
23945
25217
  })
23946
25218
  ]);
23947
25219
  var AutoTuneOptionsSchema = object({
@@ -24120,13 +25392,14 @@ var SuggestSharesResultSchema = object({
24120
25392
  nodes: array(SuggestedNodeShareSchema).readonly()
24121
25393
  });
24122
25394
  /**
24123
- * Where the node and device shares come from (D750, D755).
24124
- * - `hardware` (default) — computed by the system from each node's static
24125
- * capacity (its accelerators at their Auto tune models, from the measured
24126
- * latency table), recomputed whenever a node or device joins, leaves, is
24127
- * switched on or off, or changes model. No load input.
24128
- * - `benchmark` — the same, from each node's measured capacity (node
24129
- * benchmark results); a node without results falls back to `hardware`.
25395
+ * Where the node and device shares come from (D750, D755, D791).
25396
+ * - `benchmark` (default since D791) — each node's capacity as its own node
25397
+ * benchmark measured it; a node without fresh results is sized from
25398
+ * `hardware` and says so. Measured on the node beats the table.
25399
+ * - `hardware` — computed from each node's static capacity only (its
25400
+ * accelerators at their Auto tune models, from the latency table).
25401
+ * Both are recomputed whenever a node or device joins, leaves, is switched
25402
+ * on or off, changes model, or a benchmark result is written. No load input.
24130
25403
  * - `manual` — the operator's stored sliders.
24131
25404
  * Either way a node or device that cannot take sessions gives its share to
24132
25405
  * the others in proportion; the stored values are never rewritten for that.
@@ -24175,6 +25448,362 @@ var EffectiveSharesSchema = object({
24175
25448
  nodeWeights: record(string(), number()),
24176
25449
  deviceWeights: record(string(), record(string(), number()))
24177
25450
  });
25451
+ /**
25452
+ * Wire shapes of the node benchmark (D791): the operator's plan, the
25453
+ * preflight the confirmation shows, the run the orchestrator owns, what the
25454
+ * measuring runner reports, and the result rows Auto tune and the automatic
25455
+ * shares read.
25456
+ *
25457
+ * ONE node at a time, owned by the pipeline orchestrator. While a run is
25458
+ * active the cluster is in BENCHMARK MODE for that node: it is not a
25459
+ * detection candidate, camera pins naming it are ignored so its sessions move
25460
+ * elsewhere, and both come back when the mode ends — after a crash or a hub
25461
+ * restart too (a persisted manifest, reconciled against the registry).
25462
+ *
25463
+ * Two measurements, both on the node, driven by its own runner (frames never
25464
+ * cross a process at frame rate, D9):
25465
+ * - `device` — one accelerator × one candidate detector, root only, open
25466
+ * loop: how many streams at the camera rate it carries inside the frame
25467
+ * interval;
25468
+ * - `pipeline` — the chosen detector plus the operator's detail steps
25469
+ * (faces, plates, classifiers, CLIP…), on varied frames from the bench
25470
+ * clip: how many parallel sessions the node carries before latency, drops,
25471
+ * CPU, RAM or the event loop give out.
25472
+ */
25473
+ /** Defaults and bounds, one place. */
25474
+ var NODE_BENCHMARK_DEFAULTS = {
25475
+ fpsPerStream: 10,
25476
+ budgetMinutes: 45,
25477
+ minBudgetMinutes: 10,
25478
+ maxBudgetMinutes: 120,
25479
+ /** A result older than this no longer beats the table. */
25480
+ staleAfterDays: 30,
25481
+ /** Warm-in per ramp step (not accounted). */
25482
+ settleSec: 5,
25483
+ /** Accounted window per ramp step. */
25484
+ measureSec: 20,
25485
+ /** Longest the drain may take before the run is refused. */
25486
+ drainTimeoutSec: 120,
25487
+ /** Candidate models per device in one run. */
25488
+ maxModelsPerDevice: 6
25489
+ };
25490
+ /** The two measurements a run can make. */
25491
+ var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
25492
+ var NodeBenchmarkDevicePlanSchema = object({
25493
+ /** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
25494
+ deviceKey: string().min(1),
25495
+ /**
25496
+ * Root detector candidates for the `device` measurement, in the order
25497
+ * measured. The FIRST is the one the `pipeline` measurement runs.
25498
+ */
25499
+ modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
25500
+ });
25501
+ /** What the operator confirmed. */
25502
+ var NodeBenchmarkPlanSchema = object({
25503
+ nodeId: string().min(1),
25504
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25505
+ /** Which measurements run. At least one. */
25506
+ phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
25507
+ /**
25508
+ * Detail steps (catalog step ids under the root: faces, plates,
25509
+ * classifiers, CLIP…) the `pipeline` measurement enables. The root
25510
+ * detector always runs.
25511
+ */
25512
+ steps: array(string().min(1)).default([]),
25513
+ /** Offered rate of one stream / session. */
25514
+ fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
25515
+ /** Hard deadline: the mode ends and the cluster is restored when it passes. */
25516
+ budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
25517
+ /** Keep the models the run downloaded (default: delete what was not installed before). */
25518
+ keepDownloadedModels: boolean().default(false),
25519
+ /** Start although the other nodes' capacity does not cover the sessions running now. */
25520
+ acceptInsufficientHeadroom: boolean().default(false)
25521
+ });
25522
+ var NodeBenchmarkRefusalSchema = object({
25523
+ kind: _enum([
25524
+ "benchmark-active",
25525
+ "node-offline",
25526
+ "unknown-device",
25527
+ "no-phase",
25528
+ "insufficient-headroom"
25529
+ ]),
25530
+ detail: string(),
25531
+ overridable: boolean()
25532
+ });
25533
+ /** A camera whose detection leaves the node for the run. */
25534
+ var NodeBenchmarkMovingCameraSchema = object({
25535
+ deviceId: number(),
25536
+ /** Placed on the node now (a standing attach or a running session). */
25537
+ placedOnNode: boolean(),
25538
+ /** A node pin naming this node, ignored for the run. */
25539
+ pinnedToNode: boolean()
25540
+ });
25541
+ /** A camera that cannot leave: no other node can obtain its frames. */
25542
+ var NodeBenchmarkStayingCameraSchema = object({
25543
+ deviceId: number(),
25544
+ reason: literal("only-frame-source")
25545
+ });
25546
+ var NodeBenchmarkPreflightSchema = object({
25547
+ nodeId: string(),
25548
+ online: boolean(),
25549
+ moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
25550
+ /** Keep running on the node during the run; the result is flagged contaminated. */
25551
+ staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
25552
+ estimatedDurationMs: number(),
25553
+ /** The run ends and the cluster is restored at the latest after this long. */
25554
+ budgetMs: number(),
25555
+ phases: array(NodeBenchmarkPhaseSchema).readonly(),
25556
+ steps: array(string()).readonly(),
25557
+ devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
25558
+ /** Parallel sessions the cluster runs now, and what the other nodes can carry. */
25559
+ headroom: object({
25560
+ sessionsNow: number(),
25561
+ otherNodesCapacitySessions: number().nullable()
25562
+ }),
25563
+ refusals: array(NodeBenchmarkRefusalSchema).readonly(),
25564
+ canStart: boolean()
25565
+ });
25566
+ /** Where the measuring runner is. */
25567
+ var NodeBenchProgressSchema = object({
25568
+ phase: _enum([
25569
+ "preparing",
25570
+ "device",
25571
+ "pipeline",
25572
+ "cleanup"
25573
+ ]),
25574
+ deviceKey: string().nullable(),
25575
+ modelId: string().nullable(),
25576
+ /** Streams (device) or sessions (pipeline) of the step running now. */
25577
+ load: number().nullable(),
25578
+ cellsDone: number(),
25579
+ cellsTotal: number(),
25580
+ message: string()
25581
+ });
25582
+ /** What limited a ramp. `none` = the ramp ran out of steps still passing. */
25583
+ var NodeBenchLimitSchema = _enum([
25584
+ "p95",
25585
+ "drops",
25586
+ "errors",
25587
+ "stall",
25588
+ "cpu",
25589
+ "ram",
25590
+ "none"
25591
+ ]);
25592
+ var NodeBenchRampStepSchema = object({
25593
+ load: number(),
25594
+ pass: boolean(),
25595
+ p95Ms: number(),
25596
+ dropRatio: number(),
25597
+ /** Completed frames per second over the accounted window. */
25598
+ fps: number(),
25599
+ cpuPct: number().nullable(),
25600
+ ramFreePct: number().nullable(),
25601
+ failReasons: array(string()).readonly()
25602
+ });
25603
+ var NodeBenchCellSchema = discriminatedUnion("phase", [object({
25604
+ phase: literal("device"),
25605
+ deviceKey: string(),
25606
+ modelId: string(),
25607
+ /** Single-stream latency (the K = 1 step). */
25608
+ p50Ms: number(),
25609
+ p95Ms: number(),
25610
+ p99Ms: number(),
25611
+ /** Frames per second sustained at the last passing step. */
25612
+ fps: number(),
25613
+ /** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
25614
+ kMax: number(),
25615
+ limitedBy: NodeBenchLimitSchema,
25616
+ /** First call (model load + warm-up). */
25617
+ warmupMs: number(),
25618
+ ramp: array(NodeBenchRampStepSchema).readonly()
25619
+ }), object({
25620
+ phase: literal("pipeline"),
25621
+ deviceKey: string(),
25622
+ modelId: string(),
25623
+ steps: array(string()).readonly(),
25624
+ /** Parallel sessions at the camera rate the node carried; 0 = not even one. */
25625
+ maxSessions: number(),
25626
+ limitedBy: NodeBenchLimitSchema,
25627
+ /** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
25628
+ stepsFired: array(string()).readonly(),
25629
+ warmupMs: number(),
25630
+ ramp: array(NodeBenchRampStepSchema).readonly()
25631
+ })]);
25632
+ /**
25633
+ * What a result was measured ON. A result whose fingerprint no longer matches
25634
+ * the node no longer beats the table.
25635
+ */
25636
+ var NodeBenchFingerprintSchema = object({
25637
+ pipelineVersion: string().nullable(),
25638
+ cpuModel: string().nullable(),
25639
+ ramGb: number().nullable(),
25640
+ os: string().nullable(),
25641
+ /** Per device: the pool the cells ran on (runtime + tuning). */
25642
+ pools: record(string(), object({
25643
+ runtime: string(),
25644
+ numWorkers: number(),
25645
+ concurrency: number(),
25646
+ batchMode: string()
25647
+ })).default({})
25648
+ });
25649
+ /** The frames the run used. */
25650
+ var NodeBenchClipSchema = object({
25651
+ /** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
25652
+ id: string(),
25653
+ revision: string().nullable(),
25654
+ frames: number(),
25655
+ width: number(),
25656
+ height: number()
25657
+ });
25658
+ var NodeBenchRunnerInputSchema = object({
25659
+ runId: string().min(1),
25660
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25661
+ phases: array(NodeBenchmarkPhaseSchema).min(1),
25662
+ /** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
25663
+ steps: array(string()).default([]),
25664
+ fpsPerStream: number().int().min(1).max(30),
25665
+ /** The runner stops on its own past this instant, whatever the hub does. */
25666
+ deadlineAtMs: number(),
25667
+ settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
25668
+ measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
25669
+ keepDownloadedModels: boolean().default(false)
25670
+ });
25671
+ var NodeBenchRunnerStateSchema = _enum([
25672
+ "running",
25673
+ "done",
25674
+ "failed",
25675
+ "aborted"
25676
+ ]);
25677
+ var NodeBenchRunnerStatusSchema = object({
25678
+ runId: string(),
25679
+ nodeId: string(),
25680
+ state: NodeBenchRunnerStateSchema,
25681
+ progress: NodeBenchProgressSchema.nullable(),
25682
+ /** Every finished cell so far — a run stopped half way keeps what it measured. */
25683
+ cells: array(NodeBenchCellSchema).readonly(),
25684
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25685
+ clip: NodeBenchClipSchema.nullable(),
25686
+ /** Cameras seen running on the node during the run (they share its pools). */
25687
+ activeCameraIds: array(number()).readonly(),
25688
+ /** Models the run downloaded and then deleted (not installed before). */
25689
+ deletedModels: array(string()).readonly(),
25690
+ error: string().nullable(),
25691
+ startedAtMs: number(),
25692
+ finishedAtMs: number().nullable()
25693
+ });
25694
+ var NodeBenchmarkStateSchema = _enum([
25695
+ "draining",
25696
+ "measuring",
25697
+ "restoring",
25698
+ "done",
25699
+ "failed",
25700
+ "aborted"
25701
+ ]);
25702
+ /** Why a run ended. */
25703
+ var NodeBenchmarkEndReasonSchema = _enum([
25704
+ "completed",
25705
+ "operator-abort",
25706
+ "deadline",
25707
+ "node-lost",
25708
+ "runner-lost",
25709
+ "hub-restart",
25710
+ "drain-timeout",
25711
+ "failed"
25712
+ ]);
25713
+ var NodeBenchmarkRunSchema = object({
25714
+ runId: string(),
25715
+ nodeId: string(),
25716
+ state: NodeBenchmarkStateSchema,
25717
+ plan: NodeBenchmarkPlanSchema,
25718
+ startedAtMs: number(),
25719
+ deadlineAtMs: number(),
25720
+ finishedAtMs: number().nullable(),
25721
+ endReason: NodeBenchmarkEndReasonSchema.nullable(),
25722
+ error: string().nullable(),
25723
+ /** Cameras moved off the node for the run. */
25724
+ moved: array(number()).readonly(),
25725
+ /** Cameras that stayed (their only frame source is the node). */
25726
+ staying: array(number()).readonly(),
25727
+ /** Something else ran on the node's pools during the run. */
25728
+ contaminated: boolean(),
25729
+ progress: NodeBenchProgressSchema.nullable(),
25730
+ resultIds: array(string()).readonly()
25731
+ });
25732
+ /** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
25733
+ var NodeBenchmarkStatusSchema = object({
25734
+ /** The node the cluster is in benchmark mode for; null = none. */
25735
+ modeNodeId: string().nullable(),
25736
+ run: NodeBenchmarkRunSchema.nullable()
25737
+ });
25738
+ /**
25739
+ * One stored measurement — the only authority Auto tune and the automatic
25740
+ * shares read measured capacity from. Written by the orchestrator when a run
25741
+ * ends, never by anyone else.
25742
+ */
25743
+ var NodeBenchmarkResultSchema = object({
25744
+ id: string(),
25745
+ runId: string(),
25746
+ nodeId: string(),
25747
+ cell: NodeBenchCellSchema,
25748
+ fpsPerStream: number(),
25749
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25750
+ clip: NodeBenchClipSchema.nullable(),
25751
+ /** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
25752
+ contaminated: boolean(),
25753
+ stayingCameras: array(number()).readonly(),
25754
+ /** The run ended early; the cell itself completed. */
25755
+ partialRun: boolean(),
25756
+ measuredAtMs: number()
25757
+ });
25758
+ var ListNodeBenchmarkResultsInputSchema = object({
25759
+ nodeId: string().optional(),
25760
+ deviceKey: string().optional()
25761
+ });
25762
+ /** A result with its standing today: does it still beat the table? */
25763
+ var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
25764
+ /** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
25765
+ standing: _enum([
25766
+ "fresh",
25767
+ "stale",
25768
+ "superseded"
25769
+ ]),
25770
+ staleWhy: _enum([
25771
+ "age",
25772
+ "runtime",
25773
+ "pool-tuning"
25774
+ ]).nullable()
25775
+ });
25776
+ object({
25777
+ runId: string(),
25778
+ nodeId: string(),
25779
+ startedAtMs: number(),
25780
+ deadlineAtMs: number(),
25781
+ plan: NodeBenchmarkPlanSchema,
25782
+ moved: array(number()).readonly(),
25783
+ staying: array(number()).readonly()
25784
+ });
25785
+ /** Candidate detectors per device, for the plan editor. */
25786
+ var NodeBenchmarkCandidatesSchema = object({
25787
+ nodeId: string(),
25788
+ reachable: boolean(),
25789
+ devices: array(object({
25790
+ deviceKey: string(),
25791
+ enabled: boolean(),
25792
+ available: boolean(),
25793
+ /** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
25794
+ suggested: array(string()).readonly(),
25795
+ /** Every root detector the device has a build for. */
25796
+ all: array(string()).readonly(),
25797
+ /** The model the device runs now, when pinned. */
25798
+ currentModelId: string().nullable()
25799
+ })).readonly(),
25800
+ /** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
25801
+ steps: array(object({
25802
+ id: string(),
25803
+ name: string(),
25804
+ slot: string()
25805
+ })).readonly()
25806
+ });
24178
25807
  object({
24179
25808
  activeCameras: number(),
24180
25809
  throttledCameras: number(),
@@ -25303,7 +26932,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
25303
26932
  }), ParkedTrackFrameSchema.nullable()), method(object({
25304
26933
  deviceId: number(),
25305
26934
  trackId: string()
25306
- }), object({ released: number().int().nonnegative() }), { kind: "mutation" });
26935
+ }), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
26936
+ accepted: literal(true),
26937
+ runId: string()
26938
+ }), {
26939
+ kind: "mutation",
26940
+ auth: "admin"
26941
+ }), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
26942
+ kind: "mutation",
26943
+ auth: "admin"
26944
+ });
25307
26945
  var CameraPipelineConfigSchema = object({
25308
26946
  engine: PipelineEngineChoiceSchema.optional(),
25309
26947
  steps: array(PipelineStepInputSchema).readonly(),
@@ -25942,6 +27580,21 @@ method(object({
25942
27580
  }), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
25943
27581
  kind: "mutation",
25944
27582
  auth: "admin"
27583
+ }), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
27584
+ kind: literal("started"),
27585
+ runId: string()
27586
+ }), object({
27587
+ kind: literal("refused"),
27588
+ preflight: NodeBenchmarkPreflightSchema
27589
+ })]), {
27590
+ kind: "mutation",
27591
+ auth: "admin"
27592
+ }), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
27593
+ kind: "mutation",
27594
+ auth: "admin"
27595
+ }), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
27596
+ kind: "mutation",
27597
+ auth: "admin"
25945
27598
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
25946
27599
  deviceId: number(),
25947
27600
  addonId: string(),
@@ -26578,7 +28231,19 @@ var SsoBridgeClaimsSchema = object({
26578
28231
  * editing a descriptor must not retroactively extend or shorten a link the
26579
28232
  * operator already consented to.
26580
28233
  */
26581
- refreshTtl: union([number().int().positive(), literal("never")]).optional()
28234
+ refreshTtl: union([number().int().positive(), literal("never")]).optional(),
28235
+ /**
28236
+ * Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
28237
+ * that was started from a signed-in user's "Link" button: the finish then
28238
+ * links this identity to the intent's user instead of signing anyone in.
28239
+ * The handle carries no user id — the hub resolves it, single-use.
28240
+ */
28241
+ linkIntent: string().optional(),
28242
+ /**
28243
+ * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28244
+ * subject is unique only per issuer, so a link is bound to it.
28245
+ */
28246
+ issuer: string().optional()
26582
28247
  });
26583
28248
  method(object({
26584
28249
  claims: SsoBridgeClaimsSchema,
@@ -28513,7 +30178,22 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
28513
30178
  * field their hints were silently stripped by the schema and the
28514
30179
  * adaptive ladder started blind on the client's display size.
28515
30180
  */
28516
- hints: webrtcClientHintsSchema.optional()
30181
+ hints: webrtcClientHintsSchema.optional(),
30182
+ /**
30183
+ * Talk-back (D771): relay the PEER's audio to the device's speaker
30184
+ * through the `intercom` cap's push-talk triple. When `true` and the
30185
+ * offer lets the peer send audio, the answer's audio is `sendrecv`
30186
+ * and every inbound frame goes to `intercom.pushTalkAudio` for this
30187
+ * `deviceId`; absent/false answers `sendonly`, as for every viewer.
30188
+ *
30189
+ * TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
30190
+ * with `intercom`, when the linked user may control that camera. The
30191
+ * hub STRIPS it from every request-bound call (a browser), exactly as
30192
+ * it overwrites `relayOnly` — a viewer's talk permission is the
30193
+ * intercom cap's own surface (share tokens gate it there), and this
30194
+ * flag must not become a second door to the camera's speaker.
30195
+ */
30196
+ talkback: boolean().optional()
28517
30197
  }), object({
28518
30198
  sessionId: string(),
28519
30199
  sdpAnswer: string()
@@ -32030,6 +33710,9 @@ var CreateIntegrationInputSchema = object({
32030
33710
  enabled: boolean().optional(),
32031
33711
  info: record(string(), unknown()).optional(),
32032
33712
  settings: record(string(), unknown()).optional(),
33713
+ /** Keys of `settings` the form's schema declares secret (by type) — kept in
33714
+ * the keychain, not the table (D787). */
33715
+ secretKeys: array(string()).optional(),
32033
33716
  skipRestart: boolean().optional()
32034
33717
  });
32035
33718
  var UpdateIntegrationInputSchema = object({
@@ -32053,7 +33736,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
32053
33736
  auth: "admin"
32054
33737
  }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
32055
33738
  id: string(),
32056
- settings: record(string(), unknown())
33739
+ settings: record(string(), unknown()),
33740
+ /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
33741
+ secretKeys: array(string()).optional()
32057
33742
  }), object({ success: boolean() }), {
32058
33743
  kind: "mutation",
32059
33744
  auth: "admin"
@@ -38875,6 +40560,32 @@ var TotpStatusSchema = object({
38875
40560
  /** Null when no row exists OR the row is still pending confirmation. */
38876
40561
  confirmedAt: number().nullable()
38877
40562
  });
40563
+ /**
40564
+ * user-management — singleton capability for user accounts, API keys,
40565
+ * and scoped tokens.
40566
+ *
40567
+ * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
40568
+ * — the subset check on `setUserScopes` / `createScopedToken` is moot
40569
+ * because non-admins never reach these. If/when we open non-admin
40570
+ * delegation, structural caller-scope subset check goes inside the
40571
+ * provider.
40572
+ */
40573
+ var ExternalIdentitySchema = object({
40574
+ /** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
40575
+ provider: string(),
40576
+ /** The IdP's stable subject (`sub`) for this account. */
40577
+ subject: string(),
40578
+ /** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
40579
+ issuer: string(),
40580
+ userId: string(),
40581
+ /** What the IdP called the account at link time (username / email) — display only. */
40582
+ label: string().optional(),
40583
+ linkedAt: number()
40584
+ });
40585
+ var ExternalIdentityKeySchema = object({
40586
+ provider: string().min(1),
40587
+ subject: string().min(1)
40588
+ });
38878
40589
  method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
38879
40590
  kind: "mutation",
38880
40591
  auth: "admin",
@@ -38988,7 +40699,22 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
38988
40699
  userId: string(),
38989
40700
  username: string(),
38990
40701
  scopes: array(TokenScopeSchema)
38991
- }).nullable(), { access: "view" }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
40702
+ }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
40703
+ userId: string(),
40704
+ issuer: string()
40705
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
40706
+ userId: string(),
40707
+ issuer: string().min(1),
40708
+ label: string().optional()
40709
+ }), object({ success: literal(true) }), {
40710
+ kind: "mutation",
40711
+ auth: "admin",
40712
+ access: "create"
40713
+ }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
40714
+ kind: "mutation",
40715
+ auth: "admin",
40716
+ access: "delete"
40717
+ }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
38992
40718
  kind: "mutation",
38993
40719
  auth: "admin",
38994
40720
  access: "delete"
@@ -40175,7 +41901,8 @@ var BaseDevice$1 = class {
40175
41901
  this.role = options.role;
40176
41902
  this.parentDeviceId = ctx.parentDeviceId;
40177
41903
  const seedData = ctx.persistedConfig ?? {};
40178
- this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data), seedData, ({ droppedKeys, issues }) => {
41904
+ const declaredSecretPaths = collectZodSecretPaths(schema);
41905
+ this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
40179
41906
  ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
40180
41907
  tags: {
40181
41908
  deviceId: ctx.id,
@@ -43864,6 +45591,90 @@ Object.freeze({
43864
45591
  addonId: null,
43865
45592
  access: "create"
43866
45593
  },
45594
+ "keychain.delete": {
45595
+ capName: "keychain",
45596
+ capScope: "system",
45597
+ addonId: null,
45598
+ access: "delete"
45599
+ },
45600
+ "keychain.getState": {
45601
+ capName: "keychain",
45602
+ capScope: "system",
45603
+ addonId: null,
45604
+ access: "view"
45605
+ },
45606
+ "keychain.listMeta": {
45607
+ capName: "keychain",
45608
+ capScope: "system",
45609
+ addonId: null,
45610
+ access: "view"
45611
+ },
45612
+ "keychain.put": {
45613
+ capName: "keychain",
45614
+ capScope: "system",
45615
+ addonId: null,
45616
+ access: "create"
45617
+ },
45618
+ "keychain.resolve": {
45619
+ capName: "keychain",
45620
+ capScope: "system",
45621
+ addonId: null,
45622
+ access: "view"
45623
+ },
45624
+ "keychainAdmin.deleteOrphans": {
45625
+ capName: "keychain-admin",
45626
+ capScope: "system",
45627
+ addonId: null,
45628
+ access: "delete"
45629
+ },
45630
+ "keychainAdmin.downloadRecoveryKey": {
45631
+ capName: "keychain-admin",
45632
+ capScope: "system",
45633
+ addonId: null,
45634
+ access: "create"
45635
+ },
45636
+ "keychainAdmin.listAudit": {
45637
+ capName: "keychain-admin",
45638
+ capScope: "system",
45639
+ addonId: null,
45640
+ access: "view"
45641
+ },
45642
+ "keychainAdmin.listSecrets": {
45643
+ capName: "keychain-admin",
45644
+ capScope: "system",
45645
+ addonId: null,
45646
+ access: "view"
45647
+ },
45648
+ "keychainAdmin.purgeRetiredKeys": {
45649
+ capName: "keychain-admin",
45650
+ capScope: "system",
45651
+ addonId: null,
45652
+ access: "delete"
45653
+ },
45654
+ "keychainAdmin.resetKeychain": {
45655
+ capName: "keychain-admin",
45656
+ capScope: "system",
45657
+ addonId: null,
45658
+ access: "delete"
45659
+ },
45660
+ "keychainAdmin.reveal": {
45661
+ capName: "keychain-admin",
45662
+ capScope: "system",
45663
+ addonId: null,
45664
+ access: "create"
45665
+ },
45666
+ "keychainAdmin.rotateMasterKey": {
45667
+ capName: "keychain-admin",
45668
+ capScope: "system",
45669
+ addonId: null,
45670
+ access: "create"
45671
+ },
45672
+ "keychainAdmin.status": {
45673
+ capName: "keychain-admin",
45674
+ capScope: "system",
45675
+ addonId: null,
45676
+ access: "view"
45677
+ },
43867
45678
  "lawnMowerControl.dock": {
43868
45679
  capName: "lawn-mower-control",
43869
45680
  capScope: "device",
@@ -45238,6 +47049,18 @@ Object.freeze({
45238
47049
  addonId: null,
45239
47050
  access: "create"
45240
47051
  },
47052
+ "pipelineAnalytics.addRetrainFrameFromRecording": {
47053
+ capName: "pipeline-analytics",
47054
+ capScope: "device",
47055
+ addonId: null,
47056
+ access: "create"
47057
+ },
47058
+ "pipelineAnalytics.addRetrainFramesToCollection": {
47059
+ capName: "pipeline-analytics",
47060
+ capScope: "device",
47061
+ addonId: null,
47062
+ access: "create"
47063
+ },
45241
47064
  "pipelineAnalytics.applyDeviceSettingsPatch": {
45242
47065
  capName: "pipeline-analytics",
45243
47066
  capScope: "device",
@@ -45286,12 +47109,24 @@ Object.freeze({
45286
47109
  addonId: null,
45287
47110
  access: "view"
45288
47111
  },
47112
+ "pipelineAnalytics.createRetrainCollection": {
47113
+ capName: "pipeline-analytics",
47114
+ capScope: "device",
47115
+ addonId: null,
47116
+ access: "create"
47117
+ },
45289
47118
  "pipelineAnalytics.deleteDeviceEvents": {
45290
47119
  capName: "pipeline-analytics",
45291
47120
  capScope: "device",
45292
47121
  addonId: null,
45293
47122
  access: "delete"
45294
47123
  },
47124
+ "pipelineAnalytics.deleteRetrainCollection": {
47125
+ capName: "pipeline-analytics",
47126
+ capScope: "device",
47127
+ addonId: null,
47128
+ access: "delete"
47129
+ },
45295
47130
  "pipelineAnalytics.deleteTracks": {
45296
47131
  capName: "pipeline-analytics",
45297
47132
  capScope: "device",
@@ -45496,6 +47331,24 @@ Object.freeze({
45496
47331
  addonId: null,
45497
47332
  access: "view"
45498
47333
  },
47334
+ "pipelineAnalytics.listRetrainAssistProfiles": {
47335
+ capName: "pipeline-analytics",
47336
+ capScope: "device",
47337
+ addonId: null,
47338
+ access: "view"
47339
+ },
47340
+ "pipelineAnalytics.listRetrainCollectionFrames": {
47341
+ capName: "pipeline-analytics",
47342
+ capScope: "device",
47343
+ addonId: null,
47344
+ access: "view"
47345
+ },
47346
+ "pipelineAnalytics.listRetrainCollections": {
47347
+ capName: "pipeline-analytics",
47348
+ capScope: "device",
47349
+ addonId: null,
47350
+ access: "view"
47351
+ },
45499
47352
  "pipelineAnalytics.listRetrainFrames": {
45500
47353
  capName: "pipeline-analytics",
45501
47354
  capScope: "device",
@@ -45544,6 +47397,12 @@ Object.freeze({
45544
47397
  addonId: null,
45545
47398
  access: "create"
45546
47399
  },
47400
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
47401
+ capName: "pipeline-analytics",
47402
+ capScope: "device",
47403
+ addonId: null,
47404
+ access: "create"
47405
+ },
45547
47406
  "pipelineAnalytics.pruneEvents": {
45548
47407
  capName: "pipeline-analytics",
45549
47408
  capScope: "device",
@@ -45598,6 +47457,18 @@ Object.freeze({
45598
47457
  addonId: null,
45599
47458
  access: "create"
45600
47459
  },
47460
+ "pipelineAnalytics.removeRetrainFrameFromCollection": {
47461
+ capName: "pipeline-analytics",
47462
+ capScope: "device",
47463
+ addonId: null,
47464
+ access: "delete"
47465
+ },
47466
+ "pipelineAnalytics.renameRetrainCollection": {
47467
+ capName: "pipeline-analytics",
47468
+ capScope: "device",
47469
+ addonId: null,
47470
+ access: "create"
47471
+ },
45601
47472
  "pipelineAnalytics.restageRetrainTrack": {
45602
47473
  capName: "pipeline-analytics",
45603
47474
  capScope: "device",
@@ -45628,6 +47499,12 @@ Object.freeze({
45628
47499
  addonId: null,
45629
47500
  access: "create"
45630
47501
  },
47502
+ "pipelineAnalytics.setRetrainFrameComplete": {
47503
+ capName: "pipeline-analytics",
47504
+ capScope: "device",
47505
+ addonId: null,
47506
+ access: "create"
47507
+ },
45631
47508
  "pipelineAnalytics.setTrackFlags": {
45632
47509
  capName: "pipeline-analytics",
45633
47510
  capScope: "device",
@@ -45664,6 +47541,12 @@ Object.freeze({
45664
47541
  addonId: null,
45665
47542
  access: "delete"
45666
47543
  },
47544
+ "pipelineAnalytics.writeRetrainArchive": {
47545
+ capName: "pipeline-analytics",
47546
+ capScope: "device",
47547
+ addonId: null,
47548
+ access: "create"
47549
+ },
45667
47550
  "pipelineExecutor.cacheFrameInPool": {
45668
47551
  capName: "pipeline-executor",
45669
47552
  capScope: "system",
@@ -45874,6 +47757,12 @@ Object.freeze({
45874
47757
  addonId: null,
45875
47758
  access: "view"
45876
47759
  },
47760
+ "pipelineOrchestrator.abortNodeBenchmark": {
47761
+ capName: "pipeline-orchestrator",
47762
+ capScope: "system",
47763
+ addonId: null,
47764
+ access: "create"
47765
+ },
45877
47766
  "pipelineOrchestrator.applyAutoTune": {
45878
47767
  capName: "pipeline-orchestrator",
45879
47768
  capScope: "system",
@@ -45898,6 +47787,12 @@ Object.freeze({
45898
47787
  addonId: null,
45899
47788
  access: "create"
45900
47789
  },
47790
+ "pipelineOrchestrator.deleteNodeBenchmarkResult": {
47791
+ capName: "pipeline-orchestrator",
47792
+ capScope: "system",
47793
+ addonId: null,
47794
+ access: "delete"
47795
+ },
45901
47796
  "pipelineOrchestrator.getAgentLoad": {
45902
47797
  capName: "pipeline-orchestrator",
45903
47798
  capScope: "system",
@@ -46006,6 +47901,24 @@ Object.freeze({
46006
47901
  addonId: null,
46007
47902
  access: "view"
46008
47903
  },
47904
+ "pipelineOrchestrator.getNodeBenchmarkCandidates": {
47905
+ capName: "pipeline-orchestrator",
47906
+ capScope: "system",
47907
+ addonId: null,
47908
+ access: "view"
47909
+ },
47910
+ "pipelineOrchestrator.getNodeBenchmarkPreflight": {
47911
+ capName: "pipeline-orchestrator",
47912
+ capScope: "system",
47913
+ addonId: null,
47914
+ access: "view"
47915
+ },
47916
+ "pipelineOrchestrator.getNodeBenchmarkStatus": {
47917
+ capName: "pipeline-orchestrator",
47918
+ capScope: "system",
47919
+ addonId: null,
47920
+ access: "view"
47921
+ },
46009
47922
  "pipelineOrchestrator.getNodeInferenceDevices": {
46010
47923
  capName: "pipeline-orchestrator",
46011
47924
  capScope: "system",
@@ -46048,6 +47961,12 @@ Object.freeze({
46048
47961
  addonId: null,
46049
47962
  access: "view"
46050
47963
  },
47964
+ "pipelineOrchestrator.listNodeBenchmarkResults": {
47965
+ capName: "pipeline-orchestrator",
47966
+ capScope: "system",
47967
+ addonId: null,
47968
+ access: "view"
47969
+ },
46051
47970
  "pipelineOrchestrator.pauseForStorageMigration": {
46052
47971
  capName: "pipeline-orchestrator",
46053
47972
  capScope: "system",
@@ -46192,6 +48111,12 @@ Object.freeze({
46192
48111
  addonId: null,
46193
48112
  access: "create"
46194
48113
  },
48114
+ "pipelineOrchestrator.startNodeBenchmark": {
48115
+ capName: "pipeline-orchestrator",
48116
+ capScope: "system",
48117
+ addonId: null,
48118
+ access: "create"
48119
+ },
46195
48120
  "pipelineOrchestrator.suggestShares": {
46196
48121
  capName: "pipeline-orchestrator",
46197
48122
  capScope: "system",
@@ -46210,6 +48135,12 @@ Object.freeze({
46210
48135
  addonId: null,
46211
48136
  access: "create"
46212
48137
  },
48138
+ "pipelineRunner.abortNodeBench": {
48139
+ capName: "pipeline-runner",
48140
+ capScope: "system",
48141
+ addonId: null,
48142
+ access: "create"
48143
+ },
46213
48144
  "pipelineRunner.attachCamera": {
46214
48145
  capName: "pipeline-runner",
46215
48146
  capScope: "system",
@@ -46258,6 +48189,12 @@ Object.freeze({
46258
48189
  addonId: null,
46259
48190
  access: "view"
46260
48191
  },
48192
+ "pipelineRunner.getNodeBenchStatus": {
48193
+ capName: "pipeline-runner",
48194
+ capScope: "system",
48195
+ addonId: null,
48196
+ access: "view"
48197
+ },
46261
48198
  "pipelineRunner.getParkedTrackFrame": {
46262
48199
  capName: "pipeline-runner",
46263
48200
  capScope: "system",
@@ -46300,6 +48237,12 @@ Object.freeze({
46300
48237
  addonId: null,
46301
48238
  access: "create"
46302
48239
  },
48240
+ "pipelineRunner.startNodeBench": {
48241
+ capName: "pipeline-runner",
48242
+ capScope: "system",
48243
+ addonId: null,
48244
+ access: "create"
48245
+ },
46303
48246
  "plateGallery.assignPlate": {
46304
48247
  capName: "plate-gallery",
46305
48248
  capScope: "system",
@@ -48016,18 +49959,36 @@ Object.freeze({
48016
49959
  addonId: null,
48017
49960
  access: "delete"
48018
49961
  },
49962
+ "userManagement.findUserByExternalIdentity": {
49963
+ capName: "user-management",
49964
+ capScope: "system",
49965
+ addonId: null,
49966
+ access: "view"
49967
+ },
48019
49968
  "userManagement.getTotpStatus": {
48020
49969
  capName: "user-management",
48021
49970
  capScope: "system",
48022
49971
  addonId: null,
48023
49972
  access: "view"
48024
49973
  },
49974
+ "userManagement.linkExternalIdentity": {
49975
+ capName: "user-management",
49976
+ capScope: "system",
49977
+ addonId: null,
49978
+ access: "create"
49979
+ },
48025
49980
  "userManagement.listApiKeys": {
48026
49981
  capName: "user-management",
48027
49982
  capScope: "system",
48028
49983
  addonId: null,
48029
49984
  access: "view"
48030
49985
  },
49986
+ "userManagement.listExternalIdentities": {
49987
+ capName: "user-management",
49988
+ capScope: "system",
49989
+ addonId: null,
49990
+ access: "view"
49991
+ },
48031
49992
  "userManagement.listOauthSessions": {
48032
49993
  capName: "user-management",
48033
49994
  capScope: "system",
@@ -48106,6 +50067,12 @@ Object.freeze({
48106
50067
  addonId: null,
48107
50068
  access: "create"
48108
50069
  },
50070
+ "userManagement.unlinkExternalIdentity": {
50071
+ capName: "user-management",
50072
+ capScope: "system",
50073
+ addonId: null,
50074
+ access: "delete"
50075
+ },
48109
50076
  "userManagement.updateUser": {
48110
50077
  capName: "user-management",
48111
50078
  capScope: "system",
@@ -51205,6 +53172,11 @@ Object.freeze({
51205
53172
  form: "single",
51206
53173
  optional: false
51207
53174
  }],
53175
+ "pipelineAnalytics.addRetrainFrameFromRecording": [{
53176
+ name: "deviceId",
53177
+ form: "single",
53178
+ optional: false
53179
+ }],
51208
53180
  "pipelineAnalytics.applyDeviceSettingsPatch": [{
51209
53181
  name: "deviceId",
51210
53182
  form: "single",
@@ -51395,6 +53367,11 @@ Object.freeze({
51395
53367
  form: "single",
51396
53368
  optional: false
51397
53369
  }],
53370
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
53371
+ name: "deviceId",
53372
+ form: "single",
53373
+ optional: false
53374
+ }],
51398
53375
  "pipelineAnalytics.pruneEventsBefore": [{
51399
53376
  name: "deviceId",
51400
53377
  form: "single",
@@ -51445,6 +53422,11 @@ Object.freeze({
51445
53422
  form: "single",
51446
53423
  optional: false
51447
53424
  }],
53425
+ "pipelineAnalytics.setRetrainFrameComplete": [{
53426
+ name: "deviceId",
53427
+ form: "single",
53428
+ optional: false
53429
+ }],
51448
53430
  "pipelineAnalytics.setTrackFlags": [{
51449
53431
  name: "deviceId",
51450
53432
  form: "single",
@@ -53512,7 +55494,7 @@ var DreoRegionSchema = _enum(DREO_REGIONS);
53512
55494
  */
53513
55495
  var dreoConfigSchema = object({
53514
55496
  email: string().min(1).describe("Dreo account email"),
53515
- password: string().min(1).describe("Dreo account password"),
55497
+ password: string().min(1).describe("Dreo account password").meta({ secret: true }),
53516
55498
  region: DreoRegionSchema.default("us").describe("Dreo cloud region")
53517
55499
  });
53518
55500
  /**