@camstack/addon-auth 1.2.134 → 1.2.136

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.
@@ -1,4 +1,3 @@
1
- require("node:crypto");
2
1
  //#region ../types/dist/event-category-DaIZi00R.mjs
3
2
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4
3
  EventCategory["SystemBoot"] = "system.boot";
@@ -5377,7 +5376,7 @@ var ZodIssueCode = {
5377
5376
  var ZodFirstPartyTypeKind;
5378
5377
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5379
5378
  //#endregion
5380
- //#region ../types/dist/sleep-DujUvOcb.mjs
5379
+ //#region ../types/dist/sleep-r3RWkGVx.mjs
5381
5380
  /**
5382
5381
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5383
5382
  * window to float samples (D455).
@@ -5494,7 +5493,7 @@ function isKeychainStoredField(field) {
5494
5493
  var SECRET_CLEAR = { $secretClear: true };
5495
5494
  /** The `'***'` token D634 redaction writes for non-admins. */
5496
5495
  var LEGACY_DEVICE_REDACTION = "***";
5497
- function isRecord$1(value) {
5496
+ function isRecord$2(value) {
5498
5497
  return typeof value === "object" && value !== null && !Array.isArray(value);
5499
5498
  }
5500
5499
  function makeSecretMarker(ref) {
@@ -5505,12 +5504,12 @@ function makeSecretMarker(ref) {
5505
5504
  }
5506
5505
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5507
5506
  function isSecretMarker(value) {
5508
- if (!isRecord$1(value)) return false;
5507
+ if (!isRecord$2(value)) return false;
5509
5508
  const ref = value["$secret"];
5510
5509
  return typeof ref === "string" && ref.length > 0;
5511
5510
  }
5512
5511
  function isSecretClear(value) {
5513
- return isRecord$1(value) && value["$secretClear"] === true;
5512
+ return isRecord$2(value) && value["$secretClear"] === true;
5514
5513
  }
5515
5514
  /**
5516
5515
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6026,6 +6025,13 @@ function globalSecretScope() {
6026
6025
  function encodeSegment(value) {
6027
6026
  return encodeURIComponent(value);
6028
6027
  }
6028
+ function decodeSegment(value) {
6029
+ try {
6030
+ return decodeURIComponent(value);
6031
+ } catch {
6032
+ return null;
6033
+ }
6034
+ }
6029
6035
  /**
6030
6036
  * The field path of a value inside an array item, addressed by the item's id:
6031
6037
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6034,6 +6040,75 @@ function encodeSegment(value) {
6034
6040
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6035
6041
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6036
6042
  }
6043
+ function parseScope(segments) {
6044
+ switch (segments[0]) {
6045
+ case "global": return {
6046
+ scope: GLOBAL_SCOPE,
6047
+ used: 1
6048
+ };
6049
+ case "node": {
6050
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6051
+ return nodeId === null || nodeId.length === 0 ? null : {
6052
+ scope: {
6053
+ kind: "node",
6054
+ nodeId
6055
+ },
6056
+ used: 2
6057
+ };
6058
+ }
6059
+ case "device": {
6060
+ const raw = segments[1];
6061
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6062
+ return {
6063
+ scope: {
6064
+ kind: "device",
6065
+ deviceId: Number(raw)
6066
+ },
6067
+ used: 2
6068
+ };
6069
+ }
6070
+ case "integration": {
6071
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6072
+ return id === null || id.length === 0 ? null : {
6073
+ scope: {
6074
+ kind: "integration",
6075
+ integrationId: id
6076
+ },
6077
+ used: 2
6078
+ };
6079
+ }
6080
+ case "row": {
6081
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6082
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6083
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6084
+ return {
6085
+ scope: {
6086
+ kind: "row",
6087
+ collection,
6088
+ rowId
6089
+ },
6090
+ used: 3
6091
+ };
6092
+ }
6093
+ default: return null;
6094
+ }
6095
+ }
6096
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6097
+ function parseSecretRef(ref) {
6098
+ if (!ref.startsWith("secret://")) return null;
6099
+ const segments = ref.slice(9).split("/");
6100
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6101
+ if (owner === null || owner.length === 0) return null;
6102
+ const parsed = parseScope(segments.slice(1));
6103
+ if (parsed === null) return null;
6104
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6105
+ if (fieldPath.length === 0) return null;
6106
+ return {
6107
+ owner,
6108
+ scope: parsed.scope,
6109
+ fieldPath
6110
+ };
6111
+ }
6037
6112
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6038
6113
  var KeychainWriteRefusedError = class extends Error {
6039
6114
  fieldPath;
@@ -6044,7 +6119,7 @@ var KeychainWriteRefusedError = class extends Error {
6044
6119
  }
6045
6120
  };
6046
6121
  var KEEP = { kind: "keep" };
6047
- function isRecord(value) {
6122
+ function isRecord$1(value) {
6048
6123
  return typeof value === "object" && value !== null && !Array.isArray(value);
6049
6124
  }
6050
6125
  function defaultMintId() {
@@ -6057,7 +6132,7 @@ function collectSecretMarkerRefs(value, out = []) {
6057
6132
  return out;
6058
6133
  }
6059
6134
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6060
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6135
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6061
6136
  return out;
6062
6137
  }
6063
6138
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6112,7 +6187,7 @@ function rowId(row, idKey) {
6112
6187
  return null;
6113
6188
  }
6114
6189
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6115
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6190
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6116
6191
  if (!Array.isArray(incoming)) {
6117
6192
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6118
6193
  return {
@@ -6128,7 +6203,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6128
6203
  const kept = /* @__PURE__ */ new Set();
6129
6204
  const rows = [];
6130
6205
  for (const row of incoming) {
6131
- if (!isRecord(row)) {
6206
+ if (!isRecord$1(row)) {
6132
6207
  rows.push(row);
6133
6208
  continue;
6134
6209
  }
@@ -6153,7 +6228,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6153
6228
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6154
6229
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6155
6230
  case "object": {
6156
- if (!isRecord(incoming)) {
6231
+ if (!isRecord$1(incoming)) {
6157
6232
  if (incoming === void 0) return KEEP;
6158
6233
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6159
6234
  return {
@@ -6161,7 +6236,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6161
6236
  value: incoming
6162
6237
  };
6163
6238
  }
6164
- const storedObj = isRecord(stored) ? stored : {};
6239
+ const storedObj = isRecord$1(stored) ? stored : {};
6165
6240
  return {
6166
6241
  kind: "value",
6167
6242
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6220,12 +6295,19 @@ async function transformSecretWrite(input) {
6220
6295
  }
6221
6296
  };
6222
6297
  }
6298
+ /** Is `ref` one of `owner`'s refs? */
6299
+ function isSecretRefOwnedBy(ref, owner) {
6300
+ return parseSecretRef(ref)?.owner === owner;
6301
+ }
6223
6302
  /**
6224
6303
  * Replace every marker in `value` with its keychain value. Returns the SAME
6225
6304
  * reference when there is no marker (no allocation, no keychain call).
6226
6305
  */
6227
- async function resolveSecretMarkers(value, secrets) {
6228
- const refs = collectSecretMarkerRefs(value);
6306
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6307
+ const keepMarker = options.unresolved === "keep-marker";
6308
+ const owner = options.ownedBy;
6309
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6310
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6229
6311
  if (refs.length === 0) return {
6230
6312
  value,
6231
6313
  unresolved: []
@@ -6249,10 +6331,18 @@ async function resolveSecretMarkers(value, secrets) {
6249
6331
  }
6250
6332
  const substitute = (v) => {
6251
6333
  if (isSecretMarker(v)) {
6334
+ if (!inScope(v.$secret)) return {
6335
+ keep: true,
6336
+ value: v
6337
+ };
6252
6338
  const answer = answers[v.$secret];
6253
- return answer?.kind === "value" ? {
6339
+ if (answer?.kind === "value") return {
6254
6340
  keep: true,
6255
6341
  value: answer.value
6342
+ };
6343
+ return keepMarker ? {
6344
+ keep: true,
6345
+ value: v
6256
6346
  } : {
6257
6347
  keep: false,
6258
6348
  value: void 0
@@ -6269,7 +6359,7 @@ async function resolveSecretMarkers(value, secrets) {
6269
6359
  value: items
6270
6360
  };
6271
6361
  }
6272
- if (isRecord(v)) {
6362
+ if (isRecord$1(v)) {
6273
6363
  const out = {};
6274
6364
  for (const [k, child] of Object.entries(v)) {
6275
6365
  const s = substitute(child);
@@ -6290,14 +6380,152 @@ async function resolveSecretMarkers(value, secrets) {
6290
6380
  unresolved
6291
6381
  };
6292
6382
  }
6293
- function touchesTree(tree, patch) {
6294
- if (tree.size === 0) return false;
6295
- for (const key of Object.keys(patch)) {
6296
- const at = key.indexOf("@");
6297
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6383
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6384
+ var SecretOverwriteRefusedError = class extends Error {
6385
+ ref;
6386
+ reason;
6387
+ constructor(ref, reason) {
6388
+ 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.`);
6389
+ this.ref = ref;
6390
+ this.reason = reason;
6391
+ this.name = "SecretOverwriteRefusedError";
6392
+ }
6393
+ };
6394
+ function isRecord(value) {
6395
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6396
+ }
6397
+ function resolvedValue(pass, marker) {
6398
+ const answer = pass.answers[marker.$secret];
6399
+ return answer?.kind === "value" ? answer.value : null;
6400
+ }
6401
+ async function atMarker(pass, incoming, stored) {
6402
+ if (incoming === null) return stored;
6403
+ if (typeof incoming !== "string") return incoming;
6404
+ if (incoming === resolvedValue(pass, stored)) return stored;
6405
+ const intent = classifySecretWrite(incoming);
6406
+ if (intent.kind !== "set") return stored;
6407
+ const ref = stored.$secret;
6408
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6409
+ const answer = pass.answers[ref];
6410
+ 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);
6411
+ try {
6412
+ await pass.secrets.put(ref, intent.value);
6413
+ } catch (err) {
6414
+ throw new KeychainWriteRefusedError(ref, err);
6415
+ }
6416
+ pass.changedRefs.push(ref);
6417
+ return stored;
6418
+ }
6419
+ function inArray(pass, incoming, stored) {
6420
+ return incoming.map((item, index) => {
6421
+ const twin = stored[index];
6422
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6423
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6424
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6425
+ return item;
6426
+ });
6427
+ }
6428
+ function inArrayRow(pass, incoming, stored) {
6429
+ const out = { ...incoming };
6430
+ for (const [key, value] of Object.entries(incoming)) {
6431
+ const twin = stored[key];
6432
+ if (isSecretMarker(twin)) {
6433
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6434
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6435
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6436
+ }
6437
+ return out;
6438
+ }
6439
+ async function walk(pass, incoming, stored) {
6440
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6441
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6442
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6443
+ const out = { ...incoming };
6444
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6445
+ return out;
6446
+ }
6447
+ /** Restore markers a write-back carries as values. See the file doc. */
6448
+ async function restoreUnchangedSecrets(input) {
6449
+ const refs = [];
6450
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6451
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6452
+ if (owned.length === 0) return {
6453
+ patch: input.patch,
6454
+ changedRefs: []
6455
+ };
6456
+ const pass = {
6457
+ secrets: input.secrets,
6458
+ answers: await input.secrets.resolve([...new Set(owned)]),
6459
+ operatorWrite: input.operatorWrite,
6460
+ changedRefs: []
6461
+ };
6462
+ const out = {};
6463
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6464
+ return {
6465
+ patch: out,
6466
+ changedRefs: pass.changedRefs
6467
+ };
6468
+ }
6469
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6470
+ function isJsonEqual(a, b) {
6471
+ if (Object.is(a, b)) return true;
6472
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6473
+ if (isRecord(a) && isRecord(b)) {
6474
+ const keys = Object.keys(a);
6475
+ if (keys.length !== Object.keys(b).length) return false;
6476
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6298
6477
  }
6299
6478
  return false;
6300
6479
  }
6480
+ /** The patch without the keys whose value already equals the stored one. */
6481
+ function dropUnchangedKeys(patch, stored) {
6482
+ const out = {};
6483
+ for (const [key, value] of Object.entries(patch)) {
6484
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6485
+ out[key] = value;
6486
+ }
6487
+ return out;
6488
+ }
6489
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6490
+ function markerKeysOf(blob, owner) {
6491
+ const keys = /* @__PURE__ */ new Set();
6492
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6493
+ return keys;
6494
+ }
6495
+ function nodeFromStored(value, owner) {
6496
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6497
+ if (!isRecord(value)) return null;
6498
+ const children = /* @__PURE__ */ new Map();
6499
+ for (const [key, child] of Object.entries(value)) {
6500
+ const node = nodeFromStored(child, owner);
6501
+ if (node !== null) children.set(key, node);
6502
+ }
6503
+ return children.size > 0 ? {
6504
+ kind: "object",
6505
+ children
6506
+ } : null;
6507
+ }
6508
+ /**
6509
+ * The declared secret tree, widened by every place the STORED blob holds a
6510
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6511
+ * never declared: Wyze before b4906cec6) still gets the save path's
6512
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6513
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6514
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6515
+ * builtin that keeps another addon's marker (device-manager) never takes it
6516
+ * over.
6517
+ */
6518
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6519
+ const added = /* @__PURE__ */ new Map();
6520
+ for (const key of keys) {
6521
+ const at = key.indexOf("@");
6522
+ const base = at > 0 ? key.slice(0, at) : key;
6523
+ if (declared.has(base) || added.has(base)) continue;
6524
+ const node = nodeFromStored(stored[key], owner);
6525
+ if (node !== null) added.set(base, node);
6526
+ }
6527
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6528
+ }
6301
6529
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6302
6530
  async function readStoredAddonBlob(raw) {
6303
6531
  const threeWay = raw.readAddonStoreResult;
@@ -6306,7 +6534,41 @@ async function readStoredAddonBlob(raw) {
6306
6534
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6307
6535
  return result.kind === "missing" ? {} : result.value;
6308
6536
  }
6309
- function createSecretAwareSettings(raw, opts) {
6537
+ function touchesTree(tree, patch) {
6538
+ if (tree.size === 0) return false;
6539
+ for (const key of Object.keys(patch)) {
6540
+ const at = key.indexOf("@");
6541
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6542
+ }
6543
+ return false;
6544
+ }
6545
+ /**
6546
+ * Which top-level keys of each store held markers when last seen. `undefined`
6547
+ * for a store not seen yet: its first write reads it, to be safe.
6548
+ */
6549
+ var MarkerKeyIndex = class {
6550
+ owner;
6551
+ byStore = /* @__PURE__ */ new Map();
6552
+ constructor(owner) {
6553
+ this.owner = owner;
6554
+ }
6555
+ seen(store, blob) {
6556
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6557
+ }
6558
+ wrote(store, patch) {
6559
+ const keys = this.byStore.get(store);
6560
+ if (keys === void 0) return;
6561
+ const now = markerKeysOf(patch, this.owner);
6562
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6563
+ else keys.delete(key);
6564
+ }
6565
+ mayHoldMarkers(store, patch) {
6566
+ const keys = this.byStore.get(store);
6567
+ if (keys === void 0) return true;
6568
+ return Object.keys(patch).some((key) => keys.has(key));
6569
+ }
6570
+ };
6571
+ function createHandle(raw, opts) {
6310
6572
  const chains = /* @__PURE__ */ new Map();
6311
6573
  const serialize = (key, fn) => {
6312
6574
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6317,46 +6579,130 @@ function createSecretAwareSettings(raw, opts) {
6317
6579
  });
6318
6580
  return next;
6319
6581
  };
6320
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6321
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6322
- return serialize(chainKey, async () => {
6582
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6583
+ const resolveRead = async (store, blob) => {
6584
+ index.seen(store, blob);
6585
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6586
+ unresolved: "keep-marker",
6587
+ ownedBy: opts.secrets.owner
6588
+ });
6589
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6590
+ return value;
6591
+ };
6592
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6593
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6594
+ await rawWrite(patch);
6595
+ index.wrote(store, patch);
6596
+ return { changed: true };
6597
+ }
6598
+ return serialize(store, async () => {
6323
6599
  const stored = await readStored();
6600
+ index.seen(store, stored);
6601
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6602
+ const restored = await restoreUnchangedSecrets({
6603
+ patch,
6604
+ stored,
6605
+ secrets: opts.secrets,
6606
+ operatorWrite
6607
+ });
6324
6608
  const result = await transformSecretWrite({
6325
- tree,
6609
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6326
6610
  secrets: opts.secrets,
6327
- patch,
6611
+ patch: restored.patch,
6328
6612
  stored,
6329
6613
  ...scope !== void 0 ? { scope } : {},
6330
- operatorWrite: opts.isOperatorWrite?.() === true
6614
+ operatorWrite
6331
6615
  });
6332
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6616
+ const effective = dropUnchangedKeys(result.patch, stored);
6617
+ const wroteBlob = Object.keys(effective).length > 0;
6618
+ if (wroteBlob) {
6619
+ await rawWrite(effective);
6620
+ index.wrote(store, effective);
6621
+ }
6333
6622
  const { orphaned } = await result.afterWrite();
6334
6623
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6624
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6335
6625
  });
6336
6626
  };
6337
- const wrapped = {
6338
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6339
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6340
- kind: "device",
6341
- deviceId
6342
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6627
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6628
+ const readAddonStoreResult = raw.readAddonStoreResult;
6629
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6630
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6631
+ const overrides = {
6632
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6633
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6634
+ const result = await readAddonStoreResult.call(raw);
6635
+ return result.kind === "value" ? {
6636
+ kind: "value",
6637
+ value: await resolveRead("addon", result.value)
6638
+ } : result;
6639
+ } } : {},
6640
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6641
+ const result = await readAddonStoreKeyResult.call(raw, key);
6642
+ if (result.kind !== "present") return result;
6643
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6644
+ unresolved: "keep-marker",
6645
+ ownedBy: opts.secrets.owner
6646
+ });
6647
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6648
+ return {
6649
+ kind: "present",
6650
+ value: value[key]
6651
+ };
6652
+ } } : {},
6653
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6654
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6655
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6656
+ const out = /* @__PURE__ */ new Map();
6657
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6658
+ return out;
6659
+ } } : {},
6660
+ writeAddonStore: async (patch) => {
6661
+ await writeAddon(patch);
6662
+ },
6663
+ writeDeviceStore: async (deviceId, patch) => {
6664
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6665
+ kind: "device",
6666
+ deviceId
6667
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6668
+ }
6669
+ };
6670
+ return {
6671
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6672
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6673
+ const value = Reflect.get(target, prop, receiver);
6674
+ return typeof value === "function" ? value.bind(target) : value;
6675
+ } }),
6676
+ raw: {
6677
+ readAddonStore: async () => {
6678
+ const blob = await raw.readAddonStore();
6679
+ index.seen("addon", blob);
6680
+ return blob;
6681
+ },
6682
+ readDeviceStore: async (deviceId) => {
6683
+ const blob = await raw.readDeviceStore(deviceId);
6684
+ index.seen(`device:${deviceId}`, blob);
6685
+ return blob;
6686
+ }
6687
+ },
6688
+ writeAddonStore: writeAddon
6343
6689
  };
6344
- return new Proxy(raw, { get(target, prop, receiver) {
6345
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6346
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6347
- const value = Reflect.get(target, prop, receiver);
6348
- return typeof value === "function" ? value.bind(target) : value;
6349
- } });
6350
6690
  }
6351
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6352
- function withSecretAwareSettings(context, opts) {
6691
+ /** The context the addon sees, plus the private raw view and write outcome. */
6692
+ function createSecretAwareContext(context, opts) {
6353
6693
  const raw = context.settings;
6354
- if (raw === void 0) return context;
6355
- const settings = createSecretAwareSettings(raw, opts);
6356
- return new Proxy(context, { get(target, prop, receiver) {
6357
- if (prop === "settings") return settings;
6358
- return Reflect.get(target, prop, receiver);
6359
- } });
6694
+ if (raw === void 0) return {
6695
+ context,
6696
+ handle: null
6697
+ };
6698
+ const handle = createHandle(raw, opts);
6699
+ return {
6700
+ context: new Proxy(context, { get(target, prop, receiver) {
6701
+ if (prop === "settings") return handle.settings;
6702
+ return Reflect.get(target, prop, receiver);
6703
+ } }),
6704
+ handle
6705
+ };
6360
6706
  }
6361
6707
  var LEAF = { kind: "leaf" };
6362
6708
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6531,6 +6877,14 @@ var BaseAddon = class {
6531
6877
  _secretChangeUnsub = null;
6532
6878
  /** >0 while an OPERATOR's settings write is being applied. */
6533
6879
  _operatorWriteDepth = 0;
6880
+ /**
6881
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6882
+ * to the marker-bearing blobs and stays private to this class: the form
6883
+ * hydrate and config resolution need markers, addon code never does.
6884
+ */
6885
+ _secretSettings = null;
6886
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6887
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6534
6888
  constructor(defaults) {
6535
6889
  this.defaults = defaults;
6536
6890
  this._config = { ...defaults };
@@ -6567,13 +6921,21 @@ var BaseAddon = class {
6567
6921
  }
6568
6922
  async initialize(context) {
6569
6923
  const secrets = context.secrets;
6570
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6571
- secrets,
6572
- addonTree: () => this.addonSecretTree(),
6573
- deviceTree: () => this.deviceSecretTree(),
6574
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6575
- isOperatorWrite: () => this._operatorWriteDepth > 0
6576
- }) : context;
6924
+ if (secrets !== void 0) {
6925
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6926
+ secrets,
6927
+ addonTree: () => this.addonSecretTree(),
6928
+ deviceTree: () => this.deviceSecretTree(),
6929
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6930
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6931
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6932
+ });
6933
+ this._ctx = wrapped;
6934
+ this._secretSettings = handle;
6935
+ } else {
6936
+ this._ctx = context;
6937
+ this._secretSettings = null;
6938
+ }
6577
6939
  await this.resolveConfig();
6578
6940
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6579
6941
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6690,11 +7052,8 @@ var BaseAddon = class {
6690
7052
  async getGlobalSettings(overlay, cap, nodeId) {
6691
7053
  const schema = this.globalSettingsSchema(cap);
6692
7054
  if (!schema) return { sections: [] };
6693
- const projected = await this.resolveGlobalStore(nodeId, cap);
6694
- return hydrateSchema(schema, overlay ? {
6695
- ...projected,
6696
- ...overlay
6697
- } : projected, { inlineSecretsAsViews: true });
7055
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7056
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6698
7057
  }
6699
7058
  /**
6700
7059
  * The integration-level view of this addon's settings: exactly the sections
@@ -6739,7 +7098,7 @@ var BaseAddon = class {
6739
7098
  });
6740
7099
  }
6741
7100
  if (sections.length === 0) return null;
6742
- const projected = await this.resolveGlobalStore(nodeId);
7101
+ const projected = await this.readRawProjectedStore(nodeId);
6743
7102
  return hydrateSchema({
6744
7103
  ...schema,
6745
7104
  sections
@@ -6756,12 +7115,50 @@ var BaseAddon = class {
6756
7115
  * the store for custom option logic (option narrowing, value snapping) to
6757
7116
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6758
7117
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7118
+ *
7119
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7120
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7121
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7122
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7123
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7124
+ * resolved blob back is a no-op for every unchanged secret.
6759
7125
  */
6760
7126
  async resolveGlobalStore(nodeId, cap) {
6761
7127
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7128
+ return this.projectForNode(raw, nodeId, cap);
7129
+ }
7130
+ projectForNode(store, nodeId, cap) {
6762
7131
  const keys = this.perNodeKeys(cap);
6763
7132
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6764
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7133
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7134
+ }
7135
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7136
+ async readRawProjectedStore(nodeId, cap) {
7137
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7138
+ return this.projectForNode(raw, nodeId, cap);
7139
+ }
7140
+ /**
7141
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7142
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7143
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7144
+ * its value.
7145
+ */
7146
+ async overlayKeepingMarkers(stored, overlay) {
7147
+ const secrets = this._ctx?.secrets;
7148
+ const merged = {
7149
+ ...stored,
7150
+ ...overlay
7151
+ };
7152
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7153
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7154
+ unresolved: "keep-marker",
7155
+ ownedBy: secrets.owner
7156
+ });
7157
+ for (const key of Object.keys(overlay)) {
7158
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7159
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7160
+ }
7161
+ return merged;
6765
7162
  }
6766
7163
  /**
6767
7164
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6826,8 +7223,12 @@ var BaseAddon = class {
6826
7223
  async clearSecrets(keys, nodeId) {
6827
7224
  const tree = this.addonSecretTree();
6828
7225
  const keychain = this._ctx?.secrets !== void 0;
7226
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6829
7227
  const patch = {};
6830
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7228
+ for (const key of keys) {
7229
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7230
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7231
+ }
6831
7232
  await this.applyGlobalPatch(patch, nodeId);
6832
7233
  }
6833
7234
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6835,7 +7236,11 @@ var BaseAddon = class {
6835
7236
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6836
7237
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6837
7238
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6838
- await this._ctx?.settings?.writeAddonStore(scoped);
7239
+ const handle = this._secretSettings;
7240
+ if (handle !== null) {
7241
+ const { changed } = await handle.writeAddonStore(scoped);
7242
+ if (!changed) return;
7243
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6839
7244
  if (target !== localNode) return;
6840
7245
  await this.resolveConfig();
6841
7246
  await this.onConfigChanged();
@@ -6888,7 +7293,7 @@ var BaseAddon = class {
6888
7293
  async getDeviceSettings(deviceId) {
6889
7294
  const schema = this.deviceSettingsSchema();
6890
7295
  if (!schema) return { sections: [] };
6891
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7296
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6892
7297
  }
6893
7298
  async updateDeviceSettings(deviceId, patch) {
6894
7299
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7060,7 +7465,7 @@ var BaseAddon = class {
7060
7465
  key,
7061
7466
  schema,
7062
7467
  fallback,
7063
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7468
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7064
7469
  write: async (patch) => {
7065
7470
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7066
7471
  },
@@ -7122,6 +7527,23 @@ var BaseAddon = class {
7122
7527
  }
7123
7528
  return value;
7124
7529
  }
7530
+ /**
7531
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7532
+ * keychain the context's own view is already raw.
7533
+ */
7534
+ rawSettings() {
7535
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7536
+ }
7537
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7538
+ logUnresolvedRead(unresolved) {
7539
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7540
+ if (fresh.length === 0) return;
7541
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7542
+ 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) => ({
7543
+ ref: u.ref,
7544
+ reason: u.reason
7545
+ })) } });
7546
+ }
7125
7547
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7126
7548
  scheduleSecretReresolve(delayMs) {
7127
7549
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7148,7 +7570,7 @@ var BaseAddon = class {
7148
7570
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7149
7571
  */
7150
7572
  async readAddonStoreWithRetry() {
7151
- const settings = this._ctx?.settings;
7573
+ const settings = this.rawSettings();
7152
7574
  if (!settings) return {};
7153
7575
  const delaysMs = [
7154
7576
  150,
@@ -9501,6 +9923,278 @@ var CameraSwitchGroupSchema = object({
9501
9923
  fetchedAt: number()
9502
9924
  });
9503
9925
  /**
9926
+ * The trainer contract — what the hub hands the cloud trainer and what it
9927
+ * gets back (cloud training, D805+).
9928
+ *
9929
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
9930
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
9931
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
9932
+ * lines on stdout. These schemas are the hub's half of that boundary; the
9933
+ * trainer's pydantic models (and the JSON Schemas generated from them under
9934
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
9935
+ * change there, in the same piece of work.
9936
+ *
9937
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
9938
+ * orchestrator fills every field of a job spec explicitly.
9939
+ */
9940
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
9941
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
9942
+ /** What the trainer can export. Edge TPU is a later, separate image. */
9943
+ var TrainingExportSchema = _enum([
9944
+ "onnx",
9945
+ "openvino-fp16",
9946
+ "openvino-int8",
9947
+ "coreml-fp16"
9948
+ ]);
9949
+ var FloorsSchema = record(string(), number().min(0).max(1));
9950
+ object({
9951
+ schema: literal(TRAINING_JOB_SCHEMA),
9952
+ jobKey: string().uuid(),
9953
+ target: object({
9954
+ kind: literal("detector"),
9955
+ step: literal("object-detection")
9956
+ }),
9957
+ base: object({
9958
+ modelId: string().min(1),
9959
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
9960
+ weights: string().min(1),
9961
+ imgsz: number().int().positive()
9962
+ }),
9963
+ baseline: object({
9964
+ modelId: string().min(1),
9965
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
9966
+ onnxUrl: string().url(),
9967
+ imgsz: number().int().positive(),
9968
+ floors: FloorsSchema
9969
+ }),
9970
+ dataset: object({
9971
+ versionId: string().min(1),
9972
+ annotationHash: string(),
9973
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
9974
+ sha256: string().regex(/^[0-9a-f]{64}$/)
9975
+ }),
9976
+ split: object({
9977
+ holdoutCameras: array(number().int()),
9978
+ /** When no camera is held out: the last N days of every camera. */
9979
+ holdoutLastDays: number().int().nonnegative(),
9980
+ valFraction: number().min(0).max(.5),
9981
+ seed: number().int()
9982
+ }),
9983
+ hyper: object({
9984
+ epochs: number().int().positive(),
9985
+ batch: number().int().positive(),
9986
+ lr0: number().positive(),
9987
+ /** Layers frozen from the start of the backbone; 0 = none. */
9988
+ freeze: number().int().nonnegative(),
9989
+ patience: number().int().nonnegative(),
9990
+ seed: number().int()
9991
+ }),
9992
+ replay: object({
9993
+ source: literal("coco2017"),
9994
+ count: number().int().nonnegative()
9995
+ }),
9996
+ exports: array(TrainingExportSchema).min(1),
9997
+ calibration: object({ maxFrames: number().int().positive() }),
9998
+ floors: object({
9999
+ minSupport: number().int().positive(),
10000
+ clamp: number().min(0).max(1)
10001
+ }),
10002
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
10003
+ catalog: object({
10004
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
10005
+ name: string().min(1).max(160)
10006
+ })
10007
+ });
10008
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
10009
+ var TrainingResultFileSchema = object({
10010
+ path: string().min(1),
10011
+ bytes: number().int().nonnegative(),
10012
+ sha256: string().regex(/^[0-9a-f]{64}$/),
10013
+ format: _enum([
10014
+ "onnx",
10015
+ "openvino",
10016
+ "coreml",
10017
+ "pt"
10018
+ ]),
10019
+ variant: _enum(["base", "int8"])
10020
+ });
10021
+ var DraftFormatSchema = object({
10022
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
10023
+ url: string().min(1),
10024
+ sizeMB: number().nonnegative(),
10025
+ isDirectory: boolean().optional(),
10026
+ files: array(string()).optional(),
10027
+ runtimes: array(literal("python")).optional(),
10028
+ revision: string().min(1)
10029
+ });
10030
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
10031
+ var TrainingCatalogDraftSchema = object({
10032
+ id: string().min(1),
10033
+ name: string().min(1),
10034
+ description: string(),
10035
+ labels: array(unknown()),
10036
+ inputSize: object({
10037
+ width: number().int().positive(),
10038
+ height: number().int().positive()
10039
+ }),
10040
+ preprocessMode: literal("letterbox"),
10041
+ defaultClassFloors: FloorsSchema,
10042
+ formats: object({
10043
+ onnx: DraftFormatSchema.optional(),
10044
+ openvino: DraftFormatSchema.optional(),
10045
+ coreml: DraftFormatSchema.optional()
10046
+ })
10047
+ });
10048
+ /** One class of one model's holdout report (the eval harness's summary). */
10049
+ var TrainingEvalClassSchema = object({
10050
+ positives: number().int(),
10051
+ floor: number().nullable(),
10052
+ tp: number().int(),
10053
+ fp: number().int(),
10054
+ fn: number().int(),
10055
+ precision: number().nullable(),
10056
+ recall: number().nullable(),
10057
+ ap50: number().nullable(),
10058
+ recallByCamera: record(string(), number().nullable()).optional(),
10059
+ recallByLight: record(string(), number().nullable()).optional(),
10060
+ fpByCamera: record(string(), number()).optional(),
10061
+ smallFound: number().int().optional(),
10062
+ smallTotal: number().int().optional()
10063
+ }).passthrough();
10064
+ var TrainingEvalReportSchema = object({
10065
+ frames: number().int(),
10066
+ classes: record(string(), TrainingEvalClassSchema)
10067
+ }).passthrough();
10068
+ /**
10069
+ * A succeeded result carries every block; a failed one carries the error and
10070
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10071
+ * orchestrator checks the blocks it needs before it trusts a success.
10072
+ */
10073
+ var TrainingResultSchema = object({
10074
+ schema: literal(TRAINING_RESULT_SCHEMA),
10075
+ jobKey: string(),
10076
+ status: _enum(["succeeded", "failed"]),
10077
+ error: object({
10078
+ stage: string(),
10079
+ code: string(),
10080
+ message: string()
10081
+ }).nullable(),
10082
+ trainer: object({
10083
+ version: string(),
10084
+ revision: string()
10085
+ }),
10086
+ toolchain: record(string(), string().nullable()),
10087
+ dataset: object({
10088
+ versionId: string(),
10089
+ annotationHash: string(),
10090
+ sha256: string(),
10091
+ frames: object({
10092
+ train: number().int(),
10093
+ val: number().int(),
10094
+ holdout: number().int()
10095
+ }),
10096
+ holdoutCameras: array(number().int()),
10097
+ replayImages: number().int()
10098
+ }).optional(),
10099
+ training: object({
10100
+ epochsRun: number().int(),
10101
+ bestEpoch: number().int(),
10102
+ bestMap50: number(),
10103
+ bestMap50_95: number(),
10104
+ seconds: number()
10105
+ }).optional(),
10106
+ evaluation: object({
10107
+ holdoutFrames: number().int(),
10108
+ baseline: TrainingEvalReportSchema.nullable(),
10109
+ candidate: TrainingEvalReportSchema.nullable(),
10110
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10111
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10112
+ map50: record(string(), number().nullable())
10113
+ }).optional(),
10114
+ floors: object({
10115
+ baseline: FloorsSchema,
10116
+ candidate: FloorsSchema,
10117
+ candidateInt8: FloorsSchema.nullable(),
10118
+ notes: array(string())
10119
+ }).optional(),
10120
+ int8: object({
10121
+ kept: boolean(),
10122
+ map50Fp16: number().nullable(),
10123
+ map50Int8: number().nullable(),
10124
+ reason: string().nullable()
10125
+ }).optional(),
10126
+ exportsDropped: array(object({
10127
+ export: string(),
10128
+ reason: string()
10129
+ })).optional(),
10130
+ files: array(TrainingResultFileSchema).optional(),
10131
+ bundle: object({
10132
+ path: literal("bundle.tar"),
10133
+ bytes: number().int().nonnegative(),
10134
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10135
+ }).nullable().optional(),
10136
+ catalogDraft: object({
10137
+ base: TrainingCatalogDraftSchema,
10138
+ int8: TrainingCatalogDraftSchema.nullable()
10139
+ }).nullable().optional(),
10140
+ licence: string()
10141
+ });
10142
+ var TrainingStageSchema = _enum([
10143
+ "prepare",
10144
+ "replay",
10145
+ "train",
10146
+ "eval",
10147
+ "export",
10148
+ "package"
10149
+ ]);
10150
+ var EventBase = {
10151
+ v: literal(1),
10152
+ ts: number()
10153
+ };
10154
+ discriminatedUnion("type", [
10155
+ object({
10156
+ ...EventBase,
10157
+ type: literal("stage"),
10158
+ stage: TrainingStageSchema
10159
+ }),
10160
+ object({
10161
+ ...EventBase,
10162
+ type: literal("epoch"),
10163
+ epoch: number().int(),
10164
+ epochs: number().int(),
10165
+ boxLoss: number().nullable().optional(),
10166
+ map50: number().nullable().optional(),
10167
+ map50_95: number().nullable().optional(),
10168
+ etaSec: number().nullable().optional()
10169
+ }),
10170
+ object({
10171
+ ...EventBase,
10172
+ type: literal("metric"),
10173
+ name: string(),
10174
+ value: number()
10175
+ }),
10176
+ object({
10177
+ ...EventBase,
10178
+ type: literal("artifact"),
10179
+ path: string(),
10180
+ bytes: number(),
10181
+ sha256: string()
10182
+ }),
10183
+ object({
10184
+ ...EventBase,
10185
+ type: literal("done"),
10186
+ status: _enum(["succeeded", "failed"]),
10187
+ resultSha256: string().nullable().optional()
10188
+ }),
10189
+ object({
10190
+ ...EventBase,
10191
+ type: literal("error"),
10192
+ stage: string(),
10193
+ code: string(),
10194
+ message: string()
10195
+ })
10196
+ ]);
10197
+ /**
9504
10198
  * What the gate decided about a birth, from the CALLER's point of view.
9505
10199
  *
9506
10200
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11548,6 +12242,20 @@ var ConvertResultSchema = object({
11548
12242
  files: array(string()).readonly()
11549
12243
  })).readonly()
11550
12244
  });
12245
+ /**
12246
+ * The cookie that binds an SSO sign-in to the browser that started it.
12247
+ *
12248
+ * An IdP `/start` sets it to a random value and keeps only its SHA-256 in the
12249
+ * server-side pending state; the login bridge carries that hash. The hub's
12250
+ * `/api/auth/sso/finish` swaps a bridge for a session only when the request
12251
+ * presents the cookie whose hash the bridge names — so a bridge copied out of
12252
+ * a URL (history, a proxy log, a screenshot) is useless in any other browser.
12253
+ * The finish clears the cookie, and records the bridge's `jti` so the same
12254
+ * bridge never finishes twice.
12255
+ *
12256
+ * One name, two readers (the OIDC addon that sets it, the hub that checks it).
12257
+ */
12258
+ var SSO_STATE_COOKIE = "camstack_sso_state";
11551
12259
  var ExpressionBindingSourceSchema = union([
11552
12260
  object({
11553
12261
  kind: literal("field").optional(),
@@ -11828,7 +12536,9 @@ var AddonHttpRouteSchema = object({
11828
12536
  "authenticated",
11829
12537
  "admin"
11830
12538
  ]).optional(),
11831
- description: string().optional()
12539
+ description: string().optional(),
12540
+ /** The hub limits this route per client address before the handler runs. */
12541
+ rateLimit: _enum(["auth"]).optional()
11832
12542
  });
11833
12543
  /**
11834
12544
  * Cross-process route invocation envelope. The hub captures the
@@ -12584,6 +13294,37 @@ var BackupDestinationInfoSchema = object({
12584
13294
  lastError: string().optional()
12585
13295
  });
12586
13296
  /**
13297
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13298
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13299
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13300
+ * with it off — which restores without a key.
13301
+ */
13302
+ var BackupArchiveEncryptionSchema = object({
13303
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13304
+ scheme: string(),
13305
+ /** 16 hex — the backup key whose secret restores this archive. */
13306
+ keyId: string()
13307
+ });
13308
+ /**
13309
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13310
+ * one new archives are encrypted to, and the retired ones older archives
13311
+ * still need. The secret key is shown once, at `setupEncryption`.
13312
+ */
13313
+ var BackupEncryptionStatusSchema = object({
13314
+ enabled: boolean(),
13315
+ active: object({
13316
+ keyId: string(),
13317
+ publicKey: string(),
13318
+ createdAt: number()
13319
+ }).nullable(),
13320
+ /** Every key ever set up, newest first. */
13321
+ keys: array(object({
13322
+ keyId: string(),
13323
+ createdAt: number(),
13324
+ retiredAt: number().nullable()
13325
+ })).readonly()
13326
+ });
13327
+ /**
12587
13328
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12588
13329
  * Same shape the destination drill-in renders. Sourced from the per-
12589
13330
  * location `manifests.json` (no per-archive tarball read required).
@@ -12595,7 +13336,9 @@ var BackupArchiveEntrySchema = object({
12595
13336
  sizeBytes: number(),
12596
13337
  label: string().optional(),
12597
13338
  /** Top-level locations included in the archive (db, addons, tls, …). */
12598
- locations: array(string()).readonly()
13339
+ locations: array(string()).readonly(),
13340
+ /** Present when the archive is encrypted; restore then needs that key. */
13341
+ encryption: BackupArchiveEncryptionSchema.optional()
12599
13342
  });
12600
13343
  var BackupEntrySchema = object({
12601
13344
  id: string(),
@@ -12604,7 +13347,8 @@ var BackupEntrySchema = object({
12604
13347
  label: string().optional(),
12605
13348
  createdAt: number(),
12606
13349
  sizeBytes: number(),
12607
- locations: array(string()).optional()
13350
+ locations: array(string()).optional(),
13351
+ encryption: BackupArchiveEncryptionSchema.optional()
12608
13352
  });
12609
13353
  var ArchiveEntrySchema = object({
12610
13354
  path: string(),
@@ -12793,10 +13537,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12793
13537
  * this list and skips entries whose path doesn't start with
12794
13538
  * any of them.
12795
13539
  */
12796
- locations: array(string()).optional()
13540
+ locations: array(string()).optional(),
13541
+ /**
13542
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13543
+ * one). The archive is decrypted into the hub's private staging
13544
+ * before the restart; the key is not stored. A wrong or missing key
13545
+ * is refused before the archive is downloaded.
13546
+ */
13547
+ backupSecretKey: string().optional()
12797
13548
  }), _void(), {
12798
13549
  kind: "mutation",
12799
13550
  auth: "admin"
13551
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13552
+ keyId: string(),
13553
+ secretKey: string(),
13554
+ publicKey: string(),
13555
+ createdAt: number(),
13556
+ replacedKeyId: string().nullable()
13557
+ }), {
13558
+ kind: "mutation",
13559
+ auth: "admin"
13560
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13561
+ kind: "mutation",
13562
+ auth: "admin"
13563
+ }), method(object({ backupSecretKey: string() }), object({
13564
+ valid: boolean(),
13565
+ keyId: string().nullable(),
13566
+ /** The hub knows this key (active or retired). */
13567
+ known: boolean(),
13568
+ /** It is the key new archives are encrypted to. */
13569
+ active: boolean(),
13570
+ error: string().optional()
13571
+ }), {
13572
+ kind: "mutation",
13573
+ auth: "admin"
12800
13574
  }), method(object({
12801
13575
  destinationId: string(),
12802
13576
  backupId: string()
@@ -14420,7 +15194,60 @@ var CustomModelDescriptorSchema = object({
14420
15194
  stepId: string(),
14421
15195
  entry: ModelCatalogEntrySchema
14422
15196
  });
14423
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15197
+ /** One regular file of an imported bundle, as the producer measured it. */
15198
+ var ModelBundleFileSchema = object({
15199
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15200
+ path: string().min(1),
15201
+ bytes: number().int().nonnegative(),
15202
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15203
+ });
15204
+ var ImportModelBundleInputSchema = object({
15205
+ /** The registry provider that keeps the model (Model Studio). */
15206
+ addonId: string(),
15207
+ stepId: string().min(1),
15208
+ /**
15209
+ * The catalog rows to register, complete, every format URL already
15210
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15211
+ * bundle may carry several rows (a base and its INT8 variant).
15212
+ */
15213
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15214
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15215
+ bundle: object({
15216
+ ticket: PeerBytesTicketSchema,
15217
+ bytes: number().int().positive(),
15218
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15219
+ }),
15220
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15221
+ files: array(ModelBundleFileSchema).min(1).max(64),
15222
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15223
+ distribute: boolean()
15224
+ });
15225
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15226
+ kind: literal("imported"),
15227
+ modelIds: array(string()).readonly(),
15228
+ distributed: array(object({
15229
+ modelId: string(),
15230
+ nodeId: string(),
15231
+ format: _enum(MODEL_FORMATS),
15232
+ ok: boolean(),
15233
+ error: string().optional()
15234
+ })).readonly()
15235
+ }), object({
15236
+ kind: literal("refused"),
15237
+ reason: _enum([
15238
+ "transfer-failed",
15239
+ "checksum-mismatch",
15240
+ "bundle-mismatch",
15241
+ "invalid-entry",
15242
+ "id-taken"
15243
+ ]),
15244
+ detail: string()
15245
+ })]);
15246
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15247
+ kind: "mutation",
15248
+ auth: "admin",
15249
+ timeoutMs: 30 * 6e4
15250
+ });
14424
15251
  /**
14425
15252
  * Query filter for settings-store collections.
14426
15253
  */
@@ -14899,6 +15726,35 @@ var KeychainKeySourceSchema = object({
14899
15726
  */
14900
15727
  sharesBackupWithDatabase: boolean()
14901
15728
  });
15729
+ /**
15730
+ * One keychain reset, as the Secrets page reports it until the operator
15731
+ * acknowledges it. Never a value: refs, counts and table names only.
15732
+ */
15733
+ var KeychainResetRecordSchema = object({
15734
+ id: string(),
15735
+ at: number(),
15736
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15737
+ actor: string(),
15738
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15739
+ lockedReason: string().nullable(),
15740
+ /** Values moved into the archive table (ciphertext under the lost key). */
15741
+ archived: number().int(),
15742
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15743
+ archivedCollection: string().nullable(),
15744
+ /**
15745
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15746
+ * so the archive can still be opened if the lost master key turns up.
15747
+ */
15748
+ archivedKeysCollection: string().nullable(),
15749
+ /**
15750
+ * `system-settings` keys whose marker the reset cleared — the cluster
15751
+ * secret's: a marker left pointing at an archived value would refuse every
15752
+ * agent forever (D797).
15753
+ */
15754
+ clearedSettingsKeys: array(string()).readonly(),
15755
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15756
+ acknowledgedAt: number().nullable()
15757
+ });
14902
15758
  var KeychainStatusSchema = object({
14903
15759
  keychain: KeychainStateSchema,
14904
15760
  /** The source of the master key in use; `null` while locked. */
@@ -14916,7 +15772,9 @@ var KeychainStatusSchema = object({
14916
15772
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
14917
15773
  retiredWraps: number().int(),
14918
15774
  recoveryKeyDownloadedAt: number().nullable(),
14919
- secretCount: number().int()
15775
+ secretCount: number().int(),
15776
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15777
+ lastReset: KeychainResetRecordSchema.nullable()
14920
15778
  });
14921
15779
  /**
14922
15780
  * Whether a stored value is still pointed at by its owner's settings.
@@ -14938,13 +15796,14 @@ var KeychainAuditActionSchema = _enum([
14938
15796
  "download-recovery-key",
14939
15797
  "delete-orphans",
14940
15798
  "reset",
15799
+ "acknowledge-reset",
14941
15800
  "initialize"
14942
15801
  ]);
14943
15802
  var KeychainAuditEntrySchema = object({
14944
15803
  id: string(),
14945
15804
  at: number(),
14946
15805
  action: KeychainAuditActionSchema,
14947
- /** `addon:<id>` | `user:<id>` | `system`. */
15806
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
14948
15807
  actor: string(),
14949
15808
  ref: string().nullable(),
14950
15809
  detail: string().nullable()
@@ -15010,6 +15869,13 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15010
15869
  kind: "mutation",
15011
15870
  auth: "admin",
15012
15871
  caller: "required"
15872
+ }), method(object({}), object({
15873
+ reset: KeychainResetRecordSchema.nullable(),
15874
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15875
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15876
+ kind: "mutation",
15877
+ auth: "admin",
15878
+ caller: "required"
15013
15879
  });
15014
15880
  method(_void(), object({
15015
15881
  id: string(),
@@ -17655,7 +18521,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17655
18521
  * `login-method` — collection cap through which auth addons contribute
17656
18522
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17657
18523
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17658
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18524
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17659
18525
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17660
18526
  * procedure aggregates them for the unauthenticated login page.
17661
18527
  *
@@ -17663,8 +18529,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17663
18529
  *
17664
18530
  * - `redirect` — a declarative button. The login page renders a generic
17665
18531
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17666
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17667
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18532
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17668
18533
  * login page needs NO change.
17669
18534
  *
17670
18535
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -17683,8 +18548,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17683
18548
  * decision.
17684
18549
  *
17685
18550
  * Every contribution carries a `stage`:
17686
- * - `primary` — shown on the first credentials screen (OIDC /
17687
- * magic-link buttons; a future usernameless passkey).
18551
+ * - `primary` — shown on the first credentials screen (OIDC
18552
+ * buttons; a usernameless passkey).
17688
18553
  * - `second-factor` — shown AFTER the password leg, gated on the
17689
18554
  * returned `factors` (passkey-as-2FA today).
17690
18555
  *
@@ -17711,7 +18576,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17711
18576
  * The provider names an external identity a signed-in user can link to
17712
18577
  * their own account (D782): `auth.listLinkableProviders` /
17713
18578
  * `beginExternalLink` offer exactly the redirect methods that set this,
17714
- * whatever their id. Absent / false — a login button only (magic-link).
18579
+ * whatever their id. Absent / false — a login button only.
17715
18580
  */
17716
18581
  linkable: boolean().optional()
17717
18582
  }),
@@ -21536,8 +22401,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21536
22401
  * `super_admin` — collapsed onto the single boolean because every
21537
22402
  * non-admin caller is governed by the same scope-check rules; the
21538
22403
  * distinction was only ever used to route role-specific procedures
21539
- * which we no longer have. Agents are admin sessions issued via
21540
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22404
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21541
22405
  * with `isAdmin: false` + an explicit scope list.
21542
22406
  */
21543
22407
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -24232,6 +25096,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24232
25096
  kind: "mutation",
24233
25097
  auth: "admin",
24234
25098
  timeoutMs: 60 * 6e4
25099
+ }), method(object({
25100
+ filter: RetrainExportFilterSchema,
25101
+ layout: RetrainExportLayoutSchema
25102
+ }), object({
25103
+ ticket: PeerBytesTicketSchema,
25104
+ frames: number().int(),
25105
+ annotations: number().int()
25106
+ }), {
25107
+ kind: "mutation",
25108
+ auth: "admin",
25109
+ timeoutMs: 12e4
24235
25110
  }), method(object({
24236
25111
  selection: RetrainDatasetSelectionSchema,
24237
25112
  completeOnly: boolean().optional()
@@ -27800,8 +28675,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
27800
28675
  * `smtp-provider` — pluggable email delivery surface.
27801
28676
  *
27802
28677
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
27803
- * one for transactional / one for notifications). Consumers (magic-link,
27804
- * notifier addons, …) walk the collection and pick the first
28678
+ * one for transactional / one for notifications). Consumers (notifier
28679
+ * addons, …) walk the collection and pick the first
27805
28680
  * ready provider OR target a specific addonId.
27806
28681
  *
27807
28682
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -27980,7 +28855,7 @@ targets: array(object({
27980
28855
  })));
27981
28856
  /**
27982
28857
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
27983
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
28858
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
27984
28859
  * carrying the post-callback claims before redirecting back to
27985
28860
  * `/api/auth/sso/finish`.
27986
28861
  *
@@ -28043,7 +28918,14 @@ var SsoBridgeClaimsSchema = object({
28043
28918
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28044
28919
  * subject is unique only per issuer, so a link is bound to it.
28045
28920
  */
28046
- issuer: string().optional()
28921
+ issuer: string().optional(),
28922
+ /**
28923
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
28924
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
28925
+ * request to present the matching cookie — a login bridge is useless in
28926
+ * any other browser.
28927
+ */
28928
+ browserBinding: string().optional()
28047
28929
  });
28048
28930
  method(object({
28049
28931
  claims: SsoBridgeClaimsSchema,
@@ -33970,7 +34852,13 @@ var TopologyNodeSchema = object({
33970
34852
  })).readonly(),
33971
34853
  processes: array(TopologyProcessSchema).readonly(),
33972
34854
  categories: array(TopologyCategorySchema).readonly(),
33973
- rootPackage: TopologyRootPackageSchema.nullable()
34855
+ rootPackage: TopologyRootPackageSchema.nullable(),
34856
+ /**
34857
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
34858
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
34859
+ * for offline rows and when the hub cannot tell.
34860
+ */
34861
+ meshTransport: _enum(["tls", "clear"]).optional()
33974
34862
  });
33975
34863
  var CapUsageEdgeSchema = object({
33976
34864
  callerAddonId: string(),
@@ -37998,16 +38886,6 @@ var ApiKeySummarySchema = object({
37998
38886
  createdAt: number(),
37999
38887
  lastUsedAt: number().optional()
38000
38888
  });
38001
- var CreateApiKeyInputSchema = object({
38002
- label: string(),
38003
- isAdmin: boolean().default(false),
38004
- allowedProviders: union([array(string()), literal("*")]).optional(),
38005
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
38006
- });
38007
- var CreateApiKeyResultSchema = object({
38008
- token: string(),
38009
- record: ApiKeySummarySchema
38010
- });
38011
38889
  var ScopedTokenSummarySchema = object({
38012
38890
  id: string(),
38013
38891
  userId: string(),
@@ -38106,17 +38984,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
38106
38984
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
38107
38985
  kind: "mutation",
38108
38986
  access: "view"
38109
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
38110
- kind: "mutation",
38111
- auth: "admin",
38112
- access: "create"
38113
- }), method(object({ id: string() }), object({ success: literal(true) }), {
38987
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
38114
38988
  kind: "mutation",
38115
38989
  auth: "admin",
38116
38990
  access: "delete"
38117
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
38118
- kind: "mutation",
38119
- access: "view"
38120
38991
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
38121
38992
  kind: "mutation",
38122
38993
  auth: "admin",
@@ -38190,15 +39061,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
38190
39061
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
38191
39062
  userId: string(),
38192
39063
  issuer: string()
38193
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
38194
- userId: string(),
38195
- issuer: string().min(1),
38196
- label: string().optional()
38197
- }), object({ success: literal(true) }), {
38198
- kind: "mutation",
38199
- auth: "admin",
38200
- access: "create"
38201
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
39064
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
38202
39065
  kind: "mutation",
38203
39066
  auth: "admin",
38204
39067
  access: "delete"
@@ -38593,6 +39456,451 @@ DeviceType.Camera, method(object({
38593
39456
  detection: array(ZoneRuleSchema).readonly(),
38594
39457
  package: array(ZoneRuleSchema).readonly()
38595
39458
  });
39459
+ /**
39460
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
39461
+ *
39462
+ * A thin, mockable translation layer: it knows how to run a container with a
39463
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
39464
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
39465
+ * those are the `training` orchestrator's (D805). Every rule written there
39466
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
39467
+ * manifest entry and nothing else.
39468
+ *
39469
+ * Collection, routed by the `addonId` in every single-row input (the `llm` /
39470
+ * `notification-output` posture); `describe` concat-fans across providers.
39471
+ * Every method is `admin`: these spend money.
39472
+ *
39473
+ * Every cloud object a provider creates is tagged with the orchestrator's
39474
+ * `jobKey`, so a retried submit finds the job it already started instead of
39475
+ * starting a second GPU, and `listJobs` can find orphans.
39476
+ *
39477
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
39478
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
39479
+ * ticket the provider mints (D613).
39480
+ */
39481
+ var TrainingGpuOptionSchema = object({
39482
+ id: string(),
39483
+ label: string(),
39484
+ /** List price, USD per GPU-hour, before any region multiplier. */
39485
+ usdPerHour: number().nonnegative(),
39486
+ vramGb: number().nonnegative()
39487
+ });
39488
+ var TrainingRegionOptionSchema = object({
39489
+ /** `''` = any region (the provider's choice). */
39490
+ id: string(),
39491
+ label: string(),
39492
+ priceMultiplier: number().positive()
39493
+ });
39494
+ /**
39495
+ * The provider's per-account settings, as the orchestrator reads them. They
39496
+ * live in the PROVIDER addon's settings (operator decision 2026-10-08: they
39497
+ * depend on the user's account), never hard-coded in the orchestrator.
39498
+ */
39499
+ var TrainingProviderDefaultsSchema = object({
39500
+ gpuType: string(),
39501
+ region: string(),
39502
+ costCapUsd: number().nonnegative(),
39503
+ maxRuntimeSec: number().int().positive(),
39504
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
39505
+ failedDatasetGraceHours: number().nonnegative()
39506
+ });
39507
+ var TrainingProviderDescriptorSchema = object({
39508
+ addonId: string(),
39509
+ /** `modal`, `runpod`, `fake`, … */
39510
+ kind: string(),
39511
+ label: string(),
39512
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
39513
+ regions: array(TrainingRegionOptionSchema).readonly(),
39514
+ maxDatasetBytes: number().int().positive(),
39515
+ maxRuntimeSec: number().int().positive(),
39516
+ freeTierNote: string().optional(),
39517
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
39518
+ dataResidencyNote: string(),
39519
+ /** Credentials are present — never the values. */
39520
+ configured: boolean(),
39521
+ defaults: TrainingProviderDefaultsSchema
39522
+ });
39523
+ var TrainingCredentialCheckSchema = object({
39524
+ ok: boolean(),
39525
+ /** Workspace / account name, when the provider says. */
39526
+ account: string().optional(),
39527
+ reason: _enum([
39528
+ "missing",
39529
+ "invalid",
39530
+ "forbidden",
39531
+ "network",
39532
+ "quota"
39533
+ ]).optional(),
39534
+ detail: string().optional()
39535
+ });
39536
+ var ProviderJobStateSchema = _enum([
39537
+ "pending",
39538
+ "starting",
39539
+ "running",
39540
+ "succeeded",
39541
+ "failed",
39542
+ "cancelled",
39543
+ "lost"
39544
+ ]);
39545
+ var ProviderJobStatusSchema = object({
39546
+ jobKey: string(),
39547
+ providerJobId: string().optional(),
39548
+ state: ProviderJobStateSchema,
39549
+ startedAt: number().optional(),
39550
+ endedAt: number().optional(),
39551
+ exitCode: number().int().optional(),
39552
+ failureReason: string().optional(),
39553
+ gpuType: string(),
39554
+ region: string().optional(),
39555
+ billedSeconds: number().nonnegative(),
39556
+ costUsd: number().nonnegative(),
39557
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
39558
+ costIsEstimate: boolean(),
39559
+ lastFetchedAt: number()
39560
+ });
39561
+ /**
39562
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
39563
+ * image its own way (Modal builds the published Dockerfile at that revision;
39564
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
39565
+ * in `result.json`.
39566
+ */
39567
+ var TrainerSourceRefSchema = object({
39568
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
39569
+ repo: string().min(1),
39570
+ /** A commit sha (never a branch) — the job must be reproducible. */
39571
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
39572
+ });
39573
+ var JobRef = {
39574
+ addonId: string(),
39575
+ jobKey: string().uuid()
39576
+ };
39577
+ var TrainingLogLineSchema = object({
39578
+ ts: number(),
39579
+ text: string()
39580
+ });
39581
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
39582
+ kind: "mutation",
39583
+ auth: "admin",
39584
+ timeoutMs: 3e4
39585
+ }), method(object({
39586
+ addonId: string(),
39587
+ gpuType: string(),
39588
+ region: string(),
39589
+ datasetBytes: number().int().nonnegative(),
39590
+ gpuSecondsLow: number().nonnegative(),
39591
+ gpuSecondsHigh: number().nonnegative()
39592
+ }), object({
39593
+ usdLow: number().nonnegative(),
39594
+ usdHigh: number().nonnegative(),
39595
+ notes: array(string()).readonly()
39596
+ }), { auth: "admin" }), method(object({
39597
+ ...JobRef,
39598
+ ticket: PeerBytesTicketSchema
39599
+ }), object({
39600
+ bytes: number().int().nonnegative(),
39601
+ sha256: string()
39602
+ }), {
39603
+ kind: "mutation",
39604
+ auth: "admin",
39605
+ timeoutMs: 120 * 6e4
39606
+ }), method(object({
39607
+ ...JobRef,
39608
+ trainer: TrainerSourceRefSchema,
39609
+ jobSpecJson: string().min(2).max(64e3),
39610
+ gpuType: string(),
39611
+ region: string(),
39612
+ maxRuntimeSec: number().int().positive()
39613
+ }), ProviderJobStatusSchema, {
39614
+ kind: "mutation",
39615
+ auth: "admin",
39616
+ timeoutMs: 30 * 6e4
39617
+ }), method(object(JobRef), ProviderJobStatusSchema, {
39618
+ auth: "admin",
39619
+ timeoutMs: 6e4
39620
+ }), method(object({
39621
+ ...JobRef,
39622
+ cursor: string().optional(),
39623
+ max: number().int().min(1).max(500)
39624
+ }), object({
39625
+ lines: array(TrainingLogLineSchema).readonly(),
39626
+ cursor: string()
39627
+ }), {
39628
+ auth: "admin",
39629
+ timeoutMs: 6e4
39630
+ }), method(object(JobRef), object({ ok: literal(true) }), {
39631
+ kind: "mutation",
39632
+ auth: "admin",
39633
+ timeoutMs: 6e4
39634
+ }), method(object(JobRef), object({
39635
+ found: boolean(),
39636
+ text: string().optional()
39637
+ }), {
39638
+ kind: "mutation",
39639
+ auth: "admin",
39640
+ timeoutMs: 5 * 6e4
39641
+ }), method(object({
39642
+ ...JobRef,
39643
+ path: _enum(["bundle.tar"])
39644
+ }), object({ ticket: PeerBytesTicketSchema }), {
39645
+ kind: "mutation",
39646
+ auth: "admin",
39647
+ timeoutMs: 5 * 6e4
39648
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
39649
+ kind: "mutation",
39650
+ auth: "admin",
39651
+ timeoutMs: 5 * 6e4
39652
+ }), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
39653
+ auth: "admin",
39654
+ timeoutMs: 2 * 6e4
39655
+ });
39656
+ /**
39657
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
39658
+ * provided by `addon-training`.
39659
+ *
39660
+ * It owns what every provider must agree on, written once:
39661
+ *
39662
+ * - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
39663
+ * live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
39664
+ * the export plan) and reaches this store through the five row methods
39665
+ * below, so the Retrain page and the export did not change.
39666
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
39667
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
39668
+ * - **The return flow.** Verified artefacts → Model Studio
39669
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
39670
+ * rollback. Nothing is ever registered automatically.
39671
+ *
39672
+ * Every method is `admin`.
39673
+ */
39674
+ /** A version WITH its frame list — what the export and a job read. */
39675
+ var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
39676
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
39677
+ var TrainingBaseModelSchema = object({
39678
+ modelId: string(),
39679
+ label: string(),
39680
+ weights: string(),
39681
+ imgsz: number().int(),
39682
+ baselineOnnxUrl: string(),
39683
+ baselineFloors: record(string(), number()),
39684
+ /** The base the fleet runs most — the UI's default. */
39685
+ recommended: boolean()
39686
+ });
39687
+ var TrainingPresetSchema = _enum([
39688
+ "quick",
39689
+ "standard",
39690
+ "thorough"
39691
+ ]);
39692
+ var TrainingJobRequestSchema = object({
39693
+ datasetVersionId: string().min(1),
39694
+ /** The `training-provider` addon that runs it. */
39695
+ addonId: string().min(1),
39696
+ gpuType: string().min(1),
39697
+ region: string(),
39698
+ baseModelId: string().min(1),
39699
+ preset: TrainingPresetSchema,
39700
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
39701
+ freeze: number().int().nonnegative().nullable(),
39702
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
39703
+ holdoutCameras: array(number().int()).nullable()
39704
+ });
39705
+ var TrainingSplitPlanSchema = object({
39706
+ holdoutCameras: array(number().int()).readonly(),
39707
+ /** Used when no camera is held out: the last N days of every camera. */
39708
+ holdoutLastDays: number().int().nonnegative(),
39709
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
39710
+ holdoutSupport: record(string(), number().int()).nullable(),
39711
+ trainSubjects: number().int()
39712
+ });
39713
+ var TrainingRefusalReasonSchema = _enum([
39714
+ "unknown-dataset",
39715
+ "unknown-provider",
39716
+ "provider-not-configured",
39717
+ "unknown-base-model",
39718
+ "unknown-gpu",
39719
+ "dataset-too-large",
39720
+ "no-training-subjects",
39721
+ "job-already-running"
39722
+ ]);
39723
+ var TrainingJobPlanSchema = object({
39724
+ refusal: object({
39725
+ reason: TrainingRefusalReasonSchema,
39726
+ detail: string()
39727
+ }).nullable(),
39728
+ warnings: array(string()).readonly(),
39729
+ split: TrainingSplitPlanSchema.nullable(),
39730
+ estimate: object({
39731
+ datasetBytes: number().int(),
39732
+ uploadMinutesAt20Mbps: number(),
39733
+ gpuSecondsLow: number(),
39734
+ gpuSecondsHigh: number(),
39735
+ usdLow: number(),
39736
+ usdHigh: number(),
39737
+ notes: array(string()).readonly()
39738
+ }).nullable(),
39739
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
39740
+ defaults: object({
39741
+ maxCostUsd: number(),
39742
+ maxRuntimeSec: number().int()
39743
+ }).nullable(),
39744
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
39745
+ dataNotice: string()
39746
+ });
39747
+ /**
39748
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
39749
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
39750
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
39751
+ * result lives after the operator acted on it.
39752
+ */
39753
+ var TrainingJobStateSchema = _enum([
39754
+ "uploading",
39755
+ "submitted",
39756
+ "starting",
39757
+ "running",
39758
+ "collecting",
39759
+ "ready",
39760
+ "registered",
39761
+ "canary",
39762
+ "failed",
39763
+ "cancelling",
39764
+ "cancelled",
39765
+ "lost",
39766
+ "expired",
39767
+ "discarded"
39768
+ ]);
39769
+ var TrainingFailureReasonSchema = _enum([
39770
+ "cost-cap",
39771
+ "runtime-cap",
39772
+ "upload-failed",
39773
+ "submit-failed",
39774
+ "trainer-failed",
39775
+ "result-invalid",
39776
+ "checksum-mismatch",
39777
+ "fetch-failed",
39778
+ "provider-error",
39779
+ "hub-restart-during-upload"
39780
+ ]);
39781
+ var TrainingProgressPointSchema = object({
39782
+ epoch: number().int(),
39783
+ map50: number().nullable(),
39784
+ map50_95: number().nullable()
39785
+ });
39786
+ var TrainingCanarySchema = object({
39787
+ deviceIds: array(number().int()).readonly(),
39788
+ since: number(),
39789
+ /** Every override the canary replaced, exactly, so rollback restores it. */
39790
+ previous: array(object({
39791
+ deviceId: number().int(),
39792
+ nodeId: string(),
39793
+ deviceKey: string(),
39794
+ patch: object({
39795
+ modelId: string().optional(),
39796
+ settings: record(string(), unknown()).readonly().optional()
39797
+ }).nullable()
39798
+ })).readonly()
39799
+ });
39800
+ var TrainingJobSchema = object({
39801
+ id: string(),
39802
+ idempotencyKey: string(),
39803
+ name: string(),
39804
+ createdAt: number(),
39805
+ updatedAt: number(),
39806
+ state: TrainingJobStateSchema,
39807
+ stage: TrainingStageSchema.nullable(),
39808
+ failure: object({
39809
+ reason: TrainingFailureReasonSchema,
39810
+ stage: string().nullable(),
39811
+ detail: string()
39812
+ }).nullable(),
39813
+ request: TrainingJobRequestSchema,
39814
+ maxCostUsd: number().nonnegative(),
39815
+ maxRuntimeSec: number().int().positive(),
39816
+ trainer: TrainerSourceRefSchema,
39817
+ datasetLayout: RetrainExportLayoutSchema,
39818
+ dataset: object({
39819
+ bytes: number().int(),
39820
+ sha256: string(),
39821
+ uploadedAt: number()
39822
+ }).nullable(),
39823
+ split: TrainingSplitPlanSchema,
39824
+ provider: object({
39825
+ state: ProviderJobStateSchema.nullable(),
39826
+ providerJobId: string().nullable(),
39827
+ startedAt: number().nullable(),
39828
+ endedAt: number().nullable(),
39829
+ billedSeconds: number(),
39830
+ costUsd: number(),
39831
+ costIsEstimate: boolean(),
39832
+ lastPolledAt: number().nullable()
39833
+ }),
39834
+ progress: object({
39835
+ epoch: number().int().nullable(),
39836
+ epochs: number().int().nullable(),
39837
+ etaSec: number().nullable(),
39838
+ series: array(TrainingProgressPointSchema).readonly()
39839
+ }),
39840
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
39841
+ logTail: array(string()).readonly(),
39842
+ logCursor: string().nullable(),
39843
+ artifacts: object({
39844
+ bundleBytes: number().int(),
39845
+ bundleSha256: string(),
39846
+ fetchedAt: number(),
39847
+ /** When the staged artefacts are deleted from the hub. */
39848
+ expiresAt: number()
39849
+ }).nullable(),
39850
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
39851
+ cloudDatasetDeletedAt: number().nullable(),
39852
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
39853
+ cloudCleanupDueAt: number().nullable(),
39854
+ /** Model ids registered from this job (base, and int8 when kept). */
39855
+ registeredModelIds: array(string()).readonly(),
39856
+ canary: TrainingCanarySchema.nullable()
39857
+ });
39858
+ var IdInput = object({ id: string().min(1) });
39859
+ method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
39860
+ kind: "mutation",
39861
+ auth: "admin"
39862
+ }), 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() }), {
39863
+ kind: "mutation",
39864
+ auth: "admin"
39865
+ }), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
39866
+ auth: "admin",
39867
+ timeoutMs: 6e4
39868
+ }), method(TrainingJobRequestSchema.extend({
39869
+ name: string().min(1).max(120),
39870
+ maxCostUsd: number().positive(),
39871
+ maxRuntimeSec: number().int().positive(),
39872
+ idempotencyKey: string().min(8).max(80)
39873
+ }), discriminatedUnion("kind", [object({
39874
+ kind: literal("started"),
39875
+ job: TrainingJobSchema
39876
+ }), object({
39877
+ kind: literal("refused"),
39878
+ reason: TrainingRefusalReasonSchema,
39879
+ detail: string()
39880
+ })]), {
39881
+ kind: "mutation",
39882
+ auth: "admin",
39883
+ timeoutMs: 12e4
39884
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
39885
+ kind: "mutation",
39886
+ auth: "admin",
39887
+ timeoutMs: 12e4
39888
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
39889
+ kind: "mutation",
39890
+ auth: "admin",
39891
+ timeoutMs: 30 * 6e4
39892
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
39893
+ kind: "mutation",
39894
+ auth: "admin",
39895
+ timeoutMs: 12e4
39896
+ }), method(IdInput, TrainingJobSchema, {
39897
+ kind: "mutation",
39898
+ auth: "admin",
39899
+ timeoutMs: 12e4
39900
+ }), method(IdInput, TrainingJobSchema, {
39901
+ kind: "mutation",
39902
+ auth: "admin"
39903
+ });
38596
39904
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
38597
39905
  Object.freeze({
38598
39906
  person: .5,
@@ -39216,6 +40524,12 @@ Object.freeze({
39216
40524
  addonId: null,
39217
40525
  access: "create"
39218
40526
  },
40527
+ "backup.checkBackupKey": {
40528
+ capName: "backup",
40529
+ capScope: "system",
40530
+ addonId: null,
40531
+ access: "create"
40532
+ },
39219
40533
  "backup.delete": {
39220
40534
  capName: "backup",
39221
40535
  capScope: "system",
@@ -39228,6 +40542,18 @@ Object.freeze({
39228
40542
  addonId: null,
39229
40543
  access: "delete"
39230
40544
  },
40545
+ "backup.disableEncryption": {
40546
+ capName: "backup",
40547
+ capScope: "system",
40548
+ addonId: null,
40549
+ access: "create"
40550
+ },
40551
+ "backup.getEncryption": {
40552
+ capName: "backup",
40553
+ capScope: "system",
40554
+ addonId: null,
40555
+ access: "view"
40556
+ },
39231
40557
  "backup.getEntries": {
39232
40558
  capName: "backup",
39233
40559
  capScope: "system",
@@ -39282,6 +40608,12 @@ Object.freeze({
39282
40608
  addonId: null,
39283
40609
  access: "create"
39284
40610
  },
40611
+ "backup.setupEncryption": {
40612
+ capName: "backup",
40613
+ capScope: "system",
40614
+ addonId: null,
40615
+ access: "create"
40616
+ },
39285
40617
  "backup.trigger": {
39286
40618
  capName: "backup",
39287
40619
  capScope: "system",
@@ -39834,6 +41166,12 @@ Object.freeze({
39834
41166
  addonId: null,
39835
41167
  access: "create"
39836
41168
  },
41169
+ "customModelRegistry.importModelBundle": {
41170
+ capName: "custom-model-registry",
41171
+ capScope: "system",
41172
+ addonId: null,
41173
+ access: "create"
41174
+ },
39837
41175
  "customModelRegistry.listModels": {
39838
41176
  capName: "custom-model-registry",
39839
41177
  capScope: "system",
@@ -41274,6 +42612,12 @@ Object.freeze({
41274
42612
  addonId: null,
41275
42613
  access: "view"
41276
42614
  },
42615
+ "keychainAdmin.acknowledgeReset": {
42616
+ capName: "keychain-admin",
42617
+ capScope: "system",
42618
+ addonId: null,
42619
+ access: "create"
42620
+ },
41277
42621
  "keychainAdmin.deleteOrphans": {
41278
42622
  capName: "keychain-admin",
41279
42623
  capScope: "system",
@@ -41310,6 +42654,12 @@ Object.freeze({
41310
42654
  addonId: null,
41311
42655
  access: "delete"
41312
42656
  },
42657
+ "keychainAdmin.resetReport": {
42658
+ capName: "keychain-admin",
42659
+ capScope: "system",
42660
+ addonId: null,
42661
+ access: "delete"
42662
+ },
41313
42663
  "keychainAdmin.reveal": {
41314
42664
  capName: "keychain-admin",
41315
42665
  capScope: "system",
@@ -43056,6 +44406,12 @@ Object.freeze({
43056
44406
  addonId: null,
43057
44407
  access: "view"
43058
44408
  },
44409
+ "pipelineAnalytics.offerRetrainArchive": {
44410
+ capName: "pipeline-analytics",
44411
+ capScope: "device",
44412
+ addonId: null,
44413
+ access: "create"
44414
+ },
43059
44415
  "pipelineAnalytics.ownersWithMedia": {
43060
44416
  capName: "pipeline-analytics",
43061
44417
  capScope: "device",
@@ -45594,6 +46950,174 @@ Object.freeze({
45594
46950
  addonId: null,
45595
46951
  access: "view"
45596
46952
  },
46953
+ "training.canaryResult": {
46954
+ capName: "training",
46955
+ capScope: "system",
46956
+ addonId: null,
46957
+ access: "create"
46958
+ },
46959
+ "training.cancelJob": {
46960
+ capName: "training",
46961
+ capScope: "system",
46962
+ addonId: null,
46963
+ access: "create"
46964
+ },
46965
+ "training.discardResult": {
46966
+ capName: "training",
46967
+ capScope: "system",
46968
+ addonId: null,
46969
+ access: "create"
46970
+ },
46971
+ "training.findDatasetVersionIdByName": {
46972
+ capName: "training",
46973
+ capScope: "system",
46974
+ addonId: null,
46975
+ access: "view"
46976
+ },
46977
+ "training.getDatasetVersion": {
46978
+ capName: "training",
46979
+ capScope: "system",
46980
+ addonId: null,
46981
+ access: "view"
46982
+ },
46983
+ "training.getJob": {
46984
+ capName: "training",
46985
+ capScope: "system",
46986
+ addonId: null,
46987
+ access: "view"
46988
+ },
46989
+ "training.getJobResult": {
46990
+ capName: "training",
46991
+ capScope: "system",
46992
+ addonId: null,
46993
+ access: "view"
46994
+ },
46995
+ "training.listBaseModels": {
46996
+ capName: "training",
46997
+ capScope: "system",
46998
+ addonId: null,
46999
+ access: "view"
47000
+ },
47001
+ "training.listDatasetVersions": {
47002
+ capName: "training",
47003
+ capScope: "system",
47004
+ addonId: null,
47005
+ access: "view"
47006
+ },
47007
+ "training.listJobs": {
47008
+ capName: "training",
47009
+ capScope: "system",
47010
+ addonId: null,
47011
+ access: "view"
47012
+ },
47013
+ "training.planJob": {
47014
+ capName: "training",
47015
+ capScope: "system",
47016
+ addonId: null,
47017
+ access: "view"
47018
+ },
47019
+ "training.putDatasetVersion": {
47020
+ capName: "training",
47021
+ capScope: "system",
47022
+ addonId: null,
47023
+ access: "create"
47024
+ },
47025
+ "training.registerResult": {
47026
+ capName: "training",
47027
+ capScope: "system",
47028
+ addonId: null,
47029
+ access: "create"
47030
+ },
47031
+ "training.removeDatasetVersion": {
47032
+ capName: "training",
47033
+ capScope: "system",
47034
+ addonId: null,
47035
+ access: "delete"
47036
+ },
47037
+ "training.rollbackCanary": {
47038
+ capName: "training",
47039
+ capScope: "system",
47040
+ addonId: null,
47041
+ access: "create"
47042
+ },
47043
+ "training.startJob": {
47044
+ capName: "training",
47045
+ capScope: "system",
47046
+ addonId: null,
47047
+ access: "create"
47048
+ },
47049
+ "trainingProvider.cancelJob": {
47050
+ capName: "training-provider",
47051
+ capScope: "system",
47052
+ addonId: null,
47053
+ access: "create"
47054
+ },
47055
+ "trainingProvider.cleanupJob": {
47056
+ capName: "training-provider",
47057
+ capScope: "system",
47058
+ addonId: null,
47059
+ access: "create"
47060
+ },
47061
+ "trainingProvider.describe": {
47062
+ capName: "training-provider",
47063
+ capScope: "system",
47064
+ addonId: null,
47065
+ access: "view"
47066
+ },
47067
+ "trainingProvider.estimateJob": {
47068
+ capName: "training-provider",
47069
+ capScope: "system",
47070
+ addonId: null,
47071
+ access: "view"
47072
+ },
47073
+ "trainingProvider.getJob": {
47074
+ capName: "training-provider",
47075
+ capScope: "system",
47076
+ addonId: null,
47077
+ access: "view"
47078
+ },
47079
+ "trainingProvider.listJobEvents": {
47080
+ capName: "training-provider",
47081
+ capScope: "system",
47082
+ addonId: null,
47083
+ access: "view"
47084
+ },
47085
+ "trainingProvider.listJobs": {
47086
+ capName: "training-provider",
47087
+ capScope: "system",
47088
+ addonId: null,
47089
+ access: "view"
47090
+ },
47091
+ "trainingProvider.offerArtifact": {
47092
+ capName: "training-provider",
47093
+ capScope: "system",
47094
+ addonId: null,
47095
+ access: "create"
47096
+ },
47097
+ "trainingProvider.readResult": {
47098
+ capName: "training-provider",
47099
+ capScope: "system",
47100
+ addonId: null,
47101
+ access: "create"
47102
+ },
47103
+ "trainingProvider.submitJob": {
47104
+ capName: "training-provider",
47105
+ capScope: "system",
47106
+ addonId: null,
47107
+ access: "create"
47108
+ },
47109
+ "trainingProvider.uploadDataset": {
47110
+ capName: "training-provider",
47111
+ capScope: "system",
47112
+ addonId: null,
47113
+ access: "create"
47114
+ },
47115
+ "trainingProvider.validateCredentials": {
47116
+ capName: "training-provider",
47117
+ capScope: "system",
47118
+ addonId: null,
47119
+ access: "create"
47120
+ },
45597
47121
  "turnProvider.getTurnServers": {
45598
47122
  capName: "turn-provider",
45599
47123
  capScope: "system",
@@ -45618,12 +47142,6 @@ Object.freeze({
45618
47142
  addonId: null,
45619
47143
  access: "create"
45620
47144
  },
45621
- "userManagement.createApiKey": {
45622
- capName: "user-management",
45623
- capScope: "system",
45624
- addonId: null,
45625
- access: "create"
45626
- },
45627
47145
  "userManagement.createScopedToken": {
45628
47146
  capName: "user-management",
45629
47147
  capScope: "system",
@@ -45660,12 +47178,6 @@ Object.freeze({
45660
47178
  addonId: null,
45661
47179
  access: "view"
45662
47180
  },
45663
- "userManagement.linkExternalIdentity": {
45664
- capName: "user-management",
45665
- capScope: "system",
45666
- addonId: null,
45667
- access: "create"
45668
- },
45669
47181
  "userManagement.listApiKeys": {
45670
47182
  capName: "user-management",
45671
47183
  capScope: "system",
@@ -45768,12 +47280,6 @@ Object.freeze({
45768
47280
  addonId: null,
45769
47281
  access: "create"
45770
47282
  },
45771
- "userManagement.validateApiKey": {
45772
- capName: "user-management",
45773
- capScope: "system",
45774
- addonId: null,
45775
- access: "view"
45776
- },
45777
47283
  "userManagement.validateCredentials": {
45778
47284
  capName: "user-management",
45779
47285
  capScope: "system",
@@ -49891,6 +51397,11 @@ Object.freeze({
49891
51397
  form: "single",
49892
51398
  optional: false
49893
51399
  }],
51400
+ "training.canaryResult": [{
51401
+ name: "deviceIds",
51402
+ form: "array",
51403
+ optional: false
51404
+ }],
49894
51405
  "update.getStatus": [{
49895
51406
  name: "deviceId",
49896
51407
  form: "single",
@@ -50619,6 +52130,8 @@ var STATE_SUMMARY_VARS = [
50619
52130
  [...RULE_TEXT],
50620
52131
  [...RULE_TEXT],
50621
52132
  [...RULE_TEXT],
52133
+ [...RULE_TEXT],
52134
+ [...RULE_TEXT],
50622
52135
  ([...RULE_TEXT], [...UPDATES]),
50623
52136
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
50624
52137
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
@@ -51171,87 +52684,4 @@ DEFAULT_NATIVE_LEASE_SETTINGS.admission;
51171
52684
  var MB = 1024 * 1024;
51172
52685
  1024 * MB, 3072 * MB;
51173
52686
  //#endregion
51174
- Object.defineProperty(exports, "BaseAddon", {
51175
- enumerable: true,
51176
- get: function() {
51177
- return BaseAddon;
51178
- }
51179
- });
51180
- Object.defineProperty(exports, "addonRoutesCapability", {
51181
- enumerable: true,
51182
- get: function() {
51183
- return addonRoutesCapability;
51184
- }
51185
- });
51186
- Object.defineProperty(exports, "addonWidgetsSourceCapability", {
51187
- enumerable: true,
51188
- get: function() {
51189
- return addonWidgetsSourceCapability;
51190
- }
51191
- });
51192
- Object.defineProperty(exports, "array", {
51193
- enumerable: true,
51194
- get: function() {
51195
- return array;
51196
- }
51197
- });
51198
- Object.defineProperty(exports, "authProviderCapability", {
51199
- enumerable: true,
51200
- get: function() {
51201
- return authProviderCapability;
51202
- }
51203
- });
51204
- Object.defineProperty(exports, "boolean", {
51205
- enumerable: true,
51206
- get: function() {
51207
- return boolean;
51208
- }
51209
- });
51210
- Object.defineProperty(exports, "buildAddonRouteProvider", {
51211
- enumerable: true,
51212
- get: function() {
51213
- return buildAddonRouteProvider;
51214
- }
51215
- });
51216
- Object.defineProperty(exports, "errMsg", {
51217
- enumerable: true,
51218
- get: function() {
51219
- return errMsg;
51220
- }
51221
- });
51222
- Object.defineProperty(exports, "isDisplayIconKey", {
51223
- enumerable: true,
51224
- get: function() {
51225
- return isDisplayIconKey;
51226
- }
51227
- });
51228
- Object.defineProperty(exports, "loginMethodCapability", {
51229
- enumerable: true,
51230
- get: function() {
51231
- return loginMethodCapability;
51232
- }
51233
- });
51234
- Object.defineProperty(exports, "number", {
51235
- enumerable: true,
51236
- get: function() {
51237
- return number;
51238
- }
51239
- });
51240
- Object.defineProperty(exports, "object", {
51241
- enumerable: true,
51242
- get: function() {
51243
- return object;
51244
- }
51245
- });
51246
- Object.defineProperty(exports, "string", {
51247
- enumerable: true,
51248
- get: function() {
51249
- return string;
51250
- }
51251
- });
51252
- Object.defineProperty(exports, "userPasskeysCapability", {
51253
- enumerable: true,
51254
- get: function() {
51255
- return userPasskeysCapability;
51256
- }
51257
- });
52687
+ export { buildAddonRouteProvider as a, userPasskeysCapability as c, array as d, boolean as f, string as h, authProviderCapability as i, errMsg as l, object as m, addonRoutesCapability as n, isDisplayIconKey as o, number as p, addonWidgetsSourceCapability as r, loginMethodCapability as s, SSO_STATE_COOKIE as t, BaseAddon as u };