@camstack/addon-provider-rademacher 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.mjs CHANGED
@@ -6361,7 +6361,7 @@ var ZodIssueCode = {
6361
6361
  var ZodFirstPartyTypeKind;
6362
6362
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6363
6363
  //#endregion
6364
- //#region ../types/dist/sleep-Cr5YOk3m.mjs
6364
+ //#region ../types/dist/sleep-DwAQ9sqX.mjs
6365
6365
  /**
6366
6366
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6367
6367
  * window to float samples (D455).
@@ -6478,7 +6478,7 @@ function isKeychainStoredField(field) {
6478
6478
  var SECRET_CLEAR = { $secretClear: true };
6479
6479
  /** The `'***'` token D634 redaction writes for non-admins. */
6480
6480
  var LEGACY_DEVICE_REDACTION = "***";
6481
- function isRecord$1(value) {
6481
+ function isRecord$2(value) {
6482
6482
  return typeof value === "object" && value !== null && !Array.isArray(value);
6483
6483
  }
6484
6484
  function makeSecretMarker(ref) {
@@ -6489,12 +6489,12 @@ function makeSecretMarker(ref) {
6489
6489
  }
6490
6490
  /** A stored marker: an object whose `$secret` is a non-empty string. */
6491
6491
  function isSecretMarker(value) {
6492
- if (!isRecord$1(value)) return false;
6492
+ if (!isRecord$2(value)) return false;
6493
6493
  const ref = value["$secret"];
6494
6494
  return typeof ref === "string" && ref.length > 0;
6495
6495
  }
6496
6496
  function isSecretClear(value) {
6497
- return isRecord$1(value) && value["$secretClear"] === true;
6497
+ return isRecord$2(value) && value["$secretClear"] === true;
6498
6498
  }
6499
6499
  /**
6500
6500
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -7010,6 +7010,13 @@ function globalSecretScope() {
7010
7010
  function encodeSegment(value) {
7011
7011
  return encodeURIComponent(value);
7012
7012
  }
7013
+ function decodeSegment(value) {
7014
+ try {
7015
+ return decodeURIComponent(value);
7016
+ } catch {
7017
+ return null;
7018
+ }
7019
+ }
7013
7020
  /**
7014
7021
  * The field path of a value inside an array item, addressed by the item's id:
7015
7022
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -7018,6 +7025,75 @@ function encodeSegment(value) {
7018
7025
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
7019
7026
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
7020
7027
  }
7028
+ function parseScope(segments) {
7029
+ switch (segments[0]) {
7030
+ case "global": return {
7031
+ scope: GLOBAL_SCOPE,
7032
+ used: 1
7033
+ };
7034
+ case "node": {
7035
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
7036
+ return nodeId === null || nodeId.length === 0 ? null : {
7037
+ scope: {
7038
+ kind: "node",
7039
+ nodeId
7040
+ },
7041
+ used: 2
7042
+ };
7043
+ }
7044
+ case "device": {
7045
+ const raw = segments[1];
7046
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
7047
+ return {
7048
+ scope: {
7049
+ kind: "device",
7050
+ deviceId: Number(raw)
7051
+ },
7052
+ used: 2
7053
+ };
7054
+ }
7055
+ case "integration": {
7056
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
7057
+ return id === null || id.length === 0 ? null : {
7058
+ scope: {
7059
+ kind: "integration",
7060
+ integrationId: id
7061
+ },
7062
+ used: 2
7063
+ };
7064
+ }
7065
+ case "row": {
7066
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
7067
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
7068
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
7069
+ return {
7070
+ scope: {
7071
+ kind: "row",
7072
+ collection,
7073
+ rowId
7074
+ },
7075
+ used: 3
7076
+ };
7077
+ }
7078
+ default: return null;
7079
+ }
7080
+ }
7081
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
7082
+ function parseSecretRef(ref) {
7083
+ if (!ref.startsWith("secret://")) return null;
7084
+ const segments = ref.slice(9).split("/");
7085
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
7086
+ if (owner === null || owner.length === 0) return null;
7087
+ const parsed = parseScope(segments.slice(1));
7088
+ if (parsed === null) return null;
7089
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
7090
+ if (fieldPath.length === 0) return null;
7091
+ return {
7092
+ owner,
7093
+ scope: parsed.scope,
7094
+ fieldPath
7095
+ };
7096
+ }
7021
7097
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
7022
7098
  var KeychainWriteRefusedError = class extends Error {
7023
7099
  fieldPath;
@@ -7028,7 +7104,7 @@ var KeychainWriteRefusedError = class extends Error {
7028
7104
  }
7029
7105
  };
7030
7106
  var KEEP = { kind: "keep" };
7031
- function isRecord(value) {
7107
+ function isRecord$1(value) {
7032
7108
  return typeof value === "object" && value !== null && !Array.isArray(value);
7033
7109
  }
7034
7110
  function defaultMintId() {
@@ -7041,7 +7117,7 @@ function collectSecretMarkerRefs(value, out = []) {
7041
7117
  return out;
7042
7118
  }
7043
7119
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
7044
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
7120
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
7045
7121
  return out;
7046
7122
  }
7047
7123
  async function storedValueEquals(secrets, marker, candidate) {
@@ -7096,7 +7172,7 @@ function rowId(row, idKey) {
7096
7172
  return null;
7097
7173
  }
7098
7174
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
7099
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
7175
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
7100
7176
  if (!Array.isArray(incoming)) {
7101
7177
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
7102
7178
  return {
@@ -7112,7 +7188,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
7112
7188
  const kept = /* @__PURE__ */ new Set();
7113
7189
  const rows = [];
7114
7190
  for (const row of incoming) {
7115
- if (!isRecord(row)) {
7191
+ if (!isRecord$1(row)) {
7116
7192
  rows.push(row);
7117
7193
  continue;
7118
7194
  }
@@ -7137,7 +7213,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
7137
7213
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
7138
7214
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
7139
7215
  case "object": {
7140
- if (!isRecord(incoming)) {
7216
+ if (!isRecord$1(incoming)) {
7141
7217
  if (incoming === void 0) return KEEP;
7142
7218
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
7143
7219
  return {
@@ -7145,7 +7221,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
7145
7221
  value: incoming
7146
7222
  };
7147
7223
  }
7148
- const storedObj = isRecord(stored) ? stored : {};
7224
+ const storedObj = isRecord$1(stored) ? stored : {};
7149
7225
  return {
7150
7226
  kind: "value",
7151
7227
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -7204,12 +7280,19 @@ async function transformSecretWrite(input) {
7204
7280
  }
7205
7281
  };
7206
7282
  }
7283
+ /** Is `ref` one of `owner`'s refs? */
7284
+ function isSecretRefOwnedBy(ref, owner) {
7285
+ return parseSecretRef(ref)?.owner === owner;
7286
+ }
7207
7287
  /**
7208
7288
  * Replace every marker in `value` with its keychain value. Returns the SAME
7209
7289
  * reference when there is no marker (no allocation, no keychain call).
7210
7290
  */
7211
- async function resolveSecretMarkers(value, secrets) {
7212
- const refs = collectSecretMarkerRefs(value);
7291
+ async function resolveSecretMarkers(value, secrets, options = {}) {
7292
+ const keepMarker = options.unresolved === "keep-marker";
7293
+ const owner = options.ownedBy;
7294
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
7295
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
7213
7296
  if (refs.length === 0) return {
7214
7297
  value,
7215
7298
  unresolved: []
@@ -7233,10 +7316,18 @@ async function resolveSecretMarkers(value, secrets) {
7233
7316
  }
7234
7317
  const substitute = (v) => {
7235
7318
  if (isSecretMarker(v)) {
7319
+ if (!inScope(v.$secret)) return {
7320
+ keep: true,
7321
+ value: v
7322
+ };
7236
7323
  const answer = answers[v.$secret];
7237
- return answer?.kind === "value" ? {
7324
+ if (answer?.kind === "value") return {
7238
7325
  keep: true,
7239
7326
  value: answer.value
7327
+ };
7328
+ return keepMarker ? {
7329
+ keep: true,
7330
+ value: v
7240
7331
  } : {
7241
7332
  keep: false,
7242
7333
  value: void 0
@@ -7253,7 +7344,7 @@ async function resolveSecretMarkers(value, secrets) {
7253
7344
  value: items
7254
7345
  };
7255
7346
  }
7256
- if (isRecord(v)) {
7347
+ if (isRecord$1(v)) {
7257
7348
  const out = {};
7258
7349
  for (const [k, child] of Object.entries(v)) {
7259
7350
  const s = substitute(child);
@@ -7274,14 +7365,152 @@ async function resolveSecretMarkers(value, secrets) {
7274
7365
  unresolved
7275
7366
  };
7276
7367
  }
7277
- function touchesTree(tree, patch) {
7278
- if (tree.size === 0) return false;
7279
- for (const key of Object.keys(patch)) {
7280
- const at = key.indexOf("@");
7281
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
7368
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
7369
+ var SecretOverwriteRefusedError = class extends Error {
7370
+ ref;
7371
+ reason;
7372
+ constructor(ref, reason) {
7373
+ 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.`);
7374
+ this.ref = ref;
7375
+ this.reason = reason;
7376
+ this.name = "SecretOverwriteRefusedError";
7377
+ }
7378
+ };
7379
+ function isRecord(value) {
7380
+ return typeof value === "object" && value !== null && !Array.isArray(value);
7381
+ }
7382
+ function resolvedValue(pass, marker) {
7383
+ const answer = pass.answers[marker.$secret];
7384
+ return answer?.kind === "value" ? answer.value : null;
7385
+ }
7386
+ async function atMarker(pass, incoming, stored) {
7387
+ if (incoming === null) return stored;
7388
+ if (typeof incoming !== "string") return incoming;
7389
+ if (incoming === resolvedValue(pass, stored)) return stored;
7390
+ const intent = classifySecretWrite(incoming);
7391
+ if (intent.kind !== "set") return stored;
7392
+ const ref = stored.$secret;
7393
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
7394
+ const answer = pass.answers[ref];
7395
+ 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);
7396
+ try {
7397
+ await pass.secrets.put(ref, intent.value);
7398
+ } catch (err) {
7399
+ throw new KeychainWriteRefusedError(ref, err);
7400
+ }
7401
+ pass.changedRefs.push(ref);
7402
+ return stored;
7403
+ }
7404
+ function inArray(pass, incoming, stored) {
7405
+ return incoming.map((item, index) => {
7406
+ const twin = stored[index];
7407
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
7408
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
7409
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
7410
+ return item;
7411
+ });
7412
+ }
7413
+ function inArrayRow(pass, incoming, stored) {
7414
+ const out = { ...incoming };
7415
+ for (const [key, value] of Object.entries(incoming)) {
7416
+ const twin = stored[key];
7417
+ if (isSecretMarker(twin)) {
7418
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
7419
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
7420
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
7421
+ }
7422
+ return out;
7423
+ }
7424
+ async function walk(pass, incoming, stored) {
7425
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
7426
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
7427
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
7428
+ const out = { ...incoming };
7429
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
7430
+ return out;
7431
+ }
7432
+ /** Restore markers a write-back carries as values. See the file doc. */
7433
+ async function restoreUnchangedSecrets(input) {
7434
+ const refs = [];
7435
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
7436
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
7437
+ if (owned.length === 0) return {
7438
+ patch: input.patch,
7439
+ changedRefs: []
7440
+ };
7441
+ const pass = {
7442
+ secrets: input.secrets,
7443
+ answers: await input.secrets.resolve([...new Set(owned)]),
7444
+ operatorWrite: input.operatorWrite,
7445
+ changedRefs: []
7446
+ };
7447
+ const out = {};
7448
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
7449
+ return {
7450
+ patch: out,
7451
+ changedRefs: pass.changedRefs
7452
+ };
7453
+ }
7454
+ /** Structural equality over JSON-shaped values (key order does not matter). */
7455
+ function isJsonEqual(a, b) {
7456
+ if (Object.is(a, b)) return true;
7457
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
7458
+ if (isRecord(a) && isRecord(b)) {
7459
+ const keys = Object.keys(a);
7460
+ if (keys.length !== Object.keys(b).length) return false;
7461
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
7282
7462
  }
7283
7463
  return false;
7284
7464
  }
7465
+ /** The patch without the keys whose value already equals the stored one. */
7466
+ function dropUnchangedKeys(patch, stored) {
7467
+ const out = {};
7468
+ for (const [key, value] of Object.entries(patch)) {
7469
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
7470
+ out[key] = value;
7471
+ }
7472
+ return out;
7473
+ }
7474
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
7475
+ function markerKeysOf(blob, owner) {
7476
+ const keys = /* @__PURE__ */ new Set();
7477
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
7478
+ return keys;
7479
+ }
7480
+ function nodeFromStored(value, owner) {
7481
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
7482
+ if (!isRecord(value)) return null;
7483
+ const children = /* @__PURE__ */ new Map();
7484
+ for (const [key, child] of Object.entries(value)) {
7485
+ const node = nodeFromStored(child, owner);
7486
+ if (node !== null) children.set(key, node);
7487
+ }
7488
+ return children.size > 0 ? {
7489
+ kind: "object",
7490
+ children
7491
+ } : null;
7492
+ }
7493
+ /**
7494
+ * The declared secret tree, widened by every place the STORED blob holds a
7495
+ * marker under one of `keys` — so a marker the schema no longer declares (or
7496
+ * never declared: Wyze before b4906cec6) still gets the save path's
7497
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
7498
+ * addon writes. Markers inside arrays are not added: a row has no id field to
7499
+ * match by unless the schema declares one. Only `owner`'s markers count: a
7500
+ * builtin that keeps another addon's marker (device-manager) never takes it
7501
+ * over.
7502
+ */
7503
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
7504
+ const added = /* @__PURE__ */ new Map();
7505
+ for (const key of keys) {
7506
+ const at = key.indexOf("@");
7507
+ const base = at > 0 ? key.slice(0, at) : key;
7508
+ if (declared.has(base) || added.has(base)) continue;
7509
+ const node = nodeFromStored(stored[key], owner);
7510
+ if (node !== null) added.set(base, node);
7511
+ }
7512
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
7513
+ }
7285
7514
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
7286
7515
  async function readStoredAddonBlob(raw) {
7287
7516
  const threeWay = raw.readAddonStoreResult;
@@ -7290,7 +7519,41 @@ async function readStoredAddonBlob(raw) {
7290
7519
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
7291
7520
  return result.kind === "missing" ? {} : result.value;
7292
7521
  }
7293
- function createSecretAwareSettings(raw, opts) {
7522
+ function touchesTree(tree, patch) {
7523
+ if (tree.size === 0) return false;
7524
+ for (const key of Object.keys(patch)) {
7525
+ const at = key.indexOf("@");
7526
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
7527
+ }
7528
+ return false;
7529
+ }
7530
+ /**
7531
+ * Which top-level keys of each store held markers when last seen. `undefined`
7532
+ * for a store not seen yet: its first write reads it, to be safe.
7533
+ */
7534
+ var MarkerKeyIndex = class {
7535
+ owner;
7536
+ byStore = /* @__PURE__ */ new Map();
7537
+ constructor(owner) {
7538
+ this.owner = owner;
7539
+ }
7540
+ seen(store, blob) {
7541
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
7542
+ }
7543
+ wrote(store, patch) {
7544
+ const keys = this.byStore.get(store);
7545
+ if (keys === void 0) return;
7546
+ const now = markerKeysOf(patch, this.owner);
7547
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
7548
+ else keys.delete(key);
7549
+ }
7550
+ mayHoldMarkers(store, patch) {
7551
+ const keys = this.byStore.get(store);
7552
+ if (keys === void 0) return true;
7553
+ return Object.keys(patch).some((key) => keys.has(key));
7554
+ }
7555
+ };
7556
+ function createHandle(raw, opts) {
7294
7557
  const chains = /* @__PURE__ */ new Map();
7295
7558
  const serialize = (key, fn) => {
7296
7559
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -7301,46 +7564,130 @@ function createSecretAwareSettings(raw, opts) {
7301
7564
  });
7302
7565
  return next;
7303
7566
  };
7304
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
7305
- if (!touchesTree(tree, patch)) return rawWrite(patch);
7306
- return serialize(chainKey, async () => {
7567
+ const index = new MarkerKeyIndex(opts.secrets.owner);
7568
+ const resolveRead = async (store, blob) => {
7569
+ index.seen(store, blob);
7570
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
7571
+ unresolved: "keep-marker",
7572
+ ownedBy: opts.secrets.owner
7573
+ });
7574
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
7575
+ return value;
7576
+ };
7577
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
7578
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
7579
+ await rawWrite(patch);
7580
+ index.wrote(store, patch);
7581
+ return { changed: true };
7582
+ }
7583
+ return serialize(store, async () => {
7307
7584
  const stored = await readStored();
7585
+ index.seen(store, stored);
7586
+ const operatorWrite = opts.isOperatorWrite?.() === true;
7587
+ const restored = await restoreUnchangedSecrets({
7588
+ patch,
7589
+ stored,
7590
+ secrets: opts.secrets,
7591
+ operatorWrite
7592
+ });
7308
7593
  const result = await transformSecretWrite({
7309
- tree,
7594
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
7310
7595
  secrets: opts.secrets,
7311
- patch,
7596
+ patch: restored.patch,
7312
7597
  stored,
7313
7598
  ...scope !== void 0 ? { scope } : {},
7314
- operatorWrite: opts.isOperatorWrite?.() === true
7599
+ operatorWrite
7315
7600
  });
7316
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
7601
+ const effective = dropUnchangedKeys(result.patch, stored);
7602
+ const wroteBlob = Object.keys(effective).length > 0;
7603
+ if (wroteBlob) {
7604
+ await rawWrite(effective);
7605
+ index.wrote(store, effective);
7606
+ }
7317
7607
  const { orphaned } = await result.afterWrite();
7318
7608
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
7609
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
7319
7610
  });
7320
7611
  };
7321
- const wrapped = {
7322
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
7323
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
7324
- kind: "device",
7325
- deviceId
7326
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
7612
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
7613
+ const readAddonStoreResult = raw.readAddonStoreResult;
7614
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
7615
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
7616
+ const overrides = {
7617
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
7618
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
7619
+ const result = await readAddonStoreResult.call(raw);
7620
+ return result.kind === "value" ? {
7621
+ kind: "value",
7622
+ value: await resolveRead("addon", result.value)
7623
+ } : result;
7624
+ } } : {},
7625
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
7626
+ const result = await readAddonStoreKeyResult.call(raw, key);
7627
+ if (result.kind !== "present") return result;
7628
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
7629
+ unresolved: "keep-marker",
7630
+ ownedBy: opts.secrets.owner
7631
+ });
7632
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
7633
+ return {
7634
+ kind: "present",
7635
+ value: value[key]
7636
+ };
7637
+ } } : {},
7638
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
7639
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
7640
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
7641
+ const out = /* @__PURE__ */ new Map();
7642
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
7643
+ return out;
7644
+ } } : {},
7645
+ writeAddonStore: async (patch) => {
7646
+ await writeAddon(patch);
7647
+ },
7648
+ writeDeviceStore: async (deviceId, patch) => {
7649
+ await write(`device:${deviceId}`, opts.deviceTree(), {
7650
+ kind: "device",
7651
+ deviceId
7652
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
7653
+ }
7654
+ };
7655
+ return {
7656
+ settings: new Proxy(raw, { get(target, prop, receiver) {
7657
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
7658
+ const value = Reflect.get(target, prop, receiver);
7659
+ return typeof value === "function" ? value.bind(target) : value;
7660
+ } }),
7661
+ raw: {
7662
+ readAddonStore: async () => {
7663
+ const blob = await raw.readAddonStore();
7664
+ index.seen("addon", blob);
7665
+ return blob;
7666
+ },
7667
+ readDeviceStore: async (deviceId) => {
7668
+ const blob = await raw.readDeviceStore(deviceId);
7669
+ index.seen(`device:${deviceId}`, blob);
7670
+ return blob;
7671
+ }
7672
+ },
7673
+ writeAddonStore: writeAddon
7327
7674
  };
7328
- return new Proxy(raw, { get(target, prop, receiver) {
7329
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
7330
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
7331
- const value = Reflect.get(target, prop, receiver);
7332
- return typeof value === "function" ? value.bind(target) : value;
7333
- } });
7334
7675
  }
7335
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
7336
- function withSecretAwareSettings(context, opts) {
7676
+ /** The context the addon sees, plus the private raw view and write outcome. */
7677
+ function createSecretAwareContext(context, opts) {
7337
7678
  const raw = context.settings;
7338
- if (raw === void 0) return context;
7339
- const settings = createSecretAwareSettings(raw, opts);
7340
- return new Proxy(context, { get(target, prop, receiver) {
7341
- if (prop === "settings") return settings;
7342
- return Reflect.get(target, prop, receiver);
7343
- } });
7679
+ if (raw === void 0) return {
7680
+ context,
7681
+ handle: null
7682
+ };
7683
+ const handle = createHandle(raw, opts);
7684
+ return {
7685
+ context: new Proxy(context, { get(target, prop, receiver) {
7686
+ if (prop === "settings") return handle.settings;
7687
+ return Reflect.get(target, prop, receiver);
7688
+ } }),
7689
+ handle
7690
+ };
7344
7691
  }
7345
7692
  var LEAF = { kind: "leaf" };
7346
7693
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -7515,6 +7862,14 @@ var BaseAddon = class {
7515
7862
  _secretChangeUnsub = null;
7516
7863
  /** >0 while an OPERATOR's settings write is being applied. */
7517
7864
  _operatorWriteDepth = 0;
7865
+ /**
7866
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
7867
+ * to the marker-bearing blobs and stays private to this class: the form
7868
+ * hydrate and config resolution need markers, addon code never does.
7869
+ */
7870
+ _secretSettings = null;
7871
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
7872
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
7518
7873
  constructor(defaults) {
7519
7874
  this.defaults = defaults;
7520
7875
  this._config = { ...defaults };
@@ -7551,13 +7906,21 @@ var BaseAddon = class {
7551
7906
  }
7552
7907
  async initialize(context) {
7553
7908
  const secrets = context.secrets;
7554
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
7555
- secrets,
7556
- addonTree: () => this.addonSecretTree(),
7557
- deviceTree: () => this.deviceSecretTree(),
7558
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
7559
- isOperatorWrite: () => this._operatorWriteDepth > 0
7560
- }) : context;
7909
+ if (secrets !== void 0) {
7910
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
7911
+ secrets,
7912
+ addonTree: () => this.addonSecretTree(),
7913
+ deviceTree: () => this.deviceSecretTree(),
7914
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
7915
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
7916
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
7917
+ });
7918
+ this._ctx = wrapped;
7919
+ this._secretSettings = handle;
7920
+ } else {
7921
+ this._ctx = context;
7922
+ this._secretSettings = null;
7923
+ }
7561
7924
  await this.resolveConfig();
7562
7925
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
7563
7926
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -7674,11 +8037,8 @@ var BaseAddon = class {
7674
8037
  async getGlobalSettings(overlay, cap, nodeId) {
7675
8038
  const schema = this.globalSettingsSchema(cap);
7676
8039
  if (!schema) return { sections: [] };
7677
- const projected = await this.resolveGlobalStore(nodeId, cap);
7678
- return hydrateSchema(schema, overlay ? {
7679
- ...projected,
7680
- ...overlay
7681
- } : projected, { inlineSecretsAsViews: true });
8040
+ const projected = await this.readRawProjectedStore(nodeId, cap);
8041
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
7682
8042
  }
7683
8043
  /**
7684
8044
  * The integration-level view of this addon's settings: exactly the sections
@@ -7723,7 +8083,7 @@ var BaseAddon = class {
7723
8083
  });
7724
8084
  }
7725
8085
  if (sections.length === 0) return null;
7726
- const projected = await this.resolveGlobalStore(nodeId);
8086
+ const projected = await this.readRawProjectedStore(nodeId);
7727
8087
  return hydrateSchema({
7728
8088
  ...schema,
7729
8089
  sections
@@ -7740,12 +8100,50 @@ var BaseAddon = class {
7740
8100
  * the store for custom option logic (option narrowing, value snapping) to
7741
8101
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
7742
8102
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
8103
+ *
8104
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
8105
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
8106
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
8107
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
8108
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
8109
+ * resolved blob back is a no-op for every unchanged secret.
7743
8110
  */
7744
8111
  async resolveGlobalStore(nodeId, cap) {
7745
8112
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
8113
+ return this.projectForNode(raw, nodeId, cap);
8114
+ }
8115
+ projectForNode(store, nodeId, cap) {
7746
8116
  const keys = this.perNodeKeys(cap);
7747
8117
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
7748
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
8118
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
8119
+ }
8120
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
8121
+ async readRawProjectedStore(nodeId, cap) {
8122
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
8123
+ return this.projectForNode(raw, nodeId, cap);
8124
+ }
8125
+ /**
8126
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
8127
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
8128
+ * hydrated from a resolved overlay still shows a secret as "set", never as
8129
+ * its value.
8130
+ */
8131
+ async overlayKeepingMarkers(stored, overlay) {
8132
+ const secrets = this._ctx?.secrets;
8133
+ const merged = {
8134
+ ...stored,
8135
+ ...overlay
8136
+ };
8137
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
8138
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
8139
+ unresolved: "keep-marker",
8140
+ ownedBy: secrets.owner
8141
+ });
8142
+ for (const key of Object.keys(overlay)) {
8143
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
8144
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
8145
+ }
8146
+ return merged;
7749
8147
  }
7750
8148
  /**
7751
8149
  * Whether ONE global key of this addon's store was written, read three-way
@@ -7810,8 +8208,12 @@ var BaseAddon = class {
7810
8208
  async clearSecrets(keys, nodeId) {
7811
8209
  const tree = this.addonSecretTree();
7812
8210
  const keychain = this._ctx?.secrets !== void 0;
8211
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
7813
8212
  const patch = {};
7814
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
8213
+ for (const key of keys) {
8214
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
8215
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
8216
+ }
7815
8217
  await this.applyGlobalPatch(patch, nodeId);
7816
8218
  }
7817
8219
  async applyGlobalPatch(barePatch, nodeId) {
@@ -7819,7 +8221,11 @@ var BaseAddon = class {
7819
8221
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
7820
8222
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
7821
8223
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
7822
- await this._ctx?.settings?.writeAddonStore(scoped);
8224
+ const handle = this._secretSettings;
8225
+ if (handle !== null) {
8226
+ const { changed } = await handle.writeAddonStore(scoped);
8227
+ if (!changed) return;
8228
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
7823
8229
  if (target !== localNode) return;
7824
8230
  await this.resolveConfig();
7825
8231
  await this.onConfigChanged();
@@ -7872,7 +8278,7 @@ var BaseAddon = class {
7872
8278
  async getDeviceSettings(deviceId) {
7873
8279
  const schema = this.deviceSettingsSchema();
7874
8280
  if (!schema) return { sections: [] };
7875
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
8281
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7876
8282
  }
7877
8283
  async updateDeviceSettings(deviceId, patch) {
7878
8284
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -8044,7 +8450,7 @@ var BaseAddon = class {
8044
8450
  key,
8045
8451
  schema,
8046
8452
  fallback,
8047
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
8453
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
8048
8454
  write: async (patch) => {
8049
8455
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
8050
8456
  },
@@ -8106,6 +8512,23 @@ var BaseAddon = class {
8106
8512
  }
8107
8513
  return value;
8108
8514
  }
8515
+ /**
8516
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
8517
+ * keychain the context's own view is already raw.
8518
+ */
8519
+ rawSettings() {
8520
+ return this._secretSettings?.raw ?? this._ctx?.settings;
8521
+ }
8522
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
8523
+ logUnresolvedRead(unresolved) {
8524
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
8525
+ if (fresh.length === 0) return;
8526
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
8527
+ 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) => ({
8528
+ ref: u.ref,
8529
+ reason: u.reason
8530
+ })) } });
8531
+ }
8109
8532
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
8110
8533
  scheduleSecretReresolve(delayMs) {
8111
8534
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -8132,7 +8555,7 @@ var BaseAddon = class {
8132
8555
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
8133
8556
  */
8134
8557
  async readAddonStoreWithRetry() {
8135
- const settings = this._ctx?.settings;
8558
+ const settings = this.rawSettings();
8136
8559
  if (!settings) return {};
8137
8560
  const delaysMs = [
8138
8561
  150,
@@ -9944,6 +10367,16 @@ var CompositionSchema = object({
9944
10367
  seen.add(feature.cap);
9945
10368
  });
9946
10369
  });
10370
+ var NodeColorIdSchema = _enum([
10371
+ "node-a",
10372
+ "node-b",
10373
+ "node-c",
10374
+ "node-d",
10375
+ "node-e",
10376
+ "node-f",
10377
+ "node-g",
10378
+ "node-h"
10379
+ ]);
9947
10380
  new Set([
9948
10381
  "track",
9949
10382
  "face",
@@ -10435,6 +10868,278 @@ var CameraSwitchGroupSchema = object({
10435
10868
  fetchedAt: number()
10436
10869
  });
10437
10870
  /**
10871
+ * The trainer contract — what the hub hands the cloud trainer and what it
10872
+ * gets back (cloud training, D805+).
10873
+ *
10874
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
10875
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
10876
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
10877
+ * lines on stdout. These schemas are the hub's half of that boundary; the
10878
+ * trainer's pydantic models (and the JSON Schemas generated from them under
10879
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
10880
+ * change there, in the same piece of work.
10881
+ *
10882
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
10883
+ * orchestrator fills every field of a job spec explicitly.
10884
+ */
10885
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
10886
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
10887
+ /** What the trainer can export. Edge TPU is a later, separate image. */
10888
+ var TrainingExportSchema = _enum([
10889
+ "onnx",
10890
+ "openvino-fp16",
10891
+ "openvino-int8",
10892
+ "coreml-fp16"
10893
+ ]);
10894
+ var FloorsSchema = record(string(), number().min(0).max(1));
10895
+ object({
10896
+ schema: literal(TRAINING_JOB_SCHEMA),
10897
+ jobKey: string().uuid(),
10898
+ target: object({
10899
+ kind: literal("detector"),
10900
+ step: literal("object-detection")
10901
+ }),
10902
+ base: object({
10903
+ modelId: string().min(1),
10904
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
10905
+ weights: string().min(1),
10906
+ imgsz: number().int().positive()
10907
+ }),
10908
+ baseline: object({
10909
+ modelId: string().min(1),
10910
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
10911
+ onnxUrl: string().url(),
10912
+ imgsz: number().int().positive(),
10913
+ floors: FloorsSchema
10914
+ }),
10915
+ dataset: object({
10916
+ versionId: string().min(1),
10917
+ annotationHash: string(),
10918
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
10919
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10920
+ }),
10921
+ split: object({
10922
+ holdoutCameras: array(number().int()),
10923
+ /** When no camera is held out: the last N days of every camera. */
10924
+ holdoutLastDays: number().int().nonnegative(),
10925
+ valFraction: number().min(0).max(.5),
10926
+ seed: number().int()
10927
+ }),
10928
+ hyper: object({
10929
+ epochs: number().int().positive(),
10930
+ batch: number().int().positive(),
10931
+ lr0: number().positive(),
10932
+ /** Layers frozen from the start of the backbone; 0 = none. */
10933
+ freeze: number().int().nonnegative(),
10934
+ patience: number().int().nonnegative(),
10935
+ seed: number().int()
10936
+ }),
10937
+ replay: object({
10938
+ source: literal("coco2017"),
10939
+ count: number().int().nonnegative()
10940
+ }),
10941
+ exports: array(TrainingExportSchema).min(1),
10942
+ calibration: object({ maxFrames: number().int().positive() }),
10943
+ floors: object({
10944
+ minSupport: number().int().positive(),
10945
+ clamp: number().min(0).max(1)
10946
+ }),
10947
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
10948
+ catalog: object({
10949
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
10950
+ name: string().min(1).max(160)
10951
+ })
10952
+ });
10953
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
10954
+ var TrainingResultFileSchema = object({
10955
+ path: string().min(1),
10956
+ bytes: number().int().nonnegative(),
10957
+ sha256: string().regex(/^[0-9a-f]{64}$/),
10958
+ format: _enum([
10959
+ "onnx",
10960
+ "openvino",
10961
+ "coreml",
10962
+ "pt"
10963
+ ]),
10964
+ variant: _enum(["base", "int8"])
10965
+ });
10966
+ var DraftFormatSchema = object({
10967
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
10968
+ url: string().min(1),
10969
+ sizeMB: number().nonnegative(),
10970
+ isDirectory: boolean().optional(),
10971
+ files: array(string()).optional(),
10972
+ runtimes: array(literal("python")).optional(),
10973
+ revision: string().min(1)
10974
+ });
10975
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
10976
+ var TrainingCatalogDraftSchema = object({
10977
+ id: string().min(1),
10978
+ name: string().min(1),
10979
+ description: string(),
10980
+ labels: array(unknown()),
10981
+ inputSize: object({
10982
+ width: number().int().positive(),
10983
+ height: number().int().positive()
10984
+ }),
10985
+ preprocessMode: literal("letterbox"),
10986
+ defaultClassFloors: FloorsSchema,
10987
+ formats: object({
10988
+ onnx: DraftFormatSchema.optional(),
10989
+ openvino: DraftFormatSchema.optional(),
10990
+ coreml: DraftFormatSchema.optional()
10991
+ })
10992
+ });
10993
+ /** One class of one model's holdout report (the eval harness's summary). */
10994
+ var TrainingEvalClassSchema = object({
10995
+ positives: number().int(),
10996
+ floor: number().nullable(),
10997
+ tp: number().int(),
10998
+ fp: number().int(),
10999
+ fn: number().int(),
11000
+ precision: number().nullable(),
11001
+ recall: number().nullable(),
11002
+ ap50: number().nullable(),
11003
+ recallByCamera: record(string(), number().nullable()).optional(),
11004
+ recallByLight: record(string(), number().nullable()).optional(),
11005
+ fpByCamera: record(string(), number()).optional(),
11006
+ smallFound: number().int().optional(),
11007
+ smallTotal: number().int().optional()
11008
+ }).passthrough();
11009
+ var TrainingEvalReportSchema = object({
11010
+ frames: number().int(),
11011
+ classes: record(string(), TrainingEvalClassSchema)
11012
+ }).passthrough();
11013
+ /**
11014
+ * A succeeded result carries every block; a failed one carries the error and
11015
+ * whatever was known by then — the other blocks are ABSENT, not null. The
11016
+ * orchestrator checks the blocks it needs before it trusts a success.
11017
+ */
11018
+ var TrainingResultSchema = object({
11019
+ schema: literal(TRAINING_RESULT_SCHEMA),
11020
+ jobKey: string(),
11021
+ status: _enum(["succeeded", "failed"]),
11022
+ error: object({
11023
+ stage: string(),
11024
+ code: string(),
11025
+ message: string()
11026
+ }).nullable(),
11027
+ trainer: object({
11028
+ version: string(),
11029
+ revision: string()
11030
+ }),
11031
+ toolchain: record(string(), string().nullable()),
11032
+ dataset: object({
11033
+ versionId: string(),
11034
+ annotationHash: string(),
11035
+ sha256: string(),
11036
+ frames: object({
11037
+ train: number().int(),
11038
+ val: number().int(),
11039
+ holdout: number().int()
11040
+ }),
11041
+ holdoutCameras: array(number().int()),
11042
+ replayImages: number().int()
11043
+ }).optional(),
11044
+ training: object({
11045
+ epochsRun: number().int(),
11046
+ bestEpoch: number().int(),
11047
+ bestMap50: number(),
11048
+ bestMap50_95: number(),
11049
+ seconds: number()
11050
+ }).optional(),
11051
+ evaluation: object({
11052
+ holdoutFrames: number().int(),
11053
+ baseline: TrainingEvalReportSchema.nullable(),
11054
+ candidate: TrainingEvalReportSchema.nullable(),
11055
+ candidateInt8: TrainingEvalReportSchema.nullable(),
11056
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
11057
+ map50: record(string(), number().nullable())
11058
+ }).optional(),
11059
+ floors: object({
11060
+ baseline: FloorsSchema,
11061
+ candidate: FloorsSchema,
11062
+ candidateInt8: FloorsSchema.nullable(),
11063
+ notes: array(string())
11064
+ }).optional(),
11065
+ int8: object({
11066
+ kept: boolean(),
11067
+ map50Fp16: number().nullable(),
11068
+ map50Int8: number().nullable(),
11069
+ reason: string().nullable()
11070
+ }).optional(),
11071
+ exportsDropped: array(object({
11072
+ export: string(),
11073
+ reason: string()
11074
+ })).optional(),
11075
+ files: array(TrainingResultFileSchema).optional(),
11076
+ bundle: object({
11077
+ path: literal("bundle.tar"),
11078
+ bytes: number().int().nonnegative(),
11079
+ sha256: string().regex(/^[0-9a-f]{64}$/)
11080
+ }).nullable().optional(),
11081
+ catalogDraft: object({
11082
+ base: TrainingCatalogDraftSchema,
11083
+ int8: TrainingCatalogDraftSchema.nullable()
11084
+ }).nullable().optional(),
11085
+ licence: string()
11086
+ });
11087
+ var TrainingStageSchema = _enum([
11088
+ "prepare",
11089
+ "replay",
11090
+ "train",
11091
+ "eval",
11092
+ "export",
11093
+ "package"
11094
+ ]);
11095
+ var EventBase = {
11096
+ v: literal(1),
11097
+ ts: number()
11098
+ };
11099
+ discriminatedUnion("type", [
11100
+ object({
11101
+ ...EventBase,
11102
+ type: literal("stage"),
11103
+ stage: TrainingStageSchema
11104
+ }),
11105
+ object({
11106
+ ...EventBase,
11107
+ type: literal("epoch"),
11108
+ epoch: number().int(),
11109
+ epochs: number().int(),
11110
+ boxLoss: number().nullable().optional(),
11111
+ map50: number().nullable().optional(),
11112
+ map50_95: number().nullable().optional(),
11113
+ etaSec: number().nullable().optional()
11114
+ }),
11115
+ object({
11116
+ ...EventBase,
11117
+ type: literal("metric"),
11118
+ name: string(),
11119
+ value: number()
11120
+ }),
11121
+ object({
11122
+ ...EventBase,
11123
+ type: literal("artifact"),
11124
+ path: string(),
11125
+ bytes: number(),
11126
+ sha256: string()
11127
+ }),
11128
+ object({
11129
+ ...EventBase,
11130
+ type: literal("done"),
11131
+ status: _enum(["succeeded", "failed"]),
11132
+ resultSha256: string().nullable().optional()
11133
+ }),
11134
+ object({
11135
+ ...EventBase,
11136
+ type: literal("error"),
11137
+ stage: string(),
11138
+ code: string(),
11139
+ message: string()
11140
+ })
11141
+ ]);
11142
+ /**
10438
11143
  * What the gate decided about a birth, from the CALLER's point of view.
10439
11144
  *
10440
11145
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -12762,7 +13467,9 @@ var AddonHttpRouteSchema = object({
12762
13467
  "authenticated",
12763
13468
  "admin"
12764
13469
  ]).optional(),
12765
- description: string().optional()
13470
+ description: string().optional(),
13471
+ /** The hub limits this route per client address before the handler runs. */
13472
+ rateLimit: _enum(["auth"]).optional()
12766
13473
  });
12767
13474
  /**
12768
13475
  * Cross-process route invocation envelope. The hub captures the
@@ -13467,6 +14174,37 @@ var BackupDestinationInfoSchema = object({
13467
14174
  lastError: string().optional()
13468
14175
  });
13469
14176
  /**
14177
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
14178
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
14179
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
14180
+ * with it off — which restores without a key.
14181
+ */
14182
+ var BackupArchiveEncryptionSchema = object({
14183
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
14184
+ scheme: string(),
14185
+ /** 16 hex — the backup key whose secret restores this archive. */
14186
+ keyId: string()
14187
+ });
14188
+ /**
14189
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
14190
+ * one new archives are encrypted to, and the retired ones older archives
14191
+ * still need. The secret key is shown once, at `setupEncryption`.
14192
+ */
14193
+ var BackupEncryptionStatusSchema = object({
14194
+ enabled: boolean(),
14195
+ active: object({
14196
+ keyId: string(),
14197
+ publicKey: string(),
14198
+ createdAt: number()
14199
+ }).nullable(),
14200
+ /** Every key ever set up, newest first. */
14201
+ keys: array(object({
14202
+ keyId: string(),
14203
+ createdAt: number(),
14204
+ retiredAt: number().nullable()
14205
+ })).readonly()
14206
+ });
14207
+ /**
13470
14208
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
13471
14209
  * Same shape the destination drill-in renders. Sourced from the per-
13472
14210
  * location `manifests.json` (no per-archive tarball read required).
@@ -13478,7 +14216,9 @@ var BackupArchiveEntrySchema = object({
13478
14216
  sizeBytes: number(),
13479
14217
  label: string().optional(),
13480
14218
  /** Top-level locations included in the archive (db, addons, tls, …). */
13481
- locations: array(string()).readonly()
14219
+ locations: array(string()).readonly(),
14220
+ /** Present when the archive is encrypted; restore then needs that key. */
14221
+ encryption: BackupArchiveEncryptionSchema.optional()
13482
14222
  });
13483
14223
  var BackupEntrySchema = object({
13484
14224
  id: string(),
@@ -13487,7 +14227,8 @@ var BackupEntrySchema = object({
13487
14227
  label: string().optional(),
13488
14228
  createdAt: number(),
13489
14229
  sizeBytes: number(),
13490
- locations: array(string()).optional()
14230
+ locations: array(string()).optional(),
14231
+ encryption: BackupArchiveEncryptionSchema.optional()
13491
14232
  });
13492
14233
  var ArchiveEntrySchema = object({
13493
14234
  path: string(),
@@ -13676,10 +14417,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
13676
14417
  * this list and skips entries whose path doesn't start with
13677
14418
  * any of them.
13678
14419
  */
13679
- locations: array(string()).optional()
14420
+ locations: array(string()).optional(),
14421
+ /**
14422
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
14423
+ * one). The archive is decrypted into the hub's private staging
14424
+ * before the restart; the key is not stored. A wrong or missing key
14425
+ * is refused before the archive is downloaded.
14426
+ */
14427
+ backupSecretKey: string().optional()
13680
14428
  }), _void(), {
13681
14429
  kind: "mutation",
13682
14430
  auth: "admin"
14431
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
14432
+ keyId: string(),
14433
+ secretKey: string(),
14434
+ publicKey: string(),
14435
+ createdAt: number(),
14436
+ replacedKeyId: string().nullable()
14437
+ }), {
14438
+ kind: "mutation",
14439
+ auth: "admin"
14440
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
14441
+ kind: "mutation",
14442
+ auth: "admin"
14443
+ }), method(object({ backupSecretKey: string() }), object({
14444
+ valid: boolean(),
14445
+ keyId: string().nullable(),
14446
+ /** The hub knows this key (active or retired). */
14447
+ known: boolean(),
14448
+ /** It is the key new archives are encrypted to. */
14449
+ active: boolean(),
14450
+ error: string().optional()
14451
+ }), {
14452
+ kind: "mutation",
14453
+ auth: "admin"
13683
14454
  }), method(object({
13684
14455
  destinationId: string(),
13685
14456
  backupId: string()
@@ -15405,7 +16176,60 @@ var CustomModelDescriptorSchema = object({
15405
16176
  stepId: string(),
15406
16177
  entry: ModelCatalogEntrySchema
15407
16178
  });
15408
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
16179
+ /** One regular file of an imported bundle, as the producer measured it. */
16180
+ var ModelBundleFileSchema = object({
16181
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
16182
+ path: string().min(1),
16183
+ bytes: number().int().nonnegative(),
16184
+ sha256: string().regex(/^[0-9a-f]{64}$/)
16185
+ });
16186
+ var ImportModelBundleInputSchema = object({
16187
+ /** The registry provider that keeps the model (Model Studio). */
16188
+ addonId: string(),
16189
+ stepId: string().min(1),
16190
+ /**
16191
+ * The catalog rows to register, complete, every format URL already
16192
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
16193
+ * bundle may carry several rows (a base and its INT8 variant).
16194
+ */
16195
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
16196
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
16197
+ bundle: object({
16198
+ ticket: PeerBytesTicketSchema,
16199
+ bytes: number().int().positive(),
16200
+ sha256: string().regex(/^[0-9a-f]{64}$/)
16201
+ }),
16202
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
16203
+ files: array(ModelBundleFileSchema).min(1).max(64),
16204
+ /** Convert missing engine formats and push the model to every agent afterwards. */
16205
+ distribute: boolean()
16206
+ });
16207
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
16208
+ kind: literal("imported"),
16209
+ modelIds: array(string()).readonly(),
16210
+ distributed: array(object({
16211
+ modelId: string(),
16212
+ nodeId: string(),
16213
+ format: _enum(MODEL_FORMATS),
16214
+ ok: boolean(),
16215
+ error: string().optional()
16216
+ })).readonly()
16217
+ }), object({
16218
+ kind: literal("refused"),
16219
+ reason: _enum([
16220
+ "transfer-failed",
16221
+ "checksum-mismatch",
16222
+ "bundle-mismatch",
16223
+ "invalid-entry",
16224
+ "id-taken"
16225
+ ]),
16226
+ detail: string()
16227
+ })]);
16228
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
16229
+ kind: "mutation",
16230
+ auth: "admin",
16231
+ timeoutMs: 30 * 6e4
16232
+ });
15409
16233
  /**
15410
16234
  * Query filter for settings-store collections.
15411
16235
  */
@@ -15884,6 +16708,35 @@ var KeychainKeySourceSchema = object({
15884
16708
  */
15885
16709
  sharesBackupWithDatabase: boolean()
15886
16710
  });
16711
+ /**
16712
+ * One keychain reset, as the Secrets page reports it until the operator
16713
+ * acknowledges it. Never a value: refs, counts and table names only.
16714
+ */
16715
+ var KeychainResetRecordSchema = object({
16716
+ id: string(),
16717
+ at: number(),
16718
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
16719
+ actor: string(),
16720
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
16721
+ lockedReason: string().nullable(),
16722
+ /** Values moved into the archive table (ciphertext under the lost key). */
16723
+ archived: number().int(),
16724
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
16725
+ archivedCollection: string().nullable(),
16726
+ /**
16727
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
16728
+ * so the archive can still be opened if the lost master key turns up.
16729
+ */
16730
+ archivedKeysCollection: string().nullable(),
16731
+ /**
16732
+ * `system-settings` keys whose marker the reset cleared — the cluster
16733
+ * secret's: a marker left pointing at an archived value would refuse every
16734
+ * agent forever (D797).
16735
+ */
16736
+ clearedSettingsKeys: array(string()).readonly(),
16737
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
16738
+ acknowledgedAt: number().nullable()
16739
+ });
15887
16740
  var KeychainStatusSchema = object({
15888
16741
  keychain: KeychainStateSchema,
15889
16742
  /** The source of the master key in use; `null` while locked. */
@@ -15901,7 +16754,9 @@ var KeychainStatusSchema = object({
15901
16754
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
15902
16755
  retiredWraps: number().int(),
15903
16756
  recoveryKeyDownloadedAt: number().nullable(),
15904
- secretCount: number().int()
16757
+ secretCount: number().int(),
16758
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
16759
+ lastReset: KeychainResetRecordSchema.nullable()
15905
16760
  });
15906
16761
  /**
15907
16762
  * Whether a stored value is still pointed at by its owner's settings.
@@ -15923,17 +16778,26 @@ var KeychainAuditActionSchema = _enum([
15923
16778
  "download-recovery-key",
15924
16779
  "delete-orphans",
15925
16780
  "reset",
16781
+ "acknowledge-reset",
15926
16782
  "initialize"
15927
16783
  ]);
15928
16784
  var KeychainAuditEntrySchema = object({
15929
16785
  id: string(),
15930
16786
  at: number(),
15931
16787
  action: KeychainAuditActionSchema,
15932
- /** `addon:<id>` | `user:<id>` | `system`. */
16788
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
15933
16789
  actor: string(),
15934
16790
  ref: string().nullable(),
15935
16791
  detail: string().nullable()
15936
16792
  });
16793
+ var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
16794
+ /**
16795
+ * Secrets the HUB itself holds (owner `system`) that no settings form shows:
16796
+ * `jwt-signing-key` — the session signing key (D797). It is always "in use",
16797
+ * never an orphan; it is generated on a fresh hub and replaced only through
16798
+ * {@link keychainAdminCapability.methods.setSystemSecret}.
16799
+ */
16800
+ var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
15937
16801
  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({
15938
16802
  value: string(),
15939
16803
  version: number().int()
@@ -15941,6 +16805,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15941
16805
  kind: "mutation",
15942
16806
  auth: "admin",
15943
16807
  caller: "required"
16808
+ }), method(object({
16809
+ name: SystemHeldSecretNameSchema,
16810
+ value: string().min(16)
16811
+ }), object({
16812
+ ref: string(),
16813
+ version: number().int()
16814
+ }), {
16815
+ kind: "mutation",
16816
+ auth: "admin",
16817
+ caller: "required"
15944
16818
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
15945
16819
  deleted: array(string()).readonly(),
15946
16820
  kept: array(object({
@@ -15970,13 +16844,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15970
16844
  kind: "mutation",
15971
16845
  auth: "admin",
15972
16846
  caller: "required"
15973
- }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
16847
+ }), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
15974
16848
  archivedCollection: string().nullable(),
15975
16849
  archived: number().int()
15976
16850
  }), {
15977
16851
  kind: "mutation",
15978
16852
  auth: "admin",
15979
16853
  caller: "required"
16854
+ }), method(object({}), object({
16855
+ reset: KeychainResetRecordSchema.nullable(),
16856
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
16857
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
16858
+ kind: "mutation",
16859
+ auth: "admin",
16860
+ caller: "required"
15980
16861
  });
15981
16862
  method(_void(), object({
15982
16863
  id: string(),
@@ -18638,14 +19519,14 @@ var LlmProfileSchema = object({
18638
19519
  /** ConfigUISchema tree passed through untyped on the wire (the
18639
19520
  * notification-output `ConfigSchemaPassthrough` precedent at
18640
19521
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
18641
- var ConfigSchemaPassthrough$1 = unknown();
19522
+ var ConfigSchemaPassthrough$3 = unknown();
18642
19523
  var LlmProfileKindDescriptorSchema = object({
18643
19524
  kind: LlmProfileKindSchema,
18644
19525
  label: string(),
18645
19526
  icon: string(),
18646
19527
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
18647
19528
  addonId: string(),
18648
- configSchema: ConfigSchemaPassthrough$1
19529
+ configSchema: ConfigSchemaPassthrough$3
18649
19530
  });
18650
19531
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
18651
19532
  var LlmDefaultSchema = object({
@@ -18923,7 +19804,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
18923
19804
  * `login-method` — collection cap through which auth addons contribute
18924
19805
  * their pre-auth login surfaces to the login page. This is the SINGLE,
18925
19806
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
18926
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
19807
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
18927
19808
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
18928
19809
  * procedure aggregates them for the unauthenticated login page.
18929
19810
  *
@@ -18931,8 +19812,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
18931
19812
  *
18932
19813
  * - `redirect` — a declarative button. The login page renders a generic
18933
19814
  * button that navigates to `startUrl` (an addon-owned HTTP route).
18934
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
18935
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
19815
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
18936
19816
  * login page needs NO change.
18937
19817
  *
18938
19818
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -18951,8 +19831,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
18951
19831
  * decision.
18952
19832
  *
18953
19833
  * Every contribution carries a `stage`:
18954
- * - `primary` — shown on the first credentials screen (OIDC /
18955
- * magic-link buttons; a future usernameless passkey).
19834
+ * - `primary` — shown on the first credentials screen (OIDC
19835
+ * buttons; a usernameless passkey).
18956
19836
  * - `second-factor` — shown AFTER the password leg, gated on the
18957
19837
  * returned `factors` (passkey-as-2FA today).
18958
19838
  *
@@ -18979,7 +19859,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
18979
19859
  * The provider names an external identity a signed-in user can link to
18980
19860
  * their own account (D782): `auth.listLinkableProviders` /
18981
19861
  * `beginExternalLink` offer exactly the redirect methods that set this,
18982
- * whatever their id. Absent / false — a login button only (magic-link).
19862
+ * whatever their id. Absent / false — a login button only.
18983
19863
  */
18984
19864
  linkable: boolean().optional()
18985
19865
  }),
@@ -19767,7 +20647,7 @@ var TargetKindCapsSchema = object({
19767
20647
  * the union is large and not meant for runtime validation here; the exported
19768
20648
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
19769
20649
  */
19770
- var ConfigSchemaPassthrough = unknown();
20650
+ var ConfigSchemaPassthrough$2 = unknown();
19771
20651
  var TargetKindSchema = object({
19772
20652
  kind: string(),
19773
20653
  label: string(),
@@ -19804,7 +20684,7 @@ var TargetKindSchema = object({
19804
20684
  * its raster path, which is the safe default for an unknown image.
19805
20685
  */
19806
20686
  iconMediaType: string().optional(),
19807
- configSchema: ConfigSchemaPassthrough,
20687
+ configSchema: ConfigSchemaPassthrough$2,
19808
20688
  /**
19809
20689
  * The config keys that decide WHERE this kind's secrets are sent (server,
19810
20690
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -22834,8 +23714,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
22834
23714
  * `super_admin` — collapsed onto the single boolean because every
22835
23715
  * non-admin caller is governed by the same scope-check rules; the
22836
23716
  * distinction was only ever used to route role-specific procedures
22837
- * which we no longer have. Agents are admin sessions issued via
22838
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
23717
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
22839
23718
  * with `isAdmin: false` + an explicit scope list.
22840
23719
  */
22841
23720
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -23142,6 +24021,61 @@ var OauthIntegrationDescriptorSchema = object({
23142
24021
  });
23143
24022
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
23144
24023
  /**
24024
+ * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
24025
+ *
24026
+ * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
24027
+ * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
24028
+ * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
24029
+ * immutable after create.
24030
+ */
24031
+ var ConfigSchemaPassthrough$1 = unknown();
24032
+ var OidcConnectionSchema = object({
24033
+ id: string().min(1),
24034
+ displayName: string(),
24035
+ icon: string(),
24036
+ issuerUrl: string(),
24037
+ clientId: string(),
24038
+ /** Client id + secret present — never the secret value. */
24039
+ configured: boolean(),
24040
+ /**
24041
+ * Values for the connection form schema. `clientSecret` is a keychain
24042
+ * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
24043
+ */
24044
+ formValues: record(string(), unknown()).optional()
24045
+ });
24046
+ /**
24047
+ * Patch one connection. Omitted or empty `clientSecret` keeps the stored
24048
+ * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
24049
+ */
24050
+ var OidcConnectionUpdateInputSchema = object({
24051
+ id: string().min(1),
24052
+ displayName: string().min(1),
24053
+ icon: string().optional(),
24054
+ issuerUrl: string().optional(),
24055
+ clientId: string().optional(),
24056
+ clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
24057
+ redirectUri: string().optional(),
24058
+ scopes: string().optional(),
24059
+ usernameClaim: _enum([
24060
+ "preferred_username",
24061
+ "email",
24062
+ "sub"
24063
+ ]).optional()
24064
+ });
24065
+ method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
24066
+ id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
24067
+ displayName: string().min(1)
24068
+ }), object({ id: string() }), {
24069
+ kind: "mutation",
24070
+ auth: "admin"
24071
+ }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
24072
+ kind: "mutation",
24073
+ auth: "admin"
24074
+ }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
24075
+ kind: "mutation",
24076
+ auth: "admin"
24077
+ });
24078
+ /**
23145
24079
  * What started a camera's onboard motion (D672). `camera` is the camera's own
23146
24080
  * firmware; `sensor` is a device the operator ATTACHED to it. Absent on the
23147
24081
  * wire means the camera: only the camera-sensors bridge ever says `sensor`.
@@ -24498,21 +25432,69 @@ var RetrainFrameListSchema = object({
24498
25432
  /** What the page pre-selects — the native key frame when one survives. */
24499
25433
  autoPickMediaId: number().int().optional()
24500
25434
  });
25435
+ /** Exclusive partition of a corpus copy's annotation progress (design §4.2). */
25436
+ var RetrainFrameWorkStateSchema = _enum([
25437
+ "unannotated",
25438
+ "annotated",
25439
+ "complete"
25440
+ ]);
25441
+ /**
25442
+ * Filters for paginated corpus list, KPI, and matching export (design §4.4).
25443
+ * Every narrowing field is ANDed; omitted fields impose no constraint.
25444
+ */
25445
+ var RetrainCorpusFilterSchema = object({
25446
+ workState: RetrainFrameWorkStateSchema.optional(),
25447
+ deviceIds: array(number()).max(500).optional(),
25448
+ /** When set, only frames in this named collection. */
25449
+ collectionId: string().optional(),
25450
+ /** Frames that carry at least one saved annotation in one of these classes. */
25451
+ classes: array(RetrainMacroClassSchema).optional(),
25452
+ page: number().int().positive().default(1),
25453
+ pageSize: number().int().positive().max(100).default(50)
25454
+ });
25455
+ var RetrainCorpusPageSchema = object({
25456
+ frames: array(RetrainFrameSchema.extend({ workState: RetrainFrameWorkStateSchema })).readonly(),
25457
+ total: number().int().nonnegative(),
25458
+ page: number().int().positive(),
25459
+ pageSize: number().int().positive()
25460
+ });
25461
+ var RetrainCorpusKpiCameraRowSchema = object({
25462
+ deviceId: number(),
25463
+ unannotated: number().int().nonnegative(),
25464
+ annotated: number().int().nonnegative(),
25465
+ complete: number().int().nonnegative(),
25466
+ /** This camera's `complete` count divided by corpus `total`, in `[0,1]`.
25467
+ * `null` when the corpus is empty (no ratio). */
25468
+ pctOfCorpus: number().min(0).max(1).nullable()
25469
+ });
25470
+ var RetrainCorpusKpiSchema = object({
25471
+ total: number().int().nonnegative(),
25472
+ unannotated: number().int().nonnegative(),
25473
+ annotated: number().int().nonnegative(),
25474
+ complete: number().int().nonnegative(),
25475
+ cameras: array(RetrainCorpusKpiCameraRowSchema).readonly()
25476
+ });
24501
25477
  /**
24502
25478
  * Which frames an annotated export carries. Every field narrows; an empty
24503
- * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
24504
- * list owned by whoever trains (the training orchestrator), so `frameIds` is
24505
- * the primitive a version export uses; `batchId` re-selects what an earlier
24506
- * export carried (`exportedInBatch`).
25479
+ * filter is every annotated copy. `frameIds` is the primitive a job or
25480
+ * download uses; `batchId` re-selects what an earlier export carried
25481
+ * (`exportedInBatch`). Frozen dataset versions were removed — live selection
25482
+ * resolves to `frameIds` at plan/start.
24507
25483
  */
24508
25484
  var RetrainExportFilterSchema = object({
24509
25485
  deviceIds: array(number()).optional(),
24510
25486
  frameIds: array(string()).max(2e4).optional(),
24511
25487
  /** Only frames in at least one of these named collections. */
24512
25488
  collectionIds: array(string()).max(200).optional(),
25489
+ /** Single collection (Frames filter bar). ANDed with `collectionIds` when both set. */
25490
+ collectionId: string().optional(),
24513
25491
  batchId: string().optional(),
24514
25492
  /** Only frames the operator marked complete (all subjects boxed). */
24515
- completeOnly: boolean().optional()
25493
+ completeOnly: boolean().optional(),
25494
+ /** Exclusive work-state partition (`workStateOf`); same as the corpus list. */
25495
+ workState: RetrainFrameWorkStateSchema.optional(),
25496
+ /** Frames with at least one saved annotation in one of these classes. */
25497
+ classes: array(RetrainMacroClassSchema).optional()
24516
25498
  });
24517
25499
  /**
24518
25500
  * `frames`: the full frame copies, boxes in `annotations.json`.
@@ -24677,6 +25659,77 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
24677
25659
  ]),
24678
25660
  detail: string().optional()
24679
25661
  })]);
25662
+ /** What a dataset version is cut from. Every field narrows. */
25663
+ var RetrainDatasetSelectionSchema = object({
25664
+ deviceIds: array(number()).readonly().optional(),
25665
+ collectionIds: array(string()).max(200).readonly().optional(),
25666
+ frameIds: array(string()).max(2e4).readonly().optional()
25667
+ });
25668
+ /** The counts a dataset is judged by. */
25669
+ var RetrainDatasetStatsSchema = object({
25670
+ frames: number().int(),
25671
+ completeFrames: number().int(),
25672
+ /** `completeFrames / frames`, 0..1. */
25673
+ completeness: number(),
25674
+ /** Boxes to learn (model errors excluded). */
25675
+ subjects: number().int(),
25676
+ modelErrors: number().int(),
25677
+ /** Complete frames with no subject. */
25678
+ hardNegatives: number().int(),
25679
+ /** Subjects per class × camera × day/night. */
25680
+ cells: array(object({
25681
+ macroClass: string(),
25682
+ deviceId: number(),
25683
+ lighting: _enum([
25684
+ "day",
25685
+ "night",
25686
+ "unknown"
25687
+ ]),
25688
+ subjects: number().int(),
25689
+ frames: number().int()
25690
+ })).readonly(),
25691
+ cameras: array(object({
25692
+ deviceId: number(),
25693
+ frames: number().int(),
25694
+ completeFrames: number().int()
25695
+ })).readonly()
25696
+ });
25697
+ object({
25698
+ id: string(),
25699
+ name: string(),
25700
+ createdAt: number(),
25701
+ selection: RetrainDatasetSelectionSchema,
25702
+ layout: RetrainExportLayoutSchema,
25703
+ completeOnly: boolean(),
25704
+ frameCount: number().int(),
25705
+ annotationHash: string(),
25706
+ manifestSchema: string(),
25707
+ stats: RetrainDatasetStatsSchema
25708
+ });
25709
+ /**
25710
+ * Live training corpus criteria — same shape as `TrainingCorpusSelection` on
25711
+ * the training cap. Resolved here so plan/start and the annotated export share
25712
+ * one definition of "the frames" (`buildRetrainExportPlan`).
25713
+ */
25714
+ var RetrainTrainingCorpusSelectionSchema = object({
25715
+ collectionIds: array(string()).min(1),
25716
+ workState: _enum([
25717
+ "complete",
25718
+ "annotated_or_complete",
25719
+ "any_annotated"
25720
+ ]).default("complete")
25721
+ });
25722
+ var RetrainTrainingCorpusResolveResultSchema = discriminatedUnion("kind", [object({
25723
+ kind: literal("resolved"),
25724
+ frameIds: array(string()).max(2e4).readonly(),
25725
+ stats: RetrainDatasetStatsSchema,
25726
+ annotationHash: string(),
25727
+ layout: RetrainExportLayoutSchema
25728
+ }), object({
25729
+ kind: literal("refused"),
25730
+ reason: _enum(["unknown-collection", "no-frames"]),
25731
+ detail: string()
25732
+ })]);
24680
25733
  /** The outcome of a lifecycle move owned by the retrain page. */
24681
25734
  var RetrainTransitionResultSchema = object({
24682
25735
  trackId: string(),
@@ -25382,6 +26435,12 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
25382
26435
  }), array(RetrainTrackSchema).readonly(), {
25383
26436
  kind: "query",
25384
26437
  auth: "admin"
26438
+ }), method(RetrainCorpusFilterSchema, RetrainCorpusPageSchema, {
26439
+ kind: "query",
26440
+ auth: "admin"
26441
+ }), method(object({}), RetrainCorpusKpiSchema, {
26442
+ kind: "query",
26443
+ auth: "admin"
25385
26444
  }), method(object({ trackId: string() }), RetrainFrameListSchema, {
25386
26445
  kind: "query",
25387
26446
  auth: "admin"
@@ -25466,6 +26525,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
25466
26525
  kind: "mutation",
25467
26526
  auth: "admin",
25468
26527
  timeoutMs: 60 * 6e4
26528
+ }), method(object({
26529
+ filter: RetrainExportFilterSchema,
26530
+ layout: RetrainExportLayoutSchema
26531
+ }), object({
26532
+ ticket: PeerBytesTicketSchema,
26533
+ frames: number().int(),
26534
+ annotations: number().int()
26535
+ }), {
26536
+ kind: "mutation",
26537
+ auth: "admin",
26538
+ timeoutMs: 12e4
25469
26539
  }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
25470
26540
  kind: "query",
25471
26541
  auth: "admin"
@@ -25492,6 +26562,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
25492
26562
  }), method(object({}), array(RetrainCollectionSchema).readonly(), {
25493
26563
  kind: "query",
25494
26564
  auth: "admin"
26565
+ }), method(RetrainTrainingCorpusSelectionSchema, RetrainTrainingCorpusResolveResultSchema, {
26566
+ kind: "query",
26567
+ auth: "admin",
26568
+ timeoutMs: 6e4
25495
26569
  }), method(object({
25496
26570
  id: string(),
25497
26571
  name: string().max(120)
@@ -26108,11 +27182,14 @@ var HardwareClassIdSchema = _enum([
26108
27182
  "intel-n-series",
26109
27183
  "apple-m-base",
26110
27184
  "apple-m-pro",
27185
+ "amd-phoenix",
26111
27186
  "unknown"
26112
27187
  ]);
26113
27188
  var AcceleratorKindSchema = _enum([
26114
27189
  "intel-npu",
26115
27190
  "intel-igpu",
27191
+ "amd-igpu",
27192
+ "amd-npu",
26116
27193
  "x86-cpu",
26117
27194
  "arm-cpu",
26118
27195
  "apple-ane",
@@ -28042,6 +29119,8 @@ var AgentPipelineSettingsSchema = object({
28042
29119
  * address is wrong (multi-homed host, NAT, custom interface).
28043
29120
  */
28044
29121
  reachableHost: string().optional(),
29122
+ /** Hub-persisted UI colour (`--color-node-*` theme tokens). */
29123
+ color: NodeColorIdSchema.optional(),
28045
29124
  /**
28046
29125
  * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
28047
29126
  * weight, steps}. Absent / all-disabled ⇒ the node's single default
@@ -28591,8 +29670,9 @@ method(object({
28591
29670
  auth: "admin"
28592
29671
  }), method(object({
28593
29672
  agentNodeId: string(),
28594
- reachableHost: string().nullable()
28595
- }), object({ success: literal(true) }), {
29673
+ reachableHost: string().nullable().optional(),
29674
+ color: NodeColorIdSchema.nullable().optional()
29675
+ }).refine((v) => v.reachableHost !== void 0 || v.color !== void 0, { message: "reachableHost or color required" }), object({ success: literal(true) }), {
28596
29676
  kind: "mutation",
28597
29677
  auth: "admin"
28598
29678
  }), method(object({
@@ -29044,8 +30124,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
29044
30124
  * `smtp-provider` — pluggable email delivery surface.
29045
30125
  *
29046
30126
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
29047
- * one for transactional / one for notifications). Consumers (magic-link,
29048
- * notifier addons, …) walk the collection and pick the first
30127
+ * one for transactional / one for notifications). Consumers (notifier
30128
+ * addons, …) walk the collection and pick the first
29049
30129
  * ready provider OR target a specific addonId.
29050
30130
  *
29051
30131
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -29224,7 +30304,7 @@ targets: array(object({
29224
30304
  })));
29225
30305
  /**
29226
30306
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
29227
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
30307
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
29228
30308
  * carrying the post-callback claims before redirecting back to
29229
30309
  * `/api/auth/sso/finish`.
29230
30310
  *
@@ -29287,7 +30367,14 @@ var SsoBridgeClaimsSchema = object({
29287
30367
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
29288
30368
  * subject is unique only per issuer, so a link is bound to it.
29289
30369
  */
29290
- issuer: string().optional()
30370
+ issuer: string().optional(),
30371
+ /**
30372
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
30373
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
30374
+ * request to present the matching cookie — a login bridge is useless in
30375
+ * any other browser.
30376
+ */
30377
+ browserBinding: string().optional()
29291
30378
  });
29292
30379
  method(object({
29293
30380
  claims: SsoBridgeClaimsSchema,
@@ -31661,7 +32748,7 @@ var CustomActionInputSchema = object({
31661
32748
  action: string().min(1),
31662
32749
  input: unknown()
31663
32750
  });
31664
- method(_void(), array(AddonListItemSchema).readonly()), method(object({
32751
+ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSchema).readonly()), method(object({
31665
32752
  addonId: string(),
31666
32753
  limit: number().min(1).max(500).default(100),
31667
32754
  level: LogLevelSchema$2.optional()
@@ -36723,7 +37810,13 @@ var TopologyNodeSchema = object({
36723
37810
  })).readonly(),
36724
37811
  processes: array(TopologyProcessSchema).readonly(),
36725
37812
  categories: array(TopologyCategorySchema).readonly(),
36726
- rootPackage: TopologyRootPackageSchema.nullable()
37813
+ rootPackage: TopologyRootPackageSchema.nullable(),
37814
+ /**
37815
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
37816
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
37817
+ * for offline rows and when the hub cannot tell.
37818
+ */
37819
+ meshTransport: _enum(["tls", "clear"]).optional()
36727
37820
  });
36728
37821
  var CapUsageEdgeSchema = object({
36729
37822
  callerAddonId: string(),
@@ -37136,6 +38229,7 @@ var OsdNamedTemplateSchema = object({
37136
38229
  });
37137
38230
  /** Where a slot's value comes from. */
37138
38231
  var OsdSourceSchema = discriminatedUnion("kind", [
38232
+ object({ kind: literal("none") }),
37139
38233
  object({
37140
38234
  kind: literal("static"),
37141
38235
  text: string().max(64)
@@ -37262,6 +38356,13 @@ method(object({ deviceId: number().int() }), object({
37262
38356
  }), object({ success: literal(true) }), {
37263
38357
  kind: "mutation",
37264
38358
  auth: "admin"
38359
+ }), method(object({
38360
+ deviceId: number().int(),
38361
+ slotId: string().min(1),
38362
+ enabled: boolean()
38363
+ }), object({ success: literal(true) }), {
38364
+ kind: "mutation",
38365
+ auth: "admin"
37265
38366
  }), method(object({
37266
38367
  sourceDeviceId: number().int(),
37267
38368
  targetDeviceId: number().int()
@@ -37693,7 +38794,15 @@ var GpuInfoSchema = object({
37693
38794
  name: string(),
37694
38795
  memoryMB: number().optional()
37695
38796
  });
37696
- var NpuInfoSchema = object({ type: _enum(["apple-ane", "intel-npu"]) });
38797
+ var NpuInfoSchema = object({
38798
+ type: _enum([
38799
+ "apple-ane",
38800
+ "intel-npu",
38801
+ "amd-xdna"
38802
+ ]),
38803
+ name: string().optional(),
38804
+ generation: _enum(["xdna1", "xdna2"]).optional()
38805
+ });
37697
38806
  var CoralInfoSchema = object({
37698
38807
  type: literal("coral-edgetpu"),
37699
38808
  bus: string().optional()
@@ -41546,16 +42655,6 @@ var ApiKeySummarySchema = object({
41546
42655
  createdAt: number(),
41547
42656
  lastUsedAt: number().optional()
41548
42657
  });
41549
- var CreateApiKeyInputSchema = object({
41550
- label: string(),
41551
- isAdmin: boolean().default(false),
41552
- allowedProviders: union([array(string()), literal("*")]).optional(),
41553
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
41554
- });
41555
- var CreateApiKeyResultSchema = object({
41556
- token: string(),
41557
- record: ApiKeySummarySchema
41558
- });
41559
42658
  var ScopedTokenSummarySchema = object({
41560
42659
  id: string(),
41561
42660
  userId: string(),
@@ -41654,17 +42753,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
41654
42753
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
41655
42754
  kind: "mutation",
41656
42755
  access: "view"
41657
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
41658
- kind: "mutation",
41659
- auth: "admin",
41660
- access: "create"
41661
- }), method(object({ id: string() }), object({ success: literal(true) }), {
42756
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
41662
42757
  kind: "mutation",
41663
42758
  auth: "admin",
41664
42759
  access: "delete"
41665
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
41666
- kind: "mutation",
41667
- access: "view"
41668
42760
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
41669
42761
  kind: "mutation",
41670
42762
  auth: "admin",
@@ -41738,15 +42830,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
41738
42830
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
41739
42831
  userId: string(),
41740
42832
  issuer: string()
41741
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
41742
- userId: string(),
41743
- issuer: string().min(1),
41744
- label: string().optional()
41745
- }), object({ success: literal(true) }), {
41746
- kind: "mutation",
41747
- auth: "admin",
41748
- access: "create"
41749
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
42833
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41750
42834
  kind: "mutation",
41751
42835
  auth: "admin",
41752
42836
  access: "delete"
@@ -42451,6 +43535,563 @@ var zoneRulesCapability = {
42451
43535
  */
42452
43536
  durability: "restored"
42453
43537
  };
43538
+ /**
43539
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
43540
+ *
43541
+ * A thin, mockable translation layer: it knows how to run a container with a
43542
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
43543
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
43544
+ * those are the `training` orchestrator's (D805). Every rule written there
43545
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
43546
+ * manifest entry and nothing else.
43547
+ *
43548
+ * Collection of provider **types** (addons). Each addon owns zero or more
43549
+ * **entries** (credentials + defaults). Concat-fans: `describe`,
43550
+ * `describeTypes`, `listEntries`, `listJobs`. Single-row work is keyed by
43551
+ * `entryId`; callers also pass the owning `addonId` as the collection
43552
+ * selector (broker posture). Every method is `admin`: these spend money.
43553
+ *
43554
+ * Every cloud object a provider creates is tagged with the orchestrator's
43555
+ * `jobKey`, so a retried submit finds the job it already started instead of
43556
+ * starting a second GPU, and `listJobs` can find orphans.
43557
+ *
43558
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
43559
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
43560
+ * ticket the provider mints (D613).
43561
+ */
43562
+ var TrainingGpuOptionSchema = object({
43563
+ id: string(),
43564
+ label: string(),
43565
+ /** List price, USD per GPU-hour, before any region multiplier. */
43566
+ usdPerHour: number().nonnegative(),
43567
+ vramGb: number().nonnegative()
43568
+ });
43569
+ var TrainingRegionOptionSchema = object({
43570
+ /** `''` = any region (the provider's choice). */
43571
+ id: string(),
43572
+ label: string(),
43573
+ priceMultiplier: number().positive()
43574
+ });
43575
+ /**
43576
+ * The provider's per-entry settings, as the orchestrator reads them. They
43577
+ * live on the PROVIDER addon's entry (operator decision 2026-10-08: they
43578
+ * depend on the user's account), never hard-coded in the orchestrator.
43579
+ */
43580
+ var TrainingProviderDefaultsSchema = object({
43581
+ gpuType: string(),
43582
+ region: string(),
43583
+ costCapUsd: number().nonnegative(),
43584
+ maxRuntimeSec: number().int().positive(),
43585
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
43586
+ failedDatasetGraceHours: number().nonnegative()
43587
+ });
43588
+ /**
43589
+ * Entry form schema for a provider type — same seam as notification
43590
+ * `TargetKind.configSchema` (`z.unknown()` at the wire; callers tighten to
43591
+ * {@link ConfigUISchema}). Drives `ConfigFormBuilder` on Training → Providers.
43592
+ */
43593
+ var ConfigSchemaPassthrough = unknown();
43594
+ /** One creatable provider type, for the Add-entry dialog. */
43595
+ var TrainingProviderTypeSchema = object({
43596
+ typeId: string(),
43597
+ label: string(),
43598
+ /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
43599
+ iconAsset: string(),
43600
+ /** Owning `training-provider` addon — collection selector for createEntry. */
43601
+ addonId: string(),
43602
+ /**
43603
+ * Fields for one entry of this type (credentials + defaults). Absent on a
43604
+ * type that only needs a name. Password fields are keychain-backed on the
43605
+ * provider addon (`secretStatePaths`), not D634 plaintext.
43606
+ */
43607
+ configSchema: ConfigSchemaPassthrough.optional()
43608
+ });
43609
+ /** One configured account / workspace under a provider type. */
43610
+ var TrainingProviderEntrySchema = object({
43611
+ entryId: string(),
43612
+ typeId: string(),
43613
+ name: string(),
43614
+ addonId: string(),
43615
+ /** Credentials are present — never the values. */
43616
+ configured: boolean()
43617
+ });
43618
+ var TrainingProviderDescriptorSchema = object({
43619
+ addonId: string(),
43620
+ entryId: string(),
43621
+ typeId: string(),
43622
+ /** Operator-chosen entry name. */
43623
+ name: string(),
43624
+ iconAsset: string(),
43625
+ /** `modal`, `runpod`, `fake`, … — same as typeId for current providers. */
43626
+ kind: string(),
43627
+ label: string(),
43628
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
43629
+ regions: array(TrainingRegionOptionSchema).readonly(),
43630
+ maxDatasetBytes: number().int().positive(),
43631
+ maxRuntimeSec: number().int().positive(),
43632
+ freeTierNote: string().optional(),
43633
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
43634
+ dataResidencyNote: string(),
43635
+ /** Credentials are present — never the values. */
43636
+ configured: boolean(),
43637
+ defaults: TrainingProviderDefaultsSchema,
43638
+ /**
43639
+ * Values for {@link TrainingProviderTypeSchema}'s `configSchema` — password
43640
+ * fields are keychain {@link SecretFieldView} or `null` / `''` (create),
43641
+ * never plaintext. Same hydrate contract as settings forms (D789).
43642
+ */
43643
+ formValues: record(string(), unknown()).optional()
43644
+ });
43645
+ /**
43646
+ * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
43647
+ * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
43648
+ * `{ $secretClear: true }` clears it.
43649
+ */
43650
+ var TrainingProviderUpdateEntryInputSchema = object({
43651
+ entryId: string().min(1),
43652
+ name: string().min(1),
43653
+ tokenId: string().optional(),
43654
+ tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
43655
+ environment: string().optional(),
43656
+ gpuType: string().optional(),
43657
+ region: string().optional(),
43658
+ costCapUsd: number().nonnegative().optional(),
43659
+ maxRuntimeSec: number().int().positive().optional(),
43660
+ failedDatasetGraceHours: number().nonnegative().optional()
43661
+ });
43662
+ var TrainingCredentialCheckSchema = object({
43663
+ ok: boolean(),
43664
+ /** Workspace / account name, when the provider says. */
43665
+ account: string().optional(),
43666
+ reason: _enum([
43667
+ "missing",
43668
+ "invalid",
43669
+ "forbidden",
43670
+ "network",
43671
+ "quota"
43672
+ ]).optional(),
43673
+ detail: string().optional()
43674
+ });
43675
+ var ProviderJobStateSchema = _enum([
43676
+ "pending",
43677
+ "starting",
43678
+ "running",
43679
+ "succeeded",
43680
+ "failed",
43681
+ "cancelled",
43682
+ "lost"
43683
+ ]);
43684
+ var ProviderJobStatusSchema = object({
43685
+ jobKey: string(),
43686
+ providerJobId: string().optional(),
43687
+ state: ProviderJobStateSchema,
43688
+ startedAt: number().optional(),
43689
+ endedAt: number().optional(),
43690
+ exitCode: number().int().optional(),
43691
+ failureReason: string().optional(),
43692
+ gpuType: string(),
43693
+ region: string().optional(),
43694
+ billedSeconds: number().nonnegative(),
43695
+ costUsd: number().nonnegative(),
43696
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
43697
+ costIsEstimate: boolean(),
43698
+ lastFetchedAt: number()
43699
+ });
43700
+ /**
43701
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
43702
+ * image its own way (Modal builds the published Dockerfile at that revision;
43703
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
43704
+ * in `result.json`.
43705
+ */
43706
+ var TrainerSourceRefSchema = object({
43707
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
43708
+ repo: string().min(1),
43709
+ /** A commit sha (never a branch) — the job must be reproducible. */
43710
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
43711
+ });
43712
+ /** Cloud job identity — route with the owning addon's `addonId` selector. */
43713
+ var JobRef = {
43714
+ entryId: string().min(1),
43715
+ jobKey: string().uuid()
43716
+ };
43717
+ var TrainingLogLineSchema = object({
43718
+ ts: number(),
43719
+ text: string()
43720
+ });
43721
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
43722
+ typeId: string().min(1),
43723
+ name: string().min(1)
43724
+ }), object({ entryId: string() }), {
43725
+ kind: "mutation",
43726
+ auth: "admin"
43727
+ }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
43728
+ kind: "mutation",
43729
+ auth: "admin"
43730
+ }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
43731
+ kind: "mutation",
43732
+ auth: "admin"
43733
+ }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
43734
+ kind: "mutation",
43735
+ auth: "admin",
43736
+ timeoutMs: 3e4
43737
+ }), method(object({
43738
+ entryId: string().min(1),
43739
+ gpuType: string(),
43740
+ region: string(),
43741
+ datasetBytes: number().int().nonnegative(),
43742
+ gpuSecondsLow: number().nonnegative(),
43743
+ gpuSecondsHigh: number().nonnegative()
43744
+ }), object({
43745
+ usdLow: number().nonnegative(),
43746
+ usdHigh: number().nonnegative(),
43747
+ notes: array(string()).readonly()
43748
+ }), { auth: "admin" }), method(object({
43749
+ ...JobRef,
43750
+ ticket: PeerBytesTicketSchema
43751
+ }), object({
43752
+ bytes: number().int().nonnegative(),
43753
+ sha256: string()
43754
+ }), {
43755
+ kind: "mutation",
43756
+ auth: "admin",
43757
+ timeoutMs: 120 * 6e4
43758
+ }), method(object({
43759
+ ...JobRef,
43760
+ trainer: TrainerSourceRefSchema,
43761
+ jobSpecJson: string().min(2).max(64e3),
43762
+ gpuType: string(),
43763
+ region: string(),
43764
+ maxRuntimeSec: number().int().positive()
43765
+ }), ProviderJobStatusSchema, {
43766
+ kind: "mutation",
43767
+ auth: "admin",
43768
+ timeoutMs: 30 * 6e4
43769
+ }), method(object(JobRef), ProviderJobStatusSchema, {
43770
+ auth: "admin",
43771
+ timeoutMs: 6e4
43772
+ }), method(object({
43773
+ ...JobRef,
43774
+ cursor: string().optional(),
43775
+ max: number().int().min(1).max(500)
43776
+ }), object({
43777
+ lines: array(TrainingLogLineSchema).readonly(),
43778
+ cursor: string()
43779
+ }), {
43780
+ auth: "admin",
43781
+ timeoutMs: 6e4
43782
+ }), method(object(JobRef), object({ ok: literal(true) }), {
43783
+ kind: "mutation",
43784
+ auth: "admin",
43785
+ timeoutMs: 6e4
43786
+ }), method(object(JobRef), object({
43787
+ found: boolean(),
43788
+ text: string().optional()
43789
+ }), {
43790
+ kind: "mutation",
43791
+ auth: "admin",
43792
+ timeoutMs: 5 * 6e4
43793
+ }), method(object({
43794
+ ...JobRef,
43795
+ path: _enum(["bundle.tar"])
43796
+ }), object({ ticket: PeerBytesTicketSchema }), {
43797
+ kind: "mutation",
43798
+ auth: "admin",
43799
+ timeoutMs: 5 * 6e4
43800
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
43801
+ kind: "mutation",
43802
+ auth: "admin",
43803
+ timeoutMs: 5 * 6e4
43804
+ }), method(object({ entryId: string().min(1).optional() }), array(ProviderJobStatusSchema).readonly(), {
43805
+ auth: "admin",
43806
+ timeoutMs: 2 * 6e4
43807
+ });
43808
+ /**
43809
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
43810
+ * provided by `addon-training`.
43811
+ *
43812
+ * It owns what every provider must agree on, written once:
43813
+ *
43814
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
43815
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
43816
+ * - **The return flow.** Verified artefacts → Model Studio
43817
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
43818
+ * rollback. Nothing is ever registered automatically.
43819
+ *
43820
+ * Plan/start takes a live {@link TrainingCorpusSelection} (collections +
43821
+ * work-state rule); frame ids are resolved via pipeline-analytics at that
43822
+ * moment and snapshotted on the job. No frozen dataset version.
43823
+ *
43824
+ * Every method is `admin`.
43825
+ */
43826
+ /**
43827
+ * Live corpus criteria for plan/start (design §5.2). Default is complete-only.
43828
+ * Frame ids are resolved at plan/start — never a frozen version id.
43829
+ */
43830
+ var TrainingCorpusSelectionSchema = object({
43831
+ collectionIds: array(string()).min(1),
43832
+ /** Default complete-only for v1 */
43833
+ workState: _enum([
43834
+ "complete",
43835
+ "annotated_or_complete",
43836
+ "any_annotated"
43837
+ ]).default("complete")
43838
+ });
43839
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
43840
+ var TrainingBaseModelSchema = object({
43841
+ modelId: string(),
43842
+ label: string(),
43843
+ weights: string(),
43844
+ imgsz: number().int(),
43845
+ baselineOnnxUrl: string(),
43846
+ baselineFloors: record(string(), number()),
43847
+ /** The base the fleet runs most — the UI's default. */
43848
+ recommended: boolean()
43849
+ });
43850
+ var TrainingPresetSchema = _enum([
43851
+ "quick",
43852
+ "standard",
43853
+ "thorough"
43854
+ ]);
43855
+ var TrainingJobRequestSchema = object({
43856
+ /** Live collection + work-state criteria; resolved at plan/start. */
43857
+ selection: TrainingCorpusSelectionSchema,
43858
+ /**
43859
+ * The provider **entry** that runs it (credentials + defaults).
43860
+ * Resolve to an owning addon via `training-provider.describe` / `listEntries`.
43861
+ */
43862
+ entryId: string().min(1),
43863
+ gpuType: string().min(1),
43864
+ region: string(),
43865
+ baseModelId: string().min(1),
43866
+ preset: TrainingPresetSchema,
43867
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
43868
+ freeze: number().int().nonnegative().nullable(),
43869
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
43870
+ holdoutCameras: array(number().int()).nullable()
43871
+ });
43872
+ var TrainingSplitPlanSchema = object({
43873
+ holdoutCameras: array(number().int()).readonly(),
43874
+ /** Used when no camera is held out: the last N days of every camera. */
43875
+ holdoutLastDays: number().int().nonnegative(),
43876
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
43877
+ holdoutSupport: record(string(), number().int()).nullable(),
43878
+ trainSubjects: number().int()
43879
+ });
43880
+ var TrainingRefusalReasonSchema = _enum([
43881
+ "unknown-dataset",
43882
+ "unknown-provider",
43883
+ "provider-not-configured",
43884
+ "unknown-base-model",
43885
+ "unknown-gpu",
43886
+ "dataset-too-large",
43887
+ "no-training-subjects",
43888
+ "job-already-running"
43889
+ ]);
43890
+ var TrainingJobPlanSchema = object({
43891
+ refusal: object({
43892
+ reason: TrainingRefusalReasonSchema,
43893
+ detail: string()
43894
+ }).nullable(),
43895
+ warnings: array(string()).readonly(),
43896
+ split: TrainingSplitPlanSchema.nullable(),
43897
+ estimate: object({
43898
+ datasetBytes: number().int(),
43899
+ uploadMinutesAt20Mbps: number(),
43900
+ gpuSecondsLow: number(),
43901
+ gpuSecondsHigh: number(),
43902
+ usdLow: number(),
43903
+ usdHigh: number(),
43904
+ notes: array(string()).readonly()
43905
+ }).nullable(),
43906
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
43907
+ defaults: object({
43908
+ maxCostUsd: number(),
43909
+ maxRuntimeSec: number().int()
43910
+ }).nullable(),
43911
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
43912
+ dataNotice: string()
43913
+ });
43914
+ /**
43915
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
43916
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
43917
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
43918
+ * result lives after the operator acted on it.
43919
+ */
43920
+ var TrainingJobStateSchema = _enum([
43921
+ "queued",
43922
+ "uploading",
43923
+ "submitted",
43924
+ "starting",
43925
+ "running",
43926
+ "collecting",
43927
+ "ready",
43928
+ "registered",
43929
+ "canary",
43930
+ "failed",
43931
+ "cancelling",
43932
+ "cancelled",
43933
+ "lost",
43934
+ "expired",
43935
+ "discarded"
43936
+ ]);
43937
+ var TrainingFailureReasonSchema = _enum([
43938
+ "cost-cap",
43939
+ "runtime-cap",
43940
+ "upload-failed",
43941
+ "submit-failed",
43942
+ "trainer-failed",
43943
+ "result-invalid",
43944
+ "checksum-mismatch",
43945
+ "fetch-failed",
43946
+ "provider-error",
43947
+ "hub-restart-during-upload"
43948
+ ]);
43949
+ var TrainingProgressPointSchema = object({
43950
+ epoch: number().int(),
43951
+ map50: number().nullable(),
43952
+ map50_95: number().nullable()
43953
+ });
43954
+ var TrainingCanarySchema = object({
43955
+ deviceIds: array(number().int()).readonly(),
43956
+ since: number(),
43957
+ /** Every override the canary replaced, exactly, so rollback restores it. */
43958
+ previous: array(object({
43959
+ deviceId: number().int(),
43960
+ nodeId: string(),
43961
+ deviceKey: string(),
43962
+ patch: object({
43963
+ modelId: string().optional(),
43964
+ settings: record(string(), unknown()).readonly().optional()
43965
+ }).nullable()
43966
+ })).readonly()
43967
+ });
43968
+ var TrainingJobSchema = object({
43969
+ id: string(),
43970
+ idempotencyKey: string(),
43971
+ name: string(),
43972
+ createdAt: number(),
43973
+ updatedAt: number(),
43974
+ state: TrainingJobStateSchema,
43975
+ /**
43976
+ * Shared by every job enqueued together via `startJobBatch`.
43977
+ * `null` for a lone `startJob`. The engine advances queued siblings by this id.
43978
+ */
43979
+ batchId: string().nullable().default(null),
43980
+ stage: TrainingStageSchema.nullable(),
43981
+ failure: object({
43982
+ reason: TrainingFailureReasonSchema,
43983
+ stage: string().nullable(),
43984
+ detail: string()
43985
+ }).nullable(),
43986
+ request: TrainingJobRequestSchema,
43987
+ maxCostUsd: number().nonnegative(),
43988
+ maxRuntimeSec: number().int().positive(),
43989
+ trainer: TrainerSourceRefSchema,
43990
+ datasetLayout: RetrainExportLayoutSchema,
43991
+ /** Frame count snapshotted when the job started (audit; equals `frameIds.length`). */
43992
+ frameCount: number().int().nonnegative(),
43993
+ /** Resolved frame ids at start — the archive ships exactly these. */
43994
+ frameIds: array(string()).max(2e4).readonly(),
43995
+ /** Hash of what those frames taught at start (trainer `dataset.annotationHash`). */
43996
+ annotationHash: string(),
43997
+ dataset: object({
43998
+ bytes: number().int(),
43999
+ sha256: string(),
44000
+ uploadedAt: number()
44001
+ }).nullable(),
44002
+ split: TrainingSplitPlanSchema,
44003
+ provider: object({
44004
+ state: ProviderJobStateSchema.nullable(),
44005
+ providerJobId: string().nullable(),
44006
+ startedAt: number().nullable(),
44007
+ endedAt: number().nullable(),
44008
+ billedSeconds: number(),
44009
+ costUsd: number(),
44010
+ costIsEstimate: boolean(),
44011
+ lastPolledAt: number().nullable()
44012
+ }),
44013
+ progress: object({
44014
+ epoch: number().int().nullable(),
44015
+ epochs: number().int().nullable(),
44016
+ etaSec: number().nullable(),
44017
+ series: array(TrainingProgressPointSchema).readonly()
44018
+ }),
44019
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
44020
+ logTail: array(string()).readonly(),
44021
+ logCursor: string().nullable(),
44022
+ artifacts: object({
44023
+ bundleBytes: number().int(),
44024
+ bundleSha256: string(),
44025
+ fetchedAt: number(),
44026
+ /** When the staged artefacts are deleted from the hub. */
44027
+ expiresAt: number()
44028
+ }).nullable(),
44029
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
44030
+ cloudDatasetDeletedAt: number().nullable(),
44031
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
44032
+ cloudCleanupDueAt: number().nullable(),
44033
+ /** Model ids registered from this job (base, and int8 when kept). */
44034
+ registeredModelIds: array(string()).readonly(),
44035
+ canary: TrainingCanarySchema.nullable()
44036
+ });
44037
+ var IdInput = object({ id: string().min(1) });
44038
+ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
44039
+ auth: "admin",
44040
+ timeoutMs: 6e4
44041
+ }), method(TrainingJobRequestSchema.extend({
44042
+ name: string().min(1).max(120),
44043
+ maxCostUsd: number().positive(),
44044
+ maxRuntimeSec: number().int().positive(),
44045
+ idempotencyKey: string().min(8).max(80)
44046
+ }), discriminatedUnion("kind", [object({
44047
+ kind: literal("started"),
44048
+ job: TrainingJobSchema
44049
+ }), object({
44050
+ kind: literal("refused"),
44051
+ reason: TrainingRefusalReasonSchema,
44052
+ detail: string()
44053
+ })]), {
44054
+ kind: "mutation",
44055
+ auth: "admin",
44056
+ timeoutMs: 12e4
44057
+ }), method(TrainingJobRequestSchema.omit({ baseModelId: true }).extend({
44058
+ baseModelIds: array(string().min(1)).min(1),
44059
+ name: string().min(1).max(120),
44060
+ maxCostUsd: number().positive(),
44061
+ maxRuntimeSec: number().int().positive(),
44062
+ idempotencyKey: string().min(8).max(80)
44063
+ }), discriminatedUnion("kind", [object({
44064
+ kind: literal("started"),
44065
+ batchId: string(),
44066
+ jobs: array(TrainingJobSchema).min(1).readonly()
44067
+ }), object({
44068
+ kind: literal("refused"),
44069
+ reason: TrainingRefusalReasonSchema,
44070
+ detail: string()
44071
+ })]), {
44072
+ kind: "mutation",
44073
+ auth: "admin",
44074
+ timeoutMs: 12e4
44075
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
44076
+ kind: "mutation",
44077
+ auth: "admin",
44078
+ timeoutMs: 12e4
44079
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
44080
+ kind: "mutation",
44081
+ auth: "admin",
44082
+ timeoutMs: 30 * 6e4
44083
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
44084
+ kind: "mutation",
44085
+ auth: "admin",
44086
+ timeoutMs: 12e4
44087
+ }), method(IdInput, TrainingJobSchema, {
44088
+ kind: "mutation",
44089
+ auth: "admin",
44090
+ timeoutMs: 12e4
44091
+ }), method(IdInput, TrainingJobSchema, {
44092
+ kind: "mutation",
44093
+ auth: "admin"
44094
+ });
42454
44095
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
42455
44096
  Object.freeze({
42456
44097
  person: .5,
@@ -44599,6 +46240,12 @@ Object.freeze({
44599
46240
  addonId: null,
44600
46241
  access: "create"
44601
46242
  },
46243
+ "backup.checkBackupKey": {
46244
+ capName: "backup",
46245
+ capScope: "system",
46246
+ addonId: null,
46247
+ access: "create"
46248
+ },
44602
46249
  "backup.delete": {
44603
46250
  capName: "backup",
44604
46251
  capScope: "system",
@@ -44611,6 +46258,18 @@ Object.freeze({
44611
46258
  addonId: null,
44612
46259
  access: "delete"
44613
46260
  },
46261
+ "backup.disableEncryption": {
46262
+ capName: "backup",
46263
+ capScope: "system",
46264
+ addonId: null,
46265
+ access: "create"
46266
+ },
46267
+ "backup.getEncryption": {
46268
+ capName: "backup",
46269
+ capScope: "system",
46270
+ addonId: null,
46271
+ access: "view"
46272
+ },
44614
46273
  "backup.getEntries": {
44615
46274
  capName: "backup",
44616
46275
  capScope: "system",
@@ -44665,6 +46324,12 @@ Object.freeze({
44665
46324
  addonId: null,
44666
46325
  access: "create"
44667
46326
  },
46327
+ "backup.setupEncryption": {
46328
+ capName: "backup",
46329
+ capScope: "system",
46330
+ addonId: null,
46331
+ access: "create"
46332
+ },
44668
46333
  "backup.trigger": {
44669
46334
  capName: "backup",
44670
46335
  capScope: "system",
@@ -45217,6 +46882,12 @@ Object.freeze({
45217
46882
  addonId: null,
45218
46883
  access: "create"
45219
46884
  },
46885
+ "customModelRegistry.importModelBundle": {
46886
+ capName: "custom-model-registry",
46887
+ capScope: "system",
46888
+ addonId: null,
46889
+ access: "create"
46890
+ },
45220
46891
  "customModelRegistry.listModels": {
45221
46892
  capName: "custom-model-registry",
45222
46893
  capScope: "system",
@@ -46657,6 +48328,12 @@ Object.freeze({
46657
48328
  addonId: null,
46658
48329
  access: "view"
46659
48330
  },
48331
+ "keychainAdmin.acknowledgeReset": {
48332
+ capName: "keychain-admin",
48333
+ capScope: "system",
48334
+ addonId: null,
48335
+ access: "create"
48336
+ },
46660
48337
  "keychainAdmin.deleteOrphans": {
46661
48338
  capName: "keychain-admin",
46662
48339
  capScope: "system",
@@ -46693,6 +48370,12 @@ Object.freeze({
46693
48370
  addonId: null,
46694
48371
  access: "delete"
46695
48372
  },
48373
+ "keychainAdmin.resetReport": {
48374
+ capName: "keychain-admin",
48375
+ capScope: "system",
48376
+ addonId: null,
48377
+ access: "delete"
48378
+ },
46696
48379
  "keychainAdmin.reveal": {
46697
48380
  capName: "keychain-admin",
46698
48381
  capScope: "system",
@@ -46705,6 +48388,12 @@ Object.freeze({
46705
48388
  addonId: null,
46706
48389
  access: "create"
46707
48390
  },
48391
+ "keychainAdmin.setSystemSecret": {
48392
+ capName: "keychain-admin",
48393
+ capScope: "system",
48394
+ addonId: null,
48395
+ access: "create"
48396
+ },
46708
48397
  "keychainAdmin.status": {
46709
48398
  capName: "keychain-admin",
46710
48399
  capScope: "system",
@@ -47941,6 +49630,36 @@ Object.freeze({
47941
49630
  addonId: null,
47942
49631
  access: "view"
47943
49632
  },
49633
+ "oidcConnections.connectionFormSchema": {
49634
+ capName: "oidc-connections",
49635
+ capScope: "system",
49636
+ addonId: null,
49637
+ access: "view"
49638
+ },
49639
+ "oidcConnections.createConnection": {
49640
+ capName: "oidc-connections",
49641
+ capScope: "system",
49642
+ addonId: null,
49643
+ access: "create"
49644
+ },
49645
+ "oidcConnections.deleteConnection": {
49646
+ capName: "oidc-connections",
49647
+ capScope: "system",
49648
+ addonId: null,
49649
+ access: "delete"
49650
+ },
49651
+ "oidcConnections.listConnections": {
49652
+ capName: "oidc-connections",
49653
+ capScope: "system",
49654
+ addonId: null,
49655
+ access: "view"
49656
+ },
49657
+ "oidcConnections.updateConnection": {
49658
+ capName: "oidc-connections",
49659
+ capScope: "system",
49660
+ addonId: null,
49661
+ access: "create"
49662
+ },
47944
49663
  "osd.getStatus": {
47945
49664
  capName: "osd",
47946
49665
  capScope: "device",
@@ -48013,6 +49732,12 @@ Object.freeze({
48013
49732
  addonId: null,
48014
49733
  access: "create"
48015
49734
  },
49735
+ "osdManager.setSlotCameraEnabled": {
49736
+ capName: "osd-manager",
49737
+ capScope: "system",
49738
+ addonId: null,
49739
+ access: "create"
49740
+ },
48016
49741
  "osdManager.upsertTemplate": {
48017
49742
  capName: "osd-manager",
48018
49743
  capScope: "system",
@@ -48265,6 +49990,12 @@ Object.freeze({
48265
49990
  addonId: null,
48266
49991
  access: "view"
48267
49992
  },
49993
+ "pipelineAnalytics.getRetrainCorpusKpi": {
49994
+ capName: "pipeline-analytics",
49995
+ capScope: "device",
49996
+ addonId: null,
49997
+ access: "view"
49998
+ },
48268
49999
  "pipelineAnalytics.getRetrainExportUrl": {
48269
50000
  capName: "pipeline-analytics",
48270
50001
  capScope: "device",
@@ -48385,6 +50116,12 @@ Object.freeze({
48385
50116
  addonId: null,
48386
50117
  access: "view"
48387
50118
  },
50119
+ "pipelineAnalytics.listRetrainCorpusPage": {
50120
+ capName: "pipeline-analytics",
50121
+ capScope: "device",
50122
+ addonId: null,
50123
+ access: "view"
50124
+ },
48388
50125
  "pipelineAnalytics.listRetrainFrames": {
48389
50126
  capName: "pipeline-analytics",
48390
50127
  capScope: "device",
@@ -48415,6 +50152,12 @@ Object.freeze({
48415
50152
  addonId: null,
48416
50153
  access: "view"
48417
50154
  },
50155
+ "pipelineAnalytics.offerRetrainArchive": {
50156
+ capName: "pipeline-analytics",
50157
+ capScope: "device",
50158
+ addonId: null,
50159
+ access: "create"
50160
+ },
48418
50161
  "pipelineAnalytics.ownersWithMedia": {
48419
50162
  capName: "pipeline-analytics",
48420
50163
  capScope: "device",
@@ -48505,6 +50248,12 @@ Object.freeze({
48505
50248
  addonId: null,
48506
50249
  access: "create"
48507
50250
  },
50251
+ "pipelineAnalytics.resolveRetrainTrainingCorpus": {
50252
+ capName: "pipeline-analytics",
50253
+ capScope: "device",
50254
+ addonId: null,
50255
+ access: "view"
50256
+ },
48508
50257
  "pipelineAnalytics.restageRetrainTrack": {
48509
50258
  capName: "pipeline-analytics",
48510
50259
  capScope: "device",
@@ -50941,6 +52690,180 @@ Object.freeze({
50941
52690
  addonId: null,
50942
52691
  access: "view"
50943
52692
  },
52693
+ "training.canaryResult": {
52694
+ capName: "training",
52695
+ capScope: "system",
52696
+ addonId: null,
52697
+ access: "create"
52698
+ },
52699
+ "training.cancelJob": {
52700
+ capName: "training",
52701
+ capScope: "system",
52702
+ addonId: null,
52703
+ access: "create"
52704
+ },
52705
+ "training.discardResult": {
52706
+ capName: "training",
52707
+ capScope: "system",
52708
+ addonId: null,
52709
+ access: "create"
52710
+ },
52711
+ "training.getJob": {
52712
+ capName: "training",
52713
+ capScope: "system",
52714
+ addonId: null,
52715
+ access: "view"
52716
+ },
52717
+ "training.getJobResult": {
52718
+ capName: "training",
52719
+ capScope: "system",
52720
+ addonId: null,
52721
+ access: "view"
52722
+ },
52723
+ "training.listBaseModels": {
52724
+ capName: "training",
52725
+ capScope: "system",
52726
+ addonId: null,
52727
+ access: "view"
52728
+ },
52729
+ "training.listJobs": {
52730
+ capName: "training",
52731
+ capScope: "system",
52732
+ addonId: null,
52733
+ access: "view"
52734
+ },
52735
+ "training.planJob": {
52736
+ capName: "training",
52737
+ capScope: "system",
52738
+ addonId: null,
52739
+ access: "view"
52740
+ },
52741
+ "training.registerResult": {
52742
+ capName: "training",
52743
+ capScope: "system",
52744
+ addonId: null,
52745
+ access: "create"
52746
+ },
52747
+ "training.rollbackCanary": {
52748
+ capName: "training",
52749
+ capScope: "system",
52750
+ addonId: null,
52751
+ access: "create"
52752
+ },
52753
+ "training.startJob": {
52754
+ capName: "training",
52755
+ capScope: "system",
52756
+ addonId: null,
52757
+ access: "create"
52758
+ },
52759
+ "training.startJobBatch": {
52760
+ capName: "training",
52761
+ capScope: "system",
52762
+ addonId: null,
52763
+ access: "create"
52764
+ },
52765
+ "trainingProvider.cancelJob": {
52766
+ capName: "training-provider",
52767
+ capScope: "system",
52768
+ addonId: null,
52769
+ access: "create"
52770
+ },
52771
+ "trainingProvider.cleanupJob": {
52772
+ capName: "training-provider",
52773
+ capScope: "system",
52774
+ addonId: null,
52775
+ access: "create"
52776
+ },
52777
+ "trainingProvider.createEntry": {
52778
+ capName: "training-provider",
52779
+ capScope: "system",
52780
+ addonId: null,
52781
+ access: "create"
52782
+ },
52783
+ "trainingProvider.deleteEntry": {
52784
+ capName: "training-provider",
52785
+ capScope: "system",
52786
+ addonId: null,
52787
+ access: "delete"
52788
+ },
52789
+ "trainingProvider.describe": {
52790
+ capName: "training-provider",
52791
+ capScope: "system",
52792
+ addonId: null,
52793
+ access: "view"
52794
+ },
52795
+ "trainingProvider.describeTypes": {
52796
+ capName: "training-provider",
52797
+ capScope: "system",
52798
+ addonId: null,
52799
+ access: "view"
52800
+ },
52801
+ "trainingProvider.estimateJob": {
52802
+ capName: "training-provider",
52803
+ capScope: "system",
52804
+ addonId: null,
52805
+ access: "view"
52806
+ },
52807
+ "trainingProvider.getJob": {
52808
+ capName: "training-provider",
52809
+ capScope: "system",
52810
+ addonId: null,
52811
+ access: "view"
52812
+ },
52813
+ "trainingProvider.listEntries": {
52814
+ capName: "training-provider",
52815
+ capScope: "system",
52816
+ addonId: null,
52817
+ access: "view"
52818
+ },
52819
+ "trainingProvider.listJobEvents": {
52820
+ capName: "training-provider",
52821
+ capScope: "system",
52822
+ addonId: null,
52823
+ access: "view"
52824
+ },
52825
+ "trainingProvider.listJobs": {
52826
+ capName: "training-provider",
52827
+ capScope: "system",
52828
+ addonId: null,
52829
+ access: "view"
52830
+ },
52831
+ "trainingProvider.offerArtifact": {
52832
+ capName: "training-provider",
52833
+ capScope: "system",
52834
+ addonId: null,
52835
+ access: "create"
52836
+ },
52837
+ "trainingProvider.readResult": {
52838
+ capName: "training-provider",
52839
+ capScope: "system",
52840
+ addonId: null,
52841
+ access: "create"
52842
+ },
52843
+ "trainingProvider.submitJob": {
52844
+ capName: "training-provider",
52845
+ capScope: "system",
52846
+ addonId: null,
52847
+ access: "create"
52848
+ },
52849
+ "trainingProvider.updateEntry": {
52850
+ capName: "training-provider",
52851
+ capScope: "system",
52852
+ addonId: null,
52853
+ access: "create"
52854
+ },
52855
+ "trainingProvider.uploadDataset": {
52856
+ capName: "training-provider",
52857
+ capScope: "system",
52858
+ addonId: null,
52859
+ access: "create"
52860
+ },
52861
+ "trainingProvider.validateCredentials": {
52862
+ capName: "training-provider",
52863
+ capScope: "system",
52864
+ addonId: null,
52865
+ access: "create"
52866
+ },
50944
52867
  "turnProvider.getTurnServers": {
50945
52868
  capName: "turn-provider",
50946
52869
  capScope: "system",
@@ -50965,12 +52888,6 @@ Object.freeze({
50965
52888
  addonId: null,
50966
52889
  access: "create"
50967
52890
  },
50968
- "userManagement.createApiKey": {
50969
- capName: "user-management",
50970
- capScope: "system",
50971
- addonId: null,
50972
- access: "create"
50973
- },
50974
52891
  "userManagement.createScopedToken": {
50975
52892
  capName: "user-management",
50976
52893
  capScope: "system",
@@ -51007,12 +52924,6 @@ Object.freeze({
51007
52924
  addonId: null,
51008
52925
  access: "view"
51009
52926
  },
51010
- "userManagement.linkExternalIdentity": {
51011
- capName: "user-management",
51012
- capScope: "system",
51013
- addonId: null,
51014
- access: "create"
51015
- },
51016
52927
  "userManagement.listApiKeys": {
51017
52928
  capName: "user-management",
51018
52929
  capScope: "system",
@@ -51115,12 +53026,6 @@ Object.freeze({
51115
53026
  addonId: null,
51116
53027
  access: "create"
51117
53028
  },
51118
- "userManagement.validateApiKey": {
51119
- capName: "user-management",
51120
- capScope: "system",
51121
- addonId: null,
51122
- access: "view"
51123
- },
51124
53029
  "userManagement.validateCredentials": {
51125
53030
  capName: "user-management",
51126
53031
  capScope: "system",
@@ -54153,6 +56058,11 @@ Object.freeze({
54153
56058
  form: "single",
54154
56059
  optional: false
54155
56060
  }],
56061
+ "osdManager.setSlotCameraEnabled": [{
56062
+ name: "deviceId",
56063
+ form: "single",
56064
+ optional: false
56065
+ }],
54156
56066
  "petFeeder.callPet": [{
54157
56067
  name: "deviceId",
54158
56068
  form: "single",
@@ -54373,6 +56283,11 @@ Object.freeze({
54373
56283
  form: "array",
54374
56284
  optional: false
54375
56285
  }],
56286
+ "pipelineAnalytics.listRetrainCorpusPage": [{
56287
+ name: "deviceIds",
56288
+ form: "array",
56289
+ optional: true
56290
+ }],
54376
56291
  "pipelineAnalytics.listRetrainStaging": [{
54377
56292
  name: "deviceIds",
54378
56293
  form: "array",
@@ -55234,6 +57149,11 @@ Object.freeze({
55234
57149
  form: "single",
55235
57150
  optional: false
55236
57151
  }],
57152
+ "training.canaryResult": [{
57153
+ name: "deviceIds",
57154
+ form: "array",
57155
+ optional: false
57156
+ }],
55237
57157
  "update.getStatus": [{
55238
57158
  name: "deviceId",
55239
57159
  form: "single",
@@ -55477,6 +57397,7 @@ Object.freeze({
55477
57397
  });
55478
57398
  Object.freeze({
55479
57399
  "broker": "broker",
57400
+ "calendar-source": "calendar",
55480
57401
  "device-export": "device-export",
55481
57402
  "llm": "ai",
55482
57403
  "mesh-network": "mesh",
@@ -55962,6 +57883,8 @@ var STATE_SUMMARY_VARS = [
55962
57883
  [...RULE_TEXT],
55963
57884
  [...RULE_TEXT],
55964
57885
  [...RULE_TEXT],
57886
+ [...RULE_TEXT],
57887
+ [...RULE_TEXT],
55965
57888
  ([...RULE_TEXT], [...UPDATES]),
55966
57889
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
55967
57890
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),