@camstack/addon-model-studio 1.1.218 → 1.1.219

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 (19) hide show
  1. package/dist/{MotionZonesSettings-Capre9Um.mjs → MotionZonesSettings-iznKgqTW.mjs} +2 -2
  2. package/dist/{PrivacyMaskSettings-CTeuaW76.mjs → PrivacyMaskSettings-C6wGkgut.mjs} +4 -4
  3. package/dist/{SceneMonitorEditor-B_wS3Aqg.mjs → SceneMonitorEditor-DJAIMI8W.mjs} +3 -3
  4. package/dist/_stub.js +4228 -4228
  5. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_model_studio_page-WTUyarUL.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_model_studio_page-gHc6KKdS.mjs} +3 -3
  6. package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-ClV5IShH.mjs +26 -0
  7. package/dist/addon-model-studio.css +1 -1
  8. package/dist/{hostInit-N-aNmJfG.mjs → hostInit-8-vvEvUj.mjs} +2 -2
  9. package/dist/model-studio.addon.js +1780 -55
  10. package/dist/model-studio.addon.mjs +1780 -55
  11. package/dist/{player-overlays-CYNFSDYV.mjs → player-overlays-DDqfVhHf.mjs} +1 -1
  12. package/dist/remoteEntry.js +1 -1
  13. package/dist/{responsive-oZzHP3lx.mjs → responsive-sVlbSBci.mjs} +1 -1
  14. package/dist/{scene-monitor-copy-C2YKn7wo.mjs → scene-monitor-copy-D_xseg_c.mjs} +1 -1
  15. package/dist/{square-DUBjO0Wq.mjs → square-VW_5OacX.mjs} +1 -1
  16. package/dist/{trash-2-DpaexsRt.mjs → trash-2-C1-_5_yP.mjs} +1 -1
  17. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_model_studio_page__remoteEntry_js-BA6FOYZy.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_model_studio_page__remoteEntry_js-BgyWayNh.mjs} +1 -1
  18. package/package.json +1 -1
  19. package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CE6l15x5.mjs +0 -26
@@ -367,7 +367,7 @@ function buildScryptedRegistryDescriptor(entry) {
367
367
  };
368
368
  }
369
369
  //#endregion
370
- //#region ../types/dist/event-category-B_0XEcLF.mjs
370
+ //#region ../types/dist/event-category-DaIZi00R.mjs
371
371
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
372
372
  EventCategory["SystemBoot"] = "system.boot";
373
373
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -446,6 +446,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
446
446
  */
447
447
  EventCategory["AddonLoadFailed"] = "addon.load-failed";
