@camstack/addon-provider-dreo 0.2.123 → 0.2.125

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.mjs CHANGED
@@ -5414,7 +5414,7 @@ var ZodIssueCode = {
5414
5414
  var ZodFirstPartyTypeKind;
5415
5415
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5416
5416
  //#endregion
5417
- //#region ../types/dist/sleep-Cr5YOk3m.mjs
5417
+ //#region ../types/dist/sleep-DwAQ9sqX.mjs
5418
5418
  /**
5419
5419
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5420
5420
  * window to float samples (D455).
@@ -5531,7 +5531,7 @@ function isKeychainStoredField(field) {
5531
5531
  var SECRET_CLEAR = { $secretClear: true };
5532
5532
  /** The `'***'` token D634 redaction writes for non-admins. */
5533
5533
  var LEGACY_DEVICE_REDACTION = "***";
5534
- function isRecord$1(value) {
5534
+ function isRecord$2(value) {
5535
5535
  return typeof value === "object" && value !== null && !Array.isArray(value);
5536
5536
  }
5537
5537
  function makeSecretMarker(ref) {
@@ -5542,12 +5542,12 @@ function makeSecretMarker(ref) {
5542
5542
  }
5543
5543
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5544
5544
  function isSecretMarker(value) {
5545
- if (!isRecord$1(value)) return false;
5545
+ if (!isRecord$2(value)) return false;
5546
5546
  const ref = value["$secret"];
5547
5547
  return typeof ref === "string" && ref.length > 0;
5548
5548
  }
5549
5549
  function isSecretClear(value) {
5550
- return isRecord$1(value) && value["$secretClear"] === true;
5550
+ return isRecord$2(value) && value["$secretClear"] === true;
5551
5551
  }
5552
5552
  /**
5553
5553
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6063,6 +6063,13 @@ function globalSecretScope() {
6063
6063
  function encodeSegment(value) {
6064
6064
  return encodeURIComponent(value);
6065
6065
  }
6066
+ function decodeSegment(value) {
6067
+ try {
6068
+ return decodeURIComponent(value);
6069
+ } catch {
6070
+ return null;
6071
+ }
6072
+ }
6066
6073
  /**
6067
6074
  * The field path of a value inside an array item, addressed by the item's id:
6068
6075
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6071,6 +6078,75 @@ function encodeSegment(value) {
6071
6078
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6072
6079
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6073
6080
  }
6081
+ function parseScope(segments) {
6082
+ switch (segments[0]) {
6083
+ case "global": return {
6084
+ scope: GLOBAL_SCOPE,
6085
+ used: 1
6086
+ };
6087
+ case "node": {
6088
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6089
+ return nodeId === null || nodeId.length === 0 ? null : {
6090
+ scope: {
6091
+ kind: "node",
6092
+ nodeId
6093
+ },
6094
+ used: 2
6095
+ };
6096
+ }
6097
+ case "device": {
6098
+ const raw = segments[1];
6099
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6100
+ return {
6101
+ scope: {
6102
+ kind: "device",
6103
+ deviceId: Number(raw)
6104
+ },
6105
+ used: 2
6106
+ };
6107
+ }
6108
+ case "integration": {
6109
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6110
+ return id === null || id.length === 0 ? null : {
6111
+ scope: {
6112
+ kind: "integration",
6113
+ integrationId: id
6114
+ },
6115
+ used: 2
6116
+ };
6117
+ }
6118
+ case "row": {
6119
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6120
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6121
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6122
+ return {
6123
+ scope: {
6124
+ kind: "row",
6125
+ collection,
6126
+ rowId
6127
+ },
6128
+ used: 3
6129
+ };
6130
+ }
6131
+ default: return null;
6132
+ }
6133
+ }
6134
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6135
+ function parseSecretRef(ref) {
6136
+ if (!ref.startsWith("secret://")) return null;
6137
+ const segments = ref.slice(9).split("/");
6138
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6139
+ if (owner === null || owner.length === 0) return null;
6140
+ const parsed = parseScope(segments.slice(1));
6141
+ if (parsed === null) return null;
6142
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6143
+ if (fieldPath.length === 0) return null;
6144
+ return {
6145
+ owner,
6146
+ scope: parsed.scope,
6147
+ fieldPath
6148
+ };
6149
+ }
6074
6150
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6075
6151
  var KeychainWriteRefusedError = class extends Error {
6076
6152
  fieldPath;
@@ -6081,7 +6157,7 @@ var KeychainWriteRefusedError = class extends Error {
6081
6157
  }
6082
6158
  };
6083
6159
  var KEEP = { kind: "keep" };
6084
- function isRecord(value) {
6160
+ function isRecord$1(value) {
6085
6161
  return typeof value === "object" && value !== null && !Array.isArray(value);
6086
6162
  }
6087
6163
  function defaultMintId() {
@@ -6094,7 +6170,7 @@ function collectSecretMarkerRefs(value, out = []) {
6094
6170
  return out;
6095
6171
  }
6096
6172
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6097
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6173
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6098
6174
  return out;
6099
6175
  }
6100
6176
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6149,7 +6225,7 @@ function rowId(row, idKey) {
6149
6225
  return null;
6150
6226
  }
6151
6227
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6152
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6228
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6153
6229
  if (!Array.isArray(incoming)) {
6154
6230
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6155
6231
  return {
@@ -6165,7 +6241,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6165
6241
  const kept = /* @__PURE__ */ new Set();
6166
6242
  const rows = [];
6167
6243
  for (const row of incoming) {
6168
- if (!isRecord(row)) {
6244
+ if (!isRecord$1(row)) {
6169
6245
  rows.push(row);
6170
6246
  continue;
6171
6247
  }
@@ -6190,7 +6266,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6190
6266
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6191
6267
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6192
6268
  case "object": {
6193
- if (!isRecord(incoming)) {
6269
+ if (!isRecord$1(incoming)) {
6194
6270
  if (incoming === void 0) return KEEP;
6195
6271
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6196
6272
  return {
@@ -6198,7 +6274,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6198
6274
  value: incoming
6199
6275
  };
6200
6276
  }
6201
- const storedObj = isRecord(stored) ? stored : {};
6277
+ const storedObj = isRecord$1(stored) ? stored : {};
6202
6278
  return {
6203
6279
  kind: "value",
6204
6280
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6257,12 +6333,19 @@ async function transformSecretWrite(input) {
6257
6333
  }
6258
6334
  };
6259
6335
  }
6336
+ /** Is `ref` one of `owner`'s refs? */
6337
+ function isSecretRefOwnedBy(ref, owner) {
6338
+ return parseSecretRef(ref)?.owner === owner;
6339
+ }
6260
6340
  /**
6261
6341
  * Replace every marker in `value` with its keychain value. Returns the SAME
6262
6342
  * reference when there is no marker (no allocation, no keychain call).
6263
6343
  */
6264
- async function resolveSecretMarkers(value, secrets) {
6265
- const refs = collectSecretMarkerRefs(value);
6344
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6345
+ const keepMarker = options.unresolved === "keep-marker";
6346
+ const owner = options.ownedBy;
6347
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6348
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6266
6349
  if (refs.length === 0) return {
6267
6350
  value,
6268
6351
  unresolved: []
@@ -6286,10 +6369,18 @@ async function resolveSecretMarkers(value, secrets) {
6286
6369
  }
6287
6370
  const substitute = (v) => {
6288
6371
  if (isSecretMarker(v)) {
6372
+ if (!inScope(v.$secret)) return {
6373
+ keep: true,
6374
+ value: v
6375
+ };
6289
6376
  const answer = answers[v.$secret];
6290
- return answer?.kind === "value" ? {
6377
+ if (answer?.kind === "value") return {
6291
6378
  keep: true,
6292
6379
  value: answer.value
6380
+ };
6381
+ return keepMarker ? {
6382
+ keep: true,
6383
+ value: v
6293
6384
  } : {
6294
6385
  keep: false,
6295
6386
  value: void 0
@@ -6306,7 +6397,7 @@ async function resolveSecretMarkers(value, secrets) {
6306
6397
  value: items
6307
6398
  };
6308
6399
  }
6309
- if (isRecord(v)) {
6400
+ if (isRecord$1(v)) {
6310
6401
  const out = {};
6311
6402
  for (const [k, child] of Object.entries(v)) {
6312
6403
  const s = substitute(child);
@@ -6327,14 +6418,152 @@ async function resolveSecretMarkers(value, secrets) {
6327
6418
  unresolved
6328
6419
  };
6329
6420
  }
6330
- function touchesTree(tree, patch) {
6331
- if (tree.size === 0) return false;
6332
- for (const key of Object.keys(patch)) {
6333
- const at = key.indexOf("@");
6334
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6421
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6422
+ var SecretOverwriteRefusedError = class extends Error {
6423
+ ref;
6424
+ reason;
6425
+ constructor(ref, reason) {
6426
+ 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.`);
6427
+ this.ref = ref;
6428
+ this.reason = reason;
6429
+ this.name = "SecretOverwriteRefusedError";
6430
+ }
6431
+ };
6432
+ function isRecord(value) {
6433
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6434
+ }
6435
+ function resolvedValue(pass, marker) {
6436
+ const answer = pass.answers[marker.$secret];
6437
+ return answer?.kind === "value" ? answer.value : null;
6438
+ }
6439
+ async function atMarker(pass, incoming, stored) {
6440
+ if (incoming === null) return stored;
6441
+ if (typeof incoming !== "string") return incoming;
6442
+ if (incoming === resolvedValue(pass, stored)) return stored;
6443
+ const intent = classifySecretWrite(incoming);
6444
+ if (intent.kind !== "set") return stored;
6445
+ const ref = stored.$secret;
6446
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6447
+ const answer = pass.answers[ref];
6448
+ 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);
6449
+ try {
6450
+ await pass.secrets.put(ref, intent.value);
6451
+ } catch (err) {
6452
+ throw new KeychainWriteRefusedError(ref, err);
6453
+ }
6454
+ pass.changedRefs.push(ref);
6455
+ return stored;
6456
+ }
6457
+ function inArray(pass, incoming, stored) {
6458
+ return incoming.map((item, index) => {
6459
+ const twin = stored[index];
6460
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6461
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6462
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6463
+ return item;
6464
+ });
6465
+ }
6466
+ function inArrayRow(pass, incoming, stored) {
6467
+ const out = { ...incoming };
6468
+ for (const [key, value] of Object.entries(incoming)) {
6469
+ const twin = stored[key];
6470
+ if (isSecretMarker(twin)) {
6471
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6472
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6473
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6474
+ }
6475
+ return out;
6476
+ }
6477
+ async function walk(pass, incoming, stored) {
6478
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6479
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6480
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6481
+ const out = { ...incoming };
6482
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6483
+ return out;
6484
+ }
6485
+ /** Restore markers a write-back carries as values. See the file doc. */
6486
+ async function restoreUnchangedSecrets(input) {
6487
+ const refs = [];
6488
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6489
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6490
+ if (owned.length === 0) return {
6491
+ patch: input.patch,
6492
+ changedRefs: []
6493
+ };
6494
+ const pass = {
6495
+ secrets: input.secrets,
6496
+ answers: await input.secrets.resolve([...new Set(owned)]),
6497
+ operatorWrite: input.operatorWrite,
6498
+ changedRefs: []
6499
+ };
6500
+ const out = {};
6501
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6502
+ return {
6503
+ patch: out,
6504
+ changedRefs: pass.changedRefs
6505
+ };
6506
+ }
6507
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6508
+ function isJsonEqual(a, b) {
6509
+ if (Object.is(a, b)) return true;
6510
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6511
+ if (isRecord(a) && isRecord(b)) {
6512
+ const keys = Object.keys(a);
6513
+ if (keys.length !== Object.keys(b).length) return false;
6514
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6335
6515
  }
6336
6516
  return false;
6337
6517
  }
6518
+ /** The patch without the keys whose value already equals the stored one. */
6519
+ function dropUnchangedKeys(patch, stored) {
6520
+ const out = {};
6521
+ for (const [key, value] of Object.entries(patch)) {
6522
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6523
+ out[key] = value;
6524
+ }
6525
+ return out;
6526
+ }
6527
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6528
+ function markerKeysOf(blob, owner) {
6529
+ const keys = /* @__PURE__ */ new Set();
6530
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6531
+ return keys;
6532
+ }
6533
+ function nodeFromStored(value, owner) {
6534
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6535
+ if (!isRecord(value)) return null;
6536
+ const children = /* @__PURE__ */ new Map();
6537
+ for (const [key, child] of Object.entries(value)) {
6538
+ const node = nodeFromStored(child, owner);
6539
+ if (node !== null) children.set(key, node);
6540
+ }
6541
+ return children.size > 0 ? {
6542
+ kind: "object",
6543
+ children
6544
+ } : null;
6545
+ }
6546
+ /**
6547
+ * The declared secret tree, widened by every place the STORED blob holds a
6548
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6549
+ * never declared: Wyze before b4906cec6) still gets the save path's
6550
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6551
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6552
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6553
+ * builtin that keeps another addon's marker (device-manager) never takes it
6554
+ * over.
6555
+ */
6556
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6557
+ const added = /* @__PURE__ */ new Map();
6558
+ for (const key of keys) {
6559
+ const at = key.indexOf("@");
6560
+ const base = at > 0 ? key.slice(0, at) : key;
6561
+ if (declared.has(base) || added.has(base)) continue;
6562
+ const node = nodeFromStored(stored[key], owner);
6563
+ if (node !== null) added.set(base, node);
6564
+ }
6565
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6566
+ }
6338
6567
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6339
6568
  async function readStoredAddonBlob(raw) {
6340
6569
  const threeWay = raw.readAddonStoreResult;
@@ -6343,7 +6572,41 @@ async function readStoredAddonBlob(raw) {
6343
6572
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6344
6573
  return result.kind === "missing" ? {} : result.value;
6345
6574
  }
6346
- function createSecretAwareSettings(raw, opts) {
6575
+ function touchesTree(tree, patch) {
6576
+ if (tree.size === 0) return false;
6577
+ for (const key of Object.keys(patch)) {
6578
+ const at = key.indexOf("@");
6579
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6580
+ }
6581
+ return false;
6582
+ }
6583
+ /**
6584
+ * Which top-level keys of each store held markers when last seen. `undefined`
6585
+ * for a store not seen yet: its first write reads it, to be safe.
6586
+ */
6587
+ var MarkerKeyIndex = class {
6588
+ owner;
6589
+ byStore = /* @__PURE__ */ new Map();
6590
+ constructor(owner) {
6591
+ this.owner = owner;
6592
+ }
6593
+ seen(store, blob) {
6594
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6595
+ }
6596
+ wrote(store, patch) {
6597
+ const keys = this.byStore.get(store);
6598
+ if (keys === void 0) return;
6599
+ const now = markerKeysOf(patch, this.owner);
6600
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6601
+ else keys.delete(key);
6602
+ }
6603
+ mayHoldMarkers(store, patch) {
6604
+ const keys = this.byStore.get(store);
6605
+ if (keys === void 0) return true;
6606
+ return Object.keys(patch).some((key) => keys.has(key));
6607
+ }
6608
+ };
6609
+ function createHandle(raw, opts) {
6347
6610
  const chains = /* @__PURE__ */ new Map();
6348
6611
  const serialize = (key, fn) => {
6349
6612
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6354,46 +6617,130 @@ function createSecretAwareSettings(raw, opts) {
6354
6617
  });
6355
6618
  return next;
6356
6619
  };
6357
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6358
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6359
- return serialize(chainKey, async () => {
6620
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6621
+ const resolveRead = async (store, blob) => {
6622
+ index.seen(store, blob);
6623
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6624
+ unresolved: "keep-marker",
6625
+ ownedBy: opts.secrets.owner
6626
+ });
6627
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6628
+ return value;
6629
+ };
6630
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6631
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6632
+ await rawWrite(patch);
6633
+ index.wrote(store, patch);
6634
+ return { changed: true };
6635
+ }
6636
+ return serialize(store, async () => {
6360
6637
  const stored = await readStored();
6638
+ index.seen(store, stored);
6639
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6640
+ const restored = await restoreUnchangedSecrets({
6641
+ patch,
6642
+ stored,
6643
+ secrets: opts.secrets,
6644
+ operatorWrite
6645
+ });
6361
6646
  const result = await transformSecretWrite({
6362
- tree,
6647
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6363
6648
  secrets: opts.secrets,
6364
- patch,
6649
+ patch: restored.patch,
6365
6650
  stored,
6366
6651
  ...scope !== void 0 ? { scope } : {},
6367
- operatorWrite: opts.isOperatorWrite?.() === true
6652
+ operatorWrite
6368
6653
  });
6369
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6654
+ const effective = dropUnchangedKeys(result.patch, stored);
6655
+ const wroteBlob = Object.keys(effective).length > 0;
6656
+ if (wroteBlob) {
6657
+ await rawWrite(effective);
6658
+ index.wrote(store, effective);
6659
+ }
6370
6660
  const { orphaned } = await result.afterWrite();
6371
6661
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6662
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6372
6663
  });
6373
6664
  };
6374
- const wrapped = {
6375
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6376
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6377
- kind: "device",
6378
- deviceId
6379
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6665
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6666
+ const readAddonStoreResult = raw.readAddonStoreResult;
6667
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6668
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6669
+ const overrides = {
6670
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6671
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6672
+ const result = await readAddonStoreResult.call(raw);
6673
+ return result.kind === "value" ? {
6674
+ kind: "value",
6675
+ value: await resolveRead("addon", result.value)
6676
+ } : result;
6677
+ } } : {},
6678
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6679
+ const result = await readAddonStoreKeyResult.call(raw, key);
6680
+ if (result.kind !== "present") return result;
6681
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6682
+ unresolved: "keep-marker",
6683
+ ownedBy: opts.secrets.owner
6684
+ });
6685
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6686
+ return {
6687
+ kind: "present",
6688
+ value: value[key]
6689
+ };
6690
+ } } : {},
6691
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6692
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6693
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6694
+ const out = /* @__PURE__ */ new Map();
6695
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6696
+ return out;
6697
+ } } : {},
6698
+ writeAddonStore: async (patch) => {
6699
+ await writeAddon(patch);
6700
+ },
6701
+ writeDeviceStore: async (deviceId, patch) => {
6702
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6703
+ kind: "device",
6704
+ deviceId
6705
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6706
+ }
6707
+ };
6708
+ return {
6709
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6710
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6711
+ const value = Reflect.get(target, prop, receiver);
6712
+ return typeof value === "function" ? value.bind(target) : value;
6713
+ } }),
6714
+ raw: {
6715
+ readAddonStore: async () => {
6716
+ const blob = await raw.readAddonStore();
6717
+ index.seen("addon", blob);
6718
+ return blob;
6719
+ },
6720
+ readDeviceStore: async (deviceId) => {
6721
+ const blob = await raw.readDeviceStore(deviceId);
6722
+ index.seen(`device:${deviceId}`, blob);
6723
+ return blob;
6724
+ }
6725
+ },
6726
+ writeAddonStore: writeAddon
6380
6727
  };
6381
- return new Proxy(raw, { get(target, prop, receiver) {
6382
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6383
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6384
- const value = Reflect.get(target, prop, receiver);
6385
- return typeof value === "function" ? value.bind(target) : value;
6386
- } });
6387
6728
  }
6388
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6389
- function withSecretAwareSettings(context, opts) {
6729
+ /** The context the addon sees, plus the private raw view and write outcome. */
6730
+ function createSecretAwareContext(context, opts) {
6390
6731
  const raw = context.settings;
6391
- if (raw === void 0) return context;
6392
- const settings = createSecretAwareSettings(raw, opts);
6393
- return new Proxy(context, { get(target, prop, receiver) {
6394
- if (prop === "settings") return settings;
6395
- return Reflect.get(target, prop, receiver);
6396
- } });
6732
+ if (raw === void 0) return {
6733
+ context,
6734
+ handle: null
6735
+ };
6736
+ const handle = createHandle(raw, opts);
6737
+ return {
6738
+ context: new Proxy(context, { get(target, prop, receiver) {
6739
+ if (prop === "settings") return handle.settings;
6740
+ return Reflect.get(target, prop, receiver);
6741
+ } }),
6742
+ handle
6743
+ };
6397
6744
  }
6398
6745
  var LEAF = { kind: "leaf" };
6399
6746
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6568,6 +6915,14 @@ var BaseAddon = class {
6568
6915
  _secretChangeUnsub = null;
6569
6916
  /** >0 while an OPERATOR's settings write is being applied. */
6570
6917
  _operatorWriteDepth = 0;
6918
+ /**
6919
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6920
+ * to the marker-bearing blobs and stays private to this class: the form
6921
+ * hydrate and config resolution need markers, addon code never does.
6922
+ */
6923
+ _secretSettings = null;
6924
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6925
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6571
6926
  constructor(defaults) {
6572
6927
  this.defaults = defaults;
6573
6928
  this._config = { ...defaults };
@@ -6604,13 +6959,21 @@ var BaseAddon = class {
6604
6959
  }
6605
6960
  async initialize(context) {
6606
6961
  const secrets = context.secrets;
6607
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6608
- secrets,
6609
- addonTree: () => this.addonSecretTree(),
6610
- deviceTree: () => this.deviceSecretTree(),
6611
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6612
- isOperatorWrite: () => this._operatorWriteDepth > 0
6613
- }) : context;
6962
+ if (secrets !== void 0) {
6963
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6964
+ secrets,
6965
+ addonTree: () => this.addonSecretTree(),
6966
+ deviceTree: () => this.deviceSecretTree(),
6967
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6968
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6969
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6970
+ });
6971
+ this._ctx = wrapped;
6972
+ this._secretSettings = handle;
6973
+ } else {
6974
+ this._ctx = context;
6975
+ this._secretSettings = null;
6976
+ }
6614
6977
  await this.resolveConfig();
6615
6978
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6616
6979
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6727,11 +7090,8 @@ var BaseAddon = class {
6727
7090
  async getGlobalSettings(overlay, cap, nodeId) {
6728
7091
  const schema = this.globalSettingsSchema(cap);
6729
7092
  if (!schema) return { sections: [] };
6730
- const projected = await this.resolveGlobalStore(nodeId, cap);
6731
- return hydrateSchema(schema, overlay ? {
6732
- ...projected,
6733
- ...overlay
6734
- } : projected, { inlineSecretsAsViews: true });
7093
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7094
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6735
7095
  }
6736
7096
  /**
6737
7097
  * The integration-level view of this addon's settings: exactly the sections
@@ -6776,7 +7136,7 @@ var BaseAddon = class {
6776
7136
  });
6777
7137
  }
6778
7138
  if (sections.length === 0) return null;
6779
- const projected = await this.resolveGlobalStore(nodeId);
7139
+ const projected = await this.readRawProjectedStore(nodeId);
6780
7140
  return hydrateSchema({
6781
7141
  ...schema,
6782
7142
  sections
@@ -6793,12 +7153,50 @@ var BaseAddon = class {
6793
7153
  * the store for custom option logic (option narrowing, value snapping) to
6794
7154
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6795
7155
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7156
+ *
7157
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7158
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7159
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7160
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7161
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7162
+ * resolved blob back is a no-op for every unchanged secret.
6796
7163
  */
6797
7164
  async resolveGlobalStore(nodeId, cap) {
6798
7165
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7166
+ return this.projectForNode(raw, nodeId, cap);
7167
+ }
7168
+ projectForNode(store, nodeId, cap) {
6799
7169
  const keys = this.perNodeKeys(cap);
6800
7170
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6801
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7171
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7172
+ }
7173
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7174
+ async readRawProjectedStore(nodeId, cap) {
7175
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7176
+ return this.projectForNode(raw, nodeId, cap);
7177
+ }
7178
+ /**
7179
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7180
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7181
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7182
+ * its value.
7183
+ */
7184
+ async overlayKeepingMarkers(stored, overlay) {
7185
+ const secrets = this._ctx?.secrets;
7186
+ const merged = {
7187
+ ...stored,
7188
+ ...overlay
7189
+ };
7190
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7191
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7192
+ unresolved: "keep-marker",
7193
+ ownedBy: secrets.owner
7194
+ });
7195
+ for (const key of Object.keys(overlay)) {
7196
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7197
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7198
+ }
7199
+ return merged;
6802
7200
  }
6803
7201
  /**
6804
7202
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6863,8 +7261,12 @@ var BaseAddon = class {
6863
7261
  async clearSecrets(keys, nodeId) {
6864
7262
  const tree = this.addonSecretTree();
6865
7263
  const keychain = this._ctx?.secrets !== void 0;
7264
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6866
7265
  const patch = {};
6867
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7266
+ for (const key of keys) {
7267
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7268
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7269
+ }
6868
7270
  await this.applyGlobalPatch(patch, nodeId);
6869
7271
  }
6870
7272
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6872,7 +7274,11 @@ var BaseAddon = class {
6872
7274
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6873
7275
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6874
7276
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6875
- await this._ctx?.settings?.writeAddonStore(scoped);
7277
+ const handle = this._secretSettings;
7278
+ if (handle !== null) {
7279
+ const { changed } = await handle.writeAddonStore(scoped);
7280
+ if (!changed) return;
7281
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6876
7282
  if (target !== localNode) return;
6877
7283
  await this.resolveConfig();
6878
7284
  await this.onConfigChanged();
@@ -6925,7 +7331,7 @@ var BaseAddon = class {
6925
7331
  async getDeviceSettings(deviceId) {
6926
7332
  const schema = this.deviceSettingsSchema();
6927
7333
  if (!schema) return { sections: [] };
6928
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7334
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6929
7335
  }
6930
7336
  async updateDeviceSettings(deviceId, patch) {
6931
7337
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7097,7 +7503,7 @@ var BaseAddon = class {
7097
7503
  key,
7098
7504
  schema,
7099
7505
  fallback,
7100
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7506
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7101
7507
  write: async (patch) => {
7102
7508
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7103
7509
  },
@@ -7159,6 +7565,23 @@ var BaseAddon = class {
7159
7565
  }
7160
7566
  return value;
7161
7567
  }
7568
+ /**
7569
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7570
+ * keychain the context's own view is already raw.
7571
+ */
7572
+ rawSettings() {
7573
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7574
+ }
7575
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7576
+ logUnresolvedRead(unresolved) {
7577
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7578
+ if (fresh.length === 0) return;
7579
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7580
+ 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) => ({
7581
+ ref: u.ref,
7582
+ reason: u.reason
7583
+ })) } });
7584
+ }
7162
7585
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7163
7586
  scheduleSecretReresolve(delayMs) {
7164
7587
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7185,7 +7608,7 @@ var BaseAddon = class {
7185
7608
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7186
7609
  */
7187
7610
  async readAddonStoreWithRetry() {
7188
- const settings = this._ctx?.settings;
7611
+ const settings = this.rawSettings();
7189
7612
  if (!settings) return {};
7190
7613
  const delaysMs = [
7191
7614
  150,
@@ -8997,6 +9420,16 @@ var CompositionSchema = object({
8997
9420
  seen.add(feature.cap);
8998
9421
  });
8999
9422
  });
9423
+ var NodeColorIdSchema = _enum([
9424
+ "node-a",
9425
+ "node-b",
9426
+ "node-c",
9427
+ "node-d",
9428
+ "node-e",
9429
+ "node-f",
9430
+ "node-g",
9431
+ "node-h"
9432
+ ]);
9000
9433
  new Set([
9001
9434
  "track",
9002
9435
  "face",
@@ -9488,6 +9921,278 @@ var CameraSwitchGroupSchema = object({
9488
9921
  fetchedAt: number()
9489
9922
  });
9490
9923
  /**
9924
+ * The trainer contract — what the hub hands the cloud trainer and what it
9925
+ * gets back (cloud training, D805+).
9926
+ *
9927
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
9928
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
9929
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
9930
+ * lines on stdout. These schemas are the hub's half of that boundary; the
9931
+ * trainer's pydantic models (and the JSON Schemas generated from them under
9932
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
9933
+ * change there, in the same piece of work.
9934
+ *
9935
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
9936
+ * orchestrator fills every field of a job spec explicitly.
9937
+ */
9938
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
9939
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
9940
+ /** What the trainer can export. Edge TPU is a later, separate image. */
9941
+ var TrainingExportSchema = _enum([
9942
+ "onnx",
9943
+ "openvino-fp16",
9944
+ "openvino-int8",
9945
+ "coreml-fp16"
9946
+ ]);
9947
+ var FloorsSchema = record(string(), number().min(0).max(1));
9948
+ object({
9949
+ schema: literal(TRAINING_JOB_SCHEMA),
9950
+ jobKey: string().uuid(),
9951
+ target: object({
9952
+ kind: literal("detector"),
9953
+ step: literal("object-detection")
9954
+ }),
9955
+ base: object({
9956
+ modelId: string().min(1),
9957
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
9958
+ weights: string().min(1),
9959
+ imgsz: number().int().positive()
9960
+ }),
9961
+ baseline: object({
9962
+ modelId: string().min(1),
9963
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
9964
+ onnxUrl: string().url(),
9965
+ imgsz: number().int().positive(),
9966
+ floors: FloorsSchema
9967
+ }),
9968
+ dataset: object({
9969
+ versionId: string().min(1),
9970
+ annotationHash: string(),
9971
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
9972
+ sha256: string().regex(/^[0-9a-f]{64}$/)
9973
+ }),
9974
+ split: object({
9975
+ holdoutCameras: array(number().int()),
9976
+ /** When no camera is held out: the last N days of every camera. */
9977
+ holdoutLastDays: number().int().nonnegative(),
9978
+ valFraction: number().min(0).max(.5),
9979
+ seed: number().int()
9980
+ }),
9981
+ hyper: object({
9982
+ epochs: number().int().positive(),
9983
+ batch: number().int().positive(),
9984
+ lr0: number().positive(),
9985
+ /** Layers frozen from the start of the backbone; 0 = none. */
9986
+ freeze: number().int().nonnegative(),
9987
+ patience: number().int().nonnegative(),
9988
+ seed: number().int()
9989
+ }),
9990
+ replay: object({
9991
+ source: literal("coco2017"),
9992
+ count: number().int().nonnegative()
9993
+ }),
9994
+ exports: array(TrainingExportSchema).min(1),
9995
+ calibration: object({ maxFrames: number().int().positive() }),
9996
+ floors: object({
9997
+ minSupport: number().int().positive(),
9998
+ clamp: number().min(0).max(1)
9999
+ }),
10000
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
10001
+ catalog: object({
10002
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
10003
+ name: string().min(1).max(160)
10004
+ })
10005
+ });
10006
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
10007
+ var TrainingResultFileSchema = object({
10008
+ path: string().min(1),
10009
+ bytes: number().int().nonnegative(),
10010
+ sha256: string().regex(/^[0-9a-f]{64}$/),
10011
+ format: _enum([
10012
+ "onnx",
10013
+ "openvino",
10014
+ "coreml",
10015
+ "pt"
10016
+ ]),
10017
+ variant: _enum(["base", "int8"])
10018
+ });
10019
+ var DraftFormatSchema = object({
10020
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
10021
+ url: string().min(1),
10022
+ sizeMB: number().nonnegative(),
10023
+ isDirectory: boolean().optional(),
10024
+ files: array(string()).optional(),
10025
+ runtimes: array(literal("python")).optional(),
10026
+ revision: string().min(1)
10027
+ });
10028
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
10029
+ var TrainingCatalogDraftSchema = object({
10030
+ id: string().min(1),
10031
+ name: string().min(1),
10032
+ description: string(),
10033
+ labels: array(unknown()),
10034
+ inputSize: object({
10035
+ width: number().int().positive(),
10036
+ height: number().int().positive()
10037
+ }),
10038
+ preprocessMode: literal("letterbox"),
10039
+ defaultClassFloors: FloorsSchema,
10040
+ formats: object({
10041
+ onnx: DraftFormatSchema.optional(),
10042
+ openvino: DraftFormatSchema.optional(),
10043
+ coreml: DraftFormatSchema.optional()
10044
+ })
10045
+ });
10046
+ /** One class of one model's holdout report (the eval harness's summary). */
10047
+ var TrainingEvalClassSchema = object({
10048
+ positives: number().int(),
10049
+ floor: number().nullable(),
10050
+ tp: number().int(),
10051
+ fp: number().int(),
10052
+ fn: number().int(),
10053
+ precision: number().nullable(),
10054
+ recall: number().nullable(),
10055
+ ap50: number().nullable(),
10056
+ recallByCamera: record(string(), number().nullable()).optional(),
10057
+ recallByLight: record(string(), number().nullable()).optional(),
10058
+ fpByCamera: record(string(), number()).optional(),
10059
+ smallFound: number().int().optional(),
10060
+ smallTotal: number().int().optional()
10061
+ }).passthrough();
10062
+ var TrainingEvalReportSchema = object({
10063
+ frames: number().int(),
10064
+ classes: record(string(), TrainingEvalClassSchema)
10065
+ }).passthrough();
10066
+ /**
10067
+ * A succeeded result carries every block; a failed one carries the error and
10068
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10069
+ * orchestrator checks the blocks it needs before it trusts a success.
10070
+ */
10071
+ var TrainingResultSchema = object({
10072
+ schema: literal(TRAINING_RESULT_SCHEMA),
10073
+ jobKey: string(),
10074
+ status: _enum(["succeeded", "failed"]),
10075
+ error: object({
10076
+ stage: string(),
10077
+ code: string(),
10078
+ message: string()
10079
+ }).nullable(),
10080
+ trainer: object({
10081
+ version: string(),
10082
+ revision: string()
10083
+ }),
10084
+ toolchain: record(string(), string().nullable()),
10085
+ dataset: object({
10086
+ versionId: string(),
10087
+ annotationHash: string(),
10088
+ sha256: string(),
10089
+ frames: object({
10090
+ train: number().int(),
10091
+ val: number().int(),
10092
+ holdout: number().int()
10093
+ }),
10094
+ holdoutCameras: array(number().int()),
10095
+ replayImages: number().int()
10096
+ }).optional(),
10097
+ training: object({
10098
+ epochsRun: number().int(),
10099
+ bestEpoch: number().int(),
10100
+ bestMap50: number(),
10101
+ bestMap50_95: number(),
10102
+ seconds: number()
10103
+ }).optional(),
10104
+ evaluation: object({
10105
+ holdoutFrames: number().int(),
10106
+ baseline: TrainingEvalReportSchema.nullable(),
10107
+ candidate: TrainingEvalReportSchema.nullable(),
10108
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10109
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10110
+ map50: record(string(), number().nullable())
10111
+ }).optional(),
10112
+ floors: object({
10113
+ baseline: FloorsSchema,
10114
+ candidate: FloorsSchema,
10115
+ candidateInt8: FloorsSchema.nullable(),
10116
+ notes: array(string())
10117
+ }).optional(),
10118
+ int8: object({
10119
+ kept: boolean(),
10120
+ map50Fp16: number().nullable(),
10121
+ map50Int8: number().nullable(),
10122
+ reason: string().nullable()
10123
+ }).optional(),
10124
+ exportsDropped: array(object({
10125
+ export: string(),
10126
+ reason: string()
10127
+ })).optional(),
10128
+ files: array(TrainingResultFileSchema).optional(),
10129
+ bundle: object({
10130
+ path: literal("bundle.tar"),
10131
+ bytes: number().int().nonnegative(),
10132
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10133
+ }).nullable().optional(),
10134
+ catalogDraft: object({
10135
+ base: TrainingCatalogDraftSchema,
10136
+ int8: TrainingCatalogDraftSchema.nullable()
10137
+ }).nullable().optional(),
10138
+ licence: string()
10139
+ });
10140
+ var TrainingStageSchema = _enum([
10141
+ "prepare",
10142
+ "replay",
10143
+ "train",
10144
+ "eval",
10145
+ "export",
10146
+ "package"
10147
+ ]);
10148
+ var EventBase = {
10149
+ v: literal(1),
10150
+ ts: number()
10151
+ };
10152
+ discriminatedUnion("type", [
10153
+ object({
10154
+ ...EventBase,
10155
+ type: literal("stage"),
10156
+ stage: TrainingStageSchema
10157
+ }),
10158
+ object({
10159
+ ...EventBase,
10160
+ type: literal("epoch"),
10161
+ epoch: number().int(),
10162
+ epochs: number().int(),
10163
+ boxLoss: number().nullable().optional(),
10164
+ map50: number().nullable().optional(),
10165
+ map50_95: number().nullable().optional(),
10166
+ etaSec: number().nullable().optional()
10167
+ }),
10168
+ object({
10169
+ ...EventBase,
10170
+ type: literal("metric"),
10171
+ name: string(),
10172
+ value: number()
10173
+ }),
10174
+ object({
10175
+ ...EventBase,
10176
+ type: literal("artifact"),
10177
+ path: string(),
10178
+ bytes: number(),
10179
+ sha256: string()
10180
+ }),
10181
+ object({
10182
+ ...EventBase,
10183
+ type: literal("done"),
10184
+ status: _enum(["succeeded", "failed"]),
10185
+ resultSha256: string().nullable().optional()
10186
+ }),
10187
+ object({
10188
+ ...EventBase,
10189
+ type: literal("error"),
10190
+ stage: string(),
10191
+ code: string(),
10192
+ message: string()
10193
+ })
10194
+ ]);
10195
+ /**
9491
10196
  * What the gate decided about a birth, from the CALLER's point of view.
9492
10197
  *
9493
10198
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11815,7 +12520,9 @@ var AddonHttpRouteSchema = object({
11815
12520
  "authenticated",
11816
12521
  "admin"
11817
12522
  ]).optional(),
11818
- description: string().optional()
12523
+ description: string().optional(),
12524
+ /** The hub limits this route per client address before the handler runs. */
12525
+ rateLimit: _enum(["auth"]).optional()
11819
12526
  });
11820
12527
  /**
11821
12528
  * Cross-process route invocation envelope. The hub captures the
@@ -12520,6 +13227,37 @@ var BackupDestinationInfoSchema = object({
12520
13227
  lastError: string().optional()
12521
13228
  });
12522
13229
  /**
13230
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13231
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13232
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13233
+ * with it off — which restores without a key.
13234
+ */
13235
+ var BackupArchiveEncryptionSchema = object({
13236
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13237
+ scheme: string(),
13238
+ /** 16 hex — the backup key whose secret restores this archive. */
13239
+ keyId: string()
13240
+ });
13241
+ /**
13242
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13243
+ * one new archives are encrypted to, and the retired ones older archives
13244
+ * still need. The secret key is shown once, at `setupEncryption`.
13245
+ */
13246
+ var BackupEncryptionStatusSchema = object({
13247
+ enabled: boolean(),
13248
+ active: object({
13249
+ keyId: string(),
13250
+ publicKey: string(),
13251
+ createdAt: number()
13252
+ }).nullable(),
13253
+ /** Every key ever set up, newest first. */
13254
+ keys: array(object({
13255
+ keyId: string(),
13256
+ createdAt: number(),
13257
+ retiredAt: number().nullable()
13258
+ })).readonly()
13259
+ });
13260
+ /**
12523
13261
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12524
13262
  * Same shape the destination drill-in renders. Sourced from the per-
12525
13263
  * location `manifests.json` (no per-archive tarball read required).
@@ -12531,7 +13269,9 @@ var BackupArchiveEntrySchema = object({
12531
13269
  sizeBytes: number(),
12532
13270
  label: string().optional(),
12533
13271
  /** Top-level locations included in the archive (db, addons, tls, …). */
12534
- locations: array(string()).readonly()
13272
+ locations: array(string()).readonly(),
13273
+ /** Present when the archive is encrypted; restore then needs that key. */
13274
+ encryption: BackupArchiveEncryptionSchema.optional()
12535
13275
  });
12536
13276
  var BackupEntrySchema = object({
12537
13277
  id: string(),
@@ -12540,7 +13280,8 @@ var BackupEntrySchema = object({
12540
13280
  label: string().optional(),
12541
13281
  createdAt: number(),
12542
13282
  sizeBytes: number(),
12543
- locations: array(string()).optional()
13283
+ locations: array(string()).optional(),
13284
+ encryption: BackupArchiveEncryptionSchema.optional()
12544
13285
  });
12545
13286
  var ArchiveEntrySchema = object({
12546
13287
  path: string(),
@@ -12729,10 +13470,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12729
13470
  * this list and skips entries whose path doesn't start with
12730
13471
  * any of them.
12731
13472
  */
12732
- locations: array(string()).optional()
13473
+ locations: array(string()).optional(),
13474
+ /**
13475
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13476
+ * one). The archive is decrypted into the hub's private staging
13477
+ * before the restart; the key is not stored. A wrong or missing key
13478
+ * is refused before the archive is downloaded.
13479
+ */
13480
+ backupSecretKey: string().optional()
12733
13481
  }), _void(), {
12734
13482
  kind: "mutation",
12735
13483
  auth: "admin"
13484
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13485
+ keyId: string(),
13486
+ secretKey: string(),
13487
+ publicKey: string(),
13488
+ createdAt: number(),
13489
+ replacedKeyId: string().nullable()
13490
+ }), {
13491
+ kind: "mutation",
13492
+ auth: "admin"
13493
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13494
+ kind: "mutation",
13495
+ auth: "admin"
13496
+ }), method(object({ backupSecretKey: string() }), object({
13497
+ valid: boolean(),
13498
+ keyId: string().nullable(),
13499
+ /** The hub knows this key (active or retired). */
13500
+ known: boolean(),
13501
+ /** It is the key new archives are encrypted to. */
13502
+ active: boolean(),
13503
+ error: string().optional()
13504
+ }), {
13505
+ kind: "mutation",
13506
+ auth: "admin"
12736
13507
  }), method(object({
12737
13508
  destinationId: string(),
12738
13509
  backupId: string()
@@ -14458,7 +15229,60 @@ var CustomModelDescriptorSchema = object({
14458
15229
  stepId: string(),
14459
15230
  entry: ModelCatalogEntrySchema
14460
15231
  });
14461
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15232
+ /** One regular file of an imported bundle, as the producer measured it. */
15233
+ var ModelBundleFileSchema = object({
15234
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15235
+ path: string().min(1),
15236
+ bytes: number().int().nonnegative(),
15237
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15238
+ });
15239
+ var ImportModelBundleInputSchema = object({
15240
+ /** The registry provider that keeps the model (Model Studio). */
15241
+ addonId: string(),
15242
+ stepId: string().min(1),
15243
+ /**
15244
+ * The catalog rows to register, complete, every format URL already
15245
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15246
+ * bundle may carry several rows (a base and its INT8 variant).
15247
+ */
15248
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15249
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15250
+ bundle: object({
15251
+ ticket: PeerBytesTicketSchema,
15252
+ bytes: number().int().positive(),
15253
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15254
+ }),
15255
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15256
+ files: array(ModelBundleFileSchema).min(1).max(64),
15257
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15258
+ distribute: boolean()
15259
+ });
15260
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15261
+ kind: literal("imported"),
15262
+ modelIds: array(string()).readonly(),
15263
+ distributed: array(object({
15264
+ modelId: string(),
15265
+ nodeId: string(),
15266
+ format: _enum(MODEL_FORMATS),
15267
+ ok: boolean(),
15268
+ error: string().optional()
15269
+ })).readonly()
15270
+ }), object({
15271
+ kind: literal("refused"),
15272
+ reason: _enum([
15273
+ "transfer-failed",
15274
+ "checksum-mismatch",
15275
+ "bundle-mismatch",
15276
+ "invalid-entry",
15277
+ "id-taken"
15278
+ ]),
15279
+ detail: string()
15280
+ })]);
15281
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15282
+ kind: "mutation",
15283
+ auth: "admin",
15284
+ timeoutMs: 30 * 6e4
15285
+ });
14462
15286
  /**
14463
15287
  * Query filter for settings-store collections.
14464
15288
  */
@@ -14937,6 +15761,35 @@ var KeychainKeySourceSchema = object({
14937
15761
  */
14938
15762
  sharesBackupWithDatabase: boolean()
14939
15763
  });
15764
+ /**
15765
+ * One keychain reset, as the Secrets page reports it until the operator
15766
+ * acknowledges it. Never a value: refs, counts and table names only.
15767
+ */
15768
+ var KeychainResetRecordSchema = object({
15769
+ id: string(),
15770
+ at: number(),
15771
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15772
+ actor: string(),
15773
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15774
+ lockedReason: string().nullable(),
15775
+ /** Values moved into the archive table (ciphertext under the lost key). */
15776
+ archived: number().int(),
15777
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15778
+ archivedCollection: string().nullable(),
15779
+ /**
15780
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15781
+ * so the archive can still be opened if the lost master key turns up.
15782
+ */
15783
+ archivedKeysCollection: string().nullable(),
15784
+ /**
15785
+ * `system-settings` keys whose marker the reset cleared — the cluster
15786
+ * secret's: a marker left pointing at an archived value would refuse every
15787
+ * agent forever (D797).
15788
+ */
15789
+ clearedSettingsKeys: array(string()).readonly(),
15790
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15791
+ acknowledgedAt: number().nullable()
15792
+ });
14940
15793
  var KeychainStatusSchema = object({
14941
15794
  keychain: KeychainStateSchema,
14942
15795
  /** The source of the master key in use; `null` while locked. */
@@ -14954,7 +15807,9 @@ var KeychainStatusSchema = object({
14954
15807
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
14955
15808
  retiredWraps: number().int(),
14956
15809
  recoveryKeyDownloadedAt: number().nullable(),
14957
- secretCount: number().int()
15810
+ secretCount: number().int(),
15811
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15812
+ lastReset: KeychainResetRecordSchema.nullable()
14958
15813
  });
14959
15814
  /**
14960
15815
  * Whether a stored value is still pointed at by its owner's settings.
@@ -14976,17 +15831,26 @@ var KeychainAuditActionSchema = _enum([
14976
15831
  "download-recovery-key",
14977
15832
  "delete-orphans",
14978
15833
  "reset",
15834
+ "acknowledge-reset",
14979
15835
  "initialize"
14980
15836
  ]);
14981
15837
  var KeychainAuditEntrySchema = object({
14982
15838
  id: string(),
14983
15839
  at: number(),
14984
15840
  action: KeychainAuditActionSchema,
14985
- /** `addon:<id>` | `user:<id>` | `system`. */
15841
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
14986
15842
  actor: string(),
14987
15843
  ref: string().nullable(),
14988
15844
  detail: string().nullable()
14989
15845
  });
15846
+ var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
15847
+ /**
15848
+ * Secrets the HUB itself holds (owner `system`) that no settings form shows:
15849
+ * `jwt-signing-key` — the session signing key (D797). It is always "in use",
15850
+ * never an orphan; it is generated on a fresh hub and replaced only through
15851
+ * {@link keychainAdminCapability.methods.setSystemSecret}.
15852
+ */
15853
+ var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
14990
15854
  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({
14991
15855
  value: string(),
14992
15856
  version: number().int()
@@ -14994,6 +15858,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
14994
15858
  kind: "mutation",
14995
15859
  auth: "admin",
14996
15860
  caller: "required"
15861
+ }), method(object({
15862
+ name: SystemHeldSecretNameSchema,
15863
+ value: string().min(16)
15864
+ }), object({
15865
+ ref: string(),
15866
+ version: number().int()
15867
+ }), {
15868
+ kind: "mutation",
15869
+ auth: "admin",
15870
+ caller: "required"
14997
15871
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
14998
15872
  deleted: array(string()).readonly(),
14999
15873
  kept: array(object({
@@ -15023,13 +15897,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15023
15897
  kind: "mutation",
15024
15898
  auth: "admin",
15025
15899
  caller: "required"
15026
- }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15900
+ }), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
15027
15901
  archivedCollection: string().nullable(),
15028
15902
  archived: number().int()
15029
15903
  }), {
15030
15904
  kind: "mutation",
15031
15905
  auth: "admin",
15032
15906
  caller: "required"
15907
+ }), method(object({}), object({
15908
+ reset: KeychainResetRecordSchema.nullable(),
15909
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15910
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15911
+ kind: "mutation",
15912
+ auth: "admin",
15913
+ caller: "required"
15033
15914
  });
15034
15915
  method(_void(), object({
15035
15916
  id: string(),
@@ -17595,14 +18476,14 @@ var LlmProfileSchema = object({
17595
18476
  /** ConfigUISchema tree passed through untyped on the wire (the
17596
18477
  * notification-output `ConfigSchemaPassthrough` precedent at
17597
18478
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
17598
- var ConfigSchemaPassthrough$1 = unknown();
18479
+ var ConfigSchemaPassthrough$3 = unknown();
17599
18480
  var LlmProfileKindDescriptorSchema = object({
17600
18481
  kind: LlmProfileKindSchema,
17601
18482
  label: string(),
17602
18483
  icon: string(),
17603
18484
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
17604
18485
  addonId: string(),
17605
- configSchema: ConfigSchemaPassthrough$1
18486
+ configSchema: ConfigSchemaPassthrough$3
17606
18487
  });
17607
18488
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
17608
18489
  var LlmDefaultSchema = object({
@@ -17880,7 +18761,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17880
18761
  * `login-method` — collection cap through which auth addons contribute
17881
18762
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17882
18763
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17883
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18764
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17884
18765
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17885
18766
  * procedure aggregates them for the unauthenticated login page.
17886
18767
  *
@@ -17888,8 +18769,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17888
18769
  *
17889
18770
  * - `redirect` — a declarative button. The login page renders a generic
17890
18771
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17891
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17892
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18772
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17893
18773
  * login page needs NO change.
17894
18774
  *
17895
18775
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -17908,8 +18788,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17908
18788
  * decision.
17909
18789
  *
17910
18790
  * Every contribution carries a `stage`:
17911
- * - `primary` — shown on the first credentials screen (OIDC /
17912
- * magic-link buttons; a future usernameless passkey).
18791
+ * - `primary` — shown on the first credentials screen (OIDC
18792
+ * buttons; a usernameless passkey).
17913
18793
  * - `second-factor` — shown AFTER the password leg, gated on the
17914
18794
  * returned `factors` (passkey-as-2FA today).
17915
18795
  *
@@ -17936,7 +18816,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17936
18816
  * The provider names an external identity a signed-in user can link to
17937
18817
  * their own account (D782): `auth.listLinkableProviders` /
17938
18818
  * `beginExternalLink` offer exactly the redirect methods that set this,
17939
- * whatever their id. Absent / false — a login button only (magic-link).
18819
+ * whatever their id. Absent / false — a login button only.
17940
18820
  */
17941
18821
  linkable: boolean().optional()
17942
18822
  }),
@@ -18724,7 +19604,7 @@ var TargetKindCapsSchema = object({
18724
19604
  * the union is large and not meant for runtime validation here; the exported
18725
19605
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
18726
19606
  */
18727
- var ConfigSchemaPassthrough = unknown();
19607
+ var ConfigSchemaPassthrough$2 = unknown();
18728
19608
  var TargetKindSchema = object({
18729
19609
  kind: string(),
18730
19610
  label: string(),
@@ -18761,7 +19641,7 @@ var TargetKindSchema = object({
18761
19641
  * its raster path, which is the safe default for an unknown image.
18762
19642
  */
18763
19643
  iconMediaType: string().optional(),
18764
- configSchema: ConfigSchemaPassthrough,
19644
+ configSchema: ConfigSchemaPassthrough$2,
18765
19645
  /**
18766
19646
  * The config keys that decide WHERE this kind's secrets are sent (server,
18767
19647
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -21791,8 +22671,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21791
22671
  * `super_admin` — collapsed onto the single boolean because every
21792
22672
  * non-admin caller is governed by the same scope-check rules; the
21793
22673
  * distinction was only ever used to route role-specific procedures
21794
- * which we no longer have. Agents are admin sessions issued via
21795
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22674
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21796
22675
  * with `isAdmin: false` + an explicit scope list.
21797
22676
  */
21798
22677
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -22099,6 +22978,61 @@ var OauthIntegrationDescriptorSchema = object({
22099
22978
  });
22100
22979
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
22101
22980
  /**
22981
+ * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
22982
+ *
22983
+ * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
22984
+ * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
22985
+ * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
22986
+ * immutable after create.
22987
+ */
22988
+ var ConfigSchemaPassthrough$1 = unknown();
22989
+ var OidcConnectionSchema = object({
22990
+ id: string().min(1),
22991
+ displayName: string(),
22992
+ icon: string(),
22993
+ issuerUrl: string(),
22994
+ clientId: string(),
22995
+ /** Client id + secret present — never the secret value. */
22996
+ configured: boolean(),
22997
+ /**
22998
+ * Values for the connection form schema. `clientSecret` is a keychain
22999
+ * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
23000
+ */
23001
+ formValues: record(string(), unknown()).optional()
23002
+ });
23003
+ /**
23004
+ * Patch one connection. Omitted or empty `clientSecret` keeps the stored
23005
+ * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
23006
+ */
23007
+ var OidcConnectionUpdateInputSchema = object({
23008
+ id: string().min(1),
23009
+ displayName: string().min(1),
23010
+ icon: string().optional(),
23011
+ issuerUrl: string().optional(),
23012
+ clientId: string().optional(),
23013
+ clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
23014
+ redirectUri: string().optional(),
23015
+ scopes: string().optional(),
23016
+ usernameClaim: _enum([
23017
+ "preferred_username",
23018
+ "email",
23019
+ "sub"
23020
+ ]).optional()
23021
+ });
23022
+ method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
23023
+ id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
23024
+ displayName: string().min(1)
23025
+ }), object({ id: string() }), {
23026
+ kind: "mutation",
23027
+ auth: "admin"
23028
+ }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
23029
+ kind: "mutation",
23030
+ auth: "admin"
23031
+ }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
23032
+ kind: "mutation",
23033
+ auth: "admin"
23034
+ });
23035
+ /**
22102
23036
  * What started a camera's onboard motion (D672). `camera` is the camera's own
22103
23037
  * firmware; `sensor` is a device the operator ATTACHED to it. Absent on the
22104
23038
  * wire means the camera: only the camera-sensors bridge ever says `sensor`.
@@ -23455,21 +24389,69 @@ var RetrainFrameListSchema = object({
23455
24389
  /** What the page pre-selects — the native key frame when one survives. */
23456
24390
  autoPickMediaId: number().int().optional()
23457
24391
  });
24392
+ /** Exclusive partition of a corpus copy's annotation progress (design §4.2). */
24393
+ var RetrainFrameWorkStateSchema = _enum([
24394
+ "unannotated",
24395
+ "annotated",
24396
+ "complete"
24397
+ ]);
24398
+ /**
24399
+ * Filters for paginated corpus list, KPI, and matching export (design §4.4).
24400
+ * Every narrowing field is ANDed; omitted fields impose no constraint.
24401
+ */
24402
+ var RetrainCorpusFilterSchema = object({
24403
+ workState: RetrainFrameWorkStateSchema.optional(),
24404
+ deviceIds: array(number()).max(500).optional(),
24405
+ /** When set, only frames in this named collection. */
24406
+ collectionId: string().optional(),
24407
+ /** Frames that carry at least one saved annotation in one of these classes. */
24408
+ classes: array(RetrainMacroClassSchema).optional(),
24409
+ page: number().int().positive().default(1),
24410
+ pageSize: number().int().positive().max(100).default(50)
24411
+ });
24412
+ var RetrainCorpusPageSchema = object({
24413
+ frames: array(RetrainFrameSchema.extend({ workState: RetrainFrameWorkStateSchema })).readonly(),
24414
+ total: number().int().nonnegative(),
24415
+ page: number().int().positive(),
24416
+ pageSize: number().int().positive()
24417
+ });
24418
+ var RetrainCorpusKpiCameraRowSchema = object({
24419
+ deviceId: number(),
24420
+ unannotated: number().int().nonnegative(),
24421
+ annotated: number().int().nonnegative(),
24422
+ complete: number().int().nonnegative(),
24423
+ /** This camera's `complete` count divided by corpus `total`, in `[0,1]`.
24424
+ * `null` when the corpus is empty (no ratio). */
24425
+ pctOfCorpus: number().min(0).max(1).nullable()
24426
+ });
24427
+ var RetrainCorpusKpiSchema = object({
24428
+ total: number().int().nonnegative(),
24429
+ unannotated: number().int().nonnegative(),
24430
+ annotated: number().int().nonnegative(),
24431
+ complete: number().int().nonnegative(),
24432
+ cameras: array(RetrainCorpusKpiCameraRowSchema).readonly()
24433
+ });
23458
24434
  /**
23459
24435
  * Which frames an annotated export carries. Every field narrows; an empty
23460
- * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23461
- * list owned by whoever trains (the training orchestrator), so `frameIds` is
23462
- * the primitive a version export uses; `batchId` re-selects what an earlier
23463
- * export carried (`exportedInBatch`).
24436
+ * filter is every annotated copy. `frameIds` is the primitive a job or
24437
+ * download uses; `batchId` re-selects what an earlier export carried
24438
+ * (`exportedInBatch`). Frozen dataset versions were removed — live selection
24439
+ * resolves to `frameIds` at plan/start.
23464
24440
  */
23465
24441
  var RetrainExportFilterSchema = object({
23466
24442
  deviceIds: array(number()).optional(),
23467
24443
  frameIds: array(string()).max(2e4).optional(),
23468
24444
  /** Only frames in at least one of these named collections. */
23469
24445
  collectionIds: array(string()).max(200).optional(),
24446
+ /** Single collection (Frames filter bar). ANDed with `collectionIds` when both set. */
24447
+ collectionId: string().optional(),
23470
24448
  batchId: string().optional(),
23471
24449
  /** Only frames the operator marked complete (all subjects boxed). */
23472
- completeOnly: boolean().optional()
24450
+ completeOnly: boolean().optional(),
24451
+ /** Exclusive work-state partition (`workStateOf`); same as the corpus list. */
24452
+ workState: RetrainFrameWorkStateSchema.optional(),
24453
+ /** Frames with at least one saved annotation in one of these classes. */
24454
+ classes: array(RetrainMacroClassSchema).optional()
23473
24455
  });
23474
24456
  /**
23475
24457
  * `frames`: the full frame copies, boxes in `annotations.json`.
@@ -23634,6 +24616,77 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23634
24616
  ]),
23635
24617
  detail: string().optional()
23636
24618
  })]);
24619
+ /** What a dataset version is cut from. Every field narrows. */
24620
+ var RetrainDatasetSelectionSchema = object({
24621
+ deviceIds: array(number()).readonly().optional(),
24622
+ collectionIds: array(string()).max(200).readonly().optional(),
24623
+ frameIds: array(string()).max(2e4).readonly().optional()
24624
+ });
24625
+ /** The counts a dataset is judged by. */
24626
+ var RetrainDatasetStatsSchema = object({
24627
+ frames: number().int(),
24628
+ completeFrames: number().int(),
24629
+ /** `completeFrames / frames`, 0..1. */
24630
+ completeness: number(),
24631
+ /** Boxes to learn (model errors excluded). */
24632
+ subjects: number().int(),
24633
+ modelErrors: number().int(),
24634
+ /** Complete frames with no subject. */
24635
+ hardNegatives: number().int(),
24636
+ /** Subjects per class × camera × day/night. */
24637
+ cells: array(object({
24638
+ macroClass: string(),
24639
+ deviceId: number(),
24640
+ lighting: _enum([
24641
+ "day",
24642
+ "night",
24643
+ "unknown"
24644
+ ]),
24645
+ subjects: number().int(),
24646
+ frames: number().int()
24647
+ })).readonly(),
24648
+ cameras: array(object({
24649
+ deviceId: number(),
24650
+ frames: number().int(),
24651
+ completeFrames: number().int()
24652
+ })).readonly()
24653
+ });
24654
+ object({
24655
+ id: string(),
24656
+ name: string(),
24657
+ createdAt: number(),
24658
+ selection: RetrainDatasetSelectionSchema,
24659
+ layout: RetrainExportLayoutSchema,
24660
+ completeOnly: boolean(),
24661
+ frameCount: number().int(),
24662
+ annotationHash: string(),
24663
+ manifestSchema: string(),
24664
+ stats: RetrainDatasetStatsSchema
24665
+ });
24666
+ /**
24667
+ * Live training corpus criteria — same shape as `TrainingCorpusSelection` on
24668
+ * the training cap. Resolved here so plan/start and the annotated export share
24669
+ * one definition of "the frames" (`buildRetrainExportPlan`).
24670
+ */
24671
+ var RetrainTrainingCorpusSelectionSchema = object({
24672
+ collectionIds: array(string()).min(1),
24673
+ workState: _enum([
24674
+ "complete",
24675
+ "annotated_or_complete",
24676
+ "any_annotated"
24677
+ ]).default("complete")
24678
+ });
24679
+ var RetrainTrainingCorpusResolveResultSchema = discriminatedUnion("kind", [object({
24680
+ kind: literal("resolved"),
24681
+ frameIds: array(string()).max(2e4).readonly(),
24682
+ stats: RetrainDatasetStatsSchema,
24683
+ annotationHash: string(),
24684
+ layout: RetrainExportLayoutSchema
24685
+ }), object({
24686
+ kind: literal("refused"),
24687
+ reason: _enum(["unknown-collection", "no-frames"]),
24688
+ detail: string()
24689
+ })]);
23637
24690
  /** The outcome of a lifecycle move owned by the retrain page. */
23638
24691
  var RetrainTransitionResultSchema = object({
23639
24692
  trackId: string(),
@@ -24339,6 +25392,12 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24339
25392
  }), array(RetrainTrackSchema).readonly(), {
24340
25393
  kind: "query",
24341
25394
  auth: "admin"
25395
+ }), method(RetrainCorpusFilterSchema, RetrainCorpusPageSchema, {
25396
+ kind: "query",
25397
+ auth: "admin"
25398
+ }), method(object({}), RetrainCorpusKpiSchema, {
25399
+ kind: "query",
25400
+ auth: "admin"
24342
25401
  }), method(object({ trackId: string() }), RetrainFrameListSchema, {
24343
25402
  kind: "query",
24344
25403
  auth: "admin"
@@ -24423,6 +25482,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24423
25482
  kind: "mutation",
24424
25483
  auth: "admin",
24425
25484
  timeoutMs: 60 * 6e4
25485
+ }), method(object({
25486
+ filter: RetrainExportFilterSchema,
25487
+ layout: RetrainExportLayoutSchema
25488
+ }), object({
25489
+ ticket: PeerBytesTicketSchema,
25490
+ frames: number().int(),
25491
+ annotations: number().int()
25492
+ }), {
25493
+ kind: "mutation",
25494
+ auth: "admin",
25495
+ timeoutMs: 12e4
24426
25496
  }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24427
25497
  kind: "query",
24428
25498
  auth: "admin"
@@ -24449,6 +25519,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24449
25519
  }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24450
25520
  kind: "query",
24451
25521
  auth: "admin"
25522
+ }), method(RetrainTrainingCorpusSelectionSchema, RetrainTrainingCorpusResolveResultSchema, {
25523
+ kind: "query",
25524
+ auth: "admin",
25525
+ timeoutMs: 6e4
24452
25526
  }), method(object({
24453
25527
  id: string(),
24454
25528
  name: string().max(120)
@@ -25065,11 +26139,14 @@ var HardwareClassIdSchema = _enum([
25065
26139
  "intel-n-series",
25066
26140
  "apple-m-base",
25067
26141
  "apple-m-pro",
26142
+ "amd-phoenix",
25068
26143
  "unknown"
25069
26144
  ]);
25070
26145
  var AcceleratorKindSchema = _enum([
25071
26146
  "intel-npu",
25072
26147
  "intel-igpu",
26148
+ "amd-igpu",
26149
+ "amd-npu",
25073
26150
  "x86-cpu",
25074
26151
  "arm-cpu",
25075
26152
  "apple-ane",
@@ -26999,6 +28076,8 @@ var AgentPipelineSettingsSchema = object({
26999
28076
  * address is wrong (multi-homed host, NAT, custom interface).
27000
28077
  */
27001
28078
  reachableHost: string().optional(),
28079
+ /** Hub-persisted UI colour (`--color-node-*` theme tokens). */
28080
+ color: NodeColorIdSchema.optional(),
27002
28081
  /**
27003
28082
  * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
27004
28083
  * weight, steps}. Absent / all-disabled ⇒ the node's single default
@@ -27548,8 +28627,9 @@ method(object({
27548
28627
  auth: "admin"
27549
28628
  }), method(object({
27550
28629
  agentNodeId: string(),
27551
- reachableHost: string().nullable()
27552
- }), object({ success: literal(true) }), {
28630
+ reachableHost: string().nullable().optional(),
28631
+ color: NodeColorIdSchema.nullable().optional()
28632
+ }).refine((v) => v.reachableHost !== void 0 || v.color !== void 0, { message: "reachableHost or color required" }), object({ success: literal(true) }), {
27553
28633
  kind: "mutation",
27554
28634
  auth: "admin"
27555
28635
  }), method(object({
@@ -28001,8 +29081,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
28001
29081
  * `smtp-provider` — pluggable email delivery surface.
28002
29082
  *
28003
29083
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
28004
- * one for transactional / one for notifications). Consumers (magic-link,
28005
- * notifier addons, …) walk the collection and pick the first
29084
+ * one for transactional / one for notifications). Consumers (notifier
29085
+ * addons, …) walk the collection and pick the first
28006
29086
  * ready provider OR target a specific addonId.
28007
29087
  *
28008
29088
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -28181,7 +29261,7 @@ targets: array(object({
28181
29261
  })));
28182
29262
  /**
28183
29263
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
28184
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
29264
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
28185
29265
  * carrying the post-callback claims before redirecting back to
28186
29266
  * `/api/auth/sso/finish`.
28187
29267
  *
@@ -28244,7 +29324,14 @@ var SsoBridgeClaimsSchema = object({
28244
29324
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28245
29325
  * subject is unique only per issuer, so a link is bound to it.
28246
29326
  */
28247
- issuer: string().optional()
29327
+ issuer: string().optional(),
29328
+ /**
29329
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
29330
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
29331
+ * request to present the matching cookie — a login bridge is useless in
29332
+ * any other browser.
29333
+ */
29334
+ browserBinding: string().optional()
28248
29335
  });
28249
29336
  method(object({
28250
29337
  claims: SsoBridgeClaimsSchema,
@@ -30618,7 +31705,7 @@ var CustomActionInputSchema = object({
30618
31705
  action: string().min(1),
30619
31706
  input: unknown()
30620
31707
  });
30621
- method(_void(), array(AddonListItemSchema).readonly()), method(object({
31708
+ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSchema).readonly()), method(object({
30622
31709
  addonId: string(),
30623
31710
  limit: number().min(1).max(500).default(100),
30624
31711
  level: LogLevelSchema$2.optional()
@@ -35688,7 +36775,13 @@ var TopologyNodeSchema = object({
35688
36775
  })).readonly(),
35689
36776
  processes: array(TopologyProcessSchema).readonly(),
35690
36777
  categories: array(TopologyCategorySchema).readonly(),
35691
- rootPackage: TopologyRootPackageSchema.nullable()
36778
+ rootPackage: TopologyRootPackageSchema.nullable(),
36779
+ /**
36780
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
36781
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
36782
+ * for offline rows and when the hub cannot tell.
36783
+ */
36784
+ meshTransport: _enum(["tls", "clear"]).optional()
35692
36785
  });
35693
36786
  var CapUsageEdgeSchema = object({
35694
36787
  callerAddonId: string(),
@@ -36101,6 +37194,7 @@ var OsdNamedTemplateSchema = object({
36101
37194
  });
36102
37195
  /** Where a slot's value comes from. */
36103
37196
  var OsdSourceSchema = discriminatedUnion("kind", [
37197
+ object({ kind: literal("none") }),
36104
37198
  object({
36105
37199
  kind: literal("static"),
36106
37200
  text: string().max(64)
@@ -36227,6 +37321,13 @@ method(object({ deviceId: number().int() }), object({
36227
37321
  }), object({ success: literal(true) }), {
36228
37322
  kind: "mutation",
36229
37323
  auth: "admin"
37324
+ }), method(object({
37325
+ deviceId: number().int(),
37326
+ slotId: string().min(1),
37327
+ enabled: boolean()
37328
+ }), object({ success: literal(true) }), {
37329
+ kind: "mutation",
37330
+ auth: "admin"
36230
37331
  }), method(object({
36231
37332
  sourceDeviceId: number().int(),
36232
37333
  targetDeviceId: number().int()
@@ -36658,7 +37759,15 @@ var GpuInfoSchema = object({
36658
37759
  name: string(),
36659
37760
  memoryMB: number().optional()
36660
37761
  });
36661
- var NpuInfoSchema = object({ type: _enum(["apple-ane", "intel-npu"]) });
37762
+ var NpuInfoSchema = object({
37763
+ type: _enum([
37764
+ "apple-ane",
37765
+ "intel-npu",
37766
+ "amd-xdna"
37767
+ ]),
37768
+ name: string().optional(),
37769
+ generation: _enum(["xdna1", "xdna2"]).optional()
37770
+ });
36662
37771
  var CoralInfoSchema = object({
36663
37772
  type: literal("coral-edgetpu"),
36664
37773
  bus: string().optional()
@@ -40511,16 +41620,6 @@ var ApiKeySummarySchema = object({
40511
41620
  createdAt: number(),
40512
41621
  lastUsedAt: number().optional()
40513
41622
  });
40514
- var CreateApiKeyInputSchema = object({
40515
- label: string(),
40516
- isAdmin: boolean().default(false),
40517
- allowedProviders: union([array(string()), literal("*")]).optional(),
40518
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
40519
- });
40520
- var CreateApiKeyResultSchema = object({
40521
- token: string(),
40522
- record: ApiKeySummarySchema
40523
- });
40524
41623
  var ScopedTokenSummarySchema = object({
40525
41624
  id: string(),
40526
41625
  userId: string(),
@@ -40619,17 +41718,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40619
41718
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
40620
41719
  kind: "mutation",
40621
41720
  access: "view"
40622
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
40623
- kind: "mutation",
40624
- auth: "admin",
40625
- access: "create"
40626
- }), method(object({ id: string() }), object({ success: literal(true) }), {
41721
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
40627
41722
  kind: "mutation",
40628
41723
  auth: "admin",
40629
41724
  access: "delete"
40630
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
40631
- kind: "mutation",
40632
- access: "view"
40633
41725
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
40634
41726
  kind: "mutation",
40635
41727
  auth: "admin",
@@ -40703,15 +41795,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40703
41795
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
40704
41796
  userId: string(),
40705
41797
  issuer: string()
40706
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
40707
- userId: string(),
40708
- issuer: string().min(1),
40709
- label: string().optional()
40710
- }), object({ success: literal(true) }), {
40711
- kind: "mutation",
40712
- auth: "admin",
40713
- access: "create"
40714
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41798
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
40715
41799
  kind: "mutation",
40716
41800
  auth: "admin",
40717
41801
  access: "delete"
@@ -41416,6 +42500,563 @@ var zoneRulesCapability = {
41416
42500
  */
41417
42501
  durability: "restored"
41418
42502
  };
42503
+ /**
42504
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
42505
+ *
42506
+ * A thin, mockable translation layer: it knows how to run a container with a
42507
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
42508
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
42509
+ * those are the `training` orchestrator's (D805). Every rule written there
42510
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
42511
+ * manifest entry and nothing else.
42512
+ *
42513
+ * Collection of provider **types** (addons). Each addon owns zero or more
42514
+ * **entries** (credentials + defaults). Concat-fans: `describe`,
42515
+ * `describeTypes`, `listEntries`, `listJobs`. Single-row work is keyed by
42516
+ * `entryId`; callers also pass the owning `addonId` as the collection
42517
+ * selector (broker posture). Every method is `admin`: these spend money.
42518
+ *
42519
+ * Every cloud object a provider creates is tagged with the orchestrator's
42520
+ * `jobKey`, so a retried submit finds the job it already started instead of
42521
+ * starting a second GPU, and `listJobs` can find orphans.
42522
+ *
42523
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
42524
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
42525
+ * ticket the provider mints (D613).
42526
+ */
42527
+ var TrainingGpuOptionSchema = object({
42528
+ id: string(),
42529
+ label: string(),
42530
+ /** List price, USD per GPU-hour, before any region multiplier. */
42531
+ usdPerHour: number().nonnegative(),
42532
+ vramGb: number().nonnegative()
42533
+ });
42534
+ var TrainingRegionOptionSchema = object({
42535
+ /** `''` = any region (the provider's choice). */
42536
+ id: string(),
42537
+ label: string(),
42538
+ priceMultiplier: number().positive()
42539
+ });
42540
+ /**
42541
+ * The provider's per-entry settings, as the orchestrator reads them. They
42542
+ * live on the PROVIDER addon's entry (operator decision 2026-10-08: they
42543
+ * depend on the user's account), never hard-coded in the orchestrator.
42544
+ */
42545
+ var TrainingProviderDefaultsSchema = object({
42546
+ gpuType: string(),
42547
+ region: string(),
42548
+ costCapUsd: number().nonnegative(),
42549
+ maxRuntimeSec: number().int().positive(),
42550
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
42551
+ failedDatasetGraceHours: number().nonnegative()
42552
+ });
42553
+ /**
42554
+ * Entry form schema for a provider type — same seam as notification
42555
+ * `TargetKind.configSchema` (`z.unknown()` at the wire; callers tighten to
42556
+ * {@link ConfigUISchema}). Drives `ConfigFormBuilder` on Training → Providers.
42557
+ */
42558
+ var ConfigSchemaPassthrough = unknown();
42559
+ /** One creatable provider type, for the Add-entry dialog. */
42560
+ var TrainingProviderTypeSchema = object({
42561
+ typeId: string(),
42562
+ label: string(),
42563
+ /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
42564
+ iconAsset: string(),
42565
+ /** Owning `training-provider` addon — collection selector for createEntry. */
42566
+ addonId: string(),
42567
+ /**
42568
+ * Fields for one entry of this type (credentials + defaults). Absent on a
42569
+ * type that only needs a name. Password fields are keychain-backed on the
42570
+ * provider addon (`secretStatePaths`), not D634 plaintext.
42571
+ */
42572
+ configSchema: ConfigSchemaPassthrough.optional()
42573
+ });
42574
+ /** One configured account / workspace under a provider type. */
42575
+ var TrainingProviderEntrySchema = object({
42576
+ entryId: string(),
42577
+ typeId: string(),
42578
+ name: string(),
42579
+ addonId: string(),
42580
+ /** Credentials are present — never the values. */
42581
+ configured: boolean()
42582
+ });
42583
+ var TrainingProviderDescriptorSchema = object({
42584
+ addonId: string(),
42585
+ entryId: string(),
42586
+ typeId: string(),
42587
+ /** Operator-chosen entry name. */
42588
+ name: string(),
42589
+ iconAsset: string(),
42590
+ /** `modal`, `runpod`, `fake`, … — same as typeId for current providers. */
42591
+ kind: string(),
42592
+ label: string(),
42593
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
42594
+ regions: array(TrainingRegionOptionSchema).readonly(),
42595
+ maxDatasetBytes: number().int().positive(),
42596
+ maxRuntimeSec: number().int().positive(),
42597
+ freeTierNote: string().optional(),
42598
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
42599
+ dataResidencyNote: string(),
42600
+ /** Credentials are present — never the values. */
42601
+ configured: boolean(),
42602
+ defaults: TrainingProviderDefaultsSchema,
42603
+ /**
42604
+ * Values for {@link TrainingProviderTypeSchema}'s `configSchema` — password
42605
+ * fields are keychain {@link SecretFieldView} or `null` / `''` (create),
42606
+ * never plaintext. Same hydrate contract as settings forms (D789).
42607
+ */
42608
+ formValues: record(string(), unknown()).optional()
42609
+ });
42610
+ /**
42611
+ * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
42612
+ * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
42613
+ * `{ $secretClear: true }` clears it.
42614
+ */
42615
+ var TrainingProviderUpdateEntryInputSchema = object({
42616
+ entryId: string().min(1),
42617
+ name: string().min(1),
42618
+ tokenId: string().optional(),
42619
+ tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
42620
+ environment: string().optional(),
42621
+ gpuType: string().optional(),
42622
+ region: string().optional(),
42623
+ costCapUsd: number().nonnegative().optional(),
42624
+ maxRuntimeSec: number().int().positive().optional(),
42625
+ failedDatasetGraceHours: number().nonnegative().optional()
42626
+ });
42627
+ var TrainingCredentialCheckSchema = object({
42628
+ ok: boolean(),
42629
+ /** Workspace / account name, when the provider says. */
42630
+ account: string().optional(),
42631
+ reason: _enum([
42632
+ "missing",
42633
+ "invalid",
42634
+ "forbidden",
42635
+ "network",
42636
+ "quota"
42637
+ ]).optional(),
42638
+ detail: string().optional()
42639
+ });
42640
+ var ProviderJobStateSchema = _enum([
42641
+ "pending",
42642
+ "starting",
42643
+ "running",
42644
+ "succeeded",
42645
+ "failed",
42646
+ "cancelled",
42647
+ "lost"
42648
+ ]);
42649
+ var ProviderJobStatusSchema = object({
42650
+ jobKey: string(),
42651
+ providerJobId: string().optional(),
42652
+ state: ProviderJobStateSchema,
42653
+ startedAt: number().optional(),
42654
+ endedAt: number().optional(),
42655
+ exitCode: number().int().optional(),
42656
+ failureReason: string().optional(),
42657
+ gpuType: string(),
42658
+ region: string().optional(),
42659
+ billedSeconds: number().nonnegative(),
42660
+ costUsd: number().nonnegative(),
42661
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
42662
+ costIsEstimate: boolean(),
42663
+ lastFetchedAt: number()
42664
+ });
42665
+ /**
42666
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
42667
+ * image its own way (Modal builds the published Dockerfile at that revision;
42668
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
42669
+ * in `result.json`.
42670
+ */
42671
+ var TrainerSourceRefSchema = object({
42672
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
42673
+ repo: string().min(1),
42674
+ /** A commit sha (never a branch) — the job must be reproducible. */
42675
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
42676
+ });
42677
+ /** Cloud job identity — route with the owning addon's `addonId` selector. */
42678
+ var JobRef = {
42679
+ entryId: string().min(1),
42680
+ jobKey: string().uuid()
42681
+ };
42682
+ var TrainingLogLineSchema = object({
42683
+ ts: number(),
42684
+ text: string()
42685
+ });
42686
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
42687
+ typeId: string().min(1),
42688
+ name: string().min(1)
42689
+ }), object({ entryId: string() }), {
42690
+ kind: "mutation",
42691
+ auth: "admin"
42692
+ }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
42693
+ kind: "mutation",
42694
+ auth: "admin"
42695
+ }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
42696
+ kind: "mutation",
42697
+ auth: "admin"
42698
+ }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
42699
+ kind: "mutation",
42700
+ auth: "admin",
42701
+ timeoutMs: 3e4
42702
+ }), method(object({
42703
+ entryId: string().min(1),
42704
+ gpuType: string(),
42705
+ region: string(),
42706
+ datasetBytes: number().int().nonnegative(),
42707
+ gpuSecondsLow: number().nonnegative(),
42708
+ gpuSecondsHigh: number().nonnegative()
42709
+ }), object({
42710
+ usdLow: number().nonnegative(),
42711
+ usdHigh: number().nonnegative(),
42712
+ notes: array(string()).readonly()
42713
+ }), { auth: "admin" }), method(object({
42714
+ ...JobRef,
42715
+ ticket: PeerBytesTicketSchema
42716
+ }), object({
42717
+ bytes: number().int().nonnegative(),
42718
+ sha256: string()
42719
+ }), {
42720
+ kind: "mutation",
42721
+ auth: "admin",
42722
+ timeoutMs: 120 * 6e4
42723
+ }), method(object({
42724
+ ...JobRef,
42725
+ trainer: TrainerSourceRefSchema,
42726
+ jobSpecJson: string().min(2).max(64e3),
42727
+ gpuType: string(),
42728
+ region: string(),
42729
+ maxRuntimeSec: number().int().positive()
42730
+ }), ProviderJobStatusSchema, {
42731
+ kind: "mutation",
42732
+ auth: "admin",
42733
+ timeoutMs: 30 * 6e4
42734
+ }), method(object(JobRef), ProviderJobStatusSchema, {
42735
+ auth: "admin",
42736
+ timeoutMs: 6e4
42737
+ }), method(object({
42738
+ ...JobRef,
42739
+ cursor: string().optional(),
42740
+ max: number().int().min(1).max(500)
42741
+ }), object({
42742
+ lines: array(TrainingLogLineSchema).readonly(),
42743
+ cursor: string()
42744
+ }), {
42745
+ auth: "admin",
42746
+ timeoutMs: 6e4
42747
+ }), method(object(JobRef), object({ ok: literal(true) }), {
42748
+ kind: "mutation",
42749
+ auth: "admin",
42750
+ timeoutMs: 6e4
42751
+ }), method(object(JobRef), object({
42752
+ found: boolean(),
42753
+ text: string().optional()
42754
+ }), {
42755
+ kind: "mutation",
42756
+ auth: "admin",
42757
+ timeoutMs: 5 * 6e4
42758
+ }), method(object({
42759
+ ...JobRef,
42760
+ path: _enum(["bundle.tar"])
42761
+ }), object({ ticket: PeerBytesTicketSchema }), {
42762
+ kind: "mutation",
42763
+ auth: "admin",
42764
+ timeoutMs: 5 * 6e4
42765
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
42766
+ kind: "mutation",
42767
+ auth: "admin",
42768
+ timeoutMs: 5 * 6e4
42769
+ }), method(object({ entryId: string().min(1).optional() }), array(ProviderJobStatusSchema).readonly(), {
42770
+ auth: "admin",
42771
+ timeoutMs: 2 * 6e4
42772
+ });
42773
+ /**
42774
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
42775
+ * provided by `addon-training`.
42776
+ *
42777
+ * It owns what every provider must agree on, written once:
42778
+ *
42779
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
42780
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
42781
+ * - **The return flow.** Verified artefacts → Model Studio
42782
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
42783
+ * rollback. Nothing is ever registered automatically.
42784
+ *
42785
+ * Plan/start takes a live {@link TrainingCorpusSelection} (collections +
42786
+ * work-state rule); frame ids are resolved via pipeline-analytics at that
42787
+ * moment and snapshotted on the job. No frozen dataset version.
42788
+ *
42789
+ * Every method is `admin`.
42790
+ */
42791
+ /**
42792
+ * Live corpus criteria for plan/start (design §5.2). Default is complete-only.
42793
+ * Frame ids are resolved at plan/start — never a frozen version id.
42794
+ */
42795
+ var TrainingCorpusSelectionSchema = object({
42796
+ collectionIds: array(string()).min(1),
42797
+ /** Default complete-only for v1 */
42798
+ workState: _enum([
42799
+ "complete",
42800
+ "annotated_or_complete",
42801
+ "any_annotated"
42802
+ ]).default("complete")
42803
+ });
42804
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
42805
+ var TrainingBaseModelSchema = object({
42806
+ modelId: string(),
42807
+ label: string(),
42808
+ weights: string(),
42809
+ imgsz: number().int(),
42810
+ baselineOnnxUrl: string(),
42811
+ baselineFloors: record(string(), number()),
42812
+ /** The base the fleet runs most — the UI's default. */
42813
+ recommended: boolean()
42814
+ });
42815
+ var TrainingPresetSchema = _enum([
42816
+ "quick",
42817
+ "standard",
42818
+ "thorough"
42819
+ ]);
42820
+ var TrainingJobRequestSchema = object({
42821
+ /** Live collection + work-state criteria; resolved at plan/start. */
42822
+ selection: TrainingCorpusSelectionSchema,
42823
+ /**
42824
+ * The provider **entry** that runs it (credentials + defaults).
42825
+ * Resolve to an owning addon via `training-provider.describe` / `listEntries`.
42826
+ */
42827
+ entryId: string().min(1),
42828
+ gpuType: string().min(1),
42829
+ region: string(),
42830
+ baseModelId: string().min(1),
42831
+ preset: TrainingPresetSchema,
42832
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
42833
+ freeze: number().int().nonnegative().nullable(),
42834
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
42835
+ holdoutCameras: array(number().int()).nullable()
42836
+ });
42837
+ var TrainingSplitPlanSchema = object({
42838
+ holdoutCameras: array(number().int()).readonly(),
42839
+ /** Used when no camera is held out: the last N days of every camera. */
42840
+ holdoutLastDays: number().int().nonnegative(),
42841
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
42842
+ holdoutSupport: record(string(), number().int()).nullable(),
42843
+ trainSubjects: number().int()
42844
+ });
42845
+ var TrainingRefusalReasonSchema = _enum([
42846
+ "unknown-dataset",
42847
+ "unknown-provider",
42848
+ "provider-not-configured",
42849
+ "unknown-base-model",
42850
+ "unknown-gpu",
42851
+ "dataset-too-large",
42852
+ "no-training-subjects",
42853
+ "job-already-running"
42854
+ ]);
42855
+ var TrainingJobPlanSchema = object({
42856
+ refusal: object({
42857
+ reason: TrainingRefusalReasonSchema,
42858
+ detail: string()
42859
+ }).nullable(),
42860
+ warnings: array(string()).readonly(),
42861
+ split: TrainingSplitPlanSchema.nullable(),
42862
+ estimate: object({
42863
+ datasetBytes: number().int(),
42864
+ uploadMinutesAt20Mbps: number(),
42865
+ gpuSecondsLow: number(),
42866
+ gpuSecondsHigh: number(),
42867
+ usdLow: number(),
42868
+ usdHigh: number(),
42869
+ notes: array(string()).readonly()
42870
+ }).nullable(),
42871
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
42872
+ defaults: object({
42873
+ maxCostUsd: number(),
42874
+ maxRuntimeSec: number().int()
42875
+ }).nullable(),
42876
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
42877
+ dataNotice: string()
42878
+ });
42879
+ /**
42880
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
42881
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
42882
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
42883
+ * result lives after the operator acted on it.
42884
+ */
42885
+ var TrainingJobStateSchema = _enum([
42886
+ "queued",
42887
+ "uploading",
42888
+ "submitted",
42889
+ "starting",
42890
+ "running",
42891
+ "collecting",
42892
+ "ready",
42893
+ "registered",
42894
+ "canary",
42895
+ "failed",
42896
+ "cancelling",
42897
+ "cancelled",
42898
+ "lost",
42899
+ "expired",
42900
+ "discarded"
42901
+ ]);
42902
+ var TrainingFailureReasonSchema = _enum([
42903
+ "cost-cap",
42904
+ "runtime-cap",
42905
+ "upload-failed",
42906
+ "submit-failed",
42907
+ "trainer-failed",
42908
+ "result-invalid",
42909
+ "checksum-mismatch",
42910
+ "fetch-failed",
42911
+ "provider-error",
42912
+ "hub-restart-during-upload"
42913
+ ]);
42914
+ var TrainingProgressPointSchema = object({
42915
+ epoch: number().int(),
42916
+ map50: number().nullable(),
42917
+ map50_95: number().nullable()
42918
+ });
42919
+ var TrainingCanarySchema = object({
42920
+ deviceIds: array(number().int()).readonly(),
42921
+ since: number(),
42922
+ /** Every override the canary replaced, exactly, so rollback restores it. */
42923
+ previous: array(object({
42924
+ deviceId: number().int(),
42925
+ nodeId: string(),
42926
+ deviceKey: string(),
42927
+ patch: object({
42928
+ modelId: string().optional(),
42929
+ settings: record(string(), unknown()).readonly().optional()
42930
+ }).nullable()
42931
+ })).readonly()
42932
+ });
42933
+ var TrainingJobSchema = object({
42934
+ id: string(),
42935
+ idempotencyKey: string(),
42936
+ name: string(),
42937
+ createdAt: number(),
42938
+ updatedAt: number(),
42939
+ state: TrainingJobStateSchema,
42940
+ /**
42941
+ * Shared by every job enqueued together via `startJobBatch`.
42942
+ * `null` for a lone `startJob`. The engine advances queued siblings by this id.
42943
+ */
42944
+ batchId: string().nullable().default(null),
42945
+ stage: TrainingStageSchema.nullable(),
42946
+ failure: object({
42947
+ reason: TrainingFailureReasonSchema,
42948
+ stage: string().nullable(),
42949
+ detail: string()
42950
+ }).nullable(),
42951
+ request: TrainingJobRequestSchema,
42952
+ maxCostUsd: number().nonnegative(),
42953
+ maxRuntimeSec: number().int().positive(),
42954
+ trainer: TrainerSourceRefSchema,
42955
+ datasetLayout: RetrainExportLayoutSchema,
42956
+ /** Frame count snapshotted when the job started (audit; equals `frameIds.length`). */
42957
+ frameCount: number().int().nonnegative(),
42958
+ /** Resolved frame ids at start — the archive ships exactly these. */
42959
+ frameIds: array(string()).max(2e4).readonly(),
42960
+ /** Hash of what those frames taught at start (trainer `dataset.annotationHash`). */
42961
+ annotationHash: string(),
42962
+ dataset: object({
42963
+ bytes: number().int(),
42964
+ sha256: string(),
42965
+ uploadedAt: number()
42966
+ }).nullable(),
42967
+ split: TrainingSplitPlanSchema,
42968
+ provider: object({
42969
+ state: ProviderJobStateSchema.nullable(),
42970
+ providerJobId: string().nullable(),
42971
+ startedAt: number().nullable(),
42972
+ endedAt: number().nullable(),
42973
+ billedSeconds: number(),
42974
+ costUsd: number(),
42975
+ costIsEstimate: boolean(),
42976
+ lastPolledAt: number().nullable()
42977
+ }),
42978
+ progress: object({
42979
+ epoch: number().int().nullable(),
42980
+ epochs: number().int().nullable(),
42981
+ etaSec: number().nullable(),
42982
+ series: array(TrainingProgressPointSchema).readonly()
42983
+ }),
42984
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
42985
+ logTail: array(string()).readonly(),
42986
+ logCursor: string().nullable(),
42987
+ artifacts: object({
42988
+ bundleBytes: number().int(),
42989
+ bundleSha256: string(),
42990
+ fetchedAt: number(),
42991
+ /** When the staged artefacts are deleted from the hub. */
42992
+ expiresAt: number()
42993
+ }).nullable(),
42994
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
42995
+ cloudDatasetDeletedAt: number().nullable(),
42996
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
42997
+ cloudCleanupDueAt: number().nullable(),
42998
+ /** Model ids registered from this job (base, and int8 when kept). */
42999
+ registeredModelIds: array(string()).readonly(),
43000
+ canary: TrainingCanarySchema.nullable()
43001
+ });
43002
+ var IdInput = object({ id: string().min(1) });
43003
+ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
43004
+ auth: "admin",
43005
+ timeoutMs: 6e4
43006
+ }), method(TrainingJobRequestSchema.extend({
43007
+ name: string().min(1).max(120),
43008
+ maxCostUsd: number().positive(),
43009
+ maxRuntimeSec: number().int().positive(),
43010
+ idempotencyKey: string().min(8).max(80)
43011
+ }), discriminatedUnion("kind", [object({
43012
+ kind: literal("started"),
43013
+ job: TrainingJobSchema
43014
+ }), object({
43015
+ kind: literal("refused"),
43016
+ reason: TrainingRefusalReasonSchema,
43017
+ detail: string()
43018
+ })]), {
43019
+ kind: "mutation",
43020
+ auth: "admin",
43021
+ timeoutMs: 12e4
43022
+ }), method(TrainingJobRequestSchema.omit({ baseModelId: true }).extend({
43023
+ baseModelIds: array(string().min(1)).min(1),
43024
+ name: string().min(1).max(120),
43025
+ maxCostUsd: number().positive(),
43026
+ maxRuntimeSec: number().int().positive(),
43027
+ idempotencyKey: string().min(8).max(80)
43028
+ }), discriminatedUnion("kind", [object({
43029
+ kind: literal("started"),
43030
+ batchId: string(),
43031
+ jobs: array(TrainingJobSchema).min(1).readonly()
43032
+ }), object({
43033
+ kind: literal("refused"),
43034
+ reason: TrainingRefusalReasonSchema,
43035
+ detail: string()
43036
+ })]), {
43037
+ kind: "mutation",
43038
+ auth: "admin",
43039
+ timeoutMs: 12e4
43040
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
43041
+ kind: "mutation",
43042
+ auth: "admin",
43043
+ timeoutMs: 12e4
43044
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
43045
+ kind: "mutation",
43046
+ auth: "admin",
43047
+ timeoutMs: 30 * 6e4
43048
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
43049
+ kind: "mutation",
43050
+ auth: "admin",
43051
+ timeoutMs: 12e4
43052
+ }), method(IdInput, TrainingJobSchema, {
43053
+ kind: "mutation",
43054
+ auth: "admin",
43055
+ timeoutMs: 12e4
43056
+ }), method(IdInput, TrainingJobSchema, {
43057
+ kind: "mutation",
43058
+ auth: "admin"
43059
+ });
41419
43060
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
41420
43061
  Object.freeze({
41421
43062
  person: .5,
@@ -43564,6 +45205,12 @@ Object.freeze({
43564
45205
  addonId: null,
43565
45206
  access: "create"
43566
45207
  },
45208
+ "backup.checkBackupKey": {
45209
+ capName: "backup",
45210
+ capScope: "system",
45211
+ addonId: null,
45212
+ access: "create"
45213
+ },
43567
45214
  "backup.delete": {
43568
45215
  capName: "backup",
43569
45216
  capScope: "system",
@@ -43576,6 +45223,18 @@ Object.freeze({
43576
45223
  addonId: null,
43577
45224
  access: "delete"
43578
45225
  },
45226
+ "backup.disableEncryption": {
45227
+ capName: "backup",
45228
+ capScope: "system",
45229
+ addonId: null,
45230
+ access: "create"
45231
+ },
45232
+ "backup.getEncryption": {
45233
+ capName: "backup",
45234
+ capScope: "system",
45235
+ addonId: null,
45236
+ access: "view"
45237
+ },
43579
45238
  "backup.getEntries": {
43580
45239
  capName: "backup",
43581
45240
  capScope: "system",
@@ -43630,6 +45289,12 @@ Object.freeze({
43630
45289
  addonId: null,
43631
45290
  access: "create"
43632
45291
  },
45292
+ "backup.setupEncryption": {
45293
+ capName: "backup",
45294
+ capScope: "system",
45295
+ addonId: null,
45296
+ access: "create"
45297
+ },
43633
45298
  "backup.trigger": {
43634
45299
  capName: "backup",
43635
45300
  capScope: "system",
@@ -44182,6 +45847,12 @@ Object.freeze({
44182
45847
  addonId: null,
44183
45848
  access: "create"
44184
45849
  },
45850
+ "customModelRegistry.importModelBundle": {
45851
+ capName: "custom-model-registry",
45852
+ capScope: "system",
45853
+ addonId: null,
45854
+ access: "create"
45855
+ },
44185
45856
  "customModelRegistry.listModels": {
44186
45857
  capName: "custom-model-registry",
44187
45858
  capScope: "system",
@@ -45622,6 +47293,12 @@ Object.freeze({
45622
47293
  addonId: null,
45623
47294
  access: "view"
45624
47295
  },
47296
+ "keychainAdmin.acknowledgeReset": {
47297
+ capName: "keychain-admin",
47298
+ capScope: "system",
47299
+ addonId: null,
47300
+ access: "create"
47301
+ },
45625
47302
  "keychainAdmin.deleteOrphans": {
45626
47303
  capName: "keychain-admin",
45627
47304
  capScope: "system",
@@ -45658,6 +47335,12 @@ Object.freeze({
45658
47335
  addonId: null,
45659
47336
  access: "delete"
45660
47337
  },
47338
+ "keychainAdmin.resetReport": {
47339
+ capName: "keychain-admin",
47340
+ capScope: "system",
47341
+ addonId: null,
47342
+ access: "delete"
47343
+ },
45661
47344
  "keychainAdmin.reveal": {
45662
47345
  capName: "keychain-admin",
45663
47346
  capScope: "system",
@@ -45670,6 +47353,12 @@ Object.freeze({
45670
47353
  addonId: null,
45671
47354
  access: "create"
45672
47355
  },
47356
+ "keychainAdmin.setSystemSecret": {
47357
+ capName: "keychain-admin",
47358
+ capScope: "system",
47359
+ addonId: null,
47360
+ access: "create"
47361
+ },
45673
47362
  "keychainAdmin.status": {
45674
47363
  capName: "keychain-admin",
45675
47364
  capScope: "system",
@@ -46906,6 +48595,36 @@ Object.freeze({
46906
48595
  addonId: null,
46907
48596
  access: "view"
46908
48597
  },
48598
+ "oidcConnections.connectionFormSchema": {
48599
+ capName: "oidc-connections",
48600
+ capScope: "system",
48601
+ addonId: null,
48602
+ access: "view"
48603
+ },
48604
+ "oidcConnections.createConnection": {
48605
+ capName: "oidc-connections",
48606
+ capScope: "system",
48607
+ addonId: null,
48608
+ access: "create"
48609
+ },
48610
+ "oidcConnections.deleteConnection": {
48611
+ capName: "oidc-connections",
48612
+ capScope: "system",
48613
+ addonId: null,
48614
+ access: "delete"
48615
+ },
48616
+ "oidcConnections.listConnections": {
48617
+ capName: "oidc-connections",
48618
+ capScope: "system",
48619
+ addonId: null,
48620
+ access: "view"
48621
+ },
48622
+ "oidcConnections.updateConnection": {
48623
+ capName: "oidc-connections",
48624
+ capScope: "system",
48625
+ addonId: null,
48626
+ access: "create"
48627
+ },
46909
48628
  "osd.getStatus": {
46910
48629
  capName: "osd",
46911
48630
  capScope: "device",
@@ -46978,6 +48697,12 @@ Object.freeze({
46978
48697
  addonId: null,
46979
48698
  access: "create"
46980
48699
  },
48700
+ "osdManager.setSlotCameraEnabled": {
48701
+ capName: "osd-manager",
48702
+ capScope: "system",
48703
+ addonId: null,
48704
+ access: "create"
48705
+ },
46981
48706
  "osdManager.upsertTemplate": {
46982
48707
  capName: "osd-manager",
46983
48708
  capScope: "system",
@@ -47230,6 +48955,12 @@ Object.freeze({
47230
48955
  addonId: null,
47231
48956
  access: "view"
47232
48957
  },
48958
+ "pipelineAnalytics.getRetrainCorpusKpi": {
48959
+ capName: "pipeline-analytics",
48960
+ capScope: "device",
48961
+ addonId: null,
48962
+ access: "view"
48963
+ },
47233
48964
  "pipelineAnalytics.getRetrainExportUrl": {
47234
48965
  capName: "pipeline-analytics",
47235
48966
  capScope: "device",
@@ -47350,6 +49081,12 @@ Object.freeze({
47350
49081
  addonId: null,
47351
49082
  access: "view"
47352
49083
  },
49084
+ "pipelineAnalytics.listRetrainCorpusPage": {
49085
+ capName: "pipeline-analytics",
49086
+ capScope: "device",
49087
+ addonId: null,
49088
+ access: "view"
49089
+ },
47353
49090
  "pipelineAnalytics.listRetrainFrames": {
47354
49091
  capName: "pipeline-analytics",
47355
49092
  capScope: "device",
@@ -47380,6 +49117,12 @@ Object.freeze({
47380
49117
  addonId: null,
47381
49118
  access: "view"
47382
49119
  },
49120
+ "pipelineAnalytics.offerRetrainArchive": {
49121
+ capName: "pipeline-analytics",
49122
+ capScope: "device",
49123
+ addonId: null,
49124
+ access: "create"
49125
+ },
47383
49126
  "pipelineAnalytics.ownersWithMedia": {
47384
49127
  capName: "pipeline-analytics",
47385
49128
  capScope: "device",
@@ -47470,6 +49213,12 @@ Object.freeze({
47470
49213
  addonId: null,
47471
49214
  access: "create"
47472
49215
  },
49216
+ "pipelineAnalytics.resolveRetrainTrainingCorpus": {
49217
+ capName: "pipeline-analytics",
49218
+ capScope: "device",
49219
+ addonId: null,
49220
+ access: "view"
49221
+ },
47473
49222
  "pipelineAnalytics.restageRetrainTrack": {
47474
49223
  capName: "pipeline-analytics",
47475
49224
  capScope: "device",
@@ -49906,6 +51655,180 @@ Object.freeze({
49906
51655
  addonId: null,
49907
51656
  access: "view"
49908
51657
  },
51658
+ "training.canaryResult": {
51659
+ capName: "training",
51660
+ capScope: "system",
51661
+ addonId: null,
51662
+ access: "create"
51663
+ },
51664
+ "training.cancelJob": {
51665
+ capName: "training",
51666
+ capScope: "system",
51667
+ addonId: null,
51668
+ access: "create"
51669
+ },
51670
+ "training.discardResult": {
51671
+ capName: "training",
51672
+ capScope: "system",
51673
+ addonId: null,
51674
+ access: "create"
51675
+ },
51676
+ "training.getJob": {
51677
+ capName: "training",
51678
+ capScope: "system",
51679
+ addonId: null,
51680
+ access: "view"
51681
+ },
51682
+ "training.getJobResult": {
51683
+ capName: "training",
51684
+ capScope: "system",
51685
+ addonId: null,
51686
+ access: "view"
51687
+ },
51688
+ "training.listBaseModels": {
51689
+ capName: "training",
51690
+ capScope: "system",
51691
+ addonId: null,
51692
+ access: "view"
51693
+ },
51694
+ "training.listJobs": {
51695
+ capName: "training",
51696
+ capScope: "system",
51697
+ addonId: null,
51698
+ access: "view"
51699
+ },
51700
+ "training.planJob": {
51701
+ capName: "training",
51702
+ capScope: "system",
51703
+ addonId: null,
51704
+ access: "view"
51705
+ },
51706
+ "training.registerResult": {
51707
+ capName: "training",
51708
+ capScope: "system",
51709
+ addonId: null,
51710
+ access: "create"
51711
+ },
51712
+ "training.rollbackCanary": {
51713
+ capName: "training",
51714
+ capScope: "system",
51715
+ addonId: null,
51716
+ access: "create"
51717
+ },
51718
+ "training.startJob": {
51719
+ capName: "training",
51720
+ capScope: "system",
51721
+ addonId: null,
51722
+ access: "create"
51723
+ },
51724
+ "training.startJobBatch": {
51725
+ capName: "training",
51726
+ capScope: "system",
51727
+ addonId: null,
51728
+ access: "create"
51729
+ },
51730
+ "trainingProvider.cancelJob": {
51731
+ capName: "training-provider",
51732
+ capScope: "system",
51733
+ addonId: null,
51734
+ access: "create"
51735
+ },
51736
+ "trainingProvider.cleanupJob": {
51737
+ capName: "training-provider",
51738
+ capScope: "system",
51739
+ addonId: null,
51740
+ access: "create"
51741
+ },
51742
+ "trainingProvider.createEntry": {
51743
+ capName: "training-provider",
51744
+ capScope: "system",
51745
+ addonId: null,
51746
+ access: "create"
51747
+ },
51748
+ "trainingProvider.deleteEntry": {
51749
+ capName: "training-provider",
51750
+ capScope: "system",
51751
+ addonId: null,
51752
+ access: "delete"
51753
+ },
51754
+ "trainingProvider.describe": {
51755
+ capName: "training-provider",
51756
+ capScope: "system",
51757
+ addonId: null,
51758
+ access: "view"
51759
+ },
51760
+ "trainingProvider.describeTypes": {
51761
+ capName: "training-provider",
51762
+ capScope: "system",
51763
+ addonId: null,
51764
+ access: "view"
51765
+ },
51766
+ "trainingProvider.estimateJob": {
51767
+ capName: "training-provider",
51768
+ capScope: "system",
51769
+ addonId: null,
51770
+ access: "view"
51771
+ },
51772
+ "trainingProvider.getJob": {
51773
+ capName: "training-provider",
51774
+ capScope: "system",
51775
+ addonId: null,
51776
+ access: "view"
51777
+ },
51778
+ "trainingProvider.listEntries": {
51779
+ capName: "training-provider",
51780
+ capScope: "system",
51781
+ addonId: null,
51782
+ access: "view"
51783
+ },
51784
+ "trainingProvider.listJobEvents": {
51785
+ capName: "training-provider",
51786
+ capScope: "system",
51787
+ addonId: null,
51788
+ access: "view"
51789
+ },
51790
+ "trainingProvider.listJobs": {
51791
+ capName: "training-provider",
51792
+ capScope: "system",
51793
+ addonId: null,
51794
+ access: "view"
51795
+ },
51796
+ "trainingProvider.offerArtifact": {
51797
+ capName: "training-provider",
51798
+ capScope: "system",
51799
+ addonId: null,
51800
+ access: "create"
51801
+ },
51802
+ "trainingProvider.readResult": {
51803
+ capName: "training-provider",
51804
+ capScope: "system",
51805
+ addonId: null,
51806
+ access: "create"
51807
+ },
51808
+ "trainingProvider.submitJob": {
51809
+ capName: "training-provider",
51810
+ capScope: "system",
51811
+ addonId: null,
51812
+ access: "create"
51813
+ },
51814
+ "trainingProvider.updateEntry": {
51815
+ capName: "training-provider",
51816
+ capScope: "system",
51817
+ addonId: null,
51818
+ access: "create"
51819
+ },
51820
+ "trainingProvider.uploadDataset": {
51821
+ capName: "training-provider",
51822
+ capScope: "system",
51823
+ addonId: null,
51824
+ access: "create"
51825
+ },
51826
+ "trainingProvider.validateCredentials": {
51827
+ capName: "training-provider",
51828
+ capScope: "system",
51829
+ addonId: null,
51830
+ access: "create"
51831
+ },
49909
51832
  "turnProvider.getTurnServers": {
49910
51833
  capName: "turn-provider",
49911
51834
  capScope: "system",
@@ -49930,12 +51853,6 @@ Object.freeze({
49930
51853
  addonId: null,
49931
51854
  access: "create"
49932
51855
  },
49933
- "userManagement.createApiKey": {
49934
- capName: "user-management",
49935
- capScope: "system",
49936
- addonId: null,
49937
- access: "create"
49938
- },
49939
51856
  "userManagement.createScopedToken": {
49940
51857
  capName: "user-management",
49941
51858
  capScope: "system",
@@ -49972,12 +51889,6 @@ Object.freeze({
49972
51889
  addonId: null,
49973
51890
  access: "view"
49974
51891
  },
49975
- "userManagement.linkExternalIdentity": {
49976
- capName: "user-management",
49977
- capScope: "system",
49978
- addonId: null,
49979
- access: "create"
49980
- },
49981
51892
  "userManagement.listApiKeys": {
49982
51893
  capName: "user-management",
49983
51894
  capScope: "system",
@@ -50080,12 +51991,6 @@ Object.freeze({
50080
51991
  addonId: null,
50081
51992
  access: "create"
50082
51993
  },
50083
- "userManagement.validateApiKey": {
50084
- capName: "user-management",
50085
- capScope: "system",
50086
- addonId: null,
50087
- access: "view"
50088
- },
50089
51994
  "userManagement.validateCredentials": {
50090
51995
  capName: "user-management",
50091
51996
  capScope: "system",
@@ -53118,6 +55023,11 @@ Object.freeze({
53118
55023
  form: "single",
53119
55024
  optional: false
53120
55025
  }],
55026
+ "osdManager.setSlotCameraEnabled": [{
55027
+ name: "deviceId",
55028
+ form: "single",
55029
+ optional: false
55030
+ }],
53121
55031
  "petFeeder.callPet": [{
53122
55032
  name: "deviceId",
53123
55033
  form: "single",
@@ -53338,6 +55248,11 @@ Object.freeze({
53338
55248
  form: "array",
53339
55249
  optional: false
53340
55250
  }],
55251
+ "pipelineAnalytics.listRetrainCorpusPage": [{
55252
+ name: "deviceIds",
55253
+ form: "array",
55254
+ optional: true
55255
+ }],
53341
55256
  "pipelineAnalytics.listRetrainStaging": [{
53342
55257
  name: "deviceIds",
53343
55258
  form: "array",
@@ -54199,6 +56114,11 @@ Object.freeze({
54199
56114
  form: "single",
54200
56115
  optional: false
54201
56116
  }],
56117
+ "training.canaryResult": [{
56118
+ name: "deviceIds",
56119
+ form: "array",
56120
+ optional: false
56121
+ }],
54202
56122
  "update.getStatus": [{
54203
56123
  name: "deviceId",
54204
56124
  form: "single",
@@ -54442,6 +56362,7 @@ Object.freeze({
54442
56362
  });
54443
56363
  Object.freeze({
54444
56364
  "broker": "broker",
56365
+ "calendar-source": "calendar",
54445
56366
  "device-export": "device-export",
54446
56367
  "llm": "ai",
54447
56368
  "mesh-network": "mesh",
@@ -54927,6 +56848,8 @@ var STATE_SUMMARY_VARS = [
54927
56848
  [...RULE_TEXT],
54928
56849
  [...RULE_TEXT],
54929
56850
  [...RULE_TEXT],
56851
+ [...RULE_TEXT],
56852
+ [...RULE_TEXT],
54930
56853
  ([...RULE_TEXT], [...UPDATES]),
54931
56854
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
54932
56855
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),