@camstack/addon-provider-amcrest 0.2.133 → 0.2.135

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +2068 -145
  2. package/dist/addon.mjs +2068 -145
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -5412,7 +5412,7 @@ var ZodIssueCode = {
5412
5412
  var ZodFirstPartyTypeKind;
5413
5413
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5414
5414
  //#endregion
5415
- //#region ../types/dist/sleep-Cr5YOk3m.mjs
5415
+ //#region ../types/dist/sleep-DwAQ9sqX.mjs
5416
5416
  /**
5417
5417
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5418
5418
  * window to float samples (D455).
@@ -5529,7 +5529,7 @@ function isKeychainStoredField(field) {
5529
5529
  var SECRET_CLEAR = { $secretClear: true };
5530
5530
  /** The `'***'` token D634 redaction writes for non-admins. */
5531
5531
  var LEGACY_DEVICE_REDACTION = "***";
5532
- function isRecord$1$1(value) {
5532
+ function isRecord$2(value) {
5533
5533
  return typeof value === "object" && value !== null && !Array.isArray(value);
5534
5534
  }
5535
5535
  function makeSecretMarker(ref) {
@@ -5540,12 +5540,12 @@ function makeSecretMarker(ref) {
5540
5540
  }
5541
5541
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5542
5542
  function isSecretMarker(value) {
5543
- if (!isRecord$1$1(value)) return false;
5543
+ if (!isRecord$2(value)) return false;
5544
5544
  const ref = value["$secret"];
5545
5545
  return typeof ref === "string" && ref.length > 0;
5546
5546
  }
5547
5547
  function isSecretClear(value) {
5548
- return isRecord$1$1(value) && value["$secretClear"] === true;
5548
+ return isRecord$2(value) && value["$secretClear"] === true;
5549
5549
  }
5550
5550
  /**
5551
5551
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6061,6 +6061,13 @@ function globalSecretScope() {
6061
6061
  function encodeSegment(value) {
6062
6062
  return encodeURIComponent(value);
6063
6063
  }
6064
+ function decodeSegment(value) {
6065
+ try {
6066
+ return decodeURIComponent(value);
6067
+ } catch {
6068
+ return null;
6069
+ }
6070
+ }
6064
6071
  /**
6065
6072
  * The field path of a value inside an array item, addressed by the item's id:
6066
6073
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6069,6 +6076,75 @@ function encodeSegment(value) {
6069
6076
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6070
6077
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6071
6078
  }
6079
+ function parseScope(segments) {
6080
+ switch (segments[0]) {
6081
+ case "global": return {
6082
+ scope: GLOBAL_SCOPE,
6083
+ used: 1
6084
+ };
6085
+ case "node": {
6086
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6087
+ return nodeId === null || nodeId.length === 0 ? null : {
6088
+ scope: {
6089
+ kind: "node",
6090
+ nodeId
6091
+ },
6092
+ used: 2
6093
+ };
6094
+ }
6095
+ case "device": {
6096
+ const raw = segments[1];
6097
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6098
+ return {
6099
+ scope: {
6100
+ kind: "device",
6101
+ deviceId: Number(raw)
6102
+ },
6103
+ used: 2
6104
+ };
6105
+ }
6106
+ case "integration": {
6107
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6108
+ return id === null || id.length === 0 ? null : {
6109
+ scope: {
6110
+ kind: "integration",
6111
+ integrationId: id
6112
+ },
6113
+ used: 2
6114
+ };
6115
+ }
6116
+ case "row": {
6117
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6118
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6119
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6120
+ return {
6121
+ scope: {
6122
+ kind: "row",
6123
+ collection,
6124
+ rowId
6125
+ },
6126
+ used: 3
6127
+ };
6128
+ }
6129
+ default: return null;
6130
+ }
6131
+ }
6132
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6133
+ function parseSecretRef(ref) {
6134
+ if (!ref.startsWith("secret://")) return null;
6135
+ const segments = ref.slice(9).split("/");
6136
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6137
+ if (owner === null || owner.length === 0) return null;
6138
+ const parsed = parseScope(segments.slice(1));
6139
+ if (parsed === null) return null;
6140
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6141
+ if (fieldPath.length === 0) return null;
6142
+ return {
6143
+ owner,
6144
+ scope: parsed.scope,
6145
+ fieldPath
6146
+ };
6147
+ }
6072
6148
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6073
6149
  var KeychainWriteRefusedError = class extends Error {
6074
6150
  fieldPath;
@@ -6079,7 +6155,7 @@ var KeychainWriteRefusedError = class extends Error {
6079
6155
  }
6080
6156
  };
6081
6157
  var KEEP = { kind: "keep" };
6082
- function isRecord$2(value) {
6158
+ function isRecord$1$1(value) {
6083
6159
  return typeof value === "object" && value !== null && !Array.isArray(value);
6084
6160
  }
6085
6161
  function defaultMintId() {
@@ -6092,7 +6168,7 @@ function collectSecretMarkerRefs(value, out = []) {
6092
6168
  return out;
6093
6169
  }
6094
6170
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6095
- else if (isRecord$2(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6171
+ else if (isRecord$1$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6096
6172
  return out;
6097
6173
  }
6098
6174
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6147,7 +6223,7 @@ function rowId(row, idKey) {
6147
6223
  return null;
6148
6224
  }
6149
6225
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6150
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$2) : [];
6226
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1$1) : [];
6151
6227
  if (!Array.isArray(incoming)) {
6152
6228
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6153
6229
  return {
@@ -6163,7 +6239,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6163
6239
  const kept = /* @__PURE__ */ new Set();
6164
6240
  const rows = [];
6165
6241
  for (const row of incoming) {
6166
- if (!isRecord$2(row)) {
6242
+ if (!isRecord$1$1(row)) {
6167
6243
  rows.push(row);
6168
6244
  continue;
6169
6245
  }
@@ -6188,7 +6264,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6188
6264
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6189
6265
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6190
6266
  case "object": {
6191
- if (!isRecord$2(incoming)) {
6267
+ if (!isRecord$1$1(incoming)) {
6192
6268
  if (incoming === void 0) return KEEP;
6193
6269
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6194
6270
  return {
@@ -6196,7 +6272,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6196
6272
  value: incoming
6197
6273
  };
6198
6274
  }
6199
- const storedObj = isRecord$2(stored) ? stored : {};
6275
+ const storedObj = isRecord$1$1(stored) ? stored : {};
6200
6276
  return {
6201
6277
  kind: "value",
6202
6278
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6255,12 +6331,19 @@ async function transformSecretWrite(input) {
6255
6331
  }
6256
6332
  };
6257
6333
  }
6334
+ /** Is `ref` one of `owner`'s refs? */
6335
+ function isSecretRefOwnedBy(ref, owner) {
6336
+ return parseSecretRef(ref)?.owner === owner;
6337
+ }
6258
6338
  /**
6259
6339
  * Replace every marker in `value` with its keychain value. Returns the SAME
6260
6340
  * reference when there is no marker (no allocation, no keychain call).
6261
6341
  */
6262
- async function resolveSecretMarkers(value, secrets) {
6263
- const refs = collectSecretMarkerRefs(value);
6342
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6343
+ const keepMarker = options.unresolved === "keep-marker";
6344
+ const owner = options.ownedBy;
6345
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6346
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6264
6347
  if (refs.length === 0) return {
6265
6348
  value,
6266
6349
  unresolved: []
@@ -6284,10 +6367,18 @@ async function resolveSecretMarkers(value, secrets) {
6284
6367
  }
6285
6368
  const substitute = (v) => {
6286
6369
  if (isSecretMarker(v)) {
6370
+ if (!inScope(v.$secret)) return {
6371
+ keep: true,
6372
+ value: v
6373
+ };
6287
6374
  const answer = answers[v.$secret];
6288
- return answer?.kind === "value" ? {
6375
+ if (answer?.kind === "value") return {
6289
6376
  keep: true,
6290
6377
  value: answer.value
6378
+ };
6379
+ return keepMarker ? {
6380
+ keep: true,
6381
+ value: v
6291
6382
  } : {
6292
6383
  keep: false,
6293
6384
  value: void 0
@@ -6304,7 +6395,7 @@ async function resolveSecretMarkers(value, secrets) {
6304
6395
  value: items
6305
6396
  };
6306
6397
  }
6307
- if (isRecord$2(v)) {
6398
+ if (isRecord$1$1(v)) {
6308
6399
  const out = {};
6309
6400
  for (const [k, child] of Object.entries(v)) {
6310
6401
  const s = substitute(child);
@@ -6325,14 +6416,152 @@ async function resolveSecretMarkers(value, secrets) {
6325
6416
  unresolved
6326
6417
  };
6327
6418
  }
6328
- function touchesTree(tree, patch) {
6329
- if (tree.size === 0) return false;
6330
- for (const key of Object.keys(patch)) {
6331
- const at = key.indexOf("@");
6332
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6419
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6420
+ var SecretOverwriteRefusedError = class extends Error {
6421
+ ref;
6422
+ reason;
6423
+ constructor(ref, reason) {
6424
+ super(`secret ${ref} was not replaced: its stored value cannot be read right now (${reason}), and an addon may not overwrite a secret it cannot see. Nothing was written.`);
6425
+ this.ref = ref;
6426
+ this.reason = reason;
6427
+ this.name = "SecretOverwriteRefusedError";
6428
+ }
6429
+ };
6430
+ function isRecord$3(value) {
6431
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6432
+ }
6433
+ function resolvedValue(pass, marker) {
6434
+ const answer = pass.answers[marker.$secret];
6435
+ return answer?.kind === "value" ? answer.value : null;
6436
+ }
6437
+ async function atMarker(pass, incoming, stored) {
6438
+ if (incoming === null) return stored;
6439
+ if (typeof incoming !== "string") return incoming;
6440
+ if (incoming === resolvedValue(pass, stored)) return stored;
6441
+ const intent = classifySecretWrite(incoming);
6442
+ if (intent.kind !== "set") return stored;
6443
+ const ref = stored.$secret;
6444
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6445
+ const answer = pass.answers[ref];
6446
+ if ((answer === void 0 || answer.kind === "unavailable" || answer.kind === "forbidden") && !pass.operatorWrite) throw new SecretOverwriteRefusedError(ref, answer === void 0 ? "not-initialized" : answer.kind === "unavailable" ? answer.reason : answer.kind);
6447
+ try {
6448
+ await pass.secrets.put(ref, intent.value);
6449
+ } catch (err) {
6450
+ throw new KeychainWriteRefusedError(ref, err);
6451
+ }
6452
+ pass.changedRefs.push(ref);
6453
+ return stored;
6454
+ }
6455
+ function inArray(pass, incoming, stored) {
6456
+ return incoming.map((item, index) => {
6457
+ const twin = stored[index];
6458
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6459
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6460
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6461
+ return item;
6462
+ });
6463
+ }
6464
+ function inArrayRow(pass, incoming, stored) {
6465
+ const out = { ...incoming };
6466
+ for (const [key, value] of Object.entries(incoming)) {
6467
+ const twin = stored[key];
6468
+ if (isSecretMarker(twin)) {
6469
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6470
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6471
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6472
+ }
6473
+ return out;
6474
+ }
6475
+ async function walk(pass, incoming, stored) {
6476
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6477
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6478
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6479
+ const out = { ...incoming };
6480
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6481
+ return out;
6482
+ }
6483
+ /** Restore markers a write-back carries as values. See the file doc. */
6484
+ async function restoreUnchangedSecrets(input) {
6485
+ const refs = [];
6486
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6487
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6488
+ if (owned.length === 0) return {
6489
+ patch: input.patch,
6490
+ changedRefs: []
6491
+ };
6492
+ const pass = {
6493
+ secrets: input.secrets,
6494
+ answers: await input.secrets.resolve([...new Set(owned)]),
6495
+ operatorWrite: input.operatorWrite,
6496
+ changedRefs: []
6497
+ };
6498
+ const out = {};
6499
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6500
+ return {
6501
+ patch: out,
6502
+ changedRefs: pass.changedRefs
6503
+ };
6504
+ }
6505
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6506
+ function isJsonEqual(a, b) {
6507
+ if (Object.is(a, b)) return true;
6508
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6509
+ if (isRecord$3(a) && isRecord$3(b)) {
6510
+ const keys = Object.keys(a);
6511
+ if (keys.length !== Object.keys(b).length) return false;
6512
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6333
6513
  }
6334
6514
  return false;
6335
6515
  }
6516
+ /** The patch without the keys whose value already equals the stored one. */
6517
+ function dropUnchangedKeys(patch, stored) {
6518
+ const out = {};
6519
+ for (const [key, value] of Object.entries(patch)) {
6520
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6521
+ out[key] = value;
6522
+ }
6523
+ return out;
6524
+ }
6525
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6526
+ function markerKeysOf(blob, owner) {
6527
+ const keys = /* @__PURE__ */ new Set();
6528
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6529
+ return keys;
6530
+ }
6531
+ function nodeFromStored(value, owner) {
6532
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6533
+ if (!isRecord$3(value)) return null;
6534
+ const children = /* @__PURE__ */ new Map();
6535
+ for (const [key, child] of Object.entries(value)) {
6536
+ const node = nodeFromStored(child, owner);
6537
+ if (node !== null) children.set(key, node);
6538
+ }
6539
+ return children.size > 0 ? {
6540
+ kind: "object",
6541
+ children
6542
+ } : null;
6543
+ }
6544
+ /**
6545
+ * The declared secret tree, widened by every place the STORED blob holds a
6546
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6547
+ * never declared: Wyze before b4906cec6) still gets the save path's
6548
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6549
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6550
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6551
+ * builtin that keeps another addon's marker (device-manager) never takes it
6552
+ * over.
6553
+ */
6554
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6555
+ const added = /* @__PURE__ */ new Map();
6556
+ for (const key of keys) {
6557
+ const at = key.indexOf("@");
6558
+ const base = at > 0 ? key.slice(0, at) : key;
6559
+ if (declared.has(base) || added.has(base)) continue;
6560
+ const node = nodeFromStored(stored[key], owner);
6561
+ if (node !== null) added.set(base, node);
6562
+ }
6563
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6564
+ }
6336
6565
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6337
6566
  async function readStoredAddonBlob(raw) {
6338
6567
  const threeWay = raw.readAddonStoreResult;
@@ -6341,7 +6570,41 @@ async function readStoredAddonBlob(raw) {
6341
6570
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6342
6571
  return result.kind === "missing" ? {} : result.value;
6343
6572
  }
6344
- function createSecretAwareSettings(raw, opts) {
6573
+ function touchesTree(tree, patch) {
6574
+ if (tree.size === 0) return false;
6575
+ for (const key of Object.keys(patch)) {
6576
+ const at = key.indexOf("@");
6577
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6578
+ }
6579
+ return false;
6580
+ }
6581
+ /**
6582
+ * Which top-level keys of each store held markers when last seen. `undefined`
6583
+ * for a store not seen yet: its first write reads it, to be safe.
6584
+ */
6585
+ var MarkerKeyIndex = class {
6586
+ owner;
6587
+ byStore = /* @__PURE__ */ new Map();
6588
+ constructor(owner) {
6589
+ this.owner = owner;
6590
+ }
6591
+ seen(store, blob) {
6592
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6593
+ }
6594
+ wrote(store, patch) {
6595
+ const keys = this.byStore.get(store);
6596
+ if (keys === void 0) return;
6597
+ const now = markerKeysOf(patch, this.owner);
6598
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6599
+ else keys.delete(key);
6600
+ }
6601
+ mayHoldMarkers(store, patch) {
6602
+ const keys = this.byStore.get(store);
6603
+ if (keys === void 0) return true;
6604
+ return Object.keys(patch).some((key) => keys.has(key));
6605
+ }
6606
+ };
6607
+ function createHandle(raw, opts) {
6345
6608
  const chains = /* @__PURE__ */ new Map();
6346
6609
  const serialize = (key, fn) => {
6347
6610
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6352,46 +6615,130 @@ function createSecretAwareSettings(raw, opts) {
6352
6615
  });
6353
6616
  return next;
6354
6617
  };
6355
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6356
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6357
- return serialize(chainKey, async () => {
6618
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6619
+ const resolveRead = async (store, blob) => {
6620
+ index.seen(store, blob);
6621
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6622
+ unresolved: "keep-marker",
6623
+ ownedBy: opts.secrets.owner
6624
+ });
6625
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6626
+ return value;
6627
+ };
6628
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6629
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6630
+ await rawWrite(patch);
6631
+ index.wrote(store, patch);
6632
+ return { changed: true };
6633
+ }
6634
+ return serialize(store, async () => {
6358
6635
  const stored = await readStored();
6636
+ index.seen(store, stored);
6637
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6638
+ const restored = await restoreUnchangedSecrets({
6639
+ patch,
6640
+ stored,
6641
+ secrets: opts.secrets,
6642
+ operatorWrite
6643
+ });
6359
6644
  const result = await transformSecretWrite({
6360
- tree,
6645
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6361
6646
  secrets: opts.secrets,
6362
- patch,
6647
+ patch: restored.patch,
6363
6648
  stored,
6364
6649
  ...scope !== void 0 ? { scope } : {},
6365
- operatorWrite: opts.isOperatorWrite?.() === true
6650
+ operatorWrite
6366
6651
  });
6367
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6652
+ const effective = dropUnchangedKeys(result.patch, stored);
6653
+ const wroteBlob = Object.keys(effective).length > 0;
6654
+ if (wroteBlob) {
6655
+ await rawWrite(effective);
6656
+ index.wrote(store, effective);
6657
+ }
6368
6658
  const { orphaned } = await result.afterWrite();
6369
6659
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6660
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6370
6661
  });
6371
6662
  };
6372
- const wrapped = {
6373
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6374
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6375
- kind: "device",
6376
- deviceId
6377
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6663
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6664
+ const readAddonStoreResult = raw.readAddonStoreResult;
6665
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6666
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6667
+ const overrides = {
6668
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6669
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6670
+ const result = await readAddonStoreResult.call(raw);
6671
+ return result.kind === "value" ? {
6672
+ kind: "value",
6673
+ value: await resolveRead("addon", result.value)
6674
+ } : result;
6675
+ } } : {},
6676
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6677
+ const result = await readAddonStoreKeyResult.call(raw, key);
6678
+ if (result.kind !== "present") return result;
6679
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6680
+ unresolved: "keep-marker",
6681
+ ownedBy: opts.secrets.owner
6682
+ });
6683
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6684
+ return {
6685
+ kind: "present",
6686
+ value: value[key]
6687
+ };
6688
+ } } : {},
6689
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6690
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6691
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6692
+ const out = /* @__PURE__ */ new Map();
6693
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6694
+ return out;
6695
+ } } : {},
6696
+ writeAddonStore: async (patch) => {
6697
+ await writeAddon(patch);
6698
+ },
6699
+ writeDeviceStore: async (deviceId, patch) => {
6700
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6701
+ kind: "device",
6702
+ deviceId
6703
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6704
+ }
6705
+ };
6706
+ return {
6707
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6708
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6709
+ const value = Reflect.get(target, prop, receiver);
6710
+ return typeof value === "function" ? value.bind(target) : value;
6711
+ } }),
6712
+ raw: {
6713
+ readAddonStore: async () => {
6714
+ const blob = await raw.readAddonStore();
6715
+ index.seen("addon", blob);
6716
+ return blob;
6717
+ },
6718
+ readDeviceStore: async (deviceId) => {
6719
+ const blob = await raw.readDeviceStore(deviceId);
6720
+ index.seen(`device:${deviceId}`, blob);
6721
+ return blob;
6722
+ }
6723
+ },
6724
+ writeAddonStore: writeAddon
6378
6725
  };
6379
- return new Proxy(raw, { get(target, prop, receiver) {
6380
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6381
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6382
- const value = Reflect.get(target, prop, receiver);
6383
- return typeof value === "function" ? value.bind(target) : value;
6384
- } });
6385
6726
  }
6386
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6387
- function withSecretAwareSettings(context, opts) {
6727
+ /** The context the addon sees, plus the private raw view and write outcome. */
6728
+ function createSecretAwareContext(context, opts) {
6388
6729
  const raw = context.settings;
6389
- if (raw === void 0) return context;
6390
- const settings = createSecretAwareSettings(raw, opts);
6391
- return new Proxy(context, { get(target, prop, receiver) {
6392
- if (prop === "settings") return settings;
6393
- return Reflect.get(target, prop, receiver);
6394
- } });
6730
+ if (raw === void 0) return {
6731
+ context,
6732
+ handle: null
6733
+ };
6734
+ const handle = createHandle(raw, opts);
6735
+ return {
6736
+ context: new Proxy(context, { get(target, prop, receiver) {
6737
+ if (prop === "settings") return handle.settings;
6738
+ return Reflect.get(target, prop, receiver);
6739
+ } }),
6740
+ handle
6741
+ };
6395
6742
  }
6396
6743
  var LEAF = { kind: "leaf" };
6397
6744
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6566,6 +6913,14 @@ var BaseAddon = class {
6566
6913
  _secretChangeUnsub = null;
6567
6914
  /** >0 while an OPERATOR's settings write is being applied. */
6568
6915
  _operatorWriteDepth = 0;
6916
+ /**
6917
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6918
+ * to the marker-bearing blobs and stays private to this class: the form
6919
+ * hydrate and config resolution need markers, addon code never does.
6920
+ */
6921
+ _secretSettings = null;
6922
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6923
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6569
6924
  constructor(defaults) {
6570
6925
  this.defaults = defaults;
6571
6926
  this._config = { ...defaults };
@@ -6602,13 +6957,21 @@ var BaseAddon = class {
6602
6957
  }
6603
6958
  async initialize(context) {
6604
6959
  const secrets = context.secrets;
6605
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6606
- secrets,
6607
- addonTree: () => this.addonSecretTree(),
6608
- deviceTree: () => this.deviceSecretTree(),
6609
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6610
- isOperatorWrite: () => this._operatorWriteDepth > 0
6611
- }) : context;
6960
+ if (secrets !== void 0) {
6961
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6962
+ secrets,
6963
+ addonTree: () => this.addonSecretTree(),
6964
+ deviceTree: () => this.deviceSecretTree(),
6965
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6966
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6967
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6968
+ });
6969
+ this._ctx = wrapped;
6970
+ this._secretSettings = handle;
6971
+ } else {
6972
+ this._ctx = context;
6973
+ this._secretSettings = null;
6974
+ }
6612
6975
  await this.resolveConfig();
6613
6976
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6614
6977
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6725,11 +7088,8 @@ var BaseAddon = class {
6725
7088
  async getGlobalSettings(overlay, cap, nodeId) {
6726
7089
  const schema = this.globalSettingsSchema(cap);
6727
7090
  if (!schema) return { sections: [] };
6728
- const projected = await this.resolveGlobalStore(nodeId, cap);
6729
- return hydrateSchema(schema, overlay ? {
6730
- ...projected,
6731
- ...overlay
6732
- } : projected, { inlineSecretsAsViews: true });
7091
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7092
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6733
7093
  }
6734
7094
  /**
6735
7095
  * The integration-level view of this addon's settings: exactly the sections
@@ -6774,7 +7134,7 @@ var BaseAddon = class {
6774
7134
  });
6775
7135
  }
6776
7136
  if (sections.length === 0) return null;
6777
- const projected = await this.resolveGlobalStore(nodeId);
7137
+ const projected = await this.readRawProjectedStore(nodeId);
6778
7138
  return hydrateSchema({
6779
7139
  ...schema,
6780
7140
  sections
@@ -6791,12 +7151,50 @@ var BaseAddon = class {
6791
7151
  * the store for custom option logic (option narrowing, value snapping) to
6792
7152
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6793
7153
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7154
+ *
7155
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7156
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7157
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7158
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7159
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7160
+ * resolved blob back is a no-op for every unchanged secret.
6794
7161
  */
6795
7162
  async resolveGlobalStore(nodeId, cap) {
6796
7163
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7164
+ return this.projectForNode(raw, nodeId, cap);
7165
+ }
7166
+ projectForNode(store, nodeId, cap) {
6797
7167
  const keys = this.perNodeKeys(cap);
6798
7168
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6799
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7169
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7170
+ }
7171
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7172
+ async readRawProjectedStore(nodeId, cap) {
7173
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7174
+ return this.projectForNode(raw, nodeId, cap);
7175
+ }
7176
+ /**
7177
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7178
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7179
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7180
+ * its value.
7181
+ */
7182
+ async overlayKeepingMarkers(stored, overlay) {
7183
+ const secrets = this._ctx?.secrets;
7184
+ const merged = {
7185
+ ...stored,
7186
+ ...overlay
7187
+ };
7188
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7189
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7190
+ unresolved: "keep-marker",
7191
+ ownedBy: secrets.owner
7192
+ });
7193
+ for (const key of Object.keys(overlay)) {
7194
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7195
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7196
+ }
7197
+ return merged;
6800
7198
  }
6801
7199
  /**
6802
7200
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6861,8 +7259,12 @@ var BaseAddon = class {
6861
7259
  async clearSecrets(keys, nodeId) {
6862
7260
  const tree = this.addonSecretTree();
6863
7261
  const keychain = this._ctx?.secrets !== void 0;
7262
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6864
7263
  const patch = {};
6865
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7264
+ for (const key of keys) {
7265
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7266
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7267
+ }
6866
7268
  await this.applyGlobalPatch(patch, nodeId);
6867
7269
  }
6868
7270
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6870,7 +7272,11 @@ var BaseAddon = class {
6870
7272
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6871
7273
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6872
7274
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6873
- await this._ctx?.settings?.writeAddonStore(scoped);
7275
+ const handle = this._secretSettings;
7276
+ if (handle !== null) {
7277
+ const { changed } = await handle.writeAddonStore(scoped);
7278
+ if (!changed) return;
7279
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6874
7280
  if (target !== localNode) return;
6875
7281
  await this.resolveConfig();
6876
7282
  await this.onConfigChanged();
@@ -6923,7 +7329,7 @@ var BaseAddon = class {
6923
7329
  async getDeviceSettings(deviceId) {
6924
7330
  const schema = this.deviceSettingsSchema();
6925
7331
  if (!schema) return { sections: [] };
6926
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7332
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6927
7333
  }
6928
7334
  async updateDeviceSettings(deviceId, patch) {
6929
7335
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7095,7 +7501,7 @@ var BaseAddon = class {
7095
7501
  key,
7096
7502
  schema,
7097
7503
  fallback,
7098
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7504
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7099
7505
  write: async (patch) => {
7100
7506
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7101
7507
  },
@@ -7157,6 +7563,23 @@ var BaseAddon = class {
7157
7563
  }
7158
7564
  return value;
7159
7565
  }
7566
+ /**
7567
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7568
+ * keychain the context's own view is already raw.
7569
+ */
7570
+ rawSettings() {
7571
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7572
+ }
7573
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7574
+ logUnresolvedRead(unresolved) {
7575
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7576
+ if (fresh.length === 0) return;
7577
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7578
+ this._ctx?.logger?.warn?.("settings read: a stored secret is unavailable — it reads as its marker, not as a value", { meta: { secrets: fresh.map((u) => ({
7579
+ ref: u.ref,
7580
+ reason: u.reason
7581
+ })) } });
7582
+ }
7160
7583
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7161
7584
  scheduleSecretReresolve(delayMs) {
7162
7585
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7183,7 +7606,7 @@ var BaseAddon = class {
7183
7606
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7184
7607
  */
7185
7608
  async readAddonStoreWithRetry() {
7186
- const settings = this._ctx?.settings;
7609
+ const settings = this.rawSettings();
7187
7610
  if (!settings) return {};
7188
7611
  const delaysMs = [
7189
7612
  150,
@@ -8985,6 +9408,16 @@ var CompositionSchema = object({
8985
9408
  seen.add(feature.cap);
8986
9409
  });
8987
9410
  });
9411
+ var NodeColorIdSchema = _enum([
9412
+ "node-a",
9413
+ "node-b",
9414
+ "node-c",
9415
+ "node-d",
9416
+ "node-e",
9417
+ "node-f",
9418
+ "node-g",
9419
+ "node-h"
9420
+ ]);
8988
9421
  new Set([
8989
9422
  "track",
8990
9423
  "face",
@@ -9496,6 +9929,278 @@ var CameraSwitchGroupSchema = object({
9496
9929
  fetchedAt: number()
9497
9930
  });
9498
9931
  /**
9932
+ * The trainer contract — what the hub hands the cloud trainer and what it
9933
+ * gets back (cloud training, D805+).
9934
+ *
9935
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
9936
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
9937
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
9938
+ * lines on stdout. These schemas are the hub's half of that boundary; the
9939
+ * trainer's pydantic models (and the JSON Schemas generated from them under
9940
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
9941
+ * change there, in the same piece of work.
9942
+ *
9943
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
9944
+ * orchestrator fills every field of a job spec explicitly.
9945
+ */
9946
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
9947
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
9948
+ /** What the trainer can export. Edge TPU is a later, separate image. */
9949
+ var TrainingExportSchema = _enum([
9950
+ "onnx",
9951
+ "openvino-fp16",
9952
+ "openvino-int8",
9953
+ "coreml-fp16"
9954
+ ]);
9955
+ var FloorsSchema = record(string(), number().min(0).max(1));
9956
+ object({
9957
+ schema: literal(TRAINING_JOB_SCHEMA),
9958
+ jobKey: string().uuid(),
9959
+ target: object({
9960
+ kind: literal("detector"),
9961
+ step: literal("object-detection")
9962
+ }),
9963
+ base: object({
9964
+ modelId: string().min(1),
9965
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
9966
+ weights: string().min(1),
9967
+ imgsz: number().int().positive()
9968
+ }),
9969
+ baseline: object({
9970
+ modelId: string().min(1),
9971
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
9972
+ onnxUrl: string().url(),
9973
+ imgsz: number().int().positive(),
9974
+ floors: FloorsSchema
9975
+ }),
9976
+ dataset: object({
9977
+ versionId: string().min(1),
9978
+ annotationHash: string(),
9979
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
9980
+ sha256: string().regex(/^[0-9a-f]{64}$/)
9981
+ }),
9982
+ split: object({
9983
+ holdoutCameras: array(number().int()),
9984
+ /** When no camera is held out: the last N days of every camera. */
9985
+ holdoutLastDays: number().int().nonnegative(),
9986
+ valFraction: number().min(0).max(.5),
9987
+ seed: number().int()
9988
+ }),
9989
+ hyper: object({
9990
+ epochs: number().int().positive(),
9991
+ batch: number().int().positive(),
9992
+ lr0: number().positive(),
9993
+ /** Layers frozen from the start of the backbone; 0 = none. */
9994
+ freeze: number().int().nonnegative(),
9995
+ patience: number().int().nonnegative(),
9996
+ seed: number().int()
9997
+ }),
9998
+ replay: object({
9999
+ source: literal("coco2017"),
10000
+ count: number().int().nonnegative()
10001
+ }),
10002
+ exports: array(TrainingExportSchema).min(1),
10003
+ calibration: object({ maxFrames: number().int().positive() }),
10004
+ floors: object({
10005
+ minSupport: number().int().positive(),
10006
+ clamp: number().min(0).max(1)
10007
+ }),
10008
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
10009
+ catalog: object({
10010
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
10011
+ name: string().min(1).max(160)
10012
+ })
10013
+ });
10014
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
10015
+ var TrainingResultFileSchema = object({
10016
+ path: string().min(1),
10017
+ bytes: number().int().nonnegative(),
10018
+ sha256: string().regex(/^[0-9a-f]{64}$/),
10019
+ format: _enum([
10020
+ "onnx",
10021
+ "openvino",
10022
+ "coreml",
10023
+ "pt"
10024
+ ]),
10025
+ variant: _enum(["base", "int8"])
10026
+ });
10027
+ var DraftFormatSchema = object({
10028
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
10029
+ url: string().min(1),
10030
+ sizeMB: number().nonnegative(),
10031
+ isDirectory: boolean().optional(),
10032
+ files: array(string()).optional(),
10033
+ runtimes: array(literal("python")).optional(),
10034
+ revision: string().min(1)
10035
+ });
10036
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
10037
+ var TrainingCatalogDraftSchema = object({
10038
+ id: string().min(1),
10039
+ name: string().min(1),
10040
+ description: string(),
10041
+ labels: array(unknown()),
10042
+ inputSize: object({
10043
+ width: number().int().positive(),
10044
+ height: number().int().positive()
10045
+ }),
10046
+ preprocessMode: literal("letterbox"),
10047
+ defaultClassFloors: FloorsSchema,
10048
+ formats: object({
10049
+ onnx: DraftFormatSchema.optional(),
10050
+ openvino: DraftFormatSchema.optional(),
10051
+ coreml: DraftFormatSchema.optional()
10052
+ })
10053
+ });
10054
+ /** One class of one model's holdout report (the eval harness's summary). */
10055
+ var TrainingEvalClassSchema = object({
10056
+ positives: number().int(),
10057
+ floor: number().nullable(),
10058
+ tp: number().int(),
10059
+ fp: number().int(),
10060
+ fn: number().int(),
10061
+ precision: number().nullable(),
10062
+ recall: number().nullable(),
10063
+ ap50: number().nullable(),
10064
+ recallByCamera: record(string(), number().nullable()).optional(),
10065
+ recallByLight: record(string(), number().nullable()).optional(),
10066
+ fpByCamera: record(string(), number()).optional(),
10067
+ smallFound: number().int().optional(),
10068
+ smallTotal: number().int().optional()
10069
+ }).passthrough();
10070
+ var TrainingEvalReportSchema = object({
10071
+ frames: number().int(),
10072
+ classes: record(string(), TrainingEvalClassSchema)
10073
+ }).passthrough();
10074
+ /**
10075
+ * A succeeded result carries every block; a failed one carries the error and
10076
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10077
+ * orchestrator checks the blocks it needs before it trusts a success.
10078
+ */
10079
+ var TrainingResultSchema = object({
10080
+ schema: literal(TRAINING_RESULT_SCHEMA),
10081
+ jobKey: string(),
10082
+ status: _enum(["succeeded", "failed"]),
10083
+ error: object({
10084
+ stage: string(),
10085
+ code: string(),
10086
+ message: string()
10087
+ }).nullable(),
10088
+ trainer: object({
10089
+ version: string(),
10090
+ revision: string()
10091
+ }),
10092
+ toolchain: record(string(), string().nullable()),
10093
+ dataset: object({
10094
+ versionId: string(),
10095
+ annotationHash: string(),
10096
+ sha256: string(),
10097
+ frames: object({
10098
+ train: number().int(),
10099
+ val: number().int(),
10100
+ holdout: number().int()
10101
+ }),
10102
+ holdoutCameras: array(number().int()),
10103
+ replayImages: number().int()
10104
+ }).optional(),
10105
+ training: object({
10106
+ epochsRun: number().int(),
10107
+ bestEpoch: number().int(),
10108
+ bestMap50: number(),
10109
+ bestMap50_95: number(),
10110
+ seconds: number()
10111
+ }).optional(),
10112
+ evaluation: object({
10113
+ holdoutFrames: number().int(),
10114
+ baseline: TrainingEvalReportSchema.nullable(),
10115
+ candidate: TrainingEvalReportSchema.nullable(),
10116
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10117
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10118
+ map50: record(string(), number().nullable())
10119
+ }).optional(),
10120
+ floors: object({
10121
+ baseline: FloorsSchema,
10122
+ candidate: FloorsSchema,
10123
+ candidateInt8: FloorsSchema.nullable(),
10124
+ notes: array(string())
10125
+ }).optional(),
10126
+ int8: object({
10127
+ kept: boolean(),
10128
+ map50Fp16: number().nullable(),
10129
+ map50Int8: number().nullable(),
10130
+ reason: string().nullable()
10131
+ }).optional(),
10132
+ exportsDropped: array(object({
10133
+ export: string(),
10134
+ reason: string()
10135
+ })).optional(),
10136
+ files: array(TrainingResultFileSchema).optional(),
10137
+ bundle: object({
10138
+ path: literal("bundle.tar"),
10139
+ bytes: number().int().nonnegative(),
10140
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10141
+ }).nullable().optional(),
10142
+ catalogDraft: object({
10143
+ base: TrainingCatalogDraftSchema,
10144
+ int8: TrainingCatalogDraftSchema.nullable()
10145
+ }).nullable().optional(),
10146
+ licence: string()
10147
+ });
10148
+ var TrainingStageSchema = _enum([
10149
+ "prepare",
10150
+ "replay",
10151
+ "train",
10152
+ "eval",
10153
+ "export",
10154
+ "package"
10155
+ ]);
10156
+ var EventBase = {
10157
+ v: literal(1),
10158
+ ts: number()
10159
+ };
10160
+ discriminatedUnion("type", [
10161
+ object({
10162
+ ...EventBase,
10163
+ type: literal("stage"),
10164
+ stage: TrainingStageSchema
10165
+ }),
10166
+ object({
10167
+ ...EventBase,
10168
+ type: literal("epoch"),
10169
+ epoch: number().int(),
10170
+ epochs: number().int(),
10171
+ boxLoss: number().nullable().optional(),
10172
+ map50: number().nullable().optional(),
10173
+ map50_95: number().nullable().optional(),
10174
+ etaSec: number().nullable().optional()
10175
+ }),
10176
+ object({
10177
+ ...EventBase,
10178
+ type: literal("metric"),
10179
+ name: string(),
10180
+ value: number()
10181
+ }),
10182
+ object({
10183
+ ...EventBase,
10184
+ type: literal("artifact"),
10185
+ path: string(),
10186
+ bytes: number(),
10187
+ sha256: string()
10188
+ }),
10189
+ object({
10190
+ ...EventBase,
10191
+ type: literal("done"),
10192
+ status: _enum(["succeeded", "failed"]),
10193
+ resultSha256: string().nullable().optional()
10194
+ }),
10195
+ object({
10196
+ ...EventBase,
10197
+ type: literal("error"),
10198
+ stage: string(),
10199
+ code: string(),
10200
+ message: string()
10201
+ })
10202
+ ]);
10203
+ /**
9499
10204
  * What the gate decided about a birth, from the CALLER's point of view.
9500
10205
  *
9501
10206
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11823,7 +12528,9 @@ var AddonHttpRouteSchema = object({
11823
12528
  "authenticated",
11824
12529
  "admin"
11825
12530
  ]).optional(),
11826
- description: string().optional()
12531
+ description: string().optional(),
12532
+ /** The hub limits this route per client address before the handler runs. */
12533
+ rateLimit: _enum(["auth"]).optional()
11827
12534
  });
11828
12535
  /**
11829
12536
  * Cross-process route invocation envelope. The hub captures the
@@ -12528,6 +13235,37 @@ var BackupDestinationInfoSchema = object({
12528
13235
  lastError: string().optional()
12529
13236
  });
12530
13237
  /**
13238
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13239
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13240
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13241
+ * with it off — which restores without a key.
13242
+ */
13243
+ var BackupArchiveEncryptionSchema = object({
13244
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13245
+ scheme: string(),
13246
+ /** 16 hex — the backup key whose secret restores this archive. */
13247
+ keyId: string()
13248
+ });
13249
+ /**
13250
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13251
+ * one new archives are encrypted to, and the retired ones older archives
13252
+ * still need. The secret key is shown once, at `setupEncryption`.
13253
+ */
13254
+ var BackupEncryptionStatusSchema = object({
13255
+ enabled: boolean(),
13256
+ active: object({
13257
+ keyId: string(),
13258
+ publicKey: string(),
13259
+ createdAt: number()
13260
+ }).nullable(),
13261
+ /** Every key ever set up, newest first. */
13262
+ keys: array(object({
13263
+ keyId: string(),
13264
+ createdAt: number(),
13265
+ retiredAt: number().nullable()
13266
+ })).readonly()
13267
+ });
13268
+ /**
12531
13269
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12532
13270
  * Same shape the destination drill-in renders. Sourced from the per-
12533
13271
  * location `manifests.json` (no per-archive tarball read required).
@@ -12539,7 +13277,9 @@ var BackupArchiveEntrySchema = object({
12539
13277
  sizeBytes: number(),
12540
13278
  label: string().optional(),
12541
13279
  /** Top-level locations included in the archive (db, addons, tls, …). */
12542
- locations: array(string()).readonly()
13280
+ locations: array(string()).readonly(),
13281
+ /** Present when the archive is encrypted; restore then needs that key. */
13282
+ encryption: BackupArchiveEncryptionSchema.optional()
12543
13283
  });
12544
13284
  var BackupEntrySchema = object({
12545
13285
  id: string(),
@@ -12548,7 +13288,8 @@ var BackupEntrySchema = object({
12548
13288
  label: string().optional(),
12549
13289
  createdAt: number(),
12550
13290
  sizeBytes: number(),
12551
- locations: array(string()).optional()
13291
+ locations: array(string()).optional(),
13292
+ encryption: BackupArchiveEncryptionSchema.optional()
12552
13293
  });
12553
13294
  var ArchiveEntrySchema = object({
12554
13295
  path: string(),
@@ -12737,10 +13478,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12737
13478
  * this list and skips entries whose path doesn't start with
12738
13479
  * any of them.
12739
13480
  */
12740
- locations: array(string()).optional()
13481
+ locations: array(string()).optional(),
13482
+ /**
13483
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13484
+ * one). The archive is decrypted into the hub's private staging
13485
+ * before the restart; the key is not stored. A wrong or missing key
13486
+ * is refused before the archive is downloaded.
13487
+ */
13488
+ backupSecretKey: string().optional()
12741
13489
  }), _void(), {
12742
13490
  kind: "mutation",
12743
13491
  auth: "admin"
13492
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13493
+ keyId: string(),
13494
+ secretKey: string(),
13495
+ publicKey: string(),
13496
+ createdAt: number(),
13497
+ replacedKeyId: string().nullable()
13498
+ }), {
13499
+ kind: "mutation",
13500
+ auth: "admin"
13501
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13502
+ kind: "mutation",
13503
+ auth: "admin"
13504
+ }), method(object({ backupSecretKey: string() }), object({
13505
+ valid: boolean(),
13506
+ keyId: string().nullable(),
13507
+ /** The hub knows this key (active or retired). */
13508
+ known: boolean(),
13509
+ /** It is the key new archives are encrypted to. */
13510
+ active: boolean(),
13511
+ error: string().optional()
13512
+ }), {
13513
+ kind: "mutation",
13514
+ auth: "admin"
12744
13515
  }), method(object({
12745
13516
  destinationId: string(),
12746
13517
  backupId: string()
@@ -14466,7 +15237,60 @@ var CustomModelDescriptorSchema = object({
14466
15237
  stepId: string(),
14467
15238
  entry: ModelCatalogEntrySchema
14468
15239
  });
14469
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15240
+ /** One regular file of an imported bundle, as the producer measured it. */
15241
+ var ModelBundleFileSchema = object({
15242
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15243
+ path: string().min(1),
15244
+ bytes: number().int().nonnegative(),
15245
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15246
+ });
15247
+ var ImportModelBundleInputSchema = object({
15248
+ /** The registry provider that keeps the model (Model Studio). */
15249
+ addonId: string(),
15250
+ stepId: string().min(1),
15251
+ /**
15252
+ * The catalog rows to register, complete, every format URL already
15253
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15254
+ * bundle may carry several rows (a base and its INT8 variant).
15255
+ */
15256
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15257
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15258
+ bundle: object({
15259
+ ticket: PeerBytesTicketSchema,
15260
+ bytes: number().int().positive(),
15261
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15262
+ }),
15263
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15264
+ files: array(ModelBundleFileSchema).min(1).max(64),
15265
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15266
+ distribute: boolean()
15267
+ });
15268
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15269
+ kind: literal("imported"),
15270
+ modelIds: array(string()).readonly(),
15271
+ distributed: array(object({
15272
+ modelId: string(),
15273
+ nodeId: string(),
15274
+ format: _enum(MODEL_FORMATS),
15275
+ ok: boolean(),
15276
+ error: string().optional()
15277
+ })).readonly()
15278
+ }), object({
15279
+ kind: literal("refused"),
15280
+ reason: _enum([
15281
+ "transfer-failed",
15282
+ "checksum-mismatch",
15283
+ "bundle-mismatch",
15284
+ "invalid-entry",
15285
+ "id-taken"
15286
+ ]),
15287
+ detail: string()
15288
+ })]);
15289
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15290
+ kind: "mutation",
15291
+ auth: "admin",
15292
+ timeoutMs: 30 * 6e4
15293
+ });
14470
15294
  /**
14471
15295
  * Query filter for settings-store collections.
14472
15296
  */
