@camstack/addon-mqtt-broker 1.2.121 → 1.2.123

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.
@@ -5424,7 +5424,7 @@ var ZodIssueCode = {
5424
5424
  var ZodFirstPartyTypeKind;
5425
5425
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5426
5426
  //#endregion
5427
- //#region ../types/dist/sleep-DujUvOcb.mjs
5427
+ //#region ../types/dist/sleep-r3RWkGVx.mjs
5428
5428
  /**
5429
5429
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5430
5430
  * window to float samples (D455).
@@ -5541,7 +5541,7 @@ function isKeychainStoredField(field) {
5541
5541
  var SECRET_CLEAR = { $secretClear: true };
5542
5542
  /** The `'***'` token D634 redaction writes for non-admins. */
5543
5543
  var LEGACY_DEVICE_REDACTION = "***";
5544
- function isRecord$1(value) {
5544
+ function isRecord$2(value) {
5545
5545
  return typeof value === "object" && value !== null && !Array.isArray(value);
5546
5546
  }
5547
5547
  function makeSecretMarker(ref) {
@@ -5552,12 +5552,12 @@ function makeSecretMarker(ref) {
5552
5552
  }
5553
5553
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5554
5554
  function isSecretMarker(value) {
5555
- if (!isRecord$1(value)) return false;
5555
+ if (!isRecord$2(value)) return false;
5556
5556
  const ref = value["$secret"];
5557
5557
  return typeof ref === "string" && ref.length > 0;
5558
5558
  }
5559
5559
  function isSecretClear(value) {
5560
- return isRecord$1(value) && value["$secretClear"] === true;
5560
+ return isRecord$2(value) && value["$secretClear"] === true;
5561
5561
  }
5562
5562
  /**
5563
5563
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6073,6 +6073,13 @@ function globalSecretScope() {
6073
6073
  function encodeSegment(value) {
6074
6074
  return encodeURIComponent(value);
6075
6075
  }
6076
+ function decodeSegment(value) {
6077
+ try {
6078
+ return decodeURIComponent(value);
6079
+ } catch {
6080
+ return null;
6081
+ }
6082
+ }
6076
6083
  /**
6077
6084
  * The field path of a value inside an array item, addressed by the item's id:
6078
6085
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6081,6 +6088,75 @@ function encodeSegment(value) {
6081
6088
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6082
6089
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6083
6090
  }
6091
+ function parseScope(segments) {
6092
+ switch (segments[0]) {
6093
+ case "global": return {
6094
+ scope: GLOBAL_SCOPE,
6095
+ used: 1
6096
+ };
6097
+ case "node": {
6098
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6099
+ return nodeId === null || nodeId.length === 0 ? null : {
6100
+ scope: {
6101
+ kind: "node",
6102
+ nodeId
6103
+ },
6104
+ used: 2
6105
+ };
6106
+ }
6107
+ case "device": {
6108
+ const raw = segments[1];
6109
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6110
+ return {
6111
+ scope: {
6112
+ kind: "device",
6113
+ deviceId: Number(raw)
6114
+ },
6115
+ used: 2
6116
+ };
6117
+ }
6118
+ case "integration": {
6119
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6120
+ return id === null || id.length === 0 ? null : {
6121
+ scope: {
6122
+ kind: "integration",
6123
+ integrationId: id
6124
+ },
6125
+ used: 2
6126
+ };
6127
+ }
6128
+ case "row": {
6129
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6130
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6131
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6132
+ return {
6133
+ scope: {
6134
+ kind: "row",
6135
+ collection,
6136
+ rowId
6137
+ },
6138
+ used: 3
6139
+ };
6140
+ }
6141
+ default: return null;
6142
+ }
6143
+ }
6144
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6145
+ function parseSecretRef(ref) {
6146
+ if (!ref.startsWith("secret://")) return null;
6147
+ const segments = ref.slice(9).split("/");
6148
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6149
+ if (owner === null || owner.length === 0) return null;
6150
+ const parsed = parseScope(segments.slice(1));
6151
+ if (parsed === null) return null;
6152
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6153
+ if (fieldPath.length === 0) return null;
6154
+ return {
6155
+ owner,
6156
+ scope: parsed.scope,
6157
+ fieldPath
6158
+ };
6159
+ }
6084
6160
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6085
6161
  var KeychainWriteRefusedError = class extends Error {
6086
6162
  fieldPath;
@@ -6091,7 +6167,7 @@ var KeychainWriteRefusedError = class extends Error {
6091
6167
  }
6092
6168
  };
6093
6169
  var KEEP = { kind: "keep" };
6094
- function isRecord(value) {
6170
+ function isRecord$1(value) {
6095
6171
  return typeof value === "object" && value !== null && !Array.isArray(value);
6096
6172
  }
6097
6173
  function defaultMintId() {
@@ -6104,7 +6180,7 @@ function collectSecretMarkerRefs(value, out = []) {
6104
6180
  return out;
6105
6181
  }
6106
6182
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6107
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6183
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6108
6184
  return out;
6109
6185
  }
6110
6186
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6159,7 +6235,7 @@ function rowId(row, idKey) {
6159
6235
  return null;
6160
6236
  }
6161
6237
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6162
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6238
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6163
6239
  if (!Array.isArray(incoming)) {
6164
6240
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6165
6241
  return {
@@ -6175,7 +6251,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6175
6251
  const kept = /* @__PURE__ */ new Set();
6176
6252
  const rows = [];
6177
6253
  for (const row of incoming) {
6178
- if (!isRecord(row)) {
6254
+ if (!isRecord$1(row)) {
6179
6255
  rows.push(row);
6180
6256
  continue;
6181
6257
  }
@@ -6200,7 +6276,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6200
6276
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6201
6277
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6202
6278
  case "object": {
6203
- if (!isRecord(incoming)) {
6279
+ if (!isRecord$1(incoming)) {
6204
6280
  if (incoming === void 0) return KEEP;
6205
6281
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6206
6282
  return {
@@ -6208,7 +6284,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6208
6284
  value: incoming
6209
6285
  };
6210
6286
  }
6211
- const storedObj = isRecord(stored) ? stored : {};
6287
+ const storedObj = isRecord$1(stored) ? stored : {};
6212
6288
  return {
6213
6289
  kind: "value",
6214
6290
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6267,12 +6343,19 @@ async function transformSecretWrite(input) {
6267
6343
  }
6268
6344
  };
6269
6345
  }
6346
+ /** Is `ref` one of `owner`'s refs? */
6347
+ function isSecretRefOwnedBy(ref, owner) {
6348
+ return parseSecretRef(ref)?.owner === owner;
6349
+ }
6270
6350
  /**
6271
6351
  * Replace every marker in `value` with its keychain value. Returns the SAME
6272
6352
  * reference when there is no marker (no allocation, no keychain call).
6273
6353
  */
6274
- async function resolveSecretMarkers(value, secrets) {
6275
- const refs = collectSecretMarkerRefs(value);
6354
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6355
+ const keepMarker = options.unresolved === "keep-marker";
6356
+ const owner = options.ownedBy;
6357
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6358
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6276
6359
  if (refs.length === 0) return {
6277
6360
  value,
6278
6361
  unresolved: []
@@ -6296,10 +6379,18 @@ async function resolveSecretMarkers(value, secrets) {
6296
6379
  }
6297
6380
  const substitute = (v) => {
6298
6381
  if (isSecretMarker(v)) {
6382
+ if (!inScope(v.$secret)) return {
6383
+ keep: true,
6384
+ value: v
6385
+ };
6299
6386
  const answer = answers[v.$secret];
6300
- return answer?.kind === "value" ? {
6387
+ if (answer?.kind === "value") return {
6301
6388
  keep: true,
6302
6389
  value: answer.value
6390
+ };
6391
+ return keepMarker ? {
6392
+ keep: true,
6393
+ value: v
6303
6394
  } : {
6304
6395
  keep: false,
6305
6396
  value: void 0
@@ -6316,7 +6407,7 @@ async function resolveSecretMarkers(value, secrets) {
6316
6407
  value: items
6317
6408
  };
6318
6409
  }
6319
- if (isRecord(v)) {
6410
+ if (isRecord$1(v)) {
6320
6411
  const out = {};
6321
6412
  for (const [k, child] of Object.entries(v)) {
6322
6413
  const s = substitute(child);
@@ -6337,14 +6428,152 @@ async function resolveSecretMarkers(value, secrets) {
6337
6428
  unresolved
6338
6429
  };
6339
6430
  }
6340
- function touchesTree(tree, patch) {
6341
- if (tree.size === 0) return false;
6342
- for (const key of Object.keys(patch)) {
6343
- const at = key.indexOf("@");
6344
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6431
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6432
+ var SecretOverwriteRefusedError = class extends Error {
6433
+ ref;
6434
+ reason;
6435
+ constructor(ref, reason) {
6436
+ 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.`);
6437
+ this.ref = ref;
6438
+ this.reason = reason;
6439
+ this.name = "SecretOverwriteRefusedError";
6440
+ }
6441
+ };
6442
+ function isRecord(value) {
6443
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6444
+ }
6445
+ function resolvedValue(pass, marker) {
6446
+ const answer = pass.answers[marker.$secret];
6447
+ return answer?.kind === "value" ? answer.value : null;
6448
+ }
6449
+ async function atMarker(pass, incoming, stored) {
6450
+ if (incoming === null) return stored;
6451
+ if (typeof incoming !== "string") return incoming;
6452
+ if (incoming === resolvedValue(pass, stored)) return stored;
6453
+ const intent = classifySecretWrite(incoming);
6454
+ if (intent.kind !== "set") return stored;
6455
+ const ref = stored.$secret;
6456
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6457
+ const answer = pass.answers[ref];
6458
+ 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);
6459
+ try {
6460
+ await pass.secrets.put(ref, intent.value);
6461
+ } catch (err) {
6462
+ throw new KeychainWriteRefusedError(ref, err);
6463
+ }
6464
+ pass.changedRefs.push(ref);
6465
+ return stored;
6466
+ }
6467
+ function inArray(pass, incoming, stored) {
6468
+ return incoming.map((item, index) => {
6469
+ const twin = stored[index];
6470
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6471
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6472
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6473
+ return item;
6474
+ });
6475
+ }
6476
+ function inArrayRow(pass, incoming, stored) {
6477
+ const out = { ...incoming };
6478
+ for (const [key, value] of Object.entries(incoming)) {
6479
+ const twin = stored[key];
6480
+ if (isSecretMarker(twin)) {
6481
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6482
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6483
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6484
+ }
6485
+ return out;
6486
+ }
6487
+ async function walk(pass, incoming, stored) {
6488
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6489
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6490
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6491
+ const out = { ...incoming };
6492
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6493
+ return out;
6494
+ }
6495
+ /** Restore markers a write-back carries as values. See the file doc. */
6496
+ async function restoreUnchangedSecrets(input) {
6497
+ const refs = [];
6498
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6499
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6500
+ if (owned.length === 0) return {
6501
+ patch: input.patch,
6502
+ changedRefs: []
6503
+ };
6504
+ const pass = {
6505
+ secrets: input.secrets,
6506
+ answers: await input.secrets.resolve([...new Set(owned)]),
6507
+ operatorWrite: input.operatorWrite,
6508
+ changedRefs: []
6509
+ };
6510
+ const out = {};
6511
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6512
+ return {
6513
+ patch: out,
6514
+ changedRefs: pass.changedRefs
6515
+ };
6516
+ }
6517
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6518
+ function isJsonEqual(a, b) {
6519
+ if (Object.is(a, b)) return true;
6520
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6521
+ if (isRecord(a) && isRecord(b)) {
6522
+ const keys = Object.keys(a);
6523
+ if (keys.length !== Object.keys(b).length) return false;
6524
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6345
6525
  }
6346
6526
  return false;
6347
6527
  }
6528
+ /** The patch without the keys whose value already equals the stored one. */
6529
+ function dropUnchangedKeys(patch, stored) {
6530
+ const out = {};
6531
+ for (const [key, value] of Object.entries(patch)) {
6532
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6533
+ out[key] = value;
6534
+ }
6535
+ return out;
6536
+ }
6537
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6538
+ function markerKeysOf(blob, owner) {
6539
+ const keys = /* @__PURE__ */ new Set();
6540
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6541
+ return keys;
6542
+ }
6543
+ function nodeFromStored(value, owner) {
6544
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6545
+ if (!isRecord(value)) return null;
6546
+ const children = /* @__PURE__ */ new Map();
6547
+ for (const [key, child] of Object.entries(value)) {
6548
+ const node = nodeFromStored(child, owner);
6549
+ if (node !== null) children.set(key, node);
6550
+ }
6551
+ return children.size > 0 ? {
6552
+ kind: "object",
6553
+ children
6554
+ } : null;
6555
+ }
6556
+ /**
6557
+ * The declared secret tree, widened by every place the STORED blob holds a
6558
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6559
+ * never declared: Wyze before b4906cec6) still gets the save path's
6560
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6561
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6562
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6563
+ * builtin that keeps another addon's marker (device-manager) never takes it
6564
+ * over.
6565
+ */
6566
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6567
+ const added = /* @__PURE__ */ new Map();
6568
+ for (const key of keys) {
6569
+ const at = key.indexOf("@");
6570
+ const base = at > 0 ? key.slice(0, at) : key;
6571
+ if (declared.has(base) || added.has(base)) continue;
6572
+ const node = nodeFromStored(stored[key], owner);
6573
+ if (node !== null) added.set(base, node);
6574
+ }
6575
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6576
+ }
6348
6577
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6349
6578
  async function readStoredAddonBlob(raw) {
6350
6579
  const threeWay = raw.readAddonStoreResult;
@@ -6353,7 +6582,41 @@ async function readStoredAddonBlob(raw) {
6353
6582
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6354
6583
  return result.kind === "missing" ? {} : result.value;
6355
6584
  }
6356
- function createSecretAwareSettings(raw, opts) {
6585
+ function touchesTree(tree, patch) {
6586
+ if (tree.size === 0) return false;
6587
+ for (const key of Object.keys(patch)) {
6588
+ const at = key.indexOf("@");
6589
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6590
+ }
6591
+ return false;
6592
+ }
6593
+ /**
6594
+ * Which top-level keys of each store held markers when last seen. `undefined`
6595
+ * for a store not seen yet: its first write reads it, to be safe.
6596
+ */
6597
+ var MarkerKeyIndex = class {
6598
+ owner;
6599
+ byStore = /* @__PURE__ */ new Map();
6600
+ constructor(owner) {
6601
+ this.owner = owner;
6602
+ }
6603
+ seen(store, blob) {
6604
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6605
+ }
6606
+ wrote(store, patch) {
6607
+ const keys = this.byStore.get(store);
6608
+ if (keys === void 0) return;
6609
+ const now = markerKeysOf(patch, this.owner);
6610
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6611
+ else keys.delete(key);
6612
+ }
6613
+ mayHoldMarkers(store, patch) {
6614
+ const keys = this.byStore.get(store);
6615
+ if (keys === void 0) return true;
6616
+ return Object.keys(patch).some((key) => keys.has(key));
6617
+ }
6618
+ };
6619
+ function createHandle(raw, opts) {
6357
6620
  const chains = /* @__PURE__ */ new Map();
6358
6621
  const serialize = (key, fn) => {
6359
6622
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6364,46 +6627,130 @@ function createSecretAwareSettings(raw, opts) {
6364
6627
  });
6365
6628
  return next;
6366
6629
  };
6367
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6368
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6369
- return serialize(chainKey, async () => {
6630
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6631
+ const resolveRead = async (store, blob) => {
6632
+ index.seen(store, blob);
6633
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6634
+ unresolved: "keep-marker",
6635
+ ownedBy: opts.secrets.owner
6636
+ });
6637
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6638
+ return value;
6639
+ };
6640
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6641
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6642
+ await rawWrite(patch);
6643
+ index.wrote(store, patch);
6644
+ return { changed: true };
6645
+ }
6646
+ return serialize(store, async () => {
6370
6647
  const stored = await readStored();
6648
+ index.seen(store, stored);
6649
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6650
+ const restored = await restoreUnchangedSecrets({
6651
+ patch,
6652
+ stored,
6653
+ secrets: opts.secrets,
6654
+ operatorWrite
6655
+ });
6371
6656
  const result = await transformSecretWrite({
6372
- tree,
6657
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6373
6658
  secrets: opts.secrets,
6374
- patch,
6659
+ patch: restored.patch,
6375
6660
  stored,
6376
6661
  ...scope !== void 0 ? { scope } : {},
6377
- operatorWrite: opts.isOperatorWrite?.() === true
6662
+ operatorWrite
6378
6663
  });
6379
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6664
+ const effective = dropUnchangedKeys(result.patch, stored);
6665
+ const wroteBlob = Object.keys(effective).length > 0;
6666
+ if (wroteBlob) {
6667
+ await rawWrite(effective);
6668
+ index.wrote(store, effective);
6669
+ }
6380
6670
  const { orphaned } = await result.afterWrite();
6381
6671
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6672
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6382
6673
  });
6383
6674
  };
6384
- const wrapped = {
6385
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6386
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6387
- kind: "device",
6388
- deviceId
6389
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6390
- };
6391
- return new Proxy(raw, { get(target, prop, receiver) {
6392
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6393
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6394
- const value = Reflect.get(target, prop, receiver);
6395
- return typeof value === "function" ? value.bind(target) : value;
6396
- } });
6675
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6676
+ const readAddonStoreResult = raw.readAddonStoreResult;
6677
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6678
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6679
+ const overrides = {
6680
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6681
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6682
+ const result = await readAddonStoreResult.call(raw);
6683
+ return result.kind === "value" ? {
6684
+ kind: "value",
6685
+ value: await resolveRead("addon", result.value)
6686
+ } : result;
6687
+ } } : {},
6688
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6689
+ const result = await readAddonStoreKeyResult.call(raw, key);
6690
+ if (result.kind !== "present") return result;
6691
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6692
+ unresolved: "keep-marker",
6693
+ ownedBy: opts.secrets.owner
6694
+ });
6695
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6696
+ return {
6697
+ kind: "present",
6698
+ value: value[key]
6699
+ };
6700
+ } } : {},
6701
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6702
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6703
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6704
+ const out = /* @__PURE__ */ new Map();
6705
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6706
+ return out;
6707
+ } } : {},
6708
+ writeAddonStore: async (patch) => {
6709
+ await writeAddon(patch);
6710
+ },
6711
+ writeDeviceStore: async (deviceId, patch) => {
6712
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6713
+ kind: "device",
6714
+ deviceId
6715
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6716
+ }
6717
+ };
6718
+ return {
6719
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6720
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6721
+ const value = Reflect.get(target, prop, receiver);
6722
+ return typeof value === "function" ? value.bind(target) : value;
6723
+ } }),
6724
+ raw: {
6725
+ readAddonStore: async () => {
6726
+ const blob = await raw.readAddonStore();
6727
+ index.seen("addon", blob);
6728
+ return blob;
6729
+ },
6730
+ readDeviceStore: async (deviceId) => {
6731
+ const blob = await raw.readDeviceStore(deviceId);
6732
+ index.seen(`device:${deviceId}`, blob);
6733
+ return blob;
6734
+ }
6735
+ },
6736
+ writeAddonStore: writeAddon
6737
+ };
6397
6738
  }
6398
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6399
- function withSecretAwareSettings(context, opts) {
6739
+ /** The context the addon sees, plus the private raw view and write outcome. */
6740
+ function createSecretAwareContext(context, opts) {
6400
6741
  const raw = context.settings;
6401
- if (raw === void 0) return context;
6402
- const settings = createSecretAwareSettings(raw, opts);
6403
- return new Proxy(context, { get(target, prop, receiver) {
6404
- if (prop === "settings") return settings;
6405
- return Reflect.get(target, prop, receiver);
6406
- } });
6742
+ if (raw === void 0) return {
6743
+ context,
6744
+ handle: null
6745
+ };
6746
+ const handle = createHandle(raw, opts);
6747
+ return {
6748
+ context: new Proxy(context, { get(target, prop, receiver) {
6749
+ if (prop === "settings") return handle.settings;
6750
+ return Reflect.get(target, prop, receiver);
6751
+ } }),
6752
+ handle
6753
+ };
6407
6754
  }
6408
6755
  var LEAF = { kind: "leaf" };
6409
6756
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6578,6 +6925,14 @@ var BaseAddon = class {
6578
6925
  _secretChangeUnsub = null;
6579
6926
  /** >0 while an OPERATOR's settings write is being applied. */
6580
6927
  _operatorWriteDepth = 0;
6928
+ /**
6929
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6930
+ * to the marker-bearing blobs and stays private to this class: the form
6931
+ * hydrate and config resolution need markers, addon code never does.
6932
+ */
6933
+ _secretSettings = null;
6934
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6935
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6581
6936
  constructor(defaults) {
6582
6937
  this.defaults = defaults;
6583
6938
  this._config = { ...defaults };
@@ -6614,13 +6969,21 @@ var BaseAddon = class {
6614
6969
  }
6615
6970
  async initialize(context) {
6616
6971
  const secrets = context.secrets;
6617
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6618
- secrets,
6619
- addonTree: () => this.addonSecretTree(),
6620
- deviceTree: () => this.deviceSecretTree(),
6621
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6622
- isOperatorWrite: () => this._operatorWriteDepth > 0
6623
- }) : context;
6972
+ if (secrets !== void 0) {
6973
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6974
+ secrets,
6975
+ addonTree: () => this.addonSecretTree(),
6976
+ deviceTree: () => this.deviceSecretTree(),
6977
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6978
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6979
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6980
+ });
6981
+ this._ctx = wrapped;
6982
+ this._secretSettings = handle;
6983
+ } else {
6984
+ this._ctx = context;
6985
+ this._secretSettings = null;
6986
+ }
6624
6987
  await this.resolveConfig();
6625
6988
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6626
6989
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6737,11 +7100,8 @@ var BaseAddon = class {
6737
7100
  async getGlobalSettings(overlay, cap, nodeId) {
6738
7101
  const schema = this.globalSettingsSchema(cap);
6739
7102
  if (!schema) return { sections: [] };
6740
- const projected = await this.resolveGlobalStore(nodeId, cap);
6741
- return hydrateSchema(schema, overlay ? {
6742
- ...projected,
6743
- ...overlay
6744
- } : projected, { inlineSecretsAsViews: true });
7103
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7104
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6745
7105
  }
6746
7106
  /**
6747
7107
  * The integration-level view of this addon's settings: exactly the sections
@@ -6786,7 +7146,7 @@ var BaseAddon = class {
6786
7146
  });
6787
7147
  }
6788
7148
  if (sections.length === 0) return null;
6789
- const projected = await this.resolveGlobalStore(nodeId);
7149
+ const projected = await this.readRawProjectedStore(nodeId);
6790
7150
  return hydrateSchema({
6791
7151
  ...schema,
6792
7152
  sections
@@ -6803,12 +7163,50 @@ var BaseAddon = class {
6803
7163
  * the store for custom option logic (option narrowing, value snapping) to
6804
7164
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6805
7165
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7166
+ *
7167
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7168
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7169
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7170
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7171
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7172
+ * resolved blob back is a no-op for every unchanged secret.
6806
7173
  */
6807
7174
  async resolveGlobalStore(nodeId, cap) {
6808
7175
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7176
+ return this.projectForNode(raw, nodeId, cap);
7177
+ }
7178
+ projectForNode(store, nodeId, cap) {
6809
7179
  const keys = this.perNodeKeys(cap);
6810
7180
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6811
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7181
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7182
+ }
7183
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7184
+ async readRawProjectedStore(nodeId, cap) {
7185
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7186
+ return this.projectForNode(raw, nodeId, cap);
7187
+ }
7188
+ /**
7189
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7190
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7191
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7192
+ * its value.
7193
+ */
7194
+ async overlayKeepingMarkers(stored, overlay) {
7195
+ const secrets = this._ctx?.secrets;
7196
+ const merged = {
7197
+ ...stored,
7198
+ ...overlay
7199
+ };
7200
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7201
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7202
+ unresolved: "keep-marker",
7203
+ ownedBy: secrets.owner
7204
+ });
7205
+ for (const key of Object.keys(overlay)) {
7206
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7207
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7208
+ }
7209
+ return merged;
6812
7210
  }
6813
7211
  /**
6814
7212
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6873,8 +7271,12 @@ var BaseAddon = class {
6873
7271
  async clearSecrets(keys, nodeId) {
6874
7272
  const tree = this.addonSecretTree();
6875
7273
  const keychain = this._ctx?.secrets !== void 0;
7274
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6876
7275
  const patch = {};
6877
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7276
+ for (const key of keys) {
7277
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7278
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7279
+ }
6878
7280
  await this.applyGlobalPatch(patch, nodeId);
6879
7281
  }
6880
7282
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6882,7 +7284,11 @@ var BaseAddon = class {
6882
7284
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6883
7285
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6884
7286
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6885
- await this._ctx?.settings?.writeAddonStore(scoped);
7287
+ const handle = this._secretSettings;
7288
+ if (handle !== null) {
7289
+ const { changed } = await handle.writeAddonStore(scoped);
7290
+ if (!changed) return;
7291
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6886
7292
  if (target !== localNode) return;
6887
7293
  await this.resolveConfig();
6888
7294
  await this.onConfigChanged();
@@ -6935,7 +7341,7 @@ var BaseAddon = class {
6935
7341
  async getDeviceSettings(deviceId) {
6936
7342
  const schema = this.deviceSettingsSchema();
6937
7343
  if (!schema) return { sections: [] };
6938
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7344
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6939
7345
  }
6940
7346
  async updateDeviceSettings(deviceId, patch) {
6941
7347
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7107,7 +7513,7 @@ var BaseAddon = class {
7107
7513
  key,
7108
7514
  schema,
7109
7515
  fallback,
7110
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7516
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7111
7517
  write: async (patch) => {
7112
7518
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7113
7519
  },
@@ -7169,6 +7575,23 @@ var BaseAddon = class {
7169
7575
  }
7170
7576
  return value;
7171
7577
  }
7578
+ /**
7579
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7580
+ * keychain the context's own view is already raw.
7581
+ */
7582
+ rawSettings() {
7583
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7584
+ }
7585
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7586
+ logUnresolvedRead(unresolved) {
7587
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7588
+ if (fresh.length === 0) return;
7589
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7590
+ 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) => ({
7591
+ ref: u.ref,
7592
+ reason: u.reason
7593
+ })) } });
7594
+ }
7172
7595
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7173
7596
  scheduleSecretReresolve(delayMs) {
7174
7597
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7195,7 +7618,7 @@ var BaseAddon = class {
7195
7618
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7196
7619
  */
7197
7620
  async readAddonStoreWithRetry() {
7198
- const settings = this._ctx?.settings;
7621
+ const settings = this.rawSettings();
7199
7622
  if (!settings) return {};
7200
7623
  const delaysMs = [
7201
7624
  150,
@@ -9421,6 +9844,278 @@ var CameraSwitchGroupSchema = object({
9421
9844
  fetchedAt: number()
9422
9845
  });
9423
9846
  /**
9847
+ * The trainer contract — what the hub hands the cloud trainer and what it
9848
+ * gets back (cloud training, D805+).
9849
+ *
9850
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
9851
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
9852
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
9853
+ * lines on stdout. These schemas are the hub's half of that boundary; the
9854
+ * trainer's pydantic models (and the JSON Schemas generated from them under
9855
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
9856
+ * change there, in the same piece of work.
9857
+ *
9858
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
9859
+ * orchestrator fills every field of a job spec explicitly.
9860
+ */
9861
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
9862
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
9863
+ /** What the trainer can export. Edge TPU is a later, separate image. */
9864
+ var TrainingExportSchema = _enum([
9865
+ "onnx",
9866
+ "openvino-fp16",
9867
+ "openvino-int8",
9868
+ "coreml-fp16"
9869
+ ]);
9870
+ var FloorsSchema = record(string(), number().min(0).max(1));
9871
+ object({
9872
+ schema: literal(TRAINING_JOB_SCHEMA),
9873
+ jobKey: string().uuid(),
9874
+ target: object({
9875
+ kind: literal("detector"),
9876
+ step: literal("object-detection")
9877
+ }),
9878
+ base: object({
9879
+ modelId: string().min(1),
9880
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
9881
+ weights: string().min(1),
9882
+ imgsz: number().int().positive()
9883
+ }),
9884
+ baseline: object({
9885
+ modelId: string().min(1),
9886
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
9887
+ onnxUrl: string().url(),
9888
+ imgsz: number().int().positive(),
9889
+ floors: FloorsSchema
9890
+ }),
9891
+ dataset: object({
9892
+ versionId: string().min(1),
9893
+ annotationHash: string(),
9894
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
9895
+ sha256: string().regex(/^[0-9a-f]{64}$/)
9896
+ }),
9897
+ split: object({
9898
+ holdoutCameras: array(number().int()),
9899
+ /** When no camera is held out: the last N days of every camera. */
9900
+ holdoutLastDays: number().int().nonnegative(),
9901
+ valFraction: number().min(0).max(.5),
9902
+ seed: number().int()
9903
+ }),
9904
+ hyper: object({
9905
+ epochs: number().int().positive(),
9906
+ batch: number().int().positive(),
9907
+ lr0: number().positive(),
9908
+ /** Layers frozen from the start of the backbone; 0 = none. */
9909
+ freeze: number().int().nonnegative(),
9910
+ patience: number().int().nonnegative(),
9911
+ seed: number().int()
9912
+ }),
9913
+ replay: object({
9914
+ source: literal("coco2017"),
9915
+ count: number().int().nonnegative()
9916
+ }),
9917
+ exports: array(TrainingExportSchema).min(1),
9918
+ calibration: object({ maxFrames: number().int().positive() }),
9919
+ floors: object({
9920
+ minSupport: number().int().positive(),
9921
+ clamp: number().min(0).max(1)
9922
+ }),
9923
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
9924
+ catalog: object({
9925
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
9926
+ name: string().min(1).max(160)
9927
+ })
9928
+ });
9929
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
9930
+ var TrainingResultFileSchema = object({
9931
+ path: string().min(1),
9932
+ bytes: number().int().nonnegative(),
9933
+ sha256: string().regex(/^[0-9a-f]{64}$/),
9934
+ format: _enum([
9935
+ "onnx",
9936
+ "openvino",
9937
+ "coreml",
9938
+ "pt"
9939
+ ]),
9940
+ variant: _enum(["base", "int8"])
9941
+ });
9942
+ var DraftFormatSchema = object({
9943
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
9944
+ url: string().min(1),
9945
+ sizeMB: number().nonnegative(),
9946
+ isDirectory: boolean().optional(),
9947
+ files: array(string()).optional(),
9948
+ runtimes: array(literal("python")).optional(),
9949
+ revision: string().min(1)
9950
+ });
9951
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
9952
+ var TrainingCatalogDraftSchema = object({
9953
+ id: string().min(1),
9954
+ name: string().min(1),
9955
+ description: string(),
9956
+ labels: array(unknown()),
9957
+ inputSize: object({
9958
+ width: number().int().positive(),
9959
+ height: number().int().positive()
9960
+ }),
9961
+ preprocessMode: literal("letterbox"),
9962
+ defaultClassFloors: FloorsSchema,
9963
+ formats: object({
9964
+ onnx: DraftFormatSchema.optional(),
9965
+ openvino: DraftFormatSchema.optional(),
9966
+ coreml: DraftFormatSchema.optional()
9967
+ })
9968
+ });
9969
+ /** One class of one model's holdout report (the eval harness's summary). */
9970
+ var TrainingEvalClassSchema = object({
9971
+ positives: number().int(),
9972
+ floor: number().nullable(),
9973
+ tp: number().int(),
9974
+ fp: number().int(),
9975
+ fn: number().int(),
9976
+ precision: number().nullable(),
9977
+ recall: number().nullable(),
9978
+ ap50: number().nullable(),
9979
+ recallByCamera: record(string(), number().nullable()).optional(),
9980
+ recallByLight: record(string(), number().nullable()).optional(),
9981
+ fpByCamera: record(string(), number()).optional(),
9982
+ smallFound: number().int().optional(),
9983
+ smallTotal: number().int().optional()
9984
+ }).passthrough();
9985
+ var TrainingEvalReportSchema = object({
9986
+ frames: number().int(),
9987
+ classes: record(string(), TrainingEvalClassSchema)
9988
+ }).passthrough();
9989
+ /**
9990
+ * A succeeded result carries every block; a failed one carries the error and
9991
+ * whatever was known by then — the other blocks are ABSENT, not null. The
9992
+ * orchestrator checks the blocks it needs before it trusts a success.
9993
+ */
9994
+ var TrainingResultSchema = object({
9995
+ schema: literal(TRAINING_RESULT_SCHEMA),
9996
+ jobKey: string(),
9997
+ status: _enum(["succeeded", "failed"]),
9998
+ error: object({
9999
+ stage: string(),
10000
+ code: string(),
10001
+ message: string()
10002
+ }).nullable(),
10003
+ trainer: object({
10004
+ version: string(),
10005
+ revision: string()
10006
+ }),
10007
+ toolchain: record(string(), string().nullable()),
10008
+ dataset: object({
10009
+ versionId: string(),
10010
+ annotationHash: string(),
10011
+ sha256: string(),
10012
+ frames: object({
10013
+ train: number().int(),
10014
+ val: number().int(),
10015
+ holdout: number().int()
10016
+ }),
10017
+ holdoutCameras: array(number().int()),
10018
+ replayImages: number().int()
10019
+ }).optional(),
10020
+ training: object({
10021
+ epochsRun: number().int(),
10022
+ bestEpoch: number().int(),
10023
+ bestMap50: number(),
10024
+ bestMap50_95: number(),
10025
+ seconds: number()
10026
+ }).optional(),
10027
+ evaluation: object({
10028
+ holdoutFrames: number().int(),
10029
+ baseline: TrainingEvalReportSchema.nullable(),
10030
+ candidate: TrainingEvalReportSchema.nullable(),
10031
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10032
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10033
+ map50: record(string(), number().nullable())
10034
+ }).optional(),
10035
+ floors: object({
10036
+ baseline: FloorsSchema,
10037
+ candidate: FloorsSchema,
10038
+ candidateInt8: FloorsSchema.nullable(),
10039
+ notes: array(string())
10040
+ }).optional(),
10041
+ int8: object({
10042
+ kept: boolean(),
10043
+ map50Fp16: number().nullable(),
10044
+ map50Int8: number().nullable(),
10045
+ reason: string().nullable()
10046
+ }).optional(),
10047
+ exportsDropped: array(object({
10048
+ export: string(),
10049
+ reason: string()
10050
+ })).optional(),
10051
+ files: array(TrainingResultFileSchema).optional(),
10052
+ bundle: object({
10053
+ path: literal("bundle.tar"),
10054
+ bytes: number().int().nonnegative(),
10055
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10056
+ }).nullable().optional(),
10057
+ catalogDraft: object({
10058
+ base: TrainingCatalogDraftSchema,
10059
+ int8: TrainingCatalogDraftSchema.nullable()
10060
+ }).nullable().optional(),
10061
+ licence: string()
10062
+ });
10063
+ var TrainingStageSchema = _enum([
10064
+ "prepare",
10065
+ "replay",
10066
+ "train",
10067
+ "eval",
10068
+ "export",
10069
+ "package"
10070
+ ]);
10071
+ var EventBase = {
10072
+ v: literal(1),
10073
+ ts: number()
10074
+ };
10075
+ discriminatedUnion("type", [
10076
+ object({
10077
+ ...EventBase,
10078
+ type: literal("stage"),
10079
+ stage: TrainingStageSchema
10080
+ }),
10081
+ object({
10082
+ ...EventBase,
10083
+ type: literal("epoch"),
10084
+ epoch: number().int(),
10085
+ epochs: number().int(),
10086
+ boxLoss: number().nullable().optional(),
10087
+ map50: number().nullable().optional(),
10088
+ map50_95: number().nullable().optional(),
10089
+ etaSec: number().nullable().optional()
10090
+ }),
10091
+ object({
10092
+ ...EventBase,
10093
+ type: literal("metric"),
10094
+ name: string(),
10095
+ value: number()
10096
+ }),
10097
+ object({
10098
+ ...EventBase,
10099
+ type: literal("artifact"),
10100
+ path: string(),
10101
+ bytes: number(),
10102
+ sha256: string()
10103
+ }),
10104
+ object({
10105
+ ...EventBase,
10106
+ type: literal("done"),
10107
+ status: _enum(["succeeded", "failed"]),
10108
+ resultSha256: string().nullable().optional()
10109
+ }),
10110
+ object({
10111
+ ...EventBase,
10112
+ type: literal("error"),
10113
+ stage: string(),
10114
+ code: string(),
10115
+ message: string()
10116
+ })
10117
+ ]);
10118
+ /**
9424
10119
  * What the gate decided about a birth, from the CALLER's point of view.
9425
10120
  *
9426
10121
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11748,7 +12443,9 @@ var AddonHttpRouteSchema = object({
11748
12443
  "authenticated",
11749
12444
  "admin"
11750
12445
  ]).optional(),
11751
- description: string().optional()
12446
+ description: string().optional(),
12447
+ /** The hub limits this route per client address before the handler runs. */
12448
+ rateLimit: _enum(["auth"]).optional()
11752
12449
  });
11753
12450
  /**
11754
12451
  * Cross-process route invocation envelope. The hub captures the
@@ -12453,6 +13150,37 @@ var BackupDestinationInfoSchema = object({
12453
13150
  lastError: string().optional()
12454
13151
  });
12455
13152
  /**
13153
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13154
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13155
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13156
+ * with it off — which restores without a key.
13157
+ */
13158
+ var BackupArchiveEncryptionSchema = object({
13159
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13160
+ scheme: string(),
13161
+ /** 16 hex — the backup key whose secret restores this archive. */
13162
+ keyId: string()
13163
+ });
13164
+ /**
13165
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13166
+ * one new archives are encrypted to, and the retired ones older archives
13167
+ * still need. The secret key is shown once, at `setupEncryption`.
13168
+ */
13169
+ var BackupEncryptionStatusSchema = object({
13170
+ enabled: boolean(),
13171
+ active: object({
13172
+ keyId: string(),
13173
+ publicKey: string(),
13174
+ createdAt: number()
13175
+ }).nullable(),
13176
+ /** Every key ever set up, newest first. */
13177
+ keys: array(object({
13178
+ keyId: string(),
13179
+ createdAt: number(),
13180
+ retiredAt: number().nullable()
13181
+ })).readonly()
13182
+ });
13183
+ /**
12456
13184
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12457
13185
  * Same shape the destination drill-in renders. Sourced from the per-
12458
13186
  * location `manifests.json` (no per-archive tarball read required).
@@ -12464,7 +13192,9 @@ var BackupArchiveEntrySchema = object({
12464
13192
  sizeBytes: number(),
12465
13193
  label: string().optional(),
12466
13194
  /** Top-level locations included in the archive (db, addons, tls, …). */
12467
- locations: array(string()).readonly()
13195
+ locations: array(string()).readonly(),
13196
+ /** Present when the archive is encrypted; restore then needs that key. */
13197
+ encryption: BackupArchiveEncryptionSchema.optional()
12468
13198
  });
12469
13199
  var BackupEntrySchema = object({
12470
13200
  id: string(),
@@ -12473,7 +13203,8 @@ var BackupEntrySchema = object({
12473
13203
  label: string().optional(),
12474
13204
  createdAt: number(),
12475
13205
  sizeBytes: number(),
12476
- locations: array(string()).optional()
13206
+ locations: array(string()).optional(),
13207
+ encryption: BackupArchiveEncryptionSchema.optional()
12477
13208
  });
12478
13209
  var ArchiveEntrySchema = object({
12479
13210
  path: string(),
@@ -12662,10 +13393,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12662
13393
  * this list and skips entries whose path doesn't start with
12663
13394
  * any of them.
12664
13395
  */
12665
- locations: array(string()).optional()
13396
+ locations: array(string()).optional(),
13397
+ /**
13398
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13399
+ * one). The archive is decrypted into the hub's private staging
13400
+ * before the restart; the key is not stored. A wrong or missing key
13401
+ * is refused before the archive is downloaded.
13402
+ */
13403
+ backupSecretKey: string().optional()
12666
13404
  }), _void(), {
12667
13405
  kind: "mutation",
12668
13406
  auth: "admin"
13407
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13408
+ keyId: string(),
13409
+ secretKey: string(),
13410
+ publicKey: string(),
13411
+ createdAt: number(),
13412
+ replacedKeyId: string().nullable()
13413
+ }), {
13414
+ kind: "mutation",
13415
+ auth: "admin"
13416
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13417
+ kind: "mutation",
13418
+ auth: "admin"
13419
+ }), method(object({ backupSecretKey: string() }), object({
13420
+ valid: boolean(),
13421
+ keyId: string().nullable(),
13422
+ /** The hub knows this key (active or retired). */
13423
+ known: boolean(),
13424
+ /** It is the key new archives are encrypted to. */
13425
+ active: boolean(),
13426
+ error: string().optional()
13427
+ }), {
13428
+ kind: "mutation",
13429
+ auth: "admin"
12669
13430
  }), method(object({
12670
13431
  destinationId: string(),
12671
13432
  backupId: string()
@@ -14338,7 +15099,60 @@ var CustomModelDescriptorSchema = object({
14338
15099
  stepId: string(),
14339
15100
  entry: ModelCatalogEntrySchema
14340
15101
  });
14341
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15102
+ /** One regular file of an imported bundle, as the producer measured it. */
15103
+ var ModelBundleFileSchema = object({
15104
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15105
+ path: string().min(1),
15106
+ bytes: number().int().nonnegative(),
15107
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15108
+ });
15109
+ var ImportModelBundleInputSchema = object({
15110
+ /** The registry provider that keeps the model (Model Studio). */
15111
+ addonId: string(),
15112
+ stepId: string().min(1),
15113
+ /**
15114
+ * The catalog rows to register, complete, every format URL already
15115
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15116
+ * bundle may carry several rows (a base and its INT8 variant).
15117
+ */
15118
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15119
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15120
+ bundle: object({
15121
+ ticket: PeerBytesTicketSchema,
15122
+ bytes: number().int().positive(),
15123
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15124
+ }),
15125
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15126
+ files: array(ModelBundleFileSchema).min(1).max(64),
15127
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15128
+ distribute: boolean()
15129
+ });
15130
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15131
+ kind: literal("imported"),
15132
+ modelIds: array(string()).readonly(),
15133
+ distributed: array(object({
15134
+ modelId: string(),
15135
+ nodeId: string(),
15136
+ format: _enum(MODEL_FORMATS),
15137
+ ok: boolean(),
15138
+ error: string().optional()
15139
+ })).readonly()
15140
+ }), object({
15141
+ kind: literal("refused"),
15142
+ reason: _enum([
15143
+ "transfer-failed",
15144
+ "checksum-mismatch",
15145
+ "bundle-mismatch",
15146
+ "invalid-entry",
15147
+ "id-taken"
15148
+ ]),
15149
+ detail: string()
15150
+ })]);
15151
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15152
+ kind: "mutation",
15153
+ auth: "admin",
15154
+ timeoutMs: 30 * 6e4
15155
+ });
14342
15156
  /**
14343
15157
  * Query filter for settings-store collections.
14344
15158
  */
@@ -14817,6 +15631,35 @@ var KeychainKeySourceSchema = object({
14817
15631
  */
14818
15632
  sharesBackupWithDatabase: boolean()
14819
15633
  });
15634
+ /**
15635
+ * One keychain reset, as the Secrets page reports it until the operator
15636
+ * acknowledges it. Never a value: refs, counts and table names only.
15637
+ */
15638
+ var KeychainResetRecordSchema = object({
15639
+ id: string(),
15640
+ at: number(),
15641
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15642
+ actor: string(),
15643
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15644
+ lockedReason: string().nullable(),
15645
+ /** Values moved into the archive table (ciphertext under the lost key). */
15646
+ archived: number().int(),
15647
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15648
+ archivedCollection: string().nullable(),
15649
+ /**
15650
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15651
+ * so the archive can still be opened if the lost master key turns up.
15652
+ */
15653
+ archivedKeysCollection: string().nullable(),
15654
+ /**
15655
+ * `system-settings` keys whose marker the reset cleared — the cluster
15656
+ * secret's: a marker left pointing at an archived value would refuse every
15657
+ * agent forever (D797).
15658
+ */
15659
+ clearedSettingsKeys: array(string()).readonly(),
15660
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15661
+ acknowledgedAt: number().nullable()
15662
+ });
14820
15663
  var KeychainStatusSchema = object({
14821
15664
  keychain: KeychainStateSchema,
14822
15665
  /** The source of the master key in use; `null` while locked. */
@@ -14834,7 +15677,9 @@ var KeychainStatusSchema = object({
14834
15677
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
14835
15678
  retiredWraps: number().int(),
14836
15679
  recoveryKeyDownloadedAt: number().nullable(),
14837
- secretCount: number().int()
15680
+ secretCount: number().int(),
15681
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15682
+ lastReset: KeychainResetRecordSchema.nullable()
14838
15683
  });
14839
15684
  /**
14840
15685
  * Whether a stored value is still pointed at by its owner's settings.
@@ -14856,13 +15701,14 @@ var KeychainAuditActionSchema = _enum([
14856
15701
  "download-recovery-key",
14857
15702
  "delete-orphans",
14858
15703
  "reset",
15704
+ "acknowledge-reset",
14859
15705
  "initialize"
14860
15706
  ]);
14861
15707
  var KeychainAuditEntrySchema = object({
14862
15708
  id: string(),
14863
15709
  at: number(),
14864
15710
  action: KeychainAuditActionSchema,
14865
- /** `addon:<id>` | `user:<id>` | `system`. */
15711
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
14866
15712
  actor: string(),
14867
15713
  ref: string().nullable(),
14868
15714
  detail: string().nullable()
@@ -14928,6 +15774,13 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
14928
15774
  kind: "mutation",
14929
15775
  auth: "admin",
14930
15776
  caller: "required"
15777
+ }), method(object({}), object({
15778
+ reset: KeychainResetRecordSchema.nullable(),
15779
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15780
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15781
+ kind: "mutation",
15782
+ auth: "admin",
15783
+ caller: "required"
14931
15784
  });
14932
15785
  method(_void(), object({
14933
15786
  id: string(),
@@ -17573,7 +18426,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17573
18426
  * `login-method` — collection cap through which auth addons contribute
17574
18427
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17575
18428
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17576
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18429
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17577
18430
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17578
18431
  * procedure aggregates them for the unauthenticated login page.
17579
18432
  *
@@ -17581,8 +18434,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17581
18434
  *
17582
18435
  * - `redirect` — a declarative button. The login page renders a generic
17583
18436
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17584
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17585
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18437
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17586
18438
  * login page needs NO change.
17587
18439
  *
17588
18440
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -17601,8 +18453,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17601
18453
  * decision.
17602
18454
  *
17603
18455
  * Every contribution carries a `stage`:
17604
- * - `primary` — shown on the first credentials screen (OIDC /
17605
- * magic-link buttons; a future usernameless passkey).
18456
+ * - `primary` — shown on the first credentials screen (OIDC
18457
+ * buttons; a usernameless passkey).
17606
18458
  * - `second-factor` — shown AFTER the password leg, gated on the
17607
18459
  * returned `factors` (passkey-as-2FA today).
17608
18460
  *
@@ -17629,7 +18481,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17629
18481
  * The provider names an external identity a signed-in user can link to
17630
18482
  * their own account (D782): `auth.listLinkableProviders` /
17631
18483
  * `beginExternalLink` offer exactly the redirect methods that set this,
17632
- * whatever their id. Absent / false — a login button only (magic-link).
18484
+ * whatever their id. Absent / false — a login button only.
17633
18485
  */
17634
18486
  linkable: boolean().optional()
17635
18487
  }),
@@ -21465,8 +22317,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21465
22317
  * `super_admin` — collapsed onto the single boolean because every
21466
22318
  * non-admin caller is governed by the same scope-check rules; the
21467
22319
  * distinction was only ever used to route role-specific procedures
21468
- * which we no longer have. Agents are admin sessions issued via
21469
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22320
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21470
22321
  * with `isAdmin: false` + an explicit scope list.
21471
22322
  */
21472
22323
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -24161,6 +25012,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24161
25012
  kind: "mutation",
24162
25013
  auth: "admin",
24163
25014
  timeoutMs: 60 * 6e4
25015
+ }), method(object({
25016
+ filter: RetrainExportFilterSchema,
25017
+ layout: RetrainExportLayoutSchema
25018
+ }), object({
25019
+ ticket: PeerBytesTicketSchema,
25020
+ frames: number().int(),
25021
+ annotations: number().int()
25022
+ }), {
25023
+ kind: "mutation",
25024
+ auth: "admin",
25025
+ timeoutMs: 12e4
24164
25026
  }), method(object({
24165
25027
  selection: RetrainDatasetSelectionSchema,
24166
25028
  completeOnly: boolean().optional()
@@ -27729,8 +28591,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
27729
28591
  * `smtp-provider` — pluggable email delivery surface.
27730
28592
  *
27731
28593
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
27732
- * one for transactional / one for notifications). Consumers (magic-link,
27733
- * notifier addons, …) walk the collection and pick the first
28594
+ * one for transactional / one for notifications). Consumers (notifier
28595
+ * addons, …) walk the collection and pick the first
27734
28596
  * ready provider OR target a specific addonId.
27735
28597
  *
27736
28598
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -27909,7 +28771,7 @@ targets: array(object({
27909
28771
  })));
27910
28772
  /**
27911
28773
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
27912
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
28774
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
27913
28775
  * carrying the post-callback claims before redirecting back to
27914
28776
  * `/api/auth/sso/finish`.
27915
28777
  *
@@ -27972,7 +28834,14 @@ var SsoBridgeClaimsSchema = object({
27972
28834
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
27973
28835
  * subject is unique only per issuer, so a link is bound to it.
27974
28836
  */
27975
- issuer: string().optional()
28837
+ issuer: string().optional(),
28838
+ /**
28839
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
28840
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
28841
+ * request to present the matching cookie — a login bridge is useless in
28842
+ * any other browser.
28843
+ */
28844
+ browserBinding: string().optional()
27976
28845
  });
27977
28846
  method(object({
27978
28847
  claims: SsoBridgeClaimsSchema,
@@ -33864,7 +34733,13 @@ var TopologyNodeSchema = object({
33864
34733
  })).readonly(),
33865
34734
  processes: array(TopologyProcessSchema).readonly(),
33866
34735
  categories: array(TopologyCategorySchema).readonly(),
33867
- rootPackage: TopologyRootPackageSchema.nullable()
34736
+ rootPackage: TopologyRootPackageSchema.nullable(),
34737
+ /**
34738
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
34739
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
34740
+ * for offline rows and when the hub cannot tell.
34741
+ */
34742
+ meshTransport: _enum(["tls", "clear"]).optional()
33868
34743
  });
33869
34744
  var CapUsageEdgeSchema = object({
33870
34745
  callerAddonId: string(),
@@ -37892,16 +38767,6 @@ var ApiKeySummarySchema = object({
37892
38767
  createdAt: number(),
37893
38768
  lastUsedAt: number().optional()
37894
38769
  });
37895
- var CreateApiKeyInputSchema = object({
37896
- label: string(),
37897
- isAdmin: boolean().default(false),
37898
- allowedProviders: union([array(string()), literal("*")]).optional(),
37899
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
37900
- });
37901
- var CreateApiKeyResultSchema = object({
37902
- token: string(),
37903
- record: ApiKeySummarySchema
37904
- });
37905
38770
  var ScopedTokenSummarySchema = object({
37906
38771
  id: string(),
37907
38772
  userId: string(),
@@ -38000,17 +38865,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
38000
38865
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
38001
38866
  kind: "mutation",
38002
38867
  access: "view"
38003
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
38004
- kind: "mutation",
38005
- auth: "admin",
38006
- access: "create"
38007
- }), method(object({ id: string() }), object({ success: literal(true) }), {
38868
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
38008
38869
  kind: "mutation",
38009
38870
  auth: "admin",
38010
38871
  access: "delete"
38011
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
38012
- kind: "mutation",
38013
- access: "view"
38014
38872
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
38015
38873
  kind: "mutation",
38016
38874
  auth: "admin",
@@ -38084,15 +38942,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
38084
38942
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
38085
38943
  userId: string(),
38086
38944
  issuer: string()
38087
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
38088
- userId: string(),
38089
- issuer: string().min(1),
38090
- label: string().optional()
38091
- }), object({ success: literal(true) }), {
38092
- kind: "mutation",
38093
- auth: "admin",
38094
- access: "create"
38095
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
38945
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
38096
38946
  kind: "mutation",
38097
38947
  auth: "admin",
38098
38948
  access: "delete"
@@ -38487,6 +39337,451 @@ DeviceType.Camera, method(object({
38487
39337
  detection: array(ZoneRuleSchema).readonly(),
38488
39338
  package: array(ZoneRuleSchema).readonly()
38489
39339
  });
39340
+ /**
39341
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
39342
+ *
39343
+ * A thin, mockable translation layer: it knows how to run a container with a
39344
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
39345
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
39346
+ * those are the `training` orchestrator's (D805). Every rule written there
39347
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
39348
+ * manifest entry and nothing else.
39349
+ *
39350
+ * Collection, routed by the `addonId` in every single-row input (the `llm` /
39351
+ * `notification-output` posture); `describe` concat-fans across providers.
39352
+ * Every method is `admin`: these spend money.
39353
+ *
39354
+ * Every cloud object a provider creates is tagged with the orchestrator's
39355
+ * `jobKey`, so a retried submit finds the job it already started instead of
39356
+ * starting a second GPU, and `listJobs` can find orphans.
39357
+ *
39358
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
39359
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
39360
+ * ticket the provider mints (D613).
39361
+ */
39362
+ var TrainingGpuOptionSchema = object({
39363
+ id: string(),
39364
+ label: string(),
39365
+ /** List price, USD per GPU-hour, before any region multiplier. */
39366
+ usdPerHour: number().nonnegative(),
39367
+ vramGb: number().nonnegative()
39368
+ });
39369
+ var TrainingRegionOptionSchema = object({
39370
+ /** `''` = any region (the provider's choice). */
39371
+ id: string(),
39372
+ label: string(),
39373
+ priceMultiplier: number().positive()
39374
+ });
39375
+ /**
39376
+ * The provider's per-account settings, as the orchestrator reads them. They
39377
+ * live in the PROVIDER addon's settings (operator decision 2026-10-08: they
39378
+ * depend on the user's account), never hard-coded in the orchestrator.
39379
+ */
39380
+ var TrainingProviderDefaultsSchema = object({
39381
+ gpuType: string(),
39382
+ region: string(),
39383
+ costCapUsd: number().nonnegative(),
39384
+ maxRuntimeSec: number().int().positive(),
39385
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
39386
+ failedDatasetGraceHours: number().nonnegative()
39387
+ });
39388
+ var TrainingProviderDescriptorSchema = object({
39389
+ addonId: string(),
39390
+ /** `modal`, `runpod`, `fake`, … */
39391
+ kind: string(),
39392
+ label: string(),
39393
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
39394
+ regions: array(TrainingRegionOptionSchema).readonly(),
39395
+ maxDatasetBytes: number().int().positive(),
39396
+ maxRuntimeSec: number().int().positive(),
39397
+ freeTierNote: string().optional(),
39398
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
39399
+ dataResidencyNote: string(),
39400
+ /** Credentials are present — never the values. */
39401
+ configured: boolean(),
39402
+ defaults: TrainingProviderDefaultsSchema
39403
+ });
39404
+ var TrainingCredentialCheckSchema = object({
39405
+ ok: boolean(),
39406
+ /** Workspace / account name, when the provider says. */
39407
+ account: string().optional(),
39408
+ reason: _enum([
39409
+ "missing",
39410
+ "invalid",
39411
+ "forbidden",
39412
+ "network",
39413
+ "quota"
39414
+ ]).optional(),
39415
+ detail: string().optional()
39416
+ });
39417
+ var ProviderJobStateSchema = _enum([
39418
+ "pending",
39419
+ "starting",
39420
+ "running",
39421
+ "succeeded",
39422
+ "failed",
39423
+ "cancelled",
39424
+ "lost"
39425
+ ]);
39426
+ var ProviderJobStatusSchema = object({
39427
+ jobKey: string(),
39428
+ providerJobId: string().optional(),
39429
+ state: ProviderJobStateSchema,
39430
+ startedAt: number().optional(),
39431
+ endedAt: number().optional(),
39432
+ exitCode: number().int().optional(),
39433
+ failureReason: string().optional(),
39434
+ gpuType: string(),
39435
+ region: string().optional(),
39436
+ billedSeconds: number().nonnegative(),
39437
+ costUsd: number().nonnegative(),
39438
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
39439
+ costIsEstimate: boolean(),
39440
+ lastFetchedAt: number()
39441
+ });
39442
+ /**
39443
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
39444
+ * image its own way (Modal builds the published Dockerfile at that revision;
39445
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
39446
+ * in `result.json`.
39447
+ */
39448
+ var TrainerSourceRefSchema = object({
39449
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
39450
+ repo: string().min(1),
39451
+ /** A commit sha (never a branch) — the job must be reproducible. */
39452
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
39453
+ });
39454
+ var JobRef = {
39455
+ addonId: string(),
39456
+ jobKey: string().uuid()
39457
+ };
39458
+ var TrainingLogLineSchema = object({
39459
+ ts: number(),
39460
+ text: string()
39461
+ });
39462
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
39463
+ kind: "mutation",
39464
+ auth: "admin",
39465
+ timeoutMs: 3e4
39466
+ }), method(object({
39467
+ addonId: string(),
39468
+ gpuType: string(),
39469
+ region: string(),
39470
+ datasetBytes: number().int().nonnegative(),
39471
+ gpuSecondsLow: number().nonnegative(),
39472
+ gpuSecondsHigh: number().nonnegative()
39473
+ }), object({
39474
+ usdLow: number().nonnegative(),
39475
+ usdHigh: number().nonnegative(),
39476
+ notes: array(string()).readonly()
39477
+ }), { auth: "admin" }), method(object({
39478
+ ...JobRef,
39479
+ ticket: PeerBytesTicketSchema
39480
+ }), object({
39481
+ bytes: number().int().nonnegative(),
39482
+ sha256: string()
39483
+ }), {
39484
+ kind: "mutation",
39485
+ auth: "admin",
39486
+ timeoutMs: 120 * 6e4
39487
+ }), method(object({
39488
+ ...JobRef,
39489
+ trainer: TrainerSourceRefSchema,
39490
+ jobSpecJson: string().min(2).max(64e3),
39491
+ gpuType: string(),
39492
+ region: string(),
39493
+ maxRuntimeSec: number().int().positive()
39494
+ }), ProviderJobStatusSchema, {
39495
+ kind: "mutation",
39496
+ auth: "admin",
39497
+ timeoutMs: 30 * 6e4
39498
+ }), method(object(JobRef), ProviderJobStatusSchema, {
39499
+ auth: "admin",
39500
+ timeoutMs: 6e4
39501
+ }), method(object({
39502
+ ...JobRef,
39503
+ cursor: string().optional(),
39504
+ max: number().int().min(1).max(500)
39505
+ }), object({
39506
+ lines: array(TrainingLogLineSchema).readonly(),
39507
+ cursor: string()
39508
+ }), {
39509
+ auth: "admin",
39510
+ timeoutMs: 6e4
39511
+ }), method(object(JobRef), object({ ok: literal(true) }), {
39512
+ kind: "mutation",
39513
+ auth: "admin",
39514
+ timeoutMs: 6e4
39515
+ }), method(object(JobRef), object({
39516
+ found: boolean(),
39517
+ text: string().optional()
39518
+ }), {
39519
+ kind: "mutation",
39520
+ auth: "admin",
39521
+ timeoutMs: 5 * 6e4
39522
+ }), method(object({
39523
+ ...JobRef,
39524
+ path: _enum(["bundle.tar"])
39525
+ }), object({ ticket: PeerBytesTicketSchema }), {
39526
+ kind: "mutation",
39527
+ auth: "admin",
39528
+ timeoutMs: 5 * 6e4
39529
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
39530
+ kind: "mutation",
39531
+ auth: "admin",
39532
+ timeoutMs: 5 * 6e4
39533
+ }), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
39534
+ auth: "admin",
39535
+ timeoutMs: 2 * 6e4
39536
+ });
39537
+ /**
39538
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
39539
+ * provided by `addon-training`.
39540
+ *
39541
+ * It owns what every provider must agree on, written once:
39542
+ *
39543
+ * - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
39544
+ * live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
39545
+ * the export plan) and reaches this store through the five row methods
39546
+ * below, so the Retrain page and the export did not change.
39547
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
39548
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
39549
+ * - **The return flow.** Verified artefacts → Model Studio
39550
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
39551
+ * rollback. Nothing is ever registered automatically.
39552
+ *
39553
+ * Every method is `admin`.
39554
+ */
39555
+ /** A version WITH its frame list — what the export and a job read. */
39556
+ var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
39557
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
39558
+ var TrainingBaseModelSchema = object({
39559
+ modelId: string(),
39560
+ label: string(),
39561
+ weights: string(),
39562
+ imgsz: number().int(),
39563
+ baselineOnnxUrl: string(),
39564
+ baselineFloors: record(string(), number()),
39565
+ /** The base the fleet runs most — the UI's default. */
39566
+ recommended: boolean()
39567
+ });
39568
+ var TrainingPresetSchema = _enum([
39569
+ "quick",
39570
+ "standard",
39571
+ "thorough"
39572
+ ]);
39573
+ var TrainingJobRequestSchema = object({
39574
+ datasetVersionId: string().min(1),
39575
+ /** The `training-provider` addon that runs it. */
39576
+ addonId: string().min(1),
39577
+ gpuType: string().min(1),
39578
+ region: string(),
39579
+ baseModelId: string().min(1),
39580
+ preset: TrainingPresetSchema,
39581
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
39582
+ freeze: number().int().nonnegative().nullable(),
39583
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
39584
+ holdoutCameras: array(number().int()).nullable()
39585
+ });
39586
+ var TrainingSplitPlanSchema = object({
39587
+ holdoutCameras: array(number().int()).readonly(),
39588
+ /** Used when no camera is held out: the last N days of every camera. */
39589
+ holdoutLastDays: number().int().nonnegative(),
39590
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
39591
+ holdoutSupport: record(string(), number().int()).nullable(),
39592
+ trainSubjects: number().int()
39593
+ });
39594
+ var TrainingRefusalReasonSchema = _enum([
39595
+ "unknown-dataset",
39596
+ "unknown-provider",
39597
+ "provider-not-configured",
39598
+ "unknown-base-model",
39599
+ "unknown-gpu",
39600
+ "dataset-too-large",
39601
+ "no-training-subjects",
39602
+ "job-already-running"
39603
+ ]);
39604
+ var TrainingJobPlanSchema = object({
39605
+ refusal: object({
39606
+ reason: TrainingRefusalReasonSchema,
39607
+ detail: string()
39608
+ }).nullable(),
39609
+ warnings: array(string()).readonly(),
39610
+ split: TrainingSplitPlanSchema.nullable(),
39611
+ estimate: object({
39612
+ datasetBytes: number().int(),
39613
+ uploadMinutesAt20Mbps: number(),
39614
+ gpuSecondsLow: number(),
39615
+ gpuSecondsHigh: number(),
39616
+ usdLow: number(),
39617
+ usdHigh: number(),
39618
+ notes: array(string()).readonly()
39619
+ }).nullable(),
39620
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
39621
+ defaults: object({
39622
+ maxCostUsd: number(),
39623
+ maxRuntimeSec: number().int()
39624
+ }).nullable(),
39625
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
39626
+ dataNotice: string()
39627
+ });
39628
+ /**
39629
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
39630
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
39631
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
39632
+ * result lives after the operator acted on it.
39633
+ */
39634
+ var TrainingJobStateSchema = _enum([
39635
+ "uploading",
39636
+ "submitted",
39637
+ "starting",
39638
+ "running",
39639
+ "collecting",
39640
+ "ready",
39641
+ "registered",
39642
+ "canary",
39643
+ "failed",
39644
+ "cancelling",
39645
+ "cancelled",
39646
+ "lost",
39647
+ "expired",
39648
+ "discarded"
39649
+ ]);
39650
+ var TrainingFailureReasonSchema = _enum([
39651
+ "cost-cap",
39652
+ "runtime-cap",
39653
+ "upload-failed",
39654
+ "submit-failed",
39655
+ "trainer-failed",
39656
+ "result-invalid",
39657
+ "checksum-mismatch",
39658
+ "fetch-failed",
39659
+ "provider-error",
39660
+ "hub-restart-during-upload"
39661
+ ]);
39662
+ var TrainingProgressPointSchema = object({
39663
+ epoch: number().int(),
39664
+ map50: number().nullable(),
39665
+ map50_95: number().nullable()
39666
+ });
39667
+ var TrainingCanarySchema = object({
39668
+ deviceIds: array(number().int()).readonly(),
39669
+ since: number(),
39670
+ /** Every override the canary replaced, exactly, so rollback restores it. */
39671
+ previous: array(object({
39672
+ deviceId: number().int(),
39673
+ nodeId: string(),
39674
+ deviceKey: string(),
39675
+ patch: object({
39676
+ modelId: string().optional(),
39677
+ settings: record(string(), unknown()).readonly().optional()
39678
+ }).nullable()
39679
+ })).readonly()
39680
+ });
39681
+ var TrainingJobSchema = object({
39682
+ id: string(),
39683
+ idempotencyKey: string(),
39684
+ name: string(),
39685
+ createdAt: number(),
39686
+ updatedAt: number(),
39687
+ state: TrainingJobStateSchema,
39688
+ stage: TrainingStageSchema.nullable(),
39689
+ failure: object({
39690
+ reason: TrainingFailureReasonSchema,
39691
+ stage: string().nullable(),
39692
+ detail: string()
39693
+ }).nullable(),
39694
+ request: TrainingJobRequestSchema,
39695
+ maxCostUsd: number().nonnegative(),
39696
+ maxRuntimeSec: number().int().positive(),
39697
+ trainer: TrainerSourceRefSchema,
39698
+ datasetLayout: RetrainExportLayoutSchema,
39699
+ dataset: object({
39700
+ bytes: number().int(),
39701
+ sha256: string(),
39702
+ uploadedAt: number()
39703
+ }).nullable(),
39704
+ split: TrainingSplitPlanSchema,
39705
+ provider: object({
39706
+ state: ProviderJobStateSchema.nullable(),
39707
+ providerJobId: string().nullable(),
39708
+ startedAt: number().nullable(),
39709
+ endedAt: number().nullable(),
39710
+ billedSeconds: number(),
39711
+ costUsd: number(),
39712
+ costIsEstimate: boolean(),
39713
+ lastPolledAt: number().nullable()
39714
+ }),
39715
+ progress: object({
39716
+ epoch: number().int().nullable(),
39717
+ epochs: number().int().nullable(),
39718
+ etaSec: number().nullable(),
39719
+ series: array(TrainingProgressPointSchema).readonly()
39720
+ }),
39721
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
39722
+ logTail: array(string()).readonly(),
39723
+ logCursor: string().nullable(),
39724
+ artifacts: object({
39725
+ bundleBytes: number().int(),
39726
+ bundleSha256: string(),
39727
+ fetchedAt: number(),
39728
+ /** When the staged artefacts are deleted from the hub. */
39729
+ expiresAt: number()
39730
+ }).nullable(),
39731
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
39732
+ cloudDatasetDeletedAt: number().nullable(),
39733
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
39734
+ cloudCleanupDueAt: number().nullable(),
39735
+ /** Model ids registered from this job (base, and int8 when kept). */
39736
+ registeredModelIds: array(string()).readonly(),
39737
+ canary: TrainingCanarySchema.nullable()
39738
+ });
39739
+ var IdInput = object({ id: string().min(1) });
39740
+ method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
39741
+ kind: "mutation",
39742
+ auth: "admin"
39743
+ }), method(IdInput, TrainingDatasetVersionRowSchema.nullable(), { auth: "admin" }), method(object({}), array(RetrainDatasetVersionSchema).readonly(), { auth: "admin" }), method(object({ name: string() }), object({ id: string().nullable() }), { auth: "admin" }), method(IdInput, object({ removed: boolean() }), {
39744
+ kind: "mutation",
39745
+ auth: "admin"
39746
+ }), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
39747
+ auth: "admin",
39748
+ timeoutMs: 6e4
39749
+ }), method(TrainingJobRequestSchema.extend({
39750
+ name: string().min(1).max(120),
39751
+ maxCostUsd: number().positive(),
39752
+ maxRuntimeSec: number().int().positive(),
39753
+ idempotencyKey: string().min(8).max(80)
39754
+ }), discriminatedUnion("kind", [object({
39755
+ kind: literal("started"),
39756
+ job: TrainingJobSchema
39757
+ }), object({
39758
+ kind: literal("refused"),
39759
+ reason: TrainingRefusalReasonSchema,
39760
+ detail: string()
39761
+ })]), {
39762
+ kind: "mutation",
39763
+ auth: "admin",
39764
+ timeoutMs: 12e4
39765
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
39766
+ kind: "mutation",
39767
+ auth: "admin",
39768
+ timeoutMs: 12e4
39769
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
39770
+ kind: "mutation",
39771
+ auth: "admin",
39772
+ timeoutMs: 30 * 6e4
39773
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
39774
+ kind: "mutation",
39775
+ auth: "admin",
39776
+ timeoutMs: 12e4
39777
+ }), method(IdInput, TrainingJobSchema, {
39778
+ kind: "mutation",
39779
+ auth: "admin",
39780
+ timeoutMs: 12e4
39781
+ }), method(IdInput, TrainingJobSchema, {
39782
+ kind: "mutation",
39783
+ auth: "admin"
39784
+ });
38490
39785
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
38491
39786
  Object.freeze({
38492
39787
  person: .5,
@@ -39110,6 +40405,12 @@ Object.freeze({
39110
40405
  addonId: null,
39111
40406
  access: "create"
39112
40407
  },
40408
+ "backup.checkBackupKey": {
40409
+ capName: "backup",
40410
+ capScope: "system",
40411
+ addonId: null,
40412
+ access: "create"
40413
+ },
39113
40414
  "backup.delete": {
39114
40415
  capName: "backup",
39115
40416
  capScope: "system",
@@ -39122,6 +40423,18 @@ Object.freeze({
39122
40423
  addonId: null,
39123
40424
  access: "delete"
39124
40425
  },
40426
+ "backup.disableEncryption": {
40427
+ capName: "backup",
40428
+ capScope: "system",
40429
+ addonId: null,
40430
+ access: "create"
40431
+ },
40432
+ "backup.getEncryption": {
40433
+ capName: "backup",
40434
+ capScope: "system",
40435
+ addonId: null,
40436
+ access: "view"
40437
+ },
39125
40438
  "backup.getEntries": {
39126
40439
  capName: "backup",
39127
40440
  capScope: "system",
@@ -39176,6 +40489,12 @@ Object.freeze({
39176
40489
  addonId: null,
39177
40490
  access: "create"
39178
40491
  },
40492
+ "backup.setupEncryption": {
40493
+ capName: "backup",
40494
+ capScope: "system",
40495
+ addonId: null,
40496
+ access: "create"
40497
+ },
39179
40498
  "backup.trigger": {
39180
40499
  capName: "backup",
39181
40500
  capScope: "system",
@@ -39728,6 +41047,12 @@ Object.freeze({
39728
41047
  addonId: null,
39729
41048
  access: "create"
39730
41049
  },
41050
+ "customModelRegistry.importModelBundle": {
41051
+ capName: "custom-model-registry",
41052
+ capScope: "system",
41053
+ addonId: null,
41054
+ access: "create"
41055
+ },
39731
41056
  "customModelRegistry.listModels": {
39732
41057
  capName: "custom-model-registry",
39733
41058
  capScope: "system",
@@ -41168,6 +42493,12 @@ Object.freeze({
41168
42493
  addonId: null,
41169
42494
  access: "view"
41170
42495
  },
42496
+ "keychainAdmin.acknowledgeReset": {
42497
+ capName: "keychain-admin",
42498
+ capScope: "system",
42499
+ addonId: null,
42500
+ access: "create"
42501
+ },
41171
42502
  "keychainAdmin.deleteOrphans": {
41172
42503
  capName: "keychain-admin",
41173
42504
  capScope: "system",
@@ -41204,6 +42535,12 @@ Object.freeze({
41204
42535
  addonId: null,
41205
42536
  access: "delete"
41206
42537
  },
42538
+ "keychainAdmin.resetReport": {
42539
+ capName: "keychain-admin",
42540
+ capScope: "system",
42541
+ addonId: null,
42542
+ access: "delete"
42543
+ },
41207
42544
  "keychainAdmin.reveal": {
41208
42545
  capName: "keychain-admin",
41209
42546
  capScope: "system",
@@ -42950,6 +44287,12 @@ Object.freeze({
42950
44287
  addonId: null,
42951
44288
  access: "view"
42952
44289
  },
44290
+ "pipelineAnalytics.offerRetrainArchive": {
44291
+ capName: "pipeline-analytics",
44292
+ capScope: "device",
44293
+ addonId: null,
44294
+ access: "create"
44295
+ },
42953
44296
  "pipelineAnalytics.ownersWithMedia": {
42954
44297
  capName: "pipeline-analytics",
42955
44298
  capScope: "device",
@@ -45488,6 +46831,174 @@ Object.freeze({
45488
46831
  addonId: null,
45489
46832
  access: "view"
45490
46833
  },
46834
+ "training.canaryResult": {
46835
+ capName: "training",
46836
+ capScope: "system",
46837
+ addonId: null,
46838
+ access: "create"
46839
+ },
46840
+ "training.cancelJob": {
46841
+ capName: "training",
46842
+ capScope: "system",
46843
+ addonId: null,
46844
+ access: "create"
46845
+ },
46846
+ "training.discardResult": {
46847
+ capName: "training",
46848
+ capScope: "system",
46849
+ addonId: null,
46850
+ access: "create"
46851
+ },
46852
+ "training.findDatasetVersionIdByName": {
46853
+ capName: "training",
46854
+ capScope: "system",
46855
+ addonId: null,
46856
+ access: "view"
46857
+ },
46858
+ "training.getDatasetVersion": {
46859
+ capName: "training",
46860
+ capScope: "system",
46861
+ addonId: null,
46862
+ access: "view"
46863
+ },
46864
+ "training.getJob": {
46865
+ capName: "training",
46866
+ capScope: "system",
46867
+ addonId: null,
46868
+ access: "view"
46869
+ },
46870
+ "training.getJobResult": {
46871
+ capName: "training",
46872
+ capScope: "system",
46873
+ addonId: null,
46874
+ access: "view"
46875
+ },
46876
+ "training.listBaseModels": {
46877
+ capName: "training",
46878
+ capScope: "system",
46879
+ addonId: null,
46880
+ access: "view"
46881
+ },
46882
+ "training.listDatasetVersions": {
46883
+ capName: "training",
46884
+ capScope: "system",
46885
+ addonId: null,
46886
+ access: "view"
46887
+ },
46888
+ "training.listJobs": {
46889
+ capName: "training",
46890
+ capScope: "system",
46891
+ addonId: null,
46892
+ access: "view"
46893
+ },
46894
+ "training.planJob": {
46895
+ capName: "training",
46896
+ capScope: "system",
46897
+ addonId: null,
46898
+ access: "view"
46899
+ },
46900
+ "training.putDatasetVersion": {
46901
+ capName: "training",
46902
+ capScope: "system",
46903
+ addonId: null,
46904
+ access: "create"
46905
+ },
46906
+ "training.registerResult": {
46907
+ capName: "training",
46908
+ capScope: "system",
46909
+ addonId: null,
46910
+ access: "create"
46911
+ },
46912
+ "training.removeDatasetVersion": {
46913
+ capName: "training",
46914
+ capScope: "system",
46915
+ addonId: null,
46916
+ access: "delete"
46917
+ },
46918
+ "training.rollbackCanary": {
46919
+ capName: "training",
46920
+ capScope: "system",
46921
+ addonId: null,
46922
+ access: "create"
46923
+ },
46924
+ "training.startJob": {
46925
+ capName: "training",
46926
+ capScope: "system",
46927
+ addonId: null,
46928
+ access: "create"
46929
+ },
46930
+ "trainingProvider.cancelJob": {
46931
+ capName: "training-provider",
46932
+ capScope: "system",
46933
+ addonId: null,
46934
+ access: "create"
46935
+ },
46936
+ "trainingProvider.cleanupJob": {
46937
+ capName: "training-provider",
46938
+ capScope: "system",
46939
+ addonId: null,
46940
+ access: "create"
46941
+ },
46942
+ "trainingProvider.describe": {
46943
+ capName: "training-provider",
46944
+ capScope: "system",
46945
+ addonId: null,
46946
+ access: "view"
46947
+ },
46948
+ "trainingProvider.estimateJob": {
46949
+ capName: "training-provider",
46950
+ capScope: "system",
46951
+ addonId: null,
46952
+ access: "view"
46953
+ },
46954
+ "trainingProvider.getJob": {
46955
+ capName: "training-provider",
46956
+ capScope: "system",
46957
+ addonId: null,
46958
+ access: "view"
46959
+ },
46960
+ "trainingProvider.listJobEvents": {
46961
+ capName: "training-provider",
46962
+ capScope: "system",
46963
+ addonId: null,
46964
+ access: "view"
46965
+ },
46966
+ "trainingProvider.listJobs": {
46967
+ capName: "training-provider",
46968
+ capScope: "system",
46969
+ addonId: null,
46970
+ access: "view"
46971
+ },
46972
+ "trainingProvider.offerArtifact": {
46973
+ capName: "training-provider",
46974
+ capScope: "system",
46975
+ addonId: null,
46976
+ access: "create"
46977
+ },
46978
+ "trainingProvider.readResult": {
46979
+ capName: "training-provider",
46980
+ capScope: "system",
46981
+ addonId: null,
46982
+ access: "create"
46983
+ },
46984
+ "trainingProvider.submitJob": {
46985
+ capName: "training-provider",
46986
+ capScope: "system",
46987
+ addonId: null,
46988
+ access: "create"
46989
+ },
46990
+ "trainingProvider.uploadDataset": {
46991
+ capName: "training-provider",
46992
+ capScope: "system",
46993
+ addonId: null,
46994
+ access: "create"
46995
+ },
46996
+ "trainingProvider.validateCredentials": {
46997
+ capName: "training-provider",
46998
+ capScope: "system",
46999
+ addonId: null,
47000
+ access: "create"
47001
+ },
45491
47002
  "turnProvider.getTurnServers": {
45492
47003
  capName: "turn-provider",
45493
47004
  capScope: "system",
@@ -45512,12 +47023,6 @@ Object.freeze({
45512
47023
  addonId: null,
45513
47024
  access: "create"
45514
47025
  },
45515
- "userManagement.createApiKey": {
45516
- capName: "user-management",
45517
- capScope: "system",
45518
- addonId: null,
45519
- access: "create"
45520
- },
45521
47026
  "userManagement.createScopedToken": {
45522
47027
  capName: "user-management",
45523
47028
  capScope: "system",
@@ -45554,12 +47059,6 @@ Object.freeze({
45554
47059
  addonId: null,
45555
47060
  access: "view"
45556
47061
  },
45557
- "userManagement.linkExternalIdentity": {
45558
- capName: "user-management",
45559
- capScope: "system",
45560
- addonId: null,
45561
- access: "create"
45562
- },
45563
47062
  "userManagement.listApiKeys": {
45564
47063
  capName: "user-management",
45565
47064
  capScope: "system",
@@ -45662,12 +47161,6 @@ Object.freeze({
45662
47161
  addonId: null,
45663
47162
  access: "create"
45664
47163
  },
45665
- "userManagement.validateApiKey": {
45666
- capName: "user-management",
45667
- capScope: "system",
45668
- addonId: null,
45669
- access: "view"
45670
- },
45671
47164
  "userManagement.validateCredentials": {
45672
47165
  capName: "user-management",
45673
47166
  capScope: "system",
@@ -49781,6 +51274,11 @@ Object.freeze({
49781
51274
  form: "single",
49782
51275
  optional: false
49783
51276
  }],
51277
+ "training.canaryResult": [{
51278
+ name: "deviceIds",
51279
+ form: "array",
51280
+ optional: false
51281
+ }],
49784
51282
  "update.getStatus": [{
49785
51283
  name: "deviceId",
49786
51284
  form: "single",
@@ -50509,6 +52007,8 @@ var STATE_SUMMARY_VARS = [
50509
52007
  [...RULE_TEXT],
50510
52008
  [...RULE_TEXT],
50511
52009
  [...RULE_TEXT],
52010
+ [...RULE_TEXT],
52011
+ [...RULE_TEXT],
50512
52012
  ([...RULE_TEXT], [...UPDATES]),
50513
52013
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
50514
52014
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),