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