@@ -14945,6 +15769,35 @@ var KeychainKeySourceSchema = object({
14945
15769
  */
14946
15770
  sharesBackupWithDatabase: boolean()
14947
15771
  });
15772
+ /**
15773
+ * One keychain reset, as the Secrets page reports it until the operator
15774
+ * acknowledges it. Never a value: refs, counts and table names only.
15775
+ */
15776
+ var KeychainResetRecordSchema = object({
15777
+ id: string(),
15778
+ at: number(),
15779
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15780
+ actor: string(),
15781
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15782
+ lockedReason: string().nullable(),
15783
+ /** Values moved into the archive table (ciphertext under the lost key). */
15784
+ archived: number().int(),
15785
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15786
+ archivedCollection: string().nullable(),
15787
+ /**
15788
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15789
+ * so the archive can still be opened if the lost master key turns up.
15790
+ */
15791
+ archivedKeysCollection: string().nullable(),
15792
+ /**
15793
+ * `system-settings` keys whose marker the reset cleared — the cluster
15794
+ * secret's: a marker left pointing at an archived value would refuse every
15795
+ * agent forever (D797).
15796
+ */
15797
+ clearedSettingsKeys: array(string()).readonly(),
15798
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15799
+ acknowledgedAt: number().nullable()
15800
+ });
14948
15801
  var KeychainStatusSchema = object({
14949
15802
  keychain: KeychainStateSchema,
14950
15803
  /** The source of the master key in use; `null` while locked. */
@@ -14962,7 +15815,9 @@ var KeychainStatusSchema = object({
14962
15815
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
14963
15816
  retiredWraps: number().int(),
14964
15817
  recoveryKeyDownloadedAt: number().nullable(),
14965
- secretCount: number().int()
15818
+ secretCount: number().int(),
15819
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15820
+ lastReset: KeychainResetRecordSchema.nullable()
14966
15821
  });
14967
15822
  /**
14968
15823
  * Whether a stored value is still pointed at by its owner's settings.
@@ -14984,17 +15839,26 @@ var KeychainAuditActionSchema = _enum([
14984
15839
  "download-recovery-key",
14985
15840
  "delete-orphans",
14986
15841
  "reset",
15842
+ "acknowledge-reset",
14987
15843
  "initialize"
14988
15844
  ]);
14989
15845
  var KeychainAuditEntrySchema = object({
14990
15846
  id: string(),
14991
15847
  at: number(),
14992
15848
  action: KeychainAuditActionSchema,
14993
- /** `addon:<id>` | `user:<id>` | `system`. */
15849
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
14994
15850
  actor: string(),
14995
15851
  ref: string().nullable(),
14996
15852
  detail: string().nullable()
14997
15853
  });
