@camstack/addon-provider-amcrest 0.2.133 → 0.2.135

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +2068 -145
  2. package/dist/addon.mjs +2068 -145
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -5391,7 +5391,7 @@ var ZodIssueCode = {
5391
5391
  var ZodFirstPartyTypeKind;
5392
5392
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5393
5393
  //#endregion
5394
- //#region ../types/dist/sleep-Cr5YOk3m.mjs
5394
+ //#region ../types/dist/sleep-DwAQ9sqX.mjs
5395
5395
  /**
5396
5396
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5397
5397
  * window to float samples (D455).
@@ -5508,7 +5508,7 @@ function isKeychainStoredField(field) {
5508
5508
  var SECRET_CLEAR = { $secretClear: true };
5509
5509
  /** The `'***'` token D634 redaction writes for non-admins. */
5510
5510
  var LEGACY_DEVICE_REDACTION = "***";
5511
- function isRecord$1$1(value) {
5511
+ function isRecord$2(value) {
5512
5512
  return typeof value === "object" && value !== null && !Array.isArray(value);
5513
5513
  }
5514
5514
  function makeSecretMarker(ref) {
@@ -5519,12 +5519,12 @@ function makeSecretMarker(ref) {
5519
5519
  }
5520
5520
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5521
5521
  function isSecretMarker(value) {
5522
- if (!isRecord$1$1(value)) return false;
5522
+ if (!isRecord$2(value)) return false;
5523
5523
  const ref = value["$secret"];
5524
5524
  return typeof ref === "string" && ref.length > 0;
5525
5525
  }
5526
5526
  function isSecretClear(value) {
5527
- return isRecord$1$1(value) && value["$secretClear"] === true;
5527
+ return isRecord$2(value) && value["$secretClear"] === true;
5528
5528
  }
5529
5529
  /**
5530
5530
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6040,6 +6040,13 @@ function globalSecretScope() {
6040
6040
  function encodeSegment(value) {
6041
6041
  return encodeURIComponent(value);
6042
6042
  }
6043
+ function decodeSegment(value) {
6044
+ try {
6045
+ return decodeURIComponent(value);
6046
+ } catch {
6047
+ return null;
6048
+ }
6049
+ }
6043
6050
  /**
6044
6051
  * The field path of a value inside an array item, addressed by the item's id:
6045
6052
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6048,6 +6055,75 @@ function encodeSegment(value) {
6048
6055
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6049
6056
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6050
6057
  }
6058
+ function parseScope(segments) {
6059
+ switch (segments[0]) {
6060
+ case "global": return {
6061
+ scope: GLOBAL_SCOPE,
6062
+ used: 1
6063
+ };
6064
+ case "node": {
6065
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6066
+ return nodeId === null || nodeId.length === 0 ? null : {
6067
+ scope: {
6068
+ kind: "node",
6069
+ nodeId
6070
+ },
6071
+ used: 2
6072
+ };
6073
+ }
6074
+ case "device": {
6075
+ const raw = segments[1];
6076
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6077
+ return {
6078
+ scope: {
6079
+ kind: "device",
6080
+ deviceId: Number(raw)
6081
+ },
6082
+ used: 2
6083
+ };
6084
+ }
6085
+ case "integration": {
6086
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6087
+ return id === null || id.length === 0 ? null : {
6088
+ scope: {
6089
+ kind: "integration",
6090
+ integrationId: id
6091
+ },
6092
+ used: 2
6093
+ };
6094
+ }
6095
+ case "row": {
6096
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6097
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6098
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6099
+ return {
6100
+ scope: {
6101
+ kind: "row",
6102
+ collection,
6103
+ rowId
6104
+ },
6105
+ used: 3
6106
+ };
6107
+ }
6108
+ default: return null;
6109
+ }
6110
+ }
6111
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6112
+ function parseSecretRef(ref) {
6113
+ if (!ref.startsWith("secret://")) return null;
6114
+ const segments = ref.slice(9).split("/");
6115
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6116
+ if (owner === null || owner.length === 0) return null;
6117
+ const parsed = parseScope(segments.slice(1));
6118
+ if (parsed === null) return null;
6119
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6120
+ if (fieldPath.length === 0) return null;
6121
+ return {
6122
+ owner,
6123
+ scope: parsed.scope,
6124
+ fieldPath
6125
+ };
6126
+ }
6051
6127
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6052
6128
  var KeychainWriteRefusedError = class extends Error {
6053
6129
  fieldPath;
@@ -6058,7 +6134,7 @@ var KeychainWriteRefusedError = class extends Error {
6058
6134
  }
6059
6135
  };
6060
6136
  var KEEP = { kind: "keep" };
6061
- function isRecord$2(value) {
6137
+ function isRecord$1$1(value) {
6062
6138
  return typeof value === "object" && value !== null && !Array.isArray(value);
6063
6139
  }
6064
6140
  function defaultMintId() {
@@ -6071,7 +6147,7 @@ function collectSecretMarkerRefs(value, out = []) {
6071
6147
  return out;
6072
6148
  }
6073
6149
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6074
- else if (isRecord$2(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6150
+ else if (isRecord$1$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6075
6151
  return out;
6076
6152
  }
6077
6153
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6126,7 +6202,7 @@ function rowId(row, idKey) {
6126
6202
  return null;
6127
6203
  }
6128
6204
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6129
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$2) : [];
6205
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1$1) : [];
6130
6206
  if (!Array.isArray(incoming)) {
6131
6207
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6132
6208
  return {
@@ -6142,7 +6218,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6142
6218
  const kept = /* @__PURE__ */ new Set();
6143
6219
  const rows = [];
6144
6220
  for (const row of incoming) {
6145
- if (!isRecord$2(row)) {
6221
+ if (!isRecord$1$1(row)) {
6146
6222
  rows.push(row);
6147
6223
  continue;
6148
6224
  }
@@ -6167,7 +6243,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6167
6243
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6168
6244
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6169
6245
  case "object": {
6170
- if (!isRecord$2(incoming)) {
6246
+ if (!isRecord$1$1(incoming)) {
6171
6247
  if (incoming === void 0) return KEEP;
6172
6248
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6173
6249
  return {
@@ -6175,7 +6251,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6175
6251
  value: incoming
6176
6252
  };
6177
6253
  }
6178
- const storedObj = isRecord$2(stored) ? stored : {};
6254
+ const storedObj = isRecord$1$1(stored) ? stored : {};
6179
6255
  return {
6180
6256
  kind: "value",
6181
6257
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6234,12 +6310,19 @@ async function transformSecretWrite(input) {
6234
6310
  }
6235
6311
  };
6236
6312
  }
6313
+ /** Is `ref` one of `owner`'s refs? */
6314
+ function isSecretRefOwnedBy(ref, owner) {
6315
+ return parseSecretRef(ref)?.owner === owner;
6316
+ }
6237
6317
  /**
6238
6318
  * Replace every marker in `value` with its keychain value. Returns the SAME
6239
6319
  * reference when there is no marker (no allocation, no keychain call).
6240
6320
  */
6241
- async function resolveSecretMarkers(value, secrets) {
6242
- const refs = collectSecretMarkerRefs(value);
6321
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6322
+ const keepMarker = options.unresolved === "keep-marker";
6323
+ const owner = options.ownedBy;
6324
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6325
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6243
6326
  if (refs.length === 0) return {
6244
6327
  value,
6245
6328
  unresolved: []
@@ -6263,10 +6346,18 @@ async function resolveSecretMarkers(value, secrets) {
6263
6346
  }
6264
6347
  const substitute = (v) => {
6265
6348
  if (isSecretMarker(v)) {
6349
+ if (!inScope(v.$secret)) return {
6350
+ keep: true,
6351
+ value: v
6352
+ };
6266
6353
  const answer = answers[v.$secret];
6267
- return answer?.kind === "value" ? {
6354
+ if (answer?.kind === "value") return {
6268
6355
  keep: true,
6269
6356
  value: answer.value
6357
+ };
6358
+ return keepMarker ? {
6359
+ keep: true,
6360
+ value: v
6270
6361
  } : {
6271
6362
  keep: false,
6272
6363
  value: void 0
@@ -6283,7 +6374,7 @@ async function resolveSecretMarkers(value, secrets) {
6283
6374
  value: items
6284
6375
  };
6285
6376
  }
6286
- if (isRecord$2(v)) {
6377
+ if (isRecord$1$1(v)) {
6287
6378
  const out = {};
6288
6379
  for (const [k, child] of Object.entries(v)) {
6289
6380
  const s = substitute(child);
@@ -6304,14 +6395,152 @@ async function resolveSecretMarkers(value, secrets) {
6304
6395
  unresolved
6305
6396
  };
6306
6397
  }
6307
- function touchesTree(tree, patch) {
6308
- if (tree.size === 0) return false;
6309
- for (const key of Object.keys(patch)) {
6310
- const at = key.indexOf("@");
6311
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6398
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6399
+ var SecretOverwriteRefusedError = class extends Error {
6400
+ ref;
6401
+ reason;
6402
+ constructor(ref, reason) {
6403
+ 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.`);
6404
+ this.ref = ref;
6405
+ this.reason = reason;
6406
+ this.name = "SecretOverwriteRefusedError";
6407
+ }
6408
+ };
6409
+ function isRecord$3(value) {
6410
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6411
+ }
6412
+ function resolvedValue(pass, marker) {
6413
+ const answer = pass.answers[marker.$secret];
6414
+ return answer?.kind === "value" ? answer.value : null;
6415
+ }
6416
+ async function atMarker(pass, incoming, stored) {
6417
+ if (incoming === null) return stored;
6418
+ if (typeof incoming !== "string") return incoming;
6419
+ if (incoming === resolvedValue(pass, stored)) return stored;
6420
+ const intent = classifySecretWrite(incoming);
6421
+ if (intent.kind !== "set") return stored;
6422
+ const ref = stored.$secret;
6423
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6424
+ const answer = pass.answers[ref];
6425
+ 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);
6426
+ try {
6427
+ await pass.secrets.put(ref, intent.value);
6428
+ } catch (err) {
6429
+ throw new KeychainWriteRefusedError(ref, err);
6430
+ }
6431
+ pass.changedRefs.push(ref);
6432
+ return stored;
6433
+ }
6434
+ function inArray(pass, incoming, stored) {
6435
+ return incoming.map((item, index) => {
6436
+ const twin = stored[index];
6437
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6438
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6439
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6440
+ return item;
6441
+ });
6442
+ }
6443
+ function inArrayRow(pass, incoming, stored) {
6444
+ const out = { ...incoming };
6445
+ for (const [key, value] of Object.entries(incoming)) {
6446
+ const twin = stored[key];
6447
+ if (isSecretMarker(twin)) {
6448
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6449
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6450
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6451
+ }
6452
+ return out;
6453
+ }
6454
+ async function walk(pass, incoming, stored) {
6455
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6456
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6457
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6458
+ const out = { ...incoming };
6459
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6460
+ return out;
6461
+ }
6462
+ /** Restore markers a write-back carries as values. See the file doc. */
6463
+ async function restoreUnchangedSecrets(input) {
6464
+ const refs = [];
6465
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6466
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6467
+ if (owned.length === 0) return {
6468
+ patch: input.patch,
6469
+ changedRefs: []
6470
+ };
6471
+ const pass = {
6472
+ secrets: input.secrets,
6473
+ answers: await input.secrets.resolve([...new Set(owned)]),
6474
+ operatorWrite: input.operatorWrite,
6475
+ changedRefs: []
6476
+ };
6477
+ const out = {};
6478
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6479
+ return {
6480
+ patch: out,
6481
+ changedRefs: pass.changedRefs
6482
+ };
6483
+ }
6484
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6485
+ function isJsonEqual(a, b) {
6486
+ if (Object.is(a, b)) return true;
6487
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6488
+ if (isRecord$3(a) && isRecord$3(b)) {
6489
+ const keys = Object.keys(a);
6490
+ if (keys.length !== Object.keys(b).length) return false;
6491
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6312
6492
  }
6313
6493
  return false;
6314
6494
  }
6495
+ /** The patch without the keys whose value already equals the stored one. */
6496
+ function dropUnchangedKeys(patch, stored) {
6497
+ const out = {};
6498
+ for (const [key, value] of Object.entries(patch)) {
6499
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6500
+ out[key] = value;
6501
+ }
6502
+ return out;
6503
+ }
6504
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6505
+ function markerKeysOf(blob, owner) {
6506
+ const keys = /* @__PURE__ */ new Set();
6507
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6508
+ return keys;
6509
+ }
6510
+ function nodeFromStored(value, owner) {
6511
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6512
+ if (!isRecord$3(value)) return null;
6513
+ const children = /* @__PURE__ */ new Map();
6514
+ for (const [key, child] of Object.entries(value)) {
6515
+ const node = nodeFromStored(child, owner);
6516
+ if (node !== null) children.set(key, node);
6517
+ }
6518
+ return children.size > 0 ? {
6519
+ kind: "object",
6520
+ children
6521
+ } : null;
6522
+ }
6523
+ /**
6524
+ * The declared secret tree, widened by every place the STORED blob holds a
6525
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6526
+ * never declared: Wyze before b4906cec6) still gets the save path's
6527
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6528
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6529
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6530
+ * builtin that keeps another addon's marker (device-manager) never takes it
6531
+ * over.
6532
+ */
6533
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6534
+ const added = /* @__PURE__ */ new Map();
6535
+ for (const key of keys) {
6536
+ const at = key.indexOf("@");
6537
+ const base = at > 0 ? key.slice(0, at) : key;
6538
+ if (declared.has(base) || added.has(base)) continue;
6539
+ const node = nodeFromStored(stored[key], owner);
6540
+ if (node !== null) added.set(base, node);
6541
+ }
6542
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6543
+ }
6315
6544
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6316
6545
  async function readStoredAddonBlob(raw) {
6317
6546
  const threeWay = raw.readAddonStoreResult;
@@ -6320,7 +6549,41 @@ async function readStoredAddonBlob(raw) {
6320
6549
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6321
6550
  return result.kind === "missing" ? {} : result.value;
6322
6551
  }
6323
- function createSecretAwareSettings(raw, opts) {
6552
+ function touchesTree(tree, patch) {
6553
+ if (tree.size === 0) return false;
6554
+ for (const key of Object.keys(patch)) {
6555
+ const at = key.indexOf("@");
6556
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6557
+ }
6558
+ return false;
6559
+ }
6560
+ /**
6561
+ * Which top-level keys of each store held markers when last seen. `undefined`
6562
+ * for a store not seen yet: its first write reads it, to be safe.
6563
+ */
6564
+ var MarkerKeyIndex = class {
6565
+ owner;
6566
+ byStore = /* @__PURE__ */ new Map();
6567
+ constructor(owner) {
6568
+ this.owner = owner;
6569
+ }
6570
+ seen(store, blob) {
6571
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6572
+ }
6573
+ wrote(store, patch) {
6574
+ const keys = this.byStore.get(store);
6575
+ if (keys === void 0) return;
6576
+ const now = markerKeysOf(patch, this.owner);
6577
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6578
+ else keys.delete(key);
6579
+ }
6580
+ mayHoldMarkers(store, patch) {
6581
+ const keys = this.byStore.get(store);
6582
+ if (keys === void 0) return true;
6583
+ return Object.keys(patch).some((key) => keys.has(key));
6584
+ }
6585
+ };
6586
+ function createHandle(raw, opts) {
6324
6587
  const chains = /* @__PURE__ */ new Map();
6325
6588
  const serialize = (key, fn) => {
6326
6589
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6331,46 +6594,130 @@ function createSecretAwareSettings(raw, opts) {
6331
6594
  });
6332
6595
  return next;
6333
6596
  };
6334
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6335
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6336
- return serialize(chainKey, async () => {
6597
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6598
+ const resolveRead = async (store, blob) => {
6599
+ index.seen(store, blob);
6600
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6601
+ unresolved: "keep-marker",
6602
+ ownedBy: opts.secrets.owner
6603
+ });
6604
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6605
+ return value;
6606
+ };
6607
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6608
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6609
+ await rawWrite(patch);
6610
+ index.wrote(store, patch);
6611
+ return { changed: true };
6612
+ }
6613
+ return serialize(store, async () => {
6337
6614
  const stored = await readStored();
6615
+ index.seen(store, stored);
6616
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6617
+ const restored = await restoreUnchangedSecrets({
6618
+ patch,
6619
+ stored,
6620
+ secrets: opts.secrets,
6621
+ operatorWrite
6622
+ });
6338
6623
  const result = await transformSecretWrite({
6339
- tree,
6624
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6340
6625
  secrets: opts.secrets,
6341
- patch,
6626
+ patch: restored.patch,
6342
6627
  stored,
6343
6628
  ...scope !== void 0 ? { scope } : {},
6344
- operatorWrite: opts.isOperatorWrite?.() === true
6629
+ operatorWrite
6345
6630
  });
6346
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6631
+ const effective = dropUnchangedKeys(result.patch, stored);
6632
+ const wroteBlob = Object.keys(effective).length > 0;
6633
+ if (wroteBlob) {
6634
+ await rawWrite(effective);
6635
+ index.wrote(store, effective);
6636
+ }
6347
6637
  const { orphaned } = await result.afterWrite();
6348
6638
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6639
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6349
6640
  });
6350
6641
  };
6351
- const wrapped = {
6352
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6353
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6354
- kind: "device",
6355
- deviceId
6356
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6642
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6643
+ const readAddonStoreResult = raw.readAddonStoreResult;
6644
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6645
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6646
+ const overrides = {
6647
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6648
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6649
+ const result = await readAddonStoreResult.call(raw);
6650
+ return result.kind === "value" ? {
6651
+ kind: "value",
6652
+ value: await resolveRead("addon", result.value)
6653
+ } : result;
6654
+ } } : {},
6655
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6656
+ const result = await readAddonStoreKeyResult.call(raw, key);
6657
+ if (result.kind !== "present") return result;
6658
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6659
+ unresolved: "keep-marker",
6660
+ ownedBy: opts.secrets.owner
6661
+ });
6662
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6663
+ return {
6664
+ kind: "present",
6665
+ value: value[key]
6666
+ };
6667
+ } } : {},
6668
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6669
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6670
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6671
+ const out = /* @__PURE__ */ new Map();
6672
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6673
+ return out;
6674
+ } } : {},
6675
+ writeAddonStore: async (patch) => {
6676
+ await writeAddon(patch);
6677
+ },
6678
+ writeDeviceStore: async (deviceId, patch) => {
6679
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6680
+ kind: "device",
6681
+ deviceId
6682
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6683
+ }
6684
+ };
6685
+ return {
6686
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6687
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6688
+ const value = Reflect.get(target, prop, receiver);
6689
+ return typeof value === "function" ? value.bind(target) : value;
6690
+ } }),
6691
+ raw: {
6692
+ readAddonStore: async () => {
6693
+ const blob = await raw.readAddonStore();
6694
+ index.seen("addon", blob);
6695
+ return blob;
6696
+ },
6697
+ readDeviceStore: async (deviceId) => {
6698
+ const blob = await raw.readDeviceStore(deviceId);
6699
+ index.seen(`device:${deviceId}`, blob);
6700
+ return blob;
6701
+ }
6702
+ },
6703
+ writeAddonStore: writeAddon
6357
6704
  };
6358
- return new Proxy(raw, { get(target, prop, receiver) {
6359
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6360
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6361
- const value = Reflect.get(target, prop, receiver);
6362
- return typeof value === "function" ? value.bind(target) : value;
6363
- } });
6364
6705
  }
6365
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6366
- function withSecretAwareSettings(context, opts) {
6706
+ /** The context the addon sees, plus the private raw view and write outcome. */
6707
+ function createSecretAwareContext(context, opts) {
6367
6708
  const raw = context.settings;
6368
- if (raw === void 0) return context;
6369
- const settings = createSecretAwareSettings(raw, opts);
6370
- return new Proxy(context, { get(target, prop, receiver) {
6371
- if (prop === "settings") return settings;
6372
- return Reflect.get(target, prop, receiver);
6373
- } });
6709
+ if (raw === void 0) return {
6710
+ context,
6711
+ handle: null
6712
+ };
6713
+ const handle = createHandle(raw, opts);
6714
+ return {
6715
+ context: new Proxy(context, { get(target, prop, receiver) {
6716
+ if (prop === "settings") return handle.settings;
6717
+ return Reflect.get(target, prop, receiver);
6718
+ } }),
6719
+ handle
6720
+ };
6374
6721
  }
6375
6722
  var LEAF = { kind: "leaf" };
6376
6723
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6545,6 +6892,14 @@ var BaseAddon = class {
6545
6892
  _secretChangeUnsub = null;
6546
6893
  /** >0 while an OPERATOR's settings write is being applied. */
6547
6894
  _operatorWriteDepth = 0;
6895
+ /**
6896
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6897
+ * to the marker-bearing blobs and stays private to this class: the form
6898
+ * hydrate and config resolution need markers, addon code never does.
6899
+ */
6900
+ _secretSettings = null;
6901
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6902
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6548
6903
  constructor(defaults) {
6549
6904
  this.defaults = defaults;
6550
6905
  this._config = { ...defaults };
@@ -6581,13 +6936,21 @@ var BaseAddon = class {
6581
6936
  }
6582
6937
  async initialize(context) {
6583
6938
  const secrets = context.secrets;
6584
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6585
- secrets,
6586
- addonTree: () => this.addonSecretTree(),
6587
- deviceTree: () => this.deviceSecretTree(),
6588
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6589
- isOperatorWrite: () => this._operatorWriteDepth > 0
6590
- }) : context;
6939
+ if (secrets !== void 0) {
6940
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6941
+ secrets,
6942
+ addonTree: () => this.addonSecretTree(),
6943
+ deviceTree: () => this.deviceSecretTree(),
6944
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6945
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6946
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6947
+ });
6948
+ this._ctx = wrapped;
6949
+ this._secretSettings = handle;
6950
+ } else {
6951
+ this._ctx = context;
6952
+ this._secretSettings = null;
6953
+ }
6591
6954
  await this.resolveConfig();
6592
6955
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6593
6956
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6704,11 +7067,8 @@ var BaseAddon = class {
6704
7067
  async getGlobalSettings(overlay, cap, nodeId) {
6705
7068
  const schema = this.globalSettingsSchema(cap);
6706
7069
  if (!schema) return { sections: [] };
6707
- const projected = await this.resolveGlobalStore(nodeId, cap);
6708
- return hydrateSchema(schema, overlay ? {
6709
- ...projected,
6710
- ...overlay
6711
- } : projected, { inlineSecretsAsViews: true });
7070
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7071
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6712
7072
  }
6713
7073
  /**
6714
7074
  * The integration-level view of this addon's settings: exactly the sections
@@ -6753,7 +7113,7 @@ var BaseAddon = class {
6753
7113
  });
6754
7114
  }
6755
7115
  if (sections.length === 0) return null;
6756
- const projected = await this.resolveGlobalStore(nodeId);
7116
+ const projected = await this.readRawProjectedStore(nodeId);
6757
7117
  return hydrateSchema({
6758
7118
  ...schema,
6759
7119
  sections
@@ -6770,12 +7130,50 @@ var BaseAddon = class {
6770
7130
  * the store for custom option logic (option narrowing, value snapping) to
6771
7131
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6772
7132
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7133
+ *
7134
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7135
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7136
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7137
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7138
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7139
+ * resolved blob back is a no-op for every unchanged secret.
6773
7140
  */
6774
7141
  async resolveGlobalStore(nodeId, cap) {
6775
7142
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7143
+ return this.projectForNode(raw, nodeId, cap);
7144
+ }
7145
+ projectForNode(store, nodeId, cap) {
6776
7146
  const keys = this.perNodeKeys(cap);
6777
7147
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6778
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7148
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7149
+ }
7150
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7151
+ async readRawProjectedStore(nodeId, cap) {
7152
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7153
+ return this.projectForNode(raw, nodeId, cap);
7154
+ }
7155
+ /**
7156
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7157
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7158
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7159
+ * its value.
7160
+ */
7161
+ async overlayKeepingMarkers(stored, overlay) {
7162
+ const secrets = this._ctx?.secrets;
7163
+ const merged = {
7164
+ ...stored,
7165
+ ...overlay
7166
+ };
7167
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7168
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7169
+ unresolved: "keep-marker",
7170
+ ownedBy: secrets.owner
7171
+ });
7172
+ for (const key of Object.keys(overlay)) {
7173
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7174
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7175
+ }
7176
+ return merged;
6779
7177
  }
6780
7178
  /**
6781
7179
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6840,8 +7238,12 @@ var BaseAddon = class {
6840
7238
  async clearSecrets(keys, nodeId) {
6841
7239
  const tree = this.addonSecretTree();
6842
7240
  const keychain = this._ctx?.secrets !== void 0;
7241
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6843
7242
  const patch = {};
6844
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7243
+ for (const key of keys) {
7244
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7245
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7246
+ }
6845
7247
  await this.applyGlobalPatch(patch, nodeId);
6846
7248
  }
6847
7249
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6849,7 +7251,11 @@ var BaseAddon = class {
6849
7251
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6850
7252
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6851
7253
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6852
- await this._ctx?.settings?.writeAddonStore(scoped);
7254
+ const handle = this._secretSettings;
7255
+ if (handle !== null) {
7256
+ const { changed } = await handle.writeAddonStore(scoped);
7257
+ if (!changed) return;
7258
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6853
7259
  if (target !== localNode) return;
6854
7260
  await this.resolveConfig();
6855
7261
  await this.onConfigChanged();
@@ -6902,7 +7308,7 @@ var BaseAddon = class {
6902
7308
  async getDeviceSettings(deviceId) {
6903
7309
  const schema = this.deviceSettingsSchema();
6904
7310
  if (!schema) return { sections: [] };
6905
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7311
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6906
7312
  }
6907
7313
  async updateDeviceSettings(deviceId, patch) {
6908
7314
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7074,7 +7480,7 @@ var BaseAddon = class {
7074
7480
  key,
7075
7481
  schema,
7076
7482
  fallback,
7077
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7483
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7078
7484
  write: async (patch) => {
7079
7485
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7080
7486
  },
@@ -7136,6 +7542,23 @@ var BaseAddon = class {
7136
7542
  }
7137
7543
  return value;
7138
7544
  }
7545
+ /**
7546
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7547
+ * keychain the context's own view is already raw.
7548
+ */
7549
+ rawSettings() {
7550
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7551
+ }
7552
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7553
+ logUnresolvedRead(unresolved) {
7554
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7555
+ if (fresh.length === 0) return;
7556
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7557
+ 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) => ({
7558
+ ref: u.ref,
7559
+ reason: u.reason
7560
+ })) } });
7561
+ }
7139
7562
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7140
7563
  scheduleSecretReresolve(delayMs) {
7141
7564
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7162,7 +7585,7 @@ var BaseAddon = class {
7162
7585
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7163
7586
  */
7164
7587
  async readAddonStoreWithRetry() {
7165
- const settings = this._ctx?.settings;
7588
+ const settings = this.rawSettings();
7166
7589
  if (!settings) return {};
7167
7590
  const delaysMs = [
7168
7591
  150,
@@ -8964,6 +9387,16 @@ var CompositionSchema = object({
8964
9387
  seen.add(feature.cap);
8965
9388
  });
8966
9389
  });
9390
+ var NodeColorIdSchema = _enum([
9391
+ "node-a",
9392
+ "node-b",
9393
+ "node-c",
9394
+ "node-d",
9395
+ "node-e",
9396
+ "node-f",
9397
+ "node-g",
9398
+ "node-h"
9399
+ ]);
8967
9400
  new Set([
8968
9401
  "track",
8969
9402
  "face",
@@ -9475,6 +9908,278 @@ var CameraSwitchGroupSchema = object({
9475
9908
  fetchedAt: number()
9476
9909
  });
9477
9910
  /**
9911
+ * The trainer contract — what the hub hands the cloud trainer and what it
9912
+ * gets back (cloud training, D805+).
9913
+ *
9914
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
9915
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
9916
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
9917
+ * lines on stdout. These schemas are the hub's half of that boundary; the
9918
+ * trainer's pydantic models (and the JSON Schemas generated from them under
9919
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
9920
+ * change there, in the same piece of work.
9921
+ *
9922
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
9923
+ * orchestrator fills every field of a job spec explicitly.
9924
+ */
9925
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
9926
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
9927
+ /** What the trainer can export. Edge TPU is a later, separate image. */
9928
+ var TrainingExportSchema = _enum([
9929
+ "onnx",
9930
+ "openvino-fp16",
9931
+ "openvino-int8",
9932
+ "coreml-fp16"
9933
+ ]);
9934
+ var FloorsSchema = record(string(), number().min(0).max(1));
9935
+ object({
9936
+ schema: literal(TRAINING_JOB_SCHEMA),
9937
+ jobKey: string().uuid(),
9938
+ target: object({
9939
+ kind: literal("detector"),
9940
+ step: literal("object-detection")
9941
+ }),
9942
+ base: object({
9943
+ modelId: string().min(1),
9944
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
9945
+ weights: string().min(1),
9946
+ imgsz: number().int().positive()
9947
+ }),
9948
+ baseline: object({
9949
+ modelId: string().min(1),
9950
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
9951
+ onnxUrl: string().url(),
9952
+ imgsz: number().int().positive(),
9953
+ floors: FloorsSchema
9954
+ }),
9955
+ dataset: object({
9956
+ versionId: string().min(1),
9957
+ annotationHash: string(),
9958
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
9959
+ sha256: string().regex(/^[0-9a-f]{64}$/)
9960
+ }),
9961
+ split: object({
9962
+ holdoutCameras: array(number().int()),
9963
+ /** When no camera is held out: the last N days of every camera. */
9964
+ holdoutLastDays: number().int().nonnegative(),
9965
+ valFraction: number().min(0).max(.5),
9966
+ seed: number().int()
9967
+ }),
9968
+ hyper: object({
9969
+ epochs: number().int().positive(),
9970
+ batch: number().int().positive(),
9971
+ lr0: number().positive(),
9972
+ /** Layers frozen from the start of the backbone; 0 = none. */
9973
+ freeze: number().int().nonnegative(),
9974
+ patience: number().int().nonnegative(),
9975
+ seed: number().int()
9976
+ }),
9977
+ replay: object({
9978
+ source: literal("coco2017"),
9979
+ count: number().int().nonnegative()
9980
+ }),
9981
+ exports: array(TrainingExportSchema).min(1),
9982
+ calibration: object({ maxFrames: number().int().positive() }),
9983
+ floors: object({
9984
+ minSupport: number().int().positive(),
9985
+ clamp: number().min(0).max(1)
9986
+ }),
9987
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
9988
+ catalog: object({
9989
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
9990
+ name: string().min(1).max(160)
9991
+ })
9992
+ });
9993
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
9994
+ var TrainingResultFileSchema = object({
9995
+ path: string().min(1),
9996
+ bytes: number().int().nonnegative(),
9997
+ sha256: string().regex(/^[0-9a-f]{64}$/),
9998
+ format: _enum([
9999
+ "onnx",
10000
+ "openvino",
10001
+ "coreml",
10002
+ "pt"
10003
+ ]),
10004
+ variant: _enum(["base", "int8"])
10005
+ });
10006
+ var DraftFormatSchema = object({
10007
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
10008
+ url: string().min(1),
10009
+ sizeMB: number().nonnegative(),
10010
+ isDirectory: boolean().optional(),
10011
+ files: array(string()).optional(),
10012
+ runtimes: array(literal("python")).optional(),
10013
+ revision: string().min(1)
10014
+ });
10015
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
10016
+ var TrainingCatalogDraftSchema = object({
10017
+ id: string().min(1),
10018
+ name: string().min(1),
10019
+ description: string(),
10020
+ labels: array(unknown()),
10021
+ inputSize: object({
10022
+ width: number().int().positive(),
10023
+ height: number().int().positive()
10024
+ }),
10025
+ preprocessMode: literal("letterbox"),
10026
+ defaultClassFloors: FloorsSchema,
10027
+ formats: object({
10028
+ onnx: DraftFormatSchema.optional(),
10029
+ openvino: DraftFormatSchema.optional(),
10030
+ coreml: DraftFormatSchema.optional()
10031
+ })
10032
+ });
10033
+ /** One class of one model's holdout report (the eval harness's summary). */
10034
+ var TrainingEvalClassSchema = object({
10035
+ positives: number().int(),
10036
+ floor: number().nullable(),
10037
+ tp: number().int(),
10038
+ fp: number().int(),
10039
+ fn: number().int(),
10040
+ precision: number().nullable(),
10041
+ recall: number().nullable(),
10042
+ ap50: number().nullable(),
10043
+ recallByCamera: record(string(), number().nullable()).optional(),
10044
+ recallByLight: record(string(), number().nullable()).optional(),
10045
+ fpByCamera: record(string(), number()).optional(),
10046
+ smallFound: number().int().optional(),
10047
+ smallTotal: number().int().optional()
10048
+ }).passthrough();
10049
+ var TrainingEvalReportSchema = object({
10050
+ frames: number().int(),
10051
+ classes: record(string(), TrainingEvalClassSchema)
10052
+ }).passthrough();
10053
+ /**
10054
+ * A succeeded result carries every block; a failed one carries the error and
10055
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10056
+ * orchestrator checks the blocks it needs before it trusts a success.
10057
+ */
10058
+ var TrainingResultSchema = object({
10059
+ schema: literal(TRAINING_RESULT_SCHEMA),
10060
+ jobKey: string(),
10061
+ status: _enum(["succeeded", "failed"]),
10062
+ error: object({
10063
+ stage: string(),
10064
+ code: string(),
10065
+ message: string()
10066
+ }).nullable(),
10067
+ trainer: object({
10068
+ version: string(),
10069
+ revision: string()
10070
+ }),
10071
+ toolchain: record(string(), string().nullable()),
10072
+ dataset: object({
10073
+ versionId: string(),
10074
+ annotationHash: string(),
10075
+ sha256: string(),
10076
+ frames: object({
10077
+ train: number().int(),
10078
+ val: number().int(),
10079
+ holdout: number().int()
10080
+ }),
10081
+ holdoutCameras: array(number().int()),
10082
+ replayImages: number().int()
10083
+ }).optional(),
10084
+ training: object({
10085
+ epochsRun: number().int(),
10086
+ bestEpoch: number().int(),
10087
+ bestMap50: number(),
10088
+ bestMap50_95: number(),
10089
+ seconds: number()
10090
+ }).optional(),
10091
+ evaluation: object({
10092
+ holdoutFrames: number().int(),
10093
+ baseline: TrainingEvalReportSchema.nullable(),
10094
+ candidate: TrainingEvalReportSchema.nullable(),
10095
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10096
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10097
+ map50: record(string(), number().nullable())
10098
+ }).optional(),
10099
+ floors: object({
10100
+ baseline: FloorsSchema,
10101
+ candidate: FloorsSchema,
10102
+ candidateInt8: FloorsSchema.nullable(),
10103
+ notes: array(string())
10104
+ }).optional(),
10105
+ int8: object({
10106
+ kept: boolean(),
10107
+ map50Fp16: number().nullable(),
10108
+ map50Int8: number().nullable(),
10109
+ reason: string().nullable()
10110
+ }).optional(),
10111
+ exportsDropped: array(object({
10112
+ export: string(),
10113
+ reason: string()
10114
+ })).optional(),
10115
+ files: array(TrainingResultFileSchema).optional(),
10116
+ bundle: object({
10117
+ path: literal("bundle.tar"),
10118
+ bytes: number().int().nonnegative(),
10119
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10120
+ }).nullable().optional(),
10121
+ catalogDraft: object({
10122
+ base: TrainingCatalogDraftSchema,
10123
+ int8: TrainingCatalogDraftSchema.nullable()
10124
+ }).nullable().optional(),
10125
+ licence: string()
10126
+ });
10127
+ var TrainingStageSchema = _enum([
10128
+ "prepare",
10129
+ "replay",
10130
+ "train",
10131
+ "eval",
10132
+ "export",
10133
+ "package"
10134
+ ]);
10135
+ var EventBase = {
10136
+ v: literal(1),
10137
+ ts: number()
10138
+ };
10139
+ discriminatedUnion("type", [
10140
+ object({
10141
+ ...EventBase,
10142
+ type: literal("stage"),
10143
+ stage: TrainingStageSchema
10144
+ }),
10145
+ object({
10146
+ ...EventBase,
10147
+ type: literal("epoch"),
10148
+ epoch: number().int(),
10149
+ epochs: number().int(),
10150
+ boxLoss: number().nullable().optional(),
10151
+ map50: number().nullable().optional(),
10152
+ map50_95: number().nullable().optional(),
10153
+ etaSec: number().nullable().optional()
10154
+ }),
10155
+ object({
10156
+ ...EventBase,
10157
+ type: literal("metric"),
10158
+ name: string(),
10159
+ value: number()
10160
+ }),
10161
+ object({
10162
+ ...EventBase,
10163
+ type: literal("artifact"),
10164
+ path: string(),
10165
+ bytes: number(),
10166
+ sha256: string()
10167
+ }),
10168
+ object({
10169
+ ...EventBase,
10170
+ type: literal("done"),
10171
+ status: _enum(["succeeded", "failed"]),
10172
+ resultSha256: string().nullable().optional()
10173
+ }),
10174
+ object({
10175
+ ...EventBase,
10176
+ type: literal("error"),
10177
+ stage: string(),
10178
+ code: string(),
10179
+ message: string()
10180
+ })
10181
+ ]);
10182
+ /**
9478
10183
  * What the gate decided about a birth, from the CALLER's point of view.
9479
10184
  *
9480
10185
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11802,7 +12507,9 @@ var AddonHttpRouteSchema = object({
11802
12507
  "authenticated",
11803
12508
  "admin"
11804
12509
  ]).optional(),
11805
- description: string().optional()
12510
+ description: string().optional(),
12511
+ /** The hub limits this route per client address before the handler runs. */
12512
+ rateLimit: _enum(["auth"]).optional()
11806
12513
  });
11807
12514
  /**
11808
12515
  * Cross-process route invocation envelope. The hub captures the
@@ -12507,6 +13214,37 @@ var BackupDestinationInfoSchema = object({
12507
13214
  lastError: string().optional()
12508
13215
  });
12509
13216
  /**
13217
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13218
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13219
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13220
+ * with it off — which restores without a key.
13221
+ */
13222
+ var BackupArchiveEncryptionSchema = object({
13223
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13224
+ scheme: string(),
13225
+ /** 16 hex — the backup key whose secret restores this archive. */
13226
+ keyId: string()
13227
+ });
13228
+ /**
13229
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13230
+ * one new archives are encrypted to, and the retired ones older archives
13231
+ * still need. The secret key is shown once, at `setupEncryption`.
13232
+ */
13233
+ var BackupEncryptionStatusSchema = object({
13234
+ enabled: boolean(),
13235
+ active: object({
13236
+ keyId: string(),
13237
+ publicKey: string(),
13238
+ createdAt: number()
13239
+ }).nullable(),
13240
+ /** Every key ever set up, newest first. */
13241
+ keys: array(object({
13242
+ keyId: string(),
13243
+ createdAt: number(),
13244
+ retiredAt: number().nullable()
13245
+ })).readonly()
13246
+ });
13247
+ /**
12510
13248
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12511
13249
  * Same shape the destination drill-in renders. Sourced from the per-
12512
13250
  * location `manifests.json` (no per-archive tarball read required).
@@ -12518,7 +13256,9 @@ var BackupArchiveEntrySchema = object({
12518
13256
  sizeBytes: number(),
12519
13257
  label: string().optional(),
12520
13258
  /** Top-level locations included in the archive (db, addons, tls, …). */
12521
- locations: array(string()).readonly()
13259
+ locations: array(string()).readonly(),
13260
+ /** Present when the archive is encrypted; restore then needs that key. */
13261
+ encryption: BackupArchiveEncryptionSchema.optional()
12522
13262
  });
12523
13263
  var BackupEntrySchema = object({
12524
13264
  id: string(),
@@ -12527,7 +13267,8 @@ var BackupEntrySchema = object({
12527
13267
  label: string().optional(),
12528
13268
  createdAt: number(),
12529
13269
  sizeBytes: number(),
12530
- locations: array(string()).optional()
13270
+ locations: array(string()).optional(),
13271
+ encryption: BackupArchiveEncryptionSchema.optional()
12531
13272
  });
12532
13273
  var ArchiveEntrySchema = object({
12533
13274
  path: string(),
@@ -12716,10 +13457,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12716
13457
  * this list and skips entries whose path doesn't start with
12717
13458
  * any of them.
12718
13459
  */
12719
- locations: array(string()).optional()
13460
+ locations: array(string()).optional(),
13461
+ /**
13462
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13463
+ * one). The archive is decrypted into the hub's private staging
13464
+ * before the restart; the key is not stored. A wrong or missing key
13465
+ * is refused before the archive is downloaded.
13466
+ */
13467
+ backupSecretKey: string().optional()
12720
13468
  }), _void(), {
12721
13469
  kind: "mutation",
12722
13470
  auth: "admin"
13471
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13472
+ keyId: string(),
13473
+ secretKey: string(),
13474
+ publicKey: string(),
13475
+ createdAt: number(),
13476
+ replacedKeyId: string().nullable()
13477
+ }), {
13478
+ kind: "mutation",
13479
+ auth: "admin"
13480
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13481
+ kind: "mutation",
13482
+ auth: "admin"
13483
+ }), method(object({ backupSecretKey: string() }), object({
13484
+ valid: boolean(),
13485
+ keyId: string().nullable(),
13486
+ /** The hub knows this key (active or retired). */
13487
+ known: boolean(),
13488
+ /** It is the key new archives are encrypted to. */
13489
+ active: boolean(),
13490
+ error: string().optional()
13491
+ }), {
13492
+ kind: "mutation",
13493
+ auth: "admin"
12723
13494
  }), method(object({
12724
13495
  destinationId: string(),
12725
13496
  backupId: string()
@@ -14445,7 +15216,60 @@ var CustomModelDescriptorSchema = object({
14445
15216
  stepId: string(),
14446
15217
  entry: ModelCatalogEntrySchema
14447
15218
  });
14448
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15219
+ /** One regular file of an imported bundle, as the producer measured it. */
15220
+ var ModelBundleFileSchema = object({
15221
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15222
+ path: string().min(1),
15223
+ bytes: number().int().nonnegative(),
15224
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15225
+ });
15226
+ var ImportModelBundleInputSchema = object({
15227
+ /** The registry provider that keeps the model (Model Studio). */
15228
+ addonId: string(),
15229
+ stepId: string().min(1),
15230
+ /**
15231
+ * The catalog rows to register, complete, every format URL already
15232
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15233
+ * bundle may carry several rows (a base and its INT8 variant).
15234
+ */
15235
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15236
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15237
+ bundle: object({
15238
+ ticket: PeerBytesTicketSchema,
15239
+ bytes: number().int().positive(),
15240
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15241
+ }),
15242
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15243
+ files: array(ModelBundleFileSchema).min(1).max(64),
15244
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15245
+ distribute: boolean()
15246
+ });
15247
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15248
+ kind: literal("imported"),
15249
+ modelIds: array(string()).readonly(),
15250
+ distributed: array(object({
15251
+ modelId: string(),
15252
+ nodeId: string(),
15253
+ format: _enum(MODEL_FORMATS),
15254
+ ok: boolean(),
15255
+ error: string().optional()
15256
+ })).readonly()
15257
+ }), object({
15258
+ kind: literal("refused"),
15259
+ reason: _enum([
15260
+ "transfer-failed",
15261
+ "checksum-mismatch",
15262
+ "bundle-mismatch",
15263
+ "invalid-entry",
15264
+ "id-taken"
15265
+ ]),
15266
+ detail: string()
15267
+ })]);
15268
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15269
+ kind: "mutation",
15270
+ auth: "admin",
15271
+ timeoutMs: 30 * 6e4
15272
+ });
14449
15273
  /**
14450
15274
  * Query filter for settings-store collections.
14451
15275
  */
@@ -14924,6 +15748,35 @@ var KeychainKeySourceSchema = object({
14924
15748
  */
14925
15749
  sharesBackupWithDatabase: boolean()
14926
15750
  });
15751
+ /**
15752
+ * One keychain reset, as the Secrets page reports it until the operator
15753
+ * acknowledges it. Never a value: refs, counts and table names only.
15754
+ */
15755
+ var KeychainResetRecordSchema = object({
15756
+ id: string(),
15757
+ at: number(),
15758
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15759
+ actor: string(),
15760
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15761
+ lockedReason: string().nullable(),
15762
+ /** Values moved into the archive table (ciphertext under the lost key). */
15763
+ archived: number().int(),
15764
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15765
+ archivedCollection: string().nullable(),
15766
+ /**
15767
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15768
+ * so the archive can still be opened if the lost master key turns up.
15769
+ */
15770
+ archivedKeysCollection: string().nullable(),
15771
+ /**
15772
+ * `system-settings` keys whose marker the reset cleared — the cluster
15773
+ * secret's: a marker left pointing at an archived value would refuse every
15774
+ * agent forever (D797).
15775
+ */
15776
+ clearedSettingsKeys: array(string()).readonly(),
15777
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15778
+ acknowledgedAt: number().nullable()
15779
+ });
14927
15780
  var KeychainStatusSchema = object({
14928
15781
  keychain: KeychainStateSchema,
14929
15782
  /** The source of the master key in use; `null` while locked. */
@@ -14941,7 +15794,9 @@ var KeychainStatusSchema = object({
14941
15794
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
14942
15795
  retiredWraps: number().int(),
14943
15796
  recoveryKeyDownloadedAt: number().nullable(),
14944
- secretCount: number().int()
15797
+ secretCount: number().int(),
15798
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15799
+ lastReset: KeychainResetRecordSchema.nullable()
14945
15800
  });
14946
15801
  /**
14947
15802
  * Whether a stored value is still pointed at by its owner's settings.
@@ -14963,17 +15818,26 @@ var KeychainAuditActionSchema = _enum([
14963
15818
  "download-recovery-key",
14964
15819
  "delete-orphans",
14965
15820
  "reset",
15821
+ "acknowledge-reset",
14966
15822
  "initialize"
14967
15823
  ]);
14968
15824
  var KeychainAuditEntrySchema = object({
14969
15825
  id: string(),
14970
15826
  at: number(),
14971
15827
  action: KeychainAuditActionSchema,
14972
- /** `addon:<id>` | `user:<id>` | `system`. */
15828
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
14973
15829
  actor: string(),
14974
15830
  ref: string().nullable(),
14975
15831
  detail: string().nullable()
14976
15832
  });
15833
+ var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
15834
+ /**
15835
+ * Secrets the HUB itself holds (owner `system`) that no settings form shows:
15836
+ * `jwt-signing-key` — the session signing key (D797). It is always "in use",
15837
+ * never an orphan; it is generated on a fresh hub and replaced only through
15838
+ * {@link keychainAdminCapability.methods.setSystemSecret}.
15839
+ */
15840
+ var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
14977
15841
  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({
14978
15842
  value: string(),
14979
15843
  version: number().int()
@@ -14981,6 +15845,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
14981
15845
  kind: "mutation",
14982
15846
  auth: "admin",
14983
15847
  caller: "required"
15848
+ }), method(object({
15849
+ name: SystemHeldSecretNameSchema,
15850
+ value: string().min(16)
15851
+ }), object({
15852
+ ref: string(),
15853
+ version: number().int()
15854
+ }), {
15855
+ kind: "mutation",
15856
+ auth: "admin",
15857
+ caller: "required"
14984
15858
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
14985
15859
  deleted: array(string()).readonly(),
14986
15860
  kept: array(object({
@@ -15010,13 +15884,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15010
15884
  kind: "mutation",
15011
15885
  auth: "admin",
15012
15886
  caller: "required"
15013
- }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15887
+ }), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
15014
15888
  archivedCollection: string().nullable(),
15015
15889
  archived: number().int()
15016
15890
  }), {
15017
15891
  kind: "mutation",
15018
15892
  auth: "admin",
15019
15893
  caller: "required"
15894
+ }), method(object({}), object({
15895
+ reset: KeychainResetRecordSchema.nullable(),
15896
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15897
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15898
+ kind: "mutation",
15899
+ auth: "admin",
15900
+ caller: "required"
15020
15901
  });
15021
15902
  method(_void(), object({
15022
15903
  id: string(),
@@ -17678,14 +18559,14 @@ var LlmProfileSchema = object({
17678
18559
  /** ConfigUISchema tree passed through untyped on the wire (the
17679
18560
  * notification-output `ConfigSchemaPassthrough` precedent at
17680
18561
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
17681
- var ConfigSchemaPassthrough$1 = unknown();
18562
+ var ConfigSchemaPassthrough$3 = unknown();
17682
18563
  var LlmProfileKindDescriptorSchema = object({
17683
18564
  kind: LlmProfileKindSchema,
17684
18565
  label: string(),
17685
18566
  icon: string(),
17686
18567
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
17687
18568
  addonId: string(),
17688
- configSchema: ConfigSchemaPassthrough$1
18569
+ configSchema: ConfigSchemaPassthrough$3
17689
18570
  });
17690
18571
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
17691
18572
  var LlmDefaultSchema = object({
@@ -17963,7 +18844,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17963
18844
  * `login-method` — collection cap through which auth addons contribute
17964
18845
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17965
18846
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17966
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18847
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17967
18848
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17968
18849
  * procedure aggregates them for the unauthenticated login page.
17969
18850
  *
@@ -17971,8 +18852,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17971
18852
  *
17972
18853
  * - `redirect` — a declarative button. The login page renders a generic
17973
18854
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17974
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17975
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18855
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17976
18856
  * login page needs NO change.
17977
18857
  *
17978
18858
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -17991,8 +18871,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17991
18871
  * decision.
17992
18872
  *
17993
18873
  * Every contribution carries a `stage`:
17994
- * - `primary` — shown on the first credentials screen (OIDC /
17995
- * magic-link buttons; a future usernameless passkey).
18874
+ * - `primary` — shown on the first credentials screen (OIDC
18875
+ * buttons; a usernameless passkey).
17996
18876
  * - `second-factor` — shown AFTER the password leg, gated on the
17997
18877
  * returned `factors` (passkey-as-2FA today).
17998
18878
  *
@@ -18019,7 +18899,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
18019
18899
  * The provider names an external identity a signed-in user can link to
18020
18900
  * their own account (D782): `auth.listLinkableProviders` /
18021
18901
  * `beginExternalLink` offer exactly the redirect methods that set this,
18022
- * whatever their id. Absent / false — a login button only (magic-link).
18902
+ * whatever their id. Absent / false — a login button only.
18023
18903
  */
18024
18904
  linkable: boolean().optional()
18025
18905
  }),
@@ -18807,7 +19687,7 @@ var TargetKindCapsSchema = object({
18807
19687
  * the union is large and not meant for runtime validation here; the exported
18808
19688
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
18809
19689
  */
18810
- var ConfigSchemaPassthrough = unknown();
19690
+ var ConfigSchemaPassthrough$2 = unknown();
18811
19691
  var TargetKindSchema = object({
18812
19692
  kind: string(),
18813
19693
  label: string(),
@@ -18844,7 +19724,7 @@ var TargetKindSchema = object({
18844
19724
  * its raster path, which is the safe default for an unknown image.
18845
19725
  */
18846
19726
  iconMediaType: string().optional(),
18847
- configSchema: ConfigSchemaPassthrough,
19727
+ configSchema: ConfigSchemaPassthrough$2,
18848
19728
  /**
18849
19729
  * The config keys that decide WHERE this kind's secrets are sent (server,
18850
19730
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -21874,8 +22754,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21874
22754
  * `super_admin` — collapsed onto the single boolean because every
21875
22755
  * non-admin caller is governed by the same scope-check rules; the
21876
22756
  * distinction was only ever used to route role-specific procedures
21877
- * which we no longer have. Agents are admin sessions issued via
21878
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22757
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21879
22758
  * with `isAdmin: false` + an explicit scope list.
21880
22759
  */
21881
22760
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -22182,6 +23061,61 @@ var OauthIntegrationDescriptorSchema = object({
22182
23061
  });
22183
23062
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
22184
23063
  /**
23064
+ * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
23065
+ *
23066
+ * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
23067
+ * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
23068
+ * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
23069
+ * immutable after create.
23070
+ */
23071
+ var ConfigSchemaPassthrough$1 = unknown();
23072
+ var OidcConnectionSchema = object({
23073
+ id: string().min(1),
23074
+ displayName: string(),
23075
+ icon: string(),
23076
+ issuerUrl: string(),
23077
+ clientId: string(),
23078
+ /** Client id + secret present — never the secret value. */
23079
+ configured: boolean(),
23080
+ /**
23081
+ * Values for the connection form schema. `clientSecret` is a keychain
23082
+ * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
23083
+ */
23084
+ formValues: record(string(), unknown()).optional()
23085
+ });
23086
+ /**
23087
+ * Patch one connection. Omitted or empty `clientSecret` keeps the stored
23088
+ * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
23089
+ */
23090
+ var OidcConnectionUpdateInputSchema = object({
23091
+ id: string().min(1),
23092
+ displayName: string().min(1),
23093
+ icon: string().optional(),
23094
+ issuerUrl: string().optional(),
23095
+ clientId: string().optional(),
23096
+ clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
23097
+ redirectUri: string().optional(),
23098
+ scopes: string().optional(),
23099
+ usernameClaim: _enum([
23100
+ "preferred_username",
23101
+ "email",
23102
+ "sub"
23103
+ ]).optional()
23104
+ });
23105
+ method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
23106
+ id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
23107
+ displayName: string().min(1)
23108
+ }), object({ id: string() }), {
23109
+ kind: "mutation",
23110
+ auth: "admin"
23111
+ }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
23112
+ kind: "mutation",
23113
+ auth: "admin"
23114
+ }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
23115
+ kind: "mutation",
23116
+ auth: "admin"
23117
+ });
23118
+ /**
22185
23119
  * What started a camera's onboard motion (D672). `camera` is the camera's own
22186
23120
  * firmware; `sensor` is a device the operator ATTACHED to it. Absent on the
22187
23121
  * wire means the camera: only the camera-sensors bridge ever says `sensor`.
@@ -23538,21 +24472,69 @@ var RetrainFrameListSchema = object({
23538
24472
  /** What the page pre-selects — the native key frame when one survives. */
23539
24473
  autoPickMediaId: number().int().optional()
23540
24474
  });
24475
+ /** Exclusive partition of a corpus copy's annotation progress (design §4.2). */
24476
+ var RetrainFrameWorkStateSchema = _enum([
24477
+ "unannotated",
24478
+ "annotated",
24479
+ "complete"
24480
+ ]);
24481
+ /**
24482
+ * Filters for paginated corpus list, KPI, and matching export (design §4.4).
24483
+ * Every narrowing field is ANDed; omitted fields impose no constraint.
24484
+ */
24485
+ var RetrainCorpusFilterSchema = object({
24486
+ workState: RetrainFrameWorkStateSchema.optional(),
24487
+ deviceIds: array(number()).max(500).optional(),
24488
+ /** When set, only frames in this named collection. */
24489
+ collectionId: string().optional(),
24490
+ /** Frames that carry at least one saved annotation in one of these classes. */
24491
+ classes: array(RetrainMacroClassSchema).optional(),
24492
+ page: number().int().positive().default(1),
24493
+ pageSize: number().int().positive().max(100).default(50)
24494
+ });
24495
+ var RetrainCorpusPageSchema = object({
24496
+ frames: array(RetrainFrameSchema.extend({ workState: RetrainFrameWorkStateSchema })).readonly(),
24497
+ total: number().int().nonnegative(),
24498
+ page: number().int().positive(),
24499
+ pageSize: number().int().positive()
24500
+ });
24501
+ var RetrainCorpusKpiCameraRowSchema = object({
24502
+ deviceId: number(),
24503
+ unannotated: number().int().nonnegative(),
24504
+ annotated: number().int().nonnegative(),
24505
+ complete: number().int().nonnegative(),
24506
+ /** This camera's `complete` count divided by corpus `total`, in `[0,1]`.
24507
+ * `null` when the corpus is empty (no ratio). */
24508
+ pctOfCorpus: number().min(0).max(1).nullable()
24509
+ });
24510
+ var RetrainCorpusKpiSchema = object({
24511
+ total: number().int().nonnegative(),
24512
+ unannotated: number().int().nonnegative(),
24513
+ annotated: number().int().nonnegative(),
24514
+ complete: number().int().nonnegative(),
24515
+ cameras: array(RetrainCorpusKpiCameraRowSchema).readonly()
24516
+ });
23541
24517
  /**
23542
24518
  * Which frames an annotated export carries. Every field narrows; an empty
23543
- * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23544
- * list owned by whoever trains (the training orchestrator), so `frameIds` is
23545
- * the primitive a version export uses; `batchId` re-selects what an earlier
23546
- * export carried (`exportedInBatch`).
24519
+ * filter is every annotated copy. `frameIds` is the primitive a job or
24520
+ * download uses; `batchId` re-selects what an earlier export carried
24521
+ * (`exportedInBatch`). Frozen dataset versions were removed — live selection
24522
+ * resolves to `frameIds` at plan/start.
23547
24523
  */
23548
24524
  var RetrainExportFilterSchema = object({
23549
24525
  deviceIds: array(number()).optional(),
23550
24526
  frameIds: array(string()).max(2e4).optional(),
23551
24527
  /** Only frames in at least one of these named collections. */
23552
24528
  collectionIds: array(string()).max(200).optional(),
24529
+ /** Single collection (Frames filter bar). ANDed with `collectionIds` when both set. */
24530
+ collectionId: string().optional(),
23553
24531
  batchId: string().optional(),
23554
24532
  /** Only frames the operator marked complete (all subjects boxed). */
23555
- completeOnly: boolean().optional()
24533
+ completeOnly: boolean().optional(),
24534
+ /** Exclusive work-state partition (`workStateOf`); same as the corpus list. */
24535
+ workState: RetrainFrameWorkStateSchema.optional(),
24536
+ /** Frames with at least one saved annotation in one of these classes. */
24537
+ classes: array(RetrainMacroClassSchema).optional()
23556
24538
  });
23557
24539
  /**
23558
24540
  * `frames`: the full frame copies, boxes in `annotations.json`.
@@ -23717,6 +24699,77 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23717
24699
  ]),
23718
24700
  detail: string().optional()
23719
24701
  })]);
24702
+ /** What a dataset version is cut from. Every field narrows. */
24703
+ var RetrainDatasetSelectionSchema = object({
24704
+ deviceIds: array(number()).readonly().optional(),
24705
+ collectionIds: array(string()).max(200).readonly().optional(),
24706
+ frameIds: array(string()).max(2e4).readonly().optional()
24707
+ });
24708
+ /** The counts a dataset is judged by. */
24709
+ var RetrainDatasetStatsSchema = object({
24710
+ frames: number().int(),
24711
+ completeFrames: number().int(),
24712
+ /** `completeFrames / frames`, 0..1. */
24713
+ completeness: number(),
24714
+ /** Boxes to learn (model errors excluded). */
24715
+ subjects: number().int(),
24716
+ modelErrors: number().int(),
24717
+ /** Complete frames with no subject. */
24718
+ hardNegatives: number().int(),
24719
+ /** Subjects per class × camera × day/night. */
24720
+ cells: array(object({
24721
+ macroClass: string(),
24722
+ deviceId: number(),
24723
+ lighting: _enum([
24724
+ "day",
24725
+ "night",
24726
+ "unknown"
24727
+ ]),
24728
+ subjects: number().int(),
24729
+ frames: number().int()
24730
+ })).readonly(),
24731
+ cameras: array(object({
24732
+ deviceId: number(),
24733
+ frames: number().int(),
24734
+ completeFrames: number().int()
24735
+ })).readonly()
24736
+ });
24737
+ object({
24738
+ id: string(),
24739
+ name: string(),
24740
+ createdAt: number(),
24741
+ selection: RetrainDatasetSelectionSchema,
24742
+ layout: RetrainExportLayoutSchema,
24743
+ completeOnly: boolean(),
24744
+ frameCount: number().int(),
24745
+ annotationHash: string(),
24746
+ manifestSchema: string(),
24747
+ stats: RetrainDatasetStatsSchema
24748
+ });
24749
+ /**
24750
+ * Live training corpus criteria — same shape as `TrainingCorpusSelection` on
24751
+ * the training cap. Resolved here so plan/start and the annotated export share
24752
+ * one definition of "the frames" (`buildRetrainExportPlan`).
24753
+ */
24754
+ var RetrainTrainingCorpusSelectionSchema = object({
24755
+ collectionIds: array(string()).min(1),
24756
+ workState: _enum([
24757
+ "complete",
24758
+ "annotated_or_complete",
24759
+ "any_annotated"
24760
+ ]).default("complete")
24761
+ });
24762
+ var RetrainTrainingCorpusResolveResultSchema = discriminatedUnion("kind", [object({
24763
+ kind: literal("resolved"),
24764
+ frameIds: array(string()).max(2e4).readonly(),
24765
+ stats: RetrainDatasetStatsSchema,
24766
+ annotationHash: string(),
24767
+ layout: RetrainExportLayoutSchema
24768
+ }), object({
24769
+ kind: literal("refused"),
24770
+ reason: _enum(["unknown-collection", "no-frames"]),
24771
+ detail: string()
24772
+ })]);
23720
24773
  /** The outcome of a lifecycle move owned by the retrain page. */
23721
24774
  var RetrainTransitionResultSchema = object({
23722
24775
  trackId: string(),
@@ -24422,6 +25475,12 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24422
25475
  }), array(RetrainTrackSchema).readonly(), {
24423
25476
  kind: "query",
24424
25477
  auth: "admin"
25478
+ }), method(RetrainCorpusFilterSchema, RetrainCorpusPageSchema, {
25479
+ kind: "query",
25480
+ auth: "admin"
25481
+ }), method(object({}), RetrainCorpusKpiSchema, {
25482
+ kind: "query",
25483
+ auth: "admin"
24425
25484
  }), method(object({ trackId: string() }), RetrainFrameListSchema, {
24426
25485
  kind: "query",
24427
25486
  auth: "admin"
@@ -24506,6 +25565,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24506
25565
  kind: "mutation",
24507
25566
  auth: "admin",
24508
25567
  timeoutMs: 60 * 6e4
25568
+ }), method(object({
25569
+ filter: RetrainExportFilterSchema,
25570
+ layout: RetrainExportLayoutSchema
25571
+ }), object({
25572
+ ticket: PeerBytesTicketSchema,
25573
+ frames: number().int(),
25574
+ annotations: number().int()
25575
+ }), {
25576
+ kind: "mutation",
25577
+ auth: "admin",
25578
+ timeoutMs: 12e4
24509
25579
  }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24510
25580
  kind: "query",
24511
25581
  auth: "admin"
@@ -24532,6 +25602,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24532
25602
  }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24533
25603
  kind: "query",
24534
25604
  auth: "admin"
25605
+ }), method(RetrainTrainingCorpusSelectionSchema, RetrainTrainingCorpusResolveResultSchema, {
25606
+ kind: "query",
25607
+ auth: "admin",
25608
+ timeoutMs: 6e4
24535
25609
  }), method(object({
24536
25610
  id: string(),
24537
25611
  name: string().max(120)
@@ -25148,11 +26222,14 @@ var HardwareClassIdSchema = _enum([
25148
26222
  "intel-n-series",
25149
26223
  "apple-m-base",
25150
26224
  "apple-m-pro",
26225
+ "amd-phoenix",
25151
26226
  "unknown"
25152
26227
  ]);
25153
26228
  var AcceleratorKindSchema = _enum([
25154
26229
  "intel-npu",
25155
26230
  "intel-igpu",
26231
+ "amd-igpu",
26232
+ "amd-npu",
25156
26233
  "x86-cpu",
25157
26234
  "arm-cpu",
25158
26235
  "apple-ane",
@@ -27082,6 +28159,8 @@ var AgentPipelineSettingsSchema = object({
27082
28159
  * address is wrong (multi-homed host, NAT, custom interface).
27083
28160
  */
27084
28161
  reachableHost: string().optional(),
28162
+ /** Hub-persisted UI colour (`--color-node-*` theme tokens). */
28163
+ color: NodeColorIdSchema.optional(),
27085
28164
  /**
27086
28165
  * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
27087
28166
  * weight, steps}. Absent / all-disabled ⇒ the node's single default
@@ -27631,8 +28710,9 @@ method(object({
27631
28710
  auth: "admin"
27632
28711
  }), method(object({
27633
28712
  agentNodeId: string(),
27634
- reachableHost: string().nullable()
27635
- }), object({ success: literal(true) }), {
28713
+ reachableHost: string().nullable().optional(),
28714
+ color: NodeColorIdSchema.nullable().optional()
28715
+ }).refine((v) => v.reachableHost !== void 0 || v.color !== void 0, { message: "reachableHost or color required" }), object({ success: literal(true) }), {
27636
28716
  kind: "mutation",
27637
28717
  auth: "admin"
27638
28718
  }), method(object({
@@ -28084,8 +29164,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
28084
29164
  * `smtp-provider` — pluggable email delivery surface.
28085
29165
  *
28086
29166
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
28087
- * one for transactional / one for notifications). Consumers (magic-link,
28088
- * notifier addons, …) walk the collection and pick the first
29167
+ * one for transactional / one for notifications). Consumers (notifier
29168
+ * addons, …) walk the collection and pick the first
28089
29169
  * ready provider OR target a specific addonId.
28090
29170
  *
28091
29171
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -28368,7 +29448,7 @@ targets: array(object({
28368
29448
  };
28369
29449
  /**
28370
29450
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
28371
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
29451
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
28372
29452
  * carrying the post-callback claims before redirecting back to
28373
29453
  * `/api/auth/sso/finish`.
28374
29454
  *
@@ -28431,7 +29511,14 @@ var SsoBridgeClaimsSchema = object({
28431
29511
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28432
29512
  * subject is unique only per issuer, so a link is bound to it.
28433
29513
  */
28434
- issuer: string().optional()
29514
+ issuer: string().optional(),
29515
+ /**
29516
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
29517
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
29518
+ * request to present the matching cookie — a login bridge is useless in
29519
+ * any other browser.
29520
+ */
29521
+ browserBinding: string().optional()
28435
29522
  });
28436
29523
  method(object({
28437
29524
  claims: SsoBridgeClaimsSchema,
@@ -31214,7 +32301,7 @@ var CustomActionInputSchema = object({
31214
32301
  action: string().min(1),
31215
32302
  input: unknown()
31216
32303
  });
31217
- method(_void(), array(AddonListItemSchema).readonly()), method(object({
32304
+ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSchema).readonly()), method(object({
31218
32305
  addonId: string(),
31219
32306
  limit: number().min(1).max(500).default(100),
31220
32307
  level: LogLevelSchema$2.optional()
@@ -36276,7 +37363,13 @@ var TopologyNodeSchema = object({
36276
37363
  })).readonly(),
36277
37364
  processes: array(TopologyProcessSchema).readonly(),
36278
37365
  categories: array(TopologyCategorySchema).readonly(),
36279
- rootPackage: TopologyRootPackageSchema.nullable()
37366
+ rootPackage: TopologyRootPackageSchema.nullable(),
37367
+ /**
37368
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
37369
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
37370
+ * for offline rows and when the hub cannot tell.
37371
+ */
37372
+ meshTransport: _enum(["tls", "clear"]).optional()
36280
37373
  });
36281
37374
  var CapUsageEdgeSchema = object({
36282
37375
  callerAddonId: string(),
@@ -36735,6 +37828,7 @@ var OsdNamedTemplateSchema = object({
36735
37828
  });
36736
37829
  /** Where a slot's value comes from. */
36737
37830
  var OsdSourceSchema = discriminatedUnion("kind", [
37831
+ object({ kind: literal("none") }),
36738
37832
  object({
36739
37833
  kind: literal("static"),
36740
37834
  text: string().max(64)
@@ -36861,6 +37955,13 @@ method(object({ deviceId: number().int() }), object({
36861
37955
  }), object({ success: literal(true) }), {
36862
37956
  kind: "mutation",
36863
37957
  auth: "admin"
37958
+ }), method(object({
37959
+ deviceId: number().int(),
37960
+ slotId: string().min(1),
37961
+ enabled: boolean()
37962
+ }), object({ success: literal(true) }), {
37963
+ kind: "mutation",
37964
+ auth: "admin"
36864
37965
  }), method(object({
36865
37966
  sourceDeviceId: number().int(),
36866
37967
  targetDeviceId: number().int()
@@ -37292,7 +38393,15 @@ var GpuInfoSchema = object({
37292
38393
  name: string(),
37293
38394
  memoryMB: number().optional()
37294
38395
  });
37295
- var NpuInfoSchema = object({ type: _enum(["apple-ane", "intel-npu"]) });
38396
+ var NpuInfoSchema = object({
38397
+ type: _enum([
38398
+ "apple-ane",
38399
+ "intel-npu",
38400
+ "amd-xdna"
38401
+ ]),
38402
+ name: string().optional(),
38403
+ generation: _enum(["xdna1", "xdna2"]).optional()
38404
+ });
37296
38405
  var CoralInfoSchema = object({
37297
38406
  type: literal("coral-edgetpu"),
37298
38407
  bus: string().optional()
@@ -41561,16 +42670,6 @@ var ApiKeySummarySchema = object({
41561
42670
  createdAt: number(),
41562
42671
  lastUsedAt: number().optional()
41563
42672
  });
41564
- var CreateApiKeyInputSchema = object({
41565
- label: string(),
41566
- isAdmin: boolean().default(false),
41567
- allowedProviders: union([array(string()), literal("*")]).optional(),
41568
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
41569
- });
41570
- var CreateApiKeyResultSchema = object({
41571
- token: string(),
41572
- record: ApiKeySummarySchema
41573
- });
41574
42673
  var ScopedTokenSummarySchema = object({
41575
42674
  id: string(),
41576
42675
  userId: string(),
@@ -41669,17 +42768,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
41669
42768
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
41670
42769
  kind: "mutation",
41671
42770
  access: "view"
41672
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
41673
- kind: "mutation",
41674
- auth: "admin",
41675
- access: "create"
41676
- }), method(object({ id: string() }), object({ success: literal(true) }), {
42771
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
41677
42772
  kind: "mutation",
41678
42773
  auth: "admin",
41679
42774
  access: "delete"
41680
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
41681
- kind: "mutation",
41682
- access: "view"
41683
42775
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
41684
42776
  kind: "mutation",
41685
42777
  auth: "admin",
@@ -41753,15 +42845,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
41753
42845
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
41754
42846
  userId: string(),
41755
42847
  issuer: string()
41756
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
41757
- userId: string(),
41758
- issuer: string().min(1),
41759
- label: string().optional()
41760
- }), object({ success: literal(true) }), {
41761
- kind: "mutation",
41762
- auth: "admin",
41763
- access: "create"
41764
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
42848
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41765
42849
  kind: "mutation",
41766
42850
  auth: "admin",
41767
42851
  access: "delete"
@@ -42466,6 +43550,563 @@ var zoneRulesCapability = {
42466
43550
  */
42467
43551
  durability: "restored"
42468
43552
  };
43553
+ /**
43554
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
43555
+ *
43556
+ * A thin, mockable translation layer: it knows how to run a container with a
43557
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
43558
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
43559
+ * those are the `training` orchestrator's (D805). Every rule written there
43560
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
43561
+ * manifest entry and nothing else.
43562
+ *
43563
+ * Collection of provider **types** (addons). Each addon owns zero or more
43564
+ * **entries** (credentials + defaults). Concat-fans: `describe`,
43565
+ * `describeTypes`, `listEntries`, `listJobs`. Single-row work is keyed by
43566
+ * `entryId`; callers also pass the owning `addonId` as the collection
43567
+ * selector (broker posture). Every method is `admin`: these spend money.
43568
+ *
43569
+ * Every cloud object a provider creates is tagged with the orchestrator's
43570
+ * `jobKey`, so a retried submit finds the job it already started instead of
43571
+ * starting a second GPU, and `listJobs` can find orphans.
43572
+ *
43573
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
43574
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
43575
+ * ticket the provider mints (D613).
43576
+ */
43577
+ var TrainingGpuOptionSchema = object({
43578
+ id: string(),
43579
+ label: string(),
43580
+ /** List price, USD per GPU-hour, before any region multiplier. */
43581
+ usdPerHour: number().nonnegative(),
43582
+ vramGb: number().nonnegative()
43583
+ });
43584
+ var TrainingRegionOptionSchema = object({
43585
+ /** `''` = any region (the provider's choice). */
43586
+ id: string(),
43587
+ label: string(),
43588
+ priceMultiplier: number().positive()
43589
+ });
43590
+ /**
43591
+ * The provider's per-entry settings, as the orchestrator reads them. They
43592
+ * live on the PROVIDER addon's entry (operator decision 2026-10-08: they
43593
+ * depend on the user's account), never hard-coded in the orchestrator.
43594
+ */
43595
+ var TrainingProviderDefaultsSchema = object({
43596
+ gpuType: string(),
43597
+ region: string(),
43598
+ costCapUsd: number().nonnegative(),
43599
+ maxRuntimeSec: number().int().positive(),
43600
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
43601
+ failedDatasetGraceHours: number().nonnegative()
43602
+ });
43603
+ /**
43604
+ * Entry form schema for a provider type — same seam as notification
43605
+ * `TargetKind.configSchema` (`z.unknown()` at the wire; callers tighten to
43606
+ * {@link ConfigUISchema}). Drives `ConfigFormBuilder` on Training → Providers.
43607
+ */
43608
+ var ConfigSchemaPassthrough = unknown();
43609
+ /** One creatable provider type, for the Add-entry dialog. */
43610
+ var TrainingProviderTypeSchema = object({
43611
+ typeId: string(),
43612
+ label: string(),
43613
+ /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
43614
+ iconAsset: string(),
43615
+ /** Owning `training-provider` addon — collection selector for createEntry. */
43616
+ addonId: string(),
43617
+ /**
43618
+ * Fields for one entry of this type (credentials + defaults). Absent on a
43619
+ * type that only needs a name. Password fields are keychain-backed on the
43620
+ * provider addon (`secretStatePaths`), not D634 plaintext.
43621
+ */
43622
+ configSchema: ConfigSchemaPassthrough.optional()
43623
+ });
43624
+ /** One configured account / workspace under a provider type. */
43625
+ var TrainingProviderEntrySchema = object({
43626
+ entryId: string(),
43627
+ typeId: string(),
43628
+ name: string(),
43629
+ addonId: string(),
43630
+ /** Credentials are present — never the values. */
43631
+ configured: boolean()
43632
+ });
43633
+ var TrainingProviderDescriptorSchema = object({
43634
+ addonId: string(),
43635
+ entryId: string(),
43636
+ typeId: string(),
43637
+ /** Operator-chosen entry name. */
43638
+ name: string(),
43639
+ iconAsset: string(),
43640
+ /** `modal`, `runpod`, `fake`, … — same as typeId for current providers. */
43641
+ kind: string(),
43642
+ label: string(),
43643
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
43644
+ regions: array(TrainingRegionOptionSchema).readonly(),
43645
+ maxDatasetBytes: number().int().positive(),
43646
+ maxRuntimeSec: number().int().positive(),
43647
+ freeTierNote: string().optional(),
43648
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
43649
+ dataResidencyNote: string(),
43650
+ /** Credentials are present — never the values. */
43651
+ configured: boolean(),
43652
+ defaults: TrainingProviderDefaultsSchema,
43653
+ /**
43654
+ * Values for {@link TrainingProviderTypeSchema}'s `configSchema` — password
43655
+ * fields are keychain {@link SecretFieldView} or `null` / `''` (create),
43656
+ * never plaintext. Same hydrate contract as settings forms (D789).
43657
+ */
43658
+ formValues: record(string(), unknown()).optional()
43659
+ });
43660
+ /**
43661
+ * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
43662
+ * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
43663
+ * `{ $secretClear: true }` clears it.
43664
+ */
43665
+ var TrainingProviderUpdateEntryInputSchema = object({
43666
+ entryId: string().min(1),
43667
+ name: string().min(1),
43668
+ tokenId: string().optional(),
43669
+ tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
43670
+ environment: string().optional(),
43671
+ gpuType: string().optional(),
43672
+ region: string().optional(),
43673
+ costCapUsd: number().nonnegative().optional(),
43674
+ maxRuntimeSec: number().int().positive().optional(),
43675
+ failedDatasetGraceHours: number().nonnegative().optional()
43676
+ });
43677
+ var TrainingCredentialCheckSchema = object({
43678
+ ok: boolean(),
43679
+ /** Workspace / account name, when the provider says. */
43680
+ account: string().optional(),
43681
+ reason: _enum([
43682
+ "missing",
43683
+ "invalid",
43684
+ "forbidden",
43685
+ "network",
43686
+ "quota"
43687
+ ]).optional(),
43688
+ detail: string().optional()
43689
+ });
43690
+ var ProviderJobStateSchema = _enum([
43691
+ "pending",
43692
+ "starting",
43693
+ "running",
43694
+ "succeeded",
43695
+ "failed",
43696
+ "cancelled",
43697
+ "lost"
43698
+ ]);
43699
+ var ProviderJobStatusSchema = object({
43700
+ jobKey: string(),
43701
+ providerJobId: string().optional(),
43702
+ state: ProviderJobStateSchema,
43703
+ startedAt: number().optional(),
43704
+ endedAt: number().optional(),
43705
+ exitCode: number().int().optional(),
43706
+ failureReason: string().optional(),
43707
+ gpuType: string(),
43708
+ region: string().optional(),
43709
+ billedSeconds: number().nonnegative(),
43710
+ costUsd: number().nonnegative(),
43711
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
43712
+ costIsEstimate: boolean(),
43713
+ lastFetchedAt: number()
43714
+ });
43715
+ /**
43716
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
43717
+ * image its own way (Modal builds the published Dockerfile at that revision;
43718
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
43719
+ * in `result.json`.
43720
+ */
43721
+ var TrainerSourceRefSchema = object({
43722
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
43723
+ repo: string().min(1),
43724
+ /** A commit sha (never a branch) — the job must be reproducible. */
43725
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
43726
+ });
43727
+ /** Cloud job identity — route with the owning addon's `addonId` selector. */
43728
+ var JobRef = {
43729
+ entryId: string().min(1),
43730
+ jobKey: string().uuid()
43731
+ };
43732
+ var TrainingLogLineSchema = object({
43733
+ ts: number(),
43734
+ text: string()
43735
+ });
43736
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
43737
+ typeId: string().min(1),
43738
+ name: string().min(1)
43739
+ }), object({ entryId: string() }), {
43740
+ kind: "mutation",
43741
+ auth: "admin"
43742
+ }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
43743
+ kind: "mutation",
43744
+ auth: "admin"
43745
+ }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
43746
+ kind: "mutation",
43747
+ auth: "admin"
43748
+ }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
43749
+ kind: "mutation",
43750
+ auth: "admin",
43751
+ timeoutMs: 3e4
43752
+ }), method(object({
43753
+ entryId: string().min(1),
43754
+ gpuType: string(),
43755
+ region: string(),
43756
+ datasetBytes: number().int().nonnegative(),
43757
+ gpuSecondsLow: number().nonnegative(),
43758
+ gpuSecondsHigh: number().nonnegative()
43759
+ }), object({
43760
+ usdLow: number().nonnegative(),
43761
+ usdHigh: number().nonnegative(),
43762
+ notes: array(string()).readonly()
43763
+ }), { auth: "admin" }), method(object({
43764
+ ...JobRef,
43765
+ ticket: PeerBytesTicketSchema
43766
+ }), object({
43767
+ bytes: number().int().nonnegative(),
43768
+ sha256: string()
43769
+ }), {
43770
+ kind: "mutation",
43771
+ auth: "admin",
43772
+ timeoutMs: 120 * 6e4
43773
+ }), method(object({
43774
+ ...JobRef,
43775
+ trainer: TrainerSourceRefSchema,
43776
+ jobSpecJson: string().min(2).max(64e3),
43777
+ gpuType: string(),
43778
+ region: string(),
43779
+ maxRuntimeSec: number().int().positive()
43780
+ }), ProviderJobStatusSchema, {
43781
+ kind: "mutation",
43782
+ auth: "admin",
43783
+ timeoutMs: 30 * 6e4
43784
+ }), method(object(JobRef), ProviderJobStatusSchema, {
43785
+ auth: "admin",
43786
+ timeoutMs: 6e4
43787
+ }), method(object({
43788
+ ...JobRef,
43789
+ cursor: string().optional(),
43790
+ max: number().int().min(1).max(500)
43791
+ }), object({
43792
+ lines: array(TrainingLogLineSchema).readonly(),
43793
+ cursor: string()
43794
+ }), {
43795
+ auth: "admin",
43796
+ timeoutMs: 6e4
43797
+ }), method(object(JobRef), object({ ok: literal(true) }), {
43798
+ kind: "mutation",
43799
+ auth: "admin",
43800
+ timeoutMs: 6e4
43801
+ }), method(object(JobRef), object({
43802
+ found: boolean(),
43803
+ text: string().optional()
43804
+ }), {
43805
+ kind: "mutation",
43806
+ auth: "admin",
43807
+ timeoutMs: 5 * 6e4
43808
+ }), method(object({
43809
+ ...JobRef,
43810
+ path: _enum(["bundle.tar"])
43811
+ }), object({ ticket: PeerBytesTicketSchema }), {
43812
+ kind: "mutation",
43813
+ auth: "admin",
43814
+ timeoutMs: 5 * 6e4
43815
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
43816
+ kind: "mutation",
43817
+ auth: "admin",
43818
+ timeoutMs: 5 * 6e4
43819
+ }), method(object({ entryId: string().min(1).optional() }), array(ProviderJobStatusSchema).readonly(), {
43820
+ auth: "admin",
43821
+ timeoutMs: 2 * 6e4
43822
+ });
43823
+ /**
43824
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
43825
+ * provided by `addon-training`.
43826
+ *
43827
+ * It owns what every provider must agree on, written once:
43828
+ *
43829
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
43830
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
43831
+ * - **The return flow.** Verified artefacts → Model Studio
43832
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
43833
+ * rollback. Nothing is ever registered automatically.
43834
+ *
43835
+ * Plan/start takes a live {@link TrainingCorpusSelection} (collections +
43836
+ * work-state rule); frame ids are resolved via pipeline-analytics at that
43837
+ * moment and snapshotted on the job. No frozen dataset version.
43838
+ *
43839
+ * Every method is `admin`.
43840
+ */
43841
+ /**
43842
+ * Live corpus criteria for plan/start (design §5.2). Default is complete-only.
43843
+ * Frame ids are resolved at plan/start — never a frozen version id.
43844
+ */
43845
+ var TrainingCorpusSelectionSchema = object({
43846
+ collectionIds: array(string()).min(1),
43847
+ /** Default complete-only for v1 */
43848
+ workState: _enum([
43849
+ "complete",
43850
+ "annotated_or_complete",
43851
+ "any_annotated"
43852
+ ]).default("complete")
43853
+ });
43854
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
43855
+ var TrainingBaseModelSchema = object({
43856
+ modelId: string(),
43857
+ label: string(),
43858
+ weights: string(),
43859
+ imgsz: number().int(),
43860
+ baselineOnnxUrl: string(),
43861
+ baselineFloors: record(string(), number()),
43862
+ /** The base the fleet runs most — the UI's default. */
43863
+ recommended: boolean()
43864
+ });
43865
+ var TrainingPresetSchema = _enum([
43866
+ "quick",
43867
+ "standard",
43868
+ "thorough"
43869
+ ]);
43870
+ var TrainingJobRequestSchema = object({
43871
+ /** Live collection + work-state criteria; resolved at plan/start. */
43872
+ selection: TrainingCorpusSelectionSchema,
43873
+ /**
43874
+ * The provider **entry** that runs it (credentials + defaults).
43875
+ * Resolve to an owning addon via `training-provider.describe` / `listEntries`.
43876
+ */
43877
+ entryId: string().min(1),
43878
+ gpuType: string().min(1),
43879
+ region: string(),
43880
+ baseModelId: string().min(1),
43881
+ preset: TrainingPresetSchema,
43882
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
43883
+ freeze: number().int().nonnegative().nullable(),
43884
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
43885
+ holdoutCameras: array(number().int()).nullable()
43886
+ });
43887
+ var TrainingSplitPlanSchema = object({
43888
+ holdoutCameras: array(number().int()).readonly(),
43889
+ /** Used when no camera is held out: the last N days of every camera. */
43890
+ holdoutLastDays: number().int().nonnegative(),
43891
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
43892
+ holdoutSupport: record(string(), number().int()).nullable(),
43893
+ trainSubjects: number().int()
43894
+ });
43895
+ var TrainingRefusalReasonSchema = _enum([
43896
+ "unknown-dataset",
43897
+ "unknown-provider",
43898
+ "provider-not-configured",
43899
+ "unknown-base-model",
43900
+ "unknown-gpu",
43901
+ "dataset-too-large",
43902
+ "no-training-subjects",
43903
+ "job-already-running"
43904
+ ]);
43905
+ var TrainingJobPlanSchema = object({
43906
+ refusal: object({
43907
+ reason: TrainingRefusalReasonSchema,
43908
+ detail: string()
43909
+ }).nullable(),
43910
+ warnings: array(string()).readonly(),
43911
+ split: TrainingSplitPlanSchema.nullable(),
43912
+ estimate: object({
43913
+ datasetBytes: number().int(),
43914
+ uploadMinutesAt20Mbps: number(),
43915
+ gpuSecondsLow: number(),
43916
+ gpuSecondsHigh: number(),
43917
+ usdLow: number(),
43918
+ usdHigh: number(),
43919
+ notes: array(string()).readonly()
43920
+ }).nullable(),
43921
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
43922
+ defaults: object({
43923
+ maxCostUsd: number(),
43924
+ maxRuntimeSec: number().int()
43925
+ }).nullable(),
43926
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
43927
+ dataNotice: string()
43928
+ });
43929
+ /**
43930
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
43931
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
43932
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
43933
+ * result lives after the operator acted on it.
43934
+ */
43935
+ var TrainingJobStateSchema = _enum([
43936
+ "queued",
43937
+ "uploading",
43938
+ "submitted",
43939
+ "starting",
43940
+ "running",
43941
+ "collecting",
43942
+ "ready",
43943
+ "registered",
43944
+ "canary",
43945
+ "failed",
43946
+ "cancelling",
43947
+ "cancelled",
43948
+ "lost",
43949
+ "expired",
43950
+ "discarded"
43951
+ ]);
43952
+ var TrainingFailureReasonSchema = _enum([
43953
+ "cost-cap",
43954
+ "runtime-cap",
43955
+ "upload-failed",
43956
+ "submit-failed",
43957
+ "trainer-failed",
43958
+ "result-invalid",
43959
+ "checksum-mismatch",
43960
+ "fetch-failed",
43961
+ "provider-error",
43962
+ "hub-restart-during-upload"
43963
+ ]);
43964
+ var TrainingProgressPointSchema = object({
43965
+ epoch: number().int(),
43966
+ map50: number().nullable(),
43967
+ map50_95: number().nullable()
43968
+ });
43969
+ var TrainingCanarySchema = object({
43970
+ deviceIds: array(number().int()).readonly(),
43971
+ since: number(),
43972
+ /** Every override the canary replaced, exactly, so rollback restores it. */
43973
+ previous: array(object({
43974
+ deviceId: number().int(),
43975
+ nodeId: string(),
43976
+ deviceKey: string(),
43977
+ patch: object({
43978
+ modelId: string().optional(),
43979
+ settings: record(string(), unknown()).readonly().optional()
43980
+ }).nullable()
43981
+ })).readonly()
43982
+ });
43983
+ var TrainingJobSchema = object({
43984
+ id: string(),
43985
+ idempotencyKey: string(),
43986
+ name: string(),
43987
+ createdAt: number(),
43988
+ updatedAt: number(),
43989
+ state: TrainingJobStateSchema,
43990
+ /**
43991
+ * Shared by every job enqueued together via `startJobBatch`.
43992
+ * `null` for a lone `startJob`. The engine advances queued siblings by this id.
43993
+ */
43994
+ batchId: string().nullable().default(null),
43995
+ stage: TrainingStageSchema.nullable(),
43996
+ failure: object({
43997
+ reason: TrainingFailureReasonSchema,
43998
+ stage: string().nullable(),
43999
+ detail: string()
44000
+ }).nullable(),
44001
+ request: TrainingJobRequestSchema,
44002
+ maxCostUsd: number().nonnegative(),
44003
+ maxRuntimeSec: number().int().positive(),
44004
+ trainer: TrainerSourceRefSchema,
44005
+ datasetLayout: RetrainExportLayoutSchema,
44006
+ /** Frame count snapshotted when the job started (audit; equals `frameIds.length`). */
44007
+ frameCount: number().int().nonnegative(),
44008
+ /** Resolved frame ids at start — the archive ships exactly these. */
44009
+ frameIds: array(string()).max(2e4).readonly(),
44010
+ /** Hash of what those frames taught at start (trainer `dataset.annotationHash`). */
44011
+ annotationHash: string(),
44012
+ dataset: object({
44013
+ bytes: number().int(),
44014
+ sha256: string(),
44015
+ uploadedAt: number()
44016
+ }).nullable(),
44017
+ split: TrainingSplitPlanSchema,
44018
+ provider: object({
44019
+ state: ProviderJobStateSchema.nullable(),
44020
+ providerJobId: string().nullable(),
44021
+ startedAt: number().nullable(),
44022
+ endedAt: number().nullable(),
44023
+ billedSeconds: number(),
44024
+ costUsd: number(),
44025
+ costIsEstimate: boolean(),
44026
+ lastPolledAt: number().nullable()
44027
+ }),
44028
+ progress: object({
44029
+ epoch: number().int().nullable(),
44030
+ epochs: number().int().nullable(),
44031
+ etaSec: number().nullable(),
44032
+ series: array(TrainingProgressPointSchema).readonly()
44033
+ }),
44034
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
44035
+ logTail: array(string()).readonly(),
44036
+ logCursor: string().nullable(),
44037
+ artifacts: object({
44038
+ bundleBytes: number().int(),
44039
+ bundleSha256: string(),
44040
+ fetchedAt: number(),
44041
+ /** When the staged artefacts are deleted from the hub. */
44042
+ expiresAt: number()
44043
+ }).nullable(),
44044
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
44045
+ cloudDatasetDeletedAt: number().nullable(),
44046
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
44047
+ cloudCleanupDueAt: number().nullable(),
44048
+ /** Model ids registered from this job (base, and int8 when kept). */
44049
+ registeredModelIds: array(string()).readonly(),
44050
+ canary: TrainingCanarySchema.nullable()
44051
+ });
44052
+ var IdInput = object({ id: string().min(1) });
44053
+ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
44054
+ auth: "admin",
44055
+ timeoutMs: 6e4
44056
+ }), method(TrainingJobRequestSchema.extend({
44057
+ name: string().min(1).max(120),
44058
+ maxCostUsd: number().positive(),
44059
+ maxRuntimeSec: number().int().positive(),
44060
+ idempotencyKey: string().min(8).max(80)
44061
+ }), discriminatedUnion("kind", [object({
44062
+ kind: literal("started"),
44063
+ job: TrainingJobSchema
44064
+ }), object({
44065
+ kind: literal("refused"),
44066
+ reason: TrainingRefusalReasonSchema,
44067
+ detail: string()
44068
+ })]), {
44069
+ kind: "mutation",
44070
+ auth: "admin",
44071
+ timeoutMs: 12e4
44072
+ }), method(TrainingJobRequestSchema.omit({ baseModelId: true }).extend({
44073
+ baseModelIds: array(string().min(1)).min(1),
44074
+ name: string().min(1).max(120),
44075
+ maxCostUsd: number().positive(),
44076
+ maxRuntimeSec: number().int().positive(),
44077
+ idempotencyKey: string().min(8).max(80)
44078
+ }), discriminatedUnion("kind", [object({
44079
+ kind: literal("started"),
44080
+ batchId: string(),
44081
+ jobs: array(TrainingJobSchema).min(1).readonly()
44082
+ }), object({
44083
+ kind: literal("refused"),
44084
+ reason: TrainingRefusalReasonSchema,
44085
+ detail: string()
44086
+ })]), {
44087
+ kind: "mutation",
44088
+ auth: "admin",
44089
+ timeoutMs: 12e4
44090
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
44091
+ kind: "mutation",
44092
+ auth: "admin",
44093
+ timeoutMs: 12e4
44094
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
44095
+ kind: "mutation",
44096
+ auth: "admin",
44097
+ timeoutMs: 30 * 6e4
44098
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
44099
+ kind: "mutation",
44100
+ auth: "admin",
44101
+ timeoutMs: 12e4
44102
+ }), method(IdInput, TrainingJobSchema, {
44103
+ kind: "mutation",
44104
+ auth: "admin",
44105
+ timeoutMs: 12e4
44106
+ }), method(IdInput, TrainingJobSchema, {
44107
+ kind: "mutation",
44108
+ auth: "admin"
44109
+ });
42469
44110
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
42470
44111
  Object.freeze({
42471
44112
  person: .5,
@@ -44614,6 +46255,12 @@ Object.freeze({
44614
46255
  addonId: null,
44615
46256
  access: "create"
44616
46257
  },
46258
+ "backup.checkBackupKey": {
46259
+ capName: "backup",
46260
+ capScope: "system",
46261
+ addonId: null,
46262
+ access: "create"
46263
+ },
44617
46264
  "backup.delete": {
44618
46265
  capName: "backup",
44619
46266
  capScope: "system",
@@ -44626,6 +46273,18 @@ Object.freeze({
44626
46273
  addonId: null,
44627
46274
  access: "delete"
44628
46275
  },
46276
+ "backup.disableEncryption": {
46277
+ capName: "backup",
46278
+ capScope: "system",
46279
+ addonId: null,
46280
+ access: "create"
46281
+ },
46282
+ "backup.getEncryption": {
46283
+ capName: "backup",
46284
+ capScope: "system",
46285
+ addonId: null,
46286
+ access: "view"
46287
+ },
44629
46288
  "backup.getEntries": {
44630
46289
  capName: "backup",
44631
46290
  capScope: "system",
@@ -44680,6 +46339,12 @@ Object.freeze({
44680
46339
  addonId: null,
44681
46340
  access: "create"
44682
46341
  },
46342
+ "backup.setupEncryption": {
46343
+ capName: "backup",
46344
+ capScope: "system",
46345
+ addonId: null,
46346
+ access: "create"
46347
+ },
44683
46348
  "backup.trigger": {
44684
46349
  capName: "backup",
44685
46350
  capScope: "system",
@@ -45232,6 +46897,12 @@ Object.freeze({
45232
46897
  addonId: null,
45233
46898
  access: "create"
45234
46899
  },
46900
+ "customModelRegistry.importModelBundle": {
46901
+ capName: "custom-model-registry",
46902
+ capScope: "system",
46903
+ addonId: null,
46904
+ access: "create"
46905
+ },
45235
46906
  "customModelRegistry.listModels": {
45236
46907
  capName: "custom-model-registry",
45237
46908
  capScope: "system",
@@ -46672,6 +48343,12 @@ Object.freeze({
46672
48343
  addonId: null,
46673
48344
  access: "view"
46674
48345
  },
48346
+ "keychainAdmin.acknowledgeReset": {
48347
+ capName: "keychain-admin",
48348
+ capScope: "system",
48349
+ addonId: null,
48350
+ access: "create"
48351
+ },
46675
48352
  "keychainAdmin.deleteOrphans": {
46676
48353
  capName: "keychain-admin",
46677
48354
  capScope: "system",
@@ -46708,6 +48385,12 @@ Object.freeze({
46708
48385
  addonId: null,
46709
48386
  access: "delete"
46710
48387
  },
48388
+ "keychainAdmin.resetReport": {
48389
+ capName: "keychain-admin",
48390
+ capScope: "system",
48391
+ addonId: null,
48392
+ access: "delete"
48393
+ },
46711
48394
  "keychainAdmin.reveal": {
46712
48395
  capName: "keychain-admin",
46713
48396
  capScope: "system",
@@ -46720,6 +48403,12 @@ Object.freeze({
46720
48403
  addonId: null,
46721
48404
  access: "create"
46722
48405
  },
48406
+ "keychainAdmin.setSystemSecret": {
48407
+ capName: "keychain-admin",
48408
+ capScope: "system",
48409
+ addonId: null,
48410
+ access: "create"
48411
+ },
46723
48412
  "keychainAdmin.status": {
46724
48413
  capName: "keychain-admin",
46725
48414
  capScope: "system",
@@ -47956,6 +49645,36 @@ Object.freeze({
47956
49645
  addonId: null,
47957
49646
  access: "view"
47958
49647
  },
49648
+ "oidcConnections.connectionFormSchema": {
49649
+ capName: "oidc-connections",
49650
+ capScope: "system",
49651
+ addonId: null,
49652
+ access: "view"
49653
+ },
49654
+ "oidcConnections.createConnection": {
49655
+ capName: "oidc-connections",
49656
+ capScope: "system",
49657
+ addonId: null,
49658
+ access: "create"
49659
+ },
49660
+ "oidcConnections.deleteConnection": {
49661
+ capName: "oidc-connections",
49662
+ capScope: "system",
49663
+ addonId: null,
49664
+ access: "delete"
49665
+ },
49666
+ "oidcConnections.listConnections": {
49667
+ capName: "oidc-connections",
49668
+ capScope: "system",
49669
+ addonId: null,
49670
+ access: "view"
49671
+ },
49672
+ "oidcConnections.updateConnection": {
49673
+ capName: "oidc-connections",
49674
+ capScope: "system",
49675
+ addonId: null,
49676
+ access: "create"
49677
+ },
47959
49678
  "osd.getStatus": {
47960
49679
  capName: "osd",
47961
49680
  capScope: "device",
@@ -48028,6 +49747,12 @@ Object.freeze({
48028
49747
  addonId: null,
48029
49748
  access: "create"
48030
49749
  },
49750
+ "osdManager.setSlotCameraEnabled": {
49751
+ capName: "osd-manager",
49752
+ capScope: "system",
49753
+ addonId: null,
49754
+ access: "create"
49755
+ },
48031
49756
  "osdManager.upsertTemplate": {
48032
49757
  capName: "osd-manager",
48033
49758
  capScope: "system",
@@ -48280,6 +50005,12 @@ Object.freeze({
48280
50005
  addonId: null,
48281
50006
  access: "view"
48282
50007
  },
50008
+ "pipelineAnalytics.getRetrainCorpusKpi": {
50009
+ capName: "pipeline-analytics",
50010
+ capScope: "device",
50011
+ addonId: null,
50012
+ access: "view"
50013
+ },
48283
50014
  "pipelineAnalytics.getRetrainExportUrl": {
48284
50015
  capName: "pipeline-analytics",
48285
50016
  capScope: "device",
@@ -48400,6 +50131,12 @@ Object.freeze({
48400
50131
  addonId: null,
48401
50132
  access: "view"
48402
50133
  },
50134
+ "pipelineAnalytics.listRetrainCorpusPage": {
50135
+ capName: "pipeline-analytics",
50136
+ capScope: "device",
50137
+ addonId: null,
50138
+ access: "view"
50139
+ },
48403
50140
  "pipelineAnalytics.listRetrainFrames": {
48404
50141
  capName: "pipeline-analytics",
48405
50142
  capScope: "device",
@@ -48430,6 +50167,12 @@ Object.freeze({
48430
50167
  addonId: null,
48431
50168
  access: "view"
48432
50169
  },
50170
+ "pipelineAnalytics.offerRetrainArchive": {
50171
+ capName: "pipeline-analytics",
50172
+ capScope: "device",
50173
+ addonId: null,
50174
+ access: "create"
50175
+ },
48433
50176
  "pipelineAnalytics.ownersWithMedia": {
48434
50177
  capName: "pipeline-analytics",
48435
50178
  capScope: "device",
@@ -48520,6 +50263,12 @@ Object.freeze({
48520
50263
  addonId: null,
48521
50264
  access: "create"
48522
50265
  },
50266
+ "pipelineAnalytics.resolveRetrainTrainingCorpus": {
50267
+ capName: "pipeline-analytics",
50268
+ capScope: "device",
50269
+ addonId: null,
50270
+ access: "view"
50271
+ },
48523
50272
  "pipelineAnalytics.restageRetrainTrack": {
48524
50273
  capName: "pipeline-analytics",
48525
50274
  capScope: "device",
@@ -50956,6 +52705,180 @@ Object.freeze({
50956
52705
  addonId: null,
50957
52706
  access: "view"
50958
52707
  },
52708
+ "training.canaryResult": {
52709
+ capName: "training",
52710
+ capScope: "system",
52711
+ addonId: null,
52712
+ access: "create"
52713
+ },
52714
+ "training.cancelJob": {
52715
+ capName: "training",
52716
+ capScope: "system",
52717
+ addonId: null,
52718
+ access: "create"
52719
+ },
52720
+ "training.discardResult": {
52721
+ capName: "training",
52722
+ capScope: "system",
52723
+ addonId: null,
52724
+ access: "create"
52725
+ },
52726
+ "training.getJob": {
52727
+ capName: "training",
52728
+ capScope: "system",
52729
+ addonId: null,
52730
+ access: "view"
52731
+ },
52732
+ "training.getJobResult": {
52733
+ capName: "training",
52734
+ capScope: "system",
52735
+ addonId: null,
52736
+ access: "view"
52737
+ },
52738
+ "training.listBaseModels": {
52739
+ capName: "training",
52740
+ capScope: "system",
52741
+ addonId: null,
52742
+ access: "view"
52743
+ },
52744
+ "training.listJobs": {
52745
+ capName: "training",
52746
+ capScope: "system",
52747
+ addonId: null,
52748
+ access: "view"
52749
+ },
52750
+ "training.planJob": {
52751
+ capName: "training",
52752
+ capScope: "system",
52753
+ addonId: null,
52754
+ access: "view"
52755
+ },
52756
+ "training.registerResult": {
52757
+ capName: "training",
52758
+ capScope: "system",
52759
+ addonId: null,
52760
+ access: "create"
52761
+ },
52762
+ "training.rollbackCanary": {
52763
+ capName: "training",
52764
+ capScope: "system",
52765
+ addonId: null,
52766
+ access: "create"
52767
+ },
52768
+ "training.startJob": {
52769
+ capName: "training",
52770
+ capScope: "system",
52771
+ addonId: null,
52772
+ access: "create"
52773
+ },
52774
+ "training.startJobBatch": {
52775
+ capName: "training",
52776
+ capScope: "system",
52777
+ addonId: null,
52778
+ access: "create"
52779
+ },
52780
+ "trainingProvider.cancelJob": {
52781
+ capName: "training-provider",
52782
+ capScope: "system",
52783
+ addonId: null,
52784
+ access: "create"
52785
+ },
52786
+ "trainingProvider.cleanupJob": {
52787
+ capName: "training-provider",
52788
+ capScope: "system",
52789
+ addonId: null,
52790
+ access: "create"
52791
+ },
52792
+ "trainingProvider.createEntry": {
52793
+ capName: "training-provider",
52794
+ capScope: "system",
52795
+ addonId: null,
52796
+ access: "create"
52797
+ },
52798
+ "trainingProvider.deleteEntry": {
52799
+ capName: "training-provider",
52800
+ capScope: "system",
52801
+ addonId: null,
52802
+ access: "delete"
52803
+ },
52804
+ "trainingProvider.describe": {
52805
+ capName: "training-provider",
52806
+ capScope: "system",
52807
+ addonId: null,
52808
+ access: "view"
52809
+ },
52810
+ "trainingProvider.describeTypes": {
52811
+ capName: "training-provider",
52812
+ capScope: "system",
52813
+ addonId: null,
52814
+ access: "view"
52815
+ },
52816
+ "trainingProvider.estimateJob": {
52817
+ capName: "training-provider",
52818
+ capScope: "system",
52819
+ addonId: null,
52820
+ access: "view"
52821
+ },
52822
+ "trainingProvider.getJob": {
52823
+ capName: "training-provider",
52824
+ capScope: "system",
52825
+ addonId: null,
52826
+ access: "view"
52827
+ },
52828
+ "trainingProvider.listEntries": {
52829
+ capName: "training-provider",
52830
+ capScope: "system",
52831
+ addonId: null,
52832
+ access: "view"
52833
+ },
52834
+ "trainingProvider.listJobEvents": {
52835
+ capName: "training-provider",
52836
+ capScope: "system",
52837
+ addonId: null,
52838
+ access: "view"
52839
+ },
52840
+ "trainingProvider.listJobs": {
52841
+ capName: "training-provider",
52842
+ capScope: "system",
52843
+ addonId: null,
52844
+ access: "view"
52845
+ },
52846
+ "trainingProvider.offerArtifact": {
52847
+ capName: "training-provider",
52848
+ capScope: "system",
52849
+ addonId: null,
52850
+ access: "create"
52851
+ },
52852
+ "trainingProvider.readResult": {
52853
+ capName: "training-provider",
52854
+ capScope: "system",
52855
+ addonId: null,
52856
+ access: "create"
52857
+ },
52858
+ "trainingProvider.submitJob": {
52859
+ capName: "training-provider",
52860
+ capScope: "system",
52861
+ addonId: null,
52862
+ access: "create"
52863
+ },
52864
+ "trainingProvider.updateEntry": {
52865
+ capName: "training-provider",
52866
+ capScope: "system",
52867
+ addonId: null,
52868
+ access: "create"
52869
+ },
52870
+ "trainingProvider.uploadDataset": {
52871
+ capName: "training-provider",
52872
+ capScope: "system",
52873
+ addonId: null,
52874
+ access: "create"
52875
+ },
52876
+ "trainingProvider.validateCredentials": {
52877
+ capName: "training-provider",
52878
+ capScope: "system",
52879
+ addonId: null,
52880
+ access: "create"
52881
+ },
50959
52882
  "turnProvider.getTurnServers": {
50960
52883
  capName: "turn-provider",
50961
52884
  capScope: "system",
@@ -50980,12 +52903,6 @@ Object.freeze({
50980
52903
  addonId: null,
50981
52904
  access: "create"
50982
52905
  },
50983
- "userManagement.createApiKey": {
50984
- capName: "user-management",
50985
- capScope: "system",
50986
- addonId: null,
50987
- access: "create"
50988
- },
50989
52906
  "userManagement.createScopedToken": {
50990
52907
  capName: "user-management",
50991
52908
  capScope: "system",
@@ -51022,12 +52939,6 @@ Object.freeze({
51022
52939
  addonId: null,
51023
52940
  access: "view"
51024
52941
  },
51025
- "userManagement.linkExternalIdentity": {
51026
- capName: "user-management",
51027
- capScope: "system",
51028
- addonId: null,
51029
- access: "create"
51030
- },
51031
52942
  "userManagement.listApiKeys": {
51032
52943
  capName: "user-management",
51033
52944
  capScope: "system",
@@ -51130,12 +53041,6 @@ Object.freeze({
51130
53041
  addonId: null,
51131
53042
  access: "create"
51132
53043
  },
51133
- "userManagement.validateApiKey": {
51134
- capName: "user-management",
51135
- capScope: "system",
51136
- addonId: null,
51137
- access: "view"
51138
- },
51139
53044
  "userManagement.validateCredentials": {
51140
53045
  capName: "user-management",
51141
53046
  capScope: "system",
@@ -54374,6 +56279,11 @@ Object.freeze({
54374
56279
  form: "single",
54375
56280
  optional: false
54376
56281
  }],
56282
+ "osdManager.setSlotCameraEnabled": [{
56283
+ name: "deviceId",
56284
+ form: "single",
56285
+ optional: false
56286
+ }],
54377
56287
  "petFeeder.callPet": [{
54378
56288
  name: "deviceId",
54379
56289
  form: "single",
@@ -54594,6 +56504,11 @@ Object.freeze({
54594
56504
  form: "array",
54595
56505
  optional: false
54596
56506
  }],
56507
+ "pipelineAnalytics.listRetrainCorpusPage": [{
56508
+ name: "deviceIds",
56509
+ form: "array",
56510
+ optional: true
56511
+ }],
54597
56512
  "pipelineAnalytics.listRetrainStaging": [{
54598
56513
  name: "deviceIds",
54599
56514
  form: "array",
@@ -55455,6 +57370,11 @@ Object.freeze({
55455
57370
  form: "single",
55456
57371
  optional: false
55457
57372
  }],
57373
+ "training.canaryResult": [{
57374
+ name: "deviceIds",
57375
+ form: "array",
57376
+ optional: false
57377
+ }],
55458
57378
  "update.getStatus": [{
55459
57379
  name: "deviceId",
55460
57380
  form: "single",
@@ -55698,6 +57618,7 @@ Object.freeze({
55698
57618
  });
55699
57619
  Object.freeze({
55700
57620
  "broker": "broker",
57621
+ "calendar-source": "calendar",
55701
57622
  "device-export": "device-export",
55702
57623
  "llm": "ai",
55703
57624
  "mesh-network": "mesh",
@@ -56183,6 +58104,8 @@ var STATE_SUMMARY_VARS = [
56183
58104
  [...RULE_TEXT],
56184
58105
  [...RULE_TEXT],
56185
58106
  [...RULE_TEXT],
58107
+ [...RULE_TEXT],
58108
+ [...RULE_TEXT],
56186
58109
  ([...RULE_TEXT], [...UPDATES]),
56187
58110
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
56188
58111
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),