@camstack/addon-provider-petkit 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
@@ -1101,7 +1101,7 @@ var Nodepetkit = class {
1101
1101
  }
1102
1102
  };
1103
1103
  //#endregion
1104
- //#region ../types/dist/event-category-B_0XEcLF.mjs
1104
+ //#region ../types/dist/event-category-DaIZi00R.mjs
1105
1105
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
1106
1106
  EventCategory["SystemBoot"] = "system.boot";
1107
1107
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -1180,6 +1180,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1180
1180
  */
1181
1181
  EventCategory["AddonLoadFailed"] = "addon.load-failed";
1182
1182
  /**
1183
+ * A keychain value was stored or removed (D787). Carries the ref, its
1184
+ * owner and the new version — NEVER the value. A process holding the ref
1185
+ * drops its cached copy and the owning `BaseAddon` re-resolves its config.
1186
+ * Telemetry (D8): a process that misses it still revalidates by version.
1187
+ */
1188
+ EventCategory["KeychainChanged"] = "keychain.changed";
1189
+ /**
1183
1190
  * Addon recovered from a previous failure. Emitted when an addon
1184
1191
  * transitions from `failed` back to `healthy` (typically via the
1185
1192
  * monitor's auto-retry loop, or after manual `addons.retryLoad`).
@@ -6472,7 +6479,7 @@ var ZodIssueCode = {
6472
6479
  var ZodFirstPartyTypeKind;
6473
6480
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6474
6481
  //#endregion
6475
- //#region ../types/dist/sleep-BNeXenvr.mjs
6482
+ //#region ../types/dist/sleep-Cr5YOk3m.mjs
6476
6483
  /**
6477
6484
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6478
6485
  * window to float samples (D455).
@@ -6551,6 +6558,97 @@ function buildAlawTable() {
6551
6558
  }
6552
6559
  buildUlawTable();
6553
6560
  buildAlawTable();
6561
+ /** Is this field's stored value a credential? */
6562
+ function isSecretConfigField(field) {
6563
+ if (field.type === "password") return true;
6564
+ return "secret" in field && field.secret === true;
6565
+ }
6566
+ /**
6567
+ * Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
6568
+ * by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
6569
+ */
6570
+ function isKeychainStoredField(field) {
6571
+ if (!isSecretConfigField(field)) return false;
6572
+ if (field.type === "textarea" && field.isJson === true) return false;
6573
+ return !("storage" in field && field.storage === "inline");
6574
+ }
6575
+ /**
6576
+ * What a settings blob holds where a secret used to be.
6577
+ *
6578
+ * A keychain-stored field never holds its value. It holds a self-describing
6579
+ * MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
6580
+ * code can mistake it for a credential and no form can send it to a camera as
6581
+ * a password. The empty state is `null` / absent, never `''`.
6582
+ *
6583
+ * The same shapes travel to and from the admin UI:
6584
+ *
6585
+ * - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
6586
+ * (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
6587
+ * value is set, never the value.
6588
+ * - write: an untouched field submits the view back unchanged (KEEP); a typed
6589
+ * value is a plain non-empty string (CHANGE); the Clear button submits
6590
+ * {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
6591
+ * are KEEP — an empty string is what a defaults-fallback pushes back, and
6592
+ * treating it as "clear" is how a save destroyed a stored credential before.
6593
+ *
6594
+ * Pure and browser-safe.
6595
+ */
6596
+ var SECRET_CLEAR = { $secretClear: true };
6597
+ /** The `'***'` token D634 redaction writes for non-admins. */
6598
+ var LEGACY_DEVICE_REDACTION = "***";
6599
+ function isRecord$1(value) {
6600
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6601
+ }
6602
+ function makeSecretMarker(ref) {
6603
+ return {
6604
+ $secret: ref,
6605
+ v: 1
6606
+ };
6607
+ }
6608
+ /** A stored marker: an object whose `$secret` is a non-empty string. */
6609
+ function isSecretMarker(value) {
6610
+ if (!isRecord$1(value)) return false;
6611
+ const ref = value["$secret"];
6612
+ return typeof ref === "string" && ref.length > 0;
6613
+ }
6614
+ function isSecretClear(value) {
6615
+ return isRecord$1(value) && value["$secretClear"] === true;
6616
+ }
6617
+ /**
6618
+ * The UI view of a stored secret field value: a marker becomes "set", inline
6619
+ * plaintext becomes "set (inline)", nothing becomes `null`. A value never
6620
+ * survives this function.
6621
+ */
6622
+ function toSecretFieldView(stored) {
6623
+ if (isSecretMarker(stored)) return {
6624
+ $secret: stored.$secret,
6625
+ v: 1,
6626
+ set: true
6627
+ };
6628
+ if (typeof stored === "string" && stored.length > 0) return {
6629
+ $secret: null,
6630
+ v: 1,
6631
+ set: true,
6632
+ inline: true
6633
+ };
6634
+ return null;
6635
+ }
6636
+ /**
6637
+ * Classify an incoming value for a secret path. Only a non-empty string that is
6638
+ * not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
6639
+ * Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
6640
+ * `undefined`, a redaction token, a non-string — keeps what is stored.
6641
+ */
6642
+ function classifySecretWrite(incoming) {
6643
+ if (isSecretClear(incoming)) return { kind: "clear" };
6644
+ if (typeof incoming !== "string") return { kind: "keep" };
6645
+ if (incoming.length === 0) return { kind: "keep" };
6646
+ if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
6647
+ return {
6648
+ kind: "set",
6649
+ value: incoming
6650
+ };
6651
+ }
6554
6652
  Object.fromEntries([
6555
6653
  {
6556
6654
  id: "overview",
@@ -6722,33 +6820,19 @@ Object.fromEntries([
6722
6820
  function isValuelessField(field) {
6723
6821
  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";
6724
6822
  }
6725
- /**
6726
- * Merge a `ConfigUISchema` with a raw `values` record into a
6727
- * `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
6728
- * before returning to the admin UI. Groups are walked recursively.
6729
- *
6730
- * For each leaf field:
6731
- * - structural fields (`separator`, `info`, `button`) pass through unchanged
6732
- * - other fields get `value = values[key] ?? field.default ?? null`
6733
- *
6734
- * Unknown keys in `values` (keys not declared in the schema) are silently
6735
- * ignored — they don't contribute to the output. Missing keys fall back to
6736
- * the schema default or `null`. This mirrors the old backend behaviour where
6737
- * `FormBuilder` rendered `values[key] ?? field.default`.
6738
- */
6739
- function hydrateSchema(schema, values) {
6823
+ function hydrateSchema(schema, values, options = {}) {
6740
6824
  return {
6741
6825
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
6742
6826
  sections: schema.sections.map((section) => ({
6743
6827
  ...section,
6744
- fields: section.fields.map((field) => hydrateField(field, values))
6828
+ fields: section.fields.map((field) => hydrateField(field, values, options))
6745
6829
  }))
6746
6830
  };
6747
6831
  }
6748
- function hydrateField(field, values) {
6832
+ function hydrateField(field, values, options) {
6749
6833
  if (isValuelessField(field)) return field;
6750
6834
  if (field.type === "group") {
6751
- const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
6835
+ const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
6752
6836
  return {
6753
6837
  ...field,
6754
6838
  fields: hydratedChildren
@@ -6757,7 +6841,7 @@ function hydrateField(field, values) {
6757
6841
  if (field.type === "sub-tabs") {
6758
6842
  const hydratedTabs = field.tabs.map((tab) => ({
6759
6843
  ...tab,
6760
- fields: tab.fields.map((child) => hydrateField(child, values))
6844
+ fields: tab.fields.map((child) => hydrateField(child, values, options))
6761
6845
  }));
6762
6846
  return {
6763
6847
  ...field,
@@ -6767,6 +6851,33 @@ function hydrateField(field, values) {
6767
6851
  const key = field.key;
6768
6852
  const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
6769
6853
  const defaultValue = field.default;
6854
+ const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
6855
+ if (isKeychainStoredField(field) && asView(storedValue)) return {
6856
+ ...field,
6857
+ value: toSecretFieldView(storedValue)
6858
+ };
6859
+ if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
6860
+ ...field,
6861
+ value: null
6862
+ };
6863
+ if (field.type === "editable-array" && Array.isArray(storedValue)) {
6864
+ const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
6865
+ if (secretItemKeys.length > 0) {
6866
+ const rows = storedValue.map((row) => {
6867
+ if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
6868
+ const out = { ...row };
6869
+ for (const k of secretItemKeys) {
6870
+ const v = Reflect.get(row, k);
6871
+ if (asView(v)) out[k] = toSecretFieldView(v);
6872
+ }
6873
+ return out;
6874
+ });
6875
+ return {
6876
+ ...field,
6877
+ value: rows
6878
+ };
6879
+ }
6880
+ }
6770
6881
  if (field.multiple) {
6771
6882
  const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
6772
6883
  const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
@@ -7009,6 +7120,431 @@ function projectStore(store, perNodeKeys, nodeId) {
7009
7120
  }
7010
7121
  return out;
7011
7122
  }
7123
+ var GLOBAL_SCOPE = { kind: "global" };
7124
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
7125
+ function globalSecretScope() {
7126
+ return GLOBAL_SCOPE;
7127
+ }
7128
+ function encodeSegment(value) {
7129
+ return encodeURIComponent(value);
7130
+ }
7131
+ /**
7132
+ * The field path of a value inside an array item, addressed by the item's id:
7133
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
7134
+ * `providers[authentik].clientSecret`.
7135
+ */
7136
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
7137
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
7138
+ }
7139
+ /** A write to a secret path could not be stored in the keychain, so it was refused. */
7140
+ var KeychainWriteRefusedError = class extends Error {
7141
+ fieldPath;
7142
+ constructor(fieldPath, cause) {
7143
+ super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
7144
+ this.fieldPath = fieldPath;
7145
+ this.name = "KeychainWriteRefusedError";
7146
+ }
7147
+ };
7148
+ var KEEP = { kind: "keep" };
7149
+ function isRecord(value) {
7150
+ return typeof value === "object" && value !== null && !Array.isArray(value);
7151
+ }
7152
+ function defaultMintId() {
7153
+ return globalThis.crypto.randomUUID();
7154
+ }
7155
+ /** Every marker ref anywhere under `value`. */
7156
+ function collectSecretMarkerRefs(value, out = []) {
7157
+ if (isSecretMarker(value)) {
7158
+ out.push(value.$secret);
7159
+ return out;
7160
+ }
7161
+ if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
7162
+ else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
7163
+ return out;
7164
+ }
7165
+ async function storedValueEquals(secrets, marker, candidate) {
7166
+ const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
7167
+ return resolved?.kind === "value" && resolved.value === candidate;
7168
+ }
7169
+ async function writeLeaf(ctx, incoming, stored, fieldPath) {
7170
+ const intent = classifySecretWrite(incoming);
7171
+ const ref = ctx.secrets.ref(ctx.scope, fieldPath);
7172
+ const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
7173
+ if (intent.kind === "keep") return KEEP;
7174
+ if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
7175
+ if (intent.kind === "clear") {
7176
+ if (storedIsOurs) ctx.deletes.push(ref);
7177
+ return {
7178
+ kind: "value",
7179
+ value: null
7180
+ };
7181
+ }
7182
+ if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
7183
+ kind: "value",
7184
+ value: stored
7185
+ };
7186
+ try {
7187
+ await ctx.secrets.put(ref, intent.value);
7188
+ } catch (err) {
7189
+ throw new KeychainWriteRefusedError(fieldPath, err);
7190
+ }
7191
+ return {
7192
+ kind: "value",
7193
+ value: makeSecretMarker(ref)
7194
+ };
7195
+ }
7196
+ /** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
7197
+ function applyMember(out, key, result, storedParent) {
7198
+ if (result.kind === "value") {
7199
+ out[key] = result.value;
7200
+ return;
7201
+ }
7202
+ if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
7203
+ else delete out[key];
7204
+ }
7205
+ async function writeMembers(ctx, children, incoming, stored, pathOf) {
7206
+ const out = { ...incoming };
7207
+ for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
7208
+ return out;
7209
+ }
7210
+ function rowId(row, idKey) {
7211
+ const raw = row[idKey];
7212
+ if (typeof raw === "string" && raw.length > 0) return raw;
7213
+ if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
7214
+ return null;
7215
+ }
7216
+ async function writeArray(ctx, node, incoming, stored, fieldPath) {
7217
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
7218
+ if (!Array.isArray(incoming)) {
7219
+ ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
7220
+ return {
7221
+ kind: "value",
7222
+ value: incoming
7223
+ };
7224
+ }
7225
+ const storedById = /* @__PURE__ */ new Map();
7226
+ for (const row of storedRows) {
7227
+ const id = rowId(row, node.idKey);
7228
+ if (id !== null) storedById.set(id, row);
7229
+ }
7230
+ const kept = /* @__PURE__ */ new Set();
7231
+ const rows = [];
7232
+ for (const row of incoming) {
7233
+ if (!isRecord(row)) {
7234
+ rows.push(row);
7235
+ continue;
7236
+ }
7237
+ const id = rowId(row, node.idKey) ?? ctx.mintId();
7238
+ kept.add(id);
7239
+ const withId = {
7240
+ ...row,
7241
+ [node.idKey]: row[node.idKey] ?? id
7242
+ };
7243
+ if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
7244
+ const storedRow = storedById.get(id) ?? {};
7245
+ rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
7246
+ }
7247
+ for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
7248
+ return {
7249
+ kind: "value",
7250
+ value: rows
7251
+ };
7252
+ }
7253
+ async function writeNode(ctx, node, incoming, stored, fieldPath) {
7254
+ switch (node.kind) {
7255
+ case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
7256
+ case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
7257
+ case "object": {
7258
+ if (!isRecord(incoming)) {
7259
+ if (incoming === void 0) return KEEP;
7260
+ ctx.deletes.push(...collectSecretMarkerRefs(stored));
7261
+ return {
7262
+ kind: "value",
7263
+ value: incoming
7264
+ };
7265
+ }
7266
+ const storedObj = isRecord(stored) ? stored : {};
7267
+ return {
7268
+ kind: "value",
7269
+ value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
7270
+ };
7271
+ }
7272
+ }
7273
+ }
7274
+ /** Split a perNode-scoped key (`key@nodeId`). */
7275
+ function splitNodeKey(key) {
7276
+ const at = key.indexOf("@");
7277
+ return at <= 0 ? {
7278
+ base: key,
7279
+ nodeId: null
7280
+ } : {
7281
+ base: key.slice(0, at),
7282
+ nodeId: key.slice(at + 1)
7283
+ };
7284
+ }
7285
+ /** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
7286
+ async function transformSecretWrite(input) {
7287
+ const deletes = [];
7288
+ const base = {
7289
+ secrets: input.secrets,
7290
+ mintId: input.mintId ?? defaultMintId,
7291
+ deletes,
7292
+ operatorWrite: input.operatorWrite === true
7293
+ };
7294
+ const out = {};
7295
+ for (const [key, incoming] of Object.entries(input.patch)) {
7296
+ const { base: baseKey, nodeId } = splitNodeKey(key);
7297
+ const node = input.tree.get(baseKey);
7298
+ if (node === void 0) {
7299
+ out[key] = incoming;
7300
+ continue;
7301
+ }
7302
+ const scope = nodeId !== null && nodeId.length > 0 ? {
7303
+ kind: "node",
7304
+ nodeId
7305
+ } : input.scope ?? globalSecretScope();
7306
+ const result = await writeNode({
7307
+ ...base,
7308
+ scope
7309
+ }, node, incoming, input.stored[key], baseKey);
7310
+ if (result.kind === "value") out[key] = result.value;
7311
+ }
7312
+ return {
7313
+ patch: out,
7314
+ afterWrite: async () => {
7315
+ if (deletes.length === 0) return { orphaned: [] };
7316
+ try {
7317
+ await input.secrets.delete([...new Set(deletes)]);
7318
+ return { orphaned: [] };
7319
+ } catch {
7320
+ return { orphaned: [...new Set(deletes)] };
7321
+ }
7322
+ }
7323
+ };
7324
+ }
7325
+ /**
7326
+ * Replace every marker in `value` with its keychain value. Returns the SAME
7327
+ * reference when there is no marker (no allocation, no keychain call).
7328
+ */
7329
+ async function resolveSecretMarkers(value, secrets) {
7330
+ const refs = collectSecretMarkerRefs(value);
7331
+ if (refs.length === 0) return {
7332
+ value,
7333
+ unresolved: []
7334
+ };
7335
+ const answers = await secrets.resolve(refs);
7336
+ const unresolved = [];
7337
+ for (const ref of new Set(refs)) {
7338
+ const answer = answers[ref];
7339
+ if (answer === void 0) unresolved.push({
7340
+ ref,
7341
+ reason: "not-initialized"
7342
+ });
7343
+ else if (answer.kind === "unavailable") unresolved.push({
7344
+ ref,
7345
+ reason: answer.reason
7346
+ });
7347
+ else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
7348
+ ref,
7349
+ reason: answer.kind
7350
+ });
7351
+ }
7352
+ const substitute = (v) => {
7353
+ if (isSecretMarker(v)) {
7354
+ const answer = answers[v.$secret];
7355
+ return answer?.kind === "value" ? {
7356
+ keep: true,
7357
+ value: answer.value
7358
+ } : {
7359
+ keep: false,
7360
+ value: void 0
7361
+ };
7362
+ }
7363
+ if (Array.isArray(v)) {
7364
+ const items = [];
7365
+ for (const item of v) {
7366
+ const s = substitute(item);
7367
+ if (s.keep) items.push(s.value);
7368
+ }
7369
+ return {
7370
+ keep: true,
7371
+ value: items
7372
+ };
7373
+ }
7374
+ if (isRecord(v)) {
7375
+ const out = {};
7376
+ for (const [k, child] of Object.entries(v)) {
7377
+ const s = substitute(child);
7378
+ if (s.keep) out[k] = s.value;
7379
+ }
7380
+ return {
7381
+ keep: true,
7382
+ value: out
7383
+ };
7384
+ }
7385
+ return {
7386
+ keep: true,
7387
+ value: v
7388
+ };
7389
+ };
7390
+ return {
7391
+ value: substitute(value).value,
7392
+ unresolved
7393
+ };
7394
+ }
7395
+ function touchesTree(tree, patch) {
7396
+ if (tree.size === 0) return false;
7397
+ for (const key of Object.keys(patch)) {
7398
+ const at = key.indexOf("@");
7399
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
7400
+ }
7401
+ return false;
7402
+ }
7403
+ /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
7404
+ async function readStoredAddonBlob(raw) {
7405
+ const threeWay = raw.readAddonStoreResult;
7406
+ if (threeWay === void 0) return raw.readAddonStore();
7407
+ const result = await threeWay.call(raw);
7408
+ if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
7409
+ return result.kind === "missing" ? {} : result.value;
7410
+ }
7411
+ function createSecretAwareSettings(raw, opts) {
7412
+ const chains = /* @__PURE__ */ new Map();
7413
+ const serialize = (key, fn) => {
7414
+ const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
7415
+ const tail = next.catch(() => void 0);
7416
+ chains.set(key, tail);
7417
+ tail.then(() => {
7418
+ if (chains.get(key) === tail) chains.delete(key);
7419
+ });
7420
+ return next;
7421
+ };
7422
+ const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
7423
+ if (!touchesTree(tree, patch)) return rawWrite(patch);
7424
+ return serialize(chainKey, async () => {
7425
+ const stored = await readStored();
7426
+ const result = await transformSecretWrite({
7427
+ tree,
7428
+ secrets: opts.secrets,
7429
+ patch,
7430
+ stored,
7431
+ ...scope !== void 0 ? { scope } : {},
7432
+ operatorWrite: opts.isOperatorWrite?.() === true
7433
+ });
7434
+ if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
7435
+ const { orphaned } = await result.afterWrite();
7436
+ if (orphaned.length > 0) opts.onOrphaned(orphaned);
7437
+ });
7438
+ };
7439
+ const wrapped = {
7440
+ writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
7441
+ writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
7442
+ kind: "device",
7443
+ deviceId
7444
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
7445
+ };
7446
+ return new Proxy(raw, { get(target, prop, receiver) {
7447
+ if (prop === "writeAddonStore") return wrapped.writeAddonStore;
7448
+ if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
7449
+ const value = Reflect.get(target, prop, receiver);
7450
+ return typeof value === "function" ? value.bind(target) : value;
7451
+ } });
7452
+ }
7453
+ /** The context the addon sees: identical, except that its settings writes are secret-aware. */
7454
+ function withSecretAwareSettings(context, opts) {
7455
+ const raw = context.settings;
7456
+ if (raw === void 0) return context;
7457
+ const settings = createSecretAwareSettings(raw, opts);
7458
+ return new Proxy(context, { get(target, prop, receiver) {
7459
+ if (prop === "settings") return settings;
7460
+ return Reflect.get(target, prop, receiver);
7461
+ } });
7462
+ }
7463
+ var LEAF = { kind: "leaf" };
7464
+ var DEFAULT_ITEM_ID_KEY = "id";
7465
+ function collectFields(fields, out) {
7466
+ for (const field of fields) {
7467
+ if (field.type === "group") {
7468
+ collectFields(field.fields, out);
7469
+ continue;
7470
+ }
7471
+ if (field.type === "sub-tabs") {
7472
+ for (const tab of field.tabs) collectFields(tab.fields, out);
7473
+ continue;
7474
+ }
7475
+ if (field.type === "editable-array") {
7476
+ const item = /* @__PURE__ */ new Map();
7477
+ for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
7478
+ if (item.size > 0) out.set(field.key, {
7479
+ kind: "array",
7480
+ idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
7481
+ item
7482
+ });
7483
+ continue;
7484
+ }
7485
+ if (!("key" in field) || typeof field.key !== "string") continue;
7486
+ if (isKeychainStoredField(field)) out.set(field.key, LEAF);
7487
+ }
7488
+ }
7489
+ /** The secret tree a settings schema declares. */
7490
+ function secretTreeFromSchema(schema) {
7491
+ const out = /* @__PURE__ */ new Map();
7492
+ if (schema === null) return out;
7493
+ for (const section of schema.sections) collectFields(section.fields, out);
7494
+ return out;
7495
+ }
7496
+ /** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
7497
+ function parseSecretStatePath(path) {
7498
+ const segments = [];
7499
+ for (const raw of path.split(".")) {
7500
+ const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
7501
+ if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
7502
+ segments.push(m[2] !== void 0 ? {
7503
+ key: m[1],
7504
+ idKey: m[2]
7505
+ } : { key: m[1] });
7506
+ }
7507
+ if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
7508
+ if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
7509
+ return segments;
7510
+ }
7511
+ function insert(into, segments) {
7512
+ const [head, ...rest] = segments;
7513
+ if (head === void 0) return;
7514
+ if (rest.length === 0) {
7515
+ into.set(head.key, LEAF);
7516
+ return;
7517
+ }
7518
+ const existing = into.get(head.key);
7519
+ if (head.idKey !== void 0) {
7520
+ const item = new Map(existing?.kind === "array" ? existing.item : []);
7521
+ insert(item, rest);
7522
+ into.set(head.key, {
7523
+ kind: "array",
7524
+ idKey: head.idKey,
7525
+ item
7526
+ });
7527
+ return;
7528
+ }
7529
+ const children = new Map(existing?.kind === "object" ? existing.children : []);
7530
+ insert(children, rest);
7531
+ into.set(head.key, {
7532
+ kind: "object",
7533
+ children
7534
+ });
7535
+ }
7536
+ /** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
7537
+ function mergeSecretStatePaths(tree, paths) {
7538
+ if (paths.length === 0) return tree;
7539
+ const out = new Map(tree);
7540
+ for (const path of paths) insert(out, parseSecretStatePath(path));
7541
+ return out;
7542
+ }
7543
+ /** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
7544
+ var SECRET_RETRY_FIRST_MS = 5e3;
7545
+ var SECRET_RETRY_MAX_MS = 5 * 6e4;
7546
+ /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
7547
+ var SECRET_CHANGE_DEBOUNCE_MS = 250;
7012
7548
  /**
7013
7549
  * Base class for CamStack addons. Eliminates settings boilerplate:
7014
7550
  *
@@ -7078,6 +7614,25 @@ var BaseAddon = class {
7078
7614
  settingsStoreReady = false;
7079
7615
  /** Default config values. Provided via constructor. */
7080
7616
  defaults;
7617
+ /**
7618
+ * Hidden-state paths that hold secrets (D787) — values the addon writes
7619
+ * itself (`updateGlobalSettings`, `state()`) that no form field declares.
7620
+ * Stored in the keychain exactly like a `password` field. Syntax:
7621
+ * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
7622
+ * (`key[<id field>]` addresses array items by id, never by index).
7623
+ */
7624
+ secretStatePaths = [];
7625
+ _addonSecretTree = null;
7626
+ _deviceSecretTree = null;
7627
+ /** Refs the last resolved config pointed at — a change to one re-resolves. */
7628
+ _configSecretRefs = /* @__PURE__ */ new Set();
7629
+ _unresolvedSecrets = [];
7630
+ _secretRetryTimer = null;
7631
+ _secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
7632
+ _secretChangeTimer = null;
7633
+ _secretChangeUnsub = null;
7634
+ /** >0 while an OPERATOR's settings write is being applied. */
7635
+ _operatorWriteDepth = 0;
7081
7636
  constructor(defaults) {
7082
7637
  this.defaults = defaults;
7083
7638
  this._config = { ...defaults };
@@ -7113,8 +7668,18 @@ var BaseAddon = class {
7113
7668
  return this._config;
7114
7669
  }
7115
7670
  async initialize(context) {
7116
- this._ctx = context;
7671
+ const secrets = context.secrets;
7672
+ this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
7673
+ secrets,
7674
+ addonTree: () => this.addonSecretTree(),
7675
+ deviceTree: () => this.deviceSecretTree(),
7676
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
7677
+ isOperatorWrite: () => this._operatorWriteDepth > 0
7678
+ }) : context;
7117
7679
  await this.resolveConfig();
7680
+ if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
7681
+ if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
7682
+ });
7118
7683
  const result = await this.onInitialize();
7119
7684
  this.emitLifecycle(EventCategory.AddonStarted);
7120
7685
  const normalized = normalizeAddonInitResult(result);
@@ -7147,6 +7712,12 @@ var BaseAddon = class {
7147
7712
  */
7148
7713
  async onHubReachable() {}
7149
7714
  async shutdown() {
7715
+ this._secretChangeUnsub?.();
7716
+ this._secretChangeUnsub = null;
7717
+ if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
7718
+ if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
7719
+ this._secretRetryTimer = null;
7720
+ this._secretChangeTimer = null;
7150
7721
  this.emitLifecycle(EventCategory.AddonStopped);
7151
7722
  if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
7152
7723
  await this.onShutdown();
@@ -7225,7 +7796,7 @@ var BaseAddon = class {
7225
7796
  return hydrateSchema(schema, overlay ? {
7226
7797
  ...projected,
7227
7798
  ...overlay
7228
- } : projected);
7799
+ } : projected, { inlineSecretsAsViews: true });
7229
7800
  }
7230
7801
  /**
7231
7802
  * The integration-level view of this addon's settings: exactly the sections
@@ -7274,7 +7845,7 @@ var BaseAddon = class {
7274
7845
  return hydrateSchema({
7275
7846
  ...schema,
7276
7847
  sections
7277
- }, projected);
7848
+ }, projected, { inlineSecretsAsViews: true });
7278
7849
  }
7279
7850
  /**
7280
7851
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -7328,18 +7899,50 @@ var BaseAddon = class {
7328
7899
  value: result.value[key]
7329
7900
  };
7330
7901
  }
7902
+ /**
7903
+ * The OPERATOR's write — a settings form or an admin API call, dispatched by
7904
+ * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
7905
+ * the operator sends is stored as sent even when it equals a pre-keychain
7906
+ * inline value: the operator re-entering a password is a change, an addon
7907
+ * writing back what it read is not (D787).
7908
+ */
7909
+ async updateGlobalSettingsAsOperator(patch, nodeId) {
7910
+ this._operatorWriteDepth++;
7911
+ try {
7912
+ await this.applyGlobalPatch(patch, nodeId);
7913
+ } finally {
7914
+ this._operatorWriteDepth--;
7915
+ }
7916
+ }
7331
7917
  async updateGlobalSettings(patch, nodeId) {
7918
+ await this.applyGlobalPatch(patch, nodeId);
7919
+ }
7920
+ /**
7921
+ * REMOVE stored secrets — their keychain values and their markers (D787).
7922
+ *
7923
+ * Writing `''` to a secret field KEEPS what is stored (an empty string is
7924
+ * what a defaults fallback writes back, and it must never destroy a
7925
+ * credential), so code that means "forget this token" says so here. Without
7926
+ * a keychain (an older kernel) it writes `''`, as such code always did.
7927
+ */
7928
+ async clearSecrets(keys, nodeId) {
7929
+ const tree = this.addonSecretTree();
7930
+ const keychain = this._ctx?.secrets !== void 0;
7931
+ const patch = {};
7932
+ for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7933
+ await this.applyGlobalPatch(patch, nodeId);
7934
+ }
7935
+ async applyGlobalPatch(barePatch, nodeId) {
7332
7936
  const keys = this.perNodeKeys();
7333
7937
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
7334
7938
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
7335
- const barePatch = patch;
7336
7939
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
7337
7940
  await this._ctx?.settings?.writeAddonStore(scoped);
7338
7941
  if (target !== localNode) return;
7339
7942
  await this.resolveConfig();
7340
7943
  await this.onConfigChanged();
7341
7944
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
7342
- this.maybeAutoRestart(patch, this.globalSettingsSchema());
7945
+ this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
7343
7946
  }
7344
7947
  /**
7345
7948
  * The set of field keys the global settings schema declares `perNode: true`
@@ -7364,7 +7967,7 @@ var BaseAddon = class {
7364
7967
  * time to return its response before the addon is torn down and
7365
7968
  * re-initialised by `AddonRegistryService.restartAddon`.
7366
7969
  */
7367
- maybeAutoRestart(patch, schema) {
7970
+ maybeAutoRestart(patchKeys, schema) {
7368
7971
  if (!schema) return;
7369
7972
  const restartKeys = /* @__PURE__ */ new Set();
7370
7973
  for (const section of schema.sections) for (const field of section.fields) {
@@ -7372,13 +7975,13 @@ var BaseAddon = class {
7372
7975
  if (field.requiresRestart) restartKeys.add(field.key);
7373
7976
  }
7374
7977
  if (restartKeys.size === 0) return;
7375
- if (!Object.keys(patch).some((k) => restartKeys.has(k))) return;
7978
+ if (!patchKeys.some((k) => restartKeys.has(k))) return;
7376
7979
  const ctx = this._ctx;
7377
7980
  if (!ctx) return;
7378
7981
  const addonId = ctx.id;
7379
7982
  setImmediate(() => {
7380
7983
  ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7381
- ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: Object.keys(patch).filter((k) => restartKeys.has(k)) } });
7984
+ ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7382
7985
  }).catch((err) => {
7383
7986
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
7384
7987
  });
@@ -7387,7 +7990,7 @@ var BaseAddon = class {
7387
7990
  async getDeviceSettings(deviceId) {
7388
7991
  const schema = this.deviceSettingsSchema();
7389
7992
  if (!schema) return { sections: [] };
7390
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
7993
+ return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7391
7994
  }
7392
7995
  async updateDeviceSettings(deviceId, patch) {
7393
7996
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7517,7 +8120,7 @@ var BaseAddon = class {
7517
8120
  * selection at boot (absent scoped key ⇒ the constructor default wins).
7518
8121
  */
7519
8122
  async resolveConfig() {
7520
- const stored = await this.readAddonStoreWithRetry();
8123
+ const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
7521
8124
  const perNode = this.perNodeKeys();
7522
8125
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
7523
8126
  const resolved = { ...this.defaults };
@@ -7542,7 +8145,7 @@ var BaseAddon = class {
7542
8145
  key,
7543
8146
  schema,
7544
8147
  fallback,
7545
- read: () => this.readAddonStoreWithRetry(),
8148
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
7546
8149
  write: async (patch) => {
7547
8150
  await this._ctx?.settings?.writeAddonStore(patch);
7548
8151
  },
@@ -7559,7 +8162,7 @@ var BaseAddon = class {
7559
8162
  key,
7560
8163
  schema,
7561
8164
  fallback,
7562
- read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
8165
+ read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7563
8166
  write: async (patch) => {
7564
8167
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7565
8168
  },
@@ -7571,6 +8174,70 @@ var BaseAddon = class {
7571
8174
  } })
7572
8175
  });
7573
8176
  }
8177
+ /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
8178
+ addonSecretTree() {
8179
+ this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
8180
+ return this._addonSecretTree;
8181
+ }
8182
+ deviceSecretTree() {
8183
+ this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
8184
+ return this._deviceSecretTree;
8185
+ }
8186
+ /**
8187
+ * Secrets of this addon's stored config that could not be resolved on the
8188
+ * last read, with why. Non-empty means the addon is running WITHOUT them —
8189
+ * an addon whose function needs one should report itself degraded rather
8190
+ * than start on an empty credential.
8191
+ */
8192
+ get unresolvedSecrets() {
8193
+ return this._unresolvedSecrets;
8194
+ }
8195
+ /**
8196
+ * Substitute every keychain marker in a stored blob with its value. With no
8197
+ * keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
8198
+ * An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
8199
+ * value — and, when the cause can pass, retried with backoff. Nothing is
8200
+ * ever written back from here.
8201
+ */
8202
+ async resolveStoredSecrets(blob, trackForConfig = true) {
8203
+ const secrets = this._ctx?.secrets;
8204
+ if (secrets === void 0) return blob;
8205
+ const refs = collectSecretMarkerRefs(blob);
8206
+ if (trackForConfig) this._configSecretRefs = new Set(refs);
8207
+ if (refs.length === 0) {
8208
+ if (trackForConfig) this._unresolvedSecrets = [];
8209
+ return blob;
8210
+ }
8211
+ const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
8212
+ if (trackForConfig) {
8213
+ this._unresolvedSecrets = unresolved;
8214
+ if (unresolved.length > 0) {
8215
+ this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
8216
+ ref: u.ref,
8217
+ reason: u.reason
8218
+ })) } });
8219
+ if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
8220
+ this.scheduleSecretReresolve(this._secretRetryDelayMs);
8221
+ this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
8222
+ }
8223
+ } else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
8224
+ }
8225
+ return value;
8226
+ }
8227
+ /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
8228
+ scheduleSecretReresolve(delayMs) {
8229
+ const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
8230
+ if (this[timerOf] !== null) return;
8231
+ const timer = setTimeout(() => {
8232
+ this[timerOf] = null;
8233
+ if (this._ctx === null) return;
8234
+ this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
8235
+ this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
8236
+ });
8237
+ }, delayMs);
8238
+ timer.unref?.();
8239
+ this[timerOf] = timer;
8240
+ }
7574
8241
  /**
7575
8242
  * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7576
8243
  * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
@@ -8146,6 +8813,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8146
8813
  kind: "mutation",
8147
8814
  auth: "admin"
8148
8815
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
8816
+ function defOf(schema) {
8817
+ return schema._zod?.def ?? {};
8818
+ }
8819
+ function declaredHere(schema) {
8820
+ return globalRegistry.get(schema)?.secret === true;
8821
+ }
8822
+ /** Wrapper kinds whose `innerType` is the field itself. */
8823
+ var WRAPPERS = new Set([
8824
+ "optional",
8825
+ "nullable",
8826
+ "default",
8827
+ "prefault",
8828
+ "catch",
8829
+ "readonly",
8830
+ "nonoptional"
8831
+ ]);
8832
+ /**
8833
+ * The schema layers that make up ONE field: the schema itself and every
8834
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
8835
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8836
+ * `.transform` on `in`).
8837
+ */
8838
+ function layersOf(schema) {
8839
+ const out = [];
8840
+ const queue = [schema];
8841
+ while (queue.length > 0) {
8842
+ const s = queue.shift();
8843
+ if (!s || out.includes(s)) continue;
8844
+ out.push(s);
8845
+ const def = defOf(s);
8846
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8847
+ if (def.type === "pipe") {
8848
+ if (def.in) queue.push(def.in);
8849
+ if (def.out) queue.push(def.out);
8850
+ }
8851
+ }
8852
+ return out;
8853
+ }
8854
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
8855
+ function isZodSecret(schema) {
8856
+ return layersOf(schema).some(declaredHere);
8857
+ }
8858
+ /**
8859
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
8860
+ * element of this array" (`connection.password`, `rows[].token`). A declared
8861
+ * object or array is reported as one path and not descended into — everything
8862
+ * under it is secret.
8863
+ */
8864
+ function collectZodSecretPaths(schema, prefix = "") {
8865
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8866
+ const paths = [];
8867
+ for (const layer of layersOf(schema)) {
8868
+ const def = defOf(layer);
8869
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8870
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8871
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8872
+ else if (def.type === "intersection") {
8873
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8874
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8875
+ }
8876
+ }
8877
+ return [...new Set(paths)];
8878
+ }
8149
8879
  //#endregion
