@camstack/addon-terminal 0.1.128 → 0.1.130

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 +1631 -131
  2. package/dist/addon.mjs +1631 -131
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -5386,7 +5386,7 @@ var ZodIssueCode = {
5386
5386
  var ZodFirstPartyTypeKind;
5387
5387
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5388
5388
  //#endregion
5389
- //#region ../types/dist/sleep-DujUvOcb.mjs
5389
+ //#region ../types/dist/sleep-r3RWkGVx.mjs
5390
5390
  /**
5391
5391
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5392
5392
  * window to float samples (D455).
@@ -5503,7 +5503,7 @@ function isKeychainStoredField(field) {
5503
5503
  var SECRET_CLEAR = { $secretClear: true };
5504
5504
  /** The `'***'` token D634 redaction writes for non-admins. */
5505
5505
  var LEGACY_DEVICE_REDACTION = "***";
5506
- function isRecord$1(value) {
5506
+ function isRecord$2(value) {
5507
5507
  return typeof value === "object" && value !== null && !Array.isArray(value);
5508
5508
  }
5509
5509
  function makeSecretMarker(ref) {
@@ -5514,12 +5514,12 @@ function makeSecretMarker(ref) {
5514
5514
  }
5515
5515
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5516
5516
  function isSecretMarker(value) {
5517
- if (!isRecord$1(value)) return false;
5517
+ if (!isRecord$2(value)) return false;
5518
5518
  const ref = value["$secret"];
5519
5519
  return typeof ref === "string" && ref.length > 0;
5520
5520
  }
5521
5521
  function isSecretClear(value) {
5522
- return isRecord$1(value) && value["$secretClear"] === true;
5522
+ return isRecord$2(value) && value["$secretClear"] === true;
5523
5523
  }
5524
5524
  /**
5525
5525
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6035,6 +6035,13 @@ function globalSecretScope() {
6035
6035
  function encodeSegment(value) {
6036
6036
  return encodeURIComponent(value);
6037
6037
  }
6038
+ function decodeSegment(value) {
6039
+ try {
6040
+ return decodeURIComponent(value);
6041
+ } catch {
6042
+ return null;
6043
+ }
6044
+ }
6038
6045
  /**
6039
6046
  * The field path of a value inside an array item, addressed by the item's id:
6040
6047
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6043,6 +6050,75 @@ function encodeSegment(value) {
6043
6050
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6044
6051
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6045
6052
  }
6053
+ function parseScope(segments) {
6054
+ switch (segments[0]) {
6055
+ case "global": return {
6056
+ scope: GLOBAL_SCOPE,
6057
+ used: 1
6058
+ };
6059
+ case "node": {
6060
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6061
+ return nodeId === null || nodeId.length === 0 ? null : {
6062
+ scope: {
6063
+ kind: "node",
6064
+ nodeId
6065
+ },
6066
+ used: 2
6067
+ };
6068
+ }
6069
+ case "device": {
6070
+ const raw = segments[1];
6071
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6072
+ return {
6073
+ scope: {
6074
+ kind: "device",
6075
+ deviceId: Number(raw)
6076
+ },
6077
+ used: 2
6078
+ };
6079
+ }
6080
+ case "integration": {
6081
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6082
+ return id === null || id.length === 0 ? null : {
6083
+ scope: {
6084
+ kind: "integration",
6085
+ integrationId: id
6086
+ },
6087
+ used: 2
6088
+ };
6089
+ }
6090
+ case "row": {
6091
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6092
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6093
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6094
+ return {
6095
+ scope: {
6096
+ kind: "row",
6097
+ collection,
6098
+ rowId
6099
+ },
6100
+ used: 3
6101
+ };
6102
+ }
6103
+ default: return null;
6104
+ }
6105
+ }
6106
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6107
+ function parseSecretRef(ref) {
6108
+ if (!ref.startsWith("secret://")) return null;
6109
+ const segments = ref.slice(9).split("/");
6110
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6111
+ if (owner === null || owner.length === 0) return null;
6112
+ const parsed = parseScope(segments.slice(1));
6113
+ if (parsed === null) return null;
6114
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6115
+ if (fieldPath.length === 0) return null;
6116
+ return {
6117
+ owner,
6118
+ scope: parsed.scope,
6119
+ fieldPath
6120
+ };
6121
+ }
6046
6122
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6047
6123
  var KeychainWriteRefusedError = class extends Error {
6048
6124
  fieldPath;
@@ -6053,7 +6129,7 @@ var KeychainWriteRefusedError = class extends Error {
6053
6129
  }
6054
6130
  };
6055
6131
  var KEEP = { kind: "keep" };
6056
- function isRecord(value) {
6132
+ function isRecord$1(value) {
6057
6133
  return typeof value === "object" && value !== null && !Array.isArray(value);
6058
6134
  }
6059
6135
  function defaultMintId() {
@@ -6066,7 +6142,7 @@ function collectSecretMarkerRefs(value, out = []) {
6066
6142
  return out;
6067
6143
  }
6068
6144
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6069
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6145
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6070
6146
  return out;
6071
6147
  }
6072
6148
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6121,7 +6197,7 @@ function rowId(row, idKey) {
6121
6197
  return null;
6122
6198
  }
6123
6199
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6124
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6200
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6125
6201
  if (!Array.isArray(incoming)) {
6126
6202
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6127
6203
  return {
@@ -6137,7 +6213,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6137
6213
  const kept = /* @__PURE__ */ new Set();
6138
6214
  const rows = [];
6139
6215
  for (const row of incoming) {
6140
- if (!isRecord(row)) {
6216
+ if (!isRecord$1(row)) {
6141
6217
  rows.push(row);
6142
6218
  continue;
6143
6219
  }
@@ -6162,7 +6238,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6162
6238
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6163
6239
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6164
6240
  case "object": {
6165
- if (!isRecord(incoming)) {
6241
+ if (!isRecord$1(incoming)) {
6166
6242
  if (incoming === void 0) return KEEP;
6167
6243
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6168
6244
  return {
@@ -6170,7 +6246,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6170
6246
  value: incoming
6171
6247
  };
6172
6248
  }
6173
- const storedObj = isRecord(stored) ? stored : {};
6249
+ const storedObj = isRecord$1(stored) ? stored : {};
6174
6250
  return {
6175
6251
  kind: "value",
6176
6252
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6229,12 +6305,19 @@ async function transformSecretWrite(input) {
6229
6305
  }
6230
6306
  };
6231
6307
  }
6308
+ /** Is `ref` one of `owner`'s refs? */
6309
+ function isSecretRefOwnedBy(ref, owner) {
6310
+ return parseSecretRef(ref)?.owner === owner;
6311
+ }
6232
6312
  /**
6233
6313
  * Replace every marker in `value` with its keychain value. Returns the SAME
6234
6314
  * reference when there is no marker (no allocation, no keychain call).
6235
6315
  */
6236
- async function resolveSecretMarkers(value, secrets) {
6237
- const refs = collectSecretMarkerRefs(value);
6316
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6317
+ const keepMarker = options.unresolved === "keep-marker";
6318
+ const owner = options.ownedBy;
6319
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6320
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6238
6321
  if (refs.length === 0) return {
6239
6322
  value,
6240
6323
  unresolved: []
@@ -6258,10 +6341,18 @@ async function resolveSecretMarkers(value, secrets) {
6258
6341
  }
6259
6342
  const substitute = (v) => {
6260
6343
  if (isSecretMarker(v)) {
6344
+ if (!inScope(v.$secret)) return {
6345
+ keep: true,
6346
+ value: v
6347
+ };
6261
6348
  const answer = answers[v.$secret];
6262
- return answer?.kind === "value" ? {
6349
+ if (answer?.kind === "value") return {
6263
6350
  keep: true,
6264
6351
  value: answer.value
6352
+ };
6353
+ return keepMarker ? {
6354
+ keep: true,
6355
+ value: v
6265
6356
  } : {
6266
6357
  keep: false,
6267
6358
  value: void 0
@@ -6278,7 +6369,7 @@ async function resolveSecretMarkers(value, secrets) {
6278
6369
  value: items
6279
6370
  };
6280
6371
  }
6281
- if (isRecord(v)) {
6372
+ if (isRecord$1(v)) {
6282
6373
  const out = {};
6283
6374
  for (const [k, child] of Object.entries(v)) {
6284
6375
  const s = substitute(child);
@@ -6299,14 +6390,152 @@ async function resolveSecretMarkers(value, secrets) {
6299
6390
  unresolved
6300
6391
  };
6301
6392
  }
6302
- function touchesTree(tree, patch) {
6303
- if (tree.size === 0) return false;
6304
- for (const key of Object.keys(patch)) {
6305
- const at = key.indexOf("@");
6306
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6393
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6394
+ var SecretOverwriteRefusedError = class extends Error {
6395
+ ref;
6396
+ reason;
6397
+ constructor(ref, reason) {
6398
+ 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.`);
6399
+ this.ref = ref;
6400
+ this.reason = reason;
6401
+ this.name = "SecretOverwriteRefusedError";
6402
+ }
6403
+ };
6404
+ function isRecord(value) {
6405
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6406
+ }
6407
+ function resolvedValue(pass, marker) {
6408
+ const answer = pass.answers[marker.$secret];
6409
+ return answer?.kind === "value" ? answer.value : null;
6410
+ }
6411
+ async function atMarker(pass, incoming, stored) {
6412
+ if (incoming === null) return stored;
6413
+ if (typeof incoming !== "string") return incoming;
6414
+ if (incoming === resolvedValue(pass, stored)) return stored;
6415
+ const intent = classifySecretWrite(incoming);
6416
+ if (intent.kind !== "set") return stored;
6417
+ const ref = stored.$secret;
6418
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6419
+ const answer = pass.answers[ref];
6420
+ 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);
6421
+ try {
6422
+ await pass.secrets.put(ref, intent.value);
6423
+ } catch (err) {
6424
+ throw new KeychainWriteRefusedError(ref, err);
6425
+ }
6426
+ pass.changedRefs.push(ref);
6427
+ return stored;
6428
+ }
6429
+ function inArray(pass, incoming, stored) {
6430
+ return incoming.map((item, index) => {
6431
+ const twin = stored[index];
6432
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6433
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6434
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6435
+ return item;
6436
+ });
6437
+ }
6438
+ function inArrayRow(pass, incoming, stored) {
6439
+ const out = { ...incoming };
6440
+ for (const [key, value] of Object.entries(incoming)) {
6441
+ const twin = stored[key];
6442
+ if (isSecretMarker(twin)) {
6443
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6444
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6445
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6446
+ }
6447
+ return out;
6448
+ }
6449
+ async function walk(pass, incoming, stored) {
6450
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6451
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6452
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6453
+ const out = { ...incoming };
6454
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6455
+ return out;
6456
+ }
6457
+ /** Restore markers a write-back carries as values. See the file doc. */
6458
+ async function restoreUnchangedSecrets(input) {
6459
+ const refs = [];
6460
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6461
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6462
+ if (owned.length === 0) return {
6463
+ patch: input.patch,
6464
+ changedRefs: []
6465
+ };
6466
+ const pass = {
6467
+ secrets: input.secrets,
6468
+ answers: await input.secrets.resolve([...new Set(owned)]),
6469
+ operatorWrite: input.operatorWrite,
6470
+ changedRefs: []
6471
+ };
6472
+ const out = {};
6473
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6474
+ return {
6475
+ patch: out,
6476
+ changedRefs: pass.changedRefs
6477
+ };
6478
+ }
6479
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6480
+ function isJsonEqual(a, b) {
6481
+ if (Object.is(a, b)) return true;
6482
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6483
+ if (isRecord(a) && isRecord(b)) {
6484
+ const keys = Object.keys(a);
6485
+ if (keys.length !== Object.keys(b).length) return false;
6486
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6307
6487
  }
6308
6488
  return false;
6309
6489
  }
6490
+ /** The patch without the keys whose value already equals the stored one. */
6491
+ function dropUnchangedKeys(patch, stored) {
6492
+ const out = {};
6493
+ for (const [key, value] of Object.entries(patch)) {
6494
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6495
+ out[key] = value;
6496
+ }
6497
+ return out;
6498
+ }
6499
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6500
+ function markerKeysOf(blob, owner) {
6501
+ const keys = /* @__PURE__ */ new Set();
6502
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6503
+ return keys;
6504
+ }
6505
+ function nodeFromStored(value, owner) {
6506
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6507
+ if (!isRecord(value)) return null;
6508
+ const children = /* @__PURE__ */ new Map();
6509
+ for (const [key, child] of Object.entries(value)) {
6510
+ const node = nodeFromStored(child, owner);
6511
+ if (node !== null) children.set(key, node);
6512
+ }
6513
+ return children.size > 0 ? {
6514
+ kind: "object",
6515
+ children
6516
+ } : null;
6517
+ }
6518
+ /**
6519
+ * The declared secret tree, widened by every place the STORED blob holds a
6520
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6521
+ * never declared: Wyze before b4906cec6) still gets the save path's
6522
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6523
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6524
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6525
+ * builtin that keeps another addon's marker (device-manager) never takes it
6526
+ * over.
6527
+ */
6528
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6529
+ const added = /* @__PURE__ */ new Map();
6530
+ for (const key of keys) {
6531
+ const at = key.indexOf("@");
6532
+ const base = at > 0 ? key.slice(0, at) : key;
6533
+ if (declared.has(base) || added.has(base)) continue;
6534
+ const node = nodeFromStored(stored[key], owner);
6535
+ if (node !== null) added.set(base, node);
6536
+ }
6537
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6538
+ }
6310
6539
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6311
6540
  async function readStoredAddonBlob(raw) {
6312
6541
  const threeWay = raw.readAddonStoreResult;
@@ -6315,7 +6544,41 @@ async function readStoredAddonBlob(raw) {
6315
6544
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6316
6545
  return result.kind === "missing" ? {} : result.value;
6317
6546
  }
6318
- function createSecretAwareSettings(raw, opts) {
6547
+ function touchesTree(tree, patch) {
6548
+ if (tree.size === 0) return false;
6549
+ for (const key of Object.keys(patch)) {
6550
+ const at = key.indexOf("@");
6551
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6552
+ }
6553
+ return false;
6554
+ }
6555
+ /**
6556
+ * Which top-level keys of each store held markers when last seen. `undefined`
6557
+ * for a store not seen yet: its first write reads it, to be safe.
6558
+ */
6559
+ var MarkerKeyIndex = class {
6560
+ owner;
6561
+ byStore = /* @__PURE__ */ new Map();
6562
+ constructor(owner) {
6563
+ this.owner = owner;
6564
+ }
6565
+ seen(store, blob) {
6566
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6567
+ }
6568
+ wrote(store, patch) {
6569
+ const keys = this.byStore.get(store);
6570
+ if (keys === void 0) return;
6571
+ const now = markerKeysOf(patch, this.owner);
6572
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6573
+ else keys.delete(key);
6574
+ }
6575
+ mayHoldMarkers(store, patch) {
6576
+ const keys = this.byStore.get(store);
6577
+ if (keys === void 0) return true;
6578
+ return Object.keys(patch).some((key) => keys.has(key));
6579
+ }
6580
+ };
6581
+ function createHandle(raw, opts) {
6319
6582
  const chains = /* @__PURE__ */ new Map();
6320
6583
  const serialize = (key, fn) => {
6321
6584
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6326,46 +6589,130 @@ function createSecretAwareSettings(raw, opts) {
6326
6589
  });
6327
6590
  return next;
6328
6591
  };
6329
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6330
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6331
- return serialize(chainKey, async () => {
6592
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6593
+ const resolveRead = async (store, blob) => {
6594
+ index.seen(store, blob);
6595
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6596
+ unresolved: "keep-marker",
6597
+ ownedBy: opts.secrets.owner
6598
+ });
6599
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6600
+ return value;
6601
+ };
6602
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6603
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6604
+ await rawWrite(patch);
6605
+ index.wrote(store, patch);
6606
+ return { changed: true };
6607
+ }
6608
+ return serialize(store, async () => {
6332
6609
  const stored = await readStored();
6610
+ index.seen(store, stored);
6611
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6612
+ const restored = await restoreUnchangedSecrets({
6613
+ patch,
6614
+ stored,
6615
+ secrets: opts.secrets,
6616
+ operatorWrite
6617
+ });
6333
6618
  const result = await transformSecretWrite({
6334
- tree,
6619
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6335
6620
  secrets: opts.secrets,
6336
- patch,
6621
+ patch: restored.patch,
6337
6622
  stored,
6338
6623
  ...scope !== void 0 ? { scope } : {},
6339
- operatorWrite: opts.isOperatorWrite?.() === true
6624
+ operatorWrite
6340
6625
  });
6341
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6626
+ const effective = dropUnchangedKeys(result.patch, stored);
6627
+ const wroteBlob = Object.keys(effective).length > 0;
6628
+ if (wroteBlob) {
6629
+ await rawWrite(effective);
6630
+ index.wrote(store, effective);
6631
+ }
6342
6632
  const { orphaned } = await result.afterWrite();
6343
6633
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6634
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6344
6635
  });
6345
6636
  };
6346
- const wrapped = {
6347
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6348
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6349
- kind: "device",
6350
- deviceId
6351
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6637
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6638
+ const readAddonStoreResult = raw.readAddonStoreResult;
6639
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6640
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6641
+ const overrides = {
6642
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6643
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6644
+ const result = await readAddonStoreResult.call(raw);
6645
+ return result.kind === "value" ? {
6646
+ kind: "value",
6647
+ value: await resolveRead("addon", result.value)
6648
+ } : result;
6649
+ } } : {},
6650
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6651
+ const result = await readAddonStoreKeyResult.call(raw, key);
6652
+ if (result.kind !== "present") return result;
6653
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6654
+ unresolved: "keep-marker",
6655
+ ownedBy: opts.secrets.owner
6656
+ });
6657
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6658
+ return {
6659
+ kind: "present",
6660
+ value: value[key]
6661
+ };
6662
+ } } : {},
6663
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6664
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6665
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6666
+ const out = /* @__PURE__ */ new Map();
6667
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6668
+ return out;
6669
+ } } : {},
6670
+ writeAddonStore: async (patch) => {
6671
+ await writeAddon(patch);
6672
+ },
6673
+ writeDeviceStore: async (deviceId, patch) => {
6674
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6675
+ kind: "device",
6676
+ deviceId
6677
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6678
+ }
6679
+ };
6680
+ return {
6681
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6682
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6683
+ const value = Reflect.get(target, prop, receiver);
6684
+ return typeof value === "function" ? value.bind(target) : value;
6685
+ } }),
6686
+ raw: {
6687
+ readAddonStore: async () => {
6688
+ const blob = await raw.readAddonStore();
6689
+ index.seen("addon", blob);
6690
+ return blob;
6691
+ },
6692
+ readDeviceStore: async (deviceId) => {
6693
+ const blob = await raw.readDeviceStore(deviceId);
6694
+ index.seen(`device:${deviceId}`, blob);
6695
+ return blob;
6696
+ }
6697
+ },
6698
+ writeAddonStore: writeAddon
6352
6699
  };
6353
- return new Proxy(raw, { get(target, prop, receiver) {
6354
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6355
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6356
- const value = Reflect.get(target, prop, receiver);
6357
- return typeof value === "function" ? value.bind(target) : value;
6358
- } });
6359
6700
  }
6360
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6361
- function withSecretAwareSettings(context, opts) {
6701
+ /** The context the addon sees, plus the private raw view and write outcome. */
6702
+ function createSecretAwareContext(context, opts) {
6362
6703
  const raw = context.settings;
6363
- if (raw === void 0) return context;
6364
- const settings = createSecretAwareSettings(raw, opts);
6365
- return new Proxy(context, { get(target, prop, receiver) {
6366
- if (prop === "settings") return settings;
6367
- return Reflect.get(target, prop, receiver);
6368
- } });
6704
+ if (raw === void 0) return {
6705
+ context,
6706
+ handle: null
6707
+ };
6708
+ const handle = createHandle(raw, opts);
6709
+ return {
6710
+ context: new Proxy(context, { get(target, prop, receiver) {
6711
+ if (prop === "settings") return handle.settings;
6712
+ return Reflect.get(target, prop, receiver);
6713
+ } }),
6714
+ handle
6715
+ };
6369
6716
  }
6370
6717
  var LEAF = { kind: "leaf" };
6371
6718
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6540,6 +6887,14 @@ var BaseAddon = class {
6540
6887
  _secretChangeUnsub = null;
6541
6888
  /** >0 while an OPERATOR's settings write is being applied. */
6542
6889
  _operatorWriteDepth = 0;
6890
+ /**
6891
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6892
+ * to the marker-bearing blobs and stays private to this class: the form
6893
+ * hydrate and config resolution need markers, addon code never does.
6894
+ */
6895
+ _secretSettings = null;
6896
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6897
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6543
6898
  constructor(defaults) {
6544
6899
  this.defaults = defaults;
6545
6900
  this._config = { ...defaults };
@@ -6576,13 +6931,21 @@ var BaseAddon = class {
6576
6931
  }
6577
6932
  async initialize(context) {
6578
6933
  const secrets = context.secrets;
6579
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6580
- secrets,
6581
- addonTree: () => this.addonSecretTree(),
6582
- deviceTree: () => this.deviceSecretTree(),
6583
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6584
- isOperatorWrite: () => this._operatorWriteDepth > 0
6585
- }) : context;
6934
+ if (secrets !== void 0) {
6935
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6936
+ secrets,
6937
+ addonTree: () => this.addonSecretTree(),
6938
+ deviceTree: () => this.deviceSecretTree(),
6939
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6940
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6941
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6942
+ });
6943
+ this._ctx = wrapped;
6944
+ this._secretSettings = handle;
6945
+ } else {
6946
+ this._ctx = context;
6947
+ this._secretSettings = null;
6948
+ }
6586
6949
  await this.resolveConfig();
6587
6950
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6588
6951
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6699,11 +7062,8 @@ var BaseAddon = class {
6699
7062
  async getGlobalSettings(overlay, cap, nodeId) {
6700
7063
  const schema = this.globalSettingsSchema(cap);
6701
7064
  if (!schema) return { sections: [] };
6702
- const projected = await this.resolveGlobalStore(nodeId, cap);
6703
- return hydrateSchema(schema, overlay ? {
6704
- ...projected,
6705
- ...overlay
6706
- } : projected, { inlineSecretsAsViews: true });
7065
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7066
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6707
7067
  }
6708
7068
  /**
6709
7069
  * The integration-level view of this addon's settings: exactly the sections
@@ -6748,7 +7108,7 @@ var BaseAddon = class {
6748
7108
  });
6749
7109
  }
6750
7110
  if (sections.length === 0) return null;
6751
- const projected = await this.resolveGlobalStore(nodeId);
7111
+ const projected = await this.readRawProjectedStore(nodeId);
6752
7112
  return hydrateSchema({
6753
7113
  ...schema,
6754
7114
  sections
@@ -6765,12 +7125,50 @@ var BaseAddon = class {
6765
7125
  * the store for custom option logic (option narrowing, value snapping) to
6766
7126
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6767
7127
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7128
+ *
7129
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7130
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7131
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7132
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7133
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7134
+ * resolved blob back is a no-op for every unchanged secret.
6768
7135
  */
6769
7136
  async resolveGlobalStore(nodeId, cap) {
6770
7137
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7138
+ return this.projectForNode(raw, nodeId, cap);
7139
+ }
7140
+ projectForNode(store, nodeId, cap) {
6771
7141
  const keys = this.perNodeKeys(cap);
6772
7142
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6773
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7143
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7144
+ }
7145
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7146
+ async readRawProjectedStore(nodeId, cap) {
7147
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7148
+ return this.projectForNode(raw, nodeId, cap);
7149
+ }
7150
+ /**
7151
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7152
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7153
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7154
+ * its value.
7155
+ */
7156
+ async overlayKeepingMarkers(stored, overlay) {
7157
+ const secrets = this._ctx?.secrets;
7158
+ const merged = {
7159
+ ...stored,
7160
+ ...overlay
7161
+ };
7162
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7163
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7164
+ unresolved: "keep-marker",
7165
+ ownedBy: secrets.owner
7166
+ });
7167
+ for (const key of Object.keys(overlay)) {
7168
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7169
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7170
+ }
7171
+ return merged;
6774
7172
  }
6775
7173
  /**
6776
7174
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6835,8 +7233,12 @@ var BaseAddon = class {
6835
7233
  async clearSecrets(keys, nodeId) {
6836
7234
  const tree = this.addonSecretTree();
6837
7235
  const keychain = this._ctx?.secrets !== void 0;
7236
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6838
7237
  const patch = {};
6839
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7238
+ for (const key of keys) {
7239
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7240
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7241
+ }
6840
7242
  await this.applyGlobalPatch(patch, nodeId);
6841
7243
  }
6842
7244
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6844,7 +7246,11 @@ var BaseAddon = class {
6844
7246
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6845
7247
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6846
7248
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6847
- await this._ctx?.settings?.writeAddonStore(scoped);
7249
+ const handle = this._secretSettings;
7250
+ if (handle !== null) {
7251
+ const { changed } = await handle.writeAddonStore(scoped);
7252
+ if (!changed) return;
7253
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6848
7254
  if (target !== localNode) return;
6849
7255
  await this.resolveConfig();
6850
7256
  await this.onConfigChanged();
@@ -6897,7 +7303,7 @@ var BaseAddon = class {
6897
7303
  async getDeviceSettings(deviceId) {
6898
7304
  const schema = this.deviceSettingsSchema();
6899
7305
  if (!schema) return { sections: [] };
6900
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7306
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6901
7307
  }
6902
7308
  async updateDeviceSettings(deviceId, patch) {
6903
7309
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7069,7 +7475,7 @@ var BaseAddon = class {
7069
7475
  key,
7070
7476
  schema,
7071
7477
  fallback,
7072
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7478
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7073
7479
  write: async (patch) => {
7074
7480
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7075
7481
  },
@@ -7131,6 +7537,23 @@ var BaseAddon = class {
7131
7537
  }
7132
7538
  return value;
7133
7539
  }
7540
+ /**
7541
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7542
+ * keychain the context's own view is already raw.
7543
+ */
7544
+ rawSettings() {
7545
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7546
+ }
7547
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7548
+ logUnresolvedRead(unresolved) {
7549
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7550
+ if (fresh.length === 0) return;
7551
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7552
+ 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) => ({
7553
+ ref: u.ref,
7554
+ reason: u.reason
7555
+ })) } });
7556
+ }
7134
7557
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7135
7558
  scheduleSecretReresolve(delayMs) {
7136
7559
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7157,7 +7580,7 @@ var BaseAddon = class {
7157
7580
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7158
7581
  */
7159
7582
  async readAddonStoreWithRetry() {
7160
- const settings = this._ctx?.settings;
7583
+ const settings = this.rawSettings();
7161
7584
  if (!settings) return {};
7162
7585
  const delaysMs = [
7163
7586
  150,
@@ -9551,6 +9974,278 @@ var DERIVED_CAMERA_SILENCED_CAP_NAMES = [
9551
9974
  "scene-monitor"
9552
9975
  ];
9553
9976
  /**
9977
+ * The trainer contract — what the hub hands the cloud trainer and what it
9978
+ * gets back (cloud training, D805+).
9979
+ *
9980
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
9981
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
9982
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
9983
+ * lines on stdout. These schemas are the hub's half of that boundary; the
9984
+ * trainer's pydantic models (and the JSON Schemas generated from them under
9985
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
9986
+ * change there, in the same piece of work.
9987
+ *
9988
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
9989
+ * orchestrator fills every field of a job spec explicitly.
9990
+ */
9991
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
9992
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
9993
+ /** What the trainer can export. Edge TPU is a later, separate image. */
9994
+ var TrainingExportSchema = _enum([
9995
+ "onnx",
9996
+ "openvino-fp16",
9997
+ "openvino-int8",
9998
+ "coreml-fp16"
9999
+ ]);
10000
+ var FloorsSchema = record(string(), number().min(0).max(1));
10001
+ object({
10002
+ schema: literal(TRAINING_JOB_SCHEMA),
10003
+ jobKey: string().uuid(),
10004
+ target: object({
10005
+ kind: literal("detector"),
10006
+ step: literal("object-detection")
10007
+ }),
10008
+ base: object({
10009
+ modelId: string().min(1),
10010
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
10011
+ weights: string().min(1),
10012
+ imgsz: number().int().positive()
10013
+ }),
10014
+ baseline: object({
10015
+ modelId: string().min(1),
10016
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
10017
+ onnxUrl: string().url(),
10018
+ imgsz: number().int().positive(),
10019
+ floors: FloorsSchema
10020
+ }),
10021
+ dataset: object({
10022
+ versionId: string().min(1),
10023
+ annotationHash: string(),
10024
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
10025
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10026
+ }),
10027
+ split: object({
10028
+ holdoutCameras: array(number().int()),
10029
+ /** When no camera is held out: the last N days of every camera. */
10030
+ holdoutLastDays: number().int().nonnegative(),
10031
+ valFraction: number().min(0).max(.5),
10032
+ seed: number().int()
10033
+ }),
10034
+ hyper: object({
10035
+ epochs: number().int().positive(),
10036
+ batch: number().int().positive(),
10037
+ lr0: number().positive(),
10038
+ /** Layers frozen from the start of the backbone; 0 = none. */
10039
+ freeze: number().int().nonnegative(),
10040
+ patience: number().int().nonnegative(),
10041
+ seed: number().int()
10042
+ }),
10043
+ replay: object({
10044
+ source: literal("coco2017"),
10045
+ count: number().int().nonnegative()
10046
+ }),
10047
+ exports: array(TrainingExportSchema).min(1),
10048
+ calibration: object({ maxFrames: number().int().positive() }),
10049
+ floors: object({
10050
+ minSupport: number().int().positive(),
10051
+ clamp: number().min(0).max(1)
10052
+ }),
10053
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
10054
+ catalog: object({
10055
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
10056
+ name: string().min(1).max(160)
10057
+ })
10058
+ });
10059
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
10060
+ var TrainingResultFileSchema = object({
10061
+ path: string().min(1),
10062
+ bytes: number().int().nonnegative(),
10063
+ sha256: string().regex(/^[0-9a-f]{64}$/),
10064
+ format: _enum([
10065
+ "onnx",
10066
+ "openvino",
10067
+ "coreml",
10068
+ "pt"
10069
+ ]),
10070
+ variant: _enum(["base", "int8"])
10071
+ });
10072
+ var DraftFormatSchema = object({
10073
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
10074
+ url: string().min(1),
10075
+ sizeMB: number().nonnegative(),
10076
+ isDirectory: boolean().optional(),
10077
+ files: array(string()).optional(),
10078
+ runtimes: array(literal("python")).optional(),
10079
+ revision: string().min(1)
10080
+ });
10081
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
10082
+ var TrainingCatalogDraftSchema = object({
10083
+ id: string().min(1),
10084
+ name: string().min(1),
10085
+ description: string(),
10086
+ labels: array(unknown()),
10087
+ inputSize: object({
10088
+ width: number().int().positive(),
10089
+ height: number().int().positive()
10090
+ }),
10091
+ preprocessMode: literal("letterbox"),
10092
+ defaultClassFloors: FloorsSchema,
10093
+ formats: object({
10094
+ onnx: DraftFormatSchema.optional(),
10095
+ openvino: DraftFormatSchema.optional(),
10096
+ coreml: DraftFormatSchema.optional()
10097
+ })
10098
+ });
10099
+ /** One class of one model's holdout report (the eval harness's summary). */
10100
+ var TrainingEvalClassSchema = object({
10101
+ positives: number().int(),
10102
+ floor: number().nullable(),
10103
+ tp: number().int(),
10104
+ fp: number().int(),
10105
+ fn: number().int(),
10106
+ precision: number().nullable(),
10107
+ recall: number().nullable(),
10108
+ ap50: number().nullable(),
10109
+ recallByCamera: record(string(), number().nullable()).optional(),
10110
+ recallByLight: record(string(), number().nullable()).optional(),
10111
+ fpByCamera: record(string(), number()).optional(),
10112
+ smallFound: number().int().optional(),
10113
+ smallTotal: number().int().optional()
10114
+ }).passthrough();
10115
+ var TrainingEvalReportSchema = object({
10116
+ frames: number().int(),
10117
+ classes: record(string(), TrainingEvalClassSchema)
10118
+ }).passthrough();
10119
+ /**
10120
+ * A succeeded result carries every block; a failed one carries the error and
10121
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10122
+ * orchestrator checks the blocks it needs before it trusts a success.
10123
+ */
10124
+ var TrainingResultSchema = object({
10125
+ schema: literal(TRAINING_RESULT_SCHEMA),
10126
+ jobKey: string(),
10127
+ status: _enum(["succeeded", "failed"]),
10128
+ error: object({
10129
+ stage: string(),
10130
+ code: string(),
10131
+ message: string()
10132
+ }).nullable(),
10133
+ trainer: object({
10134
+ version: string(),
10135
+ revision: string()
10136
+ }),
10137
+ toolchain: record(string(), string().nullable()),
10138
+ dataset: object({
10139
+ versionId: string(),
10140
+ annotationHash: string(),
10141
+ sha256: string(),
10142
+ frames: object({
10143
+ train: number().int(),
10144
+ val: number().int(),
10145
+ holdout: number().int()
10146
+ }),
10147
+ holdoutCameras: array(number().int()),
10148
+ replayImages: number().int()
10149
+ }).optional(),
10150
+ training: object({
10151
+ epochsRun: number().int(),
10152
+ bestEpoch: number().int(),
10153
+ bestMap50: number(),
10154
+ bestMap50_95: number(),
10155
+ seconds: number()
10156
+ }).optional(),
10157
+ evaluation: object({
10158
+ holdoutFrames: number().int(),
10159
+ baseline: TrainingEvalReportSchema.nullable(),
10160
+ candidate: TrainingEvalReportSchema.nullable(),
10161
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10162
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10163
+ map50: record(string(), number().nullable())
10164
+ }).optional(),
10165
+ floors: object({
10166
+ baseline: FloorsSchema,
10167
+ candidate: FloorsSchema,
10168
+ candidateInt8: FloorsSchema.nullable(),
10169
+ notes: array(string())
10170
+ }).optional(),
10171
+ int8: object({
10172
+ kept: boolean(),
10173
+ map50Fp16: number().nullable(),
10174
+ map50Int8: number().nullable(),
10175
+ reason: string().nullable()
10176
+ }).optional(),
10177
+ exportsDropped: array(object({
10178
+ export: string(),
10179
+ reason: string()
10180
+ })).optional(),
10181
+ files: array(TrainingResultFileSchema).optional(),
10182
+ bundle: object({
10183
+ path: literal("bundle.tar"),
10184
+ bytes: number().int().nonnegative(),
10185
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10186
+ }).nullable().optional(),
10187
+ catalogDraft: object({
10188
+ base: TrainingCatalogDraftSchema,
10189
+ int8: TrainingCatalogDraftSchema.nullable()
10190
+ }).nullable().optional(),
10191
+ licence: string()
10192
+ });
10193
+ var TrainingStageSchema = _enum([
10194
+ "prepare",
10195
+ "replay",
10196
+ "train",
10197
+ "eval",
10198
+ "export",
10199
+ "package"
10200
+ ]);
10201
+ var EventBase = {
10202
+ v: literal(1),
10203
+ ts: number()
10204
+ };
10205
+ discriminatedUnion("type", [
10206
+ object({
10207
+ ...EventBase,
10208
+ type: literal("stage"),
10209
+ stage: TrainingStageSchema
10210
+ }),
10211
+ object({
10212
+ ...EventBase,
10213
+ type: literal("epoch"),
10214
+ epoch: number().int(),
10215
+ epochs: number().int(),
10216
+ boxLoss: number().nullable().optional(),
10217
+ map50: number().nullable().optional(),
10218
+ map50_95: number().nullable().optional(),
10219
+ etaSec: number().nullable().optional()
10220
+ }),
10221
+ object({
10222
+ ...EventBase,
10223
+ type: literal("metric"),
10224
+ name: string(),
10225
+ value: number()
10226
+ }),
10227
+ object({
10228
+ ...EventBase,
10229
+ type: literal("artifact"),
10230
+ path: string(),
10231
+ bytes: number(),
10232
+ sha256: string()
10233
+ }),
10234
+ object({
10235
+ ...EventBase,
10236
+ type: literal("done"),
10237
+ status: _enum(["succeeded", "failed"]),
10238
+ resultSha256: string().nullable().optional()
10239
+ }),
10240
+ object({
10241
+ ...EventBase,
10242
+ type: literal("error"),
10243
+ stage: string(),
10244
+ code: string(),
10245
+ message: string()
10246
+ })
10247
+ ]);
10248
+ /**
9554
10249
  * What the gate decided about a birth, from the CALLER's point of view.
9555
10250
  *
9556
10251
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11878,7 +12573,9 @@ var AddonHttpRouteSchema = object({
11878
12573
  "authenticated",
11879
12574
  "admin"
11880
12575
  ]).optional(),
11881
- description: string().optional()
12576
+ description: string().optional(),
12577
+ /** The hub limits this route per client address before the handler runs. */
12578
+ rateLimit: _enum(["auth"]).optional()
11882
12579
  });
11883
12580
  /**
11884
12581
  * Cross-process route invocation envelope. The hub captures the
@@ -12583,6 +13280,37 @@ var BackupDestinationInfoSchema = object({
12583
13280
  lastError: string().optional()
12584
13281
  });
12585
13282
  /**
13283
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13284
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13285
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13286
+ * with it off — which restores without a key.
13287
+ */
13288
+ var BackupArchiveEncryptionSchema = object({
13289
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13290
+ scheme: string(),
13291
+ /** 16 hex — the backup key whose secret restores this archive. */
13292
+ keyId: string()
13293
+ });
13294
+ /**
13295
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13296
+ * one new archives are encrypted to, and the retired ones older archives
13297
+ * still need. The secret key is shown once, at `setupEncryption`.
13298
+ */
13299
+ var BackupEncryptionStatusSchema = object({
13300
+ enabled: boolean(),
13301
+ active: object({
13302
+ keyId: string(),
13303
+ publicKey: string(),
13304
+ createdAt: number()
13305
+ }).nullable(),
13306
+ /** Every key ever set up, newest first. */
13307
+ keys: array(object({
13308
+ keyId: string(),
13309
+ createdAt: number(),
13310
+ retiredAt: number().nullable()
13311
+ })).readonly()
13312
+ });
13313
+ /**
12586
13314
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12587
13315
  * Same shape the destination drill-in renders. Sourced from the per-
12588
13316
  * location `manifests.json` (no per-archive tarball read required).
@@ -12594,7 +13322,9 @@ var BackupArchiveEntrySchema = object({
12594
13322
  sizeBytes: number(),
12595
13323
  label: string().optional(),
12596
13324
  /** Top-level locations included in the archive (db, addons, tls, …). */
12597
- locations: array(string()).readonly()
13325
+ locations: array(string()).readonly(),
13326
+ /** Present when the archive is encrypted; restore then needs that key. */
13327
+ encryption: BackupArchiveEncryptionSchema.optional()
12598
13328
  });
12599
13329
  var BackupEntrySchema = object({
12600
13330
  id: string(),
@@ -12603,7 +13333,8 @@ var BackupEntrySchema = object({
12603
13333
  label: string().optional(),
12604
13334
  createdAt: number(),
12605
13335
  sizeBytes: number(),
12606
- locations: array(string()).optional()
13336
+ locations: array(string()).optional(),
13337
+ encryption: BackupArchiveEncryptionSchema.optional()
12607
13338
  });
12608
13339
  var ArchiveEntrySchema = object({
12609
13340
  path: string(),
@@ -12792,10 +13523,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12792
13523
  * this list and skips entries whose path doesn't start with
12793
13524
  * any of them.
12794
13525
  */
12795
- locations: array(string()).optional()
13526
+ locations: array(string()).optional(),
13527
+ /**
13528
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13529
+ * one). The archive is decrypted into the hub's private staging
13530
+ * before the restart; the key is not stored. A wrong or missing key
13531
+ * is refused before the archive is downloaded.
13532
+ */
13533
+ backupSecretKey: string().optional()
12796
13534
  }), _void(), {
12797
13535
  kind: "mutation",
12798
13536
  auth: "admin"
13537
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13538
+ keyId: string(),
13539
+ secretKey: string(),
13540
+ publicKey: string(),
13541
+ createdAt: number(),
13542
+ replacedKeyId: string().nullable()
13543
+ }), {
13544
+ kind: "mutation",
13545
+ auth: "admin"
13546
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13547
+ kind: "mutation",
13548
+ auth: "admin"
13549
+ }), method(object({ backupSecretKey: string() }), object({
13550
+ valid: boolean(),
13551
+ keyId: string().nullable(),
13552
+ /** The hub knows this key (active or retired). */
13553
+ known: boolean(),
13554
+ /** It is the key new archives are encrypted to. */
13555
+ active: boolean(),
13556
+ error: string().optional()
13557
+ }), {
13558
+ kind: "mutation",
13559
+ auth: "admin"
12799
13560
  }), method(object({
12800
13561
  destinationId: string(),
12801
13562
  backupId: string()
@@ -14521,7 +15282,60 @@ var CustomModelDescriptorSchema = object({
14521
15282
  stepId: string(),
14522
15283
  entry: ModelCatalogEntrySchema
14523
15284
  });
14524
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15285
+ /** One regular file of an imported bundle, as the producer measured it. */
15286
+ var ModelBundleFileSchema = object({
15287
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15288
+ path: string().min(1),
15289
+ bytes: number().int().nonnegative(),
15290
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15291
+ });
15292
+ var ImportModelBundleInputSchema = object({
15293
+ /** The registry provider that keeps the model (Model Studio). */
15294
+ addonId: string(),
15295
+ stepId: string().min(1),
15296
+ /**
15297
+ * The catalog rows to register, complete, every format URL already
15298
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15299
+ * bundle may carry several rows (a base and its INT8 variant).
15300
+ */
15301
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15302
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15303
+ bundle: object({
15304
+ ticket: PeerBytesTicketSchema,
15305
+ bytes: number().int().positive(),
15306
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15307
+ }),
15308
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15309
+ files: array(ModelBundleFileSchema).min(1).max(64),
15310
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15311
+ distribute: boolean()
15312
+ });
15313
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15314
+ kind: literal("imported"),
15315
+ modelIds: array(string()).readonly(),
15316
+ distributed: array(object({
15317
+ modelId: string(),
15318
+ nodeId: string(),
15319
+ format: _enum(MODEL_FORMATS),
15320
+ ok: boolean(),
15321
+ error: string().optional()
15322
+ })).readonly()
15323
+ }), object({
15324
+ kind: literal("refused"),
15325
+ reason: _enum([
15326
+ "transfer-failed",
15327
+ "checksum-mismatch",
15328
+ "bundle-mismatch",
15329
+ "invalid-entry",
15330
+ "id-taken"
15331
+ ]),
15332
+ detail: string()
15333
+ })]);
15334
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15335
+ kind: "mutation",
15336
+ auth: "admin",
15337
+ timeoutMs: 30 * 6e4
15338
+ });
14525
15339
  /**
14526
15340
  * Query filter for settings-store collections.
14527
15341
  */
@@ -15000,6 +15814,35 @@ var KeychainKeySourceSchema = object({
15000
15814
  */
15001
15815
  sharesBackupWithDatabase: boolean()
15002
15816
  });
15817
+ /**
15818
+ * One keychain reset, as the Secrets page reports it until the operator
15819
+ * acknowledges it. Never a value: refs, counts and table names only.
15820
+ */
15821
+ var KeychainResetRecordSchema = object({
15822
+ id: string(),
15823
+ at: number(),
15824
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15825
+ actor: string(),
15826
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15827
+ lockedReason: string().nullable(),
15828
+ /** Values moved into the archive table (ciphertext under the lost key). */
15829
+ archived: number().int(),
15830
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15831
+ archivedCollection: string().nullable(),
15832
+ /**
15833
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15834
+ * so the archive can still be opened if the lost master key turns up.
15835
+ */
15836
+ archivedKeysCollection: string().nullable(),
15837
+ /**
15838
+ * `system-settings` keys whose marker the reset cleared — the cluster
15839
+ * secret's: a marker left pointing at an archived value would refuse every
15840
+ * agent forever (D797).
15841
+ */
15842
+ clearedSettingsKeys: array(string()).readonly(),
15843
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15844
+ acknowledgedAt: number().nullable()
15845
+ });
15003
15846
  var KeychainStatusSchema = object({
15004
15847
  keychain: KeychainStateSchema,
15005
15848
  /** The source of the master key in use; `null` while locked. */
@@ -15017,7 +15860,9 @@ var KeychainStatusSchema = object({
15017
15860
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
15018
15861
  retiredWraps: number().int(),
15019
15862
  recoveryKeyDownloadedAt: number().nullable(),
15020
- secretCount: number().int()
15863
+ secretCount: number().int(),
15864
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15865
+ lastReset: KeychainResetRecordSchema.nullable()
15021
15866
  });
15022
15867
  /**
15023
15868
  * Whether a stored value is still pointed at by its owner's settings.
@@ -15039,13 +15884,14 @@ var KeychainAuditActionSchema = _enum([
15039
15884
  "download-recovery-key",
15040
15885
  "delete-orphans",
15041
15886
  "reset",
15887
+ "acknowledge-reset",
15042
15888
  "initialize"
15043
15889
  ]);
15044
15890
  var KeychainAuditEntrySchema = object({
15045
15891
  id: string(),
15046
15892
  at: number(),
15047
15893
  action: KeychainAuditActionSchema,
15048
- /** `addon:<id>` | `user:<id>` | `system`. */
15894
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
15049
15895
  actor: string(),
15050
15896
  ref: string().nullable(),
15051
15897
  detail: string().nullable()
@@ -15111,6 +15957,13 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15111
15957
  kind: "mutation",
15112
15958
  auth: "admin",
15113
15959
  caller: "required"
15960
+ }), method(object({}), object({
15961
+ reset: KeychainResetRecordSchema.nullable(),
15962
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15963
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15964
+ kind: "mutation",
15965
+ auth: "admin",
15966
+ caller: "required"
15114
15967
  });
15115
15968
  method(_void(), object({
15116
15969
  id: string(),
@@ -17863,7 +18716,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17863
18716
  * `login-method` — collection cap through which auth addons contribute
17864
18717
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17865
18718
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17866
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18719
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17867
18720
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17868
18721
  * procedure aggregates them for the unauthenticated login page.
17869
18722
  *
@@ -17871,8 +18724,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17871
18724
  *
17872
18725
  * - `redirect` — a declarative button. The login page renders a generic
17873
18726
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17874
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17875
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18727
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17876
18728
  * login page needs NO change.
17877
18729
  *
17878
18730
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -17891,8 +18743,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17891
18743
  * decision.
17892
18744
  *
17893
18745
  * Every contribution carries a `stage`:
17894
- * - `primary` — shown on the first credentials screen (OIDC /
17895
- * magic-link buttons; a future usernameless passkey).
18746
+ * - `primary` — shown on the first credentials screen (OIDC
18747
+ * buttons; a usernameless passkey).
17896
18748
  * - `second-factor` — shown AFTER the password leg, gated on the
17897
18749
  * returned `factors` (passkey-as-2FA today).
17898
18750
  *
@@ -17919,7 +18771,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17919
18771
  * The provider names an external identity a signed-in user can link to
17920
18772
  * their own account (D782): `auth.listLinkableProviders` /
17921
18773
  * `beginExternalLink` offer exactly the redirect methods that set this,
17922
- * whatever their id. Absent / false — a login button only (magic-link).
18774
+ * whatever their id. Absent / false — a login button only.
17923
18775
  */
17924
18776
  linkable: boolean().optional()
17925
18777
  }),
@@ -21774,8 +22626,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21774
22626
  * `super_admin` — collapsed onto the single boolean because every
21775
22627
  * non-admin caller is governed by the same scope-check rules; the
21776
22628
  * distinction was only ever used to route role-specific procedures
21777
- * which we no longer have. Agents are admin sessions issued via
21778
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22629
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21779
22630
  * with `isAdmin: false` + an explicit scope list.
21780
22631
  */
21781
22632
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -24470,6 +25321,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24470
25321
  kind: "mutation",
24471
25322
  auth: "admin",
24472
25323
  timeoutMs: 60 * 6e4
25324
+ }), method(object({
25325
+ filter: RetrainExportFilterSchema,
25326
+ layout: RetrainExportLayoutSchema
25327
+ }), object({
25328
+ ticket: PeerBytesTicketSchema,
25329
+ frames: number().int(),
25330
+ annotations: number().int()
25331
+ }), {
25332
+ kind: "mutation",
25333
+ auth: "admin",
25334
+ timeoutMs: 12e4
24473
25335
  }), method(object({
24474
25336
  selection: RetrainDatasetSelectionSchema,
24475
25337
  completeOnly: boolean().optional()
@@ -28078,8 +28940,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
28078
28940
  * `smtp-provider` — pluggable email delivery surface.
28079
28941
  *
28080
28942
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
28081
- * one for transactional / one for notifications). Consumers (magic-link,
28082
- * notifier addons, …) walk the collection and pick the first
28943
+ * one for transactional / one for notifications). Consumers (notifier
28944
+ * addons, …) walk the collection and pick the first
28083
28945
  * ready provider OR target a specific addonId.
28084
28946
  *
28085
28947
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -28362,7 +29224,7 @@ targets: array(object({
28362
29224
  };
28363
29225
  /**
28364
29226
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
28365
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
29227
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
28366
29228
  * carrying the post-callback claims before redirecting back to
28367
29229
  * `/api/auth/sso/finish`.
28368
29230
  *
@@ -28425,7 +29287,14 @@ var SsoBridgeClaimsSchema = object({
28425
29287
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28426
29288
  * subject is unique only per issuer, so a link is bound to it.
28427
29289
  */
28428
- issuer: string().optional()
29290
+ issuer: string().optional(),
29291
+ /**
29292
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
29293
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
29294
+ * request to present the matching cookie — a login bridge is useless in
29295
+ * any other browser.
29296
+ */
29297
+ browserBinding: string().optional()
28429
29298
  });
28430
29299
  method(object({
28431
29300
  claims: SsoBridgeClaimsSchema,
@@ -35905,7 +36774,13 @@ var TopologyNodeSchema = object({
35905
36774
  })).readonly(),
35906
36775
  processes: array(TopologyProcessSchema).readonly(),
35907
36776
  categories: array(TopologyCategorySchema).readonly(),
35908
- rootPackage: TopologyRootPackageSchema.nullable()
36777
+ rootPackage: TopologyRootPackageSchema.nullable(),
36778
+ /**
36779
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
36780
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
36781
+ * for offline rows and when the hub cannot tell.
36782
+ */
36783
+ meshTransport: _enum(["tls", "clear"]).optional()
35909
36784
  });
35910
36785
  var CapUsageEdgeSchema = object({
35911
36786
  callerAddonId: string(),
@@ -40728,16 +41603,6 @@ var ApiKeySummarySchema = object({
40728
41603
  createdAt: number(),
40729
41604
  lastUsedAt: number().optional()
40730
41605
  });
40731
- var CreateApiKeyInputSchema = object({
40732
- label: string(),
40733
- isAdmin: boolean().default(false),
40734
- allowedProviders: union([array(string()), literal("*")]).optional(),
40735
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
40736
- });
40737
- var CreateApiKeyResultSchema = object({
40738
- token: string(),
40739
- record: ApiKeySummarySchema
40740
- });
40741
41606
  var ScopedTokenSummarySchema = object({
40742
41607
  id: string(),
40743
41608
  userId: string(),
@@ -40836,17 +41701,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40836
41701
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
40837
41702
  kind: "mutation",
40838
41703
  access: "view"
40839
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
40840
- kind: "mutation",
40841
- auth: "admin",
40842
- access: "create"
40843
- }), method(object({ id: string() }), object({ success: literal(true) }), {
41704
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
40844
41705
  kind: "mutation",
40845
41706
  auth: "admin",
40846
41707
  access: "delete"
40847
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
40848
- kind: "mutation",
40849
- access: "view"
40850
41708
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
40851
41709
  kind: "mutation",
40852
41710
  auth: "admin",
@@ -40920,15 +41778,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40920
41778
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
40921
41779
  userId: string(),
40922
41780
  issuer: string()
40923
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
40924
- userId: string(),
40925
- issuer: string().min(1),
40926
- label: string().optional()
40927
- }), object({ success: literal(true) }), {
40928
- kind: "mutation",
40929
- auth: "admin",
40930
- access: "create"
40931
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41781
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
40932
41782
  kind: "mutation",
40933
41783
  auth: "admin",
40934
41784
  access: "delete"
@@ -41633,6 +42483,451 @@ var zoneRulesCapability = {
41633
42483
  */
41634
42484
  durability: "restored"
41635
42485
  };
42486
+ /**
42487
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
42488
+ *
42489
+ * A thin, mockable translation layer: it knows how to run a container with a
42490
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
42491
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
42492
+ * those are the `training` orchestrator's (D805). Every rule written there
42493
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
42494
+ * manifest entry and nothing else.
42495
+ *
42496
+ * Collection, routed by the `addonId` in every single-row input (the `llm` /
42497
+ * `notification-output` posture); `describe` concat-fans across providers.
42498
+ * Every method is `admin`: these spend money.
42499
+ *
42500
+ * Every cloud object a provider creates is tagged with the orchestrator's
42501
+ * `jobKey`, so a retried submit finds the job it already started instead of
42502
+ * starting a second GPU, and `listJobs` can find orphans.
42503
+ *
42504
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
42505
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
42506
+ * ticket the provider mints (D613).
42507
+ */
42508
+ var TrainingGpuOptionSchema = object({
42509
+ id: string(),
42510
+ label: string(),
42511
+ /** List price, USD per GPU-hour, before any region multiplier. */
42512
+ usdPerHour: number().nonnegative(),
42513
+ vramGb: number().nonnegative()
42514
+ });
42515
+ var TrainingRegionOptionSchema = object({
42516
+ /** `''` = any region (the provider's choice). */
42517
+ id: string(),
42518
+ label: string(),
42519
+ priceMultiplier: number().positive()
42520
+ });
42521
+ /**
42522
+ * The provider's per-account settings, as the orchestrator reads them. They
42523
+ * live in the PROVIDER addon's settings (operator decision 2026-10-08: they
42524
+ * depend on the user's account), never hard-coded in the orchestrator.
42525
+ */
42526
+ var TrainingProviderDefaultsSchema = object({
42527
+ gpuType: string(),
42528
+ region: string(),
42529
+ costCapUsd: number().nonnegative(),
42530
+ maxRuntimeSec: number().int().positive(),
42531
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
42532
+ failedDatasetGraceHours: number().nonnegative()
42533
+ });
42534
+ var TrainingProviderDescriptorSchema = object({
42535
+ addonId: string(),
42536
+ /** `modal`, `runpod`, `fake`, … */
42537
+ kind: string(),
42538
+ label: string(),
42539
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
42540
+ regions: array(TrainingRegionOptionSchema).readonly(),
42541
+ maxDatasetBytes: number().int().positive(),
42542
+ maxRuntimeSec: number().int().positive(),
42543
+ freeTierNote: string().optional(),
42544
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
42545
+ dataResidencyNote: string(),
42546
+ /** Credentials are present — never the values. */
42547
+ configured: boolean(),
42548
+ defaults: TrainingProviderDefaultsSchema
42549
+ });
42550
+ var TrainingCredentialCheckSchema = object({
42551
+ ok: boolean(),
42552
+ /** Workspace / account name, when the provider says. */
42553
+ account: string().optional(),
42554
+ reason: _enum([
42555
+ "missing",
42556
+ "invalid",
42557
+ "forbidden",
42558
+ "network",
42559
+ "quota"
42560
+ ]).optional(),
42561
+ detail: string().optional()
42562
+ });
42563
+ var ProviderJobStateSchema = _enum([
42564
+ "pending",
42565
+ "starting",
42566
+ "running",
42567
+ "succeeded",
42568
+ "failed",
42569
+ "cancelled",
42570
+ "lost"
42571
+ ]);
42572
+ var ProviderJobStatusSchema = object({
42573
+ jobKey: string(),
42574
+ providerJobId: string().optional(),
42575
+ state: ProviderJobStateSchema,
42576
+ startedAt: number().optional(),
42577
+ endedAt: number().optional(),
42578
+ exitCode: number().int().optional(),
42579
+ failureReason: string().optional(),
42580
+ gpuType: string(),
42581
+ region: string().optional(),
42582
+ billedSeconds: number().nonnegative(),
42583
+ costUsd: number().nonnegative(),
42584
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
42585
+ costIsEstimate: boolean(),
42586
+ lastFetchedAt: number()
42587
+ });
42588
+ /**
42589
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
42590
+ * image its own way (Modal builds the published Dockerfile at that revision;
42591
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
42592
+ * in `result.json`.
42593
+ */
42594
+ var TrainerSourceRefSchema = object({
42595
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
42596
+ repo: string().min(1),
42597
+ /** A commit sha (never a branch) — the job must be reproducible. */
42598
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
42599
+ });
42600
+ var JobRef = {
42601
+ addonId: string(),
42602
+ jobKey: string().uuid()
42603
+ };
42604
+ var TrainingLogLineSchema = object({
42605
+ ts: number(),
42606
+ text: string()
42607
+ });
42608
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
42609
+ kind: "mutation",
42610
+ auth: "admin",
42611
+ timeoutMs: 3e4
42612
+ }), method(object({
42613
+ addonId: string(),
42614
+ gpuType: string(),
42615
+ region: string(),
42616
+ datasetBytes: number().int().nonnegative(),
42617
+ gpuSecondsLow: number().nonnegative(),
42618
+ gpuSecondsHigh: number().nonnegative()
42619
+ }), object({
42620
+ usdLow: number().nonnegative(),
42621
+ usdHigh: number().nonnegative(),
42622
+ notes: array(string()).readonly()
42623
+ }), { auth: "admin" }), method(object({
42624
+ ...JobRef,
42625
+ ticket: PeerBytesTicketSchema
42626
+ }), object({
42627
+ bytes: number().int().nonnegative(),
42628
+ sha256: string()
42629
+ }), {
42630
+ kind: "mutation",
42631
+ auth: "admin",
42632
+ timeoutMs: 120 * 6e4
42633
+ }), method(object({
42634
+ ...JobRef,
42635
+ trainer: TrainerSourceRefSchema,
42636
+ jobSpecJson: string().min(2).max(64e3),
42637
+ gpuType: string(),
42638
+ region: string(),
42639
+ maxRuntimeSec: number().int().positive()
42640
+ }), ProviderJobStatusSchema, {
42641
+ kind: "mutation",
42642
+ auth: "admin",
42643
+ timeoutMs: 30 * 6e4
42644
+ }), method(object(JobRef), ProviderJobStatusSchema, {
42645
+ auth: "admin",
42646
+ timeoutMs: 6e4
42647
+ }), method(object({
42648
+ ...JobRef,
42649
+ cursor: string().optional(),
42650
+ max: number().int().min(1).max(500)
42651
+ }), object({
42652
+ lines: array(TrainingLogLineSchema).readonly(),
42653
+ cursor: string()
42654
+ }), {
42655
+ auth: "admin",
42656
+ timeoutMs: 6e4
42657
+ }), method(object(JobRef), object({ ok: literal(true) }), {
42658
+ kind: "mutation",
42659
+ auth: "admin",
42660
+ timeoutMs: 6e4
42661
+ }), method(object(JobRef), object({
42662
+ found: boolean(),
42663
+ text: string().optional()
42664
+ }), {
42665
+ kind: "mutation",
42666
+ auth: "admin",
42667
+ timeoutMs: 5 * 6e4
42668
+ }), method(object({
42669
+ ...JobRef,
42670
+ path: _enum(["bundle.tar"])
42671
+ }), object({ ticket: PeerBytesTicketSchema }), {
42672
+ kind: "mutation",
42673
+ auth: "admin",
42674
+ timeoutMs: 5 * 6e4
42675
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
42676
+ kind: "mutation",
42677
+ auth: "admin",
42678
+ timeoutMs: 5 * 6e4
42679
+ }), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
42680
+ auth: "admin",
42681
+ timeoutMs: 2 * 6e4
42682
+ });
42683
+ /**
42684
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
42685
+ * provided by `addon-training`.
42686
+ *
42687
+ * It owns what every provider must agree on, written once:
42688
+ *
42689
+ * - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
42690
+ * live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
42691
+ * the export plan) and reaches this store through the five row methods
42692
+ * below, so the Retrain page and the export did not change.
42693
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
42694
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
42695
+ * - **The return flow.** Verified artefacts → Model Studio
42696
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
42697
+ * rollback. Nothing is ever registered automatically.
42698
+ *
42699
+ * Every method is `admin`.
42700
+ */
42701
+ /** A version WITH its frame list — what the export and a job read. */
42702
+ var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
42703
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
42704
+ var TrainingBaseModelSchema = object({
42705
+ modelId: string(),
42706
+ label: string(),
42707
+ weights: string(),
42708
+ imgsz: number().int(),
42709
+ baselineOnnxUrl: string(),
42710
+ baselineFloors: record(string(), number()),
42711
+ /** The base the fleet runs most — the UI's default. */
42712
+ recommended: boolean()
42713
+ });
42714
+ var TrainingPresetSchema = _enum([
42715
+ "quick",
42716
+ "standard",
42717
+ "thorough"
42718
+ ]);
42719
+ var TrainingJobRequestSchema = object({
42720
+ datasetVersionId: string().min(1),
42721
+ /** The `training-provider` addon that runs it. */
42722
+ addonId: string().min(1),
42723
+ gpuType: string().min(1),
42724
+ region: string(),
42725
+ baseModelId: string().min(1),
42726
+ preset: TrainingPresetSchema,
42727
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
42728
+ freeze: number().int().nonnegative().nullable(),
42729
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
42730
+ holdoutCameras: array(number().int()).nullable()
42731
+ });
42732
+ var TrainingSplitPlanSchema = object({
42733
+ holdoutCameras: array(number().int()).readonly(),
42734
+ /** Used when no camera is held out: the last N days of every camera. */
42735
+ holdoutLastDays: number().int().nonnegative(),
42736
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
42737
+ holdoutSupport: record(string(), number().int()).nullable(),
42738
+ trainSubjects: number().int()
42739
+ });
42740
+ var TrainingRefusalReasonSchema = _enum([
42741
+ "unknown-dataset",
42742
+ "unknown-provider",
42743
+ "provider-not-configured",
42744
+ "unknown-base-model",
42745
+ "unknown-gpu",
42746
+ "dataset-too-large",
42747
+ "no-training-subjects",
42748
+ "job-already-running"
42749
+ ]);
42750
+ var TrainingJobPlanSchema = object({
42751
+ refusal: object({
42752
+ reason: TrainingRefusalReasonSchema,
42753
+ detail: string()
42754
+ }).nullable(),
42755
+ warnings: array(string()).readonly(),
42756
+ split: TrainingSplitPlanSchema.nullable(),
42757
+ estimate: object({
42758
+ datasetBytes: number().int(),
42759
+ uploadMinutesAt20Mbps: number(),
42760
+ gpuSecondsLow: number(),
42761
+ gpuSecondsHigh: number(),
42762
+ usdLow: number(),
42763
+ usdHigh: number(),
42764
+ notes: array(string()).readonly()
42765
+ }).nullable(),
42766
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
42767
+ defaults: object({
42768
+ maxCostUsd: number(),
42769
+ maxRuntimeSec: number().int()
42770
+ }).nullable(),
42771
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
42772
+ dataNotice: string()
42773
+ });
42774
+ /**
42775
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
42776
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
42777
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
42778
+ * result lives after the operator acted on it.
42779
+ */
42780
+ var TrainingJobStateSchema = _enum([
42781
+ "uploading",
42782
+ "submitted",
42783
+ "starting",
42784
+ "running",
42785
+ "collecting",
42786
+ "ready",
42787
+ "registered",
42788
+ "canary",
42789
+ "failed",
42790
+ "cancelling",
42791
+ "cancelled",
42792
+ "lost",
42793
+ "expired",
42794
+ "discarded"
42795
+ ]);
42796
+ var TrainingFailureReasonSchema = _enum([
42797
+ "cost-cap",
42798
+ "runtime-cap",
42799
+ "upload-failed",
42800
+ "submit-failed",
42801
+ "trainer-failed",
42802
+ "result-invalid",
42803
+ "checksum-mismatch",
42804
+ "fetch-failed",
42805
+ "provider-error",
42806
+ "hub-restart-during-upload"
42807
+ ]);
42808
+ var TrainingProgressPointSchema = object({
42809
+ epoch: number().int(),
42810
+ map50: number().nullable(),
42811
+ map50_95: number().nullable()
42812
+ });
42813
+ var TrainingCanarySchema = object({
42814
+ deviceIds: array(number().int()).readonly(),
42815
+ since: number(),
42816
+ /** Every override the canary replaced, exactly, so rollback restores it. */
42817
+ previous: array(object({
42818
+ deviceId: number().int(),
42819
+ nodeId: string(),
42820
+ deviceKey: string(),
42821
+ patch: object({
42822
+ modelId: string().optional(),
42823
+ settings: record(string(), unknown()).readonly().optional()
42824
+ }).nullable()
42825
+ })).readonly()
42826
+ });
42827
+ var TrainingJobSchema = object({
42828
+ id: string(),
42829
+ idempotencyKey: string(),
42830
+ name: string(),
42831
+ createdAt: number(),
42832
+ updatedAt: number(),
42833
+ state: TrainingJobStateSchema,
42834
+ stage: TrainingStageSchema.nullable(),
42835
+ failure: object({
42836
+ reason: TrainingFailureReasonSchema,
42837
+ stage: string().nullable(),
42838
+ detail: string()
42839
+ }).nullable(),
42840
+ request: TrainingJobRequestSchema,
42841
+ maxCostUsd: number().nonnegative(),
42842
+ maxRuntimeSec: number().int().positive(),
42843
+ trainer: TrainerSourceRefSchema,
42844
+ datasetLayout: RetrainExportLayoutSchema,
42845
+ dataset: object({
42846
+ bytes: number().int(),
42847
+ sha256: string(),
42848
+ uploadedAt: number()
42849
+ }).nullable(),
42850
+ split: TrainingSplitPlanSchema,
42851
+ provider: object({
42852
+ state: ProviderJobStateSchema.nullable(),
42853
+ providerJobId: string().nullable(),
42854
+ startedAt: number().nullable(),
42855
+ endedAt: number().nullable(),
42856
+ billedSeconds: number(),
42857
+ costUsd: number(),
42858
+ costIsEstimate: boolean(),
42859
+ lastPolledAt: number().nullable()
42860
+ }),
42861
+ progress: object({
42862
+ epoch: number().int().nullable(),
42863
+ epochs: number().int().nullable(),
42864
+ etaSec: number().nullable(),
42865
+ series: array(TrainingProgressPointSchema).readonly()
42866
+ }),
42867
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
42868
+ logTail: array(string()).readonly(),
42869
+ logCursor: string().nullable(),
42870
+ artifacts: object({
42871
+ bundleBytes: number().int(),
42872
+ bundleSha256: string(),
42873
+ fetchedAt: number(),
42874
+ /** When the staged artefacts are deleted from the hub. */
42875
+ expiresAt: number()
42876
+ }).nullable(),
42877
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
42878
+ cloudDatasetDeletedAt: number().nullable(),
42879
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
42880
+ cloudCleanupDueAt: number().nullable(),
42881
+ /** Model ids registered from this job (base, and int8 when kept). */
42882
+ registeredModelIds: array(string()).readonly(),
42883
+ canary: TrainingCanarySchema.nullable()
42884
+ });
42885
+ var IdInput = object({ id: string().min(1) });
42886
+ method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
42887
+ kind: "mutation",
42888
+ auth: "admin"
42889
+ }), 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() }), {
42890
+ kind: "mutation",
42891
+ auth: "admin"
42892
+ }), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
42893
+ auth: "admin",
42894
+ timeoutMs: 6e4
42895
+ }), method(TrainingJobRequestSchema.extend({
42896
+ name: string().min(1).max(120),
42897
+ maxCostUsd: number().positive(),
42898
+ maxRuntimeSec: number().int().positive(),
42899
+ idempotencyKey: string().min(8).max(80)
42900
+ }), discriminatedUnion("kind", [object({
42901
+ kind: literal("started"),
42902
+ job: TrainingJobSchema
42903
+ }), object({
42904
+ kind: literal("refused"),
42905
+ reason: TrainingRefusalReasonSchema,
42906
+ detail: string()
42907
+ })]), {
42908
+ kind: "mutation",
42909
+ auth: "admin",
42910
+ timeoutMs: 12e4
42911
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
42912
+ kind: "mutation",
42913
+ auth: "admin",
42914
+ timeoutMs: 12e4
42915
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
42916
+ kind: "mutation",
42917
+ auth: "admin",
42918
+ timeoutMs: 30 * 6e4
42919
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
42920
+ kind: "mutation",
42921
+ auth: "admin",
42922
+ timeoutMs: 12e4
42923
+ }), method(IdInput, TrainingJobSchema, {
42924
+ kind: "mutation",
42925
+ auth: "admin",
42926
+ timeoutMs: 12e4
42927
+ }), method(IdInput, TrainingJobSchema, {
42928
+ kind: "mutation",
42929
+ auth: "admin"
42930
+ });
41636
42931
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
41637
42932
  Object.freeze({
41638
42933
  person: .5,
@@ -43304,6 +44599,12 @@ Object.freeze({
43304
44599
  addonId: null,
43305
44600
  access: "create"
43306
44601
  },
44602
+ "backup.checkBackupKey": {
44603
+ capName: "backup",
44604
+ capScope: "system",
44605
+ addonId: null,
44606
+ access: "create"
44607
+ },
43307
44608
  "backup.delete": {
43308
44609
  capName: "backup",
43309
44610
  capScope: "system",
@@ -43316,6 +44617,18 @@ Object.freeze({
43316
44617
  addonId: null,
43317
44618
  access: "delete"
43318
44619
  },
44620
+ "backup.disableEncryption": {
44621
+ capName: "backup",
44622
+ capScope: "system",
44623
+ addonId: null,
44624
+ access: "create"
44625
+ },
44626
+ "backup.getEncryption": {
44627
+ capName: "backup",
44628
+ capScope: "system",
44629
+ addonId: null,
44630
+ access: "view"
44631
+ },
43319
44632
  "backup.getEntries": {
43320
44633
  capName: "backup",
43321
44634
  capScope: "system",
@@ -43370,6 +44683,12 @@ Object.freeze({
43370
44683
  addonId: null,
43371
44684
  access: "create"
43372
44685
  },
44686
+ "backup.setupEncryption": {
44687
+ capName: "backup",
44688
+ capScope: "system",
44689
+ addonId: null,
44690
+ access: "create"
44691
+ },
43373
44692
  "backup.trigger": {
43374
44693
  capName: "backup",
43375
44694
  capScope: "system",
@@ -43922,6 +45241,12 @@ Object.freeze({
43922
45241
  addonId: null,
43923
45242
  access: "create"
43924
45243
  },
45244
+ "customModelRegistry.importModelBundle": {
45245
+ capName: "custom-model-registry",
45246
+ capScope: "system",
45247
+ addonId: null,
45248
+ access: "create"
45249
+ },
43925
45250
  "customModelRegistry.listModels": {
43926
45251
  capName: "custom-model-registry",
43927
45252
  capScope: "system",
@@ -45362,6 +46687,12 @@ Object.freeze({
45362
46687
  addonId: null,
45363
46688
  access: "view"
45364
46689
  },
46690
+ "keychainAdmin.acknowledgeReset": {
46691
+ capName: "keychain-admin",
46692
+ capScope: "system",
46693
+ addonId: null,
46694
+ access: "create"
46695
+ },
45365
46696
  "keychainAdmin.deleteOrphans": {
45366
46697
  capName: "keychain-admin",
45367
46698
  capScope: "system",
@@ -45398,6 +46729,12 @@ Object.freeze({
45398
46729
  addonId: null,
45399
46730
  access: "delete"
45400
46731
  },
46732
+ "keychainAdmin.resetReport": {
46733
+ capName: "keychain-admin",
46734
+ capScope: "system",
46735
+ addonId: null,
46736
+ access: "delete"
46737
+ },
45401
46738
  "keychainAdmin.reveal": {
45402
46739
  capName: "keychain-admin",
45403
46740
  capScope: "system",
@@ -47144,6 +48481,12 @@ Object.freeze({
47144
48481
  addonId: null,
47145
48482
  access: "view"
47146
48483
  },
48484
+ "pipelineAnalytics.offerRetrainArchive": {
48485
+ capName: "pipeline-analytics",
48486
+ capScope: "device",
48487
+ addonId: null,
48488
+ access: "create"
48489
+ },
47147
48490
  "pipelineAnalytics.ownersWithMedia": {
47148
48491
  capName: "pipeline-analytics",
47149
48492
  capScope: "device",
@@ -49682,6 +51025,174 @@ Object.freeze({
49682
51025
  addonId: null,
49683
51026
  access: "view"
49684
51027
  },
51028
+ "training.canaryResult": {
51029
+ capName: "training",
51030
+ capScope: "system",
51031
+ addonId: null,
51032
+ access: "create"
51033
+ },
51034
+ "training.cancelJob": {
51035
+ capName: "training",
51036
+ capScope: "system",
51037
+ addonId: null,
51038
+ access: "create"
51039
+ },
51040
+ "training.discardResult": {
51041
+ capName: "training",
51042
+ capScope: "system",
51043
+ addonId: null,
51044
+ access: "create"
51045
+ },
51046
+ "training.findDatasetVersionIdByName": {
51047
+ capName: "training",
51048
+ capScope: "system",
51049
+ addonId: null,
51050
+ access: "view"
51051
+ },
51052
+ "training.getDatasetVersion": {
51053
+ capName: "training",
51054
+ capScope: "system",
51055
+ addonId: null,
51056
+ access: "view"
51057
+ },
51058
+ "training.getJob": {
51059
+ capName: "training",
51060
+ capScope: "system",
51061
+ addonId: null,
51062
+ access: "view"
51063
+ },
51064
+ "training.getJobResult": {
51065
+ capName: "training",
51066
+ capScope: "system",
51067
+ addonId: null,
51068
+ access: "view"
51069
+ },
51070
+ "training.listBaseModels": {
51071
+ capName: "training",
51072
+ capScope: "system",
51073
+ addonId: null,
51074
+ access: "view"
51075
+ },
51076
+ "training.listDatasetVersions": {
51077
+ capName: "training",
51078
+ capScope: "system",
51079
+ addonId: null,
51080
+ access: "view"
51081
+ },
51082
+ "training.listJobs": {
51083
+ capName: "training",
51084
+ capScope: "system",
51085
+ addonId: null,
51086
+ access: "view"
51087
+ },
51088
+ "training.planJob": {
51089
+ capName: "training",
51090
+ capScope: "system",
51091
+ addonId: null,
51092
+ access: "view"
51093
+ },
51094
+ "training.putDatasetVersion": {
51095
+ capName: "training",
51096
+ capScope: "system",
51097
+ addonId: null,
51098
+ access: "create"
51099
+ },
51100
+ "training.registerResult": {
51101
+ capName: "training",
51102
+ capScope: "system",
51103
+ addonId: null,
51104
+ access: "create"
51105
+ },
51106
+ "training.removeDatasetVersion": {
51107
+ capName: "training",
51108
+ capScope: "system",
51109
+ addonId: null,
51110
+ access: "delete"
51111
+ },
51112
+ "training.rollbackCanary": {
51113
+ capName: "training",
51114
+ capScope: "system",
51115
+ addonId: null,
51116
+ access: "create"
51117
+ },
51118
+ "training.startJob": {
51119
+ capName: "training",
51120
+ capScope: "system",
51121
+ addonId: null,
51122
+ access: "create"
51123
+ },
51124
+ "trainingProvider.cancelJob": {
51125
+ capName: "training-provider",
51126
+ capScope: "system",
51127
+ addonId: null,
51128
+ access: "create"
51129
+ },
51130
+ "trainingProvider.cleanupJob": {
51131
+ capName: "training-provider",
51132
+ capScope: "system",
51133
+ addonId: null,
51134
+ access: "create"
51135
+ },
51136
+ "trainingProvider.describe": {
51137
+ capName: "training-provider",
51138
+ capScope: "system",
51139
+ addonId: null,
51140
+ access: "view"
51141
+ },
51142
+ "trainingProvider.estimateJob": {
51143
+ capName: "training-provider",
51144
+ capScope: "system",
51145
+ addonId: null,
51146
+ access: "view"
51147
+ },
51148
+ "trainingProvider.getJob": {
51149
+ capName: "training-provider",
51150
+ capScope: "system",
51151
+ addonId: null,
51152
+ access: "view"
51153
+ },
51154
+ "trainingProvider.listJobEvents": {
51155
+ capName: "training-provider",
51156
+ capScope: "system",
51157
+ addonId: null,
51158
+ access: "view"
51159
+ },
51160
+ "trainingProvider.listJobs": {
51161
+ capName: "training-provider",
51162
+ capScope: "system",
51163
+ addonId: null,
51164
+ access: "view"
51165
+ },
51166
+ "trainingProvider.offerArtifact": {
51167
+ capName: "training-provider",
51168
+ capScope: "system",
51169
+ addonId: null,
51170
+ access: "create"
51171
+ },
51172
+ "trainingProvider.readResult": {
51173
+ capName: "training-provider",
51174
+ capScope: "system",
51175
+ addonId: null,
51176
+ access: "create"
51177
+ },
51178
+ "trainingProvider.submitJob": {
51179
+ capName: "training-provider",
51180
+ capScope: "system",
51181
+ addonId: null,
51182
+ access: "create"
51183
+ },
51184
+ "trainingProvider.uploadDataset": {
51185
+ capName: "training-provider",
51186
+ capScope: "system",
51187
+ addonId: null,
51188
+ access: "create"
51189
+ },
51190
+ "trainingProvider.validateCredentials": {
51191
+ capName: "training-provider",
51192
+ capScope: "system",
51193
+ addonId: null,
51194
+ access: "create"
51195
+ },
49685
51196
  "turnProvider.getTurnServers": {
49686
51197
  capName: "turn-provider",
49687
51198
  capScope: "system",
@@ -49706,12 +51217,6 @@ Object.freeze({
49706
51217
  addonId: null,
49707
51218
  access: "create"
49708
51219
  },
49709
- "userManagement.createApiKey": {
49710
- capName: "user-management",
49711
- capScope: "system",
49712
- addonId: null,
49713
- access: "create"
49714
- },
49715
51220
  "userManagement.createScopedToken": {
49716
51221
  capName: "user-management",
49717
51222
  capScope: "system",
@@ -49748,12 +51253,6 @@ Object.freeze({
49748
51253
  addonId: null,
49749
51254
  access: "view"
49750
51255
  },
49751
- "userManagement.linkExternalIdentity": {
49752
- capName: "user-management",
49753
- capScope: "system",
49754
- addonId: null,
49755
- access: "create"
49756
- },
49757
51256
  "userManagement.listApiKeys": {
49758
51257
  capName: "user-management",
49759
51258
  capScope: "system",
@@ -49856,12 +51355,6 @@ Object.freeze({
49856
51355
  addonId: null,
49857
51356
  access: "create"
49858
51357
  },
49859
- "userManagement.validateApiKey": {
49860
- capName: "user-management",
49861
- capScope: "system",
49862
- addonId: null,
49863
- access: "view"
49864
- },
49865
51358
  "userManagement.validateCredentials": {
49866
51359
  capName: "user-management",
49867
51360
  capScope: "system",
@@ -53975,6 +55468,11 @@ Object.freeze({
53975
55468
  form: "single",
53976
55469
  optional: false
53977
55470
  }],
55471
+ "training.canaryResult": [{
55472
+ name: "deviceIds",
55473
+ form: "array",
55474
+ optional: false
55475
+ }],
53978
55476
  "update.getStatus": [{
53979
55477
  name: "deviceId",
53980
55478
  form: "single",
@@ -54703,6 +56201,8 @@ var STATE_SUMMARY_VARS = [
54703
56201
  [...RULE_TEXT],
54704
56202
  [...RULE_TEXT],
54705
56203
  [...RULE_TEXT],
56204
+ [...RULE_TEXT],
56205
+ [...RULE_TEXT],
54706
56206
  ([...RULE_TEXT], [...UPDATES]),
54707
56207
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
54708
56208
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),