@camstack/addon-provider-wyze 0.2.134 → 0.2.135

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +1622 -130
  2. package/dist/addon.mjs +1622 -130
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -5388,7 +5388,7 @@ var ZodIssueCode = {
5388
5388
  var ZodFirstPartyTypeKind;
5389
5389
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5390
5390
  //#endregion
5391
- //#region ../types/dist/sleep-DujUvOcb.mjs
5391
+ //#region ../types/dist/sleep-r3RWkGVx.mjs
5392
5392
  /**
5393
5393
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5394
5394
  * window to float samples (D455).
@@ -5505,7 +5505,7 @@ function isKeychainStoredField(field) {
5505
5505
  var SECRET_CLEAR = { $secretClear: true };
5506
5506
  /** The `'***'` token D634 redaction writes for non-admins. */
5507
5507
  var LEGACY_DEVICE_REDACTION = "***";
5508
- function isRecord$1(value) {
5508
+ function isRecord$2(value) {
5509
5509
  return typeof value === "object" && value !== null && !Array.isArray(value);
5510
5510
  }
5511
5511
  function makeSecretMarker(ref) {
@@ -5516,12 +5516,12 @@ function makeSecretMarker(ref) {
5516
5516
  }
5517
5517
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5518
5518
  function isSecretMarker(value) {
5519
- if (!isRecord$1(value)) return false;
5519
+ if (!isRecord$2(value)) return false;
5520
5520
  const ref = value["$secret"];
5521
5521
  return typeof ref === "string" && ref.length > 0;
5522
5522
  }
5523
5523
  function isSecretClear(value) {
5524
- return isRecord$1(value) && value["$secretClear"] === true;
5524
+ return isRecord$2(value) && value["$secretClear"] === true;
5525
5525
  }
5526
5526
  /**
5527
5527
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6037,6 +6037,13 @@ function globalSecretScope() {
6037
6037
  function encodeSegment(value) {
6038
6038
  return encodeURIComponent(value);
6039
6039
  }
6040
+ function decodeSegment(value) {
6041
+ try {
6042
+ return decodeURIComponent(value);
6043
+ } catch {
6044
+ return null;
6045
+ }
6046
+ }
6040
6047
  /**
6041
6048
  * The field path of a value inside an array item, addressed by the item's id:
6042
6049
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6045,6 +6052,75 @@ function encodeSegment(value) {
6045
6052
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6046
6053
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6047
6054
  }
6055
+ function parseScope(segments) {
6056
+ switch (segments[0]) {
6057
+ case "global": return {
6058
+ scope: GLOBAL_SCOPE,
6059
+ used: 1
6060
+ };
6061
+ case "node": {
6062
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6063
+ return nodeId === null || nodeId.length === 0 ? null : {
6064
+ scope: {
6065
+ kind: "node",
6066
+ nodeId
6067
+ },
6068
+ used: 2
6069
+ };
6070
+ }
6071
+ case "device": {
6072
+ const raw = segments[1];
6073
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6074
+ return {
6075
+ scope: {
6076
+ kind: "device",
6077
+ deviceId: Number(raw)
6078
+ },
6079
+ used: 2
6080
+ };
6081
+ }
6082
+ case "integration": {
6083
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6084
+ return id === null || id.length === 0 ? null : {
6085
+ scope: {
6086
+ kind: "integration",
6087
+ integrationId: id
6088
+ },
6089
+ used: 2
6090
+ };
6091
+ }
6092
+ case "row": {
6093
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6094
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6095
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6096
+ return {
6097
+ scope: {
6098
+ kind: "row",
6099
+ collection,
6100
+ rowId
6101
+ },
6102
+ used: 3
6103
+ };
6104
+ }
6105
+ default: return null;
6106
+ }
6107
+ }
6108
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6109
+ function parseSecretRef(ref) {
6110
+ if (!ref.startsWith("secret://")) return null;
6111
+ const segments = ref.slice(9).split("/");
6112
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6113
+ if (owner === null || owner.length === 0) return null;
6114
+ const parsed = parseScope(segments.slice(1));
6115
+ if (parsed === null) return null;
6116
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6117
+ if (fieldPath.length === 0) return null;
6118
+ return {
6119
+ owner,
6120
+ scope: parsed.scope,
6121
+ fieldPath
6122
+ };
6123
+ }
6048
6124
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6049
6125
  var KeychainWriteRefusedError = class extends Error {
6050
6126
  fieldPath;
@@ -6055,7 +6131,7 @@ var KeychainWriteRefusedError = class extends Error {
6055
6131
  }
6056
6132
  };
6057
6133
  var KEEP = { kind: "keep" };
6058
- function isRecord(value) {
6134
+ function isRecord$1(value) {
6059
6135
  return typeof value === "object" && value !== null && !Array.isArray(value);
6060
6136
  }
6061
6137
  function defaultMintId() {
@@ -6068,7 +6144,7 @@ function collectSecretMarkerRefs(value, out = []) {
6068
6144
  return out;
6069
6145
  }
6070
6146
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6071
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6147
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6072
6148
  return out;
6073
6149
  }
6074
6150
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6123,7 +6199,7 @@ function rowId(row, idKey) {
6123
6199
  return null;
6124
6200
  }
6125
6201
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6126
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6202
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6127
6203
  if (!Array.isArray(incoming)) {
6128
6204
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6129
6205
  return {
@@ -6139,7 +6215,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6139
6215
  const kept = /* @__PURE__ */ new Set();
6140
6216
  const rows = [];
6141
6217
  for (const row of incoming) {
6142
- if (!isRecord(row)) {
6218
+ if (!isRecord$1(row)) {
6143
6219
  rows.push(row);
6144
6220
  continue;
6145
6221
  }
@@ -6164,7 +6240,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6164
6240
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6165
6241
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6166
6242
  case "object": {
6167
- if (!isRecord(incoming)) {
6243
+ if (!isRecord$1(incoming)) {
6168
6244
  if (incoming === void 0) return KEEP;
6169
6245
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6170
6246
  return {
@@ -6172,7 +6248,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6172
6248
  value: incoming
6173
6249
  };
6174
6250
  }
6175
- const storedObj = isRecord(stored) ? stored : {};
6251
+ const storedObj = isRecord$1(stored) ? stored : {};
6176
6252
  return {
6177
6253
  kind: "value",
6178
6254
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6231,12 +6307,19 @@ async function transformSecretWrite(input) {
6231
6307
  }
6232
6308
  };
6233
6309
  }
6310
+ /** Is `ref` one of `owner`'s refs? */
6311
+ function isSecretRefOwnedBy(ref, owner) {
6312
+ return parseSecretRef(ref)?.owner === owner;
6313
+ }
6234
6314
  /**
6235
6315
  * Replace every marker in `value` with its keychain value. Returns the SAME
6236
6316
  * reference when there is no marker (no allocation, no keychain call).
6237
6317
  */
6238
- async function resolveSecretMarkers(value, secrets) {
6239
- const refs = collectSecretMarkerRefs(value);
6318
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6319
+ const keepMarker = options.unresolved === "keep-marker";
6320
+ const owner = options.ownedBy;
6321
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6322
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6240
6323
  if (refs.length === 0) return {
6241
6324
  value,
6242
6325
  unresolved: []
@@ -6260,10 +6343,18 @@ async function resolveSecretMarkers(value, secrets) {
6260
6343
  }
6261
6344
  const substitute = (v) => {
6262
6345
  if (isSecretMarker(v)) {
6346
+ if (!inScope(v.$secret)) return {
6347
+ keep: true,
6348
+ value: v
6349
+ };
6263
6350
  const answer = answers[v.$secret];
6264
- return answer?.kind === "value" ? {
6351
+ if (answer?.kind === "value") return {
6265
6352
  keep: true,
6266
6353
  value: answer.value
6354
+ };
6355
+ return keepMarker ? {
6356
+ keep: true,
6357
+ value: v
6267
6358
  } : {
6268
6359
  keep: false,
6269
6360
  value: void 0
@@ -6280,7 +6371,7 @@ async function resolveSecretMarkers(value, secrets) {
6280
6371
  value: items
6281
6372
  };
6282
6373
  }
6283
- if (isRecord(v)) {
6374
+ if (isRecord$1(v)) {
6284
6375
  const out = {};
6285
6376
  for (const [k, child] of Object.entries(v)) {
6286
6377
  const s = substitute(child);
@@ -6301,14 +6392,152 @@ async function resolveSecretMarkers(value, secrets) {
6301
6392
  unresolved
6302
6393
  };
6303
6394
  }
6304
- function touchesTree(tree, patch) {
6305
- if (tree.size === 0) return false;
6306
- for (const key of Object.keys(patch)) {
6307
- const at = key.indexOf("@");
6308
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6395
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6396
+ var SecretOverwriteRefusedError = class extends Error {
6397
+ ref;
6398
+ reason;
6399
+ constructor(ref, reason) {
6400
+ 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.`);
6401
+ this.ref = ref;
6402
+ this.reason = reason;
6403
+ this.name = "SecretOverwriteRefusedError";
6404
+ }
6405
+ };
6406
+ function isRecord(value) {
6407
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6408
+ }
6409
+ function resolvedValue(pass, marker) {
6410
+ const answer = pass.answers[marker.$secret];
6411
+ return answer?.kind === "value" ? answer.value : null;
6412
+ }
6413
+ async function atMarker(pass, incoming, stored) {
6414
+ if (incoming === null) return stored;
6415
+ if (typeof incoming !== "string") return incoming;
6416
+ if (incoming === resolvedValue(pass, stored)) return stored;
6417
+ const intent = classifySecretWrite(incoming);
6418
+ if (intent.kind !== "set") return stored;
6419
+ const ref = stored.$secret;
6420
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6421
+ const answer = pass.answers[ref];
6422
+ 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);
6423
+ try {
6424
+ await pass.secrets.put(ref, intent.value);
6425
+ } catch (err) {
6426
+ throw new KeychainWriteRefusedError(ref, err);
6427
+ }
6428
+ pass.changedRefs.push(ref);
6429
+ return stored;
6430
+ }
6431
+ function inArray(pass, incoming, stored) {
6432
+ return incoming.map((item, index) => {
6433
+ const twin = stored[index];
6434
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6435
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6436
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6437
+ return item;
6438
+ });
6439
+ }
6440
+ function inArrayRow(pass, incoming, stored) {
6441
+ const out = { ...incoming };
6442
+ for (const [key, value] of Object.entries(incoming)) {
6443
+ const twin = stored[key];
6444
+ if (isSecretMarker(twin)) {
6445
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6446
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6447
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6448
+ }
6449
+ return out;
6450
+ }
6451
+ async function walk(pass, incoming, stored) {
6452
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6453
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6454
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6455
+ const out = { ...incoming };
6456
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6457
+ return out;
6458
+ }
6459
+ /** Restore markers a write-back carries as values. See the file doc. */
6460
+ async function restoreUnchangedSecrets(input) {
6461
+ const refs = [];
6462
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6463
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6464
+ if (owned.length === 0) return {
6465
+ patch: input.patch,
6466
+ changedRefs: []
6467
+ };
6468
+ const pass = {
6469
+ secrets: input.secrets,
6470
+ answers: await input.secrets.resolve([...new Set(owned)]),
6471
+ operatorWrite: input.operatorWrite,
6472
+ changedRefs: []
6473
+ };
6474
+ const out = {};
6475
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6476
+ return {
6477
+ patch: out,
6478
+ changedRefs: pass.changedRefs
6479
+ };
6480
+ }
6481
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6482
+ function isJsonEqual(a, b) {
6483
+ if (Object.is(a, b)) return true;
6484
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6485
+ if (isRecord(a) && isRecord(b)) {
6486
+ const keys = Object.keys(a);
6487
+ if (keys.length !== Object.keys(b).length) return false;
6488
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6309
6489
  }
6310
6490
  return false;
6311
6491
  }
6492
+ /** The patch without the keys whose value already equals the stored one. */
6493
+ function dropUnchangedKeys(patch, stored) {
6494
+ const out = {};
6495
+ for (const [key, value] of Object.entries(patch)) {
6496
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6497
+ out[key] = value;
6498
+ }
6499
+ return out;
6500
+ }
6501
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6502
+ function markerKeysOf(blob, owner) {
6503
+ const keys = /* @__PURE__ */ new Set();
6504
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6505
+ return keys;
6506
+ }
6507
+ function nodeFromStored(value, owner) {
6508
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6509
+ if (!isRecord(value)) return null;
6510
+ const children = /* @__PURE__ */ new Map();
6511
+ for (const [key, child] of Object.entries(value)) {
6512
+ const node = nodeFromStored(child, owner);
6513
+ if (node !== null) children.set(key, node);
6514
+ }
6515
+ return children.size > 0 ? {
6516
+ kind: "object",
6517
+ children
6518
+ } : null;
6519
+ }
6520
+ /**
6521
+ * The declared secret tree, widened by every place the STORED blob holds a
6522
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6523
+ * never declared: Wyze before b4906cec6) still gets the save path's
6524
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6525
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6526
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6527
+ * builtin that keeps another addon's marker (device-manager) never takes it
6528
+ * over.
6529
+ */
6530
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6531
+ const added = /* @__PURE__ */ new Map();
6532
+ for (const key of keys) {
6533
+ const at = key.indexOf("@");
6534
+ const base = at > 0 ? key.slice(0, at) : key;
6535
+ if (declared.has(base) || added.has(base)) continue;
6536
+ const node = nodeFromStored(stored[key], owner);
6537
+ if (node !== null) added.set(base, node);
6538
+ }
6539
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6540
+ }
6312
6541
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6313
6542
  async function readStoredAddonBlob(raw) {
6314
6543
  const threeWay = raw.readAddonStoreResult;
@@ -6317,7 +6546,41 @@ async function readStoredAddonBlob(raw) {
6317
6546
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6318
6547
  return result.kind === "missing" ? {} : result.value;
6319
6548
  }
6320
- function createSecretAwareSettings(raw, opts) {
6549
+ function touchesTree(tree, patch) {
6550
+ if (tree.size === 0) return false;
6551
+ for (const key of Object.keys(patch)) {
6552
+ const at = key.indexOf("@");
6553
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6554
+ }
6555
+ return false;
6556
+ }
6557
+ /**
6558
+ * Which top-level keys of each store held markers when last seen. `undefined`
6559
+ * for a store not seen yet: its first write reads it, to be safe.
6560
+ */
6561
+ var MarkerKeyIndex = class {
6562
+ owner;
6563
+ byStore = /* @__PURE__ */ new Map();
6564
+ constructor(owner) {
6565
+ this.owner = owner;
6566
+ }
6567
+ seen(store, blob) {
6568
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6569
+ }
6570
+ wrote(store, patch) {
6571
+ const keys = this.byStore.get(store);
6572
+ if (keys === void 0) return;
6573
+ const now = markerKeysOf(patch, this.owner);
6574
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6575
+ else keys.delete(key);
6576
+ }
6577
+ mayHoldMarkers(store, patch) {
6578
+ const keys = this.byStore.get(store);
6579
+ if (keys === void 0) return true;
6580
+ return Object.keys(patch).some((key) => keys.has(key));
6581
+ }
6582
+ };
6583
+ function createHandle(raw, opts) {
6321
6584
  const chains = /* @__PURE__ */ new Map();
6322
6585
  const serialize = (key, fn) => {
6323
6586
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6328,46 +6591,130 @@ function createSecretAwareSettings(raw, opts) {
6328
6591
  });
6329
6592
  return next;
6330
6593
  };
6331
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6332
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6333
- return serialize(chainKey, async () => {
6594
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6595
+ const resolveRead = async (store, blob) => {
6596
+ index.seen(store, blob);
6597
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6598
+ unresolved: "keep-marker",
6599
+ ownedBy: opts.secrets.owner
6600
+ });
6601
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6602
+ return value;
6603
+ };
6604
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6605
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6606
+ await rawWrite(patch);
6607
+ index.wrote(store, patch);
6608
+ return { changed: true };
6609
+ }
6610
+ return serialize(store, async () => {
6334
6611
  const stored = await readStored();
6612
+ index.seen(store, stored);
6613
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6614
+ const restored = await restoreUnchangedSecrets({
6615
+ patch,
6616
+ stored,
6617
+ secrets: opts.secrets,
6618
+ operatorWrite
6619
+ });
6335
6620
  const result = await transformSecretWrite({
6336
- tree,
6621
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6337
6622
  secrets: opts.secrets,
6338
- patch,
6623
+ patch: restored.patch,
6339
6624
  stored,
6340
6625
  ...scope !== void 0 ? { scope } : {},
6341
- operatorWrite: opts.isOperatorWrite?.() === true
6626
+ operatorWrite
6342
6627
  });
6343
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6628
+ const effective = dropUnchangedKeys(result.patch, stored);
6629
+ const wroteBlob = Object.keys(effective).length > 0;
6630
+ if (wroteBlob) {
6631
+ await rawWrite(effective);
6632
+ index.wrote(store, effective);
6633
+ }
6344
6634
  const { orphaned } = await result.afterWrite();
6345
6635
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6636
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6346
6637
  });
6347
6638
  };
6348
- const wrapped = {
6349
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6350
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6351
- kind: "device",
6352
- deviceId
6353
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6639
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6640
+ const readAddonStoreResult = raw.readAddonStoreResult;
6641
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6642
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6643
+ const overrides = {
6644
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6645
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6646
+ const result = await readAddonStoreResult.call(raw);
6647
+ return result.kind === "value" ? {
6648
+ kind: "value",
6649
+ value: await resolveRead("addon", result.value)
6650
+ } : result;
6651
+ } } : {},
6652
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6653
+ const result = await readAddonStoreKeyResult.call(raw, key);
6654
+ if (result.kind !== "present") return result;
6655
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6656
+ unresolved: "keep-marker",
6657
+ ownedBy: opts.secrets.owner
6658
+ });
6659
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6660
+ return {
6661
+ kind: "present",
6662
+ value: value[key]
6663
+ };
6664
+ } } : {},
6665
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6666
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6667
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6668
+ const out = /* @__PURE__ */ new Map();
6669
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6670
+ return out;
6671
+ } } : {},
6672
+ writeAddonStore: async (patch) => {
6673
+ await writeAddon(patch);
6674
+ },
6675
+ writeDeviceStore: async (deviceId, patch) => {
6676
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6677
+ kind: "device",
6678
+ deviceId
6679
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6680
+ }
6681
+ };
6682
+ return {
6683
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6684
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6685
+ const value = Reflect.get(target, prop, receiver);
6686
+ return typeof value === "function" ? value.bind(target) : value;
6687
+ } }),
6688
+ raw: {
6689
+ readAddonStore: async () => {
6690
+ const blob = await raw.readAddonStore();
6691
+ index.seen("addon", blob);
6692
+ return blob;
6693
+ },
6694
+ readDeviceStore: async (deviceId) => {
6695
+ const blob = await raw.readDeviceStore(deviceId);
6696
+ index.seen(`device:${deviceId}`, blob);
6697
+ return blob;
6698
+ }
6699
+ },
6700
+ writeAddonStore: writeAddon
6354
6701
  };
6355
- return new Proxy(raw, { get(target, prop, receiver) {
6356
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6357
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6358
- const value = Reflect.get(target, prop, receiver);
6359
- return typeof value === "function" ? value.bind(target) : value;
6360
- } });
6361
6702
  }
6362
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6363
- function withSecretAwareSettings(context, opts) {
6703
+ /** The context the addon sees, plus the private raw view and write outcome. */
6704
+ function createSecretAwareContext(context, opts) {
6364
6705
  const raw = context.settings;
6365
- if (raw === void 0) return context;
6366
- const settings = createSecretAwareSettings(raw, opts);
6367
- return new Proxy(context, { get(target, prop, receiver) {
6368
- if (prop === "settings") return settings;
6369
- return Reflect.get(target, prop, receiver);
6370
- } });
6706
+ if (raw === void 0) return {
6707
+ context,
6708
+ handle: null
6709
+ };
6710
+ const handle = createHandle(raw, opts);
6711
+ return {
6712
+ context: new Proxy(context, { get(target, prop, receiver) {
6713
+ if (prop === "settings") return handle.settings;
6714
+ return Reflect.get(target, prop, receiver);
6715
+ } }),
6716
+ handle
6717
+ };
6371
6718
  }
6372
6719
  var LEAF = { kind: "leaf" };
6373
6720
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6542,6 +6889,14 @@ var BaseAddon = class {
6542
6889
  _secretChangeUnsub = null;
6543
6890
  /** >0 while an OPERATOR's settings write is being applied. */
6544
6891
  _operatorWriteDepth = 0;
6892
+ /**
6893
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6894
+ * to the marker-bearing blobs and stays private to this class: the form
6895
+ * hydrate and config resolution need markers, addon code never does.
6896
+ */
6897
+ _secretSettings = null;
6898
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6899
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6545
6900
  constructor(defaults) {
6546
6901
  this.defaults = defaults;
6547
6902
  this._config = { ...defaults };
@@ -6578,13 +6933,21 @@ var BaseAddon = class {
6578
6933
  }
6579
6934
  async initialize(context) {
6580
6935
  const secrets = context.secrets;
6581
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6582
- secrets,
6583
- addonTree: () => this.addonSecretTree(),
6584
- deviceTree: () => this.deviceSecretTree(),
6585
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6586
- isOperatorWrite: () => this._operatorWriteDepth > 0
6587
- }) : context;
6936
+ if (secrets !== void 0) {
6937
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6938
+ secrets,
6939
+ addonTree: () => this.addonSecretTree(),
6940
+ deviceTree: () => this.deviceSecretTree(),
6941
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6942
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6943
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6944
+ });
6945
+ this._ctx = wrapped;
6946
+ this._secretSettings = handle;
6947
+ } else {
6948
+ this._ctx = context;
6949
+ this._secretSettings = null;
6950
+ }
6588
6951
  await this.resolveConfig();
6589
6952
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6590
6953
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6701,11 +7064,8 @@ var BaseAddon = class {
6701
7064
  async getGlobalSettings(overlay, cap, nodeId) {
6702
7065
  const schema = this.globalSettingsSchema(cap);
6703
7066
  if (!schema) return { sections: [] };
6704
- const projected = await this.resolveGlobalStore(nodeId, cap);
6705
- return hydrateSchema(schema, overlay ? {
6706
- ...projected,
6707
- ...overlay
6708
- } : projected, { inlineSecretsAsViews: true });
7067
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7068
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6709
7069
  }
6710
7070
  /**
6711
7071
  * The integration-level view of this addon's settings: exactly the sections
@@ -6750,7 +7110,7 @@ var BaseAddon = class {
6750
7110
  });
6751
7111
  }
6752
7112
  if (sections.length === 0) return null;
6753
- const projected = await this.resolveGlobalStore(nodeId);
7113
+ const projected = await this.readRawProjectedStore(nodeId);
6754
7114
  return hydrateSchema({
6755
7115
  ...schema,
6756
7116
  sections
@@ -6767,12 +7127,50 @@ var BaseAddon = class {
6767
7127
  * the store for custom option logic (option narrowing, value snapping) to
6768
7128
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6769
7129
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7130
+ *
7131
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7132
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7133
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7134
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7135
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7136
+ * resolved blob back is a no-op for every unchanged secret.
6770
7137
  */
6771
7138
  async resolveGlobalStore(nodeId, cap) {
6772
7139
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7140
+ return this.projectForNode(raw, nodeId, cap);
7141
+ }
7142
+ projectForNode(store, nodeId, cap) {
6773
7143
  const keys = this.perNodeKeys(cap);
6774
7144
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6775
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7145
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7146
+ }
7147
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7148
+ async readRawProjectedStore(nodeId, cap) {
7149
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7150
+ return this.projectForNode(raw, nodeId, cap);
7151
+ }
7152
+ /**
7153
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7154
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7155
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7156
+ * its value.
7157
+ */
7158
+ async overlayKeepingMarkers(stored, overlay) {
7159
+ const secrets = this._ctx?.secrets;
7160
+ const merged = {
7161
+ ...stored,
7162
+ ...overlay
7163
+ };
7164
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7165
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7166
+ unresolved: "keep-marker",
7167
+ ownedBy: secrets.owner
7168
+ });
7169
+ for (const key of Object.keys(overlay)) {
7170
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7171
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7172
+ }
7173
+ return merged;
6776
7174
  }
6777
7175
  /**
6778
7176
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6837,8 +7235,12 @@ var BaseAddon = class {
6837
7235
  async clearSecrets(keys, nodeId) {
6838
7236
  const tree = this.addonSecretTree();
6839
7237
  const keychain = this._ctx?.secrets !== void 0;
7238
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6840
7239
  const patch = {};
6841
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7240
+ for (const key of keys) {
7241
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7242
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7243
+ }
6842
7244
  await this.applyGlobalPatch(patch, nodeId);
6843
7245
  }
6844
7246
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6846,7 +7248,11 @@ var BaseAddon = class {
6846
7248
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6847
7249
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6848
7250
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6849
- await this._ctx?.settings?.writeAddonStore(scoped);
7251
+ const handle = this._secretSettings;
7252
+ if (handle !== null) {
7253
+ const { changed } = await handle.writeAddonStore(scoped);
7254
+ if (!changed) return;
7255
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6850
7256
  if (target !== localNode) return;
6851
7257
  await this.resolveConfig();
6852
7258
  await this.onConfigChanged();
@@ -6899,7 +7305,7 @@ var BaseAddon = class {
6899
7305
  async getDeviceSettings(deviceId) {
6900
7306
  const schema = this.deviceSettingsSchema();
6901
7307
  if (!schema) return { sections: [] };
6902
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7308
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6903
7309
  }
6904
7310
  async updateDeviceSettings(deviceId, patch) {
6905
7311
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7071,7 +7477,7 @@ var BaseAddon = class {
7071
7477
  key,
7072
7478
  schema,
7073
7479
  fallback,
7074
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7480
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7075
7481
  write: async (patch) => {
7076
7482
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7077
7483
  },
@@ -7133,6 +7539,23 @@ var BaseAddon = class {
7133
7539
  }
7134
7540
  return value;
7135
7541
  }
7542
+ /**
7543
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7544
+ * keychain the context's own view is already raw.
7545
+ */
7546
+ rawSettings() {
7547
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7548
+ }
7549
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7550
+ logUnresolvedRead(unresolved) {
7551
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7552
+ if (fresh.length === 0) return;
7553
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7554
+ 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) => ({
7555
+ ref: u.ref,
7556
+ reason: u.reason
7557
+ })) } });
7558
+ }
7136
7559
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7137
7560
  scheduleSecretReresolve(delayMs) {
7138
7561
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7159,7 +7582,7 @@ var BaseAddon = class {
7159
7582
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7160
7583
  */
7161
7584
  async readAddonStoreWithRetry() {
7162
- const settings = this._ctx?.settings;
7585
+ const settings = this.rawSettings();
7163
7586
  if (!settings) return {};
7164
7587
  const delaysMs = [
7165
7588
  150,
@@ -9482,6 +9905,278 @@ var CameraSwitchGroupSchema = object({
9482
9905
  fetchedAt: number()
9483
9906
  });
9484
9907
  /**
9908
+ * The trainer contract — what the hub hands the cloud trainer and what it
9909
+ * gets back (cloud training, D805+).
9910
+ *
9911
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
9912
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
9913
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
9914
+ * lines on stdout. These schemas are the hub's half of that boundary; the
9915
+ * trainer's pydantic models (and the JSON Schemas generated from them under
9916
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
9917
+ * change there, in the same piece of work.
9918
+ *
9919
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
9920
+ * orchestrator fills every field of a job spec explicitly.
9921
+ */
9922
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
9923
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
9924
+ /** What the trainer can export. Edge TPU is a later, separate image. */
9925
+ var TrainingExportSchema = _enum([
9926
+ "onnx",
9927
+ "openvino-fp16",
9928
+ "openvino-int8",
9929
+ "coreml-fp16"
9930
+ ]);
9931
+ var FloorsSchema = record(string(), number().min(0).max(1));
9932
+ object({
9933
+ schema: literal(TRAINING_JOB_SCHEMA),
9934
+ jobKey: string().uuid(),
9935
+ target: object({
9936
+ kind: literal("detector"),
9937
+ step: literal("object-detection")
9938
+ }),
9939
+ base: object({
9940
+ modelId: string().min(1),
9941
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
9942
+ weights: string().min(1),
9943
+ imgsz: number().int().positive()
9944
+ }),
9945
+ baseline: object({
9946
+ modelId: string().min(1),
9947
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
9948
+ onnxUrl: string().url(),
9949
+ imgsz: number().int().positive(),
9950
+ floors: FloorsSchema
9951
+ }),
9952
+ dataset: object({
9953
+ versionId: string().min(1),
9954
+ annotationHash: string(),
9955
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
9956
+ sha256: string().regex(/^[0-9a-f]{64}$/)
9957
+ }),
9958
+ split: object({
9959
+ holdoutCameras: array(number().int()),
9960
+ /** When no camera is held out: the last N days of every camera. */
9961
+ holdoutLastDays: number().int().nonnegative(),
9962
+ valFraction: number().min(0).max(.5),
9963
+ seed: number().int()
9964
+ }),
9965
+ hyper: object({
9966
+ epochs: number().int().positive(),
9967
+ batch: number().int().positive(),
9968
+ lr0: number().positive(),
9969
+ /** Layers frozen from the start of the backbone; 0 = none. */
9970
+ freeze: number().int().nonnegative(),
9971
+ patience: number().int().nonnegative(),
9972
+ seed: number().int()
9973
+ }),
9974
+ replay: object({
9975
+ source: literal("coco2017"),
9976
+ count: number().int().nonnegative()
9977
+ }),
9978
+ exports: array(TrainingExportSchema).min(1),
9979
+ calibration: object({ maxFrames: number().int().positive() }),
9980
+ floors: object({
9981
+ minSupport: number().int().positive(),
9982
+ clamp: number().min(0).max(1)
9983
+ }),
9984
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
9985
+ catalog: object({
9986
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
9987
+ name: string().min(1).max(160)
9988
+ })
9989
+ });
9990
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
9991
+ var TrainingResultFileSchema = object({
9992
+ path: string().min(1),
9993
+ bytes: number().int().nonnegative(),
9994
+ sha256: string().regex(/^[0-9a-f]{64}$/),
9995
+ format: _enum([
9996
+ "onnx",
9997
+ "openvino",
9998
+ "coreml",
9999
+ "pt"
10000
+ ]),
10001
+ variant: _enum(["base", "int8"])
10002
+ });
10003
+ var DraftFormatSchema = object({
10004
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
10005
+ url: string().min(1),
10006
+ sizeMB: number().nonnegative(),
10007
+ isDirectory: boolean().optional(),
10008
+ files: array(string()).optional(),
10009
+ runtimes: array(literal("python")).optional(),
10010
+ revision: string().min(1)
10011
+ });
10012
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
10013
+ var TrainingCatalogDraftSchema = object({
10014
+ id: string().min(1),
10015
+ name: string().min(1),
10016
+ description: string(),
10017
+ labels: array(unknown()),
10018
+ inputSize: object({
10019
+ width: number().int().positive(),
10020
+ height: number().int().positive()
10021
+ }),
10022
+ preprocessMode: literal("letterbox"),
10023
+ defaultClassFloors: FloorsSchema,
10024
+ formats: object({
10025
+ onnx: DraftFormatSchema.optional(),
10026
+ openvino: DraftFormatSchema.optional(),
10027
+ coreml: DraftFormatSchema.optional()
10028
+ })
10029
+ });
10030
+ /** One class of one model's holdout report (the eval harness's summary). */
10031
+ var TrainingEvalClassSchema = object({
10032
+ positives: number().int(),
10033
+ floor: number().nullable(),
10034
+ tp: number().int(),
10035
+ fp: number().int(),
10036
+ fn: number().int(),
10037
+ precision: number().nullable(),
10038
+ recall: number().nullable(),
10039
+ ap50: number().nullable(),
10040
+ recallByCamera: record(string(), number().nullable()).optional(),
10041
+ recallByLight: record(string(), number().nullable()).optional(),
10042
+ fpByCamera: record(string(), number()).optional(),
10043
+ smallFound: number().int().optional(),
10044
+ smallTotal: number().int().optional()
10045
+ }).passthrough();
10046
+ var TrainingEvalReportSchema = object({
10047
+ frames: number().int(),
10048
+ classes: record(string(), TrainingEvalClassSchema)
10049
+ }).passthrough();
10050
+ /**
10051
+ * A succeeded result carries every block; a failed one carries the error and
10052
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10053
+ * orchestrator checks the blocks it needs before it trusts a success.
10054
+ */
10055
+ var TrainingResultSchema = object({
10056
+ schema: literal(TRAINING_RESULT_SCHEMA),
10057
+ jobKey: string(),
10058
+ status: _enum(["succeeded", "failed"]),
10059
+ error: object({
10060
+ stage: string(),
10061
+ code: string(),
10062
+ message: string()
10063
+ }).nullable(),
10064
+ trainer: object({
10065
+ version: string(),
10066
+ revision: string()
10067
+ }),
10068
+ toolchain: record(string(), string().nullable()),
10069
+ dataset: object({
10070
+ versionId: string(),
10071
+ annotationHash: string(),
10072
+ sha256: string(),
10073
+ frames: object({
10074
+ train: number().int(),
10075
+ val: number().int(),
10076
+ holdout: number().int()
10077
+ }),
10078
+ holdoutCameras: array(number().int()),
10079
+ replayImages: number().int()
10080
+ }).optional(),
10081
+ training: object({
10082
+ epochsRun: number().int(),
10083
+ bestEpoch: number().int(),
10084
+ bestMap50: number(),
10085
+ bestMap50_95: number(),
10086
+ seconds: number()
10087
+ }).optional(),
10088
+ evaluation: object({
10089
+ holdoutFrames: number().int(),
10090
+ baseline: TrainingEvalReportSchema.nullable(),
10091
+ candidate: TrainingEvalReportSchema.nullable(),
10092
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10093
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10094
+ map50: record(string(), number().nullable())
10095
+ }).optional(),
10096
+ floors: object({
10097
+ baseline: FloorsSchema,
10098
+ candidate: FloorsSchema,
10099
+ candidateInt8: FloorsSchema.nullable(),
10100
+ notes: array(string())
10101
+ }).optional(),
10102
+ int8: object({
10103
+ kept: boolean(),
10104
+ map50Fp16: number().nullable(),
10105
+ map50Int8: number().nullable(),
10106
+ reason: string().nullable()
10107
+ }).optional(),
10108
+ exportsDropped: array(object({
10109
+ export: string(),
10110
+ reason: string()
10111
+ })).optional(),
10112
+ files: array(TrainingResultFileSchema).optional(),
10113
+ bundle: object({
10114
+ path: literal("bundle.tar"),
10115
+ bytes: number().int().nonnegative(),
10116
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10117
+ }).nullable().optional(),
10118
+ catalogDraft: object({
10119
+ base: TrainingCatalogDraftSchema,
10120
+ int8: TrainingCatalogDraftSchema.nullable()
10121
+ }).nullable().optional(),
10122
+ licence: string()
10123
+ });
10124
+ var TrainingStageSchema = _enum([
10125
+ "prepare",
10126
+ "replay",
10127
+ "train",
10128
+ "eval",
10129
+ "export",
10130
+ "package"
10131
+ ]);
10132
+ var EventBase = {
10133
+ v: literal(1),
10134
+ ts: number()
10135
+ };
10136
+ discriminatedUnion("type", [
10137
+ object({
10138
+ ...EventBase,
10139
+ type: literal("stage"),
10140
+ stage: TrainingStageSchema
10141
+ }),
10142
+ object({
10143
+ ...EventBase,
10144
+ type: literal("epoch"),
10145
+ epoch: number().int(),
10146
+ epochs: number().int(),
10147
+ boxLoss: number().nullable().optional(),
10148
+ map50: number().nullable().optional(),
10149
+ map50_95: number().nullable().optional(),
10150
+ etaSec: number().nullable().optional()
10151
+ }),
10152
+ object({
10153
+ ...EventBase,
10154
+ type: literal("metric"),
10155
+ name: string(),
10156
+ value: number()
10157
+ }),
10158
+ object({
10159
+ ...EventBase,
10160
+ type: literal("artifact"),
10161
+ path: string(),
10162
+ bytes: number(),
10163
+ sha256: string()
10164
+ }),
10165
+ object({
10166
+ ...EventBase,
10167
+ type: literal("done"),
10168
+ status: _enum(["succeeded", "failed"]),
10169
+ resultSha256: string().nullable().optional()
10170
+ }),
10171
+ object({
10172
+ ...EventBase,
10173
+ type: literal("error"),
10174
+ stage: string(),
10175
+ code: string(),
10176
+ message: string()
10177
+ })
10178
+ ]);
10179
+ /**
9485
10180
  * What the gate decided about a birth, from the CALLER's point of view.
9486
10181
  *
9487
10182
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11809,7 +12504,9 @@ var AddonHttpRouteSchema = object({
11809
12504
  "authenticated",
11810
12505
  "admin"
11811
12506
  ]).optional(),
11812
- description: string().optional()
12507
+ description: string().optional(),
12508
+ /** The hub limits this route per client address before the handler runs. */
12509
+ rateLimit: _enum(["auth"]).optional()
11813
12510
  });
11814
12511
  /**
11815
12512
  * Cross-process route invocation envelope. The hub captures the
@@ -12514,6 +13211,37 @@ var BackupDestinationInfoSchema = object({
12514
13211
  lastError: string().optional()
12515
13212
  });
12516
13213
  /**
13214
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13215
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13216
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13217
+ * with it off — which restores without a key.
13218
+ */
13219
+ var BackupArchiveEncryptionSchema = object({
13220
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13221
+ scheme: string(),
13222
+ /** 16 hex — the backup key whose secret restores this archive. */
13223
+ keyId: string()
13224
+ });
13225
+ /**
13226
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13227
+ * one new archives are encrypted to, and the retired ones older archives
13228
+ * still need. The secret key is shown once, at `setupEncryption`.
13229
+ */
13230
+ var BackupEncryptionStatusSchema = object({
13231
+ enabled: boolean(),
13232
+ active: object({
13233
+ keyId: string(),
13234
+ publicKey: string(),
13235
+ createdAt: number()
13236
+ }).nullable(),
13237
+ /** Every key ever set up, newest first. */
13238
+ keys: array(object({
13239
+ keyId: string(),
13240
+ createdAt: number(),
13241
+ retiredAt: number().nullable()
13242
+ })).readonly()
13243
+ });
13244
+ /**
12517
13245
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12518
13246
  * Same shape the destination drill-in renders. Sourced from the per-
12519
13247
  * location `manifests.json` (no per-archive tarball read required).
@@ -12525,7 +13253,9 @@ var BackupArchiveEntrySchema = object({
12525
13253
  sizeBytes: number(),
12526
13254
  label: string().optional(),
12527
13255
  /** Top-level locations included in the archive (db, addons, tls, …). */
12528
- locations: array(string()).readonly()
13256
+ locations: array(string()).readonly(),
13257
+ /** Present when the archive is encrypted; restore then needs that key. */
13258
+ encryption: BackupArchiveEncryptionSchema.optional()
12529
13259
  });
12530
13260
  var BackupEntrySchema = object({
12531
13261
  id: string(),
@@ -12534,7 +13264,8 @@ var BackupEntrySchema = object({
12534
13264
  label: string().optional(),
12535
13265
  createdAt: number(),
12536
13266
  sizeBytes: number(),
12537
- locations: array(string()).optional()
13267
+ locations: array(string()).optional(),
13268
+ encryption: BackupArchiveEncryptionSchema.optional()
12538
13269
  });
12539
13270
  var ArchiveEntrySchema = object({
12540
13271
  path: string(),
@@ -12723,10 +13454,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12723
13454
  * this list and skips entries whose path doesn't start with
12724
13455
  * any of them.
12725
13456
  */
12726
- locations: array(string()).optional()
13457
+ locations: array(string()).optional(),
13458
+ /**
13459
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13460
+ * one). The archive is decrypted into the hub's private staging
13461
+ * before the restart; the key is not stored. A wrong or missing key
13462
+ * is refused before the archive is downloaded.
13463
+ */
13464
+ backupSecretKey: string().optional()
12727
13465
  }), _void(), {
12728
13466
  kind: "mutation",
12729
13467
  auth: "admin"
13468
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13469
+ keyId: string(),
13470
+ secretKey: string(),
13471
+ publicKey: string(),
13472
+ createdAt: number(),
13473
+ replacedKeyId: string().nullable()
13474
+ }), {
13475
+ kind: "mutation",
13476
+ auth: "admin"
13477
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13478
+ kind: "mutation",
13479
+ auth: "admin"
13480
+ }), method(object({ backupSecretKey: string() }), object({
13481
+ valid: boolean(),
13482
+ keyId: string().nullable(),
13483
+ /** The hub knows this key (active or retired). */
13484
+ known: boolean(),
13485
+ /** It is the key new archives are encrypted to. */
13486
+ active: boolean(),
13487
+ error: string().optional()
13488
+ }), {
13489
+ kind: "mutation",
13490
+ auth: "admin"
12730
13491
  }), method(object({
12731
13492
  destinationId: string(),
12732
13493
  backupId: string()
@@ -14452,7 +15213,60 @@ var CustomModelDescriptorSchema = object({
14452
15213
  stepId: string(),
14453
15214
  entry: ModelCatalogEntrySchema
14454
15215
  });
14455
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15216
+ /** One regular file of an imported bundle, as the producer measured it. */
15217
+ var ModelBundleFileSchema = object({
15218
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15219
+ path: string().min(1),
15220
+ bytes: number().int().nonnegative(),
15221
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15222
+ });
15223
+ var ImportModelBundleInputSchema = object({
15224
+ /** The registry provider that keeps the model (Model Studio). */
15225
+ addonId: string(),
15226
+ stepId: string().min(1),
15227
+ /**
15228
+ * The catalog rows to register, complete, every format URL already
15229
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15230
+ * bundle may carry several rows (a base and its INT8 variant).
15231
+ */
15232
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15233
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15234
+ bundle: object({
15235
+ ticket: PeerBytesTicketSchema,
15236
+ bytes: number().int().positive(),
15237
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15238
+ }),
15239
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15240
+ files: array(ModelBundleFileSchema).min(1).max(64),
15241
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15242
+ distribute: boolean()
15243
+ });
15244
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15245
+ kind: literal("imported"),
15246
+ modelIds: array(string()).readonly(),
15247
+ distributed: array(object({
15248
+ modelId: string(),
15249
+ nodeId: string(),
15250
+ format: _enum(MODEL_FORMATS),
15251
+ ok: boolean(),
15252
+ error: string().optional()
15253
+ })).readonly()
15254
+ }), object({
15255
+ kind: literal("refused"),
15256
+ reason: _enum([
15257
+ "transfer-failed",
15258
+ "checksum-mismatch",
15259
+ "bundle-mismatch",
15260
+ "invalid-entry",
15261
+ "id-taken"
15262
+ ]),
15263
+ detail: string()
15264
+ })]);
15265
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15266
+ kind: "mutation",
15267
+ auth: "admin",
15268
+ timeoutMs: 30 * 6e4
15269
+ });
14456
15270
  /**
14457
15271
  * Query filter for settings-store collections.
14458
15272
  */
@@ -14931,6 +15745,35 @@ var KeychainKeySourceSchema = object({
14931
15745
  */
14932
15746
  sharesBackupWithDatabase: boolean()
14933
15747
  });
15748
+ /**
15749
+ * One keychain reset, as the Secrets page reports it until the operator
15750
+ * acknowledges it. Never a value: refs, counts and table names only.
15751
+ */
15752
+ var KeychainResetRecordSchema = object({
15753
+ id: string(),
15754
+ at: number(),
15755
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15756
+ actor: string(),
15757
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15758
+ lockedReason: string().nullable(),
15759
+ /** Values moved into the archive table (ciphertext under the lost key). */
15760
+ archived: number().int(),
15761
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15762
+ archivedCollection: string().nullable(),
15763
+ /**
15764
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15765
+ * so the archive can still be opened if the lost master key turns up.
15766
+ */
15767
+ archivedKeysCollection: string().nullable(),
15768
+ /**
15769
+ * `system-settings` keys whose marker the reset cleared — the cluster
15770
+ * secret's: a marker left pointing at an archived value would refuse every
15771
+ * agent forever (D797).
15772
+ */
15773
+ clearedSettingsKeys: array(string()).readonly(),
15774
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15775
+ acknowledgedAt: number().nullable()
15776
+ });
14934
15777
  var KeychainStatusSchema = object({
14935
15778
  keychain: KeychainStateSchema,
14936
15779
  /** The source of the master key in use; `null` while locked. */
@@ -14948,7 +15791,9 @@ var KeychainStatusSchema = object({
14948
15791
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
14949
15792
  retiredWraps: number().int(),
14950
15793
  recoveryKeyDownloadedAt: number().nullable(),
14951
- secretCount: number().int()
15794
+ secretCount: number().int(),
15795
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15796
+ lastReset: KeychainResetRecordSchema.nullable()
14952
15797
  });
14953
15798
  /**
14954
15799
  * Whether a stored value is still pointed at by its owner's settings.
@@ -14970,13 +15815,14 @@ var KeychainAuditActionSchema = _enum([
14970
15815
  "download-recovery-key",
14971
15816
  "delete-orphans",
14972
15817
  "reset",
15818
+ "acknowledge-reset",
14973
15819
  "initialize"
14974
15820
  ]);
14975
15821
  var KeychainAuditEntrySchema = object({
14976
15822
  id: string(),
14977
15823
  at: number(),
14978
15824
  action: KeychainAuditActionSchema,
14979
- /** `addon:<id>` | `user:<id>` | `system`. */
15825
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
14980
15826
  actor: string(),
14981
15827
  ref: string().nullable(),
14982
15828
  detail: string().nullable()
@@ -15042,6 +15888,13 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15042
15888
  kind: "mutation",
15043
15889
  auth: "admin",
15044
15890
  caller: "required"
15891
+ }), method(object({}), object({
15892
+ reset: KeychainResetRecordSchema.nullable(),
15893
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15894
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15895
+ kind: "mutation",
15896
+ auth: "admin",
15897
+ caller: "required"
15045
15898
  });
15046
15899
  method(_void(), object({
15047
15900
  id: string(),
@@ -17892,7 +18745,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17892
18745
  * `login-method` — collection cap through which auth addons contribute
17893
18746
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17894
18747
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17895
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18748
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17896
18749
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17897
18750
  * procedure aggregates them for the unauthenticated login page.
17898
18751
  *
@@ -17900,8 +18753,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17900
18753
  *
17901
18754
  * - `redirect` — a declarative button. The login page renders a generic
17902
18755
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17903
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17904
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18756
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17905
18757
  * login page needs NO change.
17906
18758
  *
17907
18759
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -17920,8 +18772,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17920
18772
  * decision.
17921
18773
  *
17922
18774
  * Every contribution carries a `stage`:
17923
- * - `primary` — shown on the first credentials screen (OIDC /
17924
- * magic-link buttons; a future usernameless passkey).
18775
+ * - `primary` — shown on the first credentials screen (OIDC
18776
+ * buttons; a usernameless passkey).
17925
18777
  * - `second-factor` — shown AFTER the password leg, gated on the
17926
18778
  * returned `factors` (passkey-as-2FA today).
17927
18779
  *
@@ -17948,7 +18800,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17948
18800
  * The provider names an external identity a signed-in user can link to
17949
18801
  * their own account (D782): `auth.listLinkableProviders` /
17950
18802
  * `beginExternalLink` offer exactly the redirect methods that set this,
17951
- * whatever their id. Absent / false — a login button only (magic-link).
18803
+ * whatever their id. Absent / false — a login button only.
17952
18804
  */
17953
18805
  linkable: boolean().optional()
17954
18806
  }),
@@ -21803,8 +22655,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21803
22655
  * `super_admin` — collapsed onto the single boolean because every
21804
22656
  * non-admin caller is governed by the same scope-check rules; the
21805
22657
  * distinction was only ever used to route role-specific procedures
21806
- * which we no longer have. Agents are admin sessions issued via
21807
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22658
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21808
22659
  * with `isAdmin: false` + an explicit scope list.
21809
22660
  */
21810
22661
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -24499,6 +25350,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24499
25350
  kind: "mutation",
24500
25351
  auth: "admin",
24501
25352
  timeoutMs: 60 * 6e4
25353
+ }), method(object({
25354
+ filter: RetrainExportFilterSchema,
25355
+ layout: RetrainExportLayoutSchema
25356
+ }), object({
25357
+ ticket: PeerBytesTicketSchema,
25358
+ frames: number().int(),
25359
+ annotations: number().int()
25360
+ }), {
25361
+ kind: "mutation",
25362
+ auth: "admin",
25363
+ timeoutMs: 12e4
24502
25364
  }), method(object({
24503
25365
  selection: RetrainDatasetSelectionSchema,
24504
25366
  completeOnly: boolean().optional()
@@ -28107,8 +28969,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
28107
28969
  * `smtp-provider` — pluggable email delivery surface.
28108
28970
  *
28109
28971
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
28110
- * one for transactional / one for notifications). Consumers (magic-link,
28111
- * notifier addons, …) walk the collection and pick the first
28972
+ * one for transactional / one for notifications). Consumers (notifier
28973
+ * addons, …) walk the collection and pick the first
28112
28974
  * ready provider OR target a specific addonId.
28113
28975
  *
28114
28976
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -28391,7 +29253,7 @@ targets: array(object({
28391
29253
  };
28392
29254
  /**
28393
29255
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
28394
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
29256
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
28395
29257
  * carrying the post-callback claims before redirecting back to
28396
29258
  * `/api/auth/sso/finish`.
28397
29259
  *
@@ -28454,7 +29316,14 @@ var SsoBridgeClaimsSchema = object({
28454
29316
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28455
29317
  * subject is unique only per issuer, so a link is bound to it.
28456
29318
  */
28457
- issuer: string().optional()
29319
+ issuer: string().optional(),
29320
+ /**
29321
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
29322
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
29323
+ * request to present the matching cookie — a login bridge is useless in
29324
+ * any other browser.
29325
+ */
29326
+ browserBinding: string().optional()
28458
29327
  });
28459
29328
  method(object({
28460
29329
  claims: SsoBridgeClaimsSchema,
@@ -40721,16 +41590,6 @@ var ApiKeySummarySchema = object({
40721
41590
  createdAt: number(),
40722
41591
  lastUsedAt: number().optional()
40723
41592
  });
40724
- var CreateApiKeyInputSchema = object({
40725
- label: string(),
40726
- isAdmin: boolean().default(false),
40727
- allowedProviders: union([array(string()), literal("*")]).optional(),
40728
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
40729
- });
40730
- var CreateApiKeyResultSchema = object({
40731
- token: string(),
40732
- record: ApiKeySummarySchema
40733
- });
40734
41593
  var ScopedTokenSummarySchema = object({
40735
41594
  id: string(),
40736
41595
  userId: string(),
@@ -40829,17 +41688,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40829
41688
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
40830
41689
  kind: "mutation",
40831
41690
  access: "view"
40832
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
40833
- kind: "mutation",
40834
- auth: "admin",
40835
- access: "create"
40836
- }), method(object({ id: string() }), object({ success: literal(true) }), {
41691
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
40837
41692
  kind: "mutation",
40838
41693
  auth: "admin",
40839
41694
  access: "delete"
40840
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
40841
- kind: "mutation",
40842
- access: "view"
40843
41695
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
40844
41696
  kind: "mutation",
40845
41697
  auth: "admin",
@@ -40913,15 +41765,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40913
41765
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
40914
41766
  userId: string(),
40915
41767
  issuer: string()
40916
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
40917
- userId: string(),
40918
- issuer: string().min(1),
40919
- label: string().optional()
40920
- }), object({ success: literal(true) }), {
40921
- kind: "mutation",
40922
- auth: "admin",
40923
- access: "create"
40924
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41768
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
40925
41769
  kind: "mutation",
40926
41770
  auth: "admin",
40927
41771
  access: "delete"
@@ -41626,6 +42470,451 @@ var zoneRulesCapability = {
41626
42470
  */
41627
42471
  durability: "restored"
41628
42472
  };
42473
+ /**
42474
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
42475
+ *
42476
+ * A thin, mockable translation layer: it knows how to run a container with a
42477
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
42478
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
42479
+ * those are the `training` orchestrator's (D805). Every rule written there
42480
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
42481
+ * manifest entry and nothing else.
42482
+ *
42483
+ * Collection, routed by the `addonId` in every single-row input (the `llm` /
42484
+ * `notification-output` posture); `describe` concat-fans across providers.
42485
+ * Every method is `admin`: these spend money.
42486
+ *
42487
+ * Every cloud object a provider creates is tagged with the orchestrator's
42488
+ * `jobKey`, so a retried submit finds the job it already started instead of
42489
+ * starting a second GPU, and `listJobs` can find orphans.
42490
+ *
42491
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
42492
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
42493
+ * ticket the provider mints (D613).
42494
+ */
42495
+ var TrainingGpuOptionSchema = object({
42496
+ id: string(),
42497
+ label: string(),
42498
+ /** List price, USD per GPU-hour, before any region multiplier. */
42499
+ usdPerHour: number().nonnegative(),
42500
+ vramGb: number().nonnegative()
42501
+ });
42502
+ var TrainingRegionOptionSchema = object({
42503
+ /** `''` = any region (the provider's choice). */
42504
+ id: string(),
42505
+ label: string(),
42506
+ priceMultiplier: number().positive()
42507
+ });
42508
+ /**
42509
+ * The provider's per-account settings, as the orchestrator reads them. They
42510
+ * live in the PROVIDER addon's settings (operator decision 2026-10-08: they
42511
+ * depend on the user's account), never hard-coded in the orchestrator.
42512
+ */
42513
+ var TrainingProviderDefaultsSchema = object({
42514
+ gpuType: string(),
42515
+ region: string(),
42516
+ costCapUsd: number().nonnegative(),
42517
+ maxRuntimeSec: number().int().positive(),
42518
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
42519
+ failedDatasetGraceHours: number().nonnegative()
42520
+ });
42521
+ var TrainingProviderDescriptorSchema = object({
42522
+ addonId: string(),
42523
+ /** `modal`, `runpod`, `fake`, … */
42524
+ kind: string(),
42525
+ label: string(),
42526
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
42527
+ regions: array(TrainingRegionOptionSchema).readonly(),
42528
+ maxDatasetBytes: number().int().positive(),
42529
+ maxRuntimeSec: number().int().positive(),
42530
+ freeTierNote: string().optional(),
42531
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
42532
+ dataResidencyNote: string(),
42533
+ /** Credentials are present — never the values. */
42534
+ configured: boolean(),
42535
+ defaults: TrainingProviderDefaultsSchema
42536
+ });
42537
+ var TrainingCredentialCheckSchema = object({
42538
+ ok: boolean(),
42539
+ /** Workspace / account name, when the provider says. */
42540
+ account: string().optional(),
42541
+ reason: _enum([
42542
+ "missing",
42543
+ "invalid",
42544
+ "forbidden",
42545
+ "network",
42546
+ "quota"
42547
+ ]).optional(),
42548
+ detail: string().optional()
42549
+ });
42550
+ var ProviderJobStateSchema = _enum([
42551
+ "pending",
42552
+ "starting",
42553
+ "running",
42554
+ "succeeded",
42555
+ "failed",
42556
+ "cancelled",
42557
+ "lost"
42558
+ ]);
42559
+ var ProviderJobStatusSchema = object({
42560
+ jobKey: string(),
42561
+ providerJobId: string().optional(),
42562
+ state: ProviderJobStateSchema,
42563
+ startedAt: number().optional(),
42564
+ endedAt: number().optional(),
42565
+ exitCode: number().int().optional(),
42566
+ failureReason: string().optional(),
42567
+ gpuType: string(),
42568
+ region: string().optional(),
42569
+ billedSeconds: number().nonnegative(),
42570
+ costUsd: number().nonnegative(),
42571
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
42572
+ costIsEstimate: boolean(),
42573
+ lastFetchedAt: number()
42574
+ });
42575
+ /**
42576
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
42577
+ * image its own way (Modal builds the published Dockerfile at that revision;
42578
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
42579
+ * in `result.json`.
42580
+ */
42581
+ var TrainerSourceRefSchema = object({
42582
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
42583
+ repo: string().min(1),
42584
+ /** A commit sha (never a branch) — the job must be reproducible. */
42585
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
42586
+ });
42587
+ var JobRef = {
42588
+ addonId: string(),
42589
+ jobKey: string().uuid()
42590
+ };
42591
+ var TrainingLogLineSchema = object({
42592
+ ts: number(),
42593
+ text: string()
42594
+ });
42595
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
42596
+ kind: "mutation",
42597
+ auth: "admin",
42598
+ timeoutMs: 3e4
42599
+ }), method(object({
42600
+ addonId: string(),
42601
+ gpuType: string(),
42602
+ region: string(),
42603
+ datasetBytes: number().int().nonnegative(),
42604
+ gpuSecondsLow: number().nonnegative(),
42605
+ gpuSecondsHigh: number().nonnegative()
42606
+ }), object({
42607
+ usdLow: number().nonnegative(),
42608
+ usdHigh: number().nonnegative(),
42609
+ notes: array(string()).readonly()
42610
+ }), { auth: "admin" }), method(object({
42611
+ ...JobRef,
42612
+ ticket: PeerBytesTicketSchema
42613
+ }), object({
42614
+ bytes: number().int().nonnegative(),
42615
+ sha256: string()
42616
+ }), {
42617
+ kind: "mutation",
42618
+ auth: "admin",
42619
+ timeoutMs: 120 * 6e4
42620
+ }), method(object({
42621
+ ...JobRef,
42622
+ trainer: TrainerSourceRefSchema,
42623
+ jobSpecJson: string().min(2).max(64e3),
42624
+ gpuType: string(),
42625
+ region: string(),
42626
+ maxRuntimeSec: number().int().positive()
42627
+ }), ProviderJobStatusSchema, {
42628
+ kind: "mutation",
42629
+ auth: "admin",
42630
+ timeoutMs: 30 * 6e4
42631
+ }), method(object(JobRef), ProviderJobStatusSchema, {
42632
+ auth: "admin",
42633
+ timeoutMs: 6e4
42634
+ }), method(object({
42635
+ ...JobRef,
42636
+ cursor: string().optional(),
42637
+ max: number().int().min(1).max(500)
42638
+ }), object({
42639
+ lines: array(TrainingLogLineSchema).readonly(),
42640
+ cursor: string()
42641
+ }), {
42642
+ auth: "admin",
42643
+ timeoutMs: 6e4
42644
+ }), method(object(JobRef), object({ ok: literal(true) }), {
42645
+ kind: "mutation",
42646
+ auth: "admin",
42647
+ timeoutMs: 6e4
42648
+ }), method(object(JobRef), object({
42649
+ found: boolean(),
42650
+ text: string().optional()
42651
+ }), {
42652
+ kind: "mutation",
42653
+ auth: "admin",
42654
+ timeoutMs: 5 * 6e4
42655
+ }), method(object({
42656
+ ...JobRef,
42657
+ path: _enum(["bundle.tar"])
42658
+ }), object({ ticket: PeerBytesTicketSchema }), {
42659
+ kind: "mutation",
42660
+ auth: "admin",
42661
+ timeoutMs: 5 * 6e4
42662
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
42663
+ kind: "mutation",
42664
+ auth: "admin",
42665
+ timeoutMs: 5 * 6e4
42666
+ }), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
42667
+ auth: "admin",
42668
+ timeoutMs: 2 * 6e4
42669
+ });
42670
+ /**
42671
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
42672
+ * provided by `addon-training`.
42673
+ *
42674
+ * It owns what every provider must agree on, written once:
42675
+ *
42676
+ * - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
42677
+ * live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
42678
+ * the export plan) and reaches this store through the five row methods
42679
+ * below, so the Retrain page and the export did not change.
42680
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
42681
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
42682
+ * - **The return flow.** Verified artefacts → Model Studio
42683
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
42684
+ * rollback. Nothing is ever registered automatically.
42685
+ *
42686
+ * Every method is `admin`.
42687
+ */
42688
+ /** A version WITH its frame list — what the export and a job read. */
42689
+ var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
42690
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
42691
+ var TrainingBaseModelSchema = object({
42692
+ modelId: string(),
42693
+ label: string(),
42694
+ weights: string(),
42695
+ imgsz: number().int(),
42696
+ baselineOnnxUrl: string(),
42697
+ baselineFloors: record(string(), number()),
42698
+ /** The base the fleet runs most — the UI's default. */
42699
+ recommended: boolean()
42700
+ });
42701
+ var TrainingPresetSchema = _enum([
42702
+ "quick",
42703
+ "standard",
42704
+ "thorough"
42705
+ ]);
42706
+ var TrainingJobRequestSchema = object({
42707
+ datasetVersionId: string().min(1),
42708
+ /** The `training-provider` addon that runs it. */
42709
+ addonId: string().min(1),
42710
+ gpuType: string().min(1),
42711
+ region: string(),
42712
+ baseModelId: string().min(1),
42713
+ preset: TrainingPresetSchema,
42714
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
42715
+ freeze: number().int().nonnegative().nullable(),
42716
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
42717
+ holdoutCameras: array(number().int()).nullable()
42718
+ });
42719
+ var TrainingSplitPlanSchema = object({
42720
+ holdoutCameras: array(number().int()).readonly(),
42721
+ /** Used when no camera is held out: the last N days of every camera. */
42722
+ holdoutLastDays: number().int().nonnegative(),
42723
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
42724
+ holdoutSupport: record(string(), number().int()).nullable(),
42725
+ trainSubjects: number().int()
42726
+ });
42727
+ var TrainingRefusalReasonSchema = _enum([
42728
+ "unknown-dataset",
42729
+ "unknown-provider",
42730
+ "provider-not-configured",
42731
+ "unknown-base-model",
42732
+ "unknown-gpu",
42733
+ "dataset-too-large",
42734
+ "no-training-subjects",
42735
+ "job-already-running"
42736
+ ]);
42737
+ var TrainingJobPlanSchema = object({
42738
+ refusal: object({
42739
+ reason: TrainingRefusalReasonSchema,
42740
+ detail: string()
42741
+ }).nullable(),
42742
+ warnings: array(string()).readonly(),
42743
+ split: TrainingSplitPlanSchema.nullable(),
42744
+ estimate: object({
42745
+ datasetBytes: number().int(),
42746
+ uploadMinutesAt20Mbps: number(),
42747
+ gpuSecondsLow: number(),
42748
+ gpuSecondsHigh: number(),
42749
+ usdLow: number(),
42750
+ usdHigh: number(),
42751
+ notes: array(string()).readonly()
42752
+ }).nullable(),
42753
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
42754
+ defaults: object({
42755
+ maxCostUsd: number(),
42756
+ maxRuntimeSec: number().int()
42757
+ }).nullable(),
42758
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
42759
+ dataNotice: string()
42760
+ });
42761
+ /**
42762
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
42763
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
42764
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
42765
+ * result lives after the operator acted on it.
42766
+ */
42767
+ var TrainingJobStateSchema = _enum([
42768
+ "uploading",
42769
+ "submitted",
42770
+ "starting",
42771
+ "running",
42772
+ "collecting",
42773
+ "ready",
42774
+ "registered",
42775
+ "canary",
42776
+ "failed",
42777
+ "cancelling",
42778
+ "cancelled",
42779
+ "lost",
42780
+ "expired",
42781
+ "discarded"
42782
+ ]);
42783
+ var TrainingFailureReasonSchema = _enum([
42784
+ "cost-cap",
42785
+ "runtime-cap",
42786
+ "upload-failed",
42787
+ "submit-failed",
42788
+ "trainer-failed",
42789
+ "result-invalid",
42790
+ "checksum-mismatch",
42791
+ "fetch-failed",
42792
+ "provider-error",
42793
+ "hub-restart-during-upload"
42794
+ ]);
42795
+ var TrainingProgressPointSchema = object({
42796
+ epoch: number().int(),
42797
+ map50: number().nullable(),
42798
+ map50_95: number().nullable()
42799
+ });
42800
+ var TrainingCanarySchema = object({
42801
+ deviceIds: array(number().int()).readonly(),
42802
+ since: number(),
42803
+ /** Every override the canary replaced, exactly, so rollback restores it. */
42804
+ previous: array(object({
42805
+ deviceId: number().int(),
42806
+ nodeId: string(),
42807
+ deviceKey: string(),
42808
+ patch: object({
42809
+ modelId: string().optional(),
42810
+ settings: record(string(), unknown()).readonly().optional()
42811
+ }).nullable()
42812
+ })).readonly()
42813
+ });
42814
+ var TrainingJobSchema = object({
42815
+ id: string(),
42816
+ idempotencyKey: string(),
42817
+ name: string(),
42818
+ createdAt: number(),
42819
+ updatedAt: number(),
42820
+ state: TrainingJobStateSchema,
42821
+ stage: TrainingStageSchema.nullable(),
42822
+ failure: object({
42823
+ reason: TrainingFailureReasonSchema,
42824
+ stage: string().nullable(),
42825
+ detail: string()
42826
+ }).nullable(),
42827
+ request: TrainingJobRequestSchema,
42828
+ maxCostUsd: number().nonnegative(),
42829
+ maxRuntimeSec: number().int().positive(),
42830
+ trainer: TrainerSourceRefSchema,
42831
+ datasetLayout: RetrainExportLayoutSchema,
42832
+ dataset: object({
42833
+ bytes: number().int(),
42834
+ sha256: string(),
42835
+ uploadedAt: number()
42836
+ }).nullable(),
42837
+ split: TrainingSplitPlanSchema,
42838
+ provider: object({
42839
+ state: ProviderJobStateSchema.nullable(),
42840
+ providerJobId: string().nullable(),
42841
+ startedAt: number().nullable(),
42842
+ endedAt: number().nullable(),
42843
+ billedSeconds: number(),
42844
+ costUsd: number(),
42845
+ costIsEstimate: boolean(),
42846
+ lastPolledAt: number().nullable()
42847
+ }),
42848
+ progress: object({
42849
+ epoch: number().int().nullable(),
42850
+ epochs: number().int().nullable(),
42851
+ etaSec: number().nullable(),
42852
+ series: array(TrainingProgressPointSchema).readonly()
42853
+ }),
42854
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
42855
+ logTail: array(string()).readonly(),
42856
+ logCursor: string().nullable(),
42857
+ artifacts: object({
42858
+ bundleBytes: number().int(),
42859
+ bundleSha256: string(),
42860
+ fetchedAt: number(),
42861
+ /** When the staged artefacts are deleted from the hub. */
42862
+ expiresAt: number()
42863
+ }).nullable(),
42864
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
42865
+ cloudDatasetDeletedAt: number().nullable(),
42866
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
42867
+ cloudCleanupDueAt: number().nullable(),
42868
+ /** Model ids registered from this job (base, and int8 when kept). */
42869
+ registeredModelIds: array(string()).readonly(),
42870
+ canary: TrainingCanarySchema.nullable()
42871
+ });
42872
+ var IdInput = object({ id: string().min(1) });
42873
+ method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
42874
+ kind: "mutation",
42875
+ auth: "admin"
42876
+ }), 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() }), {
42877
+ kind: "mutation",
42878
+ auth: "admin"
42879
+ }), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
42880
+ auth: "admin",
42881
+ timeoutMs: 6e4
42882
+ }), method(TrainingJobRequestSchema.extend({
42883
+ name: string().min(1).max(120),
42884
+ maxCostUsd: number().positive(),
42885
+ maxRuntimeSec: number().int().positive(),
42886
+ idempotencyKey: string().min(8).max(80)
42887
+ }), discriminatedUnion("kind", [object({
42888
+ kind: literal("started"),
42889
+ job: TrainingJobSchema
42890
+ }), object({
42891
+ kind: literal("refused"),
42892
+ reason: TrainingRefusalReasonSchema,
42893
+ detail: string()
42894
+ })]), {
42895
+ kind: "mutation",
42896
+ auth: "admin",
42897
+ timeoutMs: 12e4
42898
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
42899
+ kind: "mutation",
42900
+ auth: "admin",
42901
+ timeoutMs: 12e4
42902
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
42903
+ kind: "mutation",
42904
+ auth: "admin",
42905
+ timeoutMs: 30 * 6e4
42906
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
42907
+ kind: "mutation",
42908
+ auth: "admin",
42909
+ timeoutMs: 12e4
42910
+ }), method(IdInput, TrainingJobSchema, {
42911
+ kind: "mutation",
42912
+ auth: "admin",
42913
+ timeoutMs: 12e4
42914
+ }), method(IdInput, TrainingJobSchema, {
42915
+ kind: "mutation",
42916
+ auth: "admin"
42917
+ });
41629
42918
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
41630
42919
  Object.freeze({
41631
42920
  person: .5,
@@ -43774,6 +45063,12 @@ Object.freeze({
43774
45063
  addonId: null,
43775
45064
  access: "create"
43776
45065
  },
45066
+ "backup.checkBackupKey": {
45067
+ capName: "backup",
45068
+ capScope: "system",
45069
+ addonId: null,
45070
+ access: "create"
45071
+ },
43777
45072
  "backup.delete": {
43778
45073
  capName: "backup",
43779
45074
  capScope: "system",
@@ -43786,6 +45081,18 @@ Object.freeze({
43786
45081
  addonId: null,
43787
45082
  access: "delete"
43788
45083
  },
45084
+ "backup.disableEncryption": {
45085
+ capName: "backup",
45086
+ capScope: "system",
45087
+ addonId: null,
45088
+ access: "create"
45089
+ },
45090
+ "backup.getEncryption": {
45091
+ capName: "backup",
45092
+ capScope: "system",
45093
+ addonId: null,
45094
+ access: "view"
45095
+ },
43789
45096
  "backup.getEntries": {
43790
45097
  capName: "backup",
43791
45098
  capScope: "system",
@@ -43840,6 +45147,12 @@ Object.freeze({
43840
45147
  addonId: null,
43841
45148
  access: "create"
43842
45149
  },
45150
+ "backup.setupEncryption": {
45151
+ capName: "backup",
45152
+ capScope: "system",
45153
+ addonId: null,
45154
+ access: "create"
45155
+ },
43843
45156
  "backup.trigger": {
43844
45157
  capName: "backup",
43845
45158
  capScope: "system",
@@ -44392,6 +45705,12 @@ Object.freeze({
44392
45705
  addonId: null,
44393
45706
  access: "create"
44394
45707
  },
45708
+ "customModelRegistry.importModelBundle": {
45709
+ capName: "custom-model-registry",
45710
+ capScope: "system",
45711
+ addonId: null,
45712
+ access: "create"
45713
+ },
44395
45714
  "customModelRegistry.listModels": {
44396
45715
  capName: "custom-model-registry",
44397
45716
  capScope: "system",
@@ -45832,6 +47151,12 @@ Object.freeze({
45832
47151
  addonId: null,
45833
47152
  access: "view"
45834
47153
  },
47154
+ "keychainAdmin.acknowledgeReset": {
47155
+ capName: "keychain-admin",
47156
+ capScope: "system",
47157
+ addonId: null,
47158
+ access: "create"
47159
+ },
45835
47160
  "keychainAdmin.deleteOrphans": {
45836
47161
  capName: "keychain-admin",
45837
47162
  capScope: "system",
@@ -45868,6 +47193,12 @@ Object.freeze({
45868
47193
  addonId: null,
45869
47194
  access: "delete"
45870
47195
  },
47196
+ "keychainAdmin.resetReport": {
47197
+ capName: "keychain-admin",
47198
+ capScope: "system",
47199
+ addonId: null,
47200
+ access: "delete"
47201
+ },
45871
47202
  "keychainAdmin.reveal": {
45872
47203
  capName: "keychain-admin",
45873
47204
  capScope: "system",
@@ -47614,6 +48945,12 @@ Object.freeze({
47614
48945
  addonId: null,
47615
48946
  access: "view"
47616
48947
  },
48948
+ "pipelineAnalytics.offerRetrainArchive": {
48949
+ capName: "pipeline-analytics",
48950
+ capScope: "device",
48951
+ addonId: null,
48952
+ access: "create"
48953
+ },
47617
48954
  "pipelineAnalytics.ownersWithMedia": {
47618
48955
  capName: "pipeline-analytics",
47619
48956
  capScope: "device",
@@ -50152,6 +51489,174 @@ Object.freeze({
50152
51489
  addonId: null,
50153
51490
  access: "view"
50154
51491
  },
51492
+ "training.canaryResult": {
51493
+ capName: "training",
51494
+ capScope: "system",
51495
+ addonId: null,
51496
+ access: "create"
51497
+ },
51498
+ "training.cancelJob": {
51499
+ capName: "training",
51500
+ capScope: "system",
51501
+ addonId: null,
51502
+ access: "create"
51503
+ },
51504
+ "training.discardResult": {
51505
+ capName: "training",
51506
+ capScope: "system",
51507
+ addonId: null,
51508
+ access: "create"
51509
+ },
51510
+ "training.findDatasetVersionIdByName": {
51511
+ capName: "training",
51512
+ capScope: "system",
51513
+ addonId: null,
51514
+ access: "view"
51515
+ },
51516
+ "training.getDatasetVersion": {
51517
+ capName: "training",
51518
+ capScope: "system",
51519
+ addonId: null,
51520
+ access: "view"
51521
+ },
51522
+ "training.getJob": {
51523
+ capName: "training",
51524
+ capScope: "system",
51525
+ addonId: null,
51526
+ access: "view"
51527
+ },
51528
+ "training.getJobResult": {
51529
+ capName: "training",
51530
+ capScope: "system",
51531
+ addonId: null,
51532
+ access: "view"
51533
+ },
51534
+ "training.listBaseModels": {
51535
+ capName: "training",
51536
+ capScope: "system",
51537
+ addonId: null,
51538
+ access: "view"
51539
+ },
51540
+ "training.listDatasetVersions": {
51541
+ capName: "training",
51542
+ capScope: "system",
51543
+ addonId: null,
51544
+ access: "view"
51545
+ },
51546
+ "training.listJobs": {
51547
+ capName: "training",
51548
+ capScope: "system",
51549
+ addonId: null,
51550
+ access: "view"
51551
+ },
51552
+ "training.planJob": {
51553
+ capName: "training",
51554
+ capScope: "system",
51555
+ addonId: null,
51556
+ access: "view"
51557
+ },
51558
+ "training.putDatasetVersion": {
51559
+ capName: "training",
51560
+ capScope: "system",
51561
+ addonId: null,
51562
+ access: "create"
51563
+ },
51564
+ "training.registerResult": {
51565
+ capName: "training",
51566
+ capScope: "system",
51567
+ addonId: null,
51568
+ access: "create"
51569
+ },
51570
+ "training.removeDatasetVersion": {
51571
+ capName: "training",
51572
+ capScope: "system",
51573
+ addonId: null,
51574
+ access: "delete"
51575
+ },
51576
+ "training.rollbackCanary": {
51577
+ capName: "training",
51578
+ capScope: "system",
51579
+ addonId: null,
51580
+ access: "create"
51581
+ },
51582
+ "training.startJob": {
51583
+ capName: "training",
51584
+ capScope: "system",
51585
+ addonId: null,
51586
+ access: "create"
51587
+ },
51588
+ "trainingProvider.cancelJob": {
51589
+ capName: "training-provider",
51590
+ capScope: "system",
51591
+ addonId: null,
51592
+ access: "create"
51593
+ },
51594
+ "trainingProvider.cleanupJob": {
51595
+ capName: "training-provider",
51596
+ capScope: "system",
51597
+ addonId: null,
51598
+ access: "create"
51599
+ },
51600
+ "trainingProvider.describe": {
51601
+ capName: "training-provider",
51602
+ capScope: "system",
51603
+ addonId: null,
51604
+ access: "view"
51605
+ },
51606
+ "trainingProvider.estimateJob": {
51607
+ capName: "training-provider",
51608
+ capScope: "system",
51609
+ addonId: null,
51610
+ access: "view"
51611
+ },
51612
+ "trainingProvider.getJob": {
51613
+ capName: "training-provider",
51614
+ capScope: "system",
51615
+ addonId: null,
51616
+ access: "view"
51617
+ },
51618
+ "trainingProvider.listJobEvents": {
51619
+ capName: "training-provider",
51620
+ capScope: "system",
51621
+ addonId: null,
51622
+ access: "view"
51623
+ },
51624
+ "trainingProvider.listJobs": {
51625
+ capName: "training-provider",
51626
+ capScope: "system",
51627
+ addonId: null,
51628
+ access: "view"
51629
+ },
51630
+ "trainingProvider.offerArtifact": {
51631
+ capName: "training-provider",
51632
+ capScope: "system",
51633
+ addonId: null,
51634
+ access: "create"
51635
+ },
51636
+ "trainingProvider.readResult": {
51637
+ capName: "training-provider",
51638
+ capScope: "system",
51639
+ addonId: null,
51640
+ access: "create"
51641
+ },
51642
+ "trainingProvider.submitJob": {
51643
+ capName: "training-provider",
51644
+ capScope: "system",
51645
+ addonId: null,
51646
+ access: "create"
51647
+ },
51648
+ "trainingProvider.uploadDataset": {
51649
+ capName: "training-provider",
51650
+ capScope: "system",
51651
+ addonId: null,
51652
+ access: "create"
51653
+ },
51654
+ "trainingProvider.validateCredentials": {
51655
+ capName: "training-provider",
51656
+ capScope: "system",
51657
+ addonId: null,
51658
+ access: "create"
51659
+ },
50155
51660
  "turnProvider.getTurnServers": {
50156
51661
  capName: "turn-provider",
50157
51662
  capScope: "system",
@@ -50176,12 +51681,6 @@ Object.freeze({
50176
51681
  addonId: null,
50177
51682
  access: "create"
50178
51683
  },
50179
- "userManagement.createApiKey": {
50180
- capName: "user-management",
50181
- capScope: "system",
50182
- addonId: null,
50183
- access: "create"
50184
- },
50185
51684
  "userManagement.createScopedToken": {
50186
51685
  capName: "user-management",
50187
51686
  capScope: "system",
@@ -50218,12 +51717,6 @@ Object.freeze({
50218
51717
  addonId: null,
50219
51718
  access: "view"
50220
51719
  },
50221
- "userManagement.linkExternalIdentity": {
50222
- capName: "user-management",
50223
- capScope: "system",
50224
- addonId: null,
50225
- access: "create"
50226
- },
50227
51720
  "userManagement.listApiKeys": {
50228
51721
  capName: "user-management",
50229
51722
  capScope: "system",
@@ -50326,12 +51819,6 @@ Object.freeze({
50326
51819
  addonId: null,
50327
51820
  access: "create"
50328
51821
  },
50329
- "userManagement.validateApiKey": {
50330
- capName: "user-management",
50331
- capScope: "system",
50332
- addonId: null,
50333
- access: "view"
50334
- },
50335
51822
  "userManagement.validateCredentials": {
50336
51823
  capName: "user-management",
50337
51824
  capScope: "system",
@@ -54445,6 +55932,11 @@ Object.freeze({
54445
55932
  form: "single",
54446
55933
  optional: false
54447
55934
  }],
55935
+ "training.canaryResult": [{
55936
+ name: "deviceIds",
55937
+ form: "array",
55938
+ optional: false
55939
+ }],
54448
55940
  "update.getStatus": [{
54449
55941
  name: "deviceId",
54450
55942
  form: "single",