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