15854
+ var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
15855
+ /**
15856
+ * Secrets the HUB itself holds (owner `system`) that no settings form shows:
15857
+ * `jwt-signing-key` — the session signing key (D797). It is always "in use",
15858
+ * never an orphan; it is generated on a fresh hub and replaced only through
15859
+ * {@link keychainAdminCapability.methods.setSystemSecret}.
15860
+ */
15861
+ var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
14998
15862
  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({
14999
15863
  value: string(),
15000
15864
  version: number().int()
@@ -15002,6 +15866,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15002
15866
  kind: "mutation",
15003
15867
  auth: "admin",
15004
15868
  caller: "required"
15869
+ }), method(object({
15870
+ name: SystemHeldSecretNameSchema,
15871
+ value: string().min(16)
15872
+ }), object({
15873
+ ref: string(),
15874
+ version: number().int()
15875
+ }), {
15876
+ kind: "mutation",
15877
+ auth: "admin",
15878
+ caller: "required"
15005
15879
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
15006
15880
  deleted: array(string()).readonly(),
15007
15881
  kept: array(object({
@@ -15031,13 +15905,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15031
15905
  kind: "mutation",
15032
15906
  auth: "admin",
15033
15907
  caller: "required"
15034
- }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15908
+ }), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
15035
15909
  archivedCollection: string().nullable(),
15036
15910
  archived: number().int()
15037
15911
  }), {
15038
15912
  kind: "mutation",
15039
15913
  auth: "admin",
15040
15914
  caller: "required"
15915
+ }), method(object({}), object({
15916
+ reset: KeychainResetRecordSchema.nullable(),
15917
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15918
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15919
+ kind: "mutation",
15920
+ auth: "admin",
15921
+ caller: "required"
15041
15922
  });
15042
15923
  method(_void(), object({
15043
15924
  id: string(),
@@ -17699,14 +18580,14 @@ var LlmProfileSchema = object({
17699
18580
  /** ConfigUISchema tree passed through untyped on the wire (the
17700
18581
  * notification-output `ConfigSchemaPassthrough` precedent at
17701
18582
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
17702
- var ConfigSchemaPassthrough$1 = unknown();
18583
+ var ConfigSchemaPassthrough$3 = unknown();
17703
18584
  var LlmProfileKindDescriptorSchema = object({
17704
18585
  kind: LlmProfileKindSchema,
17705
18586
  label: string(),
17706
18587
  icon: string(),
17707
18588
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
17708
18589
  addonId: string(),
17709
- configSchema: ConfigSchemaPassthrough$1
18590
+ configSchema: ConfigSchemaPassthrough$3
17710
18591
  });
17711
18592
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
17712
18593
  var LlmDefaultSchema = object({
@@ -17984,7 +18865,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17984
18865
  * `login-method` — collection cap through which auth addons contribute
17985
18866
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17986
18867
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17987
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18868
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17988
18869
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17989
18870
  * procedure aggregates them for the unauthenticated login page.
17990
18871
  *
@@ -17992,8 +18873,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17992
18873
  *
17993
18874
  * - `redirect` — a declarative button. The login page renders a generic
17994
18875
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17995
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17996
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18876
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17997
18877
  * login page needs NO change.
17998
18878
  *
17999
18879
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -18012,8 +18892,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
18012
18892
  * decision.
18013
18893
  *
18014
18894
  * Every contribution carries a `stage`:
18015
- * - `primary` — shown on the first credentials screen (OIDC /
18016
- * magic-link buttons; a future usernameless passkey).
18895
+ * - `primary` — shown on the first credentials screen (OIDC
18896
+ * buttons; a usernameless passkey).
18017
18897
  * - `second-factor` — shown AFTER the password leg, gated on the
18018
18898
  * returned `factors` (passkey-as-2FA today).
18019
18899
  *
@@ -18040,7 +18920,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
18040
18920
  * The provider names an external identity a signed-in user can link to
18041
18921
  * their own account (D782): `auth.listLinkableProviders` /
18042
18922
  * `beginExternalLink` offer exactly the redirect methods that set this,
18043
- * whatever their id. Absent / false — a login button only (magic-link).
18923
+ * whatever their id. Absent / false — a login button only.
18044
18924
  */
18045
18925
  linkable: boolean().optional()
18046
18926
  }),
@@ -18828,7 +19708,7 @@ var TargetKindCapsSchema = object({
18828
19708
  * the union is large and not meant for runtime validation here; the exported
18829
19709
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
18830
19710
  */
18831
- var ConfigSchemaPassthrough = unknown();
19711
+ var ConfigSchemaPassthrough$2 = unknown();
18832
19712
  var TargetKindSchema = object({
18833
19713
  kind: string(),
18834
19714
  label: string(),
@@ -18865,7 +19745,7 @@ var TargetKindSchema = object({
18865
19745
  * its raster path, which is the safe default for an unknown image.
18866
19746
  */
18867
19747
  iconMediaType: string().optional(),
18868
- configSchema: ConfigSchemaPassthrough,
19748
+ configSchema: ConfigSchemaPassthrough$2,
18869
19749
  /**
18870
19750
  * The config keys that decide WHERE this kind's secrets are sent (server,
18871
19751
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -21895,8 +22775,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21895
22775
  * `super_admin` — collapsed onto the single boolean because every
21896
22776
  * non-admin caller is governed by the same scope-check rules; the
21897
22777
  * distinction was only ever used to route role-specific procedures
21898
- * which we no longer have. Agents are admin sessions issued via
21899
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22778
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21900
22779
  * with `isAdmin: false` + an explicit scope list.
21901
22780
  */
21902
22781
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -22203,6 +23082,61 @@ var OauthIntegrationDescriptorSchema = object({
22203
23082
  });
22204
23083
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
22205
23084
  /**
23085
+ * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
23086
+ *
23087
+ * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
23088
+ * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
23089
+ * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
23090
+ * immutable after create.
23091
+ */
23092
+ var ConfigSchemaPassthrough$1 = unknown();
23093
+ var OidcConnectionSchema = object({
23094
+ id: string().min(1),
23095
+ displayName: string(),
23096
+ icon: string(),
23097
+ issuerUrl: string(),
23098
+ clientId: string(),
23099
+ /** Client id + secret present — never the secret value. */
23100
+ configured: boolean(),
23101
+ /**
23102
+ * Values for the connection form schema. `clientSecret` is a keychain
23103
+ * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
23104
+ */
23105
+ formValues: record(string(), unknown()).optional()
23106
+ });
23107
+ /**
23108
+ * Patch one connection. Omitted or empty `clientSecret` keeps the stored
23109
+ * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
23110
+ */
23111
+ var OidcConnectionUpdateInputSchema = object({
23112
+ id: string().min(1),
23113
+ displayName: string().min(1),
23114
+ icon: string().optional(),
23115
+ issuerUrl: string().optional(),
23116
+ clientId: string().optional(),
23117
+ clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
23118
+ redirectUri: string().optional(),
23119
+ scopes: string().optional(),
23120
+ usernameClaim: _enum([
23121
+ "preferred_username",
23122
+ "email",
23123
+ "sub"
23124
+ ]).optional()
23125
+ });
23126
+ method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
23127
+ id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
23128
+ displayName: string().min(1)
23129
+ }), object({ id: string() }), {
23130
+ kind: "mutation",
23131
+ auth: "admin"
23132
+ }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
23133
+ kind: "mutation",
23134
+ auth: "admin"
23135
+ }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
23136
+ kind: "mutation",
23137
+ auth: "admin"
23138
+ });
23139
+ /**
22206
23140
  * What started a camera's onboard motion (D672). `camera` is the camera's own
22207
23141
  * firmware; `sensor` is a device the operator ATTACHED to it. Absent on the
22208
23142
  * wire means the camera: only the camera-sensors bridge ever says `sensor`.
@@ -23559,21 +24493,69 @@ var RetrainFrameListSchema = object({
23559
24493
  /** What the page pre-selects — the native key frame when one survives. */
23560
24494
  autoPickMediaId: number().int().optional()
23561
24495
  });
24496
+ /** Exclusive partition of a corpus copy's annotation progress (design §4.2). */
24497
+ var RetrainFrameWorkStateSchema = _enum([
24498
+ "unannotated",
24499
+ "annotated",
24500
+ "complete"
24501
+ ]);
24502
+ /**
24503
+ * Filters for paginated corpus list, KPI, and matching export (design §4.4).
24504
+ * Every narrowing field is ANDed; omitted fields impose no constraint.
24505
+ */
24506
+ var RetrainCorpusFilterSchema = object({
24507
+ workState: RetrainFrameWorkStateSchema.optional(),
24508
+ deviceIds: array(number()).max(500).optional(),
24509
+ /** When set, only frames in this named collection. */
24510
+ collectionId: string().optional(),
24511
+ /** Frames that carry at least one saved annotation in one of these classes. */
24512
+ classes: array(RetrainMacroClassSchema).optional(),
24513
+ page: number().int().positive().default(1),
24514
+ pageSize: number().int().positive().max(100).default(50)
24515
+ });
24516
+ var RetrainCorpusPageSchema = object({
24517
+ frames: array(RetrainFrameSchema.extend({ workState: RetrainFrameWorkStateSchema })).readonly(),
24518
+ total: number().int().nonnegative(),
24519
+ page: number().int().positive(),
24520
+ pageSize: number().int().positive()
24521
+ });
24522
+ var RetrainCorpusKpiCameraRowSchema = object({
24523
+ deviceId: number(),
24524
+ unannotated: number().int().nonnegative(),
24525
+ annotated: number().int().nonnegative(),
24526
+ complete: number().int().nonnegative(),
24527
+ /** This camera's `complete` count divided by corpus `total`, in `[0,1]`.
24528
+ * `null` when the corpus is empty (no ratio). */
24529
+ pctOfCorpus: number().min(0).max(1).nullable()
24530
+ });
24531
+ var RetrainCorpusKpiSchema = object({
24532
+ total: number().int().nonnegative(),
24533
+ unannotated: number().int().nonnegative(),
24534
+ annotated: number().int().nonnegative(),
24535
+ complete: number().int().nonnegative(),
24536
+ cameras: array(RetrainCorpusKpiCameraRowSchema).readonly()
24537
+ });
23562
24538
  /**
23563
24539
  * Which frames an annotated export carries. Every field narrows; an empty
23564
- * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23565
- * list owned by whoever trains (the training orchestrator), so `frameIds` is
23566
- * the primitive a version export uses; `batchId` re-selects what an earlier
23567
- * export carried (`exportedInBatch`).
24540
+ * filter is every annotated copy. `frameIds` is the primitive a job or
24541
+ * download uses; `batchId` re-selects what an earlier export carried
24542
+ * (`exportedInBatch`). Frozen dataset versions were removed — live selection
24543
+ * resolves to `frameIds` at plan/start.
23568
24544
  */
23569
24545
  var RetrainExportFilterSchema = object({
23570
24546
  deviceIds: array(number()).optional(),
23571
24547
  frameIds: array(string()).max(2e4).optional(),
23572
24548
  /** Only frames in at least one of these named collections. */
23573
24549
  collectionIds: array(string()).max(200).optional(),
24550
+ /** Single collection (Frames filter bar). ANDed with `collectionIds` when both set. */
24551
+ collectionId: string().optional(),
23574
24552
  batchId: string().optional(),
23575
24553
  /** Only frames the operator marked complete (all subjects boxed). */
23576
- completeOnly: boolean().optional()
24554
+ completeOnly: boolean().optional(),
24555
+ /** Exclusive work-state partition (`workStateOf`); same as the corpus list. */
24556
+ workState: RetrainFrameWorkStateSchema.optional(),
24557
+ /** Frames with at least one saved annotation in one of these classes. */
24558
+ classes: array(RetrainMacroClassSchema).optional()
23577
24559
  });
23578
24560
  /**
23579
24561
  * `frames`: the full frame copies, boxes in `annotations.json`.
@@ -23738,6 +24720,77 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23738
24720
  ]),
23739
24721
  detail: string().optional()
23740
24722
  })]);
24723
+ /** What a dataset version is cut from. Every field narrows. */
24724
+ var RetrainDatasetSelectionSchema = object({
24725
+ deviceIds: array(number()).readonly().optional(),
24726
+ collectionIds: array(string()).max(200).readonly().optional(),
24727
+ frameIds: array(string()).max(2e4).readonly().optional()
24728
+ });
24729
+ /** The counts a dataset is judged by. */
24730
+ var RetrainDatasetStatsSchema = object({
24731
+ frames: number().int(),
24732
+ completeFrames: number().int(),
24733
+ /** `completeFrames / frames`, 0..1. */
24734
+ completeness: number(),
24735
+ /** Boxes to learn (model errors excluded). */
24736
+ subjects: number().int(),
24737
+ modelErrors: number().int(),
24738
+ /** Complete frames with no subject. */
24739
+ hardNegatives: number().int(),
24740
+ /** Subjects per class × camera × day/night. */
24741
+ cells: array(object({
24742
+ macroClass: string(),
24743
+ deviceId: number(),
24744
+ lighting: _enum([
24745
+ "day",
24746
+ "night",
24747
+ "unknown"
24748
+ ]),
24749
+ subjects: number().int(),
24750
+ frames: number().int()
24751
+ })).readonly(),
24752
+ cameras: array(object({
24753
+ deviceId: number(),
24754
+ frames: number().int(),
24755
+ completeFrames: number().int()
24756
+ })).readonly()
24757
+ });
24758
+ object({
24759
+ id: string(),
24760
+ name: string(),
24761
+ createdAt: number(),
24762
+ selection: RetrainDatasetSelectionSchema,
24763
+ layout: RetrainExportLayoutSchema,
24764
+ completeOnly: boolean(),
24765
+ frameCount: number().int(),
24766
+ annotationHash: string(),
24767
+ manifestSchema: string(),
24768
+ stats: RetrainDatasetStatsSchema
24769
+ });
24770
+ /**
24771
+ * Live training corpus criteria — same shape as `TrainingCorpusSelection` on
24772
+ * the training cap. Resolved here so plan/start and the annotated export share
24773
+ * one definition of "the frames" (`buildRetrainExportPlan`).
24774
+ */
24775
+ var RetrainTrainingCorpusSelectionSchema = object({
24776
+ collectionIds: array(string()).min(1),
24777
+ workState: _enum([
24778
+ "complete",
24779
+ "annotated_or_complete",
24780
+ "any_annotated"
24781
+ ]).default("complete")
24782
+ });
24783
+ var RetrainTrainingCorpusResolveResultSchema = discriminatedUnion("kind", [object({
24784
+ kind: literal("resolved"),
24785
+ frameIds: array(string()).max(2e4).readonly(),
24786
+ stats: RetrainDatasetStatsSchema,
24787
+ annotationHash: string(),
24788
+ layout: RetrainExportLayoutSchema
24789
+ }), object({
24790
+ kind: literal("refused"),
24791
+ reason: _enum(["unknown-collection", "no-frames"]),
24792
+ detail: string()
24793
+ })]);
23741
24794
  /** The outcome of a lifecycle move owned by the retrain page. */
23742
24795
  var RetrainTransitionResultSchema = object({
23743
24796
  trackId: string(),
@@ -24443,6 +25496,12 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24443
25496
  }), array(RetrainTrackSchema).readonly(), {
24444
25497
  kind: "query",
24445
25498
  auth: "admin"
25499
+ }), method(RetrainCorpusFilterSchema, RetrainCorpusPageSchema, {
25500
+ kind: "query",
25501
+ auth: "admin"
25502
+ }), method(object({}), RetrainCorpusKpiSchema, {
25503
+ kind: "query",
25504
+ auth: "admin"
24446
25505
  }), method(object({ trackId: string() }), RetrainFrameListSchema, {
24447
25506
  kind: "query",
24448
25507
  auth: "admin"
@@ -24527,6 +25586,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24527
25586
  kind: "mutation",
24528
25587
  auth: "admin",
24529
25588
  timeoutMs: 60 * 6e4
25589
+ }), method(object({
25590
+ filter: RetrainExportFilterSchema,
25591
+ layout: RetrainExportLayoutSchema
25592
+ }), object({
25593
+ ticket: PeerBytesTicketSchema,
25594
+ frames: number().int(),
25595
+ annotations: number().int()
25596
+ }), {
25597
+ kind: "mutation",
25598
+ auth: "admin",
25599
+ timeoutMs: 12e4
24530
25600
  }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24531
25601
  kind: "query",
24532
25602
  auth: "admin"
@@ -24553,6 +25623,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24553
25623
  }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24554
25624
  kind: "query",
24555
25625
  auth: "admin"
25626
+ }), method(RetrainTrainingCorpusSelectionSchema, RetrainTrainingCorpusResolveResultSchema, {
25627
+ kind: "query",
25628
+ auth: "admin",
25629
+ timeoutMs: 6e4
24556
25630
  }), method(object({
24557
25631
  id: string(),
24558
25632
  name: string().max(120)
@@ -25169,11 +26243,14 @@ var HardwareClassIdSchema = _enum([
25169
26243
  "intel-n-series",
25170
26244
  "apple-m-base",
25171
26245
  "apple-m-pro",
26246
+ "amd-phoenix",
25172
26247
  "unknown"
25173
26248
  ]);
25174
26249
  var AcceleratorKindSchema = _enum([
25175
26250
  "intel-npu",
25176
26251
  "intel-igpu",
26252
+ "amd-igpu",
26253
+ "amd-npu",
25177
26254
  "x86-cpu",
25178
26255
  "arm-cpu",
25179
26256
  "apple-ane",
@@ -27103,6 +28180,8 @@ var AgentPipelineSettingsSchema = object({
27103
28180
  * address is wrong (multi-homed host, NAT, custom interface).
27104
28181
  */
27105
28182
  reachableHost: string().optional(),
28183
+ /** Hub-persisted UI colour (`--color-node-*` theme tokens). */
28184
+ color: NodeColorIdSchema.optional(),
27106
28185
  /**
27107
28186
  * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
27108
28187
  * weight, steps}. Absent / all-disabled ⇒ the node's single default
@@ -27652,8 +28731,9 @@ method(object({
27652
28731
  auth: "admin"
27653
28732
  }), method(object({
27654
28733
  agentNodeId: string(),
27655
- reachableHost: string().nullable()
27656
- }), object({ success: literal(true) }), {
28734
+ reachableHost: string().nullable().optional(),
28735
+ color: NodeColorIdSchema.nullable().optional()
28736
+ }).refine((v) => v.reachableHost !== void 0 || v.color !== void 0, { message: "reachableHost or color required" }), object({ success: literal(true) }), {
27657
28737
  kind: "mutation",
27658
28738
  auth: "admin"
27659
28739
  }), method(object({
@@ -28105,8 +29185,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
28105
29185
  * `smtp-provider` — pluggable email delivery surface.
28106
29186
  *
28107
29187
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
28108
- * one for transactional / one for notifications). Consumers (magic-link,
28109
- * notifier addons, …) walk the collection and pick the first
29188
+ * one for transactional / one for notifications). Consumers (notifier
29189
+ * addons, …) walk the collection and pick the first
28110
29190
  * ready provider OR target a specific addonId.
28111
29191
  *
28112
29192
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -28389,7 +29469,7 @@ targets: array(object({
28389
29469
  };
28390
29470
  /**
28391
29471
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
28392
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
29472
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
28393
29473
  * carrying the post-callback claims before redirecting back to
28394
29474
  * `/api/auth/sso/finish`.
28395
29475
  *
@@ -28452,7 +29532,14 @@ var SsoBridgeClaimsSchema = object({
28452
29532
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28453
29533
  * subject is unique only per issuer, so a link is bound to it.
28454
29534
  */
28455
- issuer: string().optional()
29535
+ issuer: string().optional(),
29536
+ /**
29537
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
29538
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
29539
+ * request to present the matching cookie — a login bridge is useless in
29540
+ * any other browser.
29541
+ */
29542
+ browserBinding: string().optional()
28456
29543
  });
28457
29544
  method(object({
28458
29545
  claims: SsoBridgeClaimsSchema,
@@ -31235,7 +32322,7 @@ var CustomActionInputSchema = object({
31235
32322
  action: string().min(1),
31236
32323
  input: unknown()
31237
32324
  });
31238
- method(_void(), array(AddonListItemSchema).readonly()), method(object({
32325
+ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSchema).readonly()), method(object({
31239
32326
  addonId: string(),
31240
32327
  limit: number().min(1).max(500).default(100),
31241
32328
  level: LogLevelSchema$2.optional()
@@ -36297,7 +37384,13 @@ var TopologyNodeSchema = object({
36297
37384
  })).readonly(),
36298
37385
  processes: array(TopologyProcessSchema).readonly(),
36299
37386
  categories: array(TopologyCategorySchema).readonly(),
36300
- rootPackage: TopologyRootPackageSchema.nullable()
37387
+ rootPackage: TopologyRootPackageSchema.nullable(),
37388
+ /**
37389
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
37390
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
37391
+ * for offline rows and when the hub cannot tell.
37392
+ */
37393
+ meshTransport: _enum(["tls", "clear"]).optional()
36301
37394
  });
36302
37395
  var CapUsageEdgeSchema = object({
36303
37396
  callerAddonId: string(),
@@ -36756,6 +37849,7 @@ var OsdNamedTemplateSchema = object({
36756
37849
  });
36757
37850
  /** Where a slot's value comes from. */
36758
37851
  var OsdSourceSchema = discriminatedUnion("kind", [
37852
+ object({ kind: literal("none") }),
36759
37853
  object({
36760
37854
  kind: literal("static"),
36761
37855
  text: string().max(64)
@@ -36882,6 +37976,13 @@ method(object({ deviceId: number().int() }), object({
36882
37976
  }), object({ success: literal(true) }), {
36883
37977
  kind: "mutation",
36884
37978
  auth: "admin"
37979
+ }), method(object({
37980
+ deviceId: number().int(),
37981
+ slotId: string().min(1),
37982
+ enabled: boolean()
37983
+ }), object({ success: literal(true) }), {
37984
+ kind: "mutation",
37985
+ auth: "admin"
36885
37986
  }), method(object({
36886
37987
  sourceDeviceId: number().int(),
36887
37988
  targetDeviceId: number().int()
@@ -37313,7 +38414,15 @@ var GpuInfoSchema = object({
37313
38414
  name: string(),
37314
38415
  memoryMB: number().optional()
37315
38416
  });
37316
- var NpuInfoSchema = object({ type: _enum(["apple-ane", "intel-npu"]) });
38417
+ var NpuInfoSchema = object({
38418
+ type: _enum([
38419
+ "apple-ane",
38420
+ "intel-npu",
38421
+ "amd-xdna"
38422
+ ]),
38423
+ name: string().optional(),
38424
+ generation: _enum(["xdna1", "xdna2"]).optional()
38425
+ });
37317
38426
  var CoralInfoSchema = object({
37318
38427
  type: literal("coral-edgetpu"),
37319
38428
  bus: string().optional()
@@ -41582,16 +42691,6 @@ var ApiKeySummarySchema = object({
41582
42691
  createdAt: number(),
41583
42692
  lastUsedAt: number().optional()
41584
42693
  });
41585
- var CreateApiKeyInputSchema = object({
41586
- label: string(),
41587
- isAdmin: boolean().default(false),
41588
- allowedProviders: union([array(string()), literal("*")]).optional(),
41589
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
41590
- });
41591
- var CreateApiKeyResultSchema = object({
41592
- token: string(),
41593
- record: ApiKeySummarySchema
41594
- });
41595
42694
  var ScopedTokenSummarySchema = object({
41596
42695
  id: string(),
41597
42696
  userId: string(),
@@ -41690,17 +42789,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
41690
42789
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
41691
42790
  kind: "mutation",
41692
42791
  access: "view"
41693
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
41694
- kind: "mutation",
41695
- auth: "admin",
41696
- access: "create"
41697
- }), method(object({ id: string() }), object({ success: literal(true) }), {
42792
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
41698
42793
  kind: "mutation",
41699
42794
  auth: "admin",
41700
42795
  access: "delete"
41701
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
41702
- kind: "mutation",
41703
- access: "view"
41704
42796
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
41705
42797
  kind: "mutation",
41706
42798
  auth: "admin",
@@ -41774,15 +42866,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
41774
42866
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
41775
42867
  userId: string(),
41776
42868
  issuer: string()
41777
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
41778
- userId: string(),
41779
- issuer: string().min(1),
41780
- label: string().optional()
41781
- }), object({ success: literal(true) }), {
41782
- kind: "mutation",
41783
- auth: "admin",
41784
- access: "create"
41785
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
42869
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41786
42870
  kind: "mutation",
41787
42871
  auth: "admin",
41788
42872
  access: "delete"
@@ -42487,6 +43571,563 @@ var zoneRulesCapability = {
42487
43571
  */
42488
43572
  durability: "restored"
42489
43573
  };
43574
+ /**
43575
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
43576
+ *
43577
+ * A thin, mockable translation layer: it knows how to run a container with a
43578
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
43579
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
43580
+ * those are the `training` orchestrator's (D805). Every rule written there
43581
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
43582
+ * manifest entry and nothing else.
43583
+ *
43584
+ * Collection of provider **types** (addons). Each addon owns zero or more
43585
+ * **entries** (credentials + defaults). Concat-fans: `describe`,
43586
+ * `describeTypes`, `listEntries`, `listJobs`. Single-row work is keyed by
43587
+ * `entryId`; callers also pass the owning `addonId` as the collection
43588
+ * selector (broker posture). Every method is `admin`: these spend money.
43589
+ *
43590
+ * Every cloud object a provider creates is tagged with the orchestrator's
43591
+ * `jobKey`, so a retried submit finds the job it already started instead of
43592
+ * starting a second GPU, and `listJobs` can find orphans.
43593
+ *
43594
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
43595
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
43596
+ * ticket the provider mints (D613).
43597
+ */
43598
+ var TrainingGpuOptionSchema = object({
43599
+ id: string(),
43600
+ label: string(),
43601
+ /** List price, USD per GPU-hour, before any region multiplier. */
43602
+ usdPerHour: number().nonnegative(),
43603
+ vramGb: number().nonnegative()
43604
+ });
43605
+ var TrainingRegionOptionSchema = object({
43606
+ /** `''` = any region (the provider's choice). */
43607
+ id: string(),
43608
+ label: string(),
43609
+ priceMultiplier: number().positive()
43610
+ });
43611
+ /**
43612
+ * The provider's per-entry settings, as the orchestrator reads them. They
43613
+ * live on the PROVIDER addon's entry (operator decision 2026-10-08: they
43614
+ * depend on the user's account), never hard-coded in the orchestrator.
43615
+ */
43616
+ var TrainingProviderDefaultsSchema = object({
43617
+ gpuType: string(),
43618
+ region: string(),
43619
+ costCapUsd: number().nonnegative(),
43620
+ maxRuntimeSec: number().int().positive(),
43621
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
43622
+ failedDatasetGraceHours: number().nonnegative()
43623
+ });
43624
+ /**
43625
+ * Entry form schema for a provider type — same seam as notification
43626
+ * `TargetKind.configSchema` (`z.unknown()` at the wire; callers tighten to
43627
+ * {@link ConfigUISchema}). Drives `ConfigFormBuilder` on Training → Providers.
43628
+ */
43629
+ var ConfigSchemaPassthrough = unknown();
43630
+ /** One creatable provider type, for the Add-entry dialog. */
43631
+ var TrainingProviderTypeSchema = object({
43632
+ typeId: string(),
43633
+ label: string(),
43634
+ /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
43635
+ iconAsset: string(),
43636
+ /** Owning `training-provider` addon — collection selector for createEntry. */
43637
+ addonId: string(),
43638
+ /**
43639
+ * Fields for one entry of this type (credentials + defaults). Absent on a
43640
+ * type that only needs a name. Password fields are keychain-backed on the
43641
+ * provider addon (`secretStatePaths`), not D634 plaintext.
43642
+ */
43643
+ configSchema: ConfigSchemaPassthrough.optional()
43644
+ });
43645
+ /** One configured account / workspace under a provider type. */
43646
+ var TrainingProviderEntrySchema = object({
43647
+ entryId: string(),
43648
+ typeId: string(),
43649
+ name: string(),
43650
+ addonId: string(),
43651
+ /** Credentials are present — never the values. */
43652
+ configured: boolean()
43653
+ });
43654
+ var TrainingProviderDescriptorSchema = object({
43655
+ addonId: string(),
43656
+ entryId: string(),
43657
+ typeId: string(),
43658
+ /** Operator-chosen entry name. */
43659
+ name: string(),
43660
+ iconAsset: string(),
43661
+ /** `modal`, `runpod`, `fake`, … — same as typeId for current providers. */
43662
+ kind: string(),
43663
+ label: string(),
43664
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
43665
+ regions: array(TrainingRegionOptionSchema).readonly(),
43666
+ maxDatasetBytes: number().int().positive(),
43667
+ maxRuntimeSec: number().int().positive(),
43668
+ freeTierNote: string().optional(),
43669
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
43670
+ dataResidencyNote: string(),
43671
+ /** Credentials are present — never the values. */
43672
+ configured: boolean(),
43673
+ defaults: TrainingProviderDefaultsSchema,
43674
+ /**
43675
+ * Values for {@link TrainingProviderTypeSchema}'s `configSchema` — password
43676
+ * fields are keychain {@link SecretFieldView} or `null` / `''` (create),
43677
+ * never plaintext. Same hydrate contract as settings forms (D789).
43678
+ */
43679
+ formValues: record(string(), unknown()).optional()
43680
+ });
43681
+ /**
43682
+ * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
43683
+ * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
43684
+ * `{ $secretClear: true }` clears it.
43685
+ */
43686
+ var TrainingProviderUpdateEntryInputSchema = object({
43687
+ entryId: string().min(1),
43688
+ name: string().min(1),
43689
+ tokenId: string().optional(),
43690
+ tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
43691
+ environment: string().optional(),
43692
+ gpuType: string().optional(),
43693
+ region: string().optional(),
43694
+ costCapUsd: number().nonnegative().optional(),
43695
+ maxRuntimeSec: number().int().positive().optional(),
43696
+ failedDatasetGraceHours: number().nonnegative().optional()
43697
+ });
43698
+ var TrainingCredentialCheckSchema = object({
43699
+ ok: boolean(),
43700
+ /** Workspace / account name, when the provider says. */
43701
+ account: string().optional(),
43702
+ reason: _enum([
43703
+ "missing",
43704
+ "invalid",
43705
+ "forbidden",
43706
+ "network",
43707
+ "quota"
43708
+ ]).optional(),
43709
+ detail: string().optional()
43710
+ });
43711
+ var ProviderJobStateSchema = _enum([
43712
+ "pending",
43713
+ "starting",
43714
+ "running",
43715
+ "succeeded",
43716
+ "failed",
43717
+ "cancelled",
43718
+ "lost"
43719
+ ]);
43720
+ var ProviderJobStatusSchema = object({
43721
+ jobKey: string(),
43722
+ providerJobId: string().optional(),
43723
+ state: ProviderJobStateSchema,
43724
+ startedAt: number().optional(),
43725
+ endedAt: number().optional(),
43726
+ exitCode: number().int().optional(),
43727
+ failureReason: string().optional(),
43728
+ gpuType: string(),
43729
+ region: string().optional(),
43730
+ billedSeconds: number().nonnegative(),
43731
+ costUsd: number().nonnegative(),
43732
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
43733
+ costIsEstimate: boolean(),
43734
+ lastFetchedAt: number()
43735
+ });
43736
+ /**
43737
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
43738
+ * image its own way (Modal builds the published Dockerfile at that revision;
43739
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
43740
+ * in `result.json`.
43741
+ */
43742
+ var TrainerSourceRefSchema = object({
43743
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
43744
+ repo: string().min(1),
43745
+ /** A commit sha (never a branch) — the job must be reproducible. */
43746
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
43747
+ });
43748
+ /** Cloud job identity — route with the owning addon's `addonId` selector. */
43749
+ var JobRef = {
43750
+ entryId: string().min(1),
43751
+ jobKey: string().uuid()
43752
+ };
43753
+ var TrainingLogLineSchema = object({
43754
+ ts: number(),
43755
+ text: string()
43756
+ });
43757
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
43758
+ typeId: string().min(1),
43759
+ name: string().min(1)
43760
+ }), object({ entryId: string() }), {
43761
+ kind: "mutation",
43762
+ auth: "admin"
43763
+ }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
43764
+ kind: "mutation",
43765
+ auth: "admin"
43766
+ }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
43767
+ kind: "mutation",
43768
+ auth: "admin"
43769
+ }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
43770
+ kind: "mutation",
43771
+ auth: "admin",
43772
+ timeoutMs: 3e4
43773
+ }), method(object({
43774
+ entryId: string().min(1),
43775
+ gpuType: string(),
43776
+ region: string(),
43777
+ datasetBytes: number().int().nonnegative(),
43778
+ gpuSecondsLow: number().nonnegative(),
43779
+ gpuSecondsHigh: number().nonnegative()
43780
+ }), object({
43781
+ usdLow: number().nonnegative(),
43782
+ usdHigh: number().nonnegative(),
43783
+ notes: array(string()).readonly()
43784
+ }), { auth: "admin" }), method(object({
43785
+ ...JobRef,
43786
+ ticket: PeerBytesTicketSchema
43787
+ }), object({
43788
+ bytes: number().int().nonnegative(),
43789
+ sha256: string()
43790
+ }), {
43791
+ kind: "mutation",
43792
+ auth: "admin",
43793
+ timeoutMs: 120 * 6e4
43794
+ }), method(object({
43795
+ ...JobRef,
43796
+ trainer: TrainerSourceRefSchema,
43797
+ jobSpecJson: string().min(2).max(64e3),
43798
+ gpuType: string(),
43799
+ region: string(),
43800
+ maxRuntimeSec: number().int().positive()
43801
+ }), ProviderJobStatusSchema, {
43802
+ kind: "mutation",
43803
+ auth: "admin",
43804
+ timeoutMs: 30 * 6e4
43805
+ }), method(object(JobRef), ProviderJobStatusSchema, {
43806
+ auth: "admin",
43807
+ timeoutMs: 6e4
43808
+ }), method(object({
43809
+ ...JobRef,
43810
+ cursor: string().optional(),
43811
+ max: number().int().min(1).max(500)
43812
+ }), object({
43813
+ lines: array(TrainingLogLineSchema).readonly(),
43814
+ cursor: string()
43815
+ }), {
43816
+ auth: "admin",
43817
+ timeoutMs: 6e4
43818
+ }), method(object(JobRef), object({ ok: literal(true) }), {
43819
+ kind: "mutation",
43820
+ auth: "admin",
43821
+ timeoutMs: 6e4
43822
+ }), method(object(JobRef), object({
43823
+ found: boolean(),
43824
+ text: string().optional()
43825
+ }), {
43826
+ kind: "mutation",
43827
+ auth: "admin",
43828
+ timeoutMs: 5 * 6e4
43829
+ }), method(object({
43830
+ ...JobRef,
43831
+ path: _enum(["bundle.tar"])
43832
+ }), object({ ticket: PeerBytesTicketSchema }), {
43833
+ kind: "mutation",
43834
+ auth: "admin",
43835
+ timeoutMs: 5 * 6e4
43836
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
43837
+ kind: "mutation",
43838
+ auth: "admin",
43839
+ timeoutMs: 5 * 6e4
43840
+ }), method(object({ entryId: string().min(1).optional() }), array(ProviderJobStatusSchema).readonly(), {
43841
+ auth: "admin",
43842
+ timeoutMs: 2 * 6e4
43843
+ });
43844
+ /**
43845
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
43846
+ * provided by `addon-training`.
43847
+ *
43848
+ * It owns what every provider must agree on, written once:
43849
+ *
43850
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
43851
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
43852
+ * - **The return flow.** Verified artefacts → Model Studio
43853
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
43854
+ * rollback. Nothing is ever registered automatically.
43855
+ *
43856
+ * Plan/start takes a live {@link TrainingCorpusSelection} (collections +
43857
+ * work-state rule); frame ids are resolved via pipeline-analytics at that
43858
+ * moment and snapshotted on the job. No frozen dataset version.
43859
+ *
43860
+ * Every method is `admin`.
43861
+ */
43862
+ /**
43863
+ * Live corpus criteria for plan/start (design §5.2). Default is complete-only.
43864
+ * Frame ids are resolved at plan/start — never a frozen version id.
43865
+ */
43866
+ var TrainingCorpusSelectionSchema = object({
43867
+ collectionIds: array(string()).min(1),
43868
+ /** Default complete-only for v1 */
43869
+ workState: _enum([
43870
+ "complete",
43871
+ "annotated_or_complete",
43872
+ "any_annotated"
43873
+ ]).default("complete")
43874
+ });
43875
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
43876
+ var TrainingBaseModelSchema = object({
43877
+ modelId: string(),
43878
+ label: string(),
43879
+ weights: string(),
43880
+ imgsz: number().int(),
43881
+ baselineOnnxUrl: string(),
43882
+ baselineFloors: record(string(), number()),
43883
+ /** The base the fleet runs most — the UI's default. */
43884
+ recommended: boolean()
43885
+ });
43886
+ var TrainingPresetSchema = _enum([
43887
+ "quick",
43888
+ "standard",
43889
+ "thorough"
43890
+ ]);
43891
+ var TrainingJobRequestSchema = object({
43892
+ /** Live collection + work-state criteria; resolved at plan/start. */
43893
+ selection: TrainingCorpusSelectionSchema,
43894
+ /**
43895
+ * The provider **entry** that runs it (credentials + defaults).
43896
+ * Resolve to an owning addon via `training-provider.describe` / `listEntries`.
43897
+ */
43898
+ entryId: string().min(1),
43899
+ gpuType: string().min(1),
43900
+ region: string(),
43901
+ baseModelId: string().min(1),
43902
+ preset: TrainingPresetSchema,
43903
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
43904
+ freeze: number().int().nonnegative().nullable(),
43905
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
43906
+ holdoutCameras: array(number().int()).nullable()
43907
+ });
43908
+ var TrainingSplitPlanSchema = object({
43909
+ holdoutCameras: array(number().int()).readonly(),
43910
+ /** Used when no camera is held out: the last N days of every camera. */
43911
+ holdoutLastDays: number().int().nonnegative(),
43912
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
43913
+ holdoutSupport: record(string(), number().int()).nullable(),
43914
+ trainSubjects: number().int()
43915
+ });
43916
+ var TrainingRefusalReasonSchema = _enum([
43917
+ "unknown-dataset",
43918
+ "unknown-provider",
43919
+ "provider-not-configured",
43920
+ "unknown-base-model",
43921
+ "unknown-gpu",
43922
+ "dataset-too-large",
43923
+ "no-training-subjects",
43924
+ "job-already-running"
43925
+ ]);
43926
+ var TrainingJobPlanSchema = object({
43927
+ refusal: object({
43928
+ reason: TrainingRefusalReasonSchema,
43929
+ detail: string()
43930
+ }).nullable(),
43931
+ warnings: array(string()).readonly(),
43932
+ split: TrainingSplitPlanSchema.nullable(),
43933
+ estimate: object({
43934
+ datasetBytes: number().int(),
43935
+ uploadMinutesAt20Mbps: number(),
43936
+ gpuSecondsLow: number(),
43937
+ gpuSecondsHigh: number(),
43938
+ usdLow: number(),
43939
+ usdHigh: number(),
43940
+ notes: array(string()).readonly()
43941
+ }).nullable(),
43942
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
43943
+ defaults: object({
43944
+ maxCostUsd: number(),
43945
+ maxRuntimeSec: number().int()
43946
+ }).nullable(),
43947
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
43948
+ dataNotice: string()
43949
+ });
43950
+ /**
43951
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
43952
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
43953
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
43954
+ * result lives after the operator acted on it.
43955
+ */
43956
+ var TrainingJobStateSchema = _enum([
43957
+ "queued",
43958
+ "uploading",
43959
+ "submitted",
43960
+ "starting",
43961
+ "running",
43962
+ "collecting",
43963
+ "ready",
43964
+ "registered",
43965
+ "canary",
43966
+ "failed",
43967
+ "cancelling",
43968
+ "cancelled",
43969
+ "lost",
43970
+ "expired",
43971
+ "discarded"
43972
+ ]);
43973
+ var TrainingFailureReasonSchema = _enum([
43974
+ "cost-cap",
43975
+ "runtime-cap",
43976
+ "upload-failed",
43977
+ "submit-failed",
43978
+ "trainer-failed",
43979
+ "result-invalid",
43980
+ "checksum-mismatch",
43981
+ "fetch-failed",
43982
+ "provider-error",
43983
+ "hub-restart-during-upload"
43984
+ ]);
43985
+ var TrainingProgressPointSchema = object({
43986
+ epoch: number().int(),
43987
+ map50: number().nullable(),
43988
+ map50_95: number().nullable()
43989
+ });
43990
+ var TrainingCanarySchema = object({
43991
+ deviceIds: array(number().int()).readonly(),
43992
+ since: number(),
43993
+ /** Every override the canary replaced, exactly, so rollback restores it. */
43994
+ previous: array(object({
43995
+ deviceId: number().int(),
43996
+ nodeId: string(),
43997
+ deviceKey: string(),
43998
+ patch: object({
43999
+ modelId: string().optional(),
44000
+ settings: record(string(), unknown()).readonly().optional()
44001
+ }).nullable()
44002
+ })).readonly()
44003
+ });
44004
+ var TrainingJobSchema = object({
44005
+ id: string(),
44006
+ idempotencyKey: string(),
44007
+ name: string(),
44008
+ createdAt: number(),
44009
+ updatedAt: number(),
44010
+ state: TrainingJobStateSchema,
44011
+ /**
44012
+ * Shared by every job enqueued together via `startJobBatch`.
44013
+ * `null` for a lone `startJob`. The engine advances queued siblings by this id.
44014
+ */
44015
+ batchId: string().nullable().default(null),
44016
+ stage: TrainingStageSchema.nullable(),
44017
+ failure: object({
44018
+ reason: TrainingFailureReasonSchema,
44019
+ stage: string().nullable(),
44020
+ detail: string()
44021
+ }).nullable(),
44022
+ request: TrainingJobRequestSchema,
44023
+ maxCostUsd: number().nonnegative(),
44024
+ maxRuntimeSec: number().int().positive(),
44025
+ trainer: TrainerSourceRefSchema,
44026
+ datasetLayout: RetrainExportLayoutSchema,
44027
+ /** Frame count snapshotted when the job started (audit; equals `frameIds.length`). */
44028
+ frameCount: number().int().nonnegative(),
44029
+ /** Resolved frame ids at start — the archive ships exactly these. */
44030
+ frameIds: array(string()).max(2e4).readonly(),
44031
+ /** Hash of what those frames taught at start (trainer `dataset.annotationHash`). */
44032
+ annotationHash: string(),
44033
+ dataset: object({
44034
+ bytes: number().int(),
44035
+ sha256: string(),
44036
+ uploadedAt: number()
44037
+ }).nullable(),
44038
+ split: TrainingSplitPlanSchema,
44039
+ provider: object({
44040
+ state: ProviderJobStateSchema.nullable(),
44041
+ providerJobId: string().nullable(),
44042
+ startedAt: number().nullable(),
44043
+ endedAt: number().nullable(),
44044
+ billedSeconds: number(),
44045
+ costUsd: number(),
44046
+ costIsEstimate: boolean(),
44047
+ lastPolledAt: number().nullable()
44048
+ }),
44049
+ progress: object({
44050
+ epoch: number().int().nullable(),
44051
+ epochs: number().int().nullable(),
44052
+ etaSec: number().nullable(),
44053
+ series: array(TrainingProgressPointSchema).readonly()
44054
+ }),
44055
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
44056
+ logTail: array(string()).readonly(),
44057
+ logCursor: string().nullable(),
44058
+ artifacts: object({
44059
+ bundleBytes: number().int(),
44060
+ bundleSha256: string(),
44061
+ fetchedAt: number(),
44062
+ /** When the staged artefacts are deleted from the hub. */
44063
+ expiresAt: number()
44064
+ }).nullable(),
44065
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
44066
+ cloudDatasetDeletedAt: number().nullable(),
44067
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
44068
+ cloudCleanupDueAt: number().nullable(),
44069
+ /** Model ids registered from this job (base, and int8 when kept). */
44070
+ registeredModelIds: array(string()).readonly(),
44071
+ canary: TrainingCanarySchema.nullable()
44072
+ });
44073
+ var IdInput = object({ id: string().min(1) });
44074
+ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
44075
+ auth: "admin",
44076
+ timeoutMs: 6e4
44077
+ }), method(TrainingJobRequestSchema.extend({
44078
+ name: string().min(1).max(120),
44079
+ maxCostUsd: number().positive(),
44080
+ maxRuntimeSec: number().int().positive(),
44081
+ idempotencyKey: string().min(8).max(80)
44082
+ }), discriminatedUnion("kind", [object({
44083
+ kind: literal("started"),
44084
+ job: TrainingJobSchema
44085
+ }), object({
44086
+ kind: literal("refused"),
44087
+ reason: TrainingRefusalReasonSchema,
44088
+ detail: string()
44089
+ })]), {
44090
+ kind: "mutation",
44091
+ auth: "admin",
44092
+ timeoutMs: 12e4
44093
+ }), method(TrainingJobRequestSchema.omit({ baseModelId: true }).extend({
44094
+ baseModelIds: array(string().min(1)).min(1),
44095
+ name: string().min(1).max(120),
44096
+ maxCostUsd: number().positive(),
44097
+ maxRuntimeSec: number().int().positive(),
44098
+ idempotencyKey: string().min(8).max(80)
44099
+ }), discriminatedUnion("kind", [object({
44100
+ kind: literal("started"),
44101
+ batchId: string(),
44102
+ jobs: array(TrainingJobSchema).min(1).readonly()
44103
+ }), object({
44104
+ kind: literal("refused"),
44105
+ reason: TrainingRefusalReasonSchema,
44106
+ detail: string()
44107
+ })]), {
44108
+ kind: "mutation",
44109
+ auth: "admin",
44110
+ timeoutMs: 12e4
44111
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
44112
+ kind: "mutation",
44113
+ auth: "admin",
44114
+ timeoutMs: 12e4
44115
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
44116
+ kind: "mutation",
44117
+ auth: "admin",
44118
+ timeoutMs: 30 * 6e4
44119
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
44120
+ kind: "mutation",
44121
+ auth: "admin",
44122
+ timeoutMs: 12e4
44123
+ }), method(IdInput, TrainingJobSchema, {
44124
+ kind: "mutation",
44125
+ auth: "admin",
44126
+ timeoutMs: 12e4
44127
+ }), method(IdInput, TrainingJobSchema, {
44128
+ kind: "mutation",
44129
+ auth: "admin"
44130
+ });
42490
44131
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
42491
44132
  Object.freeze({
42492
44133
  person: .5,
@@ -44635,6 +46276,12 @@ Object.freeze({
44635
46276
  addonId: null,
44636
46277
  access: "create"
44637
46278
  },
46279
+ "backup.checkBackupKey": {
46280
+ capName: "backup",
46281
+ capScope: "system",
46282
+ addonId: null,
46283
+ access: "create"
46284
+ },
44638
46285
  "backup.delete": {
44639
46286
  capName: "backup",
44640
46287
  capScope: "system",
@@ -44647,6 +46294,18 @@ Object.freeze({
44647
46294
  addonId: null,
44648
46295
  access: "delete"
44649
46296
  },
46297
+ "backup.disableEncryption": {
46298
+ capName: "backup",
46299
+ capScope: "system",
46300
+ addonId: null,
46301
+ access: "create"
46302
+ },
46303
+ "backup.getEncryption": {
46304
+ capName: "backup",
46305
+ capScope: "system",
46306
+ addonId: null,
46307
+ access: "view"
46308
+ },
44650
46309
  "backup.getEntries": {
44651
46310
  capName: "backup",
44652
46311
  capScope: "system",
@@ -44701,6 +46360,12 @@ Object.freeze({
44701
46360
  addonId: null,
44702
46361
  access: "create"
44703
46362
  },
46363
+ "backup.setupEncryption": {
46364
+ capName: "backup",
46365
+ capScope: "system",
46366
+ addonId: null,
46367
+ access: "create"
46368
+ },
44704
46369
  "backup.trigger": {
44705
46370
  capName: "backup",
44706
46371
  capScope: "system",
@@ -45253,6 +46918,12 @@ Object.freeze({
45253
46918
  addonId: null,
45254
46919
  access: "create"
45255
46920
  },
46921
+ "customModelRegistry.importModelBundle": {
46922
+ capName: "custom-model-registry",
46923
+ capScope: "system",
46924
+ addonId: null,
46925
+ access: "create"
46926
+ },
45256
46927
  "customModelRegistry.listModels": {
45257
46928
  capName: "custom-model-registry",
45258
46929
  capScope: "system",
@@ -46693,6 +48364,12 @@ Object.freeze({
46693
48364
  addonId: null,
46694
48365
  access: "view"
46695
48366
  },
48367
+ "keychainAdmin.acknowledgeReset": {
48368
+ capName: "keychain-admin",
48369
+ capScope: "system",
48370
+ addonId: null,
48371
+ access: "create"
48372
+ },
46696
48373
  "keychainAdmin.deleteOrphans": {
46697
48374
  capName: "keychain-admin",
46698
48375
  capScope: "system",
@@ -46729,6 +48406,12 @@ Object.freeze({
46729
48406
  addonId: null,
46730
48407
  access: "delete"
46731
48408
  },
48409
+ "keychainAdmin.resetReport": {
48410
+ capName: "keychain-admin",
48411
+ capScope: "system",
48412
+ addonId: null,
48413
+ access: "delete"
48414
+ },
46732
48415
  "keychainAdmin.reveal": {
46733
48416
  capName: "keychain-admin",
46734
48417
  capScope: "system",
@@ -46741,6 +48424,12 @@ Object.freeze({
46741
48424
  addonId: null,
46742
48425
  access: "create"
46743
48426
  },
48427
+ "keychainAdmin.setSystemSecret": {
48428
+ capName: "keychain-admin",
48429
+ capScope: "system",
48430
+ addonId: null,
48431
+ access: "create"
48432
+ },
46744
48433
  "keychainAdmin.status": {
46745
48434
  capName: "keychain-admin",
46746
48435
  capScope: "system",
@@ -47977,6 +49666,36 @@ Object.freeze({
47977
49666
  addonId: null,
47978
49667
  access: "view"
47979
49668
  },
49669
+ "oidcConnections.connectionFormSchema": {
49670
+ capName: "oidc-connections",
49671
+ capScope: "system",
49672
+ addonId: null,
49673
+ access: "view"
49674
+ },
49675
+ "oidcConnections.createConnection": {
49676
+ capName: "oidc-connections",
49677
+ capScope: "system",
49678
+ addonId: null,
49679
+ access: "create"
49680
+ },
49681
+ "oidcConnections.deleteConnection": {
49682
+ capName: "oidc-connections",
49683
+ capScope: "system",
49684
+ addonId: null,
49685
+ access: "delete"
49686
+ },
49687
+ "oidcConnections.listConnections": {
49688
+ capName: "oidc-connections",
49689
+ capScope: "system",
49690
+ addonId: null,
49691
+ access: "view"
49692
+ },
49693
+ "oidcConnections.updateConnection": {
49694
+ capName: "oidc-connections",
49695
+ capScope: "system",
49696
+ addonId: null,
49697
+ access: "create"
49698
+ },
47980
49699
  "osd.getStatus": {
47981
49700
  capName: "osd",
47982
49701
  capScope: "device",
@@ -48049,6 +49768,12 @@ Object.freeze({
48049
49768
  addonId: null,
48050
49769
  access: "create"
48051
49770
  },
49771
+ "osdManager.setSlotCameraEnabled": {
49772
+ capName: "osd-manager",
49773
+ capScope: "system",
49774
+ addonId: null,
49775
+ access: "create"
49776
+ },
48052
49777
  "osdManager.upsertTemplate": {
48053
49778
  capName: "osd-manager",
48054
49779
  capScope: "system",
@@ -48301,6 +50026,12 @@ Object.freeze({
48301
50026
  addonId: null,
48302
50027
  access: "view"
48303
50028
  },
50029
+ "pipelineAnalytics.getRetrainCorpusKpi": {
50030
+ capName: "pipeline-analytics",
50031
+ capScope: "device",
50032
+ addonId: null,
50033
+ access: "view"
50034
+ },
48304
50035
  "pipelineAnalytics.getRetrainExportUrl": {
48305
50036
  capName: "pipeline-analytics",
48306
50037
  capScope: "device",
@@ -48421,6 +50152,12 @@ Object.freeze({
48421
50152
  addonId: null,
48422
50153
  access: "view"
48423
50154
  },
50155
+ "pipelineAnalytics.listRetrainCorpusPage": {
50156
+ capName: "pipeline-analytics",
50157
+ capScope: "device",
50158
+ addonId: null,
50159
+ access: "view"
50160
+ },
48424
50161
  "pipelineAnalytics.listRetrainFrames": {
48425
50162
  capName: "pipeline-analytics",
48426
50163
  capScope: "device",
@@ -48451,6 +50188,12 @@ Object.freeze({
48451
50188
  addonId: null,
48452
50189
  access: "view"
48453
50190
  },
50191
+ "pipelineAnalytics.offerRetrainArchive": {
50192
+ capName: "pipeline-analytics",
50193
+ capScope: "device",
50194
+ addonId: null,
50195
+ access: "create"
50196
+ },
48454
50197
  "pipelineAnalytics.ownersWithMedia": {
48455
50198
  capName: "pipeline-analytics",
48456
50199
  capScope: "device",
@@ -48541,6 +50284,12 @@ Object.freeze({
48541
50284
  addonId: null,
48542
50285
  access: "create"
48543
50286
  },
50287
+ "pipelineAnalytics.resolveRetrainTrainingCorpus": {
50288
+ capName: "pipeline-analytics",
50289
+ capScope: "device",
50290
+ addonId: null,
50291
+ access: "view"
50292
+ },
48544
50293
  "pipelineAnalytics.restageRetrainTrack": {
48545
50294
  capName: "pipeline-analytics",
48546
50295
  capScope: "device",
@@ -50977,6 +52726,180 @@ Object.freeze({
50977
52726
  addonId: null,
50978
52727
  access: "view"
50979
52728
  },
52729
+ "training.canaryResult": {
52730
+ capName: "training",
52731
+ capScope: "system",
52732
+ addonId: null,
52733
+ access: "create"
52734
+ },
52735
+ "training.cancelJob": {
52736
+ capName: "training",
52737
+ capScope: "system",
52738
+ addonId: null,
52739
+ access: "create"
52740
+ },
52741
+ "training.discardResult": {
52742
+ capName: "training",
52743
+ capScope: "system",
52744
+ addonId: null,
52745
+ access: "create"
52746
+ },
52747
+ "training.getJob": {
52748
+ capName: "training",
52749
+ capScope: "system",
52750
+ addonId: null,
52751
+ access: "view"
52752
+ },
52753
+ "training.getJobResult": {
52754
+ capName: "training",
52755
+ capScope: "system",
52756
+ addonId: null,
52757
+ access: "view"
52758
+ },
52759
+ "training.listBaseModels": {
52760
+ capName: "training",
52761
+ capScope: "system",
52762
+ addonId: null,
52763
+ access: "view"
52764
+ },
52765
+ "training.listJobs": {
52766
+ capName: "training",
52767
+ capScope: "system",
52768
+ addonId: null,
52769
+ access: "view"
52770
+ },
52771
+ "training.planJob": {
52772
+ capName: "training",
52773
+ capScope: "system",
52774
+ addonId: null,
52775
+ access: "view"
52776
+ },
52777
+ "training.registerResult": {
52778
+ capName: "training",
52779
+ capScope: "system",
52780
+ addonId: null,
52781
+ access: "create"
52782
+ },
52783
+ "training.rollbackCanary": {
52784
+ capName: "training",
52785
+ capScope: "system",
52786
+ addonId: null,
52787
+ access: "create"
52788
+ },
52789
+ "training.startJob": {
52790
+ capName: "training",
52791
+ capScope: "system",
52792
+ addonId: null,
52793
+ access: "create"
52794
+ },
52795
+ "training.startJobBatch": {
52796
+ capName: "training",
52797
+ capScope: "system",
52798
+ addonId: null,
52799
+ access: "create"
52800
+ },
52801
+ "trainingProvider.cancelJob": {
52802
+ capName: "training-provider",
52803
+ capScope: "system",
52804
+ addonId: null,
52805
+ access: "create"
52806
+ },
52807
+ "trainingProvider.cleanupJob": {
52808
+ capName: "training-provider",
52809
+ capScope: "system",
52810
+ addonId: null,
52811
+ access: "create"
52812
+ },
52813
+ "trainingProvider.createEntry": {
52814
+ capName: "training-provider",
52815
+ capScope: "system",
52816
+ addonId: null,
52817
+ access: "create"
52818
+ },
52819
+ "trainingProvider.deleteEntry": {
52820
+ capName: "training-provider",
52821
+ capScope: "system",
52822
+ addonId: null,
52823
+ access: "delete"
52824
+ },
52825
+ "trainingProvider.describe": {
52826
+ capName: "training-provider",
52827
+ capScope: "system",
52828
+ addonId: null,
52829
+ access: "view"
52830
+ },
52831
+ "trainingProvider.describeTypes": {
52832
+ capName: "training-provider",
52833
+ capScope: "system",
52834
+ addonId: null,
52835
+ access: "view"
52836
+ },
52837
+ "trainingProvider.estimateJob": {
52838
+ capName: "training-provider",
52839
+ capScope: "system",
52840
+ addonId: null,
52841
+ access: "view"
52842
+ },
52843
+ "trainingProvider.getJob": {
52844
+ capName: "training-provider",
52845
+ capScope: "system",
52846
+ addonId: null,
52847
+ access: "view"
52848
+ },
52849
+ "trainingProvider.listEntries": {
52850
+ capName: "training-provider",
52851
+ capScope: "system",
52852
+ addonId: null,
52853
+ access: "view"
52854
+ },
52855
+ "trainingProvider.listJobEvents": {
52856
+ capName: "training-provider",
52857
+ capScope: "system",
52858
+ addonId: null,
52859
+ access: "view"
52860
+ },
52861
+ "trainingProvider.listJobs": {
52862
+ capName: "training-provider",
52863
+ capScope: "system",
52864
+ addonId: null,
52865
+ access: "view"
52866
+ },
52867
+ "trainingProvider.offerArtifact": {
52868
+ capName: "training-provider",
52869
+ capScope: "system",
52870
+ addonId: null,
52871
+ access: "create"
52872
+ },
52873
+ "trainingProvider.readResult": {
52874
+ capName: "training-provider",
52875
+ capScope: "system",
52876
+ addonId: null,
52877
+ access: "create"
52878
+ },
52879
+ "trainingProvider.submitJob": {
52880
+ capName: "training-provider",
52881
+ capScope: "system",
52882
+ addonId: null,
52883
+ access: "create"
52884
+ },
52885
+ "trainingProvider.updateEntry": {
52886
+ capName: "training-provider",
52887
+ capScope: "system",
52888
+ addonId: null,
52889
+ access: "create"
52890
+ },
52891
+ "trainingProvider.uploadDataset": {
52892
+ capName: "training-provider",
52893
+ capScope: "system",
52894
+ addonId: null,
52895
+ access: "create"
52896
+ },
52897
+ "trainingProvider.validateCredentials": {
52898
+ capName: "training-provider",
52899
+ capScope: "system",
52900
+ addonId: null,
52901
+ access: "create"
52902
+ },
50980
52903
  "turnProvider.getTurnServers": {
50981
52904
  capName: "turn-provider",
50982
52905
  capScope: "system",
@@ -51001,12 +52924,6 @@ Object.freeze({
51001
52924
  addonId: null,
51002
52925
  access: "create"
51003
52926
  },
51004
- "userManagement.createApiKey": {
51005
- capName: "user-management",
51006
- capScope: "system",
51007
- addonId: null,
51008
- access: "create"
51009
- },
51010
52927
  "userManagement.createScopedToken": {
51011
52928
  capName: "user-management",
51012
52929
  capScope: "system",
@@ -51043,12 +52960,6 @@ Object.freeze({
51043
52960
  addonId: null,
51044
52961
  access: "view"
51045
52962
  },
51046
- "userManagement.linkExternalIdentity": {
51047
- capName: "user-management",
51048
- capScope: "system",
51049
- addonId: null,
51050
- access: "create"
51051
- },
51052
52963
  "userManagement.listApiKeys": {
51053
52964
  capName: "user-management",
51054
52965
  capScope: "system",
@@ -51151,12 +53062,6 @@ Object.freeze({
51151
53062
  addonId: null,
51152
53063
  access: "create"
51153
53064
  },
51154
- "userManagement.validateApiKey": {
51155
- capName: "user-management",
51156
- capScope: "system",
51157
- addonId: null,
51158
- access: "view"
51159
- },
51160
53065
  "userManagement.validateCredentials": {
51161
53066
  capName: "user-management",
51162
53067
  capScope: "system",
@@ -54395,6 +56300,11 @@ Object.freeze({
54395
56300
  form: "single",
54396
56301
  optional: false
54397
56302
  }],
56303
+ "osdManager.setSlotCameraEnabled": [{
56304
+ name: "deviceId",
56305
+ form: "single",
56306
+ optional: false
56307
+ }],
54398
56308
  "petFeeder.callPet": [{
54399
56309
  name: "deviceId",
54400
56310
  form: "single",
@@ -54615,6 +56525,11 @@ Object.freeze({
54615
56525
  form: "array",
54616
56526
  optional: false
54617
56527
  }],
56528
+ "pipelineAnalytics.listRetrainCorpusPage": [{
56529
+ name: "deviceIds",
56530
+ form: "array",
56531
+ optional: true
56532
+ }],
54618
56533
  "pipelineAnalytics.listRetrainStaging": [{
54619
56534
  name: "deviceIds",
54620
56535
  form: "array",
@@ -55476,6 +57391,11 @@ Object.freeze({
55476
57391
  form: "single",
55477
57392
  optional: false
55478
57393
  }],
57394
+ "training.canaryResult": [{
57395
+ name: "deviceIds",
57396
+ form: "array",
57397
+ optional: false
57398
+ }],
55479
57399
  "update.getStatus": [{
55480
57400
  name: "deviceId",
55481
57401
  form: "single",
@@ -55719,6 +57639,7 @@ Object.freeze({
55719
57639
  });
55720
57640
  Object.freeze({
55721
57641
  "broker": "broker",
57642
+ "calendar-source": "calendar",
55722
57643
  "device-export": "device-export",
55723
57644
  "llm": "ai",
55724
57645
  "mesh-network": "mesh",
@@ -56204,6 +58125,8 @@ var STATE_SUMMARY_VARS = [
56204
58125
  [...RULE_TEXT],
56205
58126
  [...RULE_TEXT],
56206
58127
  [...RULE_TEXT],
58128
+ [...RULE_TEXT],
58129
+ [...RULE_TEXT],
56207
58130
  ([...RULE_TEXT], [...UPDATES]),
56208
58131
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
56209
58132
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),