@camstack/addon-provider-dreame 0.2.130 → 0.2.132

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +2071 -148
  2. package/dist/addon.mjs +2071 -148
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -46208,13 +46208,13 @@ var AI_FEATURE_JSON_KEY = {
46208
46208
  furnitureDetection: "furniture_detect_switch",
46209
46209
  fluidDetection: "fluid_detect_switch"
46210
46210
  };
46211
- function isRecord$2(v) {
46211
+ function isRecord$3(v) {
46212
46212
  return v !== null && typeof v === "object" && !Array.isArray(v);
46213
46213
  }
46214
46214
  function parseJsonPayload(raw) {
46215
46215
  try {
46216
46216
  const parsed = JSON.parse(raw);
46217
- return isRecord$2(parsed) ? parsed : null;
46217
+ return isRecord$3(parsed) ? parsed : null;
46218
46218
  } catch {
46219
46219
  return null;
46220
46220
  }
@@ -58280,7 +58280,7 @@ var ZodIssueCode = {
58280
58280
  var ZodFirstPartyTypeKind;
58281
58281
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
58282
58282
  //#endregion
58283
- //#region ../types/dist/sleep-Cr5YOk3m.mjs
58283
+ //#region ../types/dist/sleep-DwAQ9sqX.mjs
58284
58284
  /**
58285
58285
  * The audio chunk plane's byte format, and the ONE expansion from a coded
58286
58286
  * window to float samples (D455).
@@ -58397,7 +58397,7 @@ function isKeychainStoredField(field) {
58397
58397
  var SECRET_CLEAR = { $secretClear: true };
58398
58398
  /** The `'***'` token D634 redaction writes for non-admins. */
58399
58399
  var LEGACY_DEVICE_REDACTION = "***";
58400
- function isRecord$1(value) {
58400
+ function isRecord$2(value) {
58401
58401
  return typeof value === "object" && value !== null && !Array.isArray(value);
58402
58402
  }
58403
58403
  function makeSecretMarker(ref) {
@@ -58408,12 +58408,12 @@ function makeSecretMarker(ref) {
58408
58408
  }
58409
58409
  /** A stored marker: an object whose `$secret` is a non-empty string. */
58410
58410
  function isSecretMarker(value) {
58411
- if (!isRecord$1(value)) return false;
58411
+ if (!isRecord$2(value)) return false;
58412
58412
  const ref = value["$secret"];
58413
58413
  return typeof ref === "string" && ref.length > 0;
58414
58414
  }
58415
58415
  function isSecretClear(value) {
58416
- return isRecord$1(value) && value["$secretClear"] === true;
58416
+ return isRecord$2(value) && value["$secretClear"] === true;
58417
58417
  }
58418
58418
  /**
58419
58419
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -58929,6 +58929,13 @@ function globalSecretScope() {
58929
58929
  function encodeSegment(value) {
58930
58930
  return encodeURIComponent(value);
58931
58931
  }
58932
+ function decodeSegment(value) {
58933
+ try {
58934
+ return decodeURIComponent(value);
58935
+ } catch {
58936
+ return null;
58937
+ }
58938
+ }
58932
58939
  /**
58933
58940
  * The field path of a value inside an array item, addressed by the item's id:
58934
58941
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -58937,6 +58944,75 @@ function encodeSegment(value) {
58937
58944
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
58938
58945
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
58939
58946
  }
58947
+ function parseScope(segments) {
58948
+ switch (segments[0]) {
58949
+ case "global": return {
58950
+ scope: GLOBAL_SCOPE,
58951
+ used: 1
58952
+ };
58953
+ case "node": {
58954
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
58955
+ return nodeId === null || nodeId.length === 0 ? null : {
58956
+ scope: {
58957
+ kind: "node",
58958
+ nodeId
58959
+ },
58960
+ used: 2
58961
+ };
58962
+ }
58963
+ case "device": {
58964
+ const raw = segments[1];
58965
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
58966
+ return {
58967
+ scope: {
58968
+ kind: "device",
58969
+ deviceId: Number(raw)
58970
+ },
58971
+ used: 2
58972
+ };
58973
+ }
58974
+ case "integration": {
58975
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
58976
+ return id === null || id.length === 0 ? null : {
58977
+ scope: {
58978
+ kind: "integration",
58979
+ integrationId: id
58980
+ },
58981
+ used: 2
58982
+ };
58983
+ }
58984
+ case "row": {
58985
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
58986
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
58987
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
58988
+ return {
58989
+ scope: {
58990
+ kind: "row",
58991
+ collection,
58992
+ rowId
58993
+ },
58994
+ used: 3
58995
+ };
58996
+ }
58997
+ default: return null;
58998
+ }
58999
+ }
59000
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
59001
+ function parseSecretRef(ref) {
59002
+ if (!ref.startsWith("secret://")) return null;
59003
+ const segments = ref.slice(9).split("/");
59004
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
59005
+ if (owner === null || owner.length === 0) return null;
59006
+ const parsed = parseScope(segments.slice(1));
59007
+ if (parsed === null) return null;
59008
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
59009
+ if (fieldPath.length === 0) return null;
59010
+ return {
59011
+ owner,
59012
+ scope: parsed.scope,
59013
+ fieldPath
59014
+ };
59015
+ }
58940
59016
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
58941
59017
  var KeychainWriteRefusedError = class extends Error {
58942
59018
  fieldPath;
@@ -58947,7 +59023,7 @@ var KeychainWriteRefusedError = class extends Error {
58947
59023
  }
58948
59024
  };
58949
59025
  var KEEP = { kind: "keep" };
58950
- function isRecord(value) {
59026
+ function isRecord$1(value) {
58951
59027
  return typeof value === "object" && value !== null && !Array.isArray(value);
58952
59028
  }
58953
59029
  function defaultMintId() {
@@ -58960,7 +59036,7 @@ function collectSecretMarkerRefs(value, out = []) {
58960
59036
  return out;
58961
59037
  }
58962
59038
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
58963
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
59039
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
58964
59040
  return out;
58965
59041
  }
58966
59042
  async function storedValueEquals(secrets, marker, candidate) {
@@ -59015,7 +59091,7 @@ function rowId(row, idKey) {
59015
59091
  return null;
59016
59092
  }
59017
59093
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
59018
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
59094
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
59019
59095
  if (!Array.isArray(incoming)) {
59020
59096
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
59021
59097
  return {
@@ -59031,7 +59107,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
59031
59107
  const kept = /* @__PURE__ */ new Set();
59032
59108
  const rows = [];
59033
59109
  for (const row of incoming) {
59034
- if (!isRecord(row)) {
59110
+ if (!isRecord$1(row)) {
59035
59111
  rows.push(row);
59036
59112
  continue;
59037
59113
  }
@@ -59056,7 +59132,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
59056
59132
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
59057
59133
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
59058
59134
  case "object": {
59059
- if (!isRecord(incoming)) {
59135
+ if (!isRecord$1(incoming)) {
59060
59136
  if (incoming === void 0) return KEEP;
59061
59137
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
59062
59138
  return {
@@ -59064,7 +59140,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
59064
59140
  value: incoming
59065
59141
  };
59066
59142
  }
59067
- const storedObj = isRecord(stored) ? stored : {};
59143
+ const storedObj = isRecord$1(stored) ? stored : {};
59068
59144
  return {
59069
59145
  kind: "value",
59070
59146
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -59123,12 +59199,19 @@ async function transformSecretWrite(input) {
59123
59199
  }
59124
59200
  };
59125
59201
  }
59202
+ /** Is `ref` one of `owner`'s refs? */
59203
+ function isSecretRefOwnedBy(ref, owner) {
59204
+ return parseSecretRef(ref)?.owner === owner;
59205
+ }
59126
59206
  /**
59127
59207
  * Replace every marker in `value` with its keychain value. Returns the SAME
59128
59208
  * reference when there is no marker (no allocation, no keychain call).
59129
59209
  */
59130
- async function resolveSecretMarkers(value, secrets) {
59131
- const refs = collectSecretMarkerRefs(value);
59210
+ async function resolveSecretMarkers(value, secrets, options = {}) {
59211
+ const keepMarker = options.unresolved === "keep-marker";
59212
+ const owner = options.ownedBy;
59213
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
59214
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
59132
59215
  if (refs.length === 0) return {
59133
59216
  value,
59134
59217
  unresolved: []
@@ -59152,10 +59235,18 @@ async function resolveSecretMarkers(value, secrets) {
59152
59235
  }
59153
59236
  const substitute = (v) => {
59154
59237
  if (isSecretMarker(v)) {
59238
+ if (!inScope(v.$secret)) return {
59239
+ keep: true,
59240
+ value: v
59241
+ };
59155
59242
  const answer = answers[v.$secret];
59156
- return answer?.kind === "value" ? {
59243
+ if (answer?.kind === "value") return {
59157
59244
  keep: true,
59158
59245
  value: answer.value
59246
+ };
59247
+ return keepMarker ? {
59248
+ keep: true,
59249
+ value: v
59159
59250
  } : {
59160
59251
  keep: false,
59161
59252
  value: void 0
@@ -59172,7 +59263,7 @@ async function resolveSecretMarkers(value, secrets) {
59172
59263
  value: items
59173
59264
  };
59174
59265
  }
59175
- if (isRecord(v)) {
59266
+ if (isRecord$1(v)) {
59176
59267
  const out = {};
59177
59268
  for (const [k, child] of Object.entries(v)) {
59178
59269
  const s = substitute(child);
@@ -59193,14 +59284,152 @@ async function resolveSecretMarkers(value, secrets) {
59193
59284
  unresolved
59194
59285
  };
59195
59286
  }
59196
- function touchesTree(tree, patch) {
59197
- if (tree.size === 0) return false;
59198
- for (const key of Object.keys(patch)) {
59199
- const at = key.indexOf("@");
59200
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
59287
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
59288
+ var SecretOverwriteRefusedError = class extends Error {
59289
+ ref;
59290
+ reason;
59291
+ constructor(ref, reason) {
59292
+ 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.`);
59293
+ this.ref = ref;
59294
+ this.reason = reason;
59295
+ this.name = "SecretOverwriteRefusedError";
59296
+ }
59297
+ };
59298
+ function isRecord(value) {
59299
+ return typeof value === "object" && value !== null && !Array.isArray(value);
59300
+ }
59301
+ function resolvedValue(pass, marker) {
59302
+ const answer = pass.answers[marker.$secret];
59303
+ return answer?.kind === "value" ? answer.value : null;
59304
+ }
59305
+ async function atMarker(pass, incoming, stored) {
59306
+ if (incoming === null) return stored;
59307
+ if (typeof incoming !== "string") return incoming;
59308
+ if (incoming === resolvedValue(pass, stored)) return stored;
59309
+ const intent = classifySecretWrite(incoming);
59310
+ if (intent.kind !== "set") return stored;
59311
+ const ref = stored.$secret;
59312
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
59313
+ const answer = pass.answers[ref];
59314
+ 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);
59315
+ try {
59316
+ await pass.secrets.put(ref, intent.value);
59317
+ } catch (err) {
59318
+ throw new KeychainWriteRefusedError(ref, err);
59319
+ }
59320
+ pass.changedRefs.push(ref);
59321
+ return stored;
59322
+ }
59323
+ function inArray(pass, incoming, stored) {
59324
+ return incoming.map((item, index) => {
59325
+ const twin = stored[index];
59326
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
59327
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
59328
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
59329
+ return item;
59330
+ });
59331
+ }
59332
+ function inArrayRow(pass, incoming, stored) {
59333
+ const out = { ...incoming };
59334
+ for (const [key, value] of Object.entries(incoming)) {
59335
+ const twin = stored[key];
59336
+ if (isSecretMarker(twin)) {
59337
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
59338
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
59339
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
59340
+ }
59341
+ return out;
59342
+ }
59343
+ async function walk(pass, incoming, stored) {
59344
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
59345
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
59346
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
59347
+ const out = { ...incoming };
59348
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
59349
+ return out;
59350
+ }
59351
+ /** Restore markers a write-back carries as values. See the file doc. */
59352
+ async function restoreUnchangedSecrets(input) {
59353
+ const refs = [];
59354
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
59355
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
59356
+ if (owned.length === 0) return {
59357
+ patch: input.patch,
59358
+ changedRefs: []
59359
+ };
59360
+ const pass = {
59361
+ secrets: input.secrets,
59362
+ answers: await input.secrets.resolve([...new Set(owned)]),
59363
+ operatorWrite: input.operatorWrite,
59364
+ changedRefs: []
59365
+ };
59366
+ const out = {};
59367
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
59368
+ return {
59369
+ patch: out,
59370
+ changedRefs: pass.changedRefs
59371
+ };
59372
+ }
59373
+ /** Structural equality over JSON-shaped values (key order does not matter). */
59374
+ function isJsonEqual(a, b) {
59375
+ if (Object.is(a, b)) return true;
59376
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
59377
+ if (isRecord(a) && isRecord(b)) {
59378
+ const keys = Object.keys(a);
59379
+ if (keys.length !== Object.keys(b).length) return false;
59380
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
59201
59381
  }
59202
59382
  return false;
59203
59383
  }
59384
+ /** The patch without the keys whose value already equals the stored one. */
59385
+ function dropUnchangedKeys(patch, stored) {
59386
+ const out = {};
59387
+ for (const [key, value] of Object.entries(patch)) {
59388
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
59389
+ out[key] = value;
59390
+ }
59391
+ return out;
59392
+ }
59393
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
59394
+ function markerKeysOf(blob, owner) {
59395
+ const keys = /* @__PURE__ */ new Set();
59396
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
59397
+ return keys;
59398
+ }
59399
+ function nodeFromStored(value, owner) {
59400
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
59401
+ if (!isRecord(value)) return null;
59402
+ const children = /* @__PURE__ */ new Map();
59403
+ for (const [key, child] of Object.entries(value)) {
59404
+ const node = nodeFromStored(child, owner);
59405
+ if (node !== null) children.set(key, node);
59406
+ }
59407
+ return children.size > 0 ? {
59408
+ kind: "object",
59409
+ children
59410
+ } : null;
59411
+ }
59412
+ /**
59413
+ * The declared secret tree, widened by every place the STORED blob holds a
59414
+ * marker under one of `keys` — so a marker the schema no longer declares (or
59415
+ * never declared: Wyze before b4906cec6) still gets the save path's
59416
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
59417
+ * addon writes. Markers inside arrays are not added: a row has no id field to
59418
+ * match by unless the schema declares one. Only `owner`'s markers count: a
59419
+ * builtin that keeps another addon's marker (device-manager) never takes it
59420
+ * over.
59421
+ */
59422
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
59423
+ const added = /* @__PURE__ */ new Map();
59424
+ for (const key of keys) {
59425
+ const at = key.indexOf("@");
59426
+ const base = at > 0 ? key.slice(0, at) : key;
59427
+ if (declared.has(base) || added.has(base)) continue;
59428
+ const node = nodeFromStored(stored[key], owner);
59429
+ if (node !== null) added.set(base, node);
59430
+ }
59431
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
59432
+ }
59204
59433
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
59205
59434
  async function readStoredAddonBlob(raw) {
59206
59435
  const threeWay = raw.readAddonStoreResult;
@@ -59209,7 +59438,41 @@ async function readStoredAddonBlob(raw) {
59209
59438
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
59210
59439
  return result.kind === "missing" ? {} : result.value;
59211
59440
  }
59212
- function createSecretAwareSettings(raw, opts) {
59441
+ function touchesTree(tree, patch) {
59442
+ if (tree.size === 0) return false;
59443
+ for (const key of Object.keys(patch)) {
59444
+ const at = key.indexOf("@");
59445
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
59446
+ }
59447
+ return false;
59448
+ }
59449
+ /**
59450
+ * Which top-level keys of each store held markers when last seen. `undefined`
59451
+ * for a store not seen yet: its first write reads it, to be safe.
59452
+ */
59453
+ var MarkerKeyIndex = class {
59454
+ owner;
59455
+ byStore = /* @__PURE__ */ new Map();
59456
+ constructor(owner) {
59457
+ this.owner = owner;
59458
+ }
59459
+ seen(store, blob) {
59460
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
59461
+ }
59462
+ wrote(store, patch) {
59463
+ const keys = this.byStore.get(store);
59464
+ if (keys === void 0) return;
59465
+ const now = markerKeysOf(patch, this.owner);
59466
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
59467
+ else keys.delete(key);
59468
+ }
59469
+ mayHoldMarkers(store, patch) {
59470
+ const keys = this.byStore.get(store);
59471
+ if (keys === void 0) return true;
59472
+ return Object.keys(patch).some((key) => keys.has(key));
59473
+ }
59474
+ };
59475
+ function createHandle(raw, opts) {
59213
59476
  const chains = /* @__PURE__ */ new Map();
59214
59477
  const serialize = (key, fn) => {
59215
59478
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -59220,46 +59483,130 @@ function createSecretAwareSettings(raw, opts) {
59220
59483
  });
59221
59484
  return next;
59222
59485
  };
59223
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
59224
- if (!touchesTree(tree, patch)) return rawWrite(patch);
59225
- return serialize(chainKey, async () => {
59486
+ const index = new MarkerKeyIndex(opts.secrets.owner);
59487
+ const resolveRead = async (store, blob) => {
59488
+ index.seen(store, blob);
59489
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
59490
+ unresolved: "keep-marker",
59491
+ ownedBy: opts.secrets.owner
59492
+ });
59493
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
59494
+ return value;
59495
+ };
59496
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
59497
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
59498
+ await rawWrite(patch);
59499
+ index.wrote(store, patch);
59500
+ return { changed: true };
59501
+ }
59502
+ return serialize(store, async () => {
59226
59503
  const stored = await readStored();
59504
+ index.seen(store, stored);
59505
+ const operatorWrite = opts.isOperatorWrite?.() === true;
59506
+ const restored = await restoreUnchangedSecrets({
59507
+ patch,
59508
+ stored,
59509
+ secrets: opts.secrets,
59510
+ operatorWrite
59511
+ });
59227
59512
  const result = await transformSecretWrite({
59228
- tree,
59513
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
59229
59514
  secrets: opts.secrets,
59230
- patch,
59515
+ patch: restored.patch,
59231
59516
  stored,
59232
59517
  ...scope !== void 0 ? { scope } : {},
59233
- operatorWrite: opts.isOperatorWrite?.() === true
59518
+ operatorWrite
59234
59519
  });
59235
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
59520
+ const effective = dropUnchangedKeys(result.patch, stored);
59521
+ const wroteBlob = Object.keys(effective).length > 0;
59522
+ if (wroteBlob) {
59523
+ await rawWrite(effective);
59524
+ index.wrote(store, effective);
59525
+ }
59236
59526
  const { orphaned } = await result.afterWrite();
59237
59527
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
59238
- });
59528
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
59529
+ });
59530
+ };
59531
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
59532
+ const readAddonStoreResult = raw.readAddonStoreResult;
59533
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
59534
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
59535
+ const overrides = {
59536
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
59537
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
59538
+ const result = await readAddonStoreResult.call(raw);
59539
+ return result.kind === "value" ? {
59540
+ kind: "value",
59541
+ value: await resolveRead("addon", result.value)
59542
+ } : result;
59543
+ } } : {},
59544
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
59545
+ const result = await readAddonStoreKeyResult.call(raw, key);
59546
+ if (result.kind !== "present") return result;
59547
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
59548
+ unresolved: "keep-marker",
59549
+ ownedBy: opts.secrets.owner
59550
+ });
59551
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
59552
+ return {
59553
+ kind: "present",
59554
+ value: value[key]
59555
+ };
59556
+ } } : {},
59557
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
59558
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
59559
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
59560
+ const out = /* @__PURE__ */ new Map();
59561
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
59562
+ return out;
59563
+ } } : {},
59564
+ writeAddonStore: async (patch) => {
59565
+ await writeAddon(patch);
59566
+ },
59567
+ writeDeviceStore: async (deviceId, patch) => {
59568
+ await write(`device:${deviceId}`, opts.deviceTree(), {
59569
+ kind: "device",
59570
+ deviceId
59571
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
59572
+ }
59239
59573
  };
59240
- const wrapped = {
59241
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
59242
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
59243
- kind: "device",
59244
- deviceId
59245
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
59574
+ return {
59575
+ settings: new Proxy(raw, { get(target, prop, receiver) {
59576
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
59577
+ const value = Reflect.get(target, prop, receiver);
59578
+ return typeof value === "function" ? value.bind(target) : value;
59579
+ } }),
59580
+ raw: {
59581
+ readAddonStore: async () => {
59582
+ const blob = await raw.readAddonStore();
59583
+ index.seen("addon", blob);
59584
+ return blob;
59585
+ },
59586
+ readDeviceStore: async (deviceId) => {
59587
+ const blob = await raw.readDeviceStore(deviceId);
59588
+ index.seen(`device:${deviceId}`, blob);
59589
+ return blob;
59590
+ }
59591
+ },
59592
+ writeAddonStore: writeAddon
59246
59593
  };
59247
- return new Proxy(raw, { get(target, prop, receiver) {
59248
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
59249
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
59250
- const value = Reflect.get(target, prop, receiver);
59251
- return typeof value === "function" ? value.bind(target) : value;
59252
- } });
59253
59594
  }
59254
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
59255
- function withSecretAwareSettings(context, opts) {
59595
+ /** The context the addon sees, plus the private raw view and write outcome. */
59596
+ function createSecretAwareContext(context, opts) {
59256
59597
  const raw = context.settings;
59257
- if (raw === void 0) return context;
59258
- const settings = createSecretAwareSettings(raw, opts);
59259
- return new Proxy(context, { get(target, prop, receiver) {
59260
- if (prop === "settings") return settings;
59261
- return Reflect.get(target, prop, receiver);
59262
- } });
59598
+ if (raw === void 0) return {
59599
+ context,
59600
+ handle: null
59601
+ };
59602
+ const handle = createHandle(raw, opts);
59603
+ return {
59604
+ context: new Proxy(context, { get(target, prop, receiver) {
59605
+ if (prop === "settings") return handle.settings;
59606
+ return Reflect.get(target, prop, receiver);
59607
+ } }),
59608
+ handle
59609
+ };
59263
59610
  }
59264
59611
  var LEAF = { kind: "leaf" };
59265
59612
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -59434,6 +59781,14 @@ var BaseAddon = class {
59434
59781
  _secretChangeUnsub = null;
59435
59782
  /** >0 while an OPERATOR's settings write is being applied. */
59436
59783
  _operatorWriteDepth = 0;
59784
+ /**
59785
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
59786
+ * to the marker-bearing blobs and stays private to this class: the form
59787
+ * hydrate and config resolution need markers, addon code never does.
59788
+ */
59789
+ _secretSettings = null;
59790
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
59791
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
59437
59792
  constructor(defaults) {
59438
59793
  this.defaults = defaults;
59439
59794
  this._config = { ...defaults };
@@ -59470,13 +59825,21 @@ var BaseAddon = class {
59470
59825
  }
59471
59826
  async initialize(context) {
59472
59827
  const secrets = context.secrets;
59473
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
59474
- secrets,
59475
- addonTree: () => this.addonSecretTree(),
59476
- deviceTree: () => this.deviceSecretTree(),
59477
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
59478
- isOperatorWrite: () => this._operatorWriteDepth > 0
59479
- }) : context;
59828
+ if (secrets !== void 0) {
59829
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
59830
+ secrets,
59831
+ addonTree: () => this.addonSecretTree(),
59832
+ deviceTree: () => this.deviceSecretTree(),
59833
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
59834
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
59835
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
59836
+ });
59837
+ this._ctx = wrapped;
59838
+ this._secretSettings = handle;
59839
+ } else {
59840
+ this._ctx = context;
59841
+ this._secretSettings = null;
59842
+ }
59480
59843
  await this.resolveConfig();
59481
59844
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
59482
59845
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -59593,11 +59956,8 @@ var BaseAddon = class {
59593
59956
  async getGlobalSettings(overlay, cap, nodeId) {
59594
59957
  const schema = this.globalSettingsSchema(cap);
59595
59958
  if (!schema) return { sections: [] };
59596
- const projected = await this.resolveGlobalStore(nodeId, cap);
59597
- return hydrateSchema(schema, overlay ? {
59598
- ...projected,
59599
- ...overlay
59600
- } : projected, { inlineSecretsAsViews: true });
59959
+ const projected = await this.readRawProjectedStore(nodeId, cap);
59960
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
59601
59961
  }
59602
59962
  /**
59603
59963
  * The integration-level view of this addon's settings: exactly the sections
@@ -59642,7 +60002,7 @@ var BaseAddon = class {
59642
60002
  });
59643
60003
  }
59644
60004
  if (sections.length === 0) return null;
59645
- const projected = await this.resolveGlobalStore(nodeId);
60005
+ const projected = await this.readRawProjectedStore(nodeId);
59646
60006
  return hydrateSchema({
59647
60007
  ...schema,
59648
60008
  sections
@@ -59659,12 +60019,50 @@ var BaseAddon = class {
59659
60019
  * the store for custom option logic (option narrowing, value snapping) to
59660
60020
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
59661
60021
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
60022
+ *
60023
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
60024
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
60025
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
60026
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
60027
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
60028
+ * resolved blob back is a no-op for every unchanged secret.
59662
60029
  */
59663
60030
  async resolveGlobalStore(nodeId, cap) {
59664
60031
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
60032
+ return this.projectForNode(raw, nodeId, cap);
60033
+ }
60034
+ projectForNode(store, nodeId, cap) {
59665
60035
  const keys = this.perNodeKeys(cap);
59666
60036
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
59667
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
60037
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
60038
+ }
60039
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
60040
+ async readRawProjectedStore(nodeId, cap) {
60041
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
60042
+ return this.projectForNode(raw, nodeId, cap);
60043
+ }
60044
+ /**
60045
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
60046
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
60047
+ * hydrated from a resolved overlay still shows a secret as "set", never as
60048
+ * its value.
60049
+ */
60050
+ async overlayKeepingMarkers(stored, overlay) {
60051
+ const secrets = this._ctx?.secrets;
60052
+ const merged = {
60053
+ ...stored,
60054
+ ...overlay
60055
+ };
60056
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
60057
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
60058
+ unresolved: "keep-marker",
60059
+ ownedBy: secrets.owner
60060
+ });
60061
+ for (const key of Object.keys(overlay)) {
60062
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
60063
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
60064
+ }
60065
+ return merged;
59668
60066
  }
59669
60067
  /**
59670
60068
  * Whether ONE global key of this addon's store was written, read three-way
@@ -59729,8 +60127,12 @@ var BaseAddon = class {
59729
60127
  async clearSecrets(keys, nodeId) {
59730
60128
  const tree = this.addonSecretTree();
59731
60129
  const keychain = this._ctx?.secrets !== void 0;
60130
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
59732
60131
  const patch = {};
59733
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
60132
+ for (const key of keys) {
60133
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
60134
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
60135
+ }
59734
60136
  await this.applyGlobalPatch(patch, nodeId);
59735
60137
  }
59736
60138
  async applyGlobalPatch(barePatch, nodeId) {
@@ -59738,7 +60140,11 @@ var BaseAddon = class {
59738
60140
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
59739
60141
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
59740
60142
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
59741
- await this._ctx?.settings?.writeAddonStore(scoped);
60143
+ const handle = this._secretSettings;
60144
+ if (handle !== null) {
60145
+ const { changed } = await handle.writeAddonStore(scoped);
60146
+ if (!changed) return;
60147
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
59742
60148
  if (target !== localNode) return;
59743
60149
  await this.resolveConfig();
59744
60150
  await this.onConfigChanged();
@@ -59791,7 +60197,7 @@ var BaseAddon = class {
59791
60197
  async getDeviceSettings(deviceId) {
59792
60198
  const schema = this.deviceSettingsSchema();
59793
60199
  if (!schema) return { sections: [] };
59794
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
60200
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
59795
60201
  }
59796
60202
  async updateDeviceSettings(deviceId, patch) {
59797
60203
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -59963,7 +60369,7 @@ var BaseAddon = class {
59963
60369
  key,
59964
60370
  schema,
59965
60371
  fallback,
59966
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
60372
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
59967
60373
  write: async (patch) => {
59968
60374
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
59969
60375
  },
@@ -60025,6 +60431,23 @@ var BaseAddon = class {
60025
60431
  }
60026
60432
  return value;
60027
60433
  }
60434
+ /**
60435
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
60436
+ * keychain the context's own view is already raw.
60437
+ */
60438
+ rawSettings() {
60439
+ return this._secretSettings?.raw ?? this._ctx?.settings;
60440
+ }
60441
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
60442
+ logUnresolvedRead(unresolved) {
60443
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
60444
+ if (fresh.length === 0) return;
60445
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
60446
+ 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) => ({
60447
+ ref: u.ref,
60448
+ reason: u.reason
60449
+ })) } });
60450
+ }
60028
60451
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
60029
60452
  scheduleSecretReresolve(delayMs) {
60030
60453
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -60051,7 +60474,7 @@ var BaseAddon = class {
60051
60474
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
60052
60475
  */
60053
60476
  async readAddonStoreWithRetry() {
60054
- const settings = this._ctx?.settings;
60477
+ const settings = this.rawSettings();
60055
60478
  if (!settings) return {};
60056
60479
  const delaysMs = [
60057
60480
  150,
@@ -61863,6 +62286,16 @@ var CompositionSchema = object({
61863
62286
  seen.add(feature.cap);
61864
62287
  });
61865
62288
  });
62289
+ var NodeColorIdSchema = _enum([
62290
+ "node-a",
62291
+ "node-b",
62292
+ "node-c",
62293
+ "node-d",
62294
+ "node-e",
62295
+ "node-f",
62296
+ "node-g",
62297
+ "node-h"
62298
+ ]);
61866
62299
  new Set([
61867
62300
  "track",
61868
62301
  "face",
@@ -62354,6 +62787,278 @@ var CameraSwitchGroupSchema = object({
62354
62787
  fetchedAt: number()
62355
62788
  });
62356
62789
  /**
62790
+ * The trainer contract — what the hub hands the cloud trainer and what it
62791
+ * gets back (cloud training, D805+).
62792
+ *
62793
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
62794
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
62795
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
62796
+ * lines on stdout. These schemas are the hub's half of that boundary; the
62797
+ * trainer's pydantic models (and the JSON Schemas generated from them under
62798
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
62799
+ * change there, in the same piece of work.
62800
+ *
62801
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
62802
+ * orchestrator fills every field of a job spec explicitly.
62803
+ */
62804
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
62805
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
62806
+ /** What the trainer can export. Edge TPU is a later, separate image. */
62807
+ var TrainingExportSchema = _enum([
62808
+ "onnx",
62809
+ "openvino-fp16",
62810
+ "openvino-int8",
62811
+ "coreml-fp16"
62812
+ ]);
62813
+ var FloorsSchema = record(string(), number().min(0).max(1));
62814
+ object({
62815
+ schema: literal(TRAINING_JOB_SCHEMA),
62816
+ jobKey: string().uuid(),
62817
+ target: object({
62818
+ kind: literal("detector"),
62819
+ step: literal("object-detection")
62820
+ }),
62821
+ base: object({
62822
+ modelId: string().min(1),
62823
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
62824
+ weights: string().min(1),
62825
+ imgsz: number().int().positive()
62826
+ }),
62827
+ baseline: object({
62828
+ modelId: string().min(1),
62829
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
62830
+ onnxUrl: string().url(),
62831
+ imgsz: number().int().positive(),
62832
+ floors: FloorsSchema
62833
+ }),
62834
+ dataset: object({
62835
+ versionId: string().min(1),
62836
+ annotationHash: string(),
62837
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
62838
+ sha256: string().regex(/^[0-9a-f]{64}$/)
62839
+ }),
62840
+ split: object({
62841
+ holdoutCameras: array(number().int()),
62842
+ /** When no camera is held out: the last N days of every camera. */
62843
+ holdoutLastDays: number().int().nonnegative(),
62844
+ valFraction: number().min(0).max(.5),
62845
+ seed: number().int()
62846
+ }),
62847
+ hyper: object({
62848
+ epochs: number().int().positive(),
62849
+ batch: number().int().positive(),
62850
+ lr0: number().positive(),
62851
+ /** Layers frozen from the start of the backbone; 0 = none. */
62852
+ freeze: number().int().nonnegative(),
62853
+ patience: number().int().nonnegative(),
62854
+ seed: number().int()
62855
+ }),
62856
+ replay: object({
62857
+ source: literal("coco2017"),
62858
+ count: number().int().nonnegative()
62859
+ }),
62860
+ exports: array(TrainingExportSchema).min(1),
62861
+ calibration: object({ maxFrames: number().int().positive() }),
62862
+ floors: object({
62863
+ minSupport: number().int().positive(),
62864
+ clamp: number().min(0).max(1)
62865
+ }),
62866
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
62867
+ catalog: object({
62868
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
62869
+ name: string().min(1).max(160)
62870
+ })
62871
+ });
62872
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
62873
+ var TrainingResultFileSchema = object({
62874
+ path: string().min(1),
62875
+ bytes: number().int().nonnegative(),
62876
+ sha256: string().regex(/^[0-9a-f]{64}$/),
62877
+ format: _enum([
62878
+ "onnx",
62879
+ "openvino",
62880
+ "coreml",
62881
+ "pt"
62882
+ ]),
62883
+ variant: _enum(["base", "int8"])
62884
+ });
62885
+ var DraftFormatSchema = object({
62886
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
62887
+ url: string().min(1),
62888
+ sizeMB: number().nonnegative(),
62889
+ isDirectory: boolean().optional(),
62890
+ files: array(string()).optional(),
62891
+ runtimes: array(literal("python")).optional(),
62892
+ revision: string().min(1)
62893
+ });
62894
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
62895
+ var TrainingCatalogDraftSchema = object({
62896
+ id: string().min(1),
62897
+ name: string().min(1),
62898
+ description: string(),
62899
+ labels: array(unknown()),
62900
+ inputSize: object({
62901
+ width: number().int().positive(),
62902
+ height: number().int().positive()
62903
+ }),
62904
+ preprocessMode: literal("letterbox"),
62905
+ defaultClassFloors: FloorsSchema,
62906
+ formats: object({
62907
+ onnx: DraftFormatSchema.optional(),
62908
+ openvino: DraftFormatSchema.optional(),
62909
+ coreml: DraftFormatSchema.optional()
62910
+ })
62911
+ });
62912
+ /** One class of one model's holdout report (the eval harness's summary). */
62913
+ var TrainingEvalClassSchema = object({
62914
+ positives: number().int(),
62915
+ floor: number().nullable(),
62916
+ tp: number().int(),
62917
+ fp: number().int(),
62918
+ fn: number().int(),
62919
+ precision: number().nullable(),
62920
+ recall: number().nullable(),
62921
+ ap50: number().nullable(),
62922
+ recallByCamera: record(string(), number().nullable()).optional(),
62923
+ recallByLight: record(string(), number().nullable()).optional(),
62924
+ fpByCamera: record(string(), number()).optional(),
62925
+ smallFound: number().int().optional(),
62926
+ smallTotal: number().int().optional()
62927
+ }).passthrough();
62928
+ var TrainingEvalReportSchema = object({
62929
+ frames: number().int(),
62930
+ classes: record(string(), TrainingEvalClassSchema)
62931
+ }).passthrough();
62932
+ /**
62933
+ * A succeeded result carries every block; a failed one carries the error and
62934
+ * whatever was known by then — the other blocks are ABSENT, not null. The
62935
+ * orchestrator checks the blocks it needs before it trusts a success.
62936
+ */
62937
+ var TrainingResultSchema = object({
62938
+ schema: literal(TRAINING_RESULT_SCHEMA),
62939
+ jobKey: string(),
62940
+ status: _enum(["succeeded", "failed"]),
62941
+ error: object({
62942
+ stage: string(),
62943
+ code: string(),
62944
+ message: string()
62945
+ }).nullable(),
62946
+ trainer: object({
62947
+ version: string(),
62948
+ revision: string()
62949
+ }),
62950
+ toolchain: record(string(), string().nullable()),
62951
+ dataset: object({
62952
+ versionId: string(),
62953
+ annotationHash: string(),
62954
+ sha256: string(),
62955
+ frames: object({
62956
+ train: number().int(),
62957
+ val: number().int(),
62958
+ holdout: number().int()
62959
+ }),
62960
+ holdoutCameras: array(number().int()),
62961
+ replayImages: number().int()
62962
+ }).optional(),
62963
+ training: object({
62964
+ epochsRun: number().int(),
62965
+ bestEpoch: number().int(),
62966
+ bestMap50: number(),
62967
+ bestMap50_95: number(),
62968
+ seconds: number()
62969
+ }).optional(),
62970
+ evaluation: object({
62971
+ holdoutFrames: number().int(),
62972
+ baseline: TrainingEvalReportSchema.nullable(),
62973
+ candidate: TrainingEvalReportSchema.nullable(),
62974
+ candidateInt8: TrainingEvalReportSchema.nullable(),
62975
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
62976
+ map50: record(string(), number().nullable())
62977
+ }).optional(),
62978
+ floors: object({
62979
+ baseline: FloorsSchema,
62980
+ candidate: FloorsSchema,
62981
+ candidateInt8: FloorsSchema.nullable(),
62982
+ notes: array(string())
62983
+ }).optional(),
62984
+ int8: object({
62985
+ kept: boolean(),
62986
+ map50Fp16: number().nullable(),
62987
+ map50Int8: number().nullable(),
62988
+ reason: string().nullable()
62989
+ }).optional(),
62990
+ exportsDropped: array(object({
62991
+ export: string(),
62992
+ reason: string()
62993
+ })).optional(),
62994
+ files: array(TrainingResultFileSchema).optional(),
62995
+ bundle: object({
62996
+ path: literal("bundle.tar"),
62997
+ bytes: number().int().nonnegative(),
62998
+ sha256: string().regex(/^[0-9a-f]{64}$/)
62999
+ }).nullable().optional(),
63000
+ catalogDraft: object({
63001
+ base: TrainingCatalogDraftSchema,
63002
+ int8: TrainingCatalogDraftSchema.nullable()
63003
+ }).nullable().optional(),
63004
+ licence: string()
63005
+ });
63006
+ var TrainingStageSchema = _enum([
63007
+ "prepare",
63008
+ "replay",
63009
+ "train",
63010
+ "eval",
63011
+ "export",
63012
+ "package"
63013
+ ]);
63014
+ var EventBase = {
63015
+ v: literal(1),
63016
+ ts: number()
63017
+ };
63018
+ discriminatedUnion("type", [
63019
+ object({
63020
+ ...EventBase,
63021
+ type: literal("stage"),
63022
+ stage: TrainingStageSchema
63023
+ }),
63024
+ object({
63025
+ ...EventBase,
63026
+ type: literal("epoch"),
63027
+ epoch: number().int(),
63028
+ epochs: number().int(),
63029
+ boxLoss: number().nullable().optional(),
63030
+ map50: number().nullable().optional(),
63031
+ map50_95: number().nullable().optional(),
63032
+ etaSec: number().nullable().optional()
63033
+ }),
63034
+ object({
63035
+ ...EventBase,
63036
+ type: literal("metric"),
63037
+ name: string(),
63038
+ value: number()
63039
+ }),
63040
+ object({
63041
+ ...EventBase,
63042
+ type: literal("artifact"),
63043
+ path: string(),
63044
+ bytes: number(),
63045
+ sha256: string()
63046
+ }),
63047
+ object({
63048
+ ...EventBase,
63049
+ type: literal("done"),
63050
+ status: _enum(["succeeded", "failed"]),
63051
+ resultSha256: string().nullable().optional()
63052
+ }),
63053
+ object({
63054
+ ...EventBase,
63055
+ type: literal("error"),
63056
+ stage: string(),
63057
+ code: string(),
63058
+ message: string()
63059
+ })
63060
+ ]);
63061
+ /**
62357
63062
  * What the gate decided about a birth, from the CALLER's point of view.
62358
63063
  *
62359
63064
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -64681,7 +65386,9 @@ var AddonHttpRouteSchema = object({
64681
65386
  "authenticated",
64682
65387
  "admin"
64683
65388
  ]).optional(),
64684
- description: string().optional()
65389
+ description: string().optional(),
65390
+ /** The hub limits this route per client address before the handler runs. */
65391
+ rateLimit: _enum(["auth"]).optional()
64685
65392
  });
64686
65393
  /**
64687
65394
  * Cross-process route invocation envelope. The hub captures the
@@ -65386,6 +66093,37 @@ var BackupDestinationInfoSchema = object({
65386
66093
  lastError: string().optional()
65387
66094
  });
65388
66095
  /**
66096
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
66097
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
66098
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
66099
+ * with it off — which restores without a key.
66100
+ */
66101
+ var BackupArchiveEncryptionSchema = object({
66102
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
66103
+ scheme: string(),
66104
+ /** 16 hex — the backup key whose secret restores this archive. */
66105
+ keyId: string()
66106
+ });
66107
+ /**
66108
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
66109
+ * one new archives are encrypted to, and the retired ones older archives
66110
+ * still need. The secret key is shown once, at `setupEncryption`.
66111
+ */
66112
+ var BackupEncryptionStatusSchema = object({
66113
+ enabled: boolean(),
66114
+ active: object({
66115
+ keyId: string(),
66116
+ publicKey: string(),
66117
+ createdAt: number()
66118
+ }).nullable(),
66119
+ /** Every key ever set up, newest first. */
66120
+ keys: array(object({
66121
+ keyId: string(),
66122
+ createdAt: number(),
66123
+ retiredAt: number().nullable()
66124
+ })).readonly()
66125
+ });
66126
+ /**
65389
66127
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
65390
66128
  * Same shape the destination drill-in renders. Sourced from the per-
65391
66129
  * location `manifests.json` (no per-archive tarball read required).
@@ -65397,7 +66135,9 @@ var BackupArchiveEntrySchema = object({
65397
66135
  sizeBytes: number(),
65398
66136
  label: string().optional(),
65399
66137
  /** Top-level locations included in the archive (db, addons, tls, …). */
65400
- locations: array(string()).readonly()
66138
+ locations: array(string()).readonly(),
66139
+ /** Present when the archive is encrypted; restore then needs that key. */
66140
+ encryption: BackupArchiveEncryptionSchema.optional()
65401
66141
  });
65402
66142
  var BackupEntrySchema = object({
65403
66143
  id: string(),
@@ -65406,7 +66146,8 @@ var BackupEntrySchema = object({
65406
66146
  label: string().optional(),
65407
66147
  createdAt: number(),
65408
66148
  sizeBytes: number(),
65409
- locations: array(string()).optional()
66149
+ locations: array(string()).optional(),
66150
+ encryption: BackupArchiveEncryptionSchema.optional()
65410
66151
  });
65411
66152
  var ArchiveEntrySchema = object({
65412
66153
  path: string(),
@@ -65595,10 +66336,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
65595
66336
  * this list and skips entries whose path doesn't start with
65596
66337
  * any of them.
65597
66338
  */
65598
- locations: array(string()).optional()
66339
+ locations: array(string()).optional(),
66340
+ /**
66341
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
66342
+ * one). The archive is decrypted into the hub's private staging
66343
+ * before the restart; the key is not stored. A wrong or missing key
66344
+ * is refused before the archive is downloaded.
66345
+ */
66346
+ backupSecretKey: string().optional()
65599
66347
  }), _void(), {
65600
66348
  kind: "mutation",
65601
66349
  auth: "admin"
66350
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
66351
+ keyId: string(),
66352
+ secretKey: string(),
66353
+ publicKey: string(),
66354
+ createdAt: number(),
66355
+ replacedKeyId: string().nullable()
66356
+ }), {
66357
+ kind: "mutation",
66358
+ auth: "admin"
66359
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
66360
+ kind: "mutation",
66361
+ auth: "admin"
66362
+ }), method(object({ backupSecretKey: string() }), object({
66363
+ valid: boolean(),
66364
+ keyId: string().nullable(),
66365
+ /** The hub knows this key (active or retired). */
66366
+ known: boolean(),
66367
+ /** It is the key new archives are encrypted to. */
66368
+ active: boolean(),
66369
+ error: string().optional()
66370
+ }), {
66371
+ kind: "mutation",
66372
+ auth: "admin"
65602
66373
  }), method(object({
65603
66374
  destinationId: string(),
65604
66375
  backupId: string()
@@ -67324,7 +68095,60 @@ var CustomModelDescriptorSchema = object({
67324
68095
  stepId: string(),
67325
68096
  entry: ModelCatalogEntrySchema
67326
68097
  });
67327
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
68098
+ /** One regular file of an imported bundle, as the producer measured it. */
68099
+ var ModelBundleFileSchema = object({
68100
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
68101
+ path: string().min(1),
68102
+ bytes: number().int().nonnegative(),
68103
+ sha256: string().regex(/^[0-9a-f]{64}$/)
68104
+ });
68105
+ var ImportModelBundleInputSchema = object({
68106
+ /** The registry provider that keeps the model (Model Studio). */
68107
+ addonId: string(),
68108
+ stepId: string().min(1),
68109
+ /**
68110
+ * The catalog rows to register, complete, every format URL already
68111
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
68112
+ * bundle may carry several rows (a base and its INT8 variant).
68113
+ */
68114
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
68115
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
68116
+ bundle: object({
68117
+ ticket: PeerBytesTicketSchema,
68118
+ bytes: number().int().positive(),
68119
+ sha256: string().regex(/^[0-9a-f]{64}$/)
68120
+ }),
68121
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
68122
+ files: array(ModelBundleFileSchema).min(1).max(64),
68123
+ /** Convert missing engine formats and push the model to every agent afterwards. */
68124
+ distribute: boolean()
68125
+ });
68126
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
68127
+ kind: literal("imported"),
68128
+ modelIds: array(string()).readonly(),
68129
+ distributed: array(object({
68130
+ modelId: string(),
68131
+ nodeId: string(),
68132
+ format: _enum(MODEL_FORMATS),
68133
+ ok: boolean(),
68134
+ error: string().optional()
68135
+ })).readonly()
68136
+ }), object({
68137
+ kind: literal("refused"),
68138
+ reason: _enum([
68139
+ "transfer-failed",
68140
+ "checksum-mismatch",
68141
+ "bundle-mismatch",
68142
+ "invalid-entry",
68143
+ "id-taken"
68144
+ ]),
68145
+ detail: string()
68146
+ })]);
68147
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
68148
+ kind: "mutation",
68149
+ auth: "admin",
68150
+ timeoutMs: 30 * 6e4
68151
+ });
67328
68152
  /**
67329
68153
  * Query filter for settings-store collections.
67330
68154
  */
@@ -67803,6 +68627,35 @@ var KeychainKeySourceSchema = object({
67803
68627
  */
67804
68628
  sharesBackupWithDatabase: boolean()
67805
68629
  });
68630
+ /**
68631
+ * One keychain reset, as the Secrets page reports it until the operator
68632
+ * acknowledges it. Never a value: refs, counts and table names only.
68633
+ */
68634
+ var KeychainResetRecordSchema = object({
68635
+ id: string(),
68636
+ at: number(),
68637
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
68638
+ actor: string(),
68639
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
68640
+ lockedReason: string().nullable(),
68641
+ /** Values moved into the archive table (ciphertext under the lost key). */
68642
+ archived: number().int(),
68643
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
68644
+ archivedCollection: string().nullable(),
68645
+ /**
68646
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
68647
+ * so the archive can still be opened if the lost master key turns up.
68648
+ */
68649
+ archivedKeysCollection: string().nullable(),
68650
+ /**
68651
+ * `system-settings` keys whose marker the reset cleared — the cluster
68652
+ * secret's: a marker left pointing at an archived value would refuse every
68653
+ * agent forever (D797).
68654
+ */
68655
+ clearedSettingsKeys: array(string()).readonly(),
68656
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
68657
+ acknowledgedAt: number().nullable()
68658
+ });
67806
68659
  var KeychainStatusSchema = object({
67807
68660
  keychain: KeychainStateSchema,
67808
68661
  /** The source of the master key in use; `null` while locked. */
@@ -67820,7 +68673,9 @@ var KeychainStatusSchema = object({
67820
68673
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
67821
68674
  retiredWraps: number().int(),
67822
68675
  recoveryKeyDownloadedAt: number().nullable(),
67823
- secretCount: number().int()
68676
+ secretCount: number().int(),
68677
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
68678
+ lastReset: KeychainResetRecordSchema.nullable()
67824
68679
  });
67825
68680
  /**
67826
68681
  * Whether a stored value is still pointed at by its owner's settings.
@@ -67842,17 +68697,26 @@ var KeychainAuditActionSchema = _enum([
67842
68697
  "download-recovery-key",
67843
68698
  "delete-orphans",
67844
68699
  "reset",
68700
+ "acknowledge-reset",
67845
68701
  "initialize"
67846
68702
  ]);
67847
68703
  var KeychainAuditEntrySchema = object({
67848
68704
  id: string(),
67849
68705
  at: number(),
67850
68706
  action: KeychainAuditActionSchema,
67851
- /** `addon:<id>` | `user:<id>` | `system`. */
68707
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
67852
68708
  actor: string(),
67853
68709
  ref: string().nullable(),
67854
68710
  detail: string().nullable()
67855
68711
  });
68712
+ var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
68713
+ /**
68714
+ * Secrets the HUB itself holds (owner `system`) that no settings form shows:
68715
+ * `jwt-signing-key` — the session signing key (D797). It is always "in use",
68716
+ * never an orphan; it is generated on a fresh hub and replaced only through
68717
+ * {@link keychainAdminCapability.methods.setSystemSecret}.
68718
+ */
68719
+ var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
67856
68720
  method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}), array(KeychainAdminSecretSchema).readonly(), { auth: "admin" }), method(object({ limit: number().int().min(1).max(500).optional() }), array(KeychainAuditEntrySchema).readonly(), { auth: "admin" }), method(object({ ref: string().min(1) }), object({
67857
68721
  value: string(),
67858
68722
  version: number().int()
@@ -67860,6 +68724,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
67860
68724
  kind: "mutation",
67861
68725
  auth: "admin",
67862
68726
  caller: "required"
68727
+ }), method(object({
68728
+ name: SystemHeldSecretNameSchema,
68729
+ value: string().min(16)
68730
+ }), object({
68731
+ ref: string(),
68732
+ version: number().int()
68733
+ }), {
68734
+ kind: "mutation",
68735
+ auth: "admin",
68736
+ caller: "required"
67863
68737
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
67864
68738
  deleted: array(string()).readonly(),
67865
68739
  kept: array(object({
@@ -67889,13 +68763,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
67889
68763
  kind: "mutation",
67890
68764
  auth: "admin",
67891
68765
  caller: "required"
67892
- }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
68766
+ }), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
67893
68767
  archivedCollection: string().nullable(),
67894
68768
  archived: number().int()
67895
68769
  }), {
67896
68770
  kind: "mutation",
67897
68771
  auth: "admin",
67898
68772
  caller: "required"
68773
+ }), method(object({}), object({
68774
+ reset: KeychainResetRecordSchema.nullable(),
68775
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
68776
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
68777
+ kind: "mutation",
68778
+ auth: "admin",
68779
+ caller: "required"
67899
68780
  });
67900
68781
  method(_void(), object({
67901
68782
  id: string(),
@@ -70473,14 +71354,14 @@ var LlmProfileSchema = object({
70473
71354
  /** ConfigUISchema tree passed through untyped on the wire (the
70474
71355
  * notification-output `ConfigSchemaPassthrough` precedent at
70475
71356
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
70476
- var ConfigSchemaPassthrough$1 = unknown();
71357
+ var ConfigSchemaPassthrough$3 = unknown();
70477
71358
  var LlmProfileKindDescriptorSchema = object({
70478
71359
  kind: LlmProfileKindSchema,
70479
71360
  label: string(),
70480
71361
  icon: string(),
70481
71362
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
70482
71363
  addonId: string(),
70483
- configSchema: ConfigSchemaPassthrough$1
71364
+ configSchema: ConfigSchemaPassthrough$3
70484
71365
  });
70485
71366
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
70486
71367
  var LlmDefaultSchema = object({
@@ -70758,7 +71639,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
70758
71639
  * `login-method` — collection cap through which auth addons contribute
70759
71640
  * their pre-auth login surfaces to the login page. This is the SINGLE,
70760
71641
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
70761
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
71642
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
70762
71643
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
70763
71644
  * procedure aggregates them for the unauthenticated login page.
70764
71645
  *
@@ -70766,8 +71647,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
70766
71647
  *
70767
71648
  * - `redirect` — a declarative button. The login page renders a generic
70768
71649
  * button that navigates to `startUrl` (an addon-owned HTTP route).
70769
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
70770
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
71650
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
70771
71651
  * login page needs NO change.
70772
71652
  *
70773
71653
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -70786,8 +71666,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
70786
71666
  * decision.
70787
71667
  *
70788
71668
  * Every contribution carries a `stage`:
70789
- * - `primary` — shown on the first credentials screen (OIDC /
70790
- * magic-link buttons; a future usernameless passkey).
71669
+ * - `primary` — shown on the first credentials screen (OIDC
71670
+ * buttons; a usernameless passkey).
70791
71671
  * - `second-factor` — shown AFTER the password leg, gated on the
70792
71672
  * returned `factors` (passkey-as-2FA today).
70793
71673
  *
@@ -70814,7 +71694,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
70814
71694
  * The provider names an external identity a signed-in user can link to
70815
71695
  * their own account (D782): `auth.listLinkableProviders` /
70816
71696
  * `beginExternalLink` offer exactly the redirect methods that set this,
70817
- * whatever their id. Absent / false — a login button only (magic-link).
71697
+ * whatever their id. Absent / false — a login button only.
70818
71698
  */
70819
71699
  linkable: boolean().optional()
70820
71700
  }),
@@ -71602,7 +72482,7 @@ var TargetKindCapsSchema = object({
71602
72482
  * the union is large and not meant for runtime validation here; the exported
71603
72483
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
71604
72484
  */
71605
- var ConfigSchemaPassthrough = unknown();
72485
+ var ConfigSchemaPassthrough$2 = unknown();
71606
72486
  var TargetKindSchema = object({
71607
72487
  kind: string(),
71608
72488
  label: string(),
@@ -71639,7 +72519,7 @@ var TargetKindSchema = object({
71639
72519
  * its raster path, which is the safe default for an unknown image.
71640
72520
  */
71641
72521
  iconMediaType: string().optional(),
71642
- configSchema: ConfigSchemaPassthrough,
72522
+ configSchema: ConfigSchemaPassthrough$2,
71643
72523
  /**
71644
72524
  * The config keys that decide WHERE this kind's secrets are sent (server,
71645
72525
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -74669,8 +75549,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
74669
75549
  * `super_admin` — collapsed onto the single boolean because every
74670
75550
  * non-admin caller is governed by the same scope-check rules; the
74671
75551
  * distinction was only ever used to route role-specific procedures
74672
- * which we no longer have. Agents are admin sessions issued via
74673
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
75552
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
74674
75553
  * with `isAdmin: false` + an explicit scope list.
74675
75554
  */
74676
75555
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -74977,6 +75856,61 @@ var OauthIntegrationDescriptorSchema = object({
74977
75856
  });
74978
75857
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
74979
75858
  /**
75859
+ * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
75860
+ *
75861
+ * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
75862
+ * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
75863
+ * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
75864
+ * immutable after create.
75865
+ */
75866
+ var ConfigSchemaPassthrough$1 = unknown();
75867
+ var OidcConnectionSchema = object({
75868
+ id: string().min(1),
75869
+ displayName: string(),
75870
+ icon: string(),
75871
+ issuerUrl: string(),
75872
+ clientId: string(),
75873
+ /** Client id + secret present — never the secret value. */
75874
+ configured: boolean(),
75875
+ /**
75876
+ * Values for the connection form schema. `clientSecret` is a keychain
75877
+ * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
75878
+ */
75879
+ formValues: record(string(), unknown()).optional()
75880
+ });
75881
+ /**
75882
+ * Patch one connection. Omitted or empty `clientSecret` keeps the stored
75883
+ * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
75884
+ */
75885
+ var OidcConnectionUpdateInputSchema = object({
75886
+ id: string().min(1),
75887
+ displayName: string().min(1),
75888
+ icon: string().optional(),
75889
+ issuerUrl: string().optional(),
75890
+ clientId: string().optional(),
75891
+ clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
75892
+ redirectUri: string().optional(),
75893
+ scopes: string().optional(),
75894
+ usernameClaim: _enum([
75895
+ "preferred_username",
75896
+ "email",
75897
+ "sub"
75898
+ ]).optional()
75899
+ });
75900
+ method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
75901
+ id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
75902
+ displayName: string().min(1)
75903
+ }), object({ id: string() }), {
75904
+ kind: "mutation",
75905
+ auth: "admin"
75906
+ }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
75907
+ kind: "mutation",
75908
+ auth: "admin"
75909
+ }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
75910
+ kind: "mutation",
75911
+ auth: "admin"
75912
+ });
75913
+ /**
74980
75914
  * What started a camera's onboard motion (D672). `camera` is the camera's own
74981
75915
  * firmware; `sensor` is a device the operator ATTACHED to it. Absent on the
74982
75916
  * wire means the camera: only the camera-sensors bridge ever says `sensor`.
@@ -76333,21 +77267,69 @@ var RetrainFrameListSchema = object({
76333
77267
  /** What the page pre-selects — the native key frame when one survives. */
76334
77268
  autoPickMediaId: number().int().optional()
76335
77269
  });
77270
+ /** Exclusive partition of a corpus copy's annotation progress (design §4.2). */
77271
+ var RetrainFrameWorkStateSchema = _enum([
77272
+ "unannotated",
77273
+ "annotated",
77274
+ "complete"
77275
+ ]);
77276
+ /**
77277
+ * Filters for paginated corpus list, KPI, and matching export (design §4.4).
77278
+ * Every narrowing field is ANDed; omitted fields impose no constraint.
77279
+ */
77280
+ var RetrainCorpusFilterSchema = object({
77281
+ workState: RetrainFrameWorkStateSchema.optional(),
77282
+ deviceIds: array(number()).max(500).optional(),
77283
+ /** When set, only frames in this named collection. */
77284
+ collectionId: string().optional(),
77285
+ /** Frames that carry at least one saved annotation in one of these classes. */
77286
+ classes: array(RetrainMacroClassSchema).optional(),
77287
+ page: number().int().positive().default(1),
77288
+ pageSize: number().int().positive().max(100).default(50)
77289
+ });
77290
+ var RetrainCorpusPageSchema = object({
77291
+ frames: array(RetrainFrameSchema.extend({ workState: RetrainFrameWorkStateSchema })).readonly(),
77292
+ total: number().int().nonnegative(),
77293
+ page: number().int().positive(),
77294
+ pageSize: number().int().positive()
77295
+ });
77296
+ var RetrainCorpusKpiCameraRowSchema = object({
77297
+ deviceId: number(),
77298
+ unannotated: number().int().nonnegative(),
77299
+ annotated: number().int().nonnegative(),
77300
+ complete: number().int().nonnegative(),
77301
+ /** This camera's `complete` count divided by corpus `total`, in `[0,1]`.
77302
+ * `null` when the corpus is empty (no ratio). */
77303
+ pctOfCorpus: number().min(0).max(1).nullable()
77304
+ });
77305
+ var RetrainCorpusKpiSchema = object({
77306
+ total: number().int().nonnegative(),
77307
+ unannotated: number().int().nonnegative(),
77308
+ annotated: number().int().nonnegative(),
77309
+ complete: number().int().nonnegative(),
77310
+ cameras: array(RetrainCorpusKpiCameraRowSchema).readonly()
77311
+ });
76336
77312
  /**
76337
77313
  * Which frames an annotated export carries. Every field narrows; an empty
76338
- * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
76339
- * list owned by whoever trains (the training orchestrator), so `frameIds` is
76340
- * the primitive a version export uses; `batchId` re-selects what an earlier
76341
- * export carried (`exportedInBatch`).
77314
+ * filter is every annotated copy. `frameIds` is the primitive a job or
77315
+ * download uses; `batchId` re-selects what an earlier export carried
77316
+ * (`exportedInBatch`). Frozen dataset versions were removed — live selection
77317
+ * resolves to `frameIds` at plan/start.
76342
77318
  */
76343
77319
  var RetrainExportFilterSchema = object({
76344
77320
  deviceIds: array(number()).optional(),
76345
77321
  frameIds: array(string()).max(2e4).optional(),
76346
77322
  /** Only frames in at least one of these named collections. */
76347
77323
  collectionIds: array(string()).max(200).optional(),
77324
+ /** Single collection (Frames filter bar). ANDed with `collectionIds` when both set. */
77325
+ collectionId: string().optional(),
76348
77326
  batchId: string().optional(),
76349
77327
  /** Only frames the operator marked complete (all subjects boxed). */
76350
- completeOnly: boolean().optional()
77328
+ completeOnly: boolean().optional(),
77329
+ /** Exclusive work-state partition (`workStateOf`); same as the corpus list. */
77330
+ workState: RetrainFrameWorkStateSchema.optional(),
77331
+ /** Frames with at least one saved annotation in one of these classes. */
77332
+ classes: array(RetrainMacroClassSchema).optional()
76351
77333
  });
76352
77334
  /**
76353
77335
  * `frames`: the full frame copies, boxes in `annotations.json`.
@@ -76512,6 +77494,77 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
76512
77494
  ]),
76513
77495
  detail: string().optional()
76514
77496
  })]);
77497
+ /** What a dataset version is cut from. Every field narrows. */
77498
+ var RetrainDatasetSelectionSchema = object({
77499
+ deviceIds: array(number()).readonly().optional(),
77500
+ collectionIds: array(string()).max(200).readonly().optional(),
77501
+ frameIds: array(string()).max(2e4).readonly().optional()
77502
+ });
77503
+ /** The counts a dataset is judged by. */
77504
+ var RetrainDatasetStatsSchema = object({
77505
+ frames: number().int(),
77506
+ completeFrames: number().int(),
77507
+ /** `completeFrames / frames`, 0..1. */
77508
+ completeness: number(),
77509
+ /** Boxes to learn (model errors excluded). */
77510
+ subjects: number().int(),
77511
+ modelErrors: number().int(),
77512
+ /** Complete frames with no subject. */
77513
+ hardNegatives: number().int(),
77514
+ /** Subjects per class × camera × day/night. */
77515
+ cells: array(object({
77516
+ macroClass: string(),
77517
+ deviceId: number(),
77518
+ lighting: _enum([
77519
+ "day",
77520
+ "night",
77521
+ "unknown"
77522
+ ]),
77523
+ subjects: number().int(),
77524
+ frames: number().int()
77525
+ })).readonly(),
77526
+ cameras: array(object({
77527
+ deviceId: number(),
77528
+ frames: number().int(),
77529
+ completeFrames: number().int()
77530
+ })).readonly()
77531
+ });
77532
+ object({
77533
+ id: string(),
77534
+ name: string(),
77535
+ createdAt: number(),
77536
+ selection: RetrainDatasetSelectionSchema,
77537
+ layout: RetrainExportLayoutSchema,
77538
+ completeOnly: boolean(),
77539
+ frameCount: number().int(),
77540
+ annotationHash: string(),
77541
+ manifestSchema: string(),
77542
+ stats: RetrainDatasetStatsSchema
77543
+ });
77544
+ /**
77545
+ * Live training corpus criteria — same shape as `TrainingCorpusSelection` on
77546
+ * the training cap. Resolved here so plan/start and the annotated export share
77547
+ * one definition of "the frames" (`buildRetrainExportPlan`).
77548
+ */
77549
+ var RetrainTrainingCorpusSelectionSchema = object({
77550
+ collectionIds: array(string()).min(1),
77551
+ workState: _enum([
77552
+ "complete",
77553
+ "annotated_or_complete",
77554
+ "any_annotated"
77555
+ ]).default("complete")
77556
+ });
77557
+ var RetrainTrainingCorpusResolveResultSchema = discriminatedUnion("kind", [object({
77558
+ kind: literal("resolved"),
77559
+ frameIds: array(string()).max(2e4).readonly(),
77560
+ stats: RetrainDatasetStatsSchema,
77561
+ annotationHash: string(),
77562
+ layout: RetrainExportLayoutSchema
77563
+ }), object({
77564
+ kind: literal("refused"),
77565
+ reason: _enum(["unknown-collection", "no-frames"]),
77566
+ detail: string()
77567
+ })]);
76515
77568
  /** The outcome of a lifecycle move owned by the retrain page. */
76516
77569
  var RetrainTransitionResultSchema = object({
76517
77570
  trackId: string(),
@@ -77217,6 +78270,12 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
77217
78270
  }), array(RetrainTrackSchema).readonly(), {
77218
78271
  kind: "query",
77219
78272
  auth: "admin"
78273
+ }), method(RetrainCorpusFilterSchema, RetrainCorpusPageSchema, {
78274
+ kind: "query",
78275
+ auth: "admin"
78276
+ }), method(object({}), RetrainCorpusKpiSchema, {
78277
+ kind: "query",
78278
+ auth: "admin"
77220
78279
  }), method(object({ trackId: string() }), RetrainFrameListSchema, {
77221
78280
  kind: "query",
77222
78281
  auth: "admin"
@@ -77301,6 +78360,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
77301
78360
  kind: "mutation",
77302
78361
  auth: "admin",
77303
78362
  timeoutMs: 60 * 6e4
78363
+ }), method(object({
78364
+ filter: RetrainExportFilterSchema,
78365
+ layout: RetrainExportLayoutSchema
78366
+ }), object({
78367
+ ticket: PeerBytesTicketSchema,
78368
+ frames: number().int(),
78369
+ annotations: number().int()
78370
+ }), {
78371
+ kind: "mutation",
78372
+ auth: "admin",
78373
+ timeoutMs: 12e4
77304
78374
  }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
77305
78375
  kind: "query",
77306
78376
  auth: "admin"
@@ -77327,6 +78397,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
77327
78397
  }), method(object({}), array(RetrainCollectionSchema).readonly(), {
77328
78398
  kind: "query",
77329
78399
  auth: "admin"
78400
+ }), method(RetrainTrainingCorpusSelectionSchema, RetrainTrainingCorpusResolveResultSchema, {
78401
+ kind: "query",
78402
+ auth: "admin",
78403
+ timeoutMs: 6e4
77330
78404
  }), method(object({
77331
78405
  id: string(),
77332
78406
  name: string().max(120)
@@ -77943,11 +79017,14 @@ var HardwareClassIdSchema = _enum([
77943
79017
  "intel-n-series",
77944
79018
  "apple-m-base",
77945
79019
  "apple-m-pro",
79020
+ "amd-phoenix",
77946
79021
  "unknown"
77947
79022
  ]);
77948
79023
  var AcceleratorKindSchema = _enum([
77949
79024
  "intel-npu",
77950
79025
  "intel-igpu",
79026
+ "amd-igpu",
79027
+ "amd-npu",
77951
79028
  "x86-cpu",
77952
79029
  "arm-cpu",
77953
79030
  "apple-ane",
@@ -79877,6 +80954,8 @@ var AgentPipelineSettingsSchema = object({
79877
80954
  * address is wrong (multi-homed host, NAT, custom interface).
79878
80955
  */
79879
80956
  reachableHost: string().optional(),
80957
+ /** Hub-persisted UI colour (`--color-node-*` theme tokens). */
80958
+ color: NodeColorIdSchema.optional(),
79880
80959
  /**
79881
80960
  * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
79882
80961
  * weight, steps}. Absent / all-disabled ⇒ the node's single default
@@ -80426,8 +81505,9 @@ method(object({
80426
81505
  auth: "admin"
80427
81506
  }), method(object({
80428
81507
  agentNodeId: string(),
80429
- reachableHost: string().nullable()
80430
- }), object({ success: literal(true) }), {
81508
+ reachableHost: string().nullable().optional(),
81509
+ color: NodeColorIdSchema.nullable().optional()
81510
+ }).refine((v) => v.reachableHost !== void 0 || v.color !== void 0, { message: "reachableHost or color required" }), object({ success: literal(true) }), {
80431
81511
  kind: "mutation",
80432
81512
  auth: "admin"
80433
81513
  }), method(object({
@@ -80879,8 +81959,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
80879
81959
  * `smtp-provider` — pluggable email delivery surface.
80880
81960
  *
80881
81961
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
80882
- * one for transactional / one for notifications). Consumers (magic-link,
80883
- * notifier addons, …) walk the collection and pick the first
81962
+ * one for transactional / one for notifications). Consumers (notifier
81963
+ * addons, …) walk the collection and pick the first
80884
81964
  * ready provider OR target a specific addonId.
80885
81965
  *
80886
81966
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -81059,7 +82139,7 @@ targets: array(object({
81059
82139
  })));
81060
82140
  /**
81061
82141
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
81062
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
82142
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
81063
82143
  * carrying the post-callback claims before redirecting back to
81064
82144
  * `/api/auth/sso/finish`.
81065
82145
  *
@@ -81122,7 +82202,14 @@ var SsoBridgeClaimsSchema = object({
81122
82202
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
81123
82203
  * subject is unique only per issuer, so a link is bound to it.
81124
82204
  */
81125
- issuer: string().optional()
82205
+ issuer: string().optional(),
82206
+ /**
82207
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
82208
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
82209
+ * request to present the matching cookie — a login bridge is useless in
82210
+ * any other browser.
82211
+ */
82212
+ browserBinding: string().optional()
81126
82213
  });
81127
82214
  method(object({
81128
82215
  claims: SsoBridgeClaimsSchema,
@@ -83496,7 +84583,7 @@ var CustomActionInputSchema = object({
83496
84583
  action: string().min(1),
83497
84584
  input: unknown()
83498
84585
  });
83499
- method(_void(), array(AddonListItemSchema).readonly()), method(object({
84586
+ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSchema).readonly()), method(object({
83500
84587
  addonId: string(),
83501
84588
  limit: number().min(1).max(500).default(100),
83502
84589
  level: LogLevelSchema$2.optional()
@@ -88731,7 +89818,13 @@ var TopologyNodeSchema = object({
88731
89818
  })).readonly(),
88732
89819
  processes: array(TopologyProcessSchema).readonly(),
88733
89820
  categories: array(TopologyCategorySchema).readonly(),
88734
- rootPackage: TopologyRootPackageSchema.nullable()
89821
+ rootPackage: TopologyRootPackageSchema.nullable(),
89822
+ /**
89823
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
89824
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
89825
+ * for offline rows and when the hub cannot tell.
89826
+ */
89827
+ meshTransport: _enum(["tls", "clear"]).optional()
88735
89828
  });
88736
89829
  var CapUsageEdgeSchema = object({
88737
89830
  callerAddonId: string(),
@@ -89144,6 +90237,7 @@ var OsdNamedTemplateSchema = object({
89144
90237
  });
89145
90238
  /** Where a slot's value comes from. */
89146
90239
  var OsdSourceSchema = discriminatedUnion("kind", [
90240
+ object({ kind: literal("none") }),
89147
90241
  object({
89148
90242
  kind: literal("static"),
89149
90243
  text: string().max(64)
@@ -89270,6 +90364,13 @@ method(object({ deviceId: number().int() }), object({
89270
90364
  }), object({ success: literal(true) }), {
89271
90365
  kind: "mutation",
89272
90366
  auth: "admin"
90367
+ }), method(object({
90368
+ deviceId: number().int(),
90369
+ slotId: string().min(1),
90370
+ enabled: boolean()
90371
+ }), object({ success: literal(true) }), {
90372
+ kind: "mutation",
90373
+ auth: "admin"
89273
90374
  }), method(object({
89274
90375
  sourceDeviceId: number().int(),
89275
90376
  targetDeviceId: number().int()
@@ -89701,7 +90802,15 @@ var GpuInfoSchema = object({
89701
90802
  name: string(),
89702
90803
  memoryMB: number().optional()
89703
90804
  });
89704
- var NpuInfoSchema = object({ type: _enum(["apple-ane", "intel-npu"]) });
90805
+ var NpuInfoSchema = object({
90806
+ type: _enum([
90807
+ "apple-ane",
90808
+ "intel-npu",
90809
+ "amd-xdna"
90810
+ ]),
90811
+ name: string().optional(),
90812
+ generation: _enum(["xdna1", "xdna2"]).optional()
90813
+ });
89705
90814
  var CoralInfoSchema = object({
89706
90815
  type: literal("coral-edgetpu"),
89707
90816
  bus: string().optional()
@@ -93554,16 +94663,6 @@ var ApiKeySummarySchema = object({
93554
94663
  createdAt: number(),
93555
94664
  lastUsedAt: number().optional()
93556
94665
  });
93557
- var CreateApiKeyInputSchema = object({
93558
- label: string(),
93559
- isAdmin: boolean().default(false),
93560
- allowedProviders: union([array(string()), literal("*")]).optional(),
93561
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
93562
- });
93563
- var CreateApiKeyResultSchema = object({
93564
- token: string(),
93565
- record: ApiKeySummarySchema
93566
- });
93567
94666
  var ScopedTokenSummarySchema = object({
93568
94667
  id: string(),
93569
94668
  userId: string(),
@@ -93662,17 +94761,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
93662
94761
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
93663
94762
  kind: "mutation",
93664
94763
  access: "view"
93665
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
93666
- kind: "mutation",
93667
- auth: "admin",
93668
- access: "create"
93669
- }), method(object({ id: string() }), object({ success: literal(true) }), {
94764
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
93670
94765
  kind: "mutation",
93671
94766
  auth: "admin",
93672
94767
  access: "delete"
93673
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
93674
- kind: "mutation",
93675
- access: "view"
93676
94768
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
93677
94769
  kind: "mutation",
93678
94770
  auth: "admin",
@@ -93746,15 +94838,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
93746
94838
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
93747
94839
  userId: string(),
93748
94840
  issuer: string()
93749
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
93750
- userId: string(),
93751
- issuer: string().min(1),
93752
- label: string().optional()
93753
- }), object({ success: literal(true) }), {
93754
- kind: "mutation",
93755
- auth: "admin",
93756
- access: "create"
93757
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
94841
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
93758
94842
  kind: "mutation",
93759
94843
  auth: "admin",
93760
94844
  access: "delete"
@@ -94459,6 +95543,563 @@ var zoneRulesCapability = {
94459
95543
  */
94460
95544
  durability: "restored"
94461
95545
  };
95546
+ /**
95547
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
95548
+ *
95549
+ * A thin, mockable translation layer: it knows how to run a container with a
95550
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
95551
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
95552
+ * those are the `training` orchestrator's (D805). Every rule written there
95553
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
95554
+ * manifest entry and nothing else.
95555
+ *
95556
+ * Collection of provider **types** (addons). Each addon owns zero or more
95557
+ * **entries** (credentials + defaults). Concat-fans: `describe`,
95558
+ * `describeTypes`, `listEntries`, `listJobs`. Single-row work is keyed by
95559
+ * `entryId`; callers also pass the owning `addonId` as the collection
95560
+ * selector (broker posture). Every method is `admin`: these spend money.
95561
+ *
95562
+ * Every cloud object a provider creates is tagged with the orchestrator's
95563
+ * `jobKey`, so a retried submit finds the job it already started instead of
95564
+ * starting a second GPU, and `listJobs` can find orphans.
95565
+ *
95566
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
95567
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
95568
+ * ticket the provider mints (D613).
95569
+ */
95570
+ var TrainingGpuOptionSchema = object({
95571
+ id: string(),
95572
+ label: string(),
95573
+ /** List price, USD per GPU-hour, before any region multiplier. */
95574
+ usdPerHour: number().nonnegative(),
95575
+ vramGb: number().nonnegative()
95576
+ });
95577
+ var TrainingRegionOptionSchema = object({
95578
+ /** `''` = any region (the provider's choice). */
95579
+ id: string(),
95580
+ label: string(),
95581
+ priceMultiplier: number().positive()
95582
+ });
95583
+ /**
95584
+ * The provider's per-entry settings, as the orchestrator reads them. They
95585
+ * live on the PROVIDER addon's entry (operator decision 2026-10-08: they
95586
+ * depend on the user's account), never hard-coded in the orchestrator.
95587
+ */
95588
+ var TrainingProviderDefaultsSchema = object({
95589
+ gpuType: string(),
95590
+ region: string(),
95591
+ costCapUsd: number().nonnegative(),
95592
+ maxRuntimeSec: number().int().positive(),
95593
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
95594
+ failedDatasetGraceHours: number().nonnegative()
95595
+ });
95596
+ /**
95597
+ * Entry form schema for a provider type — same seam as notification
95598
+ * `TargetKind.configSchema` (`z.unknown()` at the wire; callers tighten to
95599
+ * {@link ConfigUISchema}). Drives `ConfigFormBuilder` on Training → Providers.
95600
+ */
95601
+ var ConfigSchemaPassthrough = unknown();
95602
+ /** One creatable provider type, for the Add-entry dialog. */
95603
+ var TrainingProviderTypeSchema = object({
95604
+ typeId: string(),
95605
+ label: string(),
95606
+ /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
95607
+ iconAsset: string(),
95608
+ /** Owning `training-provider` addon — collection selector for createEntry. */
95609
+ addonId: string(),
95610
+ /**
95611
+ * Fields for one entry of this type (credentials + defaults). Absent on a
95612
+ * type that only needs a name. Password fields are keychain-backed on the
95613
+ * provider addon (`secretStatePaths`), not D634 plaintext.
95614
+ */
95615
+ configSchema: ConfigSchemaPassthrough.optional()
95616
+ });
95617
+ /** One configured account / workspace under a provider type. */
95618
+ var TrainingProviderEntrySchema = object({
95619
+ entryId: string(),
95620
+ typeId: string(),
95621
+ name: string(),
95622
+ addonId: string(),
95623
+ /** Credentials are present — never the values. */
95624
+ configured: boolean()
95625
+ });
95626
+ var TrainingProviderDescriptorSchema = object({
95627
+ addonId: string(),
95628
+ entryId: string(),
95629
+ typeId: string(),
95630
+ /** Operator-chosen entry name. */
95631
+ name: string(),
95632
+ iconAsset: string(),
95633
+ /** `modal`, `runpod`, `fake`, … — same as typeId for current providers. */
95634
+ kind: string(),
95635
+ label: string(),
95636
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
95637
+ regions: array(TrainingRegionOptionSchema).readonly(),
95638
+ maxDatasetBytes: number().int().positive(),
95639
+ maxRuntimeSec: number().int().positive(),
95640
+ freeTierNote: string().optional(),
95641
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
95642
+ dataResidencyNote: string(),
95643
+ /** Credentials are present — never the values. */
95644
+ configured: boolean(),
95645
+ defaults: TrainingProviderDefaultsSchema,
95646
+ /**
95647
+ * Values for {@link TrainingProviderTypeSchema}'s `configSchema` — password
95648
+ * fields are keychain {@link SecretFieldView} or `null` / `''` (create),
95649
+ * never plaintext. Same hydrate contract as settings forms (D789).
95650
+ */
95651
+ formValues: record(string(), unknown()).optional()
95652
+ });
95653
+ /**
95654
+ * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
95655
+ * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
95656
+ * `{ $secretClear: true }` clears it.
95657
+ */
95658
+ var TrainingProviderUpdateEntryInputSchema = object({
95659
+ entryId: string().min(1),
95660
+ name: string().min(1),
95661
+ tokenId: string().optional(),
95662
+ tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
95663
+ environment: string().optional(),
95664
+ gpuType: string().optional(),
95665
+ region: string().optional(),
95666
+ costCapUsd: number().nonnegative().optional(),
95667
+ maxRuntimeSec: number().int().positive().optional(),
95668
+ failedDatasetGraceHours: number().nonnegative().optional()
95669
+ });
95670
+ var TrainingCredentialCheckSchema = object({
95671
+ ok: boolean(),
95672
+ /** Workspace / account name, when the provider says. */
95673
+ account: string().optional(),
95674
+ reason: _enum([
95675
+ "missing",
95676
+ "invalid",
95677
+ "forbidden",
95678
+ "network",
95679
+ "quota"
95680
+ ]).optional(),
95681
+ detail: string().optional()
95682
+ });
95683
+ var ProviderJobStateSchema = _enum([
95684
+ "pending",
95685
+ "starting",
95686
+ "running",
95687
+ "succeeded",
95688
+ "failed",
95689
+ "cancelled",
95690
+ "lost"
95691
+ ]);
95692
+ var ProviderJobStatusSchema = object({
95693
+ jobKey: string(),
95694
+ providerJobId: string().optional(),
95695
+ state: ProviderJobStateSchema,
95696
+ startedAt: number().optional(),
95697
+ endedAt: number().optional(),
95698
+ exitCode: number().int().optional(),
95699
+ failureReason: string().optional(),
95700
+ gpuType: string(),
95701
+ region: string().optional(),
95702
+ billedSeconds: number().nonnegative(),
95703
+ costUsd: number().nonnegative(),
95704
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
95705
+ costIsEstimate: boolean(),
95706
+ lastFetchedAt: number()
95707
+ });
95708
+ /**
95709
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
95710
+ * image its own way (Modal builds the published Dockerfile at that revision;
95711
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
95712
+ * in `result.json`.
95713
+ */
95714
+ var TrainerSourceRefSchema = object({
95715
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
95716
+ repo: string().min(1),
95717
+ /** A commit sha (never a branch) — the job must be reproducible. */
95718
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
95719
+ });
95720
+ /** Cloud job identity — route with the owning addon's `addonId` selector. */
95721
+ var JobRef = {
95722
+ entryId: string().min(1),
95723
+ jobKey: string().uuid()
95724
+ };
95725
+ var TrainingLogLineSchema = object({
95726
+ ts: number(),
95727
+ text: string()
95728
+ });
95729
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
95730
+ typeId: string().min(1),
95731
+ name: string().min(1)
95732
+ }), object({ entryId: string() }), {
95733
+ kind: "mutation",
95734
+ auth: "admin"
95735
+ }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
95736
+ kind: "mutation",
95737
+ auth: "admin"
95738
+ }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
95739
+ kind: "mutation",
95740
+ auth: "admin"
95741
+ }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
95742
+ kind: "mutation",
95743
+ auth: "admin",
95744
+ timeoutMs: 3e4
95745
+ }), method(object({
95746
+ entryId: string().min(1),
95747
+ gpuType: string(),
95748
+ region: string(),
95749
+ datasetBytes: number().int().nonnegative(),
95750
+ gpuSecondsLow: number().nonnegative(),
95751
+ gpuSecondsHigh: number().nonnegative()
95752
+ }), object({
95753
+ usdLow: number().nonnegative(),
95754
+ usdHigh: number().nonnegative(),
95755
+ notes: array(string()).readonly()
95756
+ }), { auth: "admin" }), method(object({
95757
+ ...JobRef,
95758
+ ticket: PeerBytesTicketSchema
95759
+ }), object({
95760
+ bytes: number().int().nonnegative(),
95761
+ sha256: string()
95762
+ }), {
95763
+ kind: "mutation",
95764
+ auth: "admin",
95765
+ timeoutMs: 120 * 6e4
95766
+ }), method(object({
95767
+ ...JobRef,
95768
+ trainer: TrainerSourceRefSchema,
95769
+ jobSpecJson: string().min(2).max(64e3),
95770
+ gpuType: string(),
95771
+ region: string(),
95772
+ maxRuntimeSec: number().int().positive()
95773
+ }), ProviderJobStatusSchema, {
95774
+ kind: "mutation",
95775
+ auth: "admin",
95776
+ timeoutMs: 30 * 6e4
95777
+ }), method(object(JobRef), ProviderJobStatusSchema, {
95778
+ auth: "admin",
95779
+ timeoutMs: 6e4
95780
+ }), method(object({
95781
+ ...JobRef,
95782
+ cursor: string().optional(),
95783
+ max: number().int().min(1).max(500)
95784
+ }), object({
95785
+ lines: array(TrainingLogLineSchema).readonly(),
95786
+ cursor: string()
95787
+ }), {
95788
+ auth: "admin",
95789
+ timeoutMs: 6e4
95790
+ }), method(object(JobRef), object({ ok: literal(true) }), {
95791
+ kind: "mutation",
95792
+ auth: "admin",
95793
+ timeoutMs: 6e4
95794
+ }), method(object(JobRef), object({
95795
+ found: boolean(),
95796
+ text: string().optional()
95797
+ }), {
95798
+ kind: "mutation",
95799
+ auth: "admin",
95800
+ timeoutMs: 5 * 6e4
95801
+ }), method(object({
95802
+ ...JobRef,
95803
+ path: _enum(["bundle.tar"])
95804
+ }), object({ ticket: PeerBytesTicketSchema }), {
95805
+ kind: "mutation",
95806
+ auth: "admin",
95807
+ timeoutMs: 5 * 6e4
95808
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
95809
+ kind: "mutation",
95810
+ auth: "admin",
95811
+ timeoutMs: 5 * 6e4
95812
+ }), method(object({ entryId: string().min(1).optional() }), array(ProviderJobStatusSchema).readonly(), {
95813
+ auth: "admin",
95814
+ timeoutMs: 2 * 6e4
95815
+ });
95816
+ /**
95817
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
95818
+ * provided by `addon-training`.
95819
+ *
95820
+ * It owns what every provider must agree on, written once:
95821
+ *
95822
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
95823
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
95824
+ * - **The return flow.** Verified artefacts → Model Studio
95825
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
95826
+ * rollback. Nothing is ever registered automatically.
95827
+ *
95828
+ * Plan/start takes a live {@link TrainingCorpusSelection} (collections +
95829
+ * work-state rule); frame ids are resolved via pipeline-analytics at that
95830
+ * moment and snapshotted on the job. No frozen dataset version.
95831
+ *
95832
+ * Every method is `admin`.
95833
+ */
95834
+ /**
95835
+ * Live corpus criteria for plan/start (design §5.2). Default is complete-only.
95836
+ * Frame ids are resolved at plan/start — never a frozen version id.
95837
+ */
95838
+ var TrainingCorpusSelectionSchema = object({
95839
+ collectionIds: array(string()).min(1),
95840
+ /** Default complete-only for v1 */
95841
+ workState: _enum([
95842
+ "complete",
95843
+ "annotated_or_complete",
95844
+ "any_annotated"
95845
+ ]).default("complete")
95846
+ });
95847
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
95848
+ var TrainingBaseModelSchema = object({
95849
+ modelId: string(),
95850
+ label: string(),
95851
+ weights: string(),
95852
+ imgsz: number().int(),
95853
+ baselineOnnxUrl: string(),
95854
+ baselineFloors: record(string(), number()),
95855
+ /** The base the fleet runs most — the UI's default. */
95856
+ recommended: boolean()
95857
+ });
95858
+ var TrainingPresetSchema = _enum([
95859
+ "quick",
95860
+ "standard",
95861
+ "thorough"
95862
+ ]);
95863
+ var TrainingJobRequestSchema = object({
95864
+ /** Live collection + work-state criteria; resolved at plan/start. */
95865
+ selection: TrainingCorpusSelectionSchema,
95866
+ /**
95867
+ * The provider **entry** that runs it (credentials + defaults).
95868
+ * Resolve to an owning addon via `training-provider.describe` / `listEntries`.
95869
+ */
95870
+ entryId: string().min(1),
95871
+ gpuType: string().min(1),
95872
+ region: string(),
95873
+ baseModelId: string().min(1),
95874
+ preset: TrainingPresetSchema,
95875
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
95876
+ freeze: number().int().nonnegative().nullable(),
95877
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
95878
+ holdoutCameras: array(number().int()).nullable()
95879
+ });
95880
+ var TrainingSplitPlanSchema = object({
95881
+ holdoutCameras: array(number().int()).readonly(),
95882
+ /** Used when no camera is held out: the last N days of every camera. */
95883
+ holdoutLastDays: number().int().nonnegative(),
95884
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
95885
+ holdoutSupport: record(string(), number().int()).nullable(),
95886
+ trainSubjects: number().int()
95887
+ });
95888
+ var TrainingRefusalReasonSchema = _enum([
95889
+ "unknown-dataset",
95890
+ "unknown-provider",
95891
+ "provider-not-configured",
95892
+ "unknown-base-model",
95893
+ "unknown-gpu",
95894
+ "dataset-too-large",
95895
+ "no-training-subjects",
95896
+ "job-already-running"
95897
+ ]);
95898
+ var TrainingJobPlanSchema = object({
95899
+ refusal: object({
95900
+ reason: TrainingRefusalReasonSchema,
95901
+ detail: string()
95902
+ }).nullable(),
95903
+ warnings: array(string()).readonly(),
95904
+ split: TrainingSplitPlanSchema.nullable(),
95905
+ estimate: object({
95906
+ datasetBytes: number().int(),
95907
+ uploadMinutesAt20Mbps: number(),
95908
+ gpuSecondsLow: number(),
95909
+ gpuSecondsHigh: number(),
95910
+ usdLow: number(),
95911
+ usdHigh: number(),
95912
+ notes: array(string()).readonly()
95913
+ }).nullable(),
95914
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
95915
+ defaults: object({
95916
+ maxCostUsd: number(),
95917
+ maxRuntimeSec: number().int()
95918
+ }).nullable(),
95919
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
95920
+ dataNotice: string()
95921
+ });
95922
+ /**
95923
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
95924
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
95925
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
95926
+ * result lives after the operator acted on it.
95927
+ */
95928
+ var TrainingJobStateSchema = _enum([
95929
+ "queued",
95930
+ "uploading",
95931
+ "submitted",
95932
+ "starting",
95933
+ "running",
95934
+ "collecting",
95935
+ "ready",
95936
+ "registered",
95937
+ "canary",
95938
+ "failed",
95939
+ "cancelling",
95940
+ "cancelled",
95941
+ "lost",
95942
+ "expired",
95943
+ "discarded"
95944
+ ]);
95945
+ var TrainingFailureReasonSchema = _enum([
95946
+ "cost-cap",
95947
+ "runtime-cap",
95948
+ "upload-failed",
95949
+ "submit-failed",
95950
+ "trainer-failed",
95951
+ "result-invalid",
95952
+ "checksum-mismatch",
95953
+ "fetch-failed",
95954
+ "provider-error",
95955
+ "hub-restart-during-upload"
95956
+ ]);
95957
+ var TrainingProgressPointSchema = object({
95958
+ epoch: number().int(),
95959
+ map50: number().nullable(),
95960
+ map50_95: number().nullable()
95961
+ });
95962
+ var TrainingCanarySchema = object({
95963
+ deviceIds: array(number().int()).readonly(),
95964
+ since: number(),
95965
+ /** Every override the canary replaced, exactly, so rollback restores it. */
95966
+ previous: array(object({
95967
+ deviceId: number().int(),
95968
+ nodeId: string(),
95969
+ deviceKey: string(),
95970
+ patch: object({
95971
+ modelId: string().optional(),
95972
+ settings: record(string(), unknown()).readonly().optional()
95973
+ }).nullable()
95974
+ })).readonly()
95975
+ });
95976
+ var TrainingJobSchema = object({
95977
+ id: string(),
95978
+ idempotencyKey: string(),
95979
+ name: string(),
95980
+ createdAt: number(),
95981
+ updatedAt: number(),
95982
+ state: TrainingJobStateSchema,
95983
+ /**
95984
+ * Shared by every job enqueued together via `startJobBatch`.
95985
+ * `null` for a lone `startJob`. The engine advances queued siblings by this id.
95986
+ */
95987
+ batchId: string().nullable().default(null),
95988
+ stage: TrainingStageSchema.nullable(),
95989
+ failure: object({
95990
+ reason: TrainingFailureReasonSchema,
95991
+ stage: string().nullable(),
95992
+ detail: string()
95993
+ }).nullable(),
95994
+ request: TrainingJobRequestSchema,
95995
+ maxCostUsd: number().nonnegative(),
95996
+ maxRuntimeSec: number().int().positive(),
95997
+ trainer: TrainerSourceRefSchema,
95998
+ datasetLayout: RetrainExportLayoutSchema,
95999
+ /** Frame count snapshotted when the job started (audit; equals `frameIds.length`). */
96000
+ frameCount: number().int().nonnegative(),
96001
+ /** Resolved frame ids at start — the archive ships exactly these. */
96002
+ frameIds: array(string()).max(2e4).readonly(),
96003
+ /** Hash of what those frames taught at start (trainer `dataset.annotationHash`). */
96004
+ annotationHash: string(),
96005
+ dataset: object({
96006
+ bytes: number().int(),
96007
+ sha256: string(),
96008
+ uploadedAt: number()
96009
+ }).nullable(),
96010
+ split: TrainingSplitPlanSchema,
96011
+ provider: object({
96012
+ state: ProviderJobStateSchema.nullable(),
96013
+ providerJobId: string().nullable(),
96014
+ startedAt: number().nullable(),
96015
+ endedAt: number().nullable(),
96016
+ billedSeconds: number(),
96017
+ costUsd: number(),
96018
+ costIsEstimate: boolean(),
96019
+ lastPolledAt: number().nullable()
96020
+ }),
96021
+ progress: object({
96022
+ epoch: number().int().nullable(),
96023
+ epochs: number().int().nullable(),
96024
+ etaSec: number().nullable(),
96025
+ series: array(TrainingProgressPointSchema).readonly()
96026
+ }),
96027
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
96028
+ logTail: array(string()).readonly(),
96029
+ logCursor: string().nullable(),
96030
+ artifacts: object({
96031
+ bundleBytes: number().int(),
96032
+ bundleSha256: string(),
96033
+ fetchedAt: number(),
96034
+ /** When the staged artefacts are deleted from the hub. */
96035
+ expiresAt: number()
96036
+ }).nullable(),
96037
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
96038
+ cloudDatasetDeletedAt: number().nullable(),
96039
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
96040
+ cloudCleanupDueAt: number().nullable(),
96041
+ /** Model ids registered from this job (base, and int8 when kept). */
96042
+ registeredModelIds: array(string()).readonly(),
96043
+ canary: TrainingCanarySchema.nullable()
96044
+ });
96045
+ var IdInput = object({ id: string().min(1) });
96046
+ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
96047
+ auth: "admin",
96048
+ timeoutMs: 6e4
96049
+ }), method(TrainingJobRequestSchema.extend({
96050
+ name: string().min(1).max(120),
96051
+ maxCostUsd: number().positive(),
96052
+ maxRuntimeSec: number().int().positive(),
96053
+ idempotencyKey: string().min(8).max(80)
96054
+ }), discriminatedUnion("kind", [object({
96055
+ kind: literal("started"),
96056
+ job: TrainingJobSchema
96057
+ }), object({
96058
+ kind: literal("refused"),
96059
+ reason: TrainingRefusalReasonSchema,
96060
+ detail: string()
96061
+ })]), {
96062
+ kind: "mutation",
96063
+ auth: "admin",
96064
+ timeoutMs: 12e4
96065
+ }), method(TrainingJobRequestSchema.omit({ baseModelId: true }).extend({
96066
+ baseModelIds: array(string().min(1)).min(1),
96067
+ name: string().min(1).max(120),
96068
+ maxCostUsd: number().positive(),
96069
+ maxRuntimeSec: number().int().positive(),
96070
+ idempotencyKey: string().min(8).max(80)
96071
+ }), discriminatedUnion("kind", [object({
96072
+ kind: literal("started"),
96073
+ batchId: string(),
96074
+ jobs: array(TrainingJobSchema).min(1).readonly()
96075
+ }), object({
96076
+ kind: literal("refused"),
96077
+ reason: TrainingRefusalReasonSchema,
96078
+ detail: string()
96079
+ })]), {
96080
+ kind: "mutation",
96081
+ auth: "admin",
96082
+ timeoutMs: 12e4
96083
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
96084
+ kind: "mutation",
96085
+ auth: "admin",
96086
+ timeoutMs: 12e4
96087
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
96088
+ kind: "mutation",
96089
+ auth: "admin",
96090
+ timeoutMs: 30 * 6e4
96091
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
96092
+ kind: "mutation",
96093
+ auth: "admin",
96094
+ timeoutMs: 12e4
96095
+ }), method(IdInput, TrainingJobSchema, {
96096
+ kind: "mutation",
96097
+ auth: "admin",
96098
+ timeoutMs: 12e4
96099
+ }), method(IdInput, TrainingJobSchema, {
96100
+ kind: "mutation",
96101
+ auth: "admin"
96102
+ });
94462
96103
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
94463
96104
  Object.freeze({
94464
96105
  person: .5,
@@ -96607,6 +98248,12 @@ Object.freeze({
96607
98248
  addonId: null,
96608
98249
  access: "create"
96609
98250
  },
98251
+ "backup.checkBackupKey": {
98252
+ capName: "backup",
98253
+ capScope: "system",
98254
+ addonId: null,
98255
+ access: "create"
98256
+ },
96610
98257
  "backup.delete": {
96611
98258
  capName: "backup",
96612
98259
  capScope: "system",
@@ -96619,6 +98266,18 @@ Object.freeze({
96619
98266
  addonId: null,
96620
98267
  access: "delete"
96621
98268
  },
98269
+ "backup.disableEncryption": {
98270
+ capName: "backup",
98271
+ capScope: "system",
98272
+ addonId: null,
98273
+ access: "create"
98274
+ },
98275
+ "backup.getEncryption": {
98276
+ capName: "backup",
98277
+ capScope: "system",
98278
+ addonId: null,
98279
+ access: "view"
98280
+ },
96622
98281
  "backup.getEntries": {
96623
98282
  capName: "backup",
96624
98283
  capScope: "system",
@@ -96673,6 +98332,12 @@ Object.freeze({
96673
98332
  addonId: null,
96674
98333
  access: "create"
96675
98334
  },
98335
+ "backup.setupEncryption": {
98336
+ capName: "backup",
98337
+ capScope: "system",
98338
+ addonId: null,
98339
+ access: "create"
98340
+ },
96676
98341
  "backup.trigger": {
96677
98342
  capName: "backup",
96678
98343
  capScope: "system",
@@ -97225,6 +98890,12 @@ Object.freeze({
97225
98890
  addonId: null,
97226
98891
  access: "create"
97227
98892
  },
98893
+ "customModelRegistry.importModelBundle": {
98894
+ capName: "custom-model-registry",
98895
+ capScope: "system",
98896
+ addonId: null,
98897
+ access: "create"
98898
+ },
97228
98899
  "customModelRegistry.listModels": {
97229
98900
  capName: "custom-model-registry",
97230
98901
  capScope: "system",
@@ -98665,6 +100336,12 @@ Object.freeze({
98665
100336
  addonId: null,
98666
100337
  access: "view"
98667
100338
  },
100339
+ "keychainAdmin.acknowledgeReset": {
100340
+ capName: "keychain-admin",
100341
+ capScope: "system",
100342
+ addonId: null,
100343
+ access: "create"
100344
+ },
98668
100345
  "keychainAdmin.deleteOrphans": {
98669
100346
  capName: "keychain-admin",
98670
100347
  capScope: "system",
@@ -98701,6 +100378,12 @@ Object.freeze({
98701
100378
  addonId: null,
98702
100379
  access: "delete"
98703
100380
  },
100381
+ "keychainAdmin.resetReport": {
100382
+ capName: "keychain-admin",
100383
+ capScope: "system",
100384
+ addonId: null,
100385
+ access: "delete"
100386
+ },
98704
100387
  "keychainAdmin.reveal": {
98705
100388
  capName: "keychain-admin",
98706
100389
  capScope: "system",
@@ -98713,6 +100396,12 @@ Object.freeze({
98713
100396
  addonId: null,
98714
100397
  access: "create"
98715
100398
  },
100399
+ "keychainAdmin.setSystemSecret": {
100400
+ capName: "keychain-admin",
100401
+ capScope: "system",
100402
+ addonId: null,
100403
+ access: "create"
100404
+ },
98716
100405
  "keychainAdmin.status": {
98717
100406
  capName: "keychain-admin",
98718
100407
  capScope: "system",
@@ -99949,6 +101638,36 @@ Object.freeze({
99949
101638
  addonId: null,
99950
101639
  access: "view"
99951
101640
  },
101641
+ "oidcConnections.connectionFormSchema": {
101642
+ capName: "oidc-connections",
101643
+ capScope: "system",
101644
+ addonId: null,
101645
+ access: "view"
101646
+ },
101647
+ "oidcConnections.createConnection": {
101648
+ capName: "oidc-connections",
101649
+ capScope: "system",
101650
+ addonId: null,
101651
+ access: "create"
101652
+ },
101653
+ "oidcConnections.deleteConnection": {
101654
+ capName: "oidc-connections",
101655
+ capScope: "system",
101656
+ addonId: null,
101657
+ access: "delete"
101658
+ },
101659
+ "oidcConnections.listConnections": {
101660
+ capName: "oidc-connections",
101661
+ capScope: "system",
101662
+ addonId: null,
101663
+ access: "view"
101664
+ },
101665
+ "oidcConnections.updateConnection": {
101666
+ capName: "oidc-connections",
101667
+ capScope: "system",
101668
+ addonId: null,
101669
+ access: "create"
101670
+ },
99952
101671
  "osd.getStatus": {
99953
101672
  capName: "osd",
99954
101673
  capScope: "device",
@@ -100021,6 +101740,12 @@ Object.freeze({
100021
101740
  addonId: null,
100022
101741
  access: "create"
100023
101742
  },
101743
+ "osdManager.setSlotCameraEnabled": {
101744
+ capName: "osd-manager",
101745
+ capScope: "system",
101746
+ addonId: null,
101747
+ access: "create"
101748
+ },
100024
101749
  "osdManager.upsertTemplate": {
100025
101750
  capName: "osd-manager",
100026
101751
  capScope: "system",
@@ -100273,6 +101998,12 @@ Object.freeze({
100273
101998
  addonId: null,
100274
101999
  access: "view"
100275
102000
  },
102001
+ "pipelineAnalytics.getRetrainCorpusKpi": {
102002
+ capName: "pipeline-analytics",
102003
+ capScope: "device",
102004
+ addonId: null,
102005
+ access: "view"
102006
+ },
100276
102007
  "pipelineAnalytics.getRetrainExportUrl": {
100277
102008
  capName: "pipeline-analytics",
100278
102009
  capScope: "device",
@@ -100393,6 +102124,12 @@ Object.freeze({
100393
102124
  addonId: null,
100394
102125
  access: "view"
100395
102126
  },
102127
+ "pipelineAnalytics.listRetrainCorpusPage": {
102128
+ capName: "pipeline-analytics",
102129
+ capScope: "device",
102130
+ addonId: null,
102131
+ access: "view"
102132
+ },
100396
102133
  "pipelineAnalytics.listRetrainFrames": {
100397
102134
  capName: "pipeline-analytics",
100398
102135
  capScope: "device",
@@ -100423,6 +102160,12 @@ Object.freeze({
100423
102160
  addonId: null,
100424
102161
  access: "view"
100425
102162
  },
102163
+ "pipelineAnalytics.offerRetrainArchive": {
102164
+ capName: "pipeline-analytics",
102165
+ capScope: "device",
102166
+ addonId: null,
102167
+ access: "create"
102168
+ },
100426
102169
  "pipelineAnalytics.ownersWithMedia": {
100427
102170
  capName: "pipeline-analytics",
100428
102171
  capScope: "device",
@@ -100513,6 +102256,12 @@ Object.freeze({
100513
102256
  addonId: null,
100514
102257
  access: "create"
100515
102258
  },
102259
+ "pipelineAnalytics.resolveRetrainTrainingCorpus": {
102260
+ capName: "pipeline-analytics",
102261
+ capScope: "device",
102262
+ addonId: null,
102263
+ access: "view"
102264
+ },
100516
102265
  "pipelineAnalytics.restageRetrainTrack": {
100517
102266
  capName: "pipeline-analytics",
100518
102267
  capScope: "device",
@@ -102949,6 +104698,180 @@ Object.freeze({
102949
104698
  addonId: null,
102950
104699
  access: "view"
102951
104700
  },
104701
+ "training.canaryResult": {
104702
+ capName: "training",
104703
+ capScope: "system",
104704
+ addonId: null,
104705
+ access: "create"
104706
+ },
104707
+ "training.cancelJob": {
104708
+ capName: "training",
104709
+ capScope: "system",
104710
+ addonId: null,
104711
+ access: "create"
104712
+ },
104713
+ "training.discardResult": {
104714
+ capName: "training",
104715
+ capScope: "system",
104716
+ addonId: null,
104717
+ access: "create"
104718
+ },
104719
+ "training.getJob": {
104720
+ capName: "training",
104721
+ capScope: "system",
104722
+ addonId: null,
104723
+ access: "view"
104724
+ },
104725
+ "training.getJobResult": {
104726
+ capName: "training",
104727
+ capScope: "system",
104728
+ addonId: null,
104729
+ access: "view"
104730
+ },
104731
+ "training.listBaseModels": {
104732
+ capName: "training",
104733
+ capScope: "system",
104734
+ addonId: null,
104735
+ access: "view"
104736
+ },
104737
+ "training.listJobs": {
104738
+ capName: "training",
104739
+ capScope: "system",
104740
+ addonId: null,
104741
+ access: "view"
104742
+ },
104743
+ "training.planJob": {
104744
+ capName: "training",
104745
+ capScope: "system",
104746
+ addonId: null,
104747
+ access: "view"
104748
+ },
104749
+ "training.registerResult": {
104750
+ capName: "training",
104751
+ capScope: "system",
104752
+ addonId: null,
104753
+ access: "create"
104754
+ },
104755
+ "training.rollbackCanary": {
104756
+ capName: "training",
104757
+ capScope: "system",
104758
+ addonId: null,
104759
+ access: "create"
104760
+ },
104761
+ "training.startJob": {
104762
+ capName: "training",
104763
+ capScope: "system",
104764
+ addonId: null,
104765
+ access: "create"
104766
+ },
104767
+ "training.startJobBatch": {
104768
+ capName: "training",
104769
+ capScope: "system",
104770
+ addonId: null,
104771
+ access: "create"
104772
+ },
104773
+ "trainingProvider.cancelJob": {
104774
+ capName: "training-provider",
104775
+ capScope: "system",
104776
+ addonId: null,
104777
+ access: "create"
104778
+ },
104779
+ "trainingProvider.cleanupJob": {
104780
+ capName: "training-provider",
104781
+ capScope: "system",
104782
+ addonId: null,
104783
+ access: "create"
104784
+ },
104785
+ "trainingProvider.createEntry": {
104786
+ capName: "training-provider",
104787
+ capScope: "system",
104788
+ addonId: null,
104789
+ access: "create"
104790
+ },
104791
+ "trainingProvider.deleteEntry": {
104792
+ capName: "training-provider",
104793
+ capScope: "system",
104794
+ addonId: null,
104795
+ access: "delete"
104796
+ },
104797
+ "trainingProvider.describe": {
104798
+ capName: "training-provider",
104799
+ capScope: "system",
104800
+ addonId: null,
104801
+ access: "view"
104802
+ },
104803
+ "trainingProvider.describeTypes": {
104804
+ capName: "training-provider",
104805
+ capScope: "system",
104806
+ addonId: null,
104807
+ access: "view"
104808
+ },
104809
+ "trainingProvider.estimateJob": {
104810
+ capName: "training-provider",
104811
+ capScope: "system",
104812
+ addonId: null,
104813
+ access: "view"
104814
+ },
104815
+ "trainingProvider.getJob": {
104816
+ capName: "training-provider",
104817
+ capScope: "system",
104818
+ addonId: null,
104819
+ access: "view"
104820
+ },
104821
+ "trainingProvider.listEntries": {
104822
+ capName: "training-provider",
104823
+ capScope: "system",
104824
+ addonId: null,
104825
+ access: "view"
104826
+ },
104827
+ "trainingProvider.listJobEvents": {
104828
+ capName: "training-provider",
104829
+ capScope: "system",
104830
+ addonId: null,
104831
+ access: "view"
104832
+ },
104833
+ "trainingProvider.listJobs": {
104834
+ capName: "training-provider",
104835
+ capScope: "system",
104836
+ addonId: null,
104837
+ access: "view"
104838
+ },
104839
+ "trainingProvider.offerArtifact": {
104840
+ capName: "training-provider",
104841
+ capScope: "system",
104842
+ addonId: null,
104843
+ access: "create"
104844
+ },
104845
+ "trainingProvider.readResult": {
104846
+ capName: "training-provider",
104847
+ capScope: "system",
104848
+ addonId: null,
104849
+ access: "create"
104850
+ },
104851
+ "trainingProvider.submitJob": {
104852
+ capName: "training-provider",
104853
+ capScope: "system",
104854
+ addonId: null,
104855
+ access: "create"
104856
+ },
104857
+ "trainingProvider.updateEntry": {
104858
+ capName: "training-provider",
104859
+ capScope: "system",
104860
+ addonId: null,
104861
+ access: "create"
104862
+ },
104863
+ "trainingProvider.uploadDataset": {
104864
+ capName: "training-provider",
104865
+ capScope: "system",
104866
+ addonId: null,
104867
+ access: "create"
104868
+ },
104869
+ "trainingProvider.validateCredentials": {
104870
+ capName: "training-provider",
104871
+ capScope: "system",
104872
+ addonId: null,
104873
+ access: "create"
104874
+ },
102952
104875
  "turnProvider.getTurnServers": {
102953
104876
  capName: "turn-provider",
102954
104877
  capScope: "system",
@@ -102973,12 +104896,6 @@ Object.freeze({
102973
104896
  addonId: null,
102974
104897
  access: "create"
102975
104898
  },
102976
- "userManagement.createApiKey": {
102977
- capName: "user-management",
102978
- capScope: "system",
102979
- addonId: null,
102980
- access: "create"
102981
- },
102982
104899
  "userManagement.createScopedToken": {
102983
104900
  capName: "user-management",
102984
104901
  capScope: "system",
@@ -103015,12 +104932,6 @@ Object.freeze({
103015
104932
  addonId: null,
103016
104933
  access: "view"
103017
104934
  },
103018
- "userManagement.linkExternalIdentity": {
103019
- capName: "user-management",
103020
- capScope: "system",
103021
- addonId: null,
103022
- access: "create"
103023
- },
103024
104935
  "userManagement.listApiKeys": {
103025
104936
  capName: "user-management",
103026
104937
  capScope: "system",
@@ -103123,12 +105034,6 @@ Object.freeze({
103123
105034
  addonId: null,
103124
105035
  access: "create"
103125
105036
  },
103126
- "userManagement.validateApiKey": {
103127
- capName: "user-management",
103128
- capScope: "system",
103129
- addonId: null,
103130
- access: "view"
103131
- },
103132
105037
  "userManagement.validateCredentials": {
103133
105038
  capName: "user-management",
103134
105039
  capScope: "system",
@@ -106161,6 +108066,11 @@ Object.freeze({
106161
108066
  form: "single",
106162
108067
  optional: false
106163
108068
  }],
108069
+ "osdManager.setSlotCameraEnabled": [{
108070
+ name: "deviceId",
108071
+ form: "single",
108072
+ optional: false
108073
+ }],
106164
108074
  "petFeeder.callPet": [{
106165
108075
  name: "deviceId",
106166
108076
  form: "single",
@@ -106381,6 +108291,11 @@ Object.freeze({
106381
108291
  form: "array",
106382
108292
  optional: false
106383
108293
  }],
108294
+ "pipelineAnalytics.listRetrainCorpusPage": [{
108295
+ name: "deviceIds",
108296
+ form: "array",
108297
+ optional: true
108298
+ }],
106384
108299
  "pipelineAnalytics.listRetrainStaging": [{
106385
108300
  name: "deviceIds",
106386
108301
  form: "array",
@@ -107242,6 +109157,11 @@ Object.freeze({
107242
109157
  form: "single",
107243
109158
  optional: false
107244
109159
  }],
109160
+ "training.canaryResult": [{
109161
+ name: "deviceIds",
109162
+ form: "array",
109163
+ optional: false
109164
+ }],
107245
109165
  "update.getStatus": [{
107246
109166
  name: "deviceId",
107247
109167
  form: "single",
@@ -107485,6 +109405,7 @@ Object.freeze({
107485
109405
  });
107486
109406
  Object.freeze({
107487
109407
  "broker": "broker",
109408
+ "calendar-source": "calendar",
107488
109409
  "device-export": "device-export",
107489
109410
  "llm": "ai",
107490
109411
  "mesh-network": "mesh",
@@ -107970,6 +109891,8 @@ var STATE_SUMMARY_VARS = [
107970
109891
  [...RULE_TEXT],
107971
109892
  [...RULE_TEXT],
107972
109893
  [...RULE_TEXT],
109894
+ [...RULE_TEXT],
109895
+ [...RULE_TEXT],
107973
109896
  ([...RULE_TEXT], [...UPDATES]),
107974
109897
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
107975
109898
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),