@camstack/addon-terminal 0.1.128 → 0.1.129

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +1622 -130
  2. package/dist/addon.mjs +1622 -130
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -5409,7 +5409,7 @@ var ZodIssueCode = {
5409
5409
  var ZodFirstPartyTypeKind;
5410
5410
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5411
5411
  //#endregion
5412
- //#region ../types/dist/sleep-DujUvOcb.mjs
5412
+ //#region ../types/dist/sleep-r3RWkGVx.mjs
5413
5413
  /**
5414
5414
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5415
5415
  * window to float samples (D455).
@@ -5526,7 +5526,7 @@ function isKeychainStoredField(field) {
5526
5526
  var SECRET_CLEAR = { $secretClear: true };
5527
5527
  /** The `'***'` token D634 redaction writes for non-admins. */
5528
5528
  var LEGACY_DEVICE_REDACTION = "***";
5529
- function isRecord$1(value) {
5529
+ function isRecord$2(value) {
5530
5530
  return typeof value === "object" && value !== null && !Array.isArray(value);
5531
5531
  }
5532
5532
  function makeSecretMarker(ref) {
@@ -5537,12 +5537,12 @@ function makeSecretMarker(ref) {
5537
5537
  }
5538
5538
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5539
5539
  function isSecretMarker(value) {
5540
- if (!isRecord$1(value)) return false;
5540
+ if (!isRecord$2(value)) return false;
5541
5541
  const ref = value["$secret"];
5542
5542
  return typeof ref === "string" && ref.length > 0;
5543
5543
  }
5544
5544
  function isSecretClear(value) {
5545
- return isRecord$1(value) && value["$secretClear"] === true;
5545
+ return isRecord$2(value) && value["$secretClear"] === true;
5546
5546
  }
5547
5547
  /**
5548
5548
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6058,6 +6058,13 @@ function globalSecretScope() {
6058
6058
  function encodeSegment(value) {
6059
6059
  return encodeURIComponent(value);
6060
6060
  }
6061
+ function decodeSegment(value) {
6062
+ try {
6063
+ return decodeURIComponent(value);
6064
+ } catch {
6065
+ return null;
6066
+ }
6067
+ }
6061
6068
  /**
6062
6069
  * The field path of a value inside an array item, addressed by the item's id:
6063
6070
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6066,6 +6073,75 @@ function encodeSegment(value) {
6066
6073
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6067
6074
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6068
6075
  }
6076
+ function parseScope(segments) {
6077
+ switch (segments[0]) {
6078
+ case "global": return {
6079
+ scope: GLOBAL_SCOPE,
6080
+ used: 1
6081
+ };
6082
+ case "node": {
6083
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6084
+ return nodeId === null || nodeId.length === 0 ? null : {
6085
+ scope: {
6086
+ kind: "node",
6087
+ nodeId
6088
+ },
6089
+ used: 2
6090
+ };
6091
+ }
6092
+ case "device": {
6093
+ const raw = segments[1];
6094
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6095
+ return {
6096
+ scope: {
6097
+ kind: "device",
6098
+ deviceId: Number(raw)
6099
+ },
6100
+ used: 2
6101
+ };
6102
+ }
6103
+ case "integration": {
6104
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6105
+ return id === null || id.length === 0 ? null : {
6106
+ scope: {
6107
+ kind: "integration",
6108
+ integrationId: id
6109
+ },
6110
+ used: 2
6111
+ };
6112
+ }
6113
+ case "row": {
6114
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6115
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6116
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6117
+ return {
6118
+ scope: {
6119
+ kind: "row",
6120
+ collection,
6121
+ rowId
6122
+ },
6123
+ used: 3
6124
+ };
6125
+ }
6126
+ default: return null;
6127
+ }
6128
+ }
6129
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6130
+ function parseSecretRef(ref) {
6131
+ if (!ref.startsWith("secret://")) return null;
6132
+ const segments = ref.slice(9).split("/");
6133
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6134
+ if (owner === null || owner.length === 0) return null;
6135
+ const parsed = parseScope(segments.slice(1));
6136
+ if (parsed === null) return null;
6137
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6138
+ if (fieldPath.length === 0) return null;
6139
+ return {
6140
+ owner,
6141
+ scope: parsed.scope,
6142
+ fieldPath
6143
+ };
6144
+ }
6069
6145
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6070
6146
  var KeychainWriteRefusedError = class extends Error {
6071
6147
  fieldPath;
@@ -6076,7 +6152,7 @@ var KeychainWriteRefusedError = class extends Error {
6076
6152
  }
6077
6153
  };
6078
6154
  var KEEP = { kind: "keep" };
6079
- function isRecord(value) {
6155
+ function isRecord$1(value) {
6080
6156
  return typeof value === "object" && value !== null && !Array.isArray(value);
6081
6157
  }
6082
6158
  function defaultMintId() {
@@ -6089,7 +6165,7 @@ function collectSecretMarkerRefs(value, out = []) {
6089
6165
  return out;
6090
6166
  }
6091
6167
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6092
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6168
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6093
6169
  return out;
6094
6170
  }
6095
6171
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6144,7 +6220,7 @@ function rowId(row, idKey) {
6144
6220
  return null;
6145
6221
  }
6146
6222
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6147
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6223
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6148
6224
  if (!Array.isArray(incoming)) {
6149
6225
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6150
6226
  return {
@@ -6160,7 +6236,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6160
6236
  const kept = /* @__PURE__ */ new Set();
6161
6237
  const rows = [];
6162
6238
  for (const row of incoming) {
6163
- if (!isRecord(row)) {
6239
+ if (!isRecord$1(row)) {
6164
6240
  rows.push(row);
6165
6241
  continue;
6166
6242
  }
@@ -6185,7 +6261,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6185
6261
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6186
6262
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6187
6263
  case "object": {
6188
- if (!isRecord(incoming)) {
6264
+ if (!isRecord$1(incoming)) {
6189
6265
  if (incoming === void 0) return KEEP;
6190
6266
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6191
6267
  return {
@@ -6193,7 +6269,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6193
6269
  value: incoming
6194
6270
  };
6195
6271
  }
6196
- const storedObj = isRecord(stored) ? stored : {};
6272
+ const storedObj = isRecord$1(stored) ? stored : {};
6197
6273
  return {
6198
6274
  kind: "value",
6199
6275
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6252,12 +6328,19 @@ async function transformSecretWrite(input) {
6252
6328
  }
6253
6329
  };
6254
6330
  }
6331
+ /** Is `ref` one of `owner`'s refs? */
6332
+ function isSecretRefOwnedBy(ref, owner) {
6333
+ return parseSecretRef(ref)?.owner === owner;
6334
+ }
6255
6335
  /**
6256
6336
  * Replace every marker in `value` with its keychain value. Returns the SAME
6257
6337
  * reference when there is no marker (no allocation, no keychain call).
6258
6338
  */
6259
- async function resolveSecretMarkers(value, secrets) {
6260
- const refs = collectSecretMarkerRefs(value);
6339
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6340
+ const keepMarker = options.unresolved === "keep-marker";
6341
+ const owner = options.ownedBy;
6342
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6343
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6261
6344
  if (refs.length === 0) return {
6262
6345
  value,
6263
6346
  unresolved: []
@@ -6281,10 +6364,18 @@ async function resolveSecretMarkers(value, secrets) {
6281
6364
  }
6282
6365
  const substitute = (v) => {
6283
6366
  if (isSecretMarker(v)) {
6367
+ if (!inScope(v.$secret)) return {
6368
+ keep: true,
6369
+ value: v
6370
+ };
6284
6371
  const answer = answers[v.$secret];
6285
- return answer?.kind === "value" ? {
6372
+ if (answer?.kind === "value") return {
6286
6373
  keep: true,
6287
6374
  value: answer.value
6375
+ };
6376
+ return keepMarker ? {
6377
+ keep: true,
6378
+ value: v
6288
6379
  } : {
6289
6380
  keep: false,
6290
6381
  value: void 0
@@ -6301,7 +6392,7 @@ async function resolveSecretMarkers(value, secrets) {
6301
6392
  value: items
6302
6393
  };
6303
6394
  }
6304
- if (isRecord(v)) {
6395
+ if (isRecord$1(v)) {
6305
6396
  const out = {};
6306
6397
  for (const [k, child] of Object.entries(v)) {
6307
6398
  const s = substitute(child);
@@ -6322,14 +6413,152 @@ async function resolveSecretMarkers(value, secrets) {
6322
6413
  unresolved
6323
6414
  };
6324
6415
  }
6325
- function touchesTree(tree, patch) {
6326
- if (tree.size === 0) return false;
6327
- for (const key of Object.keys(patch)) {
6328
- const at = key.indexOf("@");
6329
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6416
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6417
+ var SecretOverwriteRefusedError = class extends Error {
6418
+ ref;
6419
+ reason;
6420
+ constructor(ref, reason) {
6421
+ 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.`);
6422
+ this.ref = ref;
6423
+ this.reason = reason;
6424
+ this.name = "SecretOverwriteRefusedError";
6425
+ }
6426
+ };
6427
+ function isRecord(value) {
6428
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6429
+ }
6430
+ function resolvedValue(pass, marker) {
6431
+ const answer = pass.answers[marker.$secret];
6432
+ return answer?.kind === "value" ? answer.value : null;
6433
+ }
6434
+ async function atMarker(pass, incoming, stored) {
6435
+ if (incoming === null) return stored;
6436
+ if (typeof incoming !== "string") return incoming;
6437
+ if (incoming === resolvedValue(pass, stored)) return stored;
6438
+ const intent = classifySecretWrite(incoming);
6439
+ if (intent.kind !== "set") return stored;
6440
+ const ref = stored.$secret;
6441
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6442
+ const answer = pass.answers[ref];
6443
+ 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);
6444
+ try {
6445
+ await pass.secrets.put(ref, intent.value);
6446
+ } catch (err) {
6447
+ throw new KeychainWriteRefusedError(ref, err);
6448
+ }
6449
+ pass.changedRefs.push(ref);
6450
+ return stored;
6451
+ }
6452
+ function inArray(pass, incoming, stored) {
6453
+ return incoming.map((item, index) => {
6454
+ const twin = stored[index];
6455
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6456
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6457
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6458
+ return item;
6459
+ });
6460
+ }
6461
+ function inArrayRow(pass, incoming, stored) {
6462
+ const out = { ...incoming };
6463
+ for (const [key, value] of Object.entries(incoming)) {
6464
+ const twin = stored[key];
6465
+ if (isSecretMarker(twin)) {
6466
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6467
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6468
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6469
+ }
6470
+ return out;
6471
+ }
6472
+ async function walk(pass, incoming, stored) {
6473
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6474
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6475
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6476
+ const out = { ...incoming };
6477
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6478
+ return out;
6479
+ }
6480
+ /** Restore markers a write-back carries as values. See the file doc. */
6481
+ async function restoreUnchangedSecrets(input) {
6482
+ const refs = [];
6483
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6484
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6485
+ if (owned.length === 0) return {
6486
+ patch: input.patch,
6487
+ changedRefs: []
6488
+ };
6489
+ const pass = {
6490
+ secrets: input.secrets,
6491
+ answers: await input.secrets.resolve([...new Set(owned)]),
6492
+ operatorWrite: input.operatorWrite,
6493
+ changedRefs: []
6494
+ };
6495
+ const out = {};
6496
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6497
+ return {
6498
+ patch: out,
6499
+ changedRefs: pass.changedRefs
6500
+ };
6501
+ }
6502
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6503
+ function isJsonEqual(a, b) {
6504
+ if (Object.is(a, b)) return true;
6505
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6506
+ if (isRecord(a) && isRecord(b)) {
6507
+ const keys = Object.keys(a);
6508
+ if (keys.length !== Object.keys(b).length) return false;
6509
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6330
6510
  }
6331
6511
  return false;
6332
6512
  }
6513
+ /** The patch without the keys whose value already equals the stored one. */
6514
+ function dropUnchangedKeys(patch, stored) {
6515
+ const out = {};
6516
+ for (const [key, value] of Object.entries(patch)) {
6517
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6518
+ out[key] = value;
6519
+ }
6520
+ return out;
6521
+ }
6522
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6523
+ function markerKeysOf(blob, owner) {
6524
+ const keys = /* @__PURE__ */ new Set();
6525
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6526
+ return keys;
6527
+ }
6528
+ function nodeFromStored(value, owner) {
6529
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6530
+ if (!isRecord(value)) return null;
6531
+ const children = /* @__PURE__ */ new Map();
6532
+ for (const [key, child] of Object.entries(value)) {
6533
+ const node = nodeFromStored(child, owner);
6534
+ if (node !== null) children.set(key, node);
6535
+ }
6536
+ return children.size > 0 ? {
6537
+ kind: "object",
6538
+ children
6539
+ } : null;
6540
+ }
6541
+ /**
6542
+ * The declared secret tree, widened by every place the STORED blob holds a
6543
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6544
+ * never declared: Wyze before b4906cec6) still gets the save path's
6545
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6546
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6547
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6548
+ * builtin that keeps another addon's marker (device-manager) never takes it
6549
+ * over.
6550
+ */
6551
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6552
+ const added = /* @__PURE__ */ new Map();
6553
+ for (const key of keys) {
6554
+ const at = key.indexOf("@");
6555
+ const base = at > 0 ? key.slice(0, at) : key;
6556
+ if (declared.has(base) || added.has(base)) continue;
6557
+ const node = nodeFromStored(stored[key], owner);
6558
+ if (node !== null) added.set(base, node);
6559
+ }
6560
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6561
+ }
6333
6562
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6334
6563
  async function readStoredAddonBlob(raw) {
6335
6564
  const threeWay = raw.readAddonStoreResult;
@@ -6338,7 +6567,41 @@ async function readStoredAddonBlob(raw) {
6338
6567
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6339
6568
  return result.kind === "missing" ? {} : result.value;
6340
6569
  }
6341
- function createSecretAwareSettings(raw, opts) {
6570
+ function touchesTree(tree, patch) {
6571
+ if (tree.size === 0) return false;
6572
+ for (const key of Object.keys(patch)) {
6573
+ const at = key.indexOf("@");
6574
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6575
+ }
6576
+ return false;
6577
+ }
6578
+ /**
6579
+ * Which top-level keys of each store held markers when last seen. `undefined`
6580
+ * for a store not seen yet: its first write reads it, to be safe.
6581
+ */
6582
+ var MarkerKeyIndex = class {
6583
+ owner;
6584
+ byStore = /* @__PURE__ */ new Map();
6585
+ constructor(owner) {
6586
+ this.owner = owner;
6587
+ }
6588
+ seen(store, blob) {
6589
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6590
+ }
6591
+ wrote(store, patch) {
6592
+ const keys = this.byStore.get(store);
6593
+ if (keys === void 0) return;
6594
+ const now = markerKeysOf(patch, this.owner);
6595
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6596
+ else keys.delete(key);
6597
+ }
6598
+ mayHoldMarkers(store, patch) {
6599
+ const keys = this.byStore.get(store);
6600
+ if (keys === void 0) return true;
6601
+ return Object.keys(patch).some((key) => keys.has(key));
6602
+ }
6603
+ };
6604
+ function createHandle(raw, opts) {
6342
6605
  const chains = /* @__PURE__ */ new Map();
6343
6606
  const serialize = (key, fn) => {
6344
6607
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6349,46 +6612,130 @@ function createSecretAwareSettings(raw, opts) {
6349
6612
  });
6350
6613
  return next;
6351
6614
  };
6352
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6353
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6354
- return serialize(chainKey, async () => {
6615
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6616
+ const resolveRead = async (store, blob) => {
6617
+ index.seen(store, blob);
6618
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6619
+ unresolved: "keep-marker",
6620
+ ownedBy: opts.secrets.owner
6621
+ });
6622
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6623
+ return value;
6624
+ };
6625
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6626
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6627
+ await rawWrite(patch);
6628
+ index.wrote(store, patch);
6629
+ return { changed: true };
6630
+ }
6631
+ return serialize(store, async () => {
6355
6632
  const stored = await readStored();
6633
+ index.seen(store, stored);
6634
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6635
+ const restored = await restoreUnchangedSecrets({
6636
+ patch,
6637
+ stored,
6638
+ secrets: opts.secrets,
6639
+ operatorWrite
6640
+ });
6356
6641
  const result = await transformSecretWrite({
6357
- tree,
6642
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6358
6643
  secrets: opts.secrets,
6359
- patch,
6644
+ patch: restored.patch,
6360
6645
  stored,
6361
6646
  ...scope !== void 0 ? { scope } : {},
6362
- operatorWrite: opts.isOperatorWrite?.() === true
6647
+ operatorWrite
6363
6648
  });
6364
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6649
+ const effective = dropUnchangedKeys(result.patch, stored);
6650
+ const wroteBlob = Object.keys(effective).length > 0;
6651
+ if (wroteBlob) {
6652
+ await rawWrite(effective);
6653
+ index.wrote(store, effective);
6654
+ }
6365
6655
  const { orphaned } = await result.afterWrite();
6366
6656
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6657
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6367
6658
  });
6368
6659
  };
6369
- const wrapped = {
6370
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6371
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6372
- kind: "device",
6373
- deviceId
6374
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6660
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6661
+ const readAddonStoreResult = raw.readAddonStoreResult;
6662
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6663
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6664
+ const overrides = {
6665
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6666
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6667
+ const result = await readAddonStoreResult.call(raw);
6668
+ return result.kind === "value" ? {
6669
+ kind: "value",
6670
+ value: await resolveRead("addon", result.value)
6671
+ } : result;
6672
+ } } : {},
6673
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6674
+ const result = await readAddonStoreKeyResult.call(raw, key);
6675
+ if (result.kind !== "present") return result;
6676
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6677
+ unresolved: "keep-marker",
6678
+ ownedBy: opts.secrets.owner
6679
+ });
6680
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6681
+ return {
6682
+ kind: "present",
6683
+ value: value[key]
6684
+ };
6685
+ } } : {},
6686
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6687
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6688
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6689
+ const out = /* @__PURE__ */ new Map();
6690
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6691
+ return out;
6692
+ } } : {},
6693
+ writeAddonStore: async (patch) => {
6694
+ await writeAddon(patch);
6695
+ },
6696
+ writeDeviceStore: async (deviceId, patch) => {
6697
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6698
+ kind: "device",
6699
+ deviceId
6700
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6701
+ }
6702
+ };
6703
+ return {
6704
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6705
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6706
+ const value = Reflect.get(target, prop, receiver);
6707
+ return typeof value === "function" ? value.bind(target) : value;
6708
+ } }),
6709
+ raw: {
6710
+ readAddonStore: async () => {
6711
+ const blob = await raw.readAddonStore();
6712
+ index.seen("addon", blob);
6713
+ return blob;
6714
+ },
6715
+ readDeviceStore: async (deviceId) => {
6716
+ const blob = await raw.readDeviceStore(deviceId);
6717
+ index.seen(`device:${deviceId}`, blob);
6718
+ return blob;
6719
+ }
6720
+ },
6721
+ writeAddonStore: writeAddon
6375
6722
  };
6376
- return new Proxy(raw, { get(target, prop, receiver) {
6377
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6378
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6379
- const value = Reflect.get(target, prop, receiver);
6380
- return typeof value === "function" ? value.bind(target) : value;
6381
- } });
6382
6723
  }
6383
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6384
- function withSecretAwareSettings(context, opts) {
6724
+ /** The context the addon sees, plus the private raw view and write outcome. */
6725
+ function createSecretAwareContext(context, opts) {
6385
6726
  const raw = context.settings;
6386
- if (raw === void 0) return context;
6387
- const settings = createSecretAwareSettings(raw, opts);
6388
- return new Proxy(context, { get(target, prop, receiver) {
6389
- if (prop === "settings") return settings;
6390
- return Reflect.get(target, prop, receiver);
6391
- } });
6727
+ if (raw === void 0) return {
6728
+ context,
6729
+ handle: null
6730
+ };
6731
+ const handle = createHandle(raw, opts);
6732
+ return {
6733
+ context: new Proxy(context, { get(target, prop, receiver) {
6734
+ if (prop === "settings") return handle.settings;
6735
+ return Reflect.get(target, prop, receiver);
6736
+ } }),
6737
+ handle
6738
+ };
6392
6739
  }
6393
6740
  var LEAF = { kind: "leaf" };
6394
6741
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6563,6 +6910,14 @@ var BaseAddon = class {
6563
6910
  _secretChangeUnsub = null;
6564
6911
  /** >0 while an OPERATOR's settings write is being applied. */
6565
6912
  _operatorWriteDepth = 0;
6913
+ /**
6914
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6915
+ * to the marker-bearing blobs and stays private to this class: the form
6916
+ * hydrate and config resolution need markers, addon code never does.
6917
+ */
6918
+ _secretSettings = null;
6919
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6920
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6566
6921
  constructor(defaults) {
6567
6922
  this.defaults = defaults;
6568
6923
  this._config = { ...defaults };
@@ -6599,13 +6954,21 @@ var BaseAddon = class {
6599
6954
  }
6600
6955
  async initialize(context) {
6601
6956
  const secrets = context.secrets;
6602
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6603
- secrets,
6604
- addonTree: () => this.addonSecretTree(),
6605
- deviceTree: () => this.deviceSecretTree(),
6606
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6607
- isOperatorWrite: () => this._operatorWriteDepth > 0
6608
- }) : context;
6957
+ if (secrets !== void 0) {
6958
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6959
+ secrets,
6960
+ addonTree: () => this.addonSecretTree(),
6961
+ deviceTree: () => this.deviceSecretTree(),
6962
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6963
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6964
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6965
+ });
6966
+ this._ctx = wrapped;
6967
+ this._secretSettings = handle;
6968
+ } else {
6969
+ this._ctx = context;
6970
+ this._secretSettings = null;
6971
+ }
6609
6972
  await this.resolveConfig();
6610
6973
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6611
6974
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6722,11 +7085,8 @@ var BaseAddon = class {
6722
7085
  async getGlobalSettings(overlay, cap, nodeId) {
6723
7086
  const schema = this.globalSettingsSchema(cap);
6724
7087
  if (!schema) return { sections: [] };
6725
- const projected = await this.resolveGlobalStore(nodeId, cap);
6726
- return hydrateSchema(schema, overlay ? {
6727
- ...projected,
6728
- ...overlay
6729
- } : projected, { inlineSecretsAsViews: true });
7088
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7089
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6730
7090
  }
6731
7091
  /**
6732
7092
  * The integration-level view of this addon's settings: exactly the sections
@@ -6771,7 +7131,7 @@ var BaseAddon = class {
6771
7131
  });
6772
7132
  }
6773
7133
  if (sections.length === 0) return null;
6774
- const projected = await this.resolveGlobalStore(nodeId);
7134
+ const projected = await this.readRawProjectedStore(nodeId);
6775
7135
  return hydrateSchema({
6776
7136
  ...schema,
6777
7137
  sections
@@ -6788,12 +7148,50 @@ var BaseAddon = class {
6788
7148
  * the store for custom option logic (option narrowing, value snapping) to
6789
7149
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6790
7150
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7151
+ *
7152
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7153
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7154
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7155
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7156
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7157
+ * resolved blob back is a no-op for every unchanged secret.
6791
7158
  */
6792
7159
  async resolveGlobalStore(nodeId, cap) {
6793
7160
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7161
+ return this.projectForNode(raw, nodeId, cap);
7162
+ }
7163
+ projectForNode(store, nodeId, cap) {
6794
7164
  const keys = this.perNodeKeys(cap);
6795
7165
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6796
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7166
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7167
+ }
7168
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7169
+ async readRawProjectedStore(nodeId, cap) {
7170
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7171
+ return this.projectForNode(raw, nodeId, cap);
7172
+ }
7173
+ /**
7174
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7175
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7176
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7177
+ * its value.
7178
+ */
7179
+ async overlayKeepingMarkers(stored, overlay) {
7180
+ const secrets = this._ctx?.secrets;
7181
+ const merged = {
7182
+ ...stored,
7183
+ ...overlay
7184
+ };
7185
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7186
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7187
+ unresolved: "keep-marker",
7188
+ ownedBy: secrets.owner
7189
+ });
7190
+ for (const key of Object.keys(overlay)) {
7191
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7192
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7193
+ }
7194
+ return merged;
6797
7195
  }
6798
7196
  /**
6799
7197
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6858,8 +7256,12 @@ var BaseAddon = class {
6858
7256
  async clearSecrets(keys, nodeId) {
6859
7257
  const tree = this.addonSecretTree();
6860
7258
  const keychain = this._ctx?.secrets !== void 0;
7259
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6861
7260
  const patch = {};
6862
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7261
+ for (const key of keys) {
7262
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7263
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7264
+ }
6863
7265
  await this.applyGlobalPatch(patch, nodeId);
6864
7266
  }
6865
7267
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6867,7 +7269,11 @@ var BaseAddon = class {
6867
7269
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6868
7270
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6869
7271
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6870
- await this._ctx?.settings?.writeAddonStore(scoped);
7272
+ const handle = this._secretSettings;
7273
+ if (handle !== null) {
7274
+ const { changed } = await handle.writeAddonStore(scoped);
7275
+ if (!changed) return;
7276
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6871
7277
  if (target !== localNode) return;
6872
7278
  await this.resolveConfig();
6873
7279
  await this.onConfigChanged();
@@ -6920,7 +7326,7 @@ var BaseAddon = class {
6920
7326
  async getDeviceSettings(deviceId) {
6921
7327
  const schema = this.deviceSettingsSchema();
6922
7328
  if (!schema) return { sections: [] };
6923
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7329
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6924
7330
  }
6925
7331
  async updateDeviceSettings(deviceId, patch) {
6926
7332
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7092,7 +7498,7 @@ var BaseAddon = class {
7092
7498
  key,
7093
7499
  schema,
7094
7500
  fallback,
7095
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7501
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7096
7502
  write: async (patch) => {
7097
7503
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7098
7504
  },
@@ -7154,6 +7560,23 @@ var BaseAddon = class {
7154
7560
  }
7155
7561
  return value;
7156
7562
  }
7563
+ /**
7564
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7565
+ * keychain the context's own view is already raw.
7566
+ */
7567
+ rawSettings() {
7568
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7569
+ }
7570
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7571
+ logUnresolvedRead(unresolved) {
7572
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7573
+ if (fresh.length === 0) return;
7574
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7575
+ 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) => ({
7576
+ ref: u.ref,
7577
+ reason: u.reason
7578
+ })) } });
7579
+ }
7157
7580
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7158
7581
  scheduleSecretReresolve(delayMs) {
7159
7582
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7180,7 +7603,7 @@ var BaseAddon = class {
7180
7603
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7181
7604
  */
7182
7605
  async readAddonStoreWithRetry() {
7183
- const settings = this._ctx?.settings;
7606
+ const settings = this.rawSettings();
7184
7607
  if (!settings) return {};
7185
7608
  const delaysMs = [
7186
7609
  150,
@@ -9574,6 +9997,278 @@ var DERIVED_CAMERA_SILENCED_CAP_NAMES = [
9574
9997
  "scene-monitor"
9575
9998
  ];
9576
9999
  /**
10000
+ * The trainer contract — what the hub hands the cloud trainer and what it
10001
+ * gets back (cloud training, D805+).
10002
+ *
10003
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
10004
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
10005
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
10006
+ * lines on stdout. These schemas are the hub's half of that boundary; the
10007
+ * trainer's pydantic models (and the JSON Schemas generated from them under
10008
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
10009
+ * change there, in the same piece of work.
10010
+ *
10011
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
10012
+ * orchestrator fills every field of a job spec explicitly.
10013
+ */
10014
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
10015
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
10016
+ /** What the trainer can export. Edge TPU is a later, separate image. */
10017
+ var TrainingExportSchema = _enum([
10018
+ "onnx",
10019
+ "openvino-fp16",
10020
+ "openvino-int8",
10021
+ "coreml-fp16"
10022
+ ]);
10023
+ var FloorsSchema = record(string(), number().min(0).max(1));
10024
+ object({
10025
+ schema: literal(TRAINING_JOB_SCHEMA),
10026
+ jobKey: string().uuid(),
10027
+ target: object({
10028
+ kind: literal("detector"),
10029
+ step: literal("object-detection")
10030
+ }),
10031
+ base: object({
10032
+ modelId: string().min(1),
10033
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
10034
+ weights: string().min(1),
10035
+ imgsz: number().int().positive()
10036
+ }),
10037
+ baseline: object({
10038
+ modelId: string().min(1),
10039
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
10040
+ onnxUrl: string().url(),
10041
+ imgsz: number().int().positive(),
10042
+ floors: FloorsSchema
10043
+ }),
10044
+ dataset: object({
10045
+ versionId: string().min(1),
10046
+ annotationHash: string(),
10047
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
10048
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10049
+ }),
10050
+ split: object({
10051
+ holdoutCameras: array(number().int()),
10052
+ /** When no camera is held out: the last N days of every camera. */
10053
+ holdoutLastDays: number().int().nonnegative(),
10054
+ valFraction: number().min(0).max(.5),
10055
+ seed: number().int()
10056
+ }),
10057
+ hyper: object({
10058
+ epochs: number().int().positive(),
10059
+ batch: number().int().positive(),
10060
+ lr0: number().positive(),
10061
+ /** Layers frozen from the start of the backbone; 0 = none. */
10062
+ freeze: number().int().nonnegative(),
10063
+ patience: number().int().nonnegative(),
10064
+ seed: number().int()
10065
+ }),
10066
+ replay: object({
10067
+ source: literal("coco2017"),
10068
+ count: number().int().nonnegative()
10069
+ }),
10070
+ exports: array(TrainingExportSchema).min(1),
10071
+ calibration: object({ maxFrames: number().int().positive() }),
10072
+ floors: object({
10073
+ minSupport: number().int().positive(),
10074
+ clamp: number().min(0).max(1)
10075
+ }),
10076
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
10077
+ catalog: object({
10078
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
10079
+ name: string().min(1).max(160)
10080
+ })
10081
+ });
10082
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
10083
+ var TrainingResultFileSchema = object({
10084
+ path: string().min(1),
10085
+ bytes: number().int().nonnegative(),
10086
+ sha256: string().regex(/^[0-9a-f]{64}$/),
10087
+ format: _enum([
10088
+ "onnx",
10089
+ "openvino",
10090
+ "coreml",
10091
+ "pt"
10092
+ ]),
10093
+ variant: _enum(["base", "int8"])
10094
+ });
10095
+ var DraftFormatSchema = object({
10096
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
10097
+ url: string().min(1),
10098
+ sizeMB: number().nonnegative(),
10099
+ isDirectory: boolean().optional(),
10100
+ files: array(string()).optional(),
10101
+ runtimes: array(literal("python")).optional(),
10102
+ revision: string().min(1)
10103
+ });
10104
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
10105
+ var TrainingCatalogDraftSchema = object({
10106
+ id: string().min(1),
10107
+ name: string().min(1),
10108
+ description: string(),
10109
+ labels: array(unknown()),
10110
+ inputSize: object({
10111
+ width: number().int().positive(),
10112
+ height: number().int().positive()
10113
+ }),
10114
+ preprocessMode: literal("letterbox"),
10115
+ defaultClassFloors: FloorsSchema,
10116
+ formats: object({
10117
+ onnx: DraftFormatSchema.optional(),
10118
+ openvino: DraftFormatSchema.optional(),
10119
+ coreml: DraftFormatSchema.optional()
10120
+ })
10121
+ });
10122
+ /** One class of one model's holdout report (the eval harness's summary). */
10123
+ var TrainingEvalClassSchema = object({
10124
+ positives: number().int(),
10125
+ floor: number().nullable(),
10126
+ tp: number().int(),
10127
+ fp: number().int(),
10128
+ fn: number().int(),
10129
+ precision: number().nullable(),
10130
+ recall: number().nullable(),
10131
+ ap50: number().nullable(),
10132
+ recallByCamera: record(string(), number().nullable()).optional(),
10133
+ recallByLight: record(string(), number().nullable()).optional(),
10134
+ fpByCamera: record(string(), number()).optional(),
10135
+ smallFound: number().int().optional(),
10136
+ smallTotal: number().int().optional()
10137
+ }).passthrough();
10138
+ var TrainingEvalReportSchema = object({
10139
+ frames: number().int(),
10140
+ classes: record(string(), TrainingEvalClassSchema)
10141
+ }).passthrough();
10142
+ /**
10143
+ * A succeeded result carries every block; a failed one carries the error and
10144
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10145
+ * orchestrator checks the blocks it needs before it trusts a success.
10146
+ */
10147
+ var TrainingResultSchema = object({
10148
+ schema: literal(TRAINING_RESULT_SCHEMA),
10149
+ jobKey: string(),
10150
+ status: _enum(["succeeded", "failed"]),
10151
+ error: object({
10152
+ stage: string(),
10153
+ code: string(),
10154
+ message: string()
10155
+ }).nullable(),
10156
+ trainer: object({
10157
+ version: string(),
10158
+ revision: string()
10159
+ }),
10160
+ toolchain: record(string(), string().nullable()),
10161
+ dataset: object({
10162
+ versionId: string(),
10163
+ annotationHash: string(),
10164
+ sha256: string(),
10165
+ frames: object({
10166
+ train: number().int(),
10167
+ val: number().int(),
10168
+ holdout: number().int()
10169
+ }),
10170
+ holdoutCameras: array(number().int()),
10171
+ replayImages: number().int()
10172
+ }).optional(),
10173
+ training: object({
10174
+ epochsRun: number().int(),
10175
+ bestEpoch: number().int(),
10176
+ bestMap50: number(),
10177
+ bestMap50_95: number(),
10178
+ seconds: number()
10179
+ }).optional(),
10180
+ evaluation: object({
10181
+ holdoutFrames: number().int(),
10182
+ baseline: TrainingEvalReportSchema.nullable(),
10183
+ candidate: TrainingEvalReportSchema.nullable(),
10184
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10185
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10186
+ map50: record(string(), number().nullable())
10187
+ }).optional(),
10188
+ floors: object({
10189
+ baseline: FloorsSchema,
10190
+ candidate: FloorsSchema,
10191
+ candidateInt8: FloorsSchema.nullable(),
10192
+ notes: array(string())
10193
+ }).optional(),
10194
+ int8: object({
10195
+ kept: boolean(),
10196
+ map50Fp16: number().nullable(),
10197
+ map50Int8: number().nullable(),
10198
+ reason: string().nullable()
10199
+ }).optional(),
10200
+ exportsDropped: array(object({
10201
+ export: string(),
10202
+ reason: string()
10203
+ })).optional(),
10204
+ files: array(TrainingResultFileSchema).optional(),
10205
+ bundle: object({
10206
+ path: literal("bundle.tar"),
10207
+ bytes: number().int().nonnegative(),
10208
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10209
+ }).nullable().optional(),
10210
+ catalogDraft: object({
10211
+ base: TrainingCatalogDraftSchema,
10212
+ int8: TrainingCatalogDraftSchema.nullable()
10213
+ }).nullable().optional(),
10214
+ licence: string()
10215
+ });
10216
+ var TrainingStageSchema = _enum([
10217
+ "prepare",
10218
+ "replay",
10219
+ "train",
10220
+ "eval",
10221
+ "export",
10222
+ "package"
10223
+ ]);
10224
+ var EventBase = {
10225
+ v: literal(1),
10226
+ ts: number()
10227
+ };
10228
+ discriminatedUnion("type", [
10229
+ object({
10230
+ ...EventBase,
10231
+ type: literal("stage"),
10232
+ stage: TrainingStageSchema
10233
+ }),
10234
+ object({
10235
+ ...EventBase,
10236
+ type: literal("epoch"),
10237
+ epoch: number().int(),
10238
+ epochs: number().int(),
10239
+ boxLoss: number().nullable().optional(),
10240
+ map50: number().nullable().optional(),
10241
+ map50_95: number().nullable().optional(),
10242
+ etaSec: number().nullable().optional()
10243
+ }),
10244
+ object({
10245
+ ...EventBase,
10246
+ type: literal("metric"),
10247
+ name: string(),
10248
+ value: number()
10249
+ }),
10250
+ object({
10251
+ ...EventBase,
10252
+ type: literal("artifact"),
10253
+ path: string(),
10254
+ bytes: number(),
10255
+ sha256: string()
10256
+ }),
10257
+ object({
10258
+ ...EventBase,
10259
+ type: literal("done"),
10260
+ status: _enum(["succeeded", "failed"]),
10261
+ resultSha256: string().nullable().optional()
10262
+ }),
10263
+ object({
10264
+ ...EventBase,
10265
+ type: literal("error"),
10266
+ stage: string(),
10267
+ code: string(),
10268
+ message: string()
10269
+ })
10270
+ ]);
10271
+ /**
9577
10272
  * What the gate decided about a birth, from the CALLER's point of view.
9578
10273
  *
9579
10274
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11901,7 +12596,9 @@ var AddonHttpRouteSchema = object({
11901
12596
  "authenticated",
11902
12597
  "admin"
11903
12598
  ]).optional(),
11904
- description: string().optional()
12599
+ description: string().optional(),
12600
+ /** The hub limits this route per client address before the handler runs. */
12601
+ rateLimit: _enum(["auth"]).optional()
11905
12602
  });
11906
12603
  /**
11907
12604
  * Cross-process route invocation envelope. The hub captures the
@@ -12606,6 +13303,37 @@ var BackupDestinationInfoSchema = object({
12606
13303
  lastError: string().optional()
12607
13304
  });
12608
13305
  /**
13306
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13307
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13308
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13309
+ * with it off — which restores without a key.
13310
+ */
13311
+ var BackupArchiveEncryptionSchema = object({
13312
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13313
+ scheme: string(),
13314
+ /** 16 hex — the backup key whose secret restores this archive. */
13315
+ keyId: string()
13316
+ });
13317
+ /**
13318
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13319
+ * one new archives are encrypted to, and the retired ones older archives
13320
+ * still need. The secret key is shown once, at `setupEncryption`.
13321
+ */
13322
+ var BackupEncryptionStatusSchema = object({
13323
+ enabled: boolean(),
13324
+ active: object({
13325
+ keyId: string(),
13326
+ publicKey: string(),
13327
+ createdAt: number()
13328
+ }).nullable(),
13329
+ /** Every key ever set up, newest first. */
13330
+ keys: array(object({
13331
+ keyId: string(),
13332
+ createdAt: number(),
13333
+ retiredAt: number().nullable()
13334
+ })).readonly()
13335
+ });
13336
+ /**
12609
13337
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12610
13338
  * Same shape the destination drill-in renders. Sourced from the per-
12611
13339
  * location `manifests.json` (no per-archive tarball read required).
@@ -12617,7 +13345,9 @@ var BackupArchiveEntrySchema = object({
12617
13345
  sizeBytes: number(),
12618
13346
  label: string().optional(),
12619
13347
  /** Top-level locations included in the archive (db, addons, tls, …). */
12620
- locations: array(string()).readonly()
13348
+ locations: array(string()).readonly(),
13349
+ /** Present when the archive is encrypted; restore then needs that key. */
13350
+ encryption: BackupArchiveEncryptionSchema.optional()
12621
13351
  });
12622
13352
  var BackupEntrySchema = object({
12623
13353
  id: string(),
@@ -12626,7 +13356,8 @@ var BackupEntrySchema = object({
12626
13356
  label: string().optional(),
12627
13357
  createdAt: number(),
12628
13358
  sizeBytes: number(),
12629
- locations: array(string()).optional()
13359
+ locations: array(string()).optional(),
13360
+ encryption: BackupArchiveEncryptionSchema.optional()
12630
13361
  });
12631
13362
  var ArchiveEntrySchema = object({
12632
13363
  path: string(),
@@ -12815,10 +13546,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12815
13546
  * this list and skips entries whose path doesn't start with
12816
13547
  * any of them.
12817
13548
  */
12818
- locations: array(string()).optional()
13549
+ locations: array(string()).optional(),
13550
+ /**
13551
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13552
+ * one). The archive is decrypted into the hub's private staging
13553
+ * before the restart; the key is not stored. A wrong or missing key
13554
+ * is refused before the archive is downloaded.
13555
+ */
13556
+ backupSecretKey: string().optional()
12819
13557
  }), _void(), {
12820
13558
  kind: "mutation",
12821
13559
  auth: "admin"
13560
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13561
+ keyId: string(),
13562
+ secretKey: string(),
13563
+ publicKey: string(),
13564
+ createdAt: number(),
13565
+ replacedKeyId: string().nullable()
13566
+ }), {
13567
+ kind: "mutation",
13568
+ auth: "admin"
13569
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13570
+ kind: "mutation",
13571
+ auth: "admin"
13572
+ }), method(object({ backupSecretKey: string() }), object({
13573
+ valid: boolean(),
13574
+ keyId: string().nullable(),
13575
+ /** The hub knows this key (active or retired). */
13576
+ known: boolean(),
13577
+ /** It is the key new archives are encrypted to. */
13578
+ active: boolean(),
13579
+ error: string().optional()
13580
+ }), {
13581
+ kind: "mutation",
13582
+ auth: "admin"
12822
13583
  }), method(object({
12823
13584
  destinationId: string(),
12824
13585
  backupId: string()
@@ -14544,7 +15305,60 @@ var CustomModelDescriptorSchema = object({
14544
15305
  stepId: string(),
14545
15306
  entry: ModelCatalogEntrySchema
14546
15307
  });
14547
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15308
+ /** One regular file of an imported bundle, as the producer measured it. */
15309
+ var ModelBundleFileSchema = object({
15310
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15311
+ path: string().min(1),
15312
+ bytes: number().int().nonnegative(),
15313
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15314
+ });
15315
+ var ImportModelBundleInputSchema = object({
15316
+ /** The registry provider that keeps the model (Model Studio). */
15317
+ addonId: string(),
15318
+ stepId: string().min(1),
15319
+ /**
15320
+ * The catalog rows to register, complete, every format URL already
15321
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15322
+ * bundle may carry several rows (a base and its INT8 variant).
15323
+ */
15324
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15325
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15326
+ bundle: object({
15327
+ ticket: PeerBytesTicketSchema,
15328
+ bytes: number().int().positive(),
15329
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15330
+ }),
15331
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15332
+ files: array(ModelBundleFileSchema).min(1).max(64),
15333
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15334
+ distribute: boolean()
15335
+ });
15336
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15337
+ kind: literal("imported"),
15338
+ modelIds: array(string()).readonly(),
15339
+ distributed: array(object({
15340
+ modelId: string(),
15341
+ nodeId: string(),
15342
+ format: _enum(MODEL_FORMATS),
15343
+ ok: boolean(),
15344
+ error: string().optional()
15345
+ })).readonly()
15346
+ }), object({
15347
+ kind: literal("refused"),
15348
+ reason: _enum([
15349
+ "transfer-failed",
15350
+ "checksum-mismatch",
15351
+ "bundle-mismatch",
15352
+ "invalid-entry",
15353
+ "id-taken"
15354
+ ]),
15355
+ detail: string()
15356
+ })]);
15357
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15358
+ kind: "mutation",
15359
+ auth: "admin",
15360
+ timeoutMs: 30 * 6e4
15361
+ });
14548
15362
  /**
14549
15363
  * Query filter for settings-store collections.
14550
15364
  */
@@ -15023,6 +15837,35 @@ var KeychainKeySourceSchema = object({
15023
15837
  */
15024
15838
  sharesBackupWithDatabase: boolean()
15025
15839
  });
15840
+ /**
15841
+ * One keychain reset, as the Secrets page reports it until the operator
15842
+ * acknowledges it. Never a value: refs, counts and table names only.
15843
+ */
15844
+ var KeychainResetRecordSchema = object({
15845
+ id: string(),
15846
+ at: number(),
15847
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15848
+ actor: string(),
15849
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15850
+ lockedReason: string().nullable(),
15851
+ /** Values moved into the archive table (ciphertext under the lost key). */
15852
+ archived: number().int(),
15853
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15854
+ archivedCollection: string().nullable(),
15855
+ /**
15856
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15857
+ * so the archive can still be opened if the lost master key turns up.
15858
+ */
15859
+ archivedKeysCollection: string().nullable(),
15860
+ /**
15861
+ * `system-settings` keys whose marker the reset cleared — the cluster
15862
+ * secret's: a marker left pointing at an archived value would refuse every
15863
+ * agent forever (D797).
15864
+ */
15865
+ clearedSettingsKeys: array(string()).readonly(),
15866
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15867
+ acknowledgedAt: number().nullable()
15868
+ });
15026
15869
  var KeychainStatusSchema = object({
15027
15870
  keychain: KeychainStateSchema,
15028
15871
  /** The source of the master key in use; `null` while locked. */
@@ -15040,7 +15883,9 @@ var KeychainStatusSchema = object({
15040
15883
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
15041
15884
  retiredWraps: number().int(),
15042
15885
  recoveryKeyDownloadedAt: number().nullable(),
15043
- secretCount: number().int()
15886
+ secretCount: number().int(),
15887
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15888
+ lastReset: KeychainResetRecordSchema.nullable()
15044
15889
  });
15045
15890
  /**
15046
15891
  * Whether a stored value is still pointed at by its owner's settings.
@@ -15062,13 +15907,14 @@ var KeychainAuditActionSchema = _enum([
15062
15907
  "download-recovery-key",
15063
15908
  "delete-orphans",
15064
15909
  "reset",
15910
+ "acknowledge-reset",
15065
15911
  "initialize"
15066
15912
  ]);
15067
15913
  var KeychainAuditEntrySchema = object({
15068
15914
  id: string(),
15069
15915
  at: number(),
15070
15916
  action: KeychainAuditActionSchema,
15071
- /** `addon:<id>` | `user:<id>` | `system`. */
15917
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
15072
15918
  actor: string(),
15073
15919
  ref: string().nullable(),
15074
15920
  detail: string().nullable()
@@ -15134,6 +15980,13 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15134
15980
  kind: "mutation",
15135
15981
  auth: "admin",
15136
15982
  caller: "required"
15983
+ }), method(object({}), object({
15984
+ reset: KeychainResetRecordSchema.nullable(),
15985
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15986
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15987
+ kind: "mutation",
15988
+ auth: "admin",
15989
+ caller: "required"
15137
15990
  });
15138
15991
  method(_void(), object({
15139
15992
  id: string(),
@@ -17886,7 +18739,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17886
18739
  * `login-method` — collection cap through which auth addons contribute
17887
18740
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17888
18741
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17889
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18742
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17890
18743
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17891
18744
  * procedure aggregates them for the unauthenticated login page.
17892
18745
  *
@@ -17894,8 +18747,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17894
18747
  *
17895
18748
  * - `redirect` — a declarative button. The login page renders a generic
17896
18749
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17897
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17898
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18750
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17899
18751
  * login page needs NO change.
17900
18752
  *
17901
18753
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -17914,8 +18766,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17914
18766
  * decision.
17915
18767
  *
17916
18768
  * Every contribution carries a `stage`:
17917
- * - `primary` — shown on the first credentials screen (OIDC /
17918
- * magic-link buttons; a future usernameless passkey).
18769
+ * - `primary` — shown on the first credentials screen (OIDC
18770
+ * buttons; a usernameless passkey).
17919
18771
  * - `second-factor` — shown AFTER the password leg, gated on the
17920
18772
  * returned `factors` (passkey-as-2FA today).
17921
18773
  *
@@ -17942,7 +18794,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17942
18794
  * The provider names an external identity a signed-in user can link to
17943
18795
  * their own account (D782): `auth.listLinkableProviders` /
17944
18796
  * `beginExternalLink` offer exactly the redirect methods that set this,
17945
- * whatever their id. Absent / false — a login button only (magic-link).
18797
+ * whatever their id. Absent / false — a login button only.
17946
18798
  */
17947
18799
  linkable: boolean().optional()
17948
18800
  }),
@@ -21797,8 +22649,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21797
22649
  * `super_admin` — collapsed onto the single boolean because every
21798
22650
  * non-admin caller is governed by the same scope-check rules; the
21799
22651
  * distinction was only ever used to route role-specific procedures
21800
- * which we no longer have. Agents are admin sessions issued via
21801
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22652
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21802
22653
  * with `isAdmin: false` + an explicit scope list.
21803
22654
  */
21804
22655
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -24493,6 +25344,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24493
25344
  kind: "mutation",
24494
25345
  auth: "admin",
24495
25346
  timeoutMs: 60 * 6e4
25347
+ }), method(object({
25348
+ filter: RetrainExportFilterSchema,
25349
+ layout: RetrainExportLayoutSchema
25350
+ }), object({
25351
+ ticket: PeerBytesTicketSchema,
25352
+ frames: number().int(),
25353
+ annotations: number().int()
25354
+ }), {
25355
+ kind: "mutation",
25356
+ auth: "admin",
25357
+ timeoutMs: 12e4
24496
25358
  }), method(object({
24497
25359
  selection: RetrainDatasetSelectionSchema,
24498
25360
  completeOnly: boolean().optional()
@@ -28101,8 +28963,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
28101
28963
  * `smtp-provider` — pluggable email delivery surface.
28102
28964
  *
28103
28965
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
28104
- * one for transactional / one for notifications). Consumers (magic-link,
28105
- * notifier addons, …) walk the collection and pick the first
28966
+ * one for transactional / one for notifications). Consumers (notifier
28967
+ * addons, …) walk the collection and pick the first
28106
28968
  * ready provider OR target a specific addonId.
28107
28969
  *
28108
28970
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -28385,7 +29247,7 @@ targets: array(object({
28385
29247
  };
28386
29248
  /**
28387
29249
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
28388
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
29250
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
28389
29251
  * carrying the post-callback claims before redirecting back to
28390
29252
  * `/api/auth/sso/finish`.
28391
29253
  *
@@ -28448,7 +29310,14 @@ var SsoBridgeClaimsSchema = object({
28448
29310
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28449
29311
  * subject is unique only per issuer, so a link is bound to it.
28450
29312
  */
28451
- issuer: string().optional()
29313
+ issuer: string().optional(),
29314
+ /**
29315
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
29316
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
29317
+ * request to present the matching cookie — a login bridge is useless in
29318
+ * any other browser.
29319
+ */
29320
+ browserBinding: string().optional()
28452
29321
  });
28453
29322
  method(object({
28454
29323
  claims: SsoBridgeClaimsSchema,
@@ -40751,16 +41620,6 @@ var ApiKeySummarySchema = object({
40751
41620
  createdAt: number(),
40752
41621
  lastUsedAt: number().optional()
40753
41622
  });
40754
- var CreateApiKeyInputSchema = object({
40755
- label: string(),
40756
- isAdmin: boolean().default(false),
40757
- allowedProviders: union([array(string()), literal("*")]).optional(),
40758
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
40759
- });
40760
- var CreateApiKeyResultSchema = object({
40761
- token: string(),
40762
- record: ApiKeySummarySchema
40763
- });
40764
41623
  var ScopedTokenSummarySchema = object({
40765
41624
  id: string(),
40766
41625
  userId: string(),
@@ -40859,17 +41718,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40859
41718
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
40860
41719
  kind: "mutation",
40861
41720
  access: "view"
40862
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
40863
- kind: "mutation",
40864
- auth: "admin",
40865
- access: "create"
40866
- }), method(object({ id: string() }), object({ success: literal(true) }), {
41721
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
40867
41722
  kind: "mutation",
40868
41723
  auth: "admin",
40869
41724
  access: "delete"
40870
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
40871
- kind: "mutation",
40872
- access: "view"
40873
41725
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
40874
41726
  kind: "mutation",
40875
41727
  auth: "admin",
@@ -40943,15 +41795,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40943
41795
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
40944
41796
  userId: string(),
40945
41797
  issuer: string()
40946
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
40947
- userId: string(),
40948
- issuer: string().min(1),
40949
- label: string().optional()
40950
- }), object({ success: literal(true) }), {
40951
- kind: "mutation",
40952
- auth: "admin",
40953
- access: "create"
40954
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41798
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
40955
41799
  kind: "mutation",
40956
41800
  auth: "admin",
40957
41801
  access: "delete"
@@ -41656,6 +42500,451 @@ var zoneRulesCapability = {
41656
42500
  */
41657
42501
  durability: "restored"
41658
42502
  };
42503
+ /**
42504
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
42505
+ *
42506
+ * A thin, mockable translation layer: it knows how to run a container with a
42507
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
42508
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
42509
+ * those are the `training` orchestrator's (D805). Every rule written there
42510
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
42511
+ * manifest entry and nothing else.
42512
+ *
42513
+ * Collection, routed by the `addonId` in every single-row input (the `llm` /
42514
+ * `notification-output` posture); `describe` concat-fans across providers.
42515
+ * Every method is `admin`: these spend money.
42516
+ *
42517
+ * Every cloud object a provider creates is tagged with the orchestrator's
42518
+ * `jobKey`, so a retried submit finds the job it already started instead of
42519
+ * starting a second GPU, and `listJobs` can find orphans.
42520
+ *
42521
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
42522
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
42523
+ * ticket the provider mints (D613).
42524
+ */
42525
+ var TrainingGpuOptionSchema = object({
42526
+ id: string(),
42527
+ label: string(),
42528
+ /** List price, USD per GPU-hour, before any region multiplier. */
42529
+ usdPerHour: number().nonnegative(),
42530
+ vramGb: number().nonnegative()
42531
+ });
42532
+ var TrainingRegionOptionSchema = object({
42533
+ /** `''` = any region (the provider's choice). */
42534
+ id: string(),
42535
+ label: string(),
42536
+ priceMultiplier: number().positive()
42537
+ });
42538
+ /**
42539
+ * The provider's per-account settings, as the orchestrator reads them. They
42540
+ * live in the PROVIDER addon's settings (operator decision 2026-10-08: they
42541
+ * depend on the user's account), never hard-coded in the orchestrator.
42542
+ */
42543
+ var TrainingProviderDefaultsSchema = object({
42544
+ gpuType: string(),
42545
+ region: string(),
42546
+ costCapUsd: number().nonnegative(),
42547
+ maxRuntimeSec: number().int().positive(),
42548
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
42549
+ failedDatasetGraceHours: number().nonnegative()
42550
+ });
42551
+ var TrainingProviderDescriptorSchema = object({
42552
+ addonId: string(),
42553
+ /** `modal`, `runpod`, `fake`, … */
42554
+ kind: string(),
42555
+ label: string(),
42556
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
42557
+ regions: array(TrainingRegionOptionSchema).readonly(),
42558
+ maxDatasetBytes: number().int().positive(),
42559
+ maxRuntimeSec: number().int().positive(),
42560
+ freeTierNote: string().optional(),
42561
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
42562
+ dataResidencyNote: string(),
42563
+ /** Credentials are present — never the values. */
42564
+ configured: boolean(),
42565
+ defaults: TrainingProviderDefaultsSchema
42566
+ });
42567
+ var TrainingCredentialCheckSchema = object({
42568
+ ok: boolean(),
42569
+ /** Workspace / account name, when the provider says. */
42570
+ account: string().optional(),
42571
+ reason: _enum([
42572
+ "missing",
42573
+ "invalid",
42574
+ "forbidden",
42575
+ "network",
42576
+ "quota"
42577
+ ]).optional(),
42578
+ detail: string().optional()
42579
+ });
42580
+ var ProviderJobStateSchema = _enum([
42581
+ "pending",
42582
+ "starting",
42583
+ "running",
42584
+ "succeeded",
42585
+ "failed",
42586
+ "cancelled",
42587
+ "lost"
42588
+ ]);
42589
+ var ProviderJobStatusSchema = object({
42590
+ jobKey: string(),
42591
+ providerJobId: string().optional(),
42592
+ state: ProviderJobStateSchema,
42593
+ startedAt: number().optional(),
42594
+ endedAt: number().optional(),
42595
+ exitCode: number().int().optional(),
42596
+ failureReason: string().optional(),
42597
+ gpuType: string(),
42598
+ region: string().optional(),
42599
+ billedSeconds: number().nonnegative(),
42600
+ costUsd: number().nonnegative(),
42601
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
42602
+ costIsEstimate: boolean(),
42603
+ lastFetchedAt: number()
42604
+ });
42605
+ /**
42606
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
42607
+ * image its own way (Modal builds the published Dockerfile at that revision;
42608
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
42609
+ * in `result.json`.
42610
+ */
42611
+ var TrainerSourceRefSchema = object({
42612
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
42613
+ repo: string().min(1),
42614
+ /** A commit sha (never a branch) — the job must be reproducible. */
42615
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
42616
+ });
42617
+ var JobRef = {
42618
+ addonId: string(),
42619
+ jobKey: string().uuid()
42620
+ };
42621
+ var TrainingLogLineSchema = object({
42622
+ ts: number(),
42623
+ text: string()
42624
+ });
42625
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
42626
+ kind: "mutation",
42627
+ auth: "admin",
42628
+ timeoutMs: 3e4
42629
+ }), method(object({
42630
+ addonId: string(),
42631
+ gpuType: string(),
42632
+ region: string(),
42633
+ datasetBytes: number().int().nonnegative(),
42634
+ gpuSecondsLow: number().nonnegative(),
42635
+ gpuSecondsHigh: number().nonnegative()
42636
+ }), object({
42637
+ usdLow: number().nonnegative(),
42638
+ usdHigh: number().nonnegative(),
42639
+ notes: array(string()).readonly()
42640
+ }), { auth: "admin" }), method(object({
42641
+ ...JobRef,
42642
+ ticket: PeerBytesTicketSchema
42643
+ }), object({
42644
+ bytes: number().int().nonnegative(),
42645
+ sha256: string()
42646
+ }), {
42647
+ kind: "mutation",
42648
+ auth: "admin",
42649
+ timeoutMs: 120 * 6e4
42650
+ }), method(object({
42651
+ ...JobRef,
42652
+ trainer: TrainerSourceRefSchema,
42653
+ jobSpecJson: string().min(2).max(64e3),
42654
+ gpuType: string(),
42655
+ region: string(),
42656
+ maxRuntimeSec: number().int().positive()
42657
+ }), ProviderJobStatusSchema, {
42658
+ kind: "mutation",
42659
+ auth: "admin",
42660
+ timeoutMs: 30 * 6e4
42661
+ }), method(object(JobRef), ProviderJobStatusSchema, {
42662
+ auth: "admin",
42663
+ timeoutMs: 6e4
42664
+ }), method(object({
42665
+ ...JobRef,
42666
+ cursor: string().optional(),
42667
+ max: number().int().min(1).max(500)
42668
+ }), object({
42669
+ lines: array(TrainingLogLineSchema).readonly(),
42670
+ cursor: string()
42671
+ }), {
42672
+ auth: "admin",
42673
+ timeoutMs: 6e4
42674
+ }), method(object(JobRef), object({ ok: literal(true) }), {
42675
+ kind: "mutation",
42676
+ auth: "admin",
42677
+ timeoutMs: 6e4
42678
+ }), method(object(JobRef), object({
42679
+ found: boolean(),
42680
+ text: string().optional()
42681
+ }), {
42682
+ kind: "mutation",
42683
+ auth: "admin",
42684
+ timeoutMs: 5 * 6e4
42685
+ }), method(object({
42686
+ ...JobRef,
42687
+ path: _enum(["bundle.tar"])
42688
+ }), object({ ticket: PeerBytesTicketSchema }), {
42689
+ kind: "mutation",
42690
+ auth: "admin",
42691
+ timeoutMs: 5 * 6e4
42692
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
42693
+ kind: "mutation",
42694
+ auth: "admin",
42695
+ timeoutMs: 5 * 6e4
42696
+ }), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
42697
+ auth: "admin",
42698
+ timeoutMs: 2 * 6e4
42699
+ });
42700
+ /**
42701
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
42702
+ * provided by `addon-training`.
42703
+ *
42704
+ * It owns what every provider must agree on, written once:
42705
+ *
42706
+ * - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
42707
+ * live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
42708
+ * the export plan) and reaches this store through the five row methods
42709
+ * below, so the Retrain page and the export did not change.
42710
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
42711
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
42712
+ * - **The return flow.** Verified artefacts → Model Studio
42713
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
42714
+ * rollback. Nothing is ever registered automatically.
42715
+ *
42716
+ * Every method is `admin`.
42717
+ */
42718
+ /** A version WITH its frame list — what the export and a job read. */
42719
+ var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
42720
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
42721
+ var TrainingBaseModelSchema = object({
42722
+ modelId: string(),
42723
+ label: string(),
42724
+ weights: string(),
42725
+ imgsz: number().int(),
42726
+ baselineOnnxUrl: string(),
42727
+ baselineFloors: record(string(), number()),
42728
+ /** The base the fleet runs most — the UI's default. */
42729
+ recommended: boolean()
42730
+ });
42731
+ var TrainingPresetSchema = _enum([
42732
+ "quick",
42733
+ "standard",
42734
+ "thorough"
42735
+ ]);
42736
+ var TrainingJobRequestSchema = object({
42737
+ datasetVersionId: string().min(1),
42738
+ /** The `training-provider` addon that runs it. */
42739
+ addonId: string().min(1),
42740
+ gpuType: string().min(1),
42741
+ region: string(),
42742
+ baseModelId: string().min(1),
42743
+ preset: TrainingPresetSchema,
42744
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
42745
+ freeze: number().int().nonnegative().nullable(),
42746
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
42747
+ holdoutCameras: array(number().int()).nullable()
42748
+ });
42749
+ var TrainingSplitPlanSchema = object({
42750
+ holdoutCameras: array(number().int()).readonly(),
42751
+ /** Used when no camera is held out: the last N days of every camera. */
42752
+ holdoutLastDays: number().int().nonnegative(),
42753
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
42754
+ holdoutSupport: record(string(), number().int()).nullable(),
42755
+ trainSubjects: number().int()
42756
+ });
42757
+ var TrainingRefusalReasonSchema = _enum([
42758
+ "unknown-dataset",
42759
+ "unknown-provider",
42760
+ "provider-not-configured",
42761
+ "unknown-base-model",
42762
+ "unknown-gpu",
42763
+ "dataset-too-large",
42764
+ "no-training-subjects",
42765
+ "job-already-running"
42766
+ ]);
42767
+ var TrainingJobPlanSchema = object({
42768
+ refusal: object({
42769
+ reason: TrainingRefusalReasonSchema,
42770
+ detail: string()
42771
+ }).nullable(),
42772
+ warnings: array(string()).readonly(),
42773
+ split: TrainingSplitPlanSchema.nullable(),
42774
+ estimate: object({
42775
+ datasetBytes: number().int(),
42776
+ uploadMinutesAt20Mbps: number(),
42777
+ gpuSecondsLow: number(),
42778
+ gpuSecondsHigh: number(),
42779
+ usdLow: number(),
42780
+ usdHigh: number(),
42781
+ notes: array(string()).readonly()
42782
+ }).nullable(),
42783
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
42784
+ defaults: object({
42785
+ maxCostUsd: number(),
42786
+ maxRuntimeSec: number().int()
42787
+ }).nullable(),
42788
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
42789
+ dataNotice: string()
42790
+ });
42791
+ /**
42792
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
42793
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
42794
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
42795
+ * result lives after the operator acted on it.
42796
+ */
42797
+ var TrainingJobStateSchema = _enum([
42798
+ "uploading",
42799
+ "submitted",
42800
+ "starting",
42801
+ "running",
42802
+ "collecting",
42803
+ "ready",
42804
+ "registered",
42805
+ "canary",
42806
+ "failed",
42807
+ "cancelling",
42808
+ "cancelled",
42809
+ "lost",
42810
+ "expired",
42811
+ "discarded"
42812
+ ]);
42813
+ var TrainingFailureReasonSchema = _enum([
42814
+ "cost-cap",
42815
+ "runtime-cap",
42816
+ "upload-failed",
42817
+ "submit-failed",
42818
+ "trainer-failed",
42819
+ "result-invalid",
42820
+ "checksum-mismatch",
42821
+ "fetch-failed",
42822
+ "provider-error",
42823
+ "hub-restart-during-upload"
42824
+ ]);
42825
+ var TrainingProgressPointSchema = object({
42826
+ epoch: number().int(),
42827
+ map50: number().nullable(),
42828
+ map50_95: number().nullable()
42829
+ });
42830
+ var TrainingCanarySchema = object({
42831
+ deviceIds: array(number().int()).readonly(),
42832
+ since: number(),
42833
+ /** Every override the canary replaced, exactly, so rollback restores it. */
42834
+ previous: array(object({
42835
+ deviceId: number().int(),
42836
+ nodeId: string(),
42837
+ deviceKey: string(),
42838
+ patch: object({
42839
+ modelId: string().optional(),
42840
+ settings: record(string(), unknown()).readonly().optional()
42841
+ }).nullable()
42842
+ })).readonly()
42843
+ });
42844
+ var TrainingJobSchema = object({
42845
+ id: string(),
42846
+ idempotencyKey: string(),
42847
+ name: string(),
42848
+ createdAt: number(),
42849
+ updatedAt: number(),
42850
+ state: TrainingJobStateSchema,
42851
+ stage: TrainingStageSchema.nullable(),
42852
+ failure: object({
42853
+ reason: TrainingFailureReasonSchema,
42854
+ stage: string().nullable(),
42855
+ detail: string()
42856
+ }).nullable(),
42857
+ request: TrainingJobRequestSchema,
42858
+ maxCostUsd: number().nonnegative(),
42859
+ maxRuntimeSec: number().int().positive(),
42860
+ trainer: TrainerSourceRefSchema,
42861
+ datasetLayout: RetrainExportLayoutSchema,
42862
+ dataset: object({
42863
+ bytes: number().int(),
42864
+ sha256: string(),
42865
+ uploadedAt: number()
42866
+ }).nullable(),
42867
+ split: TrainingSplitPlanSchema,
42868
+ provider: object({
42869
+ state: ProviderJobStateSchema.nullable(),
42870
+ providerJobId: string().nullable(),
42871
+ startedAt: number().nullable(),
42872
+ endedAt: number().nullable(),
42873
+ billedSeconds: number(),
42874
+ costUsd: number(),
42875
+ costIsEstimate: boolean(),
42876
+ lastPolledAt: number().nullable()
42877
+ }),
42878
+ progress: object({
42879
+ epoch: number().int().nullable(),
42880
+ epochs: number().int().nullable(),
42881
+ etaSec: number().nullable(),
42882
+ series: array(TrainingProgressPointSchema).readonly()
42883
+ }),
42884
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
42885
+ logTail: array(string()).readonly(),
42886
+ logCursor: string().nullable(),
42887
+ artifacts: object({
42888
+ bundleBytes: number().int(),
42889
+ bundleSha256: string(),
42890
+ fetchedAt: number(),
42891
+ /** When the staged artefacts are deleted from the hub. */
42892
+ expiresAt: number()
42893
+ }).nullable(),
42894
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
42895
+ cloudDatasetDeletedAt: number().nullable(),
42896
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
42897
+ cloudCleanupDueAt: number().nullable(),
42898
+ /** Model ids registered from this job (base, and int8 when kept). */
42899
+ registeredModelIds: array(string()).readonly(),
42900
+ canary: TrainingCanarySchema.nullable()
42901
+ });
42902
+ var IdInput = object({ id: string().min(1) });
42903
+ method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
42904
+ kind: "mutation",
42905
+ auth: "admin"
42906
+ }), 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() }), {
42907
+ kind: "mutation",
42908
+ auth: "admin"
42909
+ }), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
42910
+ auth: "admin",
42911
+ timeoutMs: 6e4
42912
+ }), method(TrainingJobRequestSchema.extend({
42913
+ name: string().min(1).max(120),
42914
+ maxCostUsd: number().positive(),
42915
+ maxRuntimeSec: number().int().positive(),
42916
+ idempotencyKey: string().min(8).max(80)
42917
+ }), discriminatedUnion("kind", [object({
42918
+ kind: literal("started"),
42919
+ job: TrainingJobSchema
42920
+ }), object({
42921
+ kind: literal("refused"),
42922
+ reason: TrainingRefusalReasonSchema,
42923
+ detail: string()
42924
+ })]), {
42925
+ kind: "mutation",
42926
+ auth: "admin",
42927
+ timeoutMs: 12e4
42928
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
42929
+ kind: "mutation",
42930
+ auth: "admin",
42931
+ timeoutMs: 12e4
42932
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
42933
+ kind: "mutation",
42934
+ auth: "admin",
42935
+ timeoutMs: 30 * 6e4
42936
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
42937
+ kind: "mutation",
42938
+ auth: "admin",
42939
+ timeoutMs: 12e4
42940
+ }), method(IdInput, TrainingJobSchema, {
42941
+ kind: "mutation",
42942
+ auth: "admin",
42943
+ timeoutMs: 12e4
42944
+ }), method(IdInput, TrainingJobSchema, {
42945
+ kind: "mutation",
42946
+ auth: "admin"
42947
+ });
41659
42948
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
41660
42949
  Object.freeze({
41661
42950
  person: .5,
@@ -43327,6 +44616,12 @@ Object.freeze({
43327
44616
  addonId: null,
43328
44617
  access: "create"
43329
44618
  },
44619
+ "backup.checkBackupKey": {
44620
+ capName: "backup",
44621
+ capScope: "system",
44622
+ addonId: null,
44623
+ access: "create"
44624
+ },
43330
44625
  "backup.delete": {
43331
44626
  capName: "backup",
43332
44627
  capScope: "system",
@@ -43339,6 +44634,18 @@ Object.freeze({
43339
44634
  addonId: null,
43340
44635
  access: "delete"
43341
44636
  },
44637
+ "backup.disableEncryption": {
44638
+ capName: "backup",
44639
+ capScope: "system",
44640
+ addonId: null,
44641
+ access: "create"
44642
+ },
44643
+ "backup.getEncryption": {
44644
+ capName: "backup",
44645
+ capScope: "system",
44646
+ addonId: null,
44647
+ access: "view"
44648
+ },
43342
44649
  "backup.getEntries": {
43343
44650
  capName: "backup",
43344
44651
  capScope: "system",
@@ -43393,6 +44700,12 @@ Object.freeze({
43393
44700
  addonId: null,
43394
44701
  access: "create"
43395
44702
  },
44703
+ "backup.setupEncryption": {
44704
+ capName: "backup",
44705
+ capScope: "system",
44706
+ addonId: null,
44707
+ access: "create"
44708
+ },
43396
44709
  "backup.trigger": {
43397
44710
  capName: "backup",
43398
44711
  capScope: "system",
@@ -43945,6 +45258,12 @@ Object.freeze({
43945
45258
  addonId: null,
43946
45259
  access: "create"
43947
45260
  },
45261
+ "customModelRegistry.importModelBundle": {
45262
+ capName: "custom-model-registry",
45263
+ capScope: "system",
45264
+ addonId: null,
45265
+ access: "create"
45266
+ },
43948
45267
  "customModelRegistry.listModels": {
43949
45268
  capName: "custom-model-registry",
43950
45269
  capScope: "system",
@@ -45385,6 +46704,12 @@ Object.freeze({
45385
46704
  addonId: null,
45386
46705
  access: "view"
45387
46706
  },
46707
+ "keychainAdmin.acknowledgeReset": {
46708
+ capName: "keychain-admin",
46709
+ capScope: "system",
46710
+ addonId: null,
46711
+ access: "create"
46712
+ },
45388
46713
  "keychainAdmin.deleteOrphans": {
45389
46714
  capName: "keychain-admin",
45390
46715
  capScope: "system",
@@ -45421,6 +46746,12 @@ Object.freeze({
45421
46746
  addonId: null,
45422
46747
  access: "delete"
45423
46748
  },
46749
+ "keychainAdmin.resetReport": {
46750
+ capName: "keychain-admin",
46751
+ capScope: "system",
46752
+ addonId: null,
46753
+ access: "delete"
46754
+ },
45424
46755
  "keychainAdmin.reveal": {
45425
46756
  capName: "keychain-admin",
45426
46757
  capScope: "system",
@@ -47167,6 +48498,12 @@ Object.freeze({
47167
48498
  addonId: null,
47168
48499
  access: "view"
47169
48500
  },
48501
+ "pipelineAnalytics.offerRetrainArchive": {
48502
+ capName: "pipeline-analytics",
48503
+ capScope: "device",
48504
+ addonId: null,
48505
+ access: "create"
48506
+ },
47170
48507
  "pipelineAnalytics.ownersWithMedia": {
47171
48508
  capName: "pipeline-analytics",
47172
48509
  capScope: "device",
@@ -49705,6 +51042,174 @@ Object.freeze({
49705
51042
  addonId: null,
49706
51043
  access: "view"
49707
51044
  },
51045
+ "training.canaryResult": {
51046
+ capName: "training",
51047
+ capScope: "system",
51048
+ addonId: null,
51049
+ access: "create"
51050
+ },
51051
+ "training.cancelJob": {
51052
+ capName: "training",
51053
+ capScope: "system",
51054
+ addonId: null,
51055
+ access: "create"
51056
+ },
51057
+ "training.discardResult": {
51058
+ capName: "training",
51059
+ capScope: "system",
51060
+ addonId: null,
51061
+ access: "create"
51062
+ },
51063
+ "training.findDatasetVersionIdByName": {
51064
+ capName: "training",
51065
+ capScope: "system",
51066
+ addonId: null,
51067
+ access: "view"
51068
+ },
51069
+ "training.getDatasetVersion": {
51070
+ capName: "training",
51071
+ capScope: "system",
51072
+ addonId: null,
51073
+ access: "view"
51074
+ },
51075
+ "training.getJob": {
51076
+ capName: "training",
51077
+ capScope: "system",
51078
+ addonId: null,
51079
+ access: "view"
51080
+ },
51081
+ "training.getJobResult": {
51082
+ capName: "training",
51083
+ capScope: "system",
51084
+ addonId: null,
51085
+ access: "view"
51086
+ },
51087
+ "training.listBaseModels": {
51088
+ capName: "training",
51089
+ capScope: "system",
51090
+ addonId: null,
51091
+ access: "view"
51092
+ },
51093
+ "training.listDatasetVersions": {
51094
+ capName: "training",
51095
+ capScope: "system",
51096
+ addonId: null,
51097
+ access: "view"
51098
+ },
51099
+ "training.listJobs": {
51100
+ capName: "training",
51101
+ capScope: "system",
51102
+ addonId: null,
51103
+ access: "view"
51104
+ },
51105
+ "training.planJob": {
51106
+ capName: "training",
51107
+ capScope: "system",
51108
+ addonId: null,
51109
+ access: "view"
51110
+ },
51111
+ "training.putDatasetVersion": {
51112
+ capName: "training",
51113
+ capScope: "system",
51114
+ addonId: null,
51115
+ access: "create"
51116
+ },
51117
+ "training.registerResult": {
51118
+ capName: "training",
51119
+ capScope: "system",
51120
+ addonId: null,
51121
+ access: "create"
51122
+ },
51123
+ "training.removeDatasetVersion": {
51124
+ capName: "training",
51125
+ capScope: "system",
51126
+ addonId: null,
51127
+ access: "delete"
51128
+ },
51129
+ "training.rollbackCanary": {
51130
+ capName: "training",
51131
+ capScope: "system",
51132
+ addonId: null,
51133
+ access: "create"
51134
+ },
51135
+ "training.startJob": {
51136
+ capName: "training",
51137
+ capScope: "system",
51138
+ addonId: null,
51139
+ access: "create"
51140
+ },
51141
+ "trainingProvider.cancelJob": {
51142
+ capName: "training-provider",
51143
+ capScope: "system",
51144
+ addonId: null,
51145
+ access: "create"
51146
+ },
51147
+ "trainingProvider.cleanupJob": {
51148
+ capName: "training-provider",
51149
+ capScope: "system",
51150
+ addonId: null,
51151
+ access: "create"
51152
+ },
51153
+ "trainingProvider.describe": {
51154
+ capName: "training-provider",
51155
+ capScope: "system",
51156
+ addonId: null,
51157
+ access: "view"
51158
+ },
51159
+ "trainingProvider.estimateJob": {
51160
+ capName: "training-provider",
51161
+ capScope: "system",
51162
+ addonId: null,
51163
+ access: "view"
51164
+ },
51165
+ "trainingProvider.getJob": {
51166
+ capName: "training-provider",
51167
+ capScope: "system",
51168
+ addonId: null,
51169
+ access: "view"
51170
+ },
51171
+ "trainingProvider.listJobEvents": {
51172
+ capName: "training-provider",
51173
+ capScope: "system",
51174
+ addonId: null,
51175
+ access: "view"
51176
+ },
51177
+ "trainingProvider.listJobs": {
51178
+ capName: "training-provider",
51179
+ capScope: "system",
51180
+ addonId: null,
51181
+ access: "view"
51182
+ },
51183
+ "trainingProvider.offerArtifact": {
51184
+ capName: "training-provider",
51185
+ capScope: "system",
51186
+ addonId: null,
51187
+ access: "create"
51188
+ },
51189
+ "trainingProvider.readResult": {
51190
+ capName: "training-provider",
51191
+ capScope: "system",
51192
+ addonId: null,
51193
+ access: "create"
51194
+ },
51195
+ "trainingProvider.submitJob": {
51196
+ capName: "training-provider",
51197
+ capScope: "system",
51198
+ addonId: null,
51199
+ access: "create"
51200
+ },
51201
+ "trainingProvider.uploadDataset": {
51202
+ capName: "training-provider",
51203
+ capScope: "system",
51204
+ addonId: null,
51205
+ access: "create"
51206
+ },
51207
+ "trainingProvider.validateCredentials": {
51208
+ capName: "training-provider",
51209
+ capScope: "system",
51210
+ addonId: null,
51211
+ access: "create"
51212
+ },
49708
51213
  "turnProvider.getTurnServers": {
49709
51214
  capName: "turn-provider",
49710
51215
  capScope: "system",
@@ -49729,12 +51234,6 @@ Object.freeze({
49729
51234
  addonId: null,
49730
51235
  access: "create"
49731
51236
  },
49732
- "userManagement.createApiKey": {
49733
- capName: "user-management",
49734
- capScope: "system",
49735
- addonId: null,
49736
- access: "create"
49737
- },
49738
51237
  "userManagement.createScopedToken": {
49739
51238
  capName: "user-management",
49740
51239
  capScope: "system",
@@ -49771,12 +51270,6 @@ Object.freeze({
49771
51270
  addonId: null,
49772
51271
  access: "view"
49773
51272
  },
49774
- "userManagement.linkExternalIdentity": {
49775
- capName: "user-management",
49776
- capScope: "system",
49777
- addonId: null,
49778
- access: "create"
49779
- },
49780
51273
  "userManagement.listApiKeys": {
49781
51274
  capName: "user-management",
49782
51275
  capScope: "system",
@@ -49879,12 +51372,6 @@ Object.freeze({
49879
51372
  addonId: null,
49880
51373
  access: "create"
49881
51374
  },
49882
- "userManagement.validateApiKey": {
49883
- capName: "user-management",
49884
- capScope: "system",
49885
- addonId: null,
49886
- access: "view"
49887
- },
49888
51375
  "userManagement.validateCredentials": {
49889
51376
  capName: "user-management",
49890
51377
  capScope: "system",
@@ -53998,6 +55485,11 @@ Object.freeze({
53998
55485
  form: "single",
53999
55486
  optional: false
54000
55487
  }],
55488
+ "training.canaryResult": [{
55489
+ name: "deviceIds",
55490
+ form: "array",
55491
+ optional: false
55492
+ }],
54001
55493
  "update.getStatus": [{
54002
55494
  name: "deviceId",
54003
55495
  form: "single",