8150
8880
  //#region ../types/dist/err-msg-DX6i_MY4.mjs
8151
8881
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
@@ -15176,6 +15906,196 @@ id: union([string(), number()]) }), {
15176
15906
  kind: "mutation",
15177
15907
  auth: "admin"
15178
15908
  });
15909
+ /**
15910
+ * `keychain` — the hub's encrypted store of secret values (D787).
15911
+ *
15912
+ * Settings blobs never hold a secret: they hold a marker
15913
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
15914
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
15915
+ * is the OWNER's door to its own values: every method is owner-checked
15916
+ * against the CALLER, never against anything the caller claims.
15917
+ *
15918
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
15919
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
15920
+ * connection, the agent from its child's connection carried in
15921
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
15922
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
15923
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
15924
+ * identity against BUGS and misrouting, not against a malicious addon (every
15925
+ * runner is the same OS user): see the threat model in
15926
+ * `docs/design/2026-10-08-secrets-keychain.md`.
15927
+ *
15928
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
15929
+ * parses the input, so a session can never supply it, and the internal mount
15930
+ * floors every method to admin anyway (D240).
15931
+ *
15932
+ * Internal: addons reach it through `ctx.secrets`, never directly.
15933
+ */
15934
+ /** Why a value cannot be served right now. Never folded into "missing". */
15935
+ var KeychainUnavailableReasonSchema = _enum([
15936
+ "key-missing",
15937
+ "wrong-key",
15938
+ "key-file-unreadable",
15939
+ "store-unavailable",
15940
+ "not-initialized",
15941
+ "decrypt-failed"
15942
+ ]);
15943
+ var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
15944
+ state: literal("locked"),
15945
+ reason: KeychainUnavailableReasonSchema
15946
+ })]);
15947
+ var KeychainResolveEntrySchema = discriminatedUnion("kind", [
15948
+ object({
15949
+ kind: literal("value"),
15950
+ value: string(),
15951
+ version: number().int()
15952
+ }),
15953
+ object({ kind: literal("missing") }),
15954
+ object({
15955
+ kind: literal("unavailable"),
15956
+ reason: KeychainUnavailableReasonSchema
15957
+ }),
15958
+ object({ kind: literal("forbidden") })
15959
+ ]);
15960
+ var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
15961
+ /** Metadata of one stored value — never the value. */
15962
+ var KeychainSecretMetaSchema = object({
15963
+ ref: string(),
15964
+ owner: string(),
15965
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
15966
+ scope: string(),
15967
+ fieldPath: string(),
15968
+ version: number().int(),
15969
+ createdAt: number(),
15970
+ updatedAt: number(),
15971
+ /** `addon:<id>` | `user:<id>` | `system`. */
15972
+ updatedBy: string(),
15973
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
15974
+ lastReadAt: number().nullable()
15975
+ });
15976
+ var RefListSchema = array(string().min(1)).max(512);
15977
+ method(object({
15978
+ ref: string().min(1),
15979
+ value: string().min(1)
15980
+ }), object({
15981
+ ref: string(),
15982
+ version: number().int()
15983
+ }), {
15984
+ kind: "mutation",
15985
+ auth: "admin"
15986
+ }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
15987
+ kind: "mutation",
15988
+ auth: "admin"
15989
+ }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
15990
+ var KeychainKeySourceSchema = object({
15991
+ kind: _enum([
15992
+ "config-file",
15993
+ "previous-config-file",
15994
+ "platform",
15995
+ "default-file"
15996
+ ]),
15997
+ /** File sources only — a path is not a secret. */
15998
+ path: string().optional(),
15999
+ /**
16000
+ * True when a whole-volume backup of the data directory carries this key
16001
+ * next to the database it protects (the default file). The page warns.
16002
+ */
16003
+ sharesBackupWithDatabase: boolean()
16004
+ });
16005
+ var KeychainStatusSchema = object({
16006
+ keychain: KeychainStateSchema,
16007
+ /** The source of the master key in use; `null` while locked. */
16008
+ keySource: KeychainKeySourceSchema.nullable(),
16009
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
16010
+ configuredSource: KeychainKeySourceSchema,
16011
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
16012
+ fingerprint: string().nullable(),
16013
+ activeKeyId: string().nullable(),
16014
+ /**
16015
+ * The keychain unlocked with a NON-primary source: the configured primary
16016
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
16017
+ */
16018
+ rotationPending: boolean(),
16019
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
16020
+ retiredWraps: number().int(),
16021
+ recoveryKeyDownloadedAt: number().nullable(),
16022
+ secretCount: number().int()
16023
+ });
16024
+ /**
16025
+ * Whether a stored value is still pointed at by its owner's settings.
16026
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
16027
+ * never reported as an orphan (and never deleted as one).
16028
+ */
16029
+ var KeychainSecretUsageSchema = _enum([
16030
+ "in-use",
16031
+ "orphan",
16032
+ "unknown"
16033
+ ]);
16034
+ var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
16035
+ var KeychainAuditActionSchema = _enum([
16036
+ "put",
16037
+ "delete",
16038
+ "reveal",
16039
+ "rotate-master-key",
16040
+ "purge-retired-keys",
16041
+ "download-recovery-key",
16042
+ "delete-orphans",
16043
+ "reset",
16044
+ "initialize"
16045
+ ]);
16046
+ var KeychainAuditEntrySchema = object({
16047
+ id: string(),
16048
+ at: number(),
16049
+ action: KeychainAuditActionSchema,
16050
+ /** `addon:<id>` | `user:<id>` | `system`. */
16051
+ actor: string(),
16052
+ ref: string().nullable(),
16053
+ detail: string().nullable()
16054
+ });
16055
+ 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({
16056
+ value: string(),
16057
+ version: number().int()
16058
+ }), {
16059
+ kind: "mutation",
16060
+ auth: "admin",
16061
+ caller: "required"
16062
+ }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16063
+ deleted: array(string()).readonly(),
16064
+ kept: array(object({
16065
+ ref: string(),
16066
+ usage: KeychainSecretUsageSchema
16067
+ })).readonly()
16068
+ }), {
16069
+ kind: "mutation",
16070
+ auth: "admin",
16071
+ caller: "required"
16072
+ }), method(object({}), object({
16073
+ fingerprint: string(),
16074
+ keySource: KeychainKeySourceSchema
16075
+ }), {
16076
+ kind: "mutation",
16077
+ auth: "admin",
16078
+ caller: "required"
16079
+ }), method(object({}), object({ purged: number().int() }), {
16080
+ kind: "mutation",
16081
+ auth: "admin",
16082
+ caller: "required"
16083
+ }), method(object({}), object({
16084
+ key: string(),
16085
+ fingerprint: string(),
16086
+ keySource: KeychainKeySourceSchema
16087
+ }), {
16088
+ kind: "mutation",
16089
+ auth: "admin",
16090
+ caller: "required"
16091
+ }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
16092
+ archivedCollection: string().nullable(),
16093
+ archived: number().int()
16094
+ }), {
16095
+ kind: "mutation",
16096
+ auth: "admin",
16097
+ caller: "required"
16098
+ });
15179
16099
  method(_void(), object({
15180
16100
  id: string(),
15181
16101
  name: string(),
@@ -16198,6 +17118,10 @@ var DeviceInfoSchema = object({
16198
17118
  isCamera: boolean(),
16199
17119
  /** Current config values — serializable snapshot */
16200
17120
  config: record(string(), unknown()),
17121
+ /** Paths inside `config` the device's schema declares secret (D783) —
17122
+ * what the non-admin redaction withholds. Paths, never values. Absent
17123
+ * when the owning runner has not reported them. */
17124
+ secretConfigPaths: array(string()).optional(),
16201
17125
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
16202
17126
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
16203
17127
  metadata: record(string(), unknown()).nullable().optional(),
@@ -16403,12 +17327,22 @@ var DeviceRegisterPayloadSchema = object({
16403
17327
  * call (workers re-register on init), so probe-driven updates
16404
17328
  * (e.g. PTZ flag flipping after the abilities probe) propagate. */
16405
17329
  features: array(string()).optional(),
16406
- config: record(string(), unknown())
17330
+ config: record(string(), unknown()),
17331
+ /** Config paths the device's own schema DECLARES secret
17332
+ * (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
17333
+ * `connection.password`). Re-published on every register; the non-admin
17334
+ * redaction withholds them at any depth (D783). Optional: an older runner
17335
+ * omits it and the keyword backstop applies. */
17336
+ secretConfigPaths: array(string()).optional()
16407
17337
  });
16408
17338
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
16409
17339
  var DevicePersistConfigPayloadSchema = object({
16410
17340
  deviceId: number(),
16411
- data: record(string(), unknown())
17341
+ data: record(string(), unknown()),
17342
+ /** The paths the device's schema declares secret (D783), when the caller
17343
+ * knows them — those values are kept in the keychain, not the blob (D787).
17344
+ * Absent: the paths the device last reported at `registerDevice` apply. */
17345
+ secretConfigPaths: array(string()).optional()
16412
17346
  });
16413
17347
  /** What a migration actually did, per switch. `unreachable` is a first-class
16414
17348
  * answer: a camera that could not be asked is not a camera that was silenced. */
@@ -18062,7 +18996,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
18062
18996
  icon: string().optional(),
18063
18997
  /** Addon-owned HTTP route the button navigates to (GET). */
18064
18998
  startUrl: string(),
18065
- stage: LoginStageEnum
18999
+ stage: LoginStageEnum,
19000
+ /**
19001
+ * The provider names an external identity a signed-in user can link to
19002
+ * their own account (D782): `auth.listLinkableProviders` /
19003
+ * `beginExternalLink` offer exactly the redirect methods that set this,
19004
+ * whatever their id. Absent / false — a login button only (magic-link).
19005
+ */
19006
+ linkable: boolean().optional()
18066
19007
  }),
18067
19008
  object({
18068
19009
  kind: literal("widget"),
@@ -23418,8 +24359,23 @@ var RetrainMacroClassSchema = _enum([
23418
24359
  ]);
23419
24360
  /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
23420
24361
  var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
23421
- /** Did a human draw this box, or did the assist propose it? */
23422
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
24362
+ /**
24363
+ * Where a box came from. A machine-sourced box is a DRAFT on the page until
24364
+ * the operator confirms it; once saved it keeps its source as provenance.
24365
+ *
24366
+ * - `operator` — drawn by hand.
24367
+ * - `assist` — proposed by a detector run on the copy (the camera's own
24368
+ * model, or a larger teacher model).
24369
+ * - `pipeline` — the box the live pipeline actually drew on that frame, read
24370
+ * back from the track store (never a re-run).
24371
+ * - `llm` — proposed by a vision-capable LLM profile.
24372
+ */
24373
+ var RetrainAnnotationSourceSchema = _enum([
24374
+ "operator",
24375
+ "assist",
24376
+ "pipeline",
24377
+ "llm"
24378
+ ]);
23423
24379
  /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
23424
24380
  var RetrainBboxSchema = object({
23425
24381
  x: number(),
@@ -23437,7 +24393,8 @@ var RetrainBboxSchema = object({
23437
24393
  */
23438
24394
  var RetrainAnnotationSchema = object({
23439
24395
  id: string(),
23440
- trackId: string(),
24396
+ /** The frame's track. Absent on a recording still, which has none. */
24397
+ trackId: string().optional(),
23441
24398
  deviceId: number(),
23442
24399
  /** The COPY in retrain storage — never the source track's media key. */
23443
24400
  mediaKey: string(),
@@ -23486,18 +24443,63 @@ var RetrainFrameCandidateSchema = object({
23486
24443
  * fail, whatever became of the original. */
23487
24444
  copied: boolean()
23488
24445
  });
24446
+ /**
24447
+ * One box the live pipeline drew on a copied frame — what a correction starts
24448
+ * from. Derived when the frame is listed, from the track store: the subject
24449
+ * box recorded on the source media row when there is one, else the track
24450
+ * position nearest the frame's capture time. Never stored as an annotation
24451
+ * until the operator confirms it.
24452
+ */
24453
+ var RetrainPipelineBoxSchema = object({
24454
+ /** Normalised `[0,1]` against the full frame. */
24455
+ bbox: RetrainBboxSchema,
24456
+ macroClass: RetrainMacroClassSchema,
24457
+ label: string().optional(),
24458
+ subLabel: string().optional(),
24459
+ /** The detection score of the position used, when it was recorded. */
24460
+ score: number().optional(),
24461
+ /** The root model that produced the track, when it was recorded. */
24462
+ modelId: string().optional(),
24463
+ trackId: string(),
24464
+ /** `subject-box`: recorded on this very frame. `position`: the track's
24465
+ * position nearest the capture time, `deltaMs` away. */
24466
+ basis: _enum(["subject-box", "position"]),
24467
+ deltaMs: number()
24468
+ });
24469
+ /**
24470
+ * Where a retrain frame came from: a TRACK's stored media (copy-on-select),
24471
+ * or the RECORDING at an instant — the frame a model saw nothing in has no
24472
+ * track at all.
24473
+ */
24474
+ var RetrainFrameOriginSchema = _enum(["track", "recording"]);
23489
24475
  /** A frame the dataset OWNS: bytes copied at selection time. */
23490
24476
  var RetrainFrameSchema = object({
23491
24477
  frameId: string(),
23492
24478
  deviceId: number(),
23493
- trackId: string(),
23494
- /** Provenance only. It may already point at nothing — that is expected. */
23495
- sourceMediaId: number().int(),
24479
+ origin: RetrainFrameOriginSchema,
24480
+ /** The track it was copied from. Absent on a recording still. */
24481
+ trackId: string().optional(),
24482
+ /** Provenance only. It may already point at nothing — that is expected.
24483
+ * Absent on a recording still. */
24484
+ sourceMediaId: number().int().optional(),
24485
+ /** A recording still: the playhead instant it was taken at. */
24486
+ epochMs: number().optional(),
23496
24487
  sourceKind: MediaFileKindEnum,
23497
24488
  sizeBytes: number().int(),
23498
24489
  width: number().int(),
23499
24490
  height: number().int(),
23500
- copiedAt: number()
24491
+ copiedAt: number(),
24492
+ /** When the CAMERA captured the frame. Absent on a copy taken before D785. */
24493
+ capturedAt: number().optional(),
24494
+ /** The operator's "every subject in this frame is boxed". Detector
24495
+ * evaluation keeps only complete frames: an unboxed subject would count as
24496
+ * a false positive. */
24497
+ complete: boolean(),
24498
+ /** The boxes the pipeline drew on this frame. Present on list answers;
24499
+ * empty when nothing the track store holds can be placed on it. */
24500
+ pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
24501
+ /** The named collections this frame belongs to. Present on list answers. */
24502
+ collectionIds: array(string()).readonly().optional()
23501
24503
  });
23502
24504
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
23503
24505
  var RetrainCopyRefusalSchema = _enum([
@@ -23518,6 +24520,53 @@ var RetrainFrameListSchema = object({
23518
24520
  /** What the page pre-selects — the native key frame when one survives. */
23519
24521
  autoPickMediaId: number().int().optional()
23520
24522
  });
24523
+ /**
24524
+ * Which frames an annotated export carries. Every field narrows; an empty
24525
+ * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
24526
+ * list owned by whoever trains (the training orchestrator), so `frameIds` is
24527
+ * the primitive a version export uses; `batchId` re-selects what an earlier
24528
+ * export carried (`exportedInBatch`).
24529
+ */
24530
+ var RetrainExportFilterSchema = object({
24531
+ deviceIds: array(number()).optional(),
24532
+ frameIds: array(string()).max(2e4).optional(),
24533
+ /** Only frames in at least one of these named collections. */
24534
+ collectionIds: array(string()).max(200).optional(),
24535
+ batchId: string().optional(),
24536
+ /** Only frames the operator marked complete (all subjects boxed). */
24537
+ completeOnly: boolean().optional()
24538
+ });
24539
+ /**
24540
+ * `frames`: the full frame copies, boxes in `annotations.json`.
24541
+ * `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
24542
+ * convention — the classifier layout.
24543
+ */
24544
+ var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
24545
+ /**
24546
+ * Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
24547
+ * the archive, sent chunk by chunk. Covers a presigned PUT and a provider
24548
+ * addon's data-plane upload route alike. Headers are sent verbatim and never
24549
+ * logged.
24550
+ */
24551
+ var RetrainArchiveTargetSchema = object({
24552
+ kind: literal("http"),
24553
+ method: _enum(["PUT", "POST"]),
24554
+ url: string().url(),
24555
+ headers: record(string(), string()).optional()
24556
+ });
24557
+ var RetrainArchiveResultSchema = object({
24558
+ batchId: string(),
24559
+ frames: number().int(),
24560
+ crops: number().int(),
24561
+ annotations: number().int(),
24562
+ /** Frames planned but not shipped (unreadable copy, path too long). */
24563
+ missing: number().int(),
24564
+ bytes: number().int(),
24565
+ /** sha256 of the exact bytes sent. */
24566
+ sha256: string(),
24567
+ /** The target's HTTP status. */
24568
+ status: number().int()
24569
+ });
23521
24570
  /** What the operator asked the assist to look for. */
23522
24571
  var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
23523
24572
  kind: literal("package"),
@@ -23547,6 +24596,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
23547
24596
  reason: string(),
23548
24597
  detail: string().optional()
23549
24598
  })]);
24599
+ /** A named set over the retrain corpus — membership only, it owns no pixels. */
24600
+ var RetrainCollectionSchema = object({
24601
+ id: string(),
24602
+ name: string(),
24603
+ createdAt: number(),
24604
+ frameCount: number().int()
24605
+ });
24606
+ var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
24607
+ kind: literal("created"),
24608
+ collection: RetrainCollectionSchema
24609
+ }), object({
24610
+ kind: literal("refused"),
24611
+ reason: _enum(["empty-name", "duplicate-name"])
24612
+ })]);
24613
+ var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
24614
+ kind: literal("renamed"),
24615
+ collection: RetrainCollectionSchema
24616
+ }), object({
24617
+ kind: literal("refused"),
24618
+ reason: _enum([
24619
+ "empty-name",
24620
+ "duplicate-name",
24621
+ "unknown-collection"
24622
+ ])
24623
+ })]);
24624
+ /**
24625
+ * The outcome of adding the frame at a recording instant. Every refusal is
24626
+ * named: `still-unavailable` (not recording, a gap, or an undecodable frame —
24627
+ * `detail` says which), `still-busy` (the recorder is at its decode bound; try
24628
+ * again), `unreadable-image`, `write-failed`, `unknown-collection`.
24629
+ */
24630
+ var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
24631
+ kind: literal("added"),
24632
+ collectionId: string(),
24633
+ frame: RetrainFrameSchema,
24634
+ /** The moment was already in the dataset; nothing was decoded. */
24635
+ reused: boolean()
24636
+ }), object({
24637
+ kind: literal("refused"),
24638
+ reason: _enum([
24639
+ "unknown-collection",
24640
+ "still-unavailable",
24641
+ "still-busy",
24642
+ "unreadable-image",
24643
+ "write-failed"
24644
+ ]),
24645
+ detail: string().optional()
24646
+ })]);
24647
+ /** A vision LLM profile the AI assist may use, and where it sends the frame. */
24648
+ var RetrainAssistProfileSchema = object({
24649
+ id: string(),
24650
+ name: string(),
24651
+ model: string(),
24652
+ kind: string(),
24653
+ /** `true` when the frame would leave the house (a cloud vendor, or an
24654
+ * endpoint that is not on the local network). The page confirms each such
24655
+ * run, and the provider refuses one without `allowCloud`. */
24656
+ leavesHouse: boolean()
24657
+ });
24658
+ /** A box the AI assist proposed: a draft, plus the model's own reason. */
24659
+ var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
24660
+ /** What the AI assist said about a box that was already on the canvas. */
24661
+ var RetrainLlmReviewSchema = object({
24662
+ /** The `ref` the page sent the box under. */
24663
+ ref: string(),
24664
+ verdict: _enum([
24665
+ "confirmed",
24666
+ "wrong-class",
24667
+ "not-an-object",
24668
+ "uncertain"
24669
+ ]),
24670
+ suggestedClass: RetrainMacroClassSchema.optional(),
24671
+ reason: string()
24672
+ });
24673
+ /**
24674
+ * The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
24675
+ * model and its confidence) and reviews; items the model got wrong (a box off
24676
+ * the frame, an unasked class, an unknown ref) are dropped and counted in
24677
+ * `rejected`. A whole answer that is not the schema is `malformed-answer`.
24678
+ */
24679
+ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
24680
+ kind: literal("proposed"),
24681
+ profileId: string(),
24682
+ model: string(),
24683
+ /** The frame was sent outside the house for this answer. */
24684
+ leftHouse: boolean(),
24685
+ proposals: array(RetrainLlmProposalSchema).readonly(),
24686
+ reviews: array(RetrainLlmReviewSchema).readonly(),
24687
+ rejected: number().int()
24688
+ }), object({
24689
+ kind: literal("refused"),
24690
+ reason: _enum([
24691
+ "unknown-frame",
24692
+ "unreadable-frame",
24693
+ "unknown-profile",
24694
+ "profile-disabled",
24695
+ "no-vision",
24696
+ "cloud-not-confirmed",
24697
+ "llm-error",
24698
+ "malformed-answer"
24699
+ ]),
24700
+ detail: string().optional()
24701
+ })]);
23550
24702
  /** The outcome of a lifecycle move owned by the retrain page. */
