@camstack/addon-auth 1.2.134 → 1.2.136

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,37 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
9
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
10
+ var __exportAll = (all, no_symbols) => {
11
+ let target = {};
12
+ for (var name in all) __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true
15
+ });
16
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
17
+ return target;
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
21
+ key = keys[i];
22
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
23
+ get: ((k) => from[k]).bind(null, key),
24
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
25
+ });
26
+ }
27
+ return to;
28
+ };
29
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ value: mod,
31
+ enumerable: true
32
+ }) : target, mod));
33
+ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
+ require("node:crypto");
1
35
  //#region ../types/dist/event-category-DaIZi00R.mjs
2
36
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
3
37
  EventCategory["SystemBoot"] = "system.boot";
@@ -5376,7 +5410,7 @@ var ZodIssueCode = {
5376
5410
  var ZodFirstPartyTypeKind;
5377
5411
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5378
5412
  //#endregion
5379
- //#region ../types/dist/sleep-DujUvOcb.mjs
5413
+ //#region ../types/dist/sleep-r3RWkGVx.mjs
5380
5414
  /**
5381
5415
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5382
5416
  * window to float samples (D455).
@@ -5493,7 +5527,7 @@ function isKeychainStoredField(field) {
5493
5527
  var SECRET_CLEAR = { $secretClear: true };
5494
5528
  /** The `'***'` token D634 redaction writes for non-admins. */
5495
5529
  var LEGACY_DEVICE_REDACTION = "***";
5496
- function isRecord$1(value) {
5530
+ function isRecord$2(value) {
5497
5531
  return typeof value === "object" && value !== null && !Array.isArray(value);
5498
5532
  }
5499
5533
  function makeSecretMarker(ref) {
@@ -5504,12 +5538,12 @@ function makeSecretMarker(ref) {
5504
5538
  }
5505
5539
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5506
5540
  function isSecretMarker(value) {
5507
- if (!isRecord$1(value)) return false;
5541
+ if (!isRecord$2(value)) return false;
5508
5542
  const ref = value["$secret"];
5509
5543
  return typeof ref === "string" && ref.length > 0;
5510
5544
  }
5511
5545
  function isSecretClear(value) {
5512
- return isRecord$1(value) && value["$secretClear"] === true;
5546
+ return isRecord$2(value) && value["$secretClear"] === true;
5513
5547
  }
5514
5548
  /**
5515
5549
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6025,6 +6059,13 @@ function globalSecretScope() {
6025
6059
  function encodeSegment(value) {
6026
6060
  return encodeURIComponent(value);
6027
6061
  }
6062
+ function decodeSegment(value) {
6063
+ try {
6064
+ return decodeURIComponent(value);
6065
+ } catch {
6066
+ return null;
6067
+ }
6068
+ }
6028
6069
  /**
6029
6070
  * The field path of a value inside an array item, addressed by the item's id:
6030
6071
  * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
@@ -6033,6 +6074,75 @@ function encodeSegment(value) {
6033
6074
  function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6034
6075
  return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6035
6076
  }
6077
+ function parseScope(segments) {
6078
+ switch (segments[0]) {
6079
+ case "global": return {
6080
+ scope: GLOBAL_SCOPE,
6081
+ used: 1
6082
+ };
6083
+ case "node": {
6084
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6085
+ return nodeId === null || nodeId.length === 0 ? null : {
6086
+ scope: {
6087
+ kind: "node",
6088
+ nodeId
6089
+ },
6090
+ used: 2
6091
+ };
6092
+ }
6093
+ case "device": {
6094
+ const raw = segments[1];
6095
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6096
+ return {
6097
+ scope: {
6098
+ kind: "device",
6099
+ deviceId: Number(raw)
6100
+ },
6101
+ used: 2
6102
+ };
6103
+ }
6104
+ case "integration": {
6105
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6106
+ return id === null || id.length === 0 ? null : {
6107
+ scope: {
6108
+ kind: "integration",
6109
+ integrationId: id
6110
+ },
6111
+ used: 2
6112
+ };
6113
+ }
6114
+ case "row": {
6115
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6116
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6117
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6118
+ return {
6119
+ scope: {
6120
+ kind: "row",
6121
+ collection,
6122
+ rowId
6123
+ },
6124
+ used: 3
6125
+ };
6126
+ }
6127
+ default: return null;
6128
+ }
6129
+ }
6130
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6131
+ function parseSecretRef(ref) {
6132
+ if (!ref.startsWith("secret://")) return null;
6133
+ const segments = ref.slice(9).split("/");
6134
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6135
+ if (owner === null || owner.length === 0) return null;
6136
+ const parsed = parseScope(segments.slice(1));
6137
+ if (parsed === null) return null;
6138
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6139
+ if (fieldPath.length === 0) return null;
6140
+ return {
6141
+ owner,
6142
+ scope: parsed.scope,
6143
+ fieldPath
6144
+ };
6145
+ }
6036
6146
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6037
6147
  var KeychainWriteRefusedError = class extends Error {
6038
6148
  fieldPath;
@@ -6043,7 +6153,7 @@ var KeychainWriteRefusedError = class extends Error {
6043
6153
  }
6044
6154
  };
6045
6155
  var KEEP = { kind: "keep" };
6046
- function isRecord(value) {
6156
+ function isRecord$1(value) {
6047
6157
  return typeof value === "object" && value !== null && !Array.isArray(value);
6048
6158
  }
6049
6159
  function defaultMintId() {
@@ -6056,7 +6166,7 @@ function collectSecretMarkerRefs(value, out = []) {
6056
6166
  return out;
6057
6167
  }
6058
6168
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6059
- else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6169
+ else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6060
6170
  return out;
6061
6171
  }
6062
6172
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6111,7 +6221,7 @@ function rowId(row, idKey) {
6111
6221
  return null;
6112
6222
  }
6113
6223
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6114
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6224
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6115
6225
  if (!Array.isArray(incoming)) {
6116
6226
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6117
6227
  return {
@@ -6127,7 +6237,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6127
6237
  const kept = /* @__PURE__ */ new Set();
6128
6238
  const rows = [];
6129
6239
  for (const row of incoming) {
6130
- if (!isRecord(row)) {
6240
+ if (!isRecord$1(row)) {
6131
6241
  rows.push(row);
6132
6242
  continue;
6133
6243
  }
@@ -6152,7 +6262,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6152
6262
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6153
6263
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6154
6264
  case "object": {
6155
- if (!isRecord(incoming)) {
6265
+ if (!isRecord$1(incoming)) {
6156
6266
  if (incoming === void 0) return KEEP;
6157
6267
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6158
6268
  return {
@@ -6160,7 +6270,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6160
6270
  value: incoming
6161
6271
  };
6162
6272
  }
6163
- const storedObj = isRecord(stored) ? stored : {};
6273
+ const storedObj = isRecord$1(stored) ? stored : {};
6164
6274
  return {
6165
6275
  kind: "value",
6166
6276
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6219,12 +6329,19 @@ async function transformSecretWrite(input) {
6219
6329
  }
6220
6330
  };
6221
6331
  }
6332
+ /** Is `ref` one of `owner`'s refs? */
6333
+ function isSecretRefOwnedBy(ref, owner) {
6334
+ return parseSecretRef(ref)?.owner === owner;
6335
+ }
6222
6336
  /**
6223
6337
  * Replace every marker in `value` with its keychain value. Returns the SAME
6224
6338
  * reference when there is no marker (no allocation, no keychain call).
6225
6339
  */
6226
- async function resolveSecretMarkers(value, secrets) {
6227
- const refs = collectSecretMarkerRefs(value);
6340
+ async function resolveSecretMarkers(value, secrets, options = {}) {
6341
+ const keepMarker = options.unresolved === "keep-marker";
6342
+ const owner = options.ownedBy;
6343
+ const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
6344
+ const refs = collectSecretMarkerRefs(value).filter(inScope);
6228
6345
  if (refs.length === 0) return {
6229
6346
  value,
6230
6347
  unresolved: []
@@ -6248,10 +6365,18 @@ async function resolveSecretMarkers(value, secrets) {
6248
6365
  }
6249
6366
  const substitute = (v) => {
6250
6367
  if (isSecretMarker(v)) {
6368
+ if (!inScope(v.$secret)) return {
6369
+ keep: true,
6370
+ value: v
6371
+ };
6251
6372
  const answer = answers[v.$secret];
6252
- return answer?.kind === "value" ? {
6373
+ if (answer?.kind === "value") return {
6253
6374
  keep: true,
6254
6375
  value: answer.value
6376
+ };
6377
+ return keepMarker ? {
6378
+ keep: true,
6379
+ value: v
6255
6380
  } : {
6256
6381
  keep: false,
6257
6382
  value: void 0
@@ -6268,7 +6393,7 @@ async function resolveSecretMarkers(value, secrets) {
6268
6393
  value: items
6269
6394
  };
6270
6395
  }
6271
- if (isRecord(v)) {
6396
+ if (isRecord$1(v)) {
6272
6397
  const out = {};
6273
6398
  for (const [k, child] of Object.entries(v)) {
6274
6399
  const s = substitute(child);
@@ -6289,14 +6414,152 @@ async function resolveSecretMarkers(value, secrets) {
6289
6414
  unresolved
6290
6415
  };
6291
6416
  }
6292
- function touchesTree(tree, patch) {
6293
- if (tree.size === 0) return false;
6294
- for (const key of Object.keys(patch)) {
6295
- const at = key.indexOf("@");
6296
- if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6417
+ /** An addon tried to replace a stored secret it could not read. Nothing was written. */
6418
+ var SecretOverwriteRefusedError = class extends Error {
6419
+ ref;
6420
+ reason;
6421
+ constructor(ref, reason) {
6422
+ 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.`);
6423
+ this.ref = ref;
6424
+ this.reason = reason;
6425
+ this.name = "SecretOverwriteRefusedError";
6426
+ }
6427
+ };
6428
+ function isRecord(value) {
6429
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6430
+ }
6431
+ function resolvedValue(pass, marker) {
6432
+ const answer = pass.answers[marker.$secret];
6433
+ return answer?.kind === "value" ? answer.value : null;
6434
+ }
6435
+ async function atMarker(pass, incoming, stored) {
6436
+ if (incoming === null) return stored;
6437
+ if (typeof incoming !== "string") return incoming;
6438
+ if (incoming === resolvedValue(pass, stored)) return stored;
6439
+ const intent = classifySecretWrite(incoming);
6440
+ if (intent.kind !== "set") return stored;
6441
+ const ref = stored.$secret;
6442
+ if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
6443
+ const answer = pass.answers[ref];
6444
+ 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);
6445
+ try {
6446
+ await pass.secrets.put(ref, intent.value);
6447
+ } catch (err) {
6448
+ throw new KeychainWriteRefusedError(ref, err);
6449
+ }
6450
+ pass.changedRefs.push(ref);
6451
+ return stored;
6452
+ }
6453
+ function inArray(pass, incoming, stored) {
6454
+ return incoming.map((item, index) => {
6455
+ const twin = stored[index];
6456
+ if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6457
+ if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6458
+ if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6459
+ return item;
6460
+ });
6461
+ }
6462
+ function inArrayRow(pass, incoming, stored) {
6463
+ const out = { ...incoming };
6464
+ for (const [key, value] of Object.entries(incoming)) {
6465
+ const twin = stored[key];
6466
+ if (isSecretMarker(twin)) {
6467
+ if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6468
+ } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6469
+ else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6470
+ }
6471
+ return out;
6472
+ }
6473
+ async function walk(pass, incoming, stored) {
6474
+ if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6475
+ if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6476
+ if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6477
+ const out = { ...incoming };
6478
+ for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6479
+ return out;
6480
+ }
6481
+ /** Restore markers a write-back carries as values. See the file doc. */
6482
+ async function restoreUnchangedSecrets(input) {
6483
+ const refs = [];
6484
+ for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
6485
+ const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
6486
+ if (owned.length === 0) return {
6487
+ patch: input.patch,
6488
+ changedRefs: []
6489
+ };
6490
+ const pass = {
6491
+ secrets: input.secrets,
6492
+ answers: await input.secrets.resolve([...new Set(owned)]),
6493
+ operatorWrite: input.operatorWrite,
6494
+ changedRefs: []
6495
+ };
6496
+ const out = {};
6497
+ for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
6498
+ return {
6499
+ patch: out,
6500
+ changedRefs: pass.changedRefs
6501
+ };
6502
+ }
6503
+ /** Structural equality over JSON-shaped values (key order does not matter). */
6504
+ function isJsonEqual(a, b) {
6505
+ if (Object.is(a, b)) return true;
6506
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6507
+ if (isRecord(a) && isRecord(b)) {
6508
+ const keys = Object.keys(a);
6509
+ if (keys.length !== Object.keys(b).length) return false;
6510
+ return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
6297
6511
  }
6298
6512
  return false;
6299
6513
  }
6514
+ /** The patch without the keys whose value already equals the stored one. */
6515
+ function dropUnchangedKeys(patch, stored) {
6516
+ const out = {};
6517
+ for (const [key, value] of Object.entries(patch)) {
6518
+ if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
6519
+ out[key] = value;
6520
+ }
6521
+ return out;
6522
+ }
6523
+ /** The top-level keys of a blob that hold at least one of `owner`'s markers. */
6524
+ function markerKeysOf(blob, owner) {
6525
+ const keys = /* @__PURE__ */ new Set();
6526
+ for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
6527
+ return keys;
6528
+ }
6529
+ function nodeFromStored(value, owner) {
6530
+ if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6531
+ if (!isRecord(value)) return null;
6532
+ const children = /* @__PURE__ */ new Map();
6533
+ for (const [key, child] of Object.entries(value)) {
6534
+ const node = nodeFromStored(child, owner);
6535
+ if (node !== null) children.set(key, node);
6536
+ }
6537
+ return children.size > 0 ? {
6538
+ kind: "object",
6539
+ children
6540
+ } : null;
6541
+ }
6542
+ /**
6543
+ * The declared secret tree, widened by every place the STORED blob holds a
6544
+ * marker under one of `keys` — so a marker the schema no longer declares (or
6545
+ * never declared: Wyze before b4906cec6) still gets the save path's
6546
+ * KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
6547
+ * addon writes. Markers inside arrays are not added: a row has no id field to
6548
+ * match by unless the schema declares one. Only `owner`'s markers count: a
6549
+ * builtin that keeps another addon's marker (device-manager) never takes it
6550
+ * over.
6551
+ */
6552
+ function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
6553
+ const added = /* @__PURE__ */ new Map();
6554
+ for (const key of keys) {
6555
+ const at = key.indexOf("@");
6556
+ const base = at > 0 ? key.slice(0, at) : key;
6557
+ if (declared.has(base) || added.has(base)) continue;
6558
+ const node = nodeFromStored(stored[key], owner);
6559
+ if (node !== null) added.set(base, node);
6560
+ }
6561
+ return added.size === 0 ? declared : new Map([...declared, ...added]);
6562
+ }
6300
6563
  /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6301
6564
  async function readStoredAddonBlob(raw) {
6302
6565
  const threeWay = raw.readAddonStoreResult;
@@ -6305,7 +6568,41 @@ async function readStoredAddonBlob(raw) {
6305
6568
  if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6306
6569
  return result.kind === "missing" ? {} : result.value;
6307
6570
  }
6308
- function createSecretAwareSettings(raw, opts) {
6571
+ function touchesTree(tree, patch) {
6572
+ if (tree.size === 0) return false;
6573
+ for (const key of Object.keys(patch)) {
6574
+ const at = key.indexOf("@");
6575
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6576
+ }
6577
+ return false;
6578
+ }
6579
+ /**
6580
+ * Which top-level keys of each store held markers when last seen. `undefined`
6581
+ * for a store not seen yet: its first write reads it, to be safe.
6582
+ */
6583
+ var MarkerKeyIndex = class {
6584
+ owner;
6585
+ byStore = /* @__PURE__ */ new Map();
6586
+ constructor(owner) {
6587
+ this.owner = owner;
6588
+ }
6589
+ seen(store, blob) {
6590
+ this.byStore.set(store, markerKeysOf(blob, this.owner));
6591
+ }
6592
+ wrote(store, patch) {
6593
+ const keys = this.byStore.get(store);
6594
+ if (keys === void 0) return;
6595
+ const now = markerKeysOf(patch, this.owner);
6596
+ for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
6597
+ else keys.delete(key);
6598
+ }
6599
+ mayHoldMarkers(store, patch) {
6600
+ const keys = this.byStore.get(store);
6601
+ if (keys === void 0) return true;
6602
+ return Object.keys(patch).some((key) => keys.has(key));
6603
+ }
6604
+ };
6605
+ function createHandle(raw, opts) {
6309
6606
  const chains = /* @__PURE__ */ new Map();
6310
6607
  const serialize = (key, fn) => {
6311
6608
  const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
@@ -6316,46 +6613,130 @@ function createSecretAwareSettings(raw, opts) {
6316
6613
  });
6317
6614
  return next;
6318
6615
  };
6319
- const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6320
- if (!touchesTree(tree, patch)) return rawWrite(patch);
6321
- return serialize(chainKey, async () => {
6616
+ const index = new MarkerKeyIndex(opts.secrets.owner);
6617
+ const resolveRead = async (store, blob) => {
6618
+ index.seen(store, blob);
6619
+ const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
6620
+ unresolved: "keep-marker",
6621
+ ownedBy: opts.secrets.owner
6622
+ });
6623
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6624
+ return value;
6625
+ };
6626
+ const write = async (store, declared, scope, patch, readStored, rawWrite) => {
6627
+ if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
6628
+ await rawWrite(patch);
6629
+ index.wrote(store, patch);
6630
+ return { changed: true };
6631
+ }
6632
+ return serialize(store, async () => {
6322
6633
  const stored = await readStored();
6634
+ index.seen(store, stored);
6635
+ const operatorWrite = opts.isOperatorWrite?.() === true;
6636
+ const restored = await restoreUnchangedSecrets({
6637
+ patch,
6638
+ stored,
6639
+ secrets: opts.secrets,
6640
+ operatorWrite
6641
+ });
6323
6642
  const result = await transformSecretWrite({
6324
- tree,
6643
+ tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
6325
6644
  secrets: opts.secrets,
6326
- patch,
6645
+ patch: restored.patch,
6327
6646
  stored,
6328
6647
  ...scope !== void 0 ? { scope } : {},
6329
- operatorWrite: opts.isOperatorWrite?.() === true
6648
+ operatorWrite
6330
6649
  });
6331
- if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6650
+ const effective = dropUnchangedKeys(result.patch, stored);
6651
+ const wroteBlob = Object.keys(effective).length > 0;
6652
+ if (wroteBlob) {
6653
+ await rawWrite(effective);
6654
+ index.wrote(store, effective);
6655
+ }
6332
6656
  const { orphaned } = await result.afterWrite();
6333
6657
  if (orphaned.length > 0) opts.onOrphaned(orphaned);
6658
+ return { changed: wroteBlob || restored.changedRefs.length > 0 };
6334
6659
  });
6335
6660
  };
6336
- const wrapped = {
6337
- writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6338
- writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6339
- kind: "device",
6340
- deviceId
6341
- }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6661
+ const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6662
+ const readAddonStoreResult = raw.readAddonStoreResult;
6663
+ const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6664
+ const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6665
+ const overrides = {
6666
+ readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6667
+ ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
6668
+ const result = await readAddonStoreResult.call(raw);
6669
+ return result.kind === "value" ? {
6670
+ kind: "value",
6671
+ value: await resolveRead("addon", result.value)
6672
+ } : result;
6673
+ } } : {},
6674
+ ...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
6675
+ const result = await readAddonStoreKeyResult.call(raw, key);
6676
+ if (result.kind !== "present") return result;
6677
+ const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
6678
+ unresolved: "keep-marker",
6679
+ ownedBy: opts.secrets.owner
6680
+ });
6681
+ if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
6682
+ return {
6683
+ kind: "present",
6684
+ value: value[key]
6685
+ };
6686
+ } } : {},
6687
+ readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6688
+ ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6689
+ const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6690
+ const out = /* @__PURE__ */ new Map();
6691
+ for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6692
+ return out;
6693
+ } } : {},
6694
+ writeAddonStore: async (patch) => {
6695
+ await writeAddon(patch);
6696
+ },
6697
+ writeDeviceStore: async (deviceId, patch) => {
6698
+ await write(`device:${deviceId}`, opts.deviceTree(), {
6699
+ kind: "device",
6700
+ deviceId
6701
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
6702
+ }
6703
+ };
6704
+ return {
6705
+ settings: new Proxy(raw, { get(target, prop, receiver) {
6706
+ if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
6707
+ const value = Reflect.get(target, prop, receiver);
6708
+ return typeof value === "function" ? value.bind(target) : value;
6709
+ } }),
6710
+ raw: {
6711
+ readAddonStore: async () => {
6712
+ const blob = await raw.readAddonStore();
6713
+ index.seen("addon", blob);
6714
+ return blob;
6715
+ },
6716
+ readDeviceStore: async (deviceId) => {
6717
+ const blob = await raw.readDeviceStore(deviceId);
6718
+ index.seen(`device:${deviceId}`, blob);
6719
+ return blob;
6720
+ }
6721
+ },
6722
+ writeAddonStore: writeAddon
6342
6723
  };
6343
- return new Proxy(raw, { get(target, prop, receiver) {
6344
- if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6345
- if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6346
- const value = Reflect.get(target, prop, receiver);
6347
- return typeof value === "function" ? value.bind(target) : value;
6348
- } });
6349
6724
  }
6350
- /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6351
- function withSecretAwareSettings(context, opts) {
6725
+ /** The context the addon sees, plus the private raw view and write outcome. */
6726
+ function createSecretAwareContext(context, opts) {
6352
6727
  const raw = context.settings;
6353
- if (raw === void 0) return context;
6354
- const settings = createSecretAwareSettings(raw, opts);
6355
- return new Proxy(context, { get(target, prop, receiver) {
6356
- if (prop === "settings") return settings;
6357
- return Reflect.get(target, prop, receiver);
6358
- } });
6728
+ if (raw === void 0) return {
6729
+ context,
6730
+ handle: null
6731
+ };
6732
+ const handle = createHandle(raw, opts);
6733
+ return {
6734
+ context: new Proxy(context, { get(target, prop, receiver) {
6735
+ if (prop === "settings") return handle.settings;
6736
+ return Reflect.get(target, prop, receiver);
6737
+ } }),
6738
+ handle
6739
+ };
6359
6740
  }
6360
6741
  var LEAF = { kind: "leaf" };
6361
6742
  var DEFAULT_ITEM_ID_KEY = "id";
@@ -6530,6 +6911,14 @@ var BaseAddon = class {
6530
6911
  _secretChangeUnsub = null;
6531
6912
  /** >0 while an OPERATOR's settings write is being applied. */
6532
6913
  _operatorWriteDepth = 0;
6914
+ /**
6915
+ * The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
6916
+ * to the marker-bearing blobs and stays private to this class: the form
6917
+ * hydrate and config resolution need markers, addon code never does.
6918
+ */
6919
+ _secretSettings = null;
6920
+ /** Refs an addon-facing read could not resolve — each is logged once per process. */
6921
+ _loggedUnresolvedReads = /* @__PURE__ */ new Set();
6533
6922
  constructor(defaults) {
6534
6923
  this.defaults = defaults;
6535
6924
  this._config = { ...defaults };
@@ -6566,13 +6955,21 @@ var BaseAddon = class {
6566
6955
  }
6567
6956
  async initialize(context) {
6568
6957
  const secrets = context.secrets;
6569
- this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6570
- secrets,
6571
- addonTree: () => this.addonSecretTree(),
6572
- deviceTree: () => this.deviceSecretTree(),
6573
- onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6574
- isOperatorWrite: () => this._operatorWriteDepth > 0
6575
- }) : context;
6958
+ if (secrets !== void 0) {
6959
+ const { context: wrapped, handle } = createSecretAwareContext(context, {
6960
+ secrets,
6961
+ addonTree: () => this.addonSecretTree(),
6962
+ deviceTree: () => this.deviceSecretTree(),
6963
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6964
+ isOperatorWrite: () => this._operatorWriteDepth > 0,
6965
+ onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
6966
+ });
6967
+ this._ctx = wrapped;
6968
+ this._secretSettings = handle;
6969
+ } else {
6970
+ this._ctx = context;
6971
+ this._secretSettings = null;
6972
+ }
6576
6973
  await this.resolveConfig();
6577
6974
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6578
6975
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
@@ -6689,11 +7086,8 @@ var BaseAddon = class {
6689
7086
  async getGlobalSettings(overlay, cap, nodeId) {
6690
7087
  const schema = this.globalSettingsSchema(cap);
6691
7088
  if (!schema) return { sections: [] };
6692
- const projected = await this.resolveGlobalStore(nodeId, cap);
6693
- return hydrateSchema(schema, overlay ? {
6694
- ...projected,
6695
- ...overlay
6696
- } : projected, { inlineSecretsAsViews: true });
7089
+ const projected = await this.readRawProjectedStore(nodeId, cap);
7090
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
6697
7091
  }
6698
7092
  /**
6699
7093
  * The integration-level view of this addon's settings: exactly the sections
@@ -6738,7 +7132,7 @@ var BaseAddon = class {
6738
7132
  });
6739
7133
  }
6740
7134
  if (sections.length === 0) return null;
6741
- const projected = await this.resolveGlobalStore(nodeId);
7135
+ const projected = await this.readRawProjectedStore(nodeId);
6742
7136
  return hydrateSchema({
6743
7137
  ...schema,
6744
7138
  sections
@@ -6755,12 +7149,50 @@ var BaseAddon = class {
6755
7149
  * the store for custom option logic (option narrowing, value snapping) to
6756
7150
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
6757
7151
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
7152
+ *
7153
+ * Keychain values come back RESOLVED (D798): a secret reads as its value,
7154
+ * never as a `{ $secret }` marker. One the keychain cannot serve right now
7155
+ * stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
7156
+ * is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
7157
+ * it cannot be mistaken for "nothing stored, mint a new one". Writing the
7158
+ * resolved blob back is a no-op for every unchanged secret.
6758
7159
  */
6759
7160
  async resolveGlobalStore(nodeId, cap) {
6760
7161
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
7162
+ return this.projectForNode(raw, nodeId, cap);
7163
+ }
7164
+ projectForNode(store, nodeId, cap) {
6761
7165
  const keys = this.perNodeKeys(cap);
6762
7166
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6763
- return keys.size > 0 ? projectStore(raw, keys, node) : raw;
7167
+ return keys.size > 0 ? projectStore(store, keys, node) : store;
7168
+ }
7169
+ /** The PROJECTED store with its markers — the form hydrate only (D798). */
7170
+ async readRawProjectedStore(nodeId, cap) {
7171
+ const raw = await this.rawSettings()?.readAddonStore() ?? {};
7172
+ return this.projectForNode(raw, nodeId, cap);
7173
+ }
7174
+ /**
7175
+ * `{ ...stored, ...overlay }`, except that an overlay member equal to the
7176
+ * RESOLVED stored one keeps the stored (marker-bearing) member — so a form
7177
+ * hydrated from a resolved overlay still shows a secret as "set", never as
7178
+ * its value.
7179
+ */
7180
+ async overlayKeepingMarkers(stored, overlay) {
7181
+ const secrets = this._ctx?.secrets;
7182
+ const merged = {
7183
+ ...stored,
7184
+ ...overlay
7185
+ };
7186
+ if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
7187
+ const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
7188
+ unresolved: "keep-marker",
7189
+ ownedBy: secrets.owner
7190
+ });
7191
+ for (const key of Object.keys(overlay)) {
7192
+ if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
7193
+ if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
7194
+ }
7195
+ return merged;
6764
7196
  }
6765
7197
  /**
6766
7198
  * Whether ONE global key of this addon's store was written, read three-way
@@ -6825,8 +7257,12 @@ var BaseAddon = class {
6825
7257
  async clearSecrets(keys, nodeId) {
6826
7258
  const tree = this.addonSecretTree();
6827
7259
  const keychain = this._ctx?.secrets !== void 0;
7260
+ const stored = keychain ? await this.readAddonStoreWithRetry() : {};
6828
7261
  const patch = {};
6829
- for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
7262
+ for (const key of keys) {
7263
+ const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7264
+ patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7265
+ }
6830
7266
  await this.applyGlobalPatch(patch, nodeId);
6831
7267
  }
6832
7268
  async applyGlobalPatch(barePatch, nodeId) {
@@ -6834,7 +7270,11 @@ var BaseAddon = class {
6834
7270
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6835
7271
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6836
7272
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6837
- await this._ctx?.settings?.writeAddonStore(scoped);
7273
+ const handle = this._secretSettings;
7274
+ if (handle !== null) {
7275
+ const { changed } = await handle.writeAddonStore(scoped);
7276
+ if (!changed) return;
7277
+ } else await this._ctx?.settings?.writeAddonStore(scoped);
6838
7278
  if (target !== localNode) return;
6839
7279
  await this.resolveConfig();
6840
7280
  await this.onConfigChanged();
@@ -6887,7 +7327,7 @@ var BaseAddon = class {
6887
7327
  async getDeviceSettings(deviceId) {
6888
7328
  const schema = this.deviceSettingsSchema();
6889
7329
  if (!schema) return { sections: [] };
6890
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
7330
+ return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6891
7331
  }
6892
7332
  async updateDeviceSettings(deviceId, patch) {
6893
7333
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -7059,7 +7499,7 @@ var BaseAddon = class {
7059
7499
  key,
7060
7500
  schema,
7061
7501
  fallback,
7062
- read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
7502
+ read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
7063
7503
  write: async (patch) => {
7064
7504
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
7065
7505
  },
@@ -7121,6 +7561,23 @@ var BaseAddon = class {
7121
7561
  }
7122
7562
  return value;
7123
7563
  }
7564
+ /**
7565
+ * The marker-bearing settings reads (D798) — private on purpose. Without a
7566
+ * keychain the context's own view is already raw.
7567
+ */
7568
+ rawSettings() {
7569
+ return this._secretSettings?.raw ?? this._ctx?.settings;
7570
+ }
7571
+ /** An addon-facing read met markers it could not resolve: say so once per ref. */
7572
+ logUnresolvedRead(unresolved) {
7573
+ const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
7574
+ if (fresh.length === 0) return;
7575
+ for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
7576
+ 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) => ({
7577
+ ref: u.ref,
7578
+ reason: u.reason
7579
+ })) } });
7580
+ }
7124
7581
  /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7125
7582
  scheduleSecretReresolve(delayMs) {
7126
7583
  const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
@@ -7147,7 +7604,7 @@ var BaseAddon = class {
7147
7604
  * `{}` (defaults) — the addon's first successful patch will rehydrate.
7148
7605
  */
7149
7606
  async readAddonStoreWithRetry() {
7150
- const settings = this._ctx?.settings;
7607
+ const settings = this.rawSettings();
7151
7608
  if (!settings) return {};
7152
7609
  const delaysMs = [
7153
7610
  150,
@@ -9500,6 +9957,278 @@ var CameraSwitchGroupSchema = object({
9500
9957
  fetchedAt: number()
9501
9958
  });
9502
9959
  /**
9960
+ * The trainer contract — what the hub hands the cloud trainer and what it
9961
+ * gets back (cloud training, D805+).
9962
+ *
9963
+ * The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
9964
+ * `camstack/camstack-trainer`) is a separate AGPL program the hub never
9965
+ * imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
9966
+ * lines on stdout. These schemas are the hub's half of that boundary; the
9967
+ * trainer's pydantic models (and the JSON Schemas generated from them under
9968
+ * `hf/camstack-trainer/schemas/`) are the other half. A change here is a
9969
+ * change there, in the same piece of work.
9970
+ *
9971
+ * No `.default()` anywhere: defaults do not run on the addon cap path, so the
9972
+ * orchestrator fills every field of a job spec explicitly.
9973
+ */
9974
+ var TRAINING_JOB_SCHEMA = "camstack.training/v1";
9975
+ var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
9976
+ /** What the trainer can export. Edge TPU is a later, separate image. */
9977
+ var TrainingExportSchema = _enum([
9978
+ "onnx",
9979
+ "openvino-fp16",
9980
+ "openvino-int8",
9981
+ "coreml-fp16"
9982
+ ]);
9983
+ var FloorsSchema = record(string(), number().min(0).max(1));
9984
+ object({
9985
+ schema: literal(TRAINING_JOB_SCHEMA),
9986
+ jobKey: string().uuid(),
9987
+ target: object({
9988
+ kind: literal("detector"),
9989
+ step: literal("object-detection")
9990
+ }),
9991
+ base: object({
9992
+ modelId: string().min(1),
9993
+ /** Ultralytics weights id, e.g. `yolov9m.pt`. */
9994
+ weights: string().min(1),
9995
+ imgsz: number().int().positive()
9996
+ }),
9997
+ baseline: object({
9998
+ modelId: string().min(1),
9999
+ /** The baseline ONNX the holdout comparison runs; public mirror URL. */
10000
+ onnxUrl: string().url(),
10001
+ imgsz: number().int().positive(),
10002
+ floors: FloorsSchema
10003
+ }),
10004
+ dataset: object({
10005
+ versionId: string().min(1),
10006
+ annotationHash: string(),
10007
+ /** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
10008
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10009
+ }),
10010
+ split: object({
10011
+ holdoutCameras: array(number().int()),
10012
+ /** When no camera is held out: the last N days of every camera. */
10013
+ holdoutLastDays: number().int().nonnegative(),
10014
+ valFraction: number().min(0).max(.5),
10015
+ seed: number().int()
10016
+ }),
10017
+ hyper: object({
10018
+ epochs: number().int().positive(),
10019
+ batch: number().int().positive(),
10020
+ lr0: number().positive(),
10021
+ /** Layers frozen from the start of the backbone; 0 = none. */
10022
+ freeze: number().int().nonnegative(),
10023
+ patience: number().int().nonnegative(),
10024
+ seed: number().int()
10025
+ }),
10026
+ replay: object({
10027
+ source: literal("coco2017"),
10028
+ count: number().int().nonnegative()
10029
+ }),
10030
+ exports: array(TrainingExportSchema).min(1),
10031
+ calibration: object({ maxFrames: number().int().positive() }),
10032
+ floors: object({
10033
+ minSupport: number().int().positive(),
10034
+ clamp: number().min(0).max(1)
10035
+ }),
10036
+ int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
10037
+ catalog: object({
10038
+ id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
10039
+ name: string().min(1).max(160)
10040
+ })
10041
+ });
10042
+ /** One regular file of the bundle. An mlpackage contributes one row per member. */
10043
+ var TrainingResultFileSchema = object({
10044
+ path: string().min(1),
10045
+ bytes: number().int().nonnegative(),
10046
+ sha256: string().regex(/^[0-9a-f]{64}$/),
10047
+ format: _enum([
10048
+ "onnx",
10049
+ "openvino",
10050
+ "coreml",
10051
+ "pt"
10052
+ ]),
10053
+ variant: _enum(["base", "int8"])
10054
+ });
10055
+ var DraftFormatSchema = object({
10056
+ /** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
10057
+ url: string().min(1),
10058
+ sizeMB: number().nonnegative(),
10059
+ isDirectory: boolean().optional(),
10060
+ files: array(string()).optional(),
10061
+ runtimes: array(literal("python")).optional(),
10062
+ revision: string().min(1)
10063
+ });
10064
+ /** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
10065
+ var TrainingCatalogDraftSchema = object({
10066
+ id: string().min(1),
10067
+ name: string().min(1),
10068
+ description: string(),
10069
+ labels: array(unknown()),
10070
+ inputSize: object({
10071
+ width: number().int().positive(),
10072
+ height: number().int().positive()
10073
+ }),
10074
+ preprocessMode: literal("letterbox"),
10075
+ defaultClassFloors: FloorsSchema,
10076
+ formats: object({
10077
+ onnx: DraftFormatSchema.optional(),
10078
+ openvino: DraftFormatSchema.optional(),
10079
+ coreml: DraftFormatSchema.optional()
10080
+ })
10081
+ });
10082
+ /** One class of one model's holdout report (the eval harness's summary). */
10083
+ var TrainingEvalClassSchema = object({
10084
+ positives: number().int(),
10085
+ floor: number().nullable(),
10086
+ tp: number().int(),
10087
+ fp: number().int(),
10088
+ fn: number().int(),
10089
+ precision: number().nullable(),
10090
+ recall: number().nullable(),
10091
+ ap50: number().nullable(),
10092
+ recallByCamera: record(string(), number().nullable()).optional(),
10093
+ recallByLight: record(string(), number().nullable()).optional(),
10094
+ fpByCamera: record(string(), number()).optional(),
10095
+ smallFound: number().int().optional(),
10096
+ smallTotal: number().int().optional()
10097
+ }).passthrough();
10098
+ var TrainingEvalReportSchema = object({
10099
+ frames: number().int(),
10100
+ classes: record(string(), TrainingEvalClassSchema)
10101
+ }).passthrough();
10102
+ /**
10103
+ * A succeeded result carries every block; a failed one carries the error and
10104
+ * whatever was known by then — the other blocks are ABSENT, not null. The
10105
+ * orchestrator checks the blocks it needs before it trusts a success.
10106
+ */
10107
+ var TrainingResultSchema = object({
10108
+ schema: literal(TRAINING_RESULT_SCHEMA),
10109
+ jobKey: string(),
10110
+ status: _enum(["succeeded", "failed"]),
10111
+ error: object({
10112
+ stage: string(),
10113
+ code: string(),
10114
+ message: string()
10115
+ }).nullable(),
10116
+ trainer: object({
10117
+ version: string(),
10118
+ revision: string()
10119
+ }),
10120
+ toolchain: record(string(), string().nullable()),
10121
+ dataset: object({
10122
+ versionId: string(),
10123
+ annotationHash: string(),
10124
+ sha256: string(),
10125
+ frames: object({
10126
+ train: number().int(),
10127
+ val: number().int(),
10128
+ holdout: number().int()
10129
+ }),
10130
+ holdoutCameras: array(number().int()),
10131
+ replayImages: number().int()
10132
+ }).optional(),
10133
+ training: object({
10134
+ epochsRun: number().int(),
10135
+ bestEpoch: number().int(),
10136
+ bestMap50: number(),
10137
+ bestMap50_95: number(),
10138
+ seconds: number()
10139
+ }).optional(),
10140
+ evaluation: object({
10141
+ holdoutFrames: number().int(),
10142
+ baseline: TrainingEvalReportSchema.nullable(),
10143
+ candidate: TrainingEvalReportSchema.nullable(),
10144
+ candidateInt8: TrainingEvalReportSchema.nullable(),
10145
+ recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
10146
+ map50: record(string(), number().nullable())
10147
+ }).optional(),
10148
+ floors: object({
10149
+ baseline: FloorsSchema,
10150
+ candidate: FloorsSchema,
10151
+ candidateInt8: FloorsSchema.nullable(),
10152
+ notes: array(string())
10153
+ }).optional(),
10154
+ int8: object({
10155
+ kept: boolean(),
10156
+ map50Fp16: number().nullable(),
10157
+ map50Int8: number().nullable(),
10158
+ reason: string().nullable()
10159
+ }).optional(),
10160
+ exportsDropped: array(object({
10161
+ export: string(),
10162
+ reason: string()
10163
+ })).optional(),
10164
+ files: array(TrainingResultFileSchema).optional(),
10165
+ bundle: object({
10166
+ path: literal("bundle.tar"),
10167
+ bytes: number().int().nonnegative(),
10168
+ sha256: string().regex(/^[0-9a-f]{64}$/)
10169
+ }).nullable().optional(),
10170
+ catalogDraft: object({
10171
+ base: TrainingCatalogDraftSchema,
10172
+ int8: TrainingCatalogDraftSchema.nullable()
10173
+ }).nullable().optional(),
10174
+ licence: string()
10175
+ });
10176
+ var TrainingStageSchema = _enum([
10177
+ "prepare",
10178
+ "replay",
10179
+ "train",
10180
+ "eval",
10181
+ "export",
10182
+ "package"
10183
+ ]);
10184
+ var EventBase = {
10185
+ v: literal(1),
10186
+ ts: number()
10187
+ };
10188
+ discriminatedUnion("type", [
10189
+ object({
10190
+ ...EventBase,
10191
+ type: literal("stage"),
10192
+ stage: TrainingStageSchema
10193
+ }),
10194
+ object({
10195
+ ...EventBase,
10196
+ type: literal("epoch"),
10197
+ epoch: number().int(),
10198
+ epochs: number().int(),
10199
+ boxLoss: number().nullable().optional(),
10200
+ map50: number().nullable().optional(),
10201
+ map50_95: number().nullable().optional(),
10202
+ etaSec: number().nullable().optional()
10203
+ }),
10204
+ object({
10205
+ ...EventBase,
10206
+ type: literal("metric"),
10207
+ name: string(),
10208
+ value: number()
10209
+ }),
10210
+ object({
10211
+ ...EventBase,
10212
+ type: literal("artifact"),
10213
+ path: string(),
10214
+ bytes: number(),
10215
+ sha256: string()
10216
+ }),
10217
+ object({
10218
+ ...EventBase,
10219
+ type: literal("done"),
10220
+ status: _enum(["succeeded", "failed"]),
10221
+ resultSha256: string().nullable().optional()
10222
+ }),
10223
+ object({
10224
+ ...EventBase,
10225
+ type: literal("error"),
10226
+ stage: string(),
10227
+ code: string(),
10228
+ message: string()
10229
+ })
10230
+ ]);
10231
+ /**
9503
10232
  * What the gate decided about a birth, from the CALLER's point of view.
9504
10233
  *
9505
10234
  * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
@@ -11547,6 +12276,20 @@ var ConvertResultSchema = object({
11547
12276
  files: array(string()).readonly()
11548
12277
  })).readonly()
11549
12278
  });
12279
+ /**
12280
+ * The cookie that binds an SSO sign-in to the browser that started it.
12281
+ *
12282
+ * An IdP `/start` sets it to a random value and keeps only its SHA-256 in the
12283
+ * server-side pending state; the login bridge carries that hash. The hub's
12284
+ * `/api/auth/sso/finish` swaps a bridge for a session only when the request
12285
+ * presents the cookie whose hash the bridge names — so a bridge copied out of
12286
+ * a URL (history, a proxy log, a screenshot) is useless in any other browser.
12287
+ * The finish clears the cookie, and records the bridge's `jti` so the same
12288
+ * bridge never finishes twice.
12289
+ *
12290
+ * One name, two readers (the OIDC addon that sets it, the hub that checks it).
12291
+ */
12292
+ var SSO_STATE_COOKIE = "camstack_sso_state";
11550
12293
  var ExpressionBindingSourceSchema = union([
11551
12294
  object({
11552
12295
  kind: literal("field").optional(),
@@ -11827,7 +12570,9 @@ var AddonHttpRouteSchema = object({
11827
12570
  "authenticated",
11828
12571
  "admin"
11829
12572
  ]).optional(),
11830
- description: string().optional()
12573
+ description: string().optional(),
12574
+ /** The hub limits this route per client address before the handler runs. */
12575
+ rateLimit: _enum(["auth"]).optional()
11831
12576
  });
11832
12577
  /**
11833
12578
  * Cross-process route invocation envelope. The hub captures the
@@ -12583,6 +13328,37 @@ var BackupDestinationInfoSchema = object({
12583
13328
  lastError: string().optional()
12584
13329
  });
12585
13330
  /**
13331
+ * How an archive is encrypted (operator decision 2026-10-09): to a backup
13332
+ * PUBLIC key the hub holds, so only the operator's secret key opens it.
13333
+ * Absent on a plain `.tar.gz` — every archive made before encryption, or
13334
+ * with it off — which restores without a key.
13335
+ */
13336
+ var BackupArchiveEncryptionSchema = object({
13337
+ /** `x25519-hkdf-aes256gcm-stream-v1`. */
13338
+ scheme: string(),
13339
+ /** 16 hex — the backup key whose secret restores this archive. */
13340
+ keyId: string()
13341
+ });
13342
+ /**
13343
+ * The backup encryption setting. The hub keeps PUBLIC keys only: the active
13344
+ * one new archives are encrypted to, and the retired ones older archives
13345
+ * still need. The secret key is shown once, at `setupEncryption`.
13346
+ */
13347
+ var BackupEncryptionStatusSchema = object({
13348
+ enabled: boolean(),
13349
+ active: object({
13350
+ keyId: string(),
13351
+ publicKey: string(),
13352
+ createdAt: number()
13353
+ }).nullable(),
13354
+ /** Every key ever set up, newest first. */
13355
+ keys: array(object({
13356
+ keyId: string(),
13357
+ createdAt: number(),
13358
+ retiredAt: number().nullable()
13359
+ })).readonly()
13360
+ });
13361
+ /**
12586
13362
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
12587
13363
  * Same shape the destination drill-in renders. Sourced from the per-
12588
13364
  * location `manifests.json` (no per-archive tarball read required).
@@ -12594,7 +13370,9 @@ var BackupArchiveEntrySchema = object({
12594
13370
  sizeBytes: number(),
12595
13371
  label: string().optional(),
12596
13372
  /** Top-level locations included in the archive (db, addons, tls, …). */
12597
- locations: array(string()).readonly()
13373
+ locations: array(string()).readonly(),
13374
+ /** Present when the archive is encrypted; restore then needs that key. */
13375
+ encryption: BackupArchiveEncryptionSchema.optional()
12598
13376
  });
12599
13377
  var BackupEntrySchema = object({
12600
13378
  id: string(),
@@ -12603,7 +13381,8 @@ var BackupEntrySchema = object({
12603
13381
  label: string().optional(),
12604
13382
  createdAt: number(),
12605
13383
  sizeBytes: number(),
12606
- locations: array(string()).optional()
13384
+ locations: array(string()).optional(),
13385
+ encryption: BackupArchiveEncryptionSchema.optional()
12607
13386
  });
12608
13387
  var ArchiveEntrySchema = object({
12609
13388
  path: string(),
@@ -12792,10 +13571,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
12792
13571
  * this list and skips entries whose path doesn't start with
12793
13572
  * any of them.
12794
13573
  */
12795
- locations: array(string()).optional()
13574
+ locations: array(string()).optional(),
13575
+ /**
13576
+ * The backup SECRET key, for an encrypted archive (ignored for a plain
13577
+ * one). The archive is decrypted into the hub's private staging
13578
+ * before the restart; the key is not stored. A wrong or missing key
13579
+ * is refused before the archive is downloaded.
13580
+ */
13581
+ backupSecretKey: string().optional()
12796
13582
  }), _void(), {
12797
13583
  kind: "mutation",
12798
13584
  auth: "admin"
13585
+ }), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
13586
+ keyId: string(),
13587
+ secretKey: string(),
13588
+ publicKey: string(),
13589
+ createdAt: number(),
13590
+ replacedKeyId: string().nullable()
13591
+ }), {
13592
+ kind: "mutation",
13593
+ auth: "admin"
13594
+ }), method(object({}), object({ disabledKeyId: string().nullable() }), {
13595
+ kind: "mutation",
13596
+ auth: "admin"
13597
+ }), method(object({ backupSecretKey: string() }), object({
13598
+ valid: boolean(),
13599
+ keyId: string().nullable(),
13600
+ /** The hub knows this key (active or retired). */
13601
+ known: boolean(),
13602
+ /** It is the key new archives are encrypted to. */
13603
+ active: boolean(),
13604
+ error: string().optional()
13605
+ }), {
13606
+ kind: "mutation",
13607
+ auth: "admin"
12799
13608
  }), method(object({
12800
13609
  destinationId: string(),
12801
13610
  backupId: string()
@@ -14419,7 +15228,60 @@ var CustomModelDescriptorSchema = object({
14419
15228
  stepId: string(),
14420
15229
  entry: ModelCatalogEntrySchema
14421
15230
  });
14422
- method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
15231
+ /** One regular file of an imported bundle, as the producer measured it. */
15232
+ var ModelBundleFileSchema = object({
15233
+ /** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
15234
+ path: string().min(1),
15235
+ bytes: number().int().nonnegative(),
15236
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15237
+ });
15238
+ var ImportModelBundleInputSchema = object({
15239
+ /** The registry provider that keeps the model (Model Studio). */
15240
+ addonId: string(),
15241
+ stepId: string().min(1),
15242
+ /**
15243
+ * The catalog rows to register, complete, every format URL already
15244
+ * `camstack-local://<modelId>/<file>` naming a file of the bundle. One
15245
+ * bundle may carry several rows (a base and its INT8 variant).
15246
+ */
15247
+ entries: array(ModelCatalogEntrySchema).min(1).max(4),
15248
+ /** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
15249
+ bundle: object({
15250
+ ticket: PeerBytesTicketSchema,
15251
+ bytes: number().int().positive(),
15252
+ sha256: string().regex(/^[0-9a-f]{64}$/)
15253
+ }),
15254
+ /** Every file the tar must hold; anything missing, extra or different is refused. */
15255
+ files: array(ModelBundleFileSchema).min(1).max(64),
15256
+ /** Convert missing engine formats and push the model to every agent afterwards. */
15257
+ distribute: boolean()
15258
+ });
15259
+ var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
15260
+ kind: literal("imported"),
15261
+ modelIds: array(string()).readonly(),
15262
+ distributed: array(object({
15263
+ modelId: string(),
15264
+ nodeId: string(),
15265
+ format: _enum(MODEL_FORMATS),
15266
+ ok: boolean(),
15267
+ error: string().optional()
15268
+ })).readonly()
15269
+ }), object({
15270
+ kind: literal("refused"),
15271
+ reason: _enum([
15272
+ "transfer-failed",
15273
+ "checksum-mismatch",
15274
+ "bundle-mismatch",
15275
+ "invalid-entry",
15276
+ "id-taken"
15277
+ ]),
15278
+ detail: string()
15279
+ })]);
15280
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
15281
+ kind: "mutation",
15282
+ auth: "admin",
15283
+ timeoutMs: 30 * 6e4
15284
+ });
14423
15285
  /**
14424
15286
  * Query filter for settings-store collections.
14425
15287
  */
@@ -14898,6 +15760,35 @@ var KeychainKeySourceSchema = object({
14898
15760
  */
14899
15761
  sharesBackupWithDatabase: boolean()
14900
15762
  });
15763
+ /**
15764
+ * One keychain reset, as the Secrets page reports it until the operator
15765
+ * acknowledges it. Never a value: refs, counts and table names only.
15766
+ */
15767
+ var KeychainResetRecordSchema = object({
15768
+ id: string(),
15769
+ at: number(),
15770
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
15771
+ actor: string(),
15772
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
15773
+ lockedReason: string().nullable(),
15774
+ /** Values moved into the archive table (ciphertext under the lost key). */
15775
+ archived: number().int(),
15776
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
15777
+ archivedCollection: string().nullable(),
15778
+ /**
15779
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
15780
+ * so the archive can still be opened if the lost master key turns up.
15781
+ */
15782
+ archivedKeysCollection: string().nullable(),
15783
+ /**
15784
+ * `system-settings` keys whose marker the reset cleared — the cluster
15785
+ * secret's: a marker left pointing at an archived value would refuse every
15786
+ * agent forever (D797).
15787
+ */
15788
+ clearedSettingsKeys: array(string()).readonly(),
15789
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
15790
+ acknowledgedAt: number().nullable()
15791
+ });
14901
15792
  var KeychainStatusSchema = object({
14902
15793
  keychain: KeychainStateSchema,
14903
15794
  /** The source of the master key in use; `null` while locked. */
@@ -14915,7 +15806,9 @@ var KeychainStatusSchema = object({
14915
15806
  /** Wrapped copies of the data key under a previous master key, kept until purged. */
14916
15807
  retiredWraps: number().int(),
14917
15808
  recoveryKeyDownloadedAt: number().nullable(),
14918
- secretCount: number().int()
15809
+ secretCount: number().int(),
15810
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
15811
+ lastReset: KeychainResetRecordSchema.nullable()
14919
15812
  });
14920
15813
  /**
14921
15814
  * Whether a stored value is still pointed at by its owner's settings.
@@ -14937,13 +15830,14 @@ var KeychainAuditActionSchema = _enum([
14937
15830
  "download-recovery-key",
14938
15831
  "delete-orphans",
14939
15832
  "reset",
15833
+ "acknowledge-reset",
14940
15834
  "initialize"
14941
15835
  ]);
14942
15836
  var KeychainAuditEntrySchema = object({
14943
15837
  id: string(),
14944
15838
  at: number(),
14945
15839
  action: KeychainAuditActionSchema,
14946
- /** `addon:<id>` | `user:<id>` | `system`. */
15840
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
14947
15841
  actor: string(),
14948
15842
  ref: string().nullable(),
14949
15843
  detail: string().nullable()
@@ -15009,6 +15903,13 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
15009
15903
  kind: "mutation",
15010
15904
  auth: "admin",
15011
15905
  caller: "required"
15906
+ }), method(object({}), object({
15907
+ reset: KeychainResetRecordSchema.nullable(),
15908
+ pendingReentry: array(KeychainSecretMetaSchema).readonly()
15909
+ }), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
15910
+ kind: "mutation",
15911
+ auth: "admin",
15912
+ caller: "required"
15012
15913
  });
15013
15914
  method(_void(), object({
15014
15915
  id: string(),
@@ -17654,7 +18555,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17654
18555
  * `login-method` — collection cap through which auth addons contribute
17655
18556
  * their pre-auth login surfaces to the login page. This is the SINGLE,
17656
18557
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
17657
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
18558
+ * every auth addon (OIDC, WebAuthn/passkey) registers a
17658
18559
  * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17659
18560
  * procedure aggregates them for the unauthenticated login page.
17660
18561
  *
@@ -17662,8 +18563,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17662
18563
  *
17663
18564
  * - `redirect` — a declarative button. The login page renders a generic
17664
18565
  * button that navigates to `startUrl` (an addon-owned HTTP route).
17665
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17666
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
18566
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
17667
18567
  * login page needs NO change.
17668
18568
  *
17669
18569
  * - `widget` — a Module-Federation widget the login page mounts (via
@@ -17682,8 +18582,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
17682
18582
  * decision.
17683
18583
  *
17684
18584
  * Every contribution carries a `stage`:
17685
- * - `primary` — shown on the first credentials screen (OIDC /
17686
- * magic-link buttons; a future usernameless passkey).
18585
+ * - `primary` — shown on the first credentials screen (OIDC
18586
+ * buttons; a usernameless passkey).
17687
18587
  * - `second-factor` — shown AFTER the password leg, gated on the
17688
18588
  * returned `factors` (passkey-as-2FA today).
17689
18589
  *
@@ -17710,7 +18610,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17710
18610
  * The provider names an external identity a signed-in user can link to
17711
18611
  * their own account (D782): `auth.listLinkableProviders` /
17712
18612
  * `beginExternalLink` offer exactly the redirect methods that set this,
17713
- * whatever their id. Absent / false — a login button only (magic-link).
18613
+ * whatever their id. Absent / false — a login button only.
17714
18614
  */
17715
18615
  linkable: boolean().optional()
17716
18616
  }),
@@ -21535,8 +22435,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21535
22435
  * `super_admin` — collapsed onto the single boolean because every
21536
22436
  * non-admin caller is governed by the same scope-check rules; the
21537
22437
  * distinction was only ever used to route role-specific procedures
21538
- * which we no longer have. Agents are admin sessions issued via
21539
- * `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
22438
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
21540
22439
  * with `isAdmin: false` + an explicit scope list.
21541
22440
  */
21542
22441
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -24231,6 +25130,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24231
25130
  kind: "mutation",
24232
25131
  auth: "admin",
24233
25132
  timeoutMs: 60 * 6e4
25133
+ }), method(object({
25134
+ filter: RetrainExportFilterSchema,
25135
+ layout: RetrainExportLayoutSchema
25136
+ }), object({
25137
+ ticket: PeerBytesTicketSchema,
25138
+ frames: number().int(),
25139
+ annotations: number().int()
25140
+ }), {
25141
+ kind: "mutation",
25142
+ auth: "admin",
25143
+ timeoutMs: 12e4
24234
25144
  }), method(object({
24235
25145
  selection: RetrainDatasetSelectionSchema,
24236
25146
  completeOnly: boolean().optional()
@@ -27799,8 +28709,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
27799
28709
  * `smtp-provider` — pluggable email delivery surface.
27800
28710
  *
27801
28711
  * Collection cap: a deployment may install multiple SMTP relays (e.g.
27802
- * one for transactional / one for notifications). Consumers (magic-link,
27803
- * notifier addons, …) walk the collection and pick the first
28712
+ * one for transactional / one for notifications). Consumers (notifier
28713
+ * addons, …) walk the collection and pick the first
27804
28714
  * ready provider OR target a specific addonId.
27805
28715
  *
27806
28716
  * The shape stays small on purpose — `sendEmail` is enough for the
@@ -27979,7 +28889,7 @@ targets: array(object({
27979
28889
  })));
27980
28890
  /**
27981
28891
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
27982
- * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
28892
+ * providers (OIDC, SAML, …) mint an HMAC-signed token
27983
28893
  * carrying the post-callback claims before redirecting back to
27984
28894
  * `/api/auth/sso/finish`.
27985
28895
  *
@@ -28042,7 +28952,14 @@ var SsoBridgeClaimsSchema = object({
28042
28952
  * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28043
28953
  * subject is unique only per issuer, so a link is bound to it.
28044
28954
  */
28045
- issuer: string().optional()
28955
+ issuer: string().optional(),
28956
+ /**
28957
+ * SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
28958
+ * the browser that began this sign-in. `/api/auth/sso/finish` requires the
28959
+ * request to present the matching cookie — a login bridge is useless in
28960
+ * any other browser.
28961
+ */
28962
+ browserBinding: string().optional()
28046
28963
  });
28047
28964
  method(object({
28048
28965
  claims: SsoBridgeClaimsSchema,
@@ -33969,7 +34886,13 @@ var TopologyNodeSchema = object({
33969
34886
  })).readonly(),
33970
34887
  processes: array(TopologyProcessSchema).readonly(),
33971
34888
  categories: array(TopologyCategorySchema).readonly(),
33972
- rootPackage: TopologyRootPackageSchema.nullable()
34889
+ rootPackage: TopologyRootPackageSchema.nullable(),
34890
+ /**
34891
+ * How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
34892
+ * completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
34893
+ * for offline rows and when the hub cannot tell.
34894
+ */
34895
+ meshTransport: _enum(["tls", "clear"]).optional()
33973
34896
  });
33974
34897
  var CapUsageEdgeSchema = object({
33975
34898
  callerAddonId: string(),
@@ -37997,16 +38920,6 @@ var ApiKeySummarySchema = object({
37997
38920
  createdAt: number(),
37998
38921
  lastUsedAt: number().optional()
37999
38922
  });
38000
- var CreateApiKeyInputSchema = object({
38001
- label: string(),
38002
- isAdmin: boolean().default(false),
38003
- allowedProviders: union([array(string()), literal("*")]).optional(),
38004
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
38005
- });
38006
- var CreateApiKeyResultSchema = object({
38007
- token: string(),
38008
- record: ApiKeySummarySchema
38009
- });
38010
38923
  var ScopedTokenSummarySchema = object({
38011
38924
  id: string(),
38012
38925
  userId: string(),
@@ -38105,17 +39018,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
38105
39018
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
38106
39019
  kind: "mutation",
38107
39020
  access: "view"
38108
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
38109
- kind: "mutation",
38110
- auth: "admin",
38111
- access: "create"
38112
- }), method(object({ id: string() }), object({ success: literal(true) }), {
39021
+ }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
38113
39022
  kind: "mutation",
38114
39023
  auth: "admin",
38115
39024
  access: "delete"
38116
- }), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
38117
- kind: "mutation",
38118
- access: "view"
38119
39025
  }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
38120
39026
  kind: "mutation",
38121
39027
  auth: "admin",
@@ -38189,15 +39095,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
38189
39095
  }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
38190
39096
  userId: string(),
38191
39097
  issuer: string()
38192
- }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
38193
- userId: string(),
38194
- issuer: string().min(1),
38195
- label: string().optional()
38196
- }), object({ success: literal(true) }), {
38197
- kind: "mutation",
38198
- auth: "admin",
38199
- access: "create"
38200
- }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
39098
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
38201
39099
  kind: "mutation",
38202
39100
  auth: "admin",
38203
39101
  access: "delete"
@@ -38592,6 +39490,451 @@ DeviceType.Camera, method(object({
38592
39490
  detection: array(ZoneRuleSchema).readonly(),
38593
39491
  package: array(ZoneRuleSchema).readonly()
38594
39492
  });
39493
+ /**
39494
+ * `training-provider` — ONE cloud that can run the CamStack trainer.
39495
+ *
39496
+ * A thin, mockable translation layer: it knows how to run a container with a
39497
+ * GPU, move a dataset in, read the job's stdout and hand artefacts back. It
39498
+ * knows nothing about datasets, splits, floors, cost policy or Model Studio —
39499
+ * those are the `training` orchestrator's (D805). Every rule written there
39500
+ * once is what makes a second provider (RunPod, a local NVIDIA node) a new
39501
+ * manifest entry and nothing else.
39502
+ *
39503
+ * Collection, routed by the `addonId` in every single-row input (the `llm` /
39504
+ * `notification-output` posture); `describe` concat-fans across providers.
39505
+ * Every method is `admin`: these spend money.
39506
+ *
39507
+ * Every cloud object a provider creates is tagged with the orchestrator's
39508
+ * `jobKey`, so a retried submit finds the job it already started instead of
39509
+ * starting a second GPU, and `listJobs` can find orphans.
39510
+ *
39511
+ * Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
39512
+ * ticket the producer (pipeline-analytics) minted, and artefacts leave as a
39513
+ * ticket the provider mints (D613).
39514
+ */
39515
+ var TrainingGpuOptionSchema = object({
39516
+ id: string(),
39517
+ label: string(),
39518
+ /** List price, USD per GPU-hour, before any region multiplier. */
39519
+ usdPerHour: number().nonnegative(),
39520
+ vramGb: number().nonnegative()
39521
+ });
39522
+ var TrainingRegionOptionSchema = object({
39523
+ /** `''` = any region (the provider's choice). */
39524
+ id: string(),
39525
+ label: string(),
39526
+ priceMultiplier: number().positive()
39527
+ });
39528
+ /**
39529
+ * The provider's per-account settings, as the orchestrator reads them. They
39530
+ * live in the PROVIDER addon's settings (operator decision 2026-10-08: they
39531
+ * depend on the user's account), never hard-coded in the orchestrator.
39532
+ */
39533
+ var TrainingProviderDefaultsSchema = object({
39534
+ gpuType: string(),
39535
+ region: string(),
39536
+ costCapUsd: number().nonnegative(),
39537
+ maxRuntimeSec: number().int().positive(),
39538
+ /** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
39539
+ failedDatasetGraceHours: number().nonnegative()
39540
+ });
39541
+ var TrainingProviderDescriptorSchema = object({
39542
+ addonId: string(),
39543
+ /** `modal`, `runpod`, `fake`, … */
39544
+ kind: string(),
39545
+ label: string(),
39546
+ gpuTypes: array(TrainingGpuOptionSchema).readonly(),
39547
+ regions: array(TrainingRegionOptionSchema).readonly(),
39548
+ maxDatasetBytes: number().int().positive(),
39549
+ maxRuntimeSec: number().int().positive(),
39550
+ freeTierNote: string().optional(),
39551
+ /** Where the data goes, in one sentence the confirm dialog repeats. */
39552
+ dataResidencyNote: string(),
39553
+ /** Credentials are present — never the values. */
39554
+ configured: boolean(),
39555
+ defaults: TrainingProviderDefaultsSchema
39556
+ });
39557
+ var TrainingCredentialCheckSchema = object({
39558
+ ok: boolean(),
39559
+ /** Workspace / account name, when the provider says. */
39560
+ account: string().optional(),
39561
+ reason: _enum([
39562
+ "missing",
39563
+ "invalid",
39564
+ "forbidden",
39565
+ "network",
39566
+ "quota"
39567
+ ]).optional(),
39568
+ detail: string().optional()
39569
+ });
39570
+ var ProviderJobStateSchema = _enum([
39571
+ "pending",
39572
+ "starting",
39573
+ "running",
39574
+ "succeeded",
39575
+ "failed",
39576
+ "cancelled",
39577
+ "lost"
39578
+ ]);
39579
+ var ProviderJobStatusSchema = object({
39580
+ jobKey: string(),
39581
+ providerJobId: string().optional(),
39582
+ state: ProviderJobStateSchema,
39583
+ startedAt: number().optional(),
39584
+ endedAt: number().optional(),
39585
+ exitCode: number().int().optional(),
39586
+ failureReason: string().optional(),
39587
+ gpuType: string(),
39588
+ region: string().optional(),
39589
+ billedSeconds: number().nonnegative(),
39590
+ costUsd: number().nonnegative(),
39591
+ /** True when `costUsd` is runtime × list price, not a billing answer. */
39592
+ costIsEstimate: boolean(),
39593
+ lastFetchedAt: number()
39594
+ });
39595
+ /**
39596
+ * The trainer the job runs, by SOURCE revision: the provider turns it into an
39597
+ * image its own way (Modal builds the published Dockerfile at that revision;
39598
+ * a registry-pull provider maps it to a tag). Recorded on the job and echoed
39599
+ * in `result.json`.
39600
+ */
39601
+ var TrainerSourceRefSchema = object({
39602
+ /** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
39603
+ repo: string().min(1),
39604
+ /** A commit sha (never a branch) — the job must be reproducible. */
39605
+ revision: string().regex(/^[0-9a-f]{7,64}$/)
39606
+ });
39607
+ var JobRef = {
39608
+ addonId: string(),
39609
+ jobKey: string().uuid()
39610
+ };
39611
+ var TrainingLogLineSchema = object({
39612
+ ts: number(),
39613
+ text: string()
39614
+ });
39615
+ method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
39616
+ kind: "mutation",
39617
+ auth: "admin",
39618
+ timeoutMs: 3e4
39619
+ }), method(object({
39620
+ addonId: string(),
39621
+ gpuType: string(),
39622
+ region: string(),
39623
+ datasetBytes: number().int().nonnegative(),
39624
+ gpuSecondsLow: number().nonnegative(),
39625
+ gpuSecondsHigh: number().nonnegative()
39626
+ }), object({
39627
+ usdLow: number().nonnegative(),
39628
+ usdHigh: number().nonnegative(),
39629
+ notes: array(string()).readonly()
39630
+ }), { auth: "admin" }), method(object({
39631
+ ...JobRef,
39632
+ ticket: PeerBytesTicketSchema
39633
+ }), object({
39634
+ bytes: number().int().nonnegative(),
39635
+ sha256: string()
39636
+ }), {
39637
+ kind: "mutation",
39638
+ auth: "admin",
39639
+ timeoutMs: 120 * 6e4
39640
+ }), method(object({
39641
+ ...JobRef,
39642
+ trainer: TrainerSourceRefSchema,
39643
+ jobSpecJson: string().min(2).max(64e3),
39644
+ gpuType: string(),
39645
+ region: string(),
39646
+ maxRuntimeSec: number().int().positive()
39647
+ }), ProviderJobStatusSchema, {
39648
+ kind: "mutation",
39649
+ auth: "admin",
39650
+ timeoutMs: 30 * 6e4
39651
+ }), method(object(JobRef), ProviderJobStatusSchema, {
39652
+ auth: "admin",
39653
+ timeoutMs: 6e4
39654
+ }), method(object({
39655
+ ...JobRef,
39656
+ cursor: string().optional(),
39657
+ max: number().int().min(1).max(500)
39658
+ }), object({
39659
+ lines: array(TrainingLogLineSchema).readonly(),
39660
+ cursor: string()
39661
+ }), {
39662
+ auth: "admin",
39663
+ timeoutMs: 6e4
39664
+ }), method(object(JobRef), object({ ok: literal(true) }), {
39665
+ kind: "mutation",
39666
+ auth: "admin",
39667
+ timeoutMs: 6e4
39668
+ }), method(object(JobRef), object({
39669
+ found: boolean(),
39670
+ text: string().optional()
39671
+ }), {
39672
+ kind: "mutation",
39673
+ auth: "admin",
39674
+ timeoutMs: 5 * 6e4
39675
+ }), method(object({
39676
+ ...JobRef,
39677
+ path: _enum(["bundle.tar"])
39678
+ }), object({ ticket: PeerBytesTicketSchema }), {
39679
+ kind: "mutation",
39680
+ auth: "admin",
39681
+ timeoutMs: 5 * 6e4
39682
+ }), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
39683
+ kind: "mutation",
39684
+ auth: "admin",
39685
+ timeoutMs: 5 * 6e4
39686
+ }), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
39687
+ auth: "admin",
39688
+ timeoutMs: 2 * 6e4
39689
+ });
39690
+ /**
39691
+ * `training` — the cloud-training orchestrator (D805). Hub-only singleton,
39692
+ * provided by `addon-training`.
39693
+ *
39694
+ * It owns what every provider must agree on, written once:
39695
+ *
39696
+ * - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
39697
+ * live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
39698
+ * the export plan) and reaches this store through the five row methods
39699
+ * below, so the Retrain page and the export did not change.
39700
+ * - **Jobs.** A persisted state machine, a reconcile loop against the
39701
+ * provider, a cost guard, a daily orphan sweep and the retention rules.
39702
+ * - **The return flow.** Verified artefacts → Model Studio
39703
+ * (`custom-model-registry.importModelBundle`) → canary on cameras →
39704
+ * rollback. Nothing is ever registered automatically.
39705
+ *
39706
+ * Every method is `admin`.
39707
+ */
39708
+ /** A version WITH its frame list — what the export and a job read. */
39709
+ var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
39710
+ /** A base model a detector job can fine-tune, and the baseline it is judged against. */
39711
+ var TrainingBaseModelSchema = object({
39712
+ modelId: string(),
39713
+ label: string(),
39714
+ weights: string(),
39715
+ imgsz: number().int(),
39716
+ baselineOnnxUrl: string(),
39717
+ baselineFloors: record(string(), number()),
39718
+ /** The base the fleet runs most — the UI's default. */
39719
+ recommended: boolean()
39720
+ });
39721
+ var TrainingPresetSchema = _enum([
39722
+ "quick",
39723
+ "standard",
39724
+ "thorough"
39725
+ ]);
39726
+ var TrainingJobRequestSchema = object({
39727
+ datasetVersionId: string().min(1),
39728
+ /** The `training-provider` addon that runs it. */
39729
+ addonId: string().min(1),
39730
+ gpuType: string().min(1),
39731
+ region: string(),
39732
+ baseModelId: string().min(1),
39733
+ preset: TrainingPresetSchema,
39734
+ /** Freeze the backbone's first N layers; `null` = the preset's choice. */
39735
+ freeze: number().int().nonnegative().nullable(),
39736
+ /** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
39737
+ holdoutCameras: array(number().int()).nullable()
39738
+ });
39739
+ var TrainingSplitPlanSchema = object({
39740
+ holdoutCameras: array(number().int()).readonly(),
39741
+ /** Used when no camera is held out: the last N days of every camera. */
39742
+ holdoutLastDays: number().int().nonnegative(),
39743
+ /** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
39744
+ holdoutSupport: record(string(), number().int()).nullable(),
39745
+ trainSubjects: number().int()
39746
+ });
39747
+ var TrainingRefusalReasonSchema = _enum([
39748
+ "unknown-dataset",
39749
+ "unknown-provider",
39750
+ "provider-not-configured",
39751
+ "unknown-base-model",
39752
+ "unknown-gpu",
39753
+ "dataset-too-large",
39754
+ "no-training-subjects",
39755
+ "job-already-running"
39756
+ ]);
39757
+ var TrainingJobPlanSchema = object({
39758
+ refusal: object({
39759
+ reason: TrainingRefusalReasonSchema,
39760
+ detail: string()
39761
+ }).nullable(),
39762
+ warnings: array(string()).readonly(),
39763
+ split: TrainingSplitPlanSchema.nullable(),
39764
+ estimate: object({
39765
+ datasetBytes: number().int(),
39766
+ uploadMinutesAt20Mbps: number(),
39767
+ gpuSecondsLow: number(),
39768
+ gpuSecondsHigh: number(),
39769
+ usdLow: number(),
39770
+ usdHigh: number(),
39771
+ notes: array(string()).readonly()
39772
+ }).nullable(),
39773
+ /** Pre-filled from the provider's settings; the operator may lower or raise them. */
39774
+ defaults: object({
39775
+ maxCostUsd: number(),
39776
+ maxRuntimeSec: number().int()
39777
+ }).nullable(),
39778
+ /** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
39779
+ dataNotice: string()
39780
+ });
39781
+ /**
39782
+ * Orchestrator-owned states, persisted. `uploading` covers exporting the
39783
+ * archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
39784
+ * `lost`, `expired`, `discarded`. `registered` and `canary` are where a
39785
+ * result lives after the operator acted on it.
39786
+ */
39787
+ var TrainingJobStateSchema = _enum([
39788
+ "uploading",
39789
+ "submitted",
39790
+ "starting",
39791
+ "running",
39792
+ "collecting",
39793
+ "ready",
39794
+ "registered",
39795
+ "canary",
39796
+ "failed",
39797
+ "cancelling",
39798
+ "cancelled",
39799
+ "lost",
39800
+ "expired",
39801
+ "discarded"
39802
+ ]);
39803
+ var TrainingFailureReasonSchema = _enum([
39804
+ "cost-cap",
39805
+ "runtime-cap",
39806
+ "upload-failed",
39807
+ "submit-failed",
39808
+ "trainer-failed",
39809
+ "result-invalid",
39810
+ "checksum-mismatch",
39811
+ "fetch-failed",
39812
+ "provider-error",
39813
+ "hub-restart-during-upload"
39814
+ ]);
39815
+ var TrainingProgressPointSchema = object({
39816
+ epoch: number().int(),
39817
+ map50: number().nullable(),
39818
+ map50_95: number().nullable()
39819
+ });
39820
+ var TrainingCanarySchema = object({
39821
+ deviceIds: array(number().int()).readonly(),
39822
+ since: number(),
39823
+ /** Every override the canary replaced, exactly, so rollback restores it. */
39824
+ previous: array(object({
39825
+ deviceId: number().int(),
39826
+ nodeId: string(),
39827
+ deviceKey: string(),
39828
+ patch: object({
39829
+ modelId: string().optional(),
39830
+ settings: record(string(), unknown()).readonly().optional()
39831
+ }).nullable()
39832
+ })).readonly()
39833
+ });
39834
+ var TrainingJobSchema = object({
39835
+ id: string(),
39836
+ idempotencyKey: string(),
39837
+ name: string(),
39838
+ createdAt: number(),
39839
+ updatedAt: number(),
39840
+ state: TrainingJobStateSchema,
39841
+ stage: TrainingStageSchema.nullable(),
39842
+ failure: object({
39843
+ reason: TrainingFailureReasonSchema,
39844
+ stage: string().nullable(),
39845
+ detail: string()
39846
+ }).nullable(),
39847
+ request: TrainingJobRequestSchema,
39848
+ maxCostUsd: number().nonnegative(),
39849
+ maxRuntimeSec: number().int().positive(),
39850
+ trainer: TrainerSourceRefSchema,
39851
+ datasetLayout: RetrainExportLayoutSchema,
39852
+ dataset: object({
39853
+ bytes: number().int(),
39854
+ sha256: string(),
39855
+ uploadedAt: number()
39856
+ }).nullable(),
39857
+ split: TrainingSplitPlanSchema,
39858
+ provider: object({
39859
+ state: ProviderJobStateSchema.nullable(),
39860
+ providerJobId: string().nullable(),
39861
+ startedAt: number().nullable(),
39862
+ endedAt: number().nullable(),
39863
+ billedSeconds: number(),
39864
+ costUsd: number(),
39865
+ costIsEstimate: boolean(),
39866
+ lastPolledAt: number().nullable()
39867
+ }),
39868
+ progress: object({
39869
+ epoch: number().int().nullable(),
39870
+ epochs: number().int().nullable(),
39871
+ etaSec: number().nullable(),
39872
+ series: array(TrainingProgressPointSchema).readonly()
39873
+ }),
39874
+ /** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
39875
+ logTail: array(string()).readonly(),
39876
+ logCursor: string().nullable(),
39877
+ artifacts: object({
39878
+ bundleBytes: number().int(),
39879
+ bundleSha256: string(),
39880
+ fetchedAt: number(),
39881
+ /** When the staged artefacts are deleted from the hub. */
39882
+ expiresAt: number()
39883
+ }).nullable(),
39884
+ /** When the provider-side copy of the frames was deleted; null while it exists. */
39885
+ cloudDatasetDeletedAt: number().nullable(),
39886
+ /** A failed job's dataset is kept until then (the provider's grace), then deleted. */
39887
+ cloudCleanupDueAt: number().nullable(),
39888
+ /** Model ids registered from this job (base, and int8 when kept). */
39889
+ registeredModelIds: array(string()).readonly(),
39890
+ canary: TrainingCanarySchema.nullable()
39891
+ });
39892
+ var IdInput = object({ id: string().min(1) });
39893
+ method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
39894
+ kind: "mutation",
39895
+ auth: "admin"
39896
+ }), method(IdInput, TrainingDatasetVersionRowSchema.nullable(), { auth: "admin" }), method(object({}), array(RetrainDatasetVersionSchema).readonly(), { auth: "admin" }), method(object({ name: string() }), object({ id: string().nullable() }), { auth: "admin" }), method(IdInput, object({ removed: boolean() }), {
39897
+ kind: "mutation",
39898
+ auth: "admin"
39899
+ }), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
39900
+ auth: "admin",
39901
+ timeoutMs: 6e4
39902
+ }), method(TrainingJobRequestSchema.extend({
39903
+ name: string().min(1).max(120),
39904
+ maxCostUsd: number().positive(),
39905
+ maxRuntimeSec: number().int().positive(),
39906
+ idempotencyKey: string().min(8).max(80)
39907
+ }), discriminatedUnion("kind", [object({
39908
+ kind: literal("started"),
39909
+ job: TrainingJobSchema
39910
+ }), object({
39911
+ kind: literal("refused"),
39912
+ reason: TrainingRefusalReasonSchema,
39913
+ detail: string()
39914
+ })]), {
39915
+ kind: "mutation",
39916
+ auth: "admin",
39917
+ timeoutMs: 12e4
39918
+ }), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
39919
+ kind: "mutation",
39920
+ auth: "admin",
39921
+ timeoutMs: 12e4
39922
+ }), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
39923
+ kind: "mutation",
39924
+ auth: "admin",
39925
+ timeoutMs: 30 * 6e4
39926
+ }), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
39927
+ kind: "mutation",
39928
+ auth: "admin",
39929
+ timeoutMs: 12e4
39930
+ }), method(IdInput, TrainingJobSchema, {
39931
+ kind: "mutation",
39932
+ auth: "admin",
39933
+ timeoutMs: 12e4
39934
+ }), method(IdInput, TrainingJobSchema, {
39935
+ kind: "mutation",
39936
+ auth: "admin"
39937
+ });
38595
39938
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
38596
39939
  Object.freeze({
38597
39940
  person: .5,
@@ -39215,6 +40558,12 @@ Object.freeze({
39215
40558
  addonId: null,
39216
40559
  access: "create"
39217
40560
  },
40561
+ "backup.checkBackupKey": {
40562
+ capName: "backup",
40563
+ capScope: "system",
40564
+ addonId: null,
40565
+ access: "create"
40566
+ },
39218
40567
  "backup.delete": {
39219
40568
  capName: "backup",
39220
40569
  capScope: "system",
@@ -39227,6 +40576,18 @@ Object.freeze({
39227
40576
  addonId: null,
39228
40577
  access: "delete"
39229
40578
  },
40579
+ "backup.disableEncryption": {
40580
+ capName: "backup",
40581
+ capScope: "system",
40582
+ addonId: null,
40583
+ access: "create"
40584
+ },
40585
+ "backup.getEncryption": {
40586
+ capName: "backup",
40587
+ capScope: "system",
40588
+ addonId: null,
40589
+ access: "view"
40590
+ },
39230
40591
  "backup.getEntries": {
39231
40592
  capName: "backup",
39232
40593
  capScope: "system",
@@ -39281,6 +40642,12 @@ Object.freeze({
39281
40642
  addonId: null,
39282
40643
  access: "create"
39283
40644
  },
40645
+ "backup.setupEncryption": {
40646
+ capName: "backup",
40647
+ capScope: "system",
40648
+ addonId: null,
40649
+ access: "create"
40650
+ },
39284
40651
  "backup.trigger": {
39285
40652
  capName: "backup",
39286
40653
  capScope: "system",
@@ -39833,6 +41200,12 @@ Object.freeze({
39833
41200
  addonId: null,
39834
41201
  access: "create"
39835
41202
  },
41203
+ "customModelRegistry.importModelBundle": {
41204
+ capName: "custom-model-registry",
41205
+ capScope: "system",
41206
+ addonId: null,
41207
+ access: "create"
41208
+ },
39836
41209
  "customModelRegistry.listModels": {
39837
41210
  capName: "custom-model-registry",
39838
41211
  capScope: "system",
@@ -41273,6 +42646,12 @@ Object.freeze({
41273
42646
  addonId: null,
41274
42647
  access: "view"
41275
42648
  },
42649
+ "keychainAdmin.acknowledgeReset": {
42650
+ capName: "keychain-admin",
42651
+ capScope: "system",
42652
+ addonId: null,
42653
+ access: "create"
42654
+ },
41276
42655
  "keychainAdmin.deleteOrphans": {
41277
42656
  capName: "keychain-admin",
41278
42657
  capScope: "system",
@@ -41309,6 +42688,12 @@ Object.freeze({
41309
42688
  addonId: null,
41310
42689
  access: "delete"
41311
42690
  },
42691
+ "keychainAdmin.resetReport": {
42692
+ capName: "keychain-admin",
42693
+ capScope: "system",
42694
+ addonId: null,
42695
+ access: "delete"
42696
+ },
41312
42697
  "keychainAdmin.reveal": {
41313
42698
  capName: "keychain-admin",
41314
42699
  capScope: "system",
@@ -43055,6 +44440,12 @@ Object.freeze({
43055
44440
  addonId: null,
43056
44441
  access: "view"
43057
44442
  },
44443
+ "pipelineAnalytics.offerRetrainArchive": {
44444
+ capName: "pipeline-analytics",
44445
+ capScope: "device",
44446
+ addonId: null,
44447
+ access: "create"
44448
+ },
43058
44449
  "pipelineAnalytics.ownersWithMedia": {
43059
44450
  capName: "pipeline-analytics",
43060
44451
  capScope: "device",
@@ -45593,6 +46984,174 @@ Object.freeze({
45593
46984
  addonId: null,
45594
46985
  access: "view"
45595
46986
  },
46987
+ "training.canaryResult": {
46988
+ capName: "training",
46989
+ capScope: "system",
46990
+ addonId: null,
46991
+ access: "create"
46992
+ },
46993
+ "training.cancelJob": {
46994
+ capName: "training",
46995
+ capScope: "system",
46996
+ addonId: null,
46997
+ access: "create"
46998
+ },
46999
+ "training.discardResult": {
47000
+ capName: "training",
47001
+ capScope: "system",
47002
+ addonId: null,
47003
+ access: "create"
47004
+ },
47005
+ "training.findDatasetVersionIdByName": {
47006
+ capName: "training",
47007
+ capScope: "system",
47008
+ addonId: null,
47009
+ access: "view"
47010
+ },
47011
+ "training.getDatasetVersion": {
47012
+ capName: "training",
47013
+ capScope: "system",
47014
+ addonId: null,
47015
+ access: "view"
47016
+ },
47017
+ "training.getJob": {
47018
+ capName: "training",
47019
+ capScope: "system",
47020
+ addonId: null,
47021
+ access: "view"
47022
+ },
47023
+ "training.getJobResult": {
47024
+ capName: "training",
47025
+ capScope: "system",
47026
+ addonId: null,
47027
+ access: "view"
47028
+ },
47029
+ "training.listBaseModels": {
47030
+ capName: "training",
47031
+ capScope: "system",
47032
+ addonId: null,
47033
+ access: "view"
47034
+ },
47035
+ "training.listDatasetVersions": {
47036
+ capName: "training",
47037
+ capScope: "system",
47038
+ addonId: null,
47039
+ access: "view"
47040
+ },
47041
+ "training.listJobs": {
47042
+ capName: "training",
47043
+ capScope: "system",
47044
+ addonId: null,
47045
+ access: "view"
47046
+ },
47047
+ "training.planJob": {
47048
+ capName: "training",
47049
+ capScope: "system",
47050
+ addonId: null,
47051
+ access: "view"
47052
+ },
47053
+ "training.putDatasetVersion": {
47054
+ capName: "training",
47055
+ capScope: "system",
47056
+ addonId: null,
47057
+ access: "create"
47058
+ },
47059
+ "training.registerResult": {
47060
+ capName: "training",
47061
+ capScope: "system",
47062
+ addonId: null,
47063
+ access: "create"
47064
+ },
47065
+ "training.removeDatasetVersion": {
47066
+ capName: "training",
47067
+ capScope: "system",
47068
+ addonId: null,
47069
+ access: "delete"
47070
+ },
47071
+ "training.rollbackCanary": {
47072
+ capName: "training",
47073
+ capScope: "system",
47074
+ addonId: null,
47075
+ access: "create"
47076
+ },
47077
+ "training.startJob": {
47078
+ capName: "training",
47079
+ capScope: "system",
47080
+ addonId: null,
47081
+ access: "create"
47082
+ },
47083
+ "trainingProvider.cancelJob": {
47084
+ capName: "training-provider",
47085
+ capScope: "system",
47086
+ addonId: null,
47087
+ access: "create"
47088
+ },
47089
+ "trainingProvider.cleanupJob": {
47090
+ capName: "training-provider",
47091
+ capScope: "system",
47092
+ addonId: null,
47093
+ access: "create"
47094
+ },
47095
+ "trainingProvider.describe": {
47096
+ capName: "training-provider",
47097
+ capScope: "system",
47098
+ addonId: null,
47099
+ access: "view"
47100
+ },
47101
+ "trainingProvider.estimateJob": {
47102
+ capName: "training-provider",
47103
+ capScope: "system",
47104
+ addonId: null,
47105
+ access: "view"
47106
+ },
47107
+ "trainingProvider.getJob": {
47108
+ capName: "training-provider",
47109
+ capScope: "system",
47110
+ addonId: null,
47111
+ access: "view"
47112
+ },
47113
+ "trainingProvider.listJobEvents": {
47114
+ capName: "training-provider",
47115
+ capScope: "system",
47116
+ addonId: null,
47117
+ access: "view"
47118
+ },
47119
+ "trainingProvider.listJobs": {
47120
+ capName: "training-provider",
47121
+ capScope: "system",
47122
+ addonId: null,
47123
+ access: "view"
47124
+ },
47125
+ "trainingProvider.offerArtifact": {
47126
+ capName: "training-provider",
47127
+ capScope: "system",
47128
+ addonId: null,
47129
+ access: "create"
47130
+ },
47131
+ "trainingProvider.readResult": {
47132
+ capName: "training-provider",
47133
+ capScope: "system",
47134
+ addonId: null,
47135
+ access: "create"
47136
+ },
47137
+ "trainingProvider.submitJob": {
47138
+ capName: "training-provider",
47139
+ capScope: "system",
47140
+ addonId: null,
47141
+ access: "create"
47142
+ },
47143
+ "trainingProvider.uploadDataset": {
47144
+ capName: "training-provider",
47145
+ capScope: "system",
47146
+ addonId: null,
47147
+ access: "create"
47148
+ },
47149
+ "trainingProvider.validateCredentials": {
47150
+ capName: "training-provider",
47151
+ capScope: "system",
47152
+ addonId: null,
47153
+ access: "create"
47154
+ },
45596
47155
  "turnProvider.getTurnServers": {
45597
47156
  capName: "turn-provider",
45598
47157
  capScope: "system",
@@ -45617,12 +47176,6 @@ Object.freeze({
45617
47176
  addonId: null,
45618
47177
  access: "create"
45619
47178
  },
45620
- "userManagement.createApiKey": {
45621
- capName: "user-management",
45622
- capScope: "system",
45623
- addonId: null,
45624
- access: "create"
45625
- },
45626
47179
  "userManagement.createScopedToken": {
45627
47180
  capName: "user-management",
45628
47181
  capScope: "system",
@@ -45659,12 +47212,6 @@ Object.freeze({
45659
47212
  addonId: null,
45660
47213
  access: "view"
45661
47214
  },
45662
- "userManagement.linkExternalIdentity": {
45663
- capName: "user-management",
45664
- capScope: "system",
45665
- addonId: null,
45666
- access: "create"
45667
- },
45668
47215
  "userManagement.listApiKeys": {
45669
47216
  capName: "user-management",
45670
47217
  capScope: "system",
@@ -45767,12 +47314,6 @@ Object.freeze({
45767
47314
  addonId: null,
45768
47315
  access: "create"
45769
47316
  },
45770
- "userManagement.validateApiKey": {
45771
- capName: "user-management",
45772
- capScope: "system",
45773
- addonId: null,
45774
- access: "view"
45775
- },
45776
47317
  "userManagement.validateCredentials": {
45777
47318
  capName: "user-management",
45778
47319
  capScope: "system",
@@ -49890,6 +51431,11 @@ Object.freeze({
49890
51431
  form: "single",
49891
51432
  optional: false
49892
51433
  }],
51434
+ "training.canaryResult": [{
51435
+ name: "deviceIds",
51436
+ form: "array",
51437
+ optional: false
51438
+ }],
49893
51439
  "update.getStatus": [{
49894
51440
  name: "deviceId",
49895
51441
  form: "single",
@@ -50618,6 +52164,8 @@ var STATE_SUMMARY_VARS = [
50618
52164
  [...RULE_TEXT],
50619
52165
  [...RULE_TEXT],
50620
52166
  [...RULE_TEXT],
52167
+ [...RULE_TEXT],
52168
+ [...RULE_TEXT],
50621
52169
  ([...RULE_TEXT], [...UPDATES]),
50622
52170
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
50623
52171
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
@@ -51170,4 +52718,123 @@ DEFAULT_NATIVE_LEASE_SETTINGS.admission;
51170
52718
  var MB = 1024 * 1024;
51171
52719
  1024 * MB, 3072 * MB;
51172
52720
  //#endregion
51173
- export { isDisplayIconKey as a, errMsg as c, boolean as d, number as f, buildAddonRouteProvider as i, BaseAddon as l, string as m, addonWidgetsSourceCapability as n, loginMethodCapability as o, object as p, authProviderCapability as r, userPasskeysCapability as s, addonRoutesCapability as t, array as u };
52721
+ Object.defineProperty(exports, "BaseAddon", {
52722
+ enumerable: true,
52723
+ get: function() {
52724
+ return BaseAddon;
52725
+ }
52726
+ });
52727
+ Object.defineProperty(exports, "SSO_STATE_COOKIE", {
52728
+ enumerable: true,
52729
+ get: function() {
52730
+ return SSO_STATE_COOKIE;
52731
+ }
52732
+ });
52733
+ Object.defineProperty(exports, "__commonJSMin", {
52734
+ enumerable: true,
52735
+ get: function() {
52736
+ return __commonJSMin;
52737
+ }
52738
+ });
52739
+ Object.defineProperty(exports, "__esmMin", {
52740
+ enumerable: true,
52741
+ get: function() {
52742
+ return __esmMin;
52743
+ }
52744
+ });
52745
+ Object.defineProperty(exports, "__exportAll", {
52746
+ enumerable: true,
52747
+ get: function() {
52748
+ return __exportAll;
52749
+ }
52750
+ });
52751
+ Object.defineProperty(exports, "__toCommonJS", {
52752
+ enumerable: true,
52753
+ get: function() {
52754
+ return __toCommonJS;
52755
+ }
52756
+ });
52757
+ Object.defineProperty(exports, "__toESM", {
52758
+ enumerable: true,
52759
+ get: function() {
52760
+ return __toESM;
52761
+ }
52762
+ });
52763
+ Object.defineProperty(exports, "addonRoutesCapability", {
52764
+ enumerable: true,
52765
+ get: function() {
52766
+ return addonRoutesCapability;
52767
+ }
52768
+ });
52769
+ Object.defineProperty(exports, "addonWidgetsSourceCapability", {
52770
+ enumerable: true,
52771
+ get: function() {
52772
+ return addonWidgetsSourceCapability;
52773
+ }
52774
+ });
52775
+ Object.defineProperty(exports, "array", {
52776
+ enumerable: true,
52777
+ get: function() {
52778
+ return array;
52779
+ }
52780
+ });
52781
+ Object.defineProperty(exports, "authProviderCapability", {
52782
+ enumerable: true,
52783
+ get: function() {
52784
+ return authProviderCapability;
52785
+ }
52786
+ });
52787
+ Object.defineProperty(exports, "boolean", {
52788
+ enumerable: true,
52789
+ get: function() {
52790
+ return boolean;
52791
+ }
52792
+ });
52793
+ Object.defineProperty(exports, "buildAddonRouteProvider", {
52794
+ enumerable: true,
52795
+ get: function() {
52796
+ return buildAddonRouteProvider;
52797
+ }
52798
+ });
52799
+ Object.defineProperty(exports, "errMsg", {
52800
+ enumerable: true,
52801
+ get: function() {
52802
+ return errMsg;
52803
+ }
52804
+ });
52805
+ Object.defineProperty(exports, "isDisplayIconKey", {
52806
+ enumerable: true,
52807
+ get: function() {
52808
+ return isDisplayIconKey;
52809
+ }
52810
+ });
52811
+ Object.defineProperty(exports, "loginMethodCapability", {
52812
+ enumerable: true,
52813
+ get: function() {
52814
+ return loginMethodCapability;
52815
+ }
52816
+ });
52817
+ Object.defineProperty(exports, "number", {
52818
+ enumerable: true,
52819
+ get: function() {
52820
+ return number;
52821
+ }
52822
+ });
52823
+ Object.defineProperty(exports, "object", {
52824
+ enumerable: true,
52825
+ get: function() {
52826
+ return object;
52827
+ }
52828
+ });
52829
+ Object.defineProperty(exports, "string", {
52830
+ enumerable: true,
52831
+ get: function() {
52832
+ return string;
52833
+ }
52834
+ });
52835
+ Object.defineProperty(exports, "userPasskeysCapability", {
52836
+ enumerable: true,
52837
+ get: function() {
52838
+ return userPasskeysCapability;
52839
+ }
52840
+ });