@camstack/addon-provider-ecowitt 0.2.124 → 0.2.126

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