23551
24703
  var RetrainTransitionResultSchema = object({
23552
24704
  trackId: string(),
@@ -24264,7 +25416,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24264
25416
  auth: "admin"
24265
25417
  }), method(object({
24266
25418
  deviceId: number(),
24267
- trackId: string(),
25419
+ trackId: string().optional(),
24268
25420
  frameId: string()
24269
25421
  }), object({
24270
25422
  removed: boolean(),
@@ -24281,7 +25433,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24281
25433
  auth: "admin"
24282
25434
  }), method(object({
24283
25435
  deviceId: number(),
24284
- trackId: string(),
25436
+ /** The frame's track, when it has one — checked against the frame. */
25437
+ trackId: string().optional(),
24285
25438
  frameId: string(),
24286
25439
  subject: RetrainAssistSubjectSchema,
24287
25440
  /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
@@ -24289,12 +25442,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24289
25442
  }), RetrainAssistResultSchema, {
24290
25443
  kind: "mutation",
24291
25444
  auth: "admin"
24292
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
25445
+ }), method(object({
25446
+ trackId: string().optional(),
25447
+ frameIds: array(string()).max(2e3).optional()
25448
+ }), array(RetrainAnnotationSchema).readonly(), {
24293
25449
  kind: "query",
24294
25450
  auth: "admin"
24295
25451
  }), method(object({
24296
25452
  deviceId: number(),
24297
- trackId: string(),
25453
+ /** The frame's track, when it has one — checked against the frame. */
25454
+ trackId: string().optional(),
24298
25455
  frameId: string(),
24299
25456
  annotations: array(RetrainAnnotationDraftSchema)
24300
25457
  }), array(RetrainAnnotationSchema).readonly(), {
@@ -24312,7 +25469,91 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24312
25469
  }), RetrainTransitionResultSchema, {
24313
25470
  kind: "mutation",
24314
25471
  auth: "admin"
24315
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
25472
+ }), method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string() }), {
25473
+ kind: "query",
25474
+ auth: "admin"
25475
+ }), method(object({
25476
+ deviceId: number(),
25477
+ trackId: string().optional(),
25478
+ frameId: string(),
25479
+ complete: boolean()
25480
+ }), RetrainFrameSchema, {
25481
+ kind: "mutation",
25482
+ auth: "admin"
25483
+ }), method(object({
25484
+ filter: RetrainExportFilterSchema,
25485
+ layout: RetrainExportLayoutSchema,
25486
+ target: RetrainArchiveTargetSchema
25487
+ }), RetrainArchiveResultSchema, {
25488
+ kind: "mutation",
25489
+ auth: "admin",
25490
+ timeoutMs: 60 * 6e4
25491
+ }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
25492
+ kind: "query",
25493
+ auth: "admin"
25494
+ }), method(object({
25495
+ deviceId: number(),
25496
+ trackId: string().optional(),
25497
+ frameId: string(),
25498
+ profileId: string(),
25499
+ classes: array(RetrainMacroClassSchema).min(1),
25500
+ boxes: array(object({
25501
+ ref: string(),
25502
+ bbox: RetrainBboxSchema,
25503
+ macroClass: RetrainMacroClassSchema,
25504
+ label: string().optional()
25505
+ })).max(50),
25506
+ allowCloud: boolean()
25507
+ }), RetrainLlmAssistResultSchema, {
25508
+ kind: "mutation",
25509
+ auth: "admin",
25510
+ timeoutMs: 18e4
25511
+ }), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
25512
+ kind: "mutation",
25513
+ auth: "admin"
25514
+ }), method(object({}), array(RetrainCollectionSchema).readonly(), {
25515
+ kind: "query",
25516
+ auth: "admin"
25517
+ }), method(object({
25518
+ id: string(),
25519
+ name: string().max(120)
25520
+ }), RetrainCollectionRenameResultSchema, {
25521
+ kind: "mutation",
25522
+ auth: "admin"
25523
+ }), method(object({ id: string() }), object({
25524
+ deleted: boolean(),
25525
+ removedFrames: number().int()
25526
+ }), {
25527
+ kind: "mutation",
25528
+ auth: "admin"
25529
+ }), method(object({
25530
+ collectionId: string(),
25531
+ deviceId: number(),
25532
+ epochMs: number()
25533
+ }), AddRetrainFrameFromRecordingResultSchema, {
25534
+ kind: "mutation",
25535
+ auth: "admin",
25536
+ timeoutMs: 6e4
25537
+ }), method(object({
25538
+ collectionId: string(),
25539
+ frameIds: array(string()).min(1).max(500)
25540
+ }), object({
25541
+ added: number().int(),
25542
+ alreadyMember: number().int(),
25543
+ unknownFrameIds: array(string()).readonly()
25544
+ }), {
25545
+ kind: "mutation",
25546
+ auth: "admin"
25547
+ }), method(object({
25548
+ collectionId: string(),
25549
+ frameId: string()
25550
+ }), object({
25551
+ removed: boolean(),
25552
+ deletedFrame: boolean()
25553
+ }), {
25554
+ kind: "mutation",
25555
+ auth: "admin"
25556
+ }), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
24316
25557
  kind: "query",
