@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.js CHANGED
@@ -5401,7 +5401,7 @@ var ZodIssueCode = {
5401
5401
  var ZodFirstPartyTypeKind;
5402
5402
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5403
5403
  //#endregion
5404
- //#region ../types/dist/sleep-Cr5YOk3m.mjs
5404
+ //#region ../types/dist/sleep-DwAQ9sqX.mjs
5405
5405
  /**
5406
5406
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5407
5407
  * window to float samples (D455).
@@ -5518,7 +5518,7 @@ function isKeychainStoredField(field) {
5518
5518
  var SECRET_CLEAR = { $secretClear: true };
5519
5519
  /** The `'***'` token D634 redaction writes for non-admins. */
5520
5520
  var LEGACY_DEVICE_REDACTION = "***";
5521
- function isRecord$1(value) {
5521
+ function isRecord$2(value) {
5522
5522
  return typeof value === "object" && value !== null && !Array.isArray(value);
5523
5523
  }
5524
5524
  function makeSecretMarker(ref) {
@@ -5529,12 +5529,12 @@ function makeSecretMarker(ref) {
5529
5529
  }
5530
5530
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5531
5531
  function isSecretMarker(value) {
5532
- if (!isRecord$1(value)) return false;
5532
+ if (!isRecord$2(value)) return false;
5533
5533
  const ref = value["$secret"];
5534
5534
  return typeof ref === "string" && ref.length > 0;
5535
5535
  }
5536
5536
  function isSecretClear(value) {
5537
- return isRecord$1(value) && value["$secretClear"] === true;
5537
+ return isRecord$2(value) && value["$secretClear"] === true;
5538
5538
  }
5539
5539
  /**
5540
5540
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6050,6 +6050,13 @@ function globalSecretScope() {
6050
6050
  function encodeSegment(value) {
6051
6051
  return encodeURIComponent(value);
6052
6052
  }
6053
+ function decodeSegment(value) {
6054
+ try {
6055
+ return decodeURIComponent(value);
6056
+ } catch {
6057
+ return null;
6058
+ }
6059
+ }
6053
6060
  /**
6054
6061
  * The field path of a value inside an array item, addressed by the item's id:
6055
6062
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6058,6 +6065,75 @@ function encodeSegment(value) {
6058
6065
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6059
6066
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6060
6067
  }
6068
+ function parseScope(segments) {
6069
+ switch (segments[0]) {
6070
+ case "global": return {
6071
+ scope: GLOBAL_SCOPE,
6072
+ used: 1
6073
+ };
6074
+ case "node": {
6075
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6076
+ return nodeId === null || nodeId.length === 0 ? null : {
6077
+ scope: {
6078
+ kind: "node",
6079
+ nodeId
6080
+ },
6081
+ used: 2
6082
+ };
6083
+ }
6084
+ case "device": {
6085
+ const raw = segments[1];
6086
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6087
+ return {
6088
+ scope: {
6089
+ kind: "device",
6090
+ deviceId: Number(raw)
6091
+ },
6092
+ used: 2
6093
+ };
6094
+ }
6095
+ case "integration": {
6096
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6097
+ return id === null || id.length === 0 ? null : {
6098
+ scope: {
6099
+ kind: "integration",
6100
+ integrationId: id
6101
+ },
6102
+ used: 2
6103
+ };
6104
+ }
6105
+ case "row": {
6106
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6107
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6108
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6109
+ return {
6110
+ scope: {
6111
+ kind: "row",
6112
+ collection,
6113
+ rowId
6114
+ },
6115
+ used: 3
6116
+ };
6117
+ }
6118
+ default: return null;
6119
+ }
6120
+ }
6121
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6122
+ function parseSecretRef(ref) {
6123
+ if (!ref.startsWith("secret://")) return null;
6124
+ const segments = ref.slice(9).split("/");
6125
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6126
+ if (owner === null || owner.length === 0) return null;
6127
+ const parsed = parseScope(segments.slice(1));
6128
+ if (parsed === null) return null;
6129
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6130
+ if (fieldPath.length === 0) return null;
6131
+ return {
6132
+ owner,
6133
+ scope: parsed.scope,
6134
+ fieldPath
6135
+ };
6136
+ }
6061
6137
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6062
6138
  var KeychainWriteRefusedError = class extends Error {
6063
6139
  fieldPath;
@@ -6068,7 +6144,7 @@ var KeychainWriteRefusedError = class extends Error {
6068
6144
  }
6069
6145
  };
6070
6146
  var KEEP = { kind: "keep" };
6071
- function isRecord(value) {
6147
+ function isRecord$1(value) {
6072
6148
  return typeof value === "object" && value !== null && !Array.isArray(value);
6073
6149
  }
6074
6150
  function defaultMintId() {
@@ -6081,7 +6157,7 @@ function collectSecretMarkerRefs(value, out = []) {
6081
6157
  return out;
6082
6158
  }
6083
6159
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6084
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6160
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6085
6161
  return out;
6086
6162
  }
6087
6163
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6136,7 +6212,7 @@ function rowId(row, idKey) {
6136
6212
  return null;
6137
6213
  }
6138
6214
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6139
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6215
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6140
6216
  if (!Array.isArray(incoming)) {
6141
6217
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6142
6218
  return {
@@ -6152,7 +6228,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6152
6228
  const kept = /* @__PURE__ */ new Set();
6153
6229
  const rows = [];
6154
6230
  for (const row of incoming) {
6155
- if (!isRecord(row)) {
6231
+ if (!isRecord$1(row)) {
6156
6232
  rows.push(row);
6157
6233
  continue;
6158
6234
  }
@@ -6177,7 +6253,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6177
6253
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6178
6254
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6179
6255
  case "object": {
6180
- if (!isRecord(incoming)) {
6256
+ if (!isRecord$1(incoming)) {
6181
6257
  if (incoming === void 0) return KEEP;
6182
6258
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6183
6259
  return {
@@ -6185,7 +6261,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6185
6261
  value: incoming
6186
6262
  };
6187
6263
  }
6188
- const storedObj = isRecord(stored) ? stored : {};
6264
+ const storedObj = isRecord$1(stored) ? stored : {};
6189
6265
  return {
6190
6266
  kind: "value",
6191
6267
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6244,12 +6320,19 @@ async function transformSecretWrite(input) {
6244
6320
  }
6245
6321
  };
6246
6322
  }
6323
+ /** Is `ref` one of `owner`'s refs? */
6324
+ function isSecretRefOwnedBy(ref, owner) {
6325
+ return parseSecretRef(ref)?.owner === owner;
6326
+ }
6247
6327
  /**
6248
6328
  * Replace every marker in `value` with its keychain value. Returns the SAME
6249
6329
  * reference when there is no marker (no allocation, no keychain call).
6250
6330
  */
6251
- async function resolveSecretMarkers(value, secrets) {
6252
- const refs = collectSecretMarkerRefs(value);
6331
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6332
+ const keepMarker = options.unresolved === "keep-marker";
6333
+ const owner = options.ownedBy;
6334
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6335
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6253
6336
  if (refs.length === 0) return {
6254
6337
  value,
6255
6338
  unresolved: []
@@ -6273,10 +6356,18 @@ async function resolveSecretMarkers(value, secrets) {
6273
6356
  }
6274
6357
  const substitute = (v) => {
6275
6358
  if (isSecretMarker(v)) {
6359
+ if (!inScope(v.$secret)) return {
6360
+ keep: true,
6361
+ value: v
6362
+ };
6276
6363
  const answer = answers[v.$secret];
6277
- return answer?.kind === "value" ? {
6364
+ if (answer?.kind === "value") return {
6278
6365
  keep: true,
6279
6366
  value: answer.value
6367
+ };
6368
+ return keepMarker ? {
6369
+ keep: true,
6370
+ value: v
6280
6371
  } : {
6281
6372
  keep: false,
6282
6373
  value: void 0
@@ -6293,7 +6384,7 @@ async function resolveSecretMarkers(value, secrets) {
6293
6384
  value: items
6294
6385
  };
6295
6386
  }
6296
- if (isRecord(v)) {
6387
+ if (isRecord$1(v)) {
6297
6388
  const out = {};
6298
6389
  for (const [k, child] of Object.entries(v)) {
6299
6390
  const s = substitute(child);
@@ -6314,14 +6405,152 @@ async function resolveSecretMarkers(value, secrets) {
6314
6405
  unresolved
6315
6406
  };
6316
6407
  }
6317
- function touchesTree(tree, patch) {
6318
- if (tree.size === 0) return false;
6319
- for (const key of Object.keys(patch)) {
6320
- const at = key.indexOf("@");
6321
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6408
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6409
+ var SecretOverwriteRefusedError = class extends Error {
6410
+ ref;
6411
+ reason;
6412
+ constructor(ref, reason) {
6413
+ 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.`);
6414
+ this.ref = ref;
6415
+ this.reason = reason;
6416
+ this.name = "SecretOverwriteRefusedError";
6417
+ }
6418
+ };
6419
+ function isRecord(value) {
6420
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6421
+ }
6422
+ function resolvedValue(pass, marker) {
6423
+ const answer = pass.answers[marker.$secret];
6424
+ return answer?.kind === "value" ? answer.value : null;
6425
+ }
6426
+ async function atMarker(pass, incoming, stored) {
6427
+ if (incoming === null) return stored;
6428
+ if (typeof incoming !== "string") return incoming;
6429
+ if (incoming === resolvedValue(pass, stored)) return stored;
6430
+ const intent = classifySecretWrite(incoming);
6431
+ if (intent.kind !== "set") return stored;
6432
+ const ref = stored.$secret;
6433
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6434
+ const answer = pass.answers[ref];
6435
+ 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);
6436
+ try {
6437
+ await pass.secrets.put(ref, intent.value);
6438
+ } catch (err) {
6439
+ throw new KeychainWriteRefusedError(ref, err);
6440
+ }
6441
+ pass.changedRefs.push(ref);
6442
+ return stored;
6443
+ }
6444
+ function inArray(pass, incoming, stored) {
6445
+ return incoming.map((item, index) => {
6446
+ const twin = stored[index];
6447
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6448
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6449
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6450
+ return item;
6451
+ });
6452
+ }
6453
+ function inArrayRow(pass, incoming, stored) {
6454
+ const out = { ...incoming };
6455
+ for (const [key, value] of Object.entries(incoming)) {
6456
+ const twin = stored[key];
6457
+ if (isSecretMarker(twin)) {
6458
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6459
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6460
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6461
+ }
6462
+ return out;
6463
+ }
6464
+ async function walk(pass, incoming, stored) {
6465
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6466
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6467
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6468
+ const out = { ...incoming };
6469
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6470
+ return out;
6471
+ }
6472
+ /** Restore markers a write-back carries as values. See the file doc. */
6473
+ async function restoreUnchangedSecrets(input) {
6474
+ const refs = [];
6475
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6476
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6477
+ if (owned.length === 0) return {
6478
+ patch: input.patch,
6479
+ changedRefs: []
6480
+ };
6481
+ const pass = {
6482
+ secrets: input.secrets,
6483
+ answers: await input.secrets.resolve([...new Set(owned)]),
6484
+ operatorWrite: input.operatorWrite,
6485
+ changedRefs: []
6486
+ };
6487
+ const out = {};
6488
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6489
+ return {
6490
+ patch: out,
6491
+ changedRefs: pass.changedRefs
6492
+ };
6493
+ }
6494
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6495
+ function isJsonEqual(a, b) {
6496
+ if (Object.is(a, b)) return true;
6497
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6498
+ if (isRecord(a) && isRecord(b)) {
6499
+ const keys = Object.keys(a);
6500
+ if (keys.length !== Object.keys(b).length) return false;
6501
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6322
6502
  }
6323
6503
  return false;
6324
6504
  }
6505
+ /** The patch without the keys whose value already equals the stored one. */
6506
+ function dropUnchangedKeys(patch, stored) {
6507
+ const out = {};
6508
+ for (const [key, value] of Object.entries(patch)) {
6509
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6510
+ out[key] = value;
6511
+ }
6512
+ return out;
6513
+ }
6514
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6515
+ function markerKeysOf(blob, owner) {
6516
+ const keys = /* @__PURE__ */ new Set();
6517
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6518
+ return keys;
6519
+ }
6520
+ function nodeFromStored(value, owner) {
6521
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6522
+ if (!isRecord(value)) return null;
6523
+ const children = /* @__PURE__ */ new Map();
6524
+ for (const [key, child] of Object.entries(value)) {
6525
+ const node = nodeFromStored(child, owner);
6526
+ if (node !== null) children.set(key, node);
6527
+ }
6528
+ return children.size > 0 ? {
6529
+ kind: "object",
6530
+ children
6531
+ } : null;
6532
+ }
6533
+ /**
6534
+ * The declared secret tree, widened by every place the STORED blob holds a
6535
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6536
+ * never declared: Wyze before b4906cec6) still gets the save path's
6537
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6538
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6539
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6540
+ * builtin that keeps another addon's marker (device-manager) never takes it
6541
+ * over.
6542
+ */
6543
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6544
+ const added = /* @__PURE__ */ new Map();
6545
+ for (const key of keys) {
6546
+ const at = key.indexOf("@");
6547
+ const base = at > 0 ? key.slice(0, at) : key;
6548
+ if (declared.has(base) || added.has(base)) continue;
6549
+ const node = nodeFromStored(stored[key], owner);
6550
+ if (node !== null) added.set(base, node);
6551
+ }
6552
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6553
+ }
6325
6554
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6326
6555
  async function readStoredAddonBlob(raw) {
6327
6556
  const threeWay = raw.readAddonStoreResult;
@@ -6330,7 +6559,41 @@ async function readStoredAddonBlob(raw) {
6330
6559
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6331
6560
  return result.kind === "missing" ? {} : result.value;
6332
6561
  }
6333
- function createSecretAwareSettings(raw, opts) {
6562
+ function touchesTree(tree, patch) {
6563
+ if (tree.size === 0) return false;
6564
+ for (const key of Object.keys(patch)) {
6565
+ const at = key.indexOf("@");
6566
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6567
+ }
6568
+ return false;
6569
+ }
6570
+ /**
6571
+ * Which top-level keys of each store held markers when last seen. `undefined`
6572
+ * for a store not seen yet: its first write reads it, to be safe.
6573
+ */
6574
+ var MarkerKeyIndex = class {
6575
+ owner;
6576
+ byStore = /* @__PURE__ */ new Map();
6577
+ constructor(owner) {
6578
+ this.owner = owner;
6579
+ }
6580
+ seen(store, blob) {
6581
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6582
+ }
6583
+ wrote(store, patch) {
6584
+ const keys = this.byStore.get(store);
6585
+ if (keys === void 0) return;
6586
+ const now = markerKeysOf(patch, this.owner);
6587
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6588
+ else keys.delete(key);
6589
+ }
6590
+ mayHoldMarkers(store, patch) {
6591
+ const keys = this.byStore.get(store);
6592
+ if (keys === void 0) return true;
6593
+ return Object.keys(patch).some((key) => keys.has(key));
6594
+ }
6595
+ };
6596
+ function createHandle(raw, opts) {
6334
6597
  const chains = /* @__PURE__ */ new Map();
6335
6598
  const serialize = (key, fn) => {
6336
6599
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6341,46 +6604,130 @@ function createSecretAwareSettings(raw, opts) {
6341
6604
  });
6342
6605
  return next;
6343
6606
  };
6344
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6345
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6346
- return serialize(chainKey, async () => {
6607
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6608
+ const resolveRead = async (store, blob) => {
6609
+ index.seen(store, blob);
6610
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6611
+ unresolved: "keep-marker",
6612
+ ownedBy: opts.secrets.owner
6613
+ });
6614
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6615
+ return value;
6616
+ };
6617
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6618
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6619
+ await rawWrite(patch);
6620
+ index.wrote(store, patch);
6621
+ return { changed: true };
6622
+ }
6623
+ return serialize(store, async () => {
6347
6624
  const stored = await readStored();
6625
+ index.seen(store, stored);
6626
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6627
+ const restored = await restoreUnchangedSecrets({
6628
+ patch,
6629
+ stored,
6630
+ secrets: opts.secrets,
6631
+ operatorWrite
6632
+ });
6348
6633
  const result = await transformSecretWrite({
6349
- tree,
6634
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6350
6635
  secrets: opts.secrets,
6351
- patch,
6636
+ patch: restored.patch,
6352
6637
  stored,
6353
6638
  ...scope !== void 0 ? { scope } : {},
6354
- operatorWrite: opts.isOperatorWrite?.() === true
6639
+ operatorWrite
6355
6640
  });
6356
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6641
+ const effective = dropUnchangedKeys(result.patch, stored);
6642
+ const wroteBlob = Object.keys(effective).length > 0;
6643
+ if (wroteBlob) {
6644
+ await rawWrite(effective);
6645
+ index.wrote(store, effective);
6646
+ }
6357
6647
  const { orphaned } = await result.afterWrite();
6358
6648
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6649
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6359
6650
  });
6360
6651
  };
6361
- const wrapped = {
6362
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6363
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6364
- kind: "device",
6365
- deviceId
6366
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6652
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6653
+ const readAddonStoreResult = raw.readAddonStoreResult;
6654
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6655
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6656
+ const overrides = {
6657
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6658
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6659
+ const result = await readAddonStoreResult.call(raw);
6660
+ return result.kind === "value" ? {
6661
+ kind: "value",
6662
+ value: await resolveRead("addon", result.value)
6663
+ } : result;
6664
+ } } : {},
6665
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6666
+ const result = await readAddonStoreKeyResult.call(raw, key);
6667
+ if (result.kind !== "present") return result;
6668
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6669
+ unresolved: "keep-marker",
6670
+ ownedBy: opts.secrets.owner
6671
+ });
6672
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6673
+ return {
6674
+ kind: "present",
6675
+ value: value[key]
6676
+ };
6677
+ } } : {},
6678
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6679
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6680
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6681
+ const out = /* @__PURE__ */ new Map();
6682
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6683
+ return out;
6684
+ } } : {},
6685
+ writeAddonStore: async (patch) => {
6686
+ await writeAddon(patch);
6687
+ },
6688
+ writeDeviceStore: async (deviceId, patch) => {
6689
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6690
+ kind: "device",
6691
+ deviceId
6692
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6693
+ }
6694
+ };
6695
+ return {
6696
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6697
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6698
+ const value = Reflect.get(target, prop, receiver);
6699
+ return typeof value === "function" ? value.bind(target) : value;
6700
+ } }),
6701
+ raw: {
6702
+ readAddonStore: async () => {
6703
+ const blob = await raw.readAddonStore();
6704
+ index.seen("addon", blob);
6705
+ return blob;
6706
+ },
6707
+ readDeviceStore: async (deviceId) => {
6708
+ const blob = await raw.readDeviceStore(deviceId);
6709
+ index.seen(`device:${deviceId}`, blob);
6710
+ return blob;
6711
+ }
6712
+ },
6713
+ writeAddonStore: writeAddon
6367
6714
  };
6368
- return new Proxy(raw, { get(target, prop, receiver) {
6369
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6370
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6371
- const value = Reflect.get(target, prop, receiver);
6372
- return typeof value === "function" ? value.bind(target) : value;
6373
- } });
6374
6715
  }
6375
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6376
- function withSecretAwareSettings(context, opts) {
6716
+ /** The context the addon sees, plus the private raw view and write outcome. */
6717
+ function createSecretAwareContext(context, opts) {
6377
6718
  const raw = context.settings;
6378
- if (raw === void 0) return context;
6379
- const settings = createSecretAwareSettings(raw, opts);
6380
- return new Proxy(context, { get(target, prop, receiver) {
6381
- if (prop === "settings") return settings;
6382
- return Reflect.get(target, prop, receiver);
6383
- } });
6719
+ if (raw === void 0) return {
6720
+ context,
6721
+ handle: null
6722
+ };
6723
+ const handle = createHandle(raw, opts);
6724
+ return {
6725
+ context: new Proxy(context, { get(target, prop, receiver) {
6726
+ if (prop === "settings") return handle.settings;
6727
+ return Reflect.get(target, prop, receiver);
6728
+ } }),
6729
+ handle
6730
+ };
6384
6731
  }
6385
6732
  var LEAF = { kind: "leaf" };
6386
6733
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6555,6 +6902,14 @@ var BaseAddon = class {
6555
6902
  _secretChangeUnsub = null;
6556
6903
  /** >0 while an OPERATOR's settings write is being applied. */
6557
6904
  _operatorWriteDepth = 0;
6905
+ /**
6906
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6907
+ * to the marker-bearing blobs and stays private to this class: the form
6908
+ * hydrate and config resolution need markers, addon code never does.
6909
+ */
6910
+ _secretSettings = null;
6911
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6912
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6558
6913
  constructor(defaults) {
6559
6914
  this.defaults = defaults;
6560
6915
  this._config = { ...defaults };
@@ -6591,13 +6946,21 @@ var BaseAddon = class {
6591
6946
  }
6592
6947
  async initialize(context) {
6593
6948
  const secrets = context.secrets;
6594
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6595
- secrets,
6596
- addonTree: () => this.addonSecretTree(),
6597
- deviceTree: () => this.deviceSecretTree(),
6598
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6599
- isOperatorWrite: () => this._operatorWriteDepth > 0
6600
- }) : context;
6949
+ if (secrets !== void 0) {
6950
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6951
+ secrets,
6952
+ addonTree: () => this.addonSecretTree(),
6953
+ deviceTree: () => this.deviceSecretTree(),
6954
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6955
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6956
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6957
+ });
6958
+ this._ctx = wrapped;
6959
+ this._secretSettings = handle;
6960
+ } else {
6961
+ this._ctx = context;
6962
+ this._secretSettings = null;
6963
+ }
6601
6964
  await this.resolveConfig();
6602
6965
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6603
6966
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6714,11 +7077,8 @@ var BaseAddon = class {
6714
7077
  async getGlobalSettings(overlay, cap, nodeId) {
6715
7078
  const schema = this.globalSettingsSchema(cap);
6716
7079
  if (!schema) return { sections: [] };
6717
- const projected = await this.resolveGlobalStore(nodeId, cap);
6718
- return hydrateSchema(schema, overlay ? {
6719
- ...projected,
6720
- ...overlay
6721
- } : projected, { inlineSecretsAsViews: true });
7080
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7081
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6722
7082
  }
6723
7083
  /**
6724
7084
  * The integration-level view of this addon's settings: exactly the sections
@@ -6763,7 +7123,7 @@ var BaseAddon = class {
6763
7123
  });
6764
7124
  }
6765
7125
  if (sections.length === 0) return null;
6766
- const projected = await this.resolveGlobalStore(nodeId);
7126
+ const projected = await this.readRawProjectedStore(nodeId);
6767
7127
  return hydrateSchema({
6768
7128
  ...schema,
6769
7129
  sections
@@ -6780,12 +7140,50 @@ var BaseAddon = class {
6780
7140
  * the store for custom option logic (option narrowing, value snapping) to
6781
7141
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6782
7142
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7143
+ *
7144
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7145
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7146
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7147
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7148
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7149
+ * resolved blob back is a no-op for every unchanged secret.
6783
7150
  */
6784
7151
  async resolveGlobalStore(nodeId, cap) {
6785
7152
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7153
+ return this.projectForNode(raw, nodeId, cap);
7154
+ }
7155
+ projectForNode(store, nodeId, cap) {
6786
7156
  const keys = this.perNodeKeys(cap);
6787
7157
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6788
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7158
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7159
+ }
7160
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7161
+ async readRawProjectedStore(nodeId, cap) {
7162
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7163
+ return this.projectForNode(raw, nodeId, cap);
7164
+ }
7165
+ /**
7166
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7167
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7168
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7169
+ * its value.
7170
+ */
7171
+ async overlayKeepingMarkers(stored, overlay) {
7172
+ const secrets = this._ctx?.secrets;
7173
+ const merged = {
7174
+ ...stored,
7175
+ ...overlay
7176
+ };
7177
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7178
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7179
+ unresolved: "keep-marker",
7180
+ ownedBy: secrets.owner
7181
+ });
7182
+ for (const key of Object.keys(overlay)) {
7183
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7184
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7185
+ }
7186
+ return merged;
6789
7187
  }
6790
7188
  /**
6791
7189
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6850,8 +7248,12 @@ var BaseAddon = class {
6850
7248
  async clearSecrets(keys, nodeId) {
6851
7249
  const tree = this.addonSecretTree();
6852
7250
  const keychain = this._ctx?.secrets !== void 0;
7251
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6853
7252
  const patch = {};
6854
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7253
+ for (const key of keys) {
7254
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7255
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7256
+ }
6855
7257
  await this.applyGlobalPatch(patch, nodeId);
6856
7258
  }
6857
7259
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6859,7 +7261,11 @@ var BaseAddon = class {
6859
7261
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6860
7262
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6861
7263
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6862
- await this._ctx?.settings?.writeAddonStore(scoped);
7264
+ const handle = this._secretSettings;
7265
+ if (handle !== null) {
7266
+ const { changed } = await handle.writeAddonStore(scoped);
7267
+ if (!changed) return;
7268
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6863
7269
  if (target !== localNode) return;
6864
7270
  await this.resolveConfig();
6865
7271
  await this.onConfigChanged();
@@ -6912,7 +7318,7 @@ var BaseAddon = class {
6912
7318
  async getDeviceSettings(deviceId) {
6913
7319
  const schema = this.deviceSettingsSchema();
6914
7320
  if (!schema) return { sections: [] };
6915
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7321
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6916
7322
  }
6917
7323
  async updateDeviceSettings(deviceId, patch) {
6918
7324
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7084,7 +7490,7 @@ var BaseAddon = class {
7084
7490
  key,
7085
7491
  schema,
7086
7492
  fallback,
7087
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7493
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7088
7494
  write: async (patch) => {
7089
7495
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7090
7496
  },
@@ -7146,6 +7552,23 @@ var BaseAddon = class {
7146
7552
  }
7147
7553
  return value;
7148
7554
  }
7555
+ /**
7556
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7557
+ * keychain the context's own view is already raw.
7558
+ */
7559
+ rawSettings() {
7560
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7561
+ }
7562
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7563
+ logUnresolvedRead(unresolved) {
7564
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7565
+ if (fresh.length === 0) return;
7566
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7567
+ 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) => ({
7568
+ ref: u.ref,
7569
+ reason: u.reason
7570
+ })) } });
7571
+ }
7149
7572
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7150
7573
  scheduleSecretReresolve(delayMs) {
7151
7574
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7172,7 +7595,7 @@ var BaseAddon = class {
7172
7595
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7173
7596
  */
7174
7597
  async readAddonStoreWithRetry() {
7175
- const settings = this._ctx?.settings;
7598
+ const settings = this.rawSettings();
7176
7599
  if (!settings) return {};
7177
7600
  const delaysMs = [
7178
7601
  150,
@@ -8984,6 +9407,16 @@ var CompositionSchema = object({
8984
9407
  seen.add(feature.cap);
8985
9408
  });
8986
9409
  });
9410
+ var NodeColorIdSchema = _enum([
9411
+ "node-a",
9412
+ "node-b",
9413
+ "node-c",
9414
+ "node-d",
9415
+ "node-e",
9416
+ "node-f",
9417
+ "node-g",
9418
+ "node-h"
9419
+ ]);
8987
9420
  new Set([
8988
9421
  "track",
8989
9422
  "face",
@@ -9475,6 +9908,278 @@ var CameraSwitchGroupSchema = object({
9475
9908
  fetchedAt: number()
9476
9909
  });
9477
9910
  /**
9911
+ * The trainer contract — what the hub hands the cloud trainer and what it
9912
+ * gets back (cloud training, D805+).
9913
+ *
9914
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
9915
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
9916
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
9917
+ * lines on stdout. These schemas are the hub's half of that boundary; the
9918
+ * trainer's pydantic models (and the JSON Schemas generated from them under
9919
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
9920
+ * change there, in the same piece of work.
9921
+ *
9922
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
9923
+ * orchestrator fills every field of a job spec explicitly.
9924
+ */
9925
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
9926
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
9927
+ /** What the trainer can export. Edge TPU is a later, separate image. */
9928
+ var TrainingExportSchema = _enum([
9929
+ "onnx",
9930
+ "openvino-fp16",
9931
+ "openvino-int8",
9932
+ "coreml-fp16"
9933
+ ]);
9934
+ var FloorsSchema = record(string(), number().min(0).max(1));
9935
+ object({
9936
+ schema: literal(TRAINING_JOB_SCHEMA),
9937
+ jobKey: string().uuid(),
9938
+ target: object({
9939
+ kind: literal("detector"),
9940
+ step: literal("object-detection")
9941
+ }),
9942
+ base: object({
9943
+ modelId: string().min(1),
9944
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
9945
+ weights: string().min(1),
9946
+ imgsz: number().int().positive()
9947
+ }),
9948
+ baseline: object({
9949
+ modelId: string().min(1),
9950
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
9951
+ onnxUrl: string().url(),
9952
+ imgsz: number().int().positive(),
9953
+ floors: FloorsSchema
9954
+ }),
9955
+ dataset: object({
9956
+ versionId: string().min(1),
9957
+ annotationHash: string(),
9958
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
9959
+ sha256: string().regex(/^[0-9a-f]{64}$/)
9960
+ }),
9961
+ split: object({
9962
+ holdoutCameras: array(number().int()),
9963
+ /** When no camera is held out: the last N days of every camera. */
9964
+ holdoutLastDays: number().int().nonnegative(),
9965
+ valFraction: number().min(0).max(.5),
9966
+ seed: number().int()
9967
+ }),
9968
+ hyper: object({
9969
+ epochs: number().int().positive(),
9970
+ batch: number().int().positive(),
9971
+ lr0: number().positive(),
9972
+ /** Layers frozen from the start of the backbone; 0 = none. */
9973
+ freeze: number().int().nonnegative(),
9974
+ patience: number().int().nonnegative(),
9975
+ seed: number().int()
9976
+ }),
9977
+ replay: object({
9978
+ source: literal("coco2017"),
9979
+ count: number().int().nonnegative()
9980
+ }),
9981
+ exports: array(TrainingExportSchema).min(1),
9982
+ calibration: object({ maxFrames: number().int().positive() }),
9983
+ floors: object({
9984
+ minSupport: number().int().positive(),
9985
+ clamp: number().min(0).max(1)
9986
+ }),
9987
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
9988
+ catalog: object({
9989
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
9990
+ name: string().min(1).max(160)
9991
+ })
9992
+ });
9993
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
9994
+ var TrainingResultFileSchema = object({
9995
+ path: string().min(1),
9996
+ bytes: number().int().nonnegative(),
9997
+ sha256: string().regex(/^[0-9a-f]{64}$/),
9998
+ format: _enum([
9999
+ "onnx",
10000
+ "openvino",
10001
+ "coreml",
10002
+ "pt"
10003
+ ]),
10004
+ variant: _enum(["base", "int8"])
10005
+ });
10006
+ var DraftFormatSchema = object({
10007
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
10008
+ url: string().min(1),
10009
+ sizeMB: number().nonnegative(),
10010
+ isDirectory: boolean().optional(),
10011
+ files: array(string()).optional(),
10012
+ runtimes: array(literal("python")).optional(),
10013
+ revision: string().min(1)
10014
+ });
10015
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
10016
+ var TrainingCatalogDraftSchema = object({
10017
+ id: string().min(1),
10018
+ name: string().min(1),
10019
+ description: string(),
10020
+ labels: array(unknown()),
10021
+ inputSize: object({
10022
+ width: number().int().positive(),
10023
+ height: number().int().positive()
10024
+ }),
10025
+ preprocessMode: literal("letterbox"),
10026
+ defaultClassFloors: FloorsSchema,
10027
+ formats: object({
10028
+ onnx: DraftFormatSchema.optional(),
10029
+ openvino: DraftFormatSchema.optional(),
10030
+ coreml: DraftFormatSchema.optional()
10031
+ })
10032
+ });
10033
+ /** One class of one model's holdout report (the eval harness's summary). */
10034
+ var TrainingEvalClassSchema = object({
10035
+ positives: number().int(),
10036
+ floor: number().nullable(),
10037
+ tp: number().int(),
10038
+ fp: number().int(),
10039
+ fn: number().int(),
10040
+ precision: number().nullable(),
10041
+ recall: number().nullable(),
10042
+ ap50: number().nullable(),
10043
+ recallByCamera: record(string(), number().nullable()).optional(),
10044
+ recallByLight: record(string(), number().nullable()).optional(),
10045
+ fpByCamera: record(string(), number()).optional(),
10046
+ smallFound: number().int().optional(),
10047
+ smallTotal: number().int().optional()
10048
+ }).passthrough();
10049
+ var TrainingEvalReportSchema = object({
10050
+ frames: number().int(),
10051
+ classes: record(string(), TrainingEvalClassSchema)
10052
+ }).passthrough();
10053
+ /**
10054
+ * A succeeded result carries every block; a failed one carries the error and
10055
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10056
+ * orchestrator checks the blocks it needs before it trusts a success.
10057
+ */
10058
+ var TrainingResultSchema = object({
10059
+ schema: literal(TRAINING_RESULT_SCHEMA),
10060
+ jobKey: string(),
10061
+ status: _enum(["succeeded", "failed"]),
10062
+ error: object({
10063
+ stage: string(),
10064
+ code: string(),
10065
+ message: string()
10066
+ }).nullable(),
10067
+ trainer: object({
10068
+ version: string(),
10069
+ revision: string()
10070
+ }),
10071
+ toolchain: record(string(), string().nullable()),
10072
+ dataset: object({
10073
+ versionId: string(),
10074
+ annotationHash: string(),
10075
+ sha256: string(),
10076
+ frames: object({
10077
+ train: number().int(),
10078
+ val: number().int(),
10079
+ holdout: number().int()
10080
+ }),
10081
+ holdoutCameras: array(number().int()),
10082
+ replayImages: number().int()
10083
+ }).optional(),
10084
+ training: object({
10085
+ epochsRun: number().int(),
10086
+ bestEpoch: number().int(),
10087
+ bestMap50: number(),
10088
+ bestMap50_95: number(),
10089
+ seconds: number()
10090
+ }).optional(),
10091
+ evaluation: object({
10092
+ holdoutFrames: number().int(),
10093
+ baseline: TrainingEvalReportSchema.nullable(),
10094
+ candidate: TrainingEvalReportSchema.nullable(),
10095
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10096
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10097
+ map50: record(string(), number().nullable())
10098
+ }).optional(),
10099
+ floors: object({
10100
+ baseline: FloorsSchema,
10101
+ candidate: FloorsSchema,
10102
+ candidateInt8: FloorsSchema.nullable(),
10103
+ notes: array(string())
10104
+ }).optional(),
10105
+ int8: object({
10106
+ kept: boolean(),
10107
+ map50Fp16: number().nullable(),
10108
+ map50Int8: number().nullable(),
10109
+ reason: string().nullable()
10110
+ }).optional(),
10111
+ exportsDropped: array(object({
10112
+ export: string(),
10113
+ reason: string()
10114
+ })).optional(),
10115
+ files: array(TrainingResultFileSchema).optional(),
10116
+ bundle: object({
10117
+ path: literal("bundle.tar"),
10118
+ bytes: number().int().nonnegative(),
10119
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10120
+ }).nullable().optional(),
10121
+ catalogDraft: object({
10122
+ base: TrainingCatalogDraftSchema,
10123
+ int8: TrainingCatalogDraftSchema.nullable()
10124
+ }).nullable().optional(),
10125
+ licence: string()
10126
+ });
10127
+ var TrainingStageSchema = _enum([
10128
+ "prepare",
10129
+ "replay",
10130
+ "train",
10131
+ "eval",
10132
+ "export",
10133
+ "package"
10134
+ ]);
10135
+ var EventBase = {
10136
+ v: literal(1),
10137
+ ts: number()
10138
+ };
10139
+ discriminatedUnion("type", [
10140
+ object({
10141
+ ...EventBase,
10142
+ type: literal("stage"),
10143
+ stage: TrainingStageSchema
10144
+ }),
10145
+ object({
10146
+ ...EventBase,
10147
+ type: literal("epoch"),
10148
+ epoch: number().int(),
10149
+ epochs: number().int(),
10150
+ boxLoss: number().nullable().optional(),
10151
+ map50: number().nullable().optional(),
10152
+ map50_95: number().nullable().optional(),
10153
+ etaSec: number().nullable().optional()
10154
+ }),
10155
+ object({
10156
+ ...EventBase,
10157
+ type: literal("metric"),
10158
+ name: string(),
10159
+ value: number()
10160
+ }),
10161
+ object({
10162
+ ...EventBase,
10163
+ type: literal("artifact"),
10164
+ path: string(),
10165
+ bytes: number(),
10166
+ sha256: string()
10167
+ }),
10168
+ object({
10169
+ ...EventBase,
10170
+ type: literal("done"),
10171
+ status: _enum(["succeeded", "failed"]),
10172
+ resultSha256: string().nullable().optional()
10173
+ }),
10174
+ object({
10175
+ ...EventBase,
10176
+ type: literal("error"),
10177
+ stage: string(),
10178
+ code: string(),
10179
+ message: string()
10180
+ })
10181
+ ]);
10182
+ /**
9478
10183
  * What the gate decided about a birth, from the CALLER's point of view.
9479
10184
  *
9480
10185
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11834,7 +12539,9 @@ var AddonHttpRouteSchema = object({
11834
12539
  "authenticated",
11835
12540
  "admin"
11836
12541
  ]).optional(),
11837
- description: string().optional()
12542
+ description: string().optional(),
12543
+ /** The hub limits this route per client address before the handler runs. */
12544
+ rateLimit: _enum(["auth"]).optional()
11838
12545
  });
11839
12546
  /**
11840
12547
  * Cross-process route invocation envelope. The hub captures the
@@ -12539,6 +13246,37 @@ var BackupDestinationInfoSchema = object({
12539
13246
  lastError: string().optional()
12540
13247
  });
12541
13248
  /**
13249
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13250
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13251
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13252
+ * with it off — which restores without a key.
13253
+ */
13254
+ var BackupArchiveEncryptionSchema = object({
13255
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13256
+ scheme: string(),
13257
+ /** 16 hex — the backup key whose secret restores this archive. */
13258
+ keyId: string()
13259
+ });
13260
+ /**
13261
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13262
+ * one new archives are encrypted to, and the retired ones older archives
13263
+ * still need. The secret key is shown once, at `setupEncryption`.
13264
+ */
13265
+ var BackupEncryptionStatusSchema = object({
13266
+ enabled: boolean(),
13267
+ active: object({
13268
+ keyId: string(),
13269
+ publicKey: string(),
13270
+ createdAt: number()
13271
+ }).nullable(),
13272
+ /** Every key ever set up, newest first. */
13273
+ keys: array(object({
13274
+ keyId: string(),
13275
+ createdAt: number(),
13276
+ retiredAt: number().nullable()
13277
+ })).readonly()
13278
+ });
13279
+ /**
12542
13280
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12543
13281
  * Same shape the destination drill-in renders. Sourced from the per-
12544
13282
  * location `manifests.json` (no per-archive tarball read required).
@@ -12550,7 +13288,9 @@ var BackupArchiveEntrySchema = object({
12550
13288
  sizeBytes: number(),
12551
13289
  label: string().optional(),
12552
13290
  /** Top-level locations included in the archive (db, addons, tls, …). */
12553
- locations: array(string()).readonly()
13291
+ locations: array(string()).readonly(),
13292
+ /** Present when the archive is encrypted; restore then needs that key. */
13293
+ encryption: BackupArchiveEncryptionSchema.optional()
12554
13294
  });
12555
13295
  var BackupEntrySchema = object({
12556
13296
  id: string(),
@@ -12559,7 +13299,8 @@ var BackupEntrySchema = object({
12559
13299
  label: string().optional(),
12560
13300
  createdAt: number(),
12561
13301
  sizeBytes: number(),
12562
- locations: array(string()).optional()
13302
+ locations: array(string()).optional(),
13303
+ encryption: BackupArchiveEncryptionSchema.optional()
12563
13304
  });
12564
13305
  var ArchiveEntrySchema = object({
12565
13306
  path: string(),
@@ -12748,10 +13489,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12748
13489
  * this list and skips entries whose path doesn't start with
12749
13490
  * any of them.
12750
13491
  */
12751
- locations: array(string()).optional()
13492
+ locations: array(string()).optional(),
13493
+ /**
13494
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13495
+ * one). The archive is decrypted into the hub's private staging
13496
+ * before the restart; the key is not stored. A wrong or missing key
13497
+ * is refused before the archive is downloaded.
13498
+ */
13499
+ backupSecretKey: string().optional()
12752
13500
  }), _void(), {
12753
13501
  kind: "mutation",
12754
13502
  auth: "admin"
13503
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13504
+ keyId: string(),
13505
+ secretKey: string(),
13506
+ publicKey: string(),
13507
+ createdAt: number(),
13508
+ replacedKeyId: string().nullable()
13509
+ }), {
13510
+ kind: "mutation",
13511
+ auth: "admin"
13512
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13513
+ kind: "mutation",
13514
+ auth: "admin"
13515
+ }), method(object({ backupSecretKey: string() }), object({
13516
+ valid: boolean(),
13517
+ keyId: string().nullable(),
13518
+ /** The hub knows this key (active or retired). */
13519
+ known: boolean(),
13520
+ /** It is the key new archives are encrypted to. */
13521
+ active: boolean(),
13522
+ error: string().optional()
13523
+ }), {
13524
+ kind: "mutation",
13525
+ auth: "admin"
12755
13526
  }), method(object({
12756
13527
  destinationId: string(),
12757
13528
  backupId: string()
@@ -14477,7 +15248,60 @@ var CustomModelDescriptorSchema = object({
14477
15248
  stepId: string(),
14478
15249
  entry: ModelCatalogEntrySchema
14479
15250
  });
14480
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15251
+ /** One regular file of an imported bundle, as the producer measured it. */
15252
+ var ModelBundleFileSchema = object({
15253
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15254
+ path: string().min(1),
15255
+ bytes: number().int().nonnegative(),
15256
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15257
+ });
15258
+ var ImportModelBundleInputSchema = object({
15259
+ /** The registry provider that keeps the model (Model Studio). */
15260
+ addonId: string(),
15261
+ stepId: string().min(1),
15262
+ /**
15263
+ * The catalog rows to register, complete, every format URL already
15264
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15265
+ * bundle may carry several rows (a base and its INT8 variant).
15266
+ */
15267
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15268
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15269
+ bundle: object({
15270
+ ticket: PeerBytesTicketSchema,
15271
+ bytes: number().int().positive(),
15272
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15273
+ }),
15274
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15275
+ files: array(ModelBundleFileSchema).min(1).max(64),
15276
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15277
+ distribute: boolean()
15278
+ });
15279
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15280
+ kind: literal("imported"),
15281
+ modelIds: array(string()).readonly(),
15282
+ distributed: array(object({
15283
+ modelId: string(),
15284
+ nodeId: string(),
15285
+ format: _enum(MODEL_FORMATS),
15286
+ ok: boolean(),
15287
+ error: string().optional()
15288
+ })).readonly()
15289
+ }), object({
15290
+ kind: literal("refused"),
15291
+ reason: _enum([
15292
+ "transfer-failed",
15293
+ "checksum-mismatch",
15294
+ "bundle-mismatch",
15295
+ "invalid-entry",
15296
+ "id-taken"
15297
+ ]),
15298
+ detail: string()
15299
+ })]);
15300
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15301
+ kind: "mutation",
15302
+ auth: "admin",
15303
+ timeoutMs: 30 * 6e4
15304
+ });
14481
15305
  /**
14482
15306
  * Query filter for settings-store collections.
14483
15307
  */
@@ -14956,6 +15780,35 @@ var KeychainKeySourceSchema = object({
14956
15780
  */
14957
15781
  sharesBackupWithDatabase: boolean()
14958
15782
  });
15783
+ /**
15784
+ * One keychain reset, as the Secrets page reports it until the operator
15785
+ * acknowledges it. Never a value: refs, counts and table names only.
15786
+ */
15787
+ var KeychainResetRecordSchema = object({
15788
+ id: string(),
15789
+ at: number(),
15790
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15791
+ actor: string(),
15792
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15793
+ lockedReason: string().nullable(),
15794
+ /** Values moved into the archive table (ciphertext under the lost key). */
15795
+ archived: number().int(),
15796
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15797
+ archivedCollection: string().nullable(),
15798
+ /**
15799
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15800
+ * so the archive can still be opened if the lost master key turns up.
15801
+ */
15802
+ archivedKeysCollection: string().nullable(),
15803
+ /**
15804
+ * `system-settings` keys whose marker the reset cleared — the cluster
15805
+ * secret's: a marker left pointing at an archived value would refuse every
15806
+ * agent forever (D797).
15807
+ */
15808
+ clearedSettingsKeys: array(string()).readonly(),
15809
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15810
+ acknowledgedAt: number().nullable()
15811
+ });
14959
15812
  var KeychainStatusSchema = object({
14960
15813
  keychain: KeychainStateSchema,
14961
15814
  /** The source of the master key in use; `null` while locked. */
@@ -14973,7 +15826,9 @@ var KeychainStatusSchema = object({
14973
15826
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
14974
15827
  retiredWraps: number().int(),
14975
15828
  recoveryKeyDownloadedAt: number().nullable(),
14976
- secretCount: number().int()
15829
+ secretCount: number().int(),
15830
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15831
+ lastReset: KeychainResetRecordSchema.nullable()
14977
15832
  });
14978
15833
  /**
14979
15834
  * Whether a stored value is still pointed at by its owner's settings.
@@ -14995,17 +15850,26 @@ var KeychainAuditActionSchema = _enum([
14995
15850
  "download-recovery-key",
14996
15851
  "delete-orphans",
14997
15852
  "reset",
15853
+ "acknowledge-reset",
14998
15854
  "initialize"
14999
15855
  ]);
15000
15856
  var KeychainAuditEntrySchema = object({
15001
15857
  id: string(),
15002
15858
  at: number(),
15003
15859
  action: KeychainAuditActionSchema,
15004
- /** `addon:<id>` | `user:<id>` | `system`. */
15860
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
15005
15861
  actor: string(),
15006
15862
  ref: string().nullable(),
15007
15863
  detail: string().nullable()
15008
15864
  });
15865
+ var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
15866
+ /**
15867
+ * Secrets the HUB itself holds (owner `system`) that no settings form shows:
15868
+ * `jwt-signing-key` — the session signing key (D797). It is always "in use",
15869
+ * never an orphan; it is generated on a fresh hub and replaced only through
15870
+ * {@link keychainAdminCapability.methods.setSystemSecret}.
15871
+ */
15872
+ var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
15009
15873
  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({
15010
15874
  value: string(),
15011
15875
  version: number().int()
@@ -15013,6 +15877,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15013
15877
  kind: "mutation",
15014
15878
  auth: "admin",
15015
15879
  caller: "required"
15880
+ }), method(object({
15881
+ name: SystemHeldSecretNameSchema,
15882
+ value: string().min(16)
15883
+ }), object({
15884
+ ref: string(),
15885
+ version: number().int()
15886
+ }), {
15887
+ kind: "mutation",
15888
+ auth: "admin",
15889
+ caller: "required"
15016
15890
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
15017
15891
  deleted: array(string()).readonly(),
15018
15892
  kept: array(object({
@@ -15042,13 +15916,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15042
15916
  kind: "mutation",
15043
15917
  auth: "admin",
15044
15918
  caller: "required"
15045
- }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15919
+ }), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
15046
15920
  archivedCollection: string().nullable(),
15047
15921
  archived: number().int()
15048
15922
  }), {
15049
15923
  kind: "mutation",
15050
15924
  auth: "admin",
15051
15925
  caller: "required"
15926
+ }), method(object({}), object({
15927
+ reset: KeychainResetRecordSchema.nullable(),
15928
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15929
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15930
+ kind: "mutation",
15931
+ auth: "admin",
15932
+ caller: "required"
15052
15933
  });
15053
15934
  method(_void(), object({
15054
15935
  id: string(),
@@ -17597,14 +18478,14 @@ var LlmProfileSchema = object({
17597
18478
  /** ConfigUISchema tree passed through untyped on the wire (the
17598
18479
  * notification-output `ConfigSchemaPassthrough` precedent at
17599
18480
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
17600
- var ConfigSchemaPassthrough$1 = unknown();
18481
+ var ConfigSchemaPassthrough$3 = unknown();
17601
18482
  var LlmProfileKindDescriptorSchema = object({
17602
18483
  kind: LlmProfileKindSchema,
17603
18484
  label: string(),
17604
18485
  icon: string(),
17605
18486
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
17606
18487
  addonId: string(),
17607
- configSchema: ConfigSchemaPassthrough$1
18488
+ configSchema: ConfigSchemaPassthrough$3
17608
18489
  });
17609
18490
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
17610
18491
  var LlmDefaultSchema = object({
@@ -17882,7 +18763,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17882
18763
  * `login-method` — collection cap through which auth addons contribute
17883
18764
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17884
18765
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17885
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18766
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17886
18767
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17887
18768
  * procedure aggregates them for the unauthenticated login page.
17888
18769
  *
@@ -17890,8 +18771,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17890
18771
  *
17891
18772
  * - `redirect` — a declarative button. The login page renders a generic
17892
18773
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17893
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17894
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18774
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17895
18775
  * login page needs NO change.
17896
18776
  *
17897
18777
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -17910,8 +18790,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17910
18790
  * decision.
17911
18791
  *
17912
18792
  * Every contribution carries a `stage`:
17913
- * - `primary` — shown on the first credentials screen (OIDC /
17914
- * magic-link buttons; a future usernameless passkey).
18793
+ * - `primary` — shown on the first credentials screen (OIDC
18794
+ * buttons; a usernameless passkey).
17915
18795
  * - `second-factor` — shown AFTER the password leg, gated on the
17916
18796
  * returned `factors` (passkey-as-2FA today).
17917
18797
  *
@@ -17938,7 +18818,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17938
18818
  * The provider names an external identity a signed-in user can link to
17939
18819
  * their own account (D782): `auth.listLinkableProviders` /
17940
18820
  * `beginExternalLink` offer exactly the redirect methods that set this,
17941
- * whatever their id. Absent / false — a login button only (magic-link).
18821
+ * whatever their id. Absent / false — a login button only.
17942
18822
  */
17943
18823
  linkable: boolean().optional()
17944
18824
  }),
@@ -18726,7 +19606,7 @@ var TargetKindCapsSchema = object({
18726
19606
  * the union is large and not meant for runtime validation here; the exported
18727
19607
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
18728
19608
  */
18729
- var ConfigSchemaPassthrough = unknown();
19609
+ var ConfigSchemaPassthrough$2 = unknown();
18730
19610
  var TargetKindSchema = object({
18731
19611
  kind: string(),
18732
19612
  label: string(),
@@ -18763,7 +19643,7 @@ var TargetKindSchema = object({
18763
19643
  * its raster path, which is the safe default for an unknown image.
18764
19644
  */
18765
19645
  iconMediaType: string().optional(),
18766
- configSchema: ConfigSchemaPassthrough,
19646
+ configSchema: ConfigSchemaPassthrough$2,
18767
19647
  /**
18768
19648
  * The config keys that decide WHERE this kind's secrets are sent (server,
18769
19649
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -21793,8 +22673,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21793
22673
  * `super_admin` — collapsed onto the single boolean because every
21794
22674
  * non-admin caller is governed by the same scope-check rules; the
21795
22675
  * distinction was only ever used to route role-specific procedures
21796
- * which we no longer have. Agents are admin sessions issued via
21797
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22676
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21798
22677
  * with `isAdmin: false` + an explicit scope list.
21799
22678
  */
21800
22679
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -22101,6 +22980,61 @@ var OauthIntegrationDescriptorSchema = object({
22101
22980
  });
22102
22981
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
22103
22982
  /**
22983
+ * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
22984
+ *
22985
+ * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
22986
+ * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
22987
+ * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
22988
+ * immutable after create.
22989
+ */
22990
+ var ConfigSchemaPassthrough$1 = unknown();
22991
+ var OidcConnectionSchema = object({
22992
+ id: string().min(1),
22993
+ displayName: string(),
22994
+ icon: string(),
22995
+ issuerUrl: string(),
22996
+ clientId: string(),
22997
+ /** Client id + secret present — never the secret value. */
22998
+ configured: boolean(),
22999
+ /**
23000
+ * Values for the connection form schema. `clientSecret` is a keychain
23001
+ * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
23002
+ */
23003
+ formValues: record(string(), unknown()).optional()
23004
+ });
23005
+ /**
23006
+ * Patch one connection. Omitted or empty `clientSecret` keeps the stored
23007
+ * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
23008
+ */
23009
+ var OidcConnectionUpdateInputSchema = object({
23010
+ id: string().min(1),
23011
+ displayName: string().min(1),
23012
+ icon: string().optional(),
23013
+ issuerUrl: string().optional(),
23014
+ clientId: string().optional(),
23015
+ clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
23016
+ redirectUri: string().optional(),
23017
+ scopes: string().optional(),
23018
+ usernameClaim: _enum([
23019
+ "preferred_username",
23020
+ "email",
23021
+ "sub"
23022
+ ]).optional()
23023
+ });
23024
+ method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
23025
+ id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
23026
+ displayName: string().min(1)
23027
+ }), object({ id: string() }), {
23028
+ kind: "mutation",
23029
+ auth: "admin"
23030
+ }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
23031
+ kind: "mutation",
23032
+ auth: "admin"
23033
+ }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
23034
+ kind: "mutation",
23035
+ auth: "admin"
23036
+ });
23037
+ /**
22104
23038
  * What started a camera's onboard motion (D672). `camera` is the camera's own
22105
23039
  * firmware; `sensor` is a device the operator ATTACHED to it. Absent on the
22106
23040
  * wire means the camera: only the camera-sensors bridge ever says `sensor`.
@@ -23457,21 +24391,69 @@ var RetrainFrameListSchema = object({
23457
24391
  /** What the page pre-selects — the native key frame when one survives. */
23458
24392
  autoPickMediaId: number().int().optional()
23459
24393
  });
24394
+ /** Exclusive partition of a corpus copy's annotation progress (design §4.2). */
24395
+ var RetrainFrameWorkStateSchema = _enum([
24396
+ "unannotated",
24397
+ "annotated",
24398
+ "complete"
24399
+ ]);
24400
+ /**
24401
+ * Filters for paginated corpus list, KPI, and matching export (design §4.4).
24402
+ * Every narrowing field is ANDed; omitted fields impose no constraint.
24403
+ */
24404
+ var RetrainCorpusFilterSchema = object({
24405
+ workState: RetrainFrameWorkStateSchema.optional(),
24406
+ deviceIds: array(number()).max(500).optional(),
24407
+ /** When set, only frames in this named collection. */
24408
+ collectionId: string().optional(),
24409
+ /** Frames that carry at least one saved annotation in one of these classes. */
24410
+ classes: array(RetrainMacroClassSchema).optional(),
24411
+ page: number().int().positive().default(1),
24412
+ pageSize: number().int().positive().max(100).default(50)
24413
+ });
24414
+ var RetrainCorpusPageSchema = object({
24415
+ frames: array(RetrainFrameSchema.extend({ workState: RetrainFrameWorkStateSchema })).readonly(),
24416
+ total: number().int().nonnegative(),
24417
+ page: number().int().positive(),
24418
+ pageSize: number().int().positive()
24419
+ });
24420
+ var RetrainCorpusKpiCameraRowSchema = object({
24421
+ deviceId: number(),
24422
+ unannotated: number().int().nonnegative(),
24423
+ annotated: number().int().nonnegative(),
24424
+ complete: number().int().nonnegative(),
24425
+ /** This camera's `complete` count divided by corpus `total`, in `[0,1]`.
24426
+ * `null` when the corpus is empty (no ratio). */
24427
+ pctOfCorpus: number().min(0).max(1).nullable()
24428
+ });
24429
+ var RetrainCorpusKpiSchema = object({
24430
+ total: number().int().nonnegative(),
24431
+ unannotated: number().int().nonnegative(),
24432
+ annotated: number().int().nonnegative(),
24433
+ complete: number().int().nonnegative(),
24434
+ cameras: array(RetrainCorpusKpiCameraRowSchema).readonly()
24435
+ });
23460
24436
  /**
23461
24437
  * Which frames an annotated export carries. Every field narrows; an empty
23462
- * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23463
- * list owned by whoever trains (the training orchestrator), so `frameIds` is
23464
- * the primitive a version export uses; `batchId` re-selects what an earlier
23465
- * export carried (`exportedInBatch`).
24438
+ * filter is every annotated copy. `frameIds` is the primitive a job or
24439
+ * download uses; `batchId` re-selects what an earlier export carried
24440
+ * (`exportedInBatch`). Frozen dataset versions were removed — live selection
24441
+ * resolves to `frameIds` at plan/start.
23466
24442
  */
23467
24443
  var RetrainExportFilterSchema = object({
23468
24444
  deviceIds: array(number()).optional(),
23469
24445
  frameIds: array(string()).max(2e4).optional(),
23470
24446
  /** Only frames in at least one of these named collections. */
23471
24447
  collectionIds: array(string()).max(200).optional(),
24448
+ /** Single collection (Frames filter bar). ANDed with `collectionIds` when both set. */
24449
+ collectionId: string().optional(),
23472
24450
  batchId: string().optional(),
23473
24451
  /** Only frames the operator marked complete (all subjects boxed). */
23474
- completeOnly: boolean().optional()
24452
+ completeOnly: boolean().optional(),
24453
+ /** Exclusive work-state partition (`workStateOf`); same as the corpus list. */
24454
+ workState: RetrainFrameWorkStateSchema.optional(),
24455
+ /** Frames with at least one saved annotation in one of these classes. */
24456
+ classes: array(RetrainMacroClassSchema).optional()
23475
24457
  });
23476
24458
  /**
23477
24459
  * `frames`: the full frame copies, boxes in `annotations.json`.
@@ -23636,6 +24618,77 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23636
24618
  ]),
23637
24619
  detail: string().optional()
23638
24620
  })]);
24621
+ /** What a dataset version is cut from. Every field narrows. */
24622
+ var RetrainDatasetSelectionSchema = object({
24623
+ deviceIds: array(number()).readonly().optional(),
24624
+ collectionIds: array(string()).max(200).readonly().optional(),
24625
+ frameIds: array(string()).max(2e4).readonly().optional()
24626
+ });
24627
+ /** The counts a dataset is judged by. */
24628
+ var RetrainDatasetStatsSchema = object({
24629
+ frames: number().int(),
24630
+ completeFrames: number().int(),
24631
+ /** `completeFrames / frames`, 0..1. */
24632
+ completeness: number(),
24633
+ /** Boxes to learn (model errors excluded). */
24634
+ subjects: number().int(),
24635
+ modelErrors: number().int(),
24636
+ /** Complete frames with no subject. */
24637
+ hardNegatives: number().int(),
24638
+ /** Subjects per class × camera × day/night. */
24639
+ cells: array(object({
24640
+ macroClass: string(),
24641
+ deviceId: number(),
24642
+ lighting: _enum([
24643
+ "day",
24644
+ "night",
24645
+ "unknown"
24646
+ ]),
24647
+ subjects: number().int(),
24648
+ frames: number().int()
24649
+ })).readonly(),
24650
+ cameras: array(object({
24651
+ deviceId: number(),
24652
+ frames: number().int(),
24653
+ completeFrames: number().int()
24654
+ })).readonly()
24655
+ });
24656
+ object({
24657
+ id: string(),
24658
+ name: string(),
24659
+ createdAt: number(),
24660
+ selection: RetrainDatasetSelectionSchema,
24661
+ layout: RetrainExportLayoutSchema,
24662
+ completeOnly: boolean(),
24663
+ frameCount: number().int(),
24664
+ annotationHash: string(),
24665
+ manifestSchema: string(),
24666
+ stats: RetrainDatasetStatsSchema
24667
+ });
24668
+ /**
24669
+ * Live training corpus criteria — same shape as `TrainingCorpusSelection` on
24670
+ * the training cap. Resolved here so plan/start and the annotated export share
24671
+ * one definition of "the frames" (`buildRetrainExportPlan`).
24672
+ */
24673
+ var RetrainTrainingCorpusSelectionSchema = object({
24674
+ collectionIds: array(string()).min(1),
24675
+ workState: _enum([
24676
+ "complete",
24677
+ "annotated_or_complete",
24678
+ "any_annotated"
24679
+ ]).default("complete")
24680
+ });
24681
+ var RetrainTrainingCorpusResolveResultSchema = discriminatedUnion("kind", [object({
24682
+ kind: literal("resolved"),
24683
+ frameIds: array(string()).max(2e4).readonly(),
24684
+ stats: RetrainDatasetStatsSchema,
24685
+ annotationHash: string(),
24686
+ layout: RetrainExportLayoutSchema
24687
+ }), object({
24688
+ kind: literal("refused"),
24689
+ reason: _enum(["unknown-collection", "no-frames"]),
24690
+ detail: string()
24691
+ })]);
23639
24692
  /** The outcome of a lifecycle move owned by the retrain page. */
23640
24693
  var RetrainTransitionResultSchema = object({
23641
24694
  trackId: string(),
@@ -24341,6 +25394,12 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24341
25394
  }), array(RetrainTrackSchema).readonly(), {
24342
25395
  kind: "query",
24343
25396
  auth: "admin"
25397
+ }), method(RetrainCorpusFilterSchema, RetrainCorpusPageSchema, {
25398
+ kind: "query",
25399
+ auth: "admin"
25400
+ }), method(object({}), RetrainCorpusKpiSchema, {
25401
+ kind: "query",
25402
+ auth: "admin"
24344
25403
  }), method(object({ trackId: string() }), RetrainFrameListSchema, {
24345
25404
  kind: "query",
24346
25405
  auth: "admin"
@@ -24425,6 +25484,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24425
25484
  kind: "mutation",
24426
25485
  auth: "admin",
24427
25486
  timeoutMs: 60 * 6e4
25487
+ }), method(object({
25488
+ filter: RetrainExportFilterSchema,
25489
+ layout: RetrainExportLayoutSchema
25490
+ }), object({
25491
+ ticket: PeerBytesTicketSchema,
25492
+ frames: number().int(),
25493
+ annotations: number().int()
25494
+ }), {
25495
+ kind: "mutation",
25496
+ auth: "admin",
25497
+ timeoutMs: 12e4
24428
25498
  }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24429
25499
  kind: "query",
24430
25500
  auth: "admin"
@@ -24451,6 +25521,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24451
25521
  }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24452
25522
  kind: "query",
24453
25523
  auth: "admin"
25524
+ }), method(RetrainTrainingCorpusSelectionSchema, RetrainTrainingCorpusResolveResultSchema, {
25525
+ kind: "query",
25526
+ auth: "admin",
25527
+ timeoutMs: 6e4
24454
25528
  }), method(object({
24455
25529
  id: string(),
24456
25530
  name: string().max(120)
@@ -25067,11 +26141,14 @@ var HardwareClassIdSchema = _enum([
25067
26141
  "intel-n-series",
25068
26142
  "apple-m-base",
25069
26143
  "apple-m-pro",
26144
+ "amd-phoenix",
25070
26145
  "unknown"
25071
26146
  ]);
25072
26147
  var AcceleratorKindSchema = _enum([
25073
26148
  "intel-npu",
25074
26149
  "intel-igpu",
26150
+ "amd-igpu",
26151
+ "amd-npu",
25075
26152
  "x86-cpu",
25076
26153
  "arm-cpu",
25077
26154
  "apple-ane",
@@ -27001,6 +28078,8 @@ var AgentPipelineSettingsSchema = object({
27001
28078
  * address is wrong (multi-homed host, NAT, custom interface).
27002
28079
  */
27003
28080
  reachableHost: string().optional(),
28081
+ /** Hub-persisted UI colour (`--color-node-*` theme tokens). */
28082
+ color: NodeColorIdSchema.optional(),
27004
28083
  /**
27005
28084
  * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
27006
28085
  * weight, steps}. Absent / all-disabled ⇒ the node's single default
@@ -27550,8 +28629,9 @@ method(object({
27550
28629
  auth: "admin"
27551
28630
  }), method(object({
27552
28631
  agentNodeId: string(),
27553
- reachableHost: string().nullable()
27554
- }), object({ success: literal(true) }), {
28632
+ reachableHost: string().nullable().optional(),
28633
+ color: NodeColorIdSchema.nullable().optional()
28634
+ }).refine((v) => v.reachableHost !== void 0 || v.color !== void 0, { message: "reachableHost or color required" }), object({ success: literal(true) }), {
27555
28635
  kind: "mutation",
27556
28636
  auth: "admin"
27557
28637
  }), method(object({
@@ -28003,8 +29083,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
28003
29083
  * `smtp-provider` — pluggable email delivery surface.
28004
29084
  *
28005
29085
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
28006
- * one for transactional / one for notifications). Consumers (magic-link,
28007
- * notifier addons, …) walk the collection and pick the first
29086
+ * one for transactional / one for notifications). Consumers (notifier
29087
+ * addons, …) walk the collection and pick the first
28008
29088
  * ready provider OR target a specific addonId.
28009
29089
  *
28010
29090
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -28287,7 +29367,7 @@ targets: array(object({
28287
29367
  };
28288
29368
  /**
28289
29369
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
28290
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
29370
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
28291
29371
  * carrying the post-callback claims before redirecting back to
28292
29372
  * `/api/auth/sso/finish`.
28293
29373
  *
@@ -28350,7 +29430,14 @@ var SsoBridgeClaimsSchema = object({
28350
29430
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28351
29431
  * subject is unique only per issuer, so a link is bound to it.
28352
29432
  */
28353
- issuer: string().optional()
29433
+ issuer: string().optional(),
29434
+ /**
29435
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
29436
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
29437
+ * request to present the matching cookie — a login bridge is useless in
29438
+ * any other browser.
29439
+ */
29440
+ browserBinding: string().optional()
28354
29441
  });
28355
29442
  method(object({
28356
29443
  claims: SsoBridgeClaimsSchema,
@@ -30724,7 +31811,7 @@ var CustomActionInputSchema = object({
30724
31811
  action: string().min(1),
30725
31812
  input: unknown()
30726
31813
  });
30727
- method(_void(), array(AddonListItemSchema).readonly()), method(object({
31814
+ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSchema).readonly()), method(object({
30728
31815
  addonId: string(),
30729
31816
  limit: number().min(1).max(500).default(100),
30730
31817
  level: LogLevelSchema$2.optional()
@@ -35794,7 +36881,13 @@ var TopologyNodeSchema = object({
35794
36881
  })).readonly(),
35795
36882
  processes: array(TopologyProcessSchema).readonly(),
35796
36883
  categories: array(TopologyCategorySchema).readonly(),
35797
- rootPackage: TopologyRootPackageSchema.nullable()
36884
+ rootPackage: TopologyRootPackageSchema.nullable(),
36885
+ /**
36886
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
36887
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
36888
+ * for offline rows and when the hub cannot tell.
36889
+ */
36890
+ meshTransport: _enum(["tls", "clear"]).optional()
35798
36891
  });
35799
36892
  var CapUsageEdgeSchema = object({
35800
36893
  callerAddonId: string(),
@@ -36207,6 +37300,7 @@ var OsdNamedTemplateSchema = object({
36207
37300
  });
36208
37301
  /** Where a slot's value comes from. */
36209
37302
  var OsdSourceSchema = discriminatedUnion("kind", [
37303
+ object({ kind: literal("none") }),
36210
37304
  object({
36211
37305
  kind: literal("static"),
36212
37306
  text: string().max(64)
@@ -36333,6 +37427,13 @@ method(object({ deviceId: number().int() }), object({
36333
37427
  }), object({ success: literal(true) }), {
36334
37428
  kind: "mutation",
36335
37429
  auth: "admin"
37430
+ }), method(object({
37431
+ deviceId: number().int(),
37432
+ slotId: string().min(1),
37433
+ enabled: boolean()
37434
+ }), object({ success: literal(true) }), {
37435
+ kind: "mutation",
37436
+ auth: "admin"
36336
37437
  }), method(object({
36337
37438
  sourceDeviceId: number().int(),
36338
37439
  targetDeviceId: number().int()
@@ -36764,7 +37865,15 @@ var GpuInfoSchema = object({
36764
37865
  name: string(),
36765
37866
  memoryMB: number().optional()
36766
37867
  });
36767
- var NpuInfoSchema = object({ type: _enum(["apple-ane", "intel-npu"]) });
37868
+ var NpuInfoSchema = object({
37869
+ type: _enum([
37870
+ "apple-ane",
37871
+ "intel-npu",
37872
+ "amd-xdna"
37873
+ ]),
37874
+ name: string().optional(),
37875
+ generation: _enum(["xdna1", "xdna2"]).optional()
37876
+ });
36768
37877
  var CoralInfoSchema = object({
36769
37878
  type: literal("coral-edgetpu"),
36770
37879
  bus: string().optional()
@@ -40617,16 +41726,6 @@ var ApiKeySummarySchema = object({
40617
41726
  createdAt: number(),
40618
41727
  lastUsedAt: number().optional()
40619
41728
  });
40620
- var CreateApiKeyInputSchema = object({
40621
- label: string(),
40622
- isAdmin: boolean().default(false),
40623
- allowedProviders: union([array(string()), literal("*")]).optional(),
40624
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
40625
- });
40626
- var CreateApiKeyResultSchema = object({
40627
- token: string(),
40628
- record: ApiKeySummarySchema
40629
- });
40630
41729
  var ScopedTokenSummarySchema = object({
40631
41730
  id: string(),
40632
41731
  userId: string(),
@@ -40725,17 +41824,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40725
41824
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
40726
41825
  kind: "mutation",
40727
41826
  access: "view"
40728
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
40729
- kind: "mutation",
40730
- auth: "admin",
40731
- access: "create"
40732
- }), method(object({ id: string() }), object({ success: literal(true) }), {
41827
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
40733
41828
  kind: "mutation",
40734
41829
  auth: "admin",
40735
41830
  access: "delete"
40736
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
40737
- kind: "mutation",
40738
- access: "view"
40739
41831
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
40740
41832
  kind: "mutation",
40741
41833
  auth: "admin",
@@ -40809,15 +41901,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40809
41901
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
40810
41902
  userId: string(),
40811
41903
  issuer: string()
40812
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
40813
- userId: string(),
40814
- issuer: string().min(1),
40815
- label: string().optional()
40816
- }), object({ success: literal(true) }), {
40817
- kind: "mutation",
40818
- auth: "admin",
40819
- access: "create"
40820
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41904
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
40821
41905
  kind: "mutation",
40822
41906
  auth: "admin",
40823
41907
  access: "delete"
@@ -41522,6 +42606,563 @@ var zoneRulesCapability = {
41522
42606
  */
41523
42607
  durability: "restored"
41524
42608
  };
42609
+ /**
42610
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
42611
+ *
42612
+ * A thin, mockable translation layer: it knows how to run a container with a
42613
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
42614
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
42615
+ * those are the `training` orchestrator's (D805). Every rule written there
42616
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
42617
+ * manifest entry and nothing else.
42618
+ *
42619
+ * Collection of provider **types** (addons). Each addon owns zero or more
42620
+ * **entries** (credentials + defaults). Concat-fans: `describe`,
42621
+ * `describeTypes`, `listEntries`, `listJobs`. Single-row work is keyed by
42622
+ * `entryId`; callers also pass the owning `addonId` as the collection
42623
+ * selector (broker posture). Every method is `admin`: these spend money.
42624
+ *
42625
+ * Every cloud object a provider creates is tagged with the orchestrator's
42626
+ * `jobKey`, so a retried submit finds the job it already started instead of
42627
+ * starting a second GPU, and `listJobs` can find orphans.
42628
+ *
42629
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
42630
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
42631
+ * ticket the provider mints (D613).
42632
+ */
42633
+ var TrainingGpuOptionSchema = object({
42634
+ id: string(),
42635
+ label: string(),
42636
+ /** List price, USD per GPU-hour, before any region multiplier. */
42637
+ usdPerHour: number().nonnegative(),
42638
+ vramGb: number().nonnegative()
42639
+ });
42640
+ var TrainingRegionOptionSchema = object({
42641
+ /** `''` = any region (the provider's choice). */
42642
+ id: string(),
42643
+ label: string(),
42644
+ priceMultiplier: number().positive()
42645
+ });
42646
+ /**
42647
+ * The provider's per-entry settings, as the orchestrator reads them. They
42648
+ * live on the PROVIDER addon's entry (operator decision 2026-10-08: they
42649
+ * depend on the user's account), never hard-coded in the orchestrator.
42650
+ */
42651
+ var TrainingProviderDefaultsSchema = object({
42652
+ gpuType: string(),
42653
+ region: string(),
42654
+ costCapUsd: number().nonnegative(),
42655
+ maxRuntimeSec: number().int().positive(),
42656
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
42657
+ failedDatasetGraceHours: number().nonnegative()
42658
+ });
42659
+ /**
42660
+ * Entry form schema for a provider type — same seam as notification
42661
+ * `TargetKind.configSchema` (`z.unknown()` at the wire; callers tighten to
42662
+ * {@link ConfigUISchema}). Drives `ConfigFormBuilder` on Training → Providers.
42663
+ */
42664
+ var ConfigSchemaPassthrough = unknown();
42665
+ /** One creatable provider type, for the Add-entry dialog. */
42666
+ var TrainingProviderTypeSchema = object({
42667
+ typeId: string(),
42668
+ label: string(),
42669
+ /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
42670
+ iconAsset: string(),
42671
+ /** Owning `training-provider` addon — collection selector for createEntry. */
42672
+ addonId: string(),
42673
+ /**
42674
+ * Fields for one entry of this type (credentials + defaults). Absent on a
42675
+ * type that only needs a name. Password fields are keychain-backed on the
42676
+ * provider addon (`secretStatePaths`), not D634 plaintext.
42677
+ */
42678
+ configSchema: ConfigSchemaPassthrough.optional()
42679
+ });
42680
+ /** One configured account / workspace under a provider type. */
42681
+ var TrainingProviderEntrySchema = object({
42682
+ entryId: string(),
42683
+ typeId: string(),
42684
+ name: string(),
42685
+ addonId: string(),
42686
+ /** Credentials are present — never the values. */
42687
+ configured: boolean()
42688
+ });
42689
+ var TrainingProviderDescriptorSchema = object({
42690
+ addonId: string(),
42691
+ entryId: string(),
42692
+ typeId: string(),
42693
+ /** Operator-chosen entry name. */
42694
+ name: string(),
42695
+ iconAsset: string(),
42696
+ /** `modal`, `runpod`, `fake`, … — same as typeId for current providers. */
42697
+ kind: string(),
42698
+ label: string(),
42699
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
42700
+ regions: array(TrainingRegionOptionSchema).readonly(),
42701
+ maxDatasetBytes: number().int().positive(),
42702
+ maxRuntimeSec: number().int().positive(),
42703
+ freeTierNote: string().optional(),
42704
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
42705
+ dataResidencyNote: string(),
42706
+ /** Credentials are present — never the values. */
42707
+ configured: boolean(),
42708
+ defaults: TrainingProviderDefaultsSchema,
42709
+ /**
42710
+ * Values for {@link TrainingProviderTypeSchema}'s `configSchema` — password
42711
+ * fields are keychain {@link SecretFieldView} or `null` / `''` (create),
42712
+ * never plaintext. Same hydrate contract as settings forms (D789).
42713
+ */
42714
+ formValues: record(string(), unknown()).optional()
42715
+ });
42716
+ /**
42717
+ * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
42718
+ * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
42719
+ * `{ $secretClear: true }` clears it.
42720
+ */
42721
+ var TrainingProviderUpdateEntryInputSchema = object({
42722
+ entryId: string().min(1),
42723
+ name: string().min(1),
42724
+ tokenId: string().optional(),
42725
+ tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
42726
+ environment: string().optional(),
42727
+ gpuType: string().optional(),
42728
+ region: string().optional(),
42729
+ costCapUsd: number().nonnegative().optional(),
42730
+ maxRuntimeSec: number().int().positive().optional(),
42731
+ failedDatasetGraceHours: number().nonnegative().optional()
42732
+ });
42733
+ var TrainingCredentialCheckSchema = object({
42734
+ ok: boolean(),
42735
+ /** Workspace / account name, when the provider says. */
42736
+ account: string().optional(),
42737
+ reason: _enum([
42738
+ "missing",
42739
+ "invalid",
42740
+ "forbidden",
42741
+ "network",
42742
+ "quota"
42743
+ ]).optional(),
42744
+ detail: string().optional()
42745
+ });
42746
+ var ProviderJobStateSchema = _enum([
42747
+ "pending",
42748
+ "starting",
42749
+ "running",
42750
+ "succeeded",
42751
+ "failed",
42752
+ "cancelled",
42753
+ "lost"
42754
+ ]);
42755
+ var ProviderJobStatusSchema = object({
42756
+ jobKey: string(),
42757
+ providerJobId: string().optional(),
42758
+ state: ProviderJobStateSchema,
42759
+ startedAt: number().optional(),
42760
+ endedAt: number().optional(),
42761
+ exitCode: number().int().optional(),
42762
+ failureReason: string().optional(),
42763
+ gpuType: string(),
42764
+ region: string().optional(),
42765
+ billedSeconds: number().nonnegative(),
42766
+ costUsd: number().nonnegative(),
42767
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
42768
+ costIsEstimate: boolean(),
42769
+ lastFetchedAt: number()
42770
+ });
42771
+ /**
42772
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
42773
+ * image its own way (Modal builds the published Dockerfile at that revision;
42774
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
42775
+ * in `result.json`.
42776
+ */
42777
+ var TrainerSourceRefSchema = object({
42778
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
42779
+ repo: string().min(1),
42780
+ /** A commit sha (never a branch) — the job must be reproducible. */
42781
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
42782
+ });
42783
+ /** Cloud job identity — route with the owning addon's `addonId` selector. */
42784
+ var JobRef = {
42785
+ entryId: string().min(1),
42786
+ jobKey: string().uuid()
42787
+ };
42788
+ var TrainingLogLineSchema = object({
42789
+ ts: number(),
42790
+ text: string()
42791
+ });
42792
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
42793
+ typeId: string().min(1),
42794
+ name: string().min(1)
42795
+ }), object({ entryId: string() }), {
42796
+ kind: "mutation",
42797
+ auth: "admin"
42798
+ }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
42799
+ kind: "mutation",
42800
+ auth: "admin"
42801
+ }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
42802
+ kind: "mutation",
42803
+ auth: "admin"
42804
+ }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
42805
+ kind: "mutation",
42806
+ auth: "admin",
42807
+ timeoutMs: 3e4
42808
+ }), method(object({
42809
+ entryId: string().min(1),
42810
+ gpuType: string(),
42811
+ region: string(),
42812
+ datasetBytes: number().int().nonnegative(),
42813
+ gpuSecondsLow: number().nonnegative(),
42814
+ gpuSecondsHigh: number().nonnegative()
42815
+ }), object({
42816
+ usdLow: number().nonnegative(),
42817
+ usdHigh: number().nonnegative(),
42818
+ notes: array(string()).readonly()
42819
+ }), { auth: "admin" }), method(object({
42820
+ ...JobRef,
42821
+ ticket: PeerBytesTicketSchema
42822
+ }), object({
42823
+ bytes: number().int().nonnegative(),
42824
+ sha256: string()
42825
+ }), {
42826
+ kind: "mutation",
42827
+ auth: "admin",
42828
+ timeoutMs: 120 * 6e4
42829
+ }), method(object({
42830
+ ...JobRef,
42831
+ trainer: TrainerSourceRefSchema,
42832
+ jobSpecJson: string().min(2).max(64e3),
42833
+ gpuType: string(),
42834
+ region: string(),
42835
+ maxRuntimeSec: number().int().positive()
42836
+ }), ProviderJobStatusSchema, {
42837
+ kind: "mutation",
42838
+ auth: "admin",
42839
+ timeoutMs: 30 * 6e4
42840
+ }), method(object(JobRef), ProviderJobStatusSchema, {
42841
+ auth: "admin",
42842
+ timeoutMs: 6e4
42843
+ }), method(object({
42844
+ ...JobRef,
42845
+ cursor: string().optional(),
42846
+ max: number().int().min(1).max(500)
42847
+ }), object({
42848
+ lines: array(TrainingLogLineSchema).readonly(),
42849
+ cursor: string()
42850
+ }), {
42851
+ auth: "admin",
42852
+ timeoutMs: 6e4
42853
+ }), method(object(JobRef), object({ ok: literal(true) }), {
42854
+ kind: "mutation",
42855
+ auth: "admin",
42856
+ timeoutMs: 6e4
42857
+ }), method(object(JobRef), object({
42858
+ found: boolean(),
42859
+ text: string().optional()
42860
+ }), {
42861
+ kind: "mutation",
42862
+ auth: "admin",
42863
+ timeoutMs: 5 * 6e4
42864
+ }), method(object({
42865
+ ...JobRef,
42866
+ path: _enum(["bundle.tar"])
42867
+ }), object({ ticket: PeerBytesTicketSchema }), {
42868
+ kind: "mutation",
42869
+ auth: "admin",
42870
+ timeoutMs: 5 * 6e4
42871
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
42872
+ kind: "mutation",
42873
+ auth: "admin",
42874
+ timeoutMs: 5 * 6e4
42875
+ }), method(object({ entryId: string().min(1).optional() }), array(ProviderJobStatusSchema).readonly(), {
42876
+ auth: "admin",
42877
+ timeoutMs: 2 * 6e4
42878
+ });
42879
+ /**
42880
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
42881
+ * provided by `addon-training`.
42882
+ *
42883
+ * It owns what every provider must agree on, written once:
42884
+ *
42885
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
42886
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
42887
+ * - **The return flow.** Verified artefacts → Model Studio
42888
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
42889
+ * rollback. Nothing is ever registered automatically.
42890
+ *
42891
+ * Plan/start takes a live {@link TrainingCorpusSelection} (collections +
42892
+ * work-state rule); frame ids are resolved via pipeline-analytics at that
42893
+ * moment and snapshotted on the job. No frozen dataset version.
42894
+ *
42895
+ * Every method is `admin`.
42896
+ */
42897
+ /**
42898
+ * Live corpus criteria for plan/start (design §5.2). Default is complete-only.
42899
+ * Frame ids are resolved at plan/start — never a frozen version id.
42900
+ */
42901
+ var TrainingCorpusSelectionSchema = object({
42902
+ collectionIds: array(string()).min(1),
42903
+ /** Default complete-only for v1 */
42904
+ workState: _enum([
42905
+ "complete",
42906
+ "annotated_or_complete",
42907
+ "any_annotated"
42908
+ ]).default("complete")
42909
+ });
42910
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
42911
+ var TrainingBaseModelSchema = object({
42912
+ modelId: string(),
42913
+ label: string(),
42914
+ weights: string(),
42915
+ imgsz: number().int(),
42916
+ baselineOnnxUrl: string(),
42917
+ baselineFloors: record(string(), number()),
42918
+ /** The base the fleet runs most — the UI's default. */
42919
+ recommended: boolean()
42920
+ });
42921
+ var TrainingPresetSchema = _enum([
42922
+ "quick",
42923
+ "standard",
42924
+ "thorough"
42925
+ ]);
42926
+ var TrainingJobRequestSchema = object({
42927
+ /** Live collection + work-state criteria; resolved at plan/start. */
42928
+ selection: TrainingCorpusSelectionSchema,
42929
+ /**
42930
+ * The provider **entry** that runs it (credentials + defaults).
42931
+ * Resolve to an owning addon via `training-provider.describe` / `listEntries`.
42932
+ */
42933
+ entryId: string().min(1),
42934
+ gpuType: string().min(1),
42935
+ region: string(),
42936
+ baseModelId: string().min(1),
42937
+ preset: TrainingPresetSchema,
42938
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
42939
+ freeze: number().int().nonnegative().nullable(),
42940
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
42941
+ holdoutCameras: array(number().int()).nullable()
42942
+ });
42943
+ var TrainingSplitPlanSchema = object({
42944
+ holdoutCameras: array(number().int()).readonly(),
42945
+ /** Used when no camera is held out: the last N days of every camera. */
42946
+ holdoutLastDays: number().int().nonnegative(),
42947
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
42948
+ holdoutSupport: record(string(), number().int()).nullable(),
42949
+ trainSubjects: number().int()
42950
+ });
42951
+ var TrainingRefusalReasonSchema = _enum([
42952
+ "unknown-dataset",
42953
+ "unknown-provider",
42954
+ "provider-not-configured",
42955
+ "unknown-base-model",
42956
+ "unknown-gpu",
42957
+ "dataset-too-large",
42958
+ "no-training-subjects",
42959
+ "job-already-running"
42960
+ ]);
42961
+ var TrainingJobPlanSchema = object({
42962
+ refusal: object({
42963
+ reason: TrainingRefusalReasonSchema,
42964
+ detail: string()
42965
+ }).nullable(),
42966
+ warnings: array(string()).readonly(),
42967
+ split: TrainingSplitPlanSchema.nullable(),
42968
+ estimate: object({
42969
+ datasetBytes: number().int(),
42970
+ uploadMinutesAt20Mbps: number(),
42971
+ gpuSecondsLow: number(),
42972
+ gpuSecondsHigh: number(),
42973
+ usdLow: number(),
42974
+ usdHigh: number(),
42975
+ notes: array(string()).readonly()
42976
+ }).nullable(),
42977
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
42978
+ defaults: object({
42979
+ maxCostUsd: number(),
42980
+ maxRuntimeSec: number().int()
42981
+ }).nullable(),
42982
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
42983
+ dataNotice: string()
42984
+ });
42985
+ /**
42986
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
42987
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
42988
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
42989
+ * result lives after the operator acted on it.
42990
+ */
42991
+ var TrainingJobStateSchema = _enum([
42992
+ "queued",
42993
+ "uploading",
42994
+ "submitted",
42995
+ "starting",
42996
+ "running",
42997
+ "collecting",
42998
+ "ready",
42999
+ "registered",
43000
+ "canary",
43001
+ "failed",
43002
+ "cancelling",
43003
+ "cancelled",
43004
+ "lost",
43005
+ "expired",
43006
+ "discarded"
43007
+ ]);
43008
+ var TrainingFailureReasonSchema = _enum([
43009
+ "cost-cap",
43010
+ "runtime-cap",
43011
+ "upload-failed",
43012
+ "submit-failed",
43013
+ "trainer-failed",
43014
+ "result-invalid",
43015
+ "checksum-mismatch",
43016
+ "fetch-failed",
43017
+ "provider-error",
43018
+ "hub-restart-during-upload"
43019
+ ]);
43020
+ var TrainingProgressPointSchema = object({
43021
+ epoch: number().int(),
43022
+ map50: number().nullable(),
43023
+ map50_95: number().nullable()
43024
+ });
43025
+ var TrainingCanarySchema = object({
43026
+ deviceIds: array(number().int()).readonly(),
43027
+ since: number(),
43028
+ /** Every override the canary replaced, exactly, so rollback restores it. */
43029
+ previous: array(object({
43030
+ deviceId: number().int(),
43031
+ nodeId: string(),
43032
+ deviceKey: string(),
43033
+ patch: object({
43034
+ modelId: string().optional(),
43035
+ settings: record(string(), unknown()).readonly().optional()
43036
+ }).nullable()
43037
+ })).readonly()
43038
+ });
43039
+ var TrainingJobSchema = object({
43040
+ id: string(),
43041
+ idempotencyKey: string(),
43042
+ name: string(),
43043
+ createdAt: number(),
43044
+ updatedAt: number(),
43045
+ state: TrainingJobStateSchema,
43046
+ /**
43047
+ * Shared by every job enqueued together via `startJobBatch`.
43048
+ * `null` for a lone `startJob`. The engine advances queued siblings by this id.
43049
+ */
43050
+ batchId: string().nullable().default(null),
43051
+ stage: TrainingStageSchema.nullable(),
43052
+ failure: object({
43053
+ reason: TrainingFailureReasonSchema,
43054
+ stage: string().nullable(),
43055
+ detail: string()
43056
+ }).nullable(),
43057
+ request: TrainingJobRequestSchema,
43058
+ maxCostUsd: number().nonnegative(),
43059
+ maxRuntimeSec: number().int().positive(),
43060
+ trainer: TrainerSourceRefSchema,
43061
+ datasetLayout: RetrainExportLayoutSchema,
43062
+ /** Frame count snapshotted when the job started (audit; equals `frameIds.length`). */
43063
+ frameCount: number().int().nonnegative(),
43064
+ /** Resolved frame ids at start — the archive ships exactly these. */
43065
+ frameIds: array(string()).max(2e4).readonly(),
43066
+ /** Hash of what those frames taught at start (trainer `dataset.annotationHash`). */
43067
+ annotationHash: string(),
43068
+ dataset: object({
43069
+ bytes: number().int(),
43070
+ sha256: string(),
43071
+ uploadedAt: number()
43072
+ }).nullable(),
43073
+ split: TrainingSplitPlanSchema,
43074
+ provider: object({
43075
+ state: ProviderJobStateSchema.nullable(),
43076
+ providerJobId: string().nullable(),
43077
+ startedAt: number().nullable(),
43078
+ endedAt: number().nullable(),
43079
+ billedSeconds: number(),
43080
+ costUsd: number(),
43081
+ costIsEstimate: boolean(),
43082
+ lastPolledAt: number().nullable()
43083
+ }),
43084
+ progress: object({
43085
+ epoch: number().int().nullable(),
43086
+ epochs: number().int().nullable(),
43087
+ etaSec: number().nullable(),
43088
+ series: array(TrainingProgressPointSchema).readonly()
43089
+ }),
43090
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
43091
+ logTail: array(string()).readonly(),
43092
+ logCursor: string().nullable(),
43093
+ artifacts: object({
43094
+ bundleBytes: number().int(),
43095
+ bundleSha256: string(),
43096
+ fetchedAt: number(),
43097
+ /** When the staged artefacts are deleted from the hub. */
43098
+ expiresAt: number()
43099
+ }).nullable(),
43100
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
43101
+ cloudDatasetDeletedAt: number().nullable(),
43102
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
43103
+ cloudCleanupDueAt: number().nullable(),
43104
+ /** Model ids registered from this job (base, and int8 when kept). */
43105
+ registeredModelIds: array(string()).readonly(),
43106
+ canary: TrainingCanarySchema.nullable()
43107
+ });
43108
+ var IdInput = object({ id: string().min(1) });
43109
+ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
43110
+ auth: "admin",
43111
+ timeoutMs: 6e4
43112
+ }), method(TrainingJobRequestSchema.extend({
43113
+ name: string().min(1).max(120),
43114
+ maxCostUsd: number().positive(),
43115
+ maxRuntimeSec: number().int().positive(),
43116
+ idempotencyKey: string().min(8).max(80)
43117
+ }), discriminatedUnion("kind", [object({
43118
+ kind: literal("started"),
43119
+ job: TrainingJobSchema
43120
+ }), object({
43121
+ kind: literal("refused"),
43122
+ reason: TrainingRefusalReasonSchema,
43123
+ detail: string()
43124
+ })]), {
43125
+ kind: "mutation",
43126
+ auth: "admin",
43127
+ timeoutMs: 12e4
43128
+ }), method(TrainingJobRequestSchema.omit({ baseModelId: true }).extend({
43129
+ baseModelIds: array(string().min(1)).min(1),
43130
+ name: string().min(1).max(120),
43131
+ maxCostUsd: number().positive(),
43132
+ maxRuntimeSec: number().int().positive(),
43133
+ idempotencyKey: string().min(8).max(80)
43134
+ }), discriminatedUnion("kind", [object({
43135
+ kind: literal("started"),
43136
+ batchId: string(),
43137
+ jobs: array(TrainingJobSchema).min(1).readonly()
43138
+ }), object({
43139
+ kind: literal("refused"),
43140
+ reason: TrainingRefusalReasonSchema,
43141
+ detail: string()
43142
+ })]), {
43143
+ kind: "mutation",
43144
+ auth: "admin",
43145
+ timeoutMs: 12e4
43146
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
43147
+ kind: "mutation",
43148
+ auth: "admin",
43149
+ timeoutMs: 12e4
43150
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
43151
+ kind: "mutation",
43152
+ auth: "admin",
43153
+ timeoutMs: 30 * 6e4
43154
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
43155
+ kind: "mutation",
43156
+ auth: "admin",
43157
+ timeoutMs: 12e4
43158
+ }), method(IdInput, TrainingJobSchema, {
43159
+ kind: "mutation",
43160
+ auth: "admin",
43161
+ timeoutMs: 12e4
43162
+ }), method(IdInput, TrainingJobSchema, {
43163
+ kind: "mutation",
43164
+ auth: "admin"
43165
+ });
41525
43166
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
41526
43167
  Object.freeze({
41527
43168
  person: .5,
@@ -43670,6 +45311,12 @@ Object.freeze({
43670
45311
  addonId: null,
43671
45312
  access: "create"
43672
45313
  },
45314
+ "backup.checkBackupKey": {
45315
+ capName: "backup",
45316
+ capScope: "system",
45317
+ addonId: null,
45318
+ access: "create"
45319
+ },
43673
45320
  "backup.delete": {
43674
45321
  capName: "backup",
43675
45322
  capScope: "system",
@@ -43682,6 +45329,18 @@ Object.freeze({
43682
45329
  addonId: null,
43683
45330
  access: "delete"
43684
45331
  },
45332
+ "backup.disableEncryption": {
45333
+ capName: "backup",
45334
+ capScope: "system",
45335
+ addonId: null,
45336
+ access: "create"
45337
+ },
45338
+ "backup.getEncryption": {
45339
+ capName: "backup",
45340
+ capScope: "system",
45341
+ addonId: null,
45342
+ access: "view"
45343
+ },
43685
45344
  "backup.getEntries": {
43686
45345
  capName: "backup",
43687
45346
  capScope: "system",
@@ -43736,6 +45395,12 @@ Object.freeze({
43736
45395
  addonId: null,
43737
45396
  access: "create"
43738
45397
  },
45398
+ "backup.setupEncryption": {
45399
+ capName: "backup",
45400
+ capScope: "system",
45401
+ addonId: null,
45402
+ access: "create"
45403
+ },
43739
45404
  "backup.trigger": {
43740
45405
  capName: "backup",
43741
45406
  capScope: "system",
@@ -44288,6 +45953,12 @@ Object.freeze({
44288
45953
  addonId: null,
44289
45954
  access: "create"
44290
45955
  },
45956
+ "customModelRegistry.importModelBundle": {
45957
+ capName: "custom-model-registry",
45958
+ capScope: "system",
45959
+ addonId: null,
45960
+ access: "create"
45961
+ },
44291
45962
  "customModelRegistry.listModels": {
44292
45963
  capName: "custom-model-registry",
44293
45964
  capScope: "system",
@@ -45728,6 +47399,12 @@ Object.freeze({
45728
47399
  addonId: null,
45729
47400
  access: "view"
45730
47401
  },
47402
+ "keychainAdmin.acknowledgeReset": {
47403
+ capName: "keychain-admin",
47404
+ capScope: "system",
47405
+ addonId: null,
47406
+ access: "create"
47407
+ },
45731
47408
  "keychainAdmin.deleteOrphans": {
45732
47409
  capName: "keychain-admin",
45733
47410
  capScope: "system",
@@ -45764,6 +47441,12 @@ Object.freeze({
45764
47441
  addonId: null,
45765
47442
  access: "delete"
45766
47443
  },
47444
+ "keychainAdmin.resetReport": {
47445
+ capName: "keychain-admin",
47446
+ capScope: "system",
47447
+ addonId: null,
47448
+ access: "delete"
47449
+ },
45767
47450
  "keychainAdmin.reveal": {
45768
47451
  capName: "keychain-admin",
45769
47452
  capScope: "system",
@@ -45776,6 +47459,12 @@ Object.freeze({
45776
47459
  addonId: null,
45777
47460
  access: "create"
45778
47461
  },
47462
+ "keychainAdmin.setSystemSecret": {
47463
+ capName: "keychain-admin",
47464
+ capScope: "system",
47465
+ addonId: null,
47466
+ access: "create"
47467
+ },
45779
47468
  "keychainAdmin.status": {
45780
47469
  capName: "keychain-admin",
45781
47470
  capScope: "system",
@@ -47012,6 +48701,36 @@ Object.freeze({
47012
48701
  addonId: null,
47013
48702
  access: "view"
47014
48703
  },
48704
+ "oidcConnections.connectionFormSchema": {
48705
+ capName: "oidc-connections",
48706
+ capScope: "system",
48707
+ addonId: null,
48708
+ access: "view"
48709
+ },
48710
+ "oidcConnections.createConnection": {
48711
+ capName: "oidc-connections",
48712
+ capScope: "system",
48713
+ addonId: null,
48714
+ access: "create"
48715
+ },
48716
+ "oidcConnections.deleteConnection": {
48717
+ capName: "oidc-connections",
48718
+ capScope: "system",
48719
+ addonId: null,
48720
+ access: "delete"
48721
+ },
48722
+ "oidcConnections.listConnections": {
48723
+ capName: "oidc-connections",
48724
+ capScope: "system",
48725
+ addonId: null,
48726
+ access: "view"
48727
+ },
48728
+ "oidcConnections.updateConnection": {
48729
+ capName: "oidc-connections",
48730
+ capScope: "system",
48731
+ addonId: null,
48732
+ access: "create"
48733
+ },
47015
48734
  "osd.getStatus": {
47016
48735
  capName: "osd",
47017
48736
  capScope: "device",
@@ -47084,6 +48803,12 @@ Object.freeze({
47084
48803
  addonId: null,
47085
48804
  access: "create"
47086
48805
  },
48806
+ "osdManager.setSlotCameraEnabled": {
48807
+ capName: "osd-manager",
48808
+ capScope: "system",
48809
+ addonId: null,
48810
+ access: "create"
48811
+ },
47087
48812
  "osdManager.upsertTemplate": {
47088
48813
  capName: "osd-manager",
47089
48814
  capScope: "system",
@@ -47336,6 +49061,12 @@ Object.freeze({
47336
49061
  addonId: null,
47337
49062
  access: "view"
47338
49063
  },
49064
+ "pipelineAnalytics.getRetrainCorpusKpi": {
49065
+ capName: "pipeline-analytics",
49066
+ capScope: "device",
49067
+ addonId: null,
49068
+ access: "view"
49069
+ },
47339
49070
  "pipelineAnalytics.getRetrainExportUrl": {
47340
49071
  capName: "pipeline-analytics",
47341
49072
  capScope: "device",
@@ -47456,6 +49187,12 @@ Object.freeze({
47456
49187
  addonId: null,
47457
49188
  access: "view"
47458
49189
  },
49190
+ "pipelineAnalytics.listRetrainCorpusPage": {
49191
+ capName: "pipeline-analytics",
49192
+ capScope: "device",
49193
+ addonId: null,
49194
+ access: "view"
49195
+ },
47459
49196
  "pipelineAnalytics.listRetrainFrames": {
47460
49197
  capName: "pipeline-analytics",
47461
49198
  capScope: "device",
@@ -47486,6 +49223,12 @@ Object.freeze({
47486
49223
  addonId: null,
47487
49224
  access: "view"
47488
49225
  },
49226
+ "pipelineAnalytics.offerRetrainArchive": {
49227
+ capName: "pipeline-analytics",
49228
+ capScope: "device",
49229
+ addonId: null,
49230
+ access: "create"
49231
+ },
47489
49232
  "pipelineAnalytics.ownersWithMedia": {
47490
49233
  capName: "pipeline-analytics",
47491
49234
  capScope: "device",
@@ -47576,6 +49319,12 @@ Object.freeze({
47576
49319
  addonId: null,
47577
49320
  access: "create"
47578
49321
  },
49322
+ "pipelineAnalytics.resolveRetrainTrainingCorpus": {
49323
+ capName: "pipeline-analytics",
49324
+ capScope: "device",
49325
+ addonId: null,
49326
+ access: "view"
49327
+ },
47579
49328
  "pipelineAnalytics.restageRetrainTrack": {
47580
49329
  capName: "pipeline-analytics",
47581
49330
  capScope: "device",
@@ -50012,6 +51761,180 @@ Object.freeze({
50012
51761
  addonId: null,
50013
51762
  access: "view"
50014
51763
  },
51764
+ "training.canaryResult": {
51765
+ capName: "training",
51766
+ capScope: "system",
51767
+ addonId: null,
51768
+ access: "create"
51769
+ },
51770
+ "training.cancelJob": {
51771
+ capName: "training",
51772
+ capScope: "system",
51773
+ addonId: null,
51774
+ access: "create"
51775
+ },
51776
+ "training.discardResult": {
51777
+ capName: "training",
51778
+ capScope: "system",
51779
+ addonId: null,
51780
+ access: "create"
51781
+ },
51782
+ "training.getJob": {
51783
+ capName: "training",
51784
+ capScope: "system",
51785
+ addonId: null,
51786
+ access: "view"
51787
+ },
51788
+ "training.getJobResult": {
51789
+ capName: "training",
51790
+ capScope: "system",
51791
+ addonId: null,
51792
+ access: "view"
51793
+ },
51794
+ "training.listBaseModels": {
51795
+ capName: "training",
51796
+ capScope: "system",
51797
+ addonId: null,
51798
+ access: "view"
51799
+ },
51800
+ "training.listJobs": {
51801
+ capName: "training",
51802
+ capScope: "system",
51803
+ addonId: null,
51804
+ access: "view"
51805
+ },
51806
+ "training.planJob": {
51807
+ capName: "training",
51808
+ capScope: "system",
51809
+ addonId: null,
51810
+ access: "view"
51811
+ },
51812
+ "training.registerResult": {
51813
+ capName: "training",
51814
+ capScope: "system",
51815
+ addonId: null,
51816
+ access: "create"
51817
+ },
51818
+ "training.rollbackCanary": {
51819
+ capName: "training",
51820
+ capScope: "system",
51821
+ addonId: null,
51822
+ access: "create"
51823
+ },
51824
+ "training.startJob": {
51825
+ capName: "training",
51826
+ capScope: "system",
51827
+ addonId: null,
51828
+ access: "create"
51829
+ },
51830
+ "training.startJobBatch": {
51831
+ capName: "training",
51832
+ capScope: "system",
51833
+ addonId: null,
51834
+ access: "create"
51835
+ },
51836
+ "trainingProvider.cancelJob": {
51837
+ capName: "training-provider",
51838
+ capScope: "system",
51839
+ addonId: null,
51840
+ access: "create"
51841
+ },
51842
+ "trainingProvider.cleanupJob": {
51843
+ capName: "training-provider",
51844
+ capScope: "system",
51845
+ addonId: null,
51846
+ access: "create"
51847
+ },
51848
+ "trainingProvider.createEntry": {
51849
+ capName: "training-provider",
51850
+ capScope: "system",
51851
+ addonId: null,
51852
+ access: "create"
51853
+ },
51854
+ "trainingProvider.deleteEntry": {
51855
+ capName: "training-provider",
51856
+ capScope: "system",
51857
+ addonId: null,
51858
+ access: "delete"
51859
+ },
51860
+ "trainingProvider.describe": {
51861
+ capName: "training-provider",
51862
+ capScope: "system",
51863
+ addonId: null,
51864
+ access: "view"
51865
+ },
51866
+ "trainingProvider.describeTypes": {
51867
+ capName: "training-provider",
51868
+ capScope: "system",
51869
+ addonId: null,
51870
+ access: "view"
51871
+ },
51872
+ "trainingProvider.estimateJob": {
51873
+ capName: "training-provider",
51874
+ capScope: "system",
51875
+ addonId: null,
51876
+ access: "view"
51877
+ },
51878
+ "trainingProvider.getJob": {
51879
+ capName: "training-provider",
51880
+ capScope: "system",
51881
+ addonId: null,
51882
+ access: "view"
51883
+ },
51884
+ "trainingProvider.listEntries": {
51885
+ capName: "training-provider",
51886
+ capScope: "system",
51887
+ addonId: null,
51888
+ access: "view"
51889
+ },
51890
+ "trainingProvider.listJobEvents": {
51891
+ capName: "training-provider",
51892
+ capScope: "system",
51893
+ addonId: null,
51894
+ access: "view"
51895
+ },
51896
+ "trainingProvider.listJobs": {
51897
+ capName: "training-provider",
51898
+ capScope: "system",
51899
+ addonId: null,
51900
+ access: "view"
51901
+ },
51902
+ "trainingProvider.offerArtifact": {
51903
+ capName: "training-provider",
51904
+ capScope: "system",
51905
+ addonId: null,
51906
+ access: "create"
51907
+ },
51908
+ "trainingProvider.readResult": {
51909
+ capName: "training-provider",
51910
+ capScope: "system",
51911
+ addonId: null,
51912
+ access: "create"
51913
+ },
51914
+ "trainingProvider.submitJob": {
51915
+ capName: "training-provider",
51916
+ capScope: "system",
51917
+ addonId: null,
51918
+ access: "create"
51919
+ },
51920
+ "trainingProvider.updateEntry": {
51921
+ capName: "training-provider",
51922
+ capScope: "system",
51923
+ addonId: null,
51924
+ access: "create"
51925
+ },
51926
+ "trainingProvider.uploadDataset": {
51927
+ capName: "training-provider",
51928
+ capScope: "system",
51929
+ addonId: null,
51930
+ access: "create"
51931
+ },
51932
+ "trainingProvider.validateCredentials": {
51933
+ capName: "training-provider",
51934
+ capScope: "system",
51935
+ addonId: null,
51936
+ access: "create"
51937
+ },
50015
51938
  "turnProvider.getTurnServers": {
50016
51939
  capName: "turn-provider",
50017
51940
  capScope: "system",
@@ -50036,12 +51959,6 @@ Object.freeze({
50036
51959
  addonId: null,
50037
51960
  access: "create"
50038
51961
  },
50039
- "userManagement.createApiKey": {
50040
- capName: "user-management",
50041
- capScope: "system",
50042
- addonId: null,
50043
- access: "create"
50044
- },
50045
51962
  "userManagement.createScopedToken": {
50046
51963
  capName: "user-management",
50047
51964
  capScope: "system",
@@ -50078,12 +51995,6 @@ Object.freeze({
50078
51995
  addonId: null,
50079
51996
  access: "view"
50080
51997
  },
50081
- "userManagement.linkExternalIdentity": {
50082
- capName: "user-management",
50083
- capScope: "system",
50084
- addonId: null,
50085
- access: "create"
50086
- },
50087
51998
  "userManagement.listApiKeys": {
50088
51999
  capName: "user-management",
50089
52000
  capScope: "system",
@@ -50186,12 +52097,6 @@ Object.freeze({
50186
52097
  addonId: null,
50187
52098
  access: "create"
50188
52099
  },
50189
- "userManagement.validateApiKey": {
50190
- capName: "user-management",
50191
- capScope: "system",
50192
- addonId: null,
50193
- access: "view"
50194
- },
50195
52100
  "userManagement.validateCredentials": {
50196
52101
  capName: "user-management",
50197
52102
  capScope: "system",
@@ -53290,6 +55195,11 @@ Object.freeze({
53290
55195
  form: "single",
53291
55196
  optional: false
53292
55197
  }],
55198
+ "osdManager.setSlotCameraEnabled": [{
55199
+ name: "deviceId",
55200
+ form: "single",
55201
+ optional: false
55202
+ }],
53293
55203
  "petFeeder.callPet": [{
53294
55204
  name: "deviceId",
53295
55205
  form: "single",
@@ -53510,6 +55420,11 @@ Object.freeze({
53510
55420
  form: "array",
53511
55421
  optional: false
53512
55422
  }],
55423
+ "pipelineAnalytics.listRetrainCorpusPage": [{
55424
+ name: "deviceIds",
55425
+ form: "array",
55426
+ optional: true
55427
+ }],
53513
55428
  "pipelineAnalytics.listRetrainStaging": [{
53514
55429
  name: "deviceIds",
53515
55430
  form: "array",
@@ -54371,6 +56286,11 @@ Object.freeze({
54371
56286
  form: "single",
54372
56287
  optional: false
54373
56288
  }],
56289
+ "training.canaryResult": [{
56290
+ name: "deviceIds",
56291
+ form: "array",
56292
+ optional: false
56293
+ }],
54374
56294
  "update.getStatus": [{
54375
56295
  name: "deviceId",
54376
56296
  form: "single",
@@ -54614,6 +56534,7 @@ Object.freeze({
54614
56534
  });
54615
56535
  Object.freeze({
54616
56536
  "broker": "broker",
56537
+ "calendar-source": "calendar",
54617
56538
  "device-export": "device-export",
54618
56539
  "llm": "ai",
54619
56540
  "mesh-network": "mesh",
@@ -55099,6 +57020,8 @@ var STATE_SUMMARY_VARS = [
55099
57020
  [...RULE_TEXT],
55100
57021
  [...RULE_TEXT],
55101
57022
  [...RULE_TEXT],
57023
+ [...RULE_TEXT],
57024
+ [...RULE_TEXT],
55102
57025
  ([...RULE_TEXT], [...UPDATES]),
55103
57026
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
55104
57027
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
@@ -55673,7 +57596,12 @@ var CREDENTIAL_PARAM_PATTERNS = [
55673
57596
  /^bearer$/i,
55674
57597
  /^api[_-]?key$/i,
55675
57598
  /^access[_-]?token$/i,
55676
- /^refresh[_-]?token$/i
57599
+ /^refresh[_-]?token$/i,
57600
+ /^bridge$/i,
57601
+ /^code$/i,
57602
+ /^state$/i,
57603
+ /^challenge$/i,
57604
+ /^link$/i
55677
57605
  ];
55678
57606
  function isCredentialParam(name) {
55679
57607
  return CREDENTIAL_PARAM_PATTERNS.some((re) => re.test(name));
@@ -55695,6 +57623,10 @@ function isCredentialParam(name) {
55695
57623
  * are NOT masked (those are entity references, not credentials).
55696
57624
  */
55697
57625
  function maskUrlCredentials(rawUrl) {
57626
+ if (rawUrl.startsWith("/") && !rawUrl.startsWith("//")) {
57627
+ const masked = maskUrlCredentials(`http://relative.invalid${rawUrl}`);
57628
+ return masked.startsWith("http://relative.invalid") ? masked.slice(23) : rawUrl;
57629
+ }
55698
57630
  try {
55699
57631
  const u = new URL(rawUrl);
55700
57632
  let touched = false;