@camstack/addon-provider-rtsp 1.2.123 → 1.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 +2078 -146
  2. package/dist/addon.mjs +2078 -146
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -5377,7 +5377,7 @@ var ZodIssueCode = {
5377
5377
  var ZodFirstPartyTypeKind;
5378
5378
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5379
5379
  //#endregion
5380
- //#region ../types/dist/sleep-Cr5YOk3m.mjs
5380
+ //#region ../types/dist/sleep-DwAQ9sqX.mjs
5381
5381
  /**
5382
5382
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5383
5383
  * window to float samples (D455).
@@ -5494,7 +5494,7 @@ function isKeychainStoredField(field) {
5494
5494
  var SECRET_CLEAR = { $secretClear: true };
5495
5495
  /** The `'***'` token D634 redaction writes for non-admins. */
5496
5496
  var LEGACY_DEVICE_REDACTION = "***";
5497
- function isRecord$1(value) {
5497
+ function isRecord$2(value) {
5498
5498
  return typeof value === "object" && value !== null && !Array.isArray(value);
5499
5499
  }
5500
5500
  function makeSecretMarker(ref) {
@@ -5505,12 +5505,12 @@ function makeSecretMarker(ref) {
5505
5505
  }
5506
5506
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5507
5507
  function isSecretMarker(value) {
5508
- if (!isRecord$1(value)) return false;
5508
+ if (!isRecord$2(value)) return false;
5509
5509
  const ref = value["$secret"];
5510
5510
  return typeof ref === "string" && ref.length > 0;
5511
5511
  }
5512
5512
  function isSecretClear(value) {
5513
- return isRecord$1(value) && value["$secretClear"] === true;
5513
+ return isRecord$2(value) && value["$secretClear"] === true;
5514
5514
  }
5515
5515
  /**
5516
5516
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6026,6 +6026,13 @@ function globalSecretScope() {
6026
6026
  function encodeSegment(value) {
6027
6027
  return encodeURIComponent(value);
6028
6028
  }
6029
+ function decodeSegment(value) {
6030
+ try {
6031
+ return decodeURIComponent(value);
6032
+ } catch {
6033
+ return null;
6034
+ }
6035
+ }
6029
6036
  /**
6030
6037
  * The field path of a value inside an array item, addressed by the item's id:
6031
6038
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6034,6 +6041,75 @@ function encodeSegment(value) {
6034
6041
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6035
6042
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6036
6043
  }
6044
+ function parseScope(segments) {
6045
+ switch (segments[0]) {
6046
+ case "global": return {
6047
+ scope: GLOBAL_SCOPE,
6048
+ used: 1
6049
+ };
6050
+ case "node": {
6051
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6052
+ return nodeId === null || nodeId.length === 0 ? null : {
6053
+ scope: {
6054
+ kind: "node",
6055
+ nodeId
6056
+ },
6057
+ used: 2
6058
+ };
6059
+ }
6060
+ case "device": {
6061
+ const raw = segments[1];
6062
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6063
+ return {
6064
+ scope: {
6065
+ kind: "device",
6066
+ deviceId: Number(raw)
6067
+ },
6068
+ used: 2
6069
+ };
6070
+ }
6071
+ case "integration": {
6072
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6073
+ return id === null || id.length === 0 ? null : {
6074
+ scope: {
6075
+ kind: "integration",
6076
+ integrationId: id
6077
+ },
6078
+ used: 2
6079
+ };
6080
+ }
6081
+ case "row": {
6082
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6083
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6084
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6085
+ return {
6086
+ scope: {
6087
+ kind: "row",
6088
+ collection,
6089
+ rowId
6090
+ },
6091
+ used: 3
6092
+ };
6093
+ }
6094
+ default: return null;
6095
+ }
6096
+ }
6097
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6098
+ function parseSecretRef(ref) {
6099
+ if (!ref.startsWith("secret://")) return null;
6100
+ const segments = ref.slice(9).split("/");
6101
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6102
+ if (owner === null || owner.length === 0) return null;
6103
+ const parsed = parseScope(segments.slice(1));
6104
+ if (parsed === null) return null;
6105
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6106
+ if (fieldPath.length === 0) return null;
6107
+ return {
6108
+ owner,
6109
+ scope: parsed.scope,
6110
+ fieldPath
6111
+ };
6112
+ }
6037
6113
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6038
6114
  var KeychainWriteRefusedError = class extends Error {
6039
6115
  fieldPath;
@@ -6044,7 +6120,7 @@ var KeychainWriteRefusedError = class extends Error {
6044
6120
  }
6045
6121
  };
6046
6122
  var KEEP = { kind: "keep" };
6047
- function isRecord(value) {
6123
+ function isRecord$1(value) {
6048
6124
  return typeof value === "object" && value !== null && !Array.isArray(value);
6049
6125
  }
6050
6126
  function defaultMintId() {
@@ -6057,7 +6133,7 @@ function collectSecretMarkerRefs(value, out = []) {
6057
6133
  return out;
6058
6134
  }
6059
6135
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6060
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6136
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6061
6137
  return out;
6062
6138
  }
6063
6139
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6112,7 +6188,7 @@ function rowId(row, idKey) {
6112
6188
  return null;
6113
6189
  }
6114
6190
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6115
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6191
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6116
6192
  if (!Array.isArray(incoming)) {
6117
6193
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6118
6194
  return {
@@ -6128,7 +6204,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6128
6204
  const kept = /* @__PURE__ */ new Set();
6129
6205
  const rows = [];
6130
6206
  for (const row of incoming) {
6131
- if (!isRecord(row)) {
6207
+ if (!isRecord$1(row)) {
6132
6208
  rows.push(row);
6133
6209
  continue;
6134
6210
  }
@@ -6153,7 +6229,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6153
6229
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6154
6230
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6155
6231
  case "object": {
6156
- if (!isRecord(incoming)) {
6232
+ if (!isRecord$1(incoming)) {
6157
6233
  if (incoming === void 0) return KEEP;
6158
6234
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6159
6235
  return {
@@ -6161,7 +6237,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6161
6237
  value: incoming
6162
6238
  };
6163
6239
  }
6164
- const storedObj = isRecord(stored) ? stored : {};
6240
+ const storedObj = isRecord$1(stored) ? stored : {};
6165
6241
  return {
6166
6242
  kind: "value",
6167
6243
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6220,12 +6296,19 @@ async function transformSecretWrite(input) {
6220
6296
  }
6221
6297
  };
6222
6298
  }
6299
+ /** Is `ref` one of `owner`'s refs? */
6300
+ function isSecretRefOwnedBy(ref, owner) {
6301
+ return parseSecretRef(ref)?.owner === owner;
6302
+ }
6223
6303
  /**
6224
6304
  * Replace every marker in `value` with its keychain value. Returns the SAME
6225
6305
  * reference when there is no marker (no allocation, no keychain call).
6226
6306
  */
6227
- async function resolveSecretMarkers(value, secrets) {
6228
- const refs = collectSecretMarkerRefs(value);
6307
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6308
+ const keepMarker = options.unresolved === "keep-marker";
6309
+ const owner = options.ownedBy;
6310
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6311
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6229
6312
  if (refs.length === 0) return {
6230
6313
  value,
6231
6314
  unresolved: []
@@ -6249,10 +6332,18 @@ async function resolveSecretMarkers(value, secrets) {
6249
6332
  }
6250
6333
  const substitute = (v) => {
6251
6334
  if (isSecretMarker(v)) {
6335
+ if (!inScope(v.$secret)) return {
6336
+ keep: true,
6337
+ value: v
6338
+ };
6252
6339
  const answer = answers[v.$secret];
6253
- return answer?.kind === "value" ? {
6340
+ if (answer?.kind === "value") return {
6254
6341
  keep: true,
6255
6342
  value: answer.value
6343
+ };
6344
+ return keepMarker ? {
6345
+ keep: true,
6346
+ value: v
6256
6347
  } : {
6257
6348
  keep: false,
6258
6349
  value: void 0
@@ -6269,7 +6360,7 @@ async function resolveSecretMarkers(value, secrets) {
6269
6360
  value: items
6270
6361
  };
6271
6362
  }
6272
- if (isRecord(v)) {
6363
+ if (isRecord$1(v)) {
6273
6364
  const out = {};
6274
6365
  for (const [k, child] of Object.entries(v)) {
6275
6366
  const s = substitute(child);
@@ -6290,14 +6381,152 @@ async function resolveSecretMarkers(value, secrets) {
6290
6381
  unresolved
6291
6382
  };
6292
6383
  }
6293
- function touchesTree(tree, patch) {
6294
- if (tree.size === 0) return false;
6295
- for (const key of Object.keys(patch)) {
6296
- const at = key.indexOf("@");
6297
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6384
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6385
+ var SecretOverwriteRefusedError = class extends Error {
6386
+ ref;
6387
+ reason;
6388
+ constructor(ref, reason) {
6389
+ 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.`);
6390
+ this.ref = ref;
6391
+ this.reason = reason;
6392
+ this.name = "SecretOverwriteRefusedError";
6393
+ }
6394
+ };
6395
+ function isRecord(value) {
6396
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6397
+ }
6398
+ function resolvedValue(pass, marker) {
6399
+ const answer = pass.answers[marker.$secret];
6400
+ return answer?.kind === "value" ? answer.value : null;
6401
+ }
6402
+ async function atMarker(pass, incoming, stored) {
6403
+ if (incoming === null) return stored;
6404
+ if (typeof incoming !== "string") return incoming;
6405
+ if (incoming === resolvedValue(pass, stored)) return stored;
6406
+ const intent = classifySecretWrite(incoming);
6407
+ if (intent.kind !== "set") return stored;
6408
+ const ref = stored.$secret;
6409
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6410
+ const answer = pass.answers[ref];
6411
+ 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);
6412
+ try {
6413
+ await pass.secrets.put(ref, intent.value);
6414
+ } catch (err) {
6415
+ throw new KeychainWriteRefusedError(ref, err);
6416
+ }
6417
+ pass.changedRefs.push(ref);
6418
+ return stored;
6419
+ }
6420
+ function inArray(pass, incoming, stored) {
6421
+ return incoming.map((item, index) => {
6422
+ const twin = stored[index];
6423
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6424
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6425
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6426
+ return item;
6427
+ });
6428
+ }
6429
+ function inArrayRow(pass, incoming, stored) {
6430
+ const out = { ...incoming };
6431
+ for (const [key, value] of Object.entries(incoming)) {
6432
+ const twin = stored[key];
6433
+ if (isSecretMarker(twin)) {
6434
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6435
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6436
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6437
+ }
6438
+ return out;
6439
+ }
6440
+ async function walk(pass, incoming, stored) {
6441
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6442
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6443
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6444
+ const out = { ...incoming };
6445
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6446
+ return out;
6447
+ }
6448
+ /** Restore markers a write-back carries as values. See the file doc. */
6449
+ async function restoreUnchangedSecrets(input) {
6450
+ const refs = [];
6451
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6452
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6453
+ if (owned.length === 0) return {
6454
+ patch: input.patch,
6455
+ changedRefs: []
6456
+ };
6457
+ const pass = {
6458
+ secrets: input.secrets,
6459
+ answers: await input.secrets.resolve([...new Set(owned)]),
6460
+ operatorWrite: input.operatorWrite,
6461
+ changedRefs: []
6462
+ };
6463
+ const out = {};
6464
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6465
+ return {
6466
+ patch: out,
6467
+ changedRefs: pass.changedRefs
6468
+ };
6469
+ }
6470
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6471
+ function isJsonEqual(a, b) {
6472
+ if (Object.is(a, b)) return true;
6473
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6474
+ if (isRecord(a) && isRecord(b)) {
6475
+ const keys = Object.keys(a);
6476
+ if (keys.length !== Object.keys(b).length) return false;
6477
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6298
6478
  }
6299
6479
  return false;
6300
6480
  }
6481
+ /** The patch without the keys whose value already equals the stored one. */
6482
+ function dropUnchangedKeys(patch, stored) {
6483
+ const out = {};
6484
+ for (const [key, value] of Object.entries(patch)) {
6485
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6486
+ out[key] = value;
6487
+ }
6488
+ return out;
6489
+ }
6490
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6491
+ function markerKeysOf(blob, owner) {
6492
+ const keys = /* @__PURE__ */ new Set();
6493
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6494
+ return keys;
6495
+ }
6496
+ function nodeFromStored(value, owner) {
6497
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6498
+ if (!isRecord(value)) return null;
6499
+ const children = /* @__PURE__ */ new Map();
6500
+ for (const [key, child] of Object.entries(value)) {
6501
+ const node = nodeFromStored(child, owner);
6502
+ if (node !== null) children.set(key, node);
6503
+ }
6504
+ return children.size > 0 ? {
6505
+ kind: "object",
6506
+ children
6507
+ } : null;
6508
+ }
6509
+ /**
6510
+ * The declared secret tree, widened by every place the STORED blob holds a
6511
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6512
+ * never declared: Wyze before b4906cec6) still gets the save path's
6513
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6514
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6515
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6516
+ * builtin that keeps another addon's marker (device-manager) never takes it
6517
+ * over.
6518
+ */
6519
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6520
+ const added = /* @__PURE__ */ new Map();
6521
+ for (const key of keys) {
6522
+ const at = key.indexOf("@");
6523
+ const base = at > 0 ? key.slice(0, at) : key;
6524
+ if (declared.has(base) || added.has(base)) continue;
6525
+ const node = nodeFromStored(stored[key], owner);
6526
+ if (node !== null) added.set(base, node);
6527
+ }
6528
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6529
+ }
6301
6530
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6302
6531
  async function readStoredAddonBlob(raw) {
6303
6532
  const threeWay = raw.readAddonStoreResult;
@@ -6306,7 +6535,41 @@ async function readStoredAddonBlob(raw) {
6306
6535
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6307
6536
  return result.kind === "missing" ? {} : result.value;
6308
6537
  }
6309
- function createSecretAwareSettings(raw, opts) {
6538
+ function touchesTree(tree, patch) {
6539
+ if (tree.size === 0) return false;
6540
+ for (const key of Object.keys(patch)) {
6541
+ const at = key.indexOf("@");
6542
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6543
+ }
6544
+ return false;
6545
+ }
6546
+ /**
6547
+ * Which top-level keys of each store held markers when last seen. `undefined`
6548
+ * for a store not seen yet: its first write reads it, to be safe.
6549
+ */
6550
+ var MarkerKeyIndex = class {
6551
+ owner;
6552
+ byStore = /* @__PURE__ */ new Map();
6553
+ constructor(owner) {
6554
+ this.owner = owner;
6555
+ }
6556
+ seen(store, blob) {
6557
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6558
+ }
6559
+ wrote(store, patch) {
6560
+ const keys = this.byStore.get(store);
6561
+ if (keys === void 0) return;
6562
+ const now = markerKeysOf(patch, this.owner);
6563
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6564
+ else keys.delete(key);
6565
+ }
6566
+ mayHoldMarkers(store, patch) {
6567
+ const keys = this.byStore.get(store);
6568
+ if (keys === void 0) return true;
6569
+ return Object.keys(patch).some((key) => keys.has(key));
6570
+ }
6571
+ };
6572
+ function createHandle(raw, opts) {
6310
6573
  const chains = /* @__PURE__ */ new Map();
6311
6574
  const serialize = (key, fn) => {
6312
6575
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6317,46 +6580,130 @@ function createSecretAwareSettings(raw, opts) {
6317
6580
  });
6318
6581
  return next;
6319
6582
  };
6320
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6321
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6322
- return serialize(chainKey, async () => {
6583
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6584
+ const resolveRead = async (store, blob) => {
6585
+ index.seen(store, blob);
6586
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6587
+ unresolved: "keep-marker",
6588
+ ownedBy: opts.secrets.owner
6589
+ });
6590
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6591
+ return value;
6592
+ };
6593
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6594
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6595
+ await rawWrite(patch);
6596
+ index.wrote(store, patch);
6597
+ return { changed: true };
6598
+ }
6599
+ return serialize(store, async () => {
6323
6600
  const stored = await readStored();
6601
+ index.seen(store, stored);
6602
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6603
+ const restored = await restoreUnchangedSecrets({
6604
+ patch,
6605
+ stored,
6606
+ secrets: opts.secrets,
6607
+ operatorWrite
6608
+ });
6324
6609
  const result = await transformSecretWrite({
6325
- tree,
6610
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6326
6611
  secrets: opts.secrets,
6327
- patch,
6612
+ patch: restored.patch,
6328
6613
  stored,
6329
6614
  ...scope !== void 0 ? { scope } : {},
6330
- operatorWrite: opts.isOperatorWrite?.() === true
6615
+ operatorWrite
6331
6616
  });
6332
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6617
+ const effective = dropUnchangedKeys(result.patch, stored);
6618
+ const wroteBlob = Object.keys(effective).length > 0;
6619
+ if (wroteBlob) {
6620
+ await rawWrite(effective);
6621
+ index.wrote(store, effective);
6622
+ }
6333
6623
  const { orphaned } = await result.afterWrite();
6334
6624
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6625
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6335
6626
  });
6336
6627
  };
6337
- const wrapped = {
6338
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6339
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6340
- kind: "device",
6341
- deviceId
6342
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6628
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6629
+ const readAddonStoreResult = raw.readAddonStoreResult;
6630
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6631
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6632
+ const overrides = {
6633
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6634
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6635
+ const result = await readAddonStoreResult.call(raw);
6636
+ return result.kind === "value" ? {
6637
+ kind: "value",
6638
+ value: await resolveRead("addon", result.value)
6639
+ } : result;
6640
+ } } : {},
6641
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6642
+ const result = await readAddonStoreKeyResult.call(raw, key);
6643
+ if (result.kind !== "present") return result;
6644
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6645
+ unresolved: "keep-marker",
6646
+ ownedBy: opts.secrets.owner
6647
+ });
6648
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6649
+ return {
6650
+ kind: "present",
6651
+ value: value[key]
6652
+ };
6653
+ } } : {},
6654
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6655
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6656
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6657
+ const out = /* @__PURE__ */ new Map();
6658
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6659
+ return out;
6660
+ } } : {},
6661
+ writeAddonStore: async (patch) => {
6662
+ await writeAddon(patch);
6663
+ },
6664
+ writeDeviceStore: async (deviceId, patch) => {
6665
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6666
+ kind: "device",
6667
+ deviceId
6668
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6669
+ }
6670
+ };
6671
+ return {
6672
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6673
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6674
+ const value = Reflect.get(target, prop, receiver);
6675
+ return typeof value === "function" ? value.bind(target) : value;
6676
+ } }),
6677
+ raw: {
6678
+ readAddonStore: async () => {
6679
+ const blob = await raw.readAddonStore();
6680
+ index.seen("addon", blob);
6681
+ return blob;
6682
+ },
6683
+ readDeviceStore: async (deviceId) => {
6684
+ const blob = await raw.readDeviceStore(deviceId);
6685
+ index.seen(`device:${deviceId}`, blob);
6686
+ return blob;
6687
+ }
6688
+ },
6689
+ writeAddonStore: writeAddon
6343
6690
  };
6344
- return new Proxy(raw, { get(target, prop, receiver) {
6345
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6346
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6347
- const value = Reflect.get(target, prop, receiver);
6348
- return typeof value === "function" ? value.bind(target) : value;
6349
- } });
6350
6691
  }
6351
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6352
- function withSecretAwareSettings(context, opts) {
6692
+ /** The context the addon sees, plus the private raw view and write outcome. */
6693
+ function createSecretAwareContext(context, opts) {
6353
6694
  const raw = context.settings;
6354
- if (raw === void 0) return context;
6355
- const settings = createSecretAwareSettings(raw, opts);
6356
- return new Proxy(context, { get(target, prop, receiver) {
6357
- if (prop === "settings") return settings;
6358
- return Reflect.get(target, prop, receiver);
6359
- } });
6695
+ if (raw === void 0) return {
6696
+ context,
6697
+ handle: null
6698
+ };
6699
+ const handle = createHandle(raw, opts);
6700
+ return {
6701
+ context: new Proxy(context, { get(target, prop, receiver) {
6702
+ if (prop === "settings") return handle.settings;
6703
+ return Reflect.get(target, prop, receiver);
6704
+ } }),
6705
+ handle
6706
+ };
6360
6707
  }
6361
6708
  var LEAF = { kind: "leaf" };
6362
6709
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6531,6 +6878,14 @@ var BaseAddon = class {
6531
6878
  _secretChangeUnsub = null;
6532
6879
  /** >0 while an OPERATOR's settings write is being applied. */
6533
6880
  _operatorWriteDepth = 0;
6881
+ /**
6882
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6883
+ * to the marker-bearing blobs and stays private to this class: the form
6884
+ * hydrate and config resolution need markers, addon code never does.
6885
+ */
6886
+ _secretSettings = null;
6887
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6888
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6534
6889
  constructor(defaults) {
6535
6890
  this.defaults = defaults;
6536
6891
  this._config = { ...defaults };
@@ -6567,13 +6922,21 @@ var BaseAddon = class {
6567
6922
  }
6568
6923
  async initialize(context) {
6569
6924
  const secrets = context.secrets;
6570
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6571
- secrets,
6572
- addonTree: () => this.addonSecretTree(),
6573
- deviceTree: () => this.deviceSecretTree(),
6574
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6575
- isOperatorWrite: () => this._operatorWriteDepth > 0
6576
- }) : context;
6925
+ if (secrets !== void 0) {
6926
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6927
+ secrets,
6928
+ addonTree: () => this.addonSecretTree(),
6929
+ deviceTree: () => this.deviceSecretTree(),
6930
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6931
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6932
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6933
+ });
6934
+ this._ctx = wrapped;
6935
+ this._secretSettings = handle;
6936
+ } else {
6937
+ this._ctx = context;
6938
+ this._secretSettings = null;
6939
+ }
6577
6940
  await this.resolveConfig();
6578
6941
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6579
6942
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6690,11 +7053,8 @@ var BaseAddon = class {
6690
7053
  async getGlobalSettings(overlay, cap, nodeId) {
6691
7054
  const schema = this.globalSettingsSchema(cap);
6692
7055
  if (!schema) return { sections: [] };
6693
- const projected = await this.resolveGlobalStore(nodeId, cap);
6694
- return hydrateSchema(schema, overlay ? {
6695
- ...projected,
6696
- ...overlay
6697
- } : projected, { inlineSecretsAsViews: true });
7056
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7057
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6698
7058
  }
6699
7059
  /**
6700
7060
  * The integration-level view of this addon's settings: exactly the sections
@@ -6739,7 +7099,7 @@ var BaseAddon = class {
6739
7099
  });
6740
7100
  }
6741
7101
  if (sections.length === 0) return null;
6742
- const projected = await this.resolveGlobalStore(nodeId);
7102
+ const projected = await this.readRawProjectedStore(nodeId);
6743
7103
  return hydrateSchema({
6744
7104
  ...schema,
6745
7105
  sections
@@ -6756,12 +7116,50 @@ var BaseAddon = class {
6756
7116
  * the store for custom option logic (option narrowing, value snapping) to
6757
7117
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6758
7118
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7119
+ *
7120
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7121
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7122
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7123
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7124
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7125
+ * resolved blob back is a no-op for every unchanged secret.
6759
7126
  */
6760
7127
  async resolveGlobalStore(nodeId, cap) {
6761
7128
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7129
+ return this.projectForNode(raw, nodeId, cap);
7130
+ }
7131
+ projectForNode(store, nodeId, cap) {
6762
7132
  const keys = this.perNodeKeys(cap);
6763
7133
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6764
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7134
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7135
+ }
7136
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7137
+ async readRawProjectedStore(nodeId, cap) {
7138
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7139
+ return this.projectForNode(raw, nodeId, cap);
7140
+ }
7141
+ /**
7142
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7143
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7144
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7145
+ * its value.
7146
+ */
7147
+ async overlayKeepingMarkers(stored, overlay) {
7148
+ const secrets = this._ctx?.secrets;
7149
+ const merged = {
7150
+ ...stored,
7151
+ ...overlay
7152
+ };
7153
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7154
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7155
+ unresolved: "keep-marker",
7156
+ ownedBy: secrets.owner
7157
+ });
7158
+ for (const key of Object.keys(overlay)) {
7159
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7160
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7161
+ }
7162
+ return merged;
6765
7163
  }
6766
7164
  /**
6767
7165
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6826,8 +7224,12 @@ var BaseAddon = class {
6826
7224
  async clearSecrets(keys, nodeId) {
6827
7225
  const tree = this.addonSecretTree();
6828
7226
  const keychain = this._ctx?.secrets !== void 0;
7227
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6829
7228
  const patch = {};
6830
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7229
+ for (const key of keys) {
7230
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7231
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7232
+ }
6831
7233
  await this.applyGlobalPatch(patch, nodeId);
6832
7234
  }
6833
7235
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6835,7 +7237,11 @@ var BaseAddon = class {
6835
7237
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6836
7238
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6837
7239
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6838
- await this._ctx?.settings?.writeAddonStore(scoped);
7240
+ const handle = this._secretSettings;
7241
+ if (handle !== null) {
7242
+ const { changed } = await handle.writeAddonStore(scoped);
7243
+ if (!changed) return;
7244
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6839
7245
  if (target !== localNode) return;
6840
7246
  await this.resolveConfig();
6841
7247
  await this.onConfigChanged();
@@ -6888,7 +7294,7 @@ var BaseAddon = class {
6888
7294
  async getDeviceSettings(deviceId) {
6889
7295
  const schema = this.deviceSettingsSchema();
6890
7296
  if (!schema) return { sections: [] };
6891
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7297
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6892
7298
  }
6893
7299
  async updateDeviceSettings(deviceId, patch) {
6894
7300
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7060,7 +7466,7 @@ var BaseAddon = class {
7060
7466
  key,
7061
7467
  schema,
7062
7468
  fallback,
7063
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7469
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7064
7470
  write: async (patch) => {
7065
7471
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7066
7472
  },
@@ -7122,6 +7528,23 @@ var BaseAddon = class {
7122
7528
  }
7123
7529
  return value;
7124
7530
  }
7531
+ /**
7532
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7533
+ * keychain the context's own view is already raw.
7534
+ */
7535
+ rawSettings() {
7536
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7537
+ }
7538
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7539
+ logUnresolvedRead(unresolved) {
7540
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7541
+ if (fresh.length === 0) return;
7542
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7543
+ 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) => ({
7544
+ ref: u.ref,
7545
+ reason: u.reason
7546
+ })) } });
7547
+ }
7125
7548
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7126
7549
  scheduleSecretReresolve(delayMs) {
7127
7550
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7148,7 +7571,7 @@ var BaseAddon = class {
7148
7571
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7149
7572
  */
7150
7573
  async readAddonStoreWithRetry() {
7151
- const settings = this._ctx?.settings;
7574
+ const settings = this.rawSettings();
7152
7575
  if (!settings) return {};
7153
7576
  const delaysMs = [
7154
7577
  150,
@@ -8960,6 +9383,16 @@ var CompositionSchema = object({
8960
9383
  seen.add(feature.cap);
8961
9384
  });
8962
9385
  });
9386
+ var NodeColorIdSchema = _enum([
9387
+ "node-a",
9388
+ "node-b",
9389
+ "node-c",
9390
+ "node-d",
9391
+ "node-e",
9392
+ "node-f",
9393
+ "node-g",
9394
+ "node-h"
9395
+ ]);
8963
9396
  new Set([
8964
9397
  "track",
8965
9398
  "face",
@@ -9451,6 +9884,278 @@ var CameraSwitchGroupSchema = object({
9451
9884
  fetchedAt: number()
9452
9885
  });
9453
9886
  /**
9887
+ * The trainer contract — what the hub hands the cloud trainer and what it
9888
+ * gets back (cloud training, D805+).
9889
+ *
9890
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
9891
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
9892
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
9893
+ * lines on stdout. These schemas are the hub's half of that boundary; the
9894
+ * trainer's pydantic models (and the JSON Schemas generated from them under
9895
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
9896
+ * change there, in the same piece of work.
9897
+ *
9898
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
9899
+ * orchestrator fills every field of a job spec explicitly.
9900
+ */
9901
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
9902
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
9903
+ /** What the trainer can export. Edge TPU is a later, separate image. */
9904
+ var TrainingExportSchema = _enum([
9905
+ "onnx",
9906
+ "openvino-fp16",
9907
+ "openvino-int8",
9908
+ "coreml-fp16"
9909
+ ]);
9910
+ var FloorsSchema = record(string(), number().min(0).max(1));
9911
+ object({
9912
+ schema: literal(TRAINING_JOB_SCHEMA),
9913
+ jobKey: string().uuid(),
9914
+ target: object({
9915
+ kind: literal("detector"),
9916
+ step: literal("object-detection")
9917
+ }),
9918
+ base: object({
9919
+ modelId: string().min(1),
9920
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
9921
+ weights: string().min(1),
9922
+ imgsz: number().int().positive()
9923
+ }),
9924
+ baseline: object({
9925
+ modelId: string().min(1),
9926
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
9927
+ onnxUrl: string().url(),
9928
+ imgsz: number().int().positive(),
9929
+ floors: FloorsSchema
9930
+ }),
9931
+ dataset: object({
9932
+ versionId: string().min(1),
9933
+ annotationHash: string(),
9934
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
9935
+ sha256: string().regex(/^[0-9a-f]{64}$/)
9936
+ }),
9937
+ split: object({
9938
+ holdoutCameras: array(number().int()),
9939
+ /** When no camera is held out: the last N days of every camera. */
9940
+ holdoutLastDays: number().int().nonnegative(),
9941
+ valFraction: number().min(0).max(.5),
9942
+ seed: number().int()
9943
+ }),
9944
+ hyper: object({
9945
+ epochs: number().int().positive(),
9946
+ batch: number().int().positive(),
9947
+ lr0: number().positive(),
9948
+ /** Layers frozen from the start of the backbone; 0 = none. */
9949
+ freeze: number().int().nonnegative(),
9950
+ patience: number().int().nonnegative(),
9951
+ seed: number().int()
9952
+ }),
9953
+ replay: object({
9954
+ source: literal("coco2017"),
9955
+ count: number().int().nonnegative()
9956
+ }),
9957
+ exports: array(TrainingExportSchema).min(1),
9958
+ calibration: object({ maxFrames: number().int().positive() }),
9959
+ floors: object({
9960
+ minSupport: number().int().positive(),
9961
+ clamp: number().min(0).max(1)
9962
+ }),
9963
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
9964
+ catalog: object({
9965
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
9966
+ name: string().min(1).max(160)
9967
+ })
9968
+ });
9969
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
9970
+ var TrainingResultFileSchema = object({
9971
+ path: string().min(1),
9972
+ bytes: number().int().nonnegative(),
9973
+ sha256: string().regex(/^[0-9a-f]{64}$/),
9974
+ format: _enum([
9975
+ "onnx",
9976
+ "openvino",
9977
+ "coreml",
9978
+ "pt"
9979
+ ]),
9980
+ variant: _enum(["base", "int8"])
9981
+ });
9982
+ var DraftFormatSchema = object({
9983
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
9984
+ url: string().min(1),
9985
+ sizeMB: number().nonnegative(),
9986
+ isDirectory: boolean().optional(),
9987
+ files: array(string()).optional(),
9988
+ runtimes: array(literal("python")).optional(),
9989
+ revision: string().min(1)
9990
+ });
9991
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
9992
+ var TrainingCatalogDraftSchema = object({
9993
+ id: string().min(1),
9994
+ name: string().min(1),
9995
+ description: string(),
9996
+ labels: array(unknown()),
9997
+ inputSize: object({
9998
+ width: number().int().positive(),
9999
+ height: number().int().positive()
10000
+ }),
10001
+ preprocessMode: literal("letterbox"),
10002
+ defaultClassFloors: FloorsSchema,
10003
+ formats: object({
10004
+ onnx: DraftFormatSchema.optional(),
10005
+ openvino: DraftFormatSchema.optional(),
10006
+ coreml: DraftFormatSchema.optional()
10007
+ })
10008
+ });
10009
+ /** One class of one model's holdout report (the eval harness's summary). */
10010
+ var TrainingEvalClassSchema = object({
10011
+ positives: number().int(),
10012
+ floor: number().nullable(),
10013
+ tp: number().int(),
10014
+ fp: number().int(),
10015
+ fn: number().int(),
10016
+ precision: number().nullable(),
10017
+ recall: number().nullable(),
10018
+ ap50: number().nullable(),
10019
+ recallByCamera: record(string(), number().nullable()).optional(),
10020
+ recallByLight: record(string(), number().nullable()).optional(),
10021
+ fpByCamera: record(string(), number()).optional(),
10022
+ smallFound: number().int().optional(),
10023
+ smallTotal: number().int().optional()
10024
+ }).passthrough();
10025
+ var TrainingEvalReportSchema = object({
10026
+ frames: number().int(),
10027
+ classes: record(string(), TrainingEvalClassSchema)
10028
+ }).passthrough();
10029
+ /**
10030
+ * A succeeded result carries every block; a failed one carries the error and
10031
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10032
+ * orchestrator checks the blocks it needs before it trusts a success.
10033
+ */
10034
+ var TrainingResultSchema = object({
10035
+ schema: literal(TRAINING_RESULT_SCHEMA),
10036
+ jobKey: string(),
10037
+ status: _enum(["succeeded", "failed"]),
10038
+ error: object({
10039
+ stage: string(),
10040
+ code: string(),
10041
+ message: string()
10042
+ }).nullable(),
10043
+ trainer: object({
10044
+ version: string(),
10045
+ revision: string()
10046
+ }),
10047
+ toolchain: record(string(), string().nullable()),
10048
+ dataset: object({
10049
+ versionId: string(),
10050
+ annotationHash: string(),
10051
+ sha256: string(),
10052
+ frames: object({
10053
+ train: number().int(),
10054
+ val: number().int(),
10055
+ holdout: number().int()
10056
+ }),
10057
+ holdoutCameras: array(number().int()),
10058
+ replayImages: number().int()
10059
+ }).optional(),
10060
+ training: object({
10061
+ epochsRun: number().int(),
10062
+ bestEpoch: number().int(),
10063
+ bestMap50: number(),
10064
+ bestMap50_95: number(),
10065
+ seconds: number()
10066
+ }).optional(),
10067
+ evaluation: object({
10068
+ holdoutFrames: number().int(),
10069
+ baseline: TrainingEvalReportSchema.nullable(),
10070
+ candidate: TrainingEvalReportSchema.nullable(),
10071
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10072
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10073
+ map50: record(string(), number().nullable())
10074
+ }).optional(),
10075
+ floors: object({
10076
+ baseline: FloorsSchema,
10077
+ candidate: FloorsSchema,
10078
+ candidateInt8: FloorsSchema.nullable(),
10079
+ notes: array(string())
10080
+ }).optional(),
10081
+ int8: object({
10082
+ kept: boolean(),
10083
+ map50Fp16: number().nullable(),
10084
+ map50Int8: number().nullable(),
10085
+ reason: string().nullable()
10086
+ }).optional(),
10087
+ exportsDropped: array(object({
10088
+ export: string(),
10089
+ reason: string()
10090
+ })).optional(),
10091
+ files: array(TrainingResultFileSchema).optional(),
10092
+ bundle: object({
10093
+ path: literal("bundle.tar"),
10094
+ bytes: number().int().nonnegative(),
10095
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10096
+ }).nullable().optional(),
10097
+ catalogDraft: object({
10098
+ base: TrainingCatalogDraftSchema,
10099
+ int8: TrainingCatalogDraftSchema.nullable()
10100
+ }).nullable().optional(),
10101
+ licence: string()
10102
+ });
10103
+ var TrainingStageSchema = _enum([
10104
+ "prepare",
10105
+ "replay",
10106
+ "train",
10107
+ "eval",
10108
+ "export",
10109
+ "package"
10110
+ ]);
10111
+ var EventBase = {
10112
+ v: literal(1),
10113
+ ts: number()
10114
+ };
10115
+ discriminatedUnion("type", [
10116
+ object({
10117
+ ...EventBase,
10118
+ type: literal("stage"),
10119
+ stage: TrainingStageSchema
10120
+ }),
10121
+ object({
10122
+ ...EventBase,
10123
+ type: literal("epoch"),
10124
+ epoch: number().int(),
10125
+ epochs: number().int(),
10126
+ boxLoss: number().nullable().optional(),
10127
+ map50: number().nullable().optional(),
10128
+ map50_95: number().nullable().optional(),
10129
+ etaSec: number().nullable().optional()
10130
+ }),
10131
+ object({
10132
+ ...EventBase,
10133
+ type: literal("metric"),
10134
+ name: string(),
10135
+ value: number()
10136
+ }),
10137
+ object({
10138
+ ...EventBase,
10139
+ type: literal("artifact"),
10140
+ path: string(),
10141
+ bytes: number(),
10142
+ sha256: string()
10143
+ }),
10144
+ object({
10145
+ ...EventBase,
10146
+ type: literal("done"),
10147
+ status: _enum(["succeeded", "failed"]),
10148
+ resultSha256: string().nullable().optional()
10149
+ }),
10150
+ object({
10151
+ ...EventBase,
10152
+ type: literal("error"),
10153
+ stage: string(),
10154
+ code: string(),
10155
+ message: string()
10156
+ })
10157
+ ]);
10158
+ /**
9454
10159
  * What the gate decided about a birth, from the CALLER's point of view.
9455
10160
  *
9456
10161
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11810,7 +12515,9 @@ var AddonHttpRouteSchema = object({
11810
12515
  "authenticated",
11811
12516
  "admin"
11812
12517
  ]).optional(),
11813
- description: string().optional()
12518
+ description: string().optional(),
12519
+ /** The hub limits this route per client address before the handler runs. */
12520
+ rateLimit: _enum(["auth"]).optional()
11814
12521
  });
11815
12522
  /**
11816
12523
  * Cross-process route invocation envelope. The hub captures the
@@ -12515,6 +13222,37 @@ var BackupDestinationInfoSchema = object({
12515
13222
  lastError: string().optional()
12516
13223
  });
12517
13224
  /**
13225
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13226
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13227
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13228
+ * with it off — which restores without a key.
13229
+ */
13230
+ var BackupArchiveEncryptionSchema = object({
13231
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13232
+ scheme: string(),
13233
+ /** 16 hex — the backup key whose secret restores this archive. */
13234
+ keyId: string()
13235
+ });
13236
+ /**
13237
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13238
+ * one new archives are encrypted to, and the retired ones older archives
13239
+ * still need. The secret key is shown once, at `setupEncryption`.
13240
+ */
13241
+ var BackupEncryptionStatusSchema = object({
13242
+ enabled: boolean(),
13243
+ active: object({
13244
+ keyId: string(),
13245
+ publicKey: string(),
13246
+ createdAt: number()
13247
+ }).nullable(),
13248
+ /** Every key ever set up, newest first. */
13249
+ keys: array(object({
13250
+ keyId: string(),
13251
+ createdAt: number(),
13252
+ retiredAt: number().nullable()
13253
+ })).readonly()
13254
+ });
13255
+ /**
12518
13256
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12519
13257
  * Same shape the destination drill-in renders. Sourced from the per-
12520
13258
  * location `manifests.json` (no per-archive tarball read required).
@@ -12526,7 +13264,9 @@ var BackupArchiveEntrySchema = object({
12526
13264
  sizeBytes: number(),
12527
13265
  label: string().optional(),
12528
13266
  /** Top-level locations included in the archive (db, addons, tls, …). */
12529
- locations: array(string()).readonly()
13267
+ locations: array(string()).readonly(),
13268
+ /** Present when the archive is encrypted; restore then needs that key. */
13269
+ encryption: BackupArchiveEncryptionSchema.optional()
12530
13270
  });
12531
13271
  var BackupEntrySchema = object({
12532
13272
  id: string(),
@@ -12535,7 +13275,8 @@ var BackupEntrySchema = object({
12535
13275
  label: string().optional(),
12536
13276
  createdAt: number(),
12537
13277
  sizeBytes: number(),
12538
- locations: array(string()).optional()
13278
+ locations: array(string()).optional(),
13279
+ encryption: BackupArchiveEncryptionSchema.optional()
12539
13280
  });
12540
13281
  var ArchiveEntrySchema = object({
12541
13282
  path: string(),
@@ -12724,10 +13465,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12724
13465
  * this list and skips entries whose path doesn't start with
12725
13466
  * any of them.
12726
13467
  */
12727
- locations: array(string()).optional()
13468
+ locations: array(string()).optional(),
13469
+ /**
13470
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13471
+ * one). The archive is decrypted into the hub's private staging
13472
+ * before the restart; the key is not stored. A wrong or missing key
13473
+ * is refused before the archive is downloaded.
13474
+ */
13475
+ backupSecretKey: string().optional()
12728
13476
  }), _void(), {
12729
13477
  kind: "mutation",
12730
13478
  auth: "admin"
13479
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13480
+ keyId: string(),
13481
+ secretKey: string(),
13482
+ publicKey: string(),
13483
+ createdAt: number(),
13484
+ replacedKeyId: string().nullable()
13485
+ }), {
13486
+ kind: "mutation",
13487
+ auth: "admin"
13488
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13489
+ kind: "mutation",
13490
+ auth: "admin"
13491
+ }), method(object({ backupSecretKey: string() }), object({
13492
+ valid: boolean(),
13493
+ keyId: string().nullable(),
13494
+ /** The hub knows this key (active or retired). */
13495
+ known: boolean(),
13496
+ /** It is the key new archives are encrypted to. */
13497
+ active: boolean(),
13498
+ error: string().optional()
13499
+ }), {
13500
+ kind: "mutation",
13501
+ auth: "admin"
12731
13502
  }), method(object({
12732
13503
  destinationId: string(),
12733
13504
  backupId: string()
@@ -14453,7 +15224,60 @@ var CustomModelDescriptorSchema = object({
14453
15224
  stepId: string(),
14454
15225
  entry: ModelCatalogEntrySchema
14455
15226
  });
14456
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15227
+ /** One regular file of an imported bundle, as the producer measured it. */
15228
+ var ModelBundleFileSchema = object({
15229
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15230
+ path: string().min(1),
15231
+ bytes: number().int().nonnegative(),
15232
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15233
+ });
15234
+ var ImportModelBundleInputSchema = object({
15235
+ /** The registry provider that keeps the model (Model Studio). */
15236
+ addonId: string(),
15237
+ stepId: string().min(1),
15238
+ /**
15239
+ * The catalog rows to register, complete, every format URL already
15240
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15241
+ * bundle may carry several rows (a base and its INT8 variant).
15242
+ */
15243
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15244
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15245
+ bundle: object({
15246
+ ticket: PeerBytesTicketSchema,
15247
+ bytes: number().int().positive(),
15248
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15249
+ }),
15250
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15251
+ files: array(ModelBundleFileSchema).min(1).max(64),
15252
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15253
+ distribute: boolean()
15254
+ });
15255
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15256
+ kind: literal("imported"),
15257
+ modelIds: array(string()).readonly(),
15258
+ distributed: array(object({
15259
+ modelId: string(),
15260
+ nodeId: string(),
15261
+ format: _enum(MODEL_FORMATS),
15262
+ ok: boolean(),
15263
+ error: string().optional()
15264
+ })).readonly()
15265
+ }), object({
15266
+ kind: literal("refused"),
15267
+ reason: _enum([
15268
+ "transfer-failed",
15269
+ "checksum-mismatch",
15270
+ "bundle-mismatch",
15271
+ "invalid-entry",
15272
+ "id-taken"
15273
+ ]),
15274
+ detail: string()
15275
+ })]);
15276
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15277
+ kind: "mutation",
15278
+ auth: "admin",
15279
+ timeoutMs: 30 * 6e4
15280
+ });
14457
15281
  /**
14458
15282
  * Query filter for settings-store collections.
14459
15283
  */
@@ -14932,6 +15756,35 @@ var KeychainKeySourceSchema = object({
14932
15756
  */
14933
15757
  sharesBackupWithDatabase: boolean()
14934
15758
  });
15759
+ /**
15760
+ * One keychain reset, as the Secrets page reports it until the operator
15761
+ * acknowledges it. Never a value: refs, counts and table names only.
15762
+ */
15763
+ var KeychainResetRecordSchema = object({
15764
+ id: string(),
15765
+ at: number(),
15766
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15767
+ actor: string(),
15768
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15769
+ lockedReason: string().nullable(),
15770
+ /** Values moved into the archive table (ciphertext under the lost key). */
15771
+ archived: number().int(),
15772
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15773
+ archivedCollection: string().nullable(),
15774
+ /**
15775
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15776
+ * so the archive can still be opened if the lost master key turns up.
15777
+ */
15778
+ archivedKeysCollection: string().nullable(),
15779
+ /**
15780
+ * `system-settings` keys whose marker the reset cleared — the cluster
15781
+ * secret's: a marker left pointing at an archived value would refuse every
15782
+ * agent forever (D797).
15783
+ */
15784
+ clearedSettingsKeys: array(string()).readonly(),
15785
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15786
+ acknowledgedAt: number().nullable()
15787
+ });
14935
15788
  var KeychainStatusSchema = object({
14936
15789
  keychain: KeychainStateSchema,
14937
15790
  /** The source of the master key in use; `null` while locked. */
@@ -14949,7 +15802,9 @@ var KeychainStatusSchema = object({
14949
15802
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
14950
15803
  retiredWraps: number().int(),
14951
15804
  recoveryKeyDownloadedAt: number().nullable(),
14952
- secretCount: number().int()
15805
+ secretCount: number().int(),
15806
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15807
+ lastReset: KeychainResetRecordSchema.nullable()
14953
15808
  });
14954
15809
  /**
14955
15810
  * Whether a stored value is still pointed at by its owner's settings.
@@ -14971,17 +15826,26 @@ var KeychainAuditActionSchema = _enum([
14971
15826
  "download-recovery-key",
14972
15827
  "delete-orphans",
14973
15828
  "reset",
15829
+ "acknowledge-reset",
14974
15830
  "initialize"
14975
15831
  ]);
14976
15832
  var KeychainAuditEntrySchema = object({
14977
15833
  id: string(),
14978
15834
  at: number(),
14979
15835
  action: KeychainAuditActionSchema,
14980
- /** `addon:<id>` | `user:<id>` | `system`. */
15836
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
14981
15837
  actor: string(),
14982
15838
  ref: string().nullable(),
14983
15839
  detail: string().nullable()
14984
15840
  });
15841
+ var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
15842
+ /**
15843
+ * Secrets the HUB itself holds (owner `system`) that no settings form shows:
15844
+ * `jwt-signing-key` — the session signing key (D797). It is always "in use",
15845
+ * never an orphan; it is generated on a fresh hub and replaced only through
15846
+ * {@link keychainAdminCapability.methods.setSystemSecret}.
15847
+ */
15848
+ var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
14985
15849
  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({
14986
15850
  value: string(),
14987
15851
  version: number().int()
@@ -14989,6 +15853,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
14989
15853
  kind: "mutation",
14990
15854
  auth: "admin",
14991
15855
  caller: "required"
15856
+ }), method(object({
15857
+ name: SystemHeldSecretNameSchema,
15858
+ value: string().min(16)
15859
+ }), object({
15860
+ ref: string(),
15861
+ version: number().int()
15862
+ }), {
15863
+ kind: "mutation",
15864
+ auth: "admin",
15865
+ caller: "required"
14992
15866
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
14993
15867
  deleted: array(string()).readonly(),
14994
15868
  kept: array(object({
@@ -15018,13 +15892,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15018
15892
  kind: "mutation",
15019
15893
  auth: "admin",
15020
15894
  caller: "required"
15021
- }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15895
+ }), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
15022
15896
  archivedCollection: string().nullable(),
15023
15897
  archived: number().int()
15024
15898
  }), {
15025
15899
  kind: "mutation",
15026
15900
  auth: "admin",
15027
15901
  caller: "required"
15902
+ }), method(object({}), object({
15903
+ reset: KeychainResetRecordSchema.nullable(),
15904
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15905
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15906
+ kind: "mutation",
15907
+ auth: "admin",
15908
+ caller: "required"
15028
15909
  });
15029
15910
  method(_void(), object({
15030
15911
  id: string(),
@@ -17573,14 +18454,14 @@ var LlmProfileSchema = object({
17573
18454
  /** ConfigUISchema tree passed through untyped on the wire (the
17574
18455
  * notification-output `ConfigSchemaPassthrough` precedent at
17575
18456
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
17576
- var ConfigSchemaPassthrough$1 = unknown();
18457
+ var ConfigSchemaPassthrough$3 = unknown();
17577
18458
  var LlmProfileKindDescriptorSchema = object({
17578
18459
  kind: LlmProfileKindSchema,
17579
18460
  label: string(),
17580
18461
  icon: string(),
17581
18462
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
17582
18463
  addonId: string(),
17583
- configSchema: ConfigSchemaPassthrough$1
18464
+ configSchema: ConfigSchemaPassthrough$3
17584
18465
  });
17585
18466
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
17586
18467
  var LlmDefaultSchema = object({
@@ -17858,7 +18739,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17858
18739
  * `login-method` — collection cap through which auth addons contribute
17859
18740
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17860
18741
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17861
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18742
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17862
18743
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17863
18744
  * procedure aggregates them for the unauthenticated login page.
17864
18745
  *
@@ -17866,8 +18747,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17866
18747
  *
17867
18748
  * - `redirect` — a declarative button. The login page renders a generic
17868
18749
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17869
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17870
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18750
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17871
18751
  * login page needs NO change.
17872
18752
  *
17873
18753
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -17886,8 +18766,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17886
18766
  * decision.
17887
18767
  *
17888
18768
  * Every contribution carries a `stage`:
17889
- * - `primary` — shown on the first credentials screen (OIDC /
17890
- * magic-link buttons; a future usernameless passkey).
18769
+ * - `primary` — shown on the first credentials screen (OIDC
18770
+ * buttons; a usernameless passkey).
17891
18771
  * - `second-factor` — shown AFTER the password leg, gated on the
17892
18772
  * returned `factors` (passkey-as-2FA today).
17893
18773
  *
@@ -17914,7 +18794,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17914
18794
  * The provider names an external identity a signed-in user can link to
17915
18795
  * their own account (D782): `auth.listLinkableProviders` /
17916
18796
  * `beginExternalLink` offer exactly the redirect methods that set this,
17917
- * whatever their id. Absent / false — a login button only (magic-link).
18797
+ * whatever their id. Absent / false — a login button only.
17918
18798
  */
17919
18799
  linkable: boolean().optional()
17920
18800
  }),
@@ -18702,7 +19582,7 @@ var TargetKindCapsSchema = object({
18702
19582
  * the union is large and not meant for runtime validation here; the exported
18703
19583
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
18704
19584
  */
18705
- var ConfigSchemaPassthrough = unknown();
19585
+ var ConfigSchemaPassthrough$2 = unknown();
18706
19586
  var TargetKindSchema = object({
18707
19587
  kind: string(),
18708
19588
  label: string(),
@@ -18739,7 +19619,7 @@ var TargetKindSchema = object({
18739
19619
  * its raster path, which is the safe default for an unknown image.
18740
19620
  */
18741
19621
  iconMediaType: string().optional(),
18742
- configSchema: ConfigSchemaPassthrough,
19622
+ configSchema: ConfigSchemaPassthrough$2,
18743
19623
  /**
18744
19624
  * The config keys that decide WHERE this kind's secrets are sent (server,
18745
19625
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -21769,8 +22649,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21769
22649
  * `super_admin` — collapsed onto the single boolean because every
21770
22650
  * non-admin caller is governed by the same scope-check rules; the
21771
22651
  * distinction was only ever used to route role-specific procedures
21772
- * which we no longer have. Agents are admin sessions issued via
21773
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22652
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21774
22653
  * with `isAdmin: false` + an explicit scope list.
21775
22654
  */
21776
22655
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -22077,6 +22956,61 @@ var OauthIntegrationDescriptorSchema = object({
22077
22956
  });
22078
22957
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
22079
22958
  /**
22959
+ * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
22960
+ *
22961
+ * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
22962
+ * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
22963
+ * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
22964
+ * immutable after create.
22965
+ */
22966
+ var ConfigSchemaPassthrough$1 = unknown();
22967
+ var OidcConnectionSchema = object({
22968
+ id: string().min(1),
22969
+ displayName: string(),
22970
+ icon: string(),
22971
+ issuerUrl: string(),
22972
+ clientId: string(),
22973
+ /** Client id + secret present — never the secret value. */
22974
+ configured: boolean(),
22975
+ /**
22976
+ * Values for the connection form schema. `clientSecret` is a keychain
22977
+ * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
22978
+ */
22979
+ formValues: record(string(), unknown()).optional()
22980
+ });
22981
+ /**
22982
+ * Patch one connection. Omitted or empty `clientSecret` keeps the stored
22983
+ * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
22984
+ */
22985
+ var OidcConnectionUpdateInputSchema = object({
22986
+ id: string().min(1),
22987
+ displayName: string().min(1),
22988
+ icon: string().optional(),
22989
+ issuerUrl: string().optional(),
22990
+ clientId: string().optional(),
22991
+ clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
22992
+ redirectUri: string().optional(),
22993
+ scopes: string().optional(),
22994
+ usernameClaim: _enum([
22995
+ "preferred_username",
22996
+ "email",
22997
+ "sub"
22998
+ ]).optional()
22999
+ });
23000
+ method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
23001
+ id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
23002
+ displayName: string().min(1)
23003
+ }), object({ id: string() }), {
23004
+ kind: "mutation",
23005
+ auth: "admin"
23006
+ }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
23007
+ kind: "mutation",
23008
+ auth: "admin"
23009
+ }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
23010
+ kind: "mutation",
23011
+ auth: "admin"
23012
+ });
23013
+ /**
22080
23014
  * What started a camera's onboard motion (D672). `camera` is the camera's own
22081
23015
  * firmware; `sensor` is a device the operator ATTACHED to it. Absent on the
22082
23016
  * wire means the camera: only the camera-sensors bridge ever says `sensor`.
@@ -23433,21 +24367,69 @@ var RetrainFrameListSchema = object({
23433
24367
  /** What the page pre-selects — the native key frame when one survives. */
23434
24368
  autoPickMediaId: number().int().optional()
23435
24369
  });
24370
+ /** Exclusive partition of a corpus copy's annotation progress (design §4.2). */
24371
+ var RetrainFrameWorkStateSchema = _enum([
24372
+ "unannotated",
24373
+ "annotated",
24374
+ "complete"
24375
+ ]);
24376
+ /**
24377
+ * Filters for paginated corpus list, KPI, and matching export (design §4.4).
24378
+ * Every narrowing field is ANDed; omitted fields impose no constraint.
24379
+ */
24380
+ var RetrainCorpusFilterSchema = object({
24381
+ workState: RetrainFrameWorkStateSchema.optional(),
24382
+ deviceIds: array(number()).max(500).optional(),
24383
+ /** When set, only frames in this named collection. */
24384
+ collectionId: string().optional(),
24385
+ /** Frames that carry at least one saved annotation in one of these classes. */
24386
+ classes: array(RetrainMacroClassSchema).optional(),
24387
+ page: number().int().positive().default(1),
24388
+ pageSize: number().int().positive().max(100).default(50)
24389
+ });
24390
+ var RetrainCorpusPageSchema = object({
24391
+ frames: array(RetrainFrameSchema.extend({ workState: RetrainFrameWorkStateSchema })).readonly(),
24392
+ total: number().int().nonnegative(),
24393
+ page: number().int().positive(),
24394
+ pageSize: number().int().positive()
24395
+ });
24396
+ var RetrainCorpusKpiCameraRowSchema = object({
24397
+ deviceId: number(),
24398
+ unannotated: number().int().nonnegative(),
24399
+ annotated: number().int().nonnegative(),
24400
+ complete: number().int().nonnegative(),
24401
+ /** This camera's `complete` count divided by corpus `total`, in `[0,1]`.
24402
+ * `null` when the corpus is empty (no ratio). */
24403
+ pctOfCorpus: number().min(0).max(1).nullable()
24404
+ });
24405
+ var RetrainCorpusKpiSchema = object({
24406
+ total: number().int().nonnegative(),
24407
+ unannotated: number().int().nonnegative(),
24408
+ annotated: number().int().nonnegative(),
24409
+ complete: number().int().nonnegative(),
24410
+ cameras: array(RetrainCorpusKpiCameraRowSchema).readonly()
24411
+ });
23436
24412
  /**
23437
24413
  * Which frames an annotated export carries. Every field narrows; an empty
23438
- * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23439
- * list owned by whoever trains (the training orchestrator), so `frameIds` is
23440
- * the primitive a version export uses; `batchId` re-selects what an earlier
23441
- * export carried (`exportedInBatch`).
24414
+ * filter is every annotated copy. `frameIds` is the primitive a job or
24415
+ * download uses; `batchId` re-selects what an earlier export carried
24416
+ * (`exportedInBatch`). Frozen dataset versions were removed — live selection
24417
+ * resolves to `frameIds` at plan/start.
23442
24418
  */
23443
24419
  var RetrainExportFilterSchema = object({
23444
24420
  deviceIds: array(number()).optional(),
23445
24421
  frameIds: array(string()).max(2e4).optional(),
23446
24422
  /** Only frames in at least one of these named collections. */
23447
24423
  collectionIds: array(string()).max(200).optional(),
24424
+ /** Single collection (Frames filter bar). ANDed with `collectionIds` when both set. */
24425
+ collectionId: string().optional(),
23448
24426
  batchId: string().optional(),
23449
24427
  /** Only frames the operator marked complete (all subjects boxed). */
23450
- completeOnly: boolean().optional()
24428
+ completeOnly: boolean().optional(),
24429
+ /** Exclusive work-state partition (`workStateOf`); same as the corpus list. */
24430
+ workState: RetrainFrameWorkStateSchema.optional(),
24431
+ /** Frames with at least one saved annotation in one of these classes. */
24432
+ classes: array(RetrainMacroClassSchema).optional()
23451
24433
  });
23452
24434
  /**
23453
24435
  * `frames`: the full frame copies, boxes in `annotations.json`.
@@ -23612,6 +24594,77 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23612
24594
  ]),
23613
24595
  detail: string().optional()
23614
24596
  })]);
24597
+ /** What a dataset version is cut from. Every field narrows. */
24598
+ var RetrainDatasetSelectionSchema = object({
24599
+ deviceIds: array(number()).readonly().optional(),
24600
+ collectionIds: array(string()).max(200).readonly().optional(),
24601
+ frameIds: array(string()).max(2e4).readonly().optional()
24602
+ });
24603
+ /** The counts a dataset is judged by. */
24604
+ var RetrainDatasetStatsSchema = object({
24605
+ frames: number().int(),
24606
+ completeFrames: number().int(),
24607
+ /** `completeFrames / frames`, 0..1. */
24608
+ completeness: number(),
24609
+ /** Boxes to learn (model errors excluded). */
24610
+ subjects: number().int(),
24611
+ modelErrors: number().int(),
24612
+ /** Complete frames with no subject. */
24613
+ hardNegatives: number().int(),
24614
+ /** Subjects per class × camera × day/night. */
24615
+ cells: array(object({
24616
+ macroClass: string(),
24617
+ deviceId: number(),
24618
+ lighting: _enum([
24619
+ "day",
24620
+ "night",
24621
+ "unknown"
24622
+ ]),
24623
+ subjects: number().int(),
24624
+ frames: number().int()
24625
+ })).readonly(),
24626
+ cameras: array(object({
24627
+ deviceId: number(),
24628
+ frames: number().int(),
24629
+ completeFrames: number().int()
24630
+ })).readonly()
24631
+ });
24632
+ object({
24633
+ id: string(),
24634
+ name: string(),
24635
+ createdAt: number(),
24636
+ selection: RetrainDatasetSelectionSchema,
24637
+ layout: RetrainExportLayoutSchema,
24638
+ completeOnly: boolean(),
24639
+ frameCount: number().int(),
24640
+ annotationHash: string(),
24641
+ manifestSchema: string(),
24642
+ stats: RetrainDatasetStatsSchema
24643
+ });
24644
+ /**
24645
+ * Live training corpus criteria — same shape as `TrainingCorpusSelection` on
24646
+ * the training cap. Resolved here so plan/start and the annotated export share
24647
+ * one definition of "the frames" (`buildRetrainExportPlan`).
24648
+ */
24649
+ var RetrainTrainingCorpusSelectionSchema = object({
24650
+ collectionIds: array(string()).min(1),
24651
+ workState: _enum([
24652
+ "complete",
24653
+ "annotated_or_complete",
24654
+ "any_annotated"
24655
+ ]).default("complete")
24656
+ });
24657
+ var RetrainTrainingCorpusResolveResultSchema = discriminatedUnion("kind", [object({
24658
+ kind: literal("resolved"),
24659
+ frameIds: array(string()).max(2e4).readonly(),
24660
+ stats: RetrainDatasetStatsSchema,
24661
+ annotationHash: string(),
24662
+ layout: RetrainExportLayoutSchema
24663
+ }), object({
24664
+ kind: literal("refused"),
24665
+ reason: _enum(["unknown-collection", "no-frames"]),
24666
+ detail: string()
24667
+ })]);
23615
24668
  /** The outcome of a lifecycle move owned by the retrain page. */
23616
24669
  var RetrainTransitionResultSchema = object({
23617
24670
  trackId: string(),
@@ -24317,6 +25370,12 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24317
25370
  }), array(RetrainTrackSchema).readonly(), {
24318
25371
  kind: "query",
24319
25372
  auth: "admin"
25373
+ }), method(RetrainCorpusFilterSchema, RetrainCorpusPageSchema, {
25374
+ kind: "query",
25375
+ auth: "admin"
25376
+ }), method(object({}), RetrainCorpusKpiSchema, {
25377
+ kind: "query",
25378
+ auth: "admin"
24320
25379
  }), method(object({ trackId: string() }), RetrainFrameListSchema, {
24321
25380
  kind: "query",
24322
25381
  auth: "admin"
@@ -24401,6 +25460,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24401
25460
  kind: "mutation",
24402
25461
  auth: "admin",
24403
25462
  timeoutMs: 60 * 6e4
25463
+ }), method(object({
25464
+ filter: RetrainExportFilterSchema,
25465
+ layout: RetrainExportLayoutSchema
25466
+ }), object({
25467
+ ticket: PeerBytesTicketSchema,
25468
+ frames: number().int(),
25469
+ annotations: number().int()
25470
+ }), {
25471
+ kind: "mutation",
25472
+ auth: "admin",
25473
+ timeoutMs: 12e4
24404
25474
  }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24405
25475
  kind: "query",
24406
25476
  auth: "admin"
@@ -24427,6 +25497,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24427
25497
  }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24428
25498
  kind: "query",
24429
25499
  auth: "admin"
25500
+ }), method(RetrainTrainingCorpusSelectionSchema, RetrainTrainingCorpusResolveResultSchema, {
25501
+ kind: "query",
25502
+ auth: "admin",
25503
+ timeoutMs: 6e4
24430
25504
  }), method(object({
24431
25505
  id: string(),
24432
25506
  name: string().max(120)
@@ -25043,11 +26117,14 @@ var HardwareClassIdSchema = _enum([
25043
26117
  "intel-n-series",
25044
26118
  "apple-m-base",
25045
26119
  "apple-m-pro",
26120
+ "amd-phoenix",
25046
26121
  "unknown"
25047
26122
  ]);
25048
26123
  var AcceleratorKindSchema = _enum([
25049
26124
  "intel-npu",
25050
26125
  "intel-igpu",
26126
+ "amd-igpu",
26127
+ "amd-npu",
25051
26128
  "x86-cpu",
25052
26129
  "arm-cpu",
25053
26130
  "apple-ane",
@@ -26977,6 +28054,8 @@ var AgentPipelineSettingsSchema = object({
26977
28054
  * address is wrong (multi-homed host, NAT, custom interface).
26978
28055
  */
26979
28056
  reachableHost: string().optional(),
28057
+ /** Hub-persisted UI colour (`--color-node-*` theme tokens). */
28058
+ color: NodeColorIdSchema.optional(),
26980
28059
  /**
26981
28060
  * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
26982
28061
  * weight, steps}. Absent / all-disabled ⇒ the node's single default
@@ -27526,8 +28605,9 @@ method(object({
27526
28605
  auth: "admin"
27527
28606
  }), method(object({
27528
28607
  agentNodeId: string(),
27529
- reachableHost: string().nullable()
27530
- }), object({ success: literal(true) }), {
28608
+ reachableHost: string().nullable().optional(),
28609
+ color: NodeColorIdSchema.nullable().optional()
28610
+ }).refine((v) => v.reachableHost !== void 0 || v.color !== void 0, { message: "reachableHost or color required" }), object({ success: literal(true) }), {
27531
28611
  kind: "mutation",
27532
28612
  auth: "admin"
27533
28613
  }), method(object({
@@ -27979,8 +29059,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
27979
29059
  * `smtp-provider` — pluggable email delivery surface.
27980
29060
  *
27981
29061
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
27982
- * one for transactional / one for notifications). Consumers (magic-link,
27983
- * notifier addons, …) walk the collection and pick the first
29062
+ * one for transactional / one for notifications). Consumers (notifier
29063
+ * addons, …) walk the collection and pick the first
27984
29064
  * ready provider OR target a specific addonId.
27985
29065
  *
27986
29066
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -28263,7 +29343,7 @@ targets: array(object({
28263
29343
  };
28264
29344
  /**
28265
29345
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
28266
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
29346
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
28267
29347
  * carrying the post-callback claims before redirecting back to
28268
29348
  * `/api/auth/sso/finish`.
28269
29349
  *
@@ -28326,7 +29406,14 @@ var SsoBridgeClaimsSchema = object({
28326
29406
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28327
29407
  * subject is unique only per issuer, so a link is bound to it.
28328
29408
  */
28329
- issuer: string().optional()
29409
+ issuer: string().optional(),
29410
+ /**
29411
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
29412
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
29413
+ * request to present the matching cookie — a login bridge is useless in
29414
+ * any other browser.
29415
+ */
29416
+ browserBinding: string().optional()
28330
29417
  });
28331
29418
  method(object({
28332
29419
  claims: SsoBridgeClaimsSchema,
@@ -30700,7 +31787,7 @@ var CustomActionInputSchema = object({
30700
31787
  action: string().min(1),
30701
31788
  input: unknown()
30702
31789
  });
30703
- method(_void(), array(AddonListItemSchema).readonly()), method(object({
31790
+ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSchema).readonly()), method(object({
30704
31791
  addonId: string(),
30705
31792
  limit: number().min(1).max(500).default(100),
30706
31793
  level: LogLevelSchema$2.optional()
@@ -35770,7 +36857,13 @@ var TopologyNodeSchema = object({
35770
36857
  })).readonly(),
35771
36858
  processes: array(TopologyProcessSchema).readonly(),
35772
36859
  categories: array(TopologyCategorySchema).readonly(),
35773
- rootPackage: TopologyRootPackageSchema.nullable()
36860
+ rootPackage: TopologyRootPackageSchema.nullable(),
36861
+ /**
36862
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
36863
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
36864
+ * for offline rows and when the hub cannot tell.
36865
+ */
36866
+ meshTransport: _enum(["tls", "clear"]).optional()
35774
36867
  });
35775
36868
  var CapUsageEdgeSchema = object({
35776
36869
  callerAddonId: string(),
@@ -36183,6 +37276,7 @@ var OsdNamedTemplateSchema = object({
36183
37276
  });
36184
37277
  /** Where a slot's value comes from. */
36185
37278
  var OsdSourceSchema = discriminatedUnion("kind", [
37279
+ object({ kind: literal("none") }),
36186
37280
  object({
36187
37281
  kind: literal("static"),
36188
37282
  text: string().max(64)
@@ -36309,6 +37403,13 @@ method(object({ deviceId: number().int() }), object({
36309
37403
  }), object({ success: literal(true) }), {
36310
37404
  kind: "mutation",
36311
37405
  auth: "admin"
37406
+ }), method(object({
37407
+ deviceId: number().int(),
37408
+ slotId: string().min(1),
37409
+ enabled: boolean()
37410
+ }), object({ success: literal(true) }), {
37411
+ kind: "mutation",
37412
+ auth: "admin"
36312
37413
  }), method(object({
36313
37414
  sourceDeviceId: number().int(),
36314
37415
  targetDeviceId: number().int()
@@ -36740,7 +37841,15 @@ var GpuInfoSchema = object({
36740
37841
  name: string(),
36741
37842
  memoryMB: number().optional()
36742
37843
  });
36743
- var NpuInfoSchema = object({ type: _enum(["apple-ane", "intel-npu"]) });
37844
+ var NpuInfoSchema = object({
37845
+ type: _enum([
37846
+ "apple-ane",
37847
+ "intel-npu",
37848
+ "amd-xdna"
37849
+ ]),
37850
+ name: string().optional(),
37851
+ generation: _enum(["xdna1", "xdna2"]).optional()
37852
+ });
36744
37853
  var CoralInfoSchema = object({
36745
37854
  type: literal("coral-edgetpu"),
36746
37855
  bus: string().optional()
@@ -40593,16 +41702,6 @@ var ApiKeySummarySchema = object({
40593
41702
  createdAt: number(),
40594
41703
  lastUsedAt: number().optional()
40595
41704
  });
40596
- var CreateApiKeyInputSchema = object({
40597
- label: string(),
40598
- isAdmin: boolean().default(false),
40599
- allowedProviders: union([array(string()), literal("*")]).optional(),
40600
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
40601
- });
40602
- var CreateApiKeyResultSchema = object({
40603
- token: string(),
40604
- record: ApiKeySummarySchema
40605
- });
40606
41705
  var ScopedTokenSummarySchema = object({
40607
41706
  id: string(),
40608
41707
  userId: string(),
@@ -40701,17 +41800,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40701
41800
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
40702
41801
  kind: "mutation",
40703
41802
  access: "view"
40704
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
40705
- kind: "mutation",
40706
- auth: "admin",
40707
- access: "create"
40708
- }), method(object({ id: string() }), object({ success: literal(true) }), {
41803
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
40709
41804
  kind: "mutation",
40710
41805
  auth: "admin",
40711
41806
  access: "delete"
40712
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
40713
- kind: "mutation",
40714
- access: "view"
40715
41807
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
40716
41808
  kind: "mutation",
40717
41809
  auth: "admin",
@@ -40785,15 +41877,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40785
41877
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
40786
41878
  userId: string(),
40787
41879
  issuer: string()
40788
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
40789
- userId: string(),
40790
- issuer: string().min(1),
40791
- label: string().optional()
40792
- }), object({ success: literal(true) }), {
40793
- kind: "mutation",
40794
- auth: "admin",
40795
- access: "create"
40796
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41880
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
40797
41881
  kind: "mutation",
40798
41882
  auth: "admin",
40799
41883
  access: "delete"
@@ -41498,6 +42582,563 @@ var zoneRulesCapability = {
41498
42582
  */
41499
42583
  durability: "restored"
41500
42584
  };
42585
+ /**
42586
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
42587
+ *
42588
+ * A thin, mockable translation layer: it knows how to run a container with a
42589
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
42590
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
42591
+ * those are the `training` orchestrator's (D805). Every rule written there
42592
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
42593
+ * manifest entry and nothing else.
42594
+ *
42595
+ * Collection of provider **types** (addons). Each addon owns zero or more
42596
+ * **entries** (credentials + defaults). Concat-fans: `describe`,
42597
+ * `describeTypes`, `listEntries`, `listJobs`. Single-row work is keyed by
42598
+ * `entryId`; callers also pass the owning `addonId` as the collection
42599
+ * selector (broker posture). Every method is `admin`: these spend money.
42600
+ *
42601
+ * Every cloud object a provider creates is tagged with the orchestrator's
42602
+ * `jobKey`, so a retried submit finds the job it already started instead of
42603
+ * starting a second GPU, and `listJobs` can find orphans.
42604
+ *
42605
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
42606
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
42607
+ * ticket the provider mints (D613).
42608
+ */
42609
+ var TrainingGpuOptionSchema = object({
42610
+ id: string(),
42611
+ label: string(),
42612
+ /** List price, USD per GPU-hour, before any region multiplier. */
42613
+ usdPerHour: number().nonnegative(),
42614
+ vramGb: number().nonnegative()
42615
+ });
42616
+ var TrainingRegionOptionSchema = object({
42617
+ /** `''` = any region (the provider's choice). */
42618
+ id: string(),
42619
+ label: string(),
42620
+ priceMultiplier: number().positive()
42621
+ });
42622
+ /**
42623
+ * The provider's per-entry settings, as the orchestrator reads them. They
42624
+ * live on the PROVIDER addon's entry (operator decision 2026-10-08: they
42625
+ * depend on the user's account), never hard-coded in the orchestrator.
42626
+ */
42627
+ var TrainingProviderDefaultsSchema = object({
42628
+ gpuType: string(),
42629
+ region: string(),
42630
+ costCapUsd: number().nonnegative(),
42631
+ maxRuntimeSec: number().int().positive(),
42632
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
42633
+ failedDatasetGraceHours: number().nonnegative()
42634
+ });
42635
+ /**
42636
+ * Entry form schema for a provider type — same seam as notification
42637
+ * `TargetKind.configSchema` (`z.unknown()` at the wire; callers tighten to
42638
+ * {@link ConfigUISchema}). Drives `ConfigFormBuilder` on Training → Providers.
42639
+ */
42640
+ var ConfigSchemaPassthrough = unknown();
42641
+ /** One creatable provider type, for the Add-entry dialog. */
42642
+ var TrainingProviderTypeSchema = object({
42643
+ typeId: string(),
42644
+ label: string(),
42645
+ /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
42646
+ iconAsset: string(),
42647
+ /** Owning `training-provider` addon — collection selector for createEntry. */
42648
+ addonId: string(),
42649
+ /**
42650
+ * Fields for one entry of this type (credentials + defaults). Absent on a
42651
+ * type that only needs a name. Password fields are keychain-backed on the
42652
+ * provider addon (`secretStatePaths`), not D634 plaintext.
42653
+ */
42654
+ configSchema: ConfigSchemaPassthrough.optional()
42655
+ });
42656
+ /** One configured account / workspace under a provider type. */
42657
+ var TrainingProviderEntrySchema = object({
42658
+ entryId: string(),
42659
+ typeId: string(),
42660
+ name: string(),
42661
+ addonId: string(),
42662
+ /** Credentials are present — never the values. */
42663
+ configured: boolean()
42664
+ });
42665
+ var TrainingProviderDescriptorSchema = object({
42666
+ addonId: string(),
42667
+ entryId: string(),
42668
+ typeId: string(),
42669
+ /** Operator-chosen entry name. */
42670
+ name: string(),
42671
+ iconAsset: string(),
42672
+ /** `modal`, `runpod`, `fake`, … — same as typeId for current providers. */
42673
+ kind: string(),
42674
+ label: string(),
42675
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
42676
+ regions: array(TrainingRegionOptionSchema).readonly(),
42677
+ maxDatasetBytes: number().int().positive(),
42678
+ maxRuntimeSec: number().int().positive(),
42679
+ freeTierNote: string().optional(),
42680
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
42681
+ dataResidencyNote: string(),
42682
+ /** Credentials are present — never the values. */
42683
+ configured: boolean(),
42684
+ defaults: TrainingProviderDefaultsSchema,
42685
+ /**
42686
+ * Values for {@link TrainingProviderTypeSchema}'s `configSchema` — password
42687
+ * fields are keychain {@link SecretFieldView} or `null` / `''` (create),
42688
+ * never plaintext. Same hydrate contract as settings forms (D789).
42689
+ */
42690
+ formValues: record(string(), unknown()).optional()
42691
+ });
42692
+ /**
42693
+ * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
42694
+ * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
42695
+ * `{ $secretClear: true }` clears it.
42696
+ */
42697
+ var TrainingProviderUpdateEntryInputSchema = object({
42698
+ entryId: string().min(1),
42699
+ name: string().min(1),
42700
+ tokenId: string().optional(),
42701
+ tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
42702
+ environment: string().optional(),
42703
+ gpuType: string().optional(),
42704
+ region: string().optional(),
42705
+ costCapUsd: number().nonnegative().optional(),
42706
+ maxRuntimeSec: number().int().positive().optional(),
42707
+ failedDatasetGraceHours: number().nonnegative().optional()
42708
+ });
42709
+ var TrainingCredentialCheckSchema = object({
42710
+ ok: boolean(),
42711
+ /** Workspace / account name, when the provider says. */
42712
+ account: string().optional(),
42713
+ reason: _enum([
42714
+ "missing",
42715
+ "invalid",
42716
+ "forbidden",
42717
+ "network",
42718
+ "quota"
42719
+ ]).optional(),
42720
+ detail: string().optional()
42721
+ });
42722
+ var ProviderJobStateSchema = _enum([
42723
+ "pending",
42724
+ "starting",
42725
+ "running",
42726
+ "succeeded",
42727
+ "failed",
42728
+ "cancelled",
42729
+ "lost"
42730
+ ]);
42731
+ var ProviderJobStatusSchema = object({
42732
+ jobKey: string(),
42733
+ providerJobId: string().optional(),
42734
+ state: ProviderJobStateSchema,
42735
+ startedAt: number().optional(),
42736
+ endedAt: number().optional(),
42737
+ exitCode: number().int().optional(),
42738
+ failureReason: string().optional(),
42739
+ gpuType: string(),
42740
+ region: string().optional(),
42741
+ billedSeconds: number().nonnegative(),
42742
+ costUsd: number().nonnegative(),
42743
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
42744
+ costIsEstimate: boolean(),
42745
+ lastFetchedAt: number()
42746
+ });
42747
+ /**
42748
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
42749
+ * image its own way (Modal builds the published Dockerfile at that revision;
42750
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
42751
+ * in `result.json`.
42752
+ */
42753
+ var TrainerSourceRefSchema = object({
42754
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
42755
+ repo: string().min(1),
42756
+ /** A commit sha (never a branch) — the job must be reproducible. */
42757
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
42758
+ });
42759
+ /** Cloud job identity — route with the owning addon's `addonId` selector. */
42760
+ var JobRef = {
42761
+ entryId: string().min(1),
42762
+ jobKey: string().uuid()
42763
+ };
42764
+ var TrainingLogLineSchema = object({
42765
+ ts: number(),
42766
+ text: string()
42767
+ });
42768
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
42769
+ typeId: string().min(1),
42770
+ name: string().min(1)
42771
+ }), object({ entryId: string() }), {
42772
+ kind: "mutation",
42773
+ auth: "admin"
42774
+ }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
42775
+ kind: "mutation",
42776
+ auth: "admin"
42777
+ }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
42778
+ kind: "mutation",
42779
+ auth: "admin"
42780
+ }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
42781
+ kind: "mutation",
42782
+ auth: "admin",
42783
+ timeoutMs: 3e4
42784
+ }), method(object({
42785
+ entryId: string().min(1),
42786
+ gpuType: string(),
42787
+ region: string(),
42788
+ datasetBytes: number().int().nonnegative(),
42789
+ gpuSecondsLow: number().nonnegative(),
42790
+ gpuSecondsHigh: number().nonnegative()
42791
+ }), object({
42792
+ usdLow: number().nonnegative(),
42793
+ usdHigh: number().nonnegative(),
42794
+ notes: array(string()).readonly()
42795
+ }), { auth: "admin" }), method(object({
42796
+ ...JobRef,
42797
+ ticket: PeerBytesTicketSchema
42798
+ }), object({
42799
+ bytes: number().int().nonnegative(),
42800
+ sha256: string()
42801
+ }), {
42802
+ kind: "mutation",
42803
+ auth: "admin",
42804
+ timeoutMs: 120 * 6e4
42805
+ }), method(object({
42806
+ ...JobRef,
42807
+ trainer: TrainerSourceRefSchema,
42808
+ jobSpecJson: string().min(2).max(64e3),
42809
+ gpuType: string(),
42810
+ region: string(),
42811
+ maxRuntimeSec: number().int().positive()
42812
+ }), ProviderJobStatusSchema, {
42813
+ kind: "mutation",
42814
+ auth: "admin",
42815
+ timeoutMs: 30 * 6e4
42816
+ }), method(object(JobRef), ProviderJobStatusSchema, {
42817
+ auth: "admin",
42818
+ timeoutMs: 6e4
42819
+ }), method(object({
42820
+ ...JobRef,
42821
+ cursor: string().optional(),
42822
+ max: number().int().min(1).max(500)
42823
+ }), object({
42824
+ lines: array(TrainingLogLineSchema).readonly(),
42825
+ cursor: string()
42826
+ }), {
42827
+ auth: "admin",
42828
+ timeoutMs: 6e4
42829
+ }), method(object(JobRef), object({ ok: literal(true) }), {
42830
+ kind: "mutation",
42831
+ auth: "admin",
42832
+ timeoutMs: 6e4
42833
+ }), method(object(JobRef), object({
42834
+ found: boolean(),
42835
+ text: string().optional()
42836
+ }), {
42837
+ kind: "mutation",
42838
+ auth: "admin",
42839
+ timeoutMs: 5 * 6e4
42840
+ }), method(object({
42841
+ ...JobRef,
42842
+ path: _enum(["bundle.tar"])
42843
+ }), object({ ticket: PeerBytesTicketSchema }), {
42844
+ kind: "mutation",
42845
+ auth: "admin",
42846
+ timeoutMs: 5 * 6e4
42847
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
42848
+ kind: "mutation",
42849
+ auth: "admin",
42850
+ timeoutMs: 5 * 6e4
42851
+ }), method(object({ entryId: string().min(1).optional() }), array(ProviderJobStatusSchema).readonly(), {
42852
+ auth: "admin",
42853
+ timeoutMs: 2 * 6e4
42854
+ });
42855
+ /**
42856
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
42857
+ * provided by `addon-training`.
42858
+ *
42859
+ * It owns what every provider must agree on, written once:
42860
+ *
42861
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
42862
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
42863
+ * - **The return flow.** Verified artefacts → Model Studio
42864
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
42865
+ * rollback. Nothing is ever registered automatically.
42866
+ *
42867
+ * Plan/start takes a live {@link TrainingCorpusSelection} (collections +
42868
+ * work-state rule); frame ids are resolved via pipeline-analytics at that
42869
+ * moment and snapshotted on the job. No frozen dataset version.
42870
+ *
42871
+ * Every method is `admin`.
42872
+ */
42873
+ /**
42874
+ * Live corpus criteria for plan/start (design §5.2). Default is complete-only.
42875
+ * Frame ids are resolved at plan/start — never a frozen version id.
42876
+ */
42877
+ var TrainingCorpusSelectionSchema = object({
42878
+ collectionIds: array(string()).min(1),
42879
+ /** Default complete-only for v1 */
42880
+ workState: _enum([
42881
+ "complete",
42882
+ "annotated_or_complete",
42883
+ "any_annotated"
42884
+ ]).default("complete")
42885
+ });
42886
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
42887
+ var TrainingBaseModelSchema = object({
42888
+ modelId: string(),
42889
+ label: string(),
42890
+ weights: string(),
42891
+ imgsz: number().int(),
42892
+ baselineOnnxUrl: string(),
42893
+ baselineFloors: record(string(), number()),
42894
+ /** The base the fleet runs most — the UI's default. */
42895
+ recommended: boolean()
42896
+ });
42897
+ var TrainingPresetSchema = _enum([
42898
+ "quick",
42899
+ "standard",
42900
+ "thorough"
42901
+ ]);
42902
+ var TrainingJobRequestSchema = object({
42903
+ /** Live collection + work-state criteria; resolved at plan/start. */
42904
+ selection: TrainingCorpusSelectionSchema,
42905
+ /**
42906
+ * The provider **entry** that runs it (credentials + defaults).
42907
+ * Resolve to an owning addon via `training-provider.describe` / `listEntries`.
42908
+ */
42909
+ entryId: string().min(1),
42910
+ gpuType: string().min(1),
42911
+ region: string(),
42912
+ baseModelId: string().min(1),
42913
+ preset: TrainingPresetSchema,
42914
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
42915
+ freeze: number().int().nonnegative().nullable(),
42916
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
42917
+ holdoutCameras: array(number().int()).nullable()
42918
+ });
42919
+ var TrainingSplitPlanSchema = object({
42920
+ holdoutCameras: array(number().int()).readonly(),
42921
+ /** Used when no camera is held out: the last N days of every camera. */
42922
+ holdoutLastDays: number().int().nonnegative(),
42923
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
42924
+ holdoutSupport: record(string(), number().int()).nullable(),
42925
+ trainSubjects: number().int()
42926
+ });
42927
+ var TrainingRefusalReasonSchema = _enum([
42928
+ "unknown-dataset",
42929
+ "unknown-provider",
42930
+ "provider-not-configured",
42931
+ "unknown-base-model",
42932
+ "unknown-gpu",
42933
+ "dataset-too-large",
42934
+ "no-training-subjects",
42935
+ "job-already-running"
42936
+ ]);
42937
+ var TrainingJobPlanSchema = object({
42938
+ refusal: object({
42939
+ reason: TrainingRefusalReasonSchema,
42940
+ detail: string()
42941
+ }).nullable(),
42942
+ warnings: array(string()).readonly(),
42943
+ split: TrainingSplitPlanSchema.nullable(),
42944
+ estimate: object({
42945
+ datasetBytes: number().int(),
42946
+ uploadMinutesAt20Mbps: number(),
42947
+ gpuSecondsLow: number(),
42948
+ gpuSecondsHigh: number(),
42949
+ usdLow: number(),
42950
+ usdHigh: number(),
42951
+ notes: array(string()).readonly()
42952
+ }).nullable(),
42953
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
42954
+ defaults: object({
42955
+ maxCostUsd: number(),
42956
+ maxRuntimeSec: number().int()
42957
+ }).nullable(),
42958
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
42959
+ dataNotice: string()
42960
+ });
42961
+ /**
42962
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
42963
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
42964
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
42965
+ * result lives after the operator acted on it.
42966
+ */
42967
+ var TrainingJobStateSchema = _enum([
42968
+ "queued",
42969
+ "uploading",
42970
+ "submitted",
42971
+ "starting",
42972
+ "running",
42973
+ "collecting",
42974
+ "ready",
42975
+ "registered",
42976
+ "canary",
42977
+ "failed",
42978
+ "cancelling",
42979
+ "cancelled",
42980
+ "lost",
42981
+ "expired",
42982
+ "discarded"
42983
+ ]);
42984
+ var TrainingFailureReasonSchema = _enum([
42985
+ "cost-cap",
42986
+ "runtime-cap",
42987
+ "upload-failed",
42988
+ "submit-failed",
42989
+ "trainer-failed",
42990
+ "result-invalid",
42991
+ "checksum-mismatch",
42992
+ "fetch-failed",
42993
+ "provider-error",
42994
+ "hub-restart-during-upload"
42995
+ ]);
42996
+ var TrainingProgressPointSchema = object({
42997
+ epoch: number().int(),
42998
+ map50: number().nullable(),
42999
+ map50_95: number().nullable()
43000
+ });
43001
+ var TrainingCanarySchema = object({
43002
+ deviceIds: array(number().int()).readonly(),
43003
+ since: number(),
43004
+ /** Every override the canary replaced, exactly, so rollback restores it. */
43005
+ previous: array(object({
43006
+ deviceId: number().int(),
43007
+ nodeId: string(),
43008
+ deviceKey: string(),
43009
+ patch: object({
43010
+ modelId: string().optional(),
43011
+ settings: record(string(), unknown()).readonly().optional()
43012
+ }).nullable()
43013
+ })).readonly()
43014
+ });
43015
+ var TrainingJobSchema = object({
43016
+ id: string(),
43017
+ idempotencyKey: string(),
43018
+ name: string(),
43019
+ createdAt: number(),
43020
+ updatedAt: number(),
43021
+ state: TrainingJobStateSchema,
43022
+ /**
43023
+ * Shared by every job enqueued together via `startJobBatch`.
43024
+ * `null` for a lone `startJob`. The engine advances queued siblings by this id.
43025
+ */
43026
+ batchId: string().nullable().default(null),
43027
+ stage: TrainingStageSchema.nullable(),
43028
+ failure: object({
43029
+ reason: TrainingFailureReasonSchema,
43030
+ stage: string().nullable(),
43031
+ detail: string()
43032
+ }).nullable(),
43033
+ request: TrainingJobRequestSchema,
43034
+ maxCostUsd: number().nonnegative(),
43035
+ maxRuntimeSec: number().int().positive(),
43036
+ trainer: TrainerSourceRefSchema,
43037
+ datasetLayout: RetrainExportLayoutSchema,
43038
+ /** Frame count snapshotted when the job started (audit; equals `frameIds.length`). */
43039
+ frameCount: number().int().nonnegative(),
43040
+ /** Resolved frame ids at start — the archive ships exactly these. */
43041
+ frameIds: array(string()).max(2e4).readonly(),
43042
+ /** Hash of what those frames taught at start (trainer `dataset.annotationHash`). */
43043
+ annotationHash: string(),
43044
+ dataset: object({
43045
+ bytes: number().int(),
43046
+ sha256: string(),
43047
+ uploadedAt: number()
43048
+ }).nullable(),
43049
+ split: TrainingSplitPlanSchema,
43050
+ provider: object({
43051
+ state: ProviderJobStateSchema.nullable(),
43052
+ providerJobId: string().nullable(),
43053
+ startedAt: number().nullable(),
43054
+ endedAt: number().nullable(),
43055
+ billedSeconds: number(),
43056
+ costUsd: number(),
43057
+ costIsEstimate: boolean(),
43058
+ lastPolledAt: number().nullable()
43059
+ }),
43060
+ progress: object({
43061
+ epoch: number().int().nullable(),
43062
+ epochs: number().int().nullable(),
43063
+ etaSec: number().nullable(),
43064
+ series: array(TrainingProgressPointSchema).readonly()
43065
+ }),
43066
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
43067
+ logTail: array(string()).readonly(),
43068
+ logCursor: string().nullable(),
43069
+ artifacts: object({
43070
+ bundleBytes: number().int(),
43071
+ bundleSha256: string(),
43072
+ fetchedAt: number(),
43073
+ /** When the staged artefacts are deleted from the hub. */
43074
+ expiresAt: number()
43075
+ }).nullable(),
43076
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
43077
+ cloudDatasetDeletedAt: number().nullable(),
43078
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
43079
+ cloudCleanupDueAt: number().nullable(),
43080
+ /** Model ids registered from this job (base, and int8 when kept). */
43081
+ registeredModelIds: array(string()).readonly(),
43082
+ canary: TrainingCanarySchema.nullable()
43083
+ });
43084
+ var IdInput = object({ id: string().min(1) });
43085
+ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
43086
+ auth: "admin",
43087
+ timeoutMs: 6e4
43088
+ }), method(TrainingJobRequestSchema.extend({
43089
+ name: string().min(1).max(120),
43090
+ maxCostUsd: number().positive(),
43091
+ maxRuntimeSec: number().int().positive(),
43092
+ idempotencyKey: string().min(8).max(80)
43093
+ }), discriminatedUnion("kind", [object({
43094
+ kind: literal("started"),
43095
+ job: TrainingJobSchema
43096
+ }), object({
43097
+ kind: literal("refused"),
43098
+ reason: TrainingRefusalReasonSchema,
43099
+ detail: string()
43100
+ })]), {
43101
+ kind: "mutation",
43102
+ auth: "admin",
43103
+ timeoutMs: 12e4
43104
+ }), method(TrainingJobRequestSchema.omit({ baseModelId: true }).extend({
43105
+ baseModelIds: array(string().min(1)).min(1),
43106
+ name: string().min(1).max(120),
43107
+ maxCostUsd: number().positive(),
43108
+ maxRuntimeSec: number().int().positive(),
43109
+ idempotencyKey: string().min(8).max(80)
43110
+ }), discriminatedUnion("kind", [object({
43111
+ kind: literal("started"),
43112
+ batchId: string(),
43113
+ jobs: array(TrainingJobSchema).min(1).readonly()
43114
+ }), object({
43115
+ kind: literal("refused"),
43116
+ reason: TrainingRefusalReasonSchema,
43117
+ detail: string()
43118
+ })]), {
43119
+ kind: "mutation",
43120
+ auth: "admin",
43121
+ timeoutMs: 12e4
43122
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
43123
+ kind: "mutation",
43124
+ auth: "admin",
43125
+ timeoutMs: 12e4
43126
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
43127
+ kind: "mutation",
43128
+ auth: "admin",
43129
+ timeoutMs: 30 * 6e4
43130
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
43131
+ kind: "mutation",
43132
+ auth: "admin",
43133
+ timeoutMs: 12e4
43134
+ }), method(IdInput, TrainingJobSchema, {
43135
+ kind: "mutation",
43136
+ auth: "admin",
43137
+ timeoutMs: 12e4
43138
+ }), method(IdInput, TrainingJobSchema, {
43139
+ kind: "mutation",
43140
+ auth: "admin"
43141
+ });
41501
43142
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
41502
43143
  Object.freeze({
41503
43144
  person: .5,
@@ -43646,6 +45287,12 @@ Object.freeze({
43646
45287
  addonId: null,
43647
45288
  access: "create"
43648
45289
  },
45290
+ "backup.checkBackupKey": {
45291
+ capName: "backup",
45292
+ capScope: "system",
45293
+ addonId: null,
45294
+ access: "create"
45295
+ },
43649
45296
  "backup.delete": {
43650
45297
  capName: "backup",
43651
45298
  capScope: "system",
@@ -43658,6 +45305,18 @@ Object.freeze({
43658
45305
  addonId: null,
43659
45306
  access: "delete"
43660
45307
  },
45308
+ "backup.disableEncryption": {
45309
+ capName: "backup",
45310
+ capScope: "system",
45311
+ addonId: null,
45312
+ access: "create"
45313
+ },
45314
+ "backup.getEncryption": {
45315
+ capName: "backup",
45316
+ capScope: "system",
45317
+ addonId: null,
45318
+ access: "view"
45319
+ },
43661
45320
  "backup.getEntries": {
43662
45321
  capName: "backup",
43663
45322
  capScope: "system",
@@ -43712,6 +45371,12 @@ Object.freeze({
43712
45371
  addonId: null,
43713
45372
  access: "create"
43714
45373
  },
45374
+ "backup.setupEncryption": {
45375
+ capName: "backup",
45376
+ capScope: "system",
45377
+ addonId: null,
45378
+ access: "create"
45379
+ },
43715
45380
  "backup.trigger": {
43716
45381
  capName: "backup",
43717
45382
  capScope: "system",
@@ -44264,6 +45929,12 @@ Object.freeze({
44264
45929
  addonId: null,
44265
45930
  access: "create"
44266
45931
  },
45932
+ "customModelRegistry.importModelBundle": {
45933
+ capName: "custom-model-registry",
45934
+ capScope: "system",
45935
+ addonId: null,
45936
+ access: "create"
45937
+ },
44267
45938
  "customModelRegistry.listModels": {
44268
45939
  capName: "custom-model-registry",
44269
45940
  capScope: "system",
@@ -45704,6 +47375,12 @@ Object.freeze({
45704
47375
  addonId: null,
45705
47376
  access: "view"
45706
47377
  },
47378
+ "keychainAdmin.acknowledgeReset": {
47379
+ capName: "keychain-admin",
47380
+ capScope: "system",
47381
+ addonId: null,
47382
+ access: "create"
47383
+ },
45707
47384
  "keychainAdmin.deleteOrphans": {
45708
47385
  capName: "keychain-admin",
45709
47386
  capScope: "system",
@@ -45740,6 +47417,12 @@ Object.freeze({
45740
47417
  addonId: null,
45741
47418
  access: "delete"
45742
47419
  },
47420
+ "keychainAdmin.resetReport": {
47421
+ capName: "keychain-admin",
47422
+ capScope: "system",
47423
+ addonId: null,
47424
+ access: "delete"
47425
+ },
45743
47426
  "keychainAdmin.reveal": {
45744
47427
  capName: "keychain-admin",
45745
47428
  capScope: "system",
@@ -45752,6 +47435,12 @@ Object.freeze({
45752
47435
  addonId: null,
45753
47436
  access: "create"
45754
47437
  },
47438
+ "keychainAdmin.setSystemSecret": {
47439
+ capName: "keychain-admin",
47440
+ capScope: "system",
47441
+ addonId: null,
47442
+ access: "create"
47443
+ },
45755
47444
  "keychainAdmin.status": {
45756
47445
  capName: "keychain-admin",
45757
47446
  capScope: "system",
@@ -46988,6 +48677,36 @@ Object.freeze({
46988
48677
  addonId: null,
46989
48678
  access: "view"
46990
48679
  },
48680
+ "oidcConnections.connectionFormSchema": {
48681
+ capName: "oidc-connections",
48682
+ capScope: "system",
48683
+ addonId: null,
48684
+ access: "view"
48685
+ },
48686
+ "oidcConnections.createConnection": {
48687
+ capName: "oidc-connections",
48688
+ capScope: "system",
48689
+ addonId: null,
48690
+ access: "create"
48691
+ },
48692
+ "oidcConnections.deleteConnection": {
48693
+ capName: "oidc-connections",
48694
+ capScope: "system",
48695
+ addonId: null,
48696
+ access: "delete"
48697
+ },
48698
+ "oidcConnections.listConnections": {
48699
+ capName: "oidc-connections",
48700
+ capScope: "system",
48701
+ addonId: null,
48702
+ access: "view"
48703
+ },
48704
+ "oidcConnections.updateConnection": {
48705
+ capName: "oidc-connections",
48706
+ capScope: "system",
48707
+ addonId: null,
48708
+ access: "create"
48709
+ },
46991
48710
  "osd.getStatus": {
46992
48711
  capName: "osd",
46993
48712
  capScope: "device",
@@ -47060,6 +48779,12 @@ Object.freeze({
47060
48779
  addonId: null,
47061
48780
  access: "create"
47062
48781
  },
48782
+ "osdManager.setSlotCameraEnabled": {
48783
+ capName: "osd-manager",
48784
+ capScope: "system",
48785
+ addonId: null,
48786
+ access: "create"
48787
+ },
47063
48788
  "osdManager.upsertTemplate": {
47064
48789
  capName: "osd-manager",
47065
48790
  capScope: "system",
@@ -47312,6 +49037,12 @@ Object.freeze({
47312
49037
  addonId: null,
47313
49038
  access: "view"
47314
49039
  },
49040
+ "pipelineAnalytics.getRetrainCorpusKpi": {
49041
+ capName: "pipeline-analytics",
49042
+ capScope: "device",
49043
+ addonId: null,
49044
+ access: "view"
49045
+ },
47315
49046
  "pipelineAnalytics.getRetrainExportUrl": {
47316
49047
  capName: "pipeline-analytics",
47317
49048
  capScope: "device",
@@ -47432,6 +49163,12 @@ Object.freeze({
47432
49163
  addonId: null,
47433
49164
  access: "view"
47434
49165
  },
49166
+ "pipelineAnalytics.listRetrainCorpusPage": {
49167
+ capName: "pipeline-analytics",
49168
+ capScope: "device",
49169
+ addonId: null,
49170
+ access: "view"
49171
+ },
47435
49172
  "pipelineAnalytics.listRetrainFrames": {
47436
49173
  capName: "pipeline-analytics",
47437
49174
  capScope: "device",
@@ -47462,6 +49199,12 @@ Object.freeze({
47462
49199
  addonId: null,
47463
49200
  access: "view"
47464
49201
  },
49202
+ "pipelineAnalytics.offerRetrainArchive": {
49203
+ capName: "pipeline-analytics",
49204
+ capScope: "device",
49205
+ addonId: null,
49206
+ access: "create"
49207
+ },
47465
49208
  "pipelineAnalytics.ownersWithMedia": {
47466
49209
  capName: "pipeline-analytics",
47467
49210
  capScope: "device",
@@ -47552,6 +49295,12 @@ Object.freeze({
47552
49295
  addonId: null,
47553
49296
  access: "create"
47554
49297
  },
49298
+ "pipelineAnalytics.resolveRetrainTrainingCorpus": {
49299
+ capName: "pipeline-analytics",
49300
+ capScope: "device",
49301
+ addonId: null,
49302
+ access: "view"
49303
+ },
47555
49304
  "pipelineAnalytics.restageRetrainTrack": {
47556
49305
  capName: "pipeline-analytics",
47557
49306
  capScope: "device",
@@ -49988,6 +51737,180 @@ Object.freeze({
49988
51737
  addonId: null,
49989
51738
  access: "view"
49990
51739
  },
51740
+ "training.canaryResult": {
51741
+ capName: "training",
51742
+ capScope: "system",
51743
+ addonId: null,
51744
+ access: "create"
51745
+ },
51746
+ "training.cancelJob": {
51747
+ capName: "training",
51748
+ capScope: "system",
51749
+ addonId: null,
51750
+ access: "create"
51751
+ },
51752
+ "training.discardResult": {
51753
+ capName: "training",
51754
+ capScope: "system",
51755
+ addonId: null,
51756
+ access: "create"
51757
+ },
51758
+ "training.getJob": {
51759
+ capName: "training",
51760
+ capScope: "system",
51761
+ addonId: null,
51762
+ access: "view"
51763
+ },
51764
+ "training.getJobResult": {
51765
+ capName: "training",
51766
+ capScope: "system",
51767
+ addonId: null,
51768
+ access: "view"
51769
+ },
51770
+ "training.listBaseModels": {
51771
+ capName: "training",
51772
+ capScope: "system",
51773
+ addonId: null,
51774
+ access: "view"
51775
+ },
51776
+ "training.listJobs": {
51777
+ capName: "training",
51778
+ capScope: "system",
51779
+ addonId: null,
51780
+ access: "view"
51781
+ },
51782
+ "training.planJob": {
51783
+ capName: "training",
51784
+ capScope: "system",
51785
+ addonId: null,
51786
+ access: "view"
51787
+ },
51788
+ "training.registerResult": {
51789
+ capName: "training",
51790
+ capScope: "system",
51791
+ addonId: null,
51792
+ access: "create"
51793
+ },
51794
+ "training.rollbackCanary": {
51795
+ capName: "training",
51796
+ capScope: "system",
51797
+ addonId: null,
51798
+ access: "create"
51799
+ },
51800
+ "training.startJob": {
51801
+ capName: "training",
51802
+ capScope: "system",
51803
+ addonId: null,
51804
+ access: "create"
51805
+ },
51806
+ "training.startJobBatch": {
51807
+ capName: "training",
51808
+ capScope: "system",
51809
+ addonId: null,
51810
+ access: "create"
51811
+ },
51812
+ "trainingProvider.cancelJob": {
51813
+ capName: "training-provider",
51814
+ capScope: "system",
51815
+ addonId: null,
51816
+ access: "create"
51817
+ },
51818
+ "trainingProvider.cleanupJob": {
51819
+ capName: "training-provider",
51820
+ capScope: "system",
51821
+ addonId: null,
51822
+ access: "create"
51823
+ },
51824
+ "trainingProvider.createEntry": {
51825
+ capName: "training-provider",
51826
+ capScope: "system",
51827
+ addonId: null,
51828
+ access: "create"
51829
+ },
51830
+ "trainingProvider.deleteEntry": {
51831
+ capName: "training-provider",
51832
+ capScope: "system",
51833
+ addonId: null,
51834
+ access: "delete"
51835
+ },
51836
+ "trainingProvider.describe": {
51837
+ capName: "training-provider",
51838
+ capScope: "system",
51839
+ addonId: null,
51840
+ access: "view"
51841
+ },
51842
+ "trainingProvider.describeTypes": {
51843
+ capName: "training-provider",
51844
+ capScope: "system",
51845
+ addonId: null,
51846
+ access: "view"
51847
+ },
51848
+ "trainingProvider.estimateJob": {
51849
+ capName: "training-provider",
51850
+ capScope: "system",
51851
+ addonId: null,
51852
+ access: "view"
51853
+ },
51854
+ "trainingProvider.getJob": {
51855
+ capName: "training-provider",
51856
+ capScope: "system",
51857
+ addonId: null,
51858
+ access: "view"
51859
+ },
51860
+ "trainingProvider.listEntries": {
51861
+ capName: "training-provider",
51862
+ capScope: "system",
51863
+ addonId: null,
51864
+ access: "view"
51865
+ },
51866
+ "trainingProvider.listJobEvents": {
51867
+ capName: "training-provider",
51868
+ capScope: "system",
51869
+ addonId: null,
51870
+ access: "view"
51871
+ },
51872
+ "trainingProvider.listJobs": {
51873
+ capName: "training-provider",
51874
+ capScope: "system",
51875
+ addonId: null,
51876
+ access: "view"
51877
+ },
51878
+ "trainingProvider.offerArtifact": {
51879
+ capName: "training-provider",
51880
+ capScope: "system",
51881
+ addonId: null,
51882
+ access: "create"
51883
+ },
51884
+ "trainingProvider.readResult": {
51885
+ capName: "training-provider",
51886
+ capScope: "system",
51887
+ addonId: null,
51888
+ access: "create"
51889
+ },
51890
+ "trainingProvider.submitJob": {
51891
+ capName: "training-provider",
51892
+ capScope: "system",
51893
+ addonId: null,
51894
+ access: "create"
51895
+ },
51896
+ "trainingProvider.updateEntry": {
51897
+ capName: "training-provider",
51898
+ capScope: "system",
51899
+ addonId: null,
51900
+ access: "create"
51901
+ },
51902
+ "trainingProvider.uploadDataset": {
51903
+ capName: "training-provider",
51904
+ capScope: "system",
51905
+ addonId: null,
51906
+ access: "create"
51907
+ },
51908
+ "trainingProvider.validateCredentials": {
51909
+ capName: "training-provider",
51910
+ capScope: "system",
51911
+ addonId: null,
51912
+ access: "create"
51913
+ },
49991
51914
  "turnProvider.getTurnServers": {
49992
51915
  capName: "turn-provider",
49993
51916
  capScope: "system",
@@ -50012,12 +51935,6 @@ Object.freeze({
50012
51935
  addonId: null,
50013
51936
  access: "create"
50014
51937
  },
50015
- "userManagement.createApiKey": {
50016
- capName: "user-management",
50017
- capScope: "system",
50018
- addonId: null,
50019
- access: "create"
50020
- },
50021
51938
  "userManagement.createScopedToken": {
50022
51939
  capName: "user-management",
50023
51940
  capScope: "system",
@@ -50054,12 +51971,6 @@ Object.freeze({
50054
51971
  addonId: null,
50055
51972
  access: "view"
50056
51973
  },
50057
- "userManagement.linkExternalIdentity": {
50058
- capName: "user-management",
50059
- capScope: "system",
50060
- addonId: null,
50061
- access: "create"
50062
- },
50063
51974
  "userManagement.listApiKeys": {
50064
51975
  capName: "user-management",
50065
51976
  capScope: "system",
@@ -50162,12 +52073,6 @@ Object.freeze({
50162
52073
  addonId: null,
50163
52074
  access: "create"
50164
52075
  },
50165
- "userManagement.validateApiKey": {
50166
- capName: "user-management",
50167
- capScope: "system",
50168
- addonId: null,
50169
- access: "view"
50170
- },
50171
52076
  "userManagement.validateCredentials": {
50172
52077
  capName: "user-management",
50173
52078
  capScope: "system",
@@ -53266,6 +55171,11 @@ Object.freeze({
53266
55171
  form: "single",
53267
55172
  optional: false
53268
55173
  }],
55174
+ "osdManager.setSlotCameraEnabled": [{
55175
+ name: "deviceId",
55176
+ form: "single",
55177
+ optional: false
55178
+ }],
53269
55179
  "petFeeder.callPet": [{
53270
55180
  name: "deviceId",
53271
55181
  form: "single",
@@ -53486,6 +55396,11 @@ Object.freeze({
53486
55396
  form: "array",
53487
55397
  optional: false
53488
55398
  }],
55399
+ "pipelineAnalytics.listRetrainCorpusPage": [{
55400
+ name: "deviceIds",
55401
+ form: "array",
55402
+ optional: true
55403
+ }],
53489
55404
  "pipelineAnalytics.listRetrainStaging": [{
53490
55405
  name: "deviceIds",
53491
55406
  form: "array",
@@ -54347,6 +56262,11 @@ Object.freeze({
54347
56262
  form: "single",
54348
56263
  optional: false
54349
56264
  }],
56265
+ "training.canaryResult": [{
56266
+ name: "deviceIds",
56267
+ form: "array",
56268
+ optional: false
56269
+ }],
54350
56270
  "update.getStatus": [{
54351
56271
  name: "deviceId",
54352
56272
  form: "single",
@@ -54590,6 +56510,7 @@ Object.freeze({
54590
56510
  });
54591
56511
  Object.freeze({
54592
56512
  "broker": "broker",
56513
+ "calendar-source": "calendar",
54593
56514
  "device-export": "device-export",
54594
56515
  "llm": "ai",
54595
56516
  "mesh-network": "mesh",
@@ -55075,6 +56996,8 @@ var STATE_SUMMARY_VARS = [
55075
56996
  [...RULE_TEXT],
55076
56997
  [...RULE_TEXT],
55077
56998
  [...RULE_TEXT],
56999
+ [...RULE_TEXT],
57000
+ [...RULE_TEXT],
55078
57001
  ([...RULE_TEXT], [...UPDATES]),
55079
57002
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
55080
57003
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
@@ -55649,7 +57572,12 @@ var CREDENTIAL_PARAM_PATTERNS = [
55649
57572
  /^bearer$/i,
55650
57573
  /^api[_-]?key$/i,
55651
57574
  /^access[_-]?token$/i,
55652
- /^refresh[_-]?token$/i
57575
+ /^refresh[_-]?token$/i,
57576
+ /^bridge$/i,
57577
+ /^code$/i,
57578
+ /^state$/i,
57579
+ /^challenge$/i,
57580
+ /^link$/i
55653
57581
  ];
55654
57582
  function isCredentialParam(name) {
55655
57583
  return CREDENTIAL_PARAM_PATTERNS.some((re) => re.test(name));
@@ -55671,6 +57599,10 @@ function isCredentialParam(name) {
55671
57599
  * are NOT masked (those are entity references, not credentials).
55672
57600
  */
55673
57601
  function maskUrlCredentials(rawUrl) {
57602
+ if (rawUrl.startsWith("/") && !rawUrl.startsWith("//")) {
57603
+ const masked = maskUrlCredentials(`http://relative.invalid${rawUrl}`);
57604
+ return masked.startsWith("http://relative.invalid") ? masked.slice(23) : rawUrl;
57605
+ }
55674
57606
  try {
55675
57607
  const u = new URL(rawUrl);
55676
57608
  let touched = false;