@camstack/addon-provider-dreo 0.2.123 → 0.2.125

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