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