24317
25558
  auth: "admin"
24318
25559
  }), method(object({
@@ -24938,13 +26179,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
24938
26179
  object({
24939
26180
  kind: literal("no-family-build"),
24940
26181
  format: ModelFormatSchema$1
26182
+ }),
26183
+ object({
26184
+ kind: literal("kept-custom-pin"),
26185
+ modelId: string(),
26186
+ deviceKey: string()
24941
26187
  })
24942
26188
  ]);
26189
+ /** Why a device is left exactly as it is, whatever the plan would pick (D786). */
26190
+ var KeptReasonSchema = _enum(["custom-pin"]);
26191
+ /**
26192
+ * Where a choice's latency came from (D791): this node's own benchmark
26193
+ * result, or the hardware-class table. Measured on the node beats the table.
26194
+ */
26195
+ var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
26196
+ kind: literal("node-benchmark"),
26197
+ resultId: string(),
26198
+ measuredAtMs: number()
26199
+ })]);
24943
26200
  var DeviceModelChoiceSchema = object({
24944
26201
  modelId: string(),
24945
26202
  p50Ms: number(),
24946
26203
  fps: number(),
24947
26204
  measured: boolean(),
26205
+ /** Absent on a plan from before D791 — read as the table. */
26206
+ source: LatencySourceSchema.optional(),
24948
26207
  /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
24949
26208
  capacitySessions: number(),
24950
26209
  personRecall: number()
@@ -24955,6 +26214,8 @@ var DeviceRecommendationSchema = object({
24955
26214
  enabled: boolean(),
24956
26215
  available: boolean(),
24957
26216
  chosen: DeviceModelChoiceSchema.nullable(),
26217
+ /** Present when the device is kept as is: Apply writes nothing on it. */
26218
+ kept: KeptReasonSchema.optional(),
24958
26219
  reasons: array(RecommendationReasonSchema).readonly()
24959
26220
  });
24960
26221
  var NodeRecommendationSchema = object({
@@ -25008,6 +26269,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
25008
26269
  kind: literal("coral-enabled"),
25009
26270
  nodeId: string(),
25010
26271
  deviceKey: string()
26272
+ }),
26273
+ object({
26274
+ kind: literal("custom-pin-kept"),
26275
+ nodeId: string(),
26276
+ deviceKey: string().nullable(),
26277
+ deviceId: number().nullable(),
26278
+ modelId: string()
26279
+ }),
26280
+ object({
26281
+ kind: literal("custom-registry-unreadable"),
26282
+ error: string()
25011
26283
  })
25012
26284
  ]);
