@camstack/addon-import-alexa 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 +2069 -146
  2. package/dist/addon.mjs +2069 -146
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -5416,7 +5416,7 @@ var ZodIssueCode = {
5416
5416
  var ZodFirstPartyTypeKind;
5417
5417
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5418
5418
  //#endregion
5419
- //#region ../types/dist/sleep-Cr5YOk3m.mjs
5419
+ //#region ../types/dist/sleep-DwAQ9sqX.mjs
5420
5420
  /**
5421
5421
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5422
5422
  * window to float samples (D455).
@@ -5533,7 +5533,7 @@ function isKeychainStoredField(field) {
5533
5533
  var SECRET_CLEAR = { $secretClear: true };
5534
5534
  /** The `'***'` token D634 redaction writes for non-admins. */
5535
5535
  var LEGACY_DEVICE_REDACTION = "***";
5536
- function isRecord$1$1(value) {
5536
+ function isRecord$2(value) {
5537
5537
  return typeof value === "object" && value !== null && !Array.isArray(value);
5538
5538
  }
5539
5539
  function makeSecretMarker(ref) {
@@ -5544,12 +5544,12 @@ function makeSecretMarker(ref) {
5544
5544
  }
5545
5545
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5546
5546
  function isSecretMarker(value) {
5547
- if (!isRecord$1$1(value)) return false;
5547
+ if (!isRecord$2(value)) return false;
5548
5548
  const ref = value["$secret"];
5549
5549
  return typeof ref === "string" && ref.length > 0;
5550
5550
  }
5551
5551
  function isSecretClear(value) {
5552
- return isRecord$1$1(value) && value["$secretClear"] === true;
5552
+ return isRecord$2(value) && value["$secretClear"] === true;
5553
5553
  }
5554
5554
  /**
5555
5555
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6065,6 +6065,13 @@ function globalSecretScope() {
6065
6065
  function encodeSegment(value) {
6066
6066
  return encodeURIComponent(value);
6067
6067
  }
6068
+ function decodeSegment(value) {
6069
+ try {
6070
+ return decodeURIComponent(value);
6071
+ } catch {
6072
+ return null;
6073
+ }
6074
+ }
6068
6075
  /**
6069
6076
  * The field path of a value inside an array item, addressed by the item's id:
6070
6077
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6073,6 +6080,75 @@ function encodeSegment(value) {
6073
6080
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6074
6081
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6075
6082
  }
6083
+ function parseScope(segments) {
6084
+ switch (segments[0]) {
6085
+ case "global": return {
6086
+ scope: GLOBAL_SCOPE,
6087
+ used: 1
6088
+ };
6089
+ case "node": {
6090
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6091
+ return nodeId === null || nodeId.length === 0 ? null : {
6092
+ scope: {
6093
+ kind: "node",
6094
+ nodeId
6095
+ },
6096
+ used: 2
6097
+ };
6098
+ }
6099
+ case "device": {
6100
+ const raw = segments[1];
6101
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6102
+ return {
6103
+ scope: {
6104
+ kind: "device",
6105
+ deviceId: Number(raw)
6106
+ },
6107
+ used: 2
6108
+ };
6109
+ }
6110
+ case "integration": {
6111
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6112
+ return id === null || id.length === 0 ? null : {
6113
+ scope: {
6114
+ kind: "integration",
6115
+ integrationId: id
6116
+ },
6117
+ used: 2
6118
+ };
6119
+ }
6120
+ case "row": {
6121
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6122
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6123
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6124
+ return {
6125
+ scope: {
6126
+ kind: "row",
6127
+ collection,
6128
+ rowId
6129
+ },
6130
+ used: 3
6131
+ };
6132
+ }
6133
+ default: return null;
6134
+ }
6135
+ }
6136
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6137
+ function parseSecretRef(ref) {
6138
+ if (!ref.startsWith("secret://")) return null;
6139
+ const segments = ref.slice(9).split("/");
6140
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6141
+ if (owner === null || owner.length === 0) return null;
6142
+ const parsed = parseScope(segments.slice(1));
6143
+ if (parsed === null) return null;
6144
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6145
+ if (fieldPath.length === 0) return null;
6146
+ return {
6147
+ owner,
6148
+ scope: parsed.scope,
6149
+ fieldPath
6150
+ };
6151
+ }
6076
6152
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6077
6153
  var KeychainWriteRefusedError = class extends Error {
6078
6154
  fieldPath;
@@ -6083,7 +6159,7 @@ var KeychainWriteRefusedError = class extends Error {
6083
6159
  }
6084
6160
  };
6085
6161
  var KEEP = { kind: "keep" };
6086
- function isRecord$2(value) {
6162
+ function isRecord$1$1(value) {
6087
6163
  return typeof value === "object" && value !== null && !Array.isArray(value);
6088
6164
  }
6089
6165
  function defaultMintId() {
@@ -6096,7 +6172,7 @@ function collectSecretMarkerRefs(value, out = []) {
6096
6172
  return out;
6097
6173
  }
6098
6174
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6099
- else if (isRecord$2(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6175
+ else if (isRecord$1$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6100
6176
  return out;
6101
6177
  }
6102
6178
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6151,7 +6227,7 @@ function rowId(row, idKey) {
6151
6227
  return null;
6152
6228
  }
6153
6229
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6154
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$2) : [];
6230
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1$1) : [];
6155
6231
  if (!Array.isArray(incoming)) {
6156
6232
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6157
6233
  return {
@@ -6167,7 +6243,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6167
6243
  const kept = /* @__PURE__ */ new Set();
6168
6244
  const rows = [];
6169
6245
  for (const row of incoming) {
6170
- if (!isRecord$2(row)) {
6246
+ if (!isRecord$1$1(row)) {
6171
6247
  rows.push(row);
6172
6248
  continue;
6173
6249
  }
@@ -6192,7 +6268,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6192
6268
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6193
6269
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6194
6270
  case "object": {
6195
- if (!isRecord$2(incoming)) {
6271
+ if (!isRecord$1$1(incoming)) {
6196
6272
  if (incoming === void 0) return KEEP;
6197
6273
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6198
6274
  return {
@@ -6200,7 +6276,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6200
6276
  value: incoming
6201
6277
  };
6202
6278
  }
6203
- const storedObj = isRecord$2(stored) ? stored : {};
6279
+ const storedObj = isRecord$1$1(stored) ? stored : {};
6204
6280
  return {
6205
6281
  kind: "value",
6206
6282
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6259,12 +6335,19 @@ async function transformSecretWrite(input) {
6259
6335
  }
6260
6336
  };
6261
6337
  }
6338
+ /** Is `ref` one of `owner`'s refs? */
6339
+ function isSecretRefOwnedBy(ref, owner) {
6340
+ return parseSecretRef(ref)?.owner === owner;
6341
+ }
6262
6342
  /**
6263
6343
  * Replace every marker in `value` with its keychain value. Returns the SAME
6264
6344
  * reference when there is no marker (no allocation, no keychain call).
6265
6345
  */
6266
- async function resolveSecretMarkers(value, secrets) {
6267
- const refs = collectSecretMarkerRefs(value);
6346
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6347
+ const keepMarker = options.unresolved === "keep-marker";
6348
+ const owner = options.ownedBy;
6349
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6350
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6268
6351
  if (refs.length === 0) return {
6269
6352
  value,
6270
6353
  unresolved: []
@@ -6288,10 +6371,18 @@ async function resolveSecretMarkers(value, secrets) {
6288
6371
  }
6289
6372
  const substitute = (v) => {
6290
6373
  if (isSecretMarker(v)) {
6374
+ if (!inScope(v.$secret)) return {
6375
+ keep: true,
6376
+ value: v
6377
+ };
6291
6378
  const answer = answers[v.$secret];
6292
- return answer?.kind === "value" ? {
6379
+ if (answer?.kind === "value") return {
6293
6380
  keep: true,
6294
6381
  value: answer.value
6382
+ };
6383
+ return keepMarker ? {
6384
+ keep: true,
6385
+ value: v
6295
6386
  } : {
6296
6387
  keep: false,
6297
6388
  value: void 0
@@ -6308,7 +6399,7 @@ async function resolveSecretMarkers(value, secrets) {
6308
6399
  value: items
6309
6400
  };
6310
6401
  }
6311
- if (isRecord$2(v)) {
6402
+ if (isRecord$1$1(v)) {
6312
6403
  const out = {};
6313
6404
  for (const [k, child] of Object.entries(v)) {
6314
6405
  const s = substitute(child);
@@ -6329,14 +6420,152 @@ async function resolveSecretMarkers(value, secrets) {
6329
6420
  unresolved
6330
6421
  };
6331
6422
  }
6332
- function touchesTree(tree, patch) {
6333
- if (tree.size === 0) return false;
6334
- for (const key of Object.keys(patch)) {
6335
- const at = key.indexOf("@");
6336
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6423
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6424
+ var SecretOverwriteRefusedError = class extends Error {
6425
+ ref;
6426
+ reason;
6427
+ constructor(ref, reason) {
6428
+ 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.`);
6429
+ this.ref = ref;
6430
+ this.reason = reason;
6431
+ this.name = "SecretOverwriteRefusedError";
6432
+ }
6433
+ };
6434
+ function isRecord$3(value) {
6435
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6436
+ }
6437
+ function resolvedValue(pass, marker) {
6438
+ const answer = pass.answers[marker.$secret];
6439
+ return answer?.kind === "value" ? answer.value : null;
6440
+ }
6441
+ async function atMarker(pass, incoming, stored) {
6442
+ if (incoming === null) return stored;
6443
+ if (typeof incoming !== "string") return incoming;
6444
+ if (incoming === resolvedValue(pass, stored)) return stored;
6445
+ const intent = classifySecretWrite(incoming);
6446
+ if (intent.kind !== "set") return stored;
6447
+ const ref = stored.$secret;
6448
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6449
+ const answer = pass.answers[ref];
6450
+ 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);
6451
+ try {
6452
+ await pass.secrets.put(ref, intent.value);
6453
+ } catch (err) {
6454
+ throw new KeychainWriteRefusedError(ref, err);
6455
+ }
6456
+ pass.changedRefs.push(ref);
6457
+ return stored;
6458
+ }
6459
+ function inArray(pass, incoming, stored) {
6460
+ return incoming.map((item, index) => {
6461
+ const twin = stored[index];
6462
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6463
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6464
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6465
+ return item;
6466
+ });
6467
+ }
6468
+ function inArrayRow(pass, incoming, stored) {
6469
+ const out = { ...incoming };
6470
+ for (const [key, value] of Object.entries(incoming)) {
6471
+ const twin = stored[key];
6472
+ if (isSecretMarker(twin)) {
6473
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6474
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6475
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6476
+ }
6477
+ return out;
6478
+ }
6479
+ async function walk(pass, incoming, stored) {
6480
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6481
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6482
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6483
+ const out = { ...incoming };
6484
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6485
+ return out;
6486
+ }
6487
+ /** Restore markers a write-back carries as values. See the file doc. */
6488
+ async function restoreUnchangedSecrets(input) {
6489
+ const refs = [];
6490
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6491
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6492
+ if (owned.length === 0) return {
6493
+ patch: input.patch,
6494
+ changedRefs: []
6495
+ };
6496
+ const pass = {
6497
+ secrets: input.secrets,
6498
+ answers: await input.secrets.resolve([...new Set(owned)]),
6499
+ operatorWrite: input.operatorWrite,
6500
+ changedRefs: []
6501
+ };
6502
+ const out = {};
6503
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6504
+ return {
6505
+ patch: out,
6506
+ changedRefs: pass.changedRefs
6507
+ };
6508
+ }
6509
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6510
+ function isJsonEqual(a, b) {
6511
+ if (Object.is(a, b)) return true;
6512
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6513
+ if (isRecord$3(a) && isRecord$3(b)) {
6514
+ const keys = Object.keys(a);
6515
+ if (keys.length !== Object.keys(b).length) return false;
6516
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6337
6517
  }
6338
6518
  return false;
6339
6519
  }
6520
+ /** The patch without the keys whose value already equals the stored one. */
6521
+ function dropUnchangedKeys(patch, stored) {
6522
+ const out = {};
6523
+ for (const [key, value] of Object.entries(patch)) {
6524
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6525
+ out[key] = value;
6526
+ }
6527
+ return out;
6528
+ }
6529
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6530
+ function markerKeysOf(blob, owner) {
6531
+ const keys = /* @__PURE__ */ new Set();
6532
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6533
+ return keys;
6534
+ }
6535
+ function nodeFromStored(value, owner) {
6536
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6537
+ if (!isRecord$3(value)) return null;
6538
+ const children = /* @__PURE__ */ new Map();
6539
+ for (const [key, child] of Object.entries(value)) {
6540
+ const node = nodeFromStored(child, owner);
6541
+ if (node !== null) children.set(key, node);
6542
+ }
6543
+ return children.size > 0 ? {
6544
+ kind: "object",
6545
+ children
6546
+ } : null;
6547
+ }
6548
+ /**
6549
+ * The declared secret tree, widened by every place the STORED blob holds a
6550
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6551
+ * never declared: Wyze before b4906cec6) still gets the save path's
6552
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6553
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6554
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6555
+ * builtin that keeps another addon's marker (device-manager) never takes it
6556
+ * over.
6557
+ */
6558
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6559
+ const added = /* @__PURE__ */ new Map();
6560
+ for (const key of keys) {
6561
+ const at = key.indexOf("@");
6562
+ const base = at > 0 ? key.slice(0, at) : key;
6563
+ if (declared.has(base) || added.has(base)) continue;
6564
+ const node = nodeFromStored(stored[key], owner);
6565
+ if (node !== null) added.set(base, node);
6566
+ }
6567
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6568
+ }
6340
6569
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6341
6570
  async function readStoredAddonBlob(raw) {
6342
6571
  const threeWay = raw.readAddonStoreResult;
@@ -6345,7 +6574,41 @@ async function readStoredAddonBlob(raw) {
6345
6574
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6346
6575
  return result.kind === "missing" ? {} : result.value;
6347
6576
  }
6348
- function createSecretAwareSettings(raw, opts) {
6577
+ function touchesTree(tree, patch) {
6578
+ if (tree.size === 0) return false;
6579
+ for (const key of Object.keys(patch)) {
6580
+ const at = key.indexOf("@");
6581
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6582
+ }
6583
+ return false;
6584
+ }
6585
+ /**
6586
+ * Which top-level keys of each store held markers when last seen. `undefined`
6587
+ * for a store not seen yet: its first write reads it, to be safe.
6588
+ */
6589
+ var MarkerKeyIndex = class {
6590
+ owner;
6591
+ byStore = /* @__PURE__ */ new Map();
6592
+ constructor(owner) {
6593
+ this.owner = owner;
6594
+ }
6595
+ seen(store, blob) {
6596
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6597
+ }
6598
+ wrote(store, patch) {
6599
+ const keys = this.byStore.get(store);
6600
+ if (keys === void 0) return;
6601
+ const now = markerKeysOf(patch, this.owner);
6602
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6603
+ else keys.delete(key);
6604
+ }
6605
+ mayHoldMarkers(store, patch) {
6606
+ const keys = this.byStore.get(store);
6607
+ if (keys === void 0) return true;
6608
+ return Object.keys(patch).some((key) => keys.has(key));
6609
+ }
6610
+ };
6611
+ function createHandle(raw, opts) {
6349
6612
  const chains = /* @__PURE__ */ new Map();
6350
6613
  const serialize = (key, fn) => {
6351
6614
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6356,46 +6619,130 @@ function createSecretAwareSettings(raw, opts) {
6356
6619
  });
6357
6620
  return next;
6358
6621
  };
6359
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6360
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6361
- return serialize(chainKey, async () => {
6622
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6623
+ const resolveRead = async (store, blob) => {
6624
+ index.seen(store, blob);
6625
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6626
+ unresolved: "keep-marker",
6627
+ ownedBy: opts.secrets.owner
6628
+ });
6629
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6630
+ return value;
6631
+ };
6632
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6633
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6634
+ await rawWrite(patch);
6635
+ index.wrote(store, patch);
6636
+ return { changed: true };
6637
+ }
6638
+ return serialize(store, async () => {
6362
6639
  const stored = await readStored();
6640
+ index.seen(store, stored);
6641
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6642
+ const restored = await restoreUnchangedSecrets({
6643
+ patch,
6644
+ stored,
6645
+ secrets: opts.secrets,
6646
+ operatorWrite
6647
+ });
6363
6648
  const result = await transformSecretWrite({
6364
- tree,
6649
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6365
6650
  secrets: opts.secrets,
6366
- patch,
6651
+ patch: restored.patch,
6367
6652
  stored,
6368
6653
  ...scope !== void 0 ? { scope } : {},
6369
- operatorWrite: opts.isOperatorWrite?.() === true
6654
+ operatorWrite
6370
6655
  });
6371
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6656
+ const effective = dropUnchangedKeys(result.patch, stored);
6657
+ const wroteBlob = Object.keys(effective).length > 0;
6658
+ if (wroteBlob) {
6659
+ await rawWrite(effective);
6660
+ index.wrote(store, effective);
6661
+ }
6372
6662
  const { orphaned } = await result.afterWrite();
6373
6663
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6664
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6374
6665
  });
6375
6666
  };
6376
- const wrapped = {
6377
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6378
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6379
- kind: "device",
6380
- deviceId
6381
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6382
- };
6383
- return new Proxy(raw, { get(target, prop, receiver) {
6384
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6385
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6386
- const value = Reflect.get(target, prop, receiver);
6387
- return typeof value === "function" ? value.bind(target) : value;
6388
- } });
6667
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6668
+ const readAddonStoreResult = raw.readAddonStoreResult;
6669
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6670
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6671
+ const overrides = {
6672
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6673
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6674
+ const result = await readAddonStoreResult.call(raw);
6675
+ return result.kind === "value" ? {
6676
+ kind: "value",
6677
+ value: await resolveRead("addon", result.value)
6678
+ } : result;
6679
+ } } : {},
6680
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6681
+ const result = await readAddonStoreKeyResult.call(raw, key);
6682
+ if (result.kind !== "present") return result;
6683
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6684
+ unresolved: "keep-marker",
6685
+ ownedBy: opts.secrets.owner
6686
+ });
6687
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6688
+ return {
6689
+ kind: "present",
6690
+ value: value[key]
6691
+ };
6692
+ } } : {},
6693
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6694
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6695
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6696
+ const out = /* @__PURE__ */ new Map();
6697
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6698
+ return out;
6699
+ } } : {},
6700
+ writeAddonStore: async (patch) => {
6701
+ await writeAddon(patch);
6702
+ },
6703
+ writeDeviceStore: async (deviceId, patch) => {
6704
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6705
+ kind: "device",
6706
+ deviceId
6707
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6708
+ }
6709
+ };
6710
+ return {
6711
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6712
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6713
+ const value = Reflect.get(target, prop, receiver);
6714
+ return typeof value === "function" ? value.bind(target) : value;
6715
+ } }),
6716
+ raw: {
6717
+ readAddonStore: async () => {
6718
+ const blob = await raw.readAddonStore();
6719
+ index.seen("addon", blob);
6720
+ return blob;
6721
+ },
6722
+ readDeviceStore: async (deviceId) => {
6723
+ const blob = await raw.readDeviceStore(deviceId);
6724
+ index.seen(`device:${deviceId}`, blob);
6725
+ return blob;
6726
+ }
6727
+ },
6728
+ writeAddonStore: writeAddon
6729
+ };
6389
6730
  }
6390
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6391
- function withSecretAwareSettings(context, opts) {
6731
+ /** The context the addon sees, plus the private raw view and write outcome. */
6732
+ function createSecretAwareContext(context, opts) {
6392
6733
  const raw = context.settings;
6393
- if (raw === void 0) return context;
6394
- const settings = createSecretAwareSettings(raw, opts);
6395
- return new Proxy(context, { get(target, prop, receiver) {
6396
- if (prop === "settings") return settings;
6397
- return Reflect.get(target, prop, receiver);
6398
- } });
6734
+ if (raw === void 0) return {
6735
+ context,
6736
+ handle: null
6737
+ };
6738
+ const handle = createHandle(raw, opts);
6739
+ return {
6740
+ context: new Proxy(context, { get(target, prop, receiver) {
6741
+ if (prop === "settings") return handle.settings;
6742
+ return Reflect.get(target, prop, receiver);
6743
+ } }),
6744
+ handle
6745
+ };
6399
6746
  }
6400
6747
  var LEAF = { kind: "leaf" };
6401
6748
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6570,6 +6917,14 @@ var BaseAddon = class {
6570
6917
  _secretChangeUnsub = null;
6571
6918
  /** >0 while an OPERATOR's settings write is being applied. */
6572
6919
  _operatorWriteDepth = 0;
6920
+ /**
6921
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6922
+ * to the marker-bearing blobs and stays private to this class: the form
6923
+ * hydrate and config resolution need markers, addon code never does.
6924
+ */
6925
+ _secretSettings = null;
6926
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6927
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6573
6928
  constructor(defaults) {
6574
6929
  this.defaults = defaults;
6575
6930
  this._config = { ...defaults };
@@ -6606,13 +6961,21 @@ var BaseAddon = class {
6606
6961
  }
6607
6962
  async initialize(context) {
6608
6963
  const secrets = context.secrets;
6609
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6610
- secrets,
6611
- addonTree: () => this.addonSecretTree(),
6612
- deviceTree: () => this.deviceSecretTree(),
6613
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6614
- isOperatorWrite: () => this._operatorWriteDepth > 0
6615
- }) : context;
6964
+ if (secrets !== void 0) {
6965
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6966
+ secrets,
6967
+ addonTree: () => this.addonSecretTree(),
6968
+ deviceTree: () => this.deviceSecretTree(),
6969
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6970
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6971
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6972
+ });
6973
+ this._ctx = wrapped;
6974
+ this._secretSettings = handle;
6975
+ } else {
6976
+ this._ctx = context;
6977
+ this._secretSettings = null;
6978
+ }
6616
6979
  await this.resolveConfig();
6617
6980
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6618
6981
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6729,11 +7092,8 @@ var BaseAddon = class {
6729
7092
  async getGlobalSettings(overlay, cap, nodeId) {
6730
7093
  const schema = this.globalSettingsSchema(cap);
6731
7094
  if (!schema) return { sections: [] };
6732
- const projected = await this.resolveGlobalStore(nodeId, cap);
6733
- return hydrateSchema(schema, overlay ? {
6734
- ...projected,
6735
- ...overlay
6736
- } : projected, { inlineSecretsAsViews: true });
7095
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7096
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6737
7097
  }
6738
7098
  /**
6739
7099
  * The integration-level view of this addon's settings: exactly the sections
@@ -6778,7 +7138,7 @@ var BaseAddon = class {
6778
7138
  });
6779
7139
  }
6780
7140
  if (sections.length === 0) return null;
6781
- const projected = await this.resolveGlobalStore(nodeId);
7141
+ const projected = await this.readRawProjectedStore(nodeId);
6782
7142
  return hydrateSchema({
6783
7143
  ...schema,
6784
7144
  sections
@@ -6795,12 +7155,50 @@ var BaseAddon = class {
6795
7155
  * the store for custom option logic (option narrowing, value snapping) to
6796
7156
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6797
7157
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7158
+ *
7159
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7160
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7161
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7162
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7163
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7164
+ * resolved blob back is a no-op for every unchanged secret.
6798
7165
  */
6799
7166
  async resolveGlobalStore(nodeId, cap) {
6800
7167
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7168
+ return this.projectForNode(raw, nodeId, cap);
7169
+ }
7170
+ projectForNode(store, nodeId, cap) {
6801
7171
  const keys = this.perNodeKeys(cap);
6802
7172
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6803
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7173
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7174
+ }
7175
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7176
+ async readRawProjectedStore(nodeId, cap) {
7177
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7178
+ return this.projectForNode(raw, nodeId, cap);
7179
+ }
7180
+ /**
7181
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7182
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7183
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7184
+ * its value.
7185
+ */
7186
+ async overlayKeepingMarkers(stored, overlay) {
7187
+ const secrets = this._ctx?.secrets;
7188
+ const merged = {
7189
+ ...stored,
7190
+ ...overlay
7191
+ };
7192
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7193
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7194
+ unresolved: "keep-marker",
7195
+ ownedBy: secrets.owner
7196
+ });
7197
+ for (const key of Object.keys(overlay)) {
7198
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7199
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7200
+ }
7201
+ return merged;
6804
7202
  }
6805
7203
  /**
6806
7204
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6865,8 +7263,12 @@ var BaseAddon = class {
6865
7263
  async clearSecrets(keys, nodeId) {
6866
7264
  const tree = this.addonSecretTree();
6867
7265
  const keychain = this._ctx?.secrets !== void 0;
7266
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6868
7267
  const patch = {};
6869
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7268
+ for (const key of keys) {
7269
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7270
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7271
+ }
6870
7272
  await this.applyGlobalPatch(patch, nodeId);
6871
7273
  }
6872
7274
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6874,7 +7276,11 @@ var BaseAddon = class {
6874
7276
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6875
7277
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6876
7278
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6877
- await this._ctx?.settings?.writeAddonStore(scoped);
7279
+ const handle = this._secretSettings;
7280
+ if (handle !== null) {
7281
+ const { changed } = await handle.writeAddonStore(scoped);
7282
+ if (!changed) return;
7283
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6878
7284
  if (target !== localNode) return;
6879
7285
  await this.resolveConfig();
6880
7286
  await this.onConfigChanged();
@@ -6927,7 +7333,7 @@ var BaseAddon = class {
6927
7333
  async getDeviceSettings(deviceId) {
6928
7334
  const schema = this.deviceSettingsSchema();
6929
7335
  if (!schema) return { sections: [] };
6930
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7336
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6931
7337
  }
6932
7338
  async updateDeviceSettings(deviceId, patch) {
6933
7339
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7099,7 +7505,7 @@ var BaseAddon = class {
7099
7505
  key,
7100
7506
  schema,
7101
7507
  fallback,
7102
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7508
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7103
7509
  write: async (patch) => {
7104
7510
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7105
7511
  },
@@ -7161,6 +7567,23 @@ var BaseAddon = class {
7161
7567
  }
7162
7568
  return value;
7163
7569
  }
7570
+ /**
7571
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7572
+ * keychain the context's own view is already raw.
7573
+ */
7574
+ rawSettings() {
7575
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7576
+ }
7577
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7578
+ logUnresolvedRead(unresolved) {
7579
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7580
+ if (fresh.length === 0) return;
7581
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7582
+ 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) => ({
7583
+ ref: u.ref,
7584
+ reason: u.reason
7585
+ })) } });
7586
+ }
7164
7587
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7165
7588
  scheduleSecretReresolve(delayMs) {
7166
7589
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7187,7 +7610,7 @@ var BaseAddon = class {
7187
7610
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7188
7611
  */
7189
7612
  async readAddonStoreWithRetry() {
7190
- const settings = this._ctx?.settings;
7613
+ const settings = this.rawSettings();
7191
7614
  if (!settings) return {};
7192
7615
  const delaysMs = [
7193
7616
  150,
@@ -8999,6 +9422,16 @@ var CompositionSchema = object({
8999
9422
  seen.add(feature.cap);
9000
9423
  });
9001
9424
  });
9425
+ var NodeColorIdSchema = _enum([
9426
+ "node-a",
9427
+ "node-b",
9428
+ "node-c",
9429
+ "node-d",
9430
+ "node-e",
9431
+ "node-f",
9432
+ "node-g",
9433
+ "node-h"
9434
+ ]);
9002
9435
  new Set([
9003
9436
  "track",
9004
9437
  "face",
@@ -9607,6 +10040,278 @@ var CameraSwitchGroupSchema = object({
9607
10040
  fetchedAt: number()
9608
10041
  });
9609
10042
  /**
10043
+ * The trainer contract — what the hub hands the cloud trainer and what it
10044
+ * gets back (cloud training, D805+).
10045
+ *
10046
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
10047
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
10048
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
10049
+ * lines on stdout. These schemas are the hub's half of that boundary; the
10050
+ * trainer's pydantic models (and the JSON Schemas generated from them under
10051
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
10052
+ * change there, in the same piece of work.
10053
+ *
10054
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
10055
+ * orchestrator fills every field of a job spec explicitly.
10056
+ */
10057
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
10058
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
10059
+ /** What the trainer can export. Edge TPU is a later, separate image. */
10060
+ var TrainingExportSchema = _enum([
10061
+ "onnx",
10062
+ "openvino-fp16",
10063
+ "openvino-int8",
10064
+ "coreml-fp16"
10065
+ ]);
10066
+ var FloorsSchema = record(string(), number().min(0).max(1));
10067
+ object({
10068
+ schema: literal(TRAINING_JOB_SCHEMA),
10069
+ jobKey: string().uuid(),
10070
+ target: object({
10071
+ kind: literal("detector"),
10072
+ step: literal("object-detection")
10073
+ }),
10074
+ base: object({
10075
+ modelId: string().min(1),
10076
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
10077
+ weights: string().min(1),
10078
+ imgsz: number().int().positive()
10079
+ }),
10080
+ baseline: object({
10081
+ modelId: string().min(1),
10082
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
10083
+ onnxUrl: string().url(),
10084
+ imgsz: number().int().positive(),
10085
+ floors: FloorsSchema
10086
+ }),
10087
+ dataset: object({
10088
+ versionId: string().min(1),
10089
+ annotationHash: string(),
10090
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
10091
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10092
+ }),
10093
+ split: object({
10094
+ holdoutCameras: array(number().int()),
10095
+ /** When no camera is held out: the last N days of every camera. */
10096
+ holdoutLastDays: number().int().nonnegative(),
10097
+ valFraction: number().min(0).max(.5),
10098
+ seed: number().int()
10099
+ }),
10100
+ hyper: object({
10101
+ epochs: number().int().positive(),
10102
+ batch: number().int().positive(),
10103
+ lr0: number().positive(),
10104
+ /** Layers frozen from the start of the backbone; 0 = none. */
10105
+ freeze: number().int().nonnegative(),
10106
+ patience: number().int().nonnegative(),
10107
+ seed: number().int()
10108
+ }),
10109
+ replay: object({
10110
+ source: literal("coco2017"),
10111
+ count: number().int().nonnegative()
10112
+ }),
10113
+ exports: array(TrainingExportSchema).min(1),
10114
+ calibration: object({ maxFrames: number().int().positive() }),
10115
+ floors: object({
10116
+ minSupport: number().int().positive(),
10117
+ clamp: number().min(0).max(1)
10118
+ }),
10119
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
10120
+ catalog: object({
10121
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
10122
+ name: string().min(1).max(160)
10123
+ })
10124
+ });
10125
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
10126
+ var TrainingResultFileSchema = object({
10127
+ path: string().min(1),
10128
+ bytes: number().int().nonnegative(),
10129
+ sha256: string().regex(/^[0-9a-f]{64}$/),
10130
+ format: _enum([
10131
+ "onnx",
10132
+ "openvino",
10133
+ "coreml",
10134
+ "pt"
10135
+ ]),
10136
+ variant: _enum(["base", "int8"])
10137
+ });
10138
+ var DraftFormatSchema = object({
10139
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
10140
+ url: string().min(1),
10141
+ sizeMB: number().nonnegative(),
10142
+ isDirectory: boolean().optional(),
10143
+ files: array(string()).optional(),
10144
+ runtimes: array(literal("python")).optional(),
10145
+ revision: string().min(1)
10146
+ });
10147
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
10148
+ var TrainingCatalogDraftSchema = object({
10149
+ id: string().min(1),
10150
+ name: string().min(1),
10151
+ description: string(),
10152
+ labels: array(unknown()),
10153
+ inputSize: object({
10154
+ width: number().int().positive(),
10155
+ height: number().int().positive()
10156
+ }),
10157
+ preprocessMode: literal("letterbox"),
10158
+ defaultClassFloors: FloorsSchema,
10159
+ formats: object({
10160
+ onnx: DraftFormatSchema.optional(),
10161
+ openvino: DraftFormatSchema.optional(),
10162
+ coreml: DraftFormatSchema.optional()
10163
+ })
10164
+ });
10165
+ /** One class of one model's holdout report (the eval harness's summary). */
10166
+ var TrainingEvalClassSchema = object({
10167
+ positives: number().int(),
10168
+ floor: number().nullable(),
10169
+ tp: number().int(),
10170
+ fp: number().int(),
10171
+ fn: number().int(),
10172
+ precision: number().nullable(),
10173
+ recall: number().nullable(),
10174
+ ap50: number().nullable(),
10175
+ recallByCamera: record(string(), number().nullable()).optional(),
10176
+ recallByLight: record(string(), number().nullable()).optional(),
10177
+ fpByCamera: record(string(), number()).optional(),
10178
+ smallFound: number().int().optional(),
10179
+ smallTotal: number().int().optional()
10180
+ }).passthrough();
10181
+ var TrainingEvalReportSchema = object({
10182
+ frames: number().int(),
10183
+ classes: record(string(), TrainingEvalClassSchema)
10184
+ }).passthrough();
10185
+ /**
10186
+ * A succeeded result carries every block; a failed one carries the error and
10187
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10188
+ * orchestrator checks the blocks it needs before it trusts a success.
10189
+ */
10190
+ var TrainingResultSchema = object({
10191
+ schema: literal(TRAINING_RESULT_SCHEMA),
10192
+ jobKey: string(),
10193
+ status: _enum(["succeeded", "failed"]),
10194
+ error: object({
10195
+ stage: string(),
10196
+ code: string(),
10197
+ message: string()
10198
+ }).nullable(),
10199
+ trainer: object({
10200
+ version: string(),
10201
+ revision: string()
10202
+ }),
10203
+ toolchain: record(string(), string().nullable()),
10204
+ dataset: object({
10205
+ versionId: string(),
10206
+ annotationHash: string(),
10207
+ sha256: string(),
10208
+ frames: object({
10209
+ train: number().int(),
10210
+ val: number().int(),
10211
+ holdout: number().int()
10212
+ }),
10213
+ holdoutCameras: array(number().int()),
10214
+ replayImages: number().int()
10215
+ }).optional(),
10216
+ training: object({
10217
+ epochsRun: number().int(),
10218
+ bestEpoch: number().int(),
10219
+ bestMap50: number(),
10220
+ bestMap50_95: number(),
10221
+ seconds: number()
10222
+ }).optional(),
10223
+ evaluation: object({
10224
+ holdoutFrames: number().int(),
10225
+ baseline: TrainingEvalReportSchema.nullable(),
10226
+ candidate: TrainingEvalReportSchema.nullable(),
10227
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10228
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10229
+ map50: record(string(), number().nullable())
10230
+ }).optional(),
10231
+ floors: object({
10232
+ baseline: FloorsSchema,
10233
+ candidate: FloorsSchema,
10234
+ candidateInt8: FloorsSchema.nullable(),
10235
+ notes: array(string())
10236
+ }).optional(),
10237
+ int8: object({
10238
+ kept: boolean(),
10239
+ map50Fp16: number().nullable(),
10240
+ map50Int8: number().nullable(),
10241
+ reason: string().nullable()
10242
+ }).optional(),
10243
+ exportsDropped: array(object({
10244
+ export: string(),
10245
+ reason: string()
10246
+ })).optional(),
10247
+ files: array(TrainingResultFileSchema).optional(),
10248
+ bundle: object({
10249
+ path: literal("bundle.tar"),
10250
+ bytes: number().int().nonnegative(),
10251
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10252
+ }).nullable().optional(),
10253
+ catalogDraft: object({
10254
+ base: TrainingCatalogDraftSchema,
10255
+ int8: TrainingCatalogDraftSchema.nullable()
10256
+ }).nullable().optional(),
10257
+ licence: string()
10258
+ });
10259
+ var TrainingStageSchema = _enum([
10260
+ "prepare",
10261
+ "replay",
10262
+ "train",
10263
+ "eval",
10264
+ "export",
10265
+ "package"
10266
+ ]);
10267
+ var EventBase = {
10268
+ v: literal(1),
10269
+ ts: number()
10270
+ };
10271
+ discriminatedUnion("type", [
10272
+ object({
10273
+ ...EventBase,
10274
+ type: literal("stage"),
10275
+ stage: TrainingStageSchema
10276
+ }),
10277
+ object({
10278
+ ...EventBase,
10279
+ type: literal("epoch"),
10280
+ epoch: number().int(),
10281
+ epochs: number().int(),
10282
+ boxLoss: number().nullable().optional(),
10283
+ map50: number().nullable().optional(),
10284
+ map50_95: number().nullable().optional(),
10285
+ etaSec: number().nullable().optional()
10286
+ }),
10287
+ object({
10288
+ ...EventBase,
10289
+ type: literal("metric"),
10290
+ name: string(),
10291
+ value: number()
10292
+ }),
10293
+ object({
10294
+ ...EventBase,
10295
+ type: literal("artifact"),
10296
+ path: string(),
10297
+ bytes: number(),
10298
+ sha256: string()
10299
+ }),
10300
+ object({
10301
+ ...EventBase,
10302
+ type: literal("done"),
10303
+ status: _enum(["succeeded", "failed"]),
10304
+ resultSha256: string().nullable().optional()
10305
+ }),
10306
+ object({
10307
+ ...EventBase,
10308
+ type: literal("error"),
10309
+ stage: string(),
10310
+ code: string(),
10311
+ message: string()
10312
+ })
10313
+ ]);
10314
+ /**
9610
10315
  * What the gate decided about a birth, from the CALLER's point of view.
9611
10316
  *
9612
10317
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11934,7 +12639,9 @@ var AddonHttpRouteSchema = object({
11934
12639
  "authenticated",
11935
12640
  "admin"
11936
12641
  ]).optional(),
11937
- description: string().optional()
12642
+ description: string().optional(),
12643
+ /** The hub limits this route per client address before the handler runs. */
12644
+ rateLimit: _enum(["auth"]).optional()
11938
12645
  });
11939
12646
  /**
11940
12647
  * Cross-process route invocation envelope. The hub captures the
@@ -12658,6 +13365,37 @@ var BackupDestinationInfoSchema = object({
12658
13365
  lastError: string().optional()
12659
13366
  });
12660
13367
  /**
13368
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13369
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13370
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13371
+ * with it off — which restores without a key.
13372
+ */
13373
+ var BackupArchiveEncryptionSchema = object({
13374
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13375
+ scheme: string(),
13376
+ /** 16 hex — the backup key whose secret restores this archive. */
13377
+ keyId: string()
13378
+ });
13379
+ /**
13380
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13381
+ * one new archives are encrypted to, and the retired ones older archives
13382
+ * still need. The secret key is shown once, at `setupEncryption`.
13383
+ */
13384
+ var BackupEncryptionStatusSchema = object({
13385
+ enabled: boolean(),
13386
+ active: object({
13387
+ keyId: string(),
13388
+ publicKey: string(),
13389
+ createdAt: number()
13390
+ }).nullable(),
13391
+ /** Every key ever set up, newest first. */
13392
+ keys: array(object({
13393
+ keyId: string(),
13394
+ createdAt: number(),
13395
+ retiredAt: number().nullable()
13396
+ })).readonly()
13397
+ });
13398
+ /**
12661
13399
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12662
13400
  * Same shape the destination drill-in renders. Sourced from the per-
12663
13401
  * location `manifests.json` (no per-archive tarball read required).
@@ -12669,7 +13407,9 @@ var BackupArchiveEntrySchema = object({
12669
13407
  sizeBytes: number(),
12670
13408
  label: string().optional(),
12671
13409
  /** Top-level locations included in the archive (db, addons, tls, …). */
12672
- locations: array(string()).readonly()
13410
+ locations: array(string()).readonly(),
13411
+ /** Present when the archive is encrypted; restore then needs that key. */
13412
+ encryption: BackupArchiveEncryptionSchema.optional()
12673
13413
  });
12674
13414
  var BackupEntrySchema = object({
12675
13415
  id: string(),
@@ -12678,7 +13418,8 @@ var BackupEntrySchema = object({
12678
13418
  label: string().optional(),
12679
13419
  createdAt: number(),
12680
13420
  sizeBytes: number(),
12681
- locations: array(string()).optional()
13421
+ locations: array(string()).optional(),
13422
+ encryption: BackupArchiveEncryptionSchema.optional()
12682
13423
  });
12683
13424
  var ArchiveEntrySchema = object({
12684
13425
  path: string(),
@@ -12867,10 +13608,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12867
13608
  * this list and skips entries whose path doesn't start with
12868
13609
  * any of them.
12869
13610
  */
12870
- locations: array(string()).optional()
13611
+ locations: array(string()).optional(),
13612
+ /**
13613
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13614
+ * one). The archive is decrypted into the hub's private staging
13615
+ * before the restart; the key is not stored. A wrong or missing key
13616
+ * is refused before the archive is downloaded.
13617
+ */
13618
+ backupSecretKey: string().optional()
12871
13619
  }), _void(), {
12872
13620
  kind: "mutation",
12873
13621
  auth: "admin"
13622
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13623
+ keyId: string(),
13624
+ secretKey: string(),
13625
+ publicKey: string(),
13626
+ createdAt: number(),
13627
+ replacedKeyId: string().nullable()
13628
+ }), {
13629
+ kind: "mutation",
13630
+ auth: "admin"
13631
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13632
+ kind: "mutation",
13633
+ auth: "admin"
13634
+ }), method(object({ backupSecretKey: string() }), object({
13635
+ valid: boolean(),
13636
+ keyId: string().nullable(),
13637
+ /** The hub knows this key (active or retired). */
13638
+ known: boolean(),
13639
+ /** It is the key new archives are encrypted to. */
13640
+ active: boolean(),
13641
+ error: string().optional()
13642
+ }), {
13643
+ kind: "mutation",
13644
+ auth: "admin"
12874
13645
  }), method(object({
12875
13646
  destinationId: string(),
12876
13647
  backupId: string()
@@ -14645,7 +15416,60 @@ var CustomModelDescriptorSchema = object({
14645
15416
  stepId: string(),
14646
15417
  entry: ModelCatalogEntrySchema
14647
15418
  });
14648
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15419
+ /** One regular file of an imported bundle, as the producer measured it. */
15420
+ var ModelBundleFileSchema = object({
15421
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15422
+ path: string().min(1),
15423
+ bytes: number().int().nonnegative(),
15424
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15425
+ });
15426
+ var ImportModelBundleInputSchema = object({
15427
+ /** The registry provider that keeps the model (Model Studio). */
15428
+ addonId: string(),
15429
+ stepId: string().min(1),
15430
+ /**
15431
+ * The catalog rows to register, complete, every format URL already
15432
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15433
+ * bundle may carry several rows (a base and its INT8 variant).
15434
+ */
15435
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15436
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15437
+ bundle: object({
15438
+ ticket: PeerBytesTicketSchema,
15439
+ bytes: number().int().positive(),
15440
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15441
+ }),
15442
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15443
+ files: array(ModelBundleFileSchema).min(1).max(64),
15444
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15445
+ distribute: boolean()
15446
+ });
15447
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15448
+ kind: literal("imported"),
15449
+ modelIds: array(string()).readonly(),
15450
+ distributed: array(object({
15451
+ modelId: string(),
15452
+ nodeId: string(),
15453
+ format: _enum(MODEL_FORMATS),
15454
+ ok: boolean(),
15455
+ error: string().optional()
15456
+ })).readonly()
15457
+ }), object({
15458
+ kind: literal("refused"),
15459
+ reason: _enum([
15460
+ "transfer-failed",
15461
+ "checksum-mismatch",
15462
+ "bundle-mismatch",
15463
+ "invalid-entry",
15464
+ "id-taken"
15465
+ ]),
15466
+ detail: string()
15467
+ })]);
15468
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15469
+ kind: "mutation",
15470
+ auth: "admin",
15471
+ timeoutMs: 30 * 6e4
15472
+ });
14649
15473
  /**
14650
15474
  * Query filter for settings-store collections.
14651
15475
  */
@@ -15124,6 +15948,35 @@ var KeychainKeySourceSchema = object({
15124
15948
  */
15125
15949
  sharesBackupWithDatabase: boolean()
15126
15950
  });
15951
+ /**
15952
+ * One keychain reset, as the Secrets page reports it until the operator
15953
+ * acknowledges it. Never a value: refs, counts and table names only.
15954
+ */
15955
+ var KeychainResetRecordSchema = object({
15956
+ id: string(),
15957
+ at: number(),
15958
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15959
+ actor: string(),
15960
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15961
+ lockedReason: string().nullable(),
15962
+ /** Values moved into the archive table (ciphertext under the lost key). */
15963
+ archived: number().int(),
15964
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15965
+ archivedCollection: string().nullable(),
15966
+ /**
15967
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15968
+ * so the archive can still be opened if the lost master key turns up.
15969
+ */
15970
+ archivedKeysCollection: string().nullable(),
15971
+ /**
15972
+ * `system-settings` keys whose marker the reset cleared — the cluster
15973
+ * secret's: a marker left pointing at an archived value would refuse every
15974
+ * agent forever (D797).
15975
+ */
15976
+ clearedSettingsKeys: array(string()).readonly(),
15977
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15978
+ acknowledgedAt: number().nullable()
15979
+ });
15127
15980
  var KeychainStatusSchema = object({
15128
15981
  keychain: KeychainStateSchema,
15129
15982
  /** The source of the master key in use; `null` while locked. */
@@ -15141,7 +15994,9 @@ var KeychainStatusSchema = object({
15141
15994
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
15142
15995
  retiredWraps: number().int(),
15143
15996
  recoveryKeyDownloadedAt: number().nullable(),
15144
- secretCount: number().int()
15997
+ secretCount: number().int(),
15998
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15999
+ lastReset: KeychainResetRecordSchema.nullable()
15145
16000
  });
15146
16001
  /**
15147
16002
  * Whether a stored value is still pointed at by its owner's settings.
@@ -15163,17 +16018,26 @@ var KeychainAuditActionSchema = _enum([
15163
16018
  "download-recovery-key",
15164
16019
  "delete-orphans",
15165
16020
  "reset",
16021
+ "acknowledge-reset",
15166
16022
  "initialize"
15167
16023
  ]);
15168
16024
  var KeychainAuditEntrySchema = object({
15169
16025
  id: string(),
15170
16026
  at: number(),
15171
16027
  action: KeychainAuditActionSchema,
15172
- /** `addon:<id>` | `user:<id>` | `system`. */
16028
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
15173
16029
  actor: string(),
15174
16030
  ref: string().nullable(),
15175
16031
  detail: string().nullable()
15176
16032
  });
16033
+ var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
16034
+ /**
16035
+ * Secrets the HUB itself holds (owner `system`) that no settings form shows:
16036
+ * `jwt-signing-key` — the session signing key (D797). It is always "in use",
16037
+ * never an orphan; it is generated on a fresh hub and replaced only through
16038
+ * {@link keychainAdminCapability.methods.setSystemSecret}.
16039
+ */
16040
+ var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
15177
16041
  method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}), array(KeychainAdminSecretSchema).readonly(), { auth: "admin" }), method(object({ limit: number().int().min(1).max(500).optional() }), array(KeychainAuditEntrySchema).readonly(), { auth: "admin" }), method(object({ ref: string().min(1) }), object({
15178
16042
  value: string(),
15179
16043
  version: number().int()
@@ -15181,6 +16045,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15181
16045
  kind: "mutation",
15182
16046
  auth: "admin",
15183
16047
  caller: "required"
16048
+ }), method(object({
16049
+ name: SystemHeldSecretNameSchema,
16050
+ value: string().min(16)
16051
+ }), object({
16052
+ ref: string(),
16053
+ version: number().int()
16054
+ }), {
16055
+ kind: "mutation",
16056
+ auth: "admin",
16057
+ caller: "required"
15184
16058
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
15185
16059
  deleted: array(string()).readonly(),
15186
16060
  kept: array(object({
@@ -15210,13 +16084,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15210
16084
  kind: "mutation",
15211
16085
  auth: "admin",
15212
16086
  caller: "required"
15213
- }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
16087
+ }), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
15214
16088
  archivedCollection: string().nullable(),
15215
16089
  archived: number().int()
15216
16090
  }), {
15217
16091
  kind: "mutation",
15218
16092
  auth: "admin",
15219
16093
  caller: "required"
16094
+ }), method(object({}), object({
16095
+ reset: KeychainResetRecordSchema.nullable(),
16096
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
16097
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
16098
+ kind: "mutation",
16099
+ auth: "admin",
16100
+ caller: "required"
15220
16101
  });
15221
16102
  method(_void(), object({
15222
16103
  id: string(),
@@ -17782,14 +18663,14 @@ var LlmProfileSchema = object({
17782
18663
  /** ConfigUISchema tree passed through untyped on the wire (the
17783
18664
  * notification-output `ConfigSchemaPassthrough` precedent at
17784
18665
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
17785
- var ConfigSchemaPassthrough$1 = unknown();
18666
+ var ConfigSchemaPassthrough$3 = unknown();
17786
18667
  var LlmProfileKindDescriptorSchema = object({
17787
18668
  kind: LlmProfileKindSchema,
17788
18669
  label: string(),
17789
18670
  icon: string(),
17790
18671
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
17791
18672
  addonId: string(),
17792
- configSchema: ConfigSchemaPassthrough$1
18673
+ configSchema: ConfigSchemaPassthrough$3
17793
18674
  });
17794
18675
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
17795
18676
  var LlmDefaultSchema = object({
@@ -18067,7 +18948,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
18067
18948
  * `login-method` — collection cap through which auth addons contribute
18068
18949
  * their pre-auth login surfaces to the login page. This is the SINGLE,
18069
18950
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
18070
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18951
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
18071
18952
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
18072
18953
  * procedure aggregates them for the unauthenticated login page.
18073
18954
  *
@@ -18075,8 +18956,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
18075
18956
  *
18076
18957
  * - `redirect` — a declarative button. The login page renders a generic
18077
18958
  * button that navigates to `startUrl` (an addon-owned HTTP route).
18078
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
18079
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18959
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
18080
18960
  * login page needs NO change.
18081
18961
  *
18082
18962
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -18095,8 +18975,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
18095
18975
  * decision.
18096
18976
  *
18097
18977
  * Every contribution carries a `stage`:
18098
- * - `primary` — shown on the first credentials screen (OIDC /
18099
- * magic-link buttons; a future usernameless passkey).
18978
+ * - `primary` — shown on the first credentials screen (OIDC
18979
+ * buttons; a usernameless passkey).
18100
18980
  * - `second-factor` — shown AFTER the password leg, gated on the
18101
18981
  * returned `factors` (passkey-as-2FA today).
18102
18982
  *
@@ -18123,7 +19003,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
18123
19003
  * The provider names an external identity a signed-in user can link to
18124
19004
  * their own account (D782): `auth.listLinkableProviders` /
18125
19005
  * `beginExternalLink` offer exactly the redirect methods that set this,
18126
- * whatever their id. Absent / false — a login button only (magic-link).
19006
+ * whatever their id. Absent / false — a login button only.
18127
19007
  */
18128
19008
  linkable: boolean().optional()
18129
19009
  }),
@@ -18911,7 +19791,7 @@ var TargetKindCapsSchema = object({
18911
19791
  * the union is large and not meant for runtime validation here; the exported
18912
19792
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
18913
19793
  */
18914
- var ConfigSchemaPassthrough = unknown();
19794
+ var ConfigSchemaPassthrough$2 = unknown();
18915
19795
  var TargetKindSchema = object({
18916
19796
  kind: string(),
18917
19797
  label: string(),
@@ -18948,7 +19828,7 @@ var TargetKindSchema = object({
18948
19828
  * its raster path, which is the safe default for an unknown image.
18949
19829
  */
18950
19830
  iconMediaType: string().optional(),
18951
- configSchema: ConfigSchemaPassthrough,
19831
+ configSchema: ConfigSchemaPassthrough$2,
18952
19832
  /**
18953
19833
  * The config keys that decide WHERE this kind's secrets are sent (server,
18954
19834
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -21978,8 +22858,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21978
22858
  * `super_admin` — collapsed onto the single boolean because every
21979
22859
  * non-admin caller is governed by the same scope-check rules; the
21980
22860
  * distinction was only ever used to route role-specific procedures
21981
- * which we no longer have. Agents are admin sessions issued via
21982
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22861
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21983
22862
  * with `isAdmin: false` + an explicit scope list.
21984
22863
  */
21985
22864
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -22286,6 +23165,61 @@ var OauthIntegrationDescriptorSchema = object({
22286
23165
  });
22287
23166
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
22288
23167
  /**
23168
+ * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
23169
+ *
23170
+ * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
23171
+ * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
23172
+ * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
23173
+ * immutable after create.
23174
+ */
23175
+ var ConfigSchemaPassthrough$1 = unknown();
23176
+ var OidcConnectionSchema = object({
23177
+ id: string().min(1),
23178
+ displayName: string(),
23179
+ icon: string(),
23180
+ issuerUrl: string(),
23181
+ clientId: string(),
23182
+ /** Client id + secret present — never the secret value. */
23183
+ configured: boolean(),
23184
+ /**
23185
+ * Values for the connection form schema. `clientSecret` is a keychain
23186
+ * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
23187
+ */
23188
+ formValues: record(string(), unknown()).optional()
23189
+ });
23190
+ /**
23191
+ * Patch one connection. Omitted or empty `clientSecret` keeps the stored
23192
+ * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
23193
+ */
23194
+ var OidcConnectionUpdateInputSchema = object({
23195
+ id: string().min(1),
23196
+ displayName: string().min(1),
23197
+ icon: string().optional(),
23198
+ issuerUrl: string().optional(),
23199
+ clientId: string().optional(),
23200
+ clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
23201
+ redirectUri: string().optional(),
23202
+ scopes: string().optional(),
23203
+ usernameClaim: _enum([
23204
+ "preferred_username",
23205
+ "email",
23206
+ "sub"
23207
+ ]).optional()
23208
+ });
23209
+ method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
23210
+ id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
23211
+ displayName: string().min(1)
23212
+ }), object({ id: string() }), {
23213
+ kind: "mutation",
23214
+ auth: "admin"
23215
+ }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
23216
+ kind: "mutation",
23217
+ auth: "admin"
23218
+ }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
23219
+ kind: "mutation",
23220
+ auth: "admin"
23221
+ });
23222
+ /**
22289
23223
  * What started a camera's onboard motion (D672). `camera` is the camera's own
22290
23224
  * firmware; `sensor` is a device the operator ATTACHED to it. Absent on the
22291
23225
  * wire means the camera: only the camera-sensors bridge ever says `sensor`.
@@ -23642,21 +24576,69 @@ var RetrainFrameListSchema = object({
23642
24576
  /** What the page pre-selects — the native key frame when one survives. */
23643
24577
  autoPickMediaId: number().int().optional()
23644
24578
  });
24579
+ /** Exclusive partition of a corpus copy's annotation progress (design §4.2). */
24580
+ var RetrainFrameWorkStateSchema = _enum([
24581
+ "unannotated",
24582
+ "annotated",
24583
+ "complete"
24584
+ ]);
24585
+ /**
24586
+ * Filters for paginated corpus list, KPI, and matching export (design §4.4).
24587
+ * Every narrowing field is ANDed; omitted fields impose no constraint.
24588
+ */
24589
+ var RetrainCorpusFilterSchema = object({
24590
+ workState: RetrainFrameWorkStateSchema.optional(),
24591
+ deviceIds: array(number()).max(500).optional(),
24592
+ /** When set, only frames in this named collection. */
24593
+ collectionId: string().optional(),
24594
+ /** Frames that carry at least one saved annotation in one of these classes. */
24595
+ classes: array(RetrainMacroClassSchema).optional(),
24596
+ page: number().int().positive().default(1),
24597
+ pageSize: number().int().positive().max(100).default(50)
24598
+ });
24599
+ var RetrainCorpusPageSchema = object({
24600
+ frames: array(RetrainFrameSchema.extend({ workState: RetrainFrameWorkStateSchema })).readonly(),
24601
+ total: number().int().nonnegative(),
24602
+ page: number().int().positive(),
24603
+ pageSize: number().int().positive()
24604
+ });
24605
+ var RetrainCorpusKpiCameraRowSchema = object({
24606
+ deviceId: number(),
24607
+ unannotated: number().int().nonnegative(),
24608
+ annotated: number().int().nonnegative(),
24609
+ complete: number().int().nonnegative(),
24610
+ /** This camera's `complete` count divided by corpus `total`, in `[0,1]`.
24611
+ * `null` when the corpus is empty (no ratio). */
24612
+ pctOfCorpus: number().min(0).max(1).nullable()
24613
+ });
24614
+ var RetrainCorpusKpiSchema = object({
24615
+ total: number().int().nonnegative(),
24616
+ unannotated: number().int().nonnegative(),
24617
+ annotated: number().int().nonnegative(),
24618
+ complete: number().int().nonnegative(),
24619
+ cameras: array(RetrainCorpusKpiCameraRowSchema).readonly()
24620
+ });
23645
24621
  /**
23646
24622
  * Which frames an annotated export carries. Every field narrows; an empty
23647
- * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23648
- * list owned by whoever trains (the training orchestrator), so `frameIds` is
23649
- * the primitive a version export uses; `batchId` re-selects what an earlier
23650
- * export carried (`exportedInBatch`).
24623
+ * filter is every annotated copy. `frameIds` is the primitive a job or
24624
+ * download uses; `batchId` re-selects what an earlier export carried
24625
+ * (`exportedInBatch`). Frozen dataset versions were removed — live selection
24626
+ * resolves to `frameIds` at plan/start.
23651
24627
  */
23652
24628
  var RetrainExportFilterSchema = object({
23653
24629
  deviceIds: array(number()).optional(),
23654
24630
  frameIds: array(string()).max(2e4).optional(),
23655
24631
  /** Only frames in at least one of these named collections. */
23656
24632
  collectionIds: array(string()).max(200).optional(),
24633
+ /** Single collection (Frames filter bar). ANDed with `collectionIds` when both set. */
24634
+ collectionId: string().optional(),
23657
24635
  batchId: string().optional(),
23658
24636
  /** Only frames the operator marked complete (all subjects boxed). */
23659
- completeOnly: boolean().optional()
24637
+ completeOnly: boolean().optional(),
24638
+ /** Exclusive work-state partition (`workStateOf`); same as the corpus list. */
24639
+ workState: RetrainFrameWorkStateSchema.optional(),
24640
+ /** Frames with at least one saved annotation in one of these classes. */
24641
+ classes: array(RetrainMacroClassSchema).optional()
23660
24642
  });
23661
24643
  /**
23662
24644
  * `frames`: the full frame copies, boxes in `annotations.json`.
@@ -23821,6 +24803,77 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23821
24803
  ]),
23822
24804
  detail: string().optional()
23823
24805
  })]);
24806
+ /** What a dataset version is cut from. Every field narrows. */
24807
+ var RetrainDatasetSelectionSchema = object({
24808
+ deviceIds: array(number()).readonly().optional(),
24809
+ collectionIds: array(string()).max(200).readonly().optional(),
24810
+ frameIds: array(string()).max(2e4).readonly().optional()
24811
+ });
24812
+ /** The counts a dataset is judged by. */
24813
+ var RetrainDatasetStatsSchema = object({
24814
+ frames: number().int(),
24815
+ completeFrames: number().int(),
24816
+ /** `completeFrames / frames`, 0..1. */
24817
+ completeness: number(),
24818
+ /** Boxes to learn (model errors excluded). */
24819
+ subjects: number().int(),
24820
+ modelErrors: number().int(),
24821
+ /** Complete frames with no subject. */
24822
+ hardNegatives: number().int(),
24823
+ /** Subjects per class × camera × day/night. */
24824
+ cells: array(object({
24825
+ macroClass: string(),
24826
+ deviceId: number(),
24827
+ lighting: _enum([
24828
+ "day",
24829
+ "night",
24830
+ "unknown"
24831
+ ]),
24832
+ subjects: number().int(),
24833
+ frames: number().int()
24834
+ })).readonly(),
24835
+ cameras: array(object({
24836
+ deviceId: number(),
24837
+ frames: number().int(),
24838
+ completeFrames: number().int()
24839
+ })).readonly()
24840
+ });
24841
+ object({
24842
+ id: string(),
24843
+ name: string(),
24844
+ createdAt: number(),
24845
+ selection: RetrainDatasetSelectionSchema,
24846
+ layout: RetrainExportLayoutSchema,
24847
+ completeOnly: boolean(),
24848
+ frameCount: number().int(),
24849
+ annotationHash: string(),
24850
+ manifestSchema: string(),
24851
+ stats: RetrainDatasetStatsSchema
24852
+ });
24853
+ /**
24854
+ * Live training corpus criteria — same shape as `TrainingCorpusSelection` on
24855
+ * the training cap. Resolved here so plan/start and the annotated export share
24856
+ * one definition of "the frames" (`buildRetrainExportPlan`).
24857
+ */
24858
+ var RetrainTrainingCorpusSelectionSchema = object({
24859
+ collectionIds: array(string()).min(1),
24860
+ workState: _enum([
24861
+ "complete",
24862
+ "annotated_or_complete",
24863
+ "any_annotated"
24864
+ ]).default("complete")
24865
+ });
24866
+ var RetrainTrainingCorpusResolveResultSchema = discriminatedUnion("kind", [object({
24867
+ kind: literal("resolved"),
24868
+ frameIds: array(string()).max(2e4).readonly(),
24869
+ stats: RetrainDatasetStatsSchema,
24870
+ annotationHash: string(),
24871
+ layout: RetrainExportLayoutSchema
24872
+ }), object({
24873
+ kind: literal("refused"),
24874
+ reason: _enum(["unknown-collection", "no-frames"]),
24875
+ detail: string()
24876
+ })]);
23824
24877
  /** The outcome of a lifecycle move owned by the retrain page. */
23825
24878
  var RetrainTransitionResultSchema = object({
23826
24879
  trackId: string(),
@@ -24526,6 +25579,12 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24526
25579
  }), array(RetrainTrackSchema).readonly(), {
24527
25580
  kind: "query",
24528
25581
  auth: "admin"
25582
+ }), method(RetrainCorpusFilterSchema, RetrainCorpusPageSchema, {
25583
+ kind: "query",
25584
+ auth: "admin"
25585
+ }), method(object({}), RetrainCorpusKpiSchema, {
25586
+ kind: "query",
25587
+ auth: "admin"
24529
25588
  }), method(object({ trackId: string() }), RetrainFrameListSchema, {
24530
25589
  kind: "query",
24531
25590
  auth: "admin"
@@ -24610,6 +25669,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24610
25669
  kind: "mutation",
24611
25670
  auth: "admin",
24612
25671
  timeoutMs: 60 * 6e4
25672
+ }), method(object({
25673
+ filter: RetrainExportFilterSchema,
25674
+ layout: RetrainExportLayoutSchema
25675
+ }), object({
25676
+ ticket: PeerBytesTicketSchema,
25677
+ frames: number().int(),
25678
+ annotations: number().int()
25679
+ }), {
25680
+ kind: "mutation",
25681
+ auth: "admin",
25682
+ timeoutMs: 12e4
24613
25683
  }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24614
25684
  kind: "query",
24615
25685
  auth: "admin"
@@ -24636,6 +25706,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24636
25706
  }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24637
25707
  kind: "query",
24638
25708
  auth: "admin"
25709
+ }), method(RetrainTrainingCorpusSelectionSchema, RetrainTrainingCorpusResolveResultSchema, {
25710
+ kind: "query",
25711
+ auth: "admin",
25712
+ timeoutMs: 6e4
24639
25713
  }), method(object({
24640
25714
  id: string(),
24641
25715
  name: string().max(120)
@@ -25252,11 +26326,14 @@ var HardwareClassIdSchema = _enum([
25252
26326
  "intel-n-series",
25253
26327
  "apple-m-base",
25254
26328
  "apple-m-pro",
26329
+ "amd-phoenix",
25255
26330
  "unknown"
25256
26331
  ]);
25257
26332
  var AcceleratorKindSchema = _enum([
25258
26333
  "intel-npu",
25259
26334
  "intel-igpu",
26335
+ "amd-igpu",
26336
+ "amd-npu",
25260
26337
  "x86-cpu",
25261
26338
  "arm-cpu",
25262
26339
  "apple-ane",
@@ -27186,6 +28263,8 @@ var AgentPipelineSettingsSchema = object({
27186
28263
  * address is wrong (multi-homed host, NAT, custom interface).
27187
28264
  */
27188
28265
  reachableHost: string().optional(),
28266
+ /** Hub-persisted UI colour (`--color-node-*` theme tokens). */
28267
+ color: NodeColorIdSchema.optional(),
27189
28268
  /**
27190
28269
  * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
27191
28270
  * weight, steps}. Absent / all-disabled ⇒ the node's single default
@@ -27735,8 +28814,9 @@ method(object({
27735
28814
  auth: "admin"
27736
28815
  }), method(object({
27737
28816
  agentNodeId: string(),
27738
- reachableHost: string().nullable()
27739
- }), object({ success: literal(true) }), {
28817
+ reachableHost: string().nullable().optional(),
28818
+ color: NodeColorIdSchema.nullable().optional()
28819
+ }).refine((v) => v.reachableHost !== void 0 || v.color !== void 0, { message: "reachableHost or color required" }), object({ success: literal(true) }), {
27740
28820
  kind: "mutation",
27741
28821
  auth: "admin"
27742
28822
  }), method(object({
@@ -28188,8 +29268,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
28188
29268
  * `smtp-provider` — pluggable email delivery surface.
28189
29269
  *
28190
29270
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
28191
- * one for transactional / one for notifications). Consumers (magic-link,
28192
- * notifier addons, …) walk the collection and pick the first
29271
+ * one for transactional / one for notifications). Consumers (notifier
29272
+ * addons, …) walk the collection and pick the first
28193
29273
  * ready provider OR target a specific addonId.
28194
29274
  *
28195
29275
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -28368,7 +29448,7 @@ targets: array(object({
28368
29448
  })));
28369
29449
  /**
28370
29450
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
28371
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
29451
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
28372
29452
  * carrying the post-callback claims before redirecting back to
28373
29453
  * `/api/auth/sso/finish`.
28374
29454
  *
@@ -28431,7 +29511,14 @@ var SsoBridgeClaimsSchema = object({
28431
29511
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28432
29512
  * subject is unique only per issuer, so a link is bound to it.
28433
29513
  */
28434
- issuer: string().optional()
29514
+ issuer: string().optional(),
29515
+ /**
29516
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
29517
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
29518
+ * request to present the matching cookie — a login bridge is useless in
29519
+ * any other browser.
29520
+ */
29521
+ browserBinding: string().optional()
28435
29522
  });
28436
29523
  method(object({
28437
29524
  claims: SsoBridgeClaimsSchema,
@@ -30805,7 +31892,7 @@ var CustomActionInputSchema = object({
30805
31892
  action: string().min(1),
30806
31893
  input: unknown()
30807
31894
  });
30808
- method(_void(), array(AddonListItemSchema).readonly()), method(object({
31895
+ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSchema).readonly()), method(object({
30809
31896
  addonId: string(),
30810
31897
  limit: number().min(1).max(500).default(100),
30811
31898
  level: LogLevelSchema$2.optional()
@@ -35884,7 +36971,13 @@ var TopologyNodeSchema = object({
35884
36971
  })).readonly(),
35885
36972
  processes: array(TopologyProcessSchema).readonly(),
35886
36973
  categories: array(TopologyCategorySchema).readonly(),
35887
- rootPackage: TopologyRootPackageSchema.nullable()
36974
+ rootPackage: TopologyRootPackageSchema.nullable(),
36975
+ /**
36976
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
36977
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
36978
+ * for offline rows and when the hub cannot tell.
36979
+ */
36980
+ meshTransport: _enum(["tls", "clear"]).optional()
35888
36981
  });
35889
36982
  var CapUsageEdgeSchema = object({
35890
36983
  callerAddonId: string(),
@@ -36297,6 +37390,7 @@ var OsdNamedTemplateSchema = object({
36297
37390
  });
36298
37391
  /** Where a slot's value comes from. */
36299
37392
  var OsdSourceSchema = discriminatedUnion("kind", [
37393
+ object({ kind: literal("none") }),
36300
37394
  object({
36301
37395
  kind: literal("static"),
36302
37396
  text: string().max(64)
@@ -36423,6 +37517,13 @@ method(object({ deviceId: number().int() }), object({
36423
37517
  }), object({ success: literal(true) }), {
36424
37518
  kind: "mutation",
36425
37519
  auth: "admin"
37520
+ }), method(object({
37521
+ deviceId: number().int(),
37522
+ slotId: string().min(1),
37523
+ enabled: boolean()
37524
+ }), object({ success: literal(true) }), {
37525
+ kind: "mutation",
37526
+ auth: "admin"
36426
37527
  }), method(object({
36427
37528
  sourceDeviceId: number().int(),
36428
37529
  targetDeviceId: number().int()
@@ -36854,7 +37955,15 @@ var GpuInfoSchema = object({
36854
37955
  name: string(),
36855
37956
  memoryMB: number().optional()
36856
37957
  });
36857
- var NpuInfoSchema = object({ type: _enum(["apple-ane", "intel-npu"]) });
37958
+ var NpuInfoSchema = object({
37959
+ type: _enum([
37960
+ "apple-ane",
37961
+ "intel-npu",
37962
+ "amd-xdna"
37963
+ ]),
37964
+ name: string().optional(),
37965
+ generation: _enum(["xdna1", "xdna2"]).optional()
37966
+ });
36858
37967
  var CoralInfoSchema = object({
36859
37968
  type: literal("coral-edgetpu"),
36860
37969
  bus: string().optional()
@@ -40707,16 +41816,6 @@ var ApiKeySummarySchema = object({
40707
41816
  createdAt: number(),
40708
41817
  lastUsedAt: number().optional()
40709
41818
  });
40710
- var CreateApiKeyInputSchema = object({
40711
- label: string(),
40712
- isAdmin: boolean().default(false),
40713
- allowedProviders: union([array(string()), literal("*")]).optional(),
40714
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
40715
- });
40716
- var CreateApiKeyResultSchema = object({
40717
- token: string(),
40718
- record: ApiKeySummarySchema
40719
- });
40720
41819
  var ScopedTokenSummarySchema = object({
40721
41820
  id: string(),
40722
41821
  userId: string(),
@@ -40815,17 +41914,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40815
41914
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
40816
41915
  kind: "mutation",
40817
41916
  access: "view"
40818
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
40819
- kind: "mutation",
40820
- auth: "admin",
40821
- access: "create"
40822
- }), method(object({ id: string() }), object({ success: literal(true) }), {
41917
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
40823
41918
  kind: "mutation",
40824
41919
  auth: "admin",
40825
41920
  access: "delete"
40826
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
40827
- kind: "mutation",
40828
- access: "view"
40829
41921
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
40830
41922
  kind: "mutation",
40831
41923
  auth: "admin",
@@ -40899,15 +41991,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40899
41991
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
40900
41992
  userId: string(),
40901
41993
  issuer: string()
40902
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
40903
- userId: string(),
40904
- issuer: string().min(1),
40905
- label: string().optional()
40906
- }), object({ success: literal(true) }), {
40907
- kind: "mutation",
40908
- auth: "admin",
40909
- access: "create"
40910
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41994
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
40911
41995
  kind: "mutation",
40912
41996
  auth: "admin",
40913
41997
  access: "delete"
@@ -41612,6 +42696,563 @@ var zoneRulesCapability = {
41612
42696
  */
41613
42697
  durability: "restored"
41614
42698
  };
42699
+ /**
42700
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
42701
+ *
42702
+ * A thin, mockable translation layer: it knows how to run a container with a
42703
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
42704
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
42705
+ * those are the `training` orchestrator's (D805). Every rule written there
42706
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
42707
+ * manifest entry and nothing else.
42708
+ *
42709
+ * Collection of provider **types** (addons). Each addon owns zero or more
42710
+ * **entries** (credentials + defaults). Concat-fans: `describe`,
42711
+ * `describeTypes`, `listEntries`, `listJobs`. Single-row work is keyed by
42712
+ * `entryId`; callers also pass the owning `addonId` as the collection
42713
+ * selector (broker posture). Every method is `admin`: these spend money.
42714
+ *
42715
+ * Every cloud object a provider creates is tagged with the orchestrator's
42716
+ * `jobKey`, so a retried submit finds the job it already started instead of
42717
+ * starting a second GPU, and `listJobs` can find orphans.
42718
+ *
42719
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
42720
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
42721
+ * ticket the provider mints (D613).
42722
+ */
42723
+ var TrainingGpuOptionSchema = object({
42724
+ id: string(),
42725
+ label: string(),
42726
+ /** List price, USD per GPU-hour, before any region multiplier. */
42727
+ usdPerHour: number().nonnegative(),
42728
+ vramGb: number().nonnegative()
42729
+ });
42730
+ var TrainingRegionOptionSchema = object({
42731
+ /** `''` = any region (the provider's choice). */
42732
+ id: string(),
42733
+ label: string(),
42734
+ priceMultiplier: number().positive()
42735
+ });
42736
+ /**
42737
+ * The provider's per-entry settings, as the orchestrator reads them. They
42738
+ * live on the PROVIDER addon's entry (operator decision 2026-10-08: they
42739
+ * depend on the user's account), never hard-coded in the orchestrator.
42740
+ */
42741
+ var TrainingProviderDefaultsSchema = object({
42742
+ gpuType: string(),
42743
+ region: string(),
42744
+ costCapUsd: number().nonnegative(),
42745
+ maxRuntimeSec: number().int().positive(),
42746
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
42747
+ failedDatasetGraceHours: number().nonnegative()
42748
+ });
42749
+ /**
42750
+ * Entry form schema for a provider type — same seam as notification
42751
+ * `TargetKind.configSchema` (`z.unknown()` at the wire; callers tighten to
42752
+ * {@link ConfigUISchema}). Drives `ConfigFormBuilder` on Training → Providers.
42753
+ */
42754
+ var ConfigSchemaPassthrough = unknown();
42755
+ /** One creatable provider type, for the Add-entry dialog. */
42756
+ var TrainingProviderTypeSchema = object({
42757
+ typeId: string(),
42758
+ label: string(),
42759
+ /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
42760
+ iconAsset: string(),
42761
+ /** Owning `training-provider` addon — collection selector for createEntry. */
42762
+ addonId: string(),
42763
+ /**
42764
+ * Fields for one entry of this type (credentials + defaults). Absent on a
42765
+ * type that only needs a name. Password fields are keychain-backed on the
42766
+ * provider addon (`secretStatePaths`), not D634 plaintext.
42767
+ */
42768
+ configSchema: ConfigSchemaPassthrough.optional()
42769
+ });
42770
+ /** One configured account / workspace under a provider type. */
42771
+ var TrainingProviderEntrySchema = object({
42772
+ entryId: string(),
42773
+ typeId: string(),
42774
+ name: string(),
42775
+ addonId: string(),
42776
+ /** Credentials are present — never the values. */
42777
+ configured: boolean()
42778
+ });
42779
+ var TrainingProviderDescriptorSchema = object({
42780
+ addonId: string(),
42781
+ entryId: string(),
42782
+ typeId: string(),
42783
+ /** Operator-chosen entry name. */
42784
+ name: string(),
42785
+ iconAsset: string(),
42786
+ /** `modal`, `runpod`, `fake`, … — same as typeId for current providers. */
42787
+ kind: string(),
42788
+ label: string(),
42789
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
42790
+ regions: array(TrainingRegionOptionSchema).readonly(),
42791
+ maxDatasetBytes: number().int().positive(),
42792
+ maxRuntimeSec: number().int().positive(),
42793
+ freeTierNote: string().optional(),
42794
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
42795
+ dataResidencyNote: string(),
42796
+ /** Credentials are present — never the values. */
42797
+ configured: boolean(),
42798
+ defaults: TrainingProviderDefaultsSchema,
42799
+ /**
42800
+ * Values for {@link TrainingProviderTypeSchema}'s `configSchema` — password
42801
+ * fields are keychain {@link SecretFieldView} or `null` / `''` (create),
42802
+ * never plaintext. Same hydrate contract as settings forms (D789).
42803
+ */
42804
+ formValues: record(string(), unknown()).optional()
42805
+ });
42806
+ /**
42807
+ * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
42808
+ * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
42809
+ * `{ $secretClear: true }` clears it.
42810
+ */
42811
+ var TrainingProviderUpdateEntryInputSchema = object({
42812
+ entryId: string().min(1),
42813
+ name: string().min(1),
42814
+ tokenId: string().optional(),
42815
+ tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
42816
+ environment: string().optional(),
42817
+ gpuType: string().optional(),
42818
+ region: string().optional(),
42819
+ costCapUsd: number().nonnegative().optional(),
42820
+ maxRuntimeSec: number().int().positive().optional(),
42821
+ failedDatasetGraceHours: number().nonnegative().optional()
42822
+ });
42823
+ var TrainingCredentialCheckSchema = object({
42824
+ ok: boolean(),
42825
+ /** Workspace / account name, when the provider says. */
42826
+ account: string().optional(),
42827
+ reason: _enum([
42828
+ "missing",
42829
+ "invalid",
42830
+ "forbidden",
42831
+ "network",
42832
+ "quota"
42833
+ ]).optional(),
42834
+ detail: string().optional()
42835
+ });
42836
+ var ProviderJobStateSchema = _enum([
42837
+ "pending",
42838
+ "starting",
42839
+ "running",
42840
+ "succeeded",
42841
+ "failed",
42842
+ "cancelled",
42843
+ "lost"
42844
+ ]);
42845
+ var ProviderJobStatusSchema = object({
42846
+ jobKey: string(),
42847
+ providerJobId: string().optional(),
42848
+ state: ProviderJobStateSchema,
42849
+ startedAt: number().optional(),
42850
+ endedAt: number().optional(),
42851
+ exitCode: number().int().optional(),
42852
+ failureReason: string().optional(),
42853
+ gpuType: string(),
42854
+ region: string().optional(),
42855
+ billedSeconds: number().nonnegative(),
42856
+ costUsd: number().nonnegative(),
42857
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
42858
+ costIsEstimate: boolean(),
42859
+ lastFetchedAt: number()
42860
+ });
42861
+ /**
42862
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
42863
+ * image its own way (Modal builds the published Dockerfile at that revision;
42864
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
42865
+ * in `result.json`.
42866
+ */
42867
+ var TrainerSourceRefSchema = object({
42868
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
42869
+ repo: string().min(1),
42870
+ /** A commit sha (never a branch) — the job must be reproducible. */
42871
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
42872
+ });
42873
+ /** Cloud job identity — route with the owning addon's `addonId` selector. */
42874
+ var JobRef = {
42875
+ entryId: string().min(1),
42876
+ jobKey: string().uuid()
42877
+ };
42878
+ var TrainingLogLineSchema = object({
42879
+ ts: number(),
42880
+ text: string()
42881
+ });
42882
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
42883
+ typeId: string().min(1),
42884
+ name: string().min(1)
42885
+ }), object({ entryId: string() }), {
42886
+ kind: "mutation",
42887
+ auth: "admin"
42888
+ }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
42889
+ kind: "mutation",
42890
+ auth: "admin"
42891
+ }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
42892
+ kind: "mutation",
42893
+ auth: "admin"
42894
+ }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
42895
+ kind: "mutation",
42896
+ auth: "admin",
42897
+ timeoutMs: 3e4
42898
+ }), method(object({
42899
+ entryId: string().min(1),
42900
+ gpuType: string(),
42901
+ region: string(),
42902
+ datasetBytes: number().int().nonnegative(),
42903
+ gpuSecondsLow: number().nonnegative(),
42904
+ gpuSecondsHigh: number().nonnegative()
42905
+ }), object({
42906
+ usdLow: number().nonnegative(),
42907
+ usdHigh: number().nonnegative(),
42908
+ notes: array(string()).readonly()
42909
+ }), { auth: "admin" }), method(object({
42910
+ ...JobRef,
42911
+ ticket: PeerBytesTicketSchema
42912
+ }), object({
42913
+ bytes: number().int().nonnegative(),
42914
+ sha256: string()
42915
+ }), {
42916
+ kind: "mutation",
42917
+ auth: "admin",
42918
+ timeoutMs: 120 * 6e4
42919
+ }), method(object({
42920
+ ...JobRef,
42921
+ trainer: TrainerSourceRefSchema,
42922
+ jobSpecJson: string().min(2).max(64e3),
42923
+ gpuType: string(),
42924
+ region: string(),
42925
+ maxRuntimeSec: number().int().positive()
42926
+ }), ProviderJobStatusSchema, {
42927
+ kind: "mutation",
42928
+ auth: "admin",
42929
+ timeoutMs: 30 * 6e4
42930
+ }), method(object(JobRef), ProviderJobStatusSchema, {
42931
+ auth: "admin",
42932
+ timeoutMs: 6e4
42933
+ }), method(object({
42934
+ ...JobRef,
42935
+ cursor: string().optional(),
42936
+ max: number().int().min(1).max(500)
42937
+ }), object({
42938
+ lines: array(TrainingLogLineSchema).readonly(),
42939
+ cursor: string()
42940
+ }), {
42941
+ auth: "admin",
42942
+ timeoutMs: 6e4
42943
+ }), method(object(JobRef), object({ ok: literal(true) }), {
42944
+ kind: "mutation",
42945
+ auth: "admin",
42946
+ timeoutMs: 6e4
42947
+ }), method(object(JobRef), object({
42948
+ found: boolean(),
42949
+ text: string().optional()
42950
+ }), {
42951
+ kind: "mutation",
42952
+ auth: "admin",
42953
+ timeoutMs: 5 * 6e4
42954
+ }), method(object({
42955
+ ...JobRef,
42956
+ path: _enum(["bundle.tar"])
42957
+ }), object({ ticket: PeerBytesTicketSchema }), {
42958
+ kind: "mutation",
42959
+ auth: "admin",
42960
+ timeoutMs: 5 * 6e4
42961
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
42962
+ kind: "mutation",
42963
+ auth: "admin",
42964
+ timeoutMs: 5 * 6e4
42965
+ }), method(object({ entryId: string().min(1).optional() }), array(ProviderJobStatusSchema).readonly(), {
42966
+ auth: "admin",
42967
+ timeoutMs: 2 * 6e4
42968
+ });
42969
+ /**
42970
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
42971
+ * provided by `addon-training`.
42972
+ *
42973
+ * It owns what every provider must agree on, written once:
42974
+ *
42975
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
42976
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
42977
+ * - **The return flow.** Verified artefacts → Model Studio
42978
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
42979
+ * rollback. Nothing is ever registered automatically.
42980
+ *
42981
+ * Plan/start takes a live {@link TrainingCorpusSelection} (collections +
42982
+ * work-state rule); frame ids are resolved via pipeline-analytics at that
42983
+ * moment and snapshotted on the job. No frozen dataset version.
42984
+ *
42985
+ * Every method is `admin`.
42986
+ */
42987
+ /**
42988
+ * Live corpus criteria for plan/start (design §5.2). Default is complete-only.
42989
+ * Frame ids are resolved at plan/start — never a frozen version id.
42990
+ */
42991
+ var TrainingCorpusSelectionSchema = object({
42992
+ collectionIds: array(string()).min(1),
42993
+ /** Default complete-only for v1 */
42994
+ workState: _enum([
42995
+ "complete",
42996
+ "annotated_or_complete",
42997
+ "any_annotated"
42998
+ ]).default("complete")
42999
+ });
43000
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
43001
+ var TrainingBaseModelSchema = object({
43002
+ modelId: string(),
43003
+ label: string(),
43004
+ weights: string(),
43005
+ imgsz: number().int(),
43006
+ baselineOnnxUrl: string(),
43007
+ baselineFloors: record(string(), number()),
43008
+ /** The base the fleet runs most — the UI's default. */
43009
+ recommended: boolean()
43010
+ });
43011
+ var TrainingPresetSchema = _enum([
43012
+ "quick",
43013
+ "standard",
43014
+ "thorough"
43015
+ ]);
43016
+ var TrainingJobRequestSchema = object({
43017
+ /** Live collection + work-state criteria; resolved at plan/start. */
43018
+ selection: TrainingCorpusSelectionSchema,
43019
+ /**
43020
+ * The provider **entry** that runs it (credentials + defaults).
43021
+ * Resolve to an owning addon via `training-provider.describe` / `listEntries`.
43022
+ */
43023
+ entryId: string().min(1),
43024
+ gpuType: string().min(1),
43025
+ region: string(),
43026
+ baseModelId: string().min(1),
43027
+ preset: TrainingPresetSchema,
43028
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
43029
+ freeze: number().int().nonnegative().nullable(),
43030
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
43031
+ holdoutCameras: array(number().int()).nullable()
43032
+ });
43033
+ var TrainingSplitPlanSchema = object({
43034
+ holdoutCameras: array(number().int()).readonly(),
43035
+ /** Used when no camera is held out: the last N days of every camera. */
43036
+ holdoutLastDays: number().int().nonnegative(),
43037
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
43038
+ holdoutSupport: record(string(), number().int()).nullable(),
43039
+ trainSubjects: number().int()
43040
+ });
43041
+ var TrainingRefusalReasonSchema = _enum([
43042
+ "unknown-dataset",
43043
+ "unknown-provider",
43044
+ "provider-not-configured",
43045
+ "unknown-base-model",
43046
+ "unknown-gpu",
43047
+ "dataset-too-large",
43048
+ "no-training-subjects",
43049
+ "job-already-running"
43050
+ ]);
43051
+ var TrainingJobPlanSchema = object({
43052
+ refusal: object({
43053
+ reason: TrainingRefusalReasonSchema,
43054
+ detail: string()
43055
+ }).nullable(),
43056
+ warnings: array(string()).readonly(),
43057
+ split: TrainingSplitPlanSchema.nullable(),
43058
+ estimate: object({
43059
+ datasetBytes: number().int(),
43060
+ uploadMinutesAt20Mbps: number(),
43061
+ gpuSecondsLow: number(),
43062
+ gpuSecondsHigh: number(),
43063
+ usdLow: number(),
43064
+ usdHigh: number(),
43065
+ notes: array(string()).readonly()
43066
+ }).nullable(),
43067
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
43068
+ defaults: object({
43069
+ maxCostUsd: number(),
43070
+ maxRuntimeSec: number().int()
43071
+ }).nullable(),
43072
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
43073
+ dataNotice: string()
43074
+ });
43075
+ /**
43076
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
43077
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
43078
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
43079
+ * result lives after the operator acted on it.
43080
+ */
43081
+ var TrainingJobStateSchema = _enum([
43082
+ "queued",
43083
+ "uploading",
43084
+ "submitted",
43085
+ "starting",
43086
+ "running",
43087
+ "collecting",
43088
+ "ready",
43089
+ "registered",
43090
+ "canary",
43091
+ "failed",
43092
+ "cancelling",
43093
+ "cancelled",
43094
+ "lost",
43095
+ "expired",
43096
+ "discarded"
43097
+ ]);
43098
+ var TrainingFailureReasonSchema = _enum([
43099
+ "cost-cap",
43100
+ "runtime-cap",
43101
+ "upload-failed",
43102
+ "submit-failed",
43103
+ "trainer-failed",
43104
+ "result-invalid",
43105
+ "checksum-mismatch",
43106
+ "fetch-failed",
43107
+ "provider-error",
43108
+ "hub-restart-during-upload"
43109
+ ]);
43110
+ var TrainingProgressPointSchema = object({
43111
+ epoch: number().int(),
43112
+ map50: number().nullable(),
43113
+ map50_95: number().nullable()
43114
+ });
43115
+ var TrainingCanarySchema = object({
43116
+ deviceIds: array(number().int()).readonly(),
43117
+ since: number(),
43118
+ /** Every override the canary replaced, exactly, so rollback restores it. */
43119
+ previous: array(object({
43120
+ deviceId: number().int(),
43121
+ nodeId: string(),
43122
+ deviceKey: string(),
43123
+ patch: object({
43124
+ modelId: string().optional(),
43125
+ settings: record(string(), unknown()).readonly().optional()
43126
+ }).nullable()
43127
+ })).readonly()
43128
+ });
43129
+ var TrainingJobSchema = object({
43130
+ id: string(),
43131
+ idempotencyKey: string(),
43132
+ name: string(),
43133
+ createdAt: number(),
43134
+ updatedAt: number(),
43135
+ state: TrainingJobStateSchema,
43136
+ /**
43137
+ * Shared by every job enqueued together via `startJobBatch`.
43138
+ * `null` for a lone `startJob`. The engine advances queued siblings by this id.
43139
+ */
43140
+ batchId: string().nullable().default(null),
43141
+ stage: TrainingStageSchema.nullable(),
43142
+ failure: object({
43143
+ reason: TrainingFailureReasonSchema,
43144
+ stage: string().nullable(),
43145
+ detail: string()
43146
+ }).nullable(),
43147
+ request: TrainingJobRequestSchema,
43148
+ maxCostUsd: number().nonnegative(),
43149
+ maxRuntimeSec: number().int().positive(),
43150
+ trainer: TrainerSourceRefSchema,
43151
+ datasetLayout: RetrainExportLayoutSchema,
43152
+ /** Frame count snapshotted when the job started (audit; equals `frameIds.length`). */
43153
+ frameCount: number().int().nonnegative(),
43154
+ /** Resolved frame ids at start — the archive ships exactly these. */
43155
+ frameIds: array(string()).max(2e4).readonly(),
43156
+ /** Hash of what those frames taught at start (trainer `dataset.annotationHash`). */
43157
+ annotationHash: string(),
43158
+ dataset: object({
43159
+ bytes: number().int(),
43160
+ sha256: string(),
43161
+ uploadedAt: number()
43162
+ }).nullable(),
43163
+ split: TrainingSplitPlanSchema,
43164
+ provider: object({
43165
+ state: ProviderJobStateSchema.nullable(),
43166
+ providerJobId: string().nullable(),
43167
+ startedAt: number().nullable(),
43168
+ endedAt: number().nullable(),
43169
+ billedSeconds: number(),
43170
+ costUsd: number(),
43171
+ costIsEstimate: boolean(),
43172
+ lastPolledAt: number().nullable()
43173
+ }),
43174
+ progress: object({
43175
+ epoch: number().int().nullable(),
43176
+ epochs: number().int().nullable(),
43177
+ etaSec: number().nullable(),
43178
+ series: array(TrainingProgressPointSchema).readonly()
43179
+ }),
43180
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
43181
+ logTail: array(string()).readonly(),
43182
+ logCursor: string().nullable(),
43183
+ artifacts: object({
43184
+ bundleBytes: number().int(),
43185
+ bundleSha256: string(),
43186
+ fetchedAt: number(),
43187
+ /** When the staged artefacts are deleted from the hub. */
43188
+ expiresAt: number()
43189
+ }).nullable(),
43190
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
43191
+ cloudDatasetDeletedAt: number().nullable(),
43192
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
43193
+ cloudCleanupDueAt: number().nullable(),
43194
+ /** Model ids registered from this job (base, and int8 when kept). */
43195
+ registeredModelIds: array(string()).readonly(),
43196
+ canary: TrainingCanarySchema.nullable()
43197
+ });
43198
+ var IdInput = object({ id: string().min(1) });
43199
+ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
43200
+ auth: "admin",
43201
+ timeoutMs: 6e4
43202
+ }), method(TrainingJobRequestSchema.extend({
43203
+ name: string().min(1).max(120),
43204
+ maxCostUsd: number().positive(),
43205
+ maxRuntimeSec: number().int().positive(),
43206
+ idempotencyKey: string().min(8).max(80)
43207
+ }), discriminatedUnion("kind", [object({
43208
+ kind: literal("started"),
43209
+ job: TrainingJobSchema
43210
+ }), object({
43211
+ kind: literal("refused"),
43212
+ reason: TrainingRefusalReasonSchema,
43213
+ detail: string()
43214
+ })]), {
43215
+ kind: "mutation",
43216
+ auth: "admin",
43217
+ timeoutMs: 12e4
43218
+ }), method(TrainingJobRequestSchema.omit({ baseModelId: true }).extend({
43219
+ baseModelIds: array(string().min(1)).min(1),
43220
+ name: string().min(1).max(120),
43221
+ maxCostUsd: number().positive(),
43222
+ maxRuntimeSec: number().int().positive(),
43223
+ idempotencyKey: string().min(8).max(80)
43224
+ }), discriminatedUnion("kind", [object({
43225
+ kind: literal("started"),
43226
+ batchId: string(),
43227
+ jobs: array(TrainingJobSchema).min(1).readonly()
43228
+ }), object({
43229
+ kind: literal("refused"),
43230
+ reason: TrainingRefusalReasonSchema,
43231
+ detail: string()
43232
+ })]), {
43233
+ kind: "mutation",
43234
+ auth: "admin",
43235
+ timeoutMs: 12e4
43236
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
43237
+ kind: "mutation",
43238
+ auth: "admin",
43239
+ timeoutMs: 12e4
43240
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
43241
+ kind: "mutation",
43242
+ auth: "admin",
43243
+ timeoutMs: 30 * 6e4
43244
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
43245
+ kind: "mutation",
43246
+ auth: "admin",
43247
+ timeoutMs: 12e4
43248
+ }), method(IdInput, TrainingJobSchema, {
43249
+ kind: "mutation",
43250
+ auth: "admin",
43251
+ timeoutMs: 12e4
43252
+ }), method(IdInput, TrainingJobSchema, {
43253
+ kind: "mutation",
43254
+ auth: "admin"
43255
+ });
41615
43256
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
41616
43257
  Object.freeze({
41617
43258
  person: .5,
@@ -43760,6 +45401,12 @@ Object.freeze({
43760
45401
  addonId: null,
43761
45402
  access: "create"
43762
45403
  },
45404
+ "backup.checkBackupKey": {
45405
+ capName: "backup",
45406
+ capScope: "system",
45407
+ addonId: null,
45408
+ access: "create"
45409
+ },
43763
45410
  "backup.delete": {
43764
45411
  capName: "backup",
43765
45412
  capScope: "system",
@@ -43772,6 +45419,18 @@ Object.freeze({
43772
45419
  addonId: null,
43773
45420
  access: "delete"
43774
45421
  },
45422
+ "backup.disableEncryption": {
45423
+ capName: "backup",
45424
+ capScope: "system",
45425
+ addonId: null,
45426
+ access: "create"
45427
+ },
45428
+ "backup.getEncryption": {
45429
+ capName: "backup",
45430
+ capScope: "system",
45431
+ addonId: null,
45432
+ access: "view"
45433
+ },
43775
45434
  "backup.getEntries": {
43776
45435
  capName: "backup",
43777
45436
  capScope: "system",
@@ -43826,6 +45485,12 @@ Object.freeze({
43826
45485
  addonId: null,
43827
45486
  access: "create"
43828
45487
  },
45488
+ "backup.setupEncryption": {
45489
+ capName: "backup",
45490
+ capScope: "system",
45491
+ addonId: null,
45492
+ access: "create"
45493
+ },
43829
45494
  "backup.trigger": {
43830
45495
  capName: "backup",
43831
45496
  capScope: "system",
@@ -44378,6 +46043,12 @@ Object.freeze({
44378
46043
  addonId: null,
44379
46044
  access: "create"
44380
46045
  },
46046
+ "customModelRegistry.importModelBundle": {
46047
+ capName: "custom-model-registry",
46048
+ capScope: "system",
46049
+ addonId: null,
46050
+ access: "create"
46051
+ },
44381
46052
  "customModelRegistry.listModels": {
44382
46053
  capName: "custom-model-registry",
44383
46054
  capScope: "system",
@@ -45818,6 +47489,12 @@ Object.freeze({
45818
47489
  addonId: null,
45819
47490
  access: "view"
45820
47491
  },
47492
+ "keychainAdmin.acknowledgeReset": {
47493
+ capName: "keychain-admin",
47494
+ capScope: "system",
47495
+ addonId: null,
47496
+ access: "create"
47497
+ },
45821
47498
  "keychainAdmin.deleteOrphans": {
45822
47499
  capName: "keychain-admin",
45823
47500
  capScope: "system",
@@ -45854,6 +47531,12 @@ Object.freeze({
45854
47531
  addonId: null,
45855
47532
  access: "delete"
45856
47533
  },
47534
+ "keychainAdmin.resetReport": {
47535
+ capName: "keychain-admin",
47536
+ capScope: "system",
47537
+ addonId: null,
47538
+ access: "delete"
47539
+ },
45857
47540
  "keychainAdmin.reveal": {
45858
47541
  capName: "keychain-admin",
45859
47542
  capScope: "system",
@@ -45866,6 +47549,12 @@ Object.freeze({
45866
47549
  addonId: null,
45867
47550
  access: "create"
45868
47551
  },
47552
+ "keychainAdmin.setSystemSecret": {
47553
+ capName: "keychain-admin",
47554
+ capScope: "system",
47555
+ addonId: null,
47556
+ access: "create"
47557
+ },
45869
47558
  "keychainAdmin.status": {
45870
47559
  capName: "keychain-admin",
45871
47560
  capScope: "system",
@@ -47102,6 +48791,36 @@ Object.freeze({
47102
48791
  addonId: null,
47103
48792
  access: "view"
47104
48793
  },
48794
+ "oidcConnections.connectionFormSchema": {
48795
+ capName: "oidc-connections",
48796
+ capScope: "system",
48797
+ addonId: null,
48798
+ access: "view"
48799
+ },
48800
+ "oidcConnections.createConnection": {
48801
+ capName: "oidc-connections",
48802
+ capScope: "system",
48803
+ addonId: null,
48804
+ access: "create"
48805
+ },
48806
+ "oidcConnections.deleteConnection": {
48807
+ capName: "oidc-connections",
48808
+ capScope: "system",
48809
+ addonId: null,
48810
+ access: "delete"
48811
+ },
48812
+ "oidcConnections.listConnections": {
48813
+ capName: "oidc-connections",
48814
+ capScope: "system",
48815
+ addonId: null,
48816
+ access: "view"
48817
+ },
48818
+ "oidcConnections.updateConnection": {
48819
+ capName: "oidc-connections",
48820
+ capScope: "system",
48821
+ addonId: null,
48822
+ access: "create"
48823
+ },
47105
48824
  "osd.getStatus": {
47106
48825
  capName: "osd",
47107
48826
  capScope: "device",
@@ -47174,6 +48893,12 @@ Object.freeze({
47174
48893
  addonId: null,
47175
48894
  access: "create"
47176
48895
  },
48896
+ "osdManager.setSlotCameraEnabled": {
48897
+ capName: "osd-manager",
48898
+ capScope: "system",
48899
+ addonId: null,
48900
+ access: "create"
48901
+ },
47177
48902
  "osdManager.upsertTemplate": {
47178
48903
  capName: "osd-manager",
47179
48904
  capScope: "system",
@@ -47426,6 +49151,12 @@ Object.freeze({
47426
49151
  addonId: null,
47427
49152
  access: "view"
47428
49153
  },
49154
+ "pipelineAnalytics.getRetrainCorpusKpi": {
49155
+ capName: "pipeline-analytics",
49156
+ capScope: "device",
49157
+ addonId: null,
49158
+ access: "view"
49159
+ },
47429
49160
  "pipelineAnalytics.getRetrainExportUrl": {
47430
49161
  capName: "pipeline-analytics",
47431
49162
  capScope: "device",
@@ -47546,6 +49277,12 @@ Object.freeze({
47546
49277
  addonId: null,
47547
49278
  access: "view"
47548
49279
  },
49280
+ "pipelineAnalytics.listRetrainCorpusPage": {
49281
+ capName: "pipeline-analytics",
49282
+ capScope: "device",
49283
+ addonId: null,
49284
+ access: "view"
49285
+ },
47549
49286
  "pipelineAnalytics.listRetrainFrames": {
47550
49287
  capName: "pipeline-analytics",
47551
49288
  capScope: "device",
@@ -47576,6 +49313,12 @@ Object.freeze({
47576
49313
  addonId: null,
47577
49314
  access: "view"
47578
49315
  },
49316
+ "pipelineAnalytics.offerRetrainArchive": {
49317
+ capName: "pipeline-analytics",
49318
+ capScope: "device",
49319
+ addonId: null,
49320
+ access: "create"
49321
+ },
47579
49322
  "pipelineAnalytics.ownersWithMedia": {
47580
49323
  capName: "pipeline-analytics",
47581
49324
  capScope: "device",
@@ -47666,6 +49409,12 @@ Object.freeze({
47666
49409
  addonId: null,
47667
49410
  access: "create"
47668
49411
  },
49412
+ "pipelineAnalytics.resolveRetrainTrainingCorpus": {
49413
+ capName: "pipeline-analytics",
49414
+ capScope: "device",
49415
+ addonId: null,
49416
+ access: "view"
49417
+ },
47669
49418
  "pipelineAnalytics.restageRetrainTrack": {
47670
49419
  capName: "pipeline-analytics",
47671
49420
  capScope: "device",
@@ -50102,6 +51851,180 @@ Object.freeze({
50102
51851
  addonId: null,
50103
51852
  access: "view"
50104
51853
  },
51854
+ "training.canaryResult": {
51855
+ capName: "training",
51856
+ capScope: "system",
51857
+ addonId: null,
51858
+ access: "create"
51859
+ },
51860
+ "training.cancelJob": {
51861
+ capName: "training",
51862
+ capScope: "system",
51863
+ addonId: null,
51864
+ access: "create"
51865
+ },
51866
+ "training.discardResult": {
51867
+ capName: "training",
51868
+ capScope: "system",
51869
+ addonId: null,
51870
+ access: "create"
51871
+ },
51872
+ "training.getJob": {
51873
+ capName: "training",
51874
+ capScope: "system",
51875
+ addonId: null,
51876
+ access: "view"
51877
+ },
51878
+ "training.getJobResult": {
51879
+ capName: "training",
51880
+ capScope: "system",
51881
+ addonId: null,
51882
+ access: "view"
51883
+ },
51884
+ "training.listBaseModels": {
51885
+ capName: "training",
51886
+ capScope: "system",
51887
+ addonId: null,
51888
+ access: "view"
51889
+ },
51890
+ "training.listJobs": {
51891
+ capName: "training",
51892
+ capScope: "system",
51893
+ addonId: null,
51894
+ access: "view"
51895
+ },
51896
+ "training.planJob": {
51897
+ capName: "training",
51898
+ capScope: "system",
51899
+ addonId: null,
51900
+ access: "view"
51901
+ },
51902
+ "training.registerResult": {
51903
+ capName: "training",
51904
+ capScope: "system",
51905
+ addonId: null,
51906
+ access: "create"
51907
+ },
51908
+ "training.rollbackCanary": {
51909
+ capName: "training",
51910
+ capScope: "system",
51911
+ addonId: null,
51912
+ access: "create"
51913
+ },
51914
+ "training.startJob": {
51915
+ capName: "training",
51916
+ capScope: "system",
51917
+ addonId: null,
51918
+ access: "create"
51919
+ },
51920
+ "training.startJobBatch": {
51921
+ capName: "training",
51922
+ capScope: "system",
51923
+ addonId: null,
51924
+ access: "create"
51925
+ },
51926
+ "trainingProvider.cancelJob": {
51927
+ capName: "training-provider",
51928
+ capScope: "system",
51929
+ addonId: null,
51930
+ access: "create"
51931
+ },
51932
+ "trainingProvider.cleanupJob": {
51933
+ capName: "training-provider",
51934
+ capScope: "system",
51935
+ addonId: null,
51936
+ access: "create"
51937
+ },
51938
+ "trainingProvider.createEntry": {
51939
+ capName: "training-provider",
51940
+ capScope: "system",
51941
+ addonId: null,
51942
+ access: "create"
51943
+ },
51944
+ "trainingProvider.deleteEntry": {
51945
+ capName: "training-provider",
51946
+ capScope: "system",
51947
+ addonId: null,
51948
+ access: "delete"
51949
+ },
51950
+ "trainingProvider.describe": {
51951
+ capName: "training-provider",
51952
+ capScope: "system",
51953
+ addonId: null,
51954
+ access: "view"
51955
+ },
51956
+ "trainingProvider.describeTypes": {
51957
+ capName: "training-provider",
51958
+ capScope: "system",
51959
+ addonId: null,
51960
+ access: "view"
51961
+ },
51962
+ "trainingProvider.estimateJob": {
51963
+ capName: "training-provider",
51964
+ capScope: "system",
51965
+ addonId: null,
51966
+ access: "view"
51967
+ },
51968
+ "trainingProvider.getJob": {
51969
+ capName: "training-provider",
51970
+ capScope: "system",
51971
+ addonId: null,
51972
+ access: "view"
51973
+ },
51974
+ "trainingProvider.listEntries": {
51975
+ capName: "training-provider",
51976
+ capScope: "system",
51977
+ addonId: null,
51978
+ access: "view"
51979
+ },
51980
+ "trainingProvider.listJobEvents": {
51981
+ capName: "training-provider",
51982
+ capScope: "system",
51983
+ addonId: null,
51984
+ access: "view"
51985
+ },
51986
+ "trainingProvider.listJobs": {
51987
+ capName: "training-provider",
51988
+ capScope: "system",
51989
+ addonId: null,
51990
+ access: "view"
51991
+ },
51992
+ "trainingProvider.offerArtifact": {
51993
+ capName: "training-provider",
51994
+ capScope: "system",
51995
+ addonId: null,
51996
+ access: "create"
51997
+ },
51998
+ "trainingProvider.readResult": {
51999
+ capName: "training-provider",
52000
+ capScope: "system",
52001
+ addonId: null,
52002
+ access: "create"
52003
+ },
52004
+ "trainingProvider.submitJob": {
52005
+ capName: "training-provider",
52006
+ capScope: "system",
52007
+ addonId: null,
52008
+ access: "create"
52009
+ },
52010
+ "trainingProvider.updateEntry": {
52011
+ capName: "training-provider",
52012
+ capScope: "system",
52013
+ addonId: null,
52014
+ access: "create"
52015
+ },
52016
+ "trainingProvider.uploadDataset": {
52017
+ capName: "training-provider",
52018
+ capScope: "system",
52019
+ addonId: null,
52020
+ access: "create"
52021
+ },
52022
+ "trainingProvider.validateCredentials": {
52023
+ capName: "training-provider",
52024
+ capScope: "system",
52025
+ addonId: null,
52026
+ access: "create"
52027
+ },
50105
52028
  "turnProvider.getTurnServers": {
50106
52029
  capName: "turn-provider",
50107
52030
  capScope: "system",
@@ -50126,12 +52049,6 @@ Object.freeze({
50126
52049
  addonId: null,
50127
52050
  access: "create"
50128
52051
  },
50129
- "userManagement.createApiKey": {
50130
- capName: "user-management",
50131
- capScope: "system",
50132
- addonId: null,
50133
- access: "create"
50134
- },
50135
52052
  "userManagement.createScopedToken": {
50136
52053
  capName: "user-management",
50137
52054
  capScope: "system",
@@ -50168,12 +52085,6 @@ Object.freeze({
50168
52085
  addonId: null,
50169
52086
  access: "view"
50170
52087
  },
50171
- "userManagement.linkExternalIdentity": {
50172
- capName: "user-management",
50173
- capScope: "system",
50174
- addonId: null,
50175
- access: "create"
50176
- },
50177
52088
  "userManagement.listApiKeys": {
50178
52089
  capName: "user-management",
50179
52090
  capScope: "system",
@@ -50276,12 +52187,6 @@ Object.freeze({
50276
52187
  addonId: null,
50277
52188
  access: "create"
50278
52189
  },
50279
- "userManagement.validateApiKey": {
50280
- capName: "user-management",
50281
- capScope: "system",
50282
- addonId: null,
50283
- access: "view"
50284
- },
50285
52190
  "userManagement.validateCredentials": {
50286
52191
  capName: "user-management",
50287
52192
  capScope: "system",
@@ -53314,6 +55219,11 @@ Object.freeze({
53314
55219
  form: "single",
53315
55220
  optional: false
53316
55221
  }],
55222
+ "osdManager.setSlotCameraEnabled": [{
55223
+ name: "deviceId",
55224
+ form: "single",
55225
+ optional: false
55226
+ }],
53317
55227
  "petFeeder.callPet": [{
53318
55228
  name: "deviceId",
53319
55229
  form: "single",
@@ -53534,6 +55444,11 @@ Object.freeze({
53534
55444
  form: "array",
53535
55445
  optional: false
53536
55446
  }],
55447
+ "pipelineAnalytics.listRetrainCorpusPage": [{
55448
+ name: "deviceIds",
55449
+ form: "array",
55450
+ optional: true
55451
+ }],
53537
55452
  "pipelineAnalytics.listRetrainStaging": [{
53538
55453
  name: "deviceIds",
53539
55454
  form: "array",
@@ -54395,6 +56310,11 @@ Object.freeze({
54395
56310
  form: "single",
54396
56311
  optional: false
54397
56312
  }],
56313
+ "training.canaryResult": [{
56314
+ name: "deviceIds",
56315
+ form: "array",
56316
+ optional: false
56317
+ }],
54398
56318
  "update.getStatus": [{
54399
56319
  name: "deviceId",
54400
56320
  form: "single",
@@ -54638,6 +56558,7 @@ Object.freeze({
54638
56558
  });
54639
56559
  Object.freeze({
54640
56560
  "broker": "broker",
56561
+ "calendar-source": "calendar",
54641
56562
  "device-export": "device-export",
54642
56563
  "llm": "ai",
54643
56564
  "mesh-network": "mesh",
@@ -55123,6 +57044,8 @@ var STATE_SUMMARY_VARS = [
55123
57044
  [...RULE_TEXT],
55124
57045
  [...RULE_TEXT],
55125
57046
  [...RULE_TEXT],
57047
+ [...RULE_TEXT],
57048
+ [...RULE_TEXT],
55126
57049
  ([...RULE_TEXT], [...UPDATES]),
55127
57050
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
55128
57051
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),