@camstack/addon-agent-ui 1.2.194 → 1.2.196

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.
package/dist/addon.js CHANGED
@@ -5378,7 +5378,7 @@ var ZodIssueCode = {
5378
5378
  var ZodFirstPartyTypeKind;
5379
5379
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5380
5380
  //#endregion
5381
- //#region ../types/dist/sleep-DujUvOcb.mjs
5381
+ //#region ../types/dist/sleep-r3RWkGVx.mjs
5382
5382
  /**
5383
5383
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5384
5384
  * window to float samples (D455).
@@ -5495,7 +5495,7 @@ function isKeychainStoredField(field) {
5495
5495
  var SECRET_CLEAR = { $secretClear: true };
5496
5496
  /** The `'***'` token D634 redaction writes for non-admins. */
5497
5497
  var LEGACY_DEVICE_REDACTION = "***";
5498
- function isRecord$1(value) {
5498
+ function isRecord$2(value) {
5499
5499
  return typeof value === "object" && value !== null && !Array.isArray(value);
5500
5500
  }
5501
5501
  function makeSecretMarker(ref) {
@@ -5506,12 +5506,12 @@ function makeSecretMarker(ref) {
5506
5506
  }
5507
5507
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5508
5508
  function isSecretMarker(value) {
5509
- if (!isRecord$1(value)) return false;
5509
+ if (!isRecord$2(value)) return false;
5510
5510
  const ref = value["$secret"];
5511
5511
  return typeof ref === "string" && ref.length > 0;
5512
5512
  }
5513
5513
  function isSecretClear(value) {
5514
- return isRecord$1(value) && value["$secretClear"] === true;
5514
+ return isRecord$2(value) && value["$secretClear"] === true;
5515
5515
  }
5516
5516
  /**
5517
5517
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6027,6 +6027,13 @@ function globalSecretScope() {
6027
6027
  function encodeSegment(value) {
6028
6028
  return encodeURIComponent(value);
6029
6029
  }
6030
+ function decodeSegment(value) {
6031
+ try {
6032
+ return decodeURIComponent(value);
6033
+ } catch {
6034
+ return null;
6035
+ }
6036
+ }
6030
6037
  /**
6031
6038
  * The field path of a value inside an array item, addressed by the item's id:
6032
6039
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6035,6 +6042,75 @@ function encodeSegment(value) {
6035
6042
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6036
6043
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6037
6044
  }
6045
+ function parseScope(segments) {
6046
+ switch (segments[0]) {
6047
+ case "global": return {
6048
+ scope: GLOBAL_SCOPE,
6049
+ used: 1
6050
+ };
6051
+ case "node": {
6052
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6053
+ return nodeId === null || nodeId.length === 0 ? null : {
6054
+ scope: {
6055
+ kind: "node",
6056
+ nodeId
6057
+ },
6058
+ used: 2
6059
+ };
6060
+ }
6061
+ case "device": {
6062
+ const raw = segments[1];
6063
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6064
+ return {
6065
+ scope: {
6066
+ kind: "device",
6067
+ deviceId: Number(raw)
6068
+ },
6069
+ used: 2
6070
+ };
6071
+ }
6072
+ case "integration": {
6073
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6074
+ return id === null || id.length === 0 ? null : {
6075
+ scope: {
6076
+ kind: "integration",
6077
+ integrationId: id
6078
+ },
6079
+ used: 2
6080
+ };
6081
+ }
6082
+ case "row": {
6083
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6084
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6085
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6086
+ return {
6087
+ scope: {
6088
+ kind: "row",
6089
+ collection,
6090
+ rowId
6091
+ },
6092
+ used: 3
6093
+ };
6094
+ }
6095
+ default: return null;
6096
+ }
6097
+ }
6098
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6099
+ function parseSecretRef(ref) {
6100
+ if (!ref.startsWith("secret://")) return null;
6101
+ const segments = ref.slice(9).split("/");
6102
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6103
+ if (owner === null || owner.length === 0) return null;
6104
+ const parsed = parseScope(segments.slice(1));
6105
+ if (parsed === null) return null;
6106
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6107
+ if (fieldPath.length === 0) return null;
6108
+ return {
6109
+ owner,
6110
+ scope: parsed.scope,
6111
+ fieldPath
6112
+ };
6113
+ }
6038
6114
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6039
6115
  var KeychainWriteRefusedError = class extends Error {
6040
6116
  fieldPath;
@@ -6045,7 +6121,7 @@ var KeychainWriteRefusedError = class extends Error {
6045
6121
  }
6046
6122
  };
6047
6123
  var KEEP = { kind: "keep" };
6048
- function isRecord(value) {
6124
+ function isRecord$1(value) {
6049
6125
  return typeof value === "object" && value !== null && !Array.isArray(value);
6050
6126
  }
6051
6127
  function defaultMintId() {
@@ -6058,7 +6134,7 @@ function collectSecretMarkerRefs(value, out = []) {
6058
6134
  return out;
6059
6135
  }
6060
6136
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6061
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6137
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6062
6138
  return out;
6063
6139
  }
6064
6140
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6113,7 +6189,7 @@ function rowId(row, idKey) {
6113
6189
  return null;
6114
6190
  }
6115
6191
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6116
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6192
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6117
6193
  if (!Array.isArray(incoming)) {
6118
6194
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6119
6195
  return {
@@ -6129,7 +6205,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6129
6205
  const kept = /* @__PURE__ */ new Set();
6130
6206
  const rows = [];
6131
6207
  for (const row of incoming) {
6132
- if (!isRecord(row)) {
6208
+ if (!isRecord$1(row)) {
6133
6209
  rows.push(row);
6134
6210
  continue;
6135
6211
  }
@@ -6154,7 +6230,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6154
6230
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6155
6231
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6156
6232
  case "object": {
6157
- if (!isRecord(incoming)) {
6233
+ if (!isRecord$1(incoming)) {
6158
6234
  if (incoming === void 0) return KEEP;
6159
6235
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6160
6236
  return {
@@ -6162,7 +6238,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6162
6238
  value: incoming
6163
6239
  };
6164
6240
  }
6165
- const storedObj = isRecord(stored) ? stored : {};
6241
+ const storedObj = isRecord$1(stored) ? stored : {};
6166
6242
  return {
6167
6243
  kind: "value",
6168
6244
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6221,12 +6297,19 @@ async function transformSecretWrite(input) {
6221
6297
  }
6222
6298
  };
6223
6299
  }
6300
+ /** Is `ref` one of `owner`'s refs? */
6301
+ function isSecretRefOwnedBy(ref, owner) {
6302
+ return parseSecretRef(ref)?.owner === owner;
6303
+ }
6224
6304
  /**
6225
6305
  * Replace every marker in `value` with its keychain value. Returns the SAME
6226
6306
  * reference when there is no marker (no allocation, no keychain call).
6227
6307
  */
6228
- async function resolveSecretMarkers(value, secrets) {
6229
- const refs = collectSecretMarkerRefs(value);
6308
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6309
+ const keepMarker = options.unresolved === "keep-marker";
6310
+ const owner = options.ownedBy;
6311
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6312
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6230
6313
  if (refs.length === 0) return {
6231
6314
  value,
6232
6315
  unresolved: []
@@ -6250,10 +6333,18 @@ async function resolveSecretMarkers(value, secrets) {
6250
6333
  }
6251
6334
  const substitute = (v) => {
6252
6335
  if (isSecretMarker(v)) {
6336
+ if (!inScope(v.$secret)) return {
6337
+ keep: true,
6338
+ value: v
6339
+ };
6253
6340
  const answer = answers[v.$secret];
6254
- return answer?.kind === "value" ? {
6341
+ if (answer?.kind === "value") return {
6255
6342
  keep: true,
6256
6343
  value: answer.value
6344
+ };
6345
+ return keepMarker ? {
6346
+ keep: true,
6347
+ value: v
6257
6348
  } : {
6258
6349
  keep: false,
6259
6350
  value: void 0
@@ -6270,7 +6361,7 @@ async function resolveSecretMarkers(value, secrets) {
6270
6361
  value: items
6271
6362
  };
6272
6363
  }
6273
- if (isRecord(v)) {
6364
+ if (isRecord$1(v)) {
6274
6365
  const out = {};
6275
6366
  for (const [k, child] of Object.entries(v)) {
6276
6367
  const s = substitute(child);
@@ -6291,14 +6382,152 @@ async function resolveSecretMarkers(value, secrets) {
6291
6382
  unresolved
6292
6383
  };
6293
6384
  }
6294
- function touchesTree(tree, patch) {
6295
- if (tree.size === 0) return false;
6296
- for (const key of Object.keys(patch)) {
6297
- const at = key.indexOf("@");
6298
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6385
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6386
+ var SecretOverwriteRefusedError = class extends Error {
6387
+ ref;
6388
+ reason;
6389
+ constructor(ref, reason) {
6390
+ 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.`);
6391
+ this.ref = ref;
6392
+ this.reason = reason;
6393
+ this.name = "SecretOverwriteRefusedError";
6394
+ }
6395
+ };
6396
+ function isRecord(value) {
6397
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6398
+ }
6399
+ function resolvedValue(pass, marker) {
6400
+ const answer = pass.answers[marker.$secret];
6401
+ return answer?.kind === "value" ? answer.value : null;
6402
+ }
6403
+ async function atMarker(pass, incoming, stored) {
6404
+ if (incoming === null) return stored;
6405
+ if (typeof incoming !== "string") return incoming;
6406
+ if (incoming === resolvedValue(pass, stored)) return stored;
6407
+ const intent = classifySecretWrite(incoming);
6408
+ if (intent.kind !== "set") return stored;
6409
+ const ref = stored.$secret;
6410
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6411
+ const answer = pass.answers[ref];
6412
+ 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);
6413
+ try {
6414
+ await pass.secrets.put(ref, intent.value);
6415
+ } catch (err) {
6416
+ throw new KeychainWriteRefusedError(ref, err);
6417
+ }
6418
+ pass.changedRefs.push(ref);
6419
+ return stored;
6420
+ }
6421
+ function inArray(pass, incoming, stored) {
6422
+ return incoming.map((item, index) => {
6423
+ const twin = stored[index];
6424
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6425
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6426
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6427
+ return item;
6428
+ });
6429
+ }
6430
+ function inArrayRow(pass, incoming, stored) {
6431
+ const out = { ...incoming };
6432
+ for (const [key, value] of Object.entries(incoming)) {
6433
+ const twin = stored[key];
6434
+ if (isSecretMarker(twin)) {
6435
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6436
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6437
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6438
+ }
6439
+ return out;
6440
+ }
6441
+ async function walk(pass, incoming, stored) {
6442
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6443
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6444
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6445
+ const out = { ...incoming };
6446
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6447
+ return out;
6448
+ }
6449
+ /** Restore markers a write-back carries as values. See the file doc. */
6450
+ async function restoreUnchangedSecrets(input) {
6451
+ const refs = [];
6452
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6453
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6454
+ if (owned.length === 0) return {
6455
+ patch: input.patch,
6456
+ changedRefs: []
6457
+ };
6458
+ const pass = {
6459
+ secrets: input.secrets,
6460
+ answers: await input.secrets.resolve([...new Set(owned)]),
6461
+ operatorWrite: input.operatorWrite,
6462
+ changedRefs: []
6463
+ };
6464
+ const out = {};
6465
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6466
+ return {
6467
+ patch: out,
6468
+ changedRefs: pass.changedRefs
6469
+ };
6470
+ }
6471
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6472
+ function isJsonEqual(a, b) {
6473
+ if (Object.is(a, b)) return true;
6474
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6475
+ if (isRecord(a) && isRecord(b)) {
6476
+ const keys = Object.keys(a);
6477
+ if (keys.length !== Object.keys(b).length) return false;
6478
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6299
6479
  }
6300
6480
  return false;
6301
6481
  }
6482
+ /** The patch without the keys whose value already equals the stored one. */
6483
+ function dropUnchangedKeys(patch, stored) {
6484
+ const out = {};
6485
+ for (const [key, value] of Object.entries(patch)) {
6486
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6487
+ out[key] = value;
6488
+ }
6489
+ return out;
6490
+ }
6491
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6492
+ function markerKeysOf(blob, owner) {
6493
+ const keys = /* @__PURE__ */ new Set();
6494
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6495
+ return keys;
6496
+ }
6497
+ function nodeFromStored(value, owner) {
6498
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6499
+ if (!isRecord(value)) return null;
6500
+ const children = /* @__PURE__ */ new Map();
6501
+ for (const [key, child] of Object.entries(value)) {
6502
+ const node = nodeFromStored(child, owner);
6503
+ if (node !== null) children.set(key, node);
6504
+ }
6505
+ return children.size > 0 ? {
6506
+ kind: "object",
6507
+ children
6508
+ } : null;
6509
+ }
6510
+ /**
6511
+ * The declared secret tree, widened by every place the STORED blob holds a
6512
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6513
+ * never declared: Wyze before b4906cec6) still gets the save path's
6514
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6515
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6516
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6517
+ * builtin that keeps another addon's marker (device-manager) never takes it
6518
+ * over.
6519
+ */
6520
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6521
+ const added = /* @__PURE__ */ new Map();
6522
+ for (const key of keys) {
6523
+ const at = key.indexOf("@");
6524
+ const base = at > 0 ? key.slice(0, at) : key;
6525
+ if (declared.has(base) || added.has(base)) continue;
6526
+ const node = nodeFromStored(stored[key], owner);
6527
+ if (node !== null) added.set(base, node);
6528
+ }
6529
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6530
+ }
6302
6531
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6303
6532
  async function readStoredAddonBlob(raw) {
6304
6533
  const threeWay = raw.readAddonStoreResult;
@@ -6307,7 +6536,41 @@ async function readStoredAddonBlob(raw) {
6307
6536
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6308
6537
  return result.kind === "missing" ? {} : result.value;
6309
6538
  }
6310
- function createSecretAwareSettings(raw, opts) {
6539
+ function touchesTree(tree, patch) {
6540
+ if (tree.size === 0) return false;
6541
+ for (const key of Object.keys(patch)) {
6542
+ const at = key.indexOf("@");
6543
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6544
+ }
6545
+ return false;
6546
+ }
6547
+ /**
6548
+ * Which top-level keys of each store held markers when last seen. `undefined`
6549
+ * for a store not seen yet: its first write reads it, to be safe.
6550
+ */
6551
+ var MarkerKeyIndex = class {
6552
+ owner;
6553
+ byStore = /* @__PURE__ */ new Map();
6554
+ constructor(owner) {
6555
+ this.owner = owner;
6556
+ }
6557
+ seen(store, blob) {
6558
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6559
+ }
6560
+ wrote(store, patch) {
6561
+ const keys = this.byStore.get(store);
6562
+ if (keys === void 0) return;
6563
+ const now = markerKeysOf(patch, this.owner);
6564
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6565
+ else keys.delete(key);
6566
+ }
6567
+ mayHoldMarkers(store, patch) {
6568
+ const keys = this.byStore.get(store);
6569
+ if (keys === void 0) return true;
6570
+ return Object.keys(patch).some((key) => keys.has(key));
6571
+ }
6572
+ };
6573
+ function createHandle(raw, opts) {
6311
6574
  const chains = /* @__PURE__ */ new Map();
6312
6575
  const serialize = (key, fn) => {
6313
6576
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6318,46 +6581,130 @@ function createSecretAwareSettings(raw, opts) {
6318
6581
  });
6319
6582
  return next;
6320
6583
  };
6321
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6322
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6323
- return serialize(chainKey, async () => {
6584
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6585
+ const resolveRead = async (store, blob) => {
6586
+ index.seen(store, blob);
6587
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6588
+ unresolved: "keep-marker",
6589
+ ownedBy: opts.secrets.owner
6590
+ });
6591
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6592
+ return value;
6593
+ };
6594
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6595
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6596
+ await rawWrite(patch);
6597
+ index.wrote(store, patch);
6598
+ return { changed: true };
6599
+ }
6600
+ return serialize(store, async () => {
6324
6601
  const stored = await readStored();
6602
+ index.seen(store, stored);
6603
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6604
+ const restored = await restoreUnchangedSecrets({
6605
+ patch,
6606
+ stored,
6607
+ secrets: opts.secrets,
6608
+ operatorWrite
6609
+ });
6325
6610
  const result = await transformSecretWrite({
6326
- tree,
6611
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6327
6612
  secrets: opts.secrets,
6328
- patch,
6613
+ patch: restored.patch,
6329
6614
  stored,
6330
6615
  ...scope !== void 0 ? { scope } : {},
6331
- operatorWrite: opts.isOperatorWrite?.() === true
6616
+ operatorWrite
6332
6617
  });
6333
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6618
+ const effective = dropUnchangedKeys(result.patch, stored);
6619
+ const wroteBlob = Object.keys(effective).length > 0;
6620
+ if (wroteBlob) {
6621
+ await rawWrite(effective);
6622
+ index.wrote(store, effective);
6623
+ }
6334
6624
  const { orphaned } = await result.afterWrite();
6335
6625
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6626
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6336
6627
  });
6337
6628
  };
6338
- const wrapped = {
6339
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6340
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6341
- kind: "device",
6342
- deviceId
6343
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6629
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6630
+ const readAddonStoreResult = raw.readAddonStoreResult;
6631
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6632
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6633
+ const overrides = {
6634
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6635
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6636
+ const result = await readAddonStoreResult.call(raw);
6637
+ return result.kind === "value" ? {
6638
+ kind: "value",
6639
+ value: await resolveRead("addon", result.value)
6640
+ } : result;
6641
+ } } : {},
6642
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6643
+ const result = await readAddonStoreKeyResult.call(raw, key);
6644
+ if (result.kind !== "present") return result;
6645
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6646
+ unresolved: "keep-marker",
6647
+ ownedBy: opts.secrets.owner
6648
+ });
6649
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6650
+ return {
6651
+ kind: "present",
6652
+ value: value[key]
6653
+ };
6654
+ } } : {},
6655
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6656
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6657
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6658
+ const out = /* @__PURE__ */ new Map();
6659
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6660
+ return out;
6661
+ } } : {},
6662
+ writeAddonStore: async (patch) => {
6663
+ await writeAddon(patch);
6664
+ },
6665
+ writeDeviceStore: async (deviceId, patch) => {
6666
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6667
+ kind: "device",
6668
+ deviceId
6669
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6670
+ }
6671
+ };
6672
+ return {
6673
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6674
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6675
+ const value = Reflect.get(target, prop, receiver);
6676
+ return typeof value === "function" ? value.bind(target) : value;
6677
+ } }),
6678
+ raw: {
6679
+ readAddonStore: async () => {
6680
+ const blob = await raw.readAddonStore();
6681
+ index.seen("addon", blob);
6682
+ return blob;
6683
+ },
6684
+ readDeviceStore: async (deviceId) => {
6685
+ const blob = await raw.readDeviceStore(deviceId);
6686
+ index.seen(`device:${deviceId}`, blob);
6687
+ return blob;
6688
+ }
6689
+ },
6690
+ writeAddonStore: writeAddon
6344
6691
  };
6345
- return new Proxy(raw, { get(target, prop, receiver) {
6346
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6347
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6348
- const value = Reflect.get(target, prop, receiver);
6349
- return typeof value === "function" ? value.bind(target) : value;
6350
- } });
6351
6692
  }
6352
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6353
- function withSecretAwareSettings(context, opts) {
6693
+ /** The context the addon sees, plus the private raw view and write outcome. */
6694
+ function createSecretAwareContext(context, opts) {
6354
6695
  const raw = context.settings;
6355
- if (raw === void 0) return context;
6356
- const settings = createSecretAwareSettings(raw, opts);
6357
- return new Proxy(context, { get(target, prop, receiver) {
6358
- if (prop === "settings") return settings;
6359
- return Reflect.get(target, prop, receiver);
6360
- } });
6696
+ if (raw === void 0) return {
6697
+ context,
6698
+ handle: null
6699
+ };
6700
+ const handle = createHandle(raw, opts);
6701
+ return {
6702
+ context: new Proxy(context, { get(target, prop, receiver) {
6703
+ if (prop === "settings") return handle.settings;
6704
+ return Reflect.get(target, prop, receiver);
6705
+ } }),
6706
+ handle
6707
+ };
6361
6708
  }
6362
6709
  var LEAF = { kind: "leaf" };
6363
6710
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6532,6 +6879,14 @@ var BaseAddon = class {
6532
6879
  _secretChangeUnsub = null;
6533
6880
  /** >0 while an OPERATOR's settings write is being applied. */
6534
6881
  _operatorWriteDepth = 0;
6882
+ /**
6883
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6884
+ * to the marker-bearing blobs and stays private to this class: the form
6885
+ * hydrate and config resolution need markers, addon code never does.
6886
+ */
6887
+ _secretSettings = null;
6888
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6889
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6535
6890
  constructor(defaults) {
6536
6891
  this.defaults = defaults;
6537
6892
  this._config = { ...defaults };
@@ -6568,13 +6923,21 @@ var BaseAddon = class {
6568
6923
  }
6569
6924
  async initialize(context) {
6570
6925
  const secrets = context.secrets;
6571
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6572
- secrets,
6573
- addonTree: () => this.addonSecretTree(),
6574
- deviceTree: () => this.deviceSecretTree(),
6575
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6576
- isOperatorWrite: () => this._operatorWriteDepth > 0
6577
- }) : context;
6926
+ if (secrets !== void 0) {
6927
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6928
+ secrets,
6929
+ addonTree: () => this.addonSecretTree(),
6930
+ deviceTree: () => this.deviceSecretTree(),
6931
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6932
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6933
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6934
+ });
6935
+ this._ctx = wrapped;
6936
+ this._secretSettings = handle;
6937
+ } else {
6938
+ this._ctx = context;
6939
+ this._secretSettings = null;
6940
+ }
6578
6941
  await this.resolveConfig();
6579
6942
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6580
6943
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6691,11 +7054,8 @@ var BaseAddon = class {
6691
7054
  async getGlobalSettings(overlay, cap, nodeId) {
6692
7055
  const schema = this.globalSettingsSchema(cap);
6693
7056
  if (!schema) return { sections: [] };
6694
- const projected = await this.resolveGlobalStore(nodeId, cap);
6695
- return hydrateSchema(schema, overlay ? {
6696
- ...projected,
6697
- ...overlay
6698
- } : projected, { inlineSecretsAsViews: true });
7057
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7058
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6699
7059
  }
6700
7060
  /**
6701
7061
  * The integration-level view of this addon's settings: exactly the sections
@@ -6740,7 +7100,7 @@ var BaseAddon = class {
6740
7100
  });
6741
7101
  }
6742
7102
  if (sections.length === 0) return null;
6743
- const projected = await this.resolveGlobalStore(nodeId);
7103
+ const projected = await this.readRawProjectedStore(nodeId);
6744
7104
  return hydrateSchema({
6745
7105
  ...schema,
6746
7106
  sections
@@ -6757,12 +7117,50 @@ var BaseAddon = class {
6757
7117
  * the store for custom option logic (option narrowing, value snapping) to
6758
7118
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6759
7119
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7120
+ *
7121
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7122
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7123
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7124
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7125
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7126
+ * resolved blob back is a no-op for every unchanged secret.
6760
7127
  */
6761
7128
  async resolveGlobalStore(nodeId, cap) {
6762
7129
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7130
+ return this.projectForNode(raw, nodeId, cap);
7131
+ }
7132
+ projectForNode(store, nodeId, cap) {
6763
7133
  const keys = this.perNodeKeys(cap);
6764
7134
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6765
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7135
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7136
+ }
7137
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7138
+ async readRawProjectedStore(nodeId, cap) {
7139
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7140
+ return this.projectForNode(raw, nodeId, cap);
7141
+ }
7142
+ /**
7143
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7144
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7145
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7146
+ * its value.
7147
+ */
7148
+ async overlayKeepingMarkers(stored, overlay) {
7149
+ const secrets = this._ctx?.secrets;
7150
+ const merged = {
7151
+ ...stored,
7152
+ ...overlay
7153
+ };
7154
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7155
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7156
+ unresolved: "keep-marker",
7157
+ ownedBy: secrets.owner
7158
+ });
7159
+ for (const key of Object.keys(overlay)) {
7160
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7161
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7162
+ }
7163
+ return merged;
6766
7164
  }
6767
7165
  /**
6768
7166
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6827,8 +7225,12 @@ var BaseAddon = class {
6827
7225
  async clearSecrets(keys, nodeId) {
6828
7226
  const tree = this.addonSecretTree();
6829
7227
  const keychain = this._ctx?.secrets !== void 0;
7228
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6830
7229
  const patch = {};
6831
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7230
+ for (const key of keys) {
7231
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7232
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7233
+ }
6832
7234
  await this.applyGlobalPatch(patch, nodeId);
6833
7235
  }
6834
7236
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6836,7 +7238,11 @@ var BaseAddon = class {
6836
7238
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6837
7239
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6838
7240
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6839
- await this._ctx?.settings?.writeAddonStore(scoped);
7241
+ const handle = this._secretSettings;
7242
+ if (handle !== null) {
7243
+ const { changed } = await handle.writeAddonStore(scoped);
7244
+ if (!changed) return;
7245
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6840
7246
  if (target !== localNode) return;
6841
7247
  await this.resolveConfig();
6842
7248
  await this.onConfigChanged();
@@ -6889,7 +7295,7 @@ var BaseAddon = class {
6889
7295
  async getDeviceSettings(deviceId) {
6890
7296
  const schema = this.deviceSettingsSchema();
6891
7297
  if (!schema) return { sections: [] };
6892
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7298
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6893
7299
  }
6894
7300
  async updateDeviceSettings(deviceId, patch) {
6895
7301
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7061,7 +7467,7 @@ var BaseAddon = class {
7061
7467
  key,
7062
7468
  schema,
7063
7469
  fallback,
7064
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7470
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7065
7471
  write: async (patch) => {
7066
7472
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7067
7473
  },
@@ -7123,6 +7529,23 @@ var BaseAddon = class {
7123
7529
  }
7124
7530
  return value;
7125
7531
  }
7532
+ /**
7533
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7534
+ * keychain the context's own view is already raw.
7535
+ */
7536
+ rawSettings() {
7537
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7538
+ }
7539
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7540
+ logUnresolvedRead(unresolved) {
7541
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7542
+ if (fresh.length === 0) return;
7543
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7544
+ 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) => ({
7545
+ ref: u.ref,
7546
+ reason: u.reason
7547
+ })) } });
7548
+ }
7126
7549
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7127
7550
  scheduleSecretReresolve(delayMs) {
7128
7551
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7149,7 +7572,7 @@ var BaseAddon = class {
7149
7572
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7150
7573
  */
7151
7574
  async readAddonStoreWithRetry() {
7152
- const settings = this._ctx?.settings;
7575
+ const settings = this.rawSettings();
7153
7576
  if (!settings) return {};
7154
7577
  const delaysMs = [
7155
7578
  150,
@@ -9393,6 +9816,278 @@ var CameraSwitchGroupSchema = object({
9393
9816
  fetchedAt: number()
9394
9817
  });
9395
9818
  /**
9819
+ * The trainer contract — what the hub hands the cloud trainer and what it
9820
+ * gets back (cloud training, D805+).
9821
+ *
9822
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
9823
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
9824
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
9825
+ * lines on stdout. These schemas are the hub's half of that boundary; the
9826
+ * trainer's pydantic models (and the JSON Schemas generated from them under
9827
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
9828
+ * change there, in the same piece of work.
9829
+ *
9830
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
9831
+ * orchestrator fills every field of a job spec explicitly.
9832
+ */
9833
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
9834
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
9835
+ /** What the trainer can export. Edge TPU is a later, separate image. */
9836
+ var TrainingExportSchema = _enum([
9837
+ "onnx",
9838
+ "openvino-fp16",
9839
+ "openvino-int8",
9840
+ "coreml-fp16"
9841
+ ]);
9842
+ var FloorsSchema = record(string(), number().min(0).max(1));
9843
+ object({
9844
+ schema: literal(TRAINING_JOB_SCHEMA),
9845
+ jobKey: string().uuid(),
9846
+ target: object({
9847
+ kind: literal("detector"),
9848
+ step: literal("object-detection")
9849
+ }),
9850
+ base: object({
9851
+ modelId: string().min(1),
9852
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
9853
+ weights: string().min(1),
9854
+ imgsz: number().int().positive()
9855
+ }),
9856
+ baseline: object({
9857
+ modelId: string().min(1),
9858
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
9859
+ onnxUrl: string().url(),
9860
+ imgsz: number().int().positive(),
9861
+ floors: FloorsSchema
9862
+ }),
9863
+ dataset: object({
9864
+ versionId: string().min(1),
9865
+ annotationHash: string(),
9866
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
9867
+ sha256: string().regex(/^[0-9a-f]{64}$/)
9868
+ }),
9869
+ split: object({
9870
+ holdoutCameras: array(number().int()),
9871
+ /** When no camera is held out: the last N days of every camera. */
9872
+ holdoutLastDays: number().int().nonnegative(),
9873
+ valFraction: number().min(0).max(.5),
9874
+ seed: number().int()
9875
+ }),
9876
+ hyper: object({
9877
+ epochs: number().int().positive(),
9878
+ batch: number().int().positive(),
9879
+ lr0: number().positive(),
9880
+ /** Layers frozen from the start of the backbone; 0 = none. */
9881
+ freeze: number().int().nonnegative(),
9882
+ patience: number().int().nonnegative(),
9883
+ seed: number().int()
9884
+ }),
9885
+ replay: object({
9886
+ source: literal("coco2017"),
9887
+ count: number().int().nonnegative()
9888
+ }),
9889
+ exports: array(TrainingExportSchema).min(1),
9890
+ calibration: object({ maxFrames: number().int().positive() }),
9891
+ floors: object({
9892
+ minSupport: number().int().positive(),
9893
+ clamp: number().min(0).max(1)
9894
+ }),
9895
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
9896
+ catalog: object({
9897
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
9898
+ name: string().min(1).max(160)
9899
+ })
9900
+ });
9901
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
9902
+ var TrainingResultFileSchema = object({
9903
+ path: string().min(1),
9904
+ bytes: number().int().nonnegative(),
9905
+ sha256: string().regex(/^[0-9a-f]{64}$/),
9906
+ format: _enum([
9907
+ "onnx",
9908
+ "openvino",
9909
+ "coreml",
9910
+ "pt"
9911
+ ]),
9912
+ variant: _enum(["base", "int8"])
9913
+ });
9914
+ var DraftFormatSchema = object({
9915
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
9916
+ url: string().min(1),
9917
+ sizeMB: number().nonnegative(),
9918
+ isDirectory: boolean().optional(),
9919
+ files: array(string()).optional(),
9920
+ runtimes: array(literal("python")).optional(),
9921
+ revision: string().min(1)
9922
+ });
9923
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
9924
+ var TrainingCatalogDraftSchema = object({
9925
+ id: string().min(1),
9926
+ name: string().min(1),
9927
+ description: string(),
9928
+ labels: array(unknown()),
9929
+ inputSize: object({
9930
+ width: number().int().positive(),
9931
+ height: number().int().positive()
9932
+ }),
9933
+ preprocessMode: literal("letterbox"),
9934
+ defaultClassFloors: FloorsSchema,
9935
+ formats: object({
9936
+ onnx: DraftFormatSchema.optional(),
9937
+ openvino: DraftFormatSchema.optional(),
9938
+ coreml: DraftFormatSchema.optional()
9939
+ })
9940
+ });
9941
+ /** One class of one model's holdout report (the eval harness's summary). */
9942
+ var TrainingEvalClassSchema = object({
9943
+ positives: number().int(),
9944
+ floor: number().nullable(),
9945
+ tp: number().int(),
9946
+ fp: number().int(),
9947
+ fn: number().int(),
9948
+ precision: number().nullable(),
9949
+ recall: number().nullable(),
9950
+ ap50: number().nullable(),
9951
+ recallByCamera: record(string(), number().nullable()).optional(),
9952
+ recallByLight: record(string(), number().nullable()).optional(),
9953
+ fpByCamera: record(string(), number()).optional(),
9954
+ smallFound: number().int().optional(),
9955
+ smallTotal: number().int().optional()
9956
+ }).passthrough();
9957
+ var TrainingEvalReportSchema = object({
9958
+ frames: number().int(),
9959
+ classes: record(string(), TrainingEvalClassSchema)
9960
+ }).passthrough();
9961
+ /**
9962
+ * A succeeded result carries every block; a failed one carries the error and
9963
+ * whatever was known by then — the other blocks are ABSENT, not null. The
9964
+ * orchestrator checks the blocks it needs before it trusts a success.
9965
+ */
9966
+ var TrainingResultSchema = object({
9967
+ schema: literal(TRAINING_RESULT_SCHEMA),
9968
+ jobKey: string(),
9969
+ status: _enum(["succeeded", "failed"]),
9970
+ error: object({
9971
+ stage: string(),
9972
+ code: string(),
9973
+ message: string()
9974
+ }).nullable(),
9975
+ trainer: object({
9976
+ version: string(),
9977
+ revision: string()
9978
+ }),
9979
+ toolchain: record(string(), string().nullable()),
9980
+ dataset: object({
9981
+ versionId: string(),
9982
+ annotationHash: string(),
9983
+ sha256: string(),
9984
+ frames: object({
9985
+ train: number().int(),
9986
+ val: number().int(),
9987
+ holdout: number().int()
9988
+ }),
9989
+ holdoutCameras: array(number().int()),
9990
+ replayImages: number().int()
9991
+ }).optional(),
9992
+ training: object({
9993
+ epochsRun: number().int(),
9994
+ bestEpoch: number().int(),
9995
+ bestMap50: number(),
9996
+ bestMap50_95: number(),
9997
+ seconds: number()
9998
+ }).optional(),
9999
+ evaluation: object({
10000
+ holdoutFrames: number().int(),
10001
+ baseline: TrainingEvalReportSchema.nullable(),
10002
+ candidate: TrainingEvalReportSchema.nullable(),
10003
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10004
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10005
+ map50: record(string(), number().nullable())
10006
+ }).optional(),
10007
+ floors: object({
10008
+ baseline: FloorsSchema,
10009
+ candidate: FloorsSchema,
10010
+ candidateInt8: FloorsSchema.nullable(),
10011
+ notes: array(string())
10012
+ }).optional(),
10013
+ int8: object({
10014
+ kept: boolean(),
10015
+ map50Fp16: number().nullable(),
10016
+ map50Int8: number().nullable(),
10017
+ reason: string().nullable()
10018
+ }).optional(),
10019
+ exportsDropped: array(object({
10020
+ export: string(),
10021
+ reason: string()
10022
+ })).optional(),
10023
+ files: array(TrainingResultFileSchema).optional(),
10024
+ bundle: object({
10025
+ path: literal("bundle.tar"),
10026
+ bytes: number().int().nonnegative(),
10027
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10028
+ }).nullable().optional(),
10029
+ catalogDraft: object({
10030
+ base: TrainingCatalogDraftSchema,
10031
+ int8: TrainingCatalogDraftSchema.nullable()
10032
+ }).nullable().optional(),
10033
+ licence: string()
10034
+ });
10035
+ var TrainingStageSchema = _enum([
10036
+ "prepare",
10037
+ "replay",
10038
+ "train",
10039
+ "eval",
10040
+ "export",
10041
+ "package"
10042
+ ]);
10043
+ var EventBase = {
10044
+ v: literal(1),
10045
+ ts: number()
10046
+ };
10047
+ discriminatedUnion("type", [
10048
+ object({
10049
+ ...EventBase,
10050
+ type: literal("stage"),
10051
+ stage: TrainingStageSchema
10052
+ }),
10053
+ object({
10054
+ ...EventBase,
10055
+ type: literal("epoch"),
10056
+ epoch: number().int(),
10057
+ epochs: number().int(),
10058
+ boxLoss: number().nullable().optional(),
10059
+ map50: number().nullable().optional(),
10060
+ map50_95: number().nullable().optional(),
10061
+ etaSec: number().nullable().optional()
10062
+ }),
10063
+ object({
10064
+ ...EventBase,
10065
+ type: literal("metric"),
10066
+ name: string(),
10067
+ value: number()
10068
+ }),
10069
+ object({
10070
+ ...EventBase,
10071
+ type: literal("artifact"),
10072
+ path: string(),
10073
+ bytes: number(),
10074
+ sha256: string()
10075
+ }),
10076
+ object({
10077
+ ...EventBase,
10078
+ type: literal("done"),
10079
+ status: _enum(["succeeded", "failed"]),
10080
+ resultSha256: string().nullable().optional()
10081
+ }),
10082
+ object({
10083
+ ...EventBase,
10084
+ type: literal("error"),
10085
+ stage: string(),
10086
+ code: string(),
10087
+ message: string()
10088
+ })
10089
+ ]);
10090
+ /**
9396
10091
  * What the gate decided about a birth, from the CALLER's point of view.
9397
10092
  *
9398
10093
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11720,7 +12415,9 @@ var AddonHttpRouteSchema = object({
11720
12415
  "authenticated",
11721
12416
  "admin"
11722
12417
  ]).optional(),
11723
- description: string().optional()
12418
+ description: string().optional(),
12419
+ /** The hub limits this route per client address before the handler runs. */
12420
+ rateLimit: _enum(["auth"]).optional()
11724
12421
  });
11725
12422
  /**
11726
12423
  * Cross-process route invocation envelope. The hub captures the
@@ -12425,6 +13122,37 @@ var BackupDestinationInfoSchema = object({
12425
13122
  lastError: string().optional()
12426
13123
  });
12427
13124
  /**
13125
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13126
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13127
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13128
+ * with it off — which restores without a key.
13129
+ */
13130
+ var BackupArchiveEncryptionSchema = object({
13131
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13132
+ scheme: string(),
13133
+ /** 16 hex — the backup key whose secret restores this archive. */
13134
+ keyId: string()
13135
+ });
13136
+ /**
13137
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13138
+ * one new archives are encrypted to, and the retired ones older archives
13139
+ * still need. The secret key is shown once, at `setupEncryption`.
13140
+ */
13141
+ var BackupEncryptionStatusSchema = object({
13142
+ enabled: boolean(),
13143
+ active: object({
13144
+ keyId: string(),
13145
+ publicKey: string(),
13146
+ createdAt: number()
13147
+ }).nullable(),
13148
+ /** Every key ever set up, newest first. */
13149
+ keys: array(object({
13150
+ keyId: string(),
13151
+ createdAt: number(),
13152
+ retiredAt: number().nullable()
13153
+ })).readonly()
13154
+ });
13155
+ /**
12428
13156
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12429
13157
  * Same shape the destination drill-in renders. Sourced from the per-
12430
13158
  * location `manifests.json` (no per-archive tarball read required).
@@ -12436,7 +13164,9 @@ var BackupArchiveEntrySchema = object({
12436
13164
  sizeBytes: number(),
12437
13165
  label: string().optional(),
12438
13166
  /** Top-level locations included in the archive (db, addons, tls, …). */
12439
- locations: array(string()).readonly()
13167
+ locations: array(string()).readonly(),
13168
+ /** Present when the archive is encrypted; restore then needs that key. */
13169
+ encryption: BackupArchiveEncryptionSchema.optional()
12440
13170
  });
12441
13171
  var BackupEntrySchema = object({
12442
13172
  id: string(),
@@ -12445,7 +13175,8 @@ var BackupEntrySchema = object({
12445
13175
  label: string().optional(),
12446
13176
  createdAt: number(),
12447
13177
  sizeBytes: number(),
12448
- locations: array(string()).optional()
13178
+ locations: array(string()).optional(),
13179
+ encryption: BackupArchiveEncryptionSchema.optional()
12449
13180
  });
12450
13181
  var ArchiveEntrySchema = object({
12451
13182
  path: string(),
@@ -12634,10 +13365,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12634
13365
  * this list and skips entries whose path doesn't start with
12635
13366
  * any of them.
12636
13367
  */
12637
- locations: array(string()).optional()
13368
+ locations: array(string()).optional(),
13369
+ /**
13370
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13371
+ * one). The archive is decrypted into the hub's private staging
13372
+ * before the restart; the key is not stored. A wrong or missing key
13373
+ * is refused before the archive is downloaded.
13374
+ */
13375
+ backupSecretKey: string().optional()
12638
13376
  }), _void(), {
12639
13377
  kind: "mutation",
12640
13378
  auth: "admin"
13379
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13380
+ keyId: string(),
13381
+ secretKey: string(),
13382
+ publicKey: string(),
13383
+ createdAt: number(),
13384
+ replacedKeyId: string().nullable()
13385
+ }), {
13386
+ kind: "mutation",
13387
+ auth: "admin"
13388
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13389
+ kind: "mutation",
13390
+ auth: "admin"
13391
+ }), method(object({ backupSecretKey: string() }), object({
13392
+ valid: boolean(),
13393
+ keyId: string().nullable(),
13394
+ /** The hub knows this key (active or retired). */
13395
+ known: boolean(),
13396
+ /** It is the key new archives are encrypted to. */
13397
+ active: boolean(),
13398
+ error: string().optional()
13399
+ }), {
13400
+ kind: "mutation",
13401
+ auth: "admin"
12641
13402
  }), method(object({
12642
13403
  destinationId: string(),
12643
13404
  backupId: string()
@@ -14261,7 +15022,60 @@ var CustomModelDescriptorSchema = object({
14261
15022
  stepId: string(),
14262
15023
  entry: ModelCatalogEntrySchema
14263
15024
  });
14264
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15025
+ /** One regular file of an imported bundle, as the producer measured it. */
15026
+ var ModelBundleFileSchema = object({
15027
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15028
+ path: string().min(1),
15029
+ bytes: number().int().nonnegative(),
15030
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15031
+ });
15032
+ var ImportModelBundleInputSchema = object({
15033
+ /** The registry provider that keeps the model (Model Studio). */
15034
+ addonId: string(),
15035
+ stepId: string().min(1),
15036
+ /**
15037
+ * The catalog rows to register, complete, every format URL already
15038
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15039
+ * bundle may carry several rows (a base and its INT8 variant).
15040
+ */
15041
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15042
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15043
+ bundle: object({
15044
+ ticket: PeerBytesTicketSchema,
15045
+ bytes: number().int().positive(),
15046
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15047
+ }),
15048
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15049
+ files: array(ModelBundleFileSchema).min(1).max(64),
15050
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15051
+ distribute: boolean()
15052
+ });
15053
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15054
+ kind: literal("imported"),
15055
+ modelIds: array(string()).readonly(),
15056
+ distributed: array(object({
15057
+ modelId: string(),
15058
+ nodeId: string(),
15059
+ format: _enum(MODEL_FORMATS),
15060
+ ok: boolean(),
15061
+ error: string().optional()
15062
+ })).readonly()
15063
+ }), object({
15064
+ kind: literal("refused"),
15065
+ reason: _enum([
15066
+ "transfer-failed",
15067
+ "checksum-mismatch",
15068
+ "bundle-mismatch",
15069
+ "invalid-entry",
15070
+ "id-taken"
15071
+ ]),
15072
+ detail: string()
15073
+ })]);
15074
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15075
+ kind: "mutation",
15076
+ auth: "admin",
15077
+ timeoutMs: 30 * 6e4
15078
+ });
14265
15079
  /**
14266
15080
  * Query filter for settings-store collections.
14267
15081
  */
@@ -14740,6 +15554,35 @@ var KeychainKeySourceSchema = object({
14740
15554
  */
14741
15555
  sharesBackupWithDatabase: boolean()
14742
15556
  });
15557
+ /**
15558
+ * One keychain reset, as the Secrets page reports it until the operator
15559
+ * acknowledges it. Never a value: refs, counts and table names only.
15560
+ */
15561
+ var KeychainResetRecordSchema = object({
15562
+ id: string(),
15563
+ at: number(),
15564
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15565
+ actor: string(),
15566
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15567
+ lockedReason: string().nullable(),
15568
+ /** Values moved into the archive table (ciphertext under the lost key). */
15569
+ archived: number().int(),
15570
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15571
+ archivedCollection: string().nullable(),
15572
+ /**
15573
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15574
+ * so the archive can still be opened if the lost master key turns up.
15575
+ */
15576
+ archivedKeysCollection: string().nullable(),
15577
+ /**
15578
+ * `system-settings` keys whose marker the reset cleared — the cluster
15579
+ * secret's: a marker left pointing at an archived value would refuse every
15580
+ * agent forever (D797).
15581
+ */
15582
+ clearedSettingsKeys: array(string()).readonly(),
15583
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15584
+ acknowledgedAt: number().nullable()
15585
+ });
14743
15586
  var KeychainStatusSchema = object({
14744
15587
  keychain: KeychainStateSchema,
14745
15588
  /** The source of the master key in use; `null` while locked. */
@@ -14757,7 +15600,9 @@ var KeychainStatusSchema = object({
14757
15600
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
14758
15601
  retiredWraps: number().int(),
14759
15602
  recoveryKeyDownloadedAt: number().nullable(),
14760
- secretCount: number().int()
15603
+ secretCount: number().int(),
15604
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15605
+ lastReset: KeychainResetRecordSchema.nullable()
14761
15606
  });
14762
15607
  /**
14763
15608
  * Whether a stored value is still pointed at by its owner's settings.
@@ -14779,13 +15624,14 @@ var KeychainAuditActionSchema = _enum([
14779
15624
  "download-recovery-key",
14780
15625
  "delete-orphans",
14781
15626
  "reset",
15627
+ "acknowledge-reset",
14782
15628
  "initialize"
14783
15629
  ]);
14784
15630
  var KeychainAuditEntrySchema = object({
14785
15631
  id: string(),
14786
15632
  at: number(),
14787
15633
  action: KeychainAuditActionSchema,
14788
- /** `addon:<id>` | `user:<id>` | `system`. */
15634
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
14789
15635
  actor: string(),
14790
15636
  ref: string().nullable(),
14791
15637
  detail: string().nullable()
@@ -14851,6 +15697,13 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
14851
15697
  kind: "mutation",
14852
15698
  auth: "admin",
14853
15699
  caller: "required"
15700
+ }), method(object({}), object({
15701
+ reset: KeychainResetRecordSchema.nullable(),
15702
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15703
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15704
+ kind: "mutation",
15705
+ auth: "admin",
15706
+ caller: "required"
14854
15707
  });
14855
15708
  method(_void(), object({
14856
15709
  id: string(),
@@ -17496,7 +18349,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17496
18349
  * `login-method` — collection cap through which auth addons contribute
17497
18350
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17498
18351
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17499
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18352
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17500
18353
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17501
18354
  * procedure aggregates them for the unauthenticated login page.
17502
18355
  *
@@ -17504,8 +18357,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17504
18357
  *
17505
18358
  * - `redirect` — a declarative button. The login page renders a generic
17506
18359
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17507
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17508
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18360
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17509
18361
  * login page needs NO change.
17510
18362
  *
17511
18363
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -17524,8 +18376,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17524
18376
  * decision.
17525
18377
  *
17526
18378
  * Every contribution carries a `stage`:
17527
- * - `primary` — shown on the first credentials screen (OIDC /
17528
- * magic-link buttons; a future usernameless passkey).
18379
+ * - `primary` — shown on the first credentials screen (OIDC
18380
+ * buttons; a usernameless passkey).
17529
18381
  * - `second-factor` — shown AFTER the password leg, gated on the
17530
18382
  * returned `factors` (passkey-as-2FA today).
17531
18383
  *
@@ -17552,7 +18404,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17552
18404
  * The provider names an external identity a signed-in user can link to
17553
18405
  * their own account (D782): `auth.listLinkableProviders` /
17554
18406
  * `beginExternalLink` offer exactly the redirect methods that set this,
17555
- * whatever their id. Absent / false — a login button only (magic-link).
18407
+ * whatever their id. Absent / false — a login button only.
17556
18408
  */
17557
18409
  linkable: boolean().optional()
17558
18410
  }),
@@ -21369,8 +22221,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21369
22221
  * `super_admin` — collapsed onto the single boolean because every
21370
22222
  * non-admin caller is governed by the same scope-check rules; the
21371
22223
  * distinction was only ever used to route role-specific procedures
21372
- * which we no longer have. Agents are admin sessions issued via
21373
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22224
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21374
22225
  * with `isAdmin: false` + an explicit scope list.
21375
22226
  */
21376
22227
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -24065,6 +24916,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24065
24916
  kind: "mutation",
24066
24917
  auth: "admin",
24067
24918
  timeoutMs: 60 * 6e4
24919
+ }), method(object({
24920
+ filter: RetrainExportFilterSchema,
24921
+ layout: RetrainExportLayoutSchema
24922
+ }), object({
24923
+ ticket: PeerBytesTicketSchema,
24924
+ frames: number().int(),
24925
+ annotations: number().int()
24926
+ }), {
24927
+ kind: "mutation",
24928
+ auth: "admin",
24929
+ timeoutMs: 12e4
24068
24930
  }), method(object({
24069
24931
  selection: RetrainDatasetSelectionSchema,
24070
24932
  completeOnly: boolean().optional()
@@ -27633,8 +28495,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
27633
28495
  * `smtp-provider` — pluggable email delivery surface.
27634
28496
  *
27635
28497
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
27636
- * one for transactional / one for notifications). Consumers (magic-link,
27637
- * notifier addons, …) walk the collection and pick the first
28498
+ * one for transactional / one for notifications). Consumers (notifier
28499
+ * addons, …) walk the collection and pick the first
27638
28500
  * ready provider OR target a specific addonId.
27639
28501
  *
27640
28502
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -27813,7 +28675,7 @@ targets: array(object({
27813
28675
  })));
27814
28676
  /**
27815
28677
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
27816
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
28678
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
27817
28679
  * carrying the post-callback claims before redirecting back to
27818
28680
  * `/api/auth/sso/finish`.
27819
28681
  *
@@ -27876,7 +28738,14 @@ var SsoBridgeClaimsSchema = object({
27876
28738
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
27877
28739
  * subject is unique only per issuer, so a link is bound to it.
27878
28740
  */
27879
- issuer: string().optional()
28741
+ issuer: string().optional(),
28742
+ /**
28743
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
28744
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
28745
+ * request to present the matching cookie — a login bridge is useless in
28746
+ * any other browser.
28747
+ */
28748
+ browserBinding: string().optional()
27880
28749
  });
27881
28750
  method(object({
27882
28751
  claims: SsoBridgeClaimsSchema,
@@ -37796,16 +38665,6 @@ var ApiKeySummarySchema = object({
37796
38665
  createdAt: number(),
37797
38666
  lastUsedAt: number().optional()
37798
38667
  });
37799
- var CreateApiKeyInputSchema = object({
37800
- label: string(),
37801
- isAdmin: boolean().default(false),
37802
- allowedProviders: union([array(string()), literal("*")]).optional(),
37803
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
37804
- });
37805
- var CreateApiKeyResultSchema = object({
37806
- token: string(),
37807
- record: ApiKeySummarySchema
37808
- });
37809
38668
  var ScopedTokenSummarySchema = object({
37810
38669
  id: string(),
37811
38670
  userId: string(),
@@ -37904,17 +38763,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
37904
38763
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
37905
38764
  kind: "mutation",
37906
38765
  access: "view"
37907
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
37908
- kind: "mutation",
37909
- auth: "admin",
37910
- access: "create"
37911
- }), method(object({ id: string() }), object({ success: literal(true) }), {
38766
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
37912
38767
  kind: "mutation",
37913
38768
  auth: "admin",
37914
38769
  access: "delete"
37915
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
37916
- kind: "mutation",
37917
- access: "view"
37918
38770
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
37919
38771
  kind: "mutation",
37920
38772
  auth: "admin",
@@ -37988,15 +38840,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
37988
38840
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
37989
38841
  userId: string(),
37990
38842
  issuer: string()
37991
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
37992
- userId: string(),
37993
- issuer: string().min(1),
37994
- label: string().optional()
37995
- }), object({ success: literal(true) }), {
37996
- kind: "mutation",
37997
- auth: "admin",
37998
- access: "create"
37999
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
38843
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
38000
38844
  kind: "mutation",
38001
38845
  auth: "admin",
38002
38846
  access: "delete"
@@ -38391,6 +39235,451 @@ DeviceType.Camera, method(object({
38391
39235
  detection: array(ZoneRuleSchema).readonly(),
38392
39236
  package: array(ZoneRuleSchema).readonly()
38393
39237
  });
39238
+ /**
39239
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
39240
+ *
39241
+ * A thin, mockable translation layer: it knows how to run a container with a
39242
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
39243
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
39244
+ * those are the `training` orchestrator's (D805). Every rule written there
39245
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
39246
+ * manifest entry and nothing else.
39247
+ *
39248
+ * Collection, routed by the `addonId` in every single-row input (the `llm` /
39249
+ * `notification-output` posture); `describe` concat-fans across providers.
39250
+ * Every method is `admin`: these spend money.
39251
+ *
39252
+ * Every cloud object a provider creates is tagged with the orchestrator's
39253
+ * `jobKey`, so a retried submit finds the job it already started instead of
39254
+ * starting a second GPU, and `listJobs` can find orphans.
39255
+ *
39256
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
39257
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
39258
+ * ticket the provider mints (D613).
39259
+ */
39260
+ var TrainingGpuOptionSchema = object({
39261
+ id: string(),
39262
+ label: string(),
39263
+ /** List price, USD per GPU-hour, before any region multiplier. */
39264
+ usdPerHour: number().nonnegative(),
39265
+ vramGb: number().nonnegative()
39266
+ });
39267
+ var TrainingRegionOptionSchema = object({
39268
+ /** `''` = any region (the provider's choice). */
39269
+ id: string(),
39270
+ label: string(),
39271
+ priceMultiplier: number().positive()
39272
+ });
39273
+ /**
39274
+ * The provider's per-account settings, as the orchestrator reads them. They
39275
+ * live in the PROVIDER addon's settings (operator decision 2026-10-08: they
39276
+ * depend on the user's account), never hard-coded in the orchestrator.
39277
+ */
39278
+ var TrainingProviderDefaultsSchema = object({
39279
+ gpuType: string(),
39280
+ region: string(),
39281
+ costCapUsd: number().nonnegative(),
39282
+ maxRuntimeSec: number().int().positive(),
39283
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
39284
+ failedDatasetGraceHours: number().nonnegative()
39285
+ });
39286
+ var TrainingProviderDescriptorSchema = object({
39287
+ addonId: string(),
39288
+ /** `modal`, `runpod`, `fake`, … */
39289
+ kind: string(),
39290
+ label: string(),
39291
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
39292
+ regions: array(TrainingRegionOptionSchema).readonly(),
39293
+ maxDatasetBytes: number().int().positive(),
39294
+ maxRuntimeSec: number().int().positive(),
39295
+ freeTierNote: string().optional(),
39296
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
39297
+ dataResidencyNote: string(),
39298
+ /** Credentials are present — never the values. */
39299
+ configured: boolean(),
39300
+ defaults: TrainingProviderDefaultsSchema
39301
+ });
39302
+ var TrainingCredentialCheckSchema = object({
39303
+ ok: boolean(),
39304
+ /** Workspace / account name, when the provider says. */
39305
+ account: string().optional(),
39306
+ reason: _enum([
39307
+ "missing",
39308
+ "invalid",
39309
+ "forbidden",
39310
+ "network",
39311
+ "quota"
39312
+ ]).optional(),
39313
+ detail: string().optional()
39314
+ });
39315
+ var ProviderJobStateSchema = _enum([
39316
+ "pending",
39317
+ "starting",
39318
+ "running",
39319
+ "succeeded",
39320
+ "failed",
39321
+ "cancelled",
39322
+ "lost"
39323
+ ]);
39324
+ var ProviderJobStatusSchema = object({
39325
+ jobKey: string(),
39326
+ providerJobId: string().optional(),
39327
+ state: ProviderJobStateSchema,
39328
+ startedAt: number().optional(),
39329
+ endedAt: number().optional(),
39330
+ exitCode: number().int().optional(),
39331
+ failureReason: string().optional(),
39332
+ gpuType: string(),
39333
+ region: string().optional(),
39334
+ billedSeconds: number().nonnegative(),
39335
+ costUsd: number().nonnegative(),
39336
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
39337
+ costIsEstimate: boolean(),
39338
+ lastFetchedAt: number()
39339
+ });
39340
+ /**
39341
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
39342
+ * image its own way (Modal builds the published Dockerfile at that revision;
39343
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
39344
+ * in `result.json`.
39345
+ */
39346
+ var TrainerSourceRefSchema = object({
39347
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
39348
+ repo: string().min(1),
39349
+ /** A commit sha (never a branch) — the job must be reproducible. */
39350
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
39351
+ });
39352
+ var JobRef = {
39353
+ addonId: string(),
39354
+ jobKey: string().uuid()
39355
+ };
39356
+ var TrainingLogLineSchema = object({
39357
+ ts: number(),
39358
+ text: string()
39359
+ });
39360
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
39361
+ kind: "mutation",
39362
+ auth: "admin",
39363
+ timeoutMs: 3e4
39364
+ }), method(object({
39365
+ addonId: string(),
39366
+ gpuType: string(),
39367
+ region: string(),
39368
+ datasetBytes: number().int().nonnegative(),
39369
+ gpuSecondsLow: number().nonnegative(),
39370
+ gpuSecondsHigh: number().nonnegative()
39371
+ }), object({
39372
+ usdLow: number().nonnegative(),
39373
+ usdHigh: number().nonnegative(),
39374
+ notes: array(string()).readonly()
39375
+ }), { auth: "admin" }), method(object({
39376
+ ...JobRef,
39377
+ ticket: PeerBytesTicketSchema
39378
+ }), object({
39379
+ bytes: number().int().nonnegative(),
39380
+ sha256: string()
39381
+ }), {
39382
+ kind: "mutation",
39383
+ auth: "admin",
39384
+ timeoutMs: 120 * 6e4
39385
+ }), method(object({
39386
+ ...JobRef,
39387
+ trainer: TrainerSourceRefSchema,
39388
+ jobSpecJson: string().min(2).max(64e3),
39389
+ gpuType: string(),
39390
+ region: string(),
39391
+ maxRuntimeSec: number().int().positive()
39392
+ }), ProviderJobStatusSchema, {
39393
+ kind: "mutation",
39394
+ auth: "admin",
39395
+ timeoutMs: 30 * 6e4
39396
+ }), method(object(JobRef), ProviderJobStatusSchema, {
39397
+ auth: "admin",
39398
+ timeoutMs: 6e4
39399
+ }), method(object({
39400
+ ...JobRef,
39401
+ cursor: string().optional(),
39402
+ max: number().int().min(1).max(500)
39403
+ }), object({
39404
+ lines: array(TrainingLogLineSchema).readonly(),
39405
+ cursor: string()
39406
+ }), {
39407
+ auth: "admin",
39408
+ timeoutMs: 6e4
39409
+ }), method(object(JobRef), object({ ok: literal(true) }), {
39410
+ kind: "mutation",
39411
+ auth: "admin",
39412
+ timeoutMs: 6e4
39413
+ }), method(object(JobRef), object({
39414
+ found: boolean(),
39415
+ text: string().optional()
39416
+ }), {
39417
+ kind: "mutation",
39418
+ auth: "admin",
39419
+ timeoutMs: 5 * 6e4
39420
+ }), method(object({
39421
+ ...JobRef,
39422
+ path: _enum(["bundle.tar"])
39423
+ }), object({ ticket: PeerBytesTicketSchema }), {
39424
+ kind: "mutation",
39425
+ auth: "admin",
39426
+ timeoutMs: 5 * 6e4
39427
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
39428
+ kind: "mutation",
39429
+ auth: "admin",
39430
+ timeoutMs: 5 * 6e4
39431
+ }), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
39432
+ auth: "admin",
39433
+ timeoutMs: 2 * 6e4
39434
+ });
39435
+ /**
39436
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
39437
+ * provided by `addon-training`.
39438
+ *
39439
+ * It owns what every provider must agree on, written once:
39440
+ *
39441
+ * - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
39442
+ * live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
39443
+ * the export plan) and reaches this store through the five row methods
39444
+ * below, so the Retrain page and the export did not change.
39445
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
39446
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
39447
+ * - **The return flow.** Verified artefacts → Model Studio
39448
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
39449
+ * rollback. Nothing is ever registered automatically.
39450
+ *
39451
+ * Every method is `admin`.
39452
+ */
39453
+ /** A version WITH its frame list — what the export and a job read. */
39454
+ var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
39455
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
39456
+ var TrainingBaseModelSchema = object({
39457
+ modelId: string(),
39458
+ label: string(),
39459
+ weights: string(),
39460
+ imgsz: number().int(),
39461
+ baselineOnnxUrl: string(),
39462
+ baselineFloors: record(string(), number()),
39463
+ /** The base the fleet runs most — the UI's default. */
39464
+ recommended: boolean()
39465
+ });
39466
+ var TrainingPresetSchema = _enum([
39467
+ "quick",
39468
+ "standard",
39469
+ "thorough"
39470
+ ]);
39471
+ var TrainingJobRequestSchema = object({
39472
+ datasetVersionId: string().min(1),
39473
+ /** The `training-provider` addon that runs it. */
39474
+ addonId: string().min(1),
39475
+ gpuType: string().min(1),
39476
+ region: string(),
39477
+ baseModelId: string().min(1),
39478
+ preset: TrainingPresetSchema,
39479
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
39480
+ freeze: number().int().nonnegative().nullable(),
39481
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
39482
+ holdoutCameras: array(number().int()).nullable()
39483
+ });
39484
+ var TrainingSplitPlanSchema = object({
39485
+ holdoutCameras: array(number().int()).readonly(),
39486
+ /** Used when no camera is held out: the last N days of every camera. */
39487
+ holdoutLastDays: number().int().nonnegative(),
39488
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
39489
+ holdoutSupport: record(string(), number().int()).nullable(),
39490
+ trainSubjects: number().int()
39491
+ });
39492
+ var TrainingRefusalReasonSchema = _enum([
39493
+ "unknown-dataset",
39494
+ "unknown-provider",
39495
+ "provider-not-configured",
39496
+ "unknown-base-model",
39497
+ "unknown-gpu",
39498
+ "dataset-too-large",
39499
+ "no-training-subjects",
39500
+ "job-already-running"
39501
+ ]);
39502
+ var TrainingJobPlanSchema = object({
39503
+ refusal: object({
39504
+ reason: TrainingRefusalReasonSchema,
39505
+ detail: string()
39506
+ }).nullable(),
39507
+ warnings: array(string()).readonly(),
39508
+ split: TrainingSplitPlanSchema.nullable(),
39509
+ estimate: object({
39510
+ datasetBytes: number().int(),
39511
+ uploadMinutesAt20Mbps: number(),
39512
+ gpuSecondsLow: number(),
39513
+ gpuSecondsHigh: number(),
39514
+ usdLow: number(),
39515
+ usdHigh: number(),
39516
+ notes: array(string()).readonly()
39517
+ }).nullable(),
39518
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
39519
+ defaults: object({
39520
+ maxCostUsd: number(),
39521
+ maxRuntimeSec: number().int()
39522
+ }).nullable(),
39523
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
39524
+ dataNotice: string()
39525
+ });
39526
+ /**
39527
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
39528
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
39529
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
39530
+ * result lives after the operator acted on it.
39531
+ */
39532
+ var TrainingJobStateSchema = _enum([
39533
+ "uploading",
39534
+ "submitted",
39535
+ "starting",
39536
+ "running",
39537
+ "collecting",
39538
+ "ready",
39539
+ "registered",
39540
+ "canary",
39541
+ "failed",
39542
+ "cancelling",
39543
+ "cancelled",
39544
+ "lost",
39545
+ "expired",
39546
+ "discarded"
39547
+ ]);
39548
+ var TrainingFailureReasonSchema = _enum([
39549
+ "cost-cap",
39550
+ "runtime-cap",
39551
+ "upload-failed",
39552
+ "submit-failed",
39553
+ "trainer-failed",
39554
+ "result-invalid",
39555
+ "checksum-mismatch",
39556
+ "fetch-failed",
39557
+ "provider-error",
39558
+ "hub-restart-during-upload"
39559
+ ]);
39560
+ var TrainingProgressPointSchema = object({
39561
+ epoch: number().int(),
39562
+ map50: number().nullable(),
39563
+ map50_95: number().nullable()
39564
+ });
39565
+ var TrainingCanarySchema = object({
39566
+ deviceIds: array(number().int()).readonly(),
39567
+ since: number(),
39568
+ /** Every override the canary replaced, exactly, so rollback restores it. */
39569
+ previous: array(object({
39570
+ deviceId: number().int(),
39571
+ nodeId: string(),
39572
+ deviceKey: string(),
39573
+ patch: object({
39574
+ modelId: string().optional(),
39575
+ settings: record(string(), unknown()).readonly().optional()
39576
+ }).nullable()
39577
+ })).readonly()
39578
+ });
39579
+ var TrainingJobSchema = object({
39580
+ id: string(),
39581
+ idempotencyKey: string(),
39582
+ name: string(),
39583
+ createdAt: number(),
39584
+ updatedAt: number(),
39585
+ state: TrainingJobStateSchema,
39586
+ stage: TrainingStageSchema.nullable(),
39587
+ failure: object({
39588
+ reason: TrainingFailureReasonSchema,
39589
+ stage: string().nullable(),
39590
+ detail: string()
39591
+ }).nullable(),
39592
+ request: TrainingJobRequestSchema,
39593
+ maxCostUsd: number().nonnegative(),
39594
+ maxRuntimeSec: number().int().positive(),
39595
+ trainer: TrainerSourceRefSchema,
39596
+ datasetLayout: RetrainExportLayoutSchema,
39597
+ dataset: object({
39598
+ bytes: number().int(),
39599
+ sha256: string(),
39600
+ uploadedAt: number()
39601
+ }).nullable(),
39602
+ split: TrainingSplitPlanSchema,
39603
+ provider: object({
39604
+ state: ProviderJobStateSchema.nullable(),
39605
+ providerJobId: string().nullable(),
39606
+ startedAt: number().nullable(),
39607
+ endedAt: number().nullable(),
39608
+ billedSeconds: number(),
39609
+ costUsd: number(),
39610
+ costIsEstimate: boolean(),
39611
+ lastPolledAt: number().nullable()
39612
+ }),
39613
+ progress: object({
39614
+ epoch: number().int().nullable(),
39615
+ epochs: number().int().nullable(),
39616
+ etaSec: number().nullable(),
39617
+ series: array(TrainingProgressPointSchema).readonly()
39618
+ }),
39619
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
39620
+ logTail: array(string()).readonly(),
39621
+ logCursor: string().nullable(),
39622
+ artifacts: object({
39623
+ bundleBytes: number().int(),
39624
+ bundleSha256: string(),
39625
+ fetchedAt: number(),
39626
+ /** When the staged artefacts are deleted from the hub. */
39627
+ expiresAt: number()
39628
+ }).nullable(),
39629
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
39630
+ cloudDatasetDeletedAt: number().nullable(),
39631
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
39632
+ cloudCleanupDueAt: number().nullable(),
39633
+ /** Model ids registered from this job (base, and int8 when kept). */
39634
+ registeredModelIds: array(string()).readonly(),
39635
+ canary: TrainingCanarySchema.nullable()
39636
+ });
39637
+ var IdInput = object({ id: string().min(1) });
39638
+ method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
39639
+ kind: "mutation",
39640
+ auth: "admin"
39641
+ }), method(IdInput, TrainingDatasetVersionRowSchema.nullable(), { auth: "admin" }), method(object({}), array(RetrainDatasetVersionSchema).readonly(), { auth: "admin" }), method(object({ name: string() }), object({ id: string().nullable() }), { auth: "admin" }), method(IdInput, object({ removed: boolean() }), {
39642
+ kind: "mutation",
39643
+ auth: "admin"
39644
+ }), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
39645
+ auth: "admin",
39646
+ timeoutMs: 6e4
39647
+ }), method(TrainingJobRequestSchema.extend({
39648
+ name: string().min(1).max(120),
39649
+ maxCostUsd: number().positive(),
39650
+ maxRuntimeSec: number().int().positive(),
39651
+ idempotencyKey: string().min(8).max(80)
39652
+ }), discriminatedUnion("kind", [object({
39653
+ kind: literal("started"),
39654
+ job: TrainingJobSchema
39655
+ }), object({
39656
+ kind: literal("refused"),
39657
+ reason: TrainingRefusalReasonSchema,
39658
+ detail: string()
39659
+ })]), {
39660
+ kind: "mutation",
39661
+ auth: "admin",
39662
+ timeoutMs: 12e4
39663
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
39664
+ kind: "mutation",
39665
+ auth: "admin",
39666
+ timeoutMs: 12e4
39667
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
39668
+ kind: "mutation",
39669
+ auth: "admin",
39670
+ timeoutMs: 30 * 6e4
39671
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
39672
+ kind: "mutation",
39673
+ auth: "admin",
39674
+ timeoutMs: 12e4
39675
+ }), method(IdInput, TrainingJobSchema, {
39676
+ kind: "mutation",
39677
+ auth: "admin",
39678
+ timeoutMs: 12e4
39679
+ }), method(IdInput, TrainingJobSchema, {
39680
+ kind: "mutation",
39681
+ auth: "admin"
39682
+ });
38394
39683
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
38395
39684
  Object.freeze({
38396
39685
  person: .5,
@@ -39014,6 +40303,12 @@ Object.freeze({
39014
40303
  addonId: null,
39015
40304
  access: "create"
39016
40305
  },
40306
+ "backup.checkBackupKey": {
40307
+ capName: "backup",
40308
+ capScope: "system",
40309
+ addonId: null,
40310
+ access: "create"
40311
+ },
39017
40312
  "backup.delete": {
39018
40313
  capName: "backup",
39019
40314
  capScope: "system",
@@ -39026,6 +40321,18 @@ Object.freeze({
39026
40321
  addonId: null,
39027
40322
  access: "delete"
39028
40323
  },
40324
+ "backup.disableEncryption": {
40325
+ capName: "backup",
40326
+ capScope: "system",
40327
+ addonId: null,
40328
+ access: "create"
40329
+ },
40330
+ "backup.getEncryption": {
40331
+ capName: "backup",
40332
+ capScope: "system",
40333
+ addonId: null,
40334
+ access: "view"
40335
+ },
39029
40336
  "backup.getEntries": {
39030
40337
  capName: "backup",
39031
40338
  capScope: "system",
@@ -39080,6 +40387,12 @@ Object.freeze({
39080
40387
  addonId: null,
39081
40388
  access: "create"
39082
40389
  },
40390
+ "backup.setupEncryption": {
40391
+ capName: "backup",
40392
+ capScope: "system",
40393
+ addonId: null,
40394
+ access: "create"
40395
+ },
39083
40396
  "backup.trigger": {
39084
40397
  capName: "backup",
39085
40398
  capScope: "system",
@@ -39632,6 +40945,12 @@ Object.freeze({
39632
40945
  addonId: null,
39633
40946
  access: "create"
39634
40947
  },
40948
+ "customModelRegistry.importModelBundle": {
40949
+ capName: "custom-model-registry",
40950
+ capScope: "system",
40951
+ addonId: null,
40952
+ access: "create"
40953
+ },
39635
40954
  "customModelRegistry.listModels": {
39636
40955
  capName: "custom-model-registry",
39637
40956
  capScope: "system",
@@ -41072,6 +42391,12 @@ Object.freeze({
41072
42391
  addonId: null,
41073
42392
  access: "view"
41074
42393
  },
42394
+ "keychainAdmin.acknowledgeReset": {
42395
+ capName: "keychain-admin",
42396
+ capScope: "system",
42397
+ addonId: null,
42398
+ access: "create"
42399
+ },
41075
42400
  "keychainAdmin.deleteOrphans": {
41076
42401
  capName: "keychain-admin",
41077
42402
  capScope: "system",
@@ -41108,6 +42433,12 @@ Object.freeze({
41108
42433
  addonId: null,
41109
42434
  access: "delete"
41110
42435
  },
42436
+ "keychainAdmin.resetReport": {
42437
+ capName: "keychain-admin",
42438
+ capScope: "system",
42439
+ addonId: null,
42440
+ access: "delete"
42441
+ },
41111
42442
  "keychainAdmin.reveal": {
41112
42443
  capName: "keychain-admin",
41113
42444
  capScope: "system",
@@ -42854,6 +44185,12 @@ Object.freeze({
42854
44185
  addonId: null,
42855
44186
  access: "view"
42856
44187
  },
44188
+ "pipelineAnalytics.offerRetrainArchive": {
44189
+ capName: "pipeline-analytics",
44190
+ capScope: "device",
44191
+ addonId: null,
44192
+ access: "create"
44193
+ },
42857
44194
  "pipelineAnalytics.ownersWithMedia": {
42858
44195
  capName: "pipeline-analytics",
42859
44196
  capScope: "device",
@@ -45392,6 +46729,174 @@ Object.freeze({
45392
46729
  addonId: null,
45393
46730
  access: "view"
45394
46731
  },
46732
+ "training.canaryResult": {
46733
+ capName: "training",
46734
+ capScope: "system",
46735
+ addonId: null,
46736
+ access: "create"
46737
+ },
46738
+ "training.cancelJob": {
46739
+ capName: "training",
46740
+ capScope: "system",
46741
+ addonId: null,
46742
+ access: "create"
46743
+ },
46744
+ "training.discardResult": {
46745
+ capName: "training",
46746
+ capScope: "system",
46747
+ addonId: null,
46748
+ access: "create"
46749
+ },
46750
+ "training.findDatasetVersionIdByName": {
46751
+ capName: "training",
46752
+ capScope: "system",
46753
+ addonId: null,
46754
+ access: "view"
46755
+ },
46756
+ "training.getDatasetVersion": {
46757
+ capName: "training",
46758
+ capScope: "system",
46759
+ addonId: null,
46760
+ access: "view"
46761
+ },
46762
+ "training.getJob": {
46763
+ capName: "training",
46764
+ capScope: "system",
46765
+ addonId: null,
46766
+ access: "view"
46767
+ },
46768
+ "training.getJobResult": {
46769
+ capName: "training",
46770
+ capScope: "system",
46771
+ addonId: null,
46772
+ access: "view"
46773
+ },
46774
+ "training.listBaseModels": {
46775
+ capName: "training",
46776
+ capScope: "system",
46777
+ addonId: null,
46778
+ access: "view"
46779
+ },
46780
+ "training.listDatasetVersions": {
46781
+ capName: "training",
46782
+ capScope: "system",
46783
+ addonId: null,
46784
+ access: "view"
46785
+ },
46786
+ "training.listJobs": {
46787
+ capName: "training",
46788
+ capScope: "system",
46789
+ addonId: null,
46790
+ access: "view"
46791
+ },
46792
+ "training.planJob": {
46793
+ capName: "training",
46794
+ capScope: "system",
46795
+ addonId: null,
46796
+ access: "view"
46797
+ },
46798
+ "training.putDatasetVersion": {
46799
+ capName: "training",
46800
+ capScope: "system",
46801
+ addonId: null,
46802
+ access: "create"
46803
+ },
46804
+ "training.registerResult": {
46805
+ capName: "training",
46806
+ capScope: "system",
46807
+ addonId: null,
46808
+ access: "create"
46809
+ },
46810
+ "training.removeDatasetVersion": {
46811
+ capName: "training",
46812
+ capScope: "system",
46813
+ addonId: null,
46814
+ access: "delete"
46815
+ },
46816
+ "training.rollbackCanary": {
46817
+ capName: "training",
46818
+ capScope: "system",
46819
+ addonId: null,
46820
+ access: "create"
46821
+ },
46822
+ "training.startJob": {
46823
+ capName: "training",
46824
+ capScope: "system",
46825
+ addonId: null,
46826
+ access: "create"
46827
+ },
46828
+ "trainingProvider.cancelJob": {
46829
+ capName: "training-provider",
46830
+ capScope: "system",
46831
+ addonId: null,
46832
+ access: "create"
46833
+ },
46834
+ "trainingProvider.cleanupJob": {
46835
+ capName: "training-provider",
46836
+ capScope: "system",
46837
+ addonId: null,
46838
+ access: "create"
46839
+ },
46840
+ "trainingProvider.describe": {
46841
+ capName: "training-provider",
46842
+ capScope: "system",
46843
+ addonId: null,
46844
+ access: "view"
46845
+ },
46846
+ "trainingProvider.estimateJob": {
46847
+ capName: "training-provider",
46848
+ capScope: "system",
46849
+ addonId: null,
46850
+ access: "view"
46851
+ },
46852
+ "trainingProvider.getJob": {
46853
+ capName: "training-provider",
46854
+ capScope: "system",
46855
+ addonId: null,
46856
+ access: "view"
46857
+ },
46858
+ "trainingProvider.listJobEvents": {
46859
+ capName: "training-provider",
46860
+ capScope: "system",
46861
+ addonId: null,
46862
+ access: "view"
46863
+ },
46864
+ "trainingProvider.listJobs": {
46865
+ capName: "training-provider",
46866
+ capScope: "system",
46867
+ addonId: null,
46868
+ access: "view"
46869
+ },
46870
+ "trainingProvider.offerArtifact": {
46871
+ capName: "training-provider",
46872
+ capScope: "system",
46873
+ addonId: null,
46874
+ access: "create"
46875
+ },
46876
+ "trainingProvider.readResult": {
46877
+ capName: "training-provider",
46878
+ capScope: "system",
46879
+ addonId: null,
46880
+ access: "create"
46881
+ },
46882
+ "trainingProvider.submitJob": {
46883
+ capName: "training-provider",
46884
+ capScope: "system",
46885
+ addonId: null,
46886
+ access: "create"
46887
+ },
46888
+ "trainingProvider.uploadDataset": {
46889
+ capName: "training-provider",
46890
+ capScope: "system",
46891
+ addonId: null,
46892
+ access: "create"
46893
+ },
46894
+ "trainingProvider.validateCredentials": {
46895
+ capName: "training-provider",
46896
+ capScope: "system",
46897
+ addonId: null,
46898
+ access: "create"
46899
+ },
45395
46900
  "turnProvider.getTurnServers": {
45396
46901
  capName: "turn-provider",
45397
46902
  capScope: "system",
@@ -45416,12 +46921,6 @@ Object.freeze({
45416
46921
  addonId: null,
45417
46922
  access: "create"
45418
46923
  },
45419
- "userManagement.createApiKey": {
45420
- capName: "user-management",
45421
- capScope: "system",
45422
- addonId: null,
45423
- access: "create"
45424
- },
45425
46924
  "userManagement.createScopedToken": {
45426
46925
  capName: "user-management",
45427
46926
  capScope: "system",
@@ -45458,12 +46957,6 @@ Object.freeze({
45458
46957
  addonId: null,
45459
46958
  access: "view"
45460
46959
  },
45461
- "userManagement.linkExternalIdentity": {
45462
- capName: "user-management",
45463
- capScope: "system",
45464
- addonId: null,
45465
- access: "create"
45466
- },
45467
46960
  "userManagement.listApiKeys": {
45468
46961
  capName: "user-management",
45469
46962
  capScope: "system",
@@ -45566,12 +47059,6 @@ Object.freeze({
45566
47059
  addonId: null,
45567
47060
  access: "create"
45568
47061
  },
45569
- "userManagement.validateApiKey": {
45570
- capName: "user-management",
45571
- capScope: "system",
45572
- addonId: null,
45573
- access: "view"
45574
- },
45575
47062
  "userManagement.validateCredentials": {
45576
47063
  capName: "user-management",
45577
47064
  capScope: "system",
@@ -49685,6 +51172,11 @@ Object.freeze({
49685
51172
  form: "single",
49686
51173
  optional: false
49687
51174
  }],
51175
+ "training.canaryResult": [{
51176
+ name: "deviceIds",
51177
+ form: "array",
51178
+ optional: false
51179
+ }],
49688
51180
  "update.getStatus": [{
49689
51181
  name: "deviceId",
49690
51182
  form: "single",
@@ -50985,7 +52477,7 @@ var AgentUIAddon = class extends BaseAddon {
50985
52477
  capability: adminUiCapability,
50986
52478
  provider: {
50987
52479
  getStaticDir: async () => ({ staticDir: path.resolve(__dirname) }),
50988
- getVersion: async () => ({ version: "1.2.194" })
52480
+ getVersion: async () => ({ version: "1.2.196" })
50989
52481
  }
50990
52482
  }];
50991
52483
  }