@camstack/addon-provider-tuya 0.2.122 → 0.2.124

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +2068 -145
  2. package/dist/addon.mjs +2068 -145
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -6197,7 +6197,7 @@ var ZodIssueCode = {
6197
6197
  var ZodFirstPartyTypeKind;
6198
6198
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6199
6199
  //#endregion
6200
- //#region ../types/dist/sleep-Cr5YOk3m.mjs
6200
+ //#region ../types/dist/sleep-DwAQ9sqX.mjs
6201
6201
  /**
6202
6202
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6203
6203
  * window to float samples (D455).
@@ -6314,7 +6314,7 @@ function isKeychainStoredField(field) {
6314
6314
  var SECRET_CLEAR = { $secretClear: true };
6315
6315
  /** The `'***'` token D634 redaction writes for non-admins. */
6316
6316
  var LEGACY_DEVICE_REDACTION = "***";
6317
- function isRecord$1(value) {
6317
+ function isRecord$2(value) {
6318
6318
  return typeof value === "object" && value !== null && !Array.isArray(value);
6319
6319
  }
6320
6320
  function makeSecretMarker(ref) {
@@ -6325,12 +6325,12 @@ function makeSecretMarker(ref) {
6325
6325
  }
6326
6326
  /** A stored marker: an object whose `$secret` is a non-empty string. */
6327
6327
  function isSecretMarker(value) {
6328
- if (!isRecord$1(value)) return false;
6328
+ if (!isRecord$2(value)) return false;
6329
6329
  const ref = value["$secret"];
6330
6330
  return typeof ref === "string" && ref.length > 0;
6331
6331
  }
6332
6332
  function isSecretClear(value) {
6333
- return isRecord$1(value) && value["$secretClear"] === true;
6333
+ return isRecord$2(value) && value["$secretClear"] === true;
6334
6334
  }
6335
6335
  /**
6336
6336
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6846,6 +6846,13 @@ function globalSecretScope() {
6846
6846
  function encodeSegment(value) {
6847
6847
  return encodeURIComponent(value);
6848
6848
  }
6849
+ function decodeSegment(value) {
6850
+ try {
6851
+ return decodeURIComponent(value);
6852
+ } catch {
6853
+ return null;
6854
+ }
6855
+ }
6849
6856
  /**
6850
6857
  * The field path of a value inside an array item, addressed by the item's id:
6851
6858
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6854,6 +6861,75 @@ function encodeSegment(value) {
6854
6861
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6855
6862
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6856
6863
  }
6864
+ function parseScope(segments) {
6865
+ switch (segments[0]) {
6866
+ case "global": return {
6867
+ scope: GLOBAL_SCOPE,
6868
+ used: 1
6869
+ };
6870
+ case "node": {
6871
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6872
+ return nodeId === null || nodeId.length === 0 ? null : {
6873
+ scope: {
6874
+ kind: "node",
6875
+ nodeId
6876
+ },
6877
+ used: 2
6878
+ };
6879
+ }
6880
+ case "device": {
6881
+ const raw = segments[1];
6882
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6883
+ return {
6884
+ scope: {
6885
+ kind: "device",
6886
+ deviceId: Number(raw)
6887
+ },
6888
+ used: 2
6889
+ };
6890
+ }
6891
+ case "integration": {
6892
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6893
+ return id === null || id.length === 0 ? null : {
6894
+ scope: {
6895
+ kind: "integration",
6896
+ integrationId: id
6897
+ },
6898
+ used: 2
6899
+ };
6900
+ }
6901
+ case "row": {
6902
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6903
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6904
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6905
+ return {
6906
+ scope: {
6907
+ kind: "row",
6908
+ collection,
6909
+ rowId
6910
+ },
6911
+ used: 3
6912
+ };
6913
+ }
6914
+ default: return null;
6915
+ }
6916
+ }
6917
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6918
+ function parseSecretRef(ref) {
6919
+ if (!ref.startsWith("secret://")) return null;
6920
+ const segments = ref.slice(9).split("/");
6921
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6922
+ if (owner === null || owner.length === 0) return null;
6923
+ const parsed = parseScope(segments.slice(1));
6924
+ if (parsed === null) return null;
6925
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6926
+ if (fieldPath.length === 0) return null;
6927
+ return {
6928
+ owner,
6929
+ scope: parsed.scope,
6930
+ fieldPath
6931
+ };
6932
+ }
6857
6933
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6858
6934
  var KeychainWriteRefusedError = class extends Error {
6859
6935
  fieldPath;
@@ -6864,7 +6940,7 @@ var KeychainWriteRefusedError = class extends Error {
6864
6940
  }
6865
6941
  };
6866
6942
  var KEEP = { kind: "keep" };
6867
- function isRecord(value) {
6943
+ function isRecord$1(value) {
6868
6944
  return typeof value === "object" && value !== null && !Array.isArray(value);
6869
6945
  }
6870
6946
  function defaultMintId() {
@@ -6877,7 +6953,7 @@ function collectSecretMarkerRefs(value, out = []) {
6877
6953
  return out;
6878
6954
  }
6879
6955
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6880
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6956
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6881
6957
  return out;
6882
6958
  }
6883
6959
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6932,7 +7008,7 @@ function rowId(row, idKey) {
6932
7008
  return null;
6933
7009
  }
6934
7010
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6935
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
7011
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6936
7012
  if (!Array.isArray(incoming)) {
6937
7013
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6938
7014
  return {
@@ -6948,7 +7024,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6948
7024
  const kept = /* @__PURE__ */ new Set();
6949
7025
  const rows = [];
6950
7026
  for (const row of incoming) {
6951
- if (!isRecord(row)) {
7027
+ if (!isRecord$1(row)) {
6952
7028
  rows.push(row);
6953
7029
  continue;
6954
7030
  }
@@ -6973,7 +7049,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6973
7049
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6974
7050
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6975
7051
  case "object": {
6976
- if (!isRecord(incoming)) {
7052
+ if (!isRecord$1(incoming)) {
6977
7053
  if (incoming === void 0) return KEEP;
6978
7054
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6979
7055
  return {
@@ -6981,7 +7057,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6981
7057
  value: incoming
6982
7058
  };
6983
7059
  }
6984
- const storedObj = isRecord(stored) ? stored : {};
7060
+ const storedObj = isRecord$1(stored) ? stored : {};
6985
7061
  return {
6986
7062
  kind: "value",
6987
7063
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -7040,12 +7116,19 @@ async function transformSecretWrite(input) {
7040
7116
  }
7041
7117
  };
7042
7118
  }
7119
+ /** Is `ref` one of `owner`'s refs? */
7120
+ function isSecretRefOwnedBy(ref, owner) {
7121
+ return parseSecretRef(ref)?.owner === owner;
7122
+ }
7043
7123
  /**
7044
7124
  * Replace every marker in `value` with its keychain value. Returns the SAME
7045
7125
  * reference when there is no marker (no allocation, no keychain call).
7046
7126
  */
7047
- async function resolveSecretMarkers(value, secrets) {
7048
- const refs = collectSecretMarkerRefs(value);
7127
+ async function resolveSecretMarkers(value, secrets, options = {}) {
7128
+ const keepMarker = options.unresolved === "keep-marker";
7129
+ const owner = options.ownedBy;
7130
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
7131
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
7049
7132
  if (refs.length === 0) return {
7050
7133
  value,
7051
7134
  unresolved: []
@@ -7069,10 +7152,18 @@ async function resolveSecretMarkers(value, secrets) {
7069
7152
  }
7070
7153
  const substitute = (v) => {
7071
7154
  if (isSecretMarker(v)) {
7155
+ if (!inScope(v.$secret)) return {
7156
+ keep: true,
7157
+ value: v
7158
+ };
7072
7159
  const answer = answers[v.$secret];
7073
- return answer?.kind === "value" ? {
7160
+ if (answer?.kind === "value") return {
7074
7161
  keep: true,
7075
7162
  value: answer.value
7163
+ };
7164
+ return keepMarker ? {
7165
+ keep: true,
7166
+ value: v
7076
7167
  } : {
7077
7168
  keep: false,
7078
7169
  value: void 0
@@ -7089,7 +7180,7 @@ async function resolveSecretMarkers(value, secrets) {
7089
7180
  value: items
7090
7181
  };
7091
7182
  }
7092
- if (isRecord(v)) {
7183
+ if (isRecord$1(v)) {
7093
7184
  const out = {};
7094
7185
  for (const [k, child] of Object.entries(v)) {
7095
7186
  const s = substitute(child);
@@ -7110,14 +7201,152 @@ async function resolveSecretMarkers(value, secrets) {
7110
7201
  unresolved
7111
7202
  };
7112
7203
  }
7113
- function touchesTree(tree, patch) {
7114
- if (tree.size === 0) return false;
7115
- for (const key of Object.keys(patch)) {
7116
- const at = key.indexOf("@");
7117
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
7204
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
7205
+ var SecretOverwriteRefusedError = class extends Error {
7206
+ ref;
7207
+ reason;
7208
+ constructor(ref, reason) {
7209
+ 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.`);
7210
+ this.ref = ref;
7211
+ this.reason = reason;
7212
+ this.name = "SecretOverwriteRefusedError";
7213
+ }
7214
+ };
7215
+ function isRecord(value) {
7216
+ return typeof value === "object" && value !== null && !Array.isArray(value);
7217
+ }
7218
+ function resolvedValue(pass, marker) {
7219
+ const answer = pass.answers[marker.$secret];
7220
+ return answer?.kind === "value" ? answer.value : null;
7221
+ }
7222
+ async function atMarker(pass, incoming, stored) {
7223
+ if (incoming === null) return stored;
7224
+ if (typeof incoming !== "string") return incoming;
7225
+ if (incoming === resolvedValue(pass, stored)) return stored;
7226
+ const intent = classifySecretWrite(incoming);
7227
+ if (intent.kind !== "set") return stored;
7228
+ const ref = stored.$secret;
7229
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
7230
+ const answer = pass.answers[ref];
7231
+ 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);
7232
+ try {
7233
+ await pass.secrets.put(ref, intent.value);
7234
+ } catch (err) {
7235
+ throw new KeychainWriteRefusedError(ref, err);
7236
+ }
7237
+ pass.changedRefs.push(ref);
7238
+ return stored;
7239
+ }
7240
+ function inArray(pass, incoming, stored) {
7241
+ return incoming.map((item, index) => {
7242
+ const twin = stored[index];
7243
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
7244
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
7245
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
7246
+ return item;
7247
+ });
7248
+ }
7249
+ function inArrayRow(pass, incoming, stored) {
7250
+ const out = { ...incoming };
7251
+ for (const [key, value] of Object.entries(incoming)) {
7252
+ const twin = stored[key];
7253
+ if (isSecretMarker(twin)) {
7254
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
7255
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
7256
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
7257
+ }
7258
+ return out;
7259
+ }
7260
+ async function walk(pass, incoming, stored) {
7261
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
7262
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
7263
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
7264
+ const out = { ...incoming };
7265
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
7266
+ return out;
7267
+ }
7268
+ /** Restore markers a write-back carries as values. See the file doc. */
7269
+ async function restoreUnchangedSecrets(input) {
7270
+ const refs = [];
7271
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
7272
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
7273
+ if (owned.length === 0) return {
7274
+ patch: input.patch,
7275
+ changedRefs: []
7276
+ };
7277
+ const pass = {
7278
+ secrets: input.secrets,
7279
+ answers: await input.secrets.resolve([...new Set(owned)]),
7280
+ operatorWrite: input.operatorWrite,
7281
+ changedRefs: []
7282
+ };
7283
+ const out = {};
7284
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
7285
+ return {
7286
+ patch: out,
7287
+ changedRefs: pass.changedRefs
7288
+ };
7289
+ }
7290
+ /** Structural equality over JSON-shaped values (key order does not matter). */
7291
+ function isJsonEqual(a, b) {
7292
+ if (Object.is(a, b)) return true;
7293
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
7294
+ if (isRecord(a) && isRecord(b)) {
7295
+ const keys = Object.keys(a);
7296
+ if (keys.length !== Object.keys(b).length) return false;
7297
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
7118
7298
  }
7119
7299
  return false;
7120
7300
  }
7301
+ /** The patch without the keys whose value already equals the stored one. */
7302
+ function dropUnchangedKeys(patch, stored) {
7303
+ const out = {};
7304
+ for (const [key, value] of Object.entries(patch)) {
7305
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
7306
+ out[key] = value;
7307
+ }
7308
+ return out;
7309
+ }
7310
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
7311
+ function markerKeysOf(blob, owner) {
7312
+ const keys = /* @__PURE__ */ new Set();
7313
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
7314
+ return keys;
7315
+ }
7316
+ function nodeFromStored(value, owner) {
7317
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
7318
+ if (!isRecord(value)) return null;
7319
+ const children = /* @__PURE__ */ new Map();
7320
+ for (const [key, child] of Object.entries(value)) {
7321
+ const node = nodeFromStored(child, owner);
7322
+ if (node !== null) children.set(key, node);
7323
+ }
7324
+ return children.size > 0 ? {
7325
+ kind: "object",
7326
+ children
7327
+ } : null;
7328
+ }
7329
+ /**
7330
+ * The declared secret tree, widened by every place the STORED blob holds a
7331
+ * marker under one of `keys` — so a marker the schema no longer declares (or
7332
+ * never declared: Wyze before b4906cec6) still gets the save path's
7333
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
7334
+ * addon writes. Markers inside arrays are not added: a row has no id field to
7335
+ * match by unless the schema declares one. Only `owner`'s markers count: a
7336
+ * builtin that keeps another addon's marker (device-manager) never takes it
7337
+ * over.
7338
+ */
7339
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
7340
+ const added = /* @__PURE__ */ new Map();
7341
+ for (const key of keys) {
7342
+ const at = key.indexOf("@");
7343
+ const base = at > 0 ? key.slice(0, at) : key;
7344
+ if (declared.has(base) || added.has(base)) continue;
7345
+ const node = nodeFromStored(stored[key], owner);
7346
+ if (node !== null) added.set(base, node);
7347
+ }
7348
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
7349
+ }
7121
7350
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
7122
7351
  async function readStoredAddonBlob(raw) {
7123
7352
  const threeWay = raw.readAddonStoreResult;
@@ -7126,7 +7355,41 @@ async function readStoredAddonBlob(raw) {
7126
7355
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
7127
7356
  return result.kind === "missing" ? {} : result.value;
7128
7357
  }
7129
- function createSecretAwareSettings(raw, opts) {
7358
+ function touchesTree(tree, patch) {
7359
+ if (tree.size === 0) return false;
7360
+ for (const key of Object.keys(patch)) {
7361
+ const at = key.indexOf("@");
7362
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
7363
+ }
7364
+ return false;
7365
+ }
7366
+ /**
7367
+ * Which top-level keys of each store held markers when last seen. `undefined`
7368
+ * for a store not seen yet: its first write reads it, to be safe.
7369
+ */
7370
+ var MarkerKeyIndex = class {
7371
+ owner;
7372
+ byStore = /* @__PURE__ */ new Map();
7373
+ constructor(owner) {
7374
+ this.owner = owner;
7375
+ }
7376
+ seen(store, blob) {
7377
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
7378
+ }
7379
+ wrote(store, patch) {
7380
+ const keys = this.byStore.get(store);
7381
+ if (keys === void 0) return;
7382
+ const now = markerKeysOf(patch, this.owner);
7383
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
7384
+ else keys.delete(key);
7385
+ }
7386
+ mayHoldMarkers(store, patch) {
7387
+ const keys = this.byStore.get(store);
7388
+ if (keys === void 0) return true;
7389
+ return Object.keys(patch).some((key) => keys.has(key));
7390
+ }
7391
+ };
7392
+ function createHandle(raw, opts) {
7130
7393
  const chains = /* @__PURE__ */ new Map();
7131
7394
  const serialize = (key, fn) => {
7132
7395
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -7137,46 +7400,130 @@ function createSecretAwareSettings(raw, opts) {
7137
7400
  });
7138
7401
  return next;
7139
7402
  };
7140
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
7141
- if (!touchesTree(tree, patch)) return rawWrite(patch);
7142
- return serialize(chainKey, async () => {
7403
+ const index = new MarkerKeyIndex(opts.secrets.owner);
7404
+ const resolveRead = async (store, blob) => {
7405
+ index.seen(store, blob);
7406
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
7407
+ unresolved: "keep-marker",
7408
+ ownedBy: opts.secrets.owner
7409
+ });
7410
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
7411
+ return value;
7412
+ };
7413
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
7414
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
7415
+ await rawWrite(patch);
7416
+ index.wrote(store, patch);
7417
+ return { changed: true };
7418
+ }
7419
+ return serialize(store, async () => {
7143
7420
  const stored = await readStored();
7421
+ index.seen(store, stored);
7422
+ const operatorWrite = opts.isOperatorWrite?.() === true;
7423
+ const restored = await restoreUnchangedSecrets({
7424
+ patch,
7425
+ stored,
7426
+ secrets: opts.secrets,
7427
+ operatorWrite
7428
+ });
7144
7429
  const result = await transformSecretWrite({
7145
- tree,
7430
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
7146
7431
  secrets: opts.secrets,
7147
- patch,
7432
+ patch: restored.patch,
7148
7433
  stored,
7149
7434
  ...scope !== void 0 ? { scope } : {},
7150
- operatorWrite: opts.isOperatorWrite?.() === true
7435
+ operatorWrite
7151
7436
  });
7152
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
7437
+ const effective = dropUnchangedKeys(result.patch, stored);
7438
+ const wroteBlob = Object.keys(effective).length > 0;
7439
+ if (wroteBlob) {
7440
+ await rawWrite(effective);
7441
+ index.wrote(store, effective);
7442
+ }
7153
7443
  const { orphaned } = await result.afterWrite();
7154
7444
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
7445
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
7155
7446
  });
7156
7447
  };
7157
- const wrapped = {
7158
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
7159
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
7160
- kind: "device",
7161
- deviceId
7162
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
7448
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
7449
+ const readAddonStoreResult = raw.readAddonStoreResult;
7450
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
7451
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
7452
+ const overrides = {
7453
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
7454
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
7455
+ const result = await readAddonStoreResult.call(raw);
7456
+ return result.kind === "value" ? {
7457
+ kind: "value",
7458
+ value: await resolveRead("addon", result.value)
7459
+ } : result;
7460
+ } } : {},
7461
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
7462
+ const result = await readAddonStoreKeyResult.call(raw, key);
7463
+ if (result.kind !== "present") return result;
7464
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
7465
+ unresolved: "keep-marker",
7466
+ ownedBy: opts.secrets.owner
7467
+ });
7468
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
7469
+ return {
7470
+ kind: "present",
7471
+ value: value[key]
7472
+ };
7473
+ } } : {},
7474
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
7475
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
7476
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
7477
+ const out = /* @__PURE__ */ new Map();
7478
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
7479
+ return out;
7480
+ } } : {},
7481
+ writeAddonStore: async (patch) => {
7482
+ await writeAddon(patch);
7483
+ },
7484
+ writeDeviceStore: async (deviceId, patch) => {
7485
+ await write(`device:${deviceId}`, opts.deviceTree(), {
7486
+ kind: "device",
7487
+ deviceId
7488
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
7489
+ }
7490
+ };
7491
+ return {
7492
+ settings: new Proxy(raw, { get(target, prop, receiver) {
7493
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
7494
+ const value = Reflect.get(target, prop, receiver);
7495
+ return typeof value === "function" ? value.bind(target) : value;
7496
+ } }),
7497
+ raw: {
7498
+ readAddonStore: async () => {
7499
+ const blob = await raw.readAddonStore();
7500
+ index.seen("addon", blob);
7501
+ return blob;
7502
+ },
7503
+ readDeviceStore: async (deviceId) => {
7504
+ const blob = await raw.readDeviceStore(deviceId);
7505
+ index.seen(`device:${deviceId}`, blob);
7506
+ return blob;
7507
+ }
7508
+ },
7509
+ writeAddonStore: writeAddon
7163
7510
  };
7164
- return new Proxy(raw, { get(target, prop, receiver) {
7165
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
7166
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
7167
- const value = Reflect.get(target, prop, receiver);
7168
- return typeof value === "function" ? value.bind(target) : value;
7169
- } });
7170
7511
  }
7171
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
7172
- function withSecretAwareSettings(context, opts) {
7512
+ /** The context the addon sees, plus the private raw view and write outcome. */
7513
+ function createSecretAwareContext(context, opts) {
7173
7514
  const raw = context.settings;
7174
- if (raw === void 0) return context;
7175
- const settings = createSecretAwareSettings(raw, opts);
7176
- return new Proxy(context, { get(target, prop, receiver) {
7177
- if (prop === "settings") return settings;
7178
- return Reflect.get(target, prop, receiver);
7179
- } });
7515
+ if (raw === void 0) return {
7516
+ context,
7517
+ handle: null
7518
+ };
7519
+ const handle = createHandle(raw, opts);
7520
+ return {
7521
+ context: new Proxy(context, { get(target, prop, receiver) {
7522
+ if (prop === "settings") return handle.settings;
7523
+ return Reflect.get(target, prop, receiver);
7524
+ } }),
7525
+ handle
7526
+ };
7180
7527
  }
7181
7528
  var LEAF = { kind: "leaf" };
7182
7529
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -7351,6 +7698,14 @@ var BaseAddon = class {
7351
7698
  _secretChangeUnsub = null;
7352
7699
  /** >0 while an OPERATOR's settings write is being applied. */
7353
7700
  _operatorWriteDepth = 0;
7701
+ /**
7702
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
7703
+ * to the marker-bearing blobs and stays private to this class: the form
7704
+ * hydrate and config resolution need markers, addon code never does.
7705
+ */
7706
+ _secretSettings = null;
7707
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
7708
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
7354
7709
  constructor(defaults) {
7355
7710
  this.defaults = defaults;
7356
7711
  this._config = { ...defaults };
@@ -7387,13 +7742,21 @@ var BaseAddon = class {
7387
7742
  }
7388
7743
  async initialize(context) {
7389
7744
  const secrets = context.secrets;
7390
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
7391
- secrets,
7392
- addonTree: () => this.addonSecretTree(),
7393
- deviceTree: () => this.deviceSecretTree(),
7394
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
7395
- isOperatorWrite: () => this._operatorWriteDepth > 0
7396
- }) : context;
7745
+ if (secrets !== void 0) {
7746
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
7747
+ secrets,
7748
+ addonTree: () => this.addonSecretTree(),
7749
+ deviceTree: () => this.deviceSecretTree(),
7750
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
7751
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
7752
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
7753
+ });
7754
+ this._ctx = wrapped;
7755
+ this._secretSettings = handle;
7756
+ } else {
7757
+ this._ctx = context;
7758
+ this._secretSettings = null;
7759
+ }
7397
7760
  await this.resolveConfig();
7398
7761
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
7399
7762
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -7510,11 +7873,8 @@ var BaseAddon = class {
7510
7873
  async getGlobalSettings(overlay, cap, nodeId) {
7511
7874
  const schema = this.globalSettingsSchema(cap);
7512
7875
  if (!schema) return { sections: [] };
7513
- const projected = await this.resolveGlobalStore(nodeId, cap);
7514
- return hydrateSchema(schema, overlay ? {
7515
- ...projected,
7516
- ...overlay
7517
- } : projected, { inlineSecretsAsViews: true });
7876
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7877
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
7518
7878
  }
7519
7879
  /**
7520
7880
  * The integration-level view of this addon's settings: exactly the sections
@@ -7559,7 +7919,7 @@ var BaseAddon = class {
7559
7919
  });
7560
7920
  }
7561
7921
  if (sections.length === 0) return null;
7562
- const projected = await this.resolveGlobalStore(nodeId);
7922
+ const projected = await this.readRawProjectedStore(nodeId);
7563
7923
  return hydrateSchema({
7564
7924
  ...schema,
7565
7925
  sections
@@ -7576,12 +7936,50 @@ var BaseAddon = class {
7576
7936
  * the store for custom option logic (option narrowing, value snapping) to
7577
7937
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
7578
7938
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7939
+ *
7940
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7941
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7942
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7943
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7944
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7945
+ * resolved blob back is a no-op for every unchanged secret.
7579
7946
  */
7580
7947
  async resolveGlobalStore(nodeId, cap) {
7581
7948
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7949
+ return this.projectForNode(raw, nodeId, cap);
7950
+ }
7951
+ projectForNode(store, nodeId, cap) {
7582
7952
  const keys = this.perNodeKeys(cap);
7583
7953
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
7584
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7954
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7955
+ }
7956
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7957
+ async readRawProjectedStore(nodeId, cap) {
7958
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7959
+ return this.projectForNode(raw, nodeId, cap);
7960
+ }
7961
+ /**
7962
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7963
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7964
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7965
+ * its value.
7966
+ */
7967
+ async overlayKeepingMarkers(stored, overlay) {
7968
+ const secrets = this._ctx?.secrets;
7969
+ const merged = {
7970
+ ...stored,
7971
+ ...overlay
7972
+ };
7973
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7974
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7975
+ unresolved: "keep-marker",
7976
+ ownedBy: secrets.owner
7977
+ });
7978
+ for (const key of Object.keys(overlay)) {
7979
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7980
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7981
+ }
7982
+ return merged;
7585
7983
  }
7586
7984
  /**
7587
7985
  * Whether ONE global key of this addon's store was written, read three-way
@@ -7646,8 +8044,12 @@ var BaseAddon = class {
7646
8044
  async clearSecrets(keys, nodeId) {
7647
8045
  const tree = this.addonSecretTree();
7648
8046
  const keychain = this._ctx?.secrets !== void 0;
8047
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
7649
8048
  const patch = {};
7650
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
8049
+ for (const key of keys) {
8050
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
8051
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
8052
+ }
7651
8053
  await this.applyGlobalPatch(patch, nodeId);
7652
8054
  }
7653
8055
  async applyGlobalPatch(barePatch, nodeId) {
@@ -7655,7 +8057,11 @@ var BaseAddon = class {
7655
8057
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
7656
8058
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
7657
8059
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
7658
- await this._ctx?.settings?.writeAddonStore(scoped);
8060
+ const handle = this._secretSettings;
8061
+ if (handle !== null) {
8062
+ const { changed } = await handle.writeAddonStore(scoped);
8063
+ if (!changed) return;
8064
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
7659
8065
  if (target !== localNode) return;
7660
8066
  await this.resolveConfig();
7661
8067
  await this.onConfigChanged();
@@ -7708,7 +8114,7 @@ var BaseAddon = class {
7708
8114
  async getDeviceSettings(deviceId) {
7709
8115
  const schema = this.deviceSettingsSchema();
7710
8116
  if (!schema) return { sections: [] };
7711
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
8117
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7712
8118
  }
7713
8119
  async updateDeviceSettings(deviceId, patch) {
7714
8120
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7880,7 +8286,7 @@ var BaseAddon = class {
7880
8286
  key,
7881
8287
  schema,
7882
8288
  fallback,
7883
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
8289
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7884
8290
  write: async (patch) => {
7885
8291
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7886
8292
  },
@@ -7942,6 +8348,23 @@ var BaseAddon = class {
7942
8348
  }
7943
8349
  return value;
7944
8350
  }
8351
+ /**
8352
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
8353
+ * keychain the context's own view is already raw.
8354
+ */
8355
+ rawSettings() {
8356
+ return this._secretSettings?.raw ?? this._ctx?.settings;
8357
+ }
8358
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
8359
+ logUnresolvedRead(unresolved) {
8360
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
8361
+ if (fresh.length === 0) return;
8362
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
8363
+ 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) => ({
8364
+ ref: u.ref,
8365
+ reason: u.reason
8366
+ })) } });
8367
+ }
7945
8368
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7946
8369
  scheduleSecretReresolve(delayMs) {
7947
8370
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7968,7 +8391,7 @@ var BaseAddon = class {
7968
8391
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7969
8392
  */
7970
8393
  async readAddonStoreWithRetry() {
7971
- const settings = this._ctx?.settings;
8394
+ const settings = this.rawSettings();
7972
8395
  if (!settings) return {};
7973
8396
  const delaysMs = [
7974
8397
  150,
@@ -9780,6 +10203,16 @@ var CompositionSchema = object({
9780
10203
  seen.add(feature.cap);
9781
10204
  });
9782
10205
  });
10206
+ var NodeColorIdSchema = _enum([
10207
+ "node-a",
10208
+ "node-b",
10209
+ "node-c",
10210
+ "node-d",
10211
+ "node-e",
10212
+ "node-f",
10213
+ "node-g",
10214
+ "node-h"
10215
+ ]);
9783
10216
  new Set([
9784
10217
  "track",
9785
10218
  "face",
@@ -10271,6 +10704,278 @@ var CameraSwitchGroupSchema = object({
10271
10704
  fetchedAt: number()
10272
10705
  });
10273
10706
  /**
10707
+ * The trainer contract — what the hub hands the cloud trainer and what it
10708
+ * gets back (cloud training, D805+).
10709
+ *
10710
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
10711
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
10712
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
10713
+ * lines on stdout. These schemas are the hub's half of that boundary; the
10714
+ * trainer's pydantic models (and the JSON Schemas generated from them under
10715
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
10716
+ * change there, in the same piece of work.
10717
+ *
10718
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
10719
+ * orchestrator fills every field of a job spec explicitly.
10720
+ */
10721
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
10722
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
10723
+ /** What the trainer can export. Edge TPU is a later, separate image. */
10724
+ var TrainingExportSchema = _enum([
10725
+ "onnx",
10726
+ "openvino-fp16",
10727
+ "openvino-int8",
10728
+ "coreml-fp16"
10729
+ ]);
10730
+ var FloorsSchema = record(string(), number().min(0).max(1));
10731
+ object({
10732
+ schema: literal(TRAINING_JOB_SCHEMA),
10733
+ jobKey: string().uuid(),
10734
+ target: object({
10735
+ kind: literal("detector"),
10736
+ step: literal("object-detection")
10737
+ }),
10738
+ base: object({
10739
+ modelId: string().min(1),
10740
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
10741
+ weights: string().min(1),
10742
+ imgsz: number().int().positive()
10743
+ }),
10744
+ baseline: object({
10745
+ modelId: string().min(1),
10746
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
10747
+ onnxUrl: string().url(),
10748
+ imgsz: number().int().positive(),
10749
+ floors: FloorsSchema
10750
+ }),
10751
+ dataset: object({
10752
+ versionId: string().min(1),
10753
+ annotationHash: string(),
10754
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
10755
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10756
+ }),
10757
+ split: object({
10758
+ holdoutCameras: array(number().int()),
10759
+ /** When no camera is held out: the last N days of every camera. */
10760
+ holdoutLastDays: number().int().nonnegative(),
10761
+ valFraction: number().min(0).max(.5),
10762
+ seed: number().int()
10763
+ }),
10764
+ hyper: object({
10765
+ epochs: number().int().positive(),
10766
+ batch: number().int().positive(),
10767
+ lr0: number().positive(),
10768
+ /** Layers frozen from the start of the backbone; 0 = none. */
10769
+ freeze: number().int().nonnegative(),
10770
+ patience: number().int().nonnegative(),
10771
+ seed: number().int()
10772
+ }),
10773
+ replay: object({
10774
+ source: literal("coco2017"),
10775
+ count: number().int().nonnegative()
10776
+ }),
10777
+ exports: array(TrainingExportSchema).min(1),
10778
+ calibration: object({ maxFrames: number().int().positive() }),
10779
+ floors: object({
10780
+ minSupport: number().int().positive(),
10781
+ clamp: number().min(0).max(1)
10782
+ }),
10783
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
10784
+ catalog: object({
10785
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
10786
+ name: string().min(1).max(160)
10787
+ })
10788
+ });
10789
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
10790
+ var TrainingResultFileSchema = object({
10791
+ path: string().min(1),
10792
+ bytes: number().int().nonnegative(),
10793
+ sha256: string().regex(/^[0-9a-f]{64}$/),
10794
+ format: _enum([
10795
+ "onnx",
10796
+ "openvino",
10797
+ "coreml",
10798
+ "pt"
10799
+ ]),
10800
+ variant: _enum(["base", "int8"])
10801
+ });
10802
+ var DraftFormatSchema = object({
10803
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
10804
+ url: string().min(1),
10805
+ sizeMB: number().nonnegative(),
10806
+ isDirectory: boolean().optional(),
10807
+ files: array(string()).optional(),
10808
+ runtimes: array(literal("python")).optional(),
10809
+ revision: string().min(1)
10810
+ });
10811
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
10812
+ var TrainingCatalogDraftSchema = object({
10813
+ id: string().min(1),
10814
+ name: string().min(1),
10815
+ description: string(),
10816
+ labels: array(unknown()),
10817
+ inputSize: object({
10818
+ width: number().int().positive(),
10819
+ height: number().int().positive()
10820
+ }),
10821
+ preprocessMode: literal("letterbox"),
10822
+ defaultClassFloors: FloorsSchema,
10823
+ formats: object({
10824
+ onnx: DraftFormatSchema.optional(),
10825
+ openvino: DraftFormatSchema.optional(),
10826
+ coreml: DraftFormatSchema.optional()
10827
+ })
10828
+ });
10829
+ /** One class of one model's holdout report (the eval harness's summary). */
10830
+ var TrainingEvalClassSchema = object({
10831
+ positives: number().int(),
10832
+ floor: number().nullable(),
10833
+ tp: number().int(),
10834
+ fp: number().int(),
10835
+ fn: number().int(),
10836
+ precision: number().nullable(),
10837
+ recall: number().nullable(),
10838
+ ap50: number().nullable(),
10839
+ recallByCamera: record(string(), number().nullable()).optional(),
10840
+ recallByLight: record(string(), number().nullable()).optional(),
10841
+ fpByCamera: record(string(), number()).optional(),
10842
+ smallFound: number().int().optional(),
10843
+ smallTotal: number().int().optional()
10844
+ }).passthrough();
10845
+ var TrainingEvalReportSchema = object({
10846
+ frames: number().int(),
10847
+ classes: record(string(), TrainingEvalClassSchema)
10848
+ }).passthrough();
10849
+ /**
10850
+ * A succeeded result carries every block; a failed one carries the error and
10851
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10852
+ * orchestrator checks the blocks it needs before it trusts a success.
10853
+ */
10854
+ var TrainingResultSchema = object({
10855
+ schema: literal(TRAINING_RESULT_SCHEMA),
10856
+ jobKey: string(),
10857
+ status: _enum(["succeeded", "failed"]),
10858
+ error: object({
10859
+ stage: string(),
10860
+ code: string(),
10861
+ message: string()
10862
+ }).nullable(),
10863
+ trainer: object({
10864
+ version: string(),
10865
+ revision: string()
10866
+ }),
10867
+ toolchain: record(string(), string().nullable()),
10868
+ dataset: object({
10869
+ versionId: string(),
10870
+ annotationHash: string(),
10871
+ sha256: string(),
10872
+ frames: object({
10873
+ train: number().int(),
10874
+ val: number().int(),
10875
+ holdout: number().int()
10876
+ }),
10877
+ holdoutCameras: array(number().int()),
10878
+ replayImages: number().int()
10879
+ }).optional(),
10880
+ training: object({
10881
+ epochsRun: number().int(),
10882
+ bestEpoch: number().int(),
10883
+ bestMap50: number(),
10884
+ bestMap50_95: number(),
10885
+ seconds: number()
10886
+ }).optional(),
10887
+ evaluation: object({
10888
+ holdoutFrames: number().int(),
10889
+ baseline: TrainingEvalReportSchema.nullable(),
10890
+ candidate: TrainingEvalReportSchema.nullable(),
10891
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10892
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10893
+ map50: record(string(), number().nullable())
10894
+ }).optional(),
10895
+ floors: object({
10896
+ baseline: FloorsSchema,
10897
+ candidate: FloorsSchema,
10898
+ candidateInt8: FloorsSchema.nullable(),
10899
+ notes: array(string())
10900
+ }).optional(),
10901
+ int8: object({
10902
+ kept: boolean(),
10903
+ map50Fp16: number().nullable(),
10904
+ map50Int8: number().nullable(),
10905
+ reason: string().nullable()
10906
+ }).optional(),
10907
+ exportsDropped: array(object({
10908
+ export: string(),
10909
+ reason: string()
10910
+ })).optional(),
10911
+ files: array(TrainingResultFileSchema).optional(),
10912
+ bundle: object({
10913
+ path: literal("bundle.tar"),
10914
+ bytes: number().int().nonnegative(),
10915
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10916
+ }).nullable().optional(),
10917
+ catalogDraft: object({
10918
+ base: TrainingCatalogDraftSchema,
10919
+ int8: TrainingCatalogDraftSchema.nullable()
10920
+ }).nullable().optional(),
10921
+ licence: string()
10922
+ });
10923
+ var TrainingStageSchema = _enum([
10924
+ "prepare",
10925
+ "replay",
10926
+ "train",
10927
+ "eval",
10928
+ "export",
10929
+ "package"
10930
+ ]);
10931
+ var EventBase = {
10932
+ v: literal(1),
10933
+ ts: number()
10934
+ };
10935
+ discriminatedUnion("type", [
10936
+ object({
10937
+ ...EventBase,
10938
+ type: literal("stage"),
10939
+ stage: TrainingStageSchema
10940
+ }),
10941
+ object({
10942
+ ...EventBase,
10943
+ type: literal("epoch"),
10944
+ epoch: number().int(),
10945
+ epochs: number().int(),
10946
+ boxLoss: number().nullable().optional(),
10947
+ map50: number().nullable().optional(),
10948
+ map50_95: number().nullable().optional(),
10949
+ etaSec: number().nullable().optional()
10950
+ }),
10951
+ object({
10952
+ ...EventBase,
10953
+ type: literal("metric"),
10954
+ name: string(),
10955
+ value: number()
10956
+ }),
10957
+ object({
10958
+ ...EventBase,
10959
+ type: literal("artifact"),
10960
+ path: string(),
10961
+ bytes: number(),
10962
+ sha256: string()
10963
+ }),
10964
+ object({
10965
+ ...EventBase,
10966
+ type: literal("done"),
10967
+ status: _enum(["succeeded", "failed"]),
10968
+ resultSha256: string().nullable().optional()
10969
+ }),
10970
+ object({
10971
+ ...EventBase,
10972
+ type: literal("error"),
10973
+ stage: string(),
10974
+ code: string(),
10975
+ message: string()
10976
+ })
10977
+ ]);
10978
+ /**
10274
10979
  * What the gate decided about a birth, from the CALLER's point of view.
10275
10980
  *
10276
10981
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -12598,7 +13303,9 @@ var AddonHttpRouteSchema = object({
12598
13303
  "authenticated",
12599
13304
  "admin"
12600
13305
  ]).optional(),
12601
- description: string().optional()
13306
+ description: string().optional(),
13307
+ /** The hub limits this route per client address before the handler runs. */
13308
+ rateLimit: _enum(["auth"]).optional()
12602
13309
  });
12603
13310
  /**
12604
13311
  * Cross-process route invocation envelope. The hub captures the
@@ -13303,6 +14010,37 @@ var BackupDestinationInfoSchema = object({
13303
14010
  lastError: string().optional()
13304
14011
  });
13305
14012
  /**
14013
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
14014
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
14015
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
14016
+ * with it off — which restores without a key.
14017
+ */
14018
+ var BackupArchiveEncryptionSchema = object({
14019
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
14020
+ scheme: string(),
14021
+ /** 16 hex — the backup key whose secret restores this archive. */
14022
+ keyId: string()
14023
+ });
14024
+ /**
14025
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
14026
+ * one new archives are encrypted to, and the retired ones older archives
14027
+ * still need. The secret key is shown once, at `setupEncryption`.
14028
+ */
14029
+ var BackupEncryptionStatusSchema = object({
14030
+ enabled: boolean(),
14031
+ active: object({
14032
+ keyId: string(),
14033
+ publicKey: string(),
14034
+ createdAt: number()
14035
+ }).nullable(),
14036
+ /** Every key ever set up, newest first. */
14037
+ keys: array(object({
14038
+ keyId: string(),
14039
+ createdAt: number(),
14040
+ retiredAt: number().nullable()
14041
+ })).readonly()
14042
+ });
14043
+ /**
13306
14044
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
13307
14045
  * Same shape the destination drill-in renders. Sourced from the per-
13308
14046
  * location `manifests.json` (no per-archive tarball read required).
@@ -13314,7 +14052,9 @@ var BackupArchiveEntrySchema = object({
13314
14052
  sizeBytes: number(),
13315
14053
  label: string().optional(),
13316
14054
  /** Top-level locations included in the archive (db, addons, tls, …). */
13317
- locations: array(string()).readonly()
14055
+ locations: array(string()).readonly(),
14056
+ /** Present when the archive is encrypted; restore then needs that key. */
14057
+ encryption: BackupArchiveEncryptionSchema.optional()
13318
14058
  });
13319
14059
  var BackupEntrySchema = object({
13320
14060
  id: string(),
@@ -13323,7 +14063,8 @@ var BackupEntrySchema = object({
13323
14063
  label: string().optional(),
13324
14064
  createdAt: number(),
13325
14065
  sizeBytes: number(),
13326
- locations: array(string()).optional()
14066
+ locations: array(string()).optional(),
14067
+ encryption: BackupArchiveEncryptionSchema.optional()
13327
14068
  });
13328
14069
  var ArchiveEntrySchema = object({
13329
14070
  path: string(),
@@ -13512,10 +14253,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
13512
14253
  * this list and skips entries whose path doesn't start with
13513
14254
  * any of them.
13514
14255
  */
13515
- locations: array(string()).optional()
14256
+ locations: array(string()).optional(),
14257
+ /**
14258
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
14259
+ * one). The archive is decrypted into the hub's private staging
14260
+ * before the restart; the key is not stored. A wrong or missing key
14261
+ * is refused before the archive is downloaded.
14262
+ */
14263
+ backupSecretKey: string().optional()
13516
14264
  }), _void(), {
13517
14265
  kind: "mutation",
13518
14266
  auth: "admin"
14267
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
14268
+ keyId: string(),
14269
+ secretKey: string(),
14270
+ publicKey: string(),
14271
+ createdAt: number(),
14272
+ replacedKeyId: string().nullable()
14273
+ }), {
14274
+ kind: "mutation",
14275
+ auth: "admin"
14276
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
14277
+ kind: "mutation",
14278
+ auth: "admin"
14279
+ }), method(object({ backupSecretKey: string() }), object({
14280
+ valid: boolean(),
14281
+ keyId: string().nullable(),
14282
+ /** The hub knows this key (active or retired). */
14283
+ known: boolean(),
14284
+ /** It is the key new archives are encrypted to. */
14285
+ active: boolean(),
14286
+ error: string().optional()
14287
+ }), {
14288
+ kind: "mutation",
14289
+ auth: "admin"
13519
14290
  }), method(object({
13520
14291
  destinationId: string(),
13521
14292
  backupId: string()
@@ -15241,7 +16012,60 @@ var CustomModelDescriptorSchema = object({
15241
16012
  stepId: string(),
15242
16013
  entry: ModelCatalogEntrySchema
15243
16014
  });
15244
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
16015
+ /** One regular file of an imported bundle, as the producer measured it. */
16016
+ var ModelBundleFileSchema = object({
16017
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
16018
+ path: string().min(1),
16019
+ bytes: number().int().nonnegative(),
16020
+ sha256: string().regex(/^[0-9a-f]{64}$/)
16021
+ });
16022
+ var ImportModelBundleInputSchema = object({
16023
+ /** The registry provider that keeps the model (Model Studio). */
16024
+ addonId: string(),
16025
+ stepId: string().min(1),
16026
+ /**
16027
+ * The catalog rows to register, complete, every format URL already
16028
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
16029
+ * bundle may carry several rows (a base and its INT8 variant).
16030
+ */
16031
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
16032
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
16033
+ bundle: object({
16034
+ ticket: PeerBytesTicketSchema,
16035
+ bytes: number().int().positive(),
16036
+ sha256: string().regex(/^[0-9a-f]{64}$/)
16037
+ }),
16038
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
16039
+ files: array(ModelBundleFileSchema).min(1).max(64),
16040
+ /** Convert missing engine formats and push the model to every agent afterwards. */
16041
+ distribute: boolean()
16042
+ });
16043
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
16044
+ kind: literal("imported"),
16045
+ modelIds: array(string()).readonly(),
16046
+ distributed: array(object({
16047
+ modelId: string(),
16048
+ nodeId: string(),
16049
+ format: _enum(MODEL_FORMATS),
16050
+ ok: boolean(),
16051
+ error: string().optional()
16052
+ })).readonly()
16053
+ }), object({
16054
+ kind: literal("refused"),
16055
+ reason: _enum([
16056
+ "transfer-failed",
16057
+ "checksum-mismatch",
16058
+ "bundle-mismatch",
16059
+ "invalid-entry",
16060
+ "id-taken"
16061
+ ]),
16062
+ detail: string()
16063
+ })]);
16064
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
16065
+ kind: "mutation",
16066
+ auth: "admin",
16067
+ timeoutMs: 30 * 6e4
16068
+ });
15245
16069
  /**
15246
16070
  * Query filter for settings-store collections.
15247
16071
  */
@@ -15720,6 +16544,35 @@ var KeychainKeySourceSchema = object({
15720
16544
  */
15721
16545
  sharesBackupWithDatabase: boolean()
15722
16546
  });
16547
+ /**
16548
+ * One keychain reset, as the Secrets page reports it until the operator
16549
+ * acknowledges it. Never a value: refs, counts and table names only.
16550
+ */
16551
+ var KeychainResetRecordSchema = object({
16552
+ id: string(),
16553
+ at: number(),
16554
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
16555
+ actor: string(),
16556
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
16557
+ lockedReason: string().nullable(),
16558
+ /** Values moved into the archive table (ciphertext under the lost key). */
16559
+ archived: number().int(),
16560
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
16561
+ archivedCollection: string().nullable(),
16562
+ /**
16563
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
16564
+ * so the archive can still be opened if the lost master key turns up.
16565
+ */
16566
+ archivedKeysCollection: string().nullable(),
16567
+ /**
16568
+ * `system-settings` keys whose marker the reset cleared — the cluster
16569
+ * secret's: a marker left pointing at an archived value would refuse every
16570
+ * agent forever (D797).
16571
+ */
16572
+ clearedSettingsKeys: array(string()).readonly(),
16573
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
16574
+ acknowledgedAt: number().nullable()
16575
+ });
15723
16576
  var KeychainStatusSchema = object({
15724
16577
  keychain: KeychainStateSchema,
15725
16578
  /** The source of the master key in use; `null` while locked. */
@@ -15737,7 +16590,9 @@ var KeychainStatusSchema = object({
15737
16590
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
15738
16591
  retiredWraps: number().int(),
15739
16592
  recoveryKeyDownloadedAt: number().nullable(),
15740
- secretCount: number().int()
16593
+ secretCount: number().int(),
16594
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
16595
+ lastReset: KeychainResetRecordSchema.nullable()
15741
16596
  });
15742
16597
  /**
15743
16598
  * Whether a stored value is still pointed at by its owner's settings.
@@ -15759,17 +16614,26 @@ var KeychainAuditActionSchema = _enum([
15759
16614
  "download-recovery-key",
15760
16615
  "delete-orphans",
15761
16616
  "reset",
16617
+ "acknowledge-reset",
15762
16618
  "initialize"
15763
16619
  ]);
15764
16620
  var KeychainAuditEntrySchema = object({
15765
16621
  id: string(),
15766
16622
  at: number(),
15767
16623
  action: KeychainAuditActionSchema,
15768
- /** `addon:<id>` | `user:<id>` | `system`. */
16624
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
15769
16625
  actor: string(),
15770
16626
  ref: string().nullable(),
15771
16627
  detail: string().nullable()
15772
16628
  });
16629
+ var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
16630
+ /**
16631
+ * Secrets the HUB itself holds (owner `system`) that no settings form shows:
16632
+ * `jwt-signing-key` — the session signing key (D797). It is always "in use",
16633
+ * never an orphan; it is generated on a fresh hub and replaced only through
16634
+ * {@link keychainAdminCapability.methods.setSystemSecret}.
16635
+ */
16636
+ var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
15773
16637
  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({
15774
16638
  value: string(),
15775
16639
  version: number().int()
@@ -15777,6 +16641,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15777
16641
  kind: "mutation",
15778
16642
  auth: "admin",
15779
16643
  caller: "required"
16644
+ }), method(object({
16645
+ name: SystemHeldSecretNameSchema,
16646
+ value: string().min(16)
16647
+ }), object({
16648
+ ref: string(),
16649
+ version: number().int()
16650
+ }), {
16651
+ kind: "mutation",
16652
+ auth: "admin",
16653
+ caller: "required"
15780
16654
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
15781
16655
  deleted: array(string()).readonly(),
15782
16656
  kept: array(object({
@@ -15806,13 +16680,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15806
16680
  kind: "mutation",
15807
16681
  auth: "admin",
15808
16682
  caller: "required"
15809
- }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
16683
+ }), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
15810
16684
  archivedCollection: string().nullable(),
15811
16685
  archived: number().int()
15812
16686
  }), {
15813
16687
  kind: "mutation",
15814
16688
  auth: "admin",
15815
16689
  caller: "required"
16690
+ }), method(object({}), object({
16691
+ reset: KeychainResetRecordSchema.nullable(),
16692
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
16693
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
16694
+ kind: "mutation",
16695
+ auth: "admin",
16696
+ caller: "required"
15816
16697
  });
15817
16698
  method(_void(), object({
15818
16699
  id: string(),
@@ -18378,14 +19259,14 @@ var LlmProfileSchema = object({
18378
19259
  /** ConfigUISchema tree passed through untyped on the wire (the
18379
19260
  * notification-output `ConfigSchemaPassthrough` precedent at
18380
19261
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
18381
- var ConfigSchemaPassthrough$1 = unknown();
19262
+ var ConfigSchemaPassthrough$3 = unknown();
18382
19263
  var LlmProfileKindDescriptorSchema = object({
18383
19264
  kind: LlmProfileKindSchema,
18384
19265
  label: string(),
18385
19266
  icon: string(),
18386
19267
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
18387
19268
  addonId: string(),
18388
- configSchema: ConfigSchemaPassthrough$1
19269
+ configSchema: ConfigSchemaPassthrough$3
18389
19270
  });
18390
19271
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
18391
19272
  var LlmDefaultSchema = object({
@@ -18663,7 +19544,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
18663
19544
  * `login-method` — collection cap through which auth addons contribute
18664
19545
  * their pre-auth login surfaces to the login page. This is the SINGLE,
18665
19546
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
18666
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
19547
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
18667
19548
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
18668
19549
  * procedure aggregates them for the unauthenticated login page.
18669
19550
  *
@@ -18671,8 +19552,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
18671
19552
  *
18672
19553
  * - `redirect` — a declarative button. The login page renders a generic
18673
19554
  * button that navigates to `startUrl` (an addon-owned HTTP route).
18674
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
18675
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
19555
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
18676
19556
  * login page needs NO change.
18677
19557
  *
18678
19558
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -18691,8 +19571,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
18691
19571
  * decision.
18692
19572
  *
18693
19573
  * Every contribution carries a `stage`:
18694
- * - `primary` — shown on the first credentials screen (OIDC /
18695
- * magic-link buttons; a future usernameless passkey).
19574
+ * - `primary` — shown on the first credentials screen (OIDC
19575
+ * buttons; a usernameless passkey).
18696
19576
  * - `second-factor` — shown AFTER the password leg, gated on the
18697
19577
  * returned `factors` (passkey-as-2FA today).
18698
19578
  *
@@ -18719,7 +19599,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
18719
19599
  * The provider names an external identity a signed-in user can link to
18720
19600
  * their own account (D782): `auth.listLinkableProviders` /
18721
19601
  * `beginExternalLink` offer exactly the redirect methods that set this,
18722
- * whatever their id. Absent / false — a login button only (magic-link).
19602
+ * whatever their id. Absent / false — a login button only.
18723
19603
  */
18724
19604
  linkable: boolean().optional()
18725
19605
  }),
@@ -19507,7 +20387,7 @@ var TargetKindCapsSchema = object({
19507
20387
  * the union is large and not meant for runtime validation here; the exported
19508
20388
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
19509
20389
  */
19510
- var ConfigSchemaPassthrough = unknown();
20390
+ var ConfigSchemaPassthrough$2 = unknown();
19511
20391
  var TargetKindSchema = object({
19512
20392
  kind: string(),
19513
20393
  label: string(),
@@ -19544,7 +20424,7 @@ var TargetKindSchema = object({
19544
20424
  * its raster path, which is the safe default for an unknown image.
19545
20425
  */
19546
20426
  iconMediaType: string().optional(),
19547
- configSchema: ConfigSchemaPassthrough,
20427
+ configSchema: ConfigSchemaPassthrough$2,
19548
20428
  /**
19549
20429
  * The config keys that decide WHERE this kind's secrets are sent (server,
19550
20430
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -22574,8 +23454,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
22574
23454
  * `super_admin` — collapsed onto the single boolean because every
22575
23455
  * non-admin caller is governed by the same scope-check rules; the
22576
23456
  * distinction was only ever used to route role-specific procedures
22577
- * which we no longer have. Agents are admin sessions issued via
22578
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
23457
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
22579
23458
  * with `isAdmin: false` + an explicit scope list.
22580
23459
  */
22581
23460
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -22882,6 +23761,61 @@ var OauthIntegrationDescriptorSchema = object({
22882
23761
  });
22883
23762
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
22884
23763
  /**
23764
+ * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
23765
+ *
23766
+ * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
23767
+ * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
23768
+ * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
23769
+ * immutable after create.
23770
+ */
23771
+ var ConfigSchemaPassthrough$1 = unknown();
23772
+ var OidcConnectionSchema = object({
23773
+ id: string().min(1),
23774
+ displayName: string(),
23775
+ icon: string(),
23776
+ issuerUrl: string(),
23777
+ clientId: string(),
23778
+ /** Client id + secret present — never the secret value. */
23779
+ configured: boolean(),
23780
+ /**
23781
+ * Values for the connection form schema. `clientSecret` is a keychain
23782
+ * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
23783
+ */
23784
+ formValues: record(string(), unknown()).optional()
23785
+ });
23786
+ /**
23787
+ * Patch one connection. Omitted or empty `clientSecret` keeps the stored
23788
+ * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
23789
+ */
23790
+ var OidcConnectionUpdateInputSchema = object({
23791
+ id: string().min(1),
23792
+ displayName: string().min(1),
23793
+ icon: string().optional(),
23794
+ issuerUrl: string().optional(),
23795
+ clientId: string().optional(),
23796
+ clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
23797
+ redirectUri: string().optional(),
23798
+ scopes: string().optional(),
23799
+ usernameClaim: _enum([
23800
+ "preferred_username",
23801
+ "email",
23802
+ "sub"
23803
+ ]).optional()
23804
+ });
23805
+ method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
23806
+ id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
23807
+ displayName: string().min(1)
23808
+ }), object({ id: string() }), {
23809
+ kind: "mutation",
23810
+ auth: "admin"
23811
+ }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
23812
+ kind: "mutation",
23813
+ auth: "admin"
23814
+ }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
23815
+ kind: "mutation",
23816
+ auth: "admin"
23817
+ });
23818
+ /**
22885
23819
  * What started a camera's onboard motion (D672). `camera` is the camera's own
22886
23820
  * firmware; `sensor` is a device the operator ATTACHED to it. Absent on the
22887
23821
  * wire means the camera: only the camera-sensors bridge ever says `sensor`.
@@ -24238,21 +25172,69 @@ var RetrainFrameListSchema = object({
24238
25172
  /** What the page pre-selects — the native key frame when one survives. */
24239
25173
  autoPickMediaId: number().int().optional()
24240
25174
  });
25175
+ /** Exclusive partition of a corpus copy's annotation progress (design §4.2). */
25176
+ var RetrainFrameWorkStateSchema = _enum([
25177
+ "unannotated",
25178
+ "annotated",
25179
+ "complete"
25180
+ ]);
25181
+ /**
25182
+ * Filters for paginated corpus list, KPI, and matching export (design §4.4).
25183
+ * Every narrowing field is ANDed; omitted fields impose no constraint.
25184
+ */
25185
+ var RetrainCorpusFilterSchema = object({
25186
+ workState: RetrainFrameWorkStateSchema.optional(),
25187
+ deviceIds: array(number()).max(500).optional(),
25188
+ /** When set, only frames in this named collection. */
25189
+ collectionId: string().optional(),
25190
+ /** Frames that carry at least one saved annotation in one of these classes. */
25191
+ classes: array(RetrainMacroClassSchema).optional(),
25192
+ page: number().int().positive().default(1),
25193
+ pageSize: number().int().positive().max(100).default(50)
25194
+ });
25195
+ var RetrainCorpusPageSchema = object({
25196
+ frames: array(RetrainFrameSchema.extend({ workState: RetrainFrameWorkStateSchema })).readonly(),
25197
+ total: number().int().nonnegative(),
25198
+ page: number().int().positive(),
25199
+ pageSize: number().int().positive()
25200
+ });
25201
+ var RetrainCorpusKpiCameraRowSchema = object({
25202
+ deviceId: number(),
25203
+ unannotated: number().int().nonnegative(),
25204
+ annotated: number().int().nonnegative(),
25205
+ complete: number().int().nonnegative(),
25206
+ /** This camera's `complete` count divided by corpus `total`, in `[0,1]`.
25207
+ * `null` when the corpus is empty (no ratio). */
25208
+ pctOfCorpus: number().min(0).max(1).nullable()
25209
+ });
25210
+ var RetrainCorpusKpiSchema = object({
25211
+ total: number().int().nonnegative(),
25212
+ unannotated: number().int().nonnegative(),
25213
+ annotated: number().int().nonnegative(),
25214
+ complete: number().int().nonnegative(),
25215
+ cameras: array(RetrainCorpusKpiCameraRowSchema).readonly()
25216
+ });
24241
25217
  /**
24242
25218
  * Which frames an annotated export carries. Every field narrows; an empty
24243
- * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
24244
- * list owned by whoever trains (the training orchestrator), so `frameIds` is
24245
- * the primitive a version export uses; `batchId` re-selects what an earlier
24246
- * export carried (`exportedInBatch`).
25219
+ * filter is every annotated copy. `frameIds` is the primitive a job or
25220
+ * download uses; `batchId` re-selects what an earlier export carried
25221
+ * (`exportedInBatch`). Frozen dataset versions were removed — live selection
25222
+ * resolves to `frameIds` at plan/start.
24247
25223
  */
24248
25224
  var RetrainExportFilterSchema = object({
24249
25225
  deviceIds: array(number()).optional(),
24250
25226
  frameIds: array(string()).max(2e4).optional(),
24251
25227
  /** Only frames in at least one of these named collections. */
24252
25228
  collectionIds: array(string()).max(200).optional(),
25229
+ /** Single collection (Frames filter bar). ANDed with `collectionIds` when both set. */
25230
+ collectionId: string().optional(),
24253
25231
  batchId: string().optional(),
24254
25232
  /** Only frames the operator marked complete (all subjects boxed). */
24255
- completeOnly: boolean().optional()
25233
+ completeOnly: boolean().optional(),
25234
+ /** Exclusive work-state partition (`workStateOf`); same as the corpus list. */
25235
+ workState: RetrainFrameWorkStateSchema.optional(),
25236
+ /** Frames with at least one saved annotation in one of these classes. */
25237
+ classes: array(RetrainMacroClassSchema).optional()
24256
25238
  });
24257
25239
  /**
24258
25240
  * `frames`: the full frame copies, boxes in `annotations.json`.
@@ -24417,6 +25399,77 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
24417
25399
  ]),
24418
25400
  detail: string().optional()
24419
25401
  })]);
25402
+ /** What a dataset version is cut from. Every field narrows. */
25403
+ var RetrainDatasetSelectionSchema = object({
25404
+ deviceIds: array(number()).readonly().optional(),
25405
+ collectionIds: array(string()).max(200).readonly().optional(),
25406
+ frameIds: array(string()).max(2e4).readonly().optional()
25407
+ });
25408
+ /** The counts a dataset is judged by. */
25409
+ var RetrainDatasetStatsSchema = object({
25410
+ frames: number().int(),
25411
+ completeFrames: number().int(),
25412
+ /** `completeFrames / frames`, 0..1. */
25413
+ completeness: number(),
25414
+ /** Boxes to learn (model errors excluded). */
25415
+ subjects: number().int(),
25416
+ modelErrors: number().int(),
25417
+ /** Complete frames with no subject. */
25418
+ hardNegatives: number().int(),
25419
+ /** Subjects per class × camera × day/night. */
25420
+ cells: array(object({
25421
+ macroClass: string(),
25422
+ deviceId: number(),
25423
+ lighting: _enum([
25424
+ "day",
25425
+ "night",
25426
+ "unknown"
25427
+ ]),
25428
+ subjects: number().int(),
25429
+ frames: number().int()
25430
+ })).readonly(),
25431
+ cameras: array(object({
25432
+ deviceId: number(),
25433
+ frames: number().int(),
25434
+ completeFrames: number().int()
25435
+ })).readonly()
25436
+ });
25437
+ object({
25438
+ id: string(),
25439
+ name: string(),
25440
+ createdAt: number(),
25441
+ selection: RetrainDatasetSelectionSchema,
25442
+ layout: RetrainExportLayoutSchema,
25443
+ completeOnly: boolean(),
25444
+ frameCount: number().int(),
25445
+ annotationHash: string(),
25446
+ manifestSchema: string(),
25447
+ stats: RetrainDatasetStatsSchema
25448
+ });
25449
+ /**
25450
+ * Live training corpus criteria — same shape as `TrainingCorpusSelection` on
25451
+ * the training cap. Resolved here so plan/start and the annotated export share
25452
+ * one definition of "the frames" (`buildRetrainExportPlan`).
25453
+ */
25454
+ var RetrainTrainingCorpusSelectionSchema = object({
25455
+ collectionIds: array(string()).min(1),
25456
+ workState: _enum([
25457
+ "complete",
25458
+ "annotated_or_complete",
25459
+ "any_annotated"
25460
+ ]).default("complete")
25461
+ });
25462
+ var RetrainTrainingCorpusResolveResultSchema = discriminatedUnion("kind", [object({
25463
+ kind: literal("resolved"),
25464
+ frameIds: array(string()).max(2e4).readonly(),
25465
+ stats: RetrainDatasetStatsSchema,
25466
+ annotationHash: string(),
25467
+ layout: RetrainExportLayoutSchema
25468
+ }), object({
25469
+ kind: literal("refused"),
25470
+ reason: _enum(["unknown-collection", "no-frames"]),
25471
+ detail: string()
25472
+ })]);
24420
25473
  /** The outcome of a lifecycle move owned by the retrain page. */
24421
25474
  var RetrainTransitionResultSchema = object({
24422
25475
  trackId: string(),
@@ -25122,6 +26175,12 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
25122
26175
  }), array(RetrainTrackSchema).readonly(), {
25123
26176
  kind: "query",
25124
26177
  auth: "admin"
26178
+ }), method(RetrainCorpusFilterSchema, RetrainCorpusPageSchema, {
26179
+ kind: "query",
26180
+ auth: "admin"
26181
+ }), method(object({}), RetrainCorpusKpiSchema, {
26182
+ kind: "query",
26183
+ auth: "admin"
25125
26184
  }), method(object({ trackId: string() }), RetrainFrameListSchema, {
25126
26185
  kind: "query",
25127
26186
  auth: "admin"
@@ -25206,6 +26265,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
25206
26265
  kind: "mutation",
25207
26266
  auth: "admin",
25208
26267
  timeoutMs: 60 * 6e4
26268
+ }), method(object({
26269
+ filter: RetrainExportFilterSchema,
26270
+ layout: RetrainExportLayoutSchema
26271
+ }), object({
26272
+ ticket: PeerBytesTicketSchema,
26273
+ frames: number().int(),
26274
+ annotations: number().int()
26275
+ }), {
26276
+ kind: "mutation",
26277
+ auth: "admin",
26278
+ timeoutMs: 12e4
25209
26279
  }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
25210
26280
  kind: "query",
25211
26281
  auth: "admin"
@@ -25232,6 +26302,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
25232
26302
  }), method(object({}), array(RetrainCollectionSchema).readonly(), {
25233
26303
  kind: "query",
25234
26304
  auth: "admin"
26305
+ }), method(RetrainTrainingCorpusSelectionSchema, RetrainTrainingCorpusResolveResultSchema, {
26306
+ kind: "query",
26307
+ auth: "admin",
26308
+ timeoutMs: 6e4
25235
26309
  }), method(object({
25236
26310
  id: string(),
25237
26311
  name: string().max(120)
@@ -25848,11 +26922,14 @@ var HardwareClassIdSchema = _enum([
25848
26922
  "intel-n-series",
25849
26923
  "apple-m-base",
25850
26924
  "apple-m-pro",
26925
+ "amd-phoenix",
25851
26926
  "unknown"
25852
26927
  ]);
25853
26928
  var AcceleratorKindSchema = _enum([
25854
26929
  "intel-npu",
25855
26930
  "intel-igpu",
26931
+ "amd-igpu",
26932
+ "amd-npu",
25856
26933
  "x86-cpu",
25857
26934
  "arm-cpu",
25858
26935
  "apple-ane",
@@ -27782,6 +28859,8 @@ var AgentPipelineSettingsSchema = object({
27782
28859
  * address is wrong (multi-homed host, NAT, custom interface).
27783
28860
  */
27784
28861
  reachableHost: string().optional(),
28862
+ /** Hub-persisted UI colour (`--color-node-*` theme tokens). */
28863
+ color: NodeColorIdSchema.optional(),
27785
28864
  /**
27786
28865
  * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
27787
28866
  * weight, steps}. Absent / all-disabled ⇒ the node's single default
@@ -28331,8 +29410,9 @@ method(object({
28331
29410
  auth: "admin"
28332
29411
  }), method(object({
28333
29412
  agentNodeId: string(),
28334
- reachableHost: string().nullable()
28335
- }), object({ success: literal(true) }), {
29413
+ reachableHost: string().nullable().optional(),
29414
+ color: NodeColorIdSchema.nullable().optional()
29415
+ }).refine((v) => v.reachableHost !== void 0 || v.color !== void 0, { message: "reachableHost or color required" }), object({ success: literal(true) }), {
28336
29416
  kind: "mutation",
28337
29417
  auth: "admin"
28338
29418
  }), method(object({
@@ -28784,8 +29864,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
28784
29864
  * `smtp-provider` — pluggable email delivery surface.
28785
29865
  *
28786
29866
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
28787
- * one for transactional / one for notifications). Consumers (magic-link,
28788
- * notifier addons, …) walk the collection and pick the first
29867
+ * one for transactional / one for notifications). Consumers (notifier
29868
+ * addons, …) walk the collection and pick the first
28789
29869
  * ready provider OR target a specific addonId.
28790
29870
  *
28791
29871
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -28964,7 +30044,7 @@ targets: array(object({
28964
30044
  })));
28965
30045
  /**
28966
30046
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
28967
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
30047
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
28968
30048
  * carrying the post-callback claims before redirecting back to
28969
30049
  * `/api/auth/sso/finish`.
28970
30050
  *
@@ -29027,7 +30107,14 @@ var SsoBridgeClaimsSchema = object({
29027
30107
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
29028
30108
  * subject is unique only per issuer, so a link is bound to it.
29029
30109
  */
29030
- issuer: string().optional()
30110
+ issuer: string().optional(),
30111
+ /**
30112
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
30113
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
30114
+ * request to present the matching cookie — a login bridge is useless in
30115
+ * any other browser.
30116
+ */
30117
+ browserBinding: string().optional()
29031
30118
  });
29032
30119
  method(object({
29033
30120
  claims: SsoBridgeClaimsSchema,
@@ -31401,7 +32488,7 @@ var CustomActionInputSchema = object({
31401
32488
  action: string().min(1),
31402
32489
  input: unknown()
31403
32490
  });
31404
- method(_void(), array(AddonListItemSchema).readonly()), method(object({
32491
+ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSchema).readonly()), method(object({
31405
32492
  addonId: string(),
31406
32493
  limit: number().min(1).max(500).default(100),
31407
32494
  level: LogLevelSchema$2.optional()
@@ -36471,7 +37558,13 @@ var TopologyNodeSchema = object({
36471
37558
  })).readonly(),
36472
37559
  processes: array(TopologyProcessSchema).readonly(),
36473
37560
  categories: array(TopologyCategorySchema).readonly(),
36474
- rootPackage: TopologyRootPackageSchema.nullable()
37561
+ rootPackage: TopologyRootPackageSchema.nullable(),
37562
+ /**
37563
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
37564
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
37565
+ * for offline rows and when the hub cannot tell.
37566
+ */
37567
+ meshTransport: _enum(["tls", "clear"]).optional()
36475
37568
  });
36476
37569
  var CapUsageEdgeSchema = object({
36477
37570
  callerAddonId: string(),
@@ -36884,6 +37977,7 @@ var OsdNamedTemplateSchema = object({
36884
37977
  });
36885
37978
  /** Where a slot's value comes from. */
36886
37979
  var OsdSourceSchema = discriminatedUnion("kind", [
37980
+ object({ kind: literal("none") }),
36887
37981
  object({
36888
37982
  kind: literal("static"),
36889
37983
  text: string().max(64)
@@ -37010,6 +38104,13 @@ method(object({ deviceId: number().int() }), object({
37010
38104
  }), object({ success: literal(true) }), {
37011
38105
  kind: "mutation",
37012
38106
  auth: "admin"
38107
+ }), method(object({
38108
+ deviceId: number().int(),
38109
+ slotId: string().min(1),
38110
+ enabled: boolean()
38111
+ }), object({ success: literal(true) }), {
38112
+ kind: "mutation",
38113
+ auth: "admin"
37013
38114
  }), method(object({
37014
38115
  sourceDeviceId: number().int(),
37015
38116
  targetDeviceId: number().int()
@@ -37441,7 +38542,15 @@ var GpuInfoSchema = object({
37441
38542
  name: string(),
37442
38543
  memoryMB: number().optional()
37443
38544
  });
37444
- var NpuInfoSchema = object({ type: _enum(["apple-ane", "intel-npu"]) });
38545
+ var NpuInfoSchema = object({
38546
+ type: _enum([
38547
+ "apple-ane",
38548
+ "intel-npu",
38549
+ "amd-xdna"
38550
+ ]),
38551
+ name: string().optional(),
38552
+ generation: _enum(["xdna1", "xdna2"]).optional()
38553
+ });
37445
38554
  var CoralInfoSchema = object({
37446
38555
  type: literal("coral-edgetpu"),
37447
38556
  bus: string().optional()
@@ -41294,16 +42403,6 @@ var ApiKeySummarySchema = object({
41294
42403
  createdAt: number(),
41295
42404
  lastUsedAt: number().optional()
41296
42405
  });
41297
- var CreateApiKeyInputSchema = object({
41298
- label: string(),
41299
- isAdmin: boolean().default(false),
41300
- allowedProviders: union([array(string()), literal("*")]).optional(),
41301
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
41302
- });
41303
- var CreateApiKeyResultSchema = object({
41304
- token: string(),
41305
- record: ApiKeySummarySchema
41306
- });
41307
42406
  var ScopedTokenSummarySchema = object({
41308
42407
  id: string(),
41309
42408
  userId: string(),
@@ -41402,17 +42501,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
41402
42501
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
41403
42502
  kind: "mutation",
41404
42503
  access: "view"
41405
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
41406
- kind: "mutation",
41407
- auth: "admin",
41408
- access: "create"
41409
- }), method(object({ id: string() }), object({ success: literal(true) }), {
42504
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
41410
42505
  kind: "mutation",
41411
42506
  auth: "admin",
41412
42507
  access: "delete"
41413
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
41414
- kind: "mutation",
41415
- access: "view"
41416
42508
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
41417
42509
  kind: "mutation",
41418
42510
  auth: "admin",
@@ -41486,15 +42578,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
41486
42578
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
41487
42579
  userId: string(),
41488
42580
  issuer: string()
41489
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
41490
- userId: string(),
41491
- issuer: string().min(1),
41492
- label: string().optional()
41493
- }), object({ success: literal(true) }), {
41494
- kind: "mutation",
41495
- auth: "admin",
41496
- access: "create"
41497
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
42581
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
41498
42582
  kind: "mutation",
41499
42583
  auth: "admin",
41500
42584
  access: "delete"
@@ -42199,6 +43283,563 @@ var zoneRulesCapability = {
42199
43283
  */
42200
43284
  durability: "restored"
42201
43285
  };
43286
+ /**
43287
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
43288
+ *
43289
+ * A thin, mockable translation layer: it knows how to run a container with a
43290
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
43291
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
43292
+ * those are the `training` orchestrator's (D805). Every rule written there
43293
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
43294
+ * manifest entry and nothing else.
43295
+ *
43296
+ * Collection of provider **types** (addons). Each addon owns zero or more
43297
+ * **entries** (credentials + defaults). Concat-fans: `describe`,
43298
+ * `describeTypes`, `listEntries`, `listJobs`. Single-row work is keyed by
43299
+ * `entryId`; callers also pass the owning `addonId` as the collection
43300
+ * selector (broker posture). Every method is `admin`: these spend money.
43301
+ *
43302
+ * Every cloud object a provider creates is tagged with the orchestrator's
43303
+ * `jobKey`, so a retried submit finds the job it already started instead of
43304
+ * starting a second GPU, and `listJobs` can find orphans.
43305
+ *
43306
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
43307
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
43308
+ * ticket the provider mints (D613).
43309
+ */
43310
+ var TrainingGpuOptionSchema = object({
43311
+ id: string(),
43312
+ label: string(),
43313
+ /** List price, USD per GPU-hour, before any region multiplier. */
43314
+ usdPerHour: number().nonnegative(),
43315
+ vramGb: number().nonnegative()
43316
+ });
43317
+ var TrainingRegionOptionSchema = object({
43318
+ /** `''` = any region (the provider's choice). */
43319
+ id: string(),
43320
+ label: string(),
43321
+ priceMultiplier: number().positive()
43322
+ });
43323
+ /**
43324
+ * The provider's per-entry settings, as the orchestrator reads them. They
43325
+ * live on the PROVIDER addon's entry (operator decision 2026-10-08: they
43326
+ * depend on the user's account), never hard-coded in the orchestrator.
43327
+ */
43328
+ var TrainingProviderDefaultsSchema = object({
43329
+ gpuType: string(),
43330
+ region: string(),
43331
+ costCapUsd: number().nonnegative(),
43332
+ maxRuntimeSec: number().int().positive(),
43333
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
43334
+ failedDatasetGraceHours: number().nonnegative()
43335
+ });
43336
+ /**
43337
+ * Entry form schema for a provider type — same seam as notification
43338
+ * `TargetKind.configSchema` (`z.unknown()` at the wire; callers tighten to
43339
+ * {@link ConfigUISchema}). Drives `ConfigFormBuilder` on Training → Providers.
43340
+ */
43341
+ var ConfigSchemaPassthrough = unknown();
43342
+ /** One creatable provider type, for the Add-entry dialog. */
43343
+ var TrainingProviderTypeSchema = object({
43344
+ typeId: string(),
43345
+ label: string(),
43346
+ /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
43347
+ iconAsset: string(),
43348
+ /** Owning `training-provider` addon — collection selector for createEntry. */
43349
+ addonId: string(),
43350
+ /**
43351
+ * Fields for one entry of this type (credentials + defaults). Absent on a
43352
+ * type that only needs a name. Password fields are keychain-backed on the
43353
+ * provider addon (`secretStatePaths`), not D634 plaintext.
43354
+ */
43355
+ configSchema: ConfigSchemaPassthrough.optional()
43356
+ });
43357
+ /** One configured account / workspace under a provider type. */
43358
+ var TrainingProviderEntrySchema = object({
43359
+ entryId: string(),
43360
+ typeId: string(),
43361
+ name: string(),
43362
+ addonId: string(),
43363
+ /** Credentials are present — never the values. */
43364
+ configured: boolean()
43365
+ });
43366
+ var TrainingProviderDescriptorSchema = object({
43367
+ addonId: string(),
43368
+ entryId: string(),
43369
+ typeId: string(),
43370
+ /** Operator-chosen entry name. */
43371
+ name: string(),
43372
+ iconAsset: string(),
43373
+ /** `modal`, `runpod`, `fake`, … — same as typeId for current providers. */
43374
+ kind: string(),
43375
+ label: string(),
43376
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
43377
+ regions: array(TrainingRegionOptionSchema).readonly(),
43378
+ maxDatasetBytes: number().int().positive(),
43379
+ maxRuntimeSec: number().int().positive(),
43380
+ freeTierNote: string().optional(),
43381
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
43382
+ dataResidencyNote: string(),
43383
+ /** Credentials are present — never the values. */
43384
+ configured: boolean(),
43385
+ defaults: TrainingProviderDefaultsSchema,
43386
+ /**
43387
+ * Values for {@link TrainingProviderTypeSchema}'s `configSchema` — password
43388
+ * fields are keychain {@link SecretFieldView} or `null` / `''` (create),
43389
+ * never plaintext. Same hydrate contract as settings forms (D789).
43390
+ */
43391
+ formValues: record(string(), unknown()).optional()
43392
+ });
43393
+ /**
43394
+ * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
43395
+ * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
43396
+ * `{ $secretClear: true }` clears it.
43397
+ */
43398
+ var TrainingProviderUpdateEntryInputSchema = object({
43399
+ entryId: string().min(1),
43400
+ name: string().min(1),
43401
+ tokenId: string().optional(),
43402
+ tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
43403
+ environment: string().optional(),
43404
+ gpuType: string().optional(),
43405
+ region: string().optional(),
43406
+ costCapUsd: number().nonnegative().optional(),
43407
+ maxRuntimeSec: number().int().positive().optional(),
43408
+ failedDatasetGraceHours: number().nonnegative().optional()
43409
+ });
43410
+ var TrainingCredentialCheckSchema = object({
43411
+ ok: boolean(),
43412
+ /** Workspace / account name, when the provider says. */
43413
+ account: string().optional(),
43414
+ reason: _enum([
43415
+ "missing",
43416
+ "invalid",
43417
+ "forbidden",
43418
+ "network",
43419
+ "quota"
43420
+ ]).optional(),
43421
+ detail: string().optional()
43422
+ });
43423
+ var ProviderJobStateSchema = _enum([
43424
+ "pending",
43425
+ "starting",
43426
+ "running",
43427
+ "succeeded",
43428
+ "failed",
43429
+ "cancelled",
43430
+ "lost"
43431
+ ]);
43432
+ var ProviderJobStatusSchema = object({
43433
+ jobKey: string(),
43434
+ providerJobId: string().optional(),
43435
+ state: ProviderJobStateSchema,
43436
+ startedAt: number().optional(),
43437
+ endedAt: number().optional(),
43438
+ exitCode: number().int().optional(),
43439
+ failureReason: string().optional(),
43440
+ gpuType: string(),
43441
+ region: string().optional(),
43442
+ billedSeconds: number().nonnegative(),
43443
+ costUsd: number().nonnegative(),
43444
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
43445
+ costIsEstimate: boolean(),
43446
+ lastFetchedAt: number()
43447
+ });
43448
+ /**
43449
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
43450
+ * image its own way (Modal builds the published Dockerfile at that revision;
43451
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
43452
+ * in `result.json`.
43453
+ */
43454
+ var TrainerSourceRefSchema = object({
43455
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
43456
+ repo: string().min(1),
43457
+ /** A commit sha (never a branch) — the job must be reproducible. */
43458
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
43459
+ });
43460
+ /** Cloud job identity — route with the owning addon's `addonId` selector. */
43461
+ var JobRef = {
43462
+ entryId: string().min(1),
43463
+ jobKey: string().uuid()
43464
+ };
43465
+ var TrainingLogLineSchema = object({
43466
+ ts: number(),
43467
+ text: string()
43468
+ });
43469
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
43470
+ typeId: string().min(1),
43471
+ name: string().min(1)
43472
+ }), object({ entryId: string() }), {
43473
+ kind: "mutation",
43474
+ auth: "admin"
43475
+ }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
43476
+ kind: "mutation",
43477
+ auth: "admin"
43478
+ }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
43479
+ kind: "mutation",
43480
+ auth: "admin"
43481
+ }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
43482
+ kind: "mutation",
43483
+ auth: "admin",
43484
+ timeoutMs: 3e4
43485
+ }), method(object({
43486
+ entryId: string().min(1),
43487
+ gpuType: string(),
43488
+ region: string(),
43489
+ datasetBytes: number().int().nonnegative(),
43490
+ gpuSecondsLow: number().nonnegative(),
43491
+ gpuSecondsHigh: number().nonnegative()
43492
+ }), object({
43493
+ usdLow: number().nonnegative(),
43494
+ usdHigh: number().nonnegative(),
43495
+ notes: array(string()).readonly()
43496
+ }), { auth: "admin" }), method(object({
43497
+ ...JobRef,
43498
+ ticket: PeerBytesTicketSchema
43499
+ }), object({
43500
+ bytes: number().int().nonnegative(),
43501
+ sha256: string()
43502
+ }), {
43503
+ kind: "mutation",
43504
+ auth: "admin",
43505
+ timeoutMs: 120 * 6e4
43506
+ }), method(object({
43507
+ ...JobRef,
43508
+ trainer: TrainerSourceRefSchema,
43509
+ jobSpecJson: string().min(2).max(64e3),
43510
+ gpuType: string(),
43511
+ region: string(),
43512
+ maxRuntimeSec: number().int().positive()
43513
+ }), ProviderJobStatusSchema, {
43514
+ kind: "mutation",
43515
+ auth: "admin",
43516
+ timeoutMs: 30 * 6e4
43517
+ }), method(object(JobRef), ProviderJobStatusSchema, {
43518
+ auth: "admin",
43519
+ timeoutMs: 6e4
43520
+ }), method(object({
43521
+ ...JobRef,
43522
+ cursor: string().optional(),
43523
+ max: number().int().min(1).max(500)
43524
+ }), object({
43525
+ lines: array(TrainingLogLineSchema).readonly(),
43526
+ cursor: string()
43527
+ }), {
43528
+ auth: "admin",
43529
+ timeoutMs: 6e4
43530
+ }), method(object(JobRef), object({ ok: literal(true) }), {
43531
+ kind: "mutation",
43532
+ auth: "admin",
43533
+ timeoutMs: 6e4
43534
+ }), method(object(JobRef), object({
43535
+ found: boolean(),
43536
+ text: string().optional()
43537
+ }), {
43538
+ kind: "mutation",
43539
+ auth: "admin",
43540
+ timeoutMs: 5 * 6e4
43541
+ }), method(object({
43542
+ ...JobRef,
43543
+ path: _enum(["bundle.tar"])
43544
+ }), object({ ticket: PeerBytesTicketSchema }), {
43545
+ kind: "mutation",
43546
+ auth: "admin",
43547
+ timeoutMs: 5 * 6e4
43548
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
43549
+ kind: "mutation",
43550
+ auth: "admin",
43551
+ timeoutMs: 5 * 6e4
43552
+ }), method(object({ entryId: string().min(1).optional() }), array(ProviderJobStatusSchema).readonly(), {
43553
+ auth: "admin",
43554
+ timeoutMs: 2 * 6e4
43555
+ });
43556
+ /**
43557
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
43558
+ * provided by `addon-training`.
43559
+ *
43560
+ * It owns what every provider must agree on, written once:
43561
+ *
43562
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
43563
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
43564
+ * - **The return flow.** Verified artefacts → Model Studio
43565
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
43566
+ * rollback. Nothing is ever registered automatically.
43567
+ *
43568
+ * Plan/start takes a live {@link TrainingCorpusSelection} (collections +
43569
+ * work-state rule); frame ids are resolved via pipeline-analytics at that
43570
+ * moment and snapshotted on the job. No frozen dataset version.
43571
+ *
43572
+ * Every method is `admin`.
43573
+ */
43574
+ /**
43575
+ * Live corpus criteria for plan/start (design §5.2). Default is complete-only.
43576
+ * Frame ids are resolved at plan/start — never a frozen version id.
43577
+ */
43578
+ var TrainingCorpusSelectionSchema = object({
43579
+ collectionIds: array(string()).min(1),
43580
+ /** Default complete-only for v1 */
43581
+ workState: _enum([
43582
+ "complete",
43583
+ "annotated_or_complete",
43584
+ "any_annotated"
43585
+ ]).default("complete")
43586
+ });
43587
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
43588
+ var TrainingBaseModelSchema = object({
43589
+ modelId: string(),
43590
+ label: string(),
43591
+ weights: string(),
43592
+ imgsz: number().int(),
43593
+ baselineOnnxUrl: string(),
43594
+ baselineFloors: record(string(), number()),
43595
+ /** The base the fleet runs most — the UI's default. */
43596
+ recommended: boolean()
43597
+ });
43598
+ var TrainingPresetSchema = _enum([
43599
+ "quick",
43600
+ "standard",
43601
+ "thorough"
43602
+ ]);
43603
+ var TrainingJobRequestSchema = object({
43604
+ /** Live collection + work-state criteria; resolved at plan/start. */
43605
+ selection: TrainingCorpusSelectionSchema,
43606
+ /**
43607
+ * The provider **entry** that runs it (credentials + defaults).
43608
+ * Resolve to an owning addon via `training-provider.describe` / `listEntries`.
43609
+ */
43610
+ entryId: string().min(1),
43611
+ gpuType: string().min(1),
43612
+ region: string(),
43613
+ baseModelId: string().min(1),
43614
+ preset: TrainingPresetSchema,
43615
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
43616
+ freeze: number().int().nonnegative().nullable(),
43617
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
43618
+ holdoutCameras: array(number().int()).nullable()
43619
+ });
43620
+ var TrainingSplitPlanSchema = object({
43621
+ holdoutCameras: array(number().int()).readonly(),
43622
+ /** Used when no camera is held out: the last N days of every camera. */
43623
+ holdoutLastDays: number().int().nonnegative(),
43624
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
43625
+ holdoutSupport: record(string(), number().int()).nullable(),
43626
+ trainSubjects: number().int()
43627
+ });
43628
+ var TrainingRefusalReasonSchema = _enum([
43629
+ "unknown-dataset",
43630
+ "unknown-provider",
43631
+ "provider-not-configured",
43632
+ "unknown-base-model",
43633
+ "unknown-gpu",
43634
+ "dataset-too-large",
43635
+ "no-training-subjects",
43636
+ "job-already-running"
43637
+ ]);
43638
+ var TrainingJobPlanSchema = object({
43639
+ refusal: object({
43640
+ reason: TrainingRefusalReasonSchema,
43641
+ detail: string()
43642
+ }).nullable(),
43643
+ warnings: array(string()).readonly(),
43644
+ split: TrainingSplitPlanSchema.nullable(),
43645
+ estimate: object({
43646
+ datasetBytes: number().int(),
43647
+ uploadMinutesAt20Mbps: number(),
43648
+ gpuSecondsLow: number(),
43649
+ gpuSecondsHigh: number(),
43650
+ usdLow: number(),
43651
+ usdHigh: number(),
43652
+ notes: array(string()).readonly()
43653
+ }).nullable(),
43654
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
43655
+ defaults: object({
43656
+ maxCostUsd: number(),
43657
+ maxRuntimeSec: number().int()
43658
+ }).nullable(),
43659
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
43660
+ dataNotice: string()
43661
+ });
43662
+ /**
43663
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
43664
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
43665
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
43666
+ * result lives after the operator acted on it.
43667
+ */
43668
+ var TrainingJobStateSchema = _enum([
43669
+ "queued",
43670
+ "uploading",
43671
+ "submitted",
43672
+ "starting",
43673
+ "running",
43674
+ "collecting",
43675
+ "ready",
43676
+ "registered",
43677
+ "canary",
43678
+ "failed",
43679
+ "cancelling",
43680
+ "cancelled",
43681
+ "lost",
43682
+ "expired",
43683
+ "discarded"
43684
+ ]);
43685
+ var TrainingFailureReasonSchema = _enum([
43686
+ "cost-cap",
43687
+ "runtime-cap",
43688
+ "upload-failed",
43689
+ "submit-failed",
43690
+ "trainer-failed",
43691
+ "result-invalid",
43692
+ "checksum-mismatch",
43693
+ "fetch-failed",
43694
+ "provider-error",
43695
+ "hub-restart-during-upload"
43696
+ ]);
43697
+ var TrainingProgressPointSchema = object({
43698
+ epoch: number().int(),
43699
+ map50: number().nullable(),
43700
+ map50_95: number().nullable()
43701
+ });
43702
+ var TrainingCanarySchema = object({
43703
+ deviceIds: array(number().int()).readonly(),
43704
+ since: number(),
43705
+ /** Every override the canary replaced, exactly, so rollback restores it. */
43706
+ previous: array(object({
43707
+ deviceId: number().int(),
43708
+ nodeId: string(),
43709
+ deviceKey: string(),
43710
+ patch: object({
43711
+ modelId: string().optional(),
43712
+ settings: record(string(), unknown()).readonly().optional()
43713
+ }).nullable()
43714
+ })).readonly()
43715
+ });
43716
+ var TrainingJobSchema = object({
43717
+ id: string(),
43718
+ idempotencyKey: string(),
43719
+ name: string(),
43720
+ createdAt: number(),
43721
+ updatedAt: number(),
43722
+ state: TrainingJobStateSchema,
43723
+ /**
43724
+ * Shared by every job enqueued together via `startJobBatch`.
43725
+ * `null` for a lone `startJob`. The engine advances queued siblings by this id.
43726
+ */
43727
+ batchId: string().nullable().default(null),
43728
+ stage: TrainingStageSchema.nullable(),
43729
+ failure: object({
43730
+ reason: TrainingFailureReasonSchema,
43731
+ stage: string().nullable(),
43732
+ detail: string()
43733
+ }).nullable(),
43734
+ request: TrainingJobRequestSchema,
43735
+ maxCostUsd: number().nonnegative(),
43736
+ maxRuntimeSec: number().int().positive(),
43737
+ trainer: TrainerSourceRefSchema,
43738
+ datasetLayout: RetrainExportLayoutSchema,
43739
+ /** Frame count snapshotted when the job started (audit; equals `frameIds.length`). */
43740
+ frameCount: number().int().nonnegative(),
43741
+ /** Resolved frame ids at start — the archive ships exactly these. */
43742
+ frameIds: array(string()).max(2e4).readonly(),
43743
+ /** Hash of what those frames taught at start (trainer `dataset.annotationHash`). */
43744
+ annotationHash: string(),
43745
+ dataset: object({
43746
+ bytes: number().int(),
43747
+ sha256: string(),
43748
+ uploadedAt: number()
43749
+ }).nullable(),
43750
+ split: TrainingSplitPlanSchema,
43751
+ provider: object({
43752
+ state: ProviderJobStateSchema.nullable(),
43753
+ providerJobId: string().nullable(),
43754
+ startedAt: number().nullable(),
43755
+ endedAt: number().nullable(),
43756
+ billedSeconds: number(),
43757
+ costUsd: number(),
43758
+ costIsEstimate: boolean(),
43759
+ lastPolledAt: number().nullable()
43760
+ }),
43761
+ progress: object({
43762
+ epoch: number().int().nullable(),
43763
+ epochs: number().int().nullable(),
43764
+ etaSec: number().nullable(),
43765
+ series: array(TrainingProgressPointSchema).readonly()
43766
+ }),
43767
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
43768
+ logTail: array(string()).readonly(),
43769
+ logCursor: string().nullable(),
43770
+ artifacts: object({
43771
+ bundleBytes: number().int(),
43772
+ bundleSha256: string(),
43773
+ fetchedAt: number(),
43774
+ /** When the staged artefacts are deleted from the hub. */
43775
+ expiresAt: number()
43776
+ }).nullable(),
43777
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
43778
+ cloudDatasetDeletedAt: number().nullable(),
43779
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
43780
+ cloudCleanupDueAt: number().nullable(),
43781
+ /** Model ids registered from this job (base, and int8 when kept). */
43782
+ registeredModelIds: array(string()).readonly(),
43783
+ canary: TrainingCanarySchema.nullable()
43784
+ });
43785
+ var IdInput = object({ id: string().min(1) });
43786
+ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
43787
+ auth: "admin",
43788
+ timeoutMs: 6e4
43789
+ }), method(TrainingJobRequestSchema.extend({
43790
+ name: string().min(1).max(120),
43791
+ maxCostUsd: number().positive(),
43792
+ maxRuntimeSec: number().int().positive(),
43793
+ idempotencyKey: string().min(8).max(80)
43794
+ }), discriminatedUnion("kind", [object({
43795
+ kind: literal("started"),
43796
+ job: TrainingJobSchema
43797
+ }), object({
43798
+ kind: literal("refused"),
43799
+ reason: TrainingRefusalReasonSchema,
43800
+ detail: string()
43801
+ })]), {
43802
+ kind: "mutation",
43803
+ auth: "admin",
43804
+ timeoutMs: 12e4
43805
+ }), method(TrainingJobRequestSchema.omit({ baseModelId: true }).extend({
43806
+ baseModelIds: array(string().min(1)).min(1),
43807
+ name: string().min(1).max(120),
43808
+ maxCostUsd: number().positive(),
43809
+ maxRuntimeSec: number().int().positive(),
43810
+ idempotencyKey: string().min(8).max(80)
43811
+ }), discriminatedUnion("kind", [object({
43812
+ kind: literal("started"),
43813
+ batchId: string(),
43814
+ jobs: array(TrainingJobSchema).min(1).readonly()
43815
+ }), object({
43816
+ kind: literal("refused"),
43817
+ reason: TrainingRefusalReasonSchema,
43818
+ detail: string()
43819
+ })]), {
43820
+ kind: "mutation",
43821
+ auth: "admin",
43822
+ timeoutMs: 12e4
43823
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
43824
+ kind: "mutation",
43825
+ auth: "admin",
43826
+ timeoutMs: 12e4
43827
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
43828
+ kind: "mutation",
43829
+ auth: "admin",
43830
+ timeoutMs: 30 * 6e4
43831
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
43832
+ kind: "mutation",
43833
+ auth: "admin",
43834
+ timeoutMs: 12e4
43835
+ }), method(IdInput, TrainingJobSchema, {
43836
+ kind: "mutation",
43837
+ auth: "admin",
43838
+ timeoutMs: 12e4
43839
+ }), method(IdInput, TrainingJobSchema, {
43840
+ kind: "mutation",
43841
+ auth: "admin"
43842
+ });
42202
43843
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
42203
43844
  Object.freeze({
42204
43845
  person: .5,
@@ -44347,6 +45988,12 @@ Object.freeze({
44347
45988
  addonId: null,
44348
45989
  access: "create"
44349
45990
  },
45991
+ "backup.checkBackupKey": {
45992
+ capName: "backup",
45993
+ capScope: "system",
45994
+ addonId: null,
45995
+ access: "create"
45996
+ },
44350
45997
  "backup.delete": {
44351
45998
  capName: "backup",
44352
45999
  capScope: "system",
@@ -44359,6 +46006,18 @@ Object.freeze({
44359
46006
  addonId: null,
44360
46007
  access: "delete"
44361
46008
  },
46009
+ "backup.disableEncryption": {
46010
+ capName: "backup",
46011
+ capScope: "system",
46012
+ addonId: null,
46013
+ access: "create"
46014
+ },
46015
+ "backup.getEncryption": {
46016
+ capName: "backup",
46017
+ capScope: "system",
46018
+ addonId: null,
46019
+ access: "view"
46020
+ },
44362
46021
  "backup.getEntries": {
44363
46022
  capName: "backup",
44364
46023
  capScope: "system",
@@ -44413,6 +46072,12 @@ Object.freeze({
44413
46072
  addonId: null,
44414
46073
  access: "create"
44415
46074
  },
46075
+ "backup.setupEncryption": {
46076
+ capName: "backup",
46077
+ capScope: "system",
46078
+ addonId: null,
46079
+ access: "create"
46080
+ },
44416
46081
  "backup.trigger": {
44417
46082
  capName: "backup",
44418
46083
  capScope: "system",
@@ -44965,6 +46630,12 @@ Object.freeze({
44965
46630
  addonId: null,
44966
46631
  access: "create"
44967
46632
  },
46633
+ "customModelRegistry.importModelBundle": {
46634
+ capName: "custom-model-registry",
46635
+ capScope: "system",
46636
+ addonId: null,
46637
+ access: "create"
46638
+ },
44968
46639
  "customModelRegistry.listModels": {
44969
46640
  capName: "custom-model-registry",
44970
46641
  capScope: "system",
@@ -46405,6 +48076,12 @@ Object.freeze({
46405
48076
  addonId: null,
46406
48077
  access: "view"
46407
48078
  },
48079
+ "keychainAdmin.acknowledgeReset": {
48080
+ capName: "keychain-admin",
48081
+ capScope: "system",
48082
+ addonId: null,
48083
+ access: "create"
48084
+ },
46408
48085
  "keychainAdmin.deleteOrphans": {
46409
48086
  capName: "keychain-admin",
46410
48087
  capScope: "system",
@@ -46441,6 +48118,12 @@ Object.freeze({
46441
48118
  addonId: null,
46442
48119
  access: "delete"
46443
48120
  },
48121
+ "keychainAdmin.resetReport": {
48122
+ capName: "keychain-admin",
48123
+ capScope: "system",
48124
+ addonId: null,
48125
+ access: "delete"
48126
+ },
46444
48127
  "keychainAdmin.reveal": {
46445
48128
  capName: "keychain-admin",
46446
48129
  capScope: "system",
@@ -46453,6 +48136,12 @@ Object.freeze({
46453
48136
  addonId: null,
46454
48137
  access: "create"
46455
48138
  },
48139
+ "keychainAdmin.setSystemSecret": {
48140
+ capName: "keychain-admin",
48141
+ capScope: "system",
48142
+ addonId: null,
48143
+ access: "create"
48144
+ },
46456
48145
  "keychainAdmin.status": {
46457
48146
  capName: "keychain-admin",
46458
48147
  capScope: "system",
@@ -47689,6 +49378,36 @@ Object.freeze({
47689
49378
  addonId: null,
47690
49379
  access: "view"
47691
49380
  },
49381
+ "oidcConnections.connectionFormSchema": {
49382
+ capName: "oidc-connections",
49383
+ capScope: "system",
49384
+ addonId: null,
49385
+ access: "view"
49386
+ },
49387
+ "oidcConnections.createConnection": {
49388
+ capName: "oidc-connections",
49389
+ capScope: "system",
49390
+ addonId: null,
49391
+ access: "create"
49392
+ },
49393
+ "oidcConnections.deleteConnection": {
49394
+ capName: "oidc-connections",
49395
+ capScope: "system",
49396
+ addonId: null,
49397
+ access: "delete"
49398
+ },
49399
+ "oidcConnections.listConnections": {
49400
+ capName: "oidc-connections",
49401
+ capScope: "system",
49402
+ addonId: null,
49403
+ access: "view"
49404
+ },
49405
+ "oidcConnections.updateConnection": {
49406
+ capName: "oidc-connections",
49407
+ capScope: "system",
49408
+ addonId: null,
49409
+ access: "create"
49410
+ },
47692
49411
  "osd.getStatus": {
47693
49412
  capName: "osd",
47694
49413
  capScope: "device",
@@ -47761,6 +49480,12 @@ Object.freeze({
47761
49480
  addonId: null,
47762
49481
  access: "create"
47763
49482
  },
49483
+ "osdManager.setSlotCameraEnabled": {
49484
+ capName: "osd-manager",
49485
+ capScope: "system",
49486
+ addonId: null,
49487
+ access: "create"
49488
+ },
47764
49489
  "osdManager.upsertTemplate": {
47765
49490
  capName: "osd-manager",
47766
49491
  capScope: "system",
@@ -48013,6 +49738,12 @@ Object.freeze({
48013
49738
  addonId: null,
48014
49739
  access: "view"
48015
49740
  },
49741
+ "pipelineAnalytics.getRetrainCorpusKpi": {
49742
+ capName: "pipeline-analytics",
49743
+ capScope: "device",
49744
+ addonId: null,
49745
+ access: "view"
49746
+ },
48016
49747
  "pipelineAnalytics.getRetrainExportUrl": {
48017
49748
  capName: "pipeline-analytics",
48018
49749
  capScope: "device",
@@ -48133,6 +49864,12 @@ Object.freeze({
48133
49864
  addonId: null,
48134
49865
  access: "view"
48135
49866
  },
49867
+ "pipelineAnalytics.listRetrainCorpusPage": {
49868
+ capName: "pipeline-analytics",
49869
+ capScope: "device",
49870
+ addonId: null,
49871
+ access: "view"
49872
+ },
48136
49873
  "pipelineAnalytics.listRetrainFrames": {
48137
49874
  capName: "pipeline-analytics",
48138
49875
  capScope: "device",
@@ -48163,6 +49900,12 @@ Object.freeze({
48163
49900
  addonId: null,
48164
49901
  access: "view"
48165
49902
  },
49903
+ "pipelineAnalytics.offerRetrainArchive": {
49904
+ capName: "pipeline-analytics",
49905
+ capScope: "device",
49906
+ addonId: null,
49907
+ access: "create"
49908
+ },
48166
49909
  "pipelineAnalytics.ownersWithMedia": {
48167
49910
  capName: "pipeline-analytics",
48168
49911
  capScope: "device",
@@ -48253,6 +49996,12 @@ Object.freeze({
48253
49996
  addonId: null,
48254
49997
  access: "create"
48255
49998
  },
49999
+ "pipelineAnalytics.resolveRetrainTrainingCorpus": {
50000
+ capName: "pipeline-analytics",
50001
+ capScope: "device",
50002
+ addonId: null,
50003
+ access: "view"
50004
+ },
48256
50005
  "pipelineAnalytics.restageRetrainTrack": {
48257
50006
  capName: "pipeline-analytics",
48258
50007
  capScope: "device",
@@ -50689,6 +52438,180 @@ Object.freeze({
50689
52438
  addonId: null,
50690
52439
  access: "view"
50691
52440
  },
52441
+ "training.canaryResult": {
52442
+ capName: "training",
52443
+ capScope: "system",
52444
+ addonId: null,
52445
+ access: "create"
52446
+ },
52447
+ "training.cancelJob": {
52448
+ capName: "training",
52449
+ capScope: "system",
52450
+ addonId: null,
52451
+ access: "create"
52452
+ },
52453
+ "training.discardResult": {
52454
+ capName: "training",
52455
+ capScope: "system",
52456
+ addonId: null,
52457
+ access: "create"
52458
+ },
52459
+ "training.getJob": {
52460
+ capName: "training",
52461
+ capScope: "system",
52462
+ addonId: null,
52463
+ access: "view"
52464
+ },
52465
+ "training.getJobResult": {
52466
+ capName: "training",
52467
+ capScope: "system",
52468
+ addonId: null,
52469
+ access: "view"
52470
+ },
52471
+ "training.listBaseModels": {
52472
+ capName: "training",
52473
+ capScope: "system",
52474
+ addonId: null,
52475
+ access: "view"
52476
+ },
52477
+ "training.listJobs": {
52478
+ capName: "training",
52479
+ capScope: "system",
52480
+ addonId: null,
52481
+ access: "view"
52482
+ },
52483
+ "training.planJob": {
52484
+ capName: "training",
52485
+ capScope: "system",
52486
+ addonId: null,
52487
+ access: "view"
52488
+ },
52489
+ "training.registerResult": {
52490
+ capName: "training",
52491
+ capScope: "system",
52492
+ addonId: null,
52493
+ access: "create"
52494
+ },
52495
+ "training.rollbackCanary": {
52496
+ capName: "training",
52497
+ capScope: "system",
52498
+ addonId: null,
52499
+ access: "create"
52500
+ },
52501
+ "training.startJob": {
52502
+ capName: "training",
52503
+ capScope: "system",
52504
+ addonId: null,
52505
+ access: "create"
52506
+ },
52507
+ "training.startJobBatch": {
52508
+ capName: "training",
52509
+ capScope: "system",
52510
+ addonId: null,
52511
+ access: "create"
52512
+ },
52513
+ "trainingProvider.cancelJob": {
52514
+ capName: "training-provider",
52515
+ capScope: "system",
52516
+ addonId: null,
52517
+ access: "create"
52518
+ },
52519
+ "trainingProvider.cleanupJob": {
52520
+ capName: "training-provider",
52521
+ capScope: "system",
52522
+ addonId: null,
52523
+ access: "create"
52524
+ },
52525
+ "trainingProvider.createEntry": {
52526
+ capName: "training-provider",
52527
+ capScope: "system",
52528
+ addonId: null,
52529
+ access: "create"
52530
+ },
52531
+ "trainingProvider.deleteEntry": {
52532
+ capName: "training-provider",
52533
+ capScope: "system",
52534
+ addonId: null,
52535
+ access: "delete"
52536
+ },
52537
+ "trainingProvider.describe": {
52538
+ capName: "training-provider",
52539
+ capScope: "system",
52540
+ addonId: null,
52541
+ access: "view"
52542
+ },
52543
+ "trainingProvider.describeTypes": {
52544
+ capName: "training-provider",
52545
+ capScope: "system",
52546
+ addonId: null,
52547
+ access: "view"
52548
+ },
52549
+ "trainingProvider.estimateJob": {
52550
+ capName: "training-provider",
52551
+ capScope: "system",
52552
+ addonId: null,
52553
+ access: "view"
52554
+ },
52555
+ "trainingProvider.getJob": {
52556
+ capName: "training-provider",
52557
+ capScope: "system",
52558
+ addonId: null,
52559
+ access: "view"
52560
+ },
52561
+ "trainingProvider.listEntries": {
52562
+ capName: "training-provider",
52563
+ capScope: "system",
52564
+ addonId: null,
52565
+ access: "view"
52566
+ },
52567
+ "trainingProvider.listJobEvents": {
52568
+ capName: "training-provider",
52569
+ capScope: "system",
52570
+ addonId: null,
52571
+ access: "view"
52572
+ },
52573
+ "trainingProvider.listJobs": {
52574
+ capName: "training-provider",
52575
+ capScope: "system",
52576
+ addonId: null,
52577
+ access: "view"
52578
+ },
52579
+ "trainingProvider.offerArtifact": {
52580
+ capName: "training-provider",
52581
+ capScope: "system",
52582
+ addonId: null,
52583
+ access: "create"
52584
+ },
52585
+ "trainingProvider.readResult": {
52586
+ capName: "training-provider",
52587
+ capScope: "system",
52588
+ addonId: null,
52589
+ access: "create"
52590
+ },
52591
+ "trainingProvider.submitJob": {
52592
+ capName: "training-provider",
52593
+ capScope: "system",
52594
+ addonId: null,
52595
+ access: "create"
52596
+ },
52597
+ "trainingProvider.updateEntry": {
52598
+ capName: "training-provider",
52599
+ capScope: "system",
52600
+ addonId: null,
52601
+ access: "create"
52602
+ },
52603
+ "trainingProvider.uploadDataset": {
52604
+ capName: "training-provider",
52605
+ capScope: "system",
52606
+ addonId: null,
52607
+ access: "create"
52608
+ },
52609
+ "trainingProvider.validateCredentials": {
52610
+ capName: "training-provider",
52611
+ capScope: "system",
52612
+ addonId: null,
52613
+ access: "create"
52614
+ },
50692
52615
  "turnProvider.getTurnServers": {
50693
52616
  capName: "turn-provider",
50694
52617
  capScope: "system",
@@ -50713,12 +52636,6 @@ Object.freeze({
50713
52636
  addonId: null,
50714
52637
  access: "create"
50715
52638
  },
50716
- "userManagement.createApiKey": {
50717
- capName: "user-management",
50718
- capScope: "system",
50719
- addonId: null,
50720
- access: "create"
50721
- },
50722
52639
  "userManagement.createScopedToken": {
50723
52640
  capName: "user-management",
50724
52641
  capScope: "system",
@@ -50755,12 +52672,6 @@ Object.freeze({
50755
52672
  addonId: null,
50756
52673
  access: "view"
50757
52674
  },
50758
- "userManagement.linkExternalIdentity": {
50759
- capName: "user-management",
50760
- capScope: "system",
50761
- addonId: null,
50762
- access: "create"
50763
- },
50764
52675
  "userManagement.listApiKeys": {
50765
52676
  capName: "user-management",
50766
52677
  capScope: "system",
@@ -50863,12 +52774,6 @@ Object.freeze({
50863
52774
  addonId: null,
50864
52775
  access: "create"
50865
52776
  },
50866
- "userManagement.validateApiKey": {
50867
- capName: "user-management",
50868
- capScope: "system",
50869
- addonId: null,
50870
- access: "view"
50871
- },
50872
52777
  "userManagement.validateCredentials": {
50873
52778
  capName: "user-management",
50874
52779
  capScope: "system",
@@ -53901,6 +55806,11 @@ Object.freeze({
53901
55806
  form: "single",
53902
55807
  optional: false
53903
55808
  }],
55809
+ "osdManager.setSlotCameraEnabled": [{
55810
+ name: "deviceId",
55811
+ form: "single",
55812
+ optional: false
55813
+ }],
53904
55814
  "petFeeder.callPet": [{
53905
55815
  name: "deviceId",
53906
55816
  form: "single",
@@ -54121,6 +56031,11 @@ Object.freeze({
54121
56031
  form: "array",
54122
56032
  optional: false
54123
56033
  }],
56034
+ "pipelineAnalytics.listRetrainCorpusPage": [{
56035
+ name: "deviceIds",
56036
+ form: "array",
56037
+ optional: true
56038
+ }],
54124
56039
  "pipelineAnalytics.listRetrainStaging": [{
54125
56040
  name: "deviceIds",
54126
56041
  form: "array",
@@ -54982,6 +56897,11 @@ Object.freeze({
54982
56897
  form: "single",
54983
56898
  optional: false
54984
56899
  }],
56900
+ "training.canaryResult": [{
56901
+ name: "deviceIds",
56902
+ form: "array",
56903
+ optional: false
56904
+ }],
54985
56905
  "update.getStatus": [{
54986
56906
  name: "deviceId",
54987
56907
  form: "single",
@@ -55225,6 +57145,7 @@ Object.freeze({
55225
57145
  });
55226
57146
  Object.freeze({
55227
57147
  "broker": "broker",
57148
+ "calendar-source": "calendar",
55228
57149
  "device-export": "device-export",
55229
57150
  "llm": "ai",
55230
57151
  "mesh-network": "mesh",
@@ -55710,6 +57631,8 @@ var STATE_SUMMARY_VARS = [
55710
57631
  [...RULE_TEXT],
55711
57632
  [...RULE_TEXT],
55712
57633
  [...RULE_TEXT],
57634
+ [...RULE_TEXT],
57635
+ [...RULE_TEXT],
55713
57636
  ([...RULE_TEXT], [...UPDATES]),
55714
57637
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
55715
57638
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),