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