25013
26285
  var AutoTuneOptionsSchema = object({
@@ -25186,13 +26458,14 @@ var SuggestSharesResultSchema = object({
25186
26458
  nodes: array(SuggestedNodeShareSchema).readonly()
25187
26459
  });
25188
26460
  /**
25189
- * Where the node and device shares come from (D750, D755).
25190
- * - `hardware` (default) — computed by the system from each node's static
25191
- * capacity (its accelerators at their Auto tune models, from the measured
25192
- * latency table), recomputed whenever a node or device joins, leaves, is
25193
- * switched on or off, or changes model. No load input.
25194
- * - `benchmark` — the same, from each node's measured capacity (node
25195
- * benchmark results); a node without results falls back to `hardware`.
26461
+ * Where the node and device shares come from (D750, D755, D791).
26462
+ * - `benchmark` (default since D791) — each node's capacity as its own node
26463
+ * benchmark measured it; a node without fresh results is sized from
26464
+ * `hardware` and says so. Measured on the node beats the table.
26465
+ * - `hardware` — computed from each node's static capacity only (its
26466
+ * accelerators at their Auto tune models, from the latency table).
26467
+ * Both are recomputed whenever a node or device joins, leaves, is switched
26468
+ * on or off, changes model, or a benchmark result is written. No load input.
25196
26469
  * - `manual` — the operator's stored sliders.
25197
26470
  * Either way a node or device that cannot take sessions gives its share to
25198
26471
  * the others in proportion; the stored values are never rewritten for that.
@@ -25241,6 +26514,362 @@ var EffectiveSharesSchema = object({
25241
26514
  nodeWeights: record(string(), number()),
25242
26515
  deviceWeights: record(string(), record(string(), number()))
25243
26516
  });
26517
+ /**
26518
+ * Wire shapes of the node benchmark (D791): the operator's plan, the
26519
+ * preflight the confirmation shows, the run the orchestrator owns, what the
26520
+ * measuring runner reports, and the result rows Auto tune and the automatic
26521
+ * shares read.
26522
+ *
26523
+ * ONE node at a time, owned by the pipeline orchestrator. While a run is
26524
+ * active the cluster is in BENCHMARK MODE for that node: it is not a
26525
+ * detection candidate, camera pins naming it are ignored so its sessions move
26526
+ * elsewhere, and both come back when the mode ends — after a crash or a hub
26527
+ * restart too (a persisted manifest, reconciled against the registry).
26528
+ *
26529
+ * Two measurements, both on the node, driven by its own runner (frames never
26530
+ * cross a process at frame rate, D9):
26531
+ * - `device` — one accelerator × one candidate detector, root only, open
26532
+ * loop: how many streams at the camera rate it carries inside the frame
26533
+ * interval;
26534
+ * - `pipeline` — the chosen detector plus the operator's detail steps
26535
+ * (faces, plates, classifiers, CLIP…), on varied frames from the bench
26536
+ * clip: how many parallel sessions the node carries before latency, drops,
26537
+ * CPU, RAM or the event loop give out.
26538
+ */
26539
+ /** Defaults and bounds, one place. */
26540
+ var NODE_BENCHMARK_DEFAULTS = {
26541
+ fpsPerStream: 10,
26542
+ budgetMinutes: 45,
26543
+ minBudgetMinutes: 10,
26544
+ maxBudgetMinutes: 120,
26545
+ /** A result older than this no longer beats the table. */
26546
+ staleAfterDays: 30,
26547
+ /** Warm-in per ramp step (not accounted). */
26548
+ settleSec: 5,
26549
+ /** Accounted window per ramp step. */
26550
+ measureSec: 20,
26551
+ /** Longest the drain may take before the run is refused. */
26552
+ drainTimeoutSec: 120,
26553
+ /** Candidate models per device in one run. */
26554
+ maxModelsPerDevice: 6
26555
+ };
26556
+ /** The two measurements a run can make. */
26557
+ var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
26558
+ var NodeBenchmarkDevicePlanSchema = object({
26559
+ /** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
26560
+ deviceKey: string().min(1),
26561
+ /**
26562
+ * Root detector candidates for the `device` measurement, in the order
26563
+ * measured. The FIRST is the one the `pipeline` measurement runs.
26564
+ */
26565
+ modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
26566
+ });
26567
+ /** What the operator confirmed. */
26568
+ var NodeBenchmarkPlanSchema = object({
26569
+ nodeId: string().min(1),
26570
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
26571
+ /** Which measurements run. At least one. */
26572
+ phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
26573
+ /**
26574
+ * Detail steps (catalog step ids under the root: faces, plates,
26575
+ * classifiers, CLIP…) the `pipeline` measurement enables. The root
26576
+ * detector always runs.
26577
+ */
26578
+ steps: array(string().min(1)).default([]),
26579
+ /** Offered rate of one stream / session. */
26580
+ fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
26581
+ /** Hard deadline: the mode ends and the cluster is restored when it passes. */
26582
+ budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
26583
+ /** Keep the models the run downloaded (default: delete what was not installed before). */
26584
+ keepDownloadedModels: boolean().default(false),
26585
+ /** Start although the other nodes' capacity does not cover the sessions running now. */
26586
+ acceptInsufficientHeadroom: boolean().default(false)
26587
+ });
26588
+ var NodeBenchmarkRefusalSchema = object({
26589
+ kind: _enum([
26590
+ "benchmark-active",
26591
+ "node-offline",
26592
+ "unknown-device",
26593
+ "no-phase",
26594
+ "insufficient-headroom"
26595
+ ]),
26596
+ detail: string(),
26597
+ overridable: boolean()
26598
+ });
26599
+ /** A camera whose detection leaves the node for the run. */
26600
+ var NodeBenchmarkMovingCameraSchema = object({
26601
+ deviceId: number(),
26602
+ /** Placed on the node now (a standing attach or a running session). */
26603
+ placedOnNode: boolean(),
26604
+ /** A node pin naming this node, ignored for the run. */
26605
+ pinnedToNode: boolean()
26606
+ });
26607
+ /** A camera that cannot leave: no other node can obtain its frames. */
26608
+ var NodeBenchmarkStayingCameraSchema = object({
26609
+ deviceId: number(),
26610
+ reason: literal("only-frame-source")
26611
+ });
26612
+ var NodeBenchmarkPreflightSchema = object({
26613
+ nodeId: string(),
26614
+ online: boolean(),
26615
+ moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
26616
+ /** Keep running on the node during the run; the result is flagged contaminated. */
26617
+ staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
26618
+ estimatedDurationMs: number(),
26619
+ /** The run ends and the cluster is restored at the latest after this long. */
26620
+ budgetMs: number(),
26621
+ phases: array(NodeBenchmarkPhaseSchema).readonly(),
26622
+ steps: array(string()).readonly(),
26623
+ devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
26624
+ /** Parallel sessions the cluster runs now, and what the other nodes can carry. */
26625
+ headroom: object({
26626
+ sessionsNow: number(),
26627
+ otherNodesCapacitySessions: number().nullable()
26628
+ }),
26629
+ refusals: array(NodeBenchmarkRefusalSchema).readonly(),
26630
+ canStart: boolean()
26631
+ });
26632
+ /** Where the measuring runner is. */
26633
+ var NodeBenchProgressSchema = object({
26634
+ phase: _enum([
26635
+ "preparing",
26636
+ "device",
26637
+ "pipeline",
26638
+ "cleanup"
26639
+ ]),
26640
+ deviceKey: string().nullable(),
26641
+ modelId: string().nullable(),
26642
+ /** Streams (device) or sessions (pipeline) of the step running now. */
26643
+ load: number().nullable(),
26644
+ cellsDone: number(),
26645
+ cellsTotal: number(),
26646
+ message: string()
26647
+ });
26648
+ /** What limited a ramp. `none` = the ramp ran out of steps still passing. */
26649
+ var NodeBenchLimitSchema = _enum([
26650
+ "p95",
26651
+ "drops",
26652
+ "errors",
26653
+ "stall",
26654
+ "cpu",
26655
+ "ram",
26656
+ "none"
26657
+ ]);
26658
+ var NodeBenchRampStepSchema = object({
26659
+ load: number(),
26660
+ pass: boolean(),
26661
+ p95Ms: number(),
26662
+ dropRatio: number(),
26663
+ /** Completed frames per second over the accounted window. */
26664
+ fps: number(),
26665
+ cpuPct: number().nullable(),
26666
+ ramFreePct: number().nullable(),
26667
+ failReasons: array(string()).readonly()
26668
+ });
26669
+ var NodeBenchCellSchema = discriminatedUnion("phase", [object({
26670
+ phase: literal("device"),
26671
+ deviceKey: string(),
26672
+ modelId: string(),
26673
+ /** Single-stream latency (the K = 1 step). */
26674
+ p50Ms: number(),
26675
+ p95Ms: number(),
26676
+ p99Ms: number(),
26677
+ /** Frames per second sustained at the last passing step. */
26678
+ fps: number(),
26679
+ /** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
26680
+ kMax: number(),
26681
+ limitedBy: NodeBenchLimitSchema,
26682
+ /** First call (model load + warm-up). */
26683
+ warmupMs: number(),
26684
+ ramp: array(NodeBenchRampStepSchema).readonly()
26685
+ }), object({
26686
+ phase: literal("pipeline"),
26687
+ deviceKey: string(),
26688
+ modelId: string(),
26689
+ steps: array(string()).readonly(),
26690
+ /** Parallel sessions at the camera rate the node carried; 0 = not even one. */
26691
+ maxSessions: number(),
26692
+ limitedBy: NodeBenchLimitSchema,
26693
+ /** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
26694
+ stepsFired: array(string()).readonly(),
26695
+ warmupMs: number(),
26696
+ ramp: array(NodeBenchRampStepSchema).readonly()
26697
+ })]);
26698
+ /**
26699
+ * What a result was measured ON. A result whose fingerprint no longer matches
26700
+ * the node no longer beats the table.
26701
+ */
26702
+ var NodeBenchFingerprintSchema = object({
26703
+ pipelineVersion: string().nullable(),
26704
+ cpuModel: string().nullable(),
26705
+ ramGb: number().nullable(),
26706
+ os: string().nullable(),
26707
+ /** Per device: the pool the cells ran on (runtime + tuning). */
26708
+ pools: record(string(), object({
26709
+ runtime: string(),
26710
+ numWorkers: number(),
26711
+ concurrency: number(),
26712
+ batchMode: string()
26713
+ })).default({})
26714
+ });
26715
+ /** The frames the run used. */
26716
+ var NodeBenchClipSchema = object({
26717
+ /** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
26718
+ id: string(),
26719
+ revision: string().nullable(),
26720
+ frames: number(),
26721
+ width: number(),
26722
+ height: number()
26723
+ });
26724
+ var NodeBenchRunnerInputSchema = object({
26725
+ runId: string().min(1),
26726
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
26727
+ phases: array(NodeBenchmarkPhaseSchema).min(1),
26728
+ /** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
26729
+ steps: array(string()).default([]),
26730
+ fpsPerStream: number().int().min(1).max(30),
26731
+ /** The runner stops on its own past this instant, whatever the hub does. */
26732
+ deadlineAtMs: number(),
26733
+ settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
26734
+ measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
26735
+ keepDownloadedModels: boolean().default(false)
26736
+ });
26737
+ var NodeBenchRunnerStateSchema = _enum([
26738
+ "running",
26739
+ "done",
26740
+ "failed",
26741
+ "aborted"
26742
+ ]);
26743
+ var NodeBenchRunnerStatusSchema = object({
26744
+ runId: string(),
26745
+ nodeId: string(),
26746
+ state: NodeBenchRunnerStateSchema,
26747
+ progress: NodeBenchProgressSchema.nullable(),
26748
+ /** Every finished cell so far — a run stopped half way keeps what it measured. */
26749
+ cells: array(NodeBenchCellSchema).readonly(),
26750
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
26751
+ clip: NodeBenchClipSchema.nullable(),
26752
+ /** Cameras seen running on the node during the run (they share its pools). */
26753
+ activeCameraIds: array(number()).readonly(),
26754
+ /** Models the run downloaded and then deleted (not installed before). */
26755
+ deletedModels: array(string()).readonly(),
26756
+ error: string().nullable(),
26757
+ startedAtMs: number(),
26758
+ finishedAtMs: number().nullable()
26759
+ });
26760
+ var NodeBenchmarkStateSchema = _enum([
26761
+ "draining",
26762
+ "measuring",
26763
+ "restoring",
26764
+ "done",
26765
+ "failed",
26766
+ "aborted"
26767
+ ]);
26768
+ /** Why a run ended. */
26769
+ var NodeBenchmarkEndReasonSchema = _enum([
26770
+ "completed",
26771
+ "operator-abort",
26772
+ "deadline",
26773
+ "node-lost",
26774
+ "runner-lost",
26775
+ "hub-restart",
26776
+ "drain-timeout",
26777
+ "failed"
26778
+ ]);
26779
+ var NodeBenchmarkRunSchema = object({
26780
+ runId: string(),
26781
+ nodeId: string(),
26782
+ state: NodeBenchmarkStateSchema,
26783
+ plan: NodeBenchmarkPlanSchema,
26784
+ startedAtMs: number(),
26785
+ deadlineAtMs: number(),
26786
+ finishedAtMs: number().nullable(),
26787
+ endReason: NodeBenchmarkEndReasonSchema.nullable(),
26788
+ error: string().nullable(),
26789
+ /** Cameras moved off the node for the run. */
26790
+ moved: array(number()).readonly(),
26791
+ /** Cameras that stayed (their only frame source is the node). */
26792
+ staying: array(number()).readonly(),
26793
+ /** Something else ran on the node's pools during the run. */
26794
+ contaminated: boolean(),
26795
+ progress: NodeBenchProgressSchema.nullable(),
26796
+ resultIds: array(string()).readonly()
26797
+ });
26798
+ /** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
26799
+ var NodeBenchmarkStatusSchema = object({
26800
+ /** The node the cluster is in benchmark mode for; null = none. */
26801
+ modeNodeId: string().nullable(),
26802
+ run: NodeBenchmarkRunSchema.nullable()
26803
+ });
26804
+ /**
26805
+ * One stored measurement — the only authority Auto tune and the automatic
26806
+ * shares read measured capacity from. Written by the orchestrator when a run
26807
+ * ends, never by anyone else.
26808
+ */
26809
+ var NodeBenchmarkResultSchema = object({
26810
+ id: string(),
26811
+ runId: string(),
26812
+ nodeId: string(),
26813
+ cell: NodeBenchCellSchema,
26814
+ fpsPerStream: number(),
26815
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
26816
+ clip: NodeBenchClipSchema.nullable(),
26817
+ /** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
26818
+ contaminated: boolean(),
26819
+ stayingCameras: array(number()).readonly(),
26820
+ /** The run ended early; the cell itself completed. */
26821
+ partialRun: boolean(),
26822
+ measuredAtMs: number()
26823
+ });
26824
+ var ListNodeBenchmarkResultsInputSchema = object({
26825
+ nodeId: string().optional(),
26826
+ deviceKey: string().optional()
26827
+ });
26828
+ /** A result with its standing today: does it still beat the table? */
26829
+ var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
26830
+ /** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
26831
+ standing: _enum([
26832
+ "fresh",
26833
+ "stale",
26834
+ "superseded"
26835
+ ]),
26836
+ staleWhy: _enum([
26837
+ "age",
26838
+ "runtime",
26839
+ "pool-tuning"
26840
+ ]).nullable()
26841
+ });
26842
+ object({
26843
+ runId: string(),
26844
+ nodeId: string(),
26845
+ startedAtMs: number(),
26846
+ deadlineAtMs: number(),
26847
+ plan: NodeBenchmarkPlanSchema,
26848
+ moved: array(number()).readonly(),
26849
+ staying: array(number()).readonly()
26850
+ });
26851
+ /** Candidate detectors per device, for the plan editor. */
26852
+ var NodeBenchmarkCandidatesSchema = object({
26853
+ nodeId: string(),
26854
+ reachable: boolean(),
26855
+ devices: array(object({
26856
+ deviceKey: string(),
26857
+ enabled: boolean(),
26858
+ available: boolean(),
26859
+ /** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
26860
+ suggested: array(string()).readonly(),
26861
+ /** Every root detector the device has a build for. */
26862
+ all: array(string()).readonly(),
26863
+ /** The model the device runs now, when pinned. */
26864
+ currentModelId: string().nullable()
26865
+ })).readonly(),
26866
+ /** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
26867
+ steps: array(object({
26868
+ id: string(),
26869
+ name: string(),
26870
+ slot: string()
26871
+ })).readonly()
26872
+ });
25244
26873
  object({
25245
26874
  activeCameras: number(),
25246
26875
  throttledCameras: number(),
@@ -26369,7 +27998,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
26369
27998
  }), ParkedTrackFrameSchema.nullable()), method(object({
26370
27999
  deviceId: number(),
26371
28000
  trackId: string()
26372
- }), object({ released: number().int().nonnegative() }), { kind: "mutation" });
28001
+ }), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
28002
+ accepted: literal(true),
28003
+ runId: string()
28004
+ }), {
28005
+ kind: "mutation",
28006
+ auth: "admin"
28007
+ }), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
28008
+ kind: "mutation",
28009
+ auth: "admin"
28010
+ });
26373
28011
  var CameraPipelineConfigSchema = object({
26374
28012
  engine: PipelineEngineChoiceSchema.optional(),
26375
28013
  steps: array(PipelineStepInputSchema).readonly(),
@@ -27008,6 +28646,21 @@ method(object({
27008
28646
  }), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
27009
28647
  kind: "mutation",
27010
28648
  auth: "admin"
28649
+ }), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
28650
+ kind: literal("started"),
28651
+ runId: string()
28652
+ }), object({
28653
+ kind: literal("refused"),
28654
+ preflight: NodeBenchmarkPreflightSchema
28655
+ })]), {
28656
+ kind: "mutation",
28657
+ auth: "admin"
28658
+ }), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
28659
+ kind: "mutation",
28660
+ auth: "admin"
28661
+ }), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
28662
+ kind: "mutation",
28663
+ auth: "admin"
27011
28664
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
27012
28665
  deviceId: number(),
27013
28666
  addonId: string(),
@@ -27644,7 +29297,19 @@ var SsoBridgeClaimsSchema = object({
27644
29297
  * editing a descriptor must not retroactively extend or shorten a link the
27645
29298
  * operator already consented to.
27646
29299
  */
27647
- refreshTtl: union([number().int().positive(), literal("never")]).optional()
29300
+ refreshTtl: union([number().int().positive(), literal("never")]).optional(),
29301
+ /**
29302
+ * Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
29303
+ * that was started from a signed-in user's "Link" button: the finish then
29304
+ * links this identity to the intent's user instead of signing anyone in.
29305
+ * The handle carries no user id — the hub resolves it, single-use.
29306
+ */
29307
+ linkIntent: string().optional(),
29308
+ /**
29309
+ * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
29310
+ * subject is unique only per issuer, so a link is bound to it.
29311
+ */
29312
+ issuer: string().optional()
27648
29313
  });
27649
29314
  method(object({
27650
29315
  claims: SsoBridgeClaimsSchema,
@@ -29579,7 +31244,22 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
29579
31244
  * field their hints were silently stripped by the schema and the
29580
31245
  * adaptive ladder started blind on the client's display size.
29581
31246
  */
29582
- hints: webrtcClientHintsSchema.optional()
31247
+ hints: webrtcClientHintsSchema.optional(),
31248
+ /**
31249
+ * Talk-back (D771): relay the PEER's audio to the device's speaker
31250
+ * through the `intercom` cap's push-talk triple. When `true` and the
31251
+ * offer lets the peer send audio, the answer's audio is `sendrecv`
31252
+ * and every inbound frame goes to `intercom.pushTalkAudio` for this
31253
+ * `deviceId`; absent/false answers `sendonly`, as for every viewer.
31254
+ *
31255
+ * TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
31256
+ * with `intercom`, when the linked user may control that camera. The
31257
+ * hub STRIPS it from every request-bound call (a browser), exactly as
31258
+ * it overwrites `relayOnly` — a viewer's talk permission is the
31259
+ * intercom cap's own surface (share tokens gate it there), and this
31260
+ * flag must not become a second door to the camera's speaker.
31261
+ */
31262
+ talkback: boolean().optional()
29583
31263
  }), object({
29584
31264
  sessionId: string(),
29585
31265
  sdpAnswer: string()
@@ -33096,6 +34776,9 @@ var CreateIntegrationInputSchema = object({
33096
34776
  enabled: boolean().optional(),
33097
34777
  info: record(string(), unknown()).optional(),
33098
34778
  settings: record(string(), unknown()).optional(),
34779
+ /** Keys of `settings` the form's schema declares secret (by type) — kept in
34780
+ * the keychain, not the table (D787). */
34781
+ secretKeys: array(string()).optional(),
33099
34782
  skipRestart: boolean().optional()
33100
34783
  });
33101
34784
  var UpdateIntegrationInputSchema = object({
@@ -33119,7 +34802,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
33119
34802
  auth: "admin"
33120
34803
  }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
33121
34804
  id: string(),
33122
- settings: record(string(), unknown())
34805
+ settings: record(string(), unknown()),
34806
+ /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
34807
+ secretKeys: array(string()).optional()
33123
34808
  }), object({ success: boolean() }), {
33124
34809
  kind: "mutation",
33125
34810
  auth: "admin"
@@ -39941,6 +41626,32 @@ var TotpStatusSchema = object({
39941
41626
  /** Null when no row exists OR the row is still pending confirmation. */
39942
41627
  confirmedAt: number().nullable()
39943
41628
  });
41629
+ /**
41630
+ * user-management — singleton capability for user accounts, API keys,
41631
+ * and scoped tokens.
41632
+ *
41633
+ * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
41634
+ * — the subset check on `setUserScopes` / `createScopedToken` is moot
41635
+ * because non-admins never reach these. If/when we open non-admin
41636
+ * delegation, structural caller-scope subset check goes inside the
41637
+ * provider.
41638
+ */
41639
+ var ExternalIdentitySchema = object({
41640
+ /** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
41641
+ provider: string(),
41642
+ /** The IdP's stable subject (`sub`) for this account. */
41643
+ subject: string(),
41644
+ /** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
41645
+ issuer: string(),
41646
+ userId: string(),
41647
+ /** What the IdP called the account at link time (username / email) — display only. */
41648
+ label: string().optional(),
41649
+ linkedAt: number()
41650
+ });
41651
+ var ExternalIdentityKeySchema = object({
41652
+ provider: string().min(1),
41653
+ subject: string().min(1)
41654
+ });
39944
41655
  method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
39945
41656
  kind: "mutation",
39946
41657
  auth: "admin",
@@ -40054,7 +41765,22 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40054
41765
  userId: string(),
40055
41766
  username: string(),
40056
41767
  scopes: array(TokenScopeSchema)
40057
- }).nullable(), { access: "view" }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
41768
+ }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
41769
+ userId: string(),
41770
+ issuer: string()
41771
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
41772
+ userId: string(),
41773
+ issuer: string().min(1),
41774
+ label: string().optional()
41775
+ }), object({ success: literal(true) }), {
41776
+ kind: "mutation",
41777
+ auth: "admin",
41778
+ access: "create"
41779
+ }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41780
+ kind: "mutation",
41781
+ auth: "admin",
41782
+ access: "delete"
41783
+ }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
40058
41784
  kind: "mutation",
40059
41785
  auth: "admin",
40060
41786
  access: "delete"
@@ -41241,7 +42967,8 @@ var BaseDevice = class {
41241
42967
  this.role = options.role;
41242
42968
  this.parentDeviceId = ctx.parentDeviceId;
41243
42969
  const seedData = ctx.persistedConfig ?? {};
41244
- this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data), seedData, ({ droppedKeys, issues }) => {
42970
+ const declaredSecretPaths = collectZodSecretPaths(schema);
42971
+ this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
41245
42972
  ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
41246
42973
  tags: {
41247
42974
  deviceId: ctx.id,
@@ -44930,6 +46657,90 @@ Object.freeze({
44930
46657
  addonId: null,
44931
46658
  access: "create"
44932
46659
  },
46660
+ "keychain.delete": {
46661
+ capName: "keychain",
46662
+ capScope: "system",
46663
+ addonId: null,
46664
+ access: "delete"
46665
+ },
46666
+ "keychain.getState": {
46667
+ capName: "keychain",
46668
+ capScope: "system",
46669
+ addonId: null,
46670
+ access: "view"
46671
+ },
46672
+ "keychain.listMeta": {
46673
+ capName: "keychain",
46674
+ capScope: "system",
46675
+ addonId: null,
46676
+ access: "view"
46677
+ },
46678
+ "keychain.put": {
46679
+ capName: "keychain",
46680
+ capScope: "system",
46681
+ addonId: null,
46682
+ access: "create"
46683
+ },
46684
+ "keychain.resolve": {
46685
+ capName: "keychain",
46686
+ capScope: "system",
46687
+ addonId: null,
46688
+ access: "view"
46689
+ },
46690
+ "keychainAdmin.deleteOrphans": {
46691
+ capName: "keychain-admin",
46692
+ capScope: "system",
46693
+ addonId: null,
46694
+ access: "delete"
46695
+ },
46696
+ "keychainAdmin.downloadRecoveryKey": {
46697
+ capName: "keychain-admin",
46698
+ capScope: "system",
46699
+ addonId: null,
46700
+ access: "create"
46701
+ },
46702
+ "keychainAdmin.listAudit": {
46703
+ capName: "keychain-admin",
46704
+ capScope: "system",
46705
+ addonId: null,
46706
+ access: "view"
46707
+ },
46708
+ "keychainAdmin.listSecrets": {
46709
+ capName: "keychain-admin",
46710
+ capScope: "system",
46711
+ addonId: null,
46712
+ access: "view"
46713
+ },
46714
+ "keychainAdmin.purgeRetiredKeys": {
46715
+ capName: "keychain-admin",
46716
+ capScope: "system",
46717
+ addonId: null,
46718
+ access: "delete"
46719
+ },
46720
+ "keychainAdmin.resetKeychain": {
46721
+ capName: "keychain-admin",
46722
+ capScope: "system",
46723
+ addonId: null,
46724
+ access: "delete"
46725
+ },
46726
+ "keychainAdmin.reveal": {
46727
+ capName: "keychain-admin",
46728
+ capScope: "system",
46729
+ addonId: null,
46730
+ access: "create"
46731
+ },
46732
+ "keychainAdmin.rotateMasterKey": {
46733
+ capName: "keychain-admin",
46734
+ capScope: "system",
46735
+ addonId: null,
46736
+ access: "create"
46737
+ },
46738
+ "keychainAdmin.status": {
46739
+ capName: "keychain-admin",
46740
+ capScope: "system",
46741
+ addonId: null,
46742
+ access: "view"
46743
+ },
44933
46744
  "lawnMowerControl.dock": {
44934
46745
  capName: "lawn-mower-control",
44935
46746
  capScope: "device",
@@ -46304,6 +48115,18 @@ Object.freeze({
46304
48115
  addonId: null,
46305
48116
  access: "create"
46306
48117
  },
48118
+ "pipelineAnalytics.addRetrainFrameFromRecording": {
48119
+ capName: "pipeline-analytics",
48120
+ capScope: "device",
48121
+ addonId: null,
48122
+ access: "create"
48123
+ },
48124
+ "pipelineAnalytics.addRetrainFramesToCollection": {
48125
+ capName: "pipeline-analytics",
48126
+ capScope: "device",
48127
+ addonId: null,
48128
+ access: "create"
48129
+ },
46307
48130
  "pipelineAnalytics.applyDeviceSettingsPatch": {
46308
48131
  capName: "pipeline-analytics",
46309
48132
  capScope: "device",
@@ -46352,12 +48175,24 @@ Object.freeze({
46352
48175
  addonId: null,
46353
48176
  access: "view"
46354
48177
  },
48178
+ "pipelineAnalytics.createRetrainCollection": {
48179
+ capName: "pipeline-analytics",
48180
+ capScope: "device",
48181
+ addonId: null,
48182
+ access: "create"
48183
+ },
46355
48184
  "pipelineAnalytics.deleteDeviceEvents": {
46356
48185
  capName: "pipeline-analytics",
46357
48186
  capScope: "device",
46358
48187
  addonId: null,
46359
48188
  access: "delete"
46360
48189
  },
48190
+ "pipelineAnalytics.deleteRetrainCollection": {
48191
+ capName: "pipeline-analytics",
48192
+ capScope: "device",
48193
+ addonId: null,
48194
+ access: "delete"
48195
+ },
46361
48196
  "pipelineAnalytics.deleteTracks": {
46362
48197
  capName: "pipeline-analytics",
46363
48198
  capScope: "device",
@@ -46562,6 +48397,24 @@ Object.freeze({
46562
48397
  addonId: null,
46563
48398
  access: "view"
46564
48399
  },
48400
+ "pipelineAnalytics.listRetrainAssistProfiles": {
48401
+ capName: "pipeline-analytics",
48402
+ capScope: "device",
48403
+ addonId: null,
48404
+ access: "view"
48405
+ },
48406
+ "pipelineAnalytics.listRetrainCollectionFrames": {
48407
+ capName: "pipeline-analytics",
48408
+ capScope: "device",
48409
+ addonId: null,
48410
+ access: "view"
48411
+ },
48412
+ "pipelineAnalytics.listRetrainCollections": {
48413
+ capName: "pipeline-analytics",
48414
+ capScope: "device",
48415
+ addonId: null,
48416
+ access: "view"
48417
+ },
46565
48418
  "pipelineAnalytics.listRetrainFrames": {
46566
48419
  capName: "pipeline-analytics",
46567
48420
  capScope: "device",
@@ -46610,6 +48463,12 @@ Object.freeze({
46610
48463
  addonId: null,
46611
48464
  access: "create"
46612
48465
  },
48466
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
48467
+ capName: "pipeline-analytics",
48468
+ capScope: "device",
48469
+ addonId: null,
48470
+ access: "create"
48471
+ },
46613
48472
  "pipelineAnalytics.pruneEvents": {
46614
48473
  capName: "pipeline-analytics",
46615
48474
  capScope: "device",
@@ -46664,6 +48523,18 @@ Object.freeze({
46664
48523
  addonId: null,
46665
48524
  access: "create"
46666
48525
  },
48526
+ "pipelineAnalytics.removeRetrainFrameFromCollection": {
48527
+ capName: "pipeline-analytics",
48528
+ capScope: "device",
48529
+ addonId: null,
48530
+ access: "delete"
48531
+ },
48532
+ "pipelineAnalytics.renameRetrainCollection": {
48533
+ capName: "pipeline-analytics",
48534
+ capScope: "device",
48535
+ addonId: null,
48536
+ access: "create"
48537
+ },
46667
48538
  "pipelineAnalytics.restageRetrainTrack": {
46668
48539
  capName: "pipeline-analytics",
46669
48540
  capScope: "device",
@@ -46694,6 +48565,12 @@ Object.freeze({
46694
48565
  addonId: null,
46695
48566
  access: "create"
46696
48567
  },
48568
+ "pipelineAnalytics.setRetrainFrameComplete": {
48569
+ capName: "pipeline-analytics",
48570
+ capScope: "device",
48571
+ addonId: null,
48572
+ access: "create"
48573
+ },
46697
48574
  "pipelineAnalytics.setTrackFlags": {
46698
48575
  capName: "pipeline-analytics",
46699
48576
  capScope: "device",
@@ -46730,6 +48607,12 @@ Object.freeze({
46730
48607
  addonId: null,
46731
48608
  access: "delete"
46732
48609
  },
48610
+ "pipelineAnalytics.writeRetrainArchive": {
48611
+ capName: "pipeline-analytics",
48612
+ capScope: "device",
48613
+ addonId: null,
48614
+ access: "create"
48615
+ },
46733
48616
  "pipelineExecutor.cacheFrameInPool": {
46734
48617
  capName: "pipeline-executor",
46735
48618
  capScope: "system",
@@ -46940,6 +48823,12 @@ Object.freeze({
46940
48823
  addonId: null,
46941
48824
  access: "view"
46942
48825
  },
48826
+ "pipelineOrchestrator.abortNodeBenchmark": {
48827
+ capName: "pipeline-orchestrator",
48828
+ capScope: "system",
48829
+ addonId: null,
48830
+ access: "create"
48831
+ },
46943
48832
  "pipelineOrchestrator.applyAutoTune": {
46944
48833
  capName: "pipeline-orchestrator",
46945
48834
  capScope: "system",
@@ -46964,6 +48853,12 @@ Object.freeze({
46964
48853
  addonId: null,
46965
48854
  access: "create"
46966
48855
  },
48856
+ "pipelineOrchestrator.deleteNodeBenchmarkResult": {
48857
+ capName: "pipeline-orchestrator",
48858
+ capScope: "system",
48859
+ addonId: null,
48860
+ access: "delete"
48861
+ },
46967
48862
  "pipelineOrchestrator.getAgentLoad": {
46968
48863
  capName: "pipeline-orchestrator",
46969
48864
  capScope: "system",
@@ -47072,6 +48967,24 @@ Object.freeze({
47072
48967
  addonId: null,
47073
48968
  access: "view"
47074
48969
  },
48970
+ "pipelineOrchestrator.getNodeBenchmarkCandidates": {
48971
+ capName: "pipeline-orchestrator",
48972
+ capScope: "system",
48973
+ addonId: null,
48974
+ access: "view"
48975
+ },
48976
+ "pipelineOrchestrator.getNodeBenchmarkPreflight": {
48977
+ capName: "pipeline-orchestrator",
48978
+ capScope: "system",
48979
+ addonId: null,
48980
+ access: "view"
48981
+ },
48982
+ "pipelineOrchestrator.getNodeBenchmarkStatus": {
48983
+ capName: "pipeline-orchestrator",
48984
+ capScope: "system",
48985
+ addonId: null,
48986
+ access: "view"
48987
+ },
47075
48988
  "pipelineOrchestrator.getNodeInferenceDevices": {
47076
48989
  capName: "pipeline-orchestrator",
47077
48990
  capScope: "system",
@@ -47114,6 +49027,12 @@ Object.freeze({
47114
49027
  addonId: null,
47115
49028
  access: "view"
47116
49029
  },
49030
+ "pipelineOrchestrator.listNodeBenchmarkResults": {
49031
+ capName: "pipeline-orchestrator",
49032
+ capScope: "system",
49033
+ addonId: null,
49034
+ access: "view"
49035
+ },
47117
49036
  "pipelineOrchestrator.pauseForStorageMigration": {
47118
49037
  capName: "pipeline-orchestrator",
47119
49038
  capScope: "system",
@@ -47258,6 +49177,12 @@ Object.freeze({
47258
49177
  addonId: null,
47259
49178
  access: "create"
47260
49179
  },
49180
+ "pipelineOrchestrator.startNodeBenchmark": {
49181
+ capName: "pipeline-orchestrator",
49182
+ capScope: "system",
49183
+ addonId: null,
49184
+ access: "create"
49185
+ },
47261
49186
  "pipelineOrchestrator.suggestShares": {
47262
49187
  capName: "pipeline-orchestrator",
47263
49188
  capScope: "system",
@@ -47276,6 +49201,12 @@ Object.freeze({
47276
49201
  addonId: null,
47277
49202
  access: "create"
47278
49203
  },
49204
+ "pipelineRunner.abortNodeBench": {
49205
+ capName: "pipeline-runner",
49206
+ capScope: "system",
49207
+ addonId: null,
49208
+ access: "create"
49209
+ },
47279
49210
  "pipelineRunner.attachCamera": {
47280
49211
  capName: "pipeline-runner",
47281
49212
  capScope: "system",
@@ -47324,6 +49255,12 @@ Object.freeze({
47324
49255
  addonId: null,
47325
49256
  access: "view"
47326
49257
  },
49258
+ "pipelineRunner.getNodeBenchStatus": {
49259
+ capName: "pipeline-runner",
49260
+ capScope: "system",
49261
+ addonId: null,
49262
+ access: "view"
49263
+ },
47327
49264
  "pipelineRunner.getParkedTrackFrame": {
47328
49265
  capName: "pipeline-runner",
47329
49266
  capScope: "system",
@@ -47366,6 +49303,12 @@ Object.freeze({
47366
49303
  addonId: null,
47367
49304
  access: "create"
47368
49305
  },
49306
+ "pipelineRunner.startNodeBench": {
49307
+ capName: "pipeline-runner",
49308
+ capScope: "system",
49309
+ addonId: null,
49310
+ access: "create"
49311
+ },
47369
49312
  "plateGallery.assignPlate": {
47370
49313
  capName: "plate-gallery",
47371
49314
  capScope: "system",
@@ -49082,18 +51025,36 @@ Object.freeze({
49082
51025
  addonId: null,
49083
51026
  access: "delete"
49084
51027
  },
51028
+ "userManagement.findUserByExternalIdentity": {
51029
+ capName: "user-management",
51030
+ capScope: "system",
51031
+ addonId: null,
51032
+ access: "view"
51033
+ },
49085
51034
  "userManagement.getTotpStatus": {
49086
51035
  capName: "user-management",
49087
51036
  capScope: "system",
49088
51037
  addonId: null,
49089
51038
  access: "view"
49090
51039
  },
51040
+ "userManagement.linkExternalIdentity": {
51041
+ capName: "user-management",
51042
+ capScope: "system",
51043
+ addonId: null,
51044
+ access: "create"
51045
+ },
49091
51046
  "userManagement.listApiKeys": {
49092
51047
  capName: "user-management",
49093
51048
  capScope: "system",
49094
51049
  addonId: null,
49095
51050
  access: "view"
49096
51051
  },
51052
+ "userManagement.listExternalIdentities": {
51053
+ capName: "user-management",
51054
+ capScope: "system",
51055
+ addonId: null,
51056
+ access: "view"
51057
+ },
49097
51058
  "userManagement.listOauthSessions": {
49098
51059
  capName: "user-management",
49099
51060
  capScope: "system",
@@ -49172,6 +51133,12 @@ Object.freeze({
49172
51133
  addonId: null,
49173
51134
  access: "create"
49174
51135
  },
51136
+ "userManagement.unlinkExternalIdentity": {
51137
+ capName: "user-management",
51138
+ capScope: "system",
51139
+ addonId: null,
51140
+ access: "delete"
51141
+ },
49175
51142
  "userManagement.updateUser": {
49176
51143
  capName: "user-management",
49177
51144
  capScope: "system",
@@ -52271,6 +54238,11 @@ Object.freeze({
52271
54238
  form: "single",
52272
54239
  optional: false
52273
54240
  }],
54241
+ "pipelineAnalytics.addRetrainFrameFromRecording": [{
54242
+ name: "deviceId",
54243
+ form: "single",
54244
+ optional: false
54245
+ }],
52274
54246
  "pipelineAnalytics.applyDeviceSettingsPatch": [{
52275
54247
  name: "deviceId",
52276
54248
  form: "single",
@@ -52461,6 +54433,11 @@ Object.freeze({
52461
54433
  form: "single",
52462
54434
  optional: false
52463
54435
  }],
54436
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
54437
+ name: "deviceId",
54438
+ form: "single",
54439
+ optional: false
54440
+ }],
52464
54441
  "pipelineAnalytics.pruneEventsBefore": [{
52465
54442
  name: "deviceId",
52466
54443
  form: "single",
@@ -52511,6 +54488,11 @@ Object.freeze({
52511
54488
  form: "single",
52512
54489
  optional: false
52513
54490
  }],
54491
+ "pipelineAnalytics.setRetrainFrameComplete": [{
54492
+ name: "deviceId",
54493
+ form: "single",
54494
+ optional: false
54495
+ }],
52514
54496
  "pipelineAnalytics.setTrackFlags": [{
52515
54497
  name: "deviceId",
52516
54498
  form: "single",
@@ -54598,7 +56580,7 @@ var PetkitRegionSchema = _enum(PETKIT_REGIONS);
54598
56580
  */
54599
56581
  var petkitConfigSchema = object({
54600
56582
  email: string().min(1).describe("PetKit account email"),
54601
- password: string().min(1).describe("PetKit account password"),
56583
+ password: string().min(1).describe("PetKit account password").meta({ secret: true }),
54602
56584
  region: PetkitRegionSchema.default("de").describe("PetKit cloud region"),
54603
56585
  timezone: string().default("Europe/Berlin").describe("IANA timezone used for cloud request headers"),
54604
56586
  pollIntervalMs: preprocess((v) => v === "" || v === null ? void 0 : v, number().int().min(0).max(36e5).default(3e4)).describe("Per-feeder poll cadence (ms) — 0 leaves only eager/stale refresh")