448
448
  /**
449
+ * A keychain value was stored or removed (D787). Carries the ref, its
450
+ * owner and the new version — NEVER the value. A process holding the ref
451
+ * drops its cached copy and the owning `BaseAddon` re-resolves its config.
452
+ * Telemetry (D8): a process that misses it still revalidates by version.
453
+ */
454
+ EventCategory["KeychainChanged"] = "keychain.changed";
455
+ /**
449
456
  * Addon recovered from a previous failure. Emitted when an addon
450
457
  * transitions from `failed` back to `healthy` (typically via the
451
458
  * monitor's auto-retry loop, or after manual `addons.retryLoad`).
@@ -5738,7 +5745,7 @@ var ZodIssueCode = {
5738
5745
  var ZodFirstPartyTypeKind;
5739
5746
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5740
5747
  //#endregion
5741
- //#region ../types/dist/sleep-B0JG7-_F.mjs
5748
+ //#region ../types/dist/sleep-Cr5YOk3m.mjs
5742
5749
  /**
5743
5750
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5744
5751
  * window to float samples (D455).
@@ -5817,6 +5824,97 @@ function buildAlawTable() {
5817
5824
  }
5818
5825
  buildUlawTable();
5819
5826
  buildAlawTable();
5827
+ /** Is this field's stored value a credential? */
5828
+ function isSecretConfigField(field) {
5829
+ if (field.type === "password") return true;
5830
+ return "secret" in field && field.secret === true;
5831
+ }
5832
+ /**
5833
+ * Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
5834
+ * by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
5835
+ */
5836
+ function isKeychainStoredField(field) {
5837
+ if (!isSecretConfigField(field)) return false;
5838
+ if (field.type === "textarea" && field.isJson === true) return false;
5839
+ return !("storage" in field && field.storage === "inline");
5840
+ }
5841
+ /**
5842
+ * What a settings blob holds where a secret used to be.
5843
+ *
5844
+ * A keychain-stored field never holds its value. It holds a self-describing
5845
+ * MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
5846
+ * code can mistake it for a credential and no form can send it to a camera as
5847
+ * a password. The empty state is `null` / absent, never `''`.
5848
+ *
5849
+ * The same shapes travel to and from the admin UI:
5850
+ *
5851
+ * - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
5852
+ * (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
5853
+ * value is set, never the value.
5854
+ * - write: an untouched field submits the view back unchanged (KEEP); a typed
5855
+ * value is a plain non-empty string (CHANGE); the Clear button submits
5856
+ * {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
5857
+ * are KEEP — an empty string is what a defaults-fallback pushes back, and
5858
+ * treating it as "clear" is how a save destroyed a stored credential before.
5859
+ *
5860
+ * Pure and browser-safe.
5861
+ */
5862
+ var SECRET_CLEAR = { $secretClear: true };
5863
+ /** The `'***'` token D634 redaction writes for non-admins. */
5864
+ var LEGACY_DEVICE_REDACTION = "***";
5865
+ function isRecord$1(value) {
5866
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5867
+ }
5868
+ function makeSecretMarker(ref) {
5869
+ return {
5870
+ $secret: ref,
5871
+ v: 1
5872
+ };
5873
+ }
5874
+ /** A stored marker: an object whose `$secret` is a non-empty string. */
5875
+ function isSecretMarker(value) {
5876
+ if (!isRecord$1(value)) return false;
5877
+ const ref = value["$secret"];
5878
+ return typeof ref === "string" && ref.length > 0;
5879
+ }
5880
+ function isSecretClear(value) {
5881
+ return isRecord$1(value) && value["$secretClear"] === true;
5882
+ }
5883
+ /**
5884
+ * The UI view of a stored secret field value: a marker becomes "set", inline
5885
+ * plaintext becomes "set (inline)", nothing becomes `null`. A value never
5886
+ * survives this function.
5887
+ */
5888
+ function toSecretFieldView(stored) {
5889
+ if (isSecretMarker(stored)) return {
5890
+ $secret: stored.$secret,
5891
+ v: 1,
5892
+ set: true
5893
+ };
5894
+ if (typeof stored === "string" && stored.length > 0) return {
5895
+ $secret: null,
5896
+ v: 1,
5897
+ set: true,
5898
+ inline: true
5899
+ };
5900
+ return null;
5901
+ }
5902
+ /**
5903
+ * Classify an incoming value for a secret path. Only a non-empty string that is
5904
+ * not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
5905
+ * Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
5906
+ * `undefined`, a redaction token, a non-string — keeps what is stored.
5907
+ */
5908
+ function classifySecretWrite(incoming) {
5909
+ if (isSecretClear(incoming)) return { kind: "clear" };
5910
+ if (typeof incoming !== "string") return { kind: "keep" };
5911
+ if (incoming.length === 0) return { kind: "keep" };
5912
+ if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
5913
+ return {
5914
+ kind: "set",
5915
+ value: incoming
5916
+ };
5917
+ }
5820
5918
  Object.fromEntries([
5821
5919
  {
5822
5920
  id: "overview",
@@ -5988,33 +6086,19 @@ Object.fromEntries([
5988
6086
  function isValuelessField(field) {
5989
6087
  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";
5990
6088
  }
5991
- /**
5992
- * Merge a `ConfigUISchema` with a raw `values` record into a
5993
- * `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
5994
- * before returning to the admin UI. Groups are walked recursively.
5995
- *
5996
- * For each leaf field:
5997
- * - structural fields (`separator`, `info`, `button`) pass through unchanged
5998
- * - other fields get `value = values[key] ?? field.default ?? null`
5999
- *
6000
- * Unknown keys in `values` (keys not declared in the schema) are silently
6001
- * ignored — they don't contribute to the output. Missing keys fall back to
6002
- * the schema default or `null`. This mirrors the old backend behaviour where
6003
- * `FormBuilder` rendered `values[key] ?? field.default`.
6004
- */
6005
- function hydrateSchema(schema, values) {
6089
+ function hydrateSchema(schema, values, options = {}) {
6006
6090
  return {
6007
6091
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
6008
6092
  sections: schema.sections.map((section) => ({
6009
6093
  ...section,
6010
- fields: section.fields.map((field) => hydrateField(field, values))
6094
+ fields: section.fields.map((field) => hydrateField(field, values, options))
6011
6095
  }))
6012
6096
  };
6013
6097
  }
6014
- function hydrateField(field, values) {
6098
+ function hydrateField(field, values, options) {
6015
6099
  if (isValuelessField(field)) return field;
6016
6100
  if (field.type === "group") {
6017
- const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
6101
+ const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
6018
6102
  return {
6019
6103
  ...field,
6020
6104
  fields: hydratedChildren
@@ -6023,7 +6107,7 @@ function hydrateField(field, values) {
6023
6107
  if (field.type === "sub-tabs") {
6024
6108
  const hydratedTabs = field.tabs.map((tab) => ({
6025
6109
  ...tab,
6026
- fields: tab.fields.map((child) => hydrateField(child, values))
6110
+ fields: tab.fields.map((child) => hydrateField(child, values, options))
6027
6111
  }));
6028
6112
  return {
6029
6113
  ...field,
@@ -6033,6 +6117,33 @@ function hydrateField(field, values) {
6033
6117
  const key = field.key;
6034
6118
  const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
6035
6119
  const defaultValue = field.default;
6120
+ const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
6121
+ if (isKeychainStoredField(field) && asView(storedValue)) return {
6122
+ ...field,
6123
+ value: toSecretFieldView(storedValue)
6124
+ };
6125
+ if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
6126
+ ...field,
6127
+ value: null
6128
+ };
6129
+ if (field.type === "editable-array" && Array.isArray(storedValue)) {
6130
+ const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
6131
+ if (secretItemKeys.length > 0) {
6132
+ const rows = storedValue.map((row) => {
6133
+ if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
6134
+ const out = { ...row };
6135
+ for (const k of secretItemKeys) {
6136
+ const v = Reflect.get(row, k);
6137
+ if (asView(v)) out[k] = toSecretFieldView(v);
6138
+ }
6139
+ return out;
6140
+ });
6141
+ return {
6142
+ ...field,
6143
+ value: rows
6144
+ };
6145
+ }
6146
+ }
6036
6147
  if (field.multiple) {
6037
6148
  const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
6038
6149
  const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
@@ -6275,6 +6386,431 @@ function projectStore(store, perNodeKeys, nodeId) {
6275
6386
  }
6276
6387
  return out;
6277
6388
  }
6389
+ var GLOBAL_SCOPE = { kind: "global" };
6390
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6391
+ function globalSecretScope() {
6392
+ return GLOBAL_SCOPE;
6393
+ }
6394
+ function encodeSegment(value) {
6395
+ return encodeURIComponent(value);
6396
+ }
6397
+ /**
6398
+ * The field path of a value inside an array item, addressed by the item's id:
6399
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6400
+ * `providers[authentik].clientSecret`.
6401
+ */
6402
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6403
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6404
+ }
6405
+ /** A write to a secret path could not be stored in the keychain, so it was refused. */
6406
+ var KeychainWriteRefusedError = class extends Error {
6407
+ fieldPath;
6408
+ constructor(fieldPath, cause) {
6409
+ super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
6410
+ this.fieldPath = fieldPath;
6411
+ this.name = "KeychainWriteRefusedError";
6412
+ }
6413
+ };
6414
+ var KEEP = { kind: "keep" };
6415
+ function isRecord$2(value) {
6416
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6417
+ }
6418
+ function defaultMintId() {
6419
+ return globalThis.crypto.randomUUID();
6420
+ }
6421
+ /** Every marker ref anywhere under `value`. */
6422
+ function collectSecretMarkerRefs(value, out = []) {
6423
+ if (isSecretMarker(value)) {
6424
+ out.push(value.$secret);
6425
+ return out;
6426
+ }
6427
+ if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6428
+ else if (isRecord$2(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6429
+ return out;
6430
+ }
6431
+ async function storedValueEquals(secrets, marker, candidate) {
6432
+ const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
6433
+ return resolved?.kind === "value" && resolved.value === candidate;
6434
+ }
6435
+ async function writeLeaf(ctx, incoming, stored, fieldPath) {
6436
+ const intent = classifySecretWrite(incoming);
6437
+ const ref = ctx.secrets.ref(ctx.scope, fieldPath);
6438
+ const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
6439
+ if (intent.kind === "keep") return KEEP;
6440
+ if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
6441
+ if (intent.kind === "clear") {
6442
+ if (storedIsOurs) ctx.deletes.push(ref);
6443
+ return {
6444
+ kind: "value",
6445
+ value: null
6446
+ };
6447
+ }
6448
+ if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
6449
+ kind: "value",
6450
+ value: stored
6451
+ };
6452
+ try {
6453
+ await ctx.secrets.put(ref, intent.value);
6454
+ } catch (err) {
6455
+ throw new KeychainWriteRefusedError(fieldPath, err);
6456
+ }
6457
+ return {
6458
+ kind: "value",
6459
+ value: makeSecretMarker(ref)
6460
+ };
6461
+ }
6462
+ /** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
6463
+ function applyMember(out, key, result, storedParent) {
6464
+ if (result.kind === "value") {
6465
+ out[key] = result.value;
6466
+ return;
6467
+ }
6468
+ if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
6469
+ else delete out[key];
6470
+ }
6471
+ async function writeMembers(ctx, children, incoming, stored, pathOf) {
6472
+ const out = { ...incoming };
6473
+ for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
6474
+ return out;
6475
+ }
6476
+ function rowId(row, idKey) {
6477
+ const raw = row[idKey];
6478
+ if (typeof raw === "string" && raw.length > 0) return raw;
6479
+ if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
6480
+ return null;
6481
+ }
6482
+ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6483
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$2) : [];
6484
+ if (!Array.isArray(incoming)) {
6485
+ ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6486
+ return {
6487
+ kind: "value",
6488
+ value: incoming
6489
+ };
6490
+ }
6491
+ const storedById = /* @__PURE__ */ new Map();
6492
+ for (const row of storedRows) {
6493
+ const id = rowId(row, node.idKey);
6494
+ if (id !== null) storedById.set(id, row);
6495
+ }
6496
+ const kept = /* @__PURE__ */ new Set();
6497
+ const rows = [];
6498
+ for (const row of incoming) {
6499
+ if (!isRecord$2(row)) {
6500
+ rows.push(row);
6501
+ continue;
6502
+ }
6503
+ const id = rowId(row, node.idKey) ?? ctx.mintId();
6504
+ kept.add(id);
6505
+ const withId = {
6506
+ ...row,
6507
+ [node.idKey]: row[node.idKey] ?? id
6508
+ };
6509
+ if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
6510
+ const storedRow = storedById.get(id) ?? {};
6511
+ rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
6512
+ }
6513
+ for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
6514
+ return {
6515
+ kind: "value",
6516
+ value: rows
6517
+ };
6518
+ }
6519
+ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6520
+ switch (node.kind) {
6521
+ case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6522
+ case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6523
+ case "object": {
6524
+ if (!isRecord$2(incoming)) {
6525
+ if (incoming === void 0) return KEEP;
6526
+ ctx.deletes.push(...collectSecretMarkerRefs(stored));
6527
+ return {
6528
+ kind: "value",
6529
+ value: incoming
6530
+ };
6531
+ }
6532
+ const storedObj = isRecord$2(stored) ? stored : {};
6533
+ return {
6534
+ kind: "value",
6535
+ value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
6536
+ };
6537
+ }
6538
+ }
6539
+ }
6540
+ /** Split a perNode-scoped key (`key@nodeId`). */
6541
+ function splitNodeKey(key) {
6542
+ const at = key.indexOf("@");
6543
+ return at <= 0 ? {
6544
+ base: key,
6545
+ nodeId: null
6546
+ } : {
6547
+ base: key.slice(0, at),
6548
+ nodeId: key.slice(at + 1)
6549
+ };
6550
+ }
6551
+ /** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
6552
+ async function transformSecretWrite(input) {
6553
+ const deletes = [];
6554
+ const base = {
6555
+ secrets: input.secrets,
6556
+ mintId: input.mintId ?? defaultMintId,
6557
+ deletes,
6558
+ operatorWrite: input.operatorWrite === true
6559
+ };
6560
+ const out = {};
6561
+ for (const [key, incoming] of Object.entries(input.patch)) {
6562
+ const { base: baseKey, nodeId } = splitNodeKey(key);
6563
+ const node = input.tree.get(baseKey);
6564
+ if (node === void 0) {
6565
+ out[key] = incoming;
6566
+ continue;
6567
+ }
6568
+ const scope = nodeId !== null && nodeId.length > 0 ? {
6569
+ kind: "node",
6570
+ nodeId
6571
+ } : input.scope ?? globalSecretScope();
6572
+ const result = await writeNode({
6573
+ ...base,
6574
+ scope
6575
+ }, node, incoming, input.stored[key], baseKey);
6576
+ if (result.kind === "value") out[key] = result.value;
6577
+ }
6578
+ return {
6579
+ patch: out,
6580
+ afterWrite: async () => {
6581
+ if (deletes.length === 0) return { orphaned: [] };
6582
+ try {
6583
+ await input.secrets.delete([...new Set(deletes)]);
6584
+ return { orphaned: [] };
6585
+ } catch {
6586
+ return { orphaned: [...new Set(deletes)] };
6587
+ }
6588
+ }
6589
+ };
6590
+ }
6591
+ /**
6592
+ * Replace every marker in `value` with its keychain value. Returns the SAME
6593
+ * reference when there is no marker (no allocation, no keychain call).
6594
+ */
6595
+ async function resolveSecretMarkers(value, secrets) {
6596
+ const refs = collectSecretMarkerRefs(value);
6597
+ if (refs.length === 0) return {
6598
+ value,
6599
+ unresolved: []
6600
+ };
6601
+ const answers = await secrets.resolve(refs);
6602
+ const unresolved = [];
6603
+ for (const ref of new Set(refs)) {
6604
+ const answer = answers[ref];
6605
+ if (answer === void 0) unresolved.push({
6606
+ ref,
6607
+ reason: "not-initialized"
6608
+ });
6609
+ else if (answer.kind === "unavailable") unresolved.push({
6610
+ ref,
6611
+ reason: answer.reason
6612
+ });
6613
+ else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
6614
+ ref,
6615
+ reason: answer.kind
6616
+ });
6617
+ }
6618
+ const substitute = (v) => {
6619
+ if (isSecretMarker(v)) {
6620
+ const answer = answers[v.$secret];
6621
+ return answer?.kind === "value" ? {
6622
+ keep: true,
6623
+ value: answer.value
6624
+ } : {
6625
+ keep: false,
6626
+ value: void 0
6627
+ };
6628
+ }
6629
+ if (Array.isArray(v)) {
6630
+ const items = [];
6631
+ for (const item of v) {
6632
+ const s = substitute(item);
6633
+ if (s.keep) items.push(s.value);
6634
+ }
6635
+ return {
6636
+ keep: true,
6637
+ value: items
6638
+ };
6639
+ }
6640
+ if (isRecord$2(v)) {
6641
+ const out = {};
6642
+ for (const [k, child] of Object.entries(v)) {
6643
+ const s = substitute(child);
6644
+ if (s.keep) out[k] = s.value;
6645
+ }
6646
+ return {
6647
+ keep: true,
6648
+ value: out
6649
+ };
6650
+ }
6651
+ return {
6652
+ keep: true,
6653
+ value: v
6654
+ };
6655
+ };
6656
+ return {
6657
+ value: substitute(value).value,
6658
+ unresolved
6659
+ };
6660
+ }
6661
+ function touchesTree(tree, patch) {
6662
+ if (tree.size === 0) return false;
6663
+ for (const key of Object.keys(patch)) {
6664
+ const at = key.indexOf("@");
6665
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6666
+ }
6667
+ return false;
6668
+ }
6669
+ /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6670
+ async function readStoredAddonBlob(raw) {
6671
+ const threeWay = raw.readAddonStoreResult;
6672
+ if (threeWay === void 0) return raw.readAddonStore();
6673
+ const result = await threeWay.call(raw);
6674
+ if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6675
+ return result.kind === "missing" ? {} : result.value;
6676
+ }
6677
+ function createSecretAwareSettings(raw, opts) {
6678
+ const chains = /* @__PURE__ */ new Map();
6679
+ const serialize = (key, fn) => {
6680
+ const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
6681
+ const tail = next.catch(() => void 0);
6682
+ chains.set(key, tail);
6683
+ tail.then(() => {
6684
+ if (chains.get(key) === tail) chains.delete(key);
6685
+ });
6686
+ return next;
6687
+ };
6688
+ const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6689
+ if (!touchesTree(tree, patch)) return rawWrite(patch);
6690
+ return serialize(chainKey, async () => {
6691
+ const stored = await readStored();
6692
+ const result = await transformSecretWrite({
6693
+ tree,
6694
+ secrets: opts.secrets,
6695
+ patch,
6696
+ stored,
6697
+ ...scope !== void 0 ? { scope } : {},
6698
+ operatorWrite: opts.isOperatorWrite?.() === true
6699
+ });
6700
+ if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6701
+ const { orphaned } = await result.afterWrite();
6702
+ if (orphaned.length > 0) opts.onOrphaned(orphaned);
6703
+ });
6704
+ };
6705
+ const wrapped = {
6706
+ writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6707
+ writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6708
+ kind: "device",
6709
+ deviceId
6710
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6711
+ };
6712
+ return new Proxy(raw, { get(target, prop, receiver) {
6713
+ if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6714
+ if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6715
+ const value = Reflect.get(target, prop, receiver);
6716
+ return typeof value === "function" ? value.bind(target) : value;
6717
+ } });
6718
+ }
6719
+ /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6720
+ function withSecretAwareSettings(context, opts) {
6721
+ const raw = context.settings;
6722
+ if (raw === void 0) return context;
6723
+ const settings = createSecretAwareSettings(raw, opts);
6724
+ return new Proxy(context, { get(target, prop, receiver) {
6725
+ if (prop === "settings") return settings;
6726
+ return Reflect.get(target, prop, receiver);
6727
+ } });
6728
+ }
6729
+ var LEAF = { kind: "leaf" };
6730
+ var DEFAULT_ITEM_ID_KEY = "id";
6731
+ function collectFields(fields, out) {
6732
+ for (const field of fields) {
6733
+ if (field.type === "group") {
6734
+ collectFields(field.fields, out);
6735
+ continue;
6736
+ }
6737
+ if (field.type === "sub-tabs") {
6738
+ for (const tab of field.tabs) collectFields(tab.fields, out);
6739
+ continue;
6740
+ }
6741
+ if (field.type === "editable-array") {
6742
+ const item = /* @__PURE__ */ new Map();
6743
+ for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
6744
+ if (item.size > 0) out.set(field.key, {
6745
+ kind: "array",
6746
+ idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
6747
+ item
6748
+ });
6749
+ continue;
6750
+ }
6751
+ if (!("key" in field) || typeof field.key !== "string") continue;
6752
+ if (isKeychainStoredField(field)) out.set(field.key, LEAF);
6753
+ }
6754
+ }
6755
+ /** The secret tree a settings schema declares. */
6756
+ function secretTreeFromSchema(schema) {
6757
+ const out = /* @__PURE__ */ new Map();
6758
+ if (schema === null) return out;
6759
+ for (const section of schema.sections) collectFields(section.fields, out);
6760
+ return out;
6761
+ }
6762
+ /** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
6763
+ function parseSecretStatePath(path) {
6764
+ const segments = [];
6765
+ for (const raw of path.split(".")) {
6766
+ const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
6767
+ if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
6768
+ segments.push(m[2] !== void 0 ? {
6769
+ key: m[1],
6770
+ idKey: m[2]
6771
+ } : { key: m[1] });
6772
+ }
6773
+ if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
6774
+ if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
6775
+ return segments;
6776
+ }
6777
+ function insert(into, segments) {
6778
+ const [head, ...rest] = segments;
6779
+ if (head === void 0) return;
6780
+ if (rest.length === 0) {
6781
+ into.set(head.key, LEAF);
6782
+ return;
6783
+ }
6784
+ const existing = into.get(head.key);
6785
+ if (head.idKey !== void 0) {
6786
+ const item = new Map(existing?.kind === "array" ? existing.item : []);
6787
+ insert(item, rest);
6788
+ into.set(head.key, {
6789
+ kind: "array",
6790
+ idKey: head.idKey,
6791
+ item
6792
+ });
6793
+ return;
6794
+ }
6795
+ const children = new Map(existing?.kind === "object" ? existing.children : []);
6796
+ insert(children, rest);
6797
+ into.set(head.key, {
6798
+ kind: "object",
6799
+ children
6800
+ });
6801
+ }
6802
+ /** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
6803
+ function mergeSecretStatePaths(tree, paths) {
6804
+ if (paths.length === 0) return tree;
6805
+ const out = new Map(tree);
6806
+ for (const path of paths) insert(out, parseSecretStatePath(path));
6807
+ return out;
6808
+ }
6809
+ /** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
6810
+ var SECRET_RETRY_FIRST_MS = 5e3;
6811
+ var SECRET_RETRY_MAX_MS = 5 * 6e4;
6812
+ /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
6813
+ var SECRET_CHANGE_DEBOUNCE_MS = 250;
6278
6814
  /**
6279
6815
  * Base class for CamStack addons. Eliminates settings boilerplate:
6280
6816
  *
@@ -6344,6 +6880,25 @@ var BaseAddon = class {
6344
6880
  settingsStoreReady = false;
6345
6881
  /** Default config values. Provided via constructor. */
6346
6882
  defaults;
6883
+ /**
6884
+ * Hidden-state paths that hold secrets (D787) — values the addon writes
6885
+ * itself (`updateGlobalSettings`, `state()`) that no form field declares.
6886
+ * Stored in the keychain exactly like a `password` field. Syntax:
6887
+ * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
6888
+ * (`key[<id field>]` addresses array items by id, never by index).
6889
+ */
6890
+ secretStatePaths = [];
6891
+ _addonSecretTree = null;
6892
+ _deviceSecretTree = null;
6893
+ /** Refs the last resolved config pointed at — a change to one re-resolves. */
6894
+ _configSecretRefs = /* @__PURE__ */ new Set();
6895
+ _unresolvedSecrets = [];
6896
+ _secretRetryTimer = null;
6897
+ _secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
6898
+ _secretChangeTimer = null;
6899
+ _secretChangeUnsub = null;
6900
+ /** >0 while an OPERATOR's settings write is being applied. */
6901
+ _operatorWriteDepth = 0;
6347
6902
  constructor(defaults) {
6348
6903
  this.defaults = defaults;
6349
6904
  this._config = { ...defaults };
@@ -6379,8 +6934,18 @@ var BaseAddon = class {
6379
6934
  return this._config;
6380
6935
  }
6381
6936
  async initialize(context) {
6382
- this._ctx = context;
6937
+ const secrets = context.secrets;
6938
+ this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6939
+ secrets,
6940
+ addonTree: () => this.addonSecretTree(),
6941
+ deviceTree: () => this.deviceSecretTree(),
6942
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6943
+ isOperatorWrite: () => this._operatorWriteDepth > 0
6944
+ }) : context;
6383
6945
  await this.resolveConfig();
6946
+ if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6947
+ if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
6948
+ });
6384
6949
  const result = await this.onInitialize();
6385
6950
  this.emitLifecycle(EventCategory.AddonStarted);
6386
6951
  const normalized = normalizeAddonInitResult(result);
@@ -6413,6 +6978,12 @@ var BaseAddon = class {
6413
6978
  */
6414
6979
  async onHubReachable() {}
6415
6980
  async shutdown() {
6981
+ this._secretChangeUnsub?.();
6982
+ this._secretChangeUnsub = null;
6983
+ if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
6984
+ if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
6985
+ this._secretRetryTimer = null;
6986
+ this._secretChangeTimer = null;
6416
6987
  this.emitLifecycle(EventCategory.AddonStopped);
6417
6988
  if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
6418
6989
  await this.onShutdown();
@@ -6491,7 +7062,7 @@ var BaseAddon = class {
6491
7062
  return hydrateSchema(schema, overlay ? {
6492
7063
  ...projected,
6493
7064
  ...overlay
6494
- } : projected);
7065
+ } : projected, { inlineSecretsAsViews: true });
6495
7066
  }
6496
7067
  /**
6497
7068
  * The integration-level view of this addon's settings: exactly the sections
@@ -6540,7 +7111,7 @@ var BaseAddon = class {
6540
7111
  return hydrateSchema({
6541
7112
  ...schema,
6542
7113
  sections
6543
- }, projected);
7114
+ }, projected, { inlineSecretsAsViews: true });
6544
7115
  }
6545
7116
  /**
6546
7117
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -6594,18 +7165,50 @@ var BaseAddon = class {
6594
7165
  value: result.value[key]
6595
7166
  };
6596
7167
  }
7168
+ /**
7169
+ * The OPERATOR's write — a settings form or an admin API call, dispatched by
7170
+ * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
7171
+ * the operator sends is stored as sent even when it equals a pre-keychain
7172
+ * inline value: the operator re-entering a password is a change, an addon
7173
+ * writing back what it read is not (D787).
7174
+ */
7175
+ async updateGlobalSettingsAsOperator(patch, nodeId) {
7176
+ this._operatorWriteDepth++;
7177
+ try {
7178
+ await this.applyGlobalPatch(patch, nodeId);
7179
+ } finally {
7180
+ this._operatorWriteDepth--;
7181
+ }
7182
+ }
6597
7183
  async updateGlobalSettings(patch, nodeId) {
7184
+ await this.applyGlobalPatch(patch, nodeId);
7185
+ }
7186
+ /**
7187
+ * REMOVE stored secrets — their keychain values and their markers (D787).
7188
+ *
7189
+ * Writing `''` to a secret field KEEPS what is stored (an empty string is
7190
+ * what a defaults fallback writes back, and it must never destroy a
7191
+ * credential), so code that means "forget this token" says so here. Without
7192
+ * a keychain (an older kernel) it writes `''`, as such code always did.
7193
+ */
7194
+ async clearSecrets(keys, nodeId) {
7195
+ const tree = this.addonSecretTree();
7196
+ const keychain = this._ctx?.secrets !== void 0;
7197
+ const patch = {};
7198
+ for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7199
+ await this.applyGlobalPatch(patch, nodeId);
7200
+ }
7201
+ async applyGlobalPatch(barePatch, nodeId) {
6598
7202
  const keys = this.perNodeKeys();
6599
7203
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6600
7204
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6601
- const barePatch = patch;
6602
7205
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6603
7206
  await this._ctx?.settings?.writeAddonStore(scoped);
6604
7207
  if (target !== localNode) return;
6605
7208
  await this.resolveConfig();
6606
7209
  await this.onConfigChanged();
6607
7210
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
6608
- this.maybeAutoRestart(patch, this.globalSettingsSchema());
7211
+ this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
6609
7212
  }
6610
7213
  /**
6611
7214
  * The set of field keys the global settings schema declares `perNode: true`
@@ -6630,7 +7233,7 @@ var BaseAddon = class {
6630
7233
  * time to return its response before the addon is torn down and
6631
7234
  * re-initialised by `AddonRegistryService.restartAddon`.
6632
7235
  */
6633
- maybeAutoRestart(patch, schema) {
7236
+ maybeAutoRestart(patchKeys, schema) {
6634
7237
  if (!schema) return;
6635
7238
  const restartKeys = /* @__PURE__ */ new Set();
6636
7239
  for (const section of schema.sections) for (const field of section.fields) {
@@ -6638,13 +7241,13 @@ var BaseAddon = class {
6638
7241
  if (field.requiresRestart) restartKeys.add(field.key);
6639
7242
  }
6640
7243
  if (restartKeys.size === 0) return;
6641
- if (!Object.keys(patch).some((k) => restartKeys.has(k))) return;
7244
+ if (!patchKeys.some((k) => restartKeys.has(k))) return;
6642
7245
  const ctx = this._ctx;
6643
7246
  if (!ctx) return;
6644
7247
  const addonId = ctx.id;
6645
7248
  setImmediate(() => {
6646
7249
  ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
6647
- ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: Object.keys(patch).filter((k) => restartKeys.has(k)) } });
7250
+ ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
6648
7251
  }).catch((err) => {
6649
7252
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
6650
7253
  });
@@ -6653,7 +7256,7 @@ var BaseAddon = class {
6653
7256
  async getDeviceSettings(deviceId) {
6654
7257
  const schema = this.deviceSettingsSchema();
6655
7258
  if (!schema) return { sections: [] };
6656
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
7259
+ return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6657
7260
  }
6658
7261
  async updateDeviceSettings(deviceId, patch) {
6659
7262
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -6783,7 +7386,7 @@ var BaseAddon = class {
6783
7386
  * selection at boot (absent scoped key ⇒ the constructor default wins).
6784
7387
  */
6785
7388
  async resolveConfig() {
6786
- const stored = await this.readAddonStoreWithRetry();
7389
+ const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
6787
7390
  const perNode = this.perNodeKeys();
6788
7391
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6789
7392
  const resolved = { ...this.defaults };
@@ -6808,7 +7411,7 @@ var BaseAddon = class {
6808
7411
  key,
6809
7412
  schema,
6810
7413
  fallback,
6811
- read: () => this.readAddonStoreWithRetry(),
7414
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
6812
7415
  write: async (patch) => {
6813
7416
  await this._ctx?.settings?.writeAddonStore(patch);
6814
7417
  },
@@ -6825,7 +7428,7 @@ var BaseAddon = class {
6825
7428
  key,
6826
7429
  schema,
6827
7430
  fallback,
6828
- read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
7431
+ read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
6829
7432
  write: async (patch) => {
6830
7433
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
6831
7434
  },
@@ -6837,6 +7440,70 @@ var BaseAddon = class {
6837
7440
  } })
6838
7441
  });
6839
7442
  }
7443
+ /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
7444
+ addonSecretTree() {
7445
+ this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
7446
+ return this._addonSecretTree;
7447
+ }
7448
+ deviceSecretTree() {
7449
+ this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7450
+ return this._deviceSecretTree;
7451
+ }
7452
+ /**
7453
+ * Secrets of this addon's stored config that could not be resolved on the
7454
+ * last read, with why. Non-empty means the addon is running WITHOUT them —
7455
+ * an addon whose function needs one should report itself degraded rather
7456
+ * than start on an empty credential.
7457
+ */
7458
+ get unresolvedSecrets() {
7459
+ return this._unresolvedSecrets;
7460
+ }
7461
+ /**
7462
+ * Substitute every keychain marker in a stored blob with its value. With no
7463
+ * keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
7464
+ * An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
7465
+ * value — and, when the cause can pass, retried with backoff. Nothing is
7466
+ * ever written back from here.
7467
+ */
7468
+ async resolveStoredSecrets(blob, trackForConfig = true) {
7469
+ const secrets = this._ctx?.secrets;
7470
+ if (secrets === void 0) return blob;
7471
+ const refs = collectSecretMarkerRefs(blob);
7472
+ if (trackForConfig) this._configSecretRefs = new Set(refs);
7473
+ if (refs.length === 0) {
7474
+ if (trackForConfig) this._unresolvedSecrets = [];
7475
+ return blob;
7476
+ }
7477
+ const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
7478
+ if (trackForConfig) {
7479
+ this._unresolvedSecrets = unresolved;
7480
+ if (unresolved.length > 0) {
7481
+ this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
7482
+ ref: u.ref,
7483
+ reason: u.reason
7484
+ })) } });
7485
+ if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
7486
+ this.scheduleSecretReresolve(this._secretRetryDelayMs);
7487
+ this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
7488
+ }
7489
+ } else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
7490
+ }
7491
+ return value;
7492
+ }
7493
+ /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7494
+ scheduleSecretReresolve(delayMs) {
7495
+ const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
7496
+ if (this[timerOf] !== null) return;
7497
+ const timer = setTimeout(() => {
7498
+ this[timerOf] = null;
7499
+ if (this._ctx === null) return;
7500
+ this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
7501
+ this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
7502
+ });
7503
+ }, delayMs);
7504
+ timer.unref?.();
7505
+ this[timerOf] = timer;
7506
+ }
6840
7507
  /**
6841
7508
  * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
6842
7509
  * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
@@ -14579,6 +15246,196 @@ id: union([string(), number()]) }), {
14579
15246
  kind: "mutation",
14580
15247
  auth: "admin"
14581
15248
  });
15249
+ /**
15250
+ * `keychain` — the hub's encrypted store of secret values (D787).
15251
+ *
15252
+ * Settings blobs never hold a secret: they hold a marker
15253
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
15254
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
15255
+ * is the OWNER's door to its own values: every method is owner-checked
15256
+ * against the CALLER, never against anything the caller claims.
15257
+ *
15258
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
15259
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
15260
+ * connection, the agent from its child's connection carried in
15261
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
15262
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
15263
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
15264
+ * identity against BUGS and misrouting, not against a malicious addon (every
15265
+ * runner is the same OS user): see the threat model in
15266
+ * `docs/design/2026-10-08-secrets-keychain.md`.
15267
+ *
15268
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
15269
+ * parses the input, so a session can never supply it, and the internal mount
15270
+ * floors every method to admin anyway (D240).
15271
+ *
15272
+ * Internal: addons reach it through `ctx.secrets`, never directly.
15273
+ */
15274
+ /** Why a value cannot be served right now. Never folded into "missing". */
15275
+ var KeychainUnavailableReasonSchema = _enum([
15276
+ "key-missing",
15277
+ "wrong-key",
15278
+ "key-file-unreadable",
15279
+ "store-unavailable",
15280
+ "not-initialized",
15281
+ "decrypt-failed"
15282
+ ]);
15283
+ var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
15284
+ state: literal("locked"),
15285
+ reason: KeychainUnavailableReasonSchema
15286
+ })]);
15287
+ var KeychainResolveEntrySchema = discriminatedUnion("kind", [
15288
+ object({
15289
+ kind: literal("value"),
15290
+ value: string(),
15291
+ version: number().int()
15292
+ }),
15293
+ object({ kind: literal("missing") }),
15294
+ object({
15295
+ kind: literal("unavailable"),
15296
+ reason: KeychainUnavailableReasonSchema
15297
+ }),
15298
+ object({ kind: literal("forbidden") })
15299
+ ]);
15300
+ var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
15301
+ /** Metadata of one stored value — never the value. */
15302
+ var KeychainSecretMetaSchema = object({
15303
+ ref: string(),
15304
+ owner: string(),
15305
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
15306
+ scope: string(),
15307
+ fieldPath: string(),
15308
+ version: number().int(),
15309
+ createdAt: number(),
15310
+ updatedAt: number(),
15311
+ /** `addon:<id>` | `user:<id>` | `system`. */
15312
+ updatedBy: string(),
15313
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
15314
+ lastReadAt: number().nullable()
15315
+ });
15316
+ var RefListSchema = array(string().min(1)).max(512);
15317
+ method(object({
15318
+ ref: string().min(1),
15319
+ value: string().min(1)
15320
+ }), object({
15321
+ ref: string(),
15322
+ version: number().int()
15323
+ }), {
15324
+ kind: "mutation",
15325
+ auth: "admin"
15326
+ }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
15327
+ kind: "mutation",
15328
+ auth: "admin"
15329
+ }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
15330
+ var KeychainKeySourceSchema = object({
15331
+ kind: _enum([
15332
+ "config-file",
15333
+ "previous-config-file",
15334
+ "platform",
15335
+ "default-file"
15336
+ ]),
15337
+ /** File sources only — a path is not a secret. */
15338
+ path: string().optional(),
15339
+ /**
15340
+ * True when a whole-volume backup of the data directory carries this key
15341
+ * next to the database it protects (the default file). The page warns.
15342
+ */
15343
+ sharesBackupWithDatabase: boolean()
15344
+ });
15345
+ var KeychainStatusSchema = object({
15346
+ keychain: KeychainStateSchema,
15347
+ /** The source of the master key in use; `null` while locked. */
15348
+ keySource: KeychainKeySourceSchema.nullable(),
15349
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
15350
+ configuredSource: KeychainKeySourceSchema,
15351
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
15352
+ fingerprint: string().nullable(),
15353
+ activeKeyId: string().nullable(),
15354
+ /**
15355
+ * The keychain unlocked with a NON-primary source: the configured primary
15356
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
15357
+ */
15358
+ rotationPending: boolean(),
15359
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
15360
+ retiredWraps: number().int(),
15361
+ recoveryKeyDownloadedAt: number().nullable(),
15362
+ secretCount: number().int()
15363
+ });
15364
+ /**
15365
+ * Whether a stored value is still pointed at by its owner's settings.
15366
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
15367
+ * never reported as an orphan (and never deleted as one).
15368
+ */
15369
+ var KeychainSecretUsageSchema = _enum([
15370
+ "in-use",
15371
+ "orphan",
15372
+ "unknown"
15373
+ ]);
15374
+ var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
15375
+ var KeychainAuditActionSchema = _enum([
15376
+ "put",
15377
+ "delete",
15378
+ "reveal",
15379
+ "rotate-master-key",
15380
+ "purge-retired-keys",
15381
+ "download-recovery-key",
15382
+ "delete-orphans",
15383
+ "reset",
15384
+ "initialize"
15385
+ ]);
15386
+ var KeychainAuditEntrySchema = object({
15387
+ id: string(),
15388
+ at: number(),
15389
+ action: KeychainAuditActionSchema,
15390
+ /** `addon:<id>` | `user:<id>` | `system`. */
15391
+ actor: string(),
15392
+ ref: string().nullable(),
15393
+ detail: string().nullable()
15394
+ });
15395
+ 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({
15396
+ value: string(),
15397
+ version: number().int()
15398
+ }), {
15399
+ kind: "mutation",
15400
+ auth: "admin",
15401
+ caller: "required"
15402
+ }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
15403
+ deleted: array(string()).readonly(),
15404
+ kept: array(object({
15405
+ ref: string(),
15406
+ usage: KeychainSecretUsageSchema
15407
+ })).readonly()
15408
+ }), {
15409
+ kind: "mutation",
15410
+ auth: "admin",
15411
+ caller: "required"
15412
+ }), method(object({}), object({
15413
+ fingerprint: string(),
15414
+ keySource: KeychainKeySourceSchema
15415
+ }), {
15416
+ kind: "mutation",
15417
+ auth: "admin",
15418
+ caller: "required"
15419
+ }), method(object({}), object({ purged: number().int() }), {
15420
+ kind: "mutation",
15421
+ auth: "admin",
15422
+ caller: "required"
15423
+ }), method(object({}), object({
15424
+ key: string(),
15425
+ fingerprint: string(),
15426
+ keySource: KeychainKeySourceSchema
15427
+ }), {
15428
+ kind: "mutation",
15429
+ auth: "admin",
15430
+ caller: "required"
15431
+ }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15432
+ archivedCollection: string().nullable(),
15433
+ archived: number().int()
15434
+ }), {
15435
+ kind: "mutation",
15436
+ auth: "admin",
15437
+ caller: "required"
15438
+ });
14582
15439
  method(_void(), object({
14583
15440
  id: string(),
14584
15441
  name: string(),
@@ -15616,7 +16473,11 @@ var DeviceRegisterPayloadSchema = object({
15616
16473
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
15617
16474
  var DevicePersistConfigPayloadSchema = object({
15618
16475
  deviceId: number(),
15619
- data: record(string(), unknown())
16476
+ data: record(string(), unknown()),
16477
+ /** The paths the device's schema declares secret (D783), when the caller
16478
+ * knows them — those values are kept in the keychain, not the blob (D787).
16479
+ * Absent: the paths the device last reported at `registerDevice` apply. */
16480
+ secretConfigPaths: array(string()).optional()
15620
16481
  });
15621
16482
  /** What a migration actually did, per switch. `unreachable` is a first-class
15622
16483
  * answer: a camera that could not be asked is not a camera that was silenced. */
@@ -22601,8 +23462,23 @@ var RetrainMacroClassSchema = _enum([
22601
23462
  ]);
22602
23463
  /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
22603
23464
  var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
22604
- /** Did a human draw this box, or did the assist propose it? */
22605
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
23465
+ /**
23466
+ * Where a box came from. A machine-sourced box is a DRAFT on the page until
23467
+ * the operator confirms it; once saved it keeps its source as provenance.
23468
+ *
23469
+ * - `operator` — drawn by hand.
23470
+ * - `assist` — proposed by a detector run on the copy (the camera's own
23471
+ * model, or a larger teacher model).
23472
+ * - `pipeline` — the box the live pipeline actually drew on that frame, read
23473
+ * back from the track store (never a re-run).
23474
+ * - `llm` — proposed by a vision-capable LLM profile.
23475
+ */
23476
+ var RetrainAnnotationSourceSchema = _enum([
23477
+ "operator",
23478
+ "assist",
23479
+ "pipeline",
23480
+ "llm"
23481
+ ]);
22606
23482
  /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
22607
23483
  var RetrainBboxSchema = object({
22608
23484
  x: number(),
@@ -22620,7 +23496,8 @@ var RetrainBboxSchema = object({
22620
23496
  */
22621
23497
  var RetrainAnnotationSchema = object({
22622
23498
  id: string(),
22623
- trackId: string(),
23499
+ /** The frame's track. Absent on a recording still, which has none. */
23500
+ trackId: string().optional(),
22624
23501
  deviceId: number(),
22625
23502
  /** The COPY in retrain storage — never the source track's media key. */
22626
23503
  mediaKey: string(),
@@ -22669,13 +23546,47 @@ var RetrainFrameCandidateSchema = object({
22669
23546
  * fail, whatever became of the original. */
22670
23547
  copied: boolean()
22671
23548
  });
23549
+ /**
23550
+ * One box the live pipeline drew on a copied frame — what a correction starts
23551
+ * from. Derived when the frame is listed, from the track store: the subject
23552
+ * box recorded on the source media row when there is one, else the track
23553
+ * position nearest the frame's capture time. Never stored as an annotation
23554
+ * until the operator confirms it.
23555
+ */
23556
+ var RetrainPipelineBoxSchema = object({
23557
+ /** Normalised `[0,1]` against the full frame. */
23558
+ bbox: RetrainBboxSchema,
23559
+ macroClass: RetrainMacroClassSchema,
23560
+ label: string().optional(),
23561
+ subLabel: string().optional(),
23562
+ /** The detection score of the position used, when it was recorded. */
23563
+ score: number().optional(),
23564
+ /** The root model that produced the track, when it was recorded. */
23565
+ modelId: string().optional(),
23566
+ trackId: string(),
23567
+ /** `subject-box`: recorded on this very frame. `position`: the track's
23568
+ * position nearest the capture time, `deltaMs` away. */
23569
+ basis: _enum(["subject-box", "position"]),
23570
+ deltaMs: number()
23571
+ });
23572
+ /**
23573
+ * Where a retrain frame came from: a TRACK's stored media (copy-on-select),
23574
+ * or the RECORDING at an instant — the frame a model saw nothing in has no
23575
+ * track at all.
23576
+ */
23577
+ var RetrainFrameOriginSchema = _enum(["track", "recording"]);
22672
23578
  /** A frame the dataset OWNS: bytes copied at selection time. */
22673
23579
  var RetrainFrameSchema = object({
22674
23580
  frameId: string(),
22675
23581
  deviceId: number(),
22676
- trackId: string(),
22677
- /** Provenance only. It may already point at nothing — that is expected. */
22678
- sourceMediaId: number().int(),
23582
+ origin: RetrainFrameOriginSchema,
23583
+ /** The track it was copied from. Absent on a recording still. */
23584
+ trackId: string().optional(),
23585
+ /** Provenance only. It may already point at nothing — that is expected.
23586
+ * Absent on a recording still. */
23587
+ sourceMediaId: number().int().optional(),
23588
+ /** A recording still: the playhead instant it was taken at. */
23589
+ epochMs: number().optional(),
22679
23590
  sourceKind: MediaFileKindEnum,
22680
23591
  sizeBytes: number().int(),
22681
23592
  width: number().int(),
@@ -22686,7 +23597,12 @@ var RetrainFrameSchema = object({
22686
23597
  /** The operator's "every subject in this frame is boxed". Detector
22687
23598
  * evaluation keeps only complete frames: an unboxed subject would count as
22688
23599
  * a false positive. */
22689
- complete: boolean()
23600
+ complete: boolean(),
23601
+ /** The boxes the pipeline drew on this frame. Present on list answers;
23602
+ * empty when nothing the track store holds can be placed on it. */
23603
+ pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
23604
+ /** The named collections this frame belongs to. Present on list answers. */
23605
+ collectionIds: array(string()).readonly().optional()
22690
23606
  });
22691
23607
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
22692
23608
  var RetrainCopyRefusalSchema = _enum([
@@ -22717,6 +23633,8 @@ var RetrainFrameListSchema = object({
22717
23633
  var RetrainExportFilterSchema = object({
22718
23634
  deviceIds: array(number()).optional(),
22719
23635
  frameIds: array(string()).max(2e4).optional(),
23636
+ /** Only frames in at least one of these named collections. */
23637
+ collectionIds: array(string()).max(200).optional(),
22720
23638
  batchId: string().optional(),
22721
23639
  /** Only frames the operator marked complete (all subjects boxed). */
22722
23640
  completeOnly: boolean().optional()
@@ -22781,6 +23699,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
22781
23699
  reason: string(),
22782
23700
  detail: string().optional()
22783
23701
  })]);
23702
+ /** A named set over the retrain corpus — membership only, it owns no pixels. */
23703
+ var RetrainCollectionSchema = object({
23704
+ id: string(),
23705
+ name: string(),
23706
+ createdAt: number(),
23707
+ frameCount: number().int()
23708
+ });
23709
+ var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
23710
+ kind: literal("created"),
23711
+ collection: RetrainCollectionSchema
23712
+ }), object({
23713
+ kind: literal("refused"),
23714
+ reason: _enum(["empty-name", "duplicate-name"])
23715
+ })]);
23716
+ var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
23717
+ kind: literal("renamed"),
23718
+ collection: RetrainCollectionSchema
23719
+ }), object({
23720
+ kind: literal("refused"),
23721
+ reason: _enum([
23722
+ "empty-name",
23723
+ "duplicate-name",
23724
+ "unknown-collection"
23725
+ ])
23726
+ })]);
23727
+ /**
23728
+ * The outcome of adding the frame at a recording instant. Every refusal is
23729
+ * named: `still-unavailable` (not recording, a gap, or an undecodable frame —
23730
+ * `detail` says which), `still-busy` (the recorder is at its decode bound; try
23731
+ * again), `unreadable-image`, `write-failed`, `unknown-collection`.
23732
+ */
23733
+ var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
23734
+ kind: literal("added"),
23735
+ collectionId: string(),
23736
+ frame: RetrainFrameSchema,
23737
+ /** The moment was already in the dataset; nothing was decoded. */
23738
+ reused: boolean()
23739
+ }), object({
23740
+ kind: literal("refused"),
23741
+ reason: _enum([
23742
+ "unknown-collection",
23743
+ "still-unavailable",
23744
+ "still-busy",
23745
+ "unreadable-image",
23746
+ "write-failed"
23747
+ ]),
23748
+ detail: string().optional()
23749
+ })]);
23750
+ /** A vision LLM profile the AI assist may use, and where it sends the frame. */
23751
+ var RetrainAssistProfileSchema = object({
23752
+ id: string(),
23753
+ name: string(),
23754
+ model: string(),
23755
+ kind: string(),
23756
+ /** `true` when the frame would leave the house (a cloud vendor, or an
23757
+ * endpoint that is not on the local network). The page confirms each such
23758
+ * run, and the provider refuses one without `allowCloud`. */
23759
+ leavesHouse: boolean()
23760
+ });
23761
+ /** A box the AI assist proposed: a draft, plus the model's own reason. */
23762
+ var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
23763
+ /** What the AI assist said about a box that was already on the canvas. */
23764
+ var RetrainLlmReviewSchema = object({
23765
+ /** The `ref` the page sent the box under. */
23766
+ ref: string(),
23767
+ verdict: _enum([
23768
+ "confirmed",
23769
+ "wrong-class",
23770
+ "not-an-object",
23771
+ "uncertain"
23772
+ ]),
23773
+ suggestedClass: RetrainMacroClassSchema.optional(),
23774
+ reason: string()
23775
+ });
23776
+ /**
23777
+ * The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
23778
+ * model and its confidence) and reviews; items the model got wrong (a box off
23779
+ * the frame, an unasked class, an unknown ref) are dropped and counted in
23780
+ * `rejected`. A whole answer that is not the schema is `malformed-answer`.
23781
+ */
23782
+ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23783
+ kind: literal("proposed"),
23784
+ profileId: string(),
23785
+ model: string(),
23786
+ /** The frame was sent outside the house for this answer. */
23787
+ leftHouse: boolean(),
23788
+ proposals: array(RetrainLlmProposalSchema).readonly(),
23789
+ reviews: array(RetrainLlmReviewSchema).readonly(),
23790
+ rejected: number().int()
23791
+ }), object({
23792
+ kind: literal("refused"),
23793
+ reason: _enum([
23794
+ "unknown-frame",
23795
+ "unreadable-frame",
23796
+ "unknown-profile",
23797
+ "profile-disabled",
23798
+ "no-vision",
23799
+ "cloud-not-confirmed",
23800
+ "llm-error",
23801
+ "malformed-answer"
23802
+ ]),
23803
+ detail: string().optional()
23804
+ })]);
22784
23805
  /** The outcome of a lifecycle move owned by the retrain page. */
