@camstack/addon-provider-petkit 0.2.123 → 0.2.125

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +2068 -145
  2. package/dist/addon.mjs +2068 -145
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -6478,7 +6478,7 @@ var ZodIssueCode = {
6478
6478
  var ZodFirstPartyTypeKind;
6479
6479
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6480
6480
  //#endregion
6481
- //#region ../types/dist/sleep-Cr5YOk3m.mjs
6481
+ //#region ../types/dist/sleep-DwAQ9sqX.mjs
6482
6482
  /**
6483
6483
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6484
6484
  * window to float samples (D455).
@@ -6595,7 +6595,7 @@ function isKeychainStoredField(field) {
6595
6595
  var SECRET_CLEAR = { $secretClear: true };
6596
6596
  /** The `'***'` token D634 redaction writes for non-admins. */
6597
6597
  var LEGACY_DEVICE_REDACTION = "***";
6598
- function isRecord$1(value) {
6598
+ function isRecord$2(value) {
6599
6599
  return typeof value === "object" && value !== null && !Array.isArray(value);
6600
6600
  }
6601
6601
  function makeSecretMarker(ref) {
@@ -6606,12 +6606,12 @@ function makeSecretMarker(ref) {
6606
6606
  }
6607
6607
  /** A stored marker: an object whose `$secret` is a non-empty string. */
6608
6608
  function isSecretMarker(value) {
6609
- if (!isRecord$1(value)) return false;
6609
+ if (!isRecord$2(value)) return false;
6610
6610
  const ref = value["$secret"];
6611
6611
  return typeof ref === "string" && ref.length > 0;
6612
6612
  }
6613
6613
  function isSecretClear(value) {
6614
- return isRecord$1(value) && value["$secretClear"] === true;
6614
+ return isRecord$2(value) && value["$secretClear"] === true;
6615
6615
  }
6616
6616
  /**
6617
6617
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -7127,6 +7127,13 @@ function globalSecretScope() {
7127
7127
  function encodeSegment(value) {
7128
7128
  return encodeURIComponent(value);
7129
7129
  }
7130
+ function decodeSegment(value) {
7131
+ try {
7132
+ return decodeURIComponent(value);
7133
+ } catch {
7134
+ return null;
7135
+ }
7136
+ }
7130
7137
  /**
7131
7138
  * The field path of a value inside an array item, addressed by the item's id:
7132
7139
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -7135,6 +7142,75 @@ function encodeSegment(value) {
7135
7142
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
7136
7143
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
7137
7144
  }
7145
+ function parseScope(segments) {
7146
+ switch (segments[0]) {
7147
+ case "global": return {
7148
+ scope: GLOBAL_SCOPE,
7149
+ used: 1
7150
+ };
7151
+ case "node": {
7152
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
7153
+ return nodeId === null || nodeId.length === 0 ? null : {
7154
+ scope: {
7155
+ kind: "node",
7156
+ nodeId
7157
+ },
7158
+ used: 2
7159
+ };
7160
+ }
7161
+ case "device": {
7162
+ const raw = segments[1];
7163
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
7164
+ return {
7165
+ scope: {
7166
+ kind: "device",
7167
+ deviceId: Number(raw)
7168
+ },
7169
+ used: 2
7170
+ };
7171
+ }
7172
+ case "integration": {
7173
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
7174
+ return id === null || id.length === 0 ? null : {
7175
+ scope: {
7176
+ kind: "integration",
7177
+ integrationId: id
7178
+ },
7179
+ used: 2
7180
+ };
7181
+ }
7182
+ case "row": {
7183
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
7184
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
7185
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
7186
+ return {
7187
+ scope: {
7188
+ kind: "row",
7189
+ collection,
7190
+ rowId
7191
+ },
7192
+ used: 3
7193
+ };
7194
+ }
7195
+ default: return null;
7196
+ }
7197
+ }
7198
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
7199
+ function parseSecretRef(ref) {
7200
+ if (!ref.startsWith("secret://")) return null;
7201
+ const segments = ref.slice(9).split("/");
7202
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
7203
+ if (owner === null || owner.length === 0) return null;
7204
+ const parsed = parseScope(segments.slice(1));
7205
+ if (parsed === null) return null;
7206
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
7207
+ if (fieldPath.length === 0) return null;
7208
+ return {
7209
+ owner,
7210
+ scope: parsed.scope,
7211
+ fieldPath
7212
+ };
7213
+ }
7138
7214
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
7139
7215
  var KeychainWriteRefusedError = class extends Error {
7140
7216
  fieldPath;
@@ -7145,7 +7221,7 @@ var KeychainWriteRefusedError = class extends Error {
7145
7221
  }
7146
7222
  };
7147
7223
  var KEEP = { kind: "keep" };
7148
- function isRecord(value) {
7224
+ function isRecord$1(value) {
7149
7225
  return typeof value === "object" && value !== null && !Array.isArray(value);
7150
7226
  }
7151
7227
  function defaultMintId() {
@@ -7158,7 +7234,7 @@ function collectSecretMarkerRefs(value, out = []) {
7158
7234
  return out;
7159
7235
  }
7160
7236
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
7161
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
7237
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
7162
7238
  return out;
7163
7239
  }
7164
7240
  async function storedValueEquals(secrets, marker, candidate) {
@@ -7213,7 +7289,7 @@ function rowId(row, idKey) {
7213
7289
  return null;
7214
7290
  }
7215
7291
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
7216
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
7292
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
7217
7293
  if (!Array.isArray(incoming)) {
7218
7294
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
7219
7295
  return {
@@ -7229,7 +7305,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
7229
7305
  const kept = /* @__PURE__ */ new Set();
7230
7306
  const rows = [];
7231
7307
  for (const row of incoming) {
7232
- if (!isRecord(row)) {
7308
+ if (!isRecord$1(row)) {
7233
7309
  rows.push(row);
7234
7310
  continue;
7235
7311
  }
@@ -7254,7 +7330,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
7254
7330
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
7255
7331
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
7256
7332
  case "object": {
7257
- if (!isRecord(incoming)) {
7333
+ if (!isRecord$1(incoming)) {
7258
7334
  if (incoming === void 0) return KEEP;
7259
7335
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
7260
7336
  return {
@@ -7262,7 +7338,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
7262
7338
  value: incoming
7263
7339
  };
7264
7340
  }
7265
- const storedObj = isRecord(stored) ? stored : {};
7341
+ const storedObj = isRecord$1(stored) ? stored : {};
7266
7342
  return {
7267
7343
  kind: "value",
7268
7344
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -7321,12 +7397,19 @@ async function transformSecretWrite(input) {
7321
7397
  }
7322
7398
  };
7323
7399
  }
7400
+ /** Is `ref` one of `owner`'s refs? */
7401
+ function isSecretRefOwnedBy(ref, owner) {
7402
+ return parseSecretRef(ref)?.owner === owner;
7403
+ }
7324
7404
  /**
7325
7405
  * Replace every marker in `value` with its keychain value. Returns the SAME
7326
7406
  * reference when there is no marker (no allocation, no keychain call).
7327
7407
  */
7328
- async function resolveSecretMarkers(value, secrets) {
7329
- const refs = collectSecretMarkerRefs(value);
7408
+ async function resolveSecretMarkers(value, secrets, options = {}) {
7409
+ const keepMarker = options.unresolved === "keep-marker";
7410
+ const owner = options.ownedBy;
7411
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
7412
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
7330
7413
  if (refs.length === 0) return {
7331
7414
  value,
7332
7415
  unresolved: []
@@ -7350,10 +7433,18 @@ async function resolveSecretMarkers(value, secrets) {
7350
7433
  }
7351
7434
  const substitute = (v) => {
7352
7435
  if (isSecretMarker(v)) {
7436
+ if (!inScope(v.$secret)) return {
7437
+ keep: true,
7438
+ value: v
7439
+ };
7353
7440
  const answer = answers[v.$secret];
7354
- return answer?.kind === "value" ? {
7441
+ if (answer?.kind === "value") return {
7355
7442
  keep: true,
7356
7443
  value: answer.value
7444
+ };
7445
+ return keepMarker ? {
7446
+ keep: true,
7447
+ value: v
7357
7448
  } : {
7358
7449
  keep: false,
7359
7450
  value: void 0
@@ -7370,7 +7461,7 @@ async function resolveSecretMarkers(value, secrets) {
7370
7461
  value: items
7371
7462
  };
7372
7463
  }
7373
- if (isRecord(v)) {
7464
+ if (isRecord$1(v)) {
7374
7465
  const out = {};
7375
7466
  for (const [k, child] of Object.entries(v)) {
7376
7467
  const s = substitute(child);
@@ -7391,14 +7482,152 @@ async function resolveSecretMarkers(value, secrets) {
7391
7482
  unresolved
7392
7483
  };
7393
7484
  }
7394
- function touchesTree(tree, patch) {
7395
- if (tree.size === 0) return false;
7396
- for (const key of Object.keys(patch)) {
7397
- const at = key.indexOf("@");
7398
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
7485
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
7486
+ var SecretOverwriteRefusedError = class extends Error {
7487
+ ref;
7488
+ reason;
7489
+ constructor(ref, reason) {
7490
+ 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.`);
7491
+ this.ref = ref;
7492
+ this.reason = reason;
7493
+ this.name = "SecretOverwriteRefusedError";
7494
+ }
7495
+ };
7496
+ function isRecord(value) {
7497
+ return typeof value === "object" && value !== null && !Array.isArray(value);
7498
+ }
7499
+ function resolvedValue(pass, marker) {
7500
+ const answer = pass.answers[marker.$secret];
7501
+ return answer?.kind === "value" ? answer.value : null;
7502
+ }
7503
+ async function atMarker(pass, incoming, stored) {
7504
+ if (incoming === null) return stored;
7505
+ if (typeof incoming !== "string") return incoming;
7506
+ if (incoming === resolvedValue(pass, stored)) return stored;
7507
+ const intent = classifySecretWrite(incoming);
7508
+ if (intent.kind !== "set") return stored;
7509
+ const ref = stored.$secret;
7510
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
7511
+ const answer = pass.answers[ref];
7512
+ 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);
7513
+ try {
7514
+ await pass.secrets.put(ref, intent.value);
7515
+ } catch (err) {
7516
+ throw new KeychainWriteRefusedError(ref, err);
7517
+ }
7518
+ pass.changedRefs.push(ref);
7519
+ return stored;
7520
+ }
7521
+ function inArray(pass, incoming, stored) {
7522
+ return incoming.map((item, index) => {
7523
+ const twin = stored[index];
7524
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
7525
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
7526
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
7527
+ return item;
7528
+ });
7529
+ }
7530
+ function inArrayRow(pass, incoming, stored) {
7531
+ const out = { ...incoming };
7532
+ for (const [key, value] of Object.entries(incoming)) {
7533
+ const twin = stored[key];
7534
+ if (isSecretMarker(twin)) {
7535
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
7536
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
7537
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
7538
+ }
7539
+ return out;
7540
+ }
7541
+ async function walk(pass, incoming, stored) {
7542
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
7543
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
7544
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
7545
+ const out = { ...incoming };
7546
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
7547
+ return out;
7548
+ }
7549
+ /** Restore markers a write-back carries as values. See the file doc. */
7550
+ async function restoreUnchangedSecrets(input) {
7551
+ const refs = [];
7552
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
7553
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
7554
+ if (owned.length === 0) return {
7555
+ patch: input.patch,
7556
+ changedRefs: []
7557
+ };
7558
+ const pass = {
7559
+ secrets: input.secrets,
7560
+ answers: await input.secrets.resolve([...new Set(owned)]),
7561
+ operatorWrite: input.operatorWrite,
7562
+ changedRefs: []
7563
+ };
7564
+ const out = {};
7565
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
7566
+ return {
7567
+ patch: out,
7568
+ changedRefs: pass.changedRefs
7569
+ };
7570
+ }
7571
+ /** Structural equality over JSON-shaped values (key order does not matter). */
7572
+ function isJsonEqual(a, b) {
7573
+ if (Object.is(a, b)) return true;
7574
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
7575
+ if (isRecord(a) && isRecord(b)) {
7576
+ const keys = Object.keys(a);
7577
+ if (keys.length !== Object.keys(b).length) return false;
7578
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
7399
7579
  }
7400
7580
  return false;
7401
7581
  }
7582
+ /** The patch without the keys whose value already equals the stored one. */
7583
+ function dropUnchangedKeys(patch, stored) {
7584
+ const out = {};
7585
+ for (const [key, value] of Object.entries(patch)) {
7586
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
7587
+ out[key] = value;
7588
+ }
7589
+ return out;
7590
+ }
7591
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
7592
+ function markerKeysOf(blob, owner) {
7593
+ const keys = /* @__PURE__ */ new Set();
7594
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
7595
+ return keys;
7596
+ }
7597
+ function nodeFromStored(value, owner) {
7598
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
7599
+ if (!isRecord(value)) return null;
7600
+ const children = /* @__PURE__ */ new Map();
7601
+ for (const [key, child] of Object.entries(value)) {
7602
+ const node = nodeFromStored(child, owner);
7603
+ if (node !== null) children.set(key, node);
7604
+ }
7605
+ return children.size > 0 ? {
7606
+ kind: "object",
7607
+ children
7608
+ } : null;
7609
+ }
7610
+ /**
7611
+ * The declared secret tree, widened by every place the STORED blob holds a
7612
+ * marker under one of `keys` — so a marker the schema no longer declares (or
7613
+ * never declared: Wyze before b4906cec6) still gets the save path's
7614
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
7615
+ * addon writes. Markers inside arrays are not added: a row has no id field to
7616
+ * match by unless the schema declares one. Only `owner`'s markers count: a
7617
+ * builtin that keeps another addon's marker (device-manager) never takes it
7618
+ * over.
7619
+ */
7620
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
7621
+ const added = /* @__PURE__ */ new Map();
7622
+ for (const key of keys) {
7623
+ const at = key.indexOf("@");
7624
+ const base = at > 0 ? key.slice(0, at) : key;
7625
+ if (declared.has(base) || added.has(base)) continue;
7626
+ const node = nodeFromStored(stored[key], owner);
7627
+ if (node !== null) added.set(base, node);
7628
+ }
7629
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
7630
+ }
7402
7631
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
7403
7632
  async function readStoredAddonBlob(raw) {
7404
7633
  const threeWay = raw.readAddonStoreResult;
@@ -7407,7 +7636,41 @@ async function readStoredAddonBlob(raw) {
7407
7636
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
7408
7637
  return result.kind === "missing" ? {} : result.value;
7409
7638
  }
7410
- function createSecretAwareSettings(raw, opts) {
7639
+ function touchesTree(tree, patch) {
7640
+ if (tree.size === 0) return false;
7641
+ for (const key of Object.keys(patch)) {
7642
+ const at = key.indexOf("@");
7643
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
7644
+ }
7645
+ return false;
7646
+ }
7647
+ /**
7648
+ * Which top-level keys of each store held markers when last seen. `undefined`
7649
+ * for a store not seen yet: its first write reads it, to be safe.
7650
+ */
7651
+ var MarkerKeyIndex = class {
7652
+ owner;
7653
+ byStore = /* @__PURE__ */ new Map();
7654
+ constructor(owner) {
7655
+ this.owner = owner;
7656
+ }
7657
+ seen(store, blob) {
7658
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
7659
+ }
7660
+ wrote(store, patch) {
7661
+ const keys = this.byStore.get(store);
7662
+ if (keys === void 0) return;
7663
+ const now = markerKeysOf(patch, this.owner);
7664
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
7665
+ else keys.delete(key);
7666
+ }
7667
+ mayHoldMarkers(store, patch) {
7668
+ const keys = this.byStore.get(store);
7669
+ if (keys === void 0) return true;
7670
+ return Object.keys(patch).some((key) => keys.has(key));
7671
+ }
7672
+ };
7673
+ function createHandle(raw, opts) {
7411
7674
  const chains = /* @__PURE__ */ new Map();
7412
7675
  const serialize = (key, fn) => {
7413
7676
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -7418,46 +7681,130 @@ function createSecretAwareSettings(raw, opts) {
7418
7681
  });
7419
7682
  return next;
7420
7683
  };
7421
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
7422
- if (!touchesTree(tree, patch)) return rawWrite(patch);
7423
- return serialize(chainKey, async () => {
7684
+ const index = new MarkerKeyIndex(opts.secrets.owner);
7685
+ const resolveRead = async (store, blob) => {
7686
+ index.seen(store, blob);
7687
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
7688
+ unresolved: "keep-marker",
7689
+ ownedBy: opts.secrets.owner
7690
+ });
7691
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
7692
+ return value;
7693
+ };
7694
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
7695
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
7696
+ await rawWrite(patch);
7697
+ index.wrote(store, patch);
7698
+ return { changed: true };
7699
+ }
7700
+ return serialize(store, async () => {
7424
7701
  const stored = await readStored();
7702
+ index.seen(store, stored);
7703
+ const operatorWrite = opts.isOperatorWrite?.() === true;
7704
+ const restored = await restoreUnchangedSecrets({
7705
+ patch,
7706
+ stored,
7707
+ secrets: opts.secrets,
7708
+ operatorWrite
7709
+ });
7425
7710
  const result = await transformSecretWrite({
7426
- tree,
7711
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
7427
7712
  secrets: opts.secrets,
7428
- patch,
7713
+ patch: restored.patch,
7429
7714
  stored,
7430
7715
  ...scope !== void 0 ? { scope } : {},
7431
- operatorWrite: opts.isOperatorWrite?.() === true
7716
+ operatorWrite
7432
7717
  });
7433
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
7718
+ const effective = dropUnchangedKeys(result.patch, stored);
7719
+ const wroteBlob = Object.keys(effective).length > 0;
7720
+ if (wroteBlob) {
7721
+ await rawWrite(effective);
7722
+ index.wrote(store, effective);
7723
+ }
7434
7724
  const { orphaned } = await result.afterWrite();
7435
7725
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
7726
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
7436
7727
  });
7437
7728
  };
7438
- const wrapped = {
7439
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
7440
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
7441
- kind: "device",
7442
- deviceId
7443
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
7729
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
7730
+ const readAddonStoreResult = raw.readAddonStoreResult;
7731
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
7732
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
7733
+ const overrides = {
7734
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
7735
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
7736
+ const result = await readAddonStoreResult.call(raw);
7737
+ return result.kind === "value" ? {
7738
+ kind: "value",
7739
+ value: await resolveRead("addon", result.value)
7740
+ } : result;
7741
+ } } : {},
7742
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
7743
+ const result = await readAddonStoreKeyResult.call(raw, key);
7744
+ if (result.kind !== "present") return result;
7745
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
7746
+ unresolved: "keep-marker",
7747
+ ownedBy: opts.secrets.owner
7748
+ });
7749
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
7750
+ return {
7751
+ kind: "present",
7752
+ value: value[key]
7753
+ };
7754
+ } } : {},
7755
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
7756
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
7757
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
7758
+ const out = /* @__PURE__ */ new Map();
7759
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
7760
+ return out;
7761
+ } } : {},
7762
+ writeAddonStore: async (patch) => {
7763
+ await writeAddon(patch);
7764
+ },
7765
+ writeDeviceStore: async (deviceId, patch) => {
7766
+ await write(`device:${deviceId}`, opts.deviceTree(), {
7767
+ kind: "device",
7768
+ deviceId
7769
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
7770
+ }
7771
+ };
7772
+ return {
7773
+ settings: new Proxy(raw, { get(target, prop, receiver) {
7774
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
7775
+ const value = Reflect.get(target, prop, receiver);
7776
+ return typeof value === "function" ? value.bind(target) : value;
7777
+ } }),
7778
+ raw: {
7779
+ readAddonStore: async () => {
7780
+ const blob = await raw.readAddonStore();
7781
+ index.seen("addon", blob);
7782
+ return blob;
7783
+ },
7784
+ readDeviceStore: async (deviceId) => {
7785
+ const blob = await raw.readDeviceStore(deviceId);
7786
+ index.seen(`device:${deviceId}`, blob);
7787
+ return blob;
7788
+ }
7789
+ },
7790
+ writeAddonStore: writeAddon
7444
7791
  };
7445
- return new Proxy(raw, { get(target, prop, receiver) {
7446
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
7447
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
7448
- const value = Reflect.get(target, prop, receiver);
7449
- return typeof value === "function" ? value.bind(target) : value;
7450
- } });
7451
7792
  }
7452
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
7453
- function withSecretAwareSettings(context, opts) {
7793
+ /** The context the addon sees, plus the private raw view and write outcome. */
7794
+ function createSecretAwareContext(context, opts) {
7454
7795
  const raw = context.settings;
7455
- if (raw === void 0) return context;
7456
- const settings = createSecretAwareSettings(raw, opts);
7457
- return new Proxy(context, { get(target, prop, receiver) {
7458
- if (prop === "settings") return settings;
7459
- return Reflect.get(target, prop, receiver);
7460
- } });
7796
+ if (raw === void 0) return {
7797
+ context,
7798
+ handle: null
7799
+ };
7800
+ const handle = createHandle(raw, opts);
7801
+ return {
7802
+ context: new Proxy(context, { get(target, prop, receiver) {
7803
+ if (prop === "settings") return handle.settings;
7804
+ return Reflect.get(target, prop, receiver);
7805
+ } }),
7806
+ handle
7807
+ };
7461
7808
  }
7462
7809
  var LEAF = { kind: "leaf" };
7463
7810
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -7632,6 +7979,14 @@ var BaseAddon = class {
7632
7979
  _secretChangeUnsub = null;
7633
7980
  /** >0 while an OPERATOR's settings write is being applied. */
7634
7981
  _operatorWriteDepth = 0;
7982
+ /**
7983
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
7984
+ * to the marker-bearing blobs and stays private to this class: the form
7985
+ * hydrate and config resolution need markers, addon code never does.
7986
+ */
7987
+ _secretSettings = null;
7988
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
7989
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
7635
7990
  constructor(defaults) {
7636
7991
  this.defaults = defaults;
7637
7992
  this._config = { ...defaults };
@@ -7668,13 +8023,21 @@ var BaseAddon = class {
7668
8023
  }
7669
8024
  async initialize(context) {
7670
8025
  const secrets = context.secrets;
7671
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
7672
- secrets,
7673
- addonTree: () => this.addonSecretTree(),
7674
- deviceTree: () => this.deviceSecretTree(),
7675
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
7676
- isOperatorWrite: () => this._operatorWriteDepth > 0
7677
- }) : context;
8026
+ if (secrets !== void 0) {
8027
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
8028
+ secrets,
8029
+ addonTree: () => this.addonSecretTree(),
8030
+ deviceTree: () => this.deviceSecretTree(),
8031
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
8032
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
8033
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
8034
+ });
8035
+ this._ctx = wrapped;
8036
+ this._secretSettings = handle;
8037
+ } else {
8038
+ this._ctx = context;
8039
+ this._secretSettings = null;
8040
+ }
7678
8041
  await this.resolveConfig();
7679
8042
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
7680
8043
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -7791,11 +8154,8 @@ var BaseAddon = class {
7791
8154
  async getGlobalSettings(overlay, cap, nodeId) {
7792
8155
  const schema = this.globalSettingsSchema(cap);
7793
8156
  if (!schema) return { sections: [] };
7794
- const projected = await this.resolveGlobalStore(nodeId, cap);
7795
- return hydrateSchema(schema, overlay ? {
7796
- ...projected,
7797
- ...overlay
7798
- } : projected, { inlineSecretsAsViews: true });
8157
+ const projected = await this.readRawProjectedStore(nodeId, cap);
8158
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
7799
8159
  }
7800
8160
  /**
7801
8161
  * The integration-level view of this addon's settings: exactly the sections
@@ -7840,7 +8200,7 @@ var BaseAddon = class {
7840
8200
  });
7841
8201
  }
7842
8202
  if (sections.length === 0) return null;
7843
- const projected = await this.resolveGlobalStore(nodeId);
8203
+ const projected = await this.readRawProjectedStore(nodeId);
7844
8204
  return hydrateSchema({
7845
8205
  ...schema,
7846
8206
  sections
@@ -7857,12 +8217,50 @@ var BaseAddon = class {
7857
8217
  * the store for custom option logic (option narrowing, value snapping) to
7858
8218
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
7859
8219
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
8220
+ *
8221
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
8222
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
8223
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
8224
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
8225
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
8226
+ * resolved blob back is a no-op for every unchanged secret.
7860
8227
  */
7861
8228
  async resolveGlobalStore(nodeId, cap) {
7862
8229
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
8230
+ return this.projectForNode(raw, nodeId, cap);
8231
+ }
8232
+ projectForNode(store, nodeId, cap) {
7863
8233
  const keys = this.perNodeKeys(cap);
7864
8234
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
7865
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
8235
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
8236
+ }
8237
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
8238
+ async readRawProjectedStore(nodeId, cap) {
8239
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
8240
+ return this.projectForNode(raw, nodeId, cap);
8241
+ }
8242
+ /**
8243
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
8244
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
8245
+ * hydrated from a resolved overlay still shows a secret as "set", never as
8246
+ * its value.
8247
+ */
8248
+ async overlayKeepingMarkers(stored, overlay) {
8249
+ const secrets = this._ctx?.secrets;
8250
+ const merged = {
8251
+ ...stored,
8252
+ ...overlay
8253
+ };
8254
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
8255
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
8256
+ unresolved: "keep-marker",
8257
+ ownedBy: secrets.owner
8258
+ });
8259
+ for (const key of Object.keys(overlay)) {
8260
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
8261
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
8262
+ }
8263
+ return merged;
7866
8264
  }
7867
8265
  /**
7868
8266
  * Whether ONE global key of this addon's store was written, read three-way
@@ -7927,8 +8325,12 @@ var BaseAddon = class {
7927
8325
  async clearSecrets(keys, nodeId) {
7928
8326
  const tree = this.addonSecretTree();
7929
8327
  const keychain = this._ctx?.secrets !== void 0;
8328
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
7930
8329
  const patch = {};
7931
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
8330
+ for (const key of keys) {
8331
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
8332
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
8333
+ }
7932
8334
  await this.applyGlobalPatch(patch, nodeId);
7933
8335
  }
7934
8336
  async applyGlobalPatch(barePatch, nodeId) {
@@ -7936,7 +8338,11 @@ var BaseAddon = class {
7936
8338
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
7937
8339
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
7938
8340
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
7939
- await this._ctx?.settings?.writeAddonStore(scoped);
8341
+ const handle = this._secretSettings;
8342
+ if (handle !== null) {
8343
+ const { changed } = await handle.writeAddonStore(scoped);
8344
+ if (!changed) return;
8345
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
7940
8346
  if (target !== localNode) return;
7941
8347
  await this.resolveConfig();
7942
8348
  await this.onConfigChanged();
@@ -7989,7 +8395,7 @@ var BaseAddon = class {
7989
8395
  async getDeviceSettings(deviceId) {
7990
8396
  const schema = this.deviceSettingsSchema();
7991
8397
  if (!schema) return { sections: [] };
7992
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
8398
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7993
8399
  }
7994
8400
  async updateDeviceSettings(deviceId, patch) {
7995
8401
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -8161,7 +8567,7 @@ var BaseAddon = class {
8161
8567
  key,
8162
8568
  schema,
8163
8569
  fallback,
8164
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
8570
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
8165
8571
  write: async (patch) => {
8166
8572
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
8167
8573
  },
@@ -8223,6 +8629,23 @@ var BaseAddon = class {
8223
8629
  }
8224
8630
  return value;
8225
8631
  }
8632
+ /**
8633
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
8634
+ * keychain the context's own view is already raw.
8635
+ */
8636
+ rawSettings() {
8637
+ return this._secretSettings?.raw ?? this._ctx?.settings;
8638
+ }
8639
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
8640
+ logUnresolvedRead(unresolved) {
8641
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
8642
+ if (fresh.length === 0) return;
8643
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
8644
+ 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) => ({
8645
+ ref: u.ref,
8646
+ reason: u.reason
8647
+ })) } });
8648
+ }
8226
8649
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
8227
8650
  scheduleSecretReresolve(delayMs) {
8228
8651
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -8249,7 +8672,7 @@ var BaseAddon = class {
8249
8672
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
8250
8673
  */
8251
8674
  async readAddonStoreWithRetry() {
8252
- const settings = this._ctx?.settings;
8675
+ const settings = this.rawSettings();
8253
8676
  if (!settings) return {};
8254
8677
  const delaysMs = [
8255
8678
  150,
@@ -10061,6 +10484,16 @@ var CompositionSchema = object({
10061
10484
  seen.add(feature.cap);
10062
10485
  });
10063
10486
  });
10487
+ var NodeColorIdSchema = _enum([
10488
+ "node-a",
10489
+ "node-b",
10490
+ "node-c",
10491
+ "node-d",
10492
+ "node-e",
10493
+ "node-f",
10494
+ "node-g",
10495
+ "node-h"
10496
+ ]);
10064
10497
  new Set([
10065
10498
  "track",
10066
10499
  "face",
@@ -10552,6 +10985,278 @@ var CameraSwitchGroupSchema = object({
10552
10985
  fetchedAt: number()
10553
10986
  });
10554
10987
  /**
10988
+ * The trainer contract — what the hub hands the cloud trainer and what it
10989
+ * gets back (cloud training, D805+).
10990
+ *
10991
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
10992
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
10993
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
10994
+ * lines on stdout. These schemas are the hub's half of that boundary; the
10995
+ * trainer's pydantic models (and the JSON Schemas generated from them under
10996
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
10997
+ * change there, in the same piece of work.
10998
+ *
10999
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
11000
+ * orchestrator fills every field of a job spec explicitly.
11001
+ */
11002
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
11003
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
11004
+ /** What the trainer can export. Edge TPU is a later, separate image. */
11005
+ var TrainingExportSchema = _enum([
11006
+ "onnx",
11007
+ "openvino-fp16",
11008
+ "openvino-int8",
11009
+ "coreml-fp16"
11010
+ ]);
11011
+ var FloorsSchema = record(string(), number().min(0).max(1));
11012
+ object({
11013
+ schema: literal(TRAINING_JOB_SCHEMA),
11014
+ jobKey: string().uuid(),
11015
+ target: object({
11016
+ kind: literal("detector"),
11017
+ step: literal("object-detection")
11018
+ }),
11019
+ base: object({
11020
+ modelId: string().min(1),
11021
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
11022
+ weights: string().min(1),
11023
+ imgsz: number().int().positive()
11024
+ }),
11025
+ baseline: object({
11026
+ modelId: string().min(1),
11027
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
11028
+ onnxUrl: string().url(),
11029
+ imgsz: number().int().positive(),
11030
+ floors: FloorsSchema
11031
+ }),
11032
+ dataset: object({
11033
+ versionId: string().min(1),
11034
+ annotationHash: string(),
11035
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
11036
+ sha256: string().regex(/^[0-9a-f]{64}$/)
11037
+ }),
11038
+ split: object({
11039
+ holdoutCameras: array(number().int()),
11040
+ /** When no camera is held out: the last N days of every camera. */
11041
+ holdoutLastDays: number().int().nonnegative(),
11042
+ valFraction: number().min(0).max(.5),
11043
+ seed: number().int()
11044
+ }),
11045
+ hyper: object({
11046
+ epochs: number().int().positive(),
11047
+ batch: number().int().positive(),
11048
+ lr0: number().positive(),
11049
+ /** Layers frozen from the start of the backbone; 0 = none. */
11050
+ freeze: number().int().nonnegative(),
11051
+ patience: number().int().nonnegative(),
11052
+ seed: number().int()
11053
+ }),
11054
+ replay: object({
11055
+ source: literal("coco2017"),
11056
+ count: number().int().nonnegative()
11057
+ }),
11058
+ exports: array(TrainingExportSchema).min(1),
11059
+ calibration: object({ maxFrames: number().int().positive() }),
11060
+ floors: object({
11061
+ minSupport: number().int().positive(),
11062
+ clamp: number().min(0).max(1)
11063
+ }),
11064
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
11065
+ catalog: object({
11066
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
11067
+ name: string().min(1).max(160)
11068
+ })
11069
+ });
11070
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
11071
+ var TrainingResultFileSchema = object({
11072
+ path: string().min(1),
11073
+ bytes: number().int().nonnegative(),
11074
+ sha256: string().regex(/^[0-9a-f]{64}$/),
11075
+ format: _enum([
11076
+ "onnx",
11077
+ "openvino",
11078
+ "coreml",
11079
+ "pt"
11080
+ ]),
11081
+ variant: _enum(["base", "int8"])
11082
+ });
11083
+ var DraftFormatSchema = object({
11084
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
11085
+ url: string().min(1),
11086
+ sizeMB: number().nonnegative(),
11087
+ isDirectory: boolean().optional(),
11088
+ files: array(string()).optional(),
11089
+ runtimes: array(literal("python")).optional(),
11090
+ revision: string().min(1)
11091
+ });
11092
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
11093
+ var TrainingCatalogDraftSchema = object({
11094
+ id: string().min(1),
11095
+ name: string().min(1),
11096
+ description: string(),
11097
+ labels: array(unknown()),
11098
+ inputSize: object({
11099
+ width: number().int().positive(),
11100
+ height: number().int().positive()
11101
+ }),
11102
+ preprocessMode: literal("letterbox"),
11103
+ defaultClassFloors: FloorsSchema,
11104
+ formats: object({
11105
+ onnx: DraftFormatSchema.optional(),
11106
+ openvino: DraftFormatSchema.optional(),
11107
+ coreml: DraftFormatSchema.optional()
11108
+ })
11109
+ });
11110
+ /** One class of one model's holdout report (the eval harness's summary). */
11111
+ var TrainingEvalClassSchema = object({
11112
+ positives: number().int(),
11113
+ floor: number().nullable(),
11114
+ tp: number().int(),
11115
+ fp: number().int(),
11116
+ fn: number().int(),
11117
+ precision: number().nullable(),
11118
+ recall: number().nullable(),
11119
+ ap50: number().nullable(),
11120
+ recallByCamera: record(string(), number().nullable()).optional(),
11121
+ recallByLight: record(string(), number().nullable()).optional(),
11122
+ fpByCamera: record(string(), number()).optional(),
11123
+ smallFound: number().int().optional(),
11124
+ smallTotal: number().int().optional()
11125
+ }).passthrough();
11126
+ var TrainingEvalReportSchema = object({
11127
+ frames: number().int(),
11128
+ classes: record(string(), TrainingEvalClassSchema)
11129
+ }).passthrough();
11130
+ /**
11131
+ * A succeeded result carries every block; a failed one carries the error and
11132
+ * whatever was known by then — the other blocks are ABSENT, not null. The
11133
+ * orchestrator checks the blocks it needs before it trusts a success.
11134
+ */
11135
+ var TrainingResultSchema = object({
11136
+ schema: literal(TRAINING_RESULT_SCHEMA),
11137
+ jobKey: string(),
11138
+ status: _enum(["succeeded", "failed"]),
11139
+ error: object({
11140
+ stage: string(),
11141
+ code: string(),
11142
+ message: string()
11143
+ }).nullable(),
11144
+ trainer: object({
11145
+ version: string(),
11146
+ revision: string()
11147
+ }),
11148
+ toolchain: record(string(), string().nullable()),
11149
+ dataset: object({
11150
+ versionId: string(),
11151
+ annotationHash: string(),
11152
+ sha256: string(),
11153
+ frames: object({
11154
+ train: number().int(),
11155
+ val: number().int(),
11156
+ holdout: number().int()
11157
+ }),
11158
+ holdoutCameras: array(number().int()),
11159
+ replayImages: number().int()
11160
+ }).optional(),
11161
+ training: object({
11162
+ epochsRun: number().int(),
11163
+ bestEpoch: number().int(),
11164
+ bestMap50: number(),
11165
+ bestMap50_95: number(),
11166
+ seconds: number()
11167
+ }).optional(),
11168
+ evaluation: object({
11169
+ holdoutFrames: number().int(),
11170
+ baseline: TrainingEvalReportSchema.nullable(),
11171
+ candidate: TrainingEvalReportSchema.nullable(),
11172
+ candidateInt8: TrainingEvalReportSchema.nullable(),
11173
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
11174
+ map50: record(string(), number().nullable())
11175
+ }).optional(),
11176
+ floors: object({
11177
+ baseline: FloorsSchema,
11178
+ candidate: FloorsSchema,
11179
+ candidateInt8: FloorsSchema.nullable(),
11180
+ notes: array(string())
11181
+ }).optional(),
11182
+ int8: object({
11183
+ kept: boolean(),
11184
+ map50Fp16: number().nullable(),
11185
+ map50Int8: number().nullable(),
11186
+ reason: string().nullable()
11187
+ }).optional(),
11188
+ exportsDropped: array(object({
11189
+ export: string(),
11190
+ reason: string()
11191
+ })).optional(),
11192
+ files: array(TrainingResultFileSchema).optional(),
11193
+ bundle: object({
11194
+ path: literal("bundle.tar"),
11195
+ bytes: number().int().nonnegative(),
11196
+ sha256: string().regex(/^[0-9a-f]{64}$/)
11197
+ }).nullable().optional(),
11198
+ catalogDraft: object({
11199
+ base: TrainingCatalogDraftSchema,
11200
+ int8: TrainingCatalogDraftSchema.nullable()
11201
+ }).nullable().optional(),
11202
+ licence: string()
11203
+ });
11204
+ var TrainingStageSchema = _enum([
11205
+ "prepare",
11206
+ "replay",
11207
+ "train",
11208
+ "eval",
11209
+ "export",
11210
+ "package"
11211
+ ]);
11212
+ var EventBase = {
11213
+ v: literal(1),
11214
+ ts: number()
11215
+ };
11216
+ discriminatedUnion("type", [
11217
+ object({
11218
+ ...EventBase,
11219
+ type: literal("stage"),
11220
+ stage: TrainingStageSchema
11221
+ }),
11222
+ object({
11223
+ ...EventBase,
11224
+ type: literal("epoch"),
11225
+ epoch: number().int(),
11226
+ epochs: number().int(),
11227
+ boxLoss: number().nullable().optional(),
11228
+ map50: number().nullable().optional(),
11229
+ map50_95: number().nullable().optional(),
11230
+ etaSec: number().nullable().optional()
11231
+ }),
11232
+ object({
11233
+ ...EventBase,
11234
+ type: literal("metric"),
11235
+ name: string(),
11236
+ value: number()
11237
+ }),
11238
+ object({
11239
+ ...EventBase,
11240
+ type: literal("artifact"),
11241
+ path: string(),
11242
+ bytes: number(),
11243
+ sha256: string()
11244
+ }),
11245
+ object({
11246
+ ...EventBase,
11247
+ type: literal("done"),
11248
+ status: _enum(["succeeded", "failed"]),
11249
+ resultSha256: string().nullable().optional()
11250
+ }),
11251
+ object({
11252
+ ...EventBase,
11253
+ type: literal("error"),
11254
+ stage: string(),
11255
+ code: string(),
11256
+ message: string()
11257
+ })
11258
+ ]);
11259
+ /**
10555
11260
  * What the gate decided about a birth, from the CALLER's point of view.
10556
11261
  *
10557
11262
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -12879,7 +13584,9 @@ var AddonHttpRouteSchema = object({
12879
13584
  "authenticated",
12880
13585
  "admin"
12881
13586
  ]).optional(),
12882
- description: string().optional()
13587
+ description: string().optional(),
13588
+ /** The hub limits this route per client address before the handler runs. */
13589
+ rateLimit: _enum(["auth"]).optional()
12883
13590
  });
12884
13591
  /**
12885
13592
  * Cross-process route invocation envelope. The hub captures the
@@ -13584,6 +14291,37 @@ var BackupDestinationInfoSchema = object({
13584
14291
  lastError: string().optional()
13585
14292
  });
13586
14293
  /**
14294
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
14295
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
14296
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
14297
+ * with it off — which restores without a key.
14298
+ */
14299
+ var BackupArchiveEncryptionSchema = object({
14300
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
14301
+ scheme: string(),
14302
+ /** 16 hex — the backup key whose secret restores this archive. */
14303
+ keyId: string()
14304
+ });
14305
+ /**
14306
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
14307
+ * one new archives are encrypted to, and the retired ones older archives
14308
+ * still need. The secret key is shown once, at `setupEncryption`.
14309
+ */
14310
+ var BackupEncryptionStatusSchema = object({
14311
+ enabled: boolean(),
14312
+ active: object({
14313
+ keyId: string(),
14314
+ publicKey: string(),
14315
+ createdAt: number()
14316
+ }).nullable(),
14317
+ /** Every key ever set up, newest first. */
14318
+ keys: array(object({
14319
+ keyId: string(),
14320
+ createdAt: number(),
14321
+ retiredAt: number().nullable()
14322
+ })).readonly()
14323
+ });
14324
+ /**
13587
14325
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
13588
14326
  * Same shape the destination drill-in renders. Sourced from the per-
13589
14327
  * location `manifests.json` (no per-archive tarball read required).
@@ -13595,7 +14333,9 @@ var BackupArchiveEntrySchema = object({
13595
14333
  sizeBytes: number(),
13596
14334
  label: string().optional(),
13597
14335
  /** Top-level locations included in the archive (db, addons, tls, …). */
13598
- locations: array(string()).readonly()
14336
+ locations: array(string()).readonly(),
14337
+ /** Present when the archive is encrypted; restore then needs that key. */
14338
+ encryption: BackupArchiveEncryptionSchema.optional()
13599
14339
  });
13600
14340
  var BackupEntrySchema = object({
13601
14341
  id: string(),
@@ -13604,7 +14344,8 @@ var BackupEntrySchema = object({
13604
14344
  label: string().optional(),
13605
14345
  createdAt: number(),
13606
14346
  sizeBytes: number(),
13607
- locations: array(string()).optional()
14347
+ locations: array(string()).optional(),
14348
+ encryption: BackupArchiveEncryptionSchema.optional()
13608
14349
  });
13609
14350
  var ArchiveEntrySchema = object({
13610
14351
  path: string(),
@@ -13793,10 +14534,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
13793
14534
  * this list and skips entries whose path doesn't start with
13794
14535
  * any of them.
13795
14536
  */
13796
- locations: array(string()).optional()
14537
+ locations: array(string()).optional(),
14538
+ /**
14539
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
14540
+ * one). The archive is decrypted into the hub's private staging
14541
+ * before the restart; the key is not stored. A wrong or missing key
14542
+ * is refused before the archive is downloaded.
14543
+ */
14544
+ backupSecretKey: string().optional()
13797
14545
  }), _void(), {
13798
14546
  kind: "mutation",
13799
14547
  auth: "admin"
14548
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
14549
+ keyId: string(),
14550
+ secretKey: string(),
14551
+ publicKey: string(),
14552
+ createdAt: number(),
14553
+ replacedKeyId: string().nullable()
14554
+ }), {
14555
+ kind: "mutation",
14556
+ auth: "admin"
14557
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
14558
+ kind: "mutation",
14559
+ auth: "admin"
14560
+ }), method(object({ backupSecretKey: string() }), object({
14561
+ valid: boolean(),
14562
+ keyId: string().nullable(),
14563
+ /** The hub knows this key (active or retired). */
14564
+ known: boolean(),
14565
+ /** It is the key new archives are encrypted to. */
14566
+ active: boolean(),
14567
+ error: string().optional()
14568
+ }), {
14569
+ kind: "mutation",
14570
+ auth: "admin"
13800
14571
  }), method(object({
13801
14572
  destinationId: string(),
13802
14573
  backupId: string()
@@ -15522,7 +16293,60 @@ var CustomModelDescriptorSchema = object({
15522
16293
  stepId: string(),
15523
16294
  entry: ModelCatalogEntrySchema
15524
16295
  });
15525
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
16296
+ /** One regular file of an imported bundle, as the producer measured it. */
16297
+ var ModelBundleFileSchema = object({
16298
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
16299
+ path: string().min(1),
16300
+ bytes: number().int().nonnegative(),
16301
+ sha256: string().regex(/^[0-9a-f]{64}$/)
16302
+ });
16303
+ var ImportModelBundleInputSchema = object({
16304
+ /** The registry provider that keeps the model (Model Studio). */
16305
+ addonId: string(),
16306
+ stepId: string().min(1),
16307
+ /**
16308
+ * The catalog rows to register, complete, every format URL already
16309
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
16310
+ * bundle may carry several rows (a base and its INT8 variant).
16311
+ */
16312
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
16313
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
16314
+ bundle: object({
16315
+ ticket: PeerBytesTicketSchema,
16316
+ bytes: number().int().positive(),
16317
+ sha256: string().regex(/^[0-9a-f]{64}$/)
16318
+ }),
16319
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
16320
+ files: array(ModelBundleFileSchema).min(1).max(64),
16321
+ /** Convert missing engine formats and push the model to every agent afterwards. */
16322
+ distribute: boolean()
16323
+ });
16324
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
16325
+ kind: literal("imported"),
16326
+ modelIds: array(string()).readonly(),
16327
+ distributed: array(object({
16328
+ modelId: string(),
16329
+ nodeId: string(),
16330
+ format: _enum(MODEL_FORMATS),
16331
+ ok: boolean(),
16332
+ error: string().optional()
16333
+ })).readonly()
16334
+ }), object({
16335
+ kind: literal("refused"),
16336
+ reason: _enum([
16337
+ "transfer-failed",
16338
+ "checksum-mismatch",
16339
+ "bundle-mismatch",
16340
+ "invalid-entry",
16341
+ "id-taken"
16342
+ ]),
16343
+ detail: string()
16344
+ })]);
16345
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
16346
+ kind: "mutation",
16347
+ auth: "admin",
16348
+ timeoutMs: 30 * 6e4
16349
+ });
15526
16350
  /**
15527
16351
  * Query filter for settings-store collections.
15528
16352
  */
@@ -16001,6 +16825,35 @@ var KeychainKeySourceSchema = object({
16001
16825
  */
16002
16826
  sharesBackupWithDatabase: boolean()
16003
16827
  });
16828
+ /**
16829
+ * One keychain reset, as the Secrets page reports it until the operator
16830
+ * acknowledges it. Never a value: refs, counts and table names only.
16831
+ */
16832
+ var KeychainResetRecordSchema = object({
16833
+ id: string(),
16834
+ at: number(),
16835
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
16836
+ actor: string(),
16837
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
16838
+ lockedReason: string().nullable(),
16839
+ /** Values moved into the archive table (ciphertext under the lost key). */
16840
+ archived: number().int(),
16841
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
16842
+ archivedCollection: string().nullable(),
16843
+ /**
16844
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
16845
+ * so the archive can still be opened if the lost master key turns up.
16846
+ */
16847
+ archivedKeysCollection: string().nullable(),
16848
+ /**
16849
+ * `system-settings` keys whose marker the reset cleared — the cluster
16850
+ * secret's: a marker left pointing at an archived value would refuse every
16851
+ * agent forever (D797).
16852
+ */
16853
+ clearedSettingsKeys: array(string()).readonly(),
16854
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
16855
+ acknowledgedAt: number().nullable()
16856
+ });
16004
16857
  var KeychainStatusSchema = object({
16005
16858
  keychain: KeychainStateSchema,
16006
16859
  /** The source of the master key in use; `null` while locked. */
@@ -16018,7 +16871,9 @@ var KeychainStatusSchema = object({
16018
16871
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
16019
16872
  retiredWraps: number().int(),
16020
16873
  recoveryKeyDownloadedAt: number().nullable(),
16021
- secretCount: number().int()
16874
+ secretCount: number().int(),
16875
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
16876
+ lastReset: KeychainResetRecordSchema.nullable()
16022
16877
  });
16023
16878
  /**
16024
16879
  * Whether a stored value is still pointed at by its owner's settings.
@@ -16040,17 +16895,26 @@ var KeychainAuditActionSchema = _enum([
16040
16895
  "download-recovery-key",
16041
16896
  "delete-orphans",
16042
16897
  "reset",
16898
+ "acknowledge-reset",
16043
16899
  "initialize"
16044
16900
  ]);
16045
16901
  var KeychainAuditEntrySchema = object({
16046
16902
  id: string(),
16047
16903
  at: number(),
16048
16904
  action: KeychainAuditActionSchema,
16049
- /** `addon:<id>` | `user:<id>` | `system`. */
16905
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
16050
16906
  actor: string(),
16051
16907
  ref: string().nullable(),
16052
16908
  detail: string().nullable()
16053
16909
  });
16910
+ var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
16911
+ /**
16912
+ * Secrets the HUB itself holds (owner `system`) that no settings form shows:
16913
+ * `jwt-signing-key` — the session signing key (D797). It is always "in use",
16914
+ * never an orphan; it is generated on a fresh hub and replaced only through
16915
+ * {@link keychainAdminCapability.methods.setSystemSecret}.
16916
+ */
16917
+ var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
16054
16918
  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({
16055
16919
  value: string(),
16056
16920
  version: number().int()
@@ -16058,6 +16922,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16058
16922
  kind: "mutation",
16059
16923
  auth: "admin",
16060
16924
  caller: "required"
16925
+ }), method(object({
16926
+ name: SystemHeldSecretNameSchema,
16927
+ value: string().min(16)
16928
+ }), object({
16929
+ ref: string(),
16930
+ version: number().int()
16931
+ }), {
16932
+ kind: "mutation",
16933
+ auth: "admin",
16934
+ caller: "required"
16061
16935
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16062
16936
  deleted: array(string()).readonly(),
16063
16937
  kept: array(object({
@@ -16087,13 +16961,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16087
16961
  kind: "mutation",
16088
16962
  auth: "admin",
16089
16963
  caller: "required"
16090
- }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
16964
+ }), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
16091
16965
  archivedCollection: string().nullable(),
16092
16966
  archived: number().int()
16093
16967
  }), {
16094
16968
  kind: "mutation",
16095
16969
  auth: "admin",
16096
16970
  caller: "required"
16971
+ }), method(object({}), object({
16972
+ reset: KeychainResetRecordSchema.nullable(),
16973
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
16974
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
16975
+ kind: "mutation",
16976
+ auth: "admin",
16977
+ caller: "required"
16097
16978
  });
16098
16979
  method(_void(), object({
16099
16980
  id: string(),
@@ -18659,14 +19540,14 @@ var LlmProfileSchema = object({
18659
19540
  /** ConfigUISchema tree passed through untyped on the wire (the
18660
19541
  * notification-output `ConfigSchemaPassthrough` precedent at
18661
19542
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
18662
- var ConfigSchemaPassthrough$1 = unknown();
19543
+ var ConfigSchemaPassthrough$3 = unknown();
18663
19544
  var LlmProfileKindDescriptorSchema = object({
18664
19545
  kind: LlmProfileKindSchema,
18665
19546
  label: string(),
18666
19547
  icon: string(),
18667
19548
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
18668
19549
  addonId: string(),
18669
- configSchema: ConfigSchemaPassthrough$1
19550
+ configSchema: ConfigSchemaPassthrough$3
18670
19551
  });
18671
19552
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
18672
19553
  var LlmDefaultSchema = object({
@@ -18944,7 +19825,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
18944
19825
  * `login-method` — collection cap through which auth addons contribute
18945
19826
  * their pre-auth login surfaces to the login page. This is the SINGLE,
18946
19827
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
18947
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
19828
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
18948
19829
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
18949
19830
  * procedure aggregates them for the unauthenticated login page.
18950
19831
  *
@@ -18952,8 +19833,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
18952
19833
  *
18953
19834
  * - `redirect` — a declarative button. The login page renders a generic
18954
19835
  * button that navigates to `startUrl` (an addon-owned HTTP route).
18955
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
18956
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
19836
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
18957
19837
  * login page needs NO change.
18958
19838
  *
18959
19839
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -18972,8 +19852,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
18972
19852
  * decision.
18973
19853
  *
18974
19854
  * Every contribution carries a `stage`:
18975
- * - `primary` — shown on the first credentials screen (OIDC /
18976
- * magic-link buttons; a future usernameless passkey).
19855
+ * - `primary` — shown on the first credentials screen (OIDC
19856
+ * buttons; a usernameless passkey).
18977
19857
  * - `second-factor` — shown AFTER the password leg, gated on the
18978
19858
  * returned `factors` (passkey-as-2FA today).
18979
19859
  *
@@ -19000,7 +19880,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
19000
19880
  * The provider names an external identity a signed-in user can link to
19001
19881
  * their own account (D782): `auth.listLinkableProviders` /
19002
19882
  * `beginExternalLink` offer exactly the redirect methods that set this,
19003
- * whatever their id. Absent / false — a login button only (magic-link).
19883
+ * whatever their id. Absent / false — a login button only.
19004
19884
  */
19005
19885
  linkable: boolean().optional()
19006
19886
  }),
@@ -19788,7 +20668,7 @@ var TargetKindCapsSchema = object({
19788
20668
  * the union is large and not meant for runtime validation here; the exported
19789
20669
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
19790
20670
  */
19791
- var ConfigSchemaPassthrough = unknown();
20671
+ var ConfigSchemaPassthrough$2 = unknown();
19792
20672
  var TargetKindSchema = object({
19793
20673
  kind: string(),
19794
20674
  label: string(),
@@ -19825,7 +20705,7 @@ var TargetKindSchema = object({
19825
20705
  * its raster path, which is the safe default for an unknown image.
19826
20706
  */
19827
20707
  iconMediaType: string().optional(),
19828
- configSchema: ConfigSchemaPassthrough,
20708
+ configSchema: ConfigSchemaPassthrough$2,
19829
20709
  /**
19830
20710
  * The config keys that decide WHERE this kind's secrets are sent (server,
19831
20711
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -22855,8 +23735,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
22855
23735
  * `super_admin` — collapsed onto the single boolean because every
22856
23736
  * non-admin caller is governed by the same scope-check rules; the
22857
23737
  * distinction was only ever used to route role-specific procedures
22858
- * which we no longer have. Agents are admin sessions issued via
22859
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
23738
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
22860
23739
  * with `isAdmin: false` + an explicit scope list.
22861
23740
  */
22862
23741
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -23163,6 +24042,61 @@ var OauthIntegrationDescriptorSchema = object({
23163
24042
  });
23164
24043
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
23165
24044
  /**
24045
+ * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
24046
+ *
24047
+ * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
24048
+ * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
24049
+ * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
24050
+ * immutable after create.
24051
+ */
24052
+ var ConfigSchemaPassthrough$1 = unknown();
24053
+ var OidcConnectionSchema = object({
24054
+ id: string().min(1),
24055
+ displayName: string(),
24056
+ icon: string(),
24057
+ issuerUrl: string(),
24058
+ clientId: string(),
24059
+ /** Client id + secret present — never the secret value. */
24060
+ configured: boolean(),
24061
+ /**
24062
+ * Values for the connection form schema. `clientSecret` is a keychain
24063
+ * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
24064
+ */
24065
+ formValues: record(string(), unknown()).optional()
24066
+ });
24067
+ /**
24068
+ * Patch one connection. Omitted or empty `clientSecret` keeps the stored
24069
+ * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
24070
+ */
24071
+ var OidcConnectionUpdateInputSchema = object({
24072
+ id: string().min(1),
24073
+ displayName: string().min(1),
24074
+ icon: string().optional(),
24075
+ issuerUrl: string().optional(),
24076
+ clientId: string().optional(),
24077
+ clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
24078
+ redirectUri: string().optional(),
24079
+ scopes: string().optional(),
24080
+ usernameClaim: _enum([
24081
+ "preferred_username",
24082
+ "email",
24083
+ "sub"
24084
+ ]).optional()
24085
+ });
24086
+ method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
24087
+ id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
24088
+ displayName: string().min(1)
24089
+ }), object({ id: string() }), {
24090
+ kind: "mutation",
24091
+ auth: "admin"
24092
+ }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
24093
+ kind: "mutation",
24094
+ auth: "admin"
24095
+ }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
24096
+ kind: "mutation",
24097
+ auth: "admin"
24098
+ });
24099
+ /**
23166
24100
  * What started a camera's onboard motion (D672). `camera` is the camera's own
23167
24101
  * firmware; `sensor` is a device the operator ATTACHED to it. Absent on the
23168
24102
  * wire means the camera: only the camera-sensors bridge ever says `sensor`.
@@ -24519,21 +25453,69 @@ var RetrainFrameListSchema = object({
24519
25453
  /** What the page pre-selects — the native key frame when one survives. */
24520
25454
  autoPickMediaId: number().int().optional()
24521
25455
  });
25456
+ /** Exclusive partition of a corpus copy's annotation progress (design §4.2). */
25457
+ var RetrainFrameWorkStateSchema = _enum([
25458
+ "unannotated",
25459
+ "annotated",
25460
+ "complete"
25461
+ ]);
25462
+ /**
25463
+ * Filters for paginated corpus list, KPI, and matching export (design §4.4).
25464
+ * Every narrowing field is ANDed; omitted fields impose no constraint.
25465
+ */
25466
+ var RetrainCorpusFilterSchema = object({
25467
+ workState: RetrainFrameWorkStateSchema.optional(),
25468
+ deviceIds: array(number()).max(500).optional(),
25469
+ /** When set, only frames in this named collection. */
25470
+ collectionId: string().optional(),
25471
+ /** Frames that carry at least one saved annotation in one of these classes. */
25472
+ classes: array(RetrainMacroClassSchema).optional(),
25473
+ page: number().int().positive().default(1),
25474
+ pageSize: number().int().positive().max(100).default(50)
25475
+ });
25476
+ var RetrainCorpusPageSchema = object({
25477
+ frames: array(RetrainFrameSchema.extend({ workState: RetrainFrameWorkStateSchema })).readonly(),
25478
+ total: number().int().nonnegative(),
25479
+ page: number().int().positive(),
25480
+ pageSize: number().int().positive()
25481
+ });
25482
+ var RetrainCorpusKpiCameraRowSchema = object({
25483
+ deviceId: number(),
25484
+ unannotated: number().int().nonnegative(),
25485
+ annotated: number().int().nonnegative(),
25486
+ complete: number().int().nonnegative(),
25487
+ /** This camera's `complete` count divided by corpus `total`, in `[0,1]`.
25488
+ * `null` when the corpus is empty (no ratio). */
25489
+ pctOfCorpus: number().min(0).max(1).nullable()
25490
+ });
25491
+ var RetrainCorpusKpiSchema = object({
25492
+ total: number().int().nonnegative(),
25493
+ unannotated: number().int().nonnegative(),
25494
+ annotated: number().int().nonnegative(),
25495
+ complete: number().int().nonnegative(),
25496
+ cameras: array(RetrainCorpusKpiCameraRowSchema).readonly()
25497
+ });
24522
25498
  /**
24523
25499
  * Which frames an annotated export carries. Every field narrows; an empty
24524
- * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
24525
- * list owned by whoever trains (the training orchestrator), so `frameIds` is
24526
- * the primitive a version export uses; `batchId` re-selects what an earlier
24527
- * export carried (`exportedInBatch`).
25500
+ * filter is every annotated copy. `frameIds` is the primitive a job or
25501
+ * download uses; `batchId` re-selects what an earlier export carried
25502
+ * (`exportedInBatch`). Frozen dataset versions were removed — live selection
25503
+ * resolves to `frameIds` at plan/start.
24528
25504
  */
24529
25505
  var RetrainExportFilterSchema = object({
24530
25506
  deviceIds: array(number()).optional(),
24531
25507
  frameIds: array(string()).max(2e4).optional(),
24532
25508
  /** Only frames in at least one of these named collections. */
24533
25509
  collectionIds: array(string()).max(200).optional(),
25510
+ /** Single collection (Frames filter bar). ANDed with `collectionIds` when both set. */
25511
+ collectionId: string().optional(),
24534
25512
  batchId: string().optional(),
24535
25513
  /** Only frames the operator marked complete (all subjects boxed). */
24536
- completeOnly: boolean().optional()
25514
+ completeOnly: boolean().optional(),
25515
+ /** Exclusive work-state partition (`workStateOf`); same as the corpus list. */
25516
+ workState: RetrainFrameWorkStateSchema.optional(),
25517
+ /** Frames with at least one saved annotation in one of these classes. */
25518
+ classes: array(RetrainMacroClassSchema).optional()
24537
25519
  });
24538
25520
  /**
24539
25521
  * `frames`: the full frame copies, boxes in `annotations.json`.
@@ -24698,6 +25680,77 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
24698
25680
  ]),
24699
25681
  detail: string().optional()
24700
25682
  })]);
25683
+ /** What a dataset version is cut from. Every field narrows. */
25684
+ var RetrainDatasetSelectionSchema = object({
25685
+ deviceIds: array(number()).readonly().optional(),
25686
+ collectionIds: array(string()).max(200).readonly().optional(),
25687
+ frameIds: array(string()).max(2e4).readonly().optional()
25688
+ });
25689
+ /** The counts a dataset is judged by. */
25690
+ var RetrainDatasetStatsSchema = object({
25691
+ frames: number().int(),
25692
+ completeFrames: number().int(),
25693
+ /** `completeFrames / frames`, 0..1. */
25694
+ completeness: number(),
25695
+ /** Boxes to learn (model errors excluded). */
25696
+ subjects: number().int(),
25697
+ modelErrors: number().int(),
25698
+ /** Complete frames with no subject. */
25699
+ hardNegatives: number().int(),
25700
+ /** Subjects per class × camera × day/night. */
25701
+ cells: array(object({
25702
+ macroClass: string(),
25703
+ deviceId: number(),
25704
+ lighting: _enum([
25705
+ "day",
25706
+ "night",
25707
+ "unknown"
25708
+ ]),
25709
+ subjects: number().int(),
25710
+ frames: number().int()
25711
+ })).readonly(),
25712
+ cameras: array(object({
25713
+ deviceId: number(),
25714
+ frames: number().int(),
25715
+ completeFrames: number().int()
25716
+ })).readonly()
25717
+ });
25718
+ object({
25719
+ id: string(),
25720
+ name: string(),
25721
+ createdAt: number(),
25722
+ selection: RetrainDatasetSelectionSchema,
25723
+ layout: RetrainExportLayoutSchema,
25724
+ completeOnly: boolean(),
25725
+ frameCount: number().int(),
25726
+ annotationHash: string(),
25727
+ manifestSchema: string(),
25728
+ stats: RetrainDatasetStatsSchema
25729
+ });
25730
+ /**
25731
+ * Live training corpus criteria — same shape as `TrainingCorpusSelection` on
25732
+ * the training cap. Resolved here so plan/start and the annotated export share
25733
+ * one definition of "the frames" (`buildRetrainExportPlan`).
25734
+ */
25735
+ var RetrainTrainingCorpusSelectionSchema = object({
25736
+ collectionIds: array(string()).min(1),
25737
+ workState: _enum([
25738
+ "complete",
25739
+ "annotated_or_complete",
25740
+ "any_annotated"
25741
+ ]).default("complete")
25742
+ });
25743
+ var RetrainTrainingCorpusResolveResultSchema = discriminatedUnion("kind", [object({
25744
+ kind: literal("resolved"),
25745
+ frameIds: array(string()).max(2e4).readonly(),
25746
+ stats: RetrainDatasetStatsSchema,
25747
+ annotationHash: string(),
25748
+ layout: RetrainExportLayoutSchema
25749
+ }), object({
25750
+ kind: literal("refused"),
25751
+ reason: _enum(["unknown-collection", "no-frames"]),
25752
+ detail: string()
25753
+ })]);
24701
25754
  /** The outcome of a lifecycle move owned by the retrain page. */
24702
25755
  var RetrainTransitionResultSchema = object({
24703
25756
  trackId: string(),
@@ -25403,6 +26456,12 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
25403
26456
  }), array(RetrainTrackSchema).readonly(), {
25404
26457
  kind: "query",
25405
26458
  auth: "admin"
26459
+ }), method(RetrainCorpusFilterSchema, RetrainCorpusPageSchema, {
26460
+ kind: "query",
26461
+ auth: "admin"
26462
+ }), method(object({}), RetrainCorpusKpiSchema, {
26463
+ kind: "query",
26464
+ auth: "admin"
25406
26465
  }), method(object({ trackId: string() }), RetrainFrameListSchema, {
25407
26466
  kind: "query",
25408
26467
  auth: "admin"
@@ -25487,6 +26546,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
25487
26546
  kind: "mutation",
25488
26547
  auth: "admin",
25489
26548
  timeoutMs: 60 * 6e4
26549
+ }), method(object({
26550
+ filter: RetrainExportFilterSchema,
26551
+ layout: RetrainExportLayoutSchema
26552
+ }), object({
26553
+ ticket: PeerBytesTicketSchema,
26554
+ frames: number().int(),
26555
+ annotations: number().int()
26556
+ }), {
26557
+ kind: "mutation",
26558
+ auth: "admin",
26559
+ timeoutMs: 12e4
25490
26560
  }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
25491
26561
  kind: "query",
25492
26562
  auth: "admin"
@@ -25513,6 +26583,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
25513
26583
  }), method(object({}), array(RetrainCollectionSchema).readonly(), {
25514
26584
  kind: "query",
25515
26585
  auth: "admin"
26586
+ }), method(RetrainTrainingCorpusSelectionSchema, RetrainTrainingCorpusResolveResultSchema, {
26587
+ kind: "query",
26588
+ auth: "admin",
26589
+ timeoutMs: 6e4
25516
26590
  }), method(object({
25517
26591
  id: string(),
25518
26592
  name: string().max(120)
@@ -26129,11 +27203,14 @@ var HardwareClassIdSchema = _enum([
26129
27203
  "intel-n-series",
26130
27204
  "apple-m-base",
26131
27205
  "apple-m-pro",
27206
+ "amd-phoenix",
26132
27207
  "unknown"
26133
27208
  ]);
26134
27209
  var AcceleratorKindSchema = _enum([
26135
27210
  "intel-npu",
26136
27211
  "intel-igpu",
27212
+ "amd-igpu",
27213
+ "amd-npu",
26137
27214
  "x86-cpu",
26138
27215
  "arm-cpu",
26139
27216
  "apple-ane",
@@ -28063,6 +29140,8 @@ var AgentPipelineSettingsSchema = object({
28063
29140
  * address is wrong (multi-homed host, NAT, custom interface).
28064
29141
  */
28065
29142
  reachableHost: string().optional(),
29143
+ /** Hub-persisted UI colour (`--color-node-*` theme tokens). */
29144
+ color: NodeColorIdSchema.optional(),
28066
29145
  /**
28067
29146
  * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
28068
29147
  * weight, steps}. Absent / all-disabled ⇒ the node's single default
@@ -28612,8 +29691,9 @@ method(object({
28612
29691
  auth: "admin"
28613
29692
  }), method(object({
28614
29693
  agentNodeId: string(),
28615
- reachableHost: string().nullable()
28616
- }), object({ success: literal(true) }), {
29694
+ reachableHost: string().nullable().optional(),
29695
+ color: NodeColorIdSchema.nullable().optional()
29696
+ }).refine((v) => v.reachableHost !== void 0 || v.color !== void 0, { message: "reachableHost or color required" }), object({ success: literal(true) }), {
28617
29697
  kind: "mutation",
28618
29698
  auth: "admin"
28619
29699
  }), method(object({
@@ -29065,8 +30145,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
29065
30145
  * `smtp-provider` — pluggable email delivery surface.
29066
30146
  *
29067
30147
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
29068
- * one for transactional / one for notifications). Consumers (magic-link,
29069
- * notifier addons, …) walk the collection and pick the first
30148
+ * one for transactional / one for notifications). Consumers (notifier
30149
+ * addons, …) walk the collection and pick the first
29070
30150
  * ready provider OR target a specific addonId.
29071
30151
  *
29072
30152
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -29245,7 +30325,7 @@ targets: array(object({
29245
30325
  })));
29246
30326
  /**
29247
30327
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
29248
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
30328
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
29249
30329
  * carrying the post-callback claims before redirecting back to
29250
30330
  * `/api/auth/sso/finish`.
29251
30331
  *
@@ -29308,7 +30388,14 @@ var SsoBridgeClaimsSchema = object({
29308
30388
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
29309
30389
  * subject is unique only per issuer, so a link is bound to it.
29310
30390
  */
29311
- issuer: string().optional()
30391
+ issuer: string().optional(),
30392
+ /**
30393
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
30394
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
30395
+ * request to present the matching cookie — a login bridge is useless in
30396
+ * any other browser.
30397
+ */
30398
+ browserBinding: string().optional()
29312
30399
  });
29313
30400
  method(object({
29314
30401
  claims: SsoBridgeClaimsSchema,
@@ -31682,7 +32769,7 @@ var CustomActionInputSchema = object({
31682
32769
  action: string().min(1),
31683
32770
  input: unknown()
31684
32771
  });
31685
- method(_void(), array(AddonListItemSchema).readonly()), method(object({
32772
+ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSchema).readonly()), method(object({
31686
32773
  addonId: string(),
31687
32774
  limit: number().min(1).max(500).default(100),
31688
32775
  level: LogLevelSchema$2.optional()
@@ -36752,7 +37839,13 @@ var TopologyNodeSchema = object({
36752
37839
  })).readonly(),
36753
37840
  processes: array(TopologyProcessSchema).readonly(),
36754
37841
  categories: array(TopologyCategorySchema).readonly(),
36755
- rootPackage: TopologyRootPackageSchema.nullable()
37842
+ rootPackage: TopologyRootPackageSchema.nullable(),
37843
+ /**
37844
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
37845
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
37846
+ * for offline rows and when the hub cannot tell.
37847
+ */
37848
+ meshTransport: _enum(["tls", "clear"]).optional()
36756
37849
  });
36757
37850
  var CapUsageEdgeSchema = object({
36758
37851
  callerAddonId: string(),
@@ -37165,6 +38258,7 @@ var OsdNamedTemplateSchema = object({
37165
38258
  });
37166
38259
  /** Where a slot's value comes from. */
37167
38260
  var OsdSourceSchema = discriminatedUnion("kind", [
38261
+ object({ kind: literal("none") }),
37168
38262
  object({
37169
38263
  kind: literal("static"),
37170
38264
  text: string().max(64)
@@ -37291,6 +38385,13 @@ method(object({ deviceId: number().int() }), object({
37291
38385
  }), object({ success: literal(true) }), {
37292
38386
  kind: "mutation",
37293
38387
  auth: "admin"
38388
+ }), method(object({
38389
+ deviceId: number().int(),
38390
+ slotId: string().min(1),
38391
+ enabled: boolean()
38392
+ }), object({ success: literal(true) }), {
38393
+ kind: "mutation",
38394
+ auth: "admin"
37294
38395
  }), method(object({
37295
38396
  sourceDeviceId: number().int(),
37296
38397
  targetDeviceId: number().int()
@@ -37722,7 +38823,15 @@ var GpuInfoSchema = object({
37722
38823
  name: string(),
37723
38824
  memoryMB: number().optional()
37724
38825
  });
37725
- var NpuInfoSchema = object({ type: _enum(["apple-ane", "intel-npu"]) });
38826
+ var NpuInfoSchema = object({
38827
+ type: _enum([
38828
+ "apple-ane",
38829
+ "intel-npu",
38830
+ "amd-xdna"
38831
+ ]),
38832
+ name: string().optional(),
38833
+ generation: _enum(["xdna1", "xdna2"]).optional()
38834
+ });
37726
38835
  var CoralInfoSchema = object({
37727
38836
  type: literal("coral-edgetpu"),
37728
38837
  bus: string().optional()
@@ -41575,16 +42684,6 @@ var ApiKeySummarySchema = object({
41575
42684
  createdAt: number(),
41576
42685
  lastUsedAt: number().optional()
41577
42686
  });
41578
- var CreateApiKeyInputSchema = object({
41579
- label: string(),
41580
- isAdmin: boolean().default(false),
41581
- allowedProviders: union([array(string()), literal("*")]).optional(),
41582
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
41583
- });
41584
- var CreateApiKeyResultSchema = object({
41585
- token: string(),
41586
- record: ApiKeySummarySchema
41587
- });
41588
42687
  var ScopedTokenSummarySchema = object({
41589
42688
  id: string(),
41590
42689
  userId: string(),
@@ -41683,17 +42782,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
41683
42782
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
41684
42783
  kind: "mutation",
41685
42784
  access: "view"
41686
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
41687
- kind: "mutation",
41688
- auth: "admin",
41689
- access: "create"
41690
- }), method(object({ id: string() }), object({ success: literal(true) }), {
42785
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
41691
42786
  kind: "mutation",
41692
42787
  auth: "admin",
41693
42788
  access: "delete"
41694
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
41695
- kind: "mutation",
41696
- access: "view"
41697
42789
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
41698
42790
  kind: "mutation",
41699
42791
  auth: "admin",
@@ -41767,15 +42859,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
41767
42859
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
41768
42860
  userId: string(),
41769
42861
  issuer: string()
41770
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
41771
- userId: string(),
41772
- issuer: string().min(1),
41773
- label: string().optional()
41774
- }), object({ success: literal(true) }), {
41775
- kind: "mutation",
41776
- auth: "admin",
41777
- access: "create"
41778
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
42862
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41779
42863
  kind: "mutation",
41780
42864
  auth: "admin",
41781
42865
  access: "delete"
@@ -42480,6 +43564,563 @@ var zoneRulesCapability = {
42480
43564
  */
42481
43565
  durability: "restored"
42482
43566
  };
43567
+ /**
43568
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
43569
+ *
43570
+ * A thin, mockable translation layer: it knows how to run a container with a
43571
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
43572
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
43573
+ * those are the `training` orchestrator's (D805). Every rule written there
43574
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
43575
+ * manifest entry and nothing else.
43576
+ *
43577
+ * Collection of provider **types** (addons). Each addon owns zero or more
43578
+ * **entries** (credentials + defaults). Concat-fans: `describe`,
43579
+ * `describeTypes`, `listEntries`, `listJobs`. Single-row work is keyed by
43580
+ * `entryId`; callers also pass the owning `addonId` as the collection
43581
+ * selector (broker posture). Every method is `admin`: these spend money.
43582
+ *
43583
+ * Every cloud object a provider creates is tagged with the orchestrator's
43584
+ * `jobKey`, so a retried submit finds the job it already started instead of
43585
+ * starting a second GPU, and `listJobs` can find orphans.
43586
+ *
43587
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
43588
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
43589
+ * ticket the provider mints (D613).
43590
+ */
43591
+ var TrainingGpuOptionSchema = object({
43592
+ id: string(),
43593
+ label: string(),
43594
+ /** List price, USD per GPU-hour, before any region multiplier. */
43595
+ usdPerHour: number().nonnegative(),
43596
+ vramGb: number().nonnegative()
43597
+ });
43598
+ var TrainingRegionOptionSchema = object({
43599
+ /** `''` = any region (the provider's choice). */
43600
+ id: string(),
43601
+ label: string(),
43602
+ priceMultiplier: number().positive()
43603
+ });
43604
+ /**
43605
+ * The provider's per-entry settings, as the orchestrator reads them. They
43606
+ * live on the PROVIDER addon's entry (operator decision 2026-10-08: they
43607
+ * depend on the user's account), never hard-coded in the orchestrator.
43608
+ */
43609
+ var TrainingProviderDefaultsSchema = object({
43610
+ gpuType: string(),
43611
+ region: string(),
43612
+ costCapUsd: number().nonnegative(),
43613
+ maxRuntimeSec: number().int().positive(),
43614
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
43615
+ failedDatasetGraceHours: number().nonnegative()
43616
+ });
43617
+ /**
43618
+ * Entry form schema for a provider type — same seam as notification
43619
+ * `TargetKind.configSchema` (`z.unknown()` at the wire; callers tighten to
43620
+ * {@link ConfigUISchema}). Drives `ConfigFormBuilder` on Training → Providers.
43621
+ */
43622
+ var ConfigSchemaPassthrough = unknown();
43623
+ /** One creatable provider type, for the Add-entry dialog. */
43624
+ var TrainingProviderTypeSchema = object({
43625
+ typeId: string(),
43626
+ label: string(),
43627
+ /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
43628
+ iconAsset: string(),
43629
+ /** Owning `training-provider` addon — collection selector for createEntry. */
43630
+ addonId: string(),
43631
+ /**
43632
+ * Fields for one entry of this type (credentials + defaults). Absent on a
43633
+ * type that only needs a name. Password fields are keychain-backed on the
43634
+ * provider addon (`secretStatePaths`), not D634 plaintext.
43635
+ */
43636
+ configSchema: ConfigSchemaPassthrough.optional()
43637
+ });
43638
+ /** One configured account / workspace under a provider type. */
43639
+ var TrainingProviderEntrySchema = object({
43640
+ entryId: string(),
43641
+ typeId: string(),
43642
+ name: string(),
43643
+ addonId: string(),
43644
+ /** Credentials are present — never the values. */
43645
+ configured: boolean()
43646
+ });
43647
+ var TrainingProviderDescriptorSchema = object({
43648
+ addonId: string(),
43649
+ entryId: string(),
43650
+ typeId: string(),
43651
+ /** Operator-chosen entry name. */
43652
+ name: string(),
43653
+ iconAsset: string(),
43654
+ /** `modal`, `runpod`, `fake`, … — same as typeId for current providers. */
43655
+ kind: string(),
43656
+ label: string(),
43657
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
43658
+ regions: array(TrainingRegionOptionSchema).readonly(),
43659
+ maxDatasetBytes: number().int().positive(),
43660
+ maxRuntimeSec: number().int().positive(),
43661
+ freeTierNote: string().optional(),
43662
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
43663
+ dataResidencyNote: string(),
43664
+ /** Credentials are present — never the values. */
43665
+ configured: boolean(),
43666
+ defaults: TrainingProviderDefaultsSchema,
43667
+ /**
43668
+ * Values for {@link TrainingProviderTypeSchema}'s `configSchema` — password
43669
+ * fields are keychain {@link SecretFieldView} or `null` / `''` (create),
43670
+ * never plaintext. Same hydrate contract as settings forms (D789).
43671
+ */
43672
+ formValues: record(string(), unknown()).optional()
43673
+ });
43674
+ /**
43675
+ * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
43676
+ * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
43677
+ * `{ $secretClear: true }` clears it.
43678
+ */
43679
+ var TrainingProviderUpdateEntryInputSchema = object({
43680
+ entryId: string().min(1),
43681
+ name: string().min(1),
43682
+ tokenId: string().optional(),
43683
+ tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
43684
+ environment: string().optional(),
43685
+ gpuType: string().optional(),
43686
+ region: string().optional(),
43687
+ costCapUsd: number().nonnegative().optional(),
43688
+ maxRuntimeSec: number().int().positive().optional(),
43689
+ failedDatasetGraceHours: number().nonnegative().optional()
43690
+ });
43691
+ var TrainingCredentialCheckSchema = object({
43692
+ ok: boolean(),
43693
+ /** Workspace / account name, when the provider says. */
43694
+ account: string().optional(),
43695
+ reason: _enum([
43696
+ "missing",
43697
+ "invalid",
43698
+ "forbidden",
43699
+ "network",
43700
+ "quota"
43701
+ ]).optional(),
43702
+ detail: string().optional()
43703
+ });
43704
+ var ProviderJobStateSchema = _enum([
43705
+ "pending",
43706
+ "starting",
43707
+ "running",
43708
+ "succeeded",
43709
+ "failed",
43710
+ "cancelled",
43711
+ "lost"
43712
+ ]);
43713
+ var ProviderJobStatusSchema = object({
43714
+ jobKey: string(),
43715
+ providerJobId: string().optional(),
43716
+ state: ProviderJobStateSchema,
43717
+ startedAt: number().optional(),
43718
+ endedAt: number().optional(),
43719
+ exitCode: number().int().optional(),
43720
+ failureReason: string().optional(),
43721
+ gpuType: string(),
43722
+ region: string().optional(),
43723
+ billedSeconds: number().nonnegative(),
43724
+ costUsd: number().nonnegative(),
43725
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
43726
+ costIsEstimate: boolean(),
43727
+ lastFetchedAt: number()
43728
+ });
43729
+ /**
43730
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
43731
+ * image its own way (Modal builds the published Dockerfile at that revision;
43732
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
43733
+ * in `result.json`.
43734
+ */
43735
+ var TrainerSourceRefSchema = object({
43736
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
43737
+ repo: string().min(1),
43738
+ /** A commit sha (never a branch) — the job must be reproducible. */
43739
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
43740
+ });
43741
+ /** Cloud job identity — route with the owning addon's `addonId` selector. */
43742
+ var JobRef = {
43743
+ entryId: string().min(1),
43744
+ jobKey: string().uuid()
43745
+ };
43746
+ var TrainingLogLineSchema = object({
43747
+ ts: number(),
43748
+ text: string()
43749
+ });
43750
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
43751
+ typeId: string().min(1),
43752
+ name: string().min(1)
43753
+ }), object({ entryId: string() }), {
43754
+ kind: "mutation",
43755
+ auth: "admin"
43756
+ }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
43757
+ kind: "mutation",
43758
+ auth: "admin"
43759
+ }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
43760
+ kind: "mutation",
43761
+ auth: "admin"
43762
+ }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
43763
+ kind: "mutation",
43764
+ auth: "admin",
43765
+ timeoutMs: 3e4
43766
+ }), method(object({
43767
+ entryId: string().min(1),
43768
+ gpuType: string(),
43769
+ region: string(),
43770
+ datasetBytes: number().int().nonnegative(),
43771
+ gpuSecondsLow: number().nonnegative(),
43772
+ gpuSecondsHigh: number().nonnegative()
43773
+ }), object({
43774
+ usdLow: number().nonnegative(),
43775
+ usdHigh: number().nonnegative(),
43776
+ notes: array(string()).readonly()
43777
+ }), { auth: "admin" }), method(object({
43778
+ ...JobRef,
43779
+ ticket: PeerBytesTicketSchema
43780
+ }), object({
43781
+ bytes: number().int().nonnegative(),
43782
+ sha256: string()
43783
+ }), {
43784
+ kind: "mutation",
43785
+ auth: "admin",
43786
+ timeoutMs: 120 * 6e4
43787
+ }), method(object({
43788
+ ...JobRef,
43789
+ trainer: TrainerSourceRefSchema,
43790
+ jobSpecJson: string().min(2).max(64e3),
43791
+ gpuType: string(),
43792
+ region: string(),
43793
+ maxRuntimeSec: number().int().positive()
43794
+ }), ProviderJobStatusSchema, {
43795
+ kind: "mutation",
43796
+ auth: "admin",
43797
+ timeoutMs: 30 * 6e4
43798
+ }), method(object(JobRef), ProviderJobStatusSchema, {
43799
+ auth: "admin",
43800
+ timeoutMs: 6e4
43801
+ }), method(object({
43802
+ ...JobRef,
43803
+ cursor: string().optional(),
43804
+ max: number().int().min(1).max(500)
43805
+ }), object({
43806
+ lines: array(TrainingLogLineSchema).readonly(),
43807
+ cursor: string()
43808
+ }), {
43809
+ auth: "admin",
43810
+ timeoutMs: 6e4
43811
+ }), method(object(JobRef), object({ ok: literal(true) }), {
43812
+ kind: "mutation",
43813
+ auth: "admin",
43814
+ timeoutMs: 6e4
43815
+ }), method(object(JobRef), object({
43816
+ found: boolean(),
43817
+ text: string().optional()
43818
+ }), {
43819
+ kind: "mutation",
43820
+ auth: "admin",
43821
+ timeoutMs: 5 * 6e4
43822
+ }), method(object({
43823
+ ...JobRef,
43824
+ path: _enum(["bundle.tar"])
43825
+ }), object({ ticket: PeerBytesTicketSchema }), {
43826
+ kind: "mutation",
43827
+ auth: "admin",
43828
+ timeoutMs: 5 * 6e4
43829
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
43830
+ kind: "mutation",
43831
+ auth: "admin",
43832
+ timeoutMs: 5 * 6e4
43833
+ }), method(object({ entryId: string().min(1).optional() }), array(ProviderJobStatusSchema).readonly(), {
43834
+ auth: "admin",
43835
+ timeoutMs: 2 * 6e4
43836
+ });
43837
+ /**
43838
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
43839
+ * provided by `addon-training`.
43840
+ *
43841
+ * It owns what every provider must agree on, written once:
43842
+ *
43843
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
43844
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
43845
+ * - **The return flow.** Verified artefacts → Model Studio
43846
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
43847
+ * rollback. Nothing is ever registered automatically.
43848
+ *
43849
+ * Plan/start takes a live {@link TrainingCorpusSelection} (collections +
43850
+ * work-state rule); frame ids are resolved via pipeline-analytics at that
43851
+ * moment and snapshotted on the job. No frozen dataset version.
43852
+ *
43853
+ * Every method is `admin`.
43854
+ */
43855
+ /**
43856
+ * Live corpus criteria for plan/start (design §5.2). Default is complete-only.
43857
+ * Frame ids are resolved at plan/start — never a frozen version id.
43858
+ */
43859
+ var TrainingCorpusSelectionSchema = object({
43860
+ collectionIds: array(string()).min(1),
43861
+ /** Default complete-only for v1 */
43862
+ workState: _enum([
43863
+ "complete",
43864
+ "annotated_or_complete",
43865
+ "any_annotated"
43866
+ ]).default("complete")
43867
+ });
43868
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
43869
+ var TrainingBaseModelSchema = object({
43870
+ modelId: string(),
43871
+ label: string(),
43872
+ weights: string(),
43873
+ imgsz: number().int(),
43874
+ baselineOnnxUrl: string(),
43875
+ baselineFloors: record(string(), number()),
43876
+ /** The base the fleet runs most — the UI's default. */
43877
+ recommended: boolean()
43878
+ });
43879
+ var TrainingPresetSchema = _enum([
43880
+ "quick",
43881
+ "standard",
43882
+ "thorough"
43883
+ ]);
43884
+ var TrainingJobRequestSchema = object({
43885
+ /** Live collection + work-state criteria; resolved at plan/start. */
43886
+ selection: TrainingCorpusSelectionSchema,
43887
+ /**
43888
+ * The provider **entry** that runs it (credentials + defaults).
43889
+ * Resolve to an owning addon via `training-provider.describe` / `listEntries`.
43890
+ */
43891
+ entryId: string().min(1),
43892
+ gpuType: string().min(1),
43893
+ region: string(),
43894
+ baseModelId: string().min(1),
43895
+ preset: TrainingPresetSchema,
43896
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
43897
+ freeze: number().int().nonnegative().nullable(),
43898
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
43899
+ holdoutCameras: array(number().int()).nullable()
43900
+ });
43901
+ var TrainingSplitPlanSchema = object({
43902
+ holdoutCameras: array(number().int()).readonly(),
43903
+ /** Used when no camera is held out: the last N days of every camera. */
43904
+ holdoutLastDays: number().int().nonnegative(),
43905
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
43906
+ holdoutSupport: record(string(), number().int()).nullable(),
43907
+ trainSubjects: number().int()
43908
+ });
43909
+ var TrainingRefusalReasonSchema = _enum([
43910
+ "unknown-dataset",
43911
+ "unknown-provider",
43912
+ "provider-not-configured",
43913
+ "unknown-base-model",
43914
+ "unknown-gpu",
43915
+ "dataset-too-large",
43916
+ "no-training-subjects",
43917
+ "job-already-running"
43918
+ ]);
43919
+ var TrainingJobPlanSchema = object({
43920
+ refusal: object({
43921
+ reason: TrainingRefusalReasonSchema,
43922
+ detail: string()
43923
+ }).nullable(),
43924
+ warnings: array(string()).readonly(),
43925
+ split: TrainingSplitPlanSchema.nullable(),
43926
+ estimate: object({
43927
+ datasetBytes: number().int(),
43928
+ uploadMinutesAt20Mbps: number(),
43929
+ gpuSecondsLow: number(),
43930
+ gpuSecondsHigh: number(),
43931
+ usdLow: number(),
43932
+ usdHigh: number(),
43933
+ notes: array(string()).readonly()
43934
+ }).nullable(),
43935
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
43936
+ defaults: object({
43937
+ maxCostUsd: number(),
43938
+ maxRuntimeSec: number().int()
43939
+ }).nullable(),
43940
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
43941
+ dataNotice: string()
43942
+ });
43943
+ /**
43944
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
43945
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
43946
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
43947
+ * result lives after the operator acted on it.
43948
+ */
43949
+ var TrainingJobStateSchema = _enum([
43950
+ "queued",
43951
+ "uploading",
43952
+ "submitted",
43953
+ "starting",
43954
+ "running",
43955
+ "collecting",
43956
+ "ready",
43957
+ "registered",
43958
+ "canary",
43959
+ "failed",
43960
+ "cancelling",
43961
+ "cancelled",
43962
+ "lost",
43963
+ "expired",
43964
+ "discarded"
43965
+ ]);
43966
+ var TrainingFailureReasonSchema = _enum([
43967
+ "cost-cap",
43968
+ "runtime-cap",
43969
+ "upload-failed",
43970
+ "submit-failed",
43971
+ "trainer-failed",
43972
+ "result-invalid",
43973
+ "checksum-mismatch",
43974
+ "fetch-failed",
43975
+ "provider-error",
43976
+ "hub-restart-during-upload"
43977
+ ]);
43978
+ var TrainingProgressPointSchema = object({
43979
+ epoch: number().int(),
43980
+ map50: number().nullable(),
43981
+ map50_95: number().nullable()
43982
+ });
43983
+ var TrainingCanarySchema = object({
43984
+ deviceIds: array(number().int()).readonly(),
43985
+ since: number(),
43986
+ /** Every override the canary replaced, exactly, so rollback restores it. */
43987
+ previous: array(object({
43988
+ deviceId: number().int(),
43989
+ nodeId: string(),
43990
+ deviceKey: string(),
43991
+ patch: object({
43992
+ modelId: string().optional(),
43993
+ settings: record(string(), unknown()).readonly().optional()
43994
+ }).nullable()
43995
+ })).readonly()
43996
+ });
43997
+ var TrainingJobSchema = object({
43998
+ id: string(),
43999
+ idempotencyKey: string(),
44000
+ name: string(),
44001
+ createdAt: number(),
44002
+ updatedAt: number(),
44003
+ state: TrainingJobStateSchema,
44004
+ /**
44005
+ * Shared by every job enqueued together via `startJobBatch`.
44006
+ * `null` for a lone `startJob`. The engine advances queued siblings by this id.
44007
+ */
44008
+ batchId: string().nullable().default(null),
44009
+ stage: TrainingStageSchema.nullable(),
44010
+ failure: object({
44011
+ reason: TrainingFailureReasonSchema,
44012
+ stage: string().nullable(),
44013
+ detail: string()
44014
+ }).nullable(),
44015
+ request: TrainingJobRequestSchema,
44016
+ maxCostUsd: number().nonnegative(),
44017
+ maxRuntimeSec: number().int().positive(),
44018
+ trainer: TrainerSourceRefSchema,
44019
+ datasetLayout: RetrainExportLayoutSchema,
44020
+ /** Frame count snapshotted when the job started (audit; equals `frameIds.length`). */
44021
+ frameCount: number().int().nonnegative(),
44022
+ /** Resolved frame ids at start — the archive ships exactly these. */
44023
+ frameIds: array(string()).max(2e4).readonly(),
44024
+ /** Hash of what those frames taught at start (trainer `dataset.annotationHash`). */
44025
+ annotationHash: string(),
44026
+ dataset: object({
44027
+ bytes: number().int(),
44028
+ sha256: string(),
44029
+ uploadedAt: number()
44030
+ }).nullable(),
44031
+ split: TrainingSplitPlanSchema,
44032
+ provider: object({
44033
+ state: ProviderJobStateSchema.nullable(),
44034
+ providerJobId: string().nullable(),
44035
+ startedAt: number().nullable(),
44036
+ endedAt: number().nullable(),
44037
+ billedSeconds: number(),
44038
+ costUsd: number(),
44039
+ costIsEstimate: boolean(),
44040
+ lastPolledAt: number().nullable()
44041
+ }),
44042
+ progress: object({
44043
+ epoch: number().int().nullable(),
44044
+ epochs: number().int().nullable(),
44045
+ etaSec: number().nullable(),
44046
+ series: array(TrainingProgressPointSchema).readonly()
44047
+ }),
44048
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
44049
+ logTail: array(string()).readonly(),
44050
+ logCursor: string().nullable(),
44051
+ artifacts: object({
44052
+ bundleBytes: number().int(),
44053
+ bundleSha256: string(),
44054
+ fetchedAt: number(),
44055
+ /** When the staged artefacts are deleted from the hub. */
44056
+ expiresAt: number()
44057
+ }).nullable(),
44058
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
44059
+ cloudDatasetDeletedAt: number().nullable(),
44060
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
44061
+ cloudCleanupDueAt: number().nullable(),
44062
+ /** Model ids registered from this job (base, and int8 when kept). */
44063
+ registeredModelIds: array(string()).readonly(),
44064
+ canary: TrainingCanarySchema.nullable()
44065
+ });
44066
+ var IdInput = object({ id: string().min(1) });
44067
+ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
44068
+ auth: "admin",
44069
+ timeoutMs: 6e4
44070
+ }), method(TrainingJobRequestSchema.extend({
44071
+ name: string().min(1).max(120),
44072
+ maxCostUsd: number().positive(),
44073
+ maxRuntimeSec: number().int().positive(),
44074
+ idempotencyKey: string().min(8).max(80)
44075
+ }), discriminatedUnion("kind", [object({
44076
+ kind: literal("started"),
44077
+ job: TrainingJobSchema
44078
+ }), object({
44079
+ kind: literal("refused"),
44080
+ reason: TrainingRefusalReasonSchema,
44081
+ detail: string()
44082
+ })]), {
44083
+ kind: "mutation",
44084
+ auth: "admin",
44085
+ timeoutMs: 12e4
44086
+ }), method(TrainingJobRequestSchema.omit({ baseModelId: true }).extend({
44087
+ baseModelIds: array(string().min(1)).min(1),
44088
+ name: string().min(1).max(120),
44089
+ maxCostUsd: number().positive(),
44090
+ maxRuntimeSec: number().int().positive(),
44091
+ idempotencyKey: string().min(8).max(80)
44092
+ }), discriminatedUnion("kind", [object({
44093
+ kind: literal("started"),
44094
+ batchId: string(),
44095
+ jobs: array(TrainingJobSchema).min(1).readonly()
44096
+ }), object({
44097
+ kind: literal("refused"),
44098
+ reason: TrainingRefusalReasonSchema,
44099
+ detail: string()
44100
+ })]), {
44101
+ kind: "mutation",
44102
+ auth: "admin",
44103
+ timeoutMs: 12e4
44104
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
44105
+ kind: "mutation",
44106
+ auth: "admin",
44107
+ timeoutMs: 12e4
44108
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
44109
+ kind: "mutation",
44110
+ auth: "admin",
44111
+ timeoutMs: 30 * 6e4
44112
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
44113
+ kind: "mutation",
44114
+ auth: "admin",
44115
+ timeoutMs: 12e4
44116
+ }), method(IdInput, TrainingJobSchema, {
44117
+ kind: "mutation",
44118
+ auth: "admin",
44119
+ timeoutMs: 12e4
44120
+ }), method(IdInput, TrainingJobSchema, {
44121
+ kind: "mutation",
44122
+ auth: "admin"
44123
+ });
42483
44124
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
42484
44125
  Object.freeze({
42485
44126
  person: .5,
@@ -44628,6 +46269,12 @@ Object.freeze({
44628
46269
  addonId: null,
44629
46270
  access: "create"
44630
46271
  },
46272
+ "backup.checkBackupKey": {
46273
+ capName: "backup",
46274
+ capScope: "system",
46275
+ addonId: null,
46276
+ access: "create"
46277
+ },
44631
46278
  "backup.delete": {
44632
46279
  capName: "backup",
44633
46280
  capScope: "system",
@@ -44640,6 +46287,18 @@ Object.freeze({
44640
46287
  addonId: null,
44641
46288
  access: "delete"
44642
46289
  },
46290
+ "backup.disableEncryption": {
46291
+ capName: "backup",
46292
+ capScope: "system",
46293
+ addonId: null,
46294
+ access: "create"
46295
+ },
46296
+ "backup.getEncryption": {
46297
+ capName: "backup",
46298
+ capScope: "system",
46299
+ addonId: null,
46300
+ access: "view"
46301
+ },
44643
46302
  "backup.getEntries": {
44644
46303
  capName: "backup",
44645
46304
  capScope: "system",
@@ -44694,6 +46353,12 @@ Object.freeze({
44694
46353
  addonId: null,
44695
46354
  access: "create"
44696
46355
  },
46356
+ "backup.setupEncryption": {
46357
+ capName: "backup",
46358
+ capScope: "system",
46359
+ addonId: null,
46360
+ access: "create"
46361
+ },
44697
46362
  "backup.trigger": {
44698
46363
  capName: "backup",
44699
46364
  capScope: "system",
@@ -45246,6 +46911,12 @@ Object.freeze({
45246
46911
  addonId: null,
45247
46912
  access: "create"
45248
46913
  },
46914
+ "customModelRegistry.importModelBundle": {
46915
+ capName: "custom-model-registry",
46916
+ capScope: "system",
46917
+ addonId: null,
46918
+ access: "create"
46919
+ },
45249
46920
  "customModelRegistry.listModels": {
45250
46921
  capName: "custom-model-registry",
45251
46922
  capScope: "system",
@@ -46686,6 +48357,12 @@ Object.freeze({
46686
48357
  addonId: null,
46687
48358
  access: "view"
46688
48359
  },
48360
+ "keychainAdmin.acknowledgeReset": {
48361
+ capName: "keychain-admin",
48362
+ capScope: "system",
48363
+ addonId: null,
48364
+ access: "create"
48365
+ },
46689
48366
  "keychainAdmin.deleteOrphans": {
46690
48367
  capName: "keychain-admin",
46691
48368
  capScope: "system",
@@ -46722,6 +48399,12 @@ Object.freeze({
46722
48399
  addonId: null,
46723
48400
  access: "delete"
46724
48401
  },
48402
+ "keychainAdmin.resetReport": {
48403
+ capName: "keychain-admin",
48404
+ capScope: "system",
48405
+ addonId: null,
48406
+ access: "delete"
48407
+ },
46725
48408
  "keychainAdmin.reveal": {
46726
48409
  capName: "keychain-admin",
46727
48410
  capScope: "system",
@@ -46734,6 +48417,12 @@ Object.freeze({
46734
48417
  addonId: null,
46735
48418
  access: "create"
46736
48419
  },
48420
+ "keychainAdmin.setSystemSecret": {
48421
+ capName: "keychain-admin",
48422
+ capScope: "system",
48423
+ addonId: null,
48424
+ access: "create"
48425
+ },
46737
48426
  "keychainAdmin.status": {
46738
48427
  capName: "keychain-admin",
46739
48428
  capScope: "system",
@@ -47970,6 +49659,36 @@ Object.freeze({
47970
49659
  addonId: null,
47971
49660
  access: "view"
47972
49661
  },
49662
+ "oidcConnections.connectionFormSchema": {
49663
+ capName: "oidc-connections",
49664
+ capScope: "system",
49665
+ addonId: null,
49666
+ access: "view"
49667
+ },
49668
+ "oidcConnections.createConnection": {
49669
+ capName: "oidc-connections",
49670
+ capScope: "system",
49671
+ addonId: null,
49672
+ access: "create"
49673
+ },
49674
+ "oidcConnections.deleteConnection": {
49675
+ capName: "oidc-connections",
49676
+ capScope: "system",
49677
+ addonId: null,
49678
+ access: "delete"
49679
+ },
49680
+ "oidcConnections.listConnections": {
49681
+ capName: "oidc-connections",
49682
+ capScope: "system",
49683
+ addonId: null,
49684
+ access: "view"
49685
+ },
49686
+ "oidcConnections.updateConnection": {
49687
+ capName: "oidc-connections",
49688
+ capScope: "system",
49689
+ addonId: null,
49690
+ access: "create"
49691
+ },
47973
49692
  "osd.getStatus": {
47974
49693
  capName: "osd",
47975
49694
  capScope: "device",
@@ -48042,6 +49761,12 @@ Object.freeze({
48042
49761
  addonId: null,
48043
49762
  access: "create"
48044
49763
  },
49764
+ "osdManager.setSlotCameraEnabled": {
49765
+ capName: "osd-manager",
49766
+ capScope: "system",
49767
+ addonId: null,
49768
+ access: "create"
49769
+ },
48045
49770
  "osdManager.upsertTemplate": {
48046
49771
  capName: "osd-manager",
48047
49772
  capScope: "system",
@@ -48294,6 +50019,12 @@ Object.freeze({
48294
50019
  addonId: null,
48295
50020
  access: "view"
48296
50021
  },
50022
+ "pipelineAnalytics.getRetrainCorpusKpi": {
50023
+ capName: "pipeline-analytics",
50024
+ capScope: "device",
50025
+ addonId: null,
50026
+ access: "view"
50027
+ },
48297
50028
  "pipelineAnalytics.getRetrainExportUrl": {
48298
50029
  capName: "pipeline-analytics",
48299
50030
  capScope: "device",
@@ -48414,6 +50145,12 @@ Object.freeze({
48414
50145
  addonId: null,
48415
50146
  access: "view"
48416
50147
  },
50148
+ "pipelineAnalytics.listRetrainCorpusPage": {
50149
+ capName: "pipeline-analytics",
50150
+ capScope: "device",
50151
+ addonId: null,
50152
+ access: "view"
50153
+ },
48417
50154
  "pipelineAnalytics.listRetrainFrames": {
48418
50155
  capName: "pipeline-analytics",
48419
50156
  capScope: "device",
@@ -48444,6 +50181,12 @@ Object.freeze({
48444
50181
  addonId: null,
48445
50182
  access: "view"
48446
50183
  },
50184
+ "pipelineAnalytics.offerRetrainArchive": {
50185
+ capName: "pipeline-analytics",
50186
+ capScope: "device",
50187
+ addonId: null,
50188
+ access: "create"
50189
+ },
48447
50190
  "pipelineAnalytics.ownersWithMedia": {
48448
50191
  capName: "pipeline-analytics",
48449
50192
  capScope: "device",
@@ -48534,6 +50277,12 @@ Object.freeze({
48534
50277
  addonId: null,
48535
50278
  access: "create"
48536
50279
  },
50280
+ "pipelineAnalytics.resolveRetrainTrainingCorpus": {
50281
+ capName: "pipeline-analytics",
50282
+ capScope: "device",
50283
+ addonId: null,
50284
+ access: "view"
50285
+ },
48537
50286
  "pipelineAnalytics.restageRetrainTrack": {
48538
50287
  capName: "pipeline-analytics",
48539
50288
  capScope: "device",
@@ -50970,6 +52719,180 @@ Object.freeze({
50970
52719
  addonId: null,
50971
52720
  access: "view"
50972
52721
  },
52722
+ "training.canaryResult": {
52723
+ capName: "training",
52724
+ capScope: "system",
52725
+ addonId: null,
52726
+ access: "create"
52727
+ },
52728
+ "training.cancelJob": {
52729
+ capName: "training",
52730
+ capScope: "system",
52731
+ addonId: null,
52732
+ access: "create"
52733
+ },
52734
+ "training.discardResult": {
52735
+ capName: "training",
52736
+ capScope: "system",
52737
+ addonId: null,
52738
+ access: "create"
52739
+ },
52740
+ "training.getJob": {
52741
+ capName: "training",
52742
+ capScope: "system",
52743
+ addonId: null,
52744
+ access: "view"
52745
+ },
52746
+ "training.getJobResult": {
52747
+ capName: "training",
52748
+ capScope: "system",
52749
+ addonId: null,
52750
+ access: "view"
52751
+ },
52752
+ "training.listBaseModels": {
52753
+ capName: "training",
52754
+ capScope: "system",
52755
+ addonId: null,
52756
+ access: "view"
52757
+ },
52758
+ "training.listJobs": {
52759
+ capName: "training",
52760
+ capScope: "system",
52761
+ addonId: null,
52762
+ access: "view"
52763
+ },
52764
+ "training.planJob": {
52765
+ capName: "training",
52766
+ capScope: "system",
52767
+ addonId: null,
52768
+ access: "view"
52769
+ },
52770
+ "training.registerResult": {
52771
+ capName: "training",
52772
+ capScope: "system",
52773
+ addonId: null,
52774
+ access: "create"
52775
+ },
52776
+ "training.rollbackCanary": {
52777
+ capName: "training",
52778
+ capScope: "system",
52779
+ addonId: null,
52780
+ access: "create"
52781
+ },
52782
+ "training.startJob": {
52783
+ capName: "training",
52784
+ capScope: "system",
52785
+ addonId: null,
52786
+ access: "create"
52787
+ },
52788
+ "training.startJobBatch": {
52789
+ capName: "training",
52790
+ capScope: "system",
52791
+ addonId: null,
52792
+ access: "create"
52793
+ },
52794
+ "trainingProvider.cancelJob": {
52795
+ capName: "training-provider",
52796
+ capScope: "system",
52797
+ addonId: null,
52798
+ access: "create"
52799
+ },
52800
+ "trainingProvider.cleanupJob": {
52801
+ capName: "training-provider",
52802
+ capScope: "system",
52803
+ addonId: null,
52804
+ access: "create"
52805
+ },
52806
+ "trainingProvider.createEntry": {
52807
+ capName: "training-provider",
52808
+ capScope: "system",
52809
+ addonId: null,
52810
+ access: "create"
52811
+ },
52812
+ "trainingProvider.deleteEntry": {
52813
+ capName: "training-provider",
52814
+ capScope: "system",
52815
+ addonId: null,
52816
+ access: "delete"
52817
+ },
52818
+ "trainingProvider.describe": {
52819
+ capName: "training-provider",
52820
+ capScope: "system",
52821
+ addonId: null,
52822
+ access: "view"
52823
+ },
52824
+ "trainingProvider.describeTypes": {
52825
+ capName: "training-provider",
52826
+ capScope: "system",
52827
+ addonId: null,
52828
+ access: "view"
52829
+ },
52830
+ "trainingProvider.estimateJob": {
52831
+ capName: "training-provider",
52832
+ capScope: "system",
52833
+ addonId: null,
52834
+ access: "view"
52835
+ },
52836
+ "trainingProvider.getJob": {
52837
+ capName: "training-provider",
52838
+ capScope: "system",
52839
+ addonId: null,
52840
+ access: "view"
52841
+ },
52842
+ "trainingProvider.listEntries": {
52843
+ capName: "training-provider",
52844
+ capScope: "system",
52845
+ addonId: null,
52846
+ access: "view"
52847
+ },
52848
+ "trainingProvider.listJobEvents": {
52849
+ capName: "training-provider",
52850
+ capScope: "system",
52851
+ addonId: null,
52852
+ access: "view"
52853
+ },
52854
+ "trainingProvider.listJobs": {
52855
+ capName: "training-provider",
52856
+ capScope: "system",
52857
+ addonId: null,
52858
+ access: "view"
52859
+ },
52860
+ "trainingProvider.offerArtifact": {
52861
+ capName: "training-provider",
52862
+ capScope: "system",
52863
+ addonId: null,
52864
+ access: "create"
52865
+ },
52866
+ "trainingProvider.readResult": {
52867
+ capName: "training-provider",
52868
+ capScope: "system",
52869
+ addonId: null,
52870
+ access: "create"
52871
+ },
52872
+ "trainingProvider.submitJob": {
52873
+ capName: "training-provider",
52874
+ capScope: "system",
52875
+ addonId: null,
52876
+ access: "create"
52877
+ },
52878
+ "trainingProvider.updateEntry": {
52879
+ capName: "training-provider",
52880
+ capScope: "system",
52881
+ addonId: null,
52882
+ access: "create"
52883
+ },
52884
+ "trainingProvider.uploadDataset": {
52885
+ capName: "training-provider",
52886
+ capScope: "system",
52887
+ addonId: null,
52888
+ access: "create"
52889
+ },
52890
+ "trainingProvider.validateCredentials": {
52891
+ capName: "training-provider",
52892
+ capScope: "system",
52893
+ addonId: null,
52894
+ access: "create"
52895
+ },
50973
52896
  "turnProvider.getTurnServers": {
50974
52897
  capName: "turn-provider",
50975
52898
  capScope: "system",
@@ -50994,12 +52917,6 @@ Object.freeze({
50994
52917
  addonId: null,
50995
52918
  access: "create"
50996
52919
  },
50997
- "userManagement.createApiKey": {
50998
- capName: "user-management",
50999
- capScope: "system",
51000
- addonId: null,
51001
- access: "create"
51002
- },
51003
52920
  "userManagement.createScopedToken": {
51004
52921
  capName: "user-management",
51005
52922
  capScope: "system",
@@ -51036,12 +52953,6 @@ Object.freeze({
51036
52953
  addonId: null,
51037
52954
  access: "view"
51038
52955
  },
51039
- "userManagement.linkExternalIdentity": {
51040
- capName: "user-management",
51041
- capScope: "system",
51042
- addonId: null,
51043
- access: "create"
51044
- },
51045
52956
  "userManagement.listApiKeys": {
51046
52957
  capName: "user-management",
51047
52958
  capScope: "system",
@@ -51144,12 +53055,6 @@ Object.freeze({
51144
53055
  addonId: null,
51145
53056
  access: "create"
51146
53057
  },
51147
- "userManagement.validateApiKey": {
51148
- capName: "user-management",
51149
- capScope: "system",
51150
- addonId: null,
51151
- access: "view"
51152
- },
51153
53058
  "userManagement.validateCredentials": {
51154
53059
  capName: "user-management",
51155
53060
  capScope: "system",
@@ -54182,6 +56087,11 @@ Object.freeze({
54182
56087
  form: "single",
54183
56088
  optional: false
54184
56089
  }],
56090
+ "osdManager.setSlotCameraEnabled": [{
56091
+ name: "deviceId",
56092
+ form: "single",
56093
+ optional: false
56094
+ }],
54185
56095
  "petFeeder.callPet": [{
54186
56096
  name: "deviceId",
54187
56097
  form: "single",
@@ -54402,6 +56312,11 @@ Object.freeze({
54402
56312
  form: "array",
54403
56313
  optional: false
54404
56314
  }],
56315
+ "pipelineAnalytics.listRetrainCorpusPage": [{
56316
+ name: "deviceIds",
56317
+ form: "array",
56318
+ optional: true
56319
+ }],
54405
56320
  "pipelineAnalytics.listRetrainStaging": [{
54406
56321
  name: "deviceIds",
54407
56322
  form: "array",
@@ -55263,6 +57178,11 @@ Object.freeze({
55263
57178
  form: "single",
55264
57179
  optional: false
55265
57180
  }],
57181
+ "training.canaryResult": [{
57182
+ name: "deviceIds",
57183
+ form: "array",
57184
+ optional: false
57185
+ }],
55266
57186
  "update.getStatus": [{
55267
57187
  name: "deviceId",
55268
57188
  form: "single",
@@ -55506,6 +57426,7 @@ Object.freeze({
55506
57426
  });
55507
57427
  Object.freeze({
55508
57428
  "broker": "broker",
57429
+ "calendar-source": "calendar",
55509
57430
  "device-export": "device-export",
55510
57431
  "llm": "ai",
55511
57432
  "mesh-network": "mesh",
@@ -55991,6 +57912,8 @@ var STATE_SUMMARY_VARS = [
55991
57912
  [...RULE_TEXT],
55992
57913
  [...RULE_TEXT],
55993
57914
  [...RULE_TEXT],
57915
+ [...RULE_TEXT],
57916
+ [...RULE_TEXT],
55994
57917
  ([...RULE_TEXT], [...UPDATES]),
55995
57918
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
55996
57919
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),