@camstack/addon-provider-unraid 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.js CHANGED
@@ -5377,7 +5377,7 @@ var ZodIssueCode = {
5377
5377
  var ZodFirstPartyTypeKind;
5378
5378
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5379
5379
  //#endregion
5380
- //#region ../types/dist/sleep-Cr5YOk3m.mjs
5380
+ //#region ../types/dist/sleep-DwAQ9sqX.mjs
5381
5381
  /**
5382
5382
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5383
5383
  * window to float samples (D455).
@@ -5494,7 +5494,7 @@ function isKeychainStoredField(field) {
5494
5494
  var SECRET_CLEAR = { $secretClear: true };
5495
5495
  /** The `'***'` token D634 redaction writes for non-admins. */
5496
5496
  var LEGACY_DEVICE_REDACTION = "***";
5497
- function isRecord$1(value) {
5497
+ function isRecord$2(value) {
5498
5498
  return typeof value === "object" && value !== null && !Array.isArray(value);
5499
5499
  }
5500
5500
  function makeSecretMarker(ref) {
@@ -5505,12 +5505,12 @@ function makeSecretMarker(ref) {
5505
5505
  }
5506
5506
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5507
5507
  function isSecretMarker(value) {
5508
- if (!isRecord$1(value)) return false;
5508
+ if (!isRecord$2(value)) return false;
5509
5509
  const ref = value["$secret"];
5510
5510
  return typeof ref === "string" && ref.length > 0;
5511
5511
  }
5512
5512
  function isSecretClear(value) {
5513
- return isRecord$1(value) && value["$secretClear"] === true;
5513
+ return isRecord$2(value) && value["$secretClear"] === true;
5514
5514
  }
5515
5515
  /**
5516
5516
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6026,6 +6026,13 @@ function globalSecretScope() {
6026
6026
  function encodeSegment(value) {
6027
6027
  return encodeURIComponent(value);
6028
6028
  }
6029
+ function decodeSegment(value) {
6030
+ try {
6031
+ return decodeURIComponent(value);
6032
+ } catch {
6033
+ return null;
6034
+ }
6035
+ }
6029
6036
  /**
6030
6037
  * The field path of a value inside an array item, addressed by the item's id:
6031
6038
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6034,6 +6041,75 @@ function encodeSegment(value) {
6034
6041
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6035
6042
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6036
6043
  }
6044
+ function parseScope(segments) {
6045
+ switch (segments[0]) {
6046
+ case "global": return {
6047
+ scope: GLOBAL_SCOPE,
6048
+ used: 1
6049
+ };
6050
+ case "node": {
6051
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6052
+ return nodeId === null || nodeId.length === 0 ? null : {
6053
+ scope: {
6054
+ kind: "node",
6055
+ nodeId
6056
+ },
6057
+ used: 2
6058
+ };
6059
+ }
6060
+ case "device": {
6061
+ const raw = segments[1];
6062
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6063
+ return {
6064
+ scope: {
6065
+ kind: "device",
6066
+ deviceId: Number(raw)
6067
+ },
6068
+ used: 2
6069
+ };
6070
+ }
6071
+ case "integration": {
6072
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6073
+ return id === null || id.length === 0 ? null : {
6074
+ scope: {
6075
+ kind: "integration",
6076
+ integrationId: id
6077
+ },
6078
+ used: 2
6079
+ };
6080
+ }
6081
+ case "row": {
6082
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6083
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6084
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6085
+ return {
6086
+ scope: {
6087
+ kind: "row",
6088
+ collection,
6089
+ rowId
6090
+ },
6091
+ used: 3
6092
+ };
6093
+ }
6094
+ default: return null;
6095
+ }
6096
+ }
6097
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6098
+ function parseSecretRef(ref) {
6099
+ if (!ref.startsWith("secret://")) return null;
6100
+ const segments = ref.slice(9).split("/");
6101
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6102
+ if (owner === null || owner.length === 0) return null;
6103
+ const parsed = parseScope(segments.slice(1));
6104
+ if (parsed === null) return null;
6105
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6106
+ if (fieldPath.length === 0) return null;
6107
+ return {
6108
+ owner,
6109
+ scope: parsed.scope,
6110
+ fieldPath
6111
+ };
6112
+ }
6037
6113
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6038
6114
  var KeychainWriteRefusedError = class extends Error {
6039
6115
  fieldPath;
@@ -6044,7 +6120,7 @@ var KeychainWriteRefusedError = class extends Error {
6044
6120
  }
6045
6121
  };
6046
6122
  var KEEP = { kind: "keep" };
6047
- function isRecord(value) {
6123
+ function isRecord$1(value) {
6048
6124
  return typeof value === "object" && value !== null && !Array.isArray(value);
6049
6125
  }
6050
6126
  function defaultMintId() {
@@ -6057,7 +6133,7 @@ function collectSecretMarkerRefs(value, out = []) {
6057
6133
  return out;
6058
6134
  }
6059
6135
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6060
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6136
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6061
6137
  return out;
6062
6138
  }
6063
6139
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6112,7 +6188,7 @@ function rowId(row, idKey) {
6112
6188
  return null;
6113
6189
  }
6114
6190
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6115
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6191
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6116
6192
  if (!Array.isArray(incoming)) {
6117
6193
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6118
6194
  return {
@@ -6128,7 +6204,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6128
6204
  const kept = /* @__PURE__ */ new Set();
6129
6205
  const rows = [];
6130
6206
  for (const row of incoming) {
6131
- if (!isRecord(row)) {
6207
+ if (!isRecord$1(row)) {
6132
6208
  rows.push(row);
6133
6209
  continue;
6134
6210
  }
@@ -6153,7 +6229,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6153
6229
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6154
6230
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6155
6231
  case "object": {
6156
- if (!isRecord(incoming)) {
6232
+ if (!isRecord$1(incoming)) {
6157
6233
  if (incoming === void 0) return KEEP;
6158
6234
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6159
6235
  return {
@@ -6161,7 +6237,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6161
6237
  value: incoming
6162
6238
  };
6163
6239
  }
6164
- const storedObj = isRecord(stored) ? stored : {};
6240
+ const storedObj = isRecord$1(stored) ? stored : {};
6165
6241
  return {
6166
6242
  kind: "value",
6167
6243
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6220,12 +6296,19 @@ async function transformSecretWrite(input) {
6220
6296
  }
6221
6297
  };
6222
6298
  }
6299
+ /** Is `ref` one of `owner`'s refs? */
6300
+ function isSecretRefOwnedBy(ref, owner) {
6301
+ return parseSecretRef(ref)?.owner === owner;
6302
+ }
6223
6303
  /**
6224
6304
  * Replace every marker in `value` with its keychain value. Returns the SAME
6225
6305
  * reference when there is no marker (no allocation, no keychain call).
6226
6306
  */
6227
- async function resolveSecretMarkers(value, secrets) {
6228
- const refs = collectSecretMarkerRefs(value);
6307
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6308
+ const keepMarker = options.unresolved === "keep-marker";
6309
+ const owner = options.ownedBy;
6310
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6311
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6229
6312
  if (refs.length === 0) return {
6230
6313
  value,
6231
6314
  unresolved: []
@@ -6249,10 +6332,18 @@ async function resolveSecretMarkers(value, secrets) {
6249
6332
  }
6250
6333
  const substitute = (v) => {
6251
6334
  if (isSecretMarker(v)) {
6335
+ if (!inScope(v.$secret)) return {
6336
+ keep: true,
6337
+ value: v
6338
+ };
6252
6339
  const answer = answers[v.$secret];
6253
- return answer?.kind === "value" ? {
6340
+ if (answer?.kind === "value") return {
6254
6341
  keep: true,
6255
6342
  value: answer.value
6343
+ };
6344
+ return keepMarker ? {
6345
+ keep: true,
6346
+ value: v
6256
6347
  } : {
6257
6348
  keep: false,
6258
6349
  value: void 0
@@ -6269,7 +6360,7 @@ async function resolveSecretMarkers(value, secrets) {
6269
6360
  value: items
6270
6361
  };
6271
6362
  }
6272
- if (isRecord(v)) {
6363
+ if (isRecord$1(v)) {
6273
6364
  const out = {};
6274
6365
  for (const [k, child] of Object.entries(v)) {
6275
6366
  const s = substitute(child);
@@ -6290,14 +6381,152 @@ async function resolveSecretMarkers(value, secrets) {
6290
6381
  unresolved
6291
6382
  };
6292
6383
  }
6293
- function touchesTree(tree, patch) {
6294
- if (tree.size === 0) return false;
6295
- for (const key of Object.keys(patch)) {
6296
- const at = key.indexOf("@");
6297
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6384
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6385
+ var SecretOverwriteRefusedError = class extends Error {
6386
+ ref;
6387
+ reason;
6388
+ constructor(ref, reason) {
6389
+ 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.`);
6390
+ this.ref = ref;
6391
+ this.reason = reason;
6392
+ this.name = "SecretOverwriteRefusedError";
6393
+ }
6394
+ };
6395
+ function isRecord(value) {
6396
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6397
+ }
6398
+ function resolvedValue(pass, marker) {
6399
+ const answer = pass.answers[marker.$secret];
6400
+ return answer?.kind === "value" ? answer.value : null;
6401
+ }
6402
+ async function atMarker(pass, incoming, stored) {
6403
+ if (incoming === null) return stored;
6404
+ if (typeof incoming !== "string") return incoming;
6405
+ if (incoming === resolvedValue(pass, stored)) return stored;
6406
+ const intent = classifySecretWrite(incoming);
6407
+ if (intent.kind !== "set") return stored;
6408
+ const ref = stored.$secret;
6409
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6410
+ const answer = pass.answers[ref];
6411
+ 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);
6412
+ try {
6413
+ await pass.secrets.put(ref, intent.value);
6414
+ } catch (err) {
6415
+ throw new KeychainWriteRefusedError(ref, err);
6416
+ }
6417
+ pass.changedRefs.push(ref);
6418
+ return stored;
6419
+ }
6420
+ function inArray(pass, incoming, stored) {
6421
+ return incoming.map((item, index) => {
6422
+ const twin = stored[index];
6423
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6424
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6425
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6426
+ return item;
6427
+ });
6428
+ }
6429
+ function inArrayRow(pass, incoming, stored) {
6430
+ const out = { ...incoming };
6431
+ for (const [key, value] of Object.entries(incoming)) {
6432
+ const twin = stored[key];
6433
+ if (isSecretMarker(twin)) {
6434
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6435
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6436
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6437
+ }
6438
+ return out;
6439
+ }
6440
+ async function walk(pass, incoming, stored) {
6441
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6442
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6443
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6444
+ const out = { ...incoming };
6445
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6446
+ return out;
6447
+ }
6448
+ /** Restore markers a write-back carries as values. See the file doc. */
6449
+ async function restoreUnchangedSecrets(input) {
6450
+ const refs = [];
6451
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6452
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6453
+ if (owned.length === 0) return {
6454
+ patch: input.patch,
6455
+ changedRefs: []
6456
+ };
6457
+ const pass = {
6458
+ secrets: input.secrets,
6459
+ answers: await input.secrets.resolve([...new Set(owned)]),
6460
+ operatorWrite: input.operatorWrite,
6461
+ changedRefs: []
6462
+ };
6463
+ const out = {};
6464
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6465
+ return {
6466
+ patch: out,
6467
+ changedRefs: pass.changedRefs
6468
+ };
6469
+ }
6470
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6471
+ function isJsonEqual(a, b) {
6472
+ if (Object.is(a, b)) return true;
6473
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6474
+ if (isRecord(a) && isRecord(b)) {
6475
+ const keys = Object.keys(a);
6476
+ if (keys.length !== Object.keys(b).length) return false;
6477
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6298
6478
  }
6299
6479
  return false;
6300
6480
  }
6481
+ /** The patch without the keys whose value already equals the stored one. */
6482
+ function dropUnchangedKeys(patch, stored) {
6483
+ const out = {};
6484
+ for (const [key, value] of Object.entries(patch)) {
6485
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6486
+ out[key] = value;
6487
+ }
6488
+ return out;
6489
+ }
6490
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6491
+ function markerKeysOf(blob, owner) {
6492
+ const keys = /* @__PURE__ */ new Set();
6493
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6494
+ return keys;
6495
+ }
6496
+ function nodeFromStored(value, owner) {
6497
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6498
+ if (!isRecord(value)) return null;
6499
+ const children = /* @__PURE__ */ new Map();
6500
+ for (const [key, child] of Object.entries(value)) {
6501
+ const node = nodeFromStored(child, owner);
6502
+ if (node !== null) children.set(key, node);
6503
+ }
6504
+ return children.size > 0 ? {
6505
+ kind: "object",
6506
+ children
6507
+ } : null;
6508
+ }
6509
+ /**
6510
+ * The declared secret tree, widened by every place the STORED blob holds a
6511
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6512
+ * never declared: Wyze before b4906cec6) still gets the save path's
6513
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6514
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6515
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6516
+ * builtin that keeps another addon's marker (device-manager) never takes it
6517
+ * over.
6518
+ */
6519
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6520
+ const added = /* @__PURE__ */ new Map();
6521
+ for (const key of keys) {
6522
+ const at = key.indexOf("@");
6523
+ const base = at > 0 ? key.slice(0, at) : key;
6524
+ if (declared.has(base) || added.has(base)) continue;
6525
+ const node = nodeFromStored(stored[key], owner);
6526
+ if (node !== null) added.set(base, node);
6527
+ }
6528
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6529
+ }
6301
6530
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6302
6531
  async function readStoredAddonBlob(raw) {
6303
6532
  const threeWay = raw.readAddonStoreResult;
@@ -6306,7 +6535,41 @@ async function readStoredAddonBlob(raw) {
6306
6535
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6307
6536
  return result.kind === "missing" ? {} : result.value;
6308
6537
  }
6309
- function createSecretAwareSettings(raw, opts) {
6538
+ function touchesTree(tree, patch) {
6539
+ if (tree.size === 0) return false;
6540
+ for (const key of Object.keys(patch)) {
6541
+ const at = key.indexOf("@");
6542
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6543
+ }
6544
+ return false;
6545
+ }
6546
+ /**
6547
+ * Which top-level keys of each store held markers when last seen. `undefined`
6548
+ * for a store not seen yet: its first write reads it, to be safe.
6549
+ */
6550
+ var MarkerKeyIndex = class {
6551
+ owner;
6552
+ byStore = /* @__PURE__ */ new Map();
6553
+ constructor(owner) {
6554
+ this.owner = owner;
6555
+ }
6556
+ seen(store, blob) {
6557
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6558
+ }
6559
+ wrote(store, patch) {
6560
+ const keys = this.byStore.get(store);
6561
+ if (keys === void 0) return;
6562
+ const now = markerKeysOf(patch, this.owner);
6563
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6564
+ else keys.delete(key);
6565
+ }
6566
+ mayHoldMarkers(store, patch) {
6567
+ const keys = this.byStore.get(store);
6568
+ if (keys === void 0) return true;
6569
+ return Object.keys(patch).some((key) => keys.has(key));
6570
+ }
6571
+ };
6572
+ function createHandle(raw, opts) {
6310
6573
  const chains = /* @__PURE__ */ new Map();
6311
6574
  const serialize = (key, fn) => {
6312
6575
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6317,46 +6580,130 @@ function createSecretAwareSettings(raw, opts) {
6317
6580
  });
6318
6581
  return next;
6319
6582
  };
6320
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6321
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6322
- return serialize(chainKey, async () => {
6583
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6584
+ const resolveRead = async (store, blob) => {
6585
+ index.seen(store, blob);
6586
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6587
+ unresolved: "keep-marker",
6588
+ ownedBy: opts.secrets.owner
6589
+ });
6590
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6591
+ return value;
6592
+ };
6593
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6594
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6595
+ await rawWrite(patch);
6596
+ index.wrote(store, patch);
6597
+ return { changed: true };
6598
+ }
6599
+ return serialize(store, async () => {
6323
6600
  const stored = await readStored();
6601
+ index.seen(store, stored);
6602
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6603
+ const restored = await restoreUnchangedSecrets({
6604
+ patch,
6605
+ stored,
6606
+ secrets: opts.secrets,
6607
+ operatorWrite
6608
+ });
6324
6609
  const result = await transformSecretWrite({
6325
- tree,
6610
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6326
6611
  secrets: opts.secrets,
6327
- patch,
6612
+ patch: restored.patch,
6328
6613
  stored,
6329
6614
  ...scope !== void 0 ? { scope } : {},
6330
- operatorWrite: opts.isOperatorWrite?.() === true
6615
+ operatorWrite
6331
6616
  });
6332
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6617
+ const effective = dropUnchangedKeys(result.patch, stored);
6618
+ const wroteBlob = Object.keys(effective).length > 0;
6619
+ if (wroteBlob) {
6620
+ await rawWrite(effective);
6621
+ index.wrote(store, effective);
6622
+ }
6333
6623
  const { orphaned } = await result.afterWrite();
6334
6624
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6625
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6335
6626
  });
6336
6627
  };
6337
- const wrapped = {
6338
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6339
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6340
- kind: "device",
6341
- deviceId
6342
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6628
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6629
+ const readAddonStoreResult = raw.readAddonStoreResult;
6630
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6631
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6632
+ const overrides = {
6633
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6634
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6635
+ const result = await readAddonStoreResult.call(raw);
6636
+ return result.kind === "value" ? {
6637
+ kind: "value",
6638
+ value: await resolveRead("addon", result.value)
6639
+ } : result;
6640
+ } } : {},
6641
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6642
+ const result = await readAddonStoreKeyResult.call(raw, key);
6643
+ if (result.kind !== "present") return result;
6644
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6645
+ unresolved: "keep-marker",
6646
+ ownedBy: opts.secrets.owner
6647
+ });
6648
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6649
+ return {
6650
+ kind: "present",
6651
+ value: value[key]
6652
+ };
6653
+ } } : {},
6654
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6655
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6656
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6657
+ const out = /* @__PURE__ */ new Map();
6658
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6659
+ return out;
6660
+ } } : {},
6661
+ writeAddonStore: async (patch) => {
6662
+ await writeAddon(patch);
6663
+ },
6664
+ writeDeviceStore: async (deviceId, patch) => {
6665
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6666
+ kind: "device",
6667
+ deviceId
6668
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6669
+ }
6670
+ };
6671
+ return {
6672
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6673
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6674
+ const value = Reflect.get(target, prop, receiver);
6675
+ return typeof value === "function" ? value.bind(target) : value;
6676
+ } }),
6677
+ raw: {
6678
+ readAddonStore: async () => {
6679
+ const blob = await raw.readAddonStore();
6680
+ index.seen("addon", blob);
6681
+ return blob;
6682
+ },
6683
+ readDeviceStore: async (deviceId) => {
6684
+ const blob = await raw.readDeviceStore(deviceId);
6685
+ index.seen(`device:${deviceId}`, blob);
6686
+ return blob;
6687
+ }
6688
+ },
6689
+ writeAddonStore: writeAddon
6343
6690
  };
6344
- return new Proxy(raw, { get(target, prop, receiver) {
6345
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6346
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6347
- const value = Reflect.get(target, prop, receiver);
6348
- return typeof value === "function" ? value.bind(target) : value;
6349
- } });
6350
6691
  }
6351
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6352
- function withSecretAwareSettings(context, opts) {
6692
+ /** The context the addon sees, plus the private raw view and write outcome. */
6693
+ function createSecretAwareContext(context, opts) {
6353
6694
  const raw = context.settings;
6354
- if (raw === void 0) return context;
6355
- const settings = createSecretAwareSettings(raw, opts);
6356
- return new Proxy(context, { get(target, prop, receiver) {
6357
- if (prop === "settings") return settings;
6358
- return Reflect.get(target, prop, receiver);
6359
- } });
6695
+ if (raw === void 0) return {
6696
+ context,
6697
+ handle: null
6698
+ };
6699
+ const handle = createHandle(raw, opts);
6700
+ return {
6701
+ context: new Proxy(context, { get(target, prop, receiver) {
6702
+ if (prop === "settings") return handle.settings;
6703
+ return Reflect.get(target, prop, receiver);
6704
+ } }),
6705
+ handle
6706
+ };
6360
6707
  }
6361
6708
  var LEAF = { kind: "leaf" };
6362
6709
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6531,6 +6878,14 @@ var BaseAddon = class {
6531
6878
  _secretChangeUnsub = null;
6532
6879
  /** >0 while an OPERATOR's settings write is being applied. */
6533
6880
  _operatorWriteDepth = 0;
6881
+ /**
6882
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6883
+ * to the marker-bearing blobs and stays private to this class: the form
6884
+ * hydrate and config resolution need markers, addon code never does.
6885
+ */
6886
+ _secretSettings = null;
6887
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6888
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6534
6889
  constructor(defaults) {
6535
6890
  this.defaults = defaults;
6536
6891
  this._config = { ...defaults };
@@ -6567,13 +6922,21 @@ var BaseAddon = class {
6567
6922
  }
6568
6923
  async initialize(context) {
6569
6924
  const secrets = context.secrets;
6570
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6571
- secrets,
6572
- addonTree: () => this.addonSecretTree(),
6573
- deviceTree: () => this.deviceSecretTree(),
6574
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6575
- isOperatorWrite: () => this._operatorWriteDepth > 0
6576
- }) : context;
6925
+ if (secrets !== void 0) {
6926
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6927
+ secrets,
6928
+ addonTree: () => this.addonSecretTree(),
6929
+ deviceTree: () => this.deviceSecretTree(),
6930
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6931
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6932
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6933
+ });
6934
+ this._ctx = wrapped;
6935
+ this._secretSettings = handle;
6936
+ } else {
6937
+ this._ctx = context;
6938
+ this._secretSettings = null;
6939
+ }
6577
6940
  await this.resolveConfig();
6578
6941
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6579
6942
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6690,11 +7053,8 @@ var BaseAddon = class {
6690
7053
  async getGlobalSettings(overlay, cap, nodeId) {
6691
7054
  const schema = this.globalSettingsSchema(cap);
6692
7055
  if (!schema) return { sections: [] };
6693
- const projected = await this.resolveGlobalStore(nodeId, cap);
6694
- return hydrateSchema(schema, overlay ? {
6695
- ...projected,
6696
- ...overlay
6697
- } : projected, { inlineSecretsAsViews: true });
7056
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7057
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6698
7058
  }
6699
7059
  /**
6700
7060
  * The integration-level view of this addon's settings: exactly the sections
@@ -6739,7 +7099,7 @@ var BaseAddon = class {
6739
7099
  });
6740
7100
  }
6741
7101
  if (sections.length === 0) return null;
6742
- const projected = await this.resolveGlobalStore(nodeId);
7102
+ const projected = await this.readRawProjectedStore(nodeId);
6743
7103
  return hydrateSchema({
6744
7104
  ...schema,
6745
7105
  sections
@@ -6756,12 +7116,50 @@ var BaseAddon = class {
6756
7116
  * the store for custom option logic (option narrowing, value snapping) to
6757
7117
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6758
7118
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7119
+ *
7120
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7121
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7122
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7123
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7124
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7125
+ * resolved blob back is a no-op for every unchanged secret.
6759
7126
  */
6760
7127
  async resolveGlobalStore(nodeId, cap) {
6761
7128
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7129
+ return this.projectForNode(raw, nodeId, cap);
7130
+ }
7131
+ projectForNode(store, nodeId, cap) {
6762
7132
  const keys = this.perNodeKeys(cap);
6763
7133
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6764
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7134
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7135
+ }
7136
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7137
+ async readRawProjectedStore(nodeId, cap) {
7138
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7139
+ return this.projectForNode(raw, nodeId, cap);
7140
+ }
7141
+ /**
7142
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7143
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7144
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7145
+ * its value.
7146
+ */
7147
+ async overlayKeepingMarkers(stored, overlay) {
7148
+ const secrets = this._ctx?.secrets;
7149
+ const merged = {
7150
+ ...stored,
7151
+ ...overlay
7152
+ };
7153
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7154
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7155
+ unresolved: "keep-marker",
7156
+ ownedBy: secrets.owner
7157
+ });
7158
+ for (const key of Object.keys(overlay)) {
7159
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7160
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7161
+ }
7162
+ return merged;
6765
7163
  }
6766
7164
  /**
6767
7165
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6826,8 +7224,12 @@ var BaseAddon = class {
6826
7224
  async clearSecrets(keys, nodeId) {
6827
7225
  const tree = this.addonSecretTree();
6828
7226
  const keychain = this._ctx?.secrets !== void 0;
7227
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6829
7228
  const patch = {};
6830
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7229
+ for (const key of keys) {
7230
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7231
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7232
+ }
6831
7233
  await this.applyGlobalPatch(patch, nodeId);
6832
7234
  }
6833
7235
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6835,7 +7237,11 @@ var BaseAddon = class {
6835
7237
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6836
7238
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6837
7239
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6838
- await this._ctx?.settings?.writeAddonStore(scoped);
7240
+ const handle = this._secretSettings;
7241
+ if (handle !== null) {
7242
+ const { changed } = await handle.writeAddonStore(scoped);
7243
+ if (!changed) return;
7244
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6839
7245
  if (target !== localNode) return;
6840
7246
  await this.resolveConfig();
6841
7247
  await this.onConfigChanged();
@@ -6888,7 +7294,7 @@ var BaseAddon = class {
6888
7294
  async getDeviceSettings(deviceId) {
6889
7295
  const schema = this.deviceSettingsSchema();
6890
7296
  if (!schema) return { sections: [] };
6891
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7297
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6892
7298
  }
6893
7299
  async updateDeviceSettings(deviceId, patch) {
6894
7300
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7060,7 +7466,7 @@ var BaseAddon = class {
7060
7466
  key,
7061
7467
  schema,
7062
7468
  fallback,
7063
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7469
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7064
7470
  write: async (patch) => {
7065
7471
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7066
7472
  },
@@ -7122,6 +7528,23 @@ var BaseAddon = class {
7122
7528
  }
7123
7529
  return value;
7124
7530
  }
7531
+ /**
7532
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7533
+ * keychain the context's own view is already raw.
7534
+ */
7535
+ rawSettings() {
7536
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7537
+ }
7538
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7539
+ logUnresolvedRead(unresolved) {
7540
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7541
+ if (fresh.length === 0) return;
7542
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7543
+ 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) => ({
7544
+ ref: u.ref,
7545
+ reason: u.reason
7546
+ })) } });
7547
+ }
7125
7548
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7126
7549
  scheduleSecretReresolve(delayMs) {
7127
7550
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7148,7 +7571,7 @@ var BaseAddon = class {
7148
7571
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7149
7572
  */
7150
7573
  async readAddonStoreWithRetry() {
7151
- const settings = this._ctx?.settings;
7574
+ const settings = this.rawSettings();
7152
7575
  if (!settings) return {};
7153
7576
  const delaysMs = [
7154
7577
  150,
@@ -8960,6 +9383,16 @@ var CompositionSchema = object({
8960
9383
  seen.add(feature.cap);
8961
9384
  });
8962
9385
  });
9386
+ var NodeColorIdSchema = _enum([
9387
+ "node-a",
9388
+ "node-b",
9389
+ "node-c",
9390
+ "node-d",
9391
+ "node-e",
9392
+ "node-f",
9393
+ "node-g",
9394
+ "node-h"
9395
+ ]);
8963
9396
  new Set([
8964
9397
  "track",
8965
9398
  "face",
@@ -9451,6 +9884,278 @@ var CameraSwitchGroupSchema = object({
9451
9884
  fetchedAt: number()
9452
9885
  });
9453
9886
  /**
9887
+ * The trainer contract — what the hub hands the cloud trainer and what it
9888
+ * gets back (cloud training, D805+).
9889
+ *
9890
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
9891
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
9892
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
9893
+ * lines on stdout. These schemas are the hub's half of that boundary; the
9894
+ * trainer's pydantic models (and the JSON Schemas generated from them under
9895
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
9896
+ * change there, in the same piece of work.
9897
+ *
9898
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
9899
+ * orchestrator fills every field of a job spec explicitly.
9900
+ */
9901
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
9902
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
9903
+ /** What the trainer can export. Edge TPU is a later, separate image. */
9904
+ var TrainingExportSchema = _enum([
9905
+ "onnx",
9906
+ "openvino-fp16",
9907
+ "openvino-int8",
9908
+ "coreml-fp16"
9909
+ ]);
9910
+ var FloorsSchema = record(string(), number().min(0).max(1));
9911
+ object({
9912
+ schema: literal(TRAINING_JOB_SCHEMA),
9913
+ jobKey: string().uuid(),
9914
+ target: object({
9915
+ kind: literal("detector"),
9916
+ step: literal("object-detection")
9917
+ }),
9918
+ base: object({
9919
+ modelId: string().min(1),
9920
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
9921
+ weights: string().min(1),
9922
+ imgsz: number().int().positive()
9923
+ }),
9924
+ baseline: object({
9925
+ modelId: string().min(1),
9926
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
9927
+ onnxUrl: string().url(),
9928
+ imgsz: number().int().positive(),
9929
+ floors: FloorsSchema
9930
+ }),
9931
+ dataset: object({
9932
+ versionId: string().min(1),
9933
+ annotationHash: string(),
9934
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
9935
+ sha256: string().regex(/^[0-9a-f]{64}$/)
9936
+ }),
9937
+ split: object({
9938
+ holdoutCameras: array(number().int()),
9939
+ /** When no camera is held out: the last N days of every camera. */
9940
+ holdoutLastDays: number().int().nonnegative(),
9941
+ valFraction: number().min(0).max(.5),
9942
+ seed: number().int()
9943
+ }),
9944
+ hyper: object({
9945
+ epochs: number().int().positive(),
9946
+ batch: number().int().positive(),
9947
+ lr0: number().positive(),
9948
+ /** Layers frozen from the start of the backbone; 0 = none. */
9949
+ freeze: number().int().nonnegative(),
9950
+ patience: number().int().nonnegative(),
9951
+ seed: number().int()
9952
+ }),
9953
+ replay: object({
9954
+ source: literal("coco2017"),
9955
+ count: number().int().nonnegative()
9956
+ }),
9957
+ exports: array(TrainingExportSchema).min(1),
9958
+ calibration: object({ maxFrames: number().int().positive() }),
9959
+ floors: object({
9960
+ minSupport: number().int().positive(),
9961
+ clamp: number().min(0).max(1)
9962
+ }),
9963
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
9964
+ catalog: object({
9965
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
9966
+ name: string().min(1).max(160)
9967
+ })
9968
+ });
9969
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
9970
+ var TrainingResultFileSchema = object({
9971
+ path: string().min(1),
9972
+ bytes: number().int().nonnegative(),
9973
+ sha256: string().regex(/^[0-9a-f]{64}$/),
9974
+ format: _enum([
9975
+ "onnx",
9976
+ "openvino",
9977
+ "coreml",
9978
+ "pt"
9979
+ ]),
9980
+ variant: _enum(["base", "int8"])
9981
+ });
9982
+ var DraftFormatSchema = object({
9983
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
9984
+ url: string().min(1),
9985
+ sizeMB: number().nonnegative(),
9986
+ isDirectory: boolean().optional(),
9987
+ files: array(string()).optional(),
9988
+ runtimes: array(literal("python")).optional(),
9989
+ revision: string().min(1)
9990
+ });
9991
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
9992
+ var TrainingCatalogDraftSchema = object({
9993
+ id: string().min(1),
9994
+ name: string().min(1),
9995
+ description: string(),
9996
+ labels: array(unknown()),
9997
+ inputSize: object({
9998
+ width: number().int().positive(),
9999
+ height: number().int().positive()
10000
+ }),
10001
+ preprocessMode: literal("letterbox"),
10002
+ defaultClassFloors: FloorsSchema,
10003
+ formats: object({
10004
+ onnx: DraftFormatSchema.optional(),
10005
+ openvino: DraftFormatSchema.optional(),
10006
+ coreml: DraftFormatSchema.optional()
10007
+ })
10008
+ });
10009
+ /** One class of one model's holdout report (the eval harness's summary). */
10010
+ var TrainingEvalClassSchema = object({
10011
+ positives: number().int(),
10012
+ floor: number().nullable(),
10013
+ tp: number().int(),
10014
+ fp: number().int(),
10015
+ fn: number().int(),
10016
+ precision: number().nullable(),
10017
+ recall: number().nullable(),
10018
+ ap50: number().nullable(),
10019
+ recallByCamera: record(string(), number().nullable()).optional(),
10020
+ recallByLight: record(string(), number().nullable()).optional(),
10021
+ fpByCamera: record(string(), number()).optional(),
10022
+ smallFound: number().int().optional(),
10023
+ smallTotal: number().int().optional()
10024
+ }).passthrough();
10025
+ var TrainingEvalReportSchema = object({
10026
+ frames: number().int(),
10027
+ classes: record(string(), TrainingEvalClassSchema)
10028
+ }).passthrough();
10029
+ /**
10030
+ * A succeeded result carries every block; a failed one carries the error and
10031
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10032
+ * orchestrator checks the blocks it needs before it trusts a success.
10033
+ */
10034
+ var TrainingResultSchema = object({
10035
+ schema: literal(TRAINING_RESULT_SCHEMA),
10036
+ jobKey: string(),
10037
+ status: _enum(["succeeded", "failed"]),
10038
+ error: object({
10039
+ stage: string(),
10040
+ code: string(),
10041
+ message: string()
10042
+ }).nullable(),
10043
+ trainer: object({
10044
+ version: string(),
10045
+ revision: string()
10046
+ }),
10047
+ toolchain: record(string(), string().nullable()),
10048
+ dataset: object({
10049
+ versionId: string(),
10050
+ annotationHash: string(),
10051
+ sha256: string(),
10052
+ frames: object({
10053
+ train: number().int(),
10054
+ val: number().int(),
10055
+ holdout: number().int()
10056
+ }),
10057
+ holdoutCameras: array(number().int()),
10058
+ replayImages: number().int()
10059
+ }).optional(),
10060
+ training: object({
10061
+ epochsRun: number().int(),
10062
+ bestEpoch: number().int(),
10063
+ bestMap50: number(),
10064
+ bestMap50_95: number(),
10065
+ seconds: number()
10066
+ }).optional(),
10067
+ evaluation: object({
10068
+ holdoutFrames: number().int(),
10069
+ baseline: TrainingEvalReportSchema.nullable(),
10070
+ candidate: TrainingEvalReportSchema.nullable(),
10071
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10072
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10073
+ map50: record(string(), number().nullable())
10074
+ }).optional(),
10075
+ floors: object({
10076
+ baseline: FloorsSchema,
10077
+ candidate: FloorsSchema,
10078
+ candidateInt8: FloorsSchema.nullable(),
10079
+ notes: array(string())
10080
+ }).optional(),
10081
+ int8: object({
10082
+ kept: boolean(),
10083
+ map50Fp16: number().nullable(),
10084
+ map50Int8: number().nullable(),
10085
+ reason: string().nullable()
10086
+ }).optional(),
10087
+ exportsDropped: array(object({
10088
+ export: string(),
10089
+ reason: string()
10090
+ })).optional(),
10091
+ files: array(TrainingResultFileSchema).optional(),
10092
+ bundle: object({
10093
+ path: literal("bundle.tar"),
10094
+ bytes: number().int().nonnegative(),
10095
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10096
+ }).nullable().optional(),
10097
+ catalogDraft: object({
10098
+ base: TrainingCatalogDraftSchema,
10099
+ int8: TrainingCatalogDraftSchema.nullable()
10100
+ }).nullable().optional(),
10101
+ licence: string()
10102
+ });
10103
+ var TrainingStageSchema = _enum([
10104
+ "prepare",
10105
+ "replay",
10106
+ "train",
10107
+ "eval",
10108
+ "export",
10109
+ "package"
10110
+ ]);
10111
+ var EventBase = {
10112
+ v: literal(1),
10113
+ ts: number()
10114
+ };
10115
+ discriminatedUnion("type", [
10116
+ object({
10117
+ ...EventBase,
10118
+ type: literal("stage"),
10119
+ stage: TrainingStageSchema
10120
+ }),
10121
+ object({
10122
+ ...EventBase,
10123
+ type: literal("epoch"),
10124
+ epoch: number().int(),
10125
+ epochs: number().int(),
10126
+ boxLoss: number().nullable().optional(),
10127
+ map50: number().nullable().optional(),
10128
+ map50_95: number().nullable().optional(),
10129
+ etaSec: number().nullable().optional()
10130
+ }),
10131
+ object({
10132
+ ...EventBase,
10133
+ type: literal("metric"),
10134
+ name: string(),
10135
+ value: number()
10136
+ }),
10137
+ object({
10138
+ ...EventBase,
10139
+ type: literal("artifact"),
10140
+ path: string(),
10141
+ bytes: number(),
10142
+ sha256: string()
10143
+ }),
10144
+ object({
10145
+ ...EventBase,
10146
+ type: literal("done"),
10147
+ status: _enum(["succeeded", "failed"]),
10148
+ resultSha256: string().nullable().optional()
10149
+ }),
10150
+ object({
10151
+ ...EventBase,
10152
+ type: literal("error"),
10153
+ stage: string(),
10154
+ code: string(),
10155
+ message: string()
10156
+ })
10157
+ ]);
10158
+ /**
9454
10159
  * What the gate decided about a birth, from the CALLER's point of view.
9455
10160
  *
9456
10161
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11778,7 +12483,9 @@ var AddonHttpRouteSchema = object({
11778
12483
  "authenticated",
11779
12484
  "admin"
11780
12485
  ]).optional(),
11781
- description: string().optional()
12486
+ description: string().optional(),
12487
+ /** The hub limits this route per client address before the handler runs. */
12488
+ rateLimit: _enum(["auth"]).optional()
11782
12489
  });
11783
12490
  /**
11784
12491
  * Cross-process route invocation envelope. The hub captures the
@@ -12483,6 +13190,37 @@ var BackupDestinationInfoSchema = object({
12483
13190
  lastError: string().optional()
12484
13191
  });
12485
13192
  /**
13193
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13194
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13195
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13196
+ * with it off — which restores without a key.
13197
+ */
13198
+ var BackupArchiveEncryptionSchema = object({
13199
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13200
+ scheme: string(),
13201
+ /** 16 hex — the backup key whose secret restores this archive. */
13202
+ keyId: string()
13203
+ });
13204
+ /**
13205
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13206
+ * one new archives are encrypted to, and the retired ones older archives
13207
+ * still need. The secret key is shown once, at `setupEncryption`.
13208
+ */
13209
+ var BackupEncryptionStatusSchema = object({
13210
+ enabled: boolean(),
13211
+ active: object({
13212
+ keyId: string(),
13213
+ publicKey: string(),
13214
+ createdAt: number()
13215
+ }).nullable(),
13216
+ /** Every key ever set up, newest first. */
13217
+ keys: array(object({
13218
+ keyId: string(),
13219
+ createdAt: number(),
13220
+ retiredAt: number().nullable()
13221
+ })).readonly()
13222
+ });
13223
+ /**
12486
13224
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12487
13225
  * Same shape the destination drill-in renders. Sourced from the per-
12488
13226
  * location `manifests.json` (no per-archive tarball read required).
@@ -12494,7 +13232,9 @@ var BackupArchiveEntrySchema = object({
12494
13232
  sizeBytes: number(),
12495
13233
  label: string().optional(),
12496
13234
  /** Top-level locations included in the archive (db, addons, tls, …). */
12497
- locations: array(string()).readonly()
13235
+ locations: array(string()).readonly(),
13236
+ /** Present when the archive is encrypted; restore then needs that key. */
13237
+ encryption: BackupArchiveEncryptionSchema.optional()
12498
13238
  });
12499
13239
  var BackupEntrySchema = object({
12500
13240
  id: string(),
@@ -12503,7 +13243,8 @@ var BackupEntrySchema = object({
12503
13243
  label: string().optional(),
12504
13244
  createdAt: number(),
12505
13245
  sizeBytes: number(),
12506
- locations: array(string()).optional()
13246
+ locations: array(string()).optional(),
13247
+ encryption: BackupArchiveEncryptionSchema.optional()
12507
13248
  });
12508
13249
  var ArchiveEntrySchema = object({
12509
13250
  path: string(),
@@ -12692,10 +13433,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12692
13433
  * this list and skips entries whose path doesn't start with
12693
13434
  * any of them.
12694
13435
  */
12695
- locations: array(string()).optional()
13436
+ locations: array(string()).optional(),
13437
+ /**
13438
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13439
+ * one). The archive is decrypted into the hub's private staging
13440
+ * before the restart; the key is not stored. A wrong or missing key
13441
+ * is refused before the archive is downloaded.
13442
+ */
13443
+ backupSecretKey: string().optional()
12696
13444
  }), _void(), {
12697
13445
  kind: "mutation",
12698
13446
  auth: "admin"
13447
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13448
+ keyId: string(),
13449
+ secretKey: string(),
13450
+ publicKey: string(),
13451
+ createdAt: number(),
13452
+ replacedKeyId: string().nullable()
13453
+ }), {
13454
+ kind: "mutation",
13455
+ auth: "admin"
13456
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13457
+ kind: "mutation",
13458
+ auth: "admin"
13459
+ }), method(object({ backupSecretKey: string() }), object({
13460
+ valid: boolean(),
13461
+ keyId: string().nullable(),
13462
+ /** The hub knows this key (active or retired). */
13463
+ known: boolean(),
13464
+ /** It is the key new archives are encrypted to. */
13465
+ active: boolean(),
13466
+ error: string().optional()
13467
+ }), {
13468
+ kind: "mutation",
13469
+ auth: "admin"
12699
13470
  }), method(object({
12700
13471
  destinationId: string(),
12701
13472
  backupId: string()
@@ -14421,7 +15192,60 @@ var CustomModelDescriptorSchema = object({
14421
15192
  stepId: string(),
14422
15193
  entry: ModelCatalogEntrySchema
14423
15194
  });
14424
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15195
+ /** One regular file of an imported bundle, as the producer measured it. */
15196
+ var ModelBundleFileSchema = object({
15197
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15198
+ path: string().min(1),
15199
+ bytes: number().int().nonnegative(),
15200
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15201
+ });
15202
+ var ImportModelBundleInputSchema = object({
15203
+ /** The registry provider that keeps the model (Model Studio). */
15204
+ addonId: string(),
15205
+ stepId: string().min(1),
15206
+ /**
15207
+ * The catalog rows to register, complete, every format URL already
15208
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15209
+ * bundle may carry several rows (a base and its INT8 variant).
15210
+ */
15211
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15212
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15213
+ bundle: object({
15214
+ ticket: PeerBytesTicketSchema,
15215
+ bytes: number().int().positive(),
15216
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15217
+ }),
15218
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15219
+ files: array(ModelBundleFileSchema).min(1).max(64),
15220
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15221
+ distribute: boolean()
15222
+ });
15223
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15224
+ kind: literal("imported"),
15225
+ modelIds: array(string()).readonly(),
15226
+ distributed: array(object({
15227
+ modelId: string(),
15228
+ nodeId: string(),
15229
+ format: _enum(MODEL_FORMATS),
15230
+ ok: boolean(),
15231
+ error: string().optional()
15232
+ })).readonly()
15233
+ }), object({
15234
+ kind: literal("refused"),
15235
+ reason: _enum([
15236
+ "transfer-failed",
15237
+ "checksum-mismatch",
15238
+ "bundle-mismatch",
15239
+ "invalid-entry",
15240
+ "id-taken"
15241
+ ]),
15242
+ detail: string()
15243
+ })]);
15244
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15245
+ kind: "mutation",
15246
+ auth: "admin",
15247
+ timeoutMs: 30 * 6e4
15248
+ });
14425
15249
  /**
14426
15250
  * Query filter for settings-store collections.
14427
15251
  */
@@ -14900,6 +15724,35 @@ var KeychainKeySourceSchema = object({
14900
15724
  */
14901
15725
  sharesBackupWithDatabase: boolean()
14902
15726
  });
15727
+ /**
15728
+ * One keychain reset, as the Secrets page reports it until the operator
15729
+ * acknowledges it. Never a value: refs, counts and table names only.
15730
+ */
15731
+ var KeychainResetRecordSchema = object({
15732
+ id: string(),
15733
+ at: number(),
15734
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15735
+ actor: string(),
15736
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15737
+ lockedReason: string().nullable(),
15738
+ /** Values moved into the archive table (ciphertext under the lost key). */
15739
+ archived: number().int(),
15740
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15741
+ archivedCollection: string().nullable(),
15742
+ /**
15743
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15744
+ * so the archive can still be opened if the lost master key turns up.
15745
+ */
15746
+ archivedKeysCollection: string().nullable(),
15747
+ /**
15748
+ * `system-settings` keys whose marker the reset cleared — the cluster
15749
+ * secret's: a marker left pointing at an archived value would refuse every
15750
+ * agent forever (D797).
15751
+ */
15752
+ clearedSettingsKeys: array(string()).readonly(),
15753
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15754
+ acknowledgedAt: number().nullable()
15755
+ });
14903
15756
  var KeychainStatusSchema = object({
14904
15757
  keychain: KeychainStateSchema,
14905
15758
  /** The source of the master key in use; `null` while locked. */
@@ -14917,7 +15770,9 @@ var KeychainStatusSchema = object({
14917
15770
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
14918
15771
  retiredWraps: number().int(),
14919
15772
  recoveryKeyDownloadedAt: number().nullable(),
14920
- secretCount: number().int()
15773
+ secretCount: number().int(),
15774
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15775
+ lastReset: KeychainResetRecordSchema.nullable()
14921
15776
  });
14922
15777
  /**
14923
15778
  * Whether a stored value is still pointed at by its owner's settings.
@@ -14939,17 +15794,26 @@ var KeychainAuditActionSchema = _enum([
14939
15794
  "download-recovery-key",
14940
15795
  "delete-orphans",
14941
15796
  "reset",
15797
+ "acknowledge-reset",
14942
15798
  "initialize"
14943
15799
  ]);
14944
15800
  var KeychainAuditEntrySchema = object({
14945
15801
  id: string(),
14946
15802
  at: number(),
14947
15803
  action: KeychainAuditActionSchema,
14948
- /** `addon:<id>` | `user:<id>` | `system`. */
15804
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
14949
15805
  actor: string(),
14950
15806
  ref: string().nullable(),
14951
15807
  detail: string().nullable()
14952
15808
  });
15809
+ var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
15810
+ /**
15811
+ * Secrets the HUB itself holds (owner `system`) that no settings form shows:
15812
+ * `jwt-signing-key` — the session signing key (D797). It is always "in use",
15813
+ * never an orphan; it is generated on a fresh hub and replaced only through
15814
+ * {@link keychainAdminCapability.methods.setSystemSecret}.
15815
+ */
15816
+ var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
14953
15817
  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({
14954
15818
  value: string(),
14955
15819
  version: number().int()
@@ -14957,6 +15821,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
14957
15821
  kind: "mutation",
14958
15822
  auth: "admin",
14959
15823
  caller: "required"
15824
+ }), method(object({
15825
+ name: SystemHeldSecretNameSchema,
15826
+ value: string().min(16)
15827
+ }), object({
15828
+ ref: string(),
15829
+ version: number().int()
15830
+ }), {
15831
+ kind: "mutation",
15832
+ auth: "admin",
15833
+ caller: "required"
14960
15834
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
14961
15835
  deleted: array(string()).readonly(),
14962
15836
  kept: array(object({
@@ -14986,13 +15860,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
14986
15860
  kind: "mutation",
14987
15861
  auth: "admin",
14988
15862
  caller: "required"
14989
- }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15863
+ }), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
14990
15864
  archivedCollection: string().nullable(),
14991
15865
  archived: number().int()
14992
15866
  }), {
14993
15867
  kind: "mutation",
14994
15868
  auth: "admin",
14995
15869
  caller: "required"
15870
+ }), method(object({}), object({
15871
+ reset: KeychainResetRecordSchema.nullable(),
15872
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15873
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15874
+ kind: "mutation",
15875
+ auth: "admin",
15876
+ caller: "required"
14996
15877
  });
14997
15878
  method(_void(), object({
14998
15879
  id: string(),
@@ -17654,14 +18535,14 @@ var LlmProfileSchema = object({
17654
18535
  /** ConfigUISchema tree passed through untyped on the wire (the
17655
18536
  * notification-output `ConfigSchemaPassthrough` precedent at
17656
18537
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
17657
- var ConfigSchemaPassthrough$1 = unknown();
18538
+ var ConfigSchemaPassthrough$3 = unknown();
17658
18539
  var LlmProfileKindDescriptorSchema = object({
17659
18540
  kind: LlmProfileKindSchema,
17660
18541
  label: string(),
17661
18542
  icon: string(),
17662
18543
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
17663
18544
  addonId: string(),
17664
- configSchema: ConfigSchemaPassthrough$1
18545
+ configSchema: ConfigSchemaPassthrough$3
17665
18546
  });
17666
18547
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
17667
18548
  var LlmDefaultSchema = object({
@@ -17939,7 +18820,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17939
18820
  * `login-method` — collection cap through which auth addons contribute
17940
18821
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17941
18822
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17942
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18823
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17943
18824
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17944
18825
  * procedure aggregates them for the unauthenticated login page.
17945
18826
  *
@@ -17947,8 +18828,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17947
18828
  *
17948
18829
  * - `redirect` — a declarative button. The login page renders a generic
17949
18830
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17950
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17951
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18831
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17952
18832
  * login page needs NO change.
17953
18833
  *
17954
18834
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -17967,8 +18847,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17967
18847
  * decision.
17968
18848
  *
17969
18849
  * Every contribution carries a `stage`:
17970
- * - `primary` — shown on the first credentials screen (OIDC /
17971
- * magic-link buttons; a future usernameless passkey).
18850
+ * - `primary` — shown on the first credentials screen (OIDC
18851
+ * buttons; a usernameless passkey).
17972
18852
  * - `second-factor` — shown AFTER the password leg, gated on the
17973
18853
  * returned `factors` (passkey-as-2FA today).
17974
18854
  *
@@ -17995,7 +18875,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17995
18875
  * The provider names an external identity a signed-in user can link to
17996
18876
  * their own account (D782): `auth.listLinkableProviders` /
17997
18877
  * `beginExternalLink` offer exactly the redirect methods that set this,
17998
- * whatever their id. Absent / false — a login button only (magic-link).
18878
+ * whatever their id. Absent / false — a login button only.
17999
18879
  */
18000
18880
  linkable: boolean().optional()
18001
18881
  }),
@@ -18783,7 +19663,7 @@ var TargetKindCapsSchema = object({
18783
19663
  * the union is large and not meant for runtime validation here; the exported
18784
19664
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
18785
19665
  */
18786
- var ConfigSchemaPassthrough = unknown();
19666
+ var ConfigSchemaPassthrough$2 = unknown();
18787
19667
  var TargetKindSchema = object({
18788
19668
  kind: string(),
18789
19669
  label: string(),
@@ -18820,7 +19700,7 @@ var TargetKindSchema = object({
18820
19700
  * its raster path, which is the safe default for an unknown image.
18821
19701
  */
18822
19702
  iconMediaType: string().optional(),
18823
- configSchema: ConfigSchemaPassthrough,
19703
+ configSchema: ConfigSchemaPassthrough$2,
18824
19704
  /**
18825
19705
  * The config keys that decide WHERE this kind's secrets are sent (server,
18826
19706
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -21850,8 +22730,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21850
22730
  * `super_admin` — collapsed onto the single boolean because every
21851
22731
  * non-admin caller is governed by the same scope-check rules; the
21852
22732
  * distinction was only ever used to route role-specific procedures
21853
- * which we no longer have. Agents are admin sessions issued via
21854
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22733
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21855
22734
  * with `isAdmin: false` + an explicit scope list.
21856
22735
  */
21857
22736
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -22158,6 +23037,61 @@ var OauthIntegrationDescriptorSchema = object({
22158
23037
  });
22159
23038
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
22160
23039
  /**
23040
+ * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
23041
+ *
23042
+ * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
23043
+ * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
23044
+ * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
23045
+ * immutable after create.
23046
+ */
23047
+ var ConfigSchemaPassthrough$1 = unknown();
23048
+ var OidcConnectionSchema = object({
23049
+ id: string().min(1),
23050
+ displayName: string(),
23051
+ icon: string(),
23052
+ issuerUrl: string(),
23053
+ clientId: string(),
23054
+ /** Client id + secret present — never the secret value. */
23055
+ configured: boolean(),
23056
+ /**
23057
+ * Values for the connection form schema. `clientSecret` is a keychain
23058
+ * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
23059
+ */
23060
+ formValues: record(string(), unknown()).optional()
23061
+ });
23062
+ /**
23063
+ * Patch one connection. Omitted or empty `clientSecret` keeps the stored
23064
+ * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
23065
+ */
23066
+ var OidcConnectionUpdateInputSchema = object({
23067
+ id: string().min(1),
23068
+ displayName: string().min(1),
23069
+ icon: string().optional(),
23070
+ issuerUrl: string().optional(),
23071
+ clientId: string().optional(),
23072
+ clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
23073
+ redirectUri: string().optional(),
23074
+ scopes: string().optional(),
23075
+ usernameClaim: _enum([
23076
+ "preferred_username",
23077
+ "email",
23078
+ "sub"
23079
+ ]).optional()
23080
+ });
23081
+ method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
23082
+ id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
23083
+ displayName: string().min(1)
23084
+ }), object({ id: string() }), {
23085
+ kind: "mutation",
23086
+ auth: "admin"
23087
+ }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
23088
+ kind: "mutation",
23089
+ auth: "admin"
23090
+ }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
23091
+ kind: "mutation",
23092
+ auth: "admin"
23093
+ });
23094
+ /**
22161
23095
  * What started a camera's onboard motion (D672). `camera` is the camera's own
22162
23096
  * firmware; `sensor` is a device the operator ATTACHED to it. Absent on the
22163
23097
  * wire means the camera: only the camera-sensors bridge ever says `sensor`.
@@ -23514,21 +24448,69 @@ var RetrainFrameListSchema = object({
23514
24448
  /** What the page pre-selects — the native key frame when one survives. */
23515
24449
  autoPickMediaId: number().int().optional()
23516
24450
  });
24451
+ /** Exclusive partition of a corpus copy's annotation progress (design §4.2). */
24452
+ var RetrainFrameWorkStateSchema = _enum([
24453
+ "unannotated",
24454
+ "annotated",
24455
+ "complete"
24456
+ ]);
24457
+ /**
24458
+ * Filters for paginated corpus list, KPI, and matching export (design §4.4).
24459
+ * Every narrowing field is ANDed; omitted fields impose no constraint.
24460
+ */
24461
+ var RetrainCorpusFilterSchema = object({
24462
+ workState: RetrainFrameWorkStateSchema.optional(),
24463
+ deviceIds: array(number()).max(500).optional(),
24464
+ /** When set, only frames in this named collection. */
24465
+ collectionId: string().optional(),
24466
+ /** Frames that carry at least one saved annotation in one of these classes. */
24467
+ classes: array(RetrainMacroClassSchema).optional(),
24468
+ page: number().int().positive().default(1),
24469
+ pageSize: number().int().positive().max(100).default(50)
24470
+ });
24471
+ var RetrainCorpusPageSchema = object({
24472
+ frames: array(RetrainFrameSchema.extend({ workState: RetrainFrameWorkStateSchema })).readonly(),
24473
+ total: number().int().nonnegative(),
24474
+ page: number().int().positive(),
24475
+ pageSize: number().int().positive()
24476
+ });
24477
+ var RetrainCorpusKpiCameraRowSchema = object({
24478
+ deviceId: number(),
24479
+ unannotated: number().int().nonnegative(),
24480
+ annotated: number().int().nonnegative(),
24481
+ complete: number().int().nonnegative(),
24482
+ /** This camera's `complete` count divided by corpus `total`, in `[0,1]`.
24483
+ * `null` when the corpus is empty (no ratio). */
24484
+ pctOfCorpus: number().min(0).max(1).nullable()
24485
+ });
24486
+ var RetrainCorpusKpiSchema = object({
24487
+ total: number().int().nonnegative(),
24488
+ unannotated: number().int().nonnegative(),
24489
+ annotated: number().int().nonnegative(),
24490
+ complete: number().int().nonnegative(),
24491
+ cameras: array(RetrainCorpusKpiCameraRowSchema).readonly()
24492
+ });
23517
24493
  /**
23518
24494
  * Which frames an annotated export carries. Every field narrows; an empty
23519
- * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23520
- * list owned by whoever trains (the training orchestrator), so `frameIds` is
23521
- * the primitive a version export uses; `batchId` re-selects what an earlier
23522
- * export carried (`exportedInBatch`).
24495
+ * filter is every annotated copy. `frameIds` is the primitive a job or
24496
+ * download uses; `batchId` re-selects what an earlier export carried
24497
+ * (`exportedInBatch`). Frozen dataset versions were removed — live selection
24498
+ * resolves to `frameIds` at plan/start.
23523
24499
  */
23524
24500
  var RetrainExportFilterSchema = object({
23525
24501
  deviceIds: array(number()).optional(),
23526
24502
  frameIds: array(string()).max(2e4).optional(),
23527
24503
  /** Only frames in at least one of these named collections. */
23528
24504
  collectionIds: array(string()).max(200).optional(),
24505
+ /** Single collection (Frames filter bar). ANDed with `collectionIds` when both set. */
24506
+ collectionId: string().optional(),
23529
24507
  batchId: string().optional(),
23530
24508
  /** Only frames the operator marked complete (all subjects boxed). */
23531
- completeOnly: boolean().optional()
24509
+ completeOnly: boolean().optional(),
24510
+ /** Exclusive work-state partition (`workStateOf`); same as the corpus list. */
24511
+ workState: RetrainFrameWorkStateSchema.optional(),
24512
+ /** Frames with at least one saved annotation in one of these classes. */
24513
+ classes: array(RetrainMacroClassSchema).optional()
23532
24514
  });
23533
24515
  /**
23534
24516
  * `frames`: the full frame copies, boxes in `annotations.json`.
@@ -23693,6 +24675,77 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23693
24675
  ]),
23694
24676
  detail: string().optional()
23695
24677
  })]);
24678
+ /** What a dataset version is cut from. Every field narrows. */
24679
+ var RetrainDatasetSelectionSchema = object({
24680
+ deviceIds: array(number()).readonly().optional(),
24681
+ collectionIds: array(string()).max(200).readonly().optional(),
24682
+ frameIds: array(string()).max(2e4).readonly().optional()
24683
+ });
24684
+ /** The counts a dataset is judged by. */
24685
+ var RetrainDatasetStatsSchema = object({
24686
+ frames: number().int(),
24687
+ completeFrames: number().int(),
24688
+ /** `completeFrames / frames`, 0..1. */
24689
+ completeness: number(),
24690
+ /** Boxes to learn (model errors excluded). */
24691
+ subjects: number().int(),
24692
+ modelErrors: number().int(),
24693
+ /** Complete frames with no subject. */
24694
+ hardNegatives: number().int(),
24695
+ /** Subjects per class × camera × day/night. */
24696
+ cells: array(object({
24697
+ macroClass: string(),
24698
+ deviceId: number(),
24699
+ lighting: _enum([
24700
+ "day",
24701
+ "night",
24702
+ "unknown"
24703
+ ]),
24704
+ subjects: number().int(),
24705
+ frames: number().int()
24706
+ })).readonly(),
24707
+ cameras: array(object({
24708
+ deviceId: number(),
24709
+ frames: number().int(),
24710
+ completeFrames: number().int()
24711
+ })).readonly()
24712
+ });
24713
+ object({
24714
+ id: string(),
24715
+ name: string(),
24716
+ createdAt: number(),
24717
+ selection: RetrainDatasetSelectionSchema,
24718
+ layout: RetrainExportLayoutSchema,
24719
+ completeOnly: boolean(),
24720
+ frameCount: number().int(),
24721
+ annotationHash: string(),
24722
+ manifestSchema: string(),
24723
+ stats: RetrainDatasetStatsSchema
24724
+ });
24725
+ /**
24726
+ * Live training corpus criteria — same shape as `TrainingCorpusSelection` on
24727
+ * the training cap. Resolved here so plan/start and the annotated export share
24728
+ * one definition of "the frames" (`buildRetrainExportPlan`).
24729
+ */
24730
+ var RetrainTrainingCorpusSelectionSchema = object({
24731
+ collectionIds: array(string()).min(1),
24732
+ workState: _enum([
24733
+ "complete",
24734
+ "annotated_or_complete",
24735
+ "any_annotated"
24736
+ ]).default("complete")
24737
+ });
24738
+ var RetrainTrainingCorpusResolveResultSchema = discriminatedUnion("kind", [object({
24739
+ kind: literal("resolved"),
24740
+ frameIds: array(string()).max(2e4).readonly(),
24741
+ stats: RetrainDatasetStatsSchema,
24742
+ annotationHash: string(),
24743
+ layout: RetrainExportLayoutSchema
24744
+ }), object({
24745
+ kind: literal("refused"),
24746
+ reason: _enum(["unknown-collection", "no-frames"]),
24747
+ detail: string()
24748
+ })]);
23696
24749
  /** The outcome of a lifecycle move owned by the retrain page. */
23697
24750
  var RetrainTransitionResultSchema = object({
23698
24751
  trackId: string(),
@@ -24398,6 +25451,12 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24398
25451
  }), array(RetrainTrackSchema).readonly(), {
24399
25452
  kind: "query",
24400
25453
  auth: "admin"
25454
+ }), method(RetrainCorpusFilterSchema, RetrainCorpusPageSchema, {
25455
+ kind: "query",
25456
+ auth: "admin"
25457
+ }), method(object({}), RetrainCorpusKpiSchema, {
25458
+ kind: "query",
25459
+ auth: "admin"
24401
25460
  }), method(object({ trackId: string() }), RetrainFrameListSchema, {
24402
25461
  kind: "query",
24403
25462
  auth: "admin"
@@ -24482,6 +25541,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24482
25541
  kind: "mutation",
24483
25542
  auth: "admin",
24484
25543
  timeoutMs: 60 * 6e4
25544
+ }), method(object({
25545
+ filter: RetrainExportFilterSchema,
25546
+ layout: RetrainExportLayoutSchema
25547
+ }), object({
25548
+ ticket: PeerBytesTicketSchema,
25549
+ frames: number().int(),
25550
+ annotations: number().int()
25551
+ }), {
25552
+ kind: "mutation",
25553
+ auth: "admin",
25554
+ timeoutMs: 12e4
24485
25555
  }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24486
25556
  kind: "query",
24487
25557
  auth: "admin"
@@ -24508,6 +25578,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24508
25578
  }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24509
25579
  kind: "query",
24510
25580
  auth: "admin"
25581
+ }), method(RetrainTrainingCorpusSelectionSchema, RetrainTrainingCorpusResolveResultSchema, {
25582
+ kind: "query",
25583
+ auth: "admin",
25584
+ timeoutMs: 6e4
24511
25585
  }), method(object({
24512
25586
  id: string(),
24513
25587
  name: string().max(120)
@@ -25124,11 +26198,14 @@ var HardwareClassIdSchema = _enum([
25124
26198
  "intel-n-series",
25125
26199
  "apple-m-base",
25126
26200
  "apple-m-pro",
26201
+ "amd-phoenix",
25127
26202
  "unknown"
25128
26203
  ]);
25129
26204
  var AcceleratorKindSchema = _enum([
25130
26205
  "intel-npu",
25131
26206
  "intel-igpu",
26207
+ "amd-igpu",
26208
+ "amd-npu",
25132
26209
  "x86-cpu",
25133
26210
  "arm-cpu",
25134
26211
  "apple-ane",
@@ -27058,6 +28135,8 @@ var AgentPipelineSettingsSchema = object({
27058
28135
  * address is wrong (multi-homed host, NAT, custom interface).
27059
28136
  */
27060
28137
  reachableHost: string().optional(),
28138
+ /** Hub-persisted UI colour (`--color-node-*` theme tokens). */
28139
+ color: NodeColorIdSchema.optional(),
27061
28140
  /**
27062
28141
  * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
27063
28142
  * weight, steps}. Absent / all-disabled ⇒ the node's single default
@@ -27607,8 +28686,9 @@ method(object({
27607
28686
  auth: "admin"
27608
28687
  }), method(object({
27609
28688
  agentNodeId: string(),
27610
- reachableHost: string().nullable()
27611
- }), object({ success: literal(true) }), {
28689
+ reachableHost: string().nullable().optional(),
28690
+ color: NodeColorIdSchema.nullable().optional()
28691
+ }).refine((v) => v.reachableHost !== void 0 || v.color !== void 0, { message: "reachableHost or color required" }), object({ success: literal(true) }), {
27612
28692
  kind: "mutation",
27613
28693
  auth: "admin"
27614
28694
  }), method(object({
@@ -28060,8 +29140,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
28060
29140
  * `smtp-provider` — pluggable email delivery surface.
28061
29141
  *
28062
29142
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
28063
- * one for transactional / one for notifications). Consumers (magic-link,
28064
- * notifier addons, …) walk the collection and pick the first
29143
+ * one for transactional / one for notifications). Consumers (notifier
29144
+ * addons, …) walk the collection and pick the first
28065
29145
  * ready provider OR target a specific addonId.
28066
29146
  *
28067
29147
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -28240,7 +29320,7 @@ targets: array(object({
28240
29320
  })));
28241
29321
  /**
28242
29322
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
28243
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
29323
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
28244
29324
  * carrying the post-callback claims before redirecting back to
28245
29325
  * `/api/auth/sso/finish`.
28246
29326
  *
@@ -28303,7 +29383,14 @@ var SsoBridgeClaimsSchema = object({
28303
29383
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28304
29384
  * subject is unique only per issuer, so a link is bound to it.
28305
29385
  */
28306
- issuer: string().optional()
29386
+ issuer: string().optional(),
29387
+ /**
29388
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
29389
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
29390
+ * request to present the matching cookie — a login bridge is useless in
29391
+ * any other browser.
29392
+ */
29393
+ browserBinding: string().optional()
28307
29394
  });
28308
29395
  method(object({
28309
29396
  claims: SsoBridgeClaimsSchema,
@@ -30677,7 +31764,7 @@ var CustomActionInputSchema = object({
30677
31764
  action: string().min(1),
30678
31765
  input: unknown()
30679
31766
  });
30680
- method(_void(), array(AddonListItemSchema).readonly()), method(object({
31767
+ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSchema).readonly()), method(object({
30681
31768
  addonId: string(),
30682
31769
  limit: number().min(1).max(500).default(100),
30683
31770
  level: LogLevelSchema$2.optional()
@@ -35756,7 +36843,13 @@ var TopologyNodeSchema = object({
35756
36843
  })).readonly(),
35757
36844
  processes: array(TopologyProcessSchema).readonly(),
35758
36845
  categories: array(TopologyCategorySchema).readonly(),
35759
- rootPackage: TopologyRootPackageSchema.nullable()
36846
+ rootPackage: TopologyRootPackageSchema.nullable(),
36847
+ /**
36848
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
36849
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
36850
+ * for offline rows and when the hub cannot tell.
36851
+ */
36852
+ meshTransport: _enum(["tls", "clear"]).optional()
35760
36853
  });
35761
36854
  var CapUsageEdgeSchema = object({
35762
36855
  callerAddonId: string(),
@@ -36169,6 +37262,7 @@ var OsdNamedTemplateSchema = object({
36169
37262
  });
36170
37263
  /** Where a slot's value comes from. */
36171
37264
  var OsdSourceSchema = discriminatedUnion("kind", [
37265
+ object({ kind: literal("none") }),
36172
37266
  object({
36173
37267
  kind: literal("static"),
36174
37268
  text: string().max(64)
@@ -36295,6 +37389,13 @@ method(object({ deviceId: number().int() }), object({
36295
37389
  }), object({ success: literal(true) }), {
36296
37390
  kind: "mutation",
36297
37391
  auth: "admin"
37392
+ }), method(object({
37393
+ deviceId: number().int(),
37394
+ slotId: string().min(1),
37395
+ enabled: boolean()
37396
+ }), object({ success: literal(true) }), {
37397
+ kind: "mutation",
37398
+ auth: "admin"
36298
37399
  }), method(object({
36299
37400
  sourceDeviceId: number().int(),
36300
37401
  targetDeviceId: number().int()
@@ -36726,7 +37827,15 @@ var GpuInfoSchema = object({
36726
37827
  name: string(),
36727
37828
  memoryMB: number().optional()
36728
37829
  });
36729
- var NpuInfoSchema = object({ type: _enum(["apple-ane", "intel-npu"]) });
37830
+ var NpuInfoSchema = object({
37831
+ type: _enum([
37832
+ "apple-ane",
37833
+ "intel-npu",
37834
+ "amd-xdna"
37835
+ ]),
37836
+ name: string().optional(),
37837
+ generation: _enum(["xdna1", "xdna2"]).optional()
37838
+ });
36730
37839
  var CoralInfoSchema = object({
36731
37840
  type: literal("coral-edgetpu"),
36732
37841
  bus: string().optional()
@@ -40579,16 +41688,6 @@ var ApiKeySummarySchema = object({
40579
41688
  createdAt: number(),
40580
41689
  lastUsedAt: number().optional()
40581
41690
  });
40582
- var CreateApiKeyInputSchema = object({
40583
- label: string(),
40584
- isAdmin: boolean().default(false),
40585
- allowedProviders: union([array(string()), literal("*")]).optional(),
40586
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
40587
- });
40588
- var CreateApiKeyResultSchema = object({
40589
- token: string(),
40590
- record: ApiKeySummarySchema
40591
- });
40592
41691
  var ScopedTokenSummarySchema = object({
40593
41692
  id: string(),
40594
41693
  userId: string(),
@@ -40687,17 +41786,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40687
41786
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
40688
41787
  kind: "mutation",
40689
41788
  access: "view"
40690
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
40691
- kind: "mutation",
40692
- auth: "admin",
40693
- access: "create"
40694
- }), method(object({ id: string() }), object({ success: literal(true) }), {
41789
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
40695
41790
  kind: "mutation",
40696
41791
  auth: "admin",
40697
41792
  access: "delete"
40698
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
40699
- kind: "mutation",
40700
- access: "view"
40701
41793
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
40702
41794
  kind: "mutation",
40703
41795
  auth: "admin",
@@ -40771,15 +41863,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40771
41863
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
40772
41864
  userId: string(),
40773
41865
  issuer: string()
40774
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
40775
- userId: string(),
40776
- issuer: string().min(1),
40777
- label: string().optional()
40778
- }), object({ success: literal(true) }), {
40779
- kind: "mutation",
40780
- auth: "admin",
40781
- access: "create"
40782
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41866
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
40783
41867
  kind: "mutation",
40784
41868
  auth: "admin",
40785
41869
  access: "delete"
@@ -41484,6 +42568,563 @@ var zoneRulesCapability = {
41484
42568
  */
41485
42569
  durability: "restored"
41486
42570
  };
42571
+ /**
42572
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
42573
+ *
42574
+ * A thin, mockable translation layer: it knows how to run a container with a
42575
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
42576
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
42577
+ * those are the `training` orchestrator's (D805). Every rule written there
42578
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
42579
+ * manifest entry and nothing else.
42580
+ *
42581
+ * Collection of provider **types** (addons). Each addon owns zero or more
42582
+ * **entries** (credentials + defaults). Concat-fans: `describe`,
42583
+ * `describeTypes`, `listEntries`, `listJobs`. Single-row work is keyed by
42584
+ * `entryId`; callers also pass the owning `addonId` as the collection
42585
+ * selector (broker posture). Every method is `admin`: these spend money.
42586
+ *
42587
+ * Every cloud object a provider creates is tagged with the orchestrator's
42588
+ * `jobKey`, so a retried submit finds the job it already started instead of
42589
+ * starting a second GPU, and `listJobs` can find orphans.
42590
+ *
42591
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
42592
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
42593
+ * ticket the provider mints (D613).
42594
+ */
42595
+ var TrainingGpuOptionSchema = object({
42596
+ id: string(),
42597
+ label: string(),
42598
+ /** List price, USD per GPU-hour, before any region multiplier. */
42599
+ usdPerHour: number().nonnegative(),
42600
+ vramGb: number().nonnegative()
42601
+ });
42602
+ var TrainingRegionOptionSchema = object({
42603
+ /** `''` = any region (the provider's choice). */
42604
+ id: string(),
42605
+ label: string(),
42606
+ priceMultiplier: number().positive()
42607
+ });
42608
+ /**
42609
+ * The provider's per-entry settings, as the orchestrator reads them. They
42610
+ * live on the PROVIDER addon's entry (operator decision 2026-10-08: they
42611
+ * depend on the user's account), never hard-coded in the orchestrator.
42612
+ */
42613
+ var TrainingProviderDefaultsSchema = object({
42614
+ gpuType: string(),
42615
+ region: string(),
42616
+ costCapUsd: number().nonnegative(),
42617
+ maxRuntimeSec: number().int().positive(),
42618
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
42619
+ failedDatasetGraceHours: number().nonnegative()
42620
+ });
42621
+ /**
42622
+ * Entry form schema for a provider type — same seam as notification
42623
+ * `TargetKind.configSchema` (`z.unknown()` at the wire; callers tighten to
42624
+ * {@link ConfigUISchema}). Drives `ConfigFormBuilder` on Training → Providers.
42625
+ */
42626
+ var ConfigSchemaPassthrough = unknown();
42627
+ /** One creatable provider type, for the Add-entry dialog. */
42628
+ var TrainingProviderTypeSchema = object({
42629
+ typeId: string(),
42630
+ label: string(),
42631
+ /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
42632
+ iconAsset: string(),
42633
+ /** Owning `training-provider` addon — collection selector for createEntry. */
42634
+ addonId: string(),
42635
+ /**
42636
+ * Fields for one entry of this type (credentials + defaults). Absent on a
42637
+ * type that only needs a name. Password fields are keychain-backed on the
42638
+ * provider addon (`secretStatePaths`), not D634 plaintext.
42639
+ */
42640
+ configSchema: ConfigSchemaPassthrough.optional()
42641
+ });
42642
+ /** One configured account / workspace under a provider type. */
42643
+ var TrainingProviderEntrySchema = object({
42644
+ entryId: string(),
42645
+ typeId: string(),
42646
+ name: string(),
42647
+ addonId: string(),
42648
+ /** Credentials are present — never the values. */
42649
+ configured: boolean()
42650
+ });
42651
+ var TrainingProviderDescriptorSchema = object({
42652
+ addonId: string(),
42653
+ entryId: string(),
42654
+ typeId: string(),
42655
+ /** Operator-chosen entry name. */
42656
+ name: string(),
42657
+ iconAsset: string(),
42658
+ /** `modal`, `runpod`, `fake`, … — same as typeId for current providers. */
42659
+ kind: string(),
42660
+ label: string(),
42661
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
42662
+ regions: array(TrainingRegionOptionSchema).readonly(),
42663
+ maxDatasetBytes: number().int().positive(),
42664
+ maxRuntimeSec: number().int().positive(),
42665
+ freeTierNote: string().optional(),
42666
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
42667
+ dataResidencyNote: string(),
42668
+ /** Credentials are present — never the values. */
42669
+ configured: boolean(),
42670
+ defaults: TrainingProviderDefaultsSchema,
42671
+ /**
42672
+ * Values for {@link TrainingProviderTypeSchema}'s `configSchema` — password
42673
+ * fields are keychain {@link SecretFieldView} or `null` / `''` (create),
42674
+ * never plaintext. Same hydrate contract as settings forms (D789).
42675
+ */
42676
+ formValues: record(string(), unknown()).optional()
42677
+ });
42678
+ /**
42679
+ * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
42680
+ * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
42681
+ * `{ $secretClear: true }` clears it.
42682
+ */
42683
+ var TrainingProviderUpdateEntryInputSchema = object({
42684
+ entryId: string().min(1),
42685
+ name: string().min(1),
42686
+ tokenId: string().optional(),
42687
+ tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
42688
+ environment: string().optional(),
42689
+ gpuType: string().optional(),
42690
+ region: string().optional(),
42691
+ costCapUsd: number().nonnegative().optional(),
42692
+ maxRuntimeSec: number().int().positive().optional(),
42693
+ failedDatasetGraceHours: number().nonnegative().optional()
42694
+ });
42695
+ var TrainingCredentialCheckSchema = object({
42696
+ ok: boolean(),
42697
+ /** Workspace / account name, when the provider says. */
42698
+ account: string().optional(),
42699
+ reason: _enum([
42700
+ "missing",
42701
+ "invalid",
42702
+ "forbidden",
42703
+ "network",
42704
+ "quota"
42705
+ ]).optional(),
42706
+ detail: string().optional()
42707
+ });
42708
+ var ProviderJobStateSchema = _enum([
42709
+ "pending",
42710
+ "starting",
42711
+ "running",
42712
+ "succeeded",
42713
+ "failed",
42714
+ "cancelled",
42715
+ "lost"
42716
+ ]);
42717
+ var ProviderJobStatusSchema = object({
42718
+ jobKey: string(),
42719
+ providerJobId: string().optional(),
42720
+ state: ProviderJobStateSchema,
42721
+ startedAt: number().optional(),
42722
+ endedAt: number().optional(),
42723
+ exitCode: number().int().optional(),
42724
+ failureReason: string().optional(),
42725
+ gpuType: string(),
42726
+ region: string().optional(),
42727
+ billedSeconds: number().nonnegative(),
42728
+ costUsd: number().nonnegative(),
42729
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
42730
+ costIsEstimate: boolean(),
42731
+ lastFetchedAt: number()
42732
+ });
42733
+ /**
42734
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
42735
+ * image its own way (Modal builds the published Dockerfile at that revision;
42736
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
42737
+ * in `result.json`.
42738
+ */
42739
+ var TrainerSourceRefSchema = object({
42740
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
42741
+ repo: string().min(1),
42742
+ /** A commit sha (never a branch) — the job must be reproducible. */
42743
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
42744
+ });
42745
+ /** Cloud job identity — route with the owning addon's `addonId` selector. */
42746
+ var JobRef = {
42747
+ entryId: string().min(1),
42748
+ jobKey: string().uuid()
42749
+ };
42750
+ var TrainingLogLineSchema = object({
42751
+ ts: number(),
42752
+ text: string()
42753
+ });
42754
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
42755
+ typeId: string().min(1),
42756
+ name: string().min(1)
42757
+ }), object({ entryId: string() }), {
42758
+ kind: "mutation",
42759
+ auth: "admin"
42760
+ }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
42761
+ kind: "mutation",
42762
+ auth: "admin"
42763
+ }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
42764
+ kind: "mutation",
42765
+ auth: "admin"
42766
+ }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
42767
+ kind: "mutation",
42768
+ auth: "admin",
42769
+ timeoutMs: 3e4
42770
+ }), method(object({
42771
+ entryId: string().min(1),
42772
+ gpuType: string(),
42773
+ region: string(),
42774
+ datasetBytes: number().int().nonnegative(),
42775
+ gpuSecondsLow: number().nonnegative(),
42776
+ gpuSecondsHigh: number().nonnegative()
42777
+ }), object({
42778
+ usdLow: number().nonnegative(),
42779
+ usdHigh: number().nonnegative(),
42780
+ notes: array(string()).readonly()
42781
+ }), { auth: "admin" }), method(object({
42782
+ ...JobRef,
42783
+ ticket: PeerBytesTicketSchema
42784
+ }), object({
42785
+ bytes: number().int().nonnegative(),
42786
+ sha256: string()
42787
+ }), {
42788
+ kind: "mutation",
42789
+ auth: "admin",
42790
+ timeoutMs: 120 * 6e4
42791
+ }), method(object({
42792
+ ...JobRef,
42793
+ trainer: TrainerSourceRefSchema,
42794
+ jobSpecJson: string().min(2).max(64e3),
42795
+ gpuType: string(),
42796
+ region: string(),
42797
+ maxRuntimeSec: number().int().positive()
42798
+ }), ProviderJobStatusSchema, {
42799
+ kind: "mutation",
42800
+ auth: "admin",
42801
+ timeoutMs: 30 * 6e4
42802
+ }), method(object(JobRef), ProviderJobStatusSchema, {
42803
+ auth: "admin",
42804
+ timeoutMs: 6e4
42805
+ }), method(object({
42806
+ ...JobRef,
42807
+ cursor: string().optional(),
42808
+ max: number().int().min(1).max(500)
42809
+ }), object({
42810
+ lines: array(TrainingLogLineSchema).readonly(),
42811
+ cursor: string()
42812
+ }), {
42813
+ auth: "admin",
42814
+ timeoutMs: 6e4
42815
+ }), method(object(JobRef), object({ ok: literal(true) }), {
42816
+ kind: "mutation",
42817
+ auth: "admin",
42818
+ timeoutMs: 6e4
42819
+ }), method(object(JobRef), object({
42820
+ found: boolean(),
42821
+ text: string().optional()
42822
+ }), {
42823
+ kind: "mutation",
42824
+ auth: "admin",
42825
+ timeoutMs: 5 * 6e4
42826
+ }), method(object({
42827
+ ...JobRef,
42828
+ path: _enum(["bundle.tar"])
42829
+ }), object({ ticket: PeerBytesTicketSchema }), {
42830
+ kind: "mutation",
42831
+ auth: "admin",
42832
+ timeoutMs: 5 * 6e4
42833
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
42834
+ kind: "mutation",
42835
+ auth: "admin",
42836
+ timeoutMs: 5 * 6e4
42837
+ }), method(object({ entryId: string().min(1).optional() }), array(ProviderJobStatusSchema).readonly(), {
42838
+ auth: "admin",
42839
+ timeoutMs: 2 * 6e4
42840
+ });
42841
+ /**
42842
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
42843
+ * provided by `addon-training`.
42844
+ *
42845
+ * It owns what every provider must agree on, written once:
42846
+ *
42847
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
42848
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
42849
+ * - **The return flow.** Verified artefacts → Model Studio
42850
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
42851
+ * rollback. Nothing is ever registered automatically.
42852
+ *
42853
+ * Plan/start takes a live {@link TrainingCorpusSelection} (collections +
42854
+ * work-state rule); frame ids are resolved via pipeline-analytics at that
42855
+ * moment and snapshotted on the job. No frozen dataset version.
42856
+ *
42857
+ * Every method is `admin`.
42858
+ */
42859
+ /**
42860
+ * Live corpus criteria for plan/start (design §5.2). Default is complete-only.
42861
+ * Frame ids are resolved at plan/start — never a frozen version id.
42862
+ */
42863
+ var TrainingCorpusSelectionSchema = object({
42864
+ collectionIds: array(string()).min(1),
42865
+ /** Default complete-only for v1 */
42866
+ workState: _enum([
42867
+ "complete",
42868
+ "annotated_or_complete",
42869
+ "any_annotated"
42870
+ ]).default("complete")
42871
+ });
42872
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
42873
+ var TrainingBaseModelSchema = object({
42874
+ modelId: string(),
42875
+ label: string(),
42876
+ weights: string(),
42877
+ imgsz: number().int(),
42878
+ baselineOnnxUrl: string(),
42879
+ baselineFloors: record(string(), number()),
42880
+ /** The base the fleet runs most — the UI's default. */
42881
+ recommended: boolean()
42882
+ });
42883
+ var TrainingPresetSchema = _enum([
42884
+ "quick",
42885
+ "standard",
42886
+ "thorough"
42887
+ ]);
42888
+ var TrainingJobRequestSchema = object({
42889
+ /** Live collection + work-state criteria; resolved at plan/start. */
42890
+ selection: TrainingCorpusSelectionSchema,
42891
+ /**
42892
+ * The provider **entry** that runs it (credentials + defaults).
42893
+ * Resolve to an owning addon via `training-provider.describe` / `listEntries`.
42894
+ */
42895
+ entryId: string().min(1),
42896
+ gpuType: string().min(1),
42897
+ region: string(),
42898
+ baseModelId: string().min(1),
42899
+ preset: TrainingPresetSchema,
42900
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
42901
+ freeze: number().int().nonnegative().nullable(),
42902
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
42903
+ holdoutCameras: array(number().int()).nullable()
42904
+ });
42905
+ var TrainingSplitPlanSchema = object({
42906
+ holdoutCameras: array(number().int()).readonly(),
42907
+ /** Used when no camera is held out: the last N days of every camera. */
42908
+ holdoutLastDays: number().int().nonnegative(),
42909
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
42910
+ holdoutSupport: record(string(), number().int()).nullable(),
42911
+ trainSubjects: number().int()
42912
+ });
42913
+ var TrainingRefusalReasonSchema = _enum([
42914
+ "unknown-dataset",
42915
+ "unknown-provider",
42916
+ "provider-not-configured",
42917
+ "unknown-base-model",
42918
+ "unknown-gpu",
42919
+ "dataset-too-large",
42920
+ "no-training-subjects",
42921
+ "job-already-running"
42922
+ ]);
42923
+ var TrainingJobPlanSchema = object({
42924
+ refusal: object({
42925
+ reason: TrainingRefusalReasonSchema,
42926
+ detail: string()
42927
+ }).nullable(),
42928
+ warnings: array(string()).readonly(),
42929
+ split: TrainingSplitPlanSchema.nullable(),
42930
+ estimate: object({
42931
+ datasetBytes: number().int(),
42932
+ uploadMinutesAt20Mbps: number(),
42933
+ gpuSecondsLow: number(),
42934
+ gpuSecondsHigh: number(),
42935
+ usdLow: number(),
42936
+ usdHigh: number(),
42937
+ notes: array(string()).readonly()
42938
+ }).nullable(),
42939
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
42940
+ defaults: object({
42941
+ maxCostUsd: number(),
42942
+ maxRuntimeSec: number().int()
42943
+ }).nullable(),
42944
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
42945
+ dataNotice: string()
42946
+ });
42947
+ /**
42948
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
42949
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
42950
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
42951
+ * result lives after the operator acted on it.
42952
+ */
42953
+ var TrainingJobStateSchema = _enum([
42954
+ "queued",
42955
+ "uploading",
42956
+ "submitted",
42957
+ "starting",
42958
+ "running",
42959
+ "collecting",
42960
+ "ready",
42961
+ "registered",
42962
+ "canary",
42963
+ "failed",
42964
+ "cancelling",
42965
+ "cancelled",
42966
+ "lost",
42967
+ "expired",
42968
+ "discarded"
42969
+ ]);
42970
+ var TrainingFailureReasonSchema = _enum([
42971
+ "cost-cap",
42972
+ "runtime-cap",
42973
+ "upload-failed",
42974
+ "submit-failed",
42975
+ "trainer-failed",
42976
+ "result-invalid",
42977
+ "checksum-mismatch",
42978
+ "fetch-failed",
42979
+ "provider-error",
42980
+ "hub-restart-during-upload"
42981
+ ]);
42982
+ var TrainingProgressPointSchema = object({
42983
+ epoch: number().int(),
42984
+ map50: number().nullable(),
42985
+ map50_95: number().nullable()
42986
+ });
42987
+ var TrainingCanarySchema = object({
42988
+ deviceIds: array(number().int()).readonly(),
42989
+ since: number(),
42990
+ /** Every override the canary replaced, exactly, so rollback restores it. */
42991
+ previous: array(object({
42992
+ deviceId: number().int(),
42993
+ nodeId: string(),
42994
+ deviceKey: string(),
42995
+ patch: object({
42996
+ modelId: string().optional(),
42997
+ settings: record(string(), unknown()).readonly().optional()
42998
+ }).nullable()
42999
+ })).readonly()
43000
+ });
43001
+ var TrainingJobSchema = object({
43002
+ id: string(),
43003
+ idempotencyKey: string(),
43004
+ name: string(),
43005
+ createdAt: number(),
43006
+ updatedAt: number(),
43007
+ state: TrainingJobStateSchema,
43008
+ /**
43009
+ * Shared by every job enqueued together via `startJobBatch`.
43010
+ * `null` for a lone `startJob`. The engine advances queued siblings by this id.
43011
+ */
43012
+ batchId: string().nullable().default(null),
43013
+ stage: TrainingStageSchema.nullable(),
43014
+ failure: object({
43015
+ reason: TrainingFailureReasonSchema,
43016
+ stage: string().nullable(),
43017
+ detail: string()
43018
+ }).nullable(),
43019
+ request: TrainingJobRequestSchema,
43020
+ maxCostUsd: number().nonnegative(),
43021
+ maxRuntimeSec: number().int().positive(),
43022
+ trainer: TrainerSourceRefSchema,
43023
+ datasetLayout: RetrainExportLayoutSchema,
43024
+ /** Frame count snapshotted when the job started (audit; equals `frameIds.length`). */
43025
+ frameCount: number().int().nonnegative(),
43026
+ /** Resolved frame ids at start — the archive ships exactly these. */
43027
+ frameIds: array(string()).max(2e4).readonly(),
43028
+ /** Hash of what those frames taught at start (trainer `dataset.annotationHash`). */
43029
+ annotationHash: string(),
43030
+ dataset: object({
43031
+ bytes: number().int(),
43032
+ sha256: string(),
43033
+ uploadedAt: number()
43034
+ }).nullable(),
43035
+ split: TrainingSplitPlanSchema,
43036
+ provider: object({
43037
+ state: ProviderJobStateSchema.nullable(),
43038
+ providerJobId: string().nullable(),
43039
+ startedAt: number().nullable(),
43040
+ endedAt: number().nullable(),
43041
+ billedSeconds: number(),
43042
+ costUsd: number(),
43043
+ costIsEstimate: boolean(),
43044
+ lastPolledAt: number().nullable()
43045
+ }),
43046
+ progress: object({
43047
+ epoch: number().int().nullable(),
43048
+ epochs: number().int().nullable(),
43049
+ etaSec: number().nullable(),
43050
+ series: array(TrainingProgressPointSchema).readonly()
43051
+ }),
43052
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
43053
+ logTail: array(string()).readonly(),
43054
+ logCursor: string().nullable(),
43055
+ artifacts: object({
43056
+ bundleBytes: number().int(),
43057
+ bundleSha256: string(),
43058
+ fetchedAt: number(),
43059
+ /** When the staged artefacts are deleted from the hub. */
43060
+ expiresAt: number()
43061
+ }).nullable(),
43062
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
43063
+ cloudDatasetDeletedAt: number().nullable(),
43064
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
43065
+ cloudCleanupDueAt: number().nullable(),
43066
+ /** Model ids registered from this job (base, and int8 when kept). */
43067
+ registeredModelIds: array(string()).readonly(),
43068
+ canary: TrainingCanarySchema.nullable()
43069
+ });
43070
+ var IdInput = object({ id: string().min(1) });
43071
+ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
43072
+ auth: "admin",
43073
+ timeoutMs: 6e4
43074
+ }), method(TrainingJobRequestSchema.extend({
43075
+ name: string().min(1).max(120),
43076
+ maxCostUsd: number().positive(),
43077
+ maxRuntimeSec: number().int().positive(),
43078
+ idempotencyKey: string().min(8).max(80)
43079
+ }), discriminatedUnion("kind", [object({
43080
+ kind: literal("started"),
43081
+ job: TrainingJobSchema
43082
+ }), object({
43083
+ kind: literal("refused"),
43084
+ reason: TrainingRefusalReasonSchema,
43085
+ detail: string()
43086
+ })]), {
43087
+ kind: "mutation",
43088
+ auth: "admin",
43089
+ timeoutMs: 12e4
43090
+ }), method(TrainingJobRequestSchema.omit({ baseModelId: true }).extend({
43091
+ baseModelIds: array(string().min(1)).min(1),
43092
+ name: string().min(1).max(120),
43093
+ maxCostUsd: number().positive(),
43094
+ maxRuntimeSec: number().int().positive(),
43095
+ idempotencyKey: string().min(8).max(80)
43096
+ }), discriminatedUnion("kind", [object({
43097
+ kind: literal("started"),
43098
+ batchId: string(),
43099
+ jobs: array(TrainingJobSchema).min(1).readonly()
43100
+ }), object({
43101
+ kind: literal("refused"),
43102
+ reason: TrainingRefusalReasonSchema,
43103
+ detail: string()
43104
+ })]), {
43105
+ kind: "mutation",
43106
+ auth: "admin",
43107
+ timeoutMs: 12e4
43108
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
43109
+ kind: "mutation",
43110
+ auth: "admin",
43111
+ timeoutMs: 12e4
43112
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
43113
+ kind: "mutation",
43114
+ auth: "admin",
43115
+ timeoutMs: 30 * 6e4
43116
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
43117
+ kind: "mutation",
43118
+ auth: "admin",
43119
+ timeoutMs: 12e4
43120
+ }), method(IdInput, TrainingJobSchema, {
43121
+ kind: "mutation",
43122
+ auth: "admin",
43123
+ timeoutMs: 12e4
43124
+ }), method(IdInput, TrainingJobSchema, {
43125
+ kind: "mutation",
43126
+ auth: "admin"
43127
+ });
41487
43128
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
41488
43129
  Object.freeze({
41489
43130
  person: .5,
@@ -43632,6 +45273,12 @@ Object.freeze({
43632
45273
  addonId: null,
43633
45274
  access: "create"
43634
45275
  },
45276
+ "backup.checkBackupKey": {
45277
+ capName: "backup",
45278
+ capScope: "system",
45279
+ addonId: null,
45280
+ access: "create"
45281
+ },
43635
45282
  "backup.delete": {
43636
45283
  capName: "backup",
43637
45284
  capScope: "system",
@@ -43644,6 +45291,18 @@ Object.freeze({
43644
45291
  addonId: null,
43645
45292
  access: "delete"
43646
45293
  },
45294
+ "backup.disableEncryption": {
45295
+ capName: "backup",
45296
+ capScope: "system",
45297
+ addonId: null,
45298
+ access: "create"
45299
+ },
45300
+ "backup.getEncryption": {
45301
+ capName: "backup",
45302
+ capScope: "system",
45303
+ addonId: null,
45304
+ access: "view"
45305
+ },
43647
45306
  "backup.getEntries": {
43648
45307
  capName: "backup",
43649
45308
  capScope: "system",
@@ -43698,6 +45357,12 @@ Object.freeze({
43698
45357
  addonId: null,
43699
45358
  access: "create"
43700
45359
  },
45360
+ "backup.setupEncryption": {
45361
+ capName: "backup",
45362
+ capScope: "system",
45363
+ addonId: null,
45364
+ access: "create"
45365
+ },
43701
45366
  "backup.trigger": {
43702
45367
  capName: "backup",
43703
45368
  capScope: "system",
@@ -44250,6 +45915,12 @@ Object.freeze({
44250
45915
  addonId: null,
44251
45916
  access: "create"
44252
45917
  },
45918
+ "customModelRegistry.importModelBundle": {
45919
+ capName: "custom-model-registry",
45920
+ capScope: "system",
45921
+ addonId: null,
45922
+ access: "create"
45923
+ },
44253
45924
  "customModelRegistry.listModels": {
44254
45925
  capName: "custom-model-registry",
44255
45926
  capScope: "system",
@@ -45690,6 +47361,12 @@ Object.freeze({
45690
47361
  addonId: null,
45691
47362
  access: "view"
45692
47363
  },
47364
+ "keychainAdmin.acknowledgeReset": {
47365
+ capName: "keychain-admin",
47366
+ capScope: "system",
47367
+ addonId: null,
47368
+ access: "create"
47369
+ },
45693
47370
  "keychainAdmin.deleteOrphans": {
45694
47371
  capName: "keychain-admin",
45695
47372
  capScope: "system",
@@ -45726,6 +47403,12 @@ Object.freeze({
45726
47403
  addonId: null,
45727
47404
  access: "delete"
45728
47405
  },
47406
+ "keychainAdmin.resetReport": {
47407
+ capName: "keychain-admin",
47408
+ capScope: "system",
47409
+ addonId: null,
47410
+ access: "delete"
47411
+ },
45729
47412
  "keychainAdmin.reveal": {
45730
47413
  capName: "keychain-admin",
45731
47414
  capScope: "system",
@@ -45738,6 +47421,12 @@ Object.freeze({
45738
47421
  addonId: null,
45739
47422
  access: "create"
45740
47423
  },
47424
+ "keychainAdmin.setSystemSecret": {
47425
+ capName: "keychain-admin",
47426
+ capScope: "system",
47427
+ addonId: null,
47428
+ access: "create"
47429
+ },
45741
47430
  "keychainAdmin.status": {
45742
47431
  capName: "keychain-admin",
45743
47432
  capScope: "system",
@@ -46974,6 +48663,36 @@ Object.freeze({
46974
48663
  addonId: null,
46975
48664
  access: "view"
46976
48665
  },
48666
+ "oidcConnections.connectionFormSchema": {
48667
+ capName: "oidc-connections",
48668
+ capScope: "system",
48669
+ addonId: null,
48670
+ access: "view"
48671
+ },
48672
+ "oidcConnections.createConnection": {
48673
+ capName: "oidc-connections",
48674
+ capScope: "system",
48675
+ addonId: null,
48676
+ access: "create"
48677
+ },
48678
+ "oidcConnections.deleteConnection": {
48679
+ capName: "oidc-connections",
48680
+ capScope: "system",
48681
+ addonId: null,
48682
+ access: "delete"
48683
+ },
48684
+ "oidcConnections.listConnections": {
48685
+ capName: "oidc-connections",
48686
+ capScope: "system",
48687
+ addonId: null,
48688
+ access: "view"
48689
+ },
48690
+ "oidcConnections.updateConnection": {
48691
+ capName: "oidc-connections",
48692
+ capScope: "system",
48693
+ addonId: null,
48694
+ access: "create"
48695
+ },
46977
48696
  "osd.getStatus": {
46978
48697
  capName: "osd",
46979
48698
  capScope: "device",
@@ -47046,6 +48765,12 @@ Object.freeze({
47046
48765
  addonId: null,
47047
48766
  access: "create"
47048
48767
  },
48768
+ "osdManager.setSlotCameraEnabled": {
48769
+ capName: "osd-manager",
48770
+ capScope: "system",
48771
+ addonId: null,
48772
+ access: "create"
48773
+ },
47049
48774
  "osdManager.upsertTemplate": {
47050
48775
  capName: "osd-manager",
47051
48776
  capScope: "system",
@@ -47298,6 +49023,12 @@ Object.freeze({
47298
49023
  addonId: null,
47299
49024
  access: "view"
47300
49025
  },
49026
+ "pipelineAnalytics.getRetrainCorpusKpi": {
49027
+ capName: "pipeline-analytics",
49028
+ capScope: "device",
49029
+ addonId: null,
49030
+ access: "view"
49031
+ },
47301
49032
  "pipelineAnalytics.getRetrainExportUrl": {
47302
49033
  capName: "pipeline-analytics",
47303
49034
  capScope: "device",
@@ -47418,6 +49149,12 @@ Object.freeze({
47418
49149
  addonId: null,
47419
49150
  access: "view"
47420
49151
  },
49152
+ "pipelineAnalytics.listRetrainCorpusPage": {
49153
+ capName: "pipeline-analytics",
49154
+ capScope: "device",
49155
+ addonId: null,
49156
+ access: "view"
49157
+ },
47421
49158
  "pipelineAnalytics.listRetrainFrames": {
47422
49159
  capName: "pipeline-analytics",
47423
49160
  capScope: "device",
@@ -47448,6 +49185,12 @@ Object.freeze({
47448
49185
  addonId: null,
47449
49186
  access: "view"
47450
49187
  },
49188
+ "pipelineAnalytics.offerRetrainArchive": {
49189
+ capName: "pipeline-analytics",
49190
+ capScope: "device",
49191
+ addonId: null,
49192
+ access: "create"
49193
+ },
47451
49194
  "pipelineAnalytics.ownersWithMedia": {
47452
49195
  capName: "pipeline-analytics",
47453
49196
  capScope: "device",
@@ -47538,6 +49281,12 @@ Object.freeze({
47538
49281
  addonId: null,
47539
49282
  access: "create"
47540
49283
  },
49284
+ "pipelineAnalytics.resolveRetrainTrainingCorpus": {
49285
+ capName: "pipeline-analytics",
49286
+ capScope: "device",
49287
+ addonId: null,
49288
+ access: "view"
49289
+ },
47541
49290
  "pipelineAnalytics.restageRetrainTrack": {
47542
49291
  capName: "pipeline-analytics",
47543
49292
  capScope: "device",
@@ -49974,6 +51723,180 @@ Object.freeze({
49974
51723
  addonId: null,
49975
51724
  access: "view"
49976
51725
  },
51726
+ "training.canaryResult": {
51727
+ capName: "training",
51728
+ capScope: "system",
51729
+ addonId: null,
51730
+ access: "create"
51731
+ },
51732
+ "training.cancelJob": {
51733
+ capName: "training",
51734
+ capScope: "system",
51735
+ addonId: null,
51736
+ access: "create"
51737
+ },
51738
+ "training.discardResult": {
51739
+ capName: "training",
51740
+ capScope: "system",
51741
+ addonId: null,
51742
+ access: "create"
51743
+ },
51744
+ "training.getJob": {
51745
+ capName: "training",
51746
+ capScope: "system",
51747
+ addonId: null,
51748
+ access: "view"
51749
+ },
51750
+ "training.getJobResult": {
51751
+ capName: "training",
51752
+ capScope: "system",
51753
+ addonId: null,
51754
+ access: "view"
51755
+ },
51756
+ "training.listBaseModels": {
51757
+ capName: "training",
51758
+ capScope: "system",
51759
+ addonId: null,
51760
+ access: "view"
51761
+ },
51762
+ "training.listJobs": {
51763
+ capName: "training",
51764
+ capScope: "system",
51765
+ addonId: null,
51766
+ access: "view"
51767
+ },
51768
+ "training.planJob": {
51769
+ capName: "training",
51770
+ capScope: "system",
51771
+ addonId: null,
51772
+ access: "view"
51773
+ },
51774
+ "training.registerResult": {
51775
+ capName: "training",
51776
+ capScope: "system",
51777
+ addonId: null,
51778
+ access: "create"
51779
+ },
51780
+ "training.rollbackCanary": {
51781
+ capName: "training",
51782
+ capScope: "system",
51783
+ addonId: null,
51784
+ access: "create"
51785
+ },
51786
+ "training.startJob": {
51787
+ capName: "training",
51788
+ capScope: "system",
51789
+ addonId: null,
51790
+ access: "create"
51791
+ },
51792
+ "training.startJobBatch": {
51793
+ capName: "training",
51794
+ capScope: "system",
51795
+ addonId: null,
51796
+ access: "create"
51797
+ },
51798
+ "trainingProvider.cancelJob": {
51799
+ capName: "training-provider",
51800
+ capScope: "system",
51801
+ addonId: null,
51802
+ access: "create"
51803
+ },
51804
+ "trainingProvider.cleanupJob": {
51805
+ capName: "training-provider",
51806
+ capScope: "system",
51807
+ addonId: null,
51808
+ access: "create"
51809
+ },
51810
+ "trainingProvider.createEntry": {
51811
+ capName: "training-provider",
51812
+ capScope: "system",
51813
+ addonId: null,
51814
+ access: "create"
51815
+ },
51816
+ "trainingProvider.deleteEntry": {
51817
+ capName: "training-provider",
51818
+ capScope: "system",
51819
+ addonId: null,
51820
+ access: "delete"
51821
+ },
51822
+ "trainingProvider.describe": {
51823
+ capName: "training-provider",
51824
+ capScope: "system",
51825
+ addonId: null,
51826
+ access: "view"
51827
+ },
51828
+ "trainingProvider.describeTypes": {
51829
+ capName: "training-provider",
51830
+ capScope: "system",
51831
+ addonId: null,
51832
+ access: "view"
51833
+ },
51834
+ "trainingProvider.estimateJob": {
51835
+ capName: "training-provider",
51836
+ capScope: "system",
51837
+ addonId: null,
51838
+ access: "view"
51839
+ },
51840
+ "trainingProvider.getJob": {
51841
+ capName: "training-provider",
51842
+ capScope: "system",
51843
+ addonId: null,
51844
+ access: "view"
51845
+ },
51846
+ "trainingProvider.listEntries": {
51847
+ capName: "training-provider",
51848
+ capScope: "system",
51849
+ addonId: null,
51850
+ access: "view"
51851
+ },
51852
+ "trainingProvider.listJobEvents": {
51853
+ capName: "training-provider",
51854
+ capScope: "system",
51855
+ addonId: null,
51856
+ access: "view"
51857
+ },
51858
+ "trainingProvider.listJobs": {
51859
+ capName: "training-provider",
51860
+ capScope: "system",
51861
+ addonId: null,
51862
+ access: "view"
51863
+ },
51864
+ "trainingProvider.offerArtifact": {
51865
+ capName: "training-provider",
51866
+ capScope: "system",
51867
+ addonId: null,
51868
+ access: "create"
51869
+ },
51870
+ "trainingProvider.readResult": {
51871
+ capName: "training-provider",
51872
+ capScope: "system",
51873
+ addonId: null,
51874
+ access: "create"
51875
+ },
51876
+ "trainingProvider.submitJob": {
51877
+ capName: "training-provider",
51878
+ capScope: "system",
51879
+ addonId: null,
51880
+ access: "create"
51881
+ },
51882
+ "trainingProvider.updateEntry": {
51883
+ capName: "training-provider",
51884
+ capScope: "system",
51885
+ addonId: null,
51886
+ access: "create"
51887
+ },
51888
+ "trainingProvider.uploadDataset": {
51889
+ capName: "training-provider",
51890
+ capScope: "system",
51891
+ addonId: null,
51892
+ access: "create"
51893
+ },
51894
+ "trainingProvider.validateCredentials": {
51895
+ capName: "training-provider",
51896
+ capScope: "system",
51897
+ addonId: null,
51898
+ access: "create"
51899
+ },
49977
51900
  "turnProvider.getTurnServers": {
49978
51901
  capName: "turn-provider",
49979
51902
  capScope: "system",
@@ -49998,12 +51921,6 @@ Object.freeze({
49998
51921
  addonId: null,
49999
51922
  access: "create"
50000
51923
  },
50001
- "userManagement.createApiKey": {
50002
- capName: "user-management",
50003
- capScope: "system",
50004
- addonId: null,
50005
- access: "create"
50006
- },
50007
51924
  "userManagement.createScopedToken": {
50008
51925
  capName: "user-management",
50009
51926
  capScope: "system",
@@ -50040,12 +51957,6 @@ Object.freeze({
50040
51957
  addonId: null,
50041
51958
  access: "view"
50042
51959
  },
50043
- "userManagement.linkExternalIdentity": {
50044
- capName: "user-management",
50045
- capScope: "system",
50046
- addonId: null,
50047
- access: "create"
50048
- },
50049
51960
  "userManagement.listApiKeys": {
50050
51961
  capName: "user-management",
50051
51962
  capScope: "system",
@@ -50148,12 +52059,6 @@ Object.freeze({
50148
52059
  addonId: null,
50149
52060
  access: "create"
50150
52061
  },
50151
- "userManagement.validateApiKey": {
50152
- capName: "user-management",
50153
- capScope: "system",
50154
- addonId: null,
50155
- access: "view"
50156
- },
50157
52062
  "userManagement.validateCredentials": {
50158
52063
  capName: "user-management",
50159
52064
  capScope: "system",
@@ -53186,6 +55091,11 @@ Object.freeze({
53186
55091
  form: "single",
53187
55092
  optional: false
53188
55093
  }],
55094
+ "osdManager.setSlotCameraEnabled": [{
55095
+ name: "deviceId",
55096
+ form: "single",
55097
+ optional: false
55098
+ }],
53189
55099
  "petFeeder.callPet": [{
53190
55100
  name: "deviceId",
53191
55101
  form: "single",
@@ -53406,6 +55316,11 @@ Object.freeze({
53406
55316
  form: "array",
53407
55317
  optional: false
53408
55318
  }],
55319
+ "pipelineAnalytics.listRetrainCorpusPage": [{
55320
+ name: "deviceIds",
55321
+ form: "array",
55322
+ optional: true
55323
+ }],
53409
55324
  "pipelineAnalytics.listRetrainStaging": [{
53410
55325
  name: "deviceIds",
53411
55326
  form: "array",
@@ -54267,6 +56182,11 @@ Object.freeze({
54267
56182
  form: "single",
54268
56183
  optional: false
54269
56184
  }],
56185
+ "training.canaryResult": [{
56186
+ name: "deviceIds",
56187
+ form: "array",
56188
+ optional: false
56189
+ }],
54270
56190
  "update.getStatus": [{
54271
56191
  name: "deviceId",
54272
56192
  form: "single",
@@ -54510,6 +56430,7 @@ Object.freeze({
54510
56430
  });
54511
56431
  Object.freeze({
54512
56432
  "broker": "broker",
56433
+ "calendar-source": "calendar",
54513
56434
  "device-export": "device-export",
54514
56435
  "llm": "ai",
54515
56436
  "mesh-network": "mesh",
@@ -54995,6 +56916,8 @@ var STATE_SUMMARY_VARS = [
54995
56916
  [...RULE_TEXT],
54996
56917
  [...RULE_TEXT],
54997
56918
  [...RULE_TEXT],
56919
+ [...RULE_TEXT],
56920
+ [...RULE_TEXT],
54998
56921
  ([...RULE_TEXT], [...UPDATES]),
54999
56922
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
55000
56923
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),