@camstack/addon-matter-broker 0.2.123 → 0.2.125

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +2068 -145
  2. package/dist/addon.mjs +2068 -145
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -5389,7 +5389,7 @@ var ZodIssueCode = {
5389
5389
  var ZodFirstPartyTypeKind;
5390
5390
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5391
5391
  //#endregion
5392
- //#region ../types/dist/sleep-Cr5YOk3m.mjs
5392
+ //#region ../types/dist/sleep-DwAQ9sqX.mjs
5393
5393
  /**
5394
5394
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5395
5395
  * window to float samples (D455).
@@ -5506,7 +5506,7 @@ function isKeychainStoredField(field) {
5506
5506
  var SECRET_CLEAR = { $secretClear: true };
5507
5507
  /** The `'***'` token D634 redaction writes for non-admins. */
5508
5508
  var LEGACY_DEVICE_REDACTION = "***";
5509
- function isRecord$1$1(value) {
5509
+ function isRecord$2(value) {
5510
5510
  return typeof value === "object" && value !== null && !Array.isArray(value);
5511
5511
  }
5512
5512
  function makeSecretMarker(ref) {
@@ -5517,12 +5517,12 @@ function makeSecretMarker(ref) {
5517
5517
  }
5518
5518
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5519
5519
  function isSecretMarker(value) {
5520
- if (!isRecord$1$1(value)) return false;
5520
+ if (!isRecord$2(value)) return false;
5521
5521
  const ref = value["$secret"];
5522
5522
  return typeof ref === "string" && ref.length > 0;
5523
5523
  }
5524
5524
  function isSecretClear(value) {
5525
- return isRecord$1$1(value) && value["$secretClear"] === true;
5525
+ return isRecord$2(value) && value["$secretClear"] === true;
5526
5526
  }
5527
5527
  /**
5528
5528
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6038,6 +6038,13 @@ function globalSecretScope() {
6038
6038
  function encodeSegment(value) {
6039
6039
  return encodeURIComponent(value);
6040
6040
  }
6041
+ function decodeSegment(value) {
6042
+ try {
6043
+ return decodeURIComponent(value);
6044
+ } catch {
6045
+ return null;
6046
+ }
6047
+ }
6041
6048
  /**
6042
6049
  * The field path of a value inside an array item, addressed by the item's id:
6043
6050
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6046,6 +6053,75 @@ function encodeSegment(value) {
6046
6053
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6047
6054
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6048
6055
  }
6056
+ function parseScope(segments) {
6057
+ switch (segments[0]) {
6058
+ case "global": return {
6059
+ scope: GLOBAL_SCOPE,
6060
+ used: 1
6061
+ };
6062
+ case "node": {
6063
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6064
+ return nodeId === null || nodeId.length === 0 ? null : {
6065
+ scope: {
6066
+ kind: "node",
6067
+ nodeId
6068
+ },
6069
+ used: 2
6070
+ };
6071
+ }
6072
+ case "device": {
6073
+ const raw = segments[1];
6074
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6075
+ return {
6076
+ scope: {
6077
+ kind: "device",
6078
+ deviceId: Number(raw)
6079
+ },
6080
+ used: 2
6081
+ };
6082
+ }
6083
+ case "integration": {
6084
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6085
+ return id === null || id.length === 0 ? null : {
6086
+ scope: {
6087
+ kind: "integration",
6088
+ integrationId: id
6089
+ },
6090
+ used: 2
6091
+ };
6092
+ }
6093
+ case "row": {
6094
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6095
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6096
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6097
+ return {
6098
+ scope: {
6099
+ kind: "row",
6100
+ collection,
6101
+ rowId
6102
+ },
6103
+ used: 3
6104
+ };
6105
+ }
6106
+ default: return null;
6107
+ }
6108
+ }
6109
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6110
+ function parseSecretRef(ref) {
6111
+ if (!ref.startsWith("secret://")) return null;
6112
+ const segments = ref.slice(9).split("/");
6113
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6114
+ if (owner === null || owner.length === 0) return null;
6115
+ const parsed = parseScope(segments.slice(1));
6116
+ if (parsed === null) return null;
6117
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6118
+ if (fieldPath.length === 0) return null;
6119
+ return {
6120
+ owner,
6121
+ scope: parsed.scope,
6122
+ fieldPath
6123
+ };
6124
+ }
6049
6125
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6050
6126
  var KeychainWriteRefusedError = class extends Error {
6051
6127
  fieldPath;
@@ -6056,7 +6132,7 @@ var KeychainWriteRefusedError = class extends Error {
6056
6132
  }
6057
6133
  };
6058
6134
  var KEEP = { kind: "keep" };
6059
- function isRecord$2(value) {
6135
+ function isRecord$1$1(value) {
6060
6136
  return typeof value === "object" && value !== null && !Array.isArray(value);
6061
6137
  }
6062
6138
  function defaultMintId() {
@@ -6069,7 +6145,7 @@ function collectSecretMarkerRefs(value, out = []) {
6069
6145
  return out;
6070
6146
  }
6071
6147
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6072
- else if (isRecord$2(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6148
+ else if (isRecord$1$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6073
6149
  return out;
6074
6150
  }
6075
6151
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6124,7 +6200,7 @@ function rowId(row, idKey) {
6124
6200
  return null;
6125
6201
  }
6126
6202
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6127
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$2) : [];
6203
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1$1) : [];
6128
6204
  if (!Array.isArray(incoming)) {
6129
6205
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6130
6206
  return {
@@ -6140,7 +6216,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6140
6216
  const kept = /* @__PURE__ */ new Set();
6141
6217
  const rows = [];
6142
6218
  for (const row of incoming) {
6143
- if (!isRecord$2(row)) {
6219
+ if (!isRecord$1$1(row)) {
6144
6220
  rows.push(row);
6145
6221
  continue;
6146
6222
  }
@@ -6165,7 +6241,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6165
6241
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6166
6242
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6167
6243
  case "object": {
6168
- if (!isRecord$2(incoming)) {
6244
+ if (!isRecord$1$1(incoming)) {
6169
6245
  if (incoming === void 0) return KEEP;
6170
6246
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6171
6247
  return {
@@ -6173,7 +6249,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6173
6249
  value: incoming
6174
6250
  };
6175
6251
  }
6176
- const storedObj = isRecord$2(stored) ? stored : {};
6252
+ const storedObj = isRecord$1$1(stored) ? stored : {};
6177
6253
  return {
6178
6254
  kind: "value",
6179
6255
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6232,12 +6308,19 @@ async function transformSecretWrite(input) {
6232
6308
  }
6233
6309
  };
6234
6310
  }
6311
+ /** Is `ref` one of `owner`'s refs? */
6312
+ function isSecretRefOwnedBy(ref, owner) {
6313
+ return parseSecretRef(ref)?.owner === owner;
6314
+ }
6235
6315
  /**
6236
6316
  * Replace every marker in `value` with its keychain value. Returns the SAME
6237
6317
  * reference when there is no marker (no allocation, no keychain call).
6238
6318
  */
6239
- async function resolveSecretMarkers(value, secrets) {
6240
- const refs = collectSecretMarkerRefs(value);
6319
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6320
+ const keepMarker = options.unresolved === "keep-marker";
6321
+ const owner = options.ownedBy;
6322
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6323
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6241
6324
  if (refs.length === 0) return {
6242
6325
  value,
6243
6326
  unresolved: []
@@ -6261,10 +6344,18 @@ async function resolveSecretMarkers(value, secrets) {
6261
6344
  }
6262
6345
  const substitute = (v) => {
6263
6346
  if (isSecretMarker(v)) {
6347
+ if (!inScope(v.$secret)) return {
6348
+ keep: true,
6349
+ value: v
6350
+ };
6264
6351
  const answer = answers[v.$secret];
6265
- return answer?.kind === "value" ? {
6352
+ if (answer?.kind === "value") return {
6266
6353
  keep: true,
6267
6354
  value: answer.value
6355
+ };
6356
+ return keepMarker ? {
6357
+ keep: true,
6358
+ value: v
6268
6359
  } : {
6269
6360
  keep: false,
6270
6361
  value: void 0
@@ -6281,7 +6372,7 @@ async function resolveSecretMarkers(value, secrets) {
6281
6372
  value: items
6282
6373
  };
6283
6374
  }
6284
- if (isRecord$2(v)) {
6375
+ if (isRecord$1$1(v)) {
6285
6376
  const out = {};
6286
6377
  for (const [k, child] of Object.entries(v)) {
6287
6378
  const s = substitute(child);
@@ -6302,14 +6393,152 @@ async function resolveSecretMarkers(value, secrets) {
6302
6393
  unresolved
6303
6394
  };
6304
6395
  }
6305
- function touchesTree(tree, patch) {
6306
- if (tree.size === 0) return false;
6307
- for (const key of Object.keys(patch)) {
6308
- const at = key.indexOf("@");
6309
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6396
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6397
+ var SecretOverwriteRefusedError = class extends Error {
6398
+ ref;
6399
+ reason;
6400
+ constructor(ref, reason) {
6401
+ 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.`);
6402
+ this.ref = ref;
6403
+ this.reason = reason;
6404
+ this.name = "SecretOverwriteRefusedError";
6405
+ }
6406
+ };
6407
+ function isRecord$3(value) {
6408
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6409
+ }
6410
+ function resolvedValue(pass, marker) {
6411
+ const answer = pass.answers[marker.$secret];
6412
+ return answer?.kind === "value" ? answer.value : null;
6413
+ }
6414
+ async function atMarker(pass, incoming, stored) {
6415
+ if (incoming === null) return stored;
6416
+ if (typeof incoming !== "string") return incoming;
6417
+ if (incoming === resolvedValue(pass, stored)) return stored;
6418
+ const intent = classifySecretWrite(incoming);
6419
+ if (intent.kind !== "set") return stored;
6420
+ const ref = stored.$secret;
6421
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6422
+ const answer = pass.answers[ref];
6423
+ 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);
6424
+ try {
6425
+ await pass.secrets.put(ref, intent.value);
6426
+ } catch (err) {
6427
+ throw new KeychainWriteRefusedError(ref, err);
6428
+ }
6429
+ pass.changedRefs.push(ref);
6430
+ return stored;
6431
+ }
6432
+ function inArray(pass, incoming, stored) {
6433
+ return incoming.map((item, index) => {
6434
+ const twin = stored[index];
6435
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6436
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6437
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6438
+ return item;
6439
+ });
6440
+ }
6441
+ function inArrayRow(pass, incoming, stored) {
6442
+ const out = { ...incoming };
6443
+ for (const [key, value] of Object.entries(incoming)) {
6444
+ const twin = stored[key];
6445
+ if (isSecretMarker(twin)) {
6446
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6447
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6448
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6449
+ }
6450
+ return out;
6451
+ }
6452
+ async function walk(pass, incoming, stored) {
6453
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6454
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6455
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6456
+ const out = { ...incoming };
6457
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6458
+ return out;
6459
+ }
6460
+ /** Restore markers a write-back carries as values. See the file doc. */
6461
+ async function restoreUnchangedSecrets(input) {
6462
+ const refs = [];
6463
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6464
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6465
+ if (owned.length === 0) return {
6466
+ patch: input.patch,
6467
+ changedRefs: []
6468
+ };
6469
+ const pass = {
6470
+ secrets: input.secrets,
6471
+ answers: await input.secrets.resolve([...new Set(owned)]),
6472
+ operatorWrite: input.operatorWrite,
6473
+ changedRefs: []
6474
+ };
6475
+ const out = {};
6476
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6477
+ return {
6478
+ patch: out,
6479
+ changedRefs: pass.changedRefs
6480
+ };
6481
+ }
6482
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6483
+ function isJsonEqual(a, b) {
6484
+ if (Object.is(a, b)) return true;
6485
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6486
+ if (isRecord$3(a) && isRecord$3(b)) {
6487
+ const keys = Object.keys(a);
6488
+ if (keys.length !== Object.keys(b).length) return false;
6489
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6310
6490
  }
6311
6491
  return false;
6312
6492
  }
6493
+ /** The patch without the keys whose value already equals the stored one. */
6494
+ function dropUnchangedKeys(patch, stored) {
6495
+ const out = {};
6496
+ for (const [key, value] of Object.entries(patch)) {
6497
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6498
+ out[key] = value;
6499
+ }
6500
+ return out;
6501
+ }
6502
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6503
+ function markerKeysOf(blob, owner) {
6504
+ const keys = /* @__PURE__ */ new Set();
6505
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6506
+ return keys;
6507
+ }
6508
+ function nodeFromStored(value, owner) {
6509
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6510
+ if (!isRecord$3(value)) return null;
6511
+ const children = /* @__PURE__ */ new Map();
6512
+ for (const [key, child] of Object.entries(value)) {
6513
+ const node = nodeFromStored(child, owner);
6514
+ if (node !== null) children.set(key, node);
6515
+ }
6516
+ return children.size > 0 ? {
6517
+ kind: "object",
6518
+ children
6519
+ } : null;
6520
+ }
6521
+ /**
6522
+ * The declared secret tree, widened by every place the STORED blob holds a
6523
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6524
+ * never declared: Wyze before b4906cec6) still gets the save path's
6525
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6526
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6527
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6528
+ * builtin that keeps another addon's marker (device-manager) never takes it
6529
+ * over.
6530
+ */
6531
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6532
+ const added = /* @__PURE__ */ new Map();
6533
+ for (const key of keys) {
6534
+ const at = key.indexOf("@");
6535
+ const base = at > 0 ? key.slice(0, at) : key;
6536
+ if (declared.has(base) || added.has(base)) continue;
6537
+ const node = nodeFromStored(stored[key], owner);
6538
+ if (node !== null) added.set(base, node);
6539
+ }
6540
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6541
+ }
6313
6542
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6314
6543
  async function readStoredAddonBlob(raw) {
6315
6544
  const threeWay = raw.readAddonStoreResult;
@@ -6318,7 +6547,41 @@ async function readStoredAddonBlob(raw) {
6318
6547
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6319
6548
  return result.kind === "missing" ? {} : result.value;
6320
6549
  }
6321
- function createSecretAwareSettings(raw, opts) {
6550
+ function touchesTree(tree, patch) {
6551
+ if (tree.size === 0) return false;
6552
+ for (const key of Object.keys(patch)) {
6553
+ const at = key.indexOf("@");
6554
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6555
+ }
6556
+ return false;
6557
+ }
6558
+ /**
6559
+ * Which top-level keys of each store held markers when last seen. `undefined`
6560
+ * for a store not seen yet: its first write reads it, to be safe.
6561
+ */
6562
+ var MarkerKeyIndex = class {
6563
+ owner;
6564
+ byStore = /* @__PURE__ */ new Map();
6565
+ constructor(owner) {
6566
+ this.owner = owner;
6567
+ }
6568
+ seen(store, blob) {
6569
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6570
+ }
6571
+ wrote(store, patch) {
6572
+ const keys = this.byStore.get(store);
6573
+ if (keys === void 0) return;
6574
+ const now = markerKeysOf(patch, this.owner);
6575
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6576
+ else keys.delete(key);
6577
+ }
6578
+ mayHoldMarkers(store, patch) {
6579
+ const keys = this.byStore.get(store);
6580
+ if (keys === void 0) return true;
6581
+ return Object.keys(patch).some((key) => keys.has(key));
6582
+ }
6583
+ };
6584
+ function createHandle(raw, opts) {
6322
6585
  const chains = /* @__PURE__ */ new Map();
6323
6586
  const serialize = (key, fn) => {
6324
6587
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6329,46 +6592,130 @@ function createSecretAwareSettings(raw, opts) {
6329
6592
  });
6330
6593
  return next;
6331
6594
  };
6332
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6333
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6334
- return serialize(chainKey, async () => {
6595
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6596
+ const resolveRead = async (store, blob) => {
6597
+ index.seen(store, blob);
6598
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6599
+ unresolved: "keep-marker",
6600
+ ownedBy: opts.secrets.owner
6601
+ });
6602
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6603
+ return value;
6604
+ };
6605
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6606
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6607
+ await rawWrite(patch);
6608
+ index.wrote(store, patch);
6609
+ return { changed: true };
6610
+ }
6611
+ return serialize(store, async () => {
6335
6612
  const stored = await readStored();
6613
+ index.seen(store, stored);
6614
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6615
+ const restored = await restoreUnchangedSecrets({
6616
+ patch,
6617
+ stored,
6618
+ secrets: opts.secrets,
6619
+ operatorWrite
6620
+ });
6336
6621
  const result = await transformSecretWrite({
6337
- tree,
6622
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6338
6623
  secrets: opts.secrets,
6339
- patch,
6624
+ patch: restored.patch,
6340
6625
  stored,
6341
6626
  ...scope !== void 0 ? { scope } : {},
6342
- operatorWrite: opts.isOperatorWrite?.() === true
6627
+ operatorWrite
6343
6628
  });
6344
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6629
+ const effective = dropUnchangedKeys(result.patch, stored);
6630
+ const wroteBlob = Object.keys(effective).length > 0;
6631
+ if (wroteBlob) {
6632
+ await rawWrite(effective);
6633
+ index.wrote(store, effective);
6634
+ }
6345
6635
  const { orphaned } = await result.afterWrite();
6346
6636
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6637
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6347
6638
  });
6348
6639
  };
6349
- const wrapped = {
6350
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6351
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6352
- kind: "device",
6353
- deviceId
6354
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6640
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6641
+ const readAddonStoreResult = raw.readAddonStoreResult;
6642
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6643
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6644
+ const overrides = {
6645
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6646
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6647
+ const result = await readAddonStoreResult.call(raw);
6648
+ return result.kind === "value" ? {
6649
+ kind: "value",
6650
+ value: await resolveRead("addon", result.value)
6651
+ } : result;
6652
+ } } : {},
6653
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6654
+ const result = await readAddonStoreKeyResult.call(raw, key);
6655
+ if (result.kind !== "present") return result;
6656
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6657
+ unresolved: "keep-marker",
6658
+ ownedBy: opts.secrets.owner
6659
+ });
6660
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6661
+ return {
6662
+ kind: "present",
6663
+ value: value[key]
6664
+ };
6665
+ } } : {},
6666
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6667
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6668
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6669
+ const out = /* @__PURE__ */ new Map();
6670
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6671
+ return out;
6672
+ } } : {},
6673
+ writeAddonStore: async (patch) => {
6674
+ await writeAddon(patch);
6675
+ },
6676
+ writeDeviceStore: async (deviceId, patch) => {
6677
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6678
+ kind: "device",
6679
+ deviceId
6680
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6681
+ }
6682
+ };
6683
+ return {
6684
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6685
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6686
+ const value = Reflect.get(target, prop, receiver);
6687
+ return typeof value === "function" ? value.bind(target) : value;
6688
+ } }),
6689
+ raw: {
6690
+ readAddonStore: async () => {
6691
+ const blob = await raw.readAddonStore();
6692
+ index.seen("addon", blob);
6693
+ return blob;
6694
+ },
6695
+ readDeviceStore: async (deviceId) => {
6696
+ const blob = await raw.readDeviceStore(deviceId);
6697
+ index.seen(`device:${deviceId}`, blob);
6698
+ return blob;
6699
+ }
6700
+ },
6701
+ writeAddonStore: writeAddon
6355
6702
  };
6356
- return new Proxy(raw, { get(target, prop, receiver) {
6357
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6358
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6359
- const value = Reflect.get(target, prop, receiver);
6360
- return typeof value === "function" ? value.bind(target) : value;
6361
- } });
6362
6703
  }
6363
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6364
- function withSecretAwareSettings(context, opts) {
6704
+ /** The context the addon sees, plus the private raw view and write outcome. */
6705
+ function createSecretAwareContext(context, opts) {
6365
6706
  const raw = context.settings;
6366
- if (raw === void 0) return context;
6367
- const settings = createSecretAwareSettings(raw, opts);
6368
- return new Proxy(context, { get(target, prop, receiver) {
6369
- if (prop === "settings") return settings;
6370
- return Reflect.get(target, prop, receiver);
6371
- } });
6707
+ if (raw === void 0) return {
6708
+ context,
6709
+ handle: null
6710
+ };
6711
+ const handle = createHandle(raw, opts);
6712
+ return {
6713
+ context: new Proxy(context, { get(target, prop, receiver) {
6714
+ if (prop === "settings") return handle.settings;
6715
+ return Reflect.get(target, prop, receiver);
6716
+ } }),
6717
+ handle
6718
+ };
6372
6719
  }
6373
6720
  var LEAF = { kind: "leaf" };
6374
6721
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6543,6 +6890,14 @@ var BaseAddon = class {
6543
6890
  _secretChangeUnsub = null;
6544
6891
  /** >0 while an OPERATOR's settings write is being applied. */
6545
6892
  _operatorWriteDepth = 0;
6893
+ /**
6894
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6895
+ * to the marker-bearing blobs and stays private to this class: the form
6896
+ * hydrate and config resolution need markers, addon code never does.
6897
+ */
6898
+ _secretSettings = null;
6899
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6900
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6546
6901
  constructor(defaults) {
6547
6902
  this.defaults = defaults;
6548
6903
  this._config = { ...defaults };
@@ -6579,13 +6934,21 @@ var BaseAddon = class {
6579
6934
  }
6580
6935
  async initialize(context) {
6581
6936
  const secrets = context.secrets;
6582
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6583
- secrets,
6584
- addonTree: () => this.addonSecretTree(),
6585
- deviceTree: () => this.deviceSecretTree(),
6586
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6587
- isOperatorWrite: () => this._operatorWriteDepth > 0
6588
- }) : context;
6937
+ if (secrets !== void 0) {
6938
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6939
+ secrets,
6940
+ addonTree: () => this.addonSecretTree(),
6941
+ deviceTree: () => this.deviceSecretTree(),
6942
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6943
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6944
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6945
+ });
6946
+ this._ctx = wrapped;
6947
+ this._secretSettings = handle;
6948
+ } else {
6949
+ this._ctx = context;
6950
+ this._secretSettings = null;
6951
+ }
6589
6952
  await this.resolveConfig();
6590
6953
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6591
6954
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6702,11 +7065,8 @@ var BaseAddon = class {
6702
7065
  async getGlobalSettings(overlay, cap, nodeId) {
6703
7066
  const schema = this.globalSettingsSchema(cap);
6704
7067
  if (!schema) return { sections: [] };
6705
- const projected = await this.resolveGlobalStore(nodeId, cap);
6706
- return hydrateSchema(schema, overlay ? {
6707
- ...projected,
6708
- ...overlay
6709
- } : projected, { inlineSecretsAsViews: true });
7068
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7069
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6710
7070
  }
6711
7071
  /**
6712
7072
  * The integration-level view of this addon's settings: exactly the sections
@@ -6751,7 +7111,7 @@ var BaseAddon = class {
6751
7111
  });
6752
7112
  }
6753
7113
  if (sections.length === 0) return null;
6754
- const projected = await this.resolveGlobalStore(nodeId);
7114
+ const projected = await this.readRawProjectedStore(nodeId);
6755
7115
  return hydrateSchema({
6756
7116
  ...schema,
6757
7117
  sections
@@ -6768,12 +7128,50 @@ var BaseAddon = class {
6768
7128
  * the store for custom option logic (option narrowing, value snapping) to
6769
7129
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6770
7130
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7131
+ *
7132
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7133
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7134
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7135
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7136
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7137
+ * resolved blob back is a no-op for every unchanged secret.
6771
7138
  */
6772
7139
  async resolveGlobalStore(nodeId, cap) {
6773
7140
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7141
+ return this.projectForNode(raw, nodeId, cap);
7142
+ }
7143
+ projectForNode(store, nodeId, cap) {
6774
7144
  const keys = this.perNodeKeys(cap);
6775
7145
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6776
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7146
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7147
+ }
7148
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7149
+ async readRawProjectedStore(nodeId, cap) {
7150
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7151
+ return this.projectForNode(raw, nodeId, cap);
7152
+ }
7153
+ /**
7154
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7155
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7156
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7157
+ * its value.
7158
+ */
7159
+ async overlayKeepingMarkers(stored, overlay) {
7160
+ const secrets = this._ctx?.secrets;
7161
+ const merged = {
7162
+ ...stored,
7163
+ ...overlay
7164
+ };
7165
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7166
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7167
+ unresolved: "keep-marker",
7168
+ ownedBy: secrets.owner
7169
+ });
7170
+ for (const key of Object.keys(overlay)) {
7171
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7172
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7173
+ }
7174
+ return merged;
6777
7175
  }
6778
7176
  /**
6779
7177
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6838,8 +7236,12 @@ var BaseAddon = class {
6838
7236
  async clearSecrets(keys, nodeId) {
6839
7237
  const tree = this.addonSecretTree();
6840
7238
  const keychain = this._ctx?.secrets !== void 0;
7239
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6841
7240
  const patch = {};
6842
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7241
+ for (const key of keys) {
7242
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7243
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7244
+ }
6843
7245
  await this.applyGlobalPatch(patch, nodeId);
6844
7246
  }
6845
7247
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6847,7 +7249,11 @@ var BaseAddon = class {
6847
7249
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6848
7250
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6849
7251
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6850
- await this._ctx?.settings?.writeAddonStore(scoped);
7252
+ const handle = this._secretSettings;
7253
+ if (handle !== null) {
7254
+ const { changed } = await handle.writeAddonStore(scoped);
7255
+ if (!changed) return;
7256
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6851
7257
  if (target !== localNode) return;
6852
7258
  await this.resolveConfig();
6853
7259
  await this.onConfigChanged();
@@ -6900,7 +7306,7 @@ var BaseAddon = class {
6900
7306
  async getDeviceSettings(deviceId) {
6901
7307
  const schema = this.deviceSettingsSchema();
6902
7308
  if (!schema) return { sections: [] };
6903
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7309
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6904
7310
  }
6905
7311
  async updateDeviceSettings(deviceId, patch) {
6906
7312
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7072,7 +7478,7 @@ var BaseAddon = class {
7072
7478
  key,
7073
7479
  schema,
7074
7480
  fallback,
7075
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7481
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7076
7482
  write: async (patch) => {
7077
7483
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7078
7484
  },
@@ -7134,6 +7540,23 @@ var BaseAddon = class {
7134
7540
  }
7135
7541
  return value;
7136
7542
  }
7543
+ /**
7544
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7545
+ * keychain the context's own view is already raw.
7546
+ */
7547
+ rawSettings() {
7548
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7549
+ }
7550
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7551
+ logUnresolvedRead(unresolved) {
7552
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7553
+ if (fresh.length === 0) return;
7554
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7555
+ 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) => ({
7556
+ ref: u.ref,
7557
+ reason: u.reason
7558
+ })) } });
7559
+ }
7137
7560
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7138
7561
  scheduleSecretReresolve(delayMs) {
7139
7562
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7160,7 +7583,7 @@ var BaseAddon = class {
7160
7583
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7161
7584
  */
7162
7585
  async readAddonStoreWithRetry() {
7163
- const settings = this._ctx?.settings;
7586
+ const settings = this.rawSettings();
7164
7587
  if (!settings) return {};
7165
7588
  const delaysMs = [
7166
7589
  150,
@@ -8972,6 +9395,16 @@ var CompositionSchema = object({
8972
9395
  seen.add(feature.cap);
8973
9396
  });
8974
9397
  });
9398
+ var NodeColorIdSchema = _enum([
9399
+ "node-a",
9400
+ "node-b",
9401
+ "node-c",
9402
+ "node-d",
9403
+ "node-e",
9404
+ "node-f",
9405
+ "node-g",
9406
+ "node-h"
9407
+ ]);
8975
9408
  new Set([
8976
9409
  "track",
8977
9410
  "face",
@@ -9463,6 +9896,278 @@ var CameraSwitchGroupSchema = object({
9463
9896
  fetchedAt: number()
9464
9897
  });
9465
9898
  /**
9899
+ * The trainer contract — what the hub hands the cloud trainer and what it
9900
+ * gets back (cloud training, D805+).
9901
+ *
9902
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
9903
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
9904
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
9905
+ * lines on stdout. These schemas are the hub's half of that boundary; the
9906
+ * trainer's pydantic models (and the JSON Schemas generated from them under
9907
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
9908
+ * change there, in the same piece of work.
9909
+ *
9910
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
9911
+ * orchestrator fills every field of a job spec explicitly.
9912
+ */
9913
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
9914
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
9915
+ /** What the trainer can export. Edge TPU is a later, separate image. */
9916
+ var TrainingExportSchema = _enum([
9917
+ "onnx",
9918
+ "openvino-fp16",
9919
+ "openvino-int8",
9920
+ "coreml-fp16"
9921
+ ]);
9922
+ var FloorsSchema = record(string$2(), number().min(0).max(1));
9923
+ object({
9924
+ schema: literal(TRAINING_JOB_SCHEMA),
9925
+ jobKey: string$2().uuid(),
9926
+ target: object({
9927
+ kind: literal("detector"),
9928
+ step: literal("object-detection")
9929
+ }),
9930
+ base: object({
9931
+ modelId: string$2().min(1),
9932
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
9933
+ weights: string$2().min(1),
9934
+ imgsz: number().int().positive()
9935
+ }),
9936
+ baseline: object({
9937
+ modelId: string$2().min(1),
9938
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
9939
+ onnxUrl: string$2().url(),
9940
+ imgsz: number().int().positive(),
9941
+ floors: FloorsSchema
9942
+ }),
9943
+ dataset: object({
9944
+ versionId: string$2().min(1),
9945
+ annotationHash: string$2(),
9946
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
9947
+ sha256: string$2().regex(/^[0-9a-f]{64}$/)
9948
+ }),
9949
+ split: object({
9950
+ holdoutCameras: array(number().int()),
9951
+ /** When no camera is held out: the last N days of every camera. */
9952
+ holdoutLastDays: number().int().nonnegative(),
9953
+ valFraction: number().min(0).max(.5),
9954
+ seed: number().int()
9955
+ }),
9956
+ hyper: object({
9957
+ epochs: number().int().positive(),
9958
+ batch: number().int().positive(),
9959
+ lr0: number().positive(),
9960
+ /** Layers frozen from the start of the backbone; 0 = none. */
9961
+ freeze: number().int().nonnegative(),
9962
+ patience: number().int().nonnegative(),
9963
+ seed: number().int()
9964
+ }),
9965
+ replay: object({
9966
+ source: literal("coco2017"),
9967
+ count: number().int().nonnegative()
9968
+ }),
9969
+ exports: array(TrainingExportSchema).min(1),
9970
+ calibration: object({ maxFrames: number().int().positive() }),
9971
+ floors: object({
9972
+ minSupport: number().int().positive(),
9973
+ clamp: number().min(0).max(1)
9974
+ }),
9975
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
9976
+ catalog: object({
9977
+ id: string$2().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
9978
+ name: string$2().min(1).max(160)
9979
+ })
9980
+ });
9981
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
9982
+ var TrainingResultFileSchema = object({
9983
+ path: string$2().min(1),
9984
+ bytes: number().int().nonnegative(),
9985
+ sha256: string$2().regex(/^[0-9a-f]{64}$/),
9986
+ format: _enum([
9987
+ "onnx",
9988
+ "openvino",
9989
+ "coreml",
9990
+ "pt"
9991
+ ]),
9992
+ variant: _enum(["base", "int8"])
9993
+ });
9994
+ var DraftFormatSchema = object({
9995
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
9996
+ url: string$2().min(1),
9997
+ sizeMB: number().nonnegative(),
9998
+ isDirectory: boolean().optional(),
9999
+ files: array(string$2()).optional(),
10000
+ runtimes: array(literal("python")).optional(),
10001
+ revision: string$2().min(1)
10002
+ });
10003
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
10004
+ var TrainingCatalogDraftSchema = object({
10005
+ id: string$2().min(1),
10006
+ name: string$2().min(1),
10007
+ description: string$2(),
10008
+ labels: array(unknown()),
10009
+ inputSize: object({
10010
+ width: number().int().positive(),
10011
+ height: number().int().positive()
10012
+ }),
10013
+ preprocessMode: literal("letterbox"),
10014
+ defaultClassFloors: FloorsSchema,
10015
+ formats: object({
10016
+ onnx: DraftFormatSchema.optional(),
10017
+ openvino: DraftFormatSchema.optional(),
10018
+ coreml: DraftFormatSchema.optional()
10019
+ })
10020
+ });
10021
+ /** One class of one model's holdout report (the eval harness's summary). */
10022
+ var TrainingEvalClassSchema = object({
10023
+ positives: number().int(),
10024
+ floor: number().nullable(),
10025
+ tp: number().int(),
10026
+ fp: number().int(),
10027
+ fn: number().int(),
10028
+ precision: number().nullable(),
10029
+ recall: number().nullable(),
10030
+ ap50: number().nullable(),
10031
+ recallByCamera: record(string$2(), number().nullable()).optional(),
10032
+ recallByLight: record(string$2(), number().nullable()).optional(),
10033
+ fpByCamera: record(string$2(), number()).optional(),
10034
+ smallFound: number().int().optional(),
10035
+ smallTotal: number().int().optional()
10036
+ }).passthrough();
10037
+ var TrainingEvalReportSchema = object({
10038
+ frames: number().int(),
10039
+ classes: record(string$2(), TrainingEvalClassSchema)
10040
+ }).passthrough();
10041
+ /**
10042
+ * A succeeded result carries every block; a failed one carries the error and
10043
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10044
+ * orchestrator checks the blocks it needs before it trusts a success.
10045
+ */
10046
+ var TrainingResultSchema = object({
10047
+ schema: literal(TRAINING_RESULT_SCHEMA),
10048
+ jobKey: string$2(),
10049
+ status: _enum(["succeeded", "failed"]),
10050
+ error: object({
10051
+ stage: string$2(),
10052
+ code: string$2(),
10053
+ message: string$2()
10054
+ }).nullable(),
10055
+ trainer: object({
10056
+ version: string$2(),
10057
+ revision: string$2()
10058
+ }),
10059
+ toolchain: record(string$2(), string$2().nullable()),
10060
+ dataset: object({
10061
+ versionId: string$2(),
10062
+ annotationHash: string$2(),
10063
+ sha256: string$2(),
10064
+ frames: object({
10065
+ train: number().int(),
10066
+ val: number().int(),
10067
+ holdout: number().int()
10068
+ }),
10069
+ holdoutCameras: array(number().int()),
10070
+ replayImages: number().int()
10071
+ }).optional(),
10072
+ training: object({
10073
+ epochsRun: number().int(),
10074
+ bestEpoch: number().int(),
10075
+ bestMap50: number(),
10076
+ bestMap50_95: number(),
10077
+ seconds: number()
10078
+ }).optional(),
10079
+ evaluation: object({
10080
+ holdoutFrames: number().int(),
10081
+ baseline: TrainingEvalReportSchema.nullable(),
10082
+ candidate: TrainingEvalReportSchema.nullable(),
10083
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10084
+ recallDeltaByCamera: record(string$2(), record(string$2(), number())).nullable(),
10085
+ map50: record(string$2(), number().nullable())
10086
+ }).optional(),
10087
+ floors: object({
10088
+ baseline: FloorsSchema,
10089
+ candidate: FloorsSchema,
10090
+ candidateInt8: FloorsSchema.nullable(),
10091
+ notes: array(string$2())
10092
+ }).optional(),
10093
+ int8: object({
10094
+ kept: boolean(),
10095
+ map50Fp16: number().nullable(),
10096
+ map50Int8: number().nullable(),
10097
+ reason: string$2().nullable()
10098
+ }).optional(),
10099
+ exportsDropped: array(object({
10100
+ export: string$2(),
10101
+ reason: string$2()
10102
+ })).optional(),
10103
+ files: array(TrainingResultFileSchema).optional(),
10104
+ bundle: object({
10105
+ path: literal("bundle.tar"),
10106
+ bytes: number().int().nonnegative(),
10107
+ sha256: string$2().regex(/^[0-9a-f]{64}$/)
10108
+ }).nullable().optional(),
10109
+ catalogDraft: object({
10110
+ base: TrainingCatalogDraftSchema,
10111
+ int8: TrainingCatalogDraftSchema.nullable()
10112
+ }).nullable().optional(),
10113
+ licence: string$2()
10114
+ });
10115
+ var TrainingStageSchema = _enum([
10116
+ "prepare",
10117
+ "replay",
10118
+ "train",
10119
+ "eval",
10120
+ "export",
10121
+ "package"
10122
+ ]);
10123
+ var EventBase = {
10124
+ v: literal(1),
10125
+ ts: number()
10126
+ };
10127
+ discriminatedUnion("type", [
10128
+ object({
10129
+ ...EventBase,
10130
+ type: literal("stage"),
10131
+ stage: TrainingStageSchema
10132
+ }),
10133
+ object({
10134
+ ...EventBase,
10135
+ type: literal("epoch"),
10136
+ epoch: number().int(),
10137
+ epochs: number().int(),
10138
+ boxLoss: number().nullable().optional(),
10139
+ map50: number().nullable().optional(),
10140
+ map50_95: number().nullable().optional(),
10141
+ etaSec: number().nullable().optional()
10142
+ }),
10143
+ object({
10144
+ ...EventBase,
10145
+ type: literal("metric"),
10146
+ name: string$2(),
10147
+ value: number()
10148
+ }),
10149
+ object({
10150
+ ...EventBase,
10151
+ type: literal("artifact"),
10152
+ path: string$2(),
10153
+ bytes: number(),
10154
+ sha256: string$2()
10155
+ }),
10156
+ object({
10157
+ ...EventBase,
10158
+ type: literal("done"),
10159
+ status: _enum(["succeeded", "failed"]),
10160
+ resultSha256: string$2().nullable().optional()
10161
+ }),
10162
+ object({
10163
+ ...EventBase,
10164
+ type: literal("error"),
10165
+ stage: string$2(),
10166
+ code: string$2(),
10167
+ message: string$2()
10168
+ })
10169
+ ]);
10170
+ /**
9466
10171
  * What the gate decided about a birth, from the CALLER's point of view.
9467
10172
  *
9468
10173
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11790,7 +12495,9 @@ var AddonHttpRouteSchema = object({
11790
12495
  "authenticated",
11791
12496
  "admin"
11792
12497
  ]).optional(),
11793
- description: string$2().optional()
12498
+ description: string$2().optional(),
12499
+ /** The hub limits this route per client address before the handler runs. */
12500
+ rateLimit: _enum(["auth"]).optional()
11794
12501
  });
11795
12502
  /**
11796
12503
  * Cross-process route invocation envelope. The hub captures the
@@ -12495,6 +13202,37 @@ var BackupDestinationInfoSchema = object({
12495
13202
  lastError: string$2().optional()
12496
13203
  });
12497
13204
  /**
13205
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13206
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13207
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13208
+ * with it off — which restores without a key.
13209
+ */
13210
+ var BackupArchiveEncryptionSchema = object({
13211
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13212
+ scheme: string$2(),
13213
+ /** 16 hex — the backup key whose secret restores this archive. */
13214
+ keyId: string$2()
13215
+ });
13216
+ /**
13217
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13218
+ * one new archives are encrypted to, and the retired ones older archives
13219
+ * still need. The secret key is shown once, at `setupEncryption`.
13220
+ */
13221
+ var BackupEncryptionStatusSchema = object({
13222
+ enabled: boolean(),
13223
+ active: object({
13224
+ keyId: string$2(),
13225
+ publicKey: string$2(),
13226
+ createdAt: number()
13227
+ }).nullable(),
13228
+ /** Every key ever set up, newest first. */
13229
+ keys: array(object({
13230
+ keyId: string$2(),
13231
+ createdAt: number(),
13232
+ retiredAt: number().nullable()
13233
+ })).readonly()
13234
+ });
13235
+ /**
12498
13236
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12499
13237
  * Same shape the destination drill-in renders. Sourced from the per-
12500
13238
  * location `manifests.json` (no per-archive tarball read required).
@@ -12506,7 +13244,9 @@ var BackupArchiveEntrySchema = object({
12506
13244
  sizeBytes: number(),
12507
13245
  label: string$2().optional(),
12508
13246
  /** Top-level locations included in the archive (db, addons, tls, …). */
12509
- locations: array(string$2()).readonly()
13247
+ locations: array(string$2()).readonly(),
13248
+ /** Present when the archive is encrypted; restore then needs that key. */
13249
+ encryption: BackupArchiveEncryptionSchema.optional()
12510
13250
  });
12511
13251
  var BackupEntrySchema = object({
12512
13252
  id: string$2(),
@@ -12515,7 +13255,8 @@ var BackupEntrySchema = object({
12515
13255
  label: string$2().optional(),
12516
13256
  createdAt: number(),
12517
13257
  sizeBytes: number(),
12518
- locations: array(string$2()).optional()
13258
+ locations: array(string$2()).optional(),
13259
+ encryption: BackupArchiveEncryptionSchema.optional()
12519
13260
  });
12520
13261
  var ArchiveEntrySchema = object({
12521
13262
  path: string$2(),
@@ -12704,10 +13445,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12704
13445
  * this list and skips entries whose path doesn't start with
12705
13446
  * any of them.
12706
13447
  */
12707
- locations: array(string$2()).optional()
13448
+ locations: array(string$2()).optional(),
13449
+ /**
13450
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13451
+ * one). The archive is decrypted into the hub's private staging
13452
+ * before the restart; the key is not stored. A wrong or missing key
13453
+ * is refused before the archive is downloaded.
13454
+ */
13455
+ backupSecretKey: string$2().optional()
12708
13456
  }), _void(), {
12709
13457
  kind: "mutation",
12710
13458
  auth: "admin"
13459
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13460
+ keyId: string$2(),
13461
+ secretKey: string$2(),
13462
+ publicKey: string$2(),
13463
+ createdAt: number(),
13464
+ replacedKeyId: string$2().nullable()
13465
+ }), {
13466
+ kind: "mutation",
13467
+ auth: "admin"
13468
+ }), method(object({}), object({ disabledKeyId: string$2().nullable() }), {
13469
+ kind: "mutation",
13470
+ auth: "admin"
13471
+ }), method(object({ backupSecretKey: string$2() }), object({
13472
+ valid: boolean(),
13473
+ keyId: string$2().nullable(),
13474
+ /** The hub knows this key (active or retired). */
13475
+ known: boolean(),
13476
+ /** It is the key new archives are encrypted to. */
13477
+ active: boolean(),
13478
+ error: string$2().optional()
13479
+ }), {
13480
+ kind: "mutation",
13481
+ auth: "admin"
12711
13482
  }), method(object({
12712
13483
  destinationId: string$2(),
12713
13484
  backupId: string$2()
@@ -14482,7 +15253,60 @@ var CustomModelDescriptorSchema = object({
14482
15253
  stepId: string$2(),
14483
15254
  entry: ModelCatalogEntrySchema
14484
15255
  });
14485
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15256
+ /** One regular file of an imported bundle, as the producer measured it. */
15257
+ var ModelBundleFileSchema = object({
15258
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15259
+ path: string$2().min(1),
15260
+ bytes: number().int().nonnegative(),
15261
+ sha256: string$2().regex(/^[0-9a-f]{64}$/)
15262
+ });
15263
+ var ImportModelBundleInputSchema = object({
15264
+ /** The registry provider that keeps the model (Model Studio). */
15265
+ addonId: string$2(),
15266
+ stepId: string$2().min(1),
15267
+ /**
15268
+ * The catalog rows to register, complete, every format URL already
15269
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15270
+ * bundle may carry several rows (a base and its INT8 variant).
15271
+ */
15272
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15273
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15274
+ bundle: object({
15275
+ ticket: PeerBytesTicketSchema,
15276
+ bytes: number().int().positive(),
15277
+ sha256: string$2().regex(/^[0-9a-f]{64}$/)
15278
+ }),
15279
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15280
+ files: array(ModelBundleFileSchema).min(1).max(64),
15281
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15282
+ distribute: boolean()
15283
+ });
15284
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15285
+ kind: literal("imported"),
15286
+ modelIds: array(string$2()).readonly(),
15287
+ distributed: array(object({
15288
+ modelId: string$2(),
15289
+ nodeId: string$2(),
15290
+ format: _enum(MODEL_FORMATS),
15291
+ ok: boolean(),
15292
+ error: string$2().optional()
15293
+ })).readonly()
15294
+ }), object({
15295
+ kind: literal("refused"),
15296
+ reason: _enum([
15297
+ "transfer-failed",
15298
+ "checksum-mismatch",
15299
+ "bundle-mismatch",
15300
+ "invalid-entry",
15301
+ "id-taken"
15302
+ ]),
15303
+ detail: string$2()
15304
+ })]);
15305
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15306
+ kind: "mutation",
15307
+ auth: "admin",
15308
+ timeoutMs: 30 * 6e4
15309
+ });
14486
15310
  /**
14487
15311
  * Query filter for settings-store collections.
14488
15312
  */
@@ -14961,6 +15785,35 @@ var KeychainKeySourceSchema = object({
14961
15785
  */
14962
15786
  sharesBackupWithDatabase: boolean()
14963
15787
  });
15788
+ /**
15789
+ * One keychain reset, as the Secrets page reports it until the operator
15790
+ * acknowledges it. Never a value: refs, counts and table names only.
15791
+ */
15792
+ var KeychainResetRecordSchema = object({
15793
+ id: string$2(),
15794
+ at: number(),
15795
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15796
+ actor: string$2(),
15797
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15798
+ lockedReason: string$2().nullable(),
15799
+ /** Values moved into the archive table (ciphertext under the lost key). */
15800
+ archived: number().int(),
15801
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15802
+ archivedCollection: string$2().nullable(),
15803
+ /**
15804
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15805
+ * so the archive can still be opened if the lost master key turns up.
15806
+ */
15807
+ archivedKeysCollection: string$2().nullable(),
15808
+ /**
15809
+ * `system-settings` keys whose marker the reset cleared — the cluster
15810
+ * secret's: a marker left pointing at an archived value would refuse every
15811
+ * agent forever (D797).
15812
+ */
15813
+ clearedSettingsKeys: array(string$2()).readonly(),
15814
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15815
+ acknowledgedAt: number().nullable()
15816
+ });
14964
15817
  var KeychainStatusSchema = object({
14965
15818
  keychain: KeychainStateSchema,
14966
15819
  /** The source of the master key in use; `null` while locked. */
@@ -14978,7 +15831,9 @@ var KeychainStatusSchema = object({
14978
15831
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
14979
15832
  retiredWraps: number().int(),
14980
15833
  recoveryKeyDownloadedAt: number().nullable(),
14981
- secretCount: number().int()
15834
+ secretCount: number().int(),
15835
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15836
+ lastReset: KeychainResetRecordSchema.nullable()
14982
15837
  });
14983
15838
  /**
14984
15839
  * Whether a stored value is still pointed at by its owner's settings.
@@ -15000,17 +15855,26 @@ var KeychainAuditActionSchema = _enum([
15000
15855
  "download-recovery-key",
15001
15856
  "delete-orphans",
15002
15857
  "reset",
15858
+ "acknowledge-reset",
15003
15859
  "initialize"
15004
15860
  ]);
15005
15861
  var KeychainAuditEntrySchema = object({
15006
15862
  id: string$2(),
15007
15863
  at: number(),
15008
15864
  action: KeychainAuditActionSchema,
15009
- /** `addon:<id>` | `user:<id>` | `system`. */
15865
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
15010
15866
  actor: string$2(),
15011
15867
  ref: string$2().nullable(),
15012
15868
  detail: string$2().nullable()
15013
15869
  });
15870
+ var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
15871
+ /**
15872
+ * Secrets the HUB itself holds (owner `system`) that no settings form shows:
15873
+ * `jwt-signing-key` — the session signing key (D797). It is always "in use",
15874
+ * never an orphan; it is generated on a fresh hub and replaced only through
15875
+ * {@link keychainAdminCapability.methods.setSystemSecret}.
15876
+ */
15877
+ var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
15014
15878
  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$2().min(1) }), object({
15015
15879
  value: string$2(),
15016
15880
  version: number().int()
@@ -15018,6 +15882,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15018
15882
  kind: "mutation",
15019
15883
  auth: "admin",
15020
15884
  caller: "required"
15885
+ }), method(object({
15886
+ name: SystemHeldSecretNameSchema,
15887
+ value: string$2().min(16)
15888
+ }), object({
15889
+ ref: string$2(),
15890
+ version: number().int()
15891
+ }), {
15892
+ kind: "mutation",
15893
+ auth: "admin",
15894
+ caller: "required"
15021
15895
  }), method(object({ refs: array(string$2().min(1)).max(1e3) }), object({
15022
15896
  deleted: array(string$2()).readonly(),
15023
15897
  kept: array(object({
@@ -15047,13 +15921,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15047
15921
  kind: "mutation",
15048
15922
  auth: "admin",
15049
15923
  caller: "required"
15050
- }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15924
+ }), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
15051
15925
  archivedCollection: string$2().nullable(),
15052
15926
  archived: number().int()
15053
15927
  }), {
15054
15928
  kind: "mutation",
15055
15929
  auth: "admin",
15056
15930
  caller: "required"
15931
+ }), method(object({}), object({
15932
+ reset: KeychainResetRecordSchema.nullable(),
15933
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15934
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15935
+ kind: "mutation",
15936
+ auth: "admin",
15937
+ caller: "required"
15057
15938
  });
15058
15939
  method(_void(), object({
15059
15940
  id: string$2(),
@@ -17619,14 +18500,14 @@ var LlmProfileSchema = object({
17619
18500
  /** ConfigUISchema tree passed through untyped on the wire (the
17620
18501
  * notification-output `ConfigSchemaPassthrough` precedent at
17621
18502
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
17622
- var ConfigSchemaPassthrough$1 = unknown();
18503
+ var ConfigSchemaPassthrough$3 = unknown();
17623
18504
  var LlmProfileKindDescriptorSchema = object({
17624
18505
  kind: LlmProfileKindSchema,
17625
18506
  label: string$2(),
17626
18507
  icon: string$2(),
17627
18508
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
17628
18509
  addonId: string$2(),
17629
- configSchema: ConfigSchemaPassthrough$1
18510
+ configSchema: ConfigSchemaPassthrough$3
17630
18511
  });
17631
18512
  var LlmDefaultSelectorSchema = union([object({ consumer: string$2() }), object({ purpose: _enum(["text", "vision"]) })]);
17632
18513
  var LlmDefaultSchema = object({
@@ -17904,7 +18785,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17904
18785
  * `login-method` — collection cap through which auth addons contribute
17905
18786
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17906
18787
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17907
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18788
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17908
18789
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17909
18790
  * procedure aggregates them for the unauthenticated login page.
17910
18791
  *
@@ -17912,8 +18793,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17912
18793
  *
17913
18794
  * - `redirect` — a declarative button. The login page renders a generic
17914
18795
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17915
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17916
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18796
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17917
18797
  * login page needs NO change.
17918
18798
  *
17919
18799
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -17932,8 +18812,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17932
18812
  * decision.
17933
18813
  *
17934
18814
  * Every contribution carries a `stage`:
17935
- * - `primary` — shown on the first credentials screen (OIDC /
17936
- * magic-link buttons; a future usernameless passkey).
18815
+ * - `primary` — shown on the first credentials screen (OIDC
18816
+ * buttons; a usernameless passkey).
17937
18817
  * - `second-factor` — shown AFTER the password leg, gated on the
17938
18818
  * returned `factors` (passkey-as-2FA today).
17939
18819
  *
@@ -17960,7 +18840,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17960
18840
  * The provider names an external identity a signed-in user can link to
17961
18841
  * their own account (D782): `auth.listLinkableProviders` /
17962
18842
  * `beginExternalLink` offer exactly the redirect methods that set this,
17963
- * whatever their id. Absent / false — a login button only (magic-link).
18843
+ * whatever their id. Absent / false — a login button only.
17964
18844
  */
17965
18845
  linkable: boolean().optional()
17966
18846
  }),
@@ -18748,7 +19628,7 @@ var TargetKindCapsSchema = object({
18748
19628
  * the union is large and not meant for runtime validation here; the exported
18749
19629
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
18750
19630
  */
18751
- var ConfigSchemaPassthrough = unknown();
19631
+ var ConfigSchemaPassthrough$2 = unknown();
18752
19632
  var TargetKindSchema = object({
18753
19633
  kind: string$2(),
18754
19634
  label: string$2(),
@@ -18785,7 +19665,7 @@ var TargetKindSchema = object({
18785
19665
  * its raster path, which is the safe default for an unknown image.
18786
19666
  */
18787
19667
  iconMediaType: string$2().optional(),
18788
- configSchema: ConfigSchemaPassthrough,
19668
+ configSchema: ConfigSchemaPassthrough$2,
18789
19669
  /**
18790
19670
  * The config keys that decide WHERE this kind's secrets are sent (server,
18791
19671
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -21815,8 +22695,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21815
22695
  * `super_admin` — collapsed onto the single boolean because every
21816
22696
  * non-admin caller is governed by the same scope-check rules; the
21817
22697
  * distinction was only ever used to route role-specific procedures
21818
- * which we no longer have. Agents are admin sessions issued via
21819
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22698
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21820
22699
  * with `isAdmin: false` + an explicit scope list.
21821
22700
  */
21822
22701
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -22123,6 +23002,61 @@ var OauthIntegrationDescriptorSchema = object({
22123
23002
  });
22124
23003
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
22125
23004
  /**
23005
+ * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
23006
+ *
23007
+ * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
23008
+ * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
23009
+ * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
23010
+ * immutable after create.
23011
+ */
23012
+ var ConfigSchemaPassthrough$1 = unknown();
23013
+ var OidcConnectionSchema = object({
23014
+ id: string$2().min(1),
23015
+ displayName: string$2(),
23016
+ icon: string$2(),
23017
+ issuerUrl: string$2(),
23018
+ clientId: string$2(),
23019
+ /** Client id + secret present — never the secret value. */
23020
+ configured: boolean(),
23021
+ /**
23022
+ * Values for the connection form schema. `clientSecret` is a keychain
23023
+ * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
23024
+ */
23025
+ formValues: record(string$2(), unknown()).optional()
23026
+ });
23027
+ /**
23028
+ * Patch one connection. Omitted or empty `clientSecret` keeps the stored
23029
+ * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
23030
+ */
23031
+ var OidcConnectionUpdateInputSchema = object({
23032
+ id: string$2().min(1),
23033
+ displayName: string$2().min(1),
23034
+ icon: string$2().optional(),
23035
+ issuerUrl: string$2().optional(),
23036
+ clientId: string$2().optional(),
23037
+ clientSecret: union([string$2(), object({ $secretClear: literal(true) })]).optional(),
23038
+ redirectUri: string$2().optional(),
23039
+ scopes: string$2().optional(),
23040
+ usernameClaim: _enum([
23041
+ "preferred_username",
23042
+ "email",
23043
+ "sub"
23044
+ ]).optional()
23045
+ });
23046
+ method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
23047
+ id: string$2().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
23048
+ displayName: string$2().min(1)
23049
+ }), object({ id: string$2() }), {
23050
+ kind: "mutation",
23051
+ auth: "admin"
23052
+ }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
23053
+ kind: "mutation",
23054
+ auth: "admin"
23055
+ }), method(object({ id: string$2().min(1) }), object({ ok: literal(true) }), {
23056
+ kind: "mutation",
23057
+ auth: "admin"
23058
+ });
23059
+ /**
22126
23060
  * What started a camera's onboard motion (D672). `camera` is the camera's own
22127
23061
  * firmware; `sensor` is a device the operator ATTACHED to it. Absent on the
22128
23062
  * wire means the camera: only the camera-sensors bridge ever says `sensor`.
@@ -23479,21 +24413,69 @@ var RetrainFrameListSchema = object({
23479
24413
  /** What the page pre-selects — the native key frame when one survives. */
23480
24414
  autoPickMediaId: number().int().optional()
23481
24415
  });
24416
+ /** Exclusive partition of a corpus copy's annotation progress (design §4.2). */
24417
+ var RetrainFrameWorkStateSchema = _enum([
24418
+ "unannotated",
24419
+ "annotated",
24420
+ "complete"
24421
+ ]);
24422
+ /**
24423
+ * Filters for paginated corpus list, KPI, and matching export (design §4.4).
24424
+ * Every narrowing field is ANDed; omitted fields impose no constraint.
24425
+ */
24426
+ var RetrainCorpusFilterSchema = object({
24427
+ workState: RetrainFrameWorkStateSchema.optional(),
24428
+ deviceIds: array(number()).max(500).optional(),
24429
+ /** When set, only frames in this named collection. */
24430
+ collectionId: string$2().optional(),
24431
+ /** Frames that carry at least one saved annotation in one of these classes. */
24432
+ classes: array(RetrainMacroClassSchema).optional(),
24433
+ page: number().int().positive().default(1),
24434
+ pageSize: number().int().positive().max(100).default(50)
24435
+ });
24436
+ var RetrainCorpusPageSchema = object({
24437
+ frames: array(RetrainFrameSchema.extend({ workState: RetrainFrameWorkStateSchema })).readonly(),
24438
+ total: number().int().nonnegative(),
24439
+ page: number().int().positive(),
24440
+ pageSize: number().int().positive()
24441
+ });
24442
+ var RetrainCorpusKpiCameraRowSchema = object({
24443
+ deviceId: number(),
24444
+ unannotated: number().int().nonnegative(),
24445
+ annotated: number().int().nonnegative(),
24446
+ complete: number().int().nonnegative(),
24447
+ /** This camera's `complete` count divided by corpus `total`, in `[0,1]`.
24448
+ * `null` when the corpus is empty (no ratio). */
24449
+ pctOfCorpus: number().min(0).max(1).nullable()
24450
+ });
24451
+ var RetrainCorpusKpiSchema = object({
24452
+ total: number().int().nonnegative(),
24453
+ unannotated: number().int().nonnegative(),
24454
+ annotated: number().int().nonnegative(),
24455
+ complete: number().int().nonnegative(),
24456
+ cameras: array(RetrainCorpusKpiCameraRowSchema).readonly()
24457
+ });
23482
24458
  /**
23483
24459
  * Which frames an annotated export carries. Every field narrows; an empty
23484
- * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23485
- * list owned by whoever trains (the training orchestrator), so `frameIds` is
23486
- * the primitive a version export uses; `batchId` re-selects what an earlier
23487
- * export carried (`exportedInBatch`).
24460
+ * filter is every annotated copy. `frameIds` is the primitive a job or
24461
+ * download uses; `batchId` re-selects what an earlier export carried
24462
+ * (`exportedInBatch`). Frozen dataset versions were removed — live selection
24463
+ * resolves to `frameIds` at plan/start.
23488
24464
  */
23489
24465
  var RetrainExportFilterSchema = object({
23490
24466
  deviceIds: array(number()).optional(),
23491
24467
  frameIds: array(string$2()).max(2e4).optional(),
23492
24468
  /** Only frames in at least one of these named collections. */
23493
24469
  collectionIds: array(string$2()).max(200).optional(),
24470
+ /** Single collection (Frames filter bar). ANDed with `collectionIds` when both set. */
24471
+ collectionId: string$2().optional(),
23494
24472
  batchId: string$2().optional(),
23495
24473
  /** Only frames the operator marked complete (all subjects boxed). */
23496
- completeOnly: boolean().optional()
24474
+ completeOnly: boolean().optional(),
24475
+ /** Exclusive work-state partition (`workStateOf`); same as the corpus list. */
24476
+ workState: RetrainFrameWorkStateSchema.optional(),
24477
+ /** Frames with at least one saved annotation in one of these classes. */
24478
+ classes: array(RetrainMacroClassSchema).optional()
23497
24479
  });
23498
24480
  /**
23499
24481
  * `frames`: the full frame copies, boxes in `annotations.json`.
@@ -23658,6 +24640,77 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23658
24640
  ]),
23659
24641
  detail: string$2().optional()
23660
24642
  })]);
24643
+ /** What a dataset version is cut from. Every field narrows. */
24644
+ var RetrainDatasetSelectionSchema = object({
24645
+ deviceIds: array(number()).readonly().optional(),
24646
+ collectionIds: array(string$2()).max(200).readonly().optional(),
24647
+ frameIds: array(string$2()).max(2e4).readonly().optional()
24648
+ });
24649
+ /** The counts a dataset is judged by. */
24650
+ var RetrainDatasetStatsSchema = object({
24651
+ frames: number().int(),
24652
+ completeFrames: number().int(),
24653
+ /** `completeFrames / frames`, 0..1. */
24654
+ completeness: number(),
24655
+ /** Boxes to learn (model errors excluded). */
24656
+ subjects: number().int(),
24657
+ modelErrors: number().int(),
24658
+ /** Complete frames with no subject. */
24659
+ hardNegatives: number().int(),
24660
+ /** Subjects per class × camera × day/night. */
24661
+ cells: array(object({
24662
+ macroClass: string$2(),
24663
+ deviceId: number(),
24664
+ lighting: _enum([
24665
+ "day",
24666
+ "night",
24667
+ "unknown"
24668
+ ]),
24669
+ subjects: number().int(),
24670
+ frames: number().int()
24671
+ })).readonly(),
24672
+ cameras: array(object({
24673
+ deviceId: number(),
24674
+ frames: number().int(),
24675
+ completeFrames: number().int()
24676
+ })).readonly()
24677
+ });
24678
+ object({
24679
+ id: string$2(),
24680
+ name: string$2(),
24681
+ createdAt: number(),
24682
+ selection: RetrainDatasetSelectionSchema,
24683
+ layout: RetrainExportLayoutSchema,
24684
+ completeOnly: boolean(),
24685
+ frameCount: number().int(),
24686
+ annotationHash: string$2(),
24687
+ manifestSchema: string$2(),
24688
+ stats: RetrainDatasetStatsSchema
24689
+ });
24690
+ /**
24691
+ * Live training corpus criteria — same shape as `TrainingCorpusSelection` on
24692
+ * the training cap. Resolved here so plan/start and the annotated export share
24693
+ * one definition of "the frames" (`buildRetrainExportPlan`).
24694
+ */
24695
+ var RetrainTrainingCorpusSelectionSchema = object({
24696
+ collectionIds: array(string$2()).min(1),
24697
+ workState: _enum([
24698
+ "complete",
24699
+ "annotated_or_complete",
24700
+ "any_annotated"
24701
+ ]).default("complete")
24702
+ });
24703
+ var RetrainTrainingCorpusResolveResultSchema = discriminatedUnion("kind", [object({
24704
+ kind: literal("resolved"),
24705
+ frameIds: array(string$2()).max(2e4).readonly(),
24706
+ stats: RetrainDatasetStatsSchema,
24707
+ annotationHash: string$2(),
24708
+ layout: RetrainExportLayoutSchema
24709
+ }), object({
24710
+ kind: literal("refused"),
24711
+ reason: _enum(["unknown-collection", "no-frames"]),
24712
+ detail: string$2()
24713
+ })]);
23661
24714
  /** The outcome of a lifecycle move owned by the retrain page. */
23662
24715
  var RetrainTransitionResultSchema = object({
23663
24716
  trackId: string$2(),
@@ -24363,6 +25416,12 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24363
25416
  }), array(RetrainTrackSchema).readonly(), {
24364
25417
  kind: "query",
24365
25418
  auth: "admin"
25419
+ }), method(RetrainCorpusFilterSchema, RetrainCorpusPageSchema, {
25420
+ kind: "query",
25421
+ auth: "admin"
25422
+ }), method(object({}), RetrainCorpusKpiSchema, {
25423
+ kind: "query",
25424
+ auth: "admin"
24366
25425
  }), method(object({ trackId: string$2() }), RetrainFrameListSchema, {
24367
25426
  kind: "query",
24368
25427
  auth: "admin"
@@ -24447,6 +25506,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24447
25506
  kind: "mutation",
24448
25507
  auth: "admin",
24449
25508
  timeoutMs: 60 * 6e4
25509
+ }), method(object({
25510
+ filter: RetrainExportFilterSchema,
25511
+ layout: RetrainExportLayoutSchema
25512
+ }), object({
25513
+ ticket: PeerBytesTicketSchema,
25514
+ frames: number().int(),
25515
+ annotations: number().int()
25516
+ }), {
25517
+ kind: "mutation",
25518
+ auth: "admin",
25519
+ timeoutMs: 12e4
24450
25520
  }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24451
25521
  kind: "query",
24452
25522
  auth: "admin"
@@ -24473,6 +25543,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24473
25543
  }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24474
25544
  kind: "query",
24475
25545
  auth: "admin"
25546
+ }), method(RetrainTrainingCorpusSelectionSchema, RetrainTrainingCorpusResolveResultSchema, {
25547
+ kind: "query",
25548
+ auth: "admin",
25549
+ timeoutMs: 6e4
24476
25550
  }), method(object({
24477
25551
  id: string$2(),
24478
25552
  name: string$2().max(120)
@@ -25089,11 +26163,14 @@ var HardwareClassIdSchema = _enum([
25089
26163
  "intel-n-series",
25090
26164
  "apple-m-base",
25091
26165
  "apple-m-pro",
26166
+ "amd-phoenix",
25092
26167
  "unknown"
25093
26168
  ]);
25094
26169
  var AcceleratorKindSchema = _enum([
25095
26170
  "intel-npu",
25096
26171
  "intel-igpu",
26172
+ "amd-igpu",
26173
+ "amd-npu",
25097
26174
  "x86-cpu",
25098
26175
  "arm-cpu",
25099
26176
  "apple-ane",
@@ -27023,6 +28100,8 @@ var AgentPipelineSettingsSchema = object({
27023
28100
  * address is wrong (multi-homed host, NAT, custom interface).
27024
28101
  */
27025
28102
  reachableHost: string$2().optional(),
28103
+ /** Hub-persisted UI colour (`--color-node-*` theme tokens). */
28104
+ color: NodeColorIdSchema.optional(),
27026
28105
  /**
27027
28106
  * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
27028
28107
  * weight, steps}. Absent / all-disabled ⇒ the node's single default
@@ -27572,8 +28651,9 @@ method(object({
27572
28651
  auth: "admin"
27573
28652
  }), method(object({
27574
28653
  agentNodeId: string$2(),
27575
- reachableHost: string$2().nullable()
27576
- }), object({ success: literal(true) }), {
28654
+ reachableHost: string$2().nullable().optional(),
28655
+ color: NodeColorIdSchema.nullable().optional()
28656
+ }).refine((v) => v.reachableHost !== void 0 || v.color !== void 0, { message: "reachableHost or color required" }), object({ success: literal(true) }), {
27577
28657
  kind: "mutation",
27578
28658
  auth: "admin"
27579
28659
  }), method(object({
@@ -28025,8 +29105,8 @@ version: string$2().optional() }), ServerUpdateActionResultSchema, {
28025
29105
  * `smtp-provider` — pluggable email delivery surface.
28026
29106
  *
28027
29107
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
28028
- * one for transactional / one for notifications). Consumers (magic-link,
28029
- * notifier addons, …) walk the collection and pick the first
29108
+ * one for transactional / one for notifications). Consumers (notifier
29109
+ * addons, …) walk the collection and pick the first
28030
29110
  * ready provider OR target a specific addonId.
28031
29111
  *
28032
29112
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -28205,7 +29285,7 @@ targets: array(object({
28205
29285
  })));
28206
29286
  /**
28207
29287
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
28208
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
29288
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
28209
29289
  * carrying the post-callback claims before redirecting back to
28210
29290
  * `/api/auth/sso/finish`.
28211
29291
  *
@@ -28268,7 +29348,14 @@ var SsoBridgeClaimsSchema = object({
28268
29348
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28269
29349
  * subject is unique only per issuer, so a link is bound to it.
28270
29350
  */
28271
- issuer: string$2().optional()
29351
+ issuer: string$2().optional(),
29352
+ /**
29353
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
29354
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
29355
+ * request to present the matching cookie — a login bridge is useless in
29356
+ * any other browser.
29357
+ */
29358
+ browserBinding: string$2().optional()
28272
29359
  });
28273
29360
  method(object({
28274
29361
  claims: SsoBridgeClaimsSchema,
@@ -30642,7 +31729,7 @@ var CustomActionInputSchema = object({
30642
31729
  action: string$2().min(1),
30643
31730
  input: unknown()
30644
31731
  });
30645
- method(_void(), array(AddonListItemSchema).readonly()), method(object({
31732
+ method(object({ nodeId: string$2().optional() }).optional(), array(AddonListItemSchema).readonly()), method(object({
30646
31733
  addonId: string$2(),
30647
31734
  limit: number().min(1).max(500).default(100),
30648
31735
  level: LogLevelSchema$2.optional()
@@ -35721,7 +36808,13 @@ var TopologyNodeSchema = object({
35721
36808
  })).readonly(),
35722
36809
  processes: array(TopologyProcessSchema).readonly(),
35723
36810
  categories: array(TopologyCategorySchema).readonly(),
35724
- rootPackage: TopologyRootPackageSchema.nullable()
36811
+ rootPackage: TopologyRootPackageSchema.nullable(),
36812
+ /**
36813
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
36814
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
36815
+ * for offline rows and when the hub cannot tell.
36816
+ */
36817
+ meshTransport: _enum(["tls", "clear"]).optional()
35725
36818
  });
35726
36819
  var CapUsageEdgeSchema = object({
35727
36820
  callerAddonId: string$2(),
@@ -36134,6 +37227,7 @@ var OsdNamedTemplateSchema = object({
36134
37227
  });
36135
37228
  /** Where a slot's value comes from. */
36136
37229
  var OsdSourceSchema = discriminatedUnion("kind", [
37230
+ object({ kind: literal("none") }),
36137
37231
  object({
36138
37232
  kind: literal("static"),
36139
37233
  text: string$2().max(64)
@@ -36260,6 +37354,13 @@ method(object({ deviceId: number().int() }), object({
36260
37354
  }), object({ success: literal(true) }), {
36261
37355
  kind: "mutation",
36262
37356
  auth: "admin"
37357
+ }), method(object({
37358
+ deviceId: number().int(),
37359
+ slotId: string$2().min(1),
37360
+ enabled: boolean()
37361
+ }), object({ success: literal(true) }), {
37362
+ kind: "mutation",
37363
+ auth: "admin"
36263
37364
  }), method(object({
36264
37365
  sourceDeviceId: number().int(),
36265
37366
  targetDeviceId: number().int()
@@ -36691,7 +37792,15 @@ var GpuInfoSchema = object({
36691
37792
  name: string$2(),
36692
37793
  memoryMB: number().optional()
36693
37794
  });
36694
- var NpuInfoSchema = object({ type: _enum(["apple-ane", "intel-npu"]) });
37795
+ var NpuInfoSchema = object({
37796
+ type: _enum([
37797
+ "apple-ane",
37798
+ "intel-npu",
37799
+ "amd-xdna"
37800
+ ]),
37801
+ name: string$2().optional(),
37802
+ generation: _enum(["xdna1", "xdna2"]).optional()
37803
+ });
36695
37804
  var CoralInfoSchema = object({
36696
37805
  type: literal("coral-edgetpu"),
36697
37806
  bus: string$2().optional()
@@ -40544,16 +41653,6 @@ var ApiKeySummarySchema = object({
40544
41653
  createdAt: number(),
40545
41654
  lastUsedAt: number().optional()
40546
41655
  });
40547
- var CreateApiKeyInputSchema = object({
40548
- label: string$2(),
40549
- isAdmin: boolean().default(false),
40550
- allowedProviders: union([array(string$2()), literal("*")]).optional(),
40551
- allowedDevices: record(string$2(), union([array(string$2()), literal("*")])).optional()
40552
- });
40553
- var CreateApiKeyResultSchema = object({
40554
- token: string$2(),
40555
- record: ApiKeySummarySchema
40556
- });
40557
41656
  var ScopedTokenSummarySchema = object({
40558
41657
  id: string$2(),
40559
41658
  userId: string$2(),
@@ -40652,17 +41751,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40652
41751
  }), UserSummarySchema.extend({ passwordHash: string$2() }).nullable(), {
40653
41752
  kind: "mutation",
40654
41753
  access: "view"
40655
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
40656
- kind: "mutation",
40657
- auth: "admin",
40658
- access: "create"
40659
- }), method(object({ id: string$2() }), object({ success: literal(true) }), {
41754
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string$2() }), object({ success: literal(true) }), {
40660
41755
  kind: "mutation",
40661
41756
  auth: "admin",
40662
41757
  access: "delete"
40663
- }), method(object({ token: string$2() }), ApiKeySummarySchema.nullable(), {
40664
- kind: "mutation",
40665
- access: "view"
40666
41758
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
40667
41759
  kind: "mutation",
40668
41760
  auth: "admin",
@@ -40736,15 +41828,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40736
41828
  }).nullable(), { access: "view" }), method(object({ userId: string$2() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
40737
41829
  userId: string$2(),
40738
41830
  issuer: string$2()
40739
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
40740
- userId: string$2(),
40741
- issuer: string$2().min(1),
40742
- label: string$2().optional()
40743
- }), object({ success: literal(true) }), {
40744
- kind: "mutation",
40745
- auth: "admin",
40746
- access: "create"
40747
- }), method(ExternalIdentityKeySchema.extend({ userId: string$2() }), object({ success: boolean() }), {
41831
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string$2() }), object({ success: boolean() }), {
40748
41832
  kind: "mutation",
40749
41833
  auth: "admin",
40750
41834
  access: "delete"
@@ -41449,6 +42533,563 @@ var zoneRulesCapability = {
41449
42533
  */
41450
42534
  durability: "restored"
41451
42535
  };
42536
+ /**
42537
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
42538
+ *
42539
+ * A thin, mockable translation layer: it knows how to run a container with a
42540
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
42541
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
42542
+ * those are the `training` orchestrator's (D805). Every rule written there
42543
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
42544
+ * manifest entry and nothing else.
42545
+ *
42546
+ * Collection of provider **types** (addons). Each addon owns zero or more
42547
+ * **entries** (credentials + defaults). Concat-fans: `describe`,
42548
+ * `describeTypes`, `listEntries`, `listJobs`. Single-row work is keyed by
42549
+ * `entryId`; callers also pass the owning `addonId` as the collection
42550
+ * selector (broker posture). Every method is `admin`: these spend money.
42551
+ *
42552
+ * Every cloud object a provider creates is tagged with the orchestrator's
42553
+ * `jobKey`, so a retried submit finds the job it already started instead of
42554
+ * starting a second GPU, and `listJobs` can find orphans.
42555
+ *
42556
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
42557
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
42558
+ * ticket the provider mints (D613).
42559
+ */
42560
+ var TrainingGpuOptionSchema = object({
42561
+ id: string$2(),
42562
+ label: string$2(),
42563
+ /** List price, USD per GPU-hour, before any region multiplier. */
42564
+ usdPerHour: number().nonnegative(),
42565
+ vramGb: number().nonnegative()
42566
+ });
42567
+ var TrainingRegionOptionSchema = object({
42568
+ /** `''` = any region (the provider's choice). */
42569
+ id: string$2(),
42570
+ label: string$2(),
42571
+ priceMultiplier: number().positive()
42572
+ });
42573
+ /**
42574
+ * The provider's per-entry settings, as the orchestrator reads them. They
42575
+ * live on the PROVIDER addon's entry (operator decision 2026-10-08: they
42576
+ * depend on the user's account), never hard-coded in the orchestrator.
42577
+ */
42578
+ var TrainingProviderDefaultsSchema = object({
42579
+ gpuType: string$2(),
42580
+ region: string$2(),
42581
+ costCapUsd: number().nonnegative(),
42582
+ maxRuntimeSec: number().int().positive(),
42583
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
42584
+ failedDatasetGraceHours: number().nonnegative()
42585
+ });
42586
+ /**
42587
+ * Entry form schema for a provider type — same seam as notification
42588
+ * `TargetKind.configSchema` (`z.unknown()` at the wire; callers tighten to
42589
+ * {@link ConfigUISchema}). Drives `ConfigFormBuilder` on Training → Providers.
42590
+ */
42591
+ var ConfigSchemaPassthrough = unknown();
42592
+ /** One creatable provider type, for the Add-entry dialog. */
42593
+ var TrainingProviderTypeSchema = object({
42594
+ typeId: string$2(),
42595
+ label: string$2(),
42596
+ /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
42597
+ iconAsset: string$2(),
42598
+ /** Owning `training-provider` addon — collection selector for createEntry. */
42599
+ addonId: string$2(),
42600
+ /**
42601
+ * Fields for one entry of this type (credentials + defaults). Absent on a
42602
+ * type that only needs a name. Password fields are keychain-backed on the
42603
+ * provider addon (`secretStatePaths`), not D634 plaintext.
42604
+ */
42605
+ configSchema: ConfigSchemaPassthrough.optional()
42606
+ });
42607
+ /** One configured account / workspace under a provider type. */
42608
+ var TrainingProviderEntrySchema = object({
42609
+ entryId: string$2(),
42610
+ typeId: string$2(),
42611
+ name: string$2(),
42612
+ addonId: string$2(),
42613
+ /** Credentials are present — never the values. */
42614
+ configured: boolean()
42615
+ });
42616
+ var TrainingProviderDescriptorSchema = object({
42617
+ addonId: string$2(),
42618
+ entryId: string$2(),
42619
+ typeId: string$2(),
42620
+ /** Operator-chosen entry name. */
42621
+ name: string$2(),
42622
+ iconAsset: string$2(),
42623
+ /** `modal`, `runpod`, `fake`, … — same as typeId for current providers. */
42624
+ kind: string$2(),
42625
+ label: string$2(),
42626
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
42627
+ regions: array(TrainingRegionOptionSchema).readonly(),
42628
+ maxDatasetBytes: number().int().positive(),
42629
+ maxRuntimeSec: number().int().positive(),
42630
+ freeTierNote: string$2().optional(),
42631
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
42632
+ dataResidencyNote: string$2(),
42633
+ /** Credentials are present — never the values. */
42634
+ configured: boolean(),
42635
+ defaults: TrainingProviderDefaultsSchema,
42636
+ /**
42637
+ * Values for {@link TrainingProviderTypeSchema}'s `configSchema` — password
42638
+ * fields are keychain {@link SecretFieldView} or `null` / `''` (create),
42639
+ * never plaintext. Same hydrate contract as settings forms (D789).
42640
+ */
42641
+ formValues: record(string$2(), unknown()).optional()
42642
+ });
42643
+ /**
42644
+ * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
42645
+ * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
42646
+ * `{ $secretClear: true }` clears it.
42647
+ */
42648
+ var TrainingProviderUpdateEntryInputSchema = object({
42649
+ entryId: string$2().min(1),
42650
+ name: string$2().min(1),
42651
+ tokenId: string$2().optional(),
42652
+ tokenSecret: union([string$2(), object({ $secretClear: literal(true) })]).optional(),
42653
+ environment: string$2().optional(),
42654
+ gpuType: string$2().optional(),
42655
+ region: string$2().optional(),
42656
+ costCapUsd: number().nonnegative().optional(),
42657
+ maxRuntimeSec: number().int().positive().optional(),
42658
+ failedDatasetGraceHours: number().nonnegative().optional()
42659
+ });
42660
+ var TrainingCredentialCheckSchema = object({
42661
+ ok: boolean(),
42662
+ /** Workspace / account name, when the provider says. */
42663
+ account: string$2().optional(),
42664
+ reason: _enum([
42665
+ "missing",
42666
+ "invalid",
42667
+ "forbidden",
42668
+ "network",
42669
+ "quota"
42670
+ ]).optional(),
42671
+ detail: string$2().optional()
42672
+ });
42673
+ var ProviderJobStateSchema = _enum([
42674
+ "pending",
42675
+ "starting",
42676
+ "running",
42677
+ "succeeded",
42678
+ "failed",
42679
+ "cancelled",
42680
+ "lost"
42681
+ ]);
42682
+ var ProviderJobStatusSchema = object({
42683
+ jobKey: string$2(),
42684
+ providerJobId: string$2().optional(),
42685
+ state: ProviderJobStateSchema,
42686
+ startedAt: number().optional(),
42687
+ endedAt: number().optional(),
42688
+ exitCode: number().int().optional(),
42689
+ failureReason: string$2().optional(),
42690
+ gpuType: string$2(),
42691
+ region: string$2().optional(),
42692
+ billedSeconds: number().nonnegative(),
42693
+ costUsd: number().nonnegative(),
42694
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
42695
+ costIsEstimate: boolean(),
42696
+ lastFetchedAt: number()
42697
+ });
42698
+ /**
42699
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
42700
+ * image its own way (Modal builds the published Dockerfile at that revision;
42701
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
42702
+ * in `result.json`.
42703
+ */
42704
+ var TrainerSourceRefSchema = object({
42705
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
42706
+ repo: string$2().min(1),
42707
+ /** A commit sha (never a branch) — the job must be reproducible. */
42708
+ revision: string$2().regex(/^[0-9a-f]{7,64}$/)
42709
+ });
42710
+ /** Cloud job identity — route with the owning addon's `addonId` selector. */
42711
+ var JobRef = {
42712
+ entryId: string$2().min(1),
42713
+ jobKey: string$2().uuid()
42714
+ };
42715
+ var TrainingLogLineSchema = object({
42716
+ ts: number(),
42717
+ text: string$2()
42718
+ });
42719
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
42720
+ typeId: string$2().min(1),
42721
+ name: string$2().min(1)
42722
+ }), object({ entryId: string$2() }), {
42723
+ kind: "mutation",
42724
+ auth: "admin"
42725
+ }), method(object({ entryId: string$2().min(1) }), object({ ok: literal(true) }), {
42726
+ kind: "mutation",
42727
+ auth: "admin"
42728
+ }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
42729
+ kind: "mutation",
42730
+ auth: "admin"
42731
+ }), method(object({ entryId: string$2().min(1) }), TrainingCredentialCheckSchema, {
42732
+ kind: "mutation",
42733
+ auth: "admin",
42734
+ timeoutMs: 3e4
42735
+ }), method(object({
42736
+ entryId: string$2().min(1),
42737
+ gpuType: string$2(),
42738
+ region: string$2(),
42739
+ datasetBytes: number().int().nonnegative(),
42740
+ gpuSecondsLow: number().nonnegative(),
42741
+ gpuSecondsHigh: number().nonnegative()
42742
+ }), object({
42743
+ usdLow: number().nonnegative(),
42744
+ usdHigh: number().nonnegative(),
42745
+ notes: array(string$2()).readonly()
42746
+ }), { auth: "admin" }), method(object({
42747
+ ...JobRef,
42748
+ ticket: PeerBytesTicketSchema
42749
+ }), object({
42750
+ bytes: number().int().nonnegative(),
42751
+ sha256: string$2()
42752
+ }), {
42753
+ kind: "mutation",
42754
+ auth: "admin",
42755
+ timeoutMs: 120 * 6e4
42756
+ }), method(object({
42757
+ ...JobRef,
42758
+ trainer: TrainerSourceRefSchema,
42759
+ jobSpecJson: string$2().min(2).max(64e3),
42760
+ gpuType: string$2(),
42761
+ region: string$2(),
42762
+ maxRuntimeSec: number().int().positive()
42763
+ }), ProviderJobStatusSchema, {
42764
+ kind: "mutation",
42765
+ auth: "admin",
42766
+ timeoutMs: 30 * 6e4
42767
+ }), method(object(JobRef), ProviderJobStatusSchema, {
42768
+ auth: "admin",
42769
+ timeoutMs: 6e4
42770
+ }), method(object({
42771
+ ...JobRef,
42772
+ cursor: string$2().optional(),
42773
+ max: number().int().min(1).max(500)
42774
+ }), object({
42775
+ lines: array(TrainingLogLineSchema).readonly(),
42776
+ cursor: string$2()
42777
+ }), {
42778
+ auth: "admin",
42779
+ timeoutMs: 6e4
42780
+ }), method(object(JobRef), object({ ok: literal(true) }), {
42781
+ kind: "mutation",
42782
+ auth: "admin",
42783
+ timeoutMs: 6e4
42784
+ }), method(object(JobRef), object({
42785
+ found: boolean(),
42786
+ text: string$2().optional()
42787
+ }), {
42788
+ kind: "mutation",
42789
+ auth: "admin",
42790
+ timeoutMs: 5 * 6e4
42791
+ }), method(object({
42792
+ ...JobRef,
42793
+ path: _enum(["bundle.tar"])
42794
+ }), object({ ticket: PeerBytesTicketSchema }), {
42795
+ kind: "mutation",
42796
+ auth: "admin",
42797
+ timeoutMs: 5 * 6e4
42798
+ }), method(object(JobRef), object({ deleted: array(string$2()).readonly() }), {
42799
+ kind: "mutation",
42800
+ auth: "admin",
42801
+ timeoutMs: 5 * 6e4
42802
+ }), method(object({ entryId: string$2().min(1).optional() }), array(ProviderJobStatusSchema).readonly(), {
42803
+ auth: "admin",
42804
+ timeoutMs: 2 * 6e4
42805
+ });
42806
+ /**
42807
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
42808
+ * provided by `addon-training`.
42809
+ *
42810
+ * It owns what every provider must agree on, written once:
42811
+ *
42812
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
42813
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
42814
+ * - **The return flow.** Verified artefacts → Model Studio
42815
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
42816
+ * rollback. Nothing is ever registered automatically.
42817
+ *
42818
+ * Plan/start takes a live {@link TrainingCorpusSelection} (collections +
42819
+ * work-state rule); frame ids are resolved via pipeline-analytics at that
42820
+ * moment and snapshotted on the job. No frozen dataset version.
42821
+ *
42822
+ * Every method is `admin`.
42823
+ */
42824
+ /**
42825
+ * Live corpus criteria for plan/start (design §5.2). Default is complete-only.
42826
+ * Frame ids are resolved at plan/start — never a frozen version id.
42827
+ */
42828
+ var TrainingCorpusSelectionSchema = object({
42829
+ collectionIds: array(string$2()).min(1),
42830
+ /** Default complete-only for v1 */
42831
+ workState: _enum([
42832
+ "complete",
42833
+ "annotated_or_complete",
42834
+ "any_annotated"
42835
+ ]).default("complete")
42836
+ });
42837
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
42838
+ var TrainingBaseModelSchema = object({
42839
+ modelId: string$2(),
42840
+ label: string$2(),
42841
+ weights: string$2(),
42842
+ imgsz: number().int(),
42843
+ baselineOnnxUrl: string$2(),
42844
+ baselineFloors: record(string$2(), number()),
42845
+ /** The base the fleet runs most — the UI's default. */
42846
+ recommended: boolean()
42847
+ });
42848
+ var TrainingPresetSchema = _enum([
42849
+ "quick",
42850
+ "standard",
42851
+ "thorough"
42852
+ ]);
42853
+ var TrainingJobRequestSchema = object({
42854
+ /** Live collection + work-state criteria; resolved at plan/start. */
42855
+ selection: TrainingCorpusSelectionSchema,
42856
+ /**
42857
+ * The provider **entry** that runs it (credentials + defaults).
42858
+ * Resolve to an owning addon via `training-provider.describe` / `listEntries`.
42859
+ */
42860
+ entryId: string$2().min(1),
42861
+ gpuType: string$2().min(1),
42862
+ region: string$2(),
42863
+ baseModelId: string$2().min(1),
42864
+ preset: TrainingPresetSchema,
42865
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
42866
+ freeze: number().int().nonnegative().nullable(),
42867
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
42868
+ holdoutCameras: array(number().int()).nullable()
42869
+ });
42870
+ var TrainingSplitPlanSchema = object({
42871
+ holdoutCameras: array(number().int()).readonly(),
42872
+ /** Used when no camera is held out: the last N days of every camera. */
42873
+ holdoutLastDays: number().int().nonnegative(),
42874
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
42875
+ holdoutSupport: record(string$2(), number().int()).nullable(),
42876
+ trainSubjects: number().int()
42877
+ });
42878
+ var TrainingRefusalReasonSchema = _enum([
42879
+ "unknown-dataset",
42880
+ "unknown-provider",
42881
+ "provider-not-configured",
42882
+ "unknown-base-model",
42883
+ "unknown-gpu",
42884
+ "dataset-too-large",
42885
+ "no-training-subjects",
42886
+ "job-already-running"
42887
+ ]);
42888
+ var TrainingJobPlanSchema = object({
42889
+ refusal: object({
42890
+ reason: TrainingRefusalReasonSchema,
42891
+ detail: string$2()
42892
+ }).nullable(),
42893
+ warnings: array(string$2()).readonly(),
42894
+ split: TrainingSplitPlanSchema.nullable(),
42895
+ estimate: object({
42896
+ datasetBytes: number().int(),
42897
+ uploadMinutesAt20Mbps: number(),
42898
+ gpuSecondsLow: number(),
42899
+ gpuSecondsHigh: number(),
42900
+ usdLow: number(),
42901
+ usdHigh: number(),
42902
+ notes: array(string$2()).readonly()
42903
+ }).nullable(),
42904
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
42905
+ defaults: object({
42906
+ maxCostUsd: number(),
42907
+ maxRuntimeSec: number().int()
42908
+ }).nullable(),
42909
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
42910
+ dataNotice: string$2()
42911
+ });
42912
+ /**
42913
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
42914
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
42915
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
42916
+ * result lives after the operator acted on it.
42917
+ */
42918
+ var TrainingJobStateSchema = _enum([
42919
+ "queued",
42920
+ "uploading",
42921
+ "submitted",
42922
+ "starting",
42923
+ "running",
42924
+ "collecting",
42925
+ "ready",
42926
+ "registered",
42927
+ "canary",
42928
+ "failed",
42929
+ "cancelling",
42930
+ "cancelled",
42931
+ "lost",
42932
+ "expired",
42933
+ "discarded"
42934
+ ]);
42935
+ var TrainingFailureReasonSchema = _enum([
42936
+ "cost-cap",
42937
+ "runtime-cap",
42938
+ "upload-failed",
42939
+ "submit-failed",
42940
+ "trainer-failed",
42941
+ "result-invalid",
42942
+ "checksum-mismatch",
42943
+ "fetch-failed",
42944
+ "provider-error",
42945
+ "hub-restart-during-upload"
42946
+ ]);
42947
+ var TrainingProgressPointSchema = object({
42948
+ epoch: number().int(),
42949
+ map50: number().nullable(),
42950
+ map50_95: number().nullable()
42951
+ });
42952
+ var TrainingCanarySchema = object({
42953
+ deviceIds: array(number().int()).readonly(),
42954
+ since: number(),
42955
+ /** Every override the canary replaced, exactly, so rollback restores it. */
42956
+ previous: array(object({
42957
+ deviceId: number().int(),
42958
+ nodeId: string$2(),
42959
+ deviceKey: string$2(),
42960
+ patch: object({
42961
+ modelId: string$2().optional(),
42962
+ settings: record(string$2(), unknown()).readonly().optional()
42963
+ }).nullable()
42964
+ })).readonly()
42965
+ });
42966
+ var TrainingJobSchema = object({
42967
+ id: string$2(),
42968
+ idempotencyKey: string$2(),
42969
+ name: string$2(),
42970
+ createdAt: number(),
42971
+ updatedAt: number(),
42972
+ state: TrainingJobStateSchema,
42973
+ /**
42974
+ * Shared by every job enqueued together via `startJobBatch`.
42975
+ * `null` for a lone `startJob`. The engine advances queued siblings by this id.
42976
+ */
42977
+ batchId: string$2().nullable().default(null),
42978
+ stage: TrainingStageSchema.nullable(),
42979
+ failure: object({
42980
+ reason: TrainingFailureReasonSchema,
42981
+ stage: string$2().nullable(),
42982
+ detail: string$2()
42983
+ }).nullable(),
42984
+ request: TrainingJobRequestSchema,
42985
+ maxCostUsd: number().nonnegative(),
42986
+ maxRuntimeSec: number().int().positive(),
42987
+ trainer: TrainerSourceRefSchema,
42988
+ datasetLayout: RetrainExportLayoutSchema,
42989
+ /** Frame count snapshotted when the job started (audit; equals `frameIds.length`). */
42990
+ frameCount: number().int().nonnegative(),
42991
+ /** Resolved frame ids at start — the archive ships exactly these. */
42992
+ frameIds: array(string$2()).max(2e4).readonly(),
42993
+ /** Hash of what those frames taught at start (trainer `dataset.annotationHash`). */
42994
+ annotationHash: string$2(),
42995
+ dataset: object({
42996
+ bytes: number().int(),
42997
+ sha256: string$2(),
42998
+ uploadedAt: number()
42999
+ }).nullable(),
43000
+ split: TrainingSplitPlanSchema,
43001
+ provider: object({
43002
+ state: ProviderJobStateSchema.nullable(),
43003
+ providerJobId: string$2().nullable(),
43004
+ startedAt: number().nullable(),
43005
+ endedAt: number().nullable(),
43006
+ billedSeconds: number(),
43007
+ costUsd: number(),
43008
+ costIsEstimate: boolean(),
43009
+ lastPolledAt: number().nullable()
43010
+ }),
43011
+ progress: object({
43012
+ epoch: number().int().nullable(),
43013
+ epochs: number().int().nullable(),
43014
+ etaSec: number().nullable(),
43015
+ series: array(TrainingProgressPointSchema).readonly()
43016
+ }),
43017
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
43018
+ logTail: array(string$2()).readonly(),
43019
+ logCursor: string$2().nullable(),
43020
+ artifacts: object({
43021
+ bundleBytes: number().int(),
43022
+ bundleSha256: string$2(),
43023
+ fetchedAt: number(),
43024
+ /** When the staged artefacts are deleted from the hub. */
43025
+ expiresAt: number()
43026
+ }).nullable(),
43027
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
43028
+ cloudDatasetDeletedAt: number().nullable(),
43029
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
43030
+ cloudCleanupDueAt: number().nullable(),
43031
+ /** Model ids registered from this job (base, and int8 when kept). */
43032
+ registeredModelIds: array(string$2()).readonly(),
43033
+ canary: TrainingCanarySchema.nullable()
43034
+ });
43035
+ var IdInput = object({ id: string$2().min(1) });
43036
+ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
43037
+ auth: "admin",
43038
+ timeoutMs: 6e4
43039
+ }), method(TrainingJobRequestSchema.extend({
43040
+ name: string$2().min(1).max(120),
43041
+ maxCostUsd: number().positive(),
43042
+ maxRuntimeSec: number().int().positive(),
43043
+ idempotencyKey: string$2().min(8).max(80)
43044
+ }), discriminatedUnion("kind", [object({
43045
+ kind: literal("started"),
43046
+ job: TrainingJobSchema
43047
+ }), object({
43048
+ kind: literal("refused"),
43049
+ reason: TrainingRefusalReasonSchema,
43050
+ detail: string$2()
43051
+ })]), {
43052
+ kind: "mutation",
43053
+ auth: "admin",
43054
+ timeoutMs: 12e4
43055
+ }), method(TrainingJobRequestSchema.omit({ baseModelId: true }).extend({
43056
+ baseModelIds: array(string$2().min(1)).min(1),
43057
+ name: string$2().min(1).max(120),
43058
+ maxCostUsd: number().positive(),
43059
+ maxRuntimeSec: number().int().positive(),
43060
+ idempotencyKey: string$2().min(8).max(80)
43061
+ }), discriminatedUnion("kind", [object({
43062
+ kind: literal("started"),
43063
+ batchId: string$2(),
43064
+ jobs: array(TrainingJobSchema).min(1).readonly()
43065
+ }), object({
43066
+ kind: literal("refused"),
43067
+ reason: TrainingRefusalReasonSchema,
43068
+ detail: string$2()
43069
+ })]), {
43070
+ kind: "mutation",
43071
+ auth: "admin",
43072
+ timeoutMs: 12e4
43073
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
43074
+ kind: "mutation",
43075
+ auth: "admin",
43076
+ timeoutMs: 12e4
43077
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
43078
+ kind: "mutation",
43079
+ auth: "admin",
43080
+ timeoutMs: 30 * 6e4
43081
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
43082
+ kind: "mutation",
43083
+ auth: "admin",
43084
+ timeoutMs: 12e4
43085
+ }), method(IdInput, TrainingJobSchema, {
43086
+ kind: "mutation",
43087
+ auth: "admin",
43088
+ timeoutMs: 12e4
43089
+ }), method(IdInput, TrainingJobSchema, {
43090
+ kind: "mutation",
43091
+ auth: "admin"
43092
+ });
41452
43093
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
41453
43094
  Object.freeze({
41454
43095
  person: .5,
@@ -43597,6 +45238,12 @@ Object.freeze({
43597
45238
  addonId: null,
43598
45239
  access: "create"
43599
45240
  },
45241
+ "backup.checkBackupKey": {
45242
+ capName: "backup",
45243
+ capScope: "system",
45244
+ addonId: null,
45245
+ access: "create"
45246
+ },
43600
45247
  "backup.delete": {
43601
45248
  capName: "backup",
43602
45249
  capScope: "system",
@@ -43609,6 +45256,18 @@ Object.freeze({
43609
45256
  addonId: null,
43610
45257
  access: "delete"
43611
45258
  },
45259
+ "backup.disableEncryption": {
45260
+ capName: "backup",
45261
+ capScope: "system",
45262
+ addonId: null,
45263
+ access: "create"
45264
+ },
45265
+ "backup.getEncryption": {
45266
+ capName: "backup",
45267
+ capScope: "system",
45268
+ addonId: null,
45269
+ access: "view"
45270
+ },
43612
45271
  "backup.getEntries": {
43613
45272
  capName: "backup",
43614
45273
  capScope: "system",
@@ -43663,6 +45322,12 @@ Object.freeze({
43663
45322
  addonId: null,
43664
45323
  access: "create"
43665
45324
  },
45325
+ "backup.setupEncryption": {
45326
+ capName: "backup",
45327
+ capScope: "system",
45328
+ addonId: null,
45329
+ access: "create"
45330
+ },
43666
45331
  "backup.trigger": {
43667
45332
  capName: "backup",
43668
45333
  capScope: "system",
@@ -44215,6 +45880,12 @@ Object.freeze({
44215
45880
  addonId: null,
44216
45881
  access: "create"
44217
45882
  },
45883
+ "customModelRegistry.importModelBundle": {
45884
+ capName: "custom-model-registry",
45885
+ capScope: "system",
45886
+ addonId: null,
45887
+ access: "create"
45888
+ },
44218
45889
  "customModelRegistry.listModels": {
44219
45890
  capName: "custom-model-registry",
44220
45891
  capScope: "system",
@@ -45655,6 +47326,12 @@ Object.freeze({
45655
47326
  addonId: null,
45656
47327
  access: "view"
45657
47328
  },
47329
+ "keychainAdmin.acknowledgeReset": {
47330
+ capName: "keychain-admin",
47331
+ capScope: "system",
47332
+ addonId: null,
47333
+ access: "create"
47334
+ },
45658
47335
  "keychainAdmin.deleteOrphans": {
45659
47336
  capName: "keychain-admin",
45660
47337
  capScope: "system",
@@ -45691,6 +47368,12 @@ Object.freeze({
45691
47368
  addonId: null,
45692
47369
  access: "delete"
45693
47370
  },
47371
+ "keychainAdmin.resetReport": {
47372
+ capName: "keychain-admin",
47373
+ capScope: "system",
47374
+ addonId: null,
47375
+ access: "delete"
47376
+ },
45694
47377
  "keychainAdmin.reveal": {
45695
47378
  capName: "keychain-admin",
45696
47379
  capScope: "system",
@@ -45703,6 +47386,12 @@ Object.freeze({
45703
47386
  addonId: null,
45704
47387
  access: "create"
45705
47388
  },
47389
+ "keychainAdmin.setSystemSecret": {
47390
+ capName: "keychain-admin",
47391
+ capScope: "system",
47392
+ addonId: null,
47393
+ access: "create"
47394
+ },
45706
47395
  "keychainAdmin.status": {
45707
47396
  capName: "keychain-admin",
45708
47397
  capScope: "system",
@@ -46939,6 +48628,36 @@ Object.freeze({
46939
48628
  addonId: null,
46940
48629
  access: "view"
46941
48630
  },
48631
+ "oidcConnections.connectionFormSchema": {
48632
+ capName: "oidc-connections",
48633
+ capScope: "system",
48634
+ addonId: null,
48635
+ access: "view"
48636
+ },
48637
+ "oidcConnections.createConnection": {
48638
+ capName: "oidc-connections",
48639
+ capScope: "system",
48640
+ addonId: null,
48641
+ access: "create"
48642
+ },
48643
+ "oidcConnections.deleteConnection": {
48644
+ capName: "oidc-connections",
48645
+ capScope: "system",
48646
+ addonId: null,
48647
+ access: "delete"
48648
+ },
48649
+ "oidcConnections.listConnections": {
48650
+ capName: "oidc-connections",
48651
+ capScope: "system",
48652
+ addonId: null,
48653
+ access: "view"
48654
+ },
48655
+ "oidcConnections.updateConnection": {
48656
+ capName: "oidc-connections",
48657
+ capScope: "system",
48658
+ addonId: null,
48659
+ access: "create"
48660
+ },
46942
48661
  "osd.getStatus": {
46943
48662
  capName: "osd",
46944
48663
  capScope: "device",
@@ -47011,6 +48730,12 @@ Object.freeze({
47011
48730
  addonId: null,
47012
48731
  access: "create"
47013
48732
  },
48733
+ "osdManager.setSlotCameraEnabled": {
48734
+ capName: "osd-manager",
48735
+ capScope: "system",
48736
+ addonId: null,
48737
+ access: "create"
48738
+ },
47014
48739
  "osdManager.upsertTemplate": {
47015
48740
  capName: "osd-manager",
47016
48741
  capScope: "system",
@@ -47263,6 +48988,12 @@ Object.freeze({
47263
48988
  addonId: null,
47264
48989
  access: "view"
47265
48990
  },
48991
+ "pipelineAnalytics.getRetrainCorpusKpi": {
48992
+ capName: "pipeline-analytics",
48993
+ capScope: "device",
48994
+ addonId: null,
48995
+ access: "view"
48996
+ },
47266
48997
  "pipelineAnalytics.getRetrainExportUrl": {
47267
48998
  capName: "pipeline-analytics",
47268
48999
  capScope: "device",
@@ -47383,6 +49114,12 @@ Object.freeze({
47383
49114
  addonId: null,
47384
49115
  access: "view"
47385
49116
  },
49117
+ "pipelineAnalytics.listRetrainCorpusPage": {
49118
+ capName: "pipeline-analytics",
49119
+ capScope: "device",
49120
+ addonId: null,
49121
+ access: "view"
49122
+ },
47386
49123
  "pipelineAnalytics.listRetrainFrames": {
47387
49124
  capName: "pipeline-analytics",
47388
49125
  capScope: "device",
@@ -47413,6 +49150,12 @@ Object.freeze({
47413
49150
  addonId: null,
47414
49151
  access: "view"
47415
49152
  },
49153
+ "pipelineAnalytics.offerRetrainArchive": {
49154
+ capName: "pipeline-analytics",
49155
+ capScope: "device",
49156
+ addonId: null,
49157
+ access: "create"
49158
+ },
47416
49159
  "pipelineAnalytics.ownersWithMedia": {
47417
49160
  capName: "pipeline-analytics",
47418
49161
  capScope: "device",
@@ -47503,6 +49246,12 @@ Object.freeze({
47503
49246
  addonId: null,
47504
49247
  access: "create"
47505
49248
  },
49249
+ "pipelineAnalytics.resolveRetrainTrainingCorpus": {
49250
+ capName: "pipeline-analytics",
49251
+ capScope: "device",
49252
+ addonId: null,
49253
+ access: "view"
49254
+ },
47506
49255
  "pipelineAnalytics.restageRetrainTrack": {
47507
49256
  capName: "pipeline-analytics",
47508
49257
  capScope: "device",
@@ -49939,6 +51688,180 @@ Object.freeze({
49939
51688
  addonId: null,
49940
51689
  access: "view"
49941
51690
  },
51691
+ "training.canaryResult": {
51692
+ capName: "training",
51693
+ capScope: "system",
51694
+ addonId: null,
51695
+ access: "create"
51696
+ },
51697
+ "training.cancelJob": {
51698
+ capName: "training",
51699
+ capScope: "system",
51700
+ addonId: null,
51701
+ access: "create"
51702
+ },
51703
+ "training.discardResult": {
51704
+ capName: "training",
51705
+ capScope: "system",
51706
+ addonId: null,
51707
+ access: "create"
51708
+ },
51709
+ "training.getJob": {
51710
+ capName: "training",
51711
+ capScope: "system",
51712
+ addonId: null,
51713
+ access: "view"
51714
+ },
51715
+ "training.getJobResult": {
51716
+ capName: "training",
51717
+ capScope: "system",
51718
+ addonId: null,
51719
+ access: "view"
51720
+ },
51721
+ "training.listBaseModels": {
51722
+ capName: "training",
51723
+ capScope: "system",
51724
+ addonId: null,
51725
+ access: "view"
51726
+ },
51727
+ "training.listJobs": {
51728
+ capName: "training",
51729
+ capScope: "system",
51730
+ addonId: null,
51731
+ access: "view"
51732
+ },
51733
+ "training.planJob": {
51734
+ capName: "training",
51735
+ capScope: "system",
51736
+ addonId: null,
51737
+ access: "view"
51738
+ },
51739
+ "training.registerResult": {
51740
+ capName: "training",
51741
+ capScope: "system",
51742
+ addonId: null,
51743
+ access: "create"
51744
+ },
51745
+ "training.rollbackCanary": {
51746
+ capName: "training",
51747
+ capScope: "system",
51748
+ addonId: null,
51749
+ access: "create"
51750
+ },
51751
+ "training.startJob": {
51752
+ capName: "training",
51753
+ capScope: "system",
51754
+ addonId: null,
51755
+ access: "create"
51756
+ },
51757
+ "training.startJobBatch": {
51758
+ capName: "training",
51759
+ capScope: "system",
51760
+ addonId: null,
51761
+ access: "create"
51762
+ },
51763
+ "trainingProvider.cancelJob": {
51764
+ capName: "training-provider",
51765
+ capScope: "system",
51766
+ addonId: null,
51767
+ access: "create"
51768
+ },
51769
+ "trainingProvider.cleanupJob": {
51770
+ capName: "training-provider",
51771
+ capScope: "system",
51772
+ addonId: null,
51773
+ access: "create"
51774
+ },
51775
+ "trainingProvider.createEntry": {
51776
+ capName: "training-provider",
51777
+ capScope: "system",
51778
+ addonId: null,
51779
+ access: "create"
51780
+ },
51781
+ "trainingProvider.deleteEntry": {
51782
+ capName: "training-provider",
51783
+ capScope: "system",
51784
+ addonId: null,
51785
+ access: "delete"
51786
+ },
51787
+ "trainingProvider.describe": {
51788
+ capName: "training-provider",
51789
+ capScope: "system",
51790
+ addonId: null,
51791
+ access: "view"
51792
+ },
51793
+ "trainingProvider.describeTypes": {
51794
+ capName: "training-provider",
51795
+ capScope: "system",
51796
+ addonId: null,
51797
+ access: "view"
51798
+ },
51799
+ "trainingProvider.estimateJob": {
51800
+ capName: "training-provider",
51801
+ capScope: "system",
51802
+ addonId: null,
51803
+ access: "view"
51804
+ },
51805
+ "trainingProvider.getJob": {
51806
+ capName: "training-provider",
51807
+ capScope: "system",
51808
+ addonId: null,
51809
+ access: "view"
51810
+ },
51811
+ "trainingProvider.listEntries": {
51812
+ capName: "training-provider",
51813
+ capScope: "system",
51814
+ addonId: null,
51815
+ access: "view"
51816
+ },
51817
+ "trainingProvider.listJobEvents": {
51818
+ capName: "training-provider",
51819
+ capScope: "system",
51820
+ addonId: null,
51821
+ access: "view"
51822
+ },
51823
+ "trainingProvider.listJobs": {
51824
+ capName: "training-provider",
51825
+ capScope: "system",
51826
+ addonId: null,
51827
+ access: "view"
51828
+ },
51829
+ "trainingProvider.offerArtifact": {
51830
+ capName: "training-provider",
51831
+ capScope: "system",
51832
+ addonId: null,
51833
+ access: "create"
51834
+ },
51835
+ "trainingProvider.readResult": {
51836
+ capName: "training-provider",
51837
+ capScope: "system",
51838
+ addonId: null,
51839
+ access: "create"
51840
+ },
51841
+ "trainingProvider.submitJob": {
51842
+ capName: "training-provider",
51843
+ capScope: "system",
51844
+ addonId: null,
51845
+ access: "create"
51846
+ },
51847
+ "trainingProvider.updateEntry": {
51848
+ capName: "training-provider",
51849
+ capScope: "system",
51850
+ addonId: null,
51851
+ access: "create"
51852
+ },
51853
+ "trainingProvider.uploadDataset": {
51854
+ capName: "training-provider",
51855
+ capScope: "system",
51856
+ addonId: null,
51857
+ access: "create"
51858
+ },
51859
+ "trainingProvider.validateCredentials": {
51860
+ capName: "training-provider",
51861
+ capScope: "system",
51862
+ addonId: null,
51863
+ access: "create"
51864
+ },
49942
51865
  "turnProvider.getTurnServers": {
49943
51866
  capName: "turn-provider",
49944
51867
  capScope: "system",
@@ -49963,12 +51886,6 @@ Object.freeze({
49963
51886
  addonId: null,
49964
51887
  access: "create"
49965
51888
  },
49966
- "userManagement.createApiKey": {
49967
- capName: "user-management",
49968
- capScope: "system",
49969
- addonId: null,
49970
- access: "create"
49971
- },
49972
51889
  "userManagement.createScopedToken": {
49973
51890
  capName: "user-management",
49974
51891
  capScope: "system",
@@ -50005,12 +51922,6 @@ Object.freeze({
50005
51922
  addonId: null,
50006
51923
  access: "view"
50007
51924
  },
50008
- "userManagement.linkExternalIdentity": {
50009
- capName: "user-management",
50010
- capScope: "system",
50011
- addonId: null,
50012
- access: "create"
50013
- },
50014
51925
  "userManagement.listApiKeys": {
50015
51926
  capName: "user-management",
50016
51927
  capScope: "system",
@@ -50113,12 +52024,6 @@ Object.freeze({
50113
52024
  addonId: null,
50114
52025
  access: "create"
50115
52026
  },
50116
- "userManagement.validateApiKey": {
50117
- capName: "user-management",
50118
- capScope: "system",
50119
- addonId: null,
50120
- access: "view"
50121
- },
50122
52027
  "userManagement.validateCredentials": {
50123
52028
  capName: "user-management",
50124
52029
  capScope: "system",
@@ -53151,6 +55056,11 @@ Object.freeze({
53151
55056
  form: "single",
53152
55057
  optional: false
53153
55058
  }],
55059
+ "osdManager.setSlotCameraEnabled": [{
55060
+ name: "deviceId",
55061
+ form: "single",
55062
+ optional: false
55063
+ }],
53154
55064
  "petFeeder.callPet": [{
53155
55065
  name: "deviceId",
53156
55066
  form: "single",
@@ -53371,6 +55281,11 @@ Object.freeze({
53371
55281
  form: "array",
53372
55282
  optional: false
53373
55283
  }],
55284
+ "pipelineAnalytics.listRetrainCorpusPage": [{
55285
+ name: "deviceIds",
55286
+ form: "array",
55287
+ optional: true
55288
+ }],
53374
55289
  "pipelineAnalytics.listRetrainStaging": [{
53375
55290
  name: "deviceIds",
53376
55291
  form: "array",
@@ -54232,6 +56147,11 @@ Object.freeze({
54232
56147
  form: "single",
54233
56148
  optional: false
54234
56149
  }],
56150
+ "training.canaryResult": [{
56151
+ name: "deviceIds",
56152
+ form: "array",
56153
+ optional: false
56154
+ }],
54235
56155
  "update.getStatus": [{
54236
56156
  name: "deviceId",
54237
56157
  form: "single",
@@ -54475,6 +56395,7 @@ Object.freeze({
54475
56395
  });
54476
56396
  Object.freeze({
54477
56397
  "broker": "broker",
56398
+ "calendar-source": "calendar",
54478
56399
  "device-export": "device-export",
54479
56400
  "llm": "ai",
54480
56401
  "mesh-network": "mesh",
@@ -54960,6 +56881,8 @@ var STATE_SUMMARY_VARS = [
54960
56881
  [...RULE_TEXT],
54961
56882
  [...RULE_TEXT],
54962
56883
  [...RULE_TEXT],
56884
+ [...RULE_TEXT],
56885
+ [...RULE_TEXT],
54963
56886
  ([...RULE_TEXT], [...UPDATES]),
54964
56887
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
54965
56888
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),