22785
23806
  var RetrainTransitionResultSchema = object({
22786
23807
  trackId: string(),
@@ -23498,7 +24519,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23498
24519
  auth: "admin"
23499
24520
  }), method(object({
23500
24521
  deviceId: number(),
23501
- trackId: string(),
24522
+ trackId: string().optional(),
23502
24523
  frameId: string()
23503
24524
  }), object({
23504
24525
  removed: boolean(),
@@ -23515,7 +24536,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23515
24536
  auth: "admin"
23516
24537
  }), method(object({
23517
24538
  deviceId: number(),
23518
- trackId: string(),
24539
+ /** The frame's track, when it has one — checked against the frame. */
24540
+ trackId: string().optional(),
23519
24541
  frameId: string(),
23520
24542
  subject: RetrainAssistSubjectSchema,
23521
24543
  /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
@@ -23523,12 +24545,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23523
24545
  }), RetrainAssistResultSchema, {
23524
24546
  kind: "mutation",
23525
24547
  auth: "admin"
23526
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
24548
+ }), method(object({
24549
+ trackId: string().optional(),
24550
+ frameIds: array(string()).max(2e3).optional()
24551
+ }), array(RetrainAnnotationSchema).readonly(), {
23527
24552
  kind: "query",
23528
24553
  auth: "admin"
23529
24554
  }), method(object({
23530
24555
  deviceId: number(),
23531
- trackId: string(),
24556
+ /** The frame's track, when it has one — checked against the frame. */
24557
+ trackId: string().optional(),
23532
24558
  frameId: string(),
23533
24559
  annotations: array(RetrainAnnotationDraftSchema)
23534
24560
  }), array(RetrainAnnotationSchema).readonly(), {
@@ -23551,7 +24577,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23551
24577
  auth: "admin"
23552
24578
  }), method(object({
23553
24579
  deviceId: number(),
23554
- trackId: string(),
24580
+ trackId: string().optional(),
23555
24581
  frameId: string(),
23556
24582
  complete: boolean()
23557
24583
  }), RetrainFrameSchema, {
@@ -23565,6 +24591,74 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23565
24591
  kind: "mutation",
23566
24592
  auth: "admin",
23567
24593
  timeoutMs: 60 * 6e4
24594
+ }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24595
+ kind: "query",
24596
+ auth: "admin"
24597
+ }), method(object({
24598
+ deviceId: number(),
24599
+ trackId: string().optional(),
24600
+ frameId: string(),
24601
+ profileId: string(),
24602
+ classes: array(RetrainMacroClassSchema).min(1),
24603
+ boxes: array(object({
24604
+ ref: string(),
24605
+ bbox: RetrainBboxSchema,
24606
+ macroClass: RetrainMacroClassSchema,
24607
+ label: string().optional()
24608
+ })).max(50),
24609
+ allowCloud: boolean()
24610
+ }), RetrainLlmAssistResultSchema, {
24611
+ kind: "mutation",
24612
+ auth: "admin",
24613
+ timeoutMs: 18e4
24614
+ }), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
24615
+ kind: "mutation",
24616
+ auth: "admin"
24617
+ }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24618
+ kind: "query",
24619
+ auth: "admin"
24620
+ }), method(object({
24621
+ id: string(),
24622
+ name: string().max(120)
24623
+ }), RetrainCollectionRenameResultSchema, {
24624
+ kind: "mutation",
24625
+ auth: "admin"
24626
+ }), method(object({ id: string() }), object({
24627
+ deleted: boolean(),
24628
+ removedFrames: number().int()
24629
+ }), {
24630
+ kind: "mutation",
24631
+ auth: "admin"
24632
+ }), method(object({
24633
+ collectionId: string(),
24634
+ deviceId: number(),
24635
+ epochMs: number()
24636
+ }), AddRetrainFrameFromRecordingResultSchema, {
24637
+ kind: "mutation",
24638
+ auth: "admin",
24639
+ timeoutMs: 6e4
24640
+ }), method(object({
24641
+ collectionId: string(),
24642
+ frameIds: array(string()).min(1).max(500)
24643
+ }), object({
24644
+ added: number().int(),
24645
+ alreadyMember: number().int(),
24646
+ unknownFrameIds: array(string()).readonly()
24647
+ }), {
24648
+ kind: "mutation",
24649
+ auth: "admin"
24650
+ }), method(object({
24651
+ collectionId: string(),
24652
+ frameId: string()
24653
+ }), object({
24654
+ removed: boolean(),
24655
+ deletedFrame: boolean()
24656
+ }), {
24657
+ kind: "mutation",
24658
+ auth: "admin"
24659
+ }), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
24660
+ kind: "query",
24661
+ auth: "admin"
23568
24662
  }), method(object({
23569
24663
  /** Which of the three event tables owns the row. */
23570
24664
  ownerType: EventOwnerTypeSchema,
@@ -24188,13 +25282,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
24188
25282
  object({
24189
25283
  kind: literal("no-family-build"),
24190
25284
  format: ModelFormatSchema$1
25285
+ }),
25286
+ object({
25287
+ kind: literal("kept-custom-pin"),
25288
+ modelId: string(),
25289
+ deviceKey: string()
24191
25290
  })
24192
25291
  ]);
25292
+ /** Why a device is left exactly as it is, whatever the plan would pick (D786). */
25293
+ var KeptReasonSchema = _enum(["custom-pin"]);
25294
+ /**
25295
+ * Where a choice's latency came from (D791): this node's own benchmark
25296
+ * result, or the hardware-class table. Measured on the node beats the table.
25297
+ */
25298
+ var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
25299
+ kind: literal("node-benchmark"),
25300
+ resultId: string(),
25301
+ measuredAtMs: number()
25302
+ })]);
24193
25303
  var DeviceModelChoiceSchema = object({
24194
25304
  modelId: string(),
24195
25305
  p50Ms: number(),
24196
25306
  fps: number(),
24197
25307
  measured: boolean(),
25308
+ /** Absent on a plan from before D791 — read as the table. */
25309
+ source: LatencySourceSchema.optional(),
24198
25310
  /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
24199
25311
  capacitySessions: number(),
24200
25312
  personRecall: number()
@@ -24205,6 +25317,8 @@ var DeviceRecommendationSchema = object({
24205
25317
  enabled: boolean(),
24206
25318
  available: boolean(),
24207
25319
  chosen: DeviceModelChoiceSchema.nullable(),
25320
+ /** Present when the device is kept as is: Apply writes nothing on it. */
25321
+ kept: KeptReasonSchema.optional(),
24208
25322
  reasons: array(RecommendationReasonSchema).readonly()
24209
25323
  });
24210
25324
  var NodeRecommendationSchema = object({
@@ -24258,6 +25372,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
24258
25372
  kind: literal("coral-enabled"),
24259
25373
  nodeId: string(),
24260
25374
  deviceKey: string()
25375
+ }),
25376
+ object({
25377
+ kind: literal("custom-pin-kept"),
25378
+ nodeId: string(),
25379
+ deviceKey: string().nullable(),
25380
+ deviceId: number().nullable(),
25381
+ modelId: string()
25382
+ }),
25383
+ object({
25384
+ kind: literal("custom-registry-unreadable"),
25385
+ error: string()
24261
25386
  })
24262
25387
  ]);
