@camstack/addon-provider-ecowitt 0.2.124 → 0.2.126

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 +2068 -145
  2. package/dist/addon.mjs +2068 -145
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -5380,7 +5380,7 @@ var ZodIssueCode$1 = {
5380
5380
  var ZodFirstPartyTypeKind$1;
5381
5381
  ZodFirstPartyTypeKind$1 || (ZodFirstPartyTypeKind$1 = {});
5382
5382
  //#endregion
5383
- //#region ../types/dist/sleep-Cr5YOk3m.mjs
5383
+ //#region ../types/dist/sleep-DwAQ9sqX.mjs
5384
5384
  /**
5385
5385
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5386
5386
  * window to float samples (D455).
@@ -5497,7 +5497,7 @@ function isKeychainStoredField(field) {
5497
5497
  var SECRET_CLEAR = { $secretClear: true };
5498
5498
  /** The `'***'` token D634 redaction writes for non-admins. */
5499
5499
  var LEGACY_DEVICE_REDACTION = "***";
5500
- function isRecord$1(value) {
5500
+ function isRecord$2(value) {
5501
5501
  return typeof value === "object" && value !== null && !Array.isArray(value);
5502
5502
  }
5503
5503
  function makeSecretMarker(ref) {
@@ -5508,12 +5508,12 @@ function makeSecretMarker(ref) {
5508
5508
  }
5509
5509
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5510
5510
  function isSecretMarker(value) {
5511
- if (!isRecord$1(value)) return false;
5511
+ if (!isRecord$2(value)) return false;
5512
5512
  const ref = value["$secret"];
5513
5513
  return typeof ref === "string" && ref.length > 0;
5514
5514
  }
5515
5515
  function isSecretClear(value) {
5516
- return isRecord$1(value) && value["$secretClear"] === true;
5516
+ return isRecord$2(value) && value["$secretClear"] === true;
5517
5517
  }
5518
5518
  /**
5519
5519
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6029,6 +6029,13 @@ function globalSecretScope() {
6029
6029
  function encodeSegment(value) {
6030
6030
  return encodeURIComponent(value);
6031
6031
  }
6032
+ function decodeSegment(value) {
6033
+ try {
6034
+ return decodeURIComponent(value);
6035
+ } catch {
6036
+ return null;
6037
+ }
6038
+ }
6032
6039
  /**
6033
6040
  * The field path of a value inside an array item, addressed by the item's id:
6034
6041
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6037,6 +6044,75 @@ function encodeSegment(value) {
6037
6044
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6038
6045
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6039
6046
  }
6047
+ function parseScope(segments) {
6048
+ switch (segments[0]) {
6049
+ case "global": return {
6050
+ scope: GLOBAL_SCOPE,
6051
+ used: 1
6052
+ };
6053
+ case "node": {
6054
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6055
+ return nodeId === null || nodeId.length === 0 ? null : {
6056
+ scope: {
6057
+ kind: "node",
6058
+ nodeId
6059
+ },
6060
+ used: 2
6061
+ };
6062
+ }
6063
+ case "device": {
6064
+ const raw = segments[1];
6065
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6066
+ return {
6067
+ scope: {
6068
+ kind: "device",
6069
+ deviceId: Number(raw)
6070
+ },
6071
+ used: 2
6072
+ };
6073
+ }
6074
+ case "integration": {
6075
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6076
+ return id === null || id.length === 0 ? null : {
6077
+ scope: {
6078
+ kind: "integration",
6079
+ integrationId: id
6080
+ },
6081
+ used: 2
6082
+ };
6083
+ }
6084
+ case "row": {
6085
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6086
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6087
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6088
+ return {
6089
+ scope: {
6090
+ kind: "row",
6091
+ collection,
6092
+ rowId
6093
+ },
6094
+ used: 3
6095
+ };
6096
+ }
6097
+ default: return null;
6098
+ }
6099
+ }
6100
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6101
+ function parseSecretRef(ref) {
6102
+ if (!ref.startsWith("secret://")) return null;
6103
+ const segments = ref.slice(9).split("/");
6104
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6105
+ if (owner === null || owner.length === 0) return null;
6106
+ const parsed = parseScope(segments.slice(1));
6107
+ if (parsed === null) return null;
6108
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6109
+ if (fieldPath.length === 0) return null;
6110
+ return {
6111
+ owner,
6112
+ scope: parsed.scope,
6113
+ fieldPath
6114
+ };
6115
+ }
6040
6116
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6041
6117
  var KeychainWriteRefusedError = class extends Error {
6042
6118
  fieldPath;
@@ -6047,7 +6123,7 @@ var KeychainWriteRefusedError = class extends Error {
6047
6123
  }
6048
6124
  };
6049
6125
  var KEEP = { kind: "keep" };
6050
- function isRecord(value) {
6126
+ function isRecord$1(value) {
6051
6127
  return typeof value === "object" && value !== null && !Array.isArray(value);
6052
6128
  }
6053
6129
  function defaultMintId() {
@@ -6060,7 +6136,7 @@ function collectSecretMarkerRefs(value, out = []) {
6060
6136
  return out;
6061
6137
  }
6062
6138
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6063
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6139
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6064
6140
  return out;
6065
6141
  }
6066
6142
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6115,7 +6191,7 @@ function rowId(row, idKey) {
6115
6191
  return null;
6116
6192
  }
6117
6193
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6118
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6194
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6119
6195
  if (!Array.isArray(incoming)) {
6120
6196
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6121
6197
  return {
@@ -6131,7 +6207,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6131
6207
  const kept = /* @__PURE__ */ new Set();
6132
6208
  const rows = [];
6133
6209
  for (const row of incoming) {
6134
- if (!isRecord(row)) {
6210
+ if (!isRecord$1(row)) {
6135
6211
  rows.push(row);
6136
6212
  continue;
6137
6213
  }
@@ -6156,7 +6232,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6156
6232
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6157
6233
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6158
6234
  case "object": {
6159
- if (!isRecord(incoming)) {
6235
+ if (!isRecord$1(incoming)) {
6160
6236
  if (incoming === void 0) return KEEP;
6161
6237
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6162
6238
  return {
@@ -6164,7 +6240,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6164
6240
  value: incoming
6165
6241
  };
6166
6242
  }
6167
- const storedObj = isRecord(stored) ? stored : {};
6243
+ const storedObj = isRecord$1(stored) ? stored : {};
6168
6244
  return {
6169
6245
  kind: "value",
6170
6246
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6223,12 +6299,19 @@ async function transformSecretWrite(input) {
6223
6299
  }
6224
6300
  };
6225
6301
  }
6302
+ /** Is `ref` one of `owner`'s refs? */
6303
+ function isSecretRefOwnedBy(ref, owner) {
6304
+ return parseSecretRef(ref)?.owner === owner;
6305
+ }
6226
6306
  /**
6227
6307
  * Replace every marker in `value` with its keychain value. Returns the SAME
6228
6308
  * reference when there is no marker (no allocation, no keychain call).
6229
6309
  */
6230
- async function resolveSecretMarkers(value, secrets) {
6231
- const refs = collectSecretMarkerRefs(value);
6310
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6311
+ const keepMarker = options.unresolved === "keep-marker";
6312
+ const owner = options.ownedBy;
6313
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6314
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6232
6315
  if (refs.length === 0) return {
6233
6316
  value,
6234
6317
  unresolved: []
@@ -6252,10 +6335,18 @@ async function resolveSecretMarkers(value, secrets) {
6252
6335
  }
6253
6336
  const substitute = (v) => {
6254
6337
  if (isSecretMarker(v)) {
6338
+ if (!inScope(v.$secret)) return {
6339
+ keep: true,
6340
+ value: v
6341
+ };
6255
6342
  const answer = answers[v.$secret];
6256
- return answer?.kind === "value" ? {
6343
+ if (answer?.kind === "value") return {
6257
6344
  keep: true,
6258
6345
  value: answer.value
6346
+ };
6347
+ return keepMarker ? {
6348
+ keep: true,
6349
+ value: v
6259
6350
  } : {
6260
6351
  keep: false,
6261
6352
  value: void 0
@@ -6272,7 +6363,7 @@ async function resolveSecretMarkers(value, secrets) {
6272
6363
  value: items
6273
6364
  };
6274
6365
  }
6275
- if (isRecord(v)) {
6366
+ if (isRecord$1(v)) {
6276
6367
  const out = {};
6277
6368
  for (const [k, child] of Object.entries(v)) {
6278
6369
  const s = substitute(child);
@@ -6293,14 +6384,152 @@ async function resolveSecretMarkers(value, secrets) {
6293
6384
  unresolved
6294
6385
  };
6295
6386
  }
6296
- function touchesTree(tree, patch) {
6297
- if (tree.size === 0) return false;
6298
- for (const key of Object.keys(patch)) {
6299
- const at = key.indexOf("@");
6300
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6387
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6388
+ var SecretOverwriteRefusedError = class extends Error {
6389
+ ref;
6390
+ reason;
6391
+ constructor(ref, reason) {
6392
+ 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.`);
6393
+ this.ref = ref;
6394
+ this.reason = reason;
6395
+ this.name = "SecretOverwriteRefusedError";
6396
+ }
6397
+ };
6398
+ function isRecord(value) {
6399
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6400
+ }
6401
+ function resolvedValue(pass, marker) {
6402
+ const answer = pass.answers[marker.$secret];
6403
+ return answer?.kind === "value" ? answer.value : null;
6404
+ }
6405
+ async function atMarker(pass, incoming, stored) {
6406
+ if (incoming === null) return stored;
6407
+ if (typeof incoming !== "string") return incoming;
6408
+ if (incoming === resolvedValue(pass, stored)) return stored;
6409
+ const intent = classifySecretWrite(incoming);
6410
+ if (intent.kind !== "set") return stored;
6411
+ const ref = stored.$secret;
6412
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6413
+ const answer = pass.answers[ref];
6414
+ 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);
6415
+ try {
6416
+ await pass.secrets.put(ref, intent.value);
6417
+ } catch (err) {
6418
+ throw new KeychainWriteRefusedError(ref, err);
6419
+ }
6420
+ pass.changedRefs.push(ref);
6421
+ return stored;
6422
+ }
6423
+ function inArray(pass, incoming, stored) {
6424
+ return incoming.map((item, index) => {
6425
+ const twin = stored[index];
6426
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6427
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6428
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6429
+ return item;
6430
+ });
6431
+ }
6432
+ function inArrayRow(pass, incoming, stored) {
6433
+ const out = { ...incoming };
6434
+ for (const [key, value] of Object.entries(incoming)) {
6435
+ const twin = stored[key];
6436
+ if (isSecretMarker(twin)) {
6437
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6438
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6439
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6440
+ }
6441
+ return out;
6442
+ }
6443
+ async function walk(pass, incoming, stored) {
6444
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6445
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6446
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6447
+ const out = { ...incoming };
6448
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6449
+ return out;
6450
+ }
6451
+ /** Restore markers a write-back carries as values. See the file doc. */
6452
+ async function restoreUnchangedSecrets(input) {
6453
+ const refs = [];
6454
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6455
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6456
+ if (owned.length === 0) return {
6457
+ patch: input.patch,
6458
+ changedRefs: []
6459
+ };
6460
+ const pass = {
6461
+ secrets: input.secrets,
6462
+ answers: await input.secrets.resolve([...new Set(owned)]),
6463
+ operatorWrite: input.operatorWrite,
6464
+ changedRefs: []
6465
+ };
6466
+ const out = {};
6467
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6468
+ return {
6469
+ patch: out,
6470
+ changedRefs: pass.changedRefs
6471
+ };
6472
+ }
6473
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6474
+ function isJsonEqual(a, b) {
6475
+ if (Object.is(a, b)) return true;
6476
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6477
+ if (isRecord(a) && isRecord(b)) {
6478
+ const keys = Object.keys(a);
6479
+ if (keys.length !== Object.keys(b).length) return false;
6480
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6301
6481
  }
6302
6482
  return false;
6303
6483
  }
6484
+ /** The patch without the keys whose value already equals the stored one. */
6485
+ function dropUnchangedKeys(patch, stored) {
6486
+ const out = {};
6487
+ for (const [key, value] of Object.entries(patch)) {
6488
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6489
+ out[key] = value;
6490
+ }
6491
+ return out;
6492
+ }
6493
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6494
+ function markerKeysOf(blob, owner) {
6495
+ const keys = /* @__PURE__ */ new Set();
6496
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6497
+ return keys;
6498
+ }
6499
+ function nodeFromStored(value, owner) {
6500
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6501
+ if (!isRecord(value)) return null;
6502
+ const children = /* @__PURE__ */ new Map();
6503
+ for (const [key, child] of Object.entries(value)) {
6504
+ const node = nodeFromStored(child, owner);
6505
+ if (node !== null) children.set(key, node);
6506
+ }
6507
+ return children.size > 0 ? {
6508
+ kind: "object",
6509
+ children
6510
+ } : null;
6511
+ }
6512
+ /**
6513
+ * The declared secret tree, widened by every place the STORED blob holds a
6514
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6515
+ * never declared: Wyze before b4906cec6) still gets the save path's
6516
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6517
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6518
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6519
+ * builtin that keeps another addon's marker (device-manager) never takes it
6520
+ * over.
6521
+ */
6522
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6523
+ const added = /* @__PURE__ */ new Map();
6524
+ for (const key of keys) {
6525
+ const at = key.indexOf("@");
6526
+ const base = at > 0 ? key.slice(0, at) : key;
6527
+ if (declared.has(base) || added.has(base)) continue;
6528
+ const node = nodeFromStored(stored[key], owner);
6529
+ if (node !== null) added.set(base, node);
6530
+ }
6531
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6532
+ }
6304
6533
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6305
6534
  async function readStoredAddonBlob(raw) {
6306
6535
  const threeWay = raw.readAddonStoreResult;
@@ -6309,7 +6538,41 @@ async function readStoredAddonBlob(raw) {
6309
6538
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6310
6539
  return result.kind === "missing" ? {} : result.value;
6311
6540
  }
6312
- function createSecretAwareSettings(raw, opts) {
6541
+ function touchesTree(tree, patch) {
6542
+ if (tree.size === 0) return false;
6543
+ for (const key of Object.keys(patch)) {
6544
+ const at = key.indexOf("@");
6545
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6546
+ }
6547
+ return false;
6548
+ }
6549
+ /**
6550
+ * Which top-level keys of each store held markers when last seen. `undefined`
6551
+ * for a store not seen yet: its first write reads it, to be safe.
6552
+ */
6553
+ var MarkerKeyIndex = class {
6554
+ owner;
6555
+ byStore = /* @__PURE__ */ new Map();
6556
+ constructor(owner) {
6557
+ this.owner = owner;
6558
+ }
6559
+ seen(store, blob) {
6560
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6561
+ }
6562
+ wrote(store, patch) {
6563
+ const keys = this.byStore.get(store);
6564
+ if (keys === void 0) return;
6565
+ const now = markerKeysOf(patch, this.owner);
6566
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6567
+ else keys.delete(key);
6568
+ }
6569
+ mayHoldMarkers(store, patch) {
6570
+ const keys = this.byStore.get(store);
6571
+ if (keys === void 0) return true;
6572
+ return Object.keys(patch).some((key) => keys.has(key));
6573
+ }
6574
+ };
6575
+ function createHandle(raw, opts) {
6313
6576
  const chains = /* @__PURE__ */ new Map();
6314
6577
  const serialize = (key, fn) => {
6315
6578
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6320,46 +6583,130 @@ function createSecretAwareSettings(raw, opts) {
6320
6583
  });
6321
6584
  return next;
6322
6585
  };
6323
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6324
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6325
- return serialize(chainKey, async () => {
6586
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6587
+ const resolveRead = async (store, blob) => {
6588
+ index.seen(store, blob);
6589
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6590
+ unresolved: "keep-marker",
6591
+ ownedBy: opts.secrets.owner
6592
+ });
6593
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6594
+ return value;
6595
+ };
6596
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6597
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6598
+ await rawWrite(patch);
6599
+ index.wrote(store, patch);
6600
+ return { changed: true };
6601
+ }
6602
+ return serialize(store, async () => {
6326
6603
  const stored = await readStored();
6604
+ index.seen(store, stored);
6605
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6606
+ const restored = await restoreUnchangedSecrets({
6607
+ patch,
6608
+ stored,
6609
+ secrets: opts.secrets,
6610
+ operatorWrite
6611
+ });
6327
6612
  const result = await transformSecretWrite({
6328
- tree,
6613
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6329
6614
  secrets: opts.secrets,
6330
- patch,
6615
+ patch: restored.patch,
6331
6616
  stored,
6332
6617
  ...scope !== void 0 ? { scope } : {},
6333
- operatorWrite: opts.isOperatorWrite?.() === true
6618
+ operatorWrite
6334
6619
  });
6335
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6620
+ const effective = dropUnchangedKeys(result.patch, stored);
6621
+ const wroteBlob = Object.keys(effective).length > 0;
6622
+ if (wroteBlob) {
6623
+ await rawWrite(effective);
6624
+ index.wrote(store, effective);
6625
+ }
6336
6626
  const { orphaned } = await result.afterWrite();
6337
6627
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6628
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6338
6629
  });
6339
6630
  };
6340
- const wrapped = {
6341
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6342
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6343
- kind: "device",
6344
- deviceId
6345
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6631
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6632
+ const readAddonStoreResult = raw.readAddonStoreResult;
6633
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6634
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6635
+ const overrides = {
6636
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6637
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6638
+ const result = await readAddonStoreResult.call(raw);
6639
+ return result.kind === "value" ? {
6640
+ kind: "value",
6641
+ value: await resolveRead("addon", result.value)
6642
+ } : result;
6643
+ } } : {},
6644
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6645
+ const result = await readAddonStoreKeyResult.call(raw, key);
6646
+ if (result.kind !== "present") return result;
6647
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6648
+ unresolved: "keep-marker",
6649
+ ownedBy: opts.secrets.owner
6650
+ });
6651
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6652
+ return {
6653
+ kind: "present",
6654
+ value: value[key]
6655
+ };
6656
+ } } : {},
6657
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6658
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6659
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6660
+ const out = /* @__PURE__ */ new Map();
6661
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6662
+ return out;
6663
+ } } : {},
6664
+ writeAddonStore: async (patch) => {
6665
+ await writeAddon(patch);
6666
+ },
6667
+ writeDeviceStore: async (deviceId, patch) => {
6668
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6669
+ kind: "device",
6670
+ deviceId
6671
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6672
+ }
6673
+ };
6674
+ return {
6675
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6676
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6677
+ const value = Reflect.get(target, prop, receiver);
6678
+ return typeof value === "function" ? value.bind(target) : value;
6679
+ } }),
6680
+ raw: {
6681
+ readAddonStore: async () => {
6682
+ const blob = await raw.readAddonStore();
6683
+ index.seen("addon", blob);
6684
+ return blob;
6685
+ },
6686
+ readDeviceStore: async (deviceId) => {
6687
+ const blob = await raw.readDeviceStore(deviceId);
6688
+ index.seen(`device:${deviceId}`, blob);
6689
+ return blob;
6690
+ }
6691
+ },
6692
+ writeAddonStore: writeAddon
6346
6693
  };
6347
- return new Proxy(raw, { get(target, prop, receiver) {
6348
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6349
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6350
- const value = Reflect.get(target, prop, receiver);
6351
- return typeof value === "function" ? value.bind(target) : value;
6352
- } });
6353
6694
  }
6354
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6355
- function withSecretAwareSettings(context, opts) {
6695
+ /** The context the addon sees, plus the private raw view and write outcome. */
6696
+ function createSecretAwareContext(context, opts) {
6356
6697
  const raw = context.settings;
6357
- if (raw === void 0) return context;
6358
- const settings = createSecretAwareSettings(raw, opts);
6359
- return new Proxy(context, { get(target, prop, receiver) {
6360
- if (prop === "settings") return settings;
6361
- return Reflect.get(target, prop, receiver);
6362
- } });
6698
+ if (raw === void 0) return {
6699
+ context,
6700
+ handle: null
6701
+ };
6702
+ const handle = createHandle(raw, opts);
6703
+ return {
6704
+ context: new Proxy(context, { get(target, prop, receiver) {
6705
+ if (prop === "settings") return handle.settings;
6706
+ return Reflect.get(target, prop, receiver);
6707
+ } }),
6708
+ handle
6709
+ };
6363
6710
  }
6364
6711
  var LEAF = { kind: "leaf" };
6365
6712
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6534,6 +6881,14 @@ var BaseAddon = class {
6534
6881
  _secretChangeUnsub = null;
6535
6882
  /** >0 while an OPERATOR's settings write is being applied. */
6536
6883
  _operatorWriteDepth = 0;
6884
+ /**
6885
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6886
+ * to the marker-bearing blobs and stays private to this class: the form
6887
+ * hydrate and config resolution need markers, addon code never does.
6888
+ */
6889
+ _secretSettings = null;
6890
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6891
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6537
6892
  constructor(defaults) {
6538
6893
  this.defaults = defaults;
6539
6894
  this._config = { ...defaults };
@@ -6570,13 +6925,21 @@ var BaseAddon = class {
6570
6925
  }
6571
6926
  async initialize(context) {
6572
6927
  const secrets = context.secrets;
6573
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6574
- secrets,
6575
- addonTree: () => this.addonSecretTree(),
6576
- deviceTree: () => this.deviceSecretTree(),
6577
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6578
- isOperatorWrite: () => this._operatorWriteDepth > 0
6579
- }) : context;
6928
+ if (secrets !== void 0) {
6929
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6930
+ secrets,
6931
+ addonTree: () => this.addonSecretTree(),
6932
+ deviceTree: () => this.deviceSecretTree(),
6933
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6934
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6935
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6936
+ });
6937
+ this._ctx = wrapped;
6938
+ this._secretSettings = handle;
6939
+ } else {
6940
+ this._ctx = context;
6941
+ this._secretSettings = null;
6942
+ }
6580
6943
  await this.resolveConfig();
6581
6944
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6582
6945
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6693,11 +7056,8 @@ var BaseAddon = class {
6693
7056
  async getGlobalSettings(overlay, cap, nodeId) {
6694
7057
  const schema = this.globalSettingsSchema(cap);
6695
7058
  if (!schema) return { sections: [] };
6696
- const projected = await this.resolveGlobalStore(nodeId, cap);
6697
- return hydrateSchema(schema, overlay ? {
6698
- ...projected,
6699
- ...overlay
6700
- } : projected, { inlineSecretsAsViews: true });
7059
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7060
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6701
7061
  }
6702
7062
  /**
6703
7063
  * The integration-level view of this addon's settings: exactly the sections
@@ -6742,7 +7102,7 @@ var BaseAddon = class {
6742
7102
  });
6743
7103
  }
6744
7104
  if (sections.length === 0) return null;
6745
- const projected = await this.resolveGlobalStore(nodeId);
7105
+ const projected = await this.readRawProjectedStore(nodeId);
6746
7106
  return hydrateSchema({
6747
7107
  ...schema,
6748
7108
  sections
@@ -6759,12 +7119,50 @@ var BaseAddon = class {
6759
7119
  * the store for custom option logic (option narrowing, value snapping) to
6760
7120
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6761
7121
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7122
+ *
7123
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7124
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7125
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7126
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7127
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7128
+ * resolved blob back is a no-op for every unchanged secret.
6762
7129
  */
6763
7130
  async resolveGlobalStore(nodeId, cap) {
6764
7131
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7132
+ return this.projectForNode(raw, nodeId, cap);
7133
+ }
7134
+ projectForNode(store, nodeId, cap) {
6765
7135
  const keys = this.perNodeKeys(cap);
6766
7136
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6767
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7137
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7138
+ }
7139
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7140
+ async readRawProjectedStore(nodeId, cap) {
7141
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7142
+ return this.projectForNode(raw, nodeId, cap);
7143
+ }
7144
+ /**
7145
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7146
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7147
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7148
+ * its value.
7149
+ */
7150
+ async overlayKeepingMarkers(stored, overlay) {
7151
+ const secrets = this._ctx?.secrets;
7152
+ const merged = {
7153
+ ...stored,
7154
+ ...overlay
7155
+ };
7156
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7157
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7158
+ unresolved: "keep-marker",
7159
+ ownedBy: secrets.owner
7160
+ });
7161
+ for (const key of Object.keys(overlay)) {
7162
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7163
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7164
+ }
7165
+ return merged;
6768
7166
  }
6769
7167
  /**
6770
7168
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6829,8 +7227,12 @@ var BaseAddon = class {
6829
7227
  async clearSecrets(keys, nodeId) {
6830
7228
  const tree = this.addonSecretTree();
6831
7229
  const keychain = this._ctx?.secrets !== void 0;
7230
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6832
7231
  const patch = {};
6833
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7232
+ for (const key of keys) {
7233
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7234
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7235
+ }
6834
7236
  await this.applyGlobalPatch(patch, nodeId);
6835
7237
  }
6836
7238
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6838,7 +7240,11 @@ var BaseAddon = class {
6838
7240
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6839
7241
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6840
7242
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6841
- await this._ctx?.settings?.writeAddonStore(scoped);
7243
+ const handle = this._secretSettings;
7244
+ if (handle !== null) {
7245
+ const { changed } = await handle.writeAddonStore(scoped);
7246
+ if (!changed) return;
7247
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6842
7248
  if (target !== localNode) return;
6843
7249
  await this.resolveConfig();
6844
7250
  await this.onConfigChanged();
@@ -6891,7 +7297,7 @@ var BaseAddon = class {
6891
7297
  async getDeviceSettings(deviceId) {
6892
7298
  const schema = this.deviceSettingsSchema();
6893
7299
  if (!schema) return { sections: [] };
6894
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7300
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6895
7301
  }
6896
7302
  async updateDeviceSettings(deviceId, patch) {
6897
7303
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7063,7 +7469,7 @@ var BaseAddon = class {
7063
7469
  key,
7064
7470
  schema,
7065
7471
  fallback,
7066
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7472
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7067
7473
  write: async (patch) => {
7068
7474
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7069
7475
  },
@@ -7125,6 +7531,23 @@ var BaseAddon = class {
7125
7531
  }
7126
7532
  return value;
7127
7533
  }
7534
+ /**
7535
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7536
+ * keychain the context's own view is already raw.
7537
+ */
7538
+ rawSettings() {
7539
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7540
+ }
7541
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7542
+ logUnresolvedRead(unresolved) {
7543
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7544
+ if (fresh.length === 0) return;
7545
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7546
+ 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) => ({
7547
+ ref: u.ref,
7548
+ reason: u.reason
7549
+ })) } });
7550
+ }
7128
7551
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7129
7552
  scheduleSecretReresolve(delayMs) {
7130
7553
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7151,7 +7574,7 @@ var BaseAddon = class {
7151
7574
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7152
7575
  */
7153
7576
  async readAddonStoreWithRetry() {
7154
- const settings = this._ctx?.settings;
7577
+ const settings = this.rawSettings();
7155
7578
  if (!settings) return {};
7156
7579
  const delaysMs = [
7157
7580
  150,
@@ -8963,6 +9386,16 @@ var CompositionSchema = object({
8963
9386
  seen.add(feature.cap);
8964
9387
  });
8965
9388
  });
9389
+ var NodeColorIdSchema = _enum([
9390
+ "node-a",
9391
+ "node-b",
9392
+ "node-c",
9393
+ "node-d",
9394
+ "node-e",
9395
+ "node-f",
9396
+ "node-g",
9397
+ "node-h"
9398
+ ]);
8966
9399
  new Set([
8967
9400
  "track",
8968
9401
  "face",
@@ -9454,6 +9887,278 @@ var CameraSwitchGroupSchema = object({
9454
9887
  fetchedAt: number()
9455
9888
  });
9456
9889
  /**
9890
+ * The trainer contract — what the hub hands the cloud trainer and what it
9891
+ * gets back (cloud training, D805+).
9892
+ *
9893
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
9894
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
9895
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
9896
+ * lines on stdout. These schemas are the hub's half of that boundary; the
9897
+ * trainer's pydantic models (and the JSON Schemas generated from them under
9898
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
9899
+ * change there, in the same piece of work.
9900
+ *
9901
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
9902
+ * orchestrator fills every field of a job spec explicitly.
9903
+ */
9904
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
9905
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
9906
+ /** What the trainer can export. Edge TPU is a later, separate image. */
9907
+ var TrainingExportSchema = _enum([
9908
+ "onnx",
9909
+ "openvino-fp16",
9910
+ "openvino-int8",
9911
+ "coreml-fp16"
9912
+ ]);
9913
+ var FloorsSchema = record(string(), number().min(0).max(1));
9914
+ object({
9915
+ schema: literal(TRAINING_JOB_SCHEMA),
9916
+ jobKey: string().uuid(),
9917
+ target: object({
9918
+ kind: literal("detector"),
9919
+ step: literal("object-detection")
9920
+ }),
9921
+ base: object({
9922
+ modelId: string().min(1),
9923
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
9924
+ weights: string().min(1),
9925
+ imgsz: number().int().positive()
9926
+ }),
9927
+ baseline: object({
9928
+ modelId: string().min(1),
9929
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
9930
+ onnxUrl: string().url(),
9931
+ imgsz: number().int().positive(),
9932
+ floors: FloorsSchema
9933
+ }),
9934
+ dataset: object({
9935
+ versionId: string().min(1),
9936
+ annotationHash: string(),
9937
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
9938
+ sha256: string().regex(/^[0-9a-f]{64}$/)
9939
+ }),
9940
+ split: object({
9941
+ holdoutCameras: array(number().int()),
9942
+ /** When no camera is held out: the last N days of every camera. */
9943
+ holdoutLastDays: number().int().nonnegative(),
9944
+ valFraction: number().min(0).max(.5),
9945
+ seed: number().int()
9946
+ }),
9947
+ hyper: object({
9948
+ epochs: number().int().positive(),
9949
+ batch: number().int().positive(),
9950
+ lr0: number().positive(),
9951
+ /** Layers frozen from the start of the backbone; 0 = none. */
9952
+ freeze: number().int().nonnegative(),
9953
+ patience: number().int().nonnegative(),
9954
+ seed: number().int()
9955
+ }),
9956
+ replay: object({
9957
+ source: literal("coco2017"),
9958
+ count: number().int().nonnegative()
9959
+ }),
9960
+ exports: array(TrainingExportSchema).min(1),
9961
+ calibration: object({ maxFrames: number().int().positive() }),
9962
+ floors: object({
9963
+ minSupport: number().int().positive(),
9964
+ clamp: number().min(0).max(1)
9965
+ }),
9966
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
9967
+ catalog: object({
9968
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
9969
+ name: string().min(1).max(160)
9970
+ })
9971
+ });
9972
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
9973
+ var TrainingResultFileSchema = object({
9974
+ path: string().min(1),
9975
+ bytes: number().int().nonnegative(),
9976
+ sha256: string().regex(/^[0-9a-f]{64}$/),
9977
+ format: _enum([
9978
+ "onnx",
9979
+ "openvino",
9980
+ "coreml",
9981
+ "pt"
9982
+ ]),
9983
+ variant: _enum(["base", "int8"])
9984
+ });
9985
+ var DraftFormatSchema = object({
9986
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
9987
+ url: string().min(1),
9988
+ sizeMB: number().nonnegative(),
9989
+ isDirectory: boolean().optional(),
9990
+ files: array(string()).optional(),
9991
+ runtimes: array(literal("python")).optional(),
9992
+ revision: string().min(1)
9993
+ });
9994
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
9995
+ var TrainingCatalogDraftSchema = object({
9996
+ id: string().min(1),
9997
+ name: string().min(1),
9998
+ description: string(),
9999
+ labels: array(unknown()),
10000
+ inputSize: object({
10001
+ width: number().int().positive(),
10002
+ height: number().int().positive()
10003
+ }),
10004
+ preprocessMode: literal("letterbox"),
10005
+ defaultClassFloors: FloorsSchema,
10006
+ formats: object({
10007
+ onnx: DraftFormatSchema.optional(),
10008
+ openvino: DraftFormatSchema.optional(),
10009
+ coreml: DraftFormatSchema.optional()
10010
+ })
10011
+ });
10012
+ /** One class of one model's holdout report (the eval harness's summary). */
10013
+ var TrainingEvalClassSchema = object({
10014
+ positives: number().int(),
10015
+ floor: number().nullable(),
10016
+ tp: number().int(),
10017
+ fp: number().int(),
10018
+ fn: number().int(),
10019
+ precision: number().nullable(),
10020
+ recall: number().nullable(),
10021
+ ap50: number().nullable(),
10022
+ recallByCamera: record(string(), number().nullable()).optional(),
10023
+ recallByLight: record(string(), number().nullable()).optional(),
10024
+ fpByCamera: record(string(), number()).optional(),
10025
+ smallFound: number().int().optional(),
10026
+ smallTotal: number().int().optional()
10027
+ }).passthrough();
10028
+ var TrainingEvalReportSchema = object({
10029
+ frames: number().int(),
10030
+ classes: record(string(), TrainingEvalClassSchema)
10031
+ }).passthrough();
10032
+ /**
10033
+ * A succeeded result carries every block; a failed one carries the error and
10034
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10035
+ * orchestrator checks the blocks it needs before it trusts a success.
10036
+ */
10037
+ var TrainingResultSchema = object({
10038
+ schema: literal(TRAINING_RESULT_SCHEMA),
10039
+ jobKey: string(),
10040
+ status: _enum(["succeeded", "failed"]),
10041
+ error: object({
10042
+ stage: string(),
10043
+ code: string(),
10044
+ message: string()
10045
+ }).nullable(),
10046
+ trainer: object({
10047
+ version: string(),
10048
+ revision: string()
10049
+ }),
10050
+ toolchain: record(string(), string().nullable()),
10051
+ dataset: object({
10052
+ versionId: string(),
10053
+ annotationHash: string(),
10054
+ sha256: string(),
10055
+ frames: object({
10056
+ train: number().int(),
10057
+ val: number().int(),
10058
+ holdout: number().int()
10059
+ }),
10060
+ holdoutCameras: array(number().int()),
10061
+ replayImages: number().int()
10062
+ }).optional(),
10063
+ training: object({
10064
+ epochsRun: number().int(),
10065
+ bestEpoch: number().int(),
10066
+ bestMap50: number(),
10067
+ bestMap50_95: number(),
10068
+ seconds: number()
10069
+ }).optional(),
10070
+ evaluation: object({
10071
+ holdoutFrames: number().int(),
10072
+ baseline: TrainingEvalReportSchema.nullable(),
10073
+ candidate: TrainingEvalReportSchema.nullable(),
10074
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10075
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10076
+ map50: record(string(), number().nullable())
10077
+ }).optional(),
10078
+ floors: object({
10079
+ baseline: FloorsSchema,
10080
+ candidate: FloorsSchema,
10081
+ candidateInt8: FloorsSchema.nullable(),
10082
+ notes: array(string())
10083
+ }).optional(),
10084
+ int8: object({
10085
+ kept: boolean(),
10086
+ map50Fp16: number().nullable(),
10087
+ map50Int8: number().nullable(),
10088
+ reason: string().nullable()
10089
+ }).optional(),
10090
+ exportsDropped: array(object({
10091
+ export: string(),
10092
+ reason: string()
10093
+ })).optional(),
10094
+ files: array(TrainingResultFileSchema).optional(),
10095
+ bundle: object({
10096
+ path: literal("bundle.tar"),
10097
+ bytes: number().int().nonnegative(),
10098
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10099
+ }).nullable().optional(),
10100
+ catalogDraft: object({
10101
+ base: TrainingCatalogDraftSchema,
10102
+ int8: TrainingCatalogDraftSchema.nullable()
10103
+ }).nullable().optional(),
10104
+ licence: string()
10105
+ });
10106
+ var TrainingStageSchema = _enum([
10107
+ "prepare",
10108
+ "replay",
10109
+ "train",
10110
+ "eval",
10111
+ "export",
10112
+ "package"
10113
+ ]);
10114
+ var EventBase = {
10115
+ v: literal(1),
10116
+ ts: number()
10117
+ };
10118
+ discriminatedUnion("type", [
10119
+ object({
10120
+ ...EventBase,
10121
+ type: literal("stage"),
10122
+ stage: TrainingStageSchema
10123
+ }),
10124
+ object({
10125
+ ...EventBase,
10126
+ type: literal("epoch"),
10127
+ epoch: number().int(),
10128
+ epochs: number().int(),
10129
+ boxLoss: number().nullable().optional(),
10130
+ map50: number().nullable().optional(),
10131
+ map50_95: number().nullable().optional(),
10132
+ etaSec: number().nullable().optional()
10133
+ }),
10134
+ object({
10135
+ ...EventBase,
10136
+ type: literal("metric"),
10137
+ name: string(),
10138
+ value: number()
10139
+ }),
10140
+ object({
10141
+ ...EventBase,
10142
+ type: literal("artifact"),
10143
+ path: string(),
10144
+ bytes: number(),
10145
+ sha256: string()
10146
+ }),
10147
+ object({
10148
+ ...EventBase,
10149
+ type: literal("done"),
10150
+ status: _enum(["succeeded", "failed"]),
10151
+ resultSha256: string().nullable().optional()
10152
+ }),
10153
+ object({
10154
+ ...EventBase,
10155
+ type: literal("error"),
10156
+ stage: string(),
10157
+ code: string(),
10158
+ message: string()
10159
+ })
10160
+ ]);
10161
+ /**
9457
10162
  * What the gate decided about a birth, from the CALLER's point of view.
9458
10163
  *
9459
10164
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11781,7 +12486,9 @@ var AddonHttpRouteSchema = object({
11781
12486
  "authenticated",
11782
12487
  "admin"
11783
12488
  ]).optional(),
11784
- description: string().optional()
12489
+ description: string().optional(),
12490
+ /** The hub limits this route per client address before the handler runs. */
12491
+ rateLimit: _enum(["auth"]).optional()
11785
12492
  });
11786
12493
  /**
11787
12494
  * Cross-process route invocation envelope. The hub captures the
@@ -12486,6 +13193,37 @@ var BackupDestinationInfoSchema = object({
12486
13193
  lastError: string().optional()
12487
13194
  });
12488
13195
  /**
13196
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13197
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13198
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13199
+ * with it off — which restores without a key.
13200
+ */
13201
+ var BackupArchiveEncryptionSchema = object({
13202
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13203
+ scheme: string(),
13204
+ /** 16 hex — the backup key whose secret restores this archive. */
13205
+ keyId: string()
13206
+ });
13207
+ /**
13208
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13209
+ * one new archives are encrypted to, and the retired ones older archives
13210
+ * still need. The secret key is shown once, at `setupEncryption`.
13211
+ */
13212
+ var BackupEncryptionStatusSchema = object({
13213
+ enabled: boolean(),
13214
+ active: object({
13215
+ keyId: string(),
13216
+ publicKey: string(),
13217
+ createdAt: number()
13218
+ }).nullable(),
13219
+ /** Every key ever set up, newest first. */
13220
+ keys: array(object({
13221
+ keyId: string(),
13222
+ createdAt: number(),
13223
+ retiredAt: number().nullable()
13224
+ })).readonly()
13225
+ });
13226
+ /**
12489
13227
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12490
13228
  * Same shape the destination drill-in renders. Sourced from the per-
12491
13229
  * location `manifests.json` (no per-archive tarball read required).
@@ -12497,7 +13235,9 @@ var BackupArchiveEntrySchema = object({
12497
13235
  sizeBytes: number(),
12498
13236
  label: string().optional(),
12499
13237
  /** Top-level locations included in the archive (db, addons, tls, …). */
12500
- locations: array(string()).readonly()
13238
+ locations: array(string()).readonly(),
13239
+ /** Present when the archive is encrypted; restore then needs that key. */
13240
+ encryption: BackupArchiveEncryptionSchema.optional()
12501
13241
  });
12502
13242
  var BackupEntrySchema = object({
12503
13243
  id: string(),
@@ -12506,7 +13246,8 @@ var BackupEntrySchema = object({
12506
13246
  label: string().optional(),
12507
13247
  createdAt: number(),
12508
13248
  sizeBytes: number(),
12509
- locations: array(string()).optional()
13249
+ locations: array(string()).optional(),
13250
+ encryption: BackupArchiveEncryptionSchema.optional()
12510
13251
  });
12511
13252
  var ArchiveEntrySchema = object({
12512
13253
  path: string(),
@@ -12695,10 +13436,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12695
13436
  * this list and skips entries whose path doesn't start with
12696
13437
  * any of them.
12697
13438
  */
12698
- locations: array(string()).optional()
13439
+ locations: array(string()).optional(),
13440
+ /**
13441
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13442
+ * one). The archive is decrypted into the hub's private staging
13443
+ * before the restart; the key is not stored. A wrong or missing key
13444
+ * is refused before the archive is downloaded.
13445
+ */
13446
+ backupSecretKey: string().optional()
12699
13447
  }), _void(), {
12700
13448
  kind: "mutation",
12701
13449
  auth: "admin"
13450
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13451
+ keyId: string(),
13452
+ secretKey: string(),
13453
+ publicKey: string(),
13454
+ createdAt: number(),
13455
+ replacedKeyId: string().nullable()
13456
+ }), {
13457
+ kind: "mutation",
13458
+ auth: "admin"
13459
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13460
+ kind: "mutation",
13461
+ auth: "admin"
13462
+ }), method(object({ backupSecretKey: string() }), object({
13463
+ valid: boolean(),
13464
+ keyId: string().nullable(),
13465
+ /** The hub knows this key (active or retired). */
13466
+ known: boolean(),
13467
+ /** It is the key new archives are encrypted to. */
13468
+ active: boolean(),
13469
+ error: string().optional()
13470
+ }), {
13471
+ kind: "mutation",
13472
+ auth: "admin"
12702
13473
  }), method(object({
12703
13474
  destinationId: string(),
12704
13475
  backupId: string()
@@ -14424,7 +15195,60 @@ var CustomModelDescriptorSchema = object({
14424
15195
  stepId: string(),
14425
15196
  entry: ModelCatalogEntrySchema
14426
15197
  });
14427
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15198
+ /** One regular file of an imported bundle, as the producer measured it. */
15199
+ var ModelBundleFileSchema = object({
15200
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15201
+ path: string().min(1),
15202
+ bytes: number().int().nonnegative(),
15203
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15204
+ });
15205
+ var ImportModelBundleInputSchema = object({
15206
+ /** The registry provider that keeps the model (Model Studio). */
15207
+ addonId: string(),
15208
+ stepId: string().min(1),
15209
+ /**
15210
+ * The catalog rows to register, complete, every format URL already
15211
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15212
+ * bundle may carry several rows (a base and its INT8 variant).
15213
+ */
15214
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15215
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15216
+ bundle: object({
15217
+ ticket: PeerBytesTicketSchema,
15218
+ bytes: number().int().positive(),
15219
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15220
+ }),
15221
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15222
+ files: array(ModelBundleFileSchema).min(1).max(64),
15223
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15224
+ distribute: boolean()
15225
+ });
15226
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15227
+ kind: literal("imported"),
15228
+ modelIds: array(string()).readonly(),
15229
+ distributed: array(object({
15230
+ modelId: string(),
15231
+ nodeId: string(),
15232
+ format: _enum(MODEL_FORMATS),
15233
+ ok: boolean(),
15234
+ error: string().optional()
15235
+ })).readonly()
15236
+ }), object({
15237
+ kind: literal("refused"),
15238
+ reason: _enum([
15239
+ "transfer-failed",
15240
+ "checksum-mismatch",
15241
+ "bundle-mismatch",
15242
+ "invalid-entry",
15243
+ "id-taken"
15244
+ ]),
15245
+ detail: string()
15246
+ })]);
15247
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15248
+ kind: "mutation",
15249
+ auth: "admin",
15250
+ timeoutMs: 30 * 6e4
15251
+ });
14428
15252
  /**
14429
15253
  * Query filter for settings-store collections.
14430
15254
  */
@@ -14903,6 +15727,35 @@ var KeychainKeySourceSchema = object({
14903
15727
  */
14904
15728
  sharesBackupWithDatabase: boolean()
14905
15729
  });
15730
+ /**
15731
+ * One keychain reset, as the Secrets page reports it until the operator
15732
+ * acknowledges it. Never a value: refs, counts and table names only.
15733
+ */
15734
+ var KeychainResetRecordSchema = object({
15735
+ id: string(),
15736
+ at: number(),
15737
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15738
+ actor: string(),
15739
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15740
+ lockedReason: string().nullable(),
15741
+ /** Values moved into the archive table (ciphertext under the lost key). */
15742
+ archived: number().int(),
15743
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15744
+ archivedCollection: string().nullable(),
15745
+ /**
15746
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15747
+ * so the archive can still be opened if the lost master key turns up.
15748
+ */
15749
+ archivedKeysCollection: string().nullable(),
15750
+ /**
15751
+ * `system-settings` keys whose marker the reset cleared — the cluster
15752
+ * secret's: a marker left pointing at an archived value would refuse every
15753
+ * agent forever (D797).
15754
+ */
15755
+ clearedSettingsKeys: array(string()).readonly(),
15756
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15757
+ acknowledgedAt: number().nullable()
15758
+ });
14906
15759
  var KeychainStatusSchema = object({
14907
15760
  keychain: KeychainStateSchema,
14908
15761
  /** The source of the master key in use; `null` while locked. */
@@ -14920,7 +15773,9 @@ var KeychainStatusSchema = object({
14920
15773
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
14921
15774
  retiredWraps: number().int(),
14922
15775
  recoveryKeyDownloadedAt: number().nullable(),
14923
- secretCount: number().int()
15776
+ secretCount: number().int(),
15777
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15778
+ lastReset: KeychainResetRecordSchema.nullable()
14924
15779
  });
14925
15780
  /**
14926
15781
  * Whether a stored value is still pointed at by its owner's settings.
@@ -14942,17 +15797,26 @@ var KeychainAuditActionSchema = _enum([
14942
15797
  "download-recovery-key",
14943
15798
  "delete-orphans",
14944
15799
  "reset",
15800
+ "acknowledge-reset",
14945
15801
  "initialize"
14946
15802
  ]);
14947
15803
  var KeychainAuditEntrySchema = object({
14948
15804
  id: string(),
14949
15805
  at: number(),
14950
15806
  action: KeychainAuditActionSchema,
14951
- /** `addon:<id>` | `user:<id>` | `system`. */
15807
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
14952
15808
  actor: string(),
14953
15809
  ref: string().nullable(),
14954
15810
  detail: string().nullable()
14955
15811
  });
15812
+ var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
15813
+ /**
15814
+ * Secrets the HUB itself holds (owner `system`) that no settings form shows:
15815
+ * `jwt-signing-key` — the session signing key (D797). It is always "in use",
15816
+ * never an orphan; it is generated on a fresh hub and replaced only through
15817
+ * {@link keychainAdminCapability.methods.setSystemSecret}.
15818
+ */
15819
+ var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
14956
15820
  method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}), array(KeychainAdminSecretSchema).readonly(), { auth: "admin" }), method(object({ limit: number().int().min(1).max(500).optional() }), array(KeychainAuditEntrySchema).readonly(), { auth: "admin" }), method(object({ ref: string().min(1) }), object({
14957
15821
  value: string(),
14958
15822
  version: number().int()
@@ -14960,6 +15824,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
14960
15824
  kind: "mutation",
14961
15825
  auth: "admin",
14962
15826
  caller: "required"
15827
+ }), method(object({
15828
+ name: SystemHeldSecretNameSchema,
15829
+ value: string().min(16)
15830
+ }), object({
15831
+ ref: string(),
15832
+ version: number().int()
15833
+ }), {
15834
+ kind: "mutation",
15835
+ auth: "admin",
15836
+ caller: "required"
14963
15837
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
14964
15838
  deleted: array(string()).readonly(),
14965
15839
  kept: array(object({
@@ -14989,13 +15863,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
14989
15863
  kind: "mutation",
14990
15864
  auth: "admin",
14991
15865
  caller: "required"
14992
- }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15866
+ }), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
14993
15867
  archivedCollection: string().nullable(),
14994
15868
  archived: number().int()
14995
15869
  }), {
14996
15870
  kind: "mutation",
14997
15871
  auth: "admin",
14998
15872
  caller: "required"
15873
+ }), method(object({}), object({
15874
+ reset: KeychainResetRecordSchema.nullable(),
15875
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15876
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15877
+ kind: "mutation",
15878
+ auth: "admin",
15879
+ caller: "required"
14999
15880
  });
15000
15881
  method(_void(), object({
15001
15882
  id: string(),
@@ -17657,14 +18538,14 @@ var LlmProfileSchema = object({
17657
18538
  /** ConfigUISchema tree passed through untyped on the wire (the
17658
18539
  * notification-output `ConfigSchemaPassthrough` precedent at
17659
18540
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
17660
- var ConfigSchemaPassthrough$1 = unknown();
18541
+ var ConfigSchemaPassthrough$3 = unknown();
17661
18542
  var LlmProfileKindDescriptorSchema = object({
17662
18543
  kind: LlmProfileKindSchema,
17663
18544
  label: string(),
17664
18545
  icon: string(),
17665
18546
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
17666
18547
  addonId: string(),
17667
- configSchema: ConfigSchemaPassthrough$1
18548
+ configSchema: ConfigSchemaPassthrough$3
17668
18549
  });
17669
18550
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
17670
18551
  var LlmDefaultSchema = object({
@@ -17942,7 +18823,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17942
18823
  * `login-method` — collection cap through which auth addons contribute
17943
18824
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17944
18825
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17945
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18826
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17946
18827
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17947
18828
  * procedure aggregates them for the unauthenticated login page.
17948
18829
  *
@@ -17950,8 +18831,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17950
18831
  *
17951
18832
  * - `redirect` — a declarative button. The login page renders a generic
17952
18833
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17953
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17954
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18834
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17955
18835
  * login page needs NO change.
17956
18836
  *
17957
18837
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -17970,8 +18850,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17970
18850
  * decision.
17971
18851
  *
17972
18852
  * Every contribution carries a `stage`:
17973
- * - `primary` — shown on the first credentials screen (OIDC /
17974
- * magic-link buttons; a future usernameless passkey).
18853
+ * - `primary` — shown on the first credentials screen (OIDC
18854
+ * buttons; a usernameless passkey).
17975
18855
  * - `second-factor` — shown AFTER the password leg, gated on the
17976
18856
  * returned `factors` (passkey-as-2FA today).
17977
18857
  *
@@ -17998,7 +18878,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17998
18878
  * The provider names an external identity a signed-in user can link to
17999
18879
  * their own account (D782): `auth.listLinkableProviders` /
18000
18880
  * `beginExternalLink` offer exactly the redirect methods that set this,
18001
- * whatever their id. Absent / false — a login button only (magic-link).
18881
+ * whatever their id. Absent / false — a login button only.
18002
18882
  */
18003
18883
  linkable: boolean().optional()
18004
18884
  }),
@@ -18786,7 +19666,7 @@ var TargetKindCapsSchema = object({
18786
19666
  * the union is large and not meant for runtime validation here; the exported
18787
19667
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
18788
19668
  */
18789
- var ConfigSchemaPassthrough = unknown();
19669
+ var ConfigSchemaPassthrough$2 = unknown();
18790
19670
  var TargetKindSchema = object({
18791
19671
  kind: string(),
18792
19672
  label: string(),
@@ -18823,7 +19703,7 @@ var TargetKindSchema = object({
18823
19703
  * its raster path, which is the safe default for an unknown image.
18824
19704
  */
18825
19705
  iconMediaType: string().optional(),
18826
- configSchema: ConfigSchemaPassthrough,
19706
+ configSchema: ConfigSchemaPassthrough$2,
18827
19707
  /**
18828
19708
  * The config keys that decide WHERE this kind's secrets are sent (server,
18829
19709
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -21853,8 +22733,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21853
22733
  * `super_admin` — collapsed onto the single boolean because every
21854
22734
  * non-admin caller is governed by the same scope-check rules; the
21855
22735
  * distinction was only ever used to route role-specific procedures
21856
- * which we no longer have. Agents are admin sessions issued via
21857
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22736
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21858
22737
  * with `isAdmin: false` + an explicit scope list.
21859
22738
  */
21860
22739
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -22161,6 +23040,61 @@ var OauthIntegrationDescriptorSchema = object({
22161
23040
  });
22162
23041
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
22163
23042
  /**
23043
+ * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
23044
+ *
23045
+ * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
23046
+ * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
23047
+ * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
23048
+ * immutable after create.
23049
+ */
23050
+ var ConfigSchemaPassthrough$1 = unknown();
23051
+ var OidcConnectionSchema = object({
23052
+ id: string().min(1),
23053
+ displayName: string(),
23054
+ icon: string(),
23055
+ issuerUrl: string(),
23056
+ clientId: string(),
23057
+ /** Client id + secret present — never the secret value. */
23058
+ configured: boolean(),
23059
+ /**
23060
+ * Values for the connection form schema. `clientSecret` is a keychain
23061
+ * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
23062
+ */
23063
+ formValues: record(string(), unknown()).optional()
23064
+ });
23065
+ /**
23066
+ * Patch one connection. Omitted or empty `clientSecret` keeps the stored
23067
+ * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
23068
+ */
23069
+ var OidcConnectionUpdateInputSchema = object({
23070
+ id: string().min(1),
23071
+ displayName: string().min(1),
23072
+ icon: string().optional(),
23073
+ issuerUrl: string().optional(),
23074
+ clientId: string().optional(),
23075
+ clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
23076
+ redirectUri: string().optional(),
23077
+ scopes: string().optional(),
23078
+ usernameClaim: _enum([
23079
+ "preferred_username",
23080
+ "email",
23081
+ "sub"
23082
+ ]).optional()
23083
+ });
23084
+ method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
23085
+ id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
23086
+ displayName: string().min(1)
23087
+ }), object({ id: string() }), {
23088
+ kind: "mutation",
23089
+ auth: "admin"
23090
+ }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
23091
+ kind: "mutation",
23092
+ auth: "admin"
23093
+ }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
23094
+ kind: "mutation",
23095
+ auth: "admin"
23096
+ });
23097
+ /**
22164
23098
  * What started a camera's onboard motion (D672). `camera` is the camera's own
22165
23099
  * firmware; `sensor` is a device the operator ATTACHED to it. Absent on the
22166
23100
  * wire means the camera: only the camera-sensors bridge ever says `sensor`.
@@ -23517,21 +24451,69 @@ var RetrainFrameListSchema = object({
23517
24451
  /** What the page pre-selects — the native key frame when one survives. */
23518
24452
  autoPickMediaId: number().int().optional()
23519
24453
  });
24454
+ /** Exclusive partition of a corpus copy's annotation progress (design §4.2). */
24455
+ var RetrainFrameWorkStateSchema = _enum([
24456
+ "unannotated",
24457
+ "annotated",
24458
+ "complete"
24459
+ ]);
24460
+ /**
24461
+ * Filters for paginated corpus list, KPI, and matching export (design §4.4).
24462
+ * Every narrowing field is ANDed; omitted fields impose no constraint.
24463
+ */
24464
+ var RetrainCorpusFilterSchema = object({
24465
+ workState: RetrainFrameWorkStateSchema.optional(),
24466
+ deviceIds: array(number()).max(500).optional(),
24467
+ /** When set, only frames in this named collection. */
24468
+ collectionId: string().optional(),
24469
+ /** Frames that carry at least one saved annotation in one of these classes. */
24470
+ classes: array(RetrainMacroClassSchema).optional(),
24471
+ page: number().int().positive().default(1),
24472
+ pageSize: number().int().positive().max(100).default(50)
24473
+ });
24474
+ var RetrainCorpusPageSchema = object({
24475
+ frames: array(RetrainFrameSchema.extend({ workState: RetrainFrameWorkStateSchema })).readonly(),
24476
+ total: number().int().nonnegative(),
24477
+ page: number().int().positive(),
24478
+ pageSize: number().int().positive()
24479
+ });
24480
+ var RetrainCorpusKpiCameraRowSchema = object({
24481
+ deviceId: number(),
24482
+ unannotated: number().int().nonnegative(),
24483
+ annotated: number().int().nonnegative(),
24484
+ complete: number().int().nonnegative(),
24485
+ /** This camera's `complete` count divided by corpus `total`, in `[0,1]`.
24486
+ * `null` when the corpus is empty (no ratio). */
24487
+ pctOfCorpus: number().min(0).max(1).nullable()
24488
+ });
24489
+ var RetrainCorpusKpiSchema = object({
24490
+ total: number().int().nonnegative(),
24491
+ unannotated: number().int().nonnegative(),
24492
+ annotated: number().int().nonnegative(),
24493
+ complete: number().int().nonnegative(),
24494
+ cameras: array(RetrainCorpusKpiCameraRowSchema).readonly()
24495
+ });
23520
24496
  /**
23521
24497
  * Which frames an annotated export carries. Every field narrows; an empty
23522
- * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23523
- * list owned by whoever trains (the training orchestrator), so `frameIds` is
23524
- * the primitive a version export uses; `batchId` re-selects what an earlier
23525
- * export carried (`exportedInBatch`).
24498
+ * filter is every annotated copy. `frameIds` is the primitive a job or
24499
+ * download uses; `batchId` re-selects what an earlier export carried
24500
+ * (`exportedInBatch`). Frozen dataset versions were removed — live selection
24501
+ * resolves to `frameIds` at plan/start.
23526
24502
  */
23527
24503
  var RetrainExportFilterSchema = object({
23528
24504
  deviceIds: array(number()).optional(),
23529
24505
  frameIds: array(string()).max(2e4).optional(),
23530
24506
  /** Only frames in at least one of these named collections. */
23531
24507
  collectionIds: array(string()).max(200).optional(),
24508
+ /** Single collection (Frames filter bar). ANDed with `collectionIds` when both set. */
24509
+ collectionId: string().optional(),
23532
24510
  batchId: string().optional(),
23533
24511
  /** Only frames the operator marked complete (all subjects boxed). */
23534
- completeOnly: boolean().optional()
24512
+ completeOnly: boolean().optional(),
24513
+ /** Exclusive work-state partition (`workStateOf`); same as the corpus list. */
24514
+ workState: RetrainFrameWorkStateSchema.optional(),
24515
+ /** Frames with at least one saved annotation in one of these classes. */
24516
+ classes: array(RetrainMacroClassSchema).optional()
23535
24517
  });
23536
24518
  /**
23537
24519
  * `frames`: the full frame copies, boxes in `annotations.json`.
@@ -23696,6 +24678,77 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23696
24678
  ]),
23697
24679
  detail: string().optional()
23698
24680
  })]);
24681
+ /** What a dataset version is cut from. Every field narrows. */
24682
+ var RetrainDatasetSelectionSchema = object({
24683
+ deviceIds: array(number()).readonly().optional(),
24684
+ collectionIds: array(string()).max(200).readonly().optional(),
24685
+ frameIds: array(string()).max(2e4).readonly().optional()
24686
+ });
24687
+ /** The counts a dataset is judged by. */
24688
+ var RetrainDatasetStatsSchema = object({
24689
+ frames: number().int(),
24690
+ completeFrames: number().int(),
24691
+ /** `completeFrames / frames`, 0..1. */
24692
+ completeness: number(),
24693
+ /** Boxes to learn (model errors excluded). */
24694
+ subjects: number().int(),
24695
+ modelErrors: number().int(),
24696
+ /** Complete frames with no subject. */
24697
+ hardNegatives: number().int(),
24698
+ /** Subjects per class × camera × day/night. */
24699
+ cells: array(object({
24700
+ macroClass: string(),
24701
+ deviceId: number(),
24702
+ lighting: _enum([
24703
+ "day",
24704
+ "night",
24705
+ "unknown"
24706
+ ]),
24707
+ subjects: number().int(),
24708
+ frames: number().int()
24709
+ })).readonly(),
24710
+ cameras: array(object({
24711
+ deviceId: number(),
24712
+ frames: number().int(),
24713
+ completeFrames: number().int()
24714
+ })).readonly()
24715
+ });
24716
+ object({
24717
+ id: string(),
24718
+ name: string(),
24719
+ createdAt: number(),
24720
+ selection: RetrainDatasetSelectionSchema,
24721
+ layout: RetrainExportLayoutSchema,
24722
+ completeOnly: boolean(),
24723
+ frameCount: number().int(),
24724
+ annotationHash: string(),
24725
+ manifestSchema: string(),
24726
+ stats: RetrainDatasetStatsSchema
24727
+ });
24728
+ /**
24729
+ * Live training corpus criteria — same shape as `TrainingCorpusSelection` on
24730
+ * the training cap. Resolved here so plan/start and the annotated export share
24731
+ * one definition of "the frames" (`buildRetrainExportPlan`).
24732
+ */
24733
+ var RetrainTrainingCorpusSelectionSchema = object({
24734
+ collectionIds: array(string()).min(1),
24735
+ workState: _enum([
24736
+ "complete",
24737
+ "annotated_or_complete",
24738
+ "any_annotated"
24739
+ ]).default("complete")
24740
+ });
24741
+ var RetrainTrainingCorpusResolveResultSchema = discriminatedUnion("kind", [object({
24742
+ kind: literal("resolved"),
24743
+ frameIds: array(string()).max(2e4).readonly(),
24744
+ stats: RetrainDatasetStatsSchema,
24745
+ annotationHash: string(),
24746
+ layout: RetrainExportLayoutSchema
24747
+ }), object({
24748
+ kind: literal("refused"),
24749
+ reason: _enum(["unknown-collection", "no-frames"]),
24750
+ detail: string()
24751
+ })]);
23699
24752
  /** The outcome of a lifecycle move owned by the retrain page. */
23700
24753
  var RetrainTransitionResultSchema = object({
23701
24754
  trackId: string(),
@@ -24401,6 +25454,12 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24401
25454
  }), array(RetrainTrackSchema).readonly(), {
24402
25455
  kind: "query",
24403
25456
  auth: "admin"
25457
+ }), method(RetrainCorpusFilterSchema, RetrainCorpusPageSchema, {
25458
+ kind: "query",
25459
+ auth: "admin"
25460
+ }), method(object({}), RetrainCorpusKpiSchema, {
25461
+ kind: "query",
25462
+ auth: "admin"
24404
25463
  }), method(object({ trackId: string() }), RetrainFrameListSchema, {
24405
25464
  kind: "query",
24406
25465
  auth: "admin"
@@ -24485,6 +25544,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24485
25544
  kind: "mutation",
24486
25545
  auth: "admin",
24487
25546
  timeoutMs: 60 * 6e4
25547
+ }), method(object({
25548
+ filter: RetrainExportFilterSchema,
25549
+ layout: RetrainExportLayoutSchema
25550
+ }), object({
25551
+ ticket: PeerBytesTicketSchema,
25552
+ frames: number().int(),
25553
+ annotations: number().int()
25554
+ }), {
25555
+ kind: "mutation",
25556
+ auth: "admin",
25557
+ timeoutMs: 12e4
24488
25558
  }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24489
25559
  kind: "query",
24490
25560
  auth: "admin"
@@ -24511,6 +25581,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24511
25581
  }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24512
25582
  kind: "query",
24513
25583
  auth: "admin"
25584
+ }), method(RetrainTrainingCorpusSelectionSchema, RetrainTrainingCorpusResolveResultSchema, {
25585
+ kind: "query",
25586
+ auth: "admin",
25587
+ timeoutMs: 6e4
24514
25588
  }), method(object({
24515
25589
  id: string(),
24516
25590
  name: string().max(120)
@@ -25127,11 +26201,14 @@ var HardwareClassIdSchema = _enum([
25127
26201
  "intel-n-series",
25128
26202
  "apple-m-base",
25129
26203
  "apple-m-pro",
26204
+ "amd-phoenix",
25130
26205
  "unknown"
25131
26206
  ]);
25132
26207
  var AcceleratorKindSchema = _enum([
25133
26208
  "intel-npu",
25134
26209
  "intel-igpu",
26210
+ "amd-igpu",
26211
+ "amd-npu",
25135
26212
  "x86-cpu",
25136
26213
  "arm-cpu",
25137
26214
  "apple-ane",
@@ -27061,6 +28138,8 @@ var AgentPipelineSettingsSchema = object({
27061
28138
  * address is wrong (multi-homed host, NAT, custom interface).
27062
28139
  */
27063
28140
  reachableHost: string().optional(),
28141
+ /** Hub-persisted UI colour (`--color-node-*` theme tokens). */
28142
+ color: NodeColorIdSchema.optional(),
27064
28143
  /**
27065
28144
  * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
27066
28145
  * weight, steps}. Absent / all-disabled ⇒ the node's single default
@@ -27610,8 +28689,9 @@ method(object({
27610
28689
  auth: "admin"
27611
28690
  }), method(object({
27612
28691
  agentNodeId: string(),
27613
- reachableHost: string().nullable()
27614
- }), object({ success: literal(true) }), {
28692
+ reachableHost: string().nullable().optional(),
28693
+ color: NodeColorIdSchema.nullable().optional()
28694
+ }).refine((v) => v.reachableHost !== void 0 || v.color !== void 0, { message: "reachableHost or color required" }), object({ success: literal(true) }), {
27615
28695
  kind: "mutation",
27616
28696
  auth: "admin"
27617
28697
  }), method(object({
@@ -28063,8 +29143,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
28063
29143
  * `smtp-provider` — pluggable email delivery surface.
28064
29144
  *
28065
29145
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
28066
- * one for transactional / one for notifications). Consumers (magic-link,
28067
- * notifier addons, …) walk the collection and pick the first
29146
+ * one for transactional / one for notifications). Consumers (notifier
29147
+ * addons, …) walk the collection and pick the first
28068
29148
  * ready provider OR target a specific addonId.
28069
29149
  *
28070
29150
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -28243,7 +29323,7 @@ targets: array(object({
28243
29323
  })));
28244
29324
  /**
28245
29325
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
28246
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
29326
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
28247
29327
  * carrying the post-callback claims before redirecting back to
28248
29328
  * `/api/auth/sso/finish`.
28249
29329
  *
@@ -28306,7 +29386,14 @@ var SsoBridgeClaimsSchema = object({
28306
29386
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28307
29387
  * subject is unique only per issuer, so a link is bound to it.
28308
29388
  */
28309
- issuer: string().optional()
29389
+ issuer: string().optional(),
29390
+ /**
29391
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
29392
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
29393
+ * request to present the matching cookie — a login bridge is useless in
29394
+ * any other browser.
29395
+ */
29396
+ browserBinding: string().optional()
28310
29397
  });
28311
29398
  method(object({
28312
29399
  claims: SsoBridgeClaimsSchema,
@@ -30680,7 +31767,7 @@ var CustomActionInputSchema = object({
30680
31767
  action: string().min(1),
30681
31768
  input: unknown()
30682
31769
  });
30683
- method(_void(), array(AddonListItemSchema).readonly()), method(object({
31770
+ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSchema).readonly()), method(object({
30684
31771
  addonId: string(),
30685
31772
  limit: number().min(1).max(500).default(100),
30686
31773
  level: LogLevelSchema$2.optional()
@@ -35742,7 +36829,13 @@ var TopologyNodeSchema = object({
35742
36829
  })).readonly(),
35743
36830
  processes: array(TopologyProcessSchema).readonly(),
35744
36831
  categories: array(TopologyCategorySchema).readonly(),
35745
- rootPackage: TopologyRootPackageSchema.nullable()
36832
+ rootPackage: TopologyRootPackageSchema.nullable(),
36833
+ /**
36834
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
36835
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
36836
+ * for offline rows and when the hub cannot tell.
36837
+ */
36838
+ meshTransport: _enum(["tls", "clear"]).optional()
35746
36839
  });
35747
36840
  var CapUsageEdgeSchema = object({
35748
36841
  callerAddonId: string(),
@@ -36155,6 +37248,7 @@ var OsdNamedTemplateSchema = object({
36155
37248
  });
36156
37249
  /** Where a slot's value comes from. */
36157
37250
  var OsdSourceSchema = discriminatedUnion("kind", [
37251
+ object({ kind: literal("none") }),
36158
37252
  object({
36159
37253
  kind: literal("static"),
36160
37254
  text: string().max(64)
@@ -36281,6 +37375,13 @@ method(object({ deviceId: number().int() }), object({
36281
37375
  }), object({ success: literal(true) }), {
36282
37376
  kind: "mutation",
36283
37377
  auth: "admin"
37378
+ }), method(object({
37379
+ deviceId: number().int(),
37380
+ slotId: string().min(1),
37381
+ enabled: boolean()
37382
+ }), object({ success: literal(true) }), {
37383
+ kind: "mutation",
37384
+ auth: "admin"
36284
37385
  }), method(object({
36285
37386
  sourceDeviceId: number().int(),
36286
37387
  targetDeviceId: number().int()
@@ -36712,7 +37813,15 @@ var GpuInfoSchema = object({
36712
37813
  name: string(),
36713
37814
  memoryMB: number().optional()
36714
37815
  });
36715
- var NpuInfoSchema = object({ type: _enum(["apple-ane", "intel-npu"]) });
37816
+ var NpuInfoSchema = object({
37817
+ type: _enum([
37818
+ "apple-ane",
37819
+ "intel-npu",
37820
+ "amd-xdna"
37821
+ ]),
37822
+ name: string().optional(),
37823
+ generation: _enum(["xdna1", "xdna2"]).optional()
37824
+ });
36716
37825
  var CoralInfoSchema = object({
36717
37826
  type: literal("coral-edgetpu"),
36718
37827
  bus: string().optional()
@@ -40565,16 +41674,6 @@ var ApiKeySummarySchema = object({
40565
41674
  createdAt: number(),
40566
41675
  lastUsedAt: number().optional()
40567
41676
  });
40568
- var CreateApiKeyInputSchema = object({
40569
- label: string(),
40570
- isAdmin: boolean().default(false),
40571
- allowedProviders: union([array(string()), literal("*")]).optional(),
40572
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
40573
- });
40574
- var CreateApiKeyResultSchema = object({
40575
- token: string(),
40576
- record: ApiKeySummarySchema
40577
- });
40578
41677
  var ScopedTokenSummarySchema = object({
40579
41678
  id: string(),
40580
41679
  userId: string(),
@@ -40673,17 +41772,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40673
41772
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
40674
41773
  kind: "mutation",
40675
41774
  access: "view"
40676
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
40677
- kind: "mutation",
40678
- auth: "admin",
40679
- access: "create"
40680
- }), method(object({ id: string() }), object({ success: literal(true) }), {
41775
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
40681
41776
  kind: "mutation",
40682
41777
  auth: "admin",
40683
41778
  access: "delete"
40684
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
40685
- kind: "mutation",
40686
- access: "view"
40687
41779
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
40688
41780
  kind: "mutation",
40689
41781
  auth: "admin",
@@ -40757,15 +41849,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40757
41849
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
40758
41850
  userId: string(),
40759
41851
  issuer: string()
40760
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
40761
- userId: string(),
40762
- issuer: string().min(1),
40763
- label: string().optional()
40764
- }), object({ success: literal(true) }), {
40765
- kind: "mutation",
40766
- auth: "admin",
40767
- access: "create"
40768
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41852
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
40769
41853
  kind: "mutation",
40770
41854
  auth: "admin",
40771
41855
  access: "delete"
@@ -41470,6 +42554,563 @@ var zoneRulesCapability = {
41470
42554
  */
41471
42555
  durability: "restored"
41472
42556
  };
42557
+ /**
42558
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
42559
+ *
42560
+ * A thin, mockable translation layer: it knows how to run a container with a
42561
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
42562
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
42563
+ * those are the `training` orchestrator's (D805). Every rule written there
42564
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
42565
+ * manifest entry and nothing else.
42566
+ *
42567
+ * Collection of provider **types** (addons). Each addon owns zero or more
42568
+ * **entries** (credentials + defaults). Concat-fans: `describe`,
42569
+ * `describeTypes`, `listEntries`, `listJobs`. Single-row work is keyed by
42570
+ * `entryId`; callers also pass the owning `addonId` as the collection
42571
+ * selector (broker posture). Every method is `admin`: these spend money.
42572
+ *
42573
+ * Every cloud object a provider creates is tagged with the orchestrator's
42574
+ * `jobKey`, so a retried submit finds the job it already started instead of
42575
+ * starting a second GPU, and `listJobs` can find orphans.
42576
+ *
42577
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
42578
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
42579
+ * ticket the provider mints (D613).
42580
+ */
42581
+ var TrainingGpuOptionSchema = object({
42582
+ id: string(),
42583
+ label: string(),
42584
+ /** List price, USD per GPU-hour, before any region multiplier. */
42585
+ usdPerHour: number().nonnegative(),
42586
+ vramGb: number().nonnegative()
42587
+ });
42588
+ var TrainingRegionOptionSchema = object({
42589
+ /** `''` = any region (the provider's choice). */
42590
+ id: string(),
42591
+ label: string(),
42592
+ priceMultiplier: number().positive()
42593
+ });
42594
+ /**
42595
+ * The provider's per-entry settings, as the orchestrator reads them. They
42596
+ * live on the PROVIDER addon's entry (operator decision 2026-10-08: they
42597
+ * depend on the user's account), never hard-coded in the orchestrator.
42598
+ */
42599
+ var TrainingProviderDefaultsSchema = object({
42600
+ gpuType: string(),
42601
+ region: string(),
42602
+ costCapUsd: number().nonnegative(),
42603
+ maxRuntimeSec: number().int().positive(),
42604
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
42605
+ failedDatasetGraceHours: number().nonnegative()
42606
+ });
42607
+ /**
42608
+ * Entry form schema for a provider type — same seam as notification
42609
+ * `TargetKind.configSchema` (`z.unknown()` at the wire; callers tighten to
42610
+ * {@link ConfigUISchema}). Drives `ConfigFormBuilder` on Training → Providers.
42611
+ */
42612
+ var ConfigSchemaPassthrough = unknown();
42613
+ /** One creatable provider type, for the Add-entry dialog. */
42614
+ var TrainingProviderTypeSchema = object({
42615
+ typeId: string(),
42616
+ label: string(),
42617
+ /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
42618
+ iconAsset: string(),
42619
+ /** Owning `training-provider` addon — collection selector for createEntry. */
42620
+ addonId: string(),
42621
+ /**
42622
+ * Fields for one entry of this type (credentials + defaults). Absent on a
42623
+ * type that only needs a name. Password fields are keychain-backed on the
42624
+ * provider addon (`secretStatePaths`), not D634 plaintext.
42625
+ */
42626
+ configSchema: ConfigSchemaPassthrough.optional()
42627
+ });
42628
+ /** One configured account / workspace under a provider type. */
42629
+ var TrainingProviderEntrySchema = object({
42630
+ entryId: string(),
42631
+ typeId: string(),
42632
+ name: string(),
42633
+ addonId: string(),
42634
+ /** Credentials are present — never the values. */
42635
+ configured: boolean()
42636
+ });
42637
+ var TrainingProviderDescriptorSchema = object({
42638
+ addonId: string(),
42639
+ entryId: string(),
42640
+ typeId: string(),
42641
+ /** Operator-chosen entry name. */
42642
+ name: string(),
42643
+ iconAsset: string(),
42644
+ /** `modal`, `runpod`, `fake`, … — same as typeId for current providers. */
42645
+ kind: string(),
42646
+ label: string(),
42647
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
42648
+ regions: array(TrainingRegionOptionSchema).readonly(),
42649
+ maxDatasetBytes: number().int().positive(),
42650
+ maxRuntimeSec: number().int().positive(),
42651
+ freeTierNote: string().optional(),
42652
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
42653
+ dataResidencyNote: string(),
42654
+ /** Credentials are present — never the values. */
42655
+ configured: boolean(),
42656
+ defaults: TrainingProviderDefaultsSchema,
42657
+ /**
42658
+ * Values for {@link TrainingProviderTypeSchema}'s `configSchema` — password
42659
+ * fields are keychain {@link SecretFieldView} or `null` / `''` (create),
42660
+ * never plaintext. Same hydrate contract as settings forms (D789).
42661
+ */
42662
+ formValues: record(string(), unknown()).optional()
42663
+ });
42664
+ /**
42665
+ * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
42666
+ * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
42667
+ * `{ $secretClear: true }` clears it.
42668
+ */
42669
+ var TrainingProviderUpdateEntryInputSchema = object({
42670
+ entryId: string().min(1),
42671
+ name: string().min(1),
42672
+ tokenId: string().optional(),
42673
+ tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
42674
+ environment: string().optional(),
42675
+ gpuType: string().optional(),
42676
+ region: string().optional(),
42677
+ costCapUsd: number().nonnegative().optional(),
42678
+ maxRuntimeSec: number().int().positive().optional(),
42679
+ failedDatasetGraceHours: number().nonnegative().optional()
42680
+ });
42681
+ var TrainingCredentialCheckSchema = object({
42682
+ ok: boolean(),
42683
+ /** Workspace / account name, when the provider says. */
42684
+ account: string().optional(),
42685
+ reason: _enum([
42686
+ "missing",
42687
+ "invalid",
42688
+ "forbidden",
42689
+ "network",
42690
+ "quota"
42691
+ ]).optional(),
42692
+ detail: string().optional()
42693
+ });
42694
+ var ProviderJobStateSchema = _enum([
42695
+ "pending",
42696
+ "starting",
42697
+ "running",
42698
+ "succeeded",
42699
+ "failed",
42700
+ "cancelled",
42701
+ "lost"
42702
+ ]);
42703
+ var ProviderJobStatusSchema = object({
42704
+ jobKey: string(),
42705
+ providerJobId: string().optional(),
42706
+ state: ProviderJobStateSchema,
42707
+ startedAt: number().optional(),
42708
+ endedAt: number().optional(),
42709
+ exitCode: number().int().optional(),
42710
+ failureReason: string().optional(),
42711
+ gpuType: string(),
42712
+ region: string().optional(),
42713
+ billedSeconds: number().nonnegative(),
42714
+ costUsd: number().nonnegative(),
42715
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
42716
+ costIsEstimate: boolean(),
42717
+ lastFetchedAt: number()
42718
+ });
42719
+ /**
42720
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
42721
+ * image its own way (Modal builds the published Dockerfile at that revision;
42722
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
42723
+ * in `result.json`.
42724
+ */
42725
+ var TrainerSourceRefSchema = object({
42726
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
42727
+ repo: string().min(1),
42728
+ /** A commit sha (never a branch) — the job must be reproducible. */
42729
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
42730
+ });
42731
+ /** Cloud job identity — route with the owning addon's `addonId` selector. */
42732
+ var JobRef = {
42733
+ entryId: string().min(1),
42734
+ jobKey: string().uuid()
42735
+ };
42736
+ var TrainingLogLineSchema = object({
42737
+ ts: number(),
42738
+ text: string()
42739
+ });
42740
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
42741
+ typeId: string().min(1),
42742
+ name: string().min(1)
42743
+ }), object({ entryId: string() }), {
42744
+ kind: "mutation",
42745
+ auth: "admin"
42746
+ }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
42747
+ kind: "mutation",
42748
+ auth: "admin"
42749
+ }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
42750
+ kind: "mutation",
42751
+ auth: "admin"
42752
+ }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
42753
+ kind: "mutation",
42754
+ auth: "admin",
42755
+ timeoutMs: 3e4
42756
+ }), method(object({
42757
+ entryId: string().min(1),
42758
+ gpuType: string(),
42759
+ region: string(),
42760
+ datasetBytes: number().int().nonnegative(),
42761
+ gpuSecondsLow: number().nonnegative(),
42762
+ gpuSecondsHigh: number().nonnegative()
42763
+ }), object({
42764
+ usdLow: number().nonnegative(),
42765
+ usdHigh: number().nonnegative(),
42766
+ notes: array(string()).readonly()
42767
+ }), { auth: "admin" }), method(object({
42768
+ ...JobRef,
42769
+ ticket: PeerBytesTicketSchema
42770
+ }), object({
42771
+ bytes: number().int().nonnegative(),
42772
+ sha256: string()
42773
+ }), {
42774
+ kind: "mutation",
42775
+ auth: "admin",
42776
+ timeoutMs: 120 * 6e4
42777
+ }), method(object({
42778
+ ...JobRef,
42779
+ trainer: TrainerSourceRefSchema,
42780
+ jobSpecJson: string().min(2).max(64e3),
42781
+ gpuType: string(),
42782
+ region: string(),
42783
+ maxRuntimeSec: number().int().positive()
42784
+ }), ProviderJobStatusSchema, {
42785
+ kind: "mutation",
42786
+ auth: "admin",
42787
+ timeoutMs: 30 * 6e4
42788
+ }), method(object(JobRef), ProviderJobStatusSchema, {
42789
+ auth: "admin",
42790
+ timeoutMs: 6e4
42791
+ }), method(object({
42792
+ ...JobRef,
42793
+ cursor: string().optional(),
42794
+ max: number().int().min(1).max(500)
42795
+ }), object({
42796
+ lines: array(TrainingLogLineSchema).readonly(),
42797
+ cursor: string()
42798
+ }), {
42799
+ auth: "admin",
42800
+ timeoutMs: 6e4
42801
+ }), method(object(JobRef), object({ ok: literal(true) }), {
42802
+ kind: "mutation",
42803
+ auth: "admin",
42804
+ timeoutMs: 6e4
42805
+ }), method(object(JobRef), object({
42806
+ found: boolean(),
42807
+ text: string().optional()
42808
+ }), {
42809
+ kind: "mutation",
42810
+ auth: "admin",
42811
+ timeoutMs: 5 * 6e4
42812
+ }), method(object({
42813
+ ...JobRef,
42814
+ path: _enum(["bundle.tar"])
42815
+ }), object({ ticket: PeerBytesTicketSchema }), {
42816
+ kind: "mutation",
42817
+ auth: "admin",
42818
+ timeoutMs: 5 * 6e4
42819
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
42820
+ kind: "mutation",
42821
+ auth: "admin",
42822
+ timeoutMs: 5 * 6e4
42823
+ }), method(object({ entryId: string().min(1).optional() }), array(ProviderJobStatusSchema).readonly(), {
42824
+ auth: "admin",
42825
+ timeoutMs: 2 * 6e4
42826
+ });
42827
+ /**
42828
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
42829
+ * provided by `addon-training`.
42830
+ *
42831
+ * It owns what every provider must agree on, written once:
42832
+ *
42833
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
42834
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
42835
+ * - **The return flow.** Verified artefacts → Model Studio
42836
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
42837
+ * rollback. Nothing is ever registered automatically.
42838
+ *
42839
+ * Plan/start takes a live {@link TrainingCorpusSelection} (collections +
42840
+ * work-state rule); frame ids are resolved via pipeline-analytics at that
42841
+ * moment and snapshotted on the job. No frozen dataset version.
42842
+ *
42843
+ * Every method is `admin`.
42844
+ */
42845
+ /**
42846
+ * Live corpus criteria for plan/start (design §5.2). Default is complete-only.
42847
+ * Frame ids are resolved at plan/start — never a frozen version id.
42848
+ */
42849
+ var TrainingCorpusSelectionSchema = object({
42850
+ collectionIds: array(string()).min(1),
42851
+ /** Default complete-only for v1 */
42852
+ workState: _enum([
42853
+ "complete",
42854
+ "annotated_or_complete",
42855
+ "any_annotated"
42856
+ ]).default("complete")
42857
+ });
42858
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
42859
+ var TrainingBaseModelSchema = object({
42860
+ modelId: string(),
42861
+ label: string(),
42862
+ weights: string(),
42863
+ imgsz: number().int(),
42864
+ baselineOnnxUrl: string(),
42865
+ baselineFloors: record(string(), number()),
42866
+ /** The base the fleet runs most — the UI's default. */
42867
+ recommended: boolean()
42868
+ });
42869
+ var TrainingPresetSchema = _enum([
42870
+ "quick",
42871
+ "standard",
42872
+ "thorough"
42873
+ ]);
42874
+ var TrainingJobRequestSchema = object({
42875
+ /** Live collection + work-state criteria; resolved at plan/start. */
42876
+ selection: TrainingCorpusSelectionSchema,
42877
+ /**
42878
+ * The provider **entry** that runs it (credentials + defaults).
42879
+ * Resolve to an owning addon via `training-provider.describe` / `listEntries`.
42880
+ */
42881
+ entryId: string().min(1),
42882
+ gpuType: string().min(1),
42883
+ region: string(),
42884
+ baseModelId: string().min(1),
42885
+ preset: TrainingPresetSchema,
42886
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
42887
+ freeze: number().int().nonnegative().nullable(),
42888
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
42889
+ holdoutCameras: array(number().int()).nullable()
42890
+ });
42891
+ var TrainingSplitPlanSchema = object({
42892
+ holdoutCameras: array(number().int()).readonly(),
42893
+ /** Used when no camera is held out: the last N days of every camera. */
42894
+ holdoutLastDays: number().int().nonnegative(),
42895
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
42896
+ holdoutSupport: record(string(), number().int()).nullable(),
42897
+ trainSubjects: number().int()
42898
+ });
42899
+ var TrainingRefusalReasonSchema = _enum([
42900
+ "unknown-dataset",
42901
+ "unknown-provider",
42902
+ "provider-not-configured",
42903
+ "unknown-base-model",
42904
+ "unknown-gpu",
42905
+ "dataset-too-large",
42906
+ "no-training-subjects",
42907
+ "job-already-running"
42908
+ ]);
42909
+ var TrainingJobPlanSchema = object({
42910
+ refusal: object({
42911
+ reason: TrainingRefusalReasonSchema,
42912
+ detail: string()
42913
+ }).nullable(),
42914
+ warnings: array(string()).readonly(),
42915
+ split: TrainingSplitPlanSchema.nullable(),
42916
+ estimate: object({
42917
+ datasetBytes: number().int(),
42918
+ uploadMinutesAt20Mbps: number(),
42919
+ gpuSecondsLow: number(),
42920
+ gpuSecondsHigh: number(),
42921
+ usdLow: number(),
42922
+ usdHigh: number(),
42923
+ notes: array(string()).readonly()
42924
+ }).nullable(),
42925
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
42926
+ defaults: object({
42927
+ maxCostUsd: number(),
42928
+ maxRuntimeSec: number().int()
42929
+ }).nullable(),
42930
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
42931
+ dataNotice: string()
42932
+ });
42933
+ /**
42934
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
42935
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
42936
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
42937
+ * result lives after the operator acted on it.
42938
+ */
42939
+ var TrainingJobStateSchema = _enum([
42940
+ "queued",
42941
+ "uploading",
42942
+ "submitted",
42943
+ "starting",
42944
+ "running",
42945
+ "collecting",
42946
+ "ready",
42947
+ "registered",
42948
+ "canary",
42949
+ "failed",
42950
+ "cancelling",
42951
+ "cancelled",
42952
+ "lost",
42953
+ "expired",
42954
+ "discarded"
42955
+ ]);
42956
+ var TrainingFailureReasonSchema = _enum([
42957
+ "cost-cap",
42958
+ "runtime-cap",
42959
+ "upload-failed",
42960
+ "submit-failed",
42961
+ "trainer-failed",
42962
+ "result-invalid",
42963
+ "checksum-mismatch",
42964
+ "fetch-failed",
42965
+ "provider-error",
42966
+ "hub-restart-during-upload"
42967
+ ]);
42968
+ var TrainingProgressPointSchema = object({
42969
+ epoch: number().int(),
42970
+ map50: number().nullable(),
42971
+ map50_95: number().nullable()
42972
+ });
42973
+ var TrainingCanarySchema = object({
42974
+ deviceIds: array(number().int()).readonly(),
42975
+ since: number(),
42976
+ /** Every override the canary replaced, exactly, so rollback restores it. */
42977
+ previous: array(object({
42978
+ deviceId: number().int(),
42979
+ nodeId: string(),
42980
+ deviceKey: string(),
42981
+ patch: object({
42982
+ modelId: string().optional(),
42983
+ settings: record(string(), unknown()).readonly().optional()
42984
+ }).nullable()
42985
+ })).readonly()
42986
+ });
42987
+ var TrainingJobSchema = object({
42988
+ id: string(),
42989
+ idempotencyKey: string(),
42990
+ name: string(),
42991
+ createdAt: number(),
42992
+ updatedAt: number(),
42993
+ state: TrainingJobStateSchema,
42994
+ /**
42995
+ * Shared by every job enqueued together via `startJobBatch`.
42996
+ * `null` for a lone `startJob`. The engine advances queued siblings by this id.
42997
+ */
42998
+ batchId: string().nullable().default(null),
42999
+ stage: TrainingStageSchema.nullable(),
43000
+ failure: object({
43001
+ reason: TrainingFailureReasonSchema,
43002
+ stage: string().nullable(),
43003
+ detail: string()
43004
+ }).nullable(),
43005
+ request: TrainingJobRequestSchema,
43006
+ maxCostUsd: number().nonnegative(),
43007
+ maxRuntimeSec: number().int().positive(),
43008
+ trainer: TrainerSourceRefSchema,
43009
+ datasetLayout: RetrainExportLayoutSchema,
43010
+ /** Frame count snapshotted when the job started (audit; equals `frameIds.length`). */
43011
+ frameCount: number().int().nonnegative(),
43012
+ /** Resolved frame ids at start — the archive ships exactly these. */
43013
+ frameIds: array(string()).max(2e4).readonly(),
43014
+ /** Hash of what those frames taught at start (trainer `dataset.annotationHash`). */
43015
+ annotationHash: string(),
43016
+ dataset: object({
43017
+ bytes: number().int(),
43018
+ sha256: string(),
43019
+ uploadedAt: number()
43020
+ }).nullable(),
43021
+ split: TrainingSplitPlanSchema,
43022
+ provider: object({
43023
+ state: ProviderJobStateSchema.nullable(),
43024
+ providerJobId: string().nullable(),
43025
+ startedAt: number().nullable(),
43026
+ endedAt: number().nullable(),
43027
+ billedSeconds: number(),
43028
+ costUsd: number(),
43029
+ costIsEstimate: boolean(),
43030
+ lastPolledAt: number().nullable()
43031
+ }),
43032
+ progress: object({
43033
+ epoch: number().int().nullable(),
43034
+ epochs: number().int().nullable(),
43035
+ etaSec: number().nullable(),
43036
+ series: array(TrainingProgressPointSchema).readonly()
43037
+ }),
43038
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
43039
+ logTail: array(string()).readonly(),
43040
+ logCursor: string().nullable(),
43041
+ artifacts: object({
43042
+ bundleBytes: number().int(),
43043
+ bundleSha256: string(),
43044
+ fetchedAt: number(),
43045
+ /** When the staged artefacts are deleted from the hub. */
43046
+ expiresAt: number()
43047
+ }).nullable(),
43048
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
43049
+ cloudDatasetDeletedAt: number().nullable(),
43050
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
43051
+ cloudCleanupDueAt: number().nullable(),
43052
+ /** Model ids registered from this job (base, and int8 when kept). */
43053
+ registeredModelIds: array(string()).readonly(),
43054
+ canary: TrainingCanarySchema.nullable()
43055
+ });
43056
+ var IdInput = object({ id: string().min(1) });
43057
+ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
43058
+ auth: "admin",
43059
+ timeoutMs: 6e4
43060
+ }), method(TrainingJobRequestSchema.extend({
43061
+ name: string().min(1).max(120),
43062
+ maxCostUsd: number().positive(),
43063
+ maxRuntimeSec: number().int().positive(),
43064
+ idempotencyKey: string().min(8).max(80)
43065
+ }), discriminatedUnion("kind", [object({
43066
+ kind: literal("started"),
43067
+ job: TrainingJobSchema
43068
+ }), object({
43069
+ kind: literal("refused"),
43070
+ reason: TrainingRefusalReasonSchema,
43071
+ detail: string()
43072
+ })]), {
43073
+ kind: "mutation",
43074
+ auth: "admin",
43075
+ timeoutMs: 12e4
43076
+ }), method(TrainingJobRequestSchema.omit({ baseModelId: true }).extend({
43077
+ baseModelIds: array(string().min(1)).min(1),
43078
+ name: string().min(1).max(120),
43079
+ maxCostUsd: number().positive(),
43080
+ maxRuntimeSec: number().int().positive(),
43081
+ idempotencyKey: string().min(8).max(80)
43082
+ }), discriminatedUnion("kind", [object({
43083
+ kind: literal("started"),
43084
+ batchId: string(),
43085
+ jobs: array(TrainingJobSchema).min(1).readonly()
43086
+ }), object({
43087
+ kind: literal("refused"),
43088
+ reason: TrainingRefusalReasonSchema,
43089
+ detail: string()
43090
+ })]), {
43091
+ kind: "mutation",
43092
+ auth: "admin",
43093
+ timeoutMs: 12e4
43094
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
43095
+ kind: "mutation",
43096
+ auth: "admin",
43097
+ timeoutMs: 12e4
43098
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
43099
+ kind: "mutation",
43100
+ auth: "admin",
43101
+ timeoutMs: 30 * 6e4
43102
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
43103
+ kind: "mutation",
43104
+ auth: "admin",
43105
+ timeoutMs: 12e4
43106
+ }), method(IdInput, TrainingJobSchema, {
43107
+ kind: "mutation",
43108
+ auth: "admin",
43109
+ timeoutMs: 12e4
43110
+ }), method(IdInput, TrainingJobSchema, {
43111
+ kind: "mutation",
43112
+ auth: "admin"
43113
+ });
41473
43114
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
41474
43115
  Object.freeze({
41475
43116
  person: .5,
@@ -43618,6 +45259,12 @@ Object.freeze({
43618
45259
  addonId: null,
43619
45260
  access: "create"
43620
45261
  },
45262
+ "backup.checkBackupKey": {
45263
+ capName: "backup",
45264
+ capScope: "system",
45265
+ addonId: null,
45266
+ access: "create"
45267
+ },
43621
45268
  "backup.delete": {
43622
45269
  capName: "backup",
43623
45270
  capScope: "system",
@@ -43630,6 +45277,18 @@ Object.freeze({
43630
45277
  addonId: null,
43631
45278
  access: "delete"
43632
45279
  },
45280
+ "backup.disableEncryption": {
45281
+ capName: "backup",
45282
+ capScope: "system",
45283
+ addonId: null,
45284
+ access: "create"
45285
+ },
45286
+ "backup.getEncryption": {
45287
+ capName: "backup",
45288
+ capScope: "system",
45289
+ addonId: null,
45290
+ access: "view"
45291
+ },
43633
45292
  "backup.getEntries": {
43634
45293
  capName: "backup",
43635
45294
  capScope: "system",
@@ -43684,6 +45343,12 @@ Object.freeze({
43684
45343
  addonId: null,
43685
45344
  access: "create"
43686
45345
  },
45346
+ "backup.setupEncryption": {
45347
+ capName: "backup",
45348
+ capScope: "system",
45349
+ addonId: null,
45350
+ access: "create"
45351
+ },
43687
45352
  "backup.trigger": {
43688
45353
  capName: "backup",
43689
45354
  capScope: "system",
@@ -44236,6 +45901,12 @@ Object.freeze({
44236
45901
  addonId: null,
44237
45902
  access: "create"
44238
45903
  },
45904
+ "customModelRegistry.importModelBundle": {
45905
+ capName: "custom-model-registry",
45906
+ capScope: "system",
45907
+ addonId: null,
45908
+ access: "create"
45909
+ },
44239
45910
  "customModelRegistry.listModels": {
44240
45911
  capName: "custom-model-registry",
44241
45912
  capScope: "system",
@@ -45676,6 +47347,12 @@ Object.freeze({
45676
47347
  addonId: null,
45677
47348
  access: "view"
45678
47349
  },
47350
+ "keychainAdmin.acknowledgeReset": {
47351
+ capName: "keychain-admin",
47352
+ capScope: "system",
47353
+ addonId: null,
47354
+ access: "create"
47355
+ },
45679
47356
  "keychainAdmin.deleteOrphans": {
45680
47357
  capName: "keychain-admin",
45681
47358
  capScope: "system",
@@ -45712,6 +47389,12 @@ Object.freeze({
45712
47389
  addonId: null,
45713
47390
  access: "delete"
45714
47391
  },
47392
+ "keychainAdmin.resetReport": {
47393
+ capName: "keychain-admin",
47394
+ capScope: "system",
47395
+ addonId: null,
47396
+ access: "delete"
47397
+ },
45715
47398
  "keychainAdmin.reveal": {
45716
47399
  capName: "keychain-admin",
45717
47400
  capScope: "system",
@@ -45724,6 +47407,12 @@ Object.freeze({
45724
47407
  addonId: null,
45725
47408
  access: "create"
45726
47409
  },
47410
+ "keychainAdmin.setSystemSecret": {
47411
+ capName: "keychain-admin",
47412
+ capScope: "system",
47413
+ addonId: null,
47414
+ access: "create"
47415
+ },
45727
47416
  "keychainAdmin.status": {
45728
47417
  capName: "keychain-admin",
45729
47418
  capScope: "system",
@@ -46960,6 +48649,36 @@ Object.freeze({
46960
48649
  addonId: null,
46961
48650
  access: "view"
46962
48651
  },
48652
+ "oidcConnections.connectionFormSchema": {
48653
+ capName: "oidc-connections",
48654
+ capScope: "system",
48655
+ addonId: null,
48656
+ access: "view"
48657
+ },
48658
+ "oidcConnections.createConnection": {
48659
+ capName: "oidc-connections",
48660
+ capScope: "system",
48661
+ addonId: null,
48662
+ access: "create"
48663
+ },
48664
+ "oidcConnections.deleteConnection": {
48665
+ capName: "oidc-connections",
48666
+ capScope: "system",
48667
+ addonId: null,
48668
+ access: "delete"
48669
+ },
48670
+ "oidcConnections.listConnections": {
48671
+ capName: "oidc-connections",
48672
+ capScope: "system",
48673
+ addonId: null,
48674
+ access: "view"
48675
+ },
48676
+ "oidcConnections.updateConnection": {
48677
+ capName: "oidc-connections",
48678
+ capScope: "system",
48679
+ addonId: null,
48680
+ access: "create"
48681
+ },
46963
48682
  "osd.getStatus": {
46964
48683
  capName: "osd",
46965
48684
  capScope: "device",
@@ -47032,6 +48751,12 @@ Object.freeze({
47032
48751
  addonId: null,
47033
48752
  access: "create"
47034
48753
  },
48754
+ "osdManager.setSlotCameraEnabled": {
48755
+ capName: "osd-manager",
48756
+ capScope: "system",
48757
+ addonId: null,
48758
+ access: "create"
48759
+ },
47035
48760
  "osdManager.upsertTemplate": {
47036
48761
  capName: "osd-manager",
47037
48762
  capScope: "system",
@@ -47284,6 +49009,12 @@ Object.freeze({
47284
49009
  addonId: null,
47285
49010
  access: "view"
47286
49011
  },
49012
+ "pipelineAnalytics.getRetrainCorpusKpi": {
49013
+ capName: "pipeline-analytics",
49014
+ capScope: "device",
49015
+ addonId: null,
49016
+ access: "view"
49017
+ },
47287
49018
  "pipelineAnalytics.getRetrainExportUrl": {
47288
49019
  capName: "pipeline-analytics",
47289
49020
  capScope: "device",
@@ -47404,6 +49135,12 @@ Object.freeze({
47404
49135
  addonId: null,
47405
49136
  access: "view"
47406
49137
  },
49138
+ "pipelineAnalytics.listRetrainCorpusPage": {
49139
+ capName: "pipeline-analytics",
49140
+ capScope: "device",
49141
+ addonId: null,
49142
+ access: "view"
49143
+ },
47407
49144
  "pipelineAnalytics.listRetrainFrames": {
47408
49145
  capName: "pipeline-analytics",
47409
49146
  capScope: "device",
@@ -47434,6 +49171,12 @@ Object.freeze({
47434
49171
  addonId: null,
47435
49172
  access: "view"
47436
49173
  },
49174
+ "pipelineAnalytics.offerRetrainArchive": {
49175
+ capName: "pipeline-analytics",
49176
+ capScope: "device",
49177
+ addonId: null,
49178
+ access: "create"
49179
+ },
47437
49180
  "pipelineAnalytics.ownersWithMedia": {
47438
49181
  capName: "pipeline-analytics",
47439
49182
  capScope: "device",
@@ -47524,6 +49267,12 @@ Object.freeze({
47524
49267
  addonId: null,
47525
49268
  access: "create"
47526
49269
  },
49270
+ "pipelineAnalytics.resolveRetrainTrainingCorpus": {
49271
+ capName: "pipeline-analytics",
49272
+ capScope: "device",
49273
+ addonId: null,
49274
+ access: "view"
49275
+ },
47527
49276
  "pipelineAnalytics.restageRetrainTrack": {
47528
49277
  capName: "pipeline-analytics",
47529
49278
  capScope: "device",
@@ -49960,6 +51709,180 @@ Object.freeze({
49960
51709
  addonId: null,
49961
51710
  access: "view"
49962
51711
  },
51712
+ "training.canaryResult": {
51713
+ capName: "training",
51714
+ capScope: "system",
51715
+ addonId: null,
51716
+ access: "create"
51717
+ },
51718
+ "training.cancelJob": {
51719
+ capName: "training",
51720
+ capScope: "system",
51721
+ addonId: null,
51722
+ access: "create"
51723
+ },
51724
+ "training.discardResult": {
51725
+ capName: "training",
51726
+ capScope: "system",
51727
+ addonId: null,
51728
+ access: "create"
51729
+ },
51730
+ "training.getJob": {
51731
+ capName: "training",
51732
+ capScope: "system",
51733
+ addonId: null,
51734
+ access: "view"
51735
+ },
51736
+ "training.getJobResult": {
51737
+ capName: "training",
51738
+ capScope: "system",
51739
+ addonId: null,
51740
+ access: "view"
51741
+ },
51742
+ "training.listBaseModels": {
51743
+ capName: "training",
51744
+ capScope: "system",
51745
+ addonId: null,
51746
+ access: "view"
51747
+ },
51748
+ "training.listJobs": {
51749
+ capName: "training",
51750
+ capScope: "system",
51751
+ addonId: null,
51752
+ access: "view"
51753
+ },
51754
+ "training.planJob": {
51755
+ capName: "training",
51756
+ capScope: "system",
51757
+ addonId: null,
51758
+ access: "view"
51759
+ },
51760
+ "training.registerResult": {
51761
+ capName: "training",
51762
+ capScope: "system",
51763
+ addonId: null,
51764
+ access: "create"
51765
+ },
51766
+ "training.rollbackCanary": {
51767
+ capName: "training",
51768
+ capScope: "system",
51769
+ addonId: null,
51770
+ access: "create"
51771
+ },
51772
+ "training.startJob": {
51773
+ capName: "training",
51774
+ capScope: "system",
51775
+ addonId: null,
51776
+ access: "create"
51777
+ },
51778
+ "training.startJobBatch": {
51779
+ capName: "training",
51780
+ capScope: "system",
51781
+ addonId: null,
51782
+ access: "create"
51783
+ },
51784
+ "trainingProvider.cancelJob": {
51785
+ capName: "training-provider",
51786
+ capScope: "system",
51787
+ addonId: null,
51788
+ access: "create"
51789
+ },
51790
+ "trainingProvider.cleanupJob": {
51791
+ capName: "training-provider",
51792
+ capScope: "system",
51793
+ addonId: null,
51794
+ access: "create"
51795
+ },
51796
+ "trainingProvider.createEntry": {
51797
+ capName: "training-provider",
51798
+ capScope: "system",
51799
+ addonId: null,
51800
+ access: "create"
51801
+ },
51802
+ "trainingProvider.deleteEntry": {
51803
+ capName: "training-provider",
51804
+ capScope: "system",
51805
+ addonId: null,
51806
+ access: "delete"
51807
+ },
51808
+ "trainingProvider.describe": {
51809
+ capName: "training-provider",
51810
+ capScope: "system",
51811
+ addonId: null,
51812
+ access: "view"
51813
+ },
51814
+ "trainingProvider.describeTypes": {
51815
+ capName: "training-provider",
51816
+ capScope: "system",
51817
+ addonId: null,
51818
+ access: "view"
51819
+ },
51820
+ "trainingProvider.estimateJob": {
51821
+ capName: "training-provider",
51822
+ capScope: "system",
51823
+ addonId: null,
51824
+ access: "view"
51825
+ },
51826
+ "trainingProvider.getJob": {
51827
+ capName: "training-provider",
51828
+ capScope: "system",
51829
+ addonId: null,
51830
+ access: "view"
51831
+ },
51832
+ "trainingProvider.listEntries": {
51833
+ capName: "training-provider",
51834
+ capScope: "system",
51835
+ addonId: null,
51836
+ access: "view"
51837
+ },
51838
+ "trainingProvider.listJobEvents": {
51839
+ capName: "training-provider",
51840
+ capScope: "system",
51841
+ addonId: null,
51842
+ access: "view"
51843
+ },
51844
+ "trainingProvider.listJobs": {
51845
+ capName: "training-provider",
51846
+ capScope: "system",
51847
+ addonId: null,
51848
+ access: "view"
51849
+ },
51850
+ "trainingProvider.offerArtifact": {
51851
+ capName: "training-provider",
51852
+ capScope: "system",
51853
+ addonId: null,
51854
+ access: "create"
51855
+ },
51856
+ "trainingProvider.readResult": {
51857
+ capName: "training-provider",
51858
+ capScope: "system",
51859
+ addonId: null,
51860
+ access: "create"
51861
+ },
51862
+ "trainingProvider.submitJob": {
51863
+ capName: "training-provider",
51864
+ capScope: "system",
51865
+ addonId: null,
51866
+ access: "create"
51867
+ },
51868
+ "trainingProvider.updateEntry": {
51869
+ capName: "training-provider",
51870
+ capScope: "system",
51871
+ addonId: null,
51872
+ access: "create"
51873
+ },
51874
+ "trainingProvider.uploadDataset": {
51875
+ capName: "training-provider",
51876
+ capScope: "system",
51877
+ addonId: null,
51878
+ access: "create"
51879
+ },
51880
+ "trainingProvider.validateCredentials": {
51881
+ capName: "training-provider",
51882
+ capScope: "system",
51883
+ addonId: null,
51884
+ access: "create"
51885
+ },
49963
51886
  "turnProvider.getTurnServers": {
49964
51887
  capName: "turn-provider",
49965
51888
  capScope: "system",
@@ -49984,12 +51907,6 @@ Object.freeze({
49984
51907
  addonId: null,
49985
51908
  access: "create"
49986
51909
  },
49987
- "userManagement.createApiKey": {
49988
- capName: "user-management",
49989
- capScope: "system",
49990
- addonId: null,
49991
- access: "create"
49992
- },
49993
51910
  "userManagement.createScopedToken": {
49994
51911
  capName: "user-management",
49995
51912
  capScope: "system",
@@ -50026,12 +51943,6 @@ Object.freeze({
50026
51943
  addonId: null,
50027
51944
  access: "view"
50028
51945
  },
50029
- "userManagement.linkExternalIdentity": {
50030
- capName: "user-management",
50031
- capScope: "system",
50032
- addonId: null,
50033
- access: "create"
50034
- },
50035
51946
  "userManagement.listApiKeys": {
50036
51947
  capName: "user-management",
50037
51948
  capScope: "system",
@@ -50134,12 +52045,6 @@ Object.freeze({
50134
52045
  addonId: null,
50135
52046
  access: "create"
50136
52047
  },
50137
- "userManagement.validateApiKey": {
50138
- capName: "user-management",
50139
- capScope: "system",
50140
- addonId: null,
50141
- access: "view"
50142
- },
50143
52048
  "userManagement.validateCredentials": {
50144
52049
  capName: "user-management",
50145
52050
  capScope: "system",
@@ -53172,6 +55077,11 @@ Object.freeze({
53172
55077
  form: "single",
53173
55078
  optional: false
53174
55079
  }],
55080
+ "osdManager.setSlotCameraEnabled": [{
55081
+ name: "deviceId",
55082
+ form: "single",
55083
+ optional: false
55084
+ }],
53175
55085
  "petFeeder.callPet": [{
53176
55086
  name: "deviceId",
53177
55087
  form: "single",
@@ -53392,6 +55302,11 @@ Object.freeze({
53392
55302
  form: "array",
53393
55303
  optional: false
53394
55304
  }],
55305
+ "pipelineAnalytics.listRetrainCorpusPage": [{
55306
+ name: "deviceIds",
55307
+ form: "array",
55308
+ optional: true
55309
+ }],
53395
55310
  "pipelineAnalytics.listRetrainStaging": [{
53396
55311
  name: "deviceIds",
53397
55312
  form: "array",
@@ -54253,6 +56168,11 @@ Object.freeze({
54253
56168
  form: "single",
54254
56169
  optional: false
54255
56170
  }],
56171
+ "training.canaryResult": [{
56172
+ name: "deviceIds",
56173
+ form: "array",
56174
+ optional: false
56175
+ }],
54256
56176
  "update.getStatus": [{
54257
56177
  name: "deviceId",
54258
56178
  form: "single",
@@ -54496,6 +56416,7 @@ Object.freeze({
54496
56416
  });
54497
56417
  Object.freeze({
54498
56418
  "broker": "broker",
56419
+ "calendar-source": "calendar",
54499
56420
  "device-export": "device-export",
54500
56421
  "llm": "ai",
54501
56422
  "mesh-network": "mesh",
@@ -54981,6 +56902,8 @@ var STATE_SUMMARY_VARS = [
54981
56902
  [...RULE_TEXT],
54982
56903
  [...RULE_TEXT],
54983
56904
  [...RULE_TEXT],
56905
+ [...RULE_TEXT],
56906
+ [...RULE_TEXT],
54984
56907
  ([...RULE_TEXT], [...UPDATES]),
54985
56908
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
54986
56909
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),