@camstack/addon-provider-wyze 0.2.134 → 0.2.136

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 +1985 -210
  2. package/dist/addon.mjs +1985 -210
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -5409,7 +5409,7 @@ var ZodIssueCode = {
5409
5409
  var ZodFirstPartyTypeKind;
5410
5410
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5411
5411
  //#endregion
5412
- //#region ../types/dist/sleep-DujUvOcb.mjs
5412
+ //#region ../types/dist/sleep-DwAQ9sqX.mjs
5413
5413
  /**
5414
5414
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5415
5415
  * window to float samples (D455).
@@ -5526,7 +5526,7 @@ function isKeychainStoredField(field) {
5526
5526
  var SECRET_CLEAR = { $secretClear: true };
5527
5527
  /** The `'***'` token D634 redaction writes for non-admins. */
5528
5528
  var LEGACY_DEVICE_REDACTION = "***";
5529
- function isRecord$1(value) {
5529
+ function isRecord$2(value) {
5530
5530
  return typeof value === "object" && value !== null && !Array.isArray(value);
5531
5531
  }
5532
5532
  function makeSecretMarker(ref) {
@@ -5537,12 +5537,12 @@ function makeSecretMarker(ref) {
5537
5537
  }
5538
5538
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5539
5539
  function isSecretMarker(value) {
5540
- if (!isRecord$1(value)) return false;
5540
+ if (!isRecord$2(value)) return false;
5541
5541
  const ref = value["$secret"];
5542
5542
  return typeof ref === "string" && ref.length > 0;
5543
5543
  }
5544
5544
  function isSecretClear(value) {
5545
- return isRecord$1(value) && value["$secretClear"] === true;
5545
+ return isRecord$2(value) && value["$secretClear"] === true;
5546
5546
  }
5547
5547
  /**
5548
5548
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6058,6 +6058,13 @@ function globalSecretScope() {
6058
6058
  function encodeSegment(value) {
6059
6059
  return encodeURIComponent(value);
6060
6060
  }
6061
+ function decodeSegment(value) {
6062
+ try {
6063
+ return decodeURIComponent(value);
6064
+ } catch {
6065
+ return null;
6066
+ }
6067
+ }
6061
6068
  /**
6062
6069
  * The field path of a value inside an array item, addressed by the item's id:
6063
6070
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6066,6 +6073,75 @@ function encodeSegment(value) {
6066
6073
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6067
6074
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6068
6075
  }
6076
+ function parseScope(segments) {
6077
+ switch (segments[0]) {
6078
+ case "global": return {
6079
+ scope: GLOBAL_SCOPE,
6080
+ used: 1
6081
+ };
6082
+ case "node": {
6083
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6084
+ return nodeId === null || nodeId.length === 0 ? null : {
6085
+ scope: {
6086
+ kind: "node",
6087
+ nodeId
6088
+ },
6089
+ used: 2
6090
+ };
6091
+ }
6092
+ case "device": {
6093
+ const raw = segments[1];
6094
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6095
+ return {
6096
+ scope: {
6097
+ kind: "device",
6098
+ deviceId: Number(raw)
6099
+ },
6100
+ used: 2
6101
+ };
6102
+ }
6103
+ case "integration": {
6104
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6105
+ return id === null || id.length === 0 ? null : {
6106
+ scope: {
6107
+ kind: "integration",
6108
+ integrationId: id
6109
+ },
6110
+ used: 2
6111
+ };
6112
+ }
6113
+ case "row": {
6114
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6115
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6116
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6117
+ return {
6118
+ scope: {
6119
+ kind: "row",
6120
+ collection,
6121
+ rowId
6122
+ },
6123
+ used: 3
6124
+ };
6125
+ }
6126
+ default: return null;
6127
+ }
6128
+ }
6129
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6130
+ function parseSecretRef(ref) {
6131
+ if (!ref.startsWith("secret://")) return null;
6132
+ const segments = ref.slice(9).split("/");
6133
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6134
+ if (owner === null || owner.length === 0) return null;
6135
+ const parsed = parseScope(segments.slice(1));
6136
+ if (parsed === null) return null;
6137
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6138
+ if (fieldPath.length === 0) return null;
6139
+ return {
6140
+ owner,
6141
+ scope: parsed.scope,
6142
+ fieldPath
6143
+ };
6144
+ }
6069
6145
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6070
6146
  var KeychainWriteRefusedError = class extends Error {
6071
6147
  fieldPath;
@@ -6076,7 +6152,7 @@ var KeychainWriteRefusedError = class extends Error {
6076
6152
  }
6077
6153
  };
6078
6154
  var KEEP = { kind: "keep" };
6079
- function isRecord(value) {
6155
+ function isRecord$1(value) {
6080
6156
  return typeof value === "object" && value !== null && !Array.isArray(value);
6081
6157
  }
6082
6158
  function defaultMintId() {
@@ -6089,7 +6165,7 @@ function collectSecretMarkerRefs(value, out = []) {
6089
6165
  return out;
6090
6166
  }
6091
6167
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6092
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6168
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6093
6169
  return out;
6094
6170
  }
6095
6171
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6144,7 +6220,7 @@ function rowId(row, idKey) {
6144
6220
  return null;
6145
6221
  }
6146
6222
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6147
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6223
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6148
6224
  if (!Array.isArray(incoming)) {
6149
6225
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6150
6226
  return {
@@ -6160,7 +6236,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6160
6236
  const kept = /* @__PURE__ */ new Set();
6161
6237
  const rows = [];
6162
6238
  for (const row of incoming) {
6163
- if (!isRecord(row)) {
6239
+ if (!isRecord$1(row)) {
6164
6240
  rows.push(row);
6165
6241
  continue;
6166
6242
  }
@@ -6185,7 +6261,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6185
6261
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6186
6262
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6187
6263
  case "object": {
6188
- if (!isRecord(incoming)) {
6264
+ if (!isRecord$1(incoming)) {
6189
6265
  if (incoming === void 0) return KEEP;
6190
6266
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6191
6267
  return {
@@ -6193,7 +6269,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6193
6269
  value: incoming
6194
6270
  };
6195
6271
  }
6196
- const storedObj = isRecord(stored) ? stored : {};
6272
+ const storedObj = isRecord$1(stored) ? stored : {};
6197
6273
  return {
6198
6274
  kind: "value",
6199
6275
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6252,12 +6328,19 @@ async function transformSecretWrite(input) {
6252
6328
  }
6253
6329
  };
6254
6330
  }
6331
+ /** Is `ref` one of `owner`'s refs? */
6332
+ function isSecretRefOwnedBy(ref, owner) {
6333
+ return parseSecretRef(ref)?.owner === owner;
6334
+ }
6255
6335
  /**
6256
6336
  * Replace every marker in `value` with its keychain value. Returns the SAME
6257
6337
  * reference when there is no marker (no allocation, no keychain call).
6258
6338
  */
6259
- async function resolveSecretMarkers(value, secrets) {
6260
- const refs = collectSecretMarkerRefs(value);
6339
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6340
+ const keepMarker = options.unresolved === "keep-marker";
6341
+ const owner = options.ownedBy;
6342
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6343
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6261
6344
  if (refs.length === 0) return {
6262
6345
  value,
6263
6346
  unresolved: []
@@ -6281,10 +6364,18 @@ async function resolveSecretMarkers(value, secrets) {
6281
6364
  }
6282
6365
  const substitute = (v) => {
6283
6366
  if (isSecretMarker(v)) {
6367
+ if (!inScope(v.$secret)) return {
6368
+ keep: true,
6369
+ value: v
6370
+ };
6284
6371
  const answer = answers[v.$secret];
6285
- return answer?.kind === "value" ? {
6372
+ if (answer?.kind === "value") return {
6286
6373
  keep: true,
6287
6374
  value: answer.value
6375
+ };
6376
+ return keepMarker ? {
6377
+ keep: true,
6378
+ value: v
6288
6379
  } : {
6289
6380
  keep: false,
6290
6381
  value: void 0
@@ -6301,7 +6392,7 @@ async function resolveSecretMarkers(value, secrets) {
6301
6392
  value: items
6302
6393
  };
6303
6394
  }
6304
- if (isRecord(v)) {
6395
+ if (isRecord$1(v)) {
6305
6396
  const out = {};
6306
6397
  for (const [k, child] of Object.entries(v)) {
6307
6398
  const s = substitute(child);
@@ -6322,14 +6413,152 @@ async function resolveSecretMarkers(value, secrets) {
6322
6413
  unresolved
6323
6414
  };
6324
6415
  }
6325
- function touchesTree(tree, patch) {
6326
- if (tree.size === 0) return false;
6327
- for (const key of Object.keys(patch)) {
6328
- const at = key.indexOf("@");
6329
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6416
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6417
+ var SecretOverwriteRefusedError = class extends Error {
6418
+ ref;
6419
+ reason;
6420
+ constructor(ref, reason) {
6421
+ super(`secret ${ref} was not replaced: its stored value cannot be read right now (${reason}), and an addon may not overwrite a secret it cannot see. Nothing was written.`);
6422
+ this.ref = ref;
6423
+ this.reason = reason;
6424
+ this.name = "SecretOverwriteRefusedError";
6425
+ }
6426
+ };
6427
+ function isRecord(value) {
6428
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6429
+ }
6430
+ function resolvedValue(pass, marker) {
6431
+ const answer = pass.answers[marker.$secret];
6432
+ return answer?.kind === "value" ? answer.value : null;
6433
+ }
6434
+ async function atMarker(pass, incoming, stored) {
6435
+ if (incoming === null) return stored;
6436
+ if (typeof incoming !== "string") return incoming;
6437
+ if (incoming === resolvedValue(pass, stored)) return stored;
6438
+ const intent = classifySecretWrite(incoming);
6439
+ if (intent.kind !== "set") return stored;
6440
+ const ref = stored.$secret;
6441
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6442
+ const answer = pass.answers[ref];
6443
+ if ((answer === void 0 || answer.kind === "unavailable" || answer.kind === "forbidden") && !pass.operatorWrite) throw new SecretOverwriteRefusedError(ref, answer === void 0 ? "not-initialized" : answer.kind === "unavailable" ? answer.reason : answer.kind);
6444
+ try {
6445
+ await pass.secrets.put(ref, intent.value);
6446
+ } catch (err) {
6447
+ throw new KeychainWriteRefusedError(ref, err);
6448
+ }
6449
+ pass.changedRefs.push(ref);
6450
+ return stored;
6451
+ }
6452
+ function inArray(pass, incoming, stored) {
6453
+ return incoming.map((item, index) => {
6454
+ const twin = stored[index];
6455
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6456
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6457
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6458
+ return item;
6459
+ });
6460
+ }
6461
+ function inArrayRow(pass, incoming, stored) {
6462
+ const out = { ...incoming };
6463
+ for (const [key, value] of Object.entries(incoming)) {
6464
+ const twin = stored[key];
6465
+ if (isSecretMarker(twin)) {
6466
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6467
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6468
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6469
+ }
6470
+ return out;
6471
+ }
6472
+ async function walk(pass, incoming, stored) {
6473
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6474
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6475
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6476
+ const out = { ...incoming };
6477
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6478
+ return out;
6479
+ }
6480
+ /** Restore markers a write-back carries as values. See the file doc. */
6481
+ async function restoreUnchangedSecrets(input) {
6482
+ const refs = [];
6483
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6484
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6485
+ if (owned.length === 0) return {
6486
+ patch: input.patch,
6487
+ changedRefs: []
6488
+ };
6489
+ const pass = {
6490
+ secrets: input.secrets,
6491
+ answers: await input.secrets.resolve([...new Set(owned)]),
6492
+ operatorWrite: input.operatorWrite,
6493
+ changedRefs: []
6494
+ };
6495
+ const out = {};
6496
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6497
+ return {
6498
+ patch: out,
6499
+ changedRefs: pass.changedRefs
6500
+ };
6501
+ }
6502
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6503
+ function isJsonEqual(a, b) {
6504
+ if (Object.is(a, b)) return true;
6505
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6506
+ if (isRecord(a) && isRecord(b)) {
6507
+ const keys = Object.keys(a);
6508
+ if (keys.length !== Object.keys(b).length) return false;
6509
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6330
6510
  }
6331
6511
  return false;
6332
6512
  }
6513
+ /** The patch without the keys whose value already equals the stored one. */
6514
+ function dropUnchangedKeys(patch, stored) {
6515
+ const out = {};
6516
+ for (const [key, value] of Object.entries(patch)) {
6517
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6518
+ out[key] = value;
6519
+ }
6520
+ return out;
6521
+ }
6522
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6523
+ function markerKeysOf(blob, owner) {
6524
+ const keys = /* @__PURE__ */ new Set();
6525
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6526
+ return keys;
6527
+ }
6528
+ function nodeFromStored(value, owner) {
6529
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6530
+ if (!isRecord(value)) return null;
6531
+ const children = /* @__PURE__ */ new Map();
6532
+ for (const [key, child] of Object.entries(value)) {
6533
+ const node = nodeFromStored(child, owner);
6534
+ if (node !== null) children.set(key, node);
6535
+ }
6536
+ return children.size > 0 ? {
6537
+ kind: "object",
6538
+ children
6539
+ } : null;
6540
+ }
6541
+ /**
6542
+ * The declared secret tree, widened by every place the STORED blob holds a
6543
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6544
+ * never declared: Wyze before b4906cec6) still gets the save path's
6545
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6546
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6547
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6548
+ * builtin that keeps another addon's marker (device-manager) never takes it
6549
+ * over.
6550
+ */
6551
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6552
+ const added = /* @__PURE__ */ new Map();
6553
+ for (const key of keys) {
6554
+ const at = key.indexOf("@");
6555
+ const base = at > 0 ? key.slice(0, at) : key;
6556
+ if (declared.has(base) || added.has(base)) continue;
6557
+ const node = nodeFromStored(stored[key], owner);
6558
+ if (node !== null) added.set(base, node);
6559
+ }
6560
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6561
+ }
6333
6562
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6334
6563
  async function readStoredAddonBlob(raw) {
6335
6564
  const threeWay = raw.readAddonStoreResult;
@@ -6338,7 +6567,41 @@ async function readStoredAddonBlob(raw) {
6338
6567
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6339
6568
  return result.kind === "missing" ? {} : result.value;
6340
6569
  }
6341
- function createSecretAwareSettings(raw, opts) {
6570
+ function touchesTree(tree, patch) {
6571
+ if (tree.size === 0) return false;
6572
+ for (const key of Object.keys(patch)) {
6573
+ const at = key.indexOf("@");
6574
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6575
+ }
6576
+ return false;
6577
+ }
6578
+ /**
6579
+ * Which top-level keys of each store held markers when last seen. `undefined`
6580
+ * for a store not seen yet: its first write reads it, to be safe.
6581
+ */
6582
+ var MarkerKeyIndex = class {
6583
+ owner;
6584
+ byStore = /* @__PURE__ */ new Map();
6585
+ constructor(owner) {
6586
+ this.owner = owner;
6587
+ }
6588
+ seen(store, blob) {
6589
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6590
+ }
6591
+ wrote(store, patch) {
6592
+ const keys = this.byStore.get(store);
6593
+ if (keys === void 0) return;
6594
+ const now = markerKeysOf(patch, this.owner);
6595
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6596
+ else keys.delete(key);
6597
+ }
6598
+ mayHoldMarkers(store, patch) {
6599
+ const keys = this.byStore.get(store);
6600
+ if (keys === void 0) return true;
6601
+ return Object.keys(patch).some((key) => keys.has(key));
6602
+ }
6603
+ };
6604
+ function createHandle(raw, opts) {
6342
6605
  const chains = /* @__PURE__ */ new Map();
6343
6606
  const serialize = (key, fn) => {
6344
6607
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6349,46 +6612,130 @@ function createSecretAwareSettings(raw, opts) {
6349
6612
  });
6350
6613
  return next;
6351
6614
  };
6352
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6353
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6354
- return serialize(chainKey, async () => {
6615
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6616
+ const resolveRead = async (store, blob) => {
6617
+ index.seen(store, blob);
6618
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6619
+ unresolved: "keep-marker",
6620
+ ownedBy: opts.secrets.owner
6621
+ });
6622
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6623
+ return value;
6624
+ };
6625
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6626
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6627
+ await rawWrite(patch);
6628
+ index.wrote(store, patch);
6629
+ return { changed: true };
6630
+ }
6631
+ return serialize(store, async () => {
6355
6632
  const stored = await readStored();
6633
+ index.seen(store, stored);
6634
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6635
+ const restored = await restoreUnchangedSecrets({
6636
+ patch,
6637
+ stored,
6638
+ secrets: opts.secrets,
6639
+ operatorWrite
6640
+ });
6356
6641
  const result = await transformSecretWrite({
6357
- tree,
6642
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6358
6643
  secrets: opts.secrets,
6359
- patch,
6644
+ patch: restored.patch,
6360
6645
  stored,
6361
6646
  ...scope !== void 0 ? { scope } : {},
6362
- operatorWrite: opts.isOperatorWrite?.() === true
6647
+ operatorWrite
6363
6648
  });
6364
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6649
+ const effective = dropUnchangedKeys(result.patch, stored);
6650
+ const wroteBlob = Object.keys(effective).length > 0;
6651
+ if (wroteBlob) {
6652
+ await rawWrite(effective);
6653
+ index.wrote(store, effective);
6654
+ }
6365
6655
  const { orphaned } = await result.afterWrite();
6366
6656
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6657
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6367
6658
  });
6368
6659
  };
6369
- const wrapped = {
6370
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6371
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6372
- kind: "device",
6373
- deviceId
6374
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6660
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6661
+ const readAddonStoreResult = raw.readAddonStoreResult;
6662
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6663
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6664
+ const overrides = {
6665
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6666
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6667
+ const result = await readAddonStoreResult.call(raw);
6668
+ return result.kind === "value" ? {
6669
+ kind: "value",
6670
+ value: await resolveRead("addon", result.value)
6671
+ } : result;
6672
+ } } : {},
6673
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6674
+ const result = await readAddonStoreKeyResult.call(raw, key);
6675
+ if (result.kind !== "present") return result;
6676
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6677
+ unresolved: "keep-marker",
6678
+ ownedBy: opts.secrets.owner
6679
+ });
6680
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6681
+ return {
6682
+ kind: "present",
6683
+ value: value[key]
6684
+ };
6685
+ } } : {},
6686
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6687
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6688
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6689
+ const out = /* @__PURE__ */ new Map();
6690
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6691
+ return out;
6692
+ } } : {},
6693
+ writeAddonStore: async (patch) => {
6694
+ await writeAddon(patch);
6695
+ },
6696
+ writeDeviceStore: async (deviceId, patch) => {
6697
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6698
+ kind: "device",
6699
+ deviceId
6700
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6701
+ }
6702
+ };
6703
+ return {
6704
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6705
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6706
+ const value = Reflect.get(target, prop, receiver);
6707
+ return typeof value === "function" ? value.bind(target) : value;
6708
+ } }),
6709
+ raw: {
6710
+ readAddonStore: async () => {
6711
+ const blob = await raw.readAddonStore();
6712
+ index.seen("addon", blob);
6713
+ return blob;
6714
+ },
6715
+ readDeviceStore: async (deviceId) => {
6716
+ const blob = await raw.readDeviceStore(deviceId);
6717
+ index.seen(`device:${deviceId}`, blob);
6718
+ return blob;
6719
+ }
6720
+ },
6721
+ writeAddonStore: writeAddon
6375
6722
  };
6376
- return new Proxy(raw, { get(target, prop, receiver) {
6377
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6378
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6379
- const value = Reflect.get(target, prop, receiver);
6380
- return typeof value === "function" ? value.bind(target) : value;
6381
- } });
6382
6723
  }
6383
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6384
- function withSecretAwareSettings(context, opts) {
6724
+ /** The context the addon sees, plus the private raw view and write outcome. */
6725
+ function createSecretAwareContext(context, opts) {
6385
6726
  const raw = context.settings;
6386
- if (raw === void 0) return context;
6387
- const settings = createSecretAwareSettings(raw, opts);
6388
- return new Proxy(context, { get(target, prop, receiver) {
6389
- if (prop === "settings") return settings;
6390
- return Reflect.get(target, prop, receiver);
6391
- } });
6727
+ if (raw === void 0) return {
6728
+ context,
6729
+ handle: null
6730
+ };
6731
+ const handle = createHandle(raw, opts);
6732
+ return {
6733
+ context: new Proxy(context, { get(target, prop, receiver) {
6734
+ if (prop === "settings") return handle.settings;
6735
+ return Reflect.get(target, prop, receiver);
6736
+ } }),
6737
+ handle
6738
+ };
6392
6739
  }
6393
6740
  var LEAF = { kind: "leaf" };
6394
6741
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6563,6 +6910,14 @@ var BaseAddon = class {
6563
6910
  _secretChangeUnsub = null;
6564
6911
  /** >0 while an OPERATOR's settings write is being applied. */
6565
6912
  _operatorWriteDepth = 0;
6913
+ /**
6914
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6915
+ * to the marker-bearing blobs and stays private to this class: the form
6916
+ * hydrate and config resolution need markers, addon code never does.
6917
+ */
6918
+ _secretSettings = null;
6919
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6920
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6566
6921
  constructor(defaults) {
6567
6922
  this.defaults = defaults;
6568
6923
  this._config = { ...defaults };
@@ -6599,13 +6954,21 @@ var BaseAddon = class {
6599
6954
  }
6600
6955
  async initialize(context) {
6601
6956
  const secrets = context.secrets;
6602
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6603
- secrets,
6604
- addonTree: () => this.addonSecretTree(),
6605
- deviceTree: () => this.deviceSecretTree(),
6606
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6607
- isOperatorWrite: () => this._operatorWriteDepth > 0
6608
- }) : context;
6957
+ if (secrets !== void 0) {
6958
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6959
+ secrets,
6960
+ addonTree: () => this.addonSecretTree(),
6961
+ deviceTree: () => this.deviceSecretTree(),
6962
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6963
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6964
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6965
+ });
6966
+ this._ctx = wrapped;
6967
+ this._secretSettings = handle;
6968
+ } else {
6969
+ this._ctx = context;
6970
+ this._secretSettings = null;
6971
+ }
6609
6972
  await this.resolveConfig();
6610
6973
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6611
6974
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6722,11 +7085,8 @@ var BaseAddon = class {
6722
7085
  async getGlobalSettings(overlay, cap, nodeId) {
6723
7086
  const schema = this.globalSettingsSchema(cap);
6724
7087
  if (!schema) return { sections: [] };
6725
- const projected = await this.resolveGlobalStore(nodeId, cap);
6726
- return hydrateSchema(schema, overlay ? {
6727
- ...projected,
6728
- ...overlay
6729
- } : projected, { inlineSecretsAsViews: true });
7088
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7089
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6730
7090
  }
6731
7091
  /**
6732
7092
  * The integration-level view of this addon's settings: exactly the sections
@@ -6771,7 +7131,7 @@ var BaseAddon = class {
6771
7131
  });
6772
7132
  }
6773
7133
  if (sections.length === 0) return null;
6774
- const projected = await this.resolveGlobalStore(nodeId);
7134
+ const projected = await this.readRawProjectedStore(nodeId);
6775
7135
  return hydrateSchema({
6776
7136
  ...schema,
6777
7137
  sections
@@ -6788,12 +7148,50 @@ var BaseAddon = class {
6788
7148
  * the store for custom option logic (option narrowing, value snapping) to
6789
7149
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6790
7150
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7151
+ *
7152
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7153
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7154
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7155
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7156
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7157
+ * resolved blob back is a no-op for every unchanged secret.
6791
7158
  */
6792
7159
  async resolveGlobalStore(nodeId, cap) {
6793
7160
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7161
+ return this.projectForNode(raw, nodeId, cap);
7162
+ }
7163
+ projectForNode(store, nodeId, cap) {
6794
7164
  const keys = this.perNodeKeys(cap);
6795
7165
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6796
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7166
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7167
+ }
7168
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7169
+ async readRawProjectedStore(nodeId, cap) {
7170
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7171
+ return this.projectForNode(raw, nodeId, cap);
7172
+ }
7173
+ /**
7174
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7175
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7176
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7177
+ * its value.
7178
+ */
7179
+ async overlayKeepingMarkers(stored, overlay) {
7180
+ const secrets = this._ctx?.secrets;
7181
+ const merged = {
7182
+ ...stored,
7183
+ ...overlay
7184
+ };
7185
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7186
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7187
+ unresolved: "keep-marker",
7188
+ ownedBy: secrets.owner
7189
+ });
7190
+ for (const key of Object.keys(overlay)) {
7191
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7192
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7193
+ }
7194
+ return merged;
6797
7195
  }
6798
7196
  /**
6799
7197
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6858,8 +7256,12 @@ var BaseAddon = class {
6858
7256
  async clearSecrets(keys, nodeId) {
6859
7257
  const tree = this.addonSecretTree();
6860
7258
  const keychain = this._ctx?.secrets !== void 0;
7259
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6861
7260
  const patch = {};
6862
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7261
+ for (const key of keys) {
7262
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7263
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7264
+ }
6863
7265
  await this.applyGlobalPatch(patch, nodeId);
6864
7266
  }
6865
7267
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6867,7 +7269,11 @@ var BaseAddon = class {
6867
7269
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6868
7270
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6869
7271
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6870
- await this._ctx?.settings?.writeAddonStore(scoped);
7272
+ const handle = this._secretSettings;
7273
+ if (handle !== null) {
7274
+ const { changed } = await handle.writeAddonStore(scoped);
7275
+ if (!changed) return;
7276
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6871
7277
  if (target !== localNode) return;
6872
7278
  await this.resolveConfig();
6873
7279
  await this.onConfigChanged();
@@ -6920,7 +7326,7 @@ var BaseAddon = class {
6920
7326
  async getDeviceSettings(deviceId) {
6921
7327
  const schema = this.deviceSettingsSchema();
6922
7328
  if (!schema) return { sections: [] };
6923
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7329
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6924
7330
  }
6925
7331
  async updateDeviceSettings(deviceId, patch) {
6926
7332
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7092,7 +7498,7 @@ var BaseAddon = class {
7092
7498
  key,
7093
7499
  schema,
7094
7500
  fallback,
7095
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7501
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7096
7502
  write: async (patch) => {
7097
7503
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7098
7504
  },
@@ -7154,6 +7560,23 @@ var BaseAddon = class {
7154
7560
  }
7155
7561
  return value;
7156
7562
  }
7563
+ /**
7564
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7565
+ * keychain the context's own view is already raw.
7566
+ */
7567
+ rawSettings() {
7568
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7569
+ }
7570
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7571
+ logUnresolvedRead(unresolved) {
7572
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7573
+ if (fresh.length === 0) return;
7574
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7575
+ this._ctx?.logger?.warn?.("settings read: a stored secret is unavailable — it reads as its marker, not as a value", { meta: { secrets: fresh.map((u) => ({
7576
+ ref: u.ref,
7577
+ reason: u.reason
7578
+ })) } });
7579
+ }
7157
7580
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7158
7581
  scheduleSecretReresolve(delayMs) {
7159
7582
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7180,7 +7603,7 @@ var BaseAddon = class {
7180
7603
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7181
7604
  */
7182
7605
  async readAddonStoreWithRetry() {
7183
- const settings = this._ctx?.settings;
7606
+ const settings = this.rawSettings();
7184
7607
  if (!settings) return {};
7185
7608
  const delaysMs = [
7186
7609
  150,
@@ -8992,6 +9415,16 @@ var CompositionSchema = object({
8992
9415
  seen.add(feature.cap);
8993
9416
  });
8994
9417
  });
9418
+ var NodeColorIdSchema = _enum([
9419
+ "node-a",
9420
+ "node-b",
9421
+ "node-c",
9422
+ "node-d",
9423
+ "node-e",
9424
+ "node-f",
9425
+ "node-g",
9426
+ "node-h"
9427
+ ]);
8995
9428
  new Set([
8996
9429
  "track",
8997
9430
  "face",
@@ -9503,6 +9936,278 @@ var CameraSwitchGroupSchema = object({
9503
9936
  fetchedAt: number()
9504
9937
  });
9505
9938
  /**
9939
+ * The trainer contract — what the hub hands the cloud trainer and what it
9940
+ * gets back (cloud training, D805+).
9941
+ *
9942
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
9943
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
9944
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
9945
+ * lines on stdout. These schemas are the hub's half of that boundary; the
9946
+ * trainer's pydantic models (and the JSON Schemas generated from them under
9947
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
9948
+ * change there, in the same piece of work.
9949
+ *
9950
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
9951
+ * orchestrator fills every field of a job spec explicitly.
9952
+ */
9953
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
9954
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
9955
+ /** What the trainer can export. Edge TPU is a later, separate image. */
9956
+ var TrainingExportSchema = _enum([
9957
+ "onnx",
9958
+ "openvino-fp16",
9959
+ "openvino-int8",
9960
+ "coreml-fp16"
9961
+ ]);
9962
+ var FloorsSchema = record(string(), number().min(0).max(1));
9963
+ object({
9964
+ schema: literal(TRAINING_JOB_SCHEMA),
9965
+ jobKey: string().uuid(),
9966
+ target: object({
9967
+ kind: literal("detector"),
9968
+ step: literal("object-detection")
9969
+ }),
9970
+ base: object({
9971
+ modelId: string().min(1),
9972
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
9973
+ weights: string().min(1),
9974
+ imgsz: number().int().positive()
9975
+ }),
9976
+ baseline: object({
9977
+ modelId: string().min(1),
9978
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
9979
+ onnxUrl: string().url(),
9980
+ imgsz: number().int().positive(),
9981
+ floors: FloorsSchema
9982
+ }),
9983
+ dataset: object({
9984
+ versionId: string().min(1),
9985
+ annotationHash: string(),
9986
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
9987
+ sha256: string().regex(/^[0-9a-f]{64}$/)
9988
+ }),
9989
+ split: object({
9990
+ holdoutCameras: array(number().int()),
9991
+ /** When no camera is held out: the last N days of every camera. */
9992
+ holdoutLastDays: number().int().nonnegative(),
9993
+ valFraction: number().min(0).max(.5),
9994
+ seed: number().int()
9995
+ }),
9996
+ hyper: object({
9997
+ epochs: number().int().positive(),
9998
+ batch: number().int().positive(),
9999
+ lr0: number().positive(),
10000
+ /** Layers frozen from the start of the backbone; 0 = none. */
10001
+ freeze: number().int().nonnegative(),
10002
+ patience: number().int().nonnegative(),
10003
+ seed: number().int()
10004
+ }),
10005
+ replay: object({
10006
+ source: literal("coco2017"),
10007
+ count: number().int().nonnegative()
10008
+ }),
10009
+ exports: array(TrainingExportSchema).min(1),
10010
+ calibration: object({ maxFrames: number().int().positive() }),
10011
+ floors: object({
10012
+ minSupport: number().int().positive(),
10013
+ clamp: number().min(0).max(1)
10014
+ }),
10015
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
10016
+ catalog: object({
10017
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
10018
+ name: string().min(1).max(160)
10019
+ })
10020
+ });
10021
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
10022
+ var TrainingResultFileSchema = object({
10023
+ path: string().min(1),
10024
+ bytes: number().int().nonnegative(),
10025
+ sha256: string().regex(/^[0-9a-f]{64}$/),
10026
+ format: _enum([
10027
+ "onnx",
10028
+ "openvino",
10029
+ "coreml",
10030
+ "pt"
10031
+ ]),
10032
+ variant: _enum(["base", "int8"])
10033
+ });
10034
+ var DraftFormatSchema = object({
10035
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
10036
+ url: string().min(1),
10037
+ sizeMB: number().nonnegative(),
10038
+ isDirectory: boolean().optional(),
10039
+ files: array(string()).optional(),
10040
+ runtimes: array(literal("python")).optional(),
10041
+ revision: string().min(1)
10042
+ });
10043
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
10044
+ var TrainingCatalogDraftSchema = object({
10045
+ id: string().min(1),
10046
+ name: string().min(1),
10047
+ description: string(),
10048
+ labels: array(unknown()),
10049
+ inputSize: object({
10050
+ width: number().int().positive(),
10051
+ height: number().int().positive()
10052
+ }),
10053
+ preprocessMode: literal("letterbox"),
10054
+ defaultClassFloors: FloorsSchema,
10055
+ formats: object({
10056
+ onnx: DraftFormatSchema.optional(),
10057
+ openvino: DraftFormatSchema.optional(),
10058
+ coreml: DraftFormatSchema.optional()
10059
+ })
10060
+ });
10061
+ /** One class of one model's holdout report (the eval harness's summary). */
10062
+ var TrainingEvalClassSchema = object({
10063
+ positives: number().int(),
10064
+ floor: number().nullable(),
10065
+ tp: number().int(),
10066
+ fp: number().int(),
10067
+ fn: number().int(),
10068
+ precision: number().nullable(),
10069
+ recall: number().nullable(),
10070
+ ap50: number().nullable(),
10071
+ recallByCamera: record(string(), number().nullable()).optional(),
10072
+ recallByLight: record(string(), number().nullable()).optional(),
10073
+ fpByCamera: record(string(), number()).optional(),
10074
+ smallFound: number().int().optional(),
10075
+ smallTotal: number().int().optional()
10076
+ }).passthrough();
10077
+ var TrainingEvalReportSchema = object({
10078
+ frames: number().int(),
10079
+ classes: record(string(), TrainingEvalClassSchema)
10080
+ }).passthrough();
10081
+ /**
10082
+ * A succeeded result carries every block; a failed one carries the error and
10083
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10084
+ * orchestrator checks the blocks it needs before it trusts a success.
10085
+ */
10086
+ var TrainingResultSchema = object({
10087
+ schema: literal(TRAINING_RESULT_SCHEMA),
10088
+ jobKey: string(),
10089
+ status: _enum(["succeeded", "failed"]),
10090
+ error: object({
10091
+ stage: string(),
10092
+ code: string(),
10093
+ message: string()
10094
+ }).nullable(),
10095
+ trainer: object({
10096
+ version: string(),
10097
+ revision: string()
10098
+ }),
10099
+ toolchain: record(string(), string().nullable()),
10100
+ dataset: object({
10101
+ versionId: string(),
10102
+ annotationHash: string(),
10103
+ sha256: string(),
10104
+ frames: object({
10105
+ train: number().int(),
10106
+ val: number().int(),
10107
+ holdout: number().int()
10108
+ }),
10109
+ holdoutCameras: array(number().int()),
10110
+ replayImages: number().int()
10111
+ }).optional(),
10112
+ training: object({
10113
+ epochsRun: number().int(),
10114
+ bestEpoch: number().int(),
10115
+ bestMap50: number(),
10116
+ bestMap50_95: number(),
10117
+ seconds: number()
10118
+ }).optional(),
10119
+ evaluation: object({
10120
+ holdoutFrames: number().int(),
10121
+ baseline: TrainingEvalReportSchema.nullable(),
10122
+ candidate: TrainingEvalReportSchema.nullable(),
10123
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10124
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10125
+ map50: record(string(), number().nullable())
10126
+ }).optional(),
10127
+ floors: object({
10128
+ baseline: FloorsSchema,
10129
+ candidate: FloorsSchema,
10130
+ candidateInt8: FloorsSchema.nullable(),
10131
+ notes: array(string())
10132
+ }).optional(),
10133
+ int8: object({
10134
+ kept: boolean(),
10135
+ map50Fp16: number().nullable(),
10136
+ map50Int8: number().nullable(),
10137
+ reason: string().nullable()
10138
+ }).optional(),
10139
+ exportsDropped: array(object({
10140
+ export: string(),
10141
+ reason: string()
10142
+ })).optional(),
10143
+ files: array(TrainingResultFileSchema).optional(),
10144
+ bundle: object({
10145
+ path: literal("bundle.tar"),
10146
+ bytes: number().int().nonnegative(),
10147
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10148
+ }).nullable().optional(),
10149
+ catalogDraft: object({
10150
+ base: TrainingCatalogDraftSchema,
10151
+ int8: TrainingCatalogDraftSchema.nullable()
10152
+ }).nullable().optional(),
10153
+ licence: string()
10154
+ });
10155
+ var TrainingStageSchema = _enum([
10156
+ "prepare",
10157
+ "replay",
10158
+ "train",
10159
+ "eval",
10160
+ "export",
10161
+ "package"
10162
+ ]);
10163
+ var EventBase = {
10164
+ v: literal(1),
10165
+ ts: number()
10166
+ };
10167
+ discriminatedUnion("type", [
10168
+ object({
10169
+ ...EventBase,
10170
+ type: literal("stage"),
10171
+ stage: TrainingStageSchema
10172
+ }),
10173
+ object({
10174
+ ...EventBase,
10175
+ type: literal("epoch"),
10176
+ epoch: number().int(),
10177
+ epochs: number().int(),
10178
+ boxLoss: number().nullable().optional(),
10179
+ map50: number().nullable().optional(),
10180
+ map50_95: number().nullable().optional(),
10181
+ etaSec: number().nullable().optional()
10182
+ }),
10183
+ object({
10184
+ ...EventBase,
10185
+ type: literal("metric"),
10186
+ name: string(),
10187
+ value: number()
10188
+ }),
10189
+ object({
10190
+ ...EventBase,
10191
+ type: literal("artifact"),
10192
+ path: string(),
10193
+ bytes: number(),
10194
+ sha256: string()
10195
+ }),
10196
+ object({
10197
+ ...EventBase,
10198
+ type: literal("done"),
10199
+ status: _enum(["succeeded", "failed"]),
10200
+ resultSha256: string().nullable().optional()
10201
+ }),
10202
+ object({
10203
+ ...EventBase,
10204
+ type: literal("error"),
10205
+ stage: string(),
10206
+ code: string(),
10207
+ message: string()
10208
+ })
10209
+ ]);
10210
+ /**
9506
10211
  * What the gate decided about a birth, from the CALLER's point of view.
9507
10212
  *
9508
10213
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11830,7 +12535,9 @@ var AddonHttpRouteSchema = object({
11830
12535
  "authenticated",
11831
12536
  "admin"
11832
12537
  ]).optional(),
11833
- description: string().optional()
12538
+ description: string().optional(),
12539
+ /** The hub limits this route per client address before the handler runs. */
12540
+ rateLimit: _enum(["auth"]).optional()
11834
12541
  });
11835
12542
  /**
11836
12543
  * Cross-process route invocation envelope. The hub captures the
@@ -12535,6 +13242,37 @@ var BackupDestinationInfoSchema = object({
12535
13242
  lastError: string().optional()
12536
13243
  });
12537
13244
  /**
13245
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13246
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13247
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13248
+ * with it off — which restores without a key.
13249
+ */
13250
+ var BackupArchiveEncryptionSchema = object({
13251
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13252
+ scheme: string(),
13253
+ /** 16 hex — the backup key whose secret restores this archive. */
13254
+ keyId: string()
13255
+ });
13256
+ /**
13257
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13258
+ * one new archives are encrypted to, and the retired ones older archives
13259
+ * still need. The secret key is shown once, at `setupEncryption`.
13260
+ */
13261
+ var BackupEncryptionStatusSchema = object({
13262
+ enabled: boolean(),
13263
+ active: object({
13264
+ keyId: string(),
13265
+ publicKey: string(),
13266
+ createdAt: number()
13267
+ }).nullable(),
13268
+ /** Every key ever set up, newest first. */
13269
+ keys: array(object({
13270
+ keyId: string(),
13271
+ createdAt: number(),
13272
+ retiredAt: number().nullable()
13273
+ })).readonly()
13274
+ });
13275
+ /**
12538
13276
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12539
13277
  * Same shape the destination drill-in renders. Sourced from the per-
12540
13278
  * location `manifests.json` (no per-archive tarball read required).
@@ -12546,7 +13284,9 @@ var BackupArchiveEntrySchema = object({
12546
13284
  sizeBytes: number(),
12547
13285
  label: string().optional(),
12548
13286
  /** Top-level locations included in the archive (db, addons, tls, …). */
12549
- locations: array(string()).readonly()
13287
+ locations: array(string()).readonly(),
13288
+ /** Present when the archive is encrypted; restore then needs that key. */
13289
+ encryption: BackupArchiveEncryptionSchema.optional()
12550
13290
  });
12551
13291
  var BackupEntrySchema = object({
12552
13292
  id: string(),
@@ -12555,7 +13295,8 @@ var BackupEntrySchema = object({
12555
13295
  label: string().optional(),
12556
13296
  createdAt: number(),
12557
13297
  sizeBytes: number(),
12558
- locations: array(string()).optional()
13298
+ locations: array(string()).optional(),
13299
+ encryption: BackupArchiveEncryptionSchema.optional()
12559
13300
  });
12560
13301
  var ArchiveEntrySchema = object({
12561
13302
  path: string(),
@@ -12744,10 +13485,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12744
13485
  * this list and skips entries whose path doesn't start with
12745
13486
  * any of them.
12746
13487
  */
12747
- locations: array(string()).optional()
13488
+ locations: array(string()).optional(),
13489
+ /**
13490
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13491
+ * one). The archive is decrypted into the hub's private staging
13492
+ * before the restart; the key is not stored. A wrong or missing key
13493
+ * is refused before the archive is downloaded.
13494
+ */
13495
+ backupSecretKey: string().optional()
12748
13496
  }), _void(), {
12749
13497
  kind: "mutation",
12750
13498
  auth: "admin"
13499
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13500
+ keyId: string(),
13501
+ secretKey: string(),
13502
+ publicKey: string(),
13503
+ createdAt: number(),
13504
+ replacedKeyId: string().nullable()
13505
+ }), {
13506
+ kind: "mutation",
13507
+ auth: "admin"
13508
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13509
+ kind: "mutation",
13510
+ auth: "admin"
13511
+ }), method(object({ backupSecretKey: string() }), object({
13512
+ valid: boolean(),
13513
+ keyId: string().nullable(),
13514
+ /** The hub knows this key (active or retired). */
13515
+ known: boolean(),
13516
+ /** It is the key new archives are encrypted to. */
13517
+ active: boolean(),
13518
+ error: string().optional()
13519
+ }), {
13520
+ kind: "mutation",
13521
+ auth: "admin"
12751
13522
  }), method(object({
12752
13523
  destinationId: string(),
12753
13524
  backupId: string()
@@ -14473,7 +15244,60 @@ var CustomModelDescriptorSchema = object({
14473
15244
  stepId: string(),
14474
15245
  entry: ModelCatalogEntrySchema
14475
15246
  });
14476
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15247
+ /** One regular file of an imported bundle, as the producer measured it. */
15248
+ var ModelBundleFileSchema = object({
15249
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15250
+ path: string().min(1),
15251
+ bytes: number().int().nonnegative(),
15252
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15253
+ });
15254
+ var ImportModelBundleInputSchema = object({
15255
+ /** The registry provider that keeps the model (Model Studio). */
15256
+ addonId: string(),
15257
+ stepId: string().min(1),
15258
+ /**
15259
+ * The catalog rows to register, complete, every format URL already
15260
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15261
+ * bundle may carry several rows (a base and its INT8 variant).
15262
+ */
15263
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15264
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15265
+ bundle: object({
15266
+ ticket: PeerBytesTicketSchema,
15267
+ bytes: number().int().positive(),
15268
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15269
+ }),
15270
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15271
+ files: array(ModelBundleFileSchema).min(1).max(64),
15272
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15273
+ distribute: boolean()
15274
+ });
15275
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15276
+ kind: literal("imported"),
15277
+ modelIds: array(string()).readonly(),
15278
+ distributed: array(object({
15279
+ modelId: string(),
15280
+ nodeId: string(),
15281
+ format: _enum(MODEL_FORMATS),
15282
+ ok: boolean(),
15283
+ error: string().optional()
15284
+ })).readonly()
15285
+ }), object({
15286
+ kind: literal("refused"),
15287
+ reason: _enum([
15288
+ "transfer-failed",
15289
+ "checksum-mismatch",
15290
+ "bundle-mismatch",
15291
+ "invalid-entry",
15292
+ "id-taken"
15293
+ ]),
15294
+ detail: string()
15295
+ })]);
15296
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15297
+ kind: "mutation",
15298
+ auth: "admin",
15299
+ timeoutMs: 30 * 6e4
15300
+ });
14477
15301
  /**
14478
15302
  * Query filter for settings-store collections.
14479
15303
  */