24263
25388
  var AutoTuneOptionsSchema = object({
@@ -24436,13 +25561,14 @@ var SuggestSharesResultSchema = object({
24436
25561
  nodes: array(SuggestedNodeShareSchema).readonly()
24437
25562
  });
24438
25563
  /**
24439
- * Where the node and device shares come from (D750, D755).
24440
- * - `hardware` (default) — computed by the system from each node's static
24441
- * capacity (its accelerators at their Auto tune models, from the measured
24442
- * latency table), recomputed whenever a node or device joins, leaves, is
24443
- * switched on or off, or changes model. No load input.
24444
- * - `benchmark` — the same, from each node's measured capacity (node
24445
- * benchmark results); a node without results falls back to `hardware`.
25564
+ * Where the node and device shares come from (D750, D755, D791).
25565
+ * - `benchmark` (default since D791) — each node's capacity as its own node
25566
+ * benchmark measured it; a node without fresh results is sized from
25567
+ * `hardware` and says so. Measured on the node beats the table.
25568
+ * - `hardware` — computed from each node's static capacity only (its
25569
+ * accelerators at their Auto tune models, from the latency table).
25570
+ * Both are recomputed whenever a node or device joins, leaves, is switched
25571
+ * on or off, changes model, or a benchmark result is written. No load input.
24446
25572
  * - `manual` — the operator's stored sliders.
24447
25573
  * Either way a node or device that cannot take sessions gives its share to
24448
25574
  * the others in proportion; the stored values are never rewritten for that.
@@ -24491,6 +25617,362 @@ var EffectiveSharesSchema = object({
24491
25617
  nodeWeights: record(string(), number()),
24492
25618
  deviceWeights: record(string(), record(string(), number()))
24493
25619
  });
25620
+ /**
25621
+ * Wire shapes of the node benchmark (D791): the operator's plan, the
25622
+ * preflight the confirmation shows, the run the orchestrator owns, what the
25623
+ * measuring runner reports, and the result rows Auto tune and the automatic
25624
+ * shares read.
25625
+ *
25626
+ * ONE node at a time, owned by the pipeline orchestrator. While a run is
25627
+ * active the cluster is in BENCHMARK MODE for that node: it is not a
25628
+ * detection candidate, camera pins naming it are ignored so its sessions move
25629
+ * elsewhere, and both come back when the mode ends — after a crash or a hub
25630
+ * restart too (a persisted manifest, reconciled against the registry).
25631
+ *
25632
+ * Two measurements, both on the node, driven by its own runner (frames never
25633
+ * cross a process at frame rate, D9):
25634
+ * - `device` — one accelerator × one candidate detector, root only, open
25635
+ * loop: how many streams at the camera rate it carries inside the frame
25636
+ * interval;
25637
+ * - `pipeline` — the chosen detector plus the operator's detail steps
25638
+ * (faces, plates, classifiers, CLIP…), on varied frames from the bench
25639
+ * clip: how many parallel sessions the node carries before latency, drops,
25640
+ * CPU, RAM or the event loop give out.
25641
+ */
25642
+ /** Defaults and bounds, one place. */
25643
+ var NODE_BENCHMARK_DEFAULTS = {
25644
+ fpsPerStream: 10,
25645
+ budgetMinutes: 45,
25646
+ minBudgetMinutes: 10,
25647
+ maxBudgetMinutes: 120,
25648
+ /** A result older than this no longer beats the table. */
25649
+ staleAfterDays: 30,
25650
+ /** Warm-in per ramp step (not accounted). */
25651
+ settleSec: 5,
25652
+ /** Accounted window per ramp step. */
25653
+ measureSec: 20,
25654
+ /** Longest the drain may take before the run is refused. */
25655
+ drainTimeoutSec: 120,
25656
+ /** Candidate models per device in one run. */
25657
+ maxModelsPerDevice: 6
25658
+ };
25659
+ /** The two measurements a run can make. */
25660
+ var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
25661
+ var NodeBenchmarkDevicePlanSchema = object({
25662
+ /** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
25663
+ deviceKey: string().min(1),
25664
+ /**
25665
+ * Root detector candidates for the `device` measurement, in the order
25666
+ * measured. The FIRST is the one the `pipeline` measurement runs.
25667
+ */
25668
+ modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
25669
+ });
25670
+ /** What the operator confirmed. */
25671
+ var NodeBenchmarkPlanSchema = object({
25672
+ nodeId: string().min(1),
25673
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25674
+ /** Which measurements run. At least one. */
25675
+ phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
25676
+ /**
25677
+ * Detail steps (catalog step ids under the root: faces, plates,
25678
+ * classifiers, CLIP…) the `pipeline` measurement enables. The root
25679
+ * detector always runs.
25680
+ */
25681
+ steps: array(string().min(1)).default([]),
25682
+ /** Offered rate of one stream / session. */
25683
+ fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
25684
+ /** Hard deadline: the mode ends and the cluster is restored when it passes. */
25685
+ budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
25686
+ /** Keep the models the run downloaded (default: delete what was not installed before). */
25687
+ keepDownloadedModels: boolean().default(false),
25688
+ /** Start although the other nodes' capacity does not cover the sessions running now. */
25689
+ acceptInsufficientHeadroom: boolean().default(false)
25690
+ });
25691
+ var NodeBenchmarkRefusalSchema = object({
25692
+ kind: _enum([
25693
+ "benchmark-active",
25694
+ "node-offline",
25695
+ "unknown-device",
25696
+ "no-phase",
25697
+ "insufficient-headroom"
25698
+ ]),
25699
+ detail: string(),
25700
+ overridable: boolean()
25701
+ });
25702
+ /** A camera whose detection leaves the node for the run. */
25703
+ var NodeBenchmarkMovingCameraSchema = object({
25704
+ deviceId: number(),
25705
+ /** Placed on the node now (a standing attach or a running session). */
25706
+ placedOnNode: boolean(),
25707
+ /** A node pin naming this node, ignored for the run. */
25708
+ pinnedToNode: boolean()
25709
+ });
25710
+ /** A camera that cannot leave: no other node can obtain its frames. */
25711
+ var NodeBenchmarkStayingCameraSchema = object({
25712
+ deviceId: number(),
25713
+ reason: literal("only-frame-source")
25714
+ });
25715
+ var NodeBenchmarkPreflightSchema = object({
25716
+ nodeId: string(),
25717
+ online: boolean(),
25718
+ moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
25719
+ /** Keep running on the node during the run; the result is flagged contaminated. */
25720
+ staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
25721
+ estimatedDurationMs: number(),
25722
+ /** The run ends and the cluster is restored at the latest after this long. */
25723
+ budgetMs: number(),
25724
+ phases: array(NodeBenchmarkPhaseSchema).readonly(),
25725
+ steps: array(string()).readonly(),
25726
+ devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
25727
+ /** Parallel sessions the cluster runs now, and what the other nodes can carry. */
25728
+ headroom: object({
25729
+ sessionsNow: number(),
25730
+ otherNodesCapacitySessions: number().nullable()
25731
+ }),
25732
+ refusals: array(NodeBenchmarkRefusalSchema).readonly(),
25733
+ canStart: boolean()
25734
+ });
25735
+ /** Where the measuring runner is. */
25736
+ var NodeBenchProgressSchema = object({
25737
+ phase: _enum([
25738
+ "preparing",
25739
+ "device",
25740
+ "pipeline",
25741
+ "cleanup"
25742
+ ]),
25743
+ deviceKey: string().nullable(),
25744
+ modelId: string().nullable(),
25745
+ /** Streams (device) or sessions (pipeline) of the step running now. */
25746
+ load: number().nullable(),
25747
+ cellsDone: number(),
25748
+ cellsTotal: number(),
25749
+ message: string()
25750
+ });
25751
+ /** What limited a ramp. `none` = the ramp ran out of steps still passing. */
25752
+ var NodeBenchLimitSchema = _enum([
25753
+ "p95",
25754
+ "drops",
25755
+ "errors",
25756
+ "stall",
25757
+ "cpu",
25758
+ "ram",
25759
+ "none"
25760
+ ]);
25761
+ var NodeBenchRampStepSchema = object({
25762
+ load: number(),
25763
+ pass: boolean(),
25764
+ p95Ms: number(),
25765
+ dropRatio: number(),
25766
+ /** Completed frames per second over the accounted window. */
25767
+ fps: number(),
25768
+ cpuPct: number().nullable(),
25769
+ ramFreePct: number().nullable(),
25770
+ failReasons: array(string()).readonly()
25771
+ });
25772
+ var NodeBenchCellSchema = discriminatedUnion("phase", [object({
25773
+ phase: literal("device"),
25774
+ deviceKey: string(),
25775
+ modelId: string(),
25776
+ /** Single-stream latency (the K = 1 step). */
25777
+ p50Ms: number(),
25778
+ p95Ms: number(),
25779
+ p99Ms: number(),
25780
+ /** Frames per second sustained at the last passing step. */
25781
+ fps: number(),
25782
+ /** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
25783
+ kMax: number(),
25784
+ limitedBy: NodeBenchLimitSchema,
25785
+ /** First call (model load + warm-up). */
25786
+ warmupMs: number(),
25787
+ ramp: array(NodeBenchRampStepSchema).readonly()
25788
+ }), object({
25789
+ phase: literal("pipeline"),
25790
+ deviceKey: string(),
25791
+ modelId: string(),
25792
+ steps: array(string()).readonly(),
25793
+ /** Parallel sessions at the camera rate the node carried; 0 = not even one. */
25794
+ maxSessions: number(),
25795
+ limitedBy: NodeBenchLimitSchema,
25796
+ /** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
25797
+ stepsFired: array(string()).readonly(),
25798
+ warmupMs: number(),
25799
+ ramp: array(NodeBenchRampStepSchema).readonly()
25800
+ })]);
25801
+ /**
25802
+ * What a result was measured ON. A result whose fingerprint no longer matches
25803
+ * the node no longer beats the table.
25804
+ */
25805
+ var NodeBenchFingerprintSchema = object({
25806
+ pipelineVersion: string().nullable(),
25807
+ cpuModel: string().nullable(),
25808
+ ramGb: number().nullable(),
25809
+ os: string().nullable(),
25810
+ /** Per device: the pool the cells ran on (runtime + tuning). */
25811
+ pools: record(string(), object({
25812
+ runtime: string(),
25813
+ numWorkers: number(),
25814
+ concurrency: number(),
25815
+ batchMode: string()
25816
+ })).default({})
25817
+ });
25818
+ /** The frames the run used. */
25819
+ var NodeBenchClipSchema = object({
25820
+ /** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
25821
+ id: string(),
25822
+ revision: string().nullable(),
25823
+ frames: number(),
25824
+ width: number(),
25825
+ height: number()
25826
+ });
25827
+ var NodeBenchRunnerInputSchema = object({
25828
+ runId: string().min(1),
25829
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25830
+ phases: array(NodeBenchmarkPhaseSchema).min(1),
25831
+ /** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
25832
+ steps: array(string()).default([]),
25833
+ fpsPerStream: number().int().min(1).max(30),
25834
+ /** The runner stops on its own past this instant, whatever the hub does. */
25835
+ deadlineAtMs: number(),
25836
+ settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
25837
+ measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
25838
+ keepDownloadedModels: boolean().default(false)
25839
+ });
25840
+ var NodeBenchRunnerStateSchema = _enum([
25841
+ "running",
25842
+ "done",
25843
+ "failed",
25844
+ "aborted"
25845
+ ]);
25846
+ var NodeBenchRunnerStatusSchema = object({
25847
+ runId: string(),
25848
+ nodeId: string(),
25849
+ state: NodeBenchRunnerStateSchema,
25850
+ progress: NodeBenchProgressSchema.nullable(),
25851
+ /** Every finished cell so far — a run stopped half way keeps what it measured. */
25852
+ cells: array(NodeBenchCellSchema).readonly(),
25853
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25854
+ clip: NodeBenchClipSchema.nullable(),
25855
+ /** Cameras seen running on the node during the run (they share its pools). */
25856
+ activeCameraIds: array(number()).readonly(),
25857
+ /** Models the run downloaded and then deleted (not installed before). */
25858
+ deletedModels: array(string()).readonly(),
25859
+ error: string().nullable(),
25860
+ startedAtMs: number(),
25861
+ finishedAtMs: number().nullable()
25862
+ });
25863
+ var NodeBenchmarkStateSchema = _enum([
25864
+ "draining",
25865
+ "measuring",
25866
+ "restoring",
25867
+ "done",
25868
+ "failed",
25869
+ "aborted"
25870
+ ]);
25871
+ /** Why a run ended. */
25872
+ var NodeBenchmarkEndReasonSchema = _enum([
25873
+ "completed",
25874
+ "operator-abort",
25875
+ "deadline",
25876
+ "node-lost",
25877
+ "runner-lost",
25878
+ "hub-restart",
25879
+ "drain-timeout",
25880
+ "failed"
25881
+ ]);
25882
+ var NodeBenchmarkRunSchema = object({
25883
+ runId: string(),
25884
+ nodeId: string(),
25885
+ state: NodeBenchmarkStateSchema,
25886
+ plan: NodeBenchmarkPlanSchema,
25887
+ startedAtMs: number(),
25888
+ deadlineAtMs: number(),
25889
+ finishedAtMs: number().nullable(),
25890
+ endReason: NodeBenchmarkEndReasonSchema.nullable(),
25891
+ error: string().nullable(),
25892
+ /** Cameras moved off the node for the run. */
25893
+ moved: array(number()).readonly(),
25894
+ /** Cameras that stayed (their only frame source is the node). */
25895
+ staying: array(number()).readonly(),
25896
+ /** Something else ran on the node's pools during the run. */
25897
+ contaminated: boolean(),
25898
+ progress: NodeBenchProgressSchema.nullable(),
25899
+ resultIds: array(string()).readonly()
25900
+ });
25901
+ /** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
25902
+ var NodeBenchmarkStatusSchema = object({
25903
+ /** The node the cluster is in benchmark mode for; null = none. */
25904
+ modeNodeId: string().nullable(),
25905
+ run: NodeBenchmarkRunSchema.nullable()
25906
+ });
25907
+ /**
25908
+ * One stored measurement — the only authority Auto tune and the automatic
25909
+ * shares read measured capacity from. Written by the orchestrator when a run
25910
+ * ends, never by anyone else.
25911
+ */
25912
+ var NodeBenchmarkResultSchema = object({
25913
+ id: string(),
25914
+ runId: string(),
25915
+ nodeId: string(),
25916
+ cell: NodeBenchCellSchema,
25917
+ fpsPerStream: number(),
25918
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25919
+ clip: NodeBenchClipSchema.nullable(),
25920
+ /** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
25921
+ contaminated: boolean(),
25922
+ stayingCameras: array(number()).readonly(),
25923
+ /** The run ended early; the cell itself completed. */
25924
+ partialRun: boolean(),
25925
+ measuredAtMs: number()
25926
+ });
25927
+ var ListNodeBenchmarkResultsInputSchema = object({
25928
+ nodeId: string().optional(),
25929
+ deviceKey: string().optional()
25930
+ });
25931
+ /** A result with its standing today: does it still beat the table? */
25932
+ var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
25933
+ /** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
25934
+ standing: _enum([
25935
+ "fresh",
25936
+ "stale",
25937
+ "superseded"
25938
+ ]),
25939
+ staleWhy: _enum([
25940
+ "age",
25941
+ "runtime",
25942
+ "pool-tuning"
25943
+ ]).nullable()
25944
+ });
25945
+ object({
25946
+ runId: string(),
25947
+ nodeId: string(),
25948
+ startedAtMs: number(),
25949
+ deadlineAtMs: number(),
25950
+ plan: NodeBenchmarkPlanSchema,
25951
+ moved: array(number()).readonly(),
25952
+ staying: array(number()).readonly()
25953
+ });
25954
+ /** Candidate detectors per device, for the plan editor. */
25955
+ var NodeBenchmarkCandidatesSchema = object({
25956
+ nodeId: string(),
25957
+ reachable: boolean(),
25958
+ devices: array(object({
25959
+ deviceKey: string(),
25960
+ enabled: boolean(),
25961
+ available: boolean(),
25962
+ /** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
25963
+ suggested: array(string()).readonly(),
25964
+ /** Every root detector the device has a build for. */
25965
+ all: array(string()).readonly(),
25966
+ /** The model the device runs now, when pinned. */
25967
+ currentModelId: string().nullable()
25968
+ })).readonly(),
25969
+ /** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
25970
+ steps: array(object({
25971
+ id: string(),
25972
+ name: string(),
25973
+ slot: string()
25974
+ })).readonly()
25975
+ });
24494
25976
  object({
24495
25977
  activeCameras: number(),
24496
25978
  throttledCameras: number(),
@@ -25579,7 +27061,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
25579
27061
  }), ParkedTrackFrameSchema.nullable()), method(object({
25580
27062
  deviceId: number(),
25581
27063
  trackId: string()
25582
- }), object({ released: number().int().nonnegative() }), { kind: "mutation" });
27064
+ }), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
27065
+ accepted: literal(true),
27066
+ runId: string()
27067
+ }), {
27068
+ kind: "mutation",
27069
+ auth: "admin"
27070
+ }), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
27071
+ kind: "mutation",
27072
+ auth: "admin"
27073
+ });
25583
27074
  var CameraPipelineConfigSchema = object({
25584
27075
  engine: PipelineEngineChoiceSchema.optional(),
25585
27076
  steps: array(PipelineStepInputSchema).readonly(),
@@ -26218,6 +27709,21 @@ method(object({
26218
27709
  }), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
26219
27710
  kind: "mutation",
26220
27711
  auth: "admin"
27712
+ }), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
27713
+ kind: literal("started"),
27714
+ runId: string()
27715
+ }), object({
27716
+ kind: literal("refused"),
27717
+ preflight: NodeBenchmarkPreflightSchema
27718
+ })]), {
27719
+ kind: "mutation",
27720
+ auth: "admin"
27721
+ }), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
27722
+ kind: "mutation",
27723
+ auth: "admin"
27724
+ }), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
27725
+ kind: "mutation",
27726
+ auth: "admin"
26221
27727
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
26222
27728
  deviceId: number(),
26223
27729
  addonId: string(),
@@ -31299,6 +32805,9 @@ var CreateIntegrationInputSchema = object({
31299
32805
  enabled: boolean().optional(),
31300
32806
  info: record(string(), unknown()).optional(),
31301
32807
  settings: record(string(), unknown()).optional(),
32808
+ /** Keys of `settings` the form's schema declares secret (by type) — kept in
32809
+ * the keychain, not the table (D787). */
32810
+ secretKeys: array(string()).optional(),
31302
32811
  skipRestart: boolean().optional()
31303
32812
  });
31304
32813
  var UpdateIntegrationInputSchema = object({
@@ -31322,7 +32831,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
31322
32831
  auth: "admin"
31323
32832
  }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
31324
32833
  id: string(),
31325
- settings: record(string(), unknown())
32834
+ settings: record(string(), unknown()),
32835
+ /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
32836
+ secretKeys: array(string()).optional()
31326
32837
  }), object({ success: boolean() }), {
31327
32838
  kind: "mutation",
31328
32839
  auth: "admin"
@@ -40125,6 +41636,90 @@ Object.freeze({
40125
41636
  addonId: null,
40126
41637
  access: "create"
40127
41638
  },
41639
+ "keychain.delete": {
41640
+ capName: "keychain",
41641
+ capScope: "system",
41642
+ addonId: null,
41643
+ access: "delete"
41644
+ },
41645
+ "keychain.getState": {
41646
+ capName: "keychain",
41647
+ capScope: "system",
41648
+ addonId: null,
41649
+ access: "view"
41650
+ },
41651
+ "keychain.listMeta": {
41652
+ capName: "keychain",
41653
+ capScope: "system",
41654
+ addonId: null,
41655
+ access: "view"
41656
+ },
41657
+ "keychain.put": {
41658
+ capName: "keychain",
41659
+ capScope: "system",
41660
+ addonId: null,
41661
+ access: "create"
41662
+ },
41663
+ "keychain.resolve": {
41664
+ capName: "keychain",
41665
+ capScope: "system",
41666
+ addonId: null,
41667
+ access: "view"
41668
+ },
41669
+ "keychainAdmin.deleteOrphans": {
41670
+ capName: "keychain-admin",
41671
+ capScope: "system",
41672
+ addonId: null,
41673
+ access: "delete"
41674
+ },
41675
+ "keychainAdmin.downloadRecoveryKey": {
41676
+ capName: "keychain-admin",
41677
+ capScope: "system",
41678
+ addonId: null,
41679
+ access: "create"
41680
+ },
41681
+ "keychainAdmin.listAudit": {
41682
+ capName: "keychain-admin",
41683
+ capScope: "system",
41684
+ addonId: null,
41685
+ access: "view"
41686
+ },
41687
+ "keychainAdmin.listSecrets": {
41688
+ capName: "keychain-admin",
41689
+ capScope: "system",
41690
+ addonId: null,
41691
+ access: "view"
41692
+ },
41693
+ "keychainAdmin.purgeRetiredKeys": {
41694
+ capName: "keychain-admin",
41695
+ capScope: "system",
41696
+ addonId: null,
41697
+ access: "delete"
41698
+ },
41699
+ "keychainAdmin.resetKeychain": {
41700
+ capName: "keychain-admin",
41701
+ capScope: "system",
41702
+ addonId: null,
41703
+ access: "delete"
41704
+ },
41705
+ "keychainAdmin.reveal": {
41706
+ capName: "keychain-admin",
41707
+ capScope: "system",
41708
+ addonId: null,
41709
+ access: "create"
41710
+ },
41711
+ "keychainAdmin.rotateMasterKey": {
41712
+ capName: "keychain-admin",
41713
+ capScope: "system",
41714
+ addonId: null,
41715
+ access: "create"
41716
+ },
41717
+ "keychainAdmin.status": {
41718
+ capName: "keychain-admin",
41719
+ capScope: "system",
41720
+ addonId: null,
41721
+ access: "view"
41722
+ },
40128
41723
  "lawnMowerControl.dock": {
40129
41724
  capName: "lawn-mower-control",
40130
41725
  capScope: "device",
@@ -41499,6 +43094,18 @@ Object.freeze({
41499
43094
  addonId: null,
41500
43095
  access: "create"
41501
43096
  },
43097
+ "pipelineAnalytics.addRetrainFrameFromRecording": {
43098
+ capName: "pipeline-analytics",
43099
+ capScope: "device",
43100
+ addonId: null,
43101
+ access: "create"
43102
+ },
43103
+ "pipelineAnalytics.addRetrainFramesToCollection": {
43104
+ capName: "pipeline-analytics",
43105
+ capScope: "device",
43106
+ addonId: null,
43107
+ access: "create"
43108
+ },
41502
43109
  "pipelineAnalytics.applyDeviceSettingsPatch": {
41503
43110
  capName: "pipeline-analytics",
41504
43111
  capScope: "device",
@@ -41547,12 +43154,24 @@ Object.freeze({
41547
43154
  addonId: null,
41548
43155
  access: "view"
41549
43156
  },
43157
+ "pipelineAnalytics.createRetrainCollection": {
43158
+ capName: "pipeline-analytics",
43159
+ capScope: "device",
43160
+ addonId: null,
43161
+ access: "create"
43162
+ },
41550
43163
  "pipelineAnalytics.deleteDeviceEvents": {
41551
43164
  capName: "pipeline-analytics",
41552
43165
  capScope: "device",
41553
43166
  addonId: null,
41554
43167
  access: "delete"
41555
43168
  },
43169
+ "pipelineAnalytics.deleteRetrainCollection": {
43170
+ capName: "pipeline-analytics",
43171
+ capScope: "device",
43172
+ addonId: null,
43173
+ access: "delete"
43174
+ },
41556
43175
  "pipelineAnalytics.deleteTracks": {
41557
43176
  capName: "pipeline-analytics",
41558
43177
  capScope: "device",
@@ -41757,6 +43376,24 @@ Object.freeze({
41757
43376
  addonId: null,
41758
43377
  access: "view"
41759
43378
  },
43379
+ "pipelineAnalytics.listRetrainAssistProfiles": {
43380
+ capName: "pipeline-analytics",
43381
+ capScope: "device",
43382
+ addonId: null,
43383
+ access: "view"
43384
+ },
43385
+ "pipelineAnalytics.listRetrainCollectionFrames": {
43386
+ capName: "pipeline-analytics",
43387
+ capScope: "device",
43388
+ addonId: null,
43389
+ access: "view"
43390
+ },
43391
+ "pipelineAnalytics.listRetrainCollections": {
43392
+ capName: "pipeline-analytics",
43393
+ capScope: "device",
43394
+ addonId: null,
43395
+ access: "view"
43396
+ },
41760
43397
  "pipelineAnalytics.listRetrainFrames": {
41761
43398
  capName: "pipeline-analytics",
41762
43399
  capScope: "device",
@@ -41805,6 +43442,12 @@ Object.freeze({
41805
43442
  addonId: null,
41806
43443
  access: "create"
41807
43444
  },
43445
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
43446
+ capName: "pipeline-analytics",
43447
+ capScope: "device",
43448
+ addonId: null,
43449
+ access: "create"
43450
+ },
41808
43451
  "pipelineAnalytics.pruneEvents": {
41809
43452
  capName: "pipeline-analytics",
41810
43453
  capScope: "device",
@@ -41859,6 +43502,18 @@ Object.freeze({
41859
43502
  addonId: null,
41860
43503
  access: "create"
41861
43504
  },
43505
+ "pipelineAnalytics.removeRetrainFrameFromCollection": {
43506
+ capName: "pipeline-analytics",
43507
+ capScope: "device",
43508
+ addonId: null,
43509
+ access: "delete"
43510
+ },
43511
+ "pipelineAnalytics.renameRetrainCollection": {
43512
+ capName: "pipeline-analytics",
43513
+ capScope: "device",
43514
+ addonId: null,
43515
+ access: "create"
43516
+ },
41862
43517
  "pipelineAnalytics.restageRetrainTrack": {
41863
43518
  capName: "pipeline-analytics",
41864
43519
  capScope: "device",
@@ -42147,6 +43802,12 @@ Object.freeze({
42147
43802
  addonId: null,
42148
43803
  access: "view"
42149
43804
  },
43805
+ "pipelineOrchestrator.abortNodeBenchmark": {
43806
+ capName: "pipeline-orchestrator",
43807
+ capScope: "system",
43808
+ addonId: null,
43809
+ access: "create"
43810
+ },
42150
43811
  "pipelineOrchestrator.applyAutoTune": {
42151
43812
  capName: "pipeline-orchestrator",
42152
43813
  capScope: "system",
@@ -42171,6 +43832,12 @@ Object.freeze({
42171
43832
  addonId: null,
42172
43833
  access: "create"
42173
43834
  },
43835
+ "pipelineOrchestrator.deleteNodeBenchmarkResult": {
43836
+ capName: "pipeline-orchestrator",
43837
+ capScope: "system",
43838
+ addonId: null,
43839
+ access: "delete"
43840
+ },
42174
43841
  "pipelineOrchestrator.getAgentLoad": {
42175
43842
  capName: "pipeline-orchestrator",
42176
43843
  capScope: "system",
@@ -42279,6 +43946,24 @@ Object.freeze({
42279
43946
  addonId: null,
42280
43947
  access: "view"
42281
43948
  },
43949
+ "pipelineOrchestrator.getNodeBenchmarkCandidates": {
43950
+ capName: "pipeline-orchestrator",
43951
+ capScope: "system",
43952
+ addonId: null,
43953
+ access: "view"
43954
+ },
43955
+ "pipelineOrchestrator.getNodeBenchmarkPreflight": {
43956
+ capName: "pipeline-orchestrator",
43957
+ capScope: "system",
43958
+ addonId: null,
43959
+ access: "view"
43960
+ },
43961
+ "pipelineOrchestrator.getNodeBenchmarkStatus": {
43962
+ capName: "pipeline-orchestrator",
43963
+ capScope: "system",
43964
+ addonId: null,
43965
+ access: "view"
43966
+ },
42282
43967
  "pipelineOrchestrator.getNodeInferenceDevices": {
42283
43968
  capName: "pipeline-orchestrator",
42284
43969
  capScope: "system",
@@ -42321,6 +44006,12 @@ Object.freeze({
42321
44006
  addonId: null,
42322
44007
  access: "view"
42323
44008
  },
44009
+ "pipelineOrchestrator.listNodeBenchmarkResults": {
44010
+ capName: "pipeline-orchestrator",
44011
+ capScope: "system",
44012
+ addonId: null,
44013
+ access: "view"
44014
+ },
42324
44015
  "pipelineOrchestrator.pauseForStorageMigration": {
42325
44016
  capName: "pipeline-orchestrator",
42326
44017
  capScope: "system",
@@ -42465,6 +44156,12 @@ Object.freeze({
42465
44156
  addonId: null,
42466
44157
  access: "create"
42467
44158
  },
44159
+ "pipelineOrchestrator.startNodeBenchmark": {
44160
+ capName: "pipeline-orchestrator",
44161
+ capScope: "system",
44162
+ addonId: null,
44163
+ access: "create"
44164
+ },
42468
44165
  "pipelineOrchestrator.suggestShares": {
42469
44166
  capName: "pipeline-orchestrator",
42470
44167
  capScope: "system",
@@ -42483,6 +44180,12 @@ Object.freeze({
42483
44180
  addonId: null,
42484
44181
  access: "create"
42485
44182
  },
44183
+ "pipelineRunner.abortNodeBench": {
44184
+ capName: "pipeline-runner",
44185
+ capScope: "system",
44186
+ addonId: null,
44187
+ access: "create"
44188
+ },
42486
44189
  "pipelineRunner.attachCamera": {
42487
44190
  capName: "pipeline-runner",
42488
44191
  capScope: "system",
@@ -42531,6 +44234,12 @@ Object.freeze({
42531
44234
  addonId: null,
42532
44235
  access: "view"
42533
44236
  },
44237
+ "pipelineRunner.getNodeBenchStatus": {
44238
+ capName: "pipeline-runner",
44239
+ capScope: "system",
44240
+ addonId: null,
44241
+ access: "view"
44242
+ },
42534
44243
  "pipelineRunner.getParkedTrackFrame": {
42535
44244
  capName: "pipeline-runner",
42536
44245
  capScope: "system",
@@ -42573,6 +44282,12 @@ Object.freeze({
42573
44282
  addonId: null,
42574
44283
  access: "create"
42575
44284
  },
44285
+ "pipelineRunner.startNodeBench": {
44286
+ capName: "pipeline-runner",
44287
+ capScope: "system",
44288
+ addonId: null,
44289
+ access: "create"
44290
+ },
42576
44291
  "plateGallery.assignPlate": {
42577
44292
  capName: "plate-gallery",
42578
44293
  capScope: "system",
@@ -47502,6 +49217,11 @@ Object.freeze({
47502
49217
  form: "single",
47503
49218
  optional: false
47504
49219
  }],
49220
+ "pipelineAnalytics.addRetrainFrameFromRecording": [{
49221
+ name: "deviceId",
49222
+ form: "single",
49223
+ optional: false
49224
+ }],
47505
49225
  "pipelineAnalytics.applyDeviceSettingsPatch": [{
47506
49226
  name: "deviceId",
47507
49227
  form: "single",
@@ -47692,6 +49412,11 @@ Object.freeze({
47692
49412
  form: "single",
47693
49413
  optional: false
47694
49414
  }],
49415
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
49416
+ name: "deviceId",
49417
+ form: "single",
49418
+ optional: false
49419
+ }],
47695
49420
  "pipelineAnalytics.pruneEventsBefore": [{
47696
49421
  name: "deviceId",
47697
49422
  form: "single",