@camstack/addon-provider-velux 0.2.124 → 0.2.126

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
@@ -5376,7 +5376,7 @@ var ZodIssueCode = {
5376
5376
  var ZodFirstPartyTypeKind;
5377
5377
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5378
5378
  //#endregion
5379
- //#region ../types/dist/sleep-Cr5YOk3m.mjs
5379
+ //#region ../types/dist/sleep-DwAQ9sqX.mjs
5380
5380
  /**
5381
5381
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5382
5382
  * window to float samples (D455).
@@ -5493,7 +5493,7 @@ function isKeychainStoredField(field) {
5493
5493
  var SECRET_CLEAR = { $secretClear: true };
5494
5494
  /** The `'***'` token D634 redaction writes for non-admins. */
5495
5495
  var LEGACY_DEVICE_REDACTION = "***";
5496
- function isRecord$1(value) {
5496
+ function isRecord$2(value) {
5497
5497
  return typeof value === "object" && value !== null && !Array.isArray(value);
5498
5498
  }
5499
5499
  function makeSecretMarker(ref) {
@@ -5504,12 +5504,12 @@ function makeSecretMarker(ref) {
5504
5504
  }
5505
5505
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5506
5506
  function isSecretMarker(value) {
5507
- if (!isRecord$1(value)) return false;
5507
+ if (!isRecord$2(value)) return false;
5508
5508
  const ref = value["$secret"];
5509
5509
  return typeof ref === "string" && ref.length > 0;
5510
5510
  }
5511
5511
  function isSecretClear(value) {
5512
- return isRecord$1(value) && value["$secretClear"] === true;
5512
+ return isRecord$2(value) && value["$secretClear"] === true;
5513
5513
  }
5514
5514
  /**
5515
5515
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6025,6 +6025,13 @@ function globalSecretScope() {
6025
6025
  function encodeSegment(value) {
6026
6026
  return encodeURIComponent(value);
6027
6027
  }
6028
+ function decodeSegment(value) {
6029
+ try {
6030
+ return decodeURIComponent(value);
6031
+ } catch {
6032
+ return null;
6033
+ }
6034
+ }
6028
6035
  /**
6029
6036
  * The field path of a value inside an array item, addressed by the item's id:
6030
6037
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6033,6 +6040,75 @@ function encodeSegment(value) {
6033
6040
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6034
6041
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6035
6042
  }
6043
+ function parseScope(segments) {
6044
+ switch (segments[0]) {
6045
+ case "global": return {
6046
+ scope: GLOBAL_SCOPE,
6047
+ used: 1
6048
+ };
6049
+ case "node": {
6050
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6051
+ return nodeId === null || nodeId.length === 0 ? null : {
6052
+ scope: {
6053
+ kind: "node",
6054
+ nodeId
6055
+ },
6056
+ used: 2
6057
+ };
6058
+ }
6059
+ case "device": {
6060
+ const raw = segments[1];
6061
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6062
+ return {
6063
+ scope: {
6064
+ kind: "device",
6065
+ deviceId: Number(raw)
6066
+ },
6067
+ used: 2
6068
+ };
6069
+ }
6070
+ case "integration": {
6071
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6072
+ return id === null || id.length === 0 ? null : {
6073
+ scope: {
6074
+ kind: "integration",
6075
+ integrationId: id
6076
+ },
6077
+ used: 2
6078
+ };
6079
+ }
6080
+ case "row": {
6081
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6082
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6083
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6084
+ return {
6085
+ scope: {
6086
+ kind: "row",
6087
+ collection,
6088
+ rowId
6089
+ },
6090
+ used: 3
6091
+ };
6092
+ }
6093
+ default: return null;
6094
+ }
6095
+ }
6096
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6097
+ function parseSecretRef(ref) {
6098
+ if (!ref.startsWith("secret://")) return null;
6099
+ const segments = ref.slice(9).split("/");
6100
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6101
+ if (owner === null || owner.length === 0) return null;
6102
+ const parsed = parseScope(segments.slice(1));
6103
+ if (parsed === null) return null;
6104
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6105
+ if (fieldPath.length === 0) return null;
6106
+ return {
6107
+ owner,
6108
+ scope: parsed.scope,
6109
+ fieldPath
6110
+ };
6111
+ }
6036
6112
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6037
6113
  var KeychainWriteRefusedError = class extends Error {
6038
6114
  fieldPath;
@@ -6043,7 +6119,7 @@ var KeychainWriteRefusedError = class extends Error {
6043
6119
  }
6044
6120
  };
6045
6121
  var KEEP = { kind: "keep" };
6046
- function isRecord(value) {
6122
+ function isRecord$1(value) {
6047
6123
  return typeof value === "object" && value !== null && !Array.isArray(value);
6048
6124
  }
6049
6125
  function defaultMintId() {
@@ -6056,7 +6132,7 @@ function collectSecretMarkerRefs(value, out = []) {
6056
6132
  return out;
6057
6133
  }
6058
6134
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6059
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6135
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6060
6136
  return out;
6061
6137
  }
6062
6138
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6111,7 +6187,7 @@ function rowId(row, idKey) {
6111
6187
  return null;
6112
6188
  }
6113
6189
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6114
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6190
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6115
6191
  if (!Array.isArray(incoming)) {
6116
6192
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6117
6193
  return {
@@ -6127,7 +6203,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6127
6203
  const kept = /* @__PURE__ */ new Set();
6128
6204
  const rows = [];
6129
6205
  for (const row of incoming) {
6130
- if (!isRecord(row)) {
6206
+ if (!isRecord$1(row)) {
6131
6207
  rows.push(row);
6132
6208
  continue;
6133
6209
  }
@@ -6152,7 +6228,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6152
6228
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6153
6229
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6154
6230
  case "object": {
6155
- if (!isRecord(incoming)) {
6231
+ if (!isRecord$1(incoming)) {
6156
6232
  if (incoming === void 0) return KEEP;
6157
6233
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6158
6234
  return {
@@ -6160,7 +6236,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6160
6236
  value: incoming
6161
6237
  };
6162
6238
  }
6163
- const storedObj = isRecord(stored) ? stored : {};
6239
+ const storedObj = isRecord$1(stored) ? stored : {};
6164
6240
  return {
6165
6241
  kind: "value",
6166
6242
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6219,12 +6295,19 @@ async function transformSecretWrite(input) {
6219
6295
  }
6220
6296
  };
6221
6297
  }
6298
+ /** Is `ref` one of `owner`'s refs? */
6299
+ function isSecretRefOwnedBy(ref, owner) {
6300
+ return parseSecretRef(ref)?.owner === owner;
6301
+ }
6222
6302
  /**
6223
6303
  * Replace every marker in `value` with its keychain value. Returns the SAME
6224
6304
  * reference when there is no marker (no allocation, no keychain call).
6225
6305
  */
6226
- async function resolveSecretMarkers(value, secrets) {
6227
- const refs = collectSecretMarkerRefs(value);
6306
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6307
+ const keepMarker = options.unresolved === "keep-marker";
6308
+ const owner = options.ownedBy;
6309
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6310
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6228
6311
  if (refs.length === 0) return {
6229
6312
  value,
6230
6313
  unresolved: []
@@ -6248,10 +6331,18 @@ async function resolveSecretMarkers(value, secrets) {
6248
6331
  }
6249
6332
  const substitute = (v) => {
6250
6333
  if (isSecretMarker(v)) {
6334
+ if (!inScope(v.$secret)) return {
6335
+ keep: true,
6336
+ value: v
6337
+ };
6251
6338
  const answer = answers[v.$secret];
6252
- return answer?.kind === "value" ? {
6339
+ if (answer?.kind === "value") return {
6253
6340
  keep: true,
6254
6341
  value: answer.value
6342
+ };
6343
+ return keepMarker ? {
6344
+ keep: true,
6345
+ value: v
6255
6346
  } : {
6256
6347
  keep: false,
6257
6348
  value: void 0
@@ -6268,7 +6359,7 @@ async function resolveSecretMarkers(value, secrets) {
6268
6359
  value: items
6269
6360
  };
6270
6361
  }
6271
- if (isRecord(v)) {
6362
+ if (isRecord$1(v)) {
6272
6363
  const out = {};
6273
6364
  for (const [k, child] of Object.entries(v)) {
6274
6365
  const s = substitute(child);
@@ -6289,14 +6380,152 @@ async function resolveSecretMarkers(value, secrets) {
6289
6380
  unresolved
6290
6381
  };
6291
6382
  }
6292
- function touchesTree(tree, patch) {
6293
- if (tree.size === 0) return false;
6294
- for (const key of Object.keys(patch)) {
6295
- const at = key.indexOf("@");
6296
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6383
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6384
+ var SecretOverwriteRefusedError = class extends Error {
6385
+ ref;
6386
+ reason;
6387
+ constructor(ref, reason) {
6388
+ 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.`);
6389
+ this.ref = ref;
6390
+ this.reason = reason;
6391
+ this.name = "SecretOverwriteRefusedError";
6392
+ }
6393
+ };
6394
+ function isRecord(value) {
6395
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6396
+ }
6397
+ function resolvedValue(pass, marker) {
6398
+ const answer = pass.answers[marker.$secret];
6399
+ return answer?.kind === "value" ? answer.value : null;
6400
+ }
6401
+ async function atMarker(pass, incoming, stored) {
6402
+ if (incoming === null) return stored;
6403
+ if (typeof incoming !== "string") return incoming;
6404
+ if (incoming === resolvedValue(pass, stored)) return stored;
6405
+ const intent = classifySecretWrite(incoming);
6406
+ if (intent.kind !== "set") return stored;
6407
+ const ref = stored.$secret;
6408
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6409
+ const answer = pass.answers[ref];
6410
+ 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);
6411
+ try {
6412
+ await pass.secrets.put(ref, intent.value);
6413
+ } catch (err) {
6414
+ throw new KeychainWriteRefusedError(ref, err);
6415
+ }
6416
+ pass.changedRefs.push(ref);
6417
+ return stored;
6418
+ }
6419
+ function inArray(pass, incoming, stored) {
6420
+ return incoming.map((item, index) => {
6421
+ const twin = stored[index];
6422
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6423
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6424
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6425
+ return item;
6426
+ });
6427
+ }
6428
+ function inArrayRow(pass, incoming, stored) {
6429
+ const out = { ...incoming };
6430
+ for (const [key, value] of Object.entries(incoming)) {
6431
+ const twin = stored[key];
6432
+ if (isSecretMarker(twin)) {
6433
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6434
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6435
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6436
+ }
6437
+ return out;
6438
+ }
6439
+ async function walk(pass, incoming, stored) {
6440
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6441
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6442
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6443
+ const out = { ...incoming };
6444
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6445
+ return out;
6446
+ }
6447
+ /** Restore markers a write-back carries as values. See the file doc. */
6448
+ async function restoreUnchangedSecrets(input) {
6449
+ const refs = [];
6450
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6451
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6452
+ if (owned.length === 0) return {
6453
+ patch: input.patch,
6454
+ changedRefs: []
6455
+ };
6456
+ const pass = {
6457
+ secrets: input.secrets,
6458
+ answers: await input.secrets.resolve([...new Set(owned)]),
6459
+ operatorWrite: input.operatorWrite,
6460
+ changedRefs: []
6461
+ };
6462
+ const out = {};
6463
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6464
+ return {
6465
+ patch: out,
6466
+ changedRefs: pass.changedRefs
6467
+ };
6468
+ }
6469
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6470
+ function isJsonEqual(a, b) {
6471
+ if (Object.is(a, b)) return true;
6472
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6473
+ if (isRecord(a) && isRecord(b)) {
6474
+ const keys = Object.keys(a);
6475
+ if (keys.length !== Object.keys(b).length) return false;
6476
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6297
6477
  }
6298
6478
  return false;
6299
6479
  }
6480
+ /** The patch without the keys whose value already equals the stored one. */
6481
+ function dropUnchangedKeys(patch, stored) {
6482
+ const out = {};
6483
+ for (const [key, value] of Object.entries(patch)) {
6484
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6485
+ out[key] = value;
6486
+ }
6487
+ return out;
6488
+ }
6489
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6490
+ function markerKeysOf(blob, owner) {
6491
+ const keys = /* @__PURE__ */ new Set();
6492
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6493
+ return keys;
6494
+ }
6495
+ function nodeFromStored(value, owner) {
6496
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6497
+ if (!isRecord(value)) return null;
6498
+ const children = /* @__PURE__ */ new Map();
6499
+ for (const [key, child] of Object.entries(value)) {
6500
+ const node = nodeFromStored(child, owner);
6501
+ if (node !== null) children.set(key, node);
6502
+ }
6503
+ return children.size > 0 ? {
6504
+ kind: "object",
6505
+ children
6506
+ } : null;
6507
+ }
6508
+ /**
6509
+ * The declared secret tree, widened by every place the STORED blob holds a
6510
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6511
+ * never declared: Wyze before b4906cec6) still gets the save path's
6512
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6513
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6514
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6515
+ * builtin that keeps another addon's marker (device-manager) never takes it
6516
+ * over.
6517
+ */
6518
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6519
+ const added = /* @__PURE__ */ new Map();
6520
+ for (const key of keys) {
6521
+ const at = key.indexOf("@");
6522
+ const base = at > 0 ? key.slice(0, at) : key;
6523
+ if (declared.has(base) || added.has(base)) continue;
6524
+ const node = nodeFromStored(stored[key], owner);
6525
+ if (node !== null) added.set(base, node);
6526
+ }
6527
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6528
+ }
6300
6529
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6301
6530
  async function readStoredAddonBlob(raw) {
6302
6531
  const threeWay = raw.readAddonStoreResult;
@@ -6305,7 +6534,41 @@ async function readStoredAddonBlob(raw) {
6305
6534
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6306
6535
  return result.kind === "missing" ? {} : result.value;
6307
6536
  }
6308
- function createSecretAwareSettings(raw, opts) {
6537
+ function touchesTree(tree, patch) {
6538
+ if (tree.size === 0) return false;
6539
+ for (const key of Object.keys(patch)) {
6540
+ const at = key.indexOf("@");
6541
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6542
+ }
6543
+ return false;
6544
+ }
6545
+ /**
6546
+ * Which top-level keys of each store held markers when last seen. `undefined`
6547
+ * for a store not seen yet: its first write reads it, to be safe.
6548
+ */
6549
+ var MarkerKeyIndex = class {
6550
+ owner;
6551
+ byStore = /* @__PURE__ */ new Map();
6552
+ constructor(owner) {
6553
+ this.owner = owner;
6554
+ }
6555
+ seen(store, blob) {
6556
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6557
+ }
6558
+ wrote(store, patch) {
6559
+ const keys = this.byStore.get(store);
6560
+ if (keys === void 0) return;
6561
+ const now = markerKeysOf(patch, this.owner);
6562
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6563
+ else keys.delete(key);
6564
+ }
6565
+ mayHoldMarkers(store, patch) {
6566
+ const keys = this.byStore.get(store);
6567
+ if (keys === void 0) return true;
6568
+ return Object.keys(patch).some((key) => keys.has(key));
6569
+ }
6570
+ };
6571
+ function createHandle(raw, opts) {
6309
6572
  const chains = /* @__PURE__ */ new Map();
6310
6573
  const serialize = (key, fn) => {
6311
6574
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6316,46 +6579,130 @@ function createSecretAwareSettings(raw, opts) {
6316
6579
  });
6317
6580
  return next;
6318
6581
  };
6319
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6320
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6321
- return serialize(chainKey, async () => {
6582
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6583
+ const resolveRead = async (store, blob) => {
6584
+ index.seen(store, blob);
6585
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6586
+ unresolved: "keep-marker",
6587
+ ownedBy: opts.secrets.owner
6588
+ });
6589
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6590
+ return value;
6591
+ };
6592
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6593
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6594
+ await rawWrite(patch);
6595
+ index.wrote(store, patch);
6596
+ return { changed: true };
6597
+ }
6598
+ return serialize(store, async () => {
6322
6599
  const stored = await readStored();
6600
+ index.seen(store, stored);
6601
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6602
+ const restored = await restoreUnchangedSecrets({
6603
+ patch,
6604
+ stored,
6605
+ secrets: opts.secrets,
6606
+ operatorWrite
6607
+ });
6323
6608
  const result = await transformSecretWrite({
6324
- tree,
6609
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6325
6610
  secrets: opts.secrets,
6326
- patch,
6611
+ patch: restored.patch,
6327
6612
  stored,
6328
6613
  ...scope !== void 0 ? { scope } : {},
6329
- operatorWrite: opts.isOperatorWrite?.() === true
6614
+ operatorWrite
6330
6615
  });
6331
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6616
+ const effective = dropUnchangedKeys(result.patch, stored);
6617
+ const wroteBlob = Object.keys(effective).length > 0;
6618
+ if (wroteBlob) {
6619
+ await rawWrite(effective);
6620
+ index.wrote(store, effective);
6621
+ }
6332
6622
  const { orphaned } = await result.afterWrite();
6333
6623
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6624
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6334
6625
  });
6335
6626
  };
6336
- const wrapped = {
6337
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6338
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6339
- kind: "device",
6340
- deviceId
6341
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6627
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6628
+ const readAddonStoreResult = raw.readAddonStoreResult;
6629
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6630
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6631
+ const overrides = {
6632
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6633
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6634
+ const result = await readAddonStoreResult.call(raw);
6635
+ return result.kind === "value" ? {
6636
+ kind: "value",
6637
+ value: await resolveRead("addon", result.value)
6638
+ } : result;
6639
+ } } : {},
6640
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6641
+ const result = await readAddonStoreKeyResult.call(raw, key);
6642
+ if (result.kind !== "present") return result;
6643
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6644
+ unresolved: "keep-marker",
6645
+ ownedBy: opts.secrets.owner
6646
+ });
6647
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6648
+ return {
6649
+ kind: "present",
6650
+ value: value[key]
6651
+ };
6652
+ } } : {},
6653
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6654
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6655
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6656
+ const out = /* @__PURE__ */ new Map();
6657
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6658
+ return out;
6659
+ } } : {},
6660
+ writeAddonStore: async (patch) => {
6661
+ await writeAddon(patch);
6662
+ },
6663
+ writeDeviceStore: async (deviceId, patch) => {
6664
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6665
+ kind: "device",
6666
+ deviceId
6667
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6668
+ }
6669
+ };
6670
+ return {
6671
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6672
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6673
+ const value = Reflect.get(target, prop, receiver);
6674
+ return typeof value === "function" ? value.bind(target) : value;
6675
+ } }),
6676
+ raw: {
6677
+ readAddonStore: async () => {
6678
+ const blob = await raw.readAddonStore();
6679
+ index.seen("addon", blob);
6680
+ return blob;
6681
+ },
6682
+ readDeviceStore: async (deviceId) => {
6683
+ const blob = await raw.readDeviceStore(deviceId);
6684
+ index.seen(`device:${deviceId}`, blob);
6685
+ return blob;
6686
+ }
6687
+ },
6688
+ writeAddonStore: writeAddon
6342
6689
  };
6343
- return new Proxy(raw, { get(target, prop, receiver) {
6344
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6345
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6346
- const value = Reflect.get(target, prop, receiver);
6347
- return typeof value === "function" ? value.bind(target) : value;
6348
- } });
6349
6690
  }
6350
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6351
- function withSecretAwareSettings(context, opts) {
6691
+ /** The context the addon sees, plus the private raw view and write outcome. */
6692
+ function createSecretAwareContext(context, opts) {
6352
6693
  const raw = context.settings;
6353
- if (raw === void 0) return context;
6354
- const settings = createSecretAwareSettings(raw, opts);
6355
- return new Proxy(context, { get(target, prop, receiver) {
6356
- if (prop === "settings") return settings;
6357
- return Reflect.get(target, prop, receiver);
6358
- } });
6694
+ if (raw === void 0) return {
6695
+ context,
6696
+ handle: null
6697
+ };
6698
+ const handle = createHandle(raw, opts);
6699
+ return {
6700
+ context: new Proxy(context, { get(target, prop, receiver) {
6701
+ if (prop === "settings") return handle.settings;
6702
+ return Reflect.get(target, prop, receiver);
6703
+ } }),
6704
+ handle
6705
+ };
6359
6706
  }
6360
6707
  var LEAF = { kind: "leaf" };
6361
6708
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6530,6 +6877,14 @@ var BaseAddon = class {
6530
6877
  _secretChangeUnsub = null;
6531
6878
  /** >0 while an OPERATOR's settings write is being applied. */
6532
6879
  _operatorWriteDepth = 0;
6880
+ /**
6881
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6882
+ * to the marker-bearing blobs and stays private to this class: the form
6883
+ * hydrate and config resolution need markers, addon code never does.
6884
+ */
6885
+ _secretSettings = null;
6886
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6887
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6533
6888
  constructor(defaults) {
6534
6889
  this.defaults = defaults;
6535
6890
  this._config = { ...defaults };
@@ -6566,13 +6921,21 @@ var BaseAddon = class {
6566
6921
  }
6567
6922
  async initialize(context) {
6568
6923
  const secrets = context.secrets;
6569
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6570
- secrets,
6571
- addonTree: () => this.addonSecretTree(),
6572
- deviceTree: () => this.deviceSecretTree(),
6573
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6574
- isOperatorWrite: () => this._operatorWriteDepth > 0
6575
- }) : context;
6924
+ if (secrets !== void 0) {
6925
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6926
+ secrets,
6927
+ addonTree: () => this.addonSecretTree(),
6928
+ deviceTree: () => this.deviceSecretTree(),
6929
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6930
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6931
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6932
+ });
6933
+ this._ctx = wrapped;
6934
+ this._secretSettings = handle;
6935
+ } else {
6936
+ this._ctx = context;
6937
+ this._secretSettings = null;
6938
+ }
6576
6939
  await this.resolveConfig();
6577
6940
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6578
6941
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6689,11 +7052,8 @@ var BaseAddon = class {
6689
7052
  async getGlobalSettings(overlay, cap, nodeId) {
6690
7053
  const schema = this.globalSettingsSchema(cap);
6691
7054
  if (!schema) return { sections: [] };
6692
- const projected = await this.resolveGlobalStore(nodeId, cap);
6693
- return hydrateSchema(schema, overlay ? {
6694
- ...projected,
6695
- ...overlay
6696
- } : projected, { inlineSecretsAsViews: true });
7055
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7056
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6697
7057
  }
6698
7058
  /**
6699
7059
  * The integration-level view of this addon's settings: exactly the sections
@@ -6738,7 +7098,7 @@ var BaseAddon = class {
6738
7098
  });
6739
7099
  }
6740
7100
  if (sections.length === 0) return null;
6741
- const projected = await this.resolveGlobalStore(nodeId);
7101
+ const projected = await this.readRawProjectedStore(nodeId);
6742
7102
  return hydrateSchema({
6743
7103
  ...schema,
6744
7104
  sections
@@ -6755,12 +7115,50 @@ var BaseAddon = class {
6755
7115
  * the store for custom option logic (option narrowing, value snapping) to
6756
7116
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6757
7117
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7118
+ *
7119
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7120
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7121
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7122
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7123
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7124
+ * resolved blob back is a no-op for every unchanged secret.
6758
7125
  */
6759
7126
  async resolveGlobalStore(nodeId, cap) {
6760
7127
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7128
+ return this.projectForNode(raw, nodeId, cap);
7129
+ }
7130
+ projectForNode(store, nodeId, cap) {
6761
7131
  const keys = this.perNodeKeys(cap);
6762
7132
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6763
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7133
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7134
+ }
7135
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7136
+ async readRawProjectedStore(nodeId, cap) {
7137
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7138
+ return this.projectForNode(raw, nodeId, cap);
7139
+ }
7140
+ /**
7141
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7142
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7143
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7144
+ * its value.
7145
+ */
7146
+ async overlayKeepingMarkers(stored, overlay) {
7147
+ const secrets = this._ctx?.secrets;
7148
+ const merged = {
7149
+ ...stored,
7150
+ ...overlay
7151
+ };
7152
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7153
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7154
+ unresolved: "keep-marker",
7155
+ ownedBy: secrets.owner
7156
+ });
7157
+ for (const key of Object.keys(overlay)) {
7158
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7159
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7160
+ }
7161
+ return merged;
6764
7162
  }
6765
7163
  /**
6766
7164
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6825,8 +7223,12 @@ var BaseAddon = class {
6825
7223
  async clearSecrets(keys, nodeId) {
6826
7224
  const tree = this.addonSecretTree();
6827
7225
  const keychain = this._ctx?.secrets !== void 0;
7226
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6828
7227
  const patch = {};
6829
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7228
+ for (const key of keys) {
7229
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7230
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7231
+ }
6830
7232
  await this.applyGlobalPatch(patch, nodeId);
6831
7233
  }
6832
7234
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6834,7 +7236,11 @@ var BaseAddon = class {
6834
7236
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6835
7237
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6836
7238
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6837
- await this._ctx?.settings?.writeAddonStore(scoped);
7239
+ const handle = this._secretSettings;
7240
+ if (handle !== null) {
7241
+ const { changed } = await handle.writeAddonStore(scoped);
7242
+ if (!changed) return;
7243
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6838
7244
  if (target !== localNode) return;
6839
7245
  await this.resolveConfig();
6840
7246
  await this.onConfigChanged();
@@ -6887,7 +7293,7 @@ var BaseAddon = class {
6887
7293
  async getDeviceSettings(deviceId) {
6888
7294
  const schema = this.deviceSettingsSchema();
6889
7295
  if (!schema) return { sections: [] };
6890
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7296
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6891
7297
  }
6892
7298
  async updateDeviceSettings(deviceId, patch) {
6893
7299
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7059,7 +7465,7 @@ var BaseAddon = class {
7059
7465
  key,
7060
7466
  schema,
7061
7467
  fallback,
7062
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7468
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7063
7469
  write: async (patch) => {
7064
7470
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7065
7471
  },
@@ -7121,6 +7527,23 @@ var BaseAddon = class {
7121
7527
  }
7122
7528
  return value;
7123
7529
  }
7530
+ /**
7531
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7532
+ * keychain the context's own view is already raw.
7533
+ */
7534
+ rawSettings() {
7535
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7536
+ }
7537
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7538
+ logUnresolvedRead(unresolved) {
7539
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7540
+ if (fresh.length === 0) return;
7541
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7542
+ 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) => ({
7543
+ ref: u.ref,
7544
+ reason: u.reason
7545
+ })) } });
7546
+ }
7124
7547
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7125
7548
  scheduleSecretReresolve(delayMs) {
7126
7549
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7147,7 +7570,7 @@ var BaseAddon = class {
7147
7570
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7148
7571
  */
7149
7572
  async readAddonStoreWithRetry() {
7150
- const settings = this._ctx?.settings;
7573
+ const settings = this.rawSettings();
7151
7574
  if (!settings) return {};
7152
7575
  const delaysMs = [
7153
7576
  150,
@@ -8959,6 +9382,16 @@ var CompositionSchema = object({
8959
9382
  seen.add(feature.cap);
8960
9383
  });
8961
9384
  });
9385
+ var NodeColorIdSchema = _enum([
9386
+ "node-a",
9387
+ "node-b",
9388
+ "node-c",
9389
+ "node-d",
9390
+ "node-e",
9391
+ "node-f",
9392
+ "node-g",
9393
+ "node-h"
9394
+ ]);
8962
9395
  new Set([
8963
9396
  "track",
8964
9397
  "face",
@@ -9450,6 +9883,278 @@ var CameraSwitchGroupSchema = object({
9450
9883
  fetchedAt: number()
9451
9884
  });
9452
9885
  /**
9886
+ * The trainer contract — what the hub hands the cloud trainer and what it
9887
+ * gets back (cloud training, D805+).
9888
+ *
9889
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
9890
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
9891
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
9892
+ * lines on stdout. These schemas are the hub's half of that boundary; the
9893
+ * trainer's pydantic models (and the JSON Schemas generated from them under
9894
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
9895
+ * change there, in the same piece of work.
9896
+ *
9897
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
9898
+ * orchestrator fills every field of a job spec explicitly.
9899
+ */
9900
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
9901
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
9902
+ /** What the trainer can export. Edge TPU is a later, separate image. */
9903
+ var TrainingExportSchema = _enum([
9904
+ "onnx",
9905
+ "openvino-fp16",
9906
+ "openvino-int8",
9907
+ "coreml-fp16"
9908
+ ]);
9909
+ var FloorsSchema = record(string(), number().min(0).max(1));
9910
+ object({
9911
+ schema: literal(TRAINING_JOB_SCHEMA),
9912
+ jobKey: string().uuid(),
9913
+ target: object({
9914
+ kind: literal("detector"),
9915
+ step: literal("object-detection")
9916
+ }),
9917
+ base: object({
9918
+ modelId: string().min(1),
9919
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
9920
+ weights: string().min(1),
9921
+ imgsz: number().int().positive()
9922
+ }),
9923
+ baseline: object({
9924
+ modelId: string().min(1),
9925
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
9926
+ onnxUrl: string().url(),
9927
+ imgsz: number().int().positive(),
9928
+ floors: FloorsSchema
9929
+ }),
9930
+ dataset: object({
9931
+ versionId: string().min(1),
9932
+ annotationHash: string(),
9933
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
9934
+ sha256: string().regex(/^[0-9a-f]{64}$/)
9935
+ }),
9936
+ split: object({
9937
+ holdoutCameras: array(number().int()),
9938
+ /** When no camera is held out: the last N days of every camera. */
9939
+ holdoutLastDays: number().int().nonnegative(),
9940
+ valFraction: number().min(0).max(.5),
9941
+ seed: number().int()
9942
+ }),
9943
+ hyper: object({
9944
+ epochs: number().int().positive(),
9945
+ batch: number().int().positive(),
9946
+ lr0: number().positive(),
9947
+ /** Layers frozen from the start of the backbone; 0 = none. */
9948
+ freeze: number().int().nonnegative(),
9949
+ patience: number().int().nonnegative(),
9950
+ seed: number().int()
9951
+ }),
9952
+ replay: object({
9953
+ source: literal("coco2017"),
9954
+ count: number().int().nonnegative()
9955
+ }),
9956
+ exports: array(TrainingExportSchema).min(1),
9957
+ calibration: object({ maxFrames: number().int().positive() }),
9958
+ floors: object({
9959
+ minSupport: number().int().positive(),
9960
+ clamp: number().min(0).max(1)
9961
+ }),
9962
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
9963
+ catalog: object({
9964
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
9965
+ name: string().min(1).max(160)
9966
+ })
9967
+ });
9968
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
9969
+ var TrainingResultFileSchema = object({
9970
+ path: string().min(1),
9971
+ bytes: number().int().nonnegative(),
9972
+ sha256: string().regex(/^[0-9a-f]{64}$/),
9973
+ format: _enum([
9974
+ "onnx",
9975
+ "openvino",
9976
+ "coreml",
9977
+ "pt"
9978
+ ]),
9979
+ variant: _enum(["base", "int8"])
9980
+ });
9981
+ var DraftFormatSchema = object({
9982
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
9983
+ url: string().min(1),
9984
+ sizeMB: number().nonnegative(),
9985
+ isDirectory: boolean().optional(),
9986
+ files: array(string()).optional(),
9987
+ runtimes: array(literal("python")).optional(),
9988
+ revision: string().min(1)
9989
+ });
9990
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
9991
+ var TrainingCatalogDraftSchema = object({
9992
+ id: string().min(1),
9993
+ name: string().min(1),
9994
+ description: string(),
9995
+ labels: array(unknown()),
9996
+ inputSize: object({
9997
+ width: number().int().positive(),
9998
+ height: number().int().positive()
9999
+ }),
10000
+ preprocessMode: literal("letterbox"),
10001
+ defaultClassFloors: FloorsSchema,
10002
+ formats: object({
10003
+ onnx: DraftFormatSchema.optional(),
10004
+ openvino: DraftFormatSchema.optional(),
10005
+ coreml: DraftFormatSchema.optional()
10006
+ })
10007
+ });
10008
+ /** One class of one model's holdout report (the eval harness's summary). */
10009
+ var TrainingEvalClassSchema = object({
10010
+ positives: number().int(),
10011
+ floor: number().nullable(),
10012
+ tp: number().int(),
10013
+ fp: number().int(),
10014
+ fn: number().int(),
10015
+ precision: number().nullable(),
10016
+ recall: number().nullable(),
10017
+ ap50: number().nullable(),
10018
+ recallByCamera: record(string(), number().nullable()).optional(),
10019
+ recallByLight: record(string(), number().nullable()).optional(),
10020
+ fpByCamera: record(string(), number()).optional(),
10021
+ smallFound: number().int().optional(),
10022
+ smallTotal: number().int().optional()
10023
+ }).passthrough();
10024
+ var TrainingEvalReportSchema = object({
10025
+ frames: number().int(),
10026
+ classes: record(string(), TrainingEvalClassSchema)
10027
+ }).passthrough();
10028
+ /**
10029
+ * A succeeded result carries every block; a failed one carries the error and
10030
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10031
+ * orchestrator checks the blocks it needs before it trusts a success.
10032
+ */
10033
+ var TrainingResultSchema = object({
10034
+ schema: literal(TRAINING_RESULT_SCHEMA),
10035
+ jobKey: string(),
10036
+ status: _enum(["succeeded", "failed"]),
10037
+ error: object({
10038
+ stage: string(),
10039
+ code: string(),
10040
+ message: string()
10041
+ }).nullable(),
10042
+ trainer: object({
10043
+ version: string(),
10044
+ revision: string()
10045
+ }),
10046
+ toolchain: record(string(), string().nullable()),
10047
+ dataset: object({
10048
+ versionId: string(),
10049
+ annotationHash: string(),
10050
+ sha256: string(),
10051
+ frames: object({
10052
+ train: number().int(),
10053
+ val: number().int(),
10054
+ holdout: number().int()
10055
+ }),
10056
+ holdoutCameras: array(number().int()),
10057
+ replayImages: number().int()
10058
+ }).optional(),
10059
+ training: object({
10060
+ epochsRun: number().int(),
10061
+ bestEpoch: number().int(),
10062
+ bestMap50: number(),
10063
+ bestMap50_95: number(),
10064
+ seconds: number()
10065
+ }).optional(),
10066
+ evaluation: object({
10067
+ holdoutFrames: number().int(),
10068
+ baseline: TrainingEvalReportSchema.nullable(),
10069
+ candidate: TrainingEvalReportSchema.nullable(),
10070
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10071
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10072
+ map50: record(string(), number().nullable())
10073
+ }).optional(),
10074
+ floors: object({
10075
+ baseline: FloorsSchema,
10076
+ candidate: FloorsSchema,
10077
+ candidateInt8: FloorsSchema.nullable(),
10078
+ notes: array(string())
10079
+ }).optional(),
10080
+ int8: object({
10081
+ kept: boolean(),
10082
+ map50Fp16: number().nullable(),
10083
+ map50Int8: number().nullable(),
10084
+ reason: string().nullable()
10085
+ }).optional(),
10086
+ exportsDropped: array(object({
10087
+ export: string(),
10088
+ reason: string()
10089
+ })).optional(),
10090
+ files: array(TrainingResultFileSchema).optional(),
10091
+ bundle: object({
10092
+ path: literal("bundle.tar"),
10093
+ bytes: number().int().nonnegative(),
10094
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10095
+ }).nullable().optional(),
10096
+ catalogDraft: object({
10097
+ base: TrainingCatalogDraftSchema,
10098
+ int8: TrainingCatalogDraftSchema.nullable()
10099
+ }).nullable().optional(),
10100
+ licence: string()
10101
+ });
10102
+ var TrainingStageSchema = _enum([
10103
+ "prepare",
10104
+ "replay",
10105
+ "train",
10106
+ "eval",
10107
+ "export",
10108
+ "package"
10109
+ ]);
10110
+ var EventBase = {
10111
+ v: literal(1),
10112
+ ts: number()
10113
+ };
10114
+ discriminatedUnion("type", [
10115
+ object({
10116
+ ...EventBase,
10117
+ type: literal("stage"),
10118
+ stage: TrainingStageSchema
10119
+ }),
10120
+ object({
10121
+ ...EventBase,
10122
+ type: literal("epoch"),
10123
+ epoch: number().int(),
10124
+ epochs: number().int(),
10125
+ boxLoss: number().nullable().optional(),
10126
+ map50: number().nullable().optional(),
10127
+ map50_95: number().nullable().optional(),
10128
+ etaSec: number().nullable().optional()
10129
+ }),
10130
+ object({
10131
+ ...EventBase,
10132
+ type: literal("metric"),
10133
+ name: string(),
10134
+ value: number()
10135
+ }),
10136
+ object({
10137
+ ...EventBase,
10138
+ type: literal("artifact"),
10139
+ path: string(),
10140
+ bytes: number(),
10141
+ sha256: string()
10142
+ }),
10143
+ object({
10144
+ ...EventBase,
10145
+ type: literal("done"),
10146
+ status: _enum(["succeeded", "failed"]),
10147
+ resultSha256: string().nullable().optional()
10148
+ }),
10149
+ object({
10150
+ ...EventBase,
10151
+ type: literal("error"),
10152
+ stage: string(),
10153
+ code: string(),
10154
+ message: string()
10155
+ })
10156
+ ]);
10157
+ /**
9453
10158
  * What the gate decided about a birth, from the CALLER's point of view.
9454
10159
  *
9455
10160
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11777,7 +12482,9 @@ var AddonHttpRouteSchema = object({
11777
12482
  "authenticated",
11778
12483
  "admin"
11779
12484
  ]).optional(),
11780
- description: string().optional()
12485
+ description: string().optional(),
12486
+ /** The hub limits this route per client address before the handler runs. */
12487
+ rateLimit: _enum(["auth"]).optional()
11781
12488
  });
11782
12489
  /**
11783
12490
  * Cross-process route invocation envelope. The hub captures the
@@ -12482,6 +13189,37 @@ var BackupDestinationInfoSchema = object({
12482
13189
  lastError: string().optional()
12483
13190
  });
12484
13191
  /**
13192
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13193
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13194
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13195
+ * with it off — which restores without a key.
13196
+ */
13197
+ var BackupArchiveEncryptionSchema = object({
13198
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13199
+ scheme: string(),
13200
+ /** 16 hex — the backup key whose secret restores this archive. */
13201
+ keyId: string()
13202
+ });
13203
+ /**
13204
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13205
+ * one new archives are encrypted to, and the retired ones older archives
13206
+ * still need. The secret key is shown once, at `setupEncryption`.
13207
+ */
13208
+ var BackupEncryptionStatusSchema = object({
13209
+ enabled: boolean(),
13210
+ active: object({
13211
+ keyId: string(),
13212
+ publicKey: string(),
13213
+ createdAt: number()
13214
+ }).nullable(),
13215
+ /** Every key ever set up, newest first. */
13216
+ keys: array(object({
13217
+ keyId: string(),
13218
+ createdAt: number(),
13219
+ retiredAt: number().nullable()
13220
+ })).readonly()
13221
+ });
13222
+ /**
12485
13223
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12486
13224
  * Same shape the destination drill-in renders. Sourced from the per-
12487
13225
  * location `manifests.json` (no per-archive tarball read required).
@@ -12493,7 +13231,9 @@ var BackupArchiveEntrySchema = object({
12493
13231
  sizeBytes: number(),
12494
13232
  label: string().optional(),
12495
13233
  /** Top-level locations included in the archive (db, addons, tls, …). */
12496
- locations: array(string()).readonly()
13234
+ locations: array(string()).readonly(),
13235
+ /** Present when the archive is encrypted; restore then needs that key. */
13236
+ encryption: BackupArchiveEncryptionSchema.optional()
12497
13237
  });
12498
13238
  var BackupEntrySchema = object({
12499
13239
  id: string(),
@@ -12502,7 +13242,8 @@ var BackupEntrySchema = object({
12502
13242
  label: string().optional(),
12503
13243
  createdAt: number(),
12504
13244
  sizeBytes: number(),
12505
- locations: array(string()).optional()
13245
+ locations: array(string()).optional(),
13246
+ encryption: BackupArchiveEncryptionSchema.optional()
12506
13247
  });
12507
13248
  var ArchiveEntrySchema = object({
12508
13249
  path: string(),
@@ -12691,10 +13432,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12691
13432
  * this list and skips entries whose path doesn't start with
12692
13433
  * any of them.
12693
13434
  */
12694
- locations: array(string()).optional()
13435
+ locations: array(string()).optional(),
13436
+ /**
13437
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13438
+ * one). The archive is decrypted into the hub's private staging
13439
+ * before the restart; the key is not stored. A wrong or missing key
13440
+ * is refused before the archive is downloaded.
13441
+ */
13442
+ backupSecretKey: string().optional()
12695
13443
  }), _void(), {
12696
13444
  kind: "mutation",
12697
13445
  auth: "admin"
13446
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13447
+ keyId: string(),
13448
+ secretKey: string(),
13449
+ publicKey: string(),
13450
+ createdAt: number(),
13451
+ replacedKeyId: string().nullable()
13452
+ }), {
13453
+ kind: "mutation",
13454
+ auth: "admin"
13455
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13456
+ kind: "mutation",
13457
+ auth: "admin"
13458
+ }), method(object({ backupSecretKey: string() }), object({
13459
+ valid: boolean(),
13460
+ keyId: string().nullable(),
13461
+ /** The hub knows this key (active or retired). */
13462
+ known: boolean(),
13463
+ /** It is the key new archives are encrypted to. */
13464
+ active: boolean(),
13465
+ error: string().optional()
13466
+ }), {
13467
+ kind: "mutation",
13468
+ auth: "admin"
12698
13469
  }), method(object({
12699
13470
  destinationId: string(),
12700
13471
  backupId: string()
@@ -14420,7 +15191,60 @@ var CustomModelDescriptorSchema = object({
14420
15191
  stepId: string(),
14421
15192
  entry: ModelCatalogEntrySchema
14422
15193
  });
14423
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15194
+ /** One regular file of an imported bundle, as the producer measured it. */
15195
+ var ModelBundleFileSchema = object({
15196
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15197
+ path: string().min(1),
15198
+ bytes: number().int().nonnegative(),
15199
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15200
+ });
15201
+ var ImportModelBundleInputSchema = object({
15202
+ /** The registry provider that keeps the model (Model Studio). */
15203
+ addonId: string(),
15204
+ stepId: string().min(1),
15205
+ /**
15206
+ * The catalog rows to register, complete, every format URL already
15207
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15208
+ * bundle may carry several rows (a base and its INT8 variant).
15209
+ */
15210
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15211
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15212
+ bundle: object({
15213
+ ticket: PeerBytesTicketSchema,
15214
+ bytes: number().int().positive(),
15215
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15216
+ }),
15217
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15218
+ files: array(ModelBundleFileSchema).min(1).max(64),
15219
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15220
+ distribute: boolean()
15221
+ });
15222
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15223
+ kind: literal("imported"),
15224
+ modelIds: array(string()).readonly(),
15225
+ distributed: array(object({
15226
+ modelId: string(),
15227
+ nodeId: string(),
15228
+ format: _enum(MODEL_FORMATS),
15229
+ ok: boolean(),
15230
+ error: string().optional()
15231
+ })).readonly()
15232
+ }), object({
15233
+ kind: literal("refused"),
15234
+ reason: _enum([
15235
+ "transfer-failed",
15236
+ "checksum-mismatch",
15237
+ "bundle-mismatch",
15238
+ "invalid-entry",
15239
+ "id-taken"
15240
+ ]),
15241
+ detail: string()
15242
+ })]);
15243
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15244
+ kind: "mutation",
15245
+ auth: "admin",
15246
+ timeoutMs: 30 * 6e4
15247
+ });
14424
15248
  /**
14425
15249
  * Query filter for settings-store collections.
14426
15250
  */
@@ -14899,6 +15723,35 @@ var KeychainKeySourceSchema = object({
14899
15723
  */
14900
15724
  sharesBackupWithDatabase: boolean()
14901
15725
  });
15726
+ /**
15727
+ * One keychain reset, as the Secrets page reports it until the operator
15728
+ * acknowledges it. Never a value: refs, counts and table names only.
15729
+ */
15730
+ var KeychainResetRecordSchema = object({
15731
+ id: string(),
15732
+ at: number(),
15733
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15734
+ actor: string(),
15735
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15736
+ lockedReason: string().nullable(),
15737
+ /** Values moved into the archive table (ciphertext under the lost key). */
15738
+ archived: number().int(),
15739
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15740
+ archivedCollection: string().nullable(),
15741
+ /**
15742
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15743
+ * so the archive can still be opened if the lost master key turns up.
15744
+ */
15745
+ archivedKeysCollection: string().nullable(),
15746
+ /**
15747
+ * `system-settings` keys whose marker the reset cleared — the cluster
15748
+ * secret's: a marker left pointing at an archived value would refuse every
15749
+ * agent forever (D797).
15750
+ */
15751
+ clearedSettingsKeys: array(string()).readonly(),
15752
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15753
+ acknowledgedAt: number().nullable()
15754
+ });
14902
15755
  var KeychainStatusSchema = object({
14903
15756
  keychain: KeychainStateSchema,
14904
15757
  /** The source of the master key in use; `null` while locked. */
@@ -14916,7 +15769,9 @@ var KeychainStatusSchema = object({
14916
15769
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
14917
15770
  retiredWraps: number().int(),
14918
15771
  recoveryKeyDownloadedAt: number().nullable(),
14919
- secretCount: number().int()
15772
+ secretCount: number().int(),
15773
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15774
+ lastReset: KeychainResetRecordSchema.nullable()
14920
15775
  });
14921
15776
  /**
14922
15777
  * Whether a stored value is still pointed at by its owner's settings.
@@ -14938,17 +15793,26 @@ var KeychainAuditActionSchema = _enum([
14938
15793
  "download-recovery-key",
14939
15794
  "delete-orphans",
14940
15795
  "reset",
15796
+ "acknowledge-reset",
14941
15797
  "initialize"
14942
15798
  ]);
14943
15799
  var KeychainAuditEntrySchema = object({
14944
15800
  id: string(),
14945
15801
  at: number(),
14946
15802
  action: KeychainAuditActionSchema,
14947
- /** `addon:<id>` | `user:<id>` | `system`. */
15803
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
14948
15804
  actor: string(),
14949
15805
  ref: string().nullable(),
14950
15806
  detail: string().nullable()
14951
15807
  });
15808
+ var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
15809
+ /**
15810
+ * Secrets the HUB itself holds (owner `system`) that no settings form shows:
15811
+ * `jwt-signing-key` — the session signing key (D797). It is always "in use",
15812
+ * never an orphan; it is generated on a fresh hub and replaced only through
15813
+ * {@link keychainAdminCapability.methods.setSystemSecret}.
15814
+ */
15815
+ var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
14952
15816
  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({
14953
15817
  value: string(),
14954
15818
  version: number().int()
@@ -14956,6 +15820,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
14956
15820
  kind: "mutation",
14957
15821
  auth: "admin",
14958
15822
  caller: "required"
15823
+ }), method(object({
15824
+ name: SystemHeldSecretNameSchema,
15825
+ value: string().min(16)
15826
+ }), object({
15827
+ ref: string(),
15828
+ version: number().int()
15829
+ }), {
15830
+ kind: "mutation",
15831
+ auth: "admin",
15832
+ caller: "required"
14959
15833
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
14960
15834
  deleted: array(string()).readonly(),
14961
15835
  kept: array(object({
@@ -14985,13 +15859,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
14985
15859
  kind: "mutation",
14986
15860
  auth: "admin",
14987
15861
  caller: "required"
14988
- }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15862
+ }), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
14989
15863
  archivedCollection: string().nullable(),
14990
15864
  archived: number().int()
14991
15865
  }), {
14992
15866
  kind: "mutation",
14993
15867
  auth: "admin",
14994
15868
  caller: "required"
15869
+ }), method(object({}), object({
15870
+ reset: KeychainResetRecordSchema.nullable(),
15871
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15872
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15873
+ kind: "mutation",
15874
+ auth: "admin",
15875
+ caller: "required"
14995
15876
  });
14996
15877
  method(_void(), object({
14997
15878
  id: string(),
@@ -17653,14 +18534,14 @@ var LlmProfileSchema = object({
17653
18534
  /** ConfigUISchema tree passed through untyped on the wire (the
17654
18535
  * notification-output `ConfigSchemaPassthrough` precedent at
17655
18536
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
17656
- var ConfigSchemaPassthrough$1 = unknown();
18537
+ var ConfigSchemaPassthrough$3 = unknown();
17657
18538
  var LlmProfileKindDescriptorSchema = object({
17658
18539
  kind: LlmProfileKindSchema,
17659
18540
  label: string(),
17660
18541
  icon: string(),
17661
18542
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
17662
18543
  addonId: string(),
17663
- configSchema: ConfigSchemaPassthrough$1
18544
+ configSchema: ConfigSchemaPassthrough$3
17664
18545
  });
17665
18546
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
17666
18547
  var LlmDefaultSchema = object({
@@ -17938,7 +18819,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17938
18819
  * `login-method` — collection cap through which auth addons contribute
17939
18820
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17940
18821
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17941
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18822
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17942
18823
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17943
18824
  * procedure aggregates them for the unauthenticated login page.
17944
18825
  *
@@ -17946,8 +18827,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17946
18827
  *
17947
18828
  * - `redirect` — a declarative button. The login page renders a generic
17948
18829
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17949
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17950
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18830
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17951
18831
  * login page needs NO change.
17952
18832
  *
17953
18833
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -17966,8 +18846,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17966
18846
  * decision.
17967
18847
  *
17968
18848
  * Every contribution carries a `stage`:
17969
- * - `primary` — shown on the first credentials screen (OIDC /
17970
- * magic-link buttons; a future usernameless passkey).
18849
+ * - `primary` — shown on the first credentials screen (OIDC
18850
+ * buttons; a usernameless passkey).
17971
18851
  * - `second-factor` — shown AFTER the password leg, gated on the
17972
18852
  * returned `factors` (passkey-as-2FA today).
17973
18853
  *
@@ -17994,7 +18874,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17994
18874
  * The provider names an external identity a signed-in user can link to
17995
18875
  * their own account (D782): `auth.listLinkableProviders` /
17996
18876
  * `beginExternalLink` offer exactly the redirect methods that set this,
17997
- * whatever their id. Absent / false — a login button only (magic-link).
18877
+ * whatever their id. Absent / false — a login button only.
17998
18878
  */
17999
18879
  linkable: boolean().optional()
18000
18880
  }),
@@ -18782,7 +19662,7 @@ var TargetKindCapsSchema = object({
18782
19662
  * the union is large and not meant for runtime validation here; the exported
18783
19663
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
18784
19664
  */
18785
- var ConfigSchemaPassthrough = unknown();
19665
+ var ConfigSchemaPassthrough$2 = unknown();
18786
19666
  var TargetKindSchema = object({
18787
19667
  kind: string(),
18788
19668
  label: string(),
@@ -18819,7 +19699,7 @@ var TargetKindSchema = object({
18819
19699
  * its raster path, which is the safe default for an unknown image.
18820
19700
  */
18821
19701
  iconMediaType: string().optional(),
18822
- configSchema: ConfigSchemaPassthrough,
19702
+ configSchema: ConfigSchemaPassthrough$2,
18823
19703
  /**
18824
19704
  * The config keys that decide WHERE this kind's secrets are sent (server,
18825
19705
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -21849,8 +22729,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21849
22729
  * `super_admin` — collapsed onto the single boolean because every
21850
22730
  * non-admin caller is governed by the same scope-check rules; the
21851
22731
  * distinction was only ever used to route role-specific procedures
21852
- * which we no longer have. Agents are admin sessions issued via
21853
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22732
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21854
22733
  * with `isAdmin: false` + an explicit scope list.
21855
22734
  */
21856
22735
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -22157,6 +23036,61 @@ var OauthIntegrationDescriptorSchema = object({
22157
23036
  });
22158
23037
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
22159
23038
  /**
23039
+ * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
23040
+ *
23041
+ * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
23042
+ * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
23043
+ * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
23044
+ * immutable after create.
23045
+ */
23046
+ var ConfigSchemaPassthrough$1 = unknown();
23047
+ var OidcConnectionSchema = object({
23048
+ id: string().min(1),
23049
+ displayName: string(),
23050
+ icon: string(),
23051
+ issuerUrl: string(),
23052
+ clientId: string(),
23053
+ /** Client id + secret present — never the secret value. */
23054
+ configured: boolean(),
23055
+ /**
23056
+ * Values for the connection form schema. `clientSecret` is a keychain
23057
+ * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
23058
+ */
23059
+ formValues: record(string(), unknown()).optional()
23060
+ });
23061
+ /**
23062
+ * Patch one connection. Omitted or empty `clientSecret` keeps the stored
23063
+ * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
23064
+ */
23065
+ var OidcConnectionUpdateInputSchema = object({
23066
+ id: string().min(1),
23067
+ displayName: string().min(1),
23068
+ icon: string().optional(),
23069
+ issuerUrl: string().optional(),
23070
+ clientId: string().optional(),
23071
+ clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
23072
+ redirectUri: string().optional(),
23073
+ scopes: string().optional(),
23074
+ usernameClaim: _enum([
23075
+ "preferred_username",
23076
+ "email",
23077
+ "sub"
23078
+ ]).optional()
23079
+ });
23080
+ method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
23081
+ id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
23082
+ displayName: string().min(1)
23083
+ }), object({ id: string() }), {
23084
+ kind: "mutation",
23085
+ auth: "admin"
23086
+ }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
23087
+ kind: "mutation",
23088
+ auth: "admin"
23089
+ }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
23090
+ kind: "mutation",
23091
+ auth: "admin"
23092
+ });
23093
+ /**
22160
23094
  * What started a camera's onboard motion (D672). `camera` is the camera's own
22161
23095
  * firmware; `sensor` is a device the operator ATTACHED to it. Absent on the
22162
23096
  * wire means the camera: only the camera-sensors bridge ever says `sensor`.
@@ -23513,21 +24447,69 @@ var RetrainFrameListSchema = object({
23513
24447
  /** What the page pre-selects — the native key frame when one survives. */
23514
24448
  autoPickMediaId: number().int().optional()
23515
24449
  });
24450
+ /** Exclusive partition of a corpus copy's annotation progress (design §4.2). */
24451
+ var RetrainFrameWorkStateSchema = _enum([
24452
+ "unannotated",
24453
+ "annotated",
24454
+ "complete"
24455
+ ]);
24456
+ /**
24457
+ * Filters for paginated corpus list, KPI, and matching export (design §4.4).
24458
+ * Every narrowing field is ANDed; omitted fields impose no constraint.
24459
+ */
24460
+ var RetrainCorpusFilterSchema = object({
24461
+ workState: RetrainFrameWorkStateSchema.optional(),
24462
+ deviceIds: array(number()).max(500).optional(),
24463
+ /** When set, only frames in this named collection. */
24464
+ collectionId: string().optional(),
24465
+ /** Frames that carry at least one saved annotation in one of these classes. */
24466
+ classes: array(RetrainMacroClassSchema).optional(),
24467
+ page: number().int().positive().default(1),
24468
+ pageSize: number().int().positive().max(100).default(50)
24469
+ });
24470
+ var RetrainCorpusPageSchema = object({
24471
+ frames: array(RetrainFrameSchema.extend({ workState: RetrainFrameWorkStateSchema })).readonly(),
24472
+ total: number().int().nonnegative(),
24473
+ page: number().int().positive(),
24474
+ pageSize: number().int().positive()
24475
+ });
24476
+ var RetrainCorpusKpiCameraRowSchema = object({
24477
+ deviceId: number(),
24478
+ unannotated: number().int().nonnegative(),
24479
+ annotated: number().int().nonnegative(),
24480
+ complete: number().int().nonnegative(),
24481
+ /** This camera's `complete` count divided by corpus `total`, in `[0,1]`.
24482
+ * `null` when the corpus is empty (no ratio). */
24483
+ pctOfCorpus: number().min(0).max(1).nullable()
24484
+ });
24485
+ var RetrainCorpusKpiSchema = object({
24486
+ total: number().int().nonnegative(),
24487
+ unannotated: number().int().nonnegative(),
24488
+ annotated: number().int().nonnegative(),
24489
+ complete: number().int().nonnegative(),
24490
+ cameras: array(RetrainCorpusKpiCameraRowSchema).readonly()
24491
+ });
23516
24492
  /**
23517
24493
  * Which frames an annotated export carries. Every field narrows; an empty
23518
- * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23519
- * list owned by whoever trains (the training orchestrator), so `frameIds` is
23520
- * the primitive a version export uses; `batchId` re-selects what an earlier
23521
- * export carried (`exportedInBatch`).
24494
+ * filter is every annotated copy. `frameIds` is the primitive a job or
24495
+ * download uses; `batchId` re-selects what an earlier export carried
24496
+ * (`exportedInBatch`). Frozen dataset versions were removed — live selection
24497
+ * resolves to `frameIds` at plan/start.
23522
24498
  */
23523
24499
  var RetrainExportFilterSchema = object({
23524
24500
  deviceIds: array(number()).optional(),
23525
24501
  frameIds: array(string()).max(2e4).optional(),
23526
24502
  /** Only frames in at least one of these named collections. */
23527
24503
  collectionIds: array(string()).max(200).optional(),
24504
+ /** Single collection (Frames filter bar). ANDed with `collectionIds` when both set. */
24505
+ collectionId: string().optional(),
23528
24506
  batchId: string().optional(),
23529
24507
  /** Only frames the operator marked complete (all subjects boxed). */
23530
- completeOnly: boolean().optional()
24508
+ completeOnly: boolean().optional(),
24509
+ /** Exclusive work-state partition (`workStateOf`); same as the corpus list. */
24510
+ workState: RetrainFrameWorkStateSchema.optional(),
24511
+ /** Frames with at least one saved annotation in one of these classes. */
24512
+ classes: array(RetrainMacroClassSchema).optional()
23531
24513
  });
23532
24514
  /**
23533
24515
  * `frames`: the full frame copies, boxes in `annotations.json`.
@@ -23692,6 +24674,77 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23692
24674
  ]),
23693
24675
  detail: string().optional()
23694
24676
  })]);
24677
+ /** What a dataset version is cut from. Every field narrows. */
24678
+ var RetrainDatasetSelectionSchema = object({
24679
+ deviceIds: array(number()).readonly().optional(),
24680
+ collectionIds: array(string()).max(200).readonly().optional(),
24681
+ frameIds: array(string()).max(2e4).readonly().optional()
24682
+ });
24683
+ /** The counts a dataset is judged by. */
24684
+ var RetrainDatasetStatsSchema = object({
24685
+ frames: number().int(),
24686
+ completeFrames: number().int(),
24687
+ /** `completeFrames / frames`, 0..1. */
24688
+ completeness: number(),
24689
+ /** Boxes to learn (model errors excluded). */
24690
+ subjects: number().int(),
24691
+ modelErrors: number().int(),
24692
+ /** Complete frames with no subject. */
24693
+ hardNegatives: number().int(),
24694
+ /** Subjects per class × camera × day/night. */
24695
+ cells: array(object({
24696
+ macroClass: string(),
24697
+ deviceId: number(),
24698
+ lighting: _enum([
24699
+ "day",
24700
+ "night",
24701
+ "unknown"
24702
+ ]),
24703
+ subjects: number().int(),
24704
+ frames: number().int()
24705
+ })).readonly(),
24706
+ cameras: array(object({
24707
+ deviceId: number(),
24708
+ frames: number().int(),
24709
+ completeFrames: number().int()
24710
+ })).readonly()
24711
+ });
24712
+ object({
24713
+ id: string(),
24714
+ name: string(),
24715
+ createdAt: number(),
24716
+ selection: RetrainDatasetSelectionSchema,
24717
+ layout: RetrainExportLayoutSchema,
24718
+ completeOnly: boolean(),
24719
+ frameCount: number().int(),
24720
+ annotationHash: string(),
24721
+ manifestSchema: string(),
24722
+ stats: RetrainDatasetStatsSchema
24723
+ });
24724
+ /**
24725
+ * Live training corpus criteria — same shape as `TrainingCorpusSelection` on
24726
+ * the training cap. Resolved here so plan/start and the annotated export share
24727
+ * one definition of "the frames" (`buildRetrainExportPlan`).
24728
+ */
24729
+ var RetrainTrainingCorpusSelectionSchema = object({
24730
+ collectionIds: array(string()).min(1),
24731
+ workState: _enum([
24732
+ "complete",
24733
+ "annotated_or_complete",
24734
+ "any_annotated"
24735
+ ]).default("complete")
24736
+ });
24737
+ var RetrainTrainingCorpusResolveResultSchema = discriminatedUnion("kind", [object({
24738
+ kind: literal("resolved"),
24739
+ frameIds: array(string()).max(2e4).readonly(),
24740
+ stats: RetrainDatasetStatsSchema,
24741
+ annotationHash: string(),
24742
+ layout: RetrainExportLayoutSchema
24743
+ }), object({
24744
+ kind: literal("refused"),
24745
+ reason: _enum(["unknown-collection", "no-frames"]),
24746
+ detail: string()
24747
+ })]);
23695
24748
  /** The outcome of a lifecycle move owned by the retrain page. */
23696
24749
  var RetrainTransitionResultSchema = object({
23697
24750
  trackId: string(),
@@ -24397,6 +25450,12 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24397
25450
  }), array(RetrainTrackSchema).readonly(), {
24398
25451
  kind: "query",
24399
25452
  auth: "admin"
25453
+ }), method(RetrainCorpusFilterSchema, RetrainCorpusPageSchema, {
25454
+ kind: "query",
25455
+ auth: "admin"
25456
+ }), method(object({}), RetrainCorpusKpiSchema, {
25457
+ kind: "query",
25458
+ auth: "admin"
24400
25459
  }), method(object({ trackId: string() }), RetrainFrameListSchema, {
24401
25460
  kind: "query",
24402
25461
  auth: "admin"
@@ -24481,6 +25540,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24481
25540
  kind: "mutation",
24482
25541
  auth: "admin",
24483
25542
  timeoutMs: 60 * 6e4
25543
+ }), method(object({
25544
+ filter: RetrainExportFilterSchema,
25545
+ layout: RetrainExportLayoutSchema
25546
+ }), object({
25547
+ ticket: PeerBytesTicketSchema,
25548
+ frames: number().int(),
25549
+ annotations: number().int()
25550
+ }), {
25551
+ kind: "mutation",
25552
+ auth: "admin",
25553
+ timeoutMs: 12e4
24484
25554
  }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24485
25555
  kind: "query",
24486
25556
  auth: "admin"
@@ -24507,6 +25577,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24507
25577
  }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24508
25578
  kind: "query",
24509
25579
  auth: "admin"
25580
+ }), method(RetrainTrainingCorpusSelectionSchema, RetrainTrainingCorpusResolveResultSchema, {
25581
+ kind: "query",
25582
+ auth: "admin",
25583
+ timeoutMs: 6e4
24510
25584
  }), method(object({
24511
25585
  id: string(),
24512
25586
  name: string().max(120)
@@ -25123,11 +26197,14 @@ var HardwareClassIdSchema = _enum([
25123
26197
  "intel-n-series",
25124
26198
  "apple-m-base",
25125
26199
  "apple-m-pro",
26200
+ "amd-phoenix",
25126
26201
  "unknown"
25127
26202
  ]);
25128
26203
  var AcceleratorKindSchema = _enum([
25129
26204
  "intel-npu",
25130
26205
  "intel-igpu",
26206
+ "amd-igpu",
26207
+ "amd-npu",
25131
26208
  "x86-cpu",
25132
26209
  "arm-cpu",
25133
26210
  "apple-ane",
@@ -27057,6 +28134,8 @@ var AgentPipelineSettingsSchema = object({
27057
28134
  * address is wrong (multi-homed host, NAT, custom interface).
27058
28135
  */
27059
28136
  reachableHost: string().optional(),
28137
+ /** Hub-persisted UI colour (`--color-node-*` theme tokens). */
28138
+ color: NodeColorIdSchema.optional(),
27060
28139
  /**
27061
28140
  * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
27062
28141
  * weight, steps}. Absent / all-disabled ⇒ the node's single default
@@ -27606,8 +28685,9 @@ method(object({
27606
28685
  auth: "admin"
27607
28686
  }), method(object({
27608
28687
  agentNodeId: string(),
27609
- reachableHost: string().nullable()
27610
- }), object({ success: literal(true) }), {
28688
+ reachableHost: string().nullable().optional(),
28689
+ color: NodeColorIdSchema.nullable().optional()
28690
+ }).refine((v) => v.reachableHost !== void 0 || v.color !== void 0, { message: "reachableHost or color required" }), object({ success: literal(true) }), {
27611
28691
  kind: "mutation",
27612
28692
  auth: "admin"
27613
28693
  }), method(object({
@@ -28059,8 +29139,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
28059
29139
  * `smtp-provider` — pluggable email delivery surface.
28060
29140
  *
28061
29141
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
28062
- * one for transactional / one for notifications). Consumers (magic-link,
28063
- * notifier addons, …) walk the collection and pick the first
29142
+ * one for transactional / one for notifications). Consumers (notifier
29143
+ * addons, …) walk the collection and pick the first
28064
29144
  * ready provider OR target a specific addonId.
28065
29145
  *
28066
29146
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -28239,7 +29319,7 @@ targets: array(object({
28239
29319
  })));
28240
29320
  /**
28241
29321
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
28242
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
29322
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
28243
29323
  * carrying the post-callback claims before redirecting back to
28244
29324
  * `/api/auth/sso/finish`.
28245
29325
  *
@@ -28302,7 +29382,14 @@ var SsoBridgeClaimsSchema = object({
28302
29382
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28303
29383
  * subject is unique only per issuer, so a link is bound to it.
28304
29384
  */
28305
- issuer: string().optional()
29385
+ issuer: string().optional(),
29386
+ /**
29387
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
29388
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
29389
+ * request to present the matching cookie — a login bridge is useless in
29390
+ * any other browser.
29391
+ */
29392
+ browserBinding: string().optional()
28306
29393
  });
28307
29394
  method(object({
28308
29395
  claims: SsoBridgeClaimsSchema,
@@ -30676,7 +31763,7 @@ var CustomActionInputSchema = object({
30676
31763
  action: string().min(1),
30677
31764
  input: unknown()
30678
31765
  });
30679
- method(_void(), array(AddonListItemSchema).readonly()), method(object({
31766
+ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSchema).readonly()), method(object({
30680
31767
  addonId: string(),
30681
31768
  limit: number().min(1).max(500).default(100),
30682
31769
  level: LogLevelSchema$2.optional()
@@ -35738,7 +36825,13 @@ var TopologyNodeSchema = object({
35738
36825
  })).readonly(),
35739
36826
  processes: array(TopologyProcessSchema).readonly(),
35740
36827
  categories: array(TopologyCategorySchema).readonly(),
35741
- rootPackage: TopologyRootPackageSchema.nullable()
36828
+ rootPackage: TopologyRootPackageSchema.nullable(),
36829
+ /**
36830
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
36831
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
36832
+ * for offline rows and when the hub cannot tell.
36833
+ */
36834
+ meshTransport: _enum(["tls", "clear"]).optional()
35742
36835
  });
35743
36836
  var CapUsageEdgeSchema = object({
35744
36837
  callerAddonId: string(),
@@ -36151,6 +37244,7 @@ var OsdNamedTemplateSchema = object({
36151
37244
  });
36152
37245
  /** Where a slot's value comes from. */
36153
37246
  var OsdSourceSchema = discriminatedUnion("kind", [
37247
+ object({ kind: literal("none") }),
36154
37248
  object({
36155
37249
  kind: literal("static"),
36156
37250
  text: string().max(64)
@@ -36277,6 +37371,13 @@ method(object({ deviceId: number().int() }), object({
36277
37371
  }), object({ success: literal(true) }), {
36278
37372
  kind: "mutation",
36279
37373
  auth: "admin"
37374
+ }), method(object({
37375
+ deviceId: number().int(),
37376
+ slotId: string().min(1),
37377
+ enabled: boolean()
37378
+ }), object({ success: literal(true) }), {
37379
+ kind: "mutation",
37380
+ auth: "admin"
36280
37381
  }), method(object({
36281
37382
  sourceDeviceId: number().int(),
36282
37383
  targetDeviceId: number().int()
@@ -36708,7 +37809,15 @@ var GpuInfoSchema = object({
36708
37809
  name: string(),
36709
37810
  memoryMB: number().optional()
36710
37811
  });
36711
- var NpuInfoSchema = object({ type: _enum(["apple-ane", "intel-npu"]) });
37812
+ var NpuInfoSchema = object({
37813
+ type: _enum([
37814
+ "apple-ane",
37815
+ "intel-npu",
37816
+ "amd-xdna"
37817
+ ]),
37818
+ name: string().optional(),
37819
+ generation: _enum(["xdna1", "xdna2"]).optional()
37820
+ });
36712
37821
  var CoralInfoSchema = object({
36713
37822
  type: literal("coral-edgetpu"),
36714
37823
  bus: string().optional()
@@ -40561,16 +41670,6 @@ var ApiKeySummarySchema = object({
40561
41670
  createdAt: number(),
40562
41671
  lastUsedAt: number().optional()
40563
41672
  });
40564
- var CreateApiKeyInputSchema = object({
40565
- label: string(),
40566
- isAdmin: boolean().default(false),
40567
- allowedProviders: union([array(string()), literal("*")]).optional(),
40568
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
40569
- });
40570
- var CreateApiKeyResultSchema = object({
40571
- token: string(),
40572
- record: ApiKeySummarySchema
40573
- });
40574
41673
  var ScopedTokenSummarySchema = object({
40575
41674
  id: string(),
40576
41675
  userId: string(),
@@ -40669,17 +41768,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40669
41768
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
40670
41769
  kind: "mutation",
40671
41770
  access: "view"
40672
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
40673
- kind: "mutation",
40674
- auth: "admin",
40675
- access: "create"
40676
- }), method(object({ id: string() }), object({ success: literal(true) }), {
41771
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
40677
41772
  kind: "mutation",
40678
41773
  auth: "admin",
40679
41774
  access: "delete"
40680
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
40681
- kind: "mutation",
40682
- access: "view"
40683
41775
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
40684
41776
  kind: "mutation",
40685
41777
  auth: "admin",
@@ -40753,15 +41845,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40753
41845
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
40754
41846
  userId: string(),
40755
41847
  issuer: string()
40756
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
40757
- userId: string(),
40758
- issuer: string().min(1),
40759
- label: string().optional()
40760
- }), object({ success: literal(true) }), {
40761
- kind: "mutation",
40762
- auth: "admin",
40763
- access: "create"
40764
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41848
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
40765
41849
  kind: "mutation",
40766
41850
  auth: "admin",
40767
41851
  access: "delete"
@@ -41466,6 +42550,563 @@ var zoneRulesCapability = {
41466
42550
  */
41467
42551
  durability: "restored"
41468
42552
  };
42553
+ /**
42554
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
42555
+ *
42556
+ * A thin, mockable translation layer: it knows how to run a container with a
42557
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
42558
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
42559
+ * those are the `training` orchestrator's (D805). Every rule written there
42560
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
42561
+ * manifest entry and nothing else.
42562
+ *
42563
+ * Collection of provider **types** (addons). Each addon owns zero or more
42564
+ * **entries** (credentials + defaults). Concat-fans: `describe`,
42565
+ * `describeTypes`, `listEntries`, `listJobs`. Single-row work is keyed by
42566
+ * `entryId`; callers also pass the owning `addonId` as the collection
42567
+ * selector (broker posture). Every method is `admin`: these spend money.
42568
+ *
42569
+ * Every cloud object a provider creates is tagged with the orchestrator's
42570
+ * `jobKey`, so a retried submit finds the job it already started instead of
42571
+ * starting a second GPU, and `listJobs` can find orphans.
42572
+ *
42573
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
42574
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
42575
+ * ticket the provider mints (D613).
42576
+ */
42577
+ var TrainingGpuOptionSchema = object({
42578
+ id: string(),
42579
+ label: string(),
42580
+ /** List price, USD per GPU-hour, before any region multiplier. */
42581
+ usdPerHour: number().nonnegative(),
42582
+ vramGb: number().nonnegative()
42583
+ });
42584
+ var TrainingRegionOptionSchema = object({
42585
+ /** `''` = any region (the provider's choice). */
42586
+ id: string(),
42587
+ label: string(),
42588
+ priceMultiplier: number().positive()
42589
+ });
42590
+ /**
42591
+ * The provider's per-entry settings, as the orchestrator reads them. They
42592
+ * live on the PROVIDER addon's entry (operator decision 2026-10-08: they
42593
+ * depend on the user's account), never hard-coded in the orchestrator.
42594
+ */
42595
+ var TrainingProviderDefaultsSchema = object({
42596
+ gpuType: string(),
42597
+ region: string(),
42598
+ costCapUsd: number().nonnegative(),
42599
+ maxRuntimeSec: number().int().positive(),
42600
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
42601
+ failedDatasetGraceHours: number().nonnegative()
42602
+ });
42603
+ /**
42604
+ * Entry form schema for a provider type — same seam as notification
42605
+ * `TargetKind.configSchema` (`z.unknown()` at the wire; callers tighten to
42606
+ * {@link ConfigUISchema}). Drives `ConfigFormBuilder` on Training → Providers.
42607
+ */
42608
+ var ConfigSchemaPassthrough = unknown();
42609
+ /** One creatable provider type, for the Add-entry dialog. */
42610
+ var TrainingProviderTypeSchema = object({
42611
+ typeId: string(),
42612
+ label: string(),
42613
+ /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
42614
+ iconAsset: string(),
42615
+ /** Owning `training-provider` addon — collection selector for createEntry. */
42616
+ addonId: string(),
42617
+ /**
42618
+ * Fields for one entry of this type (credentials + defaults). Absent on a
42619
+ * type that only needs a name. Password fields are keychain-backed on the
42620
+ * provider addon (`secretStatePaths`), not D634 plaintext.
42621
+ */
42622
+ configSchema: ConfigSchemaPassthrough.optional()
42623
+ });
42624
+ /** One configured account / workspace under a provider type. */
42625
+ var TrainingProviderEntrySchema = object({
42626
+ entryId: string(),
42627
+ typeId: string(),
42628
+ name: string(),
42629
+ addonId: string(),
42630
+ /** Credentials are present — never the values. */
42631
+ configured: boolean()
42632
+ });
42633
+ var TrainingProviderDescriptorSchema = object({
42634
+ addonId: string(),
42635
+ entryId: string(),
42636
+ typeId: string(),
42637
+ /** Operator-chosen entry name. */
42638
+ name: string(),
42639
+ iconAsset: string(),
42640
+ /** `modal`, `runpod`, `fake`, … — same as typeId for current providers. */
42641
+ kind: string(),
42642
+ label: string(),
42643
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
42644
+ regions: array(TrainingRegionOptionSchema).readonly(),
42645
+ maxDatasetBytes: number().int().positive(),
42646
+ maxRuntimeSec: number().int().positive(),
42647
+ freeTierNote: string().optional(),
42648
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
42649
+ dataResidencyNote: string(),
42650
+ /** Credentials are present — never the values. */
42651
+ configured: boolean(),
42652
+ defaults: TrainingProviderDefaultsSchema,
42653
+ /**
42654
+ * Values for {@link TrainingProviderTypeSchema}'s `configSchema` — password
42655
+ * fields are keychain {@link SecretFieldView} or `null` / `''` (create),
42656
+ * never plaintext. Same hydrate contract as settings forms (D789).
42657
+ */
42658
+ formValues: record(string(), unknown()).optional()
42659
+ });
42660
+ /**
42661
+ * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
42662
+ * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
42663
+ * `{ $secretClear: true }` clears it.
42664
+ */
42665
+ var TrainingProviderUpdateEntryInputSchema = object({
42666
+ entryId: string().min(1),
42667
+ name: string().min(1),
42668
+ tokenId: string().optional(),
42669
+ tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
42670
+ environment: string().optional(),
42671
+ gpuType: string().optional(),
42672
+ region: string().optional(),
42673
+ costCapUsd: number().nonnegative().optional(),
42674
+ maxRuntimeSec: number().int().positive().optional(),
42675
+ failedDatasetGraceHours: number().nonnegative().optional()
42676
+ });
42677
+ var TrainingCredentialCheckSchema = object({
42678
+ ok: boolean(),
42679
+ /** Workspace / account name, when the provider says. */
42680
+ account: string().optional(),
42681
+ reason: _enum([
42682
+ "missing",
42683
+ "invalid",
42684
+ "forbidden",
42685
+ "network",
42686
+ "quota"
42687
+ ]).optional(),
42688
+ detail: string().optional()
42689
+ });
42690
+ var ProviderJobStateSchema = _enum([
42691
+ "pending",
42692
+ "starting",
42693
+ "running",
42694
+ "succeeded",
42695
+ "failed",
42696
+ "cancelled",
42697
+ "lost"
42698
+ ]);
42699
+ var ProviderJobStatusSchema = object({
42700
+ jobKey: string(),
42701
+ providerJobId: string().optional(),
42702
+ state: ProviderJobStateSchema,
42703
+ startedAt: number().optional(),
42704
+ endedAt: number().optional(),
42705
+ exitCode: number().int().optional(),
42706
+ failureReason: string().optional(),
42707
+ gpuType: string(),
42708
+ region: string().optional(),
42709
+ billedSeconds: number().nonnegative(),
42710
+ costUsd: number().nonnegative(),
42711
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
42712
+ costIsEstimate: boolean(),
42713
+ lastFetchedAt: number()
42714
+ });
42715
+ /**
42716
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
42717
+ * image its own way (Modal builds the published Dockerfile at that revision;
42718
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
42719
+ * in `result.json`.
42720
+ */
42721
+ var TrainerSourceRefSchema = object({
42722
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
42723
+ repo: string().min(1),
42724
+ /** A commit sha (never a branch) — the job must be reproducible. */
42725
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
42726
+ });
42727
+ /** Cloud job identity — route with the owning addon's `addonId` selector. */
42728
+ var JobRef = {
42729
+ entryId: string().min(1),
42730
+ jobKey: string().uuid()
42731
+ };
42732
+ var TrainingLogLineSchema = object({
42733
+ ts: number(),
42734
+ text: string()
42735
+ });
42736
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
42737
+ typeId: string().min(1),
42738
+ name: string().min(1)
42739
+ }), object({ entryId: string() }), {
42740
+ kind: "mutation",
42741
+ auth: "admin"
42742
+ }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
42743
+ kind: "mutation",
42744
+ auth: "admin"
42745
+ }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
42746
+ kind: "mutation",
42747
+ auth: "admin"
42748
+ }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
42749
+ kind: "mutation",
42750
+ auth: "admin",
42751
+ timeoutMs: 3e4
42752
+ }), method(object({
42753
+ entryId: string().min(1),
42754
+ gpuType: string(),
42755
+ region: string(),
42756
+ datasetBytes: number().int().nonnegative(),
42757
+ gpuSecondsLow: number().nonnegative(),
42758
+ gpuSecondsHigh: number().nonnegative()
42759
+ }), object({
42760
+ usdLow: number().nonnegative(),
42761
+ usdHigh: number().nonnegative(),
42762
+ notes: array(string()).readonly()
42763
+ }), { auth: "admin" }), method(object({
42764
+ ...JobRef,
42765
+ ticket: PeerBytesTicketSchema
42766
+ }), object({
42767
+ bytes: number().int().nonnegative(),
42768
+ sha256: string()
42769
+ }), {
42770
+ kind: "mutation",
42771
+ auth: "admin",
42772
+ timeoutMs: 120 * 6e4
42773
+ }), method(object({
42774
+ ...JobRef,
42775
+ trainer: TrainerSourceRefSchema,
42776
+ jobSpecJson: string().min(2).max(64e3),
42777
+ gpuType: string(),
42778
+ region: string(),
42779
+ maxRuntimeSec: number().int().positive()
42780
+ }), ProviderJobStatusSchema, {
42781
+ kind: "mutation",
42782
+ auth: "admin",
42783
+ timeoutMs: 30 * 6e4
42784
+ }), method(object(JobRef), ProviderJobStatusSchema, {
42785
+ auth: "admin",
42786
+ timeoutMs: 6e4
42787
+ }), method(object({
42788
+ ...JobRef,
42789
+ cursor: string().optional(),
42790
+ max: number().int().min(1).max(500)
42791
+ }), object({
42792
+ lines: array(TrainingLogLineSchema).readonly(),
42793
+ cursor: string()
42794
+ }), {
42795
+ auth: "admin",
42796
+ timeoutMs: 6e4
42797
+ }), method(object(JobRef), object({ ok: literal(true) }), {
42798
+ kind: "mutation",
42799
+ auth: "admin",
42800
+ timeoutMs: 6e4
42801
+ }), method(object(JobRef), object({
42802
+ found: boolean(),
42803
+ text: string().optional()
42804
+ }), {
42805
+ kind: "mutation",
42806
+ auth: "admin",
42807
+ timeoutMs: 5 * 6e4
42808
+ }), method(object({
42809
+ ...JobRef,
42810
+ path: _enum(["bundle.tar"])
42811
+ }), object({ ticket: PeerBytesTicketSchema }), {
42812
+ kind: "mutation",
42813
+ auth: "admin",
42814
+ timeoutMs: 5 * 6e4
42815
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
42816
+ kind: "mutation",
42817
+ auth: "admin",
42818
+ timeoutMs: 5 * 6e4
42819
+ }), method(object({ entryId: string().min(1).optional() }), array(ProviderJobStatusSchema).readonly(), {
42820
+ auth: "admin",
42821
+ timeoutMs: 2 * 6e4
42822
+ });
42823
+ /**
42824
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
42825
+ * provided by `addon-training`.
42826
+ *
42827
+ * It owns what every provider must agree on, written once:
42828
+ *
42829
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
42830
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
42831
+ * - **The return flow.** Verified artefacts → Model Studio
42832
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
42833
+ * rollback. Nothing is ever registered automatically.
42834
+ *
42835
+ * Plan/start takes a live {@link TrainingCorpusSelection} (collections +
42836
+ * work-state rule); frame ids are resolved via pipeline-analytics at that
42837
+ * moment and snapshotted on the job. No frozen dataset version.
42838
+ *
42839
+ * Every method is `admin`.
42840
+ */
42841
+ /**
42842
+ * Live corpus criteria for plan/start (design §5.2). Default is complete-only.
42843
+ * Frame ids are resolved at plan/start — never a frozen version id.
42844
+ */
42845
+ var TrainingCorpusSelectionSchema = object({
42846
+ collectionIds: array(string()).min(1),
42847
+ /** Default complete-only for v1 */
42848
+ workState: _enum([
42849
+ "complete",
42850
+ "annotated_or_complete",
42851
+ "any_annotated"
42852
+ ]).default("complete")
42853
+ });
42854
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
42855
+ var TrainingBaseModelSchema = object({
42856
+ modelId: string(),
42857
+ label: string(),
42858
+ weights: string(),
42859
+ imgsz: number().int(),
42860
+ baselineOnnxUrl: string(),
42861
+ baselineFloors: record(string(), number()),
42862
+ /** The base the fleet runs most — the UI's default. */
42863
+ recommended: boolean()
42864
+ });
42865
+ var TrainingPresetSchema = _enum([
42866
+ "quick",
42867
+ "standard",
42868
+ "thorough"
42869
+ ]);
42870
+ var TrainingJobRequestSchema = object({
42871
+ /** Live collection + work-state criteria; resolved at plan/start. */
42872
+ selection: TrainingCorpusSelectionSchema,
42873
+ /**
42874
+ * The provider **entry** that runs it (credentials + defaults).
42875
+ * Resolve to an owning addon via `training-provider.describe` / `listEntries`.
42876
+ */
42877
+ entryId: string().min(1),
42878
+ gpuType: string().min(1),
42879
+ region: string(),
42880
+ baseModelId: string().min(1),
42881
+ preset: TrainingPresetSchema,
42882
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
42883
+ freeze: number().int().nonnegative().nullable(),
42884
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
42885
+ holdoutCameras: array(number().int()).nullable()
42886
+ });
42887
+ var TrainingSplitPlanSchema = object({
42888
+ holdoutCameras: array(number().int()).readonly(),
42889
+ /** Used when no camera is held out: the last N days of every camera. */
42890
+ holdoutLastDays: number().int().nonnegative(),
42891
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
42892
+ holdoutSupport: record(string(), number().int()).nullable(),
42893
+ trainSubjects: number().int()
42894
+ });
42895
+ var TrainingRefusalReasonSchema = _enum([
42896
+ "unknown-dataset",
42897
+ "unknown-provider",
42898
+ "provider-not-configured",
42899
+ "unknown-base-model",
42900
+ "unknown-gpu",
42901
+ "dataset-too-large",
42902
+ "no-training-subjects",
42903
+ "job-already-running"
42904
+ ]);
42905
+ var TrainingJobPlanSchema = object({
42906
+ refusal: object({
42907
+ reason: TrainingRefusalReasonSchema,
42908
+ detail: string()
42909
+ }).nullable(),
42910
+ warnings: array(string()).readonly(),
42911
+ split: TrainingSplitPlanSchema.nullable(),
42912
+ estimate: object({
42913
+ datasetBytes: number().int(),
42914
+ uploadMinutesAt20Mbps: number(),
42915
+ gpuSecondsLow: number(),
42916
+ gpuSecondsHigh: number(),
42917
+ usdLow: number(),
42918
+ usdHigh: number(),
42919
+ notes: array(string()).readonly()
42920
+ }).nullable(),
42921
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
42922
+ defaults: object({
42923
+ maxCostUsd: number(),
42924
+ maxRuntimeSec: number().int()
42925
+ }).nullable(),
42926
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
42927
+ dataNotice: string()
42928
+ });
42929
+ /**
42930
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
42931
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
42932
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
42933
+ * result lives after the operator acted on it.
42934
+ */
42935
+ var TrainingJobStateSchema = _enum([
42936
+ "queued",
42937
+ "uploading",
42938
+ "submitted",
42939
+ "starting",
42940
+ "running",
42941
+ "collecting",
42942
+ "ready",
42943
+ "registered",
42944
+ "canary",
42945
+ "failed",
42946
+ "cancelling",
42947
+ "cancelled",
42948
+ "lost",
42949
+ "expired",
42950
+ "discarded"
42951
+ ]);
42952
+ var TrainingFailureReasonSchema = _enum([
42953
+ "cost-cap",
42954
+ "runtime-cap",
42955
+ "upload-failed",
42956
+ "submit-failed",
42957
+ "trainer-failed",
42958
+ "result-invalid",
42959
+ "checksum-mismatch",
42960
+ "fetch-failed",
42961
+ "provider-error",
42962
+ "hub-restart-during-upload"
42963
+ ]);
42964
+ var TrainingProgressPointSchema = object({
42965
+ epoch: number().int(),
42966
+ map50: number().nullable(),
42967
+ map50_95: number().nullable()
42968
+ });
42969
+ var TrainingCanarySchema = object({
42970
+ deviceIds: array(number().int()).readonly(),
42971
+ since: number(),
42972
+ /** Every override the canary replaced, exactly, so rollback restores it. */
42973
+ previous: array(object({
42974
+ deviceId: number().int(),
42975
+ nodeId: string(),
42976
+ deviceKey: string(),
42977
+ patch: object({
42978
+ modelId: string().optional(),
42979
+ settings: record(string(), unknown()).readonly().optional()
42980
+ }).nullable()
42981
+ })).readonly()
42982
+ });
42983
+ var TrainingJobSchema = object({
42984
+ id: string(),
42985
+ idempotencyKey: string(),
42986
+ name: string(),
42987
+ createdAt: number(),
42988
+ updatedAt: number(),
42989
+ state: TrainingJobStateSchema,
42990
+ /**
42991
+ * Shared by every job enqueued together via `startJobBatch`.
42992
+ * `null` for a lone `startJob`. The engine advances queued siblings by this id.
42993
+ */
42994
+ batchId: string().nullable().default(null),
42995
+ stage: TrainingStageSchema.nullable(),
42996
+ failure: object({
42997
+ reason: TrainingFailureReasonSchema,
42998
+ stage: string().nullable(),
42999
+ detail: string()
43000
+ }).nullable(),
43001
+ request: TrainingJobRequestSchema,
43002
+ maxCostUsd: number().nonnegative(),
43003
+ maxRuntimeSec: number().int().positive(),
43004
+ trainer: TrainerSourceRefSchema,
43005
+ datasetLayout: RetrainExportLayoutSchema,
43006
+ /** Frame count snapshotted when the job started (audit; equals `frameIds.length`). */
43007
+ frameCount: number().int().nonnegative(),
43008
+ /** Resolved frame ids at start — the archive ships exactly these. */
43009
+ frameIds: array(string()).max(2e4).readonly(),
43010
+ /** Hash of what those frames taught at start (trainer `dataset.annotationHash`). */
43011
+ annotationHash: string(),
43012
+ dataset: object({
43013
+ bytes: number().int(),
43014
+ sha256: string(),
43015
+ uploadedAt: number()
43016
+ }).nullable(),
43017
+ split: TrainingSplitPlanSchema,
43018
+ provider: object({
43019
+ state: ProviderJobStateSchema.nullable(),
43020
+ providerJobId: string().nullable(),
43021
+ startedAt: number().nullable(),
43022
+ endedAt: number().nullable(),
43023
+ billedSeconds: number(),
43024
+ costUsd: number(),
43025
+ costIsEstimate: boolean(),
43026
+ lastPolledAt: number().nullable()
43027
+ }),
43028
+ progress: object({
43029
+ epoch: number().int().nullable(),
43030
+ epochs: number().int().nullable(),
43031
+ etaSec: number().nullable(),
43032
+ series: array(TrainingProgressPointSchema).readonly()
43033
+ }),
43034
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
43035
+ logTail: array(string()).readonly(),
43036
+ logCursor: string().nullable(),
43037
+ artifacts: object({
43038
+ bundleBytes: number().int(),
43039
+ bundleSha256: string(),
43040
+ fetchedAt: number(),
43041
+ /** When the staged artefacts are deleted from the hub. */
43042
+ expiresAt: number()
43043
+ }).nullable(),
43044
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
43045
+ cloudDatasetDeletedAt: number().nullable(),
43046
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
43047
+ cloudCleanupDueAt: number().nullable(),
43048
+ /** Model ids registered from this job (base, and int8 when kept). */
43049
+ registeredModelIds: array(string()).readonly(),
43050
+ canary: TrainingCanarySchema.nullable()
43051
+ });
43052
+ var IdInput = object({ id: string().min(1) });
43053
+ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
43054
+ auth: "admin",
43055
+ timeoutMs: 6e4
43056
+ }), method(TrainingJobRequestSchema.extend({
43057
+ name: string().min(1).max(120),
43058
+ maxCostUsd: number().positive(),
43059
+ maxRuntimeSec: number().int().positive(),
43060
+ idempotencyKey: string().min(8).max(80)
43061
+ }), discriminatedUnion("kind", [object({
43062
+ kind: literal("started"),
43063
+ job: TrainingJobSchema
43064
+ }), object({
43065
+ kind: literal("refused"),
43066
+ reason: TrainingRefusalReasonSchema,
43067
+ detail: string()
43068
+ })]), {
43069
+ kind: "mutation",
43070
+ auth: "admin",
43071
+ timeoutMs: 12e4
43072
+ }), method(TrainingJobRequestSchema.omit({ baseModelId: true }).extend({
43073
+ baseModelIds: array(string().min(1)).min(1),
43074
+ name: string().min(1).max(120),
43075
+ maxCostUsd: number().positive(),
43076
+ maxRuntimeSec: number().int().positive(),
43077
+ idempotencyKey: string().min(8).max(80)
43078
+ }), discriminatedUnion("kind", [object({
43079
+ kind: literal("started"),
43080
+ batchId: string(),
43081
+ jobs: array(TrainingJobSchema).min(1).readonly()
43082
+ }), object({
43083
+ kind: literal("refused"),
43084
+ reason: TrainingRefusalReasonSchema,
43085
+ detail: string()
43086
+ })]), {
43087
+ kind: "mutation",
43088
+ auth: "admin",
43089
+ timeoutMs: 12e4
43090
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
43091
+ kind: "mutation",
43092
+ auth: "admin",
43093
+ timeoutMs: 12e4
43094
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
43095
+ kind: "mutation",
43096
+ auth: "admin",
43097
+ timeoutMs: 30 * 6e4
43098
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
43099
+ kind: "mutation",
43100
+ auth: "admin",
43101
+ timeoutMs: 12e4
43102
+ }), method(IdInput, TrainingJobSchema, {
43103
+ kind: "mutation",
43104
+ auth: "admin",
43105
+ timeoutMs: 12e4
43106
+ }), method(IdInput, TrainingJobSchema, {
43107
+ kind: "mutation",
43108
+ auth: "admin"
43109
+ });
41469
43110
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
41470
43111
  Object.freeze({
41471
43112
  person: .5,
@@ -43614,6 +45255,12 @@ Object.freeze({
43614
45255
  addonId: null,
43615
45256
  access: "create"
43616
45257
  },
45258
+ "backup.checkBackupKey": {
45259
+ capName: "backup",
45260
+ capScope: "system",
45261
+ addonId: null,
45262
+ access: "create"
45263
+ },
43617
45264
  "backup.delete": {
43618
45265
  capName: "backup",
43619
45266
  capScope: "system",
@@ -43626,6 +45273,18 @@ Object.freeze({
43626
45273
  addonId: null,
43627
45274
  access: "delete"
43628
45275
  },
45276
+ "backup.disableEncryption": {
45277
+ capName: "backup",
45278
+ capScope: "system",
45279
+ addonId: null,
45280
+ access: "create"
45281
+ },
45282
+ "backup.getEncryption": {
45283
+ capName: "backup",
45284
+ capScope: "system",
45285
+ addonId: null,
45286
+ access: "view"
45287
+ },
43629
45288
  "backup.getEntries": {
43630
45289
  capName: "backup",
43631
45290
  capScope: "system",
@@ -43680,6 +45339,12 @@ Object.freeze({
43680
45339
  addonId: null,
43681
45340
  access: "create"
43682
45341
  },
45342
+ "backup.setupEncryption": {
45343
+ capName: "backup",
45344
+ capScope: "system",
45345
+ addonId: null,
45346
+ access: "create"
45347
+ },
43683
45348
  "backup.trigger": {
43684
45349
  capName: "backup",
43685
45350
  capScope: "system",
@@ -44232,6 +45897,12 @@ Object.freeze({
44232
45897
  addonId: null,
44233
45898
  access: "create"
44234
45899
  },
45900
+ "customModelRegistry.importModelBundle": {
45901
+ capName: "custom-model-registry",
45902
+ capScope: "system",
45903
+ addonId: null,
45904
+ access: "create"
45905
+ },
44235
45906
  "customModelRegistry.listModels": {
44236
45907
  capName: "custom-model-registry",
44237
45908
  capScope: "system",
@@ -45672,6 +47343,12 @@ Object.freeze({
45672
47343
  addonId: null,
45673
47344
  access: "view"
45674
47345
  },
47346
+ "keychainAdmin.acknowledgeReset": {
47347
+ capName: "keychain-admin",
47348
+ capScope: "system",
47349
+ addonId: null,
47350
+ access: "create"
47351
+ },
45675
47352
  "keychainAdmin.deleteOrphans": {
45676
47353
  capName: "keychain-admin",
45677
47354
  capScope: "system",
@@ -45708,6 +47385,12 @@ Object.freeze({
45708
47385
  addonId: null,
45709
47386
  access: "delete"
45710
47387
  },
47388
+ "keychainAdmin.resetReport": {
47389
+ capName: "keychain-admin",
47390
+ capScope: "system",
47391
+ addonId: null,
47392
+ access: "delete"
47393
+ },
45711
47394
  "keychainAdmin.reveal": {
45712
47395
  capName: "keychain-admin",
45713
47396
  capScope: "system",
@@ -45720,6 +47403,12 @@ Object.freeze({
45720
47403
  addonId: null,
45721
47404
  access: "create"
45722
47405
  },
47406
+ "keychainAdmin.setSystemSecret": {
47407
+ capName: "keychain-admin",
47408
+ capScope: "system",
47409
+ addonId: null,
47410
+ access: "create"
47411
+ },
45723
47412
  "keychainAdmin.status": {
45724
47413
  capName: "keychain-admin",
45725
47414
  capScope: "system",
@@ -46956,6 +48645,36 @@ Object.freeze({
46956
48645
  addonId: null,
46957
48646
  access: "view"
46958
48647
  },
48648
+ "oidcConnections.connectionFormSchema": {
48649
+ capName: "oidc-connections",
48650
+ capScope: "system",
48651
+ addonId: null,
48652
+ access: "view"
48653
+ },
48654
+ "oidcConnections.createConnection": {
48655
+ capName: "oidc-connections",
48656
+ capScope: "system",
48657
+ addonId: null,
48658
+ access: "create"
48659
+ },
48660
+ "oidcConnections.deleteConnection": {
48661
+ capName: "oidc-connections",
48662
+ capScope: "system",
48663
+ addonId: null,
48664
+ access: "delete"
48665
+ },
48666
+ "oidcConnections.listConnections": {
48667
+ capName: "oidc-connections",
48668
+ capScope: "system",
48669
+ addonId: null,
48670
+ access: "view"
48671
+ },
48672
+ "oidcConnections.updateConnection": {
48673
+ capName: "oidc-connections",
48674
+ capScope: "system",
48675
+ addonId: null,
48676
+ access: "create"
48677
+ },
46959
48678
  "osd.getStatus": {
46960
48679
  capName: "osd",
46961
48680
  capScope: "device",
@@ -47028,6 +48747,12 @@ Object.freeze({
47028
48747
  addonId: null,
47029
48748
  access: "create"
47030
48749
  },
48750
+ "osdManager.setSlotCameraEnabled": {
48751
+ capName: "osd-manager",
48752
+ capScope: "system",
48753
+ addonId: null,
48754
+ access: "create"
48755
+ },
47031
48756
  "osdManager.upsertTemplate": {
47032
48757
  capName: "osd-manager",
47033
48758
  capScope: "system",
@@ -47280,6 +49005,12 @@ Object.freeze({
47280
49005
  addonId: null,
47281
49006
  access: "view"
47282
49007
  },
49008
+ "pipelineAnalytics.getRetrainCorpusKpi": {
49009
+ capName: "pipeline-analytics",
49010
+ capScope: "device",
49011
+ addonId: null,
49012
+ access: "view"
49013
+ },
47283
49014
  "pipelineAnalytics.getRetrainExportUrl": {
47284
49015
  capName: "pipeline-analytics",
47285
49016
  capScope: "device",
@@ -47400,6 +49131,12 @@ Object.freeze({
47400
49131
  addonId: null,
47401
49132
  access: "view"
47402
49133
  },
49134
+ "pipelineAnalytics.listRetrainCorpusPage": {
49135
+ capName: "pipeline-analytics",
49136
+ capScope: "device",
49137
+ addonId: null,
49138
+ access: "view"
49139
+ },
47403
49140
  "pipelineAnalytics.listRetrainFrames": {
47404
49141
  capName: "pipeline-analytics",
47405
49142
  capScope: "device",
@@ -47430,6 +49167,12 @@ Object.freeze({
47430
49167
  addonId: null,
47431
49168
  access: "view"
47432
49169
  },
49170
+ "pipelineAnalytics.offerRetrainArchive": {
49171
+ capName: "pipeline-analytics",
49172
+ capScope: "device",
49173
+ addonId: null,
49174
+ access: "create"
49175
+ },
47433
49176
  "pipelineAnalytics.ownersWithMedia": {
47434
49177
  capName: "pipeline-analytics",
47435
49178
  capScope: "device",
@@ -47520,6 +49263,12 @@ Object.freeze({
47520
49263
  addonId: null,
47521
49264
  access: "create"
47522
49265
  },
49266
+ "pipelineAnalytics.resolveRetrainTrainingCorpus": {
49267
+ capName: "pipeline-analytics",
49268
+ capScope: "device",
49269
+ addonId: null,
49270
+ access: "view"
49271
+ },
47523
49272
  "pipelineAnalytics.restageRetrainTrack": {
47524
49273
  capName: "pipeline-analytics",
47525
49274
  capScope: "device",
@@ -49956,6 +51705,180 @@ Object.freeze({
49956
51705
  addonId: null,
49957
51706
  access: "view"
49958
51707
  },
51708
+ "training.canaryResult": {
51709
+ capName: "training",
51710
+ capScope: "system",
51711
+ addonId: null,
51712
+ access: "create"
51713
+ },
51714
+ "training.cancelJob": {
51715
+ capName: "training",
51716
+ capScope: "system",
51717
+ addonId: null,
51718
+ access: "create"
51719
+ },
51720
+ "training.discardResult": {
51721
+ capName: "training",
51722
+ capScope: "system",
51723
+ addonId: null,
51724
+ access: "create"
51725
+ },
51726
+ "training.getJob": {
51727
+ capName: "training",
51728
+ capScope: "system",
51729
+ addonId: null,
51730
+ access: "view"
51731
+ },
51732
+ "training.getJobResult": {
51733
+ capName: "training",
51734
+ capScope: "system",
51735
+ addonId: null,
51736
+ access: "view"
51737
+ },
51738
+ "training.listBaseModels": {
51739
+ capName: "training",
51740
+ capScope: "system",
51741
+ addonId: null,
51742
+ access: "view"
51743
+ },
51744
+ "training.listJobs": {
51745
+ capName: "training",
51746
+ capScope: "system",
51747
+ addonId: null,
51748
+ access: "view"
51749
+ },
51750
+ "training.planJob": {
51751
+ capName: "training",
51752
+ capScope: "system",
51753
+ addonId: null,
51754
+ access: "view"
51755
+ },
51756
+ "training.registerResult": {
51757
+ capName: "training",
51758
+ capScope: "system",
51759
+ addonId: null,
51760
+ access: "create"
51761
+ },
51762
+ "training.rollbackCanary": {
51763
+ capName: "training",
51764
+ capScope: "system",
51765
+ addonId: null,
51766
+ access: "create"
51767
+ },
51768
+ "training.startJob": {
51769
+ capName: "training",
51770
+ capScope: "system",
51771
+ addonId: null,
51772
+ access: "create"
51773
+ },
51774
+ "training.startJobBatch": {
51775
+ capName: "training",
51776
+ capScope: "system",
51777
+ addonId: null,
51778
+ access: "create"
51779
+ },
51780
+ "trainingProvider.cancelJob": {
51781
+ capName: "training-provider",
51782
+ capScope: "system",
51783
+ addonId: null,
51784
+ access: "create"
51785
+ },
51786
+ "trainingProvider.cleanupJob": {
51787
+ capName: "training-provider",
51788
+ capScope: "system",
51789
+ addonId: null,
51790
+ access: "create"
51791
+ },
51792
+ "trainingProvider.createEntry": {
51793
+ capName: "training-provider",
51794
+ capScope: "system",
51795
+ addonId: null,
51796
+ access: "create"
51797
+ },
51798
+ "trainingProvider.deleteEntry": {
51799
+ capName: "training-provider",
51800
+ capScope: "system",
51801
+ addonId: null,
51802
+ access: "delete"
51803
+ },
51804
+ "trainingProvider.describe": {
51805
+ capName: "training-provider",
51806
+ capScope: "system",
51807
+ addonId: null,
51808
+ access: "view"
51809
+ },
51810
+ "trainingProvider.describeTypes": {
51811
+ capName: "training-provider",
51812
+ capScope: "system",
51813
+ addonId: null,
51814
+ access: "view"
51815
+ },
51816
+ "trainingProvider.estimateJob": {
51817
+ capName: "training-provider",
51818
+ capScope: "system",
51819
+ addonId: null,
51820
+ access: "view"
51821
+ },
51822
+ "trainingProvider.getJob": {
51823
+ capName: "training-provider",
51824
+ capScope: "system",
51825
+ addonId: null,
51826
+ access: "view"
51827
+ },
51828
+ "trainingProvider.listEntries": {
51829
+ capName: "training-provider",
51830
+ capScope: "system",
51831
+ addonId: null,
51832
+ access: "view"
51833
+ },
51834
+ "trainingProvider.listJobEvents": {
51835
+ capName: "training-provider",
51836
+ capScope: "system",
51837
+ addonId: null,
51838
+ access: "view"
51839
+ },
51840
+ "trainingProvider.listJobs": {
51841
+ capName: "training-provider",
51842
+ capScope: "system",
51843
+ addonId: null,
51844
+ access: "view"
51845
+ },
51846
+ "trainingProvider.offerArtifact": {
51847
+ capName: "training-provider",
51848
+ capScope: "system",
51849
+ addonId: null,
51850
+ access: "create"
51851
+ },
51852
+ "trainingProvider.readResult": {
51853
+ capName: "training-provider",
51854
+ capScope: "system",
51855
+ addonId: null,
51856
+ access: "create"
51857
+ },
51858
+ "trainingProvider.submitJob": {
51859
+ capName: "training-provider",
51860
+ capScope: "system",
51861
+ addonId: null,
51862
+ access: "create"
51863
+ },
51864
+ "trainingProvider.updateEntry": {
51865
+ capName: "training-provider",
51866
+ capScope: "system",
51867
+ addonId: null,
51868
+ access: "create"
51869
+ },
51870
+ "trainingProvider.uploadDataset": {
51871
+ capName: "training-provider",
51872
+ capScope: "system",
51873
+ addonId: null,
51874
+ access: "create"
51875
+ },
51876
+ "trainingProvider.validateCredentials": {
51877
+ capName: "training-provider",
51878
+ capScope: "system",
51879
+ addonId: null,
51880
+ access: "create"
51881
+ },
49959
51882
  "turnProvider.getTurnServers": {
49960
51883
  capName: "turn-provider",
49961
51884
  capScope: "system",
@@ -49980,12 +51903,6 @@ Object.freeze({
49980
51903
  addonId: null,
49981
51904
  access: "create"
49982
51905
  },
49983
- "userManagement.createApiKey": {
49984
- capName: "user-management",
49985
- capScope: "system",
49986
- addonId: null,
49987
- access: "create"
49988
- },
49989
51906
  "userManagement.createScopedToken": {
49990
51907
  capName: "user-management",
49991
51908
  capScope: "system",
@@ -50022,12 +51939,6 @@ Object.freeze({
50022
51939
  addonId: null,
50023
51940
  access: "view"
50024
51941
  },
50025
- "userManagement.linkExternalIdentity": {
50026
- capName: "user-management",
50027
- capScope: "system",
50028
- addonId: null,
50029
- access: "create"
50030
- },
50031
51942
  "userManagement.listApiKeys": {
50032
51943
  capName: "user-management",
50033
51944
  capScope: "system",
@@ -50130,12 +52041,6 @@ Object.freeze({
50130
52041
  addonId: null,
50131
52042
  access: "create"
50132
52043
  },
50133
- "userManagement.validateApiKey": {
50134
- capName: "user-management",
50135
- capScope: "system",
50136
- addonId: null,
50137
- access: "view"
50138
- },
50139
52044
  "userManagement.validateCredentials": {
50140
52045
  capName: "user-management",
50141
52046
  capScope: "system",
@@ -53168,6 +55073,11 @@ Object.freeze({
53168
55073
  form: "single",
53169
55074
  optional: false
53170
55075
  }],
55076
+ "osdManager.setSlotCameraEnabled": [{
55077
+ name: "deviceId",
55078
+ form: "single",
55079
+ optional: false
55080
+ }],
53171
55081
  "petFeeder.callPet": [{
53172
55082
  name: "deviceId",
53173
55083
  form: "single",
@@ -53388,6 +55298,11 @@ Object.freeze({
53388
55298
  form: "array",
53389
55299
  optional: false
53390
55300
  }],
55301
+ "pipelineAnalytics.listRetrainCorpusPage": [{
55302
+ name: "deviceIds",
55303
+ form: "array",
55304
+ optional: true
55305
+ }],
53391
55306
  "pipelineAnalytics.listRetrainStaging": [{
53392
55307
  name: "deviceIds",
53393
55308
  form: "array",
@@ -54249,6 +56164,11 @@ Object.freeze({
54249
56164
  form: "single",
54250
56165
  optional: false
54251
56166
  }],
56167
+ "training.canaryResult": [{
56168
+ name: "deviceIds",
56169
+ form: "array",
56170
+ optional: false
56171
+ }],
54252
56172
  "update.getStatus": [{
54253
56173
  name: "deviceId",
54254
56174
  form: "single",
@@ -54492,6 +56412,7 @@ Object.freeze({
54492
56412
  });
54493
56413
  Object.freeze({
54494
56414
  "broker": "broker",
56415
+ "calendar-source": "calendar",
54495
56416
  "device-export": "device-export",
54496
56417
  "llm": "ai",
54497
56418
  "mesh-network": "mesh",
@@ -54977,6 +56898,8 @@ var STATE_SUMMARY_VARS = [
54977
56898
  [...RULE_TEXT],
54978
56899
  [...RULE_TEXT],
54979
56900
  [...RULE_TEXT],
56901
+ [...RULE_TEXT],
56902
+ [...RULE_TEXT],
54980
56903
  ([...RULE_TEXT], [...UPDATES]),
54981
56904
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
54982
56905
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),