@@ -14952,6 +15776,35 @@ var KeychainKeySourceSchema = object({
14952
15776
  */
14953
15777
  sharesBackupWithDatabase: boolean()
14954
15778
  });
15779
+ /**
15780
+ * One keychain reset, as the Secrets page reports it until the operator
15781
+ * acknowledges it. Never a value: refs, counts and table names only.
15782
+ */
15783
+ var KeychainResetRecordSchema = object({
15784
+ id: string(),
15785
+ at: number(),
15786
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15787
+ actor: string(),
15788
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15789
+ lockedReason: string().nullable(),
15790
+ /** Values moved into the archive table (ciphertext under the lost key). */
15791
+ archived: number().int(),
15792
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15793
+ archivedCollection: string().nullable(),
15794
+ /**
15795
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15796
+ * so the archive can still be opened if the lost master key turns up.
15797
+ */
15798
+ archivedKeysCollection: string().nullable(),
15799
+ /**
15800
+ * `system-settings` keys whose marker the reset cleared — the cluster
15801
+ * secret's: a marker left pointing at an archived value would refuse every
15802
+ * agent forever (D797).
15803
+ */
15804
+ clearedSettingsKeys: array(string()).readonly(),
15805
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15806
+ acknowledgedAt: number().nullable()
15807
+ });
14955
15808
  var KeychainStatusSchema = object({
14956
15809
  keychain: KeychainStateSchema,
14957
15810
  /** The source of the master key in use; `null` while locked. */
@@ -14969,7 +15822,9 @@ var KeychainStatusSchema = object({
14969
15822
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
14970
15823
  retiredWraps: number().int(),
14971
15824
  recoveryKeyDownloadedAt: number().nullable(),
14972
- secretCount: number().int()
15825
+ secretCount: number().int(),
15826
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15827
+ lastReset: KeychainResetRecordSchema.nullable()
14973
15828
  });
14974
15829
  /**
14975
15830
  * Whether a stored value is still pointed at by its owner's settings.
@@ -14991,13 +15846,14 @@ var KeychainAuditActionSchema = _enum([
14991
15846
  "download-recovery-key",
14992
15847
  "delete-orphans",
14993
15848
  "reset",
15849
+ "acknowledge-reset",
14994
15850
  "initialize"
14995
15851
  ]);
14996
15852
  var KeychainAuditEntrySchema = object({
14997
15853
  id: string(),
14998
15854
  at: number(),
14999
15855
  action: KeychainAuditActionSchema,
15000
- /** `addon:<id>` | `user:<id>` | `system`. */
15856
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
15001
15857
  actor: string(),
15002
15858
  ref: string().nullable(),
15003
15859
  detail: string().nullable()
@@ -15063,6 +15919,13 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15063
15919
  kind: "mutation",
15064
15920
  auth: "admin",
15065
15921
  caller: "required"
15922
+ }), method(object({}), object({
15923
+ reset: KeychainResetRecordSchema.nullable(),
15924
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15925
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15926
+ kind: "mutation",
15927
+ auth: "admin",
15928
+ caller: "required"
15066
15929
  });
15067
15930
  method(_void(), object({
15068
15931
  id: string(),
@@ -17628,14 +18491,14 @@ var LlmProfileSchema = object({
17628
18491
  /** ConfigUISchema tree passed through untyped on the wire (the
17629
18492
  * notification-output `ConfigSchemaPassthrough` precedent at
17630
18493
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
17631
- var ConfigSchemaPassthrough$1 = unknown();
18494
+ var ConfigSchemaPassthrough$3 = unknown();
17632
18495
  var LlmProfileKindDescriptorSchema = object({
17633
18496
  kind: LlmProfileKindSchema,
17634
18497
  label: string(),
17635
18498
  icon: string(),
17636
18499
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
17637
18500
  addonId: string(),
17638
- configSchema: ConfigSchemaPassthrough$1
18501
+ configSchema: ConfigSchemaPassthrough$3
17639
18502
  });
17640
18503
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
17641
18504
  var LlmDefaultSchema = object({
@@ -17913,7 +18776,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17913
18776
  * `login-method` — collection cap through which auth addons contribute
17914
18777
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17915
18778
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17916
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18779
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17917
18780
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17918
18781
  * procedure aggregates them for the unauthenticated login page.
17919
18782
  *
@@ -17921,8 +18784,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17921
18784
  *
17922
18785
  * - `redirect` — a declarative button. The login page renders a generic
17923
18786
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17924
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17925
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18787
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17926
18788
  * login page needs NO change.
17927
18789
  *
17928
18790
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -17941,8 +18803,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17941
18803
  * decision.
17942
18804
  *
17943
18805
  * Every contribution carries a `stage`:
17944
- * - `primary` — shown on the first credentials screen (OIDC /
17945
- * magic-link buttons; a future usernameless passkey).
18806
+ * - `primary` — shown on the first credentials screen (OIDC
18807
+ * buttons; a usernameless passkey).
17946
18808
  * - `second-factor` — shown AFTER the password leg, gated on the
17947
18809
  * returned `factors` (passkey-as-2FA today).
17948
18810
  *
@@ -17969,7 +18831,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17969
18831
  * The provider names an external identity a signed-in user can link to
17970
18832
  * their own account (D782): `auth.listLinkableProviders` /
17971
18833
  * `beginExternalLink` offer exactly the redirect methods that set this,
17972
- * whatever their id. Absent / false — a login button only (magic-link).
18834
+ * whatever their id. Absent / false — a login button only.
17973
18835
  */
17974
18836
  linkable: boolean().optional()
17975
18837
  }),
@@ -18757,7 +19619,7 @@ var TargetKindCapsSchema = object({
18757
19619
  * the union is large and not meant for runtime validation here; the exported
18758
19620
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
18759
19621
  */
18760
- var ConfigSchemaPassthrough = unknown();
19622
+ var ConfigSchemaPassthrough$2 = unknown();
18761
19623
  var TargetKindSchema = object({
18762
19624
  kind: string(),
18763
19625
  label: string(),
@@ -18794,7 +19656,7 @@ var TargetKindSchema = object({
18794
19656
  * its raster path, which is the safe default for an unknown image.
18795
19657
  */
18796
19658
  iconMediaType: string().optional(),
18797
- configSchema: ConfigSchemaPassthrough,
19659
+ configSchema: ConfigSchemaPassthrough$2,
18798
19660
  /**
18799
19661
  * The config keys that decide WHERE this kind's secrets are sent (server,
18800
19662
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -21824,8 +22686,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21824
22686
  * `super_admin` — collapsed onto the single boolean because every
21825
22687
  * non-admin caller is governed by the same scope-check rules; the
21826
22688
  * distinction was only ever used to route role-specific procedures
21827
- * which we no longer have. Agents are admin sessions issued via
21828
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22689
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21829
22690
  * with `isAdmin: false` + an explicit scope list.
21830
22691
  */
21831
22692
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -22132,6 +22993,61 @@ var OauthIntegrationDescriptorSchema = object({
22132
22993
  });
22133
22994
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
22134
22995
  /**
22996
+ * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
22997
+ *
22998
+ * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
22999
+ * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
23000
+ * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
23001
+ * immutable after create.
23002
+ */
23003
+ var ConfigSchemaPassthrough$1 = unknown();
23004
+ var OidcConnectionSchema = object({
23005
+ id: string().min(1),
23006
+ displayName: string(),
23007
+ icon: string(),
23008
+ issuerUrl: string(),
23009
+ clientId: string(),
23010
+ /** Client id + secret present — never the secret value. */
23011
+ configured: boolean(),
23012
+ /**
23013
+ * Values for the connection form schema. `clientSecret` is a keychain
23014
+ * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
23015
+ */
23016
+ formValues: record(string(), unknown()).optional()
23017
+ });
23018
+ /**
23019
+ * Patch one connection. Omitted or empty `clientSecret` keeps the stored
23020
+ * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
23021
+ */
23022
+ var OidcConnectionUpdateInputSchema = object({
23023
+ id: string().min(1),
23024
+ displayName: string().min(1),
23025
+ icon: string().optional(),
23026
+ issuerUrl: string().optional(),
23027
+ clientId: string().optional(),
23028
+ clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
23029
+ redirectUri: string().optional(),
23030
+ scopes: string().optional(),
23031
+ usernameClaim: _enum([
23032
+ "preferred_username",
23033
+ "email",
23034
+ "sub"
23035
+ ]).optional()
23036
+ });
23037
+ method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
23038
+ id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
23039
+ displayName: string().min(1)
23040
+ }), object({ id: string() }), {
23041
+ kind: "mutation",
23042
+ auth: "admin"
23043
+ }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
23044
+ kind: "mutation",
23045
+ auth: "admin"
23046
+ }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
23047
+ kind: "mutation",
23048
+ auth: "admin"
23049
+ });
23050
+ /**
22135
23051
  * What started a camera's onboard motion (D672). `camera` is the camera's own
22136
23052
  * firmware; `sensor` is a device the operator ATTACHED to it. Absent on the
22137
23053
  * wire means the camera: only the camera-sensors bridge ever says `sensor`.
@@ -23488,24 +24404,69 @@ var RetrainFrameListSchema = object({
23488
24404
  /** What the page pre-selects — the native key frame when one survives. */
23489
24405
  autoPickMediaId: number().int().optional()
23490
24406
  });
24407
+ /** Exclusive partition of a corpus copy's annotation progress (design §4.2). */
24408
+ var RetrainFrameWorkStateSchema = _enum([
24409
+ "unannotated",
24410
+ "annotated",
24411
+ "complete"
24412
+ ]);
24413
+ /**
24414
+ * Filters for paginated corpus list, KPI, and matching export (design §4.4).
24415
+ * Every narrowing field is ANDed; omitted fields impose no constraint.
24416
+ */
24417
+ var RetrainCorpusFilterSchema = object({
24418
+ workState: RetrainFrameWorkStateSchema.optional(),
24419
+ deviceIds: array(number()).max(500).optional(),
24420
+ /** When set, only frames in this named collection. */
24421
+ collectionId: string().optional(),
24422
+ /** Frames that carry at least one saved annotation in one of these classes. */
24423
+ classes: array(RetrainMacroClassSchema).optional(),
24424
+ page: number().int().positive().default(1),
24425
+ pageSize: number().int().positive().max(100).default(50)
24426
+ });
24427
+ var RetrainCorpusPageSchema = object({
24428
+ frames: array(RetrainFrameSchema.extend({ workState: RetrainFrameWorkStateSchema })).readonly(),
24429
+ total: number().int().nonnegative(),
24430
+ page: number().int().positive(),
24431
+ pageSize: number().int().positive()
24432
+ });
24433
+ var RetrainCorpusKpiCameraRowSchema = object({
24434
+ deviceId: number(),
24435
+ unannotated: number().int().nonnegative(),
24436
+ annotated: number().int().nonnegative(),
24437
+ complete: number().int().nonnegative(),
24438
+ /** This camera's `complete` count divided by corpus `total`, in `[0,1]`.
24439
+ * `null` when the corpus is empty (no ratio). */
24440
+ pctOfCorpus: number().min(0).max(1).nullable()
24441
+ });
24442
+ var RetrainCorpusKpiSchema = object({
24443
+ total: number().int().nonnegative(),
24444
+ unannotated: number().int().nonnegative(),
24445
+ annotated: number().int().nonnegative(),
24446
+ complete: number().int().nonnegative(),
24447
+ cameras: array(RetrainCorpusKpiCameraRowSchema).readonly()
24448
+ });
23491
24449
  /**
23492
24450
  * Which frames an annotated export carries. Every field narrows; an empty
23493
- * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23494
- * list owned by whoever trains (the training orchestrator), so `frameIds` is
23495
- * the primitive a version export uses; `batchId` re-selects what an earlier
23496
- * export carried (`exportedInBatch`).
24451
+ * filter is every annotated copy. `frameIds` is the primitive a job or
24452
+ * download uses; `batchId` re-selects what an earlier export carried
24453
+ * (`exportedInBatch`). Frozen dataset versions were removed — live selection
24454
+ * resolves to `frameIds` at plan/start.
23497
24455
  */
23498
24456
  var RetrainExportFilterSchema = object({
23499
24457
  deviceIds: array(number()).optional(),
23500
24458
  frameIds: array(string()).max(2e4).optional(),
23501
24459
  /** Only frames in at least one of these named collections. */
23502
24460
  collectionIds: array(string()).max(200).optional(),
23503
- /** Exactly the frames of this dataset version (and its completeOnly). An
23504
- * unknown id selects nothing. */
23505
- datasetVersionId: string().optional(),
24461
+ /** Single collection (Frames filter bar). ANDed with `collectionIds` when both set. */
24462
+ collectionId: string().optional(),
23506
24463
  batchId: string().optional(),
23507
24464
  /** Only frames the operator marked complete (all subjects boxed). */
23508
- completeOnly: boolean().optional()
24465
+ completeOnly: boolean().optional(),
24466
+ /** Exclusive work-state partition (`workStateOf`); same as the corpus list. */
24467
+ workState: RetrainFrameWorkStateSchema.optional(),
24468
+ /** Frames with at least one saved annotation in one of these classes. */
24469
+ classes: array(RetrainMacroClassSchema).optional()
23509
24470
  });
23510
24471
  /**
23511
24472
  * `frames`: the full frame copies, boxes in `annotations.json`.
@@ -23705,8 +24666,7 @@ var RetrainDatasetStatsSchema = object({
23705
24666
  completeFrames: number().int()
23706
24667
  })).readonly()
23707
24668
  });
23708
- /** An immutable dataset version, without its frame list. */
23709
- var RetrainDatasetVersionSchema = object({
24669
+ object({
23710
24670
  id: string(),
23711
24671
  name: string(),
23712
24672
  createdAt: number(),
@@ -23714,22 +24674,33 @@ var RetrainDatasetVersionSchema = object({
23714
24674
  layout: RetrainExportLayoutSchema,
23715
24675
  completeOnly: boolean(),
23716
24676
  frameCount: number().int(),
23717
- /** sha256 of what the frames taught when the version was frozen. */
23718
24677
  annotationHash: string(),
23719
- /** The export manifest schema the version was cut under. */
23720
24678
  manifestSchema: string(),
23721
24679
  stats: RetrainDatasetStatsSchema
23722
24680
  });
23723
- var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
23724
- kind: literal("created"),
23725
- version: RetrainDatasetVersionSchema
24681
+ /**
24682
+ * Live training corpus criteria — same shape as `TrainingCorpusSelection` on
24683
+ * the training cap. Resolved here so plan/start and the annotated export share
24684
+ * one definition of "the frames" (`buildRetrainExportPlan`).
24685
+ */
24686
+ var RetrainTrainingCorpusSelectionSchema = object({
24687
+ collectionIds: array(string()).min(1),
24688
+ workState: _enum([
24689
+ "complete",
24690
+ "annotated_or_complete",
24691
+ "any_annotated"
24692
+ ]).default("complete")
24693
+ });
24694
+ var RetrainTrainingCorpusResolveResultSchema = discriminatedUnion("kind", [object({
24695
+ kind: literal("resolved"),
24696
+ frameIds: array(string()).max(2e4).readonly(),
24697
+ stats: RetrainDatasetStatsSchema,
24698
+ annotationHash: string(),
24699
+ layout: RetrainExportLayoutSchema
23726
24700
  }), object({
23727
24701
  kind: literal("refused"),
23728
- reason: _enum([
23729
- "empty-name",
23730
- "duplicate-name",
23731
- "no-frames"
23732
- ])
24702
+ reason: _enum(["unknown-collection", "no-frames"]),
24703
+ detail: string()
23733
24704
  })]);
23734
24705
  /** The outcome of a lifecycle move owned by the retrain page. */
23735
24706
  var RetrainTransitionResultSchema = object({
@@ -24436,6 +25407,12 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24436
25407
  }), array(RetrainTrackSchema).readonly(), {
24437
25408
  kind: "query",
24438
25409
  auth: "admin"
25410
+ }), method(RetrainCorpusFilterSchema, RetrainCorpusPageSchema, {
25411
+ kind: "query",
25412
+ auth: "admin"
25413
+ }), method(object({}), RetrainCorpusKpiSchema, {
25414
+ kind: "query",
25415
+ auth: "admin"
24439
25416
  }), method(object({ trackId: string() }), RetrainFrameListSchema, {
24440
25417
  kind: "query",
24441
25418
  auth: "admin"
@@ -24521,33 +25498,14 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24521
25498
  auth: "admin",
24522
25499
  timeoutMs: 60 * 6e4
24523
25500
  }), method(object({
24524
- selection: RetrainDatasetSelectionSchema,
24525
- completeOnly: boolean().optional()
24526
- }), RetrainDatasetStatsSchema, {
24527
- kind: "query",
24528
- auth: "admin"
24529
- }), method(object({
24530
- name: string().max(120),
24531
- selection: RetrainDatasetSelectionSchema,
24532
- layout: RetrainExportLayoutSchema,
24533
- completeOnly: boolean()
24534
- }), CreateRetrainDatasetVersionResultSchema, {
24535
- kind: "mutation",
24536
- auth: "admin",
24537
- timeoutMs: 12e4
24538
- }), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
24539
- kind: "query",
24540
- auth: "admin"
24541
- }), method(object({ id: string() }), object({ deleted: boolean() }), {
24542
- kind: "mutation",
24543
- auth: "admin"
24544
- }), method(object({ id: string() }), object({
24545
- found: boolean(),
24546
- annotationHash: string(),
24547
- matches: boolean(),
24548
- missingFrames: number().int()
25501
+ filter: RetrainExportFilterSchema,
25502
+ layout: RetrainExportLayoutSchema
25503
+ }), object({
25504
+ ticket: PeerBytesTicketSchema,
25505
+ frames: number().int(),
25506
+ annotations: number().int()
24549
25507
  }), {
24550
- kind: "query",
25508
+ kind: "mutation",
24551
25509
  auth: "admin",
24552
25510
  timeoutMs: 12e4
24553
25511
  }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
@@ -24576,6 +25534,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24576
25534
  }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24577
25535
  kind: "query",
24578
25536
  auth: "admin"
25537
+ }), method(RetrainTrainingCorpusSelectionSchema, RetrainTrainingCorpusResolveResultSchema, {
25538
+ kind: "query",
25539
+ auth: "admin",
25540
+ timeoutMs: 6e4
24579
25541
  }), method(object({
24580
25542
  id: string(),
24581
25543
  name: string().max(120)
@@ -25192,11 +26154,14 @@ var HardwareClassIdSchema = _enum([
25192
26154
  "intel-n-series",
25193
26155
  "apple-m-base",
25194
26156
  "apple-m-pro",
26157
+ "amd-phoenix",
25195
26158
  "unknown"
25196
26159
  ]);
25197
26160
  var AcceleratorKindSchema = _enum([
25198
26161
  "intel-npu",
25199
26162
  "intel-igpu",
26163
+ "amd-igpu",
26164
+ "amd-npu",
25200
26165
  "x86-cpu",
25201
26166
  "arm-cpu",
25202
26167
  "apple-ane",
@@ -27126,6 +28091,8 @@ var AgentPipelineSettingsSchema = object({
27126
28091
  * address is wrong (multi-homed host, NAT, custom interface).
27127
28092
  */
27128
28093
  reachableHost: string().optional(),
28094
+ /** Hub-persisted UI colour (`--color-node-*` theme tokens). */
28095
+ color: NodeColorIdSchema.optional(),
27129
28096
  /**
27130
28097
  * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
27131
28098
  * weight, steps}. Absent / all-disabled ⇒ the node's single default
@@ -27675,8 +28642,9 @@ method(object({
27675
28642
  auth: "admin"
27676
28643
  }), method(object({
27677
28644
  agentNodeId: string(),
27678
- reachableHost: string().nullable()
27679
- }), object({ success: literal(true) }), {
28645
+ reachableHost: string().nullable().optional(),
28646
+ color: NodeColorIdSchema.nullable().optional()
28647
+ }).refine((v) => v.reachableHost !== void 0 || v.color !== void 0, { message: "reachableHost or color required" }), object({ success: literal(true) }), {
27680
28648
  kind: "mutation",
27681
28649
  auth: "admin"
27682
28650
  }), method(object({
@@ -28128,8 +29096,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
28128
29096
  * `smtp-provider` — pluggable email delivery surface.
28129
29097
  *
28130
29098
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
28131
- * one for transactional / one for notifications). Consumers (magic-link,
28132
- * notifier addons, …) walk the collection and pick the first
29099
+ * one for transactional / one for notifications). Consumers (notifier
29100
+ * addons, …) walk the collection and pick the first
28133
29101
  * ready provider OR target a specific addonId.
28134
29102
  *
28135
29103
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -28412,7 +29380,7 @@ targets: array(object({
28412
29380
  };
28413
29381
  /**
28414
29382
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
28415
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
29383
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
28416
29384
  * carrying the post-callback claims before redirecting back to
28417
29385
  * `/api/auth/sso/finish`.
28418
29386
  *
@@ -28475,7 +29443,14 @@ var SsoBridgeClaimsSchema = object({
28475
29443
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28476
29444
  * subject is unique only per issuer, so a link is bound to it.
28477
29445
  */
28478
- issuer: string().optional()
29446
+ issuer: string().optional(),
29447
+ /**
29448
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
29449
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
29450
+ * request to present the matching cookie — a login bridge is useless in
29451
+ * any other browser.
29452
+ */
29453
+ browserBinding: string().optional()
28479
29454
  });
28480
29455
  method(object({
28481
29456
  claims: SsoBridgeClaimsSchema,
@@ -30849,7 +31824,7 @@ var CustomActionInputSchema = object({
30849
31824
  action: string().min(1),
30850
31825
  input: unknown()
30851
31826
  });
30852
- method(_void(), array(AddonListItemSchema).readonly()), method(object({
31827
+ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSchema).readonly()), method(object({
30853
31828
  addonId: string(),
30854
31829
  limit: number().min(1).max(500).default(100),
30855
31830
  level: LogLevelSchema$2.optional()
@@ -35919,7 +36894,13 @@ var TopologyNodeSchema = object({
35919
36894
  })).readonly(),
35920
36895
  processes: array(TopologyProcessSchema).readonly(),
35921
36896
  categories: array(TopologyCategorySchema).readonly(),
35922
- rootPackage: TopologyRootPackageSchema.nullable()
36897
+ rootPackage: TopologyRootPackageSchema.nullable(),
36898
+ /**
36899
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
36900
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
36901
+ * for offline rows and when the hub cannot tell.
36902
+ */
36903
+ meshTransport: _enum(["tls", "clear"]).optional()
35923
36904
  });
35924
36905
  var CapUsageEdgeSchema = object({
35925
36906
  callerAddonId: string(),
@@ -36332,6 +37313,7 @@ var OsdNamedTemplateSchema = object({
36332
37313
  });
36333
37314
  /** Where a slot's value comes from. */
36334
37315
  var OsdSourceSchema = discriminatedUnion("kind", [
37316
+ object({ kind: literal("none") }),
36335
37317
  object({
36336
37318
  kind: literal("static"),
36337
37319
  text: string().max(64)
@@ -36458,6 +37440,13 @@ method(object({ deviceId: number().int() }), object({
36458
37440
  }), object({ success: literal(true) }), {
36459
37441
  kind: "mutation",
36460
37442
  auth: "admin"
37443
+ }), method(object({
37444
+ deviceId: number().int(),
37445
+ slotId: string().min(1),
37446
+ enabled: boolean()
37447
+ }), object({ success: literal(true) }), {
37448
+ kind: "mutation",
37449
+ auth: "admin"
36461
37450
  }), method(object({
36462
37451
  sourceDeviceId: number().int(),
36463
37452
  targetDeviceId: number().int()
@@ -36889,7 +37878,15 @@ var GpuInfoSchema = object({
36889
37878
  name: string(),
36890
37879
  memoryMB: number().optional()
36891
37880
  });
36892
- var NpuInfoSchema = object({ type: _enum(["apple-ane", "intel-npu"]) });
37881
+ var NpuInfoSchema = object({
37882
+ type: _enum([
37883
+ "apple-ane",
37884
+ "intel-npu",
37885
+ "amd-xdna"
37886
+ ]),
37887
+ name: string().optional(),
37888
+ generation: _enum(["xdna1", "xdna2"]).optional()
37889
+ });
36893
37890
  var CoralInfoSchema = object({
36894
37891
  type: literal("coral-edgetpu"),
36895
37892
  bus: string().optional()
@@ -40742,16 +41739,6 @@ var ApiKeySummarySchema = object({
40742
41739
  createdAt: number(),
40743
41740
  lastUsedAt: number().optional()
40744
41741
  });
40745
- var CreateApiKeyInputSchema = object({
40746
- label: string(),
40747
- isAdmin: boolean().default(false),
40748
- allowedProviders: union([array(string()), literal("*")]).optional(),
40749
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
40750
- });
40751
- var CreateApiKeyResultSchema = object({
40752
- token: string(),
40753
- record: ApiKeySummarySchema
40754
- });
40755
41742
  var ScopedTokenSummarySchema = object({
40756
41743
  id: string(),
40757
41744
  userId: string(),
@@ -40850,17 +41837,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40850
41837
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
40851
41838
  kind: "mutation",
40852
41839
  access: "view"
40853
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
40854
- kind: "mutation",
40855
- auth: "admin",
40856
- access: "create"
40857
- }), method(object({ id: string() }), object({ success: literal(true) }), {
41840
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
40858
41841
  kind: "mutation",
40859
41842
  auth: "admin",
40860
41843
  access: "delete"
40861
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
40862
- kind: "mutation",
40863
- access: "view"
40864
41844
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
40865
41845
  kind: "mutation",
40866
41846
  auth: "admin",
@@ -40934,15 +41914,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40934
41914
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
40935
41915
  userId: string(),
40936
41916
  issuer: string()
40937
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
40938
- userId: string(),
40939
- issuer: string().min(1),
40940
- label: string().optional()
40941
- }), object({ success: literal(true) }), {
40942
- kind: "mutation",
40943
- auth: "admin",
40944
- access: "create"
40945
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41917
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
40946
41918
  kind: "mutation",
40947
41919
  auth: "admin",
40948
41920
  access: "delete"
@@ -41647,6 +42619,563 @@ var zoneRulesCapability = {
41647
42619
  */
41648
42620
  durability: "restored"
41649
42621
  };
42622
+ /**
42623
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
42624
+ *
42625
+ * A thin, mockable translation layer: it knows how to run a container with a
42626
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
42627
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
42628
+ * those are the `training` orchestrator's (D805). Every rule written there
42629
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
42630
+ * manifest entry and nothing else.
42631
+ *
42632
+ * Collection of provider **types** (addons). Each addon owns zero or more
42633
+ * **entries** (credentials + defaults). Concat-fans: `describe`,
42634
+ * `describeTypes`, `listEntries`, `listJobs`. Single-row work is keyed by
42635
+ * `entryId`; callers also pass the owning `addonId` as the collection
42636
+ * selector (broker posture). Every method is `admin`: these spend money.
42637
+ *
42638
+ * Every cloud object a provider creates is tagged with the orchestrator's
42639
+ * `jobKey`, so a retried submit finds the job it already started instead of
42640
+ * starting a second GPU, and `listJobs` can find orphans.
42641
+ *
42642
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
42643
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
42644
+ * ticket the provider mints (D613).
42645
+ */
42646
+ var TrainingGpuOptionSchema = object({
42647
+ id: string(),
42648
+ label: string(),
42649
+ /** List price, USD per GPU-hour, before any region multiplier. */
42650
+ usdPerHour: number().nonnegative(),
42651
+ vramGb: number().nonnegative()
42652
+ });
42653
+ var TrainingRegionOptionSchema = object({
42654
+ /** `''` = any region (the provider's choice). */
42655
+ id: string(),
42656
+ label: string(),
42657
+ priceMultiplier: number().positive()
42658
+ });
42659
+ /**
42660
+ * The provider's per-entry settings, as the orchestrator reads them. They
42661
+ * live on the PROVIDER addon's entry (operator decision 2026-10-08: they
42662
+ * depend on the user's account), never hard-coded in the orchestrator.
42663
+ */
42664
+ var TrainingProviderDefaultsSchema = object({
42665
+ gpuType: string(),
42666
+ region: string(),
42667
+ costCapUsd: number().nonnegative(),
42668
+ maxRuntimeSec: number().int().positive(),
42669
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
42670
+ failedDatasetGraceHours: number().nonnegative()
42671
+ });
42672
+ /**
42673
+ * Entry form schema for a provider type — same seam as notification
42674
+ * `TargetKind.configSchema` (`z.unknown()` at the wire; callers tighten to
42675
+ * {@link ConfigUISchema}). Drives `ConfigFormBuilder` on Training → Providers.
42676
+ */
42677
+ var ConfigSchemaPassthrough = unknown();
42678
+ /** One creatable provider type, for the Add-entry dialog. */
42679
+ var TrainingProviderTypeSchema = object({
42680
+ typeId: string(),
42681
+ label: string(),
42682
+ /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
42683
+ iconAsset: string(),
42684
+ /** Owning `training-provider` addon — collection selector for createEntry. */
42685
+ addonId: string(),
42686
+ /**
42687
+ * Fields for one entry of this type (credentials + defaults). Absent on a
42688
+ * type that only needs a name. Password fields are keychain-backed on the
42689
+ * provider addon (`secretStatePaths`), not D634 plaintext.
42690
+ */
42691
+ configSchema: ConfigSchemaPassthrough.optional()
42692
+ });
42693
+ /** One configured account / workspace under a provider type. */
42694
+ var TrainingProviderEntrySchema = object({
42695
+ entryId: string(),
42696
+ typeId: string(),
42697
+ name: string(),
42698
+ addonId: string(),
42699
+ /** Credentials are present — never the values. */
42700
+ configured: boolean()
42701
+ });
42702
+ var TrainingProviderDescriptorSchema = object({
42703
+ addonId: string(),
42704
+ entryId: string(),
42705
+ typeId: string(),
42706
+ /** Operator-chosen entry name. */
42707
+ name: string(),
42708
+ iconAsset: string(),
42709
+ /** `modal`, `runpod`, `fake`, … — same as typeId for current providers. */
42710
+ kind: string(),
42711
+ label: string(),
42712
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
42713
+ regions: array(TrainingRegionOptionSchema).readonly(),
42714
+ maxDatasetBytes: number().int().positive(),
42715
+ maxRuntimeSec: number().int().positive(),
42716
+ freeTierNote: string().optional(),
42717
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
42718
+ dataResidencyNote: string(),
42719
+ /** Credentials are present — never the values. */
42720
+ configured: boolean(),
42721
+ defaults: TrainingProviderDefaultsSchema,
42722
+ /**
42723
+ * Values for {@link TrainingProviderTypeSchema}'s `configSchema` — password
42724
+ * fields are keychain {@link SecretFieldView} or `null` / `''` (create),
42725
+ * never plaintext. Same hydrate contract as settings forms (D789).
42726
+ */
42727
+ formValues: record(string(), unknown()).optional()
42728
+ });
42729
+ /**
42730
+ * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
42731
+ * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
42732
+ * `{ $secretClear: true }` clears it.
42733
+ */
42734
+ var TrainingProviderUpdateEntryInputSchema = object({
42735
+ entryId: string().min(1),
42736
+ name: string().min(1),
42737
+ tokenId: string().optional(),
42738
+ tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
42739
+ environment: string().optional(),
42740
+ gpuType: string().optional(),
42741
+ region: string().optional(),
42742
+ costCapUsd: number().nonnegative().optional(),
42743
+ maxRuntimeSec: number().int().positive().optional(),
42744
+ failedDatasetGraceHours: number().nonnegative().optional()
42745
+ });
42746
+ var TrainingCredentialCheckSchema = object({
42747
+ ok: boolean(),
42748
+ /** Workspace / account name, when the provider says. */
42749
+ account: string().optional(),
42750
+ reason: _enum([
42751
+ "missing",
42752
+ "invalid",
42753
+ "forbidden",
42754
+ "network",
42755
+ "quota"
42756
+ ]).optional(),
42757
+ detail: string().optional()
42758
+ });
42759
+ var ProviderJobStateSchema = _enum([
42760
+ "pending",
42761
+ "starting",
42762
+ "running",
42763
+ "succeeded",
42764
+ "failed",
42765
+ "cancelled",
42766
+ "lost"
42767
+ ]);
42768
+ var ProviderJobStatusSchema = object({
42769
+ jobKey: string(),
42770
+ providerJobId: string().optional(),
42771
+ state: ProviderJobStateSchema,
42772
+ startedAt: number().optional(),
42773
+ endedAt: number().optional(),
42774
+ exitCode: number().int().optional(),
42775
+ failureReason: string().optional(),
42776
+ gpuType: string(),
42777
+ region: string().optional(),
42778
+ billedSeconds: number().nonnegative(),
42779
+ costUsd: number().nonnegative(),
42780
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
42781
+ costIsEstimate: boolean(),
42782
+ lastFetchedAt: number()
42783
+ });
42784
+ /**
42785
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
42786
+ * image its own way (Modal builds the published Dockerfile at that revision;
42787
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
42788
+ * in `result.json`.
42789
+ */
42790
+ var TrainerSourceRefSchema = object({
42791
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
42792
+ repo: string().min(1),
42793
+ /** A commit sha (never a branch) — the job must be reproducible. */
42794
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
42795
+ });
42796
+ /** Cloud job identity — route with the owning addon's `addonId` selector. */
42797
+ var JobRef = {
42798
+ entryId: string().min(1),
42799
+ jobKey: string().uuid()
42800
+ };
42801
+ var TrainingLogLineSchema = object({
42802
+ ts: number(),
42803
+ text: string()
42804
+ });
42805
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
42806
+ typeId: string().min(1),
42807
+ name: string().min(1)
42808
+ }), object({ entryId: string() }), {
42809
+ kind: "mutation",
42810
+ auth: "admin"
42811
+ }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
42812
+ kind: "mutation",
42813
+ auth: "admin"
42814
+ }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
42815
+ kind: "mutation",
42816
+ auth: "admin"
42817
+ }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
42818
+ kind: "mutation",
42819
+ auth: "admin",
42820
+ timeoutMs: 3e4
42821
+ }), method(object({
42822
+ entryId: string().min(1),
42823
+ gpuType: string(),
42824
+ region: string(),
42825
+ datasetBytes: number().int().nonnegative(),
42826
+ gpuSecondsLow: number().nonnegative(),
42827
+ gpuSecondsHigh: number().nonnegative()
42828
+ }), object({
42829
+ usdLow: number().nonnegative(),
42830
+ usdHigh: number().nonnegative(),
42831
+ notes: array(string()).readonly()
42832
+ }), { auth: "admin" }), method(object({
42833
+ ...JobRef,
42834
+ ticket: PeerBytesTicketSchema
42835
+ }), object({
42836
+ bytes: number().int().nonnegative(),
42837
+ sha256: string()
42838
+ }), {
42839
+ kind: "mutation",
42840
+ auth: "admin",
42841
+ timeoutMs: 120 * 6e4
42842
+ }), method(object({
42843
+ ...JobRef,
42844
+ trainer: TrainerSourceRefSchema,
42845
+ jobSpecJson: string().min(2).max(64e3),
42846
+ gpuType: string(),
42847
+ region: string(),
42848
+ maxRuntimeSec: number().int().positive()
42849
+ }), ProviderJobStatusSchema, {
42850
+ kind: "mutation",
42851
+ auth: "admin",
42852
+ timeoutMs: 30 * 6e4
42853
+ }), method(object(JobRef), ProviderJobStatusSchema, {
42854
+ auth: "admin",
42855
+ timeoutMs: 6e4
42856
+ }), method(object({
42857
+ ...JobRef,
42858
+ cursor: string().optional(),
42859
+ max: number().int().min(1).max(500)
42860
+ }), object({
42861
+ lines: array(TrainingLogLineSchema).readonly(),
42862
+ cursor: string()
42863
+ }), {
42864
+ auth: "admin",
42865
+ timeoutMs: 6e4
42866
+ }), method(object(JobRef), object({ ok: literal(true) }), {
42867
+ kind: "mutation",
42868
+ auth: "admin",
42869
+ timeoutMs: 6e4
42870
+ }), method(object(JobRef), object({
42871
+ found: boolean(),
42872
+ text: string().optional()
42873
+ }), {
42874
+ kind: "mutation",
42875
+ auth: "admin",
42876
+ timeoutMs: 5 * 6e4
42877
+ }), method(object({
42878
+ ...JobRef,
42879
+ path: _enum(["bundle.tar"])
42880
+ }), object({ ticket: PeerBytesTicketSchema }), {
42881
+ kind: "mutation",
42882
+ auth: "admin",
42883
+ timeoutMs: 5 * 6e4
42884
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
42885
+ kind: "mutation",
42886
+ auth: "admin",
42887
+ timeoutMs: 5 * 6e4
42888
+ }), method(object({ entryId: string().min(1).optional() }), array(ProviderJobStatusSchema).readonly(), {
42889
+ auth: "admin",
42890
+ timeoutMs: 2 * 6e4
42891
+ });
42892
+ /**
42893
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
42894
+ * provided by `addon-training`.
42895
+ *
42896
+ * It owns what every provider must agree on, written once:
42897
+ *
42898
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
42899
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
42900
+ * - **The return flow.** Verified artefacts → Model Studio
42901
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
42902
+ * rollback. Nothing is ever registered automatically.
42903
+ *
42904
+ * Plan/start takes a live {@link TrainingCorpusSelection} (collections +
42905
+ * work-state rule); frame ids are resolved via pipeline-analytics at that
42906
+ * moment and snapshotted on the job. No frozen dataset version.
42907
+ *
42908
+ * Every method is `admin`.
42909
+ */
42910
+ /**
42911
+ * Live corpus criteria for plan/start (design §5.2). Default is complete-only.
42912
+ * Frame ids are resolved at plan/start — never a frozen version id.
42913
+ */
42914
+ var TrainingCorpusSelectionSchema = object({
42915
+ collectionIds: array(string()).min(1),
42916
+ /** Default complete-only for v1 */
42917
+ workState: _enum([
42918
+ "complete",
42919
+ "annotated_or_complete",
42920
+ "any_annotated"
42921
+ ]).default("complete")
42922
+ });
42923
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
42924
+ var TrainingBaseModelSchema = object({
42925
+ modelId: string(),
42926
+ label: string(),
42927
+ weights: string(),
42928
+ imgsz: number().int(),
42929
+ baselineOnnxUrl: string(),
42930
+ baselineFloors: record(string(), number()),
42931
+ /** The base the fleet runs most — the UI's default. */
42932
+ recommended: boolean()
42933
+ });
42934
+ var TrainingPresetSchema = _enum([
42935
+ "quick",
42936
+ "standard",
42937
+ "thorough"
42938
+ ]);
42939
+ var TrainingJobRequestSchema = object({
42940
+ /** Live collection + work-state criteria; resolved at plan/start. */
42941
+ selection: TrainingCorpusSelectionSchema,
42942
+ /**
42943
+ * The provider **entry** that runs it (credentials + defaults).
42944
+ * Resolve to an owning addon via `training-provider.describe` / `listEntries`.
42945
+ */
42946
+ entryId: string().min(1),
42947
+ gpuType: string().min(1),
42948
+ region: string(),
42949
+ baseModelId: string().min(1),
42950
+ preset: TrainingPresetSchema,
42951
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
42952
+ freeze: number().int().nonnegative().nullable(),
42953
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
42954
+ holdoutCameras: array(number().int()).nullable()
42955
+ });
42956
+ var TrainingSplitPlanSchema = object({
42957
+ holdoutCameras: array(number().int()).readonly(),
42958
+ /** Used when no camera is held out: the last N days of every camera. */
42959
+ holdoutLastDays: number().int().nonnegative(),
42960
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
42961
+ holdoutSupport: record(string(), number().int()).nullable(),
42962
+ trainSubjects: number().int()
42963
+ });
42964
+ var TrainingRefusalReasonSchema = _enum([
42965
+ "unknown-dataset",
42966
+ "unknown-provider",
42967
+ "provider-not-configured",
42968
+ "unknown-base-model",
42969
+ "unknown-gpu",
42970
+ "dataset-too-large",
42971
+ "no-training-subjects",
42972
+ "job-already-running"
42973
+ ]);
42974
+ var TrainingJobPlanSchema = object({
42975
+ refusal: object({
42976
+ reason: TrainingRefusalReasonSchema,
42977
+ detail: string()
42978
+ }).nullable(),
42979
+ warnings: array(string()).readonly(),
42980
+ split: TrainingSplitPlanSchema.nullable(),
42981
+ estimate: object({
42982
+ datasetBytes: number().int(),
42983
+ uploadMinutesAt20Mbps: number(),
42984
+ gpuSecondsLow: number(),
42985
+ gpuSecondsHigh: number(),
42986
+ usdLow: number(),
42987
+ usdHigh: number(),
42988
+ notes: array(string()).readonly()
42989
+ }).nullable(),
42990
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
42991
+ defaults: object({
42992
+ maxCostUsd: number(),
42993
+ maxRuntimeSec: number().int()
42994
+ }).nullable(),
42995
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
42996
+ dataNotice: string()
42997
+ });
42998
+ /**
42999
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
43000
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
43001
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
43002
+ * result lives after the operator acted on it.
43003
+ */
43004
+ var TrainingJobStateSchema = _enum([
43005
+ "queued",
43006
+ "uploading",
43007
+ "submitted",
43008
+ "starting",
43009
+ "running",
43010
+ "collecting",
43011
+ "ready",
43012
+ "registered",
43013
+ "canary",
43014
+ "failed",
43015
+ "cancelling",
43016
+ "cancelled",
43017
+ "lost",
43018
+ "expired",
43019
+ "discarded"
43020
+ ]);
43021
+ var TrainingFailureReasonSchema = _enum([
43022
+ "cost-cap",
43023
+ "runtime-cap",
43024
+ "upload-failed",
43025
+ "submit-failed",
43026
+ "trainer-failed",
43027
+ "result-invalid",
43028
+ "checksum-mismatch",
43029
+ "fetch-failed",
43030
+ "provider-error",
43031
+ "hub-restart-during-upload"
43032
+ ]);
43033
+ var TrainingProgressPointSchema = object({
43034
+ epoch: number().int(),
43035
+ map50: number().nullable(),
43036
+ map50_95: number().nullable()
43037
+ });
43038
+ var TrainingCanarySchema = object({
43039
+ deviceIds: array(number().int()).readonly(),
43040
+ since: number(),
43041
+ /** Every override the canary replaced, exactly, so rollback restores it. */
43042
+ previous: array(object({
43043
+ deviceId: number().int(),
43044
+ nodeId: string(),
43045
+ deviceKey: string(),
43046
+ patch: object({
43047
+ modelId: string().optional(),
43048
+ settings: record(string(), unknown()).readonly().optional()
43049
+ }).nullable()
43050
+ })).readonly()
43051
+ });
43052
+ var TrainingJobSchema = object({
43053
+ id: string(),
43054
+ idempotencyKey: string(),
43055
+ name: string(),
43056
+ createdAt: number(),
43057
+ updatedAt: number(),
43058
+ state: TrainingJobStateSchema,
43059
+ /**
43060
+ * Shared by every job enqueued together via `startJobBatch`.
43061
+ * `null` for a lone `startJob`. The engine advances queued siblings by this id.
43062
+ */
43063
+ batchId: string().nullable().default(null),
43064
+ stage: TrainingStageSchema.nullable(),
43065
+ failure: object({
43066
+ reason: TrainingFailureReasonSchema,
43067
+ stage: string().nullable(),
43068
+ detail: string()
43069
+ }).nullable(),
43070
+ request: TrainingJobRequestSchema,
43071
+ maxCostUsd: number().nonnegative(),
43072
+ maxRuntimeSec: number().int().positive(),
43073
+ trainer: TrainerSourceRefSchema,
43074
+ datasetLayout: RetrainExportLayoutSchema,
43075
+ /** Frame count snapshotted when the job started (audit; equals `frameIds.length`). */
43076
+ frameCount: number().int().nonnegative(),
43077
+ /** Resolved frame ids at start — the archive ships exactly these. */
43078
+ frameIds: array(string()).max(2e4).readonly(),
43079
+ /** Hash of what those frames taught at start (trainer `dataset.annotationHash`). */
43080
+ annotationHash: string(),
43081
+ dataset: object({
43082
+ bytes: number().int(),
43083
+ sha256: string(),
43084
+ uploadedAt: number()
43085
+ }).nullable(),
43086
+ split: TrainingSplitPlanSchema,
43087
+ provider: object({
43088
+ state: ProviderJobStateSchema.nullable(),
43089
+ providerJobId: string().nullable(),
43090
+ startedAt: number().nullable(),
43091
+ endedAt: number().nullable(),
43092
+ billedSeconds: number(),
43093
+ costUsd: number(),
43094
+ costIsEstimate: boolean(),
43095
+ lastPolledAt: number().nullable()
43096
+ }),
43097
+ progress: object({
43098
+ epoch: number().int().nullable(),
43099
+ epochs: number().int().nullable(),
43100
+ etaSec: number().nullable(),
43101
+ series: array(TrainingProgressPointSchema).readonly()
43102
+ }),
43103
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
43104
+ logTail: array(string()).readonly(),
43105
+ logCursor: string().nullable(),
43106
+ artifacts: object({
43107
+ bundleBytes: number().int(),
43108
+ bundleSha256: string(),
43109
+ fetchedAt: number(),
43110
+ /** When the staged artefacts are deleted from the hub. */
43111
+ expiresAt: number()
43112
+ }).nullable(),
43113
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
43114
+ cloudDatasetDeletedAt: number().nullable(),
43115
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
43116
+ cloudCleanupDueAt: number().nullable(),
43117
+ /** Model ids registered from this job (base, and int8 when kept). */
43118
+ registeredModelIds: array(string()).readonly(),
43119
+ canary: TrainingCanarySchema.nullable()
43120
+ });
43121
+ var IdInput = object({ id: string().min(1) });
43122
+ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
43123
+ auth: "admin",
43124
+ timeoutMs: 6e4
43125
+ }), method(TrainingJobRequestSchema.extend({
43126
+ name: string().min(1).max(120),
43127
+ maxCostUsd: number().positive(),
43128
+ maxRuntimeSec: number().int().positive(),
43129
+ idempotencyKey: string().min(8).max(80)
43130
+ }), discriminatedUnion("kind", [object({
43131
+ kind: literal("started"),
43132
+ job: TrainingJobSchema
43133
+ }), object({
43134
+ kind: literal("refused"),
43135
+ reason: TrainingRefusalReasonSchema,
43136
+ detail: string()
43137
+ })]), {
43138
+ kind: "mutation",
43139
+ auth: "admin",
43140
+ timeoutMs: 12e4
43141
+ }), method(TrainingJobRequestSchema.omit({ baseModelId: true }).extend({
43142
+ baseModelIds: array(string().min(1)).min(1),
43143
+ name: string().min(1).max(120),
43144
+ maxCostUsd: number().positive(),
43145
+ maxRuntimeSec: number().int().positive(),
43146
+ idempotencyKey: string().min(8).max(80)
43147
+ }), discriminatedUnion("kind", [object({
43148
+ kind: literal("started"),
43149
+ batchId: string(),
43150
+ jobs: array(TrainingJobSchema).min(1).readonly()
43151
+ }), object({
43152
+ kind: literal("refused"),
43153
+ reason: TrainingRefusalReasonSchema,
43154
+ detail: string()
43155
+ })]), {
43156
+ kind: "mutation",
43157
+ auth: "admin",
43158
+ timeoutMs: 12e4
43159
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
43160
+ kind: "mutation",
43161
+ auth: "admin",
43162
+ timeoutMs: 12e4
43163
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
43164
+ kind: "mutation",
43165
+ auth: "admin",
43166
+ timeoutMs: 30 * 6e4
43167
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
43168
+ kind: "mutation",
43169
+ auth: "admin",
43170
+ timeoutMs: 12e4
43171
+ }), method(IdInput, TrainingJobSchema, {
43172
+ kind: "mutation",
43173
+ auth: "admin",
43174
+ timeoutMs: 12e4
43175
+ }), method(IdInput, TrainingJobSchema, {
43176
+ kind: "mutation",
43177
+ auth: "admin"
43178
+ });
41650
43179
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
41651
43180
  Object.freeze({
41652
43181
  person: .5,
@@ -43795,6 +45324,12 @@ Object.freeze({
43795
45324
  addonId: null,
43796
45325
  access: "create"
43797
45326
  },
45327
+ "backup.checkBackupKey": {
45328
+ capName: "backup",
45329
+ capScope: "system",
45330
+ addonId: null,
45331
+ access: "create"
45332
+ },
43798
45333
  "backup.delete": {
43799
45334
  capName: "backup",
43800
45335
  capScope: "system",
@@ -43807,6 +45342,18 @@ Object.freeze({
43807
45342
  addonId: null,
43808
45343
  access: "delete"
43809
45344
  },
45345
+ "backup.disableEncryption": {
45346
+ capName: "backup",
45347
+ capScope: "system",
45348
+ addonId: null,
45349
+ access: "create"
45350
+ },
45351
+ "backup.getEncryption": {
45352
+ capName: "backup",
45353
+ capScope: "system",
45354
+ addonId: null,
45355
+ access: "view"
45356
+ },
43810
45357
  "backup.getEntries": {
43811
45358
  capName: "backup",
43812
45359
  capScope: "system",
@@ -43861,6 +45408,12 @@ Object.freeze({
43861
45408
  addonId: null,
43862
45409
  access: "create"
43863
45410
  },
45411
+ "backup.setupEncryption": {
45412
+ capName: "backup",
45413
+ capScope: "system",
45414
+ addonId: null,
45415
+ access: "create"
45416
+ },
43864
45417
  "backup.trigger": {
43865
45418
  capName: "backup",
43866
45419
  capScope: "system",
@@ -44413,6 +45966,12 @@ Object.freeze({
44413
45966
  addonId: null,
44414
45967
  access: "create"
44415
45968
  },
45969
+ "customModelRegistry.importModelBundle": {
45970
+ capName: "custom-model-registry",
45971
+ capScope: "system",
45972
+ addonId: null,
45973
+ access: "create"
45974
+ },
44416
45975
  "customModelRegistry.listModels": {
44417
45976
  capName: "custom-model-registry",
44418
45977
  capScope: "system",
@@ -45853,6 +47412,12 @@ Object.freeze({
45853
47412
  addonId: null,
45854
47413
  access: "view"
45855
47414
  },
47415
+ "keychainAdmin.acknowledgeReset": {
47416
+ capName: "keychain-admin",
47417
+ capScope: "system",
47418
+ addonId: null,
47419
+ access: "create"
47420
+ },
45856
47421
  "keychainAdmin.deleteOrphans": {
45857
47422
  capName: "keychain-admin",
45858
47423
  capScope: "system",
@@ -45889,6 +47454,12 @@ Object.freeze({
45889
47454
  addonId: null,
45890
47455
  access: "delete"
45891
47456
  },
47457
+ "keychainAdmin.resetReport": {
47458
+ capName: "keychain-admin",
47459
+ capScope: "system",
47460
+ addonId: null,
47461
+ access: "delete"
47462
+ },
45892
47463
  "keychainAdmin.reveal": {
45893
47464
  capName: "keychain-admin",
45894
47465
  capScope: "system",
@@ -47143,6 +48714,36 @@ Object.freeze({
47143
48714
  addonId: null,
47144
48715
  access: "view"
47145
48716
  },
48717
+ "oidcConnections.connectionFormSchema": {
48718
+ capName: "oidc-connections",
48719
+ capScope: "system",
48720
+ addonId: null,
48721
+ access: "view"
48722
+ },
48723
+ "oidcConnections.createConnection": {
48724
+ capName: "oidc-connections",
48725
+ capScope: "system",
48726
+ addonId: null,
48727
+ access: "create"
48728
+ },
48729
+ "oidcConnections.deleteConnection": {
48730
+ capName: "oidc-connections",
48731
+ capScope: "system",
48732
+ addonId: null,
48733
+ access: "delete"
48734
+ },
48735
+ "oidcConnections.listConnections": {
48736
+ capName: "oidc-connections",
48737
+ capScope: "system",
48738
+ addonId: null,
48739
+ access: "view"
48740
+ },
48741
+ "oidcConnections.updateConnection": {
48742
+ capName: "oidc-connections",
48743
+ capScope: "system",
48744
+ addonId: null,
48745
+ access: "create"
48746
+ },
47146
48747
  "osd.getStatus": {
47147
48748
  capName: "osd",
47148
48749
  capScope: "device",
@@ -47215,6 +48816,12 @@ Object.freeze({
47215
48816
  addonId: null,
47216
48817
  access: "create"
47217
48818
  },
48819
+ "osdManager.setSlotCameraEnabled": {
48820
+ capName: "osd-manager",
48821
+ capScope: "system",
48822
+ addonId: null,
48823
+ access: "create"
48824
+ },
47218
48825
  "osdManager.upsertTemplate": {
47219
48826
  capName: "osd-manager",
47220
48827
  capScope: "system",
@@ -47353,12 +48960,6 @@ Object.freeze({
47353
48960
  addonId: null,
47354
48961
  access: "create"
47355
48962
  },
47356
- "pipelineAnalytics.createRetrainDatasetVersion": {
47357
- capName: "pipeline-analytics",
47358
- capScope: "device",
47359
- addonId: null,
47360
- access: "create"
47361
- },
47362
48963
  "pipelineAnalytics.deleteDeviceEvents": {
47363
48964
  capName: "pipeline-analytics",
47364
48965
  capScope: "device",
@@ -47371,12 +48972,6 @@ Object.freeze({
47371
48972
  addonId: null,
47372
48973
  access: "delete"
47373
48974
  },
47374
- "pipelineAnalytics.deleteRetrainDatasetVersion": {
47375
- capName: "pipeline-analytics",
47376
- capScope: "device",
47377
- addonId: null,
47378
- access: "delete"
47379
- },
47380
48975
  "pipelineAnalytics.deleteTracks": {
47381
48976
  capName: "pipeline-analytics",
47382
48977
  capScope: "device",
@@ -47479,6 +49074,12 @@ Object.freeze({
47479
49074
  addonId: null,
47480
49075
  access: "view"
47481
49076
  },
49077
+ "pipelineAnalytics.getRetrainCorpusKpi": {
49078
+ capName: "pipeline-analytics",
49079
+ capScope: "device",
49080
+ addonId: null,
49081
+ access: "view"
49082
+ },
47482
49083
  "pipelineAnalytics.getRetrainExportUrl": {
47483
49084
  capName: "pipeline-analytics",
47484
49085
  capScope: "device",
@@ -47599,7 +49200,7 @@ Object.freeze({
47599
49200
  addonId: null,
47600
49201
  access: "view"
47601
49202
  },
47602
- "pipelineAnalytics.listRetrainDatasetVersions": {
49203
+ "pipelineAnalytics.listRetrainCorpusPage": {
47603
49204
  capName: "pipeline-analytics",
47604
49205
  capScope: "device",
47605
49206
  addonId: null,
@@ -47635,23 +49236,23 @@ Object.freeze({
47635
49236
  addonId: null,
47636
49237
  access: "view"
47637
49238
  },
47638
- "pipelineAnalytics.ownersWithMedia": {
49239
+ "pipelineAnalytics.offerRetrainArchive": {
47639
49240
  capName: "pipeline-analytics",
47640
49241
  capScope: "device",
47641
49242
  addonId: null,
47642
- access: "view"
49243
+ access: "create"
47643
49244
  },
47644
- "pipelineAnalytics.pauseForStorageMigration": {
49245
+ "pipelineAnalytics.ownersWithMedia": {
47645
49246
  capName: "pipeline-analytics",
47646
49247
  capScope: "device",
47647
49248
  addonId: null,
47648
- access: "create"
49249
+ access: "view"
47649
49250
  },
47650
- "pipelineAnalytics.previewRetrainDataset": {
49251
+ "pipelineAnalytics.pauseForStorageMigration": {
47651
49252
  capName: "pipeline-analytics",
47652
49253
  capScope: "device",
47653
49254
  addonId: null,
47654
- access: "view"
49255
+ access: "create"
47655
49256
  },
47656
49257
  "pipelineAnalytics.proposeRetrainAnnotations": {
47657
49258
  capName: "pipeline-analytics",
@@ -47731,6 +49332,12 @@ Object.freeze({
47731
49332
  addonId: null,
47732
49333
  access: "create"
47733
49334
  },
49335
+ "pipelineAnalytics.resolveRetrainTrainingCorpus": {
49336
+ capName: "pipeline-analytics",
49337
+ capScope: "device",
49338
+ addonId: null,
49339
+ access: "view"
49340
+ },
47734
49341
  "pipelineAnalytics.restageRetrainTrack": {
47735
49342
  capName: "pipeline-analytics",
47736
49343
  capScope: "device",
@@ -47791,12 +49398,6 @@ Object.freeze({
47791
49398
  addonId: null,
47792
49399
  access: "create"
47793
49400
  },
47794
- "pipelineAnalytics.verifyRetrainDatasetVersion": {
47795
- capName: "pipeline-analytics",
47796
- capScope: "device",
47797
- addonId: null,
47798
- access: "view"
47799
- },
47800
49401
  "pipelineAnalytics.wipeAllAnalytics": {
47801
49402
  capName: "pipeline-analytics",
47802
49403
  capScope: "device",
@@ -50173,6 +51774,180 @@ Object.freeze({
50173
51774
  addonId: null,
50174
51775
  access: "view"
50175
51776
  },
51777
+ "training.canaryResult": {
51778
+ capName: "training",
51779
+ capScope: "system",
51780
+ addonId: null,
51781
+ access: "create"
51782
+ },
51783
+ "training.cancelJob": {
51784
+ capName: "training",
51785
+ capScope: "system",
51786
+ addonId: null,
51787
+ access: "create"
51788
+ },
51789
+ "training.discardResult": {
51790
+ capName: "training",
51791
+ capScope: "system",
51792
+ addonId: null,
51793
+ access: "create"
51794
+ },
51795
+ "training.getJob": {
51796
+ capName: "training",
51797
+ capScope: "system",
51798
+ addonId: null,
51799
+ access: "view"
51800
+ },
51801
+ "training.getJobResult": {
51802
+ capName: "training",
51803
+ capScope: "system",
51804
+ addonId: null,
51805
+ access: "view"
51806
+ },
51807
+ "training.listBaseModels": {
51808
+ capName: "training",
51809
+ capScope: "system",
51810
+ addonId: null,
51811
+ access: "view"
51812
+ },
51813
+ "training.listJobs": {
51814
+ capName: "training",
51815
+ capScope: "system",
51816
+ addonId: null,
51817
+ access: "view"
51818
+ },
51819
+ "training.planJob": {
51820
+ capName: "training",
51821
+ capScope: "system",
51822
+ addonId: null,
51823
+ access: "view"
51824
+ },
51825
+ "training.registerResult": {
51826
+ capName: "training",
51827
+ capScope: "system",
51828
+ addonId: null,
51829
+ access: "create"
51830
+ },
51831
+ "training.rollbackCanary": {
51832
+ capName: "training",
51833
+ capScope: "system",
51834
+ addonId: null,
51835
+ access: "create"
51836
+ },
51837
+ "training.startJob": {
51838
+ capName: "training",
51839
+ capScope: "system",
51840
+ addonId: null,
51841
+ access: "create"
51842
+ },
51843
+ "training.startJobBatch": {
51844
+ capName: "training",
51845
+ capScope: "system",
51846
+ addonId: null,
51847
+ access: "create"
51848
+ },
51849
+ "trainingProvider.cancelJob": {
51850
+ capName: "training-provider",
51851
+ capScope: "system",
51852
+ addonId: null,
51853
+ access: "create"
51854
+ },
51855
+ "trainingProvider.cleanupJob": {
51856
+ capName: "training-provider",
51857
+ capScope: "system",
51858
+ addonId: null,
51859
+ access: "create"
51860
+ },
51861
+ "trainingProvider.createEntry": {
51862
+ capName: "training-provider",
51863
+ capScope: "system",
51864
+ addonId: null,
51865
+ access: "create"
51866
+ },
51867
+ "trainingProvider.deleteEntry": {
51868
+ capName: "training-provider",
51869
+ capScope: "system",
51870
+ addonId: null,
51871
+ access: "delete"
51872
+ },
51873
+ "trainingProvider.describe": {
51874
+ capName: "training-provider",
51875
+ capScope: "system",
51876
+ addonId: null,
51877
+ access: "view"
51878
+ },
51879
+ "trainingProvider.describeTypes": {
51880
+ capName: "training-provider",
51881
+ capScope: "system",
51882
+ addonId: null,
51883
+ access: "view"
51884
+ },
51885
+ "trainingProvider.estimateJob": {
51886
+ capName: "training-provider",
51887
+ capScope: "system",
51888
+ addonId: null,
51889
+ access: "view"
51890
+ },
51891
+ "trainingProvider.getJob": {
51892
+ capName: "training-provider",
51893
+ capScope: "system",
51894
+ addonId: null,
51895
+ access: "view"
51896
+ },
51897
+ "trainingProvider.listEntries": {
51898
+ capName: "training-provider",
51899
+ capScope: "system",
51900
+ addonId: null,
51901
+ access: "view"
51902
+ },
51903
+ "trainingProvider.listJobEvents": {
51904
+ capName: "training-provider",
51905
+ capScope: "system",
51906
+ addonId: null,
51907
+ access: "view"
51908
+ },
51909
+ "trainingProvider.listJobs": {
51910
+ capName: "training-provider",
51911
+ capScope: "system",
51912
+ addonId: null,
51913
+ access: "view"
51914
+ },
51915
+ "trainingProvider.offerArtifact": {
51916
+ capName: "training-provider",
51917
+ capScope: "system",
51918
+ addonId: null,
51919
+ access: "create"
51920
+ },
51921
+ "trainingProvider.readResult": {
51922
+ capName: "training-provider",
51923
+ capScope: "system",
51924
+ addonId: null,
51925
+ access: "create"
51926
+ },
51927
+ "trainingProvider.submitJob": {
51928
+ capName: "training-provider",
51929
+ capScope: "system",
51930
+ addonId: null,
51931
+ access: "create"
51932
+ },
51933
+ "trainingProvider.updateEntry": {
51934
+ capName: "training-provider",
51935
+ capScope: "system",
51936
+ addonId: null,
51937
+ access: "create"
51938
+ },
51939
+ "trainingProvider.uploadDataset": {
51940
+ capName: "training-provider",
51941
+ capScope: "system",
51942
+ addonId: null,
51943
+ access: "create"
51944
+ },
51945
+ "trainingProvider.validateCredentials": {
51946
+ capName: "training-provider",
51947
+ capScope: "system",
51948
+ addonId: null,
51949
+ access: "create"
51950
+ },
50176
51951
  "turnProvider.getTurnServers": {
50177
51952
  capName: "turn-provider",
50178
51953
  capScope: "system",
@@ -50197,12 +51972,6 @@ Object.freeze({
50197
51972
  addonId: null,
50198
51973
  access: "create"
50199
51974
  },
50200
- "userManagement.createApiKey": {
50201
- capName: "user-management",
50202
- capScope: "system",
50203
- addonId: null,
50204
- access: "create"
50205
- },
50206
51975
  "userManagement.createScopedToken": {
50207
51976
  capName: "user-management",
50208
51977
  capScope: "system",
@@ -50239,12 +52008,6 @@ Object.freeze({
50239
52008
  addonId: null,
50240
52009
  access: "view"
50241
52010
  },
50242
- "userManagement.linkExternalIdentity": {
50243
- capName: "user-management",
50244
- capScope: "system",
50245
- addonId: null,
50246
- access: "create"
50247
- },
50248
52011
  "userManagement.listApiKeys": {
50249
52012
  capName: "user-management",
50250
52013
  capScope: "system",
@@ -50347,12 +52110,6 @@ Object.freeze({
50347
52110
  addonId: null,
50348
52111
  access: "create"
50349
52112
  },
50350
- "userManagement.validateApiKey": {
50351
- capName: "user-management",
50352
- capScope: "system",
50353
- addonId: null,
50354
- access: "view"
50355
- },
50356
52113
  "userManagement.validateCredentials": {
50357
52114
  capName: "user-management",
50358
52115
  capScope: "system",
@@ -53385,6 +55142,11 @@ Object.freeze({
53385
55142
  form: "single",
53386
55143
  optional: false
53387
55144
  }],
55145
+ "osdManager.setSlotCameraEnabled": [{
55146
+ name: "deviceId",
55147
+ form: "single",
55148
+ optional: false
55149
+ }],
53388
55150
  "petFeeder.callPet": [{
53389
55151
  name: "deviceId",
53390
55152
  form: "single",
@@ -53605,6 +55367,11 @@ Object.freeze({
53605
55367
  form: "array",
53606
55368
  optional: false
53607
55369
  }],
55370
+ "pipelineAnalytics.listRetrainCorpusPage": [{
55371
+ name: "deviceIds",
55372
+ form: "array",
55373
+ optional: true
55374
+ }],
53608
55375
  "pipelineAnalytics.listRetrainStaging": [{
53609
55376
  name: "deviceIds",
53610
55377
  form: "array",
@@ -54466,6 +56233,11 @@ Object.freeze({
54466
56233
  form: "single",
54467
56234
  optional: false
54468
56235
  }],
56236
+ "training.canaryResult": [{
56237
+ name: "deviceIds",
56238
+ form: "array",
56239
+ optional: false
56240
+ }],
54469
56241
  "update.getStatus": [{
54470
56242
  name: "deviceId",
54471
56243
  form: "single",
@@ -54709,6 +56481,7 @@ Object.freeze({
54709
56481
  });
54710
56482
  Object.freeze({
54711
56483
  "broker": "broker",
56484
+ "calendar-source": "calendar",
54712
56485
  "device-export": "device-export",
54713
56486
  "llm": "ai",
54714
56487
  "mesh-network": "mesh",
@@ -55194,6 +56967,8 @@ var STATE_SUMMARY_VARS = [
55194
56967
  [...RULE_TEXT],
55195
56968
  [...RULE_TEXT],
55196
56969
  [...RULE_TEXT],
56970
+ [...RULE_TEXT],
56971
+ [...RULE_TEXT],
55197
56972
  ([...RULE_TEXT], [...UPDATES]),
55198
56973
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
55199
56974
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),