@camstack/addon-smtp-nodemailer 1.2.118 → 1.2.119

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.
@@ -36,7 +36,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
36
36
  }) : target, mod));
37
37
  var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
38
  //#endregion
39
- //#region ../types/dist/event-category-B_0XEcLF.mjs
39
+ //#region ../types/dist/event-category-DaIZi00R.mjs
40
40
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
41
41
  EventCategory["SystemBoot"] = "system.boot";
42
42
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -115,6 +115,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
115
115
  */
116
116
  EventCategory["AddonLoadFailed"] = "addon.load-failed";
117
117
  /**
118
+ * A keychain value was stored or removed (D787). Carries the ref, its
119
+ * owner and the new version — NEVER the value. A process holding the ref
120
+ * drops its cached copy and the owning `BaseAddon` re-resolves its config.
121
+ * Telemetry (D8): a process that misses it still revalidates by version.
122
+ */
123
+ EventCategory["KeychainChanged"] = "keychain.changed";
124
+ /**
118
125
  * Addon recovered from a previous failure. Emitted when an addon
119
126
  * transitions from `failed` back to `healthy` (typically via the
120
127
  * monitor's auto-retry loop, or after manual `addons.retryLoad`).
@@ -5407,7 +5414,7 @@ var ZodIssueCode = {
5407
5414
  var ZodFirstPartyTypeKind;
5408
5415
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5409
5416
  //#endregion
5410
- //#region ../types/dist/sleep-B0JG7-_F.mjs
5417
+ //#region ../types/dist/sleep-Cr5YOk3m.mjs
5411
5418
  /**
5412
5419
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5413
5420
  * window to float samples (D455).
@@ -5486,6 +5493,97 @@ function buildAlawTable() {
5486
5493
  }
5487
5494
  buildUlawTable();
5488
5495
  buildAlawTable();
5496
+ /** Is this field's stored value a credential? */
5497
+ function isSecretConfigField(field) {
5498
+ if (field.type === "password") return true;
5499
+ return "secret" in field && field.secret === true;
5500
+ }
5501
+ /**
5502
+ * Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
5503
+ * by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
5504
+ */
5505
+ function isKeychainStoredField(field) {
5506
+ if (!isSecretConfigField(field)) return false;
5507
+ if (field.type === "textarea" && field.isJson === true) return false;
5508
+ return !("storage" in field && field.storage === "inline");
5509
+ }
5510
+ /**
5511
+ * What a settings blob holds where a secret used to be.
5512
+ *
5513
+ * A keychain-stored field never holds its value. It holds a self-describing
5514
+ * MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
5515
+ * code can mistake it for a credential and no form can send it to a camera as
5516
+ * a password. The empty state is `null` / absent, never `''`.
5517
+ *
5518
+ * The same shapes travel to and from the admin UI:
5519
+ *
5520
+ * - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
5521
+ * (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
5522
+ * value is set, never the value.
5523
+ * - write: an untouched field submits the view back unchanged (KEEP); a typed
5524
+ * value is a plain non-empty string (CHANGE); the Clear button submits
5525
+ * {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
5526
+ * are KEEP — an empty string is what a defaults-fallback pushes back, and
5527
+ * treating it as "clear" is how a save destroyed a stored credential before.
5528
+ *
5529
+ * Pure and browser-safe.
5530
+ */
5531
+ var SECRET_CLEAR = { $secretClear: true };
5532
+ /** The `'***'` token D634 redaction writes for non-admins. */
5533
+ var LEGACY_DEVICE_REDACTION = "***";
5534
+ function isRecord$1(value) {
5535
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5536
+ }
5537
+ function makeSecretMarker(ref) {
5538
+ return {
5539
+ $secret: ref,
5540
+ v: 1
5541
+ };
5542
+ }
5543
+ /** A stored marker: an object whose `$secret` is a non-empty string. */
5544
+ function isSecretMarker(value) {
5545
+ if (!isRecord$1(value)) return false;
5546
+ const ref = value["$secret"];
5547
+ return typeof ref === "string" && ref.length > 0;
5548
+ }
5549
+ function isSecretClear(value) {
5550
+ return isRecord$1(value) && value["$secretClear"] === true;
5551
+ }
5552
+ /**
5553
+ * The UI view of a stored secret field value: a marker becomes "set", inline
5554
+ * plaintext becomes "set (inline)", nothing becomes `null`. A value never
5555
+ * survives this function.
5556
+ */
5557
+ function toSecretFieldView(stored) {
5558
+ if (isSecretMarker(stored)) return {
5559
+ $secret: stored.$secret,
5560
+ v: 1,
5561
+ set: true
5562
+ };
5563
+ if (typeof stored === "string" && stored.length > 0) return {
5564
+ $secret: null,
5565
+ v: 1,
5566
+ set: true,
5567
+ inline: true
5568
+ };
5569
+ return null;
5570
+ }
5571
+ /**
5572
+ * Classify an incoming value for a secret path. Only a non-empty string that is
5573
+ * not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
5574
+ * Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
5575
+ * `undefined`, a redaction token, a non-string — keeps what is stored.
5576
+ */
5577
+ function classifySecretWrite(incoming) {
5578
+ if (isSecretClear(incoming)) return { kind: "clear" };
5579
+ if (typeof incoming !== "string") return { kind: "keep" };
5580
+ if (incoming.length === 0) return { kind: "keep" };
5581
+ if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
5582
+ return {
5583
+ kind: "set",
5584
+ value: incoming
5585
+ };
5586
+ }
5489
5587
  Object.fromEntries([
5490
5588
  {
5491
5589
  id: "overview",
@@ -5657,33 +5755,19 @@ Object.fromEntries([
5657
5755
  function isValuelessField(field) {
5658
5756
  return field.type === "separator" || field.type === "info" || field.type === "qr-code" || field.type === "button" || field.type === "object-array" || field.type === "widget" || field.type === "addon-action-button" || field.type === "device-action-button";
5659
5757
  }
5660
- /**
5661
- * Merge a `ConfigUISchema` with a raw `values` record into a
5662
- * `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
5663
- * before returning to the admin UI. Groups are walked recursively.
5664
- *
5665
- * For each leaf field:
5666
- * - structural fields (`separator`, `info`, `button`) pass through unchanged
5667
- * - other fields get `value = values[key] ?? field.default ?? null`
5668
- *
5669
- * Unknown keys in `values` (keys not declared in the schema) are silently
5670
- * ignored — they don't contribute to the output. Missing keys fall back to
5671
- * the schema default or `null`. This mirrors the old backend behaviour where
5672
- * `FormBuilder` rendered `values[key] ?? field.default`.
5673
- */
5674
- function hydrateSchema(schema, values) {
5758
+ function hydrateSchema(schema, values, options = {}) {
5675
5759
  return {
5676
5760
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
5677
5761
  sections: schema.sections.map((section) => ({
5678
5762
  ...section,
5679
- fields: section.fields.map((field) => hydrateField(field, values))
5763
+ fields: section.fields.map((field) => hydrateField(field, values, options))
5680
5764
  }))
5681
5765
  };
5682
5766
  }
5683
- function hydrateField(field, values) {
5767
+ function hydrateField(field, values, options) {
5684
5768
  if (isValuelessField(field)) return field;
5685
5769
  if (field.type === "group") {
5686
- const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
5770
+ const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
5687
5771
  return {
5688
5772
  ...field,
5689
5773
  fields: hydratedChildren
@@ -5692,7 +5776,7 @@ function hydrateField(field, values) {
5692
5776
  if (field.type === "sub-tabs") {
5693
5777
  const hydratedTabs = field.tabs.map((tab) => ({
5694
5778
  ...tab,
5695
- fields: tab.fields.map((child) => hydrateField(child, values))
5779
+ fields: tab.fields.map((child) => hydrateField(child, values, options))
5696
5780
  }));
5697
5781
  return {
5698
5782
  ...field,
@@ -5702,6 +5786,33 @@ function hydrateField(field, values) {
5702
5786
  const key = field.key;
5703
5787
  const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
5704
5788
  const defaultValue = field.default;
5789
+ const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
5790
+ if (isKeychainStoredField(field) && asView(storedValue)) return {
5791
+ ...field,
5792
+ value: toSecretFieldView(storedValue)
5793
+ };
5794
+ if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
5795
+ ...field,
5796
+ value: null
5797
+ };
5798
+ if (field.type === "editable-array" && Array.isArray(storedValue)) {
5799
+ const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
5800
+ if (secretItemKeys.length > 0) {
5801
+ const rows = storedValue.map((row) => {
5802
+ if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
5803
+ const out = { ...row };
5804
+ for (const k of secretItemKeys) {
5805
+ const v = Reflect.get(row, k);
5806
+ if (asView(v)) out[k] = toSecretFieldView(v);
5807
+ }
5808
+ return out;
5809
+ });
5810
+ return {
5811
+ ...field,
5812
+ value: rows
5813
+ };
5814
+ }
5815
+ }
5705
5816
  if (field.multiple) {
5706
5817
  const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
5707
5818
  const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
@@ -5944,6 +6055,431 @@ function projectStore(store, perNodeKeys, nodeId) {
5944
6055
  }
5945
6056
  return out;
5946
6057
  }
6058
+ var GLOBAL_SCOPE = { kind: "global" };
6059
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6060
+ function globalSecretScope() {
6061
+ return GLOBAL_SCOPE;
6062
+ }
6063
+ function encodeSegment(value) {
6064
+ return encodeURIComponent(value);
6065
+ }
6066
+ /**
6067
+ * The field path of a value inside an array item, addressed by the item's id:
6068
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6069
+ * `providers[authentik].clientSecret`.
6070
+ */
6071
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6072
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6073
+ }
6074
+ /** A write to a secret path could not be stored in the keychain, so it was refused. */
6075
+ var KeychainWriteRefusedError = class extends Error {
6076
+ fieldPath;
6077
+ constructor(fieldPath, cause) {
6078
+ super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
6079
+ this.fieldPath = fieldPath;
6080
+ this.name = "KeychainWriteRefusedError";
6081
+ }
6082
+ };
6083
+ var KEEP = { kind: "keep" };
6084
+ function isRecord(value) {
6085
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6086
+ }
6087
+ function defaultMintId() {
6088
+ return globalThis.crypto.randomUUID();
6089
+ }
6090
+ /** Every marker ref anywhere under `value`. */
6091
+ function collectSecretMarkerRefs(value, out = []) {
6092
+ if (isSecretMarker(value)) {
6093
+ out.push(value.$secret);
6094
+ return out;
6095
+ }
6096
+ if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6097
+ else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6098
+ return out;
6099
+ }
6100
+ async function storedValueEquals(secrets, marker, candidate) {
6101
+ const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
6102
+ return resolved?.kind === "value" && resolved.value === candidate;
6103
+ }
6104
+ async function writeLeaf(ctx, incoming, stored, fieldPath) {
6105
+ const intent = classifySecretWrite(incoming);
6106
+ const ref = ctx.secrets.ref(ctx.scope, fieldPath);
6107
+ const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
6108
+ if (intent.kind === "keep") return KEEP;
6109
+ if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
6110
+ if (intent.kind === "clear") {
6111
+ if (storedIsOurs) ctx.deletes.push(ref);
6112
+ return {
6113
+ kind: "value",
6114
+ value: null
6115
+ };
6116
+ }
6117
+ if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
6118
+ kind: "value",
6119
+ value: stored
6120
+ };
6121
+ try {
6122
+ await ctx.secrets.put(ref, intent.value);
6123
+ } catch (err) {
6124
+ throw new KeychainWriteRefusedError(fieldPath, err);
6125
+ }
6126
+ return {
6127
+ kind: "value",
6128
+ value: makeSecretMarker(ref)
6129
+ };
6130
+ }
6131
+ /** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
6132
+ function applyMember(out, key, result, storedParent) {
6133
+ if (result.kind === "value") {
6134
+ out[key] = result.value;
6135
+ return;
6136
+ }
6137
+ if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
6138
+ else delete out[key];
6139
+ }
6140
+ async function writeMembers(ctx, children, incoming, stored, pathOf) {
6141
+ const out = { ...incoming };
6142
+ for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
6143
+ return out;
6144
+ }
6145
+ function rowId(row, idKey) {
6146
+ const raw = row[idKey];
6147
+ if (typeof raw === "string" && raw.length > 0) return raw;
6148
+ if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
6149
+ return null;
6150
+ }
6151
+ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6152
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6153
+ if (!Array.isArray(incoming)) {
6154
+ ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6155
+ return {
6156
+ kind: "value",
6157
+ value: incoming
6158
+ };
6159
+ }
6160
+ const storedById = /* @__PURE__ */ new Map();
6161
+ for (const row of storedRows) {
6162
+ const id = rowId(row, node.idKey);
6163
+ if (id !== null) storedById.set(id, row);
6164
+ }
6165
+ const kept = /* @__PURE__ */ new Set();
6166
+ const rows = [];
6167
+ for (const row of incoming) {
6168
+ if (!isRecord(row)) {
6169
+ rows.push(row);
6170
+ continue;
6171
+ }
6172
+ const id = rowId(row, node.idKey) ?? ctx.mintId();
6173
+ kept.add(id);
6174
+ const withId = {
6175
+ ...row,
6176
+ [node.idKey]: row[node.idKey] ?? id
6177
+ };
6178
+ if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
6179
+ const storedRow = storedById.get(id) ?? {};
6180
+ rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
6181
+ }
6182
+ for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
6183
+ return {
6184
+ kind: "value",
6185
+ value: rows
6186
+ };
6187
+ }
6188
+ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6189
+ switch (node.kind) {
6190
+ case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6191
+ case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6192
+ case "object": {
6193
+ if (!isRecord(incoming)) {
6194
+ if (incoming === void 0) return KEEP;
6195
+ ctx.deletes.push(...collectSecretMarkerRefs(stored));
6196
+ return {
6197
+ kind: "value",
6198
+ value: incoming
6199
+ };
6200
+ }
6201
+ const storedObj = isRecord(stored) ? stored : {};
6202
+ return {
6203
+ kind: "value",
6204
+ value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
6205
+ };
6206
+ }
6207
+ }
6208
+ }
6209
+ /** Split a perNode-scoped key (`key@nodeId`). */
6210
+ function splitNodeKey(key) {
6211
+ const at = key.indexOf("@");
6212
+ return at <= 0 ? {
6213
+ base: key,
6214
+ nodeId: null
6215
+ } : {
6216
+ base: key.slice(0, at),
6217
+ nodeId: key.slice(at + 1)
6218
+ };
6219
+ }
6220
+ /** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
6221
+ async function transformSecretWrite(input) {
6222
+ const deletes = [];
6223
+ const base = {
6224
+ secrets: input.secrets,
6225
+ mintId: input.mintId ?? defaultMintId,
6226
+ deletes,
6227
+ operatorWrite: input.operatorWrite === true
6228
+ };
6229
+ const out = {};
6230
+ for (const [key, incoming] of Object.entries(input.patch)) {
6231
+ const { base: baseKey, nodeId } = splitNodeKey(key);
6232
+ const node = input.tree.get(baseKey);
6233
+ if (node === void 0) {
6234
+ out[key] = incoming;
6235
+ continue;
6236
+ }
6237
+ const scope = nodeId !== null && nodeId.length > 0 ? {
6238
+ kind: "node",
6239
+ nodeId
6240
+ } : input.scope ?? globalSecretScope();
6241
+ const result = await writeNode({
6242
+ ...base,
6243
+ scope
6244
+ }, node, incoming, input.stored[key], baseKey);
6245
+ if (result.kind === "value") out[key] = result.value;
6246
+ }
6247
+ return {
6248
+ patch: out,
6249
+ afterWrite: async () => {
6250
+ if (deletes.length === 0) return { orphaned: [] };
6251
+ try {
6252
+ await input.secrets.delete([...new Set(deletes)]);
6253
+ return { orphaned: [] };
6254
+ } catch {
6255
+ return { orphaned: [...new Set(deletes)] };
6256
+ }
6257
+ }
6258
+ };
6259
+ }
6260
+ /**
6261
+ * Replace every marker in `value` with its keychain value. Returns the SAME
6262
+ * reference when there is no marker (no allocation, no keychain call).
6263
+ */
6264
+ async function resolveSecretMarkers(value, secrets) {
6265
+ const refs = collectSecretMarkerRefs(value);
6266
+ if (refs.length === 0) return {
6267
+ value,
6268
+ unresolved: []
6269
+ };
6270
+ const answers = await secrets.resolve(refs);
6271
+ const unresolved = [];
6272
+ for (const ref of new Set(refs)) {
6273
+ const answer = answers[ref];
6274
+ if (answer === void 0) unresolved.push({
6275
+ ref,
6276
+ reason: "not-initialized"
6277
+ });
6278
+ else if (answer.kind === "unavailable") unresolved.push({
6279
+ ref,
6280
+ reason: answer.reason
6281
+ });
6282
+ else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
6283
+ ref,
6284
+ reason: answer.kind
6285
+ });
6286
+ }
6287
+ const substitute = (v) => {
6288
+ if (isSecretMarker(v)) {
6289
+ const answer = answers[v.$secret];
6290
+ return answer?.kind === "value" ? {
6291
+ keep: true,
6292
+ value: answer.value
6293
+ } : {
6294
+ keep: false,
6295
+ value: void 0
6296
+ };
6297
+ }
6298
+ if (Array.isArray(v)) {
6299
+ const items = [];
6300
+ for (const item of v) {
6301
+ const s = substitute(item);
6302
+ if (s.keep) items.push(s.value);
6303
+ }
6304
+ return {
6305
+ keep: true,
6306
+ value: items
6307
+ };
6308
+ }
6309
+ if (isRecord(v)) {
6310
+ const out = {};
6311
+ for (const [k, child] of Object.entries(v)) {
6312
+ const s = substitute(child);
6313
+ if (s.keep) out[k] = s.value;
6314
+ }
6315
+ return {
6316
+ keep: true,
6317
+ value: out
6318
+ };
6319
+ }
6320
+ return {
6321
+ keep: true,
6322
+ value: v
6323
+ };
6324
+ };
6325
+ return {
6326
+ value: substitute(value).value,
6327
+ unresolved
6328
+ };
6329
+ }
6330
+ function touchesTree(tree, patch) {
6331
+ if (tree.size === 0) return false;
6332
+ for (const key of Object.keys(patch)) {
6333
+ const at = key.indexOf("@");
6334
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6335
+ }
6336
+ return false;
6337
+ }
6338
+ /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6339
+ async function readStoredAddonBlob(raw) {
6340
+ const threeWay = raw.readAddonStoreResult;
6341
+ if (threeWay === void 0) return raw.readAddonStore();
6342
+ const result = await threeWay.call(raw);
6343
+ if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6344
+ return result.kind === "missing" ? {} : result.value;
6345
+ }
6346
+ function createSecretAwareSettings(raw, opts) {
6347
+ const chains = /* @__PURE__ */ new Map();
6348
+ const serialize = (key, fn) => {
6349
+ const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
6350
+ const tail = next.catch(() => void 0);
6351
+ chains.set(key, tail);
6352
+ tail.then(() => {
6353
+ if (chains.get(key) === tail) chains.delete(key);
6354
+ });
6355
+ return next;
6356
+ };
6357
+ const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6358
+ if (!touchesTree(tree, patch)) return rawWrite(patch);
6359
+ return serialize(chainKey, async () => {
6360
+ const stored = await readStored();
6361
+ const result = await transformSecretWrite({
6362
+ tree,
6363
+ secrets: opts.secrets,
6364
+ patch,
6365
+ stored,
6366
+ ...scope !== void 0 ? { scope } : {},
6367
+ operatorWrite: opts.isOperatorWrite?.() === true
6368
+ });
6369
+ if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6370
+ const { orphaned } = await result.afterWrite();
6371
+ if (orphaned.length > 0) opts.onOrphaned(orphaned);
6372
+ });
6373
+ };
6374
+ const wrapped = {
6375
+ writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6376
+ writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6377
+ kind: "device",
6378
+ deviceId
6379
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6380
+ };
6381
+ return new Proxy(raw, { get(target, prop, receiver) {
6382
+ if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6383
+ if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6384
+ const value = Reflect.get(target, prop, receiver);
6385
+ return typeof value === "function" ? value.bind(target) : value;
6386
+ } });
6387
+ }
6388
+ /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6389
+ function withSecretAwareSettings(context, opts) {
6390
+ const raw = context.settings;
6391
+ if (raw === void 0) return context;
6392
+ const settings = createSecretAwareSettings(raw, opts);
6393
+ return new Proxy(context, { get(target, prop, receiver) {
6394
+ if (prop === "settings") return settings;
6395
+ return Reflect.get(target, prop, receiver);
6396
+ } });
6397
+ }
6398
+ var LEAF = { kind: "leaf" };
6399
+ var DEFAULT_ITEM_ID_KEY = "id";
6400
+ function collectFields(fields, out) {
6401
+ for (const field of fields) {
6402
+ if (field.type === "group") {
6403
+ collectFields(field.fields, out);
6404
+ continue;
6405
+ }
6406
+ if (field.type === "sub-tabs") {
6407
+ for (const tab of field.tabs) collectFields(tab.fields, out);
6408
+ continue;
6409
+ }
6410
+ if (field.type === "editable-array") {
6411
+ const item = /* @__PURE__ */ new Map();
6412
+ for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
6413
+ if (item.size > 0) out.set(field.key, {
6414
+ kind: "array",
6415
+ idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
6416
+ item
6417
+ });
6418
+ continue;
6419
+ }
6420
+ if (!("key" in field) || typeof field.key !== "string") continue;
6421
+ if (isKeychainStoredField(field)) out.set(field.key, LEAF);
6422
+ }
6423
+ }
6424
+ /** The secret tree a settings schema declares. */
6425
+ function secretTreeFromSchema(schema) {
6426
+ const out = /* @__PURE__ */ new Map();
6427
+ if (schema === null) return out;
6428
+ for (const section of schema.sections) collectFields(section.fields, out);
6429
+ return out;
6430
+ }
6431
+ /** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
6432
+ function parseSecretStatePath(path) {
6433
+ const segments = [];
6434
+ for (const raw of path.split(".")) {
6435
+ const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
6436
+ if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
6437
+ segments.push(m[2] !== void 0 ? {
6438
+ key: m[1],
6439
+ idKey: m[2]
6440
+ } : { key: m[1] });
6441
+ }
6442
+ if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
6443
+ if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
6444
+ return segments;
6445
+ }
6446
+ function insert(into, segments) {
6447
+ const [head, ...rest] = segments;
6448
+ if (head === void 0) return;
6449
+ if (rest.length === 0) {
6450
+ into.set(head.key, LEAF);
6451
+ return;
6452
+ }
6453
+ const existing = into.get(head.key);
6454
+ if (head.idKey !== void 0) {
6455
+ const item = new Map(existing?.kind === "array" ? existing.item : []);
6456
+ insert(item, rest);
6457
+ into.set(head.key, {
6458
+ kind: "array",
6459
+ idKey: head.idKey,
6460
+ item
6461
+ });
6462
+ return;
6463
+ }
6464
+ const children = new Map(existing?.kind === "object" ? existing.children : []);
6465
+ insert(children, rest);
6466
+ into.set(head.key, {
6467
+ kind: "object",
6468
+ children
6469
+ });
6470
+ }
6471
+ /** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
6472
+ function mergeSecretStatePaths(tree, paths) {
6473
+ if (paths.length === 0) return tree;
6474
+ const out = new Map(tree);
6475
+ for (const path of paths) insert(out, parseSecretStatePath(path));
6476
+ return out;
6477
+ }
6478
+ /** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
6479
+ var SECRET_RETRY_FIRST_MS = 5e3;
6480
+ var SECRET_RETRY_MAX_MS = 5 * 6e4;
6481
+ /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
6482
+ var SECRET_CHANGE_DEBOUNCE_MS = 250;
5947
6483
  /**
5948
6484
  * Base class for CamStack addons. Eliminates settings boilerplate:
5949
6485
  *
@@ -6013,6 +6549,25 @@ var BaseAddon = class {
6013
6549
  settingsStoreReady = false;
6014
6550
  /** Default config values. Provided via constructor. */
6015
6551
  defaults;
6552
+ /**
6553
+ * Hidden-state paths that hold secrets (D787) — values the addon writes
6554
+ * itself (`updateGlobalSettings`, `state()`) that no form field declares.
6555
+ * Stored in the keychain exactly like a `password` field. Syntax:
6556
+ * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
6557
+ * (`key[<id field>]` addresses array items by id, never by index).
6558
+ */
6559
+ secretStatePaths = [];
6560
+ _addonSecretTree = null;
6561
+ _deviceSecretTree = null;
6562
+ /** Refs the last resolved config pointed at — a change to one re-resolves. */
6563
+ _configSecretRefs = /* @__PURE__ */ new Set();
6564
+ _unresolvedSecrets = [];
6565
+ _secretRetryTimer = null;
6566
+ _secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
6567
+ _secretChangeTimer = null;
6568
+ _secretChangeUnsub = null;
6569
+ /** >0 while an OPERATOR's settings write is being applied. */
6570
+ _operatorWriteDepth = 0;
6016
6571
  constructor(defaults) {
6017
6572
  this.defaults = defaults;
6018
6573
  this._config = { ...defaults };
@@ -6048,8 +6603,18 @@ var BaseAddon = class {
6048
6603
  return this._config;
6049
6604
  }
6050
6605
  async initialize(context) {
6051
- this._ctx = context;
6606
+ const secrets = context.secrets;
6607
+ this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6608
+ secrets,
6609
+ addonTree: () => this.addonSecretTree(),
6610
+ deviceTree: () => this.deviceSecretTree(),
6611
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6612
+ isOperatorWrite: () => this._operatorWriteDepth > 0
6613
+ }) : context;
6052
6614
  await this.resolveConfig();
6615
+ if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6616
+ if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
6617
+ });
6053
6618
  const result = await this.onInitialize();
6054
6619
  this.emitLifecycle(EventCategory.AddonStarted);
6055
6620
  const normalized = normalizeAddonInitResult(result);
@@ -6082,6 +6647,12 @@ var BaseAddon = class {
6082
6647
  */
6083
6648
  async onHubReachable() {}
6084
6649
  async shutdown() {
6650
+ this._secretChangeUnsub?.();
6651
+ this._secretChangeUnsub = null;
6652
+ if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
6653
+ if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
6654
+ this._secretRetryTimer = null;
6655
+ this._secretChangeTimer = null;
6085
6656
  this.emitLifecycle(EventCategory.AddonStopped);
6086
6657
  if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
6087
6658
  await this.onShutdown();
@@ -6160,7 +6731,7 @@ var BaseAddon = class {
6160
6731
  return hydrateSchema(schema, overlay ? {
6161
6732
  ...projected,
6162
6733
  ...overlay
6163
- } : projected);
6734
+ } : projected, { inlineSecretsAsViews: true });
6164
6735
  }
6165
6736
  /**
6166
6737
  * The integration-level view of this addon's settings: exactly the sections
@@ -6209,7 +6780,7 @@ var BaseAddon = class {
6209
6780
  return hydrateSchema({
6210
6781
  ...schema,
6211
6782
  sections
6212
- }, projected);
6783
+ }, projected, { inlineSecretsAsViews: true });
6213
6784
  }
6214
6785
  /**
6215
6786
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -6263,18 +6834,50 @@ var BaseAddon = class {
6263
6834
  value: result.value[key]
6264
6835
  };
6265
6836
  }
6837
+ /**
6838
+ * The OPERATOR's write — a settings form or an admin API call, dispatched by
6839
+ * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
6840
+ * the operator sends is stored as sent even when it equals a pre-keychain
6841
+ * inline value: the operator re-entering a password is a change, an addon
6842
+ * writing back what it read is not (D787).
6843
+ */
6844
+ async updateGlobalSettingsAsOperator(patch, nodeId) {
6845
+ this._operatorWriteDepth++;
6846
+ try {
6847
+ await this.applyGlobalPatch(patch, nodeId);
6848
+ } finally {
6849
+ this._operatorWriteDepth--;
6850
+ }
6851
+ }
6266
6852
  async updateGlobalSettings(patch, nodeId) {
6853
+ await this.applyGlobalPatch(patch, nodeId);
6854
+ }
6855
+ /**
6856
+ * REMOVE stored secrets — their keychain values and their markers (D787).
6857
+ *
6858
+ * Writing `''` to a secret field KEEPS what is stored (an empty string is
6859
+ * what a defaults fallback writes back, and it must never destroy a
6860
+ * credential), so code that means "forget this token" says so here. Without
6861
+ * a keychain (an older kernel) it writes `''`, as such code always did.
6862
+ */
6863
+ async clearSecrets(keys, nodeId) {
6864
+ const tree = this.addonSecretTree();
6865
+ const keychain = this._ctx?.secrets !== void 0;
6866
+ const patch = {};
6867
+ for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
6868
+ await this.applyGlobalPatch(patch, nodeId);
6869
+ }
6870
+ async applyGlobalPatch(barePatch, nodeId) {
6267
6871
  const keys = this.perNodeKeys();
6268
6872
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6269
6873
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6270
- const barePatch = patch;
6271
6874
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6272
6875
  await this._ctx?.settings?.writeAddonStore(scoped);
6273
6876
  if (target !== localNode) return;
6274
6877
  await this.resolveConfig();
6275
6878
  await this.onConfigChanged();
6276
6879
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
6277
- this.maybeAutoRestart(patch, this.globalSettingsSchema());
6880
+ this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
6278
6881
  }
6279
6882
  /**
6280
6883
  * The set of field keys the global settings schema declares `perNode: true`
@@ -6299,7 +6902,7 @@ var BaseAddon = class {
6299
6902
  * time to return its response before the addon is torn down and
6300
6903
  * re-initialised by `AddonRegistryService.restartAddon`.
6301
6904
  */
6302
- maybeAutoRestart(patch, schema) {
6905
+ maybeAutoRestart(patchKeys, schema) {
6303
6906
  if (!schema) return;
6304
6907
  const restartKeys = /* @__PURE__ */ new Set();
6305
6908
  for (const section of schema.sections) for (const field of section.fields) {
@@ -6307,13 +6910,13 @@ var BaseAddon = class {
6307
6910
  if (field.requiresRestart) restartKeys.add(field.key);
6308
6911
  }
6309
6912
  if (restartKeys.size === 0) return;
6310
- if (!Object.keys(patch).some((k) => restartKeys.has(k))) return;
6913
+ if (!patchKeys.some((k) => restartKeys.has(k))) return;
6311
6914
  const ctx = this._ctx;
6312
6915
  if (!ctx) return;
6313
6916
  const addonId = ctx.id;
6314
6917
  setImmediate(() => {
6315
6918
  ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
6316
- ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: Object.keys(patch).filter((k) => restartKeys.has(k)) } });
6919
+ ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
6317
6920
  }).catch((err) => {
6318
6921
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
6319
6922
  });
@@ -6322,7 +6925,7 @@ var BaseAddon = class {
6322
6925
  async getDeviceSettings(deviceId) {
6323
6926
  const schema = this.deviceSettingsSchema();
6324
6927
  if (!schema) return { sections: [] };
6325
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
6928
+ return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6326
6929
  }
6327
6930
  async updateDeviceSettings(deviceId, patch) {
6328
6931
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -6452,7 +7055,7 @@ var BaseAddon = class {
6452
7055
  * selection at boot (absent scoped key ⇒ the constructor default wins).
6453
7056
  */
6454
7057
  async resolveConfig() {
6455
- const stored = await this.readAddonStoreWithRetry();
7058
+ const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
6456
7059
  const perNode = this.perNodeKeys();
6457
7060
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6458
7061
  const resolved = { ...this.defaults };
@@ -6477,7 +7080,7 @@ var BaseAddon = class {
6477
7080
  key,
6478
7081
  schema,
6479
7082
  fallback,
6480
- read: () => this.readAddonStoreWithRetry(),
7083
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
6481
7084
  write: async (patch) => {
6482
7085
  await this._ctx?.settings?.writeAddonStore(patch);
6483
7086
  },
@@ -6494,7 +7097,7 @@ var BaseAddon = class {
6494
7097
  key,
6495
7098
  schema,
6496
7099
  fallback,
6497
- read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
7100
+ read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
6498
7101
  write: async (patch) => {
6499
7102
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
6500
7103
  },
@@ -6506,6 +7109,70 @@ var BaseAddon = class {
6506
7109
  } })
6507
7110
  });
6508
7111
  }
7112
+ /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
7113
+ addonSecretTree() {
7114
+ this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
7115
+ return this._addonSecretTree;
7116
+ }
7117
+ deviceSecretTree() {
7118
+ this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7119
+ return this._deviceSecretTree;
7120
+ }
7121
+ /**
7122
+ * Secrets of this addon's stored config that could not be resolved on the
7123
+ * last read, with why. Non-empty means the addon is running WITHOUT them —
7124
+ * an addon whose function needs one should report itself degraded rather
7125
+ * than start on an empty credential.
7126
+ */
7127
+ get unresolvedSecrets() {
7128
+ return this._unresolvedSecrets;
7129
+ }
7130
+ /**
7131
+ * Substitute every keychain marker in a stored blob with its value. With no
7132
+ * keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
7133
+ * An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
7134
+ * value — and, when the cause can pass, retried with backoff. Nothing is
7135
+ * ever written back from here.
7136
+ */
7137
+ async resolveStoredSecrets(blob, trackForConfig = true) {
7138
+ const secrets = this._ctx?.secrets;
7139
+ if (secrets === void 0) return blob;
7140
+ const refs = collectSecretMarkerRefs(blob);
7141
+ if (trackForConfig) this._configSecretRefs = new Set(refs);
7142
+ if (refs.length === 0) {
7143
+ if (trackForConfig) this._unresolvedSecrets = [];
7144
+ return blob;
7145
+ }
7146
+ const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
7147
+ if (trackForConfig) {
7148
+ this._unresolvedSecrets = unresolved;
7149
+ if (unresolved.length > 0) {
7150
+ this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
7151
+ ref: u.ref,
7152
+ reason: u.reason
7153
+ })) } });
7154
+ if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
7155
+ this.scheduleSecretReresolve(this._secretRetryDelayMs);
7156
+ this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
7157
+ }
7158
+ } else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
7159
+ }
7160
+ return value;
7161
+ }
7162
+ /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7163
+ scheduleSecretReresolve(delayMs) {
7164
+ const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
7165
+ if (this[timerOf] !== null) return;
7166
+ const timer = setTimeout(() => {
7167
+ this[timerOf] = null;
7168
+ if (this._ctx === null) return;
7169
+ this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
7170
+ this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
7171
+ });
7172
+ }, delayMs);
7173
+ timer.unref?.();
7174
+ this[timerOf] = timer;
7175
+ }
6509
7176
  /**
6510
7177
  * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
6511
7178
  * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
@@ -13995,6 +14662,196 @@ id: union([string(), number()]) }), {
13995
14662
  kind: "mutation",
13996
14663
  auth: "admin"
13997
14664
  });
14665
+ /**
14666
+ * `keychain` — the hub's encrypted store of secret values (D787).
14667
+ *
14668
+ * Settings blobs never hold a secret: they hold a marker
14669
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
14670
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
14671
+ * is the OWNER's door to its own values: every method is owner-checked
14672
+ * against the CALLER, never against anything the caller claims.
14673
+ *
14674
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
14675
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
14676
+ * connection, the agent from its child's connection carried in
14677
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
14678
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
14679
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
14680
+ * identity against BUGS and misrouting, not against a malicious addon (every
14681
+ * runner is the same OS user): see the threat model in
14682
+ * `docs/design/2026-10-08-secrets-keychain.md`.
14683
+ *
14684
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
14685
+ * parses the input, so a session can never supply it, and the internal mount
14686
+ * floors every method to admin anyway (D240).
14687
+ *
14688
+ * Internal: addons reach it through `ctx.secrets`, never directly.
14689
+ */
14690
+ /** Why a value cannot be served right now. Never folded into "missing". */
14691
+ var KeychainUnavailableReasonSchema = _enum([
14692
+ "key-missing",
14693
+ "wrong-key",
14694
+ "key-file-unreadable",
14695
+ "store-unavailable",
14696
+ "not-initialized",
14697
+ "decrypt-failed"
14698
+ ]);
14699
+ var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
14700
+ state: literal("locked"),
14701
+ reason: KeychainUnavailableReasonSchema
14702
+ })]);
14703
+ var KeychainResolveEntrySchema = discriminatedUnion("kind", [
14704
+ object({
14705
+ kind: literal("value"),
14706
+ value: string(),
14707
+ version: number().int()
14708
+ }),
14709
+ object({ kind: literal("missing") }),
14710
+ object({
14711
+ kind: literal("unavailable"),
14712
+ reason: KeychainUnavailableReasonSchema
14713
+ }),
14714
+ object({ kind: literal("forbidden") })
14715
+ ]);
14716
+ var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
14717
+ /** Metadata of one stored value — never the value. */
14718
+ var KeychainSecretMetaSchema = object({
14719
+ ref: string(),
14720
+ owner: string(),
14721
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
14722
+ scope: string(),
14723
+ fieldPath: string(),
14724
+ version: number().int(),
14725
+ createdAt: number(),
14726
+ updatedAt: number(),
14727
+ /** `addon:<id>` | `user:<id>` | `system`. */
14728
+ updatedBy: string(),
14729
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
14730
+ lastReadAt: number().nullable()
14731
+ });
14732
+ var RefListSchema = array(string().min(1)).max(512);
14733
+ method(object({
14734
+ ref: string().min(1),
14735
+ value: string().min(1)
14736
+ }), object({
14737
+ ref: string(),
14738
+ version: number().int()
14739
+ }), {
14740
+ kind: "mutation",
14741
+ auth: "admin"
14742
+ }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
14743
+ kind: "mutation",
14744
+ auth: "admin"
14745
+ }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
14746
+ var KeychainKeySourceSchema = object({
14747
+ kind: _enum([
14748
+ "config-file",
14749
+ "previous-config-file",
14750
+ "platform",
14751
+ "default-file"
14752
+ ]),
14753
+ /** File sources only — a path is not a secret. */
14754
+ path: string().optional(),
14755
+ /**
14756
+ * True when a whole-volume backup of the data directory carries this key
14757
+ * next to the database it protects (the default file). The page warns.
14758
+ */
14759
+ sharesBackupWithDatabase: boolean()
14760
+ });
14761
+ var KeychainStatusSchema = object({
14762
+ keychain: KeychainStateSchema,
14763
+ /** The source of the master key in use; `null` while locked. */
14764
+ keySource: KeychainKeySourceSchema.nullable(),
14765
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
14766
+ configuredSource: KeychainKeySourceSchema,
14767
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
14768
+ fingerprint: string().nullable(),
14769
+ activeKeyId: string().nullable(),
14770
+ /**
14771
+ * The keychain unlocked with a NON-primary source: the configured primary
14772
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
14773
+ */
14774
+ rotationPending: boolean(),
14775
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
14776
+ retiredWraps: number().int(),
14777
+ recoveryKeyDownloadedAt: number().nullable(),
14778
+ secretCount: number().int()
14779
+ });
14780
+ /**
14781
+ * Whether a stored value is still pointed at by its owner's settings.
14782
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
14783
+ * never reported as an orphan (and never deleted as one).
14784
+ */
14785
+ var KeychainSecretUsageSchema = _enum([
14786
+ "in-use",
14787
+ "orphan",
14788
+ "unknown"
14789
+ ]);
14790
+ var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
14791
+ var KeychainAuditActionSchema = _enum([
14792
+ "put",
14793
+ "delete",
14794
+ "reveal",
14795
+ "rotate-master-key",
14796
+ "purge-retired-keys",
14797
+ "download-recovery-key",
14798
+ "delete-orphans",
14799
+ "reset",
14800
+ "initialize"
14801
+ ]);
14802
+ var KeychainAuditEntrySchema = object({
14803
+ id: string(),
14804
+ at: number(),
14805
+ action: KeychainAuditActionSchema,
14806
+ /** `addon:<id>` | `user:<id>` | `system`. */
14807
+ actor: string(),
14808
+ ref: string().nullable(),
14809
+ detail: string().nullable()
14810
+ });
14811
+ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}), array(KeychainAdminSecretSchema).readonly(), { auth: "admin" }), method(object({ limit: number().int().min(1).max(500).optional() }), array(KeychainAuditEntrySchema).readonly(), { auth: "admin" }), method(object({ ref: string().min(1) }), object({
14812
+ value: string(),
14813
+ version: number().int()
14814
+ }), {
14815
+ kind: "mutation",
14816
+ auth: "admin",
14817
+ caller: "required"
14818
+ }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
14819
+ deleted: array(string()).readonly(),
14820
+ kept: array(object({
14821
+ ref: string(),
14822
+ usage: KeychainSecretUsageSchema
14823
+ })).readonly()
14824
+ }), {
14825
+ kind: "mutation",
14826
+ auth: "admin",
14827
+ caller: "required"
14828
+ }), method(object({}), object({
14829
+ fingerprint: string(),
14830
+ keySource: KeychainKeySourceSchema
14831
+ }), {
14832
+ kind: "mutation",
14833
+ auth: "admin",
14834
+ caller: "required"
14835
+ }), method(object({}), object({ purged: number().int() }), {
14836
+ kind: "mutation",
14837
+ auth: "admin",
14838
+ caller: "required"
14839
+ }), method(object({}), object({
14840
+ key: string(),
14841
+ fingerprint: string(),
14842
+ keySource: KeychainKeySourceSchema
14843
+ }), {
14844
+ kind: "mutation",
14845
+ auth: "admin",
14846
+ caller: "required"
14847
+ }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
14848
+ archivedCollection: string().nullable(),
14849
+ archived: number().int()
14850
+ }), {
14851
+ kind: "mutation",
14852
+ auth: "admin",
14853
+ caller: "required"
14854
+ });
13998
14855
  method(_void(), object({
13999
14856
  id: string(),
14000
14857
  name: string(),
@@ -15032,7 +15889,11 @@ var DeviceRegisterPayloadSchema = object({
15032
15889
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
15033
15890
  var DevicePersistConfigPayloadSchema = object({
15034
15891
  deviceId: number(),
15035
- data: record(string(), unknown())
15892
+ data: record(string(), unknown()),
15893
+ /** The paths the device's schema declares secret (D783), when the caller
15894
+ * knows them — those values are kept in the keychain, not the blob (D787).
15895
+ * Absent: the paths the device last reported at `registerDevice` apply. */
15896
+ secretConfigPaths: array(string()).optional()
15036
15897
  });
15037
15898
  /** What a migration actually did, per switch. `unreachable` is a first-class
15038
15899
  * answer: a camera that could not be asked is not a camera that was silenced. */
@@ -22011,8 +22872,23 @@ var RetrainMacroClassSchema = _enum([
22011
22872
  ]);
22012
22873
  /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
22013
22874
  var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
22014
- /** Did a human draw this box, or did the assist propose it? */
22015
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
22875
+ /**
22876
+ * Where a box came from. A machine-sourced box is a DRAFT on the page until
22877
+ * the operator confirms it; once saved it keeps its source as provenance.
22878
+ *
22879
+ * - `operator` — drawn by hand.
22880
+ * - `assist` — proposed by a detector run on the copy (the camera's own
22881
+ * model, or a larger teacher model).
22882
+ * - `pipeline` — the box the live pipeline actually drew on that frame, read
22883
+ * back from the track store (never a re-run).
22884
+ * - `llm` — proposed by a vision-capable LLM profile.
22885
+ */
22886
+ var RetrainAnnotationSourceSchema = _enum([
22887
+ "operator",
22888
+ "assist",
22889
+ "pipeline",
22890
+ "llm"
22891
+ ]);
22016
22892
  /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
22017
22893
  var RetrainBboxSchema = object({
22018
22894
  x: number(),
@@ -22030,7 +22906,8 @@ var RetrainBboxSchema = object({
22030
22906
  */
22031
22907
  var RetrainAnnotationSchema = object({
22032
22908
  id: string(),
22033
- trackId: string(),
22909
+ /** The frame's track. Absent on a recording still, which has none. */
22910
+ trackId: string().optional(),
22034
22911
  deviceId: number(),
22035
22912
  /** The COPY in retrain storage — never the source track's media key. */
22036
22913
  mediaKey: string(),
@@ -22079,13 +22956,47 @@ var RetrainFrameCandidateSchema = object({
22079
22956
  * fail, whatever became of the original. */
22080
22957
  copied: boolean()
22081
22958
  });
22959
+ /**
22960
+ * One box the live pipeline drew on a copied frame — what a correction starts
22961
+ * from. Derived when the frame is listed, from the track store: the subject
22962
+ * box recorded on the source media row when there is one, else the track
22963
+ * position nearest the frame's capture time. Never stored as an annotation
22964
+ * until the operator confirms it.
22965
+ */
22966
+ var RetrainPipelineBoxSchema = object({
22967
+ /** Normalised `[0,1]` against the full frame. */
22968
+ bbox: RetrainBboxSchema,
22969
+ macroClass: RetrainMacroClassSchema,
22970
+ label: string().optional(),
22971
+ subLabel: string().optional(),
22972
+ /** The detection score of the position used, when it was recorded. */
22973
+ score: number().optional(),
22974
+ /** The root model that produced the track, when it was recorded. */
22975
+ modelId: string().optional(),
22976
+ trackId: string(),
22977
+ /** `subject-box`: recorded on this very frame. `position`: the track's
22978
+ * position nearest the capture time, `deltaMs` away. */
22979
+ basis: _enum(["subject-box", "position"]),
22980
+ deltaMs: number()
22981
+ });
22982
+ /**
22983
+ * Where a retrain frame came from: a TRACK's stored media (copy-on-select),
22984
+ * or the RECORDING at an instant — the frame a model saw nothing in has no
22985
+ * track at all.
22986
+ */
22987
+ var RetrainFrameOriginSchema = _enum(["track", "recording"]);
22082
22988
  /** A frame the dataset OWNS: bytes copied at selection time. */
22083
22989
  var RetrainFrameSchema = object({
22084
22990
  frameId: string(),
22085
22991
  deviceId: number(),
22086
- trackId: string(),
22087
- /** Provenance only. It may already point at nothing — that is expected. */
22088
- sourceMediaId: number().int(),
22992
+ origin: RetrainFrameOriginSchema,
22993
+ /** The track it was copied from. Absent on a recording still. */
22994
+ trackId: string().optional(),
22995
+ /** Provenance only. It may already point at nothing — that is expected.
22996
+ * Absent on a recording still. */
22997
+ sourceMediaId: number().int().optional(),
22998
+ /** A recording still: the playhead instant it was taken at. */
22999
+ epochMs: number().optional(),
22089
23000
  sourceKind: MediaFileKindEnum,
22090
23001
  sizeBytes: number().int(),
22091
23002
  width: number().int(),
@@ -22096,7 +23007,12 @@ var RetrainFrameSchema = object({
22096
23007
  /** The operator's "every subject in this frame is boxed". Detector
22097
23008
  * evaluation keeps only complete frames: an unboxed subject would count as
22098
23009
  * a false positive. */
22099
- complete: boolean()
23010
+ complete: boolean(),
23011
+ /** The boxes the pipeline drew on this frame. Present on list answers;
23012
+ * empty when nothing the track store holds can be placed on it. */
23013
+ pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
23014
+ /** The named collections this frame belongs to. Present on list answers. */
23015
+ collectionIds: array(string()).readonly().optional()
22100
23016
  });
22101
23017
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
22102
23018
  var RetrainCopyRefusalSchema = _enum([
@@ -22127,6 +23043,8 @@ var RetrainFrameListSchema = object({
22127
23043
  var RetrainExportFilterSchema = object({
22128
23044
  deviceIds: array(number()).optional(),
22129
23045
  frameIds: array(string()).max(2e4).optional(),
23046
+ /** Only frames in at least one of these named collections. */
23047
+ collectionIds: array(string()).max(200).optional(),
22130
23048
  batchId: string().optional(),
22131
23049
  /** Only frames the operator marked complete (all subjects boxed). */
22132
23050
  completeOnly: boolean().optional()
@@ -22191,6 +23109,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
22191
23109
  reason: string(),
22192
23110
  detail: string().optional()
22193
23111
  })]);
23112
+ /** A named set over the retrain corpus — membership only, it owns no pixels. */
23113
+ var RetrainCollectionSchema = object({
23114
+ id: string(),
23115
+ name: string(),
23116
+ createdAt: number(),
23117
+ frameCount: number().int()
23118
+ });
23119
+ var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
23120
+ kind: literal("created"),
23121
+ collection: RetrainCollectionSchema
23122
+ }), object({
23123
+ kind: literal("refused"),
23124
+ reason: _enum(["empty-name", "duplicate-name"])
23125
+ })]);
23126
+ var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
23127
+ kind: literal("renamed"),
23128
+ collection: RetrainCollectionSchema
23129
+ }), object({
23130
+ kind: literal("refused"),
23131
+ reason: _enum([
23132
+ "empty-name",
23133
+ "duplicate-name",
23134
+ "unknown-collection"
23135
+ ])
23136
+ })]);
23137
+ /**
23138
+ * The outcome of adding the frame at a recording instant. Every refusal is
23139
+ * named: `still-unavailable` (not recording, a gap, or an undecodable frame —
23140
+ * `detail` says which), `still-busy` (the recorder is at its decode bound; try
23141
+ * again), `unreadable-image`, `write-failed`, `unknown-collection`.
23142
+ */
23143
+ var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
23144
+ kind: literal("added"),
23145
+ collectionId: string(),
23146
+ frame: RetrainFrameSchema,
23147
+ /** The moment was already in the dataset; nothing was decoded. */
23148
+ reused: boolean()
23149
+ }), object({
23150
+ kind: literal("refused"),
23151
+ reason: _enum([
23152
+ "unknown-collection",
23153
+ "still-unavailable",
23154
+ "still-busy",
23155
+ "unreadable-image",
23156
+ "write-failed"
23157
+ ]),
23158
+ detail: string().optional()
23159
+ })]);
23160
+ /** A vision LLM profile the AI assist may use, and where it sends the frame. */
23161
+ var RetrainAssistProfileSchema = object({
23162
+ id: string(),
23163
+ name: string(),
23164
+ model: string(),
23165
+ kind: string(),
23166
+ /** `true` when the frame would leave the house (a cloud vendor, or an
23167
+ * endpoint that is not on the local network). The page confirms each such
23168
+ * run, and the provider refuses one without `allowCloud`. */
23169
+ leavesHouse: boolean()
23170
+ });
23171
+ /** A box the AI assist proposed: a draft, plus the model's own reason. */
23172
+ var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
23173
+ /** What the AI assist said about a box that was already on the canvas. */
23174
+ var RetrainLlmReviewSchema = object({
23175
+ /** The `ref` the page sent the box under. */
23176
+ ref: string(),
23177
+ verdict: _enum([
23178
+ "confirmed",
23179
+ "wrong-class",
23180
+ "not-an-object",
23181
+ "uncertain"
23182
+ ]),
23183
+ suggestedClass: RetrainMacroClassSchema.optional(),
23184
+ reason: string()
23185
+ });
23186
+ /**
23187
+ * The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
23188
+ * model and its confidence) and reviews; items the model got wrong (a box off
23189
+ * the frame, an unasked class, an unknown ref) are dropped and counted in
23190
+ * `rejected`. A whole answer that is not the schema is `malformed-answer`.
23191
+ */
23192
+ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23193
+ kind: literal("proposed"),
23194
+ profileId: string(),
23195
+ model: string(),
23196
+ /** The frame was sent outside the house for this answer. */
23197
+ leftHouse: boolean(),
23198
+ proposals: array(RetrainLlmProposalSchema).readonly(),
23199
+ reviews: array(RetrainLlmReviewSchema).readonly(),
23200
+ rejected: number().int()
23201
+ }), object({
23202
+ kind: literal("refused"),
23203
+ reason: _enum([
23204
+ "unknown-frame",
23205
+ "unreadable-frame",
23206
+ "unknown-profile",
23207
+ "profile-disabled",
23208
+ "no-vision",
23209
+ "cloud-not-confirmed",
23210
+ "llm-error",
23211
+ "malformed-answer"
23212
+ ]),
23213
+ detail: string().optional()
23214
+ })]);
22194
23215
  /** The outcome of a lifecycle move owned by the retrain page. */
22195
23216
  var RetrainTransitionResultSchema = object({
22196
23217
  trackId: string(),
@@ -22908,7 +23929,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22908
23929
  auth: "admin"
22909
23930
  }), method(object({
22910
23931
  deviceId: number(),
22911
- trackId: string(),
23932
+ trackId: string().optional(),
22912
23933
  frameId: string()
22913
23934
  }), object({
22914
23935
  removed: boolean(),
@@ -22925,7 +23946,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22925
23946
  auth: "admin"
22926
23947
  }), method(object({
22927
23948
  deviceId: number(),
22928
- trackId: string(),
23949
+ /** The frame's track, when it has one — checked against the frame. */
23950
+ trackId: string().optional(),
22929
23951
  frameId: string(),
22930
23952
  subject: RetrainAssistSubjectSchema,
22931
23953
  /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
@@ -22933,12 +23955,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22933
23955
  }), RetrainAssistResultSchema, {
22934
23956
  kind: "mutation",
22935
23957
  auth: "admin"
22936
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
23958
+ }), method(object({
23959
+ trackId: string().optional(),
23960
+ frameIds: array(string()).max(2e3).optional()
23961
+ }), array(RetrainAnnotationSchema).readonly(), {
22937
23962
  kind: "query",
22938
23963
  auth: "admin"
22939
23964
  }), method(object({
22940
23965
  deviceId: number(),
22941
- trackId: string(),
23966
+ /** The frame's track, when it has one — checked against the frame. */
23967
+ trackId: string().optional(),
22942
23968
  frameId: string(),
22943
23969
  annotations: array(RetrainAnnotationDraftSchema)
22944
23970
  }), array(RetrainAnnotationSchema).readonly(), {
@@ -22961,7 +23987,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22961
23987
  auth: "admin"
22962
23988
  }), method(object({
22963
23989
  deviceId: number(),
22964
- trackId: string(),
23990
+ trackId: string().optional(),
22965
23991
  frameId: string(),
22966
23992
  complete: boolean()
22967
23993
  }), RetrainFrameSchema, {
@@ -22975,6 +24001,74 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22975
24001
  kind: "mutation",
22976
24002
  auth: "admin",
22977
24003
  timeoutMs: 60 * 6e4
24004
+ }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24005
+ kind: "query",
24006
+ auth: "admin"
24007
+ }), method(object({
24008
+ deviceId: number(),
24009
+ trackId: string().optional(),
24010
+ frameId: string(),
24011
+ profileId: string(),
24012
+ classes: array(RetrainMacroClassSchema).min(1),
24013
+ boxes: array(object({
24014
+ ref: string(),
24015
+ bbox: RetrainBboxSchema,
24016
+ macroClass: RetrainMacroClassSchema,
24017
+ label: string().optional()
24018
+ })).max(50),
24019
+ allowCloud: boolean()
24020
+ }), RetrainLlmAssistResultSchema, {
24021
+ kind: "mutation",
24022
+ auth: "admin",
24023
+ timeoutMs: 18e4
24024
+ }), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
24025
+ kind: "mutation",
24026
+ auth: "admin"
24027
+ }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24028
+ kind: "query",
24029
+ auth: "admin"
24030
+ }), method(object({
24031
+ id: string(),
24032
+ name: string().max(120)
24033
+ }), RetrainCollectionRenameResultSchema, {
24034
+ kind: "mutation",
24035
+ auth: "admin"
24036
+ }), method(object({ id: string() }), object({
24037
+ deleted: boolean(),
24038
+ removedFrames: number().int()
24039
+ }), {
24040
+ kind: "mutation",
24041
+ auth: "admin"
24042
+ }), method(object({
24043
+ collectionId: string(),
24044
+ deviceId: number(),
24045
+ epochMs: number()
24046
+ }), AddRetrainFrameFromRecordingResultSchema, {
24047
+ kind: "mutation",
24048
+ auth: "admin",
24049
+ timeoutMs: 6e4
24050
+ }), method(object({
24051
+ collectionId: string(),
24052
+ frameIds: array(string()).min(1).max(500)
24053
+ }), object({
24054
+ added: number().int(),
24055
+ alreadyMember: number().int(),
24056
+ unknownFrameIds: array(string()).readonly()
24057
+ }), {
24058
+ kind: "mutation",
24059
+ auth: "admin"
24060
+ }), method(object({
24061
+ collectionId: string(),
24062
+ frameId: string()
24063
+ }), object({
24064
+ removed: boolean(),
24065
+ deletedFrame: boolean()
24066
+ }), {
24067
+ kind: "mutation",
24068
+ auth: "admin"
24069
+ }), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
24070
+ kind: "query",
24071
+ auth: "admin"
22978
24072
  }), method(object({
22979
24073
  /** Which of the three event tables owns the row. */
22980
24074
  ownerType: EventOwnerTypeSchema,
@@ -23598,13 +24692,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
23598
24692
  object({
23599
24693
  kind: literal("no-family-build"),
23600
24694
  format: ModelFormatSchema$1
24695
+ }),
24696
+ object({
24697
+ kind: literal("kept-custom-pin"),
24698
+ modelId: string(),
24699
+ deviceKey: string()
23601
24700
  })
23602
24701
  ]);
24702
+ /** Why a device is left exactly as it is, whatever the plan would pick (D786). */
24703
+ var KeptReasonSchema = _enum(["custom-pin"]);
24704
+ /**
24705
+ * Where a choice's latency came from (D791): this node's own benchmark
24706
+ * result, or the hardware-class table. Measured on the node beats the table.
24707
+ */
24708
+ var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
24709
+ kind: literal("node-benchmark"),
24710
+ resultId: string(),
24711
+ measuredAtMs: number()
24712
+ })]);
23603
24713
  var DeviceModelChoiceSchema = object({
23604
24714
  modelId: string(),
23605
24715
  p50Ms: number(),
23606
24716
  fps: number(),
23607
24717
  measured: boolean(),
24718
+ /** Absent on a plan from before D791 — read as the table. */
24719
+ source: LatencySourceSchema.optional(),
23608
24720
  /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
23609
24721
  capacitySessions: number(),
23610
24722
  personRecall: number()
@@ -23615,6 +24727,8 @@ var DeviceRecommendationSchema = object({
23615
24727
  enabled: boolean(),
23616
24728
  available: boolean(),
23617
24729
  chosen: DeviceModelChoiceSchema.nullable(),
24730
+ /** Present when the device is kept as is: Apply writes nothing on it. */
24731
+ kept: KeptReasonSchema.optional(),
23618
24732
  reasons: array(RecommendationReasonSchema).readonly()
23619
24733
  });
23620
24734
  var NodeRecommendationSchema = object({
@@ -23668,6 +24782,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
23668
24782
  kind: literal("coral-enabled"),
23669
24783
  nodeId: string(),
23670
24784
  deviceKey: string()
24785
+ }),
24786
+ object({
24787
+ kind: literal("custom-pin-kept"),
24788
+ nodeId: string(),
24789
+ deviceKey: string().nullable(),
24790
+ deviceId: number().nullable(),
24791
+ modelId: string()
24792
+ }),
24793
+ object({
24794
+ kind: literal("custom-registry-unreadable"),
24795
+ error: string()
23671
24796
  })
23672
24797
  ]);
23673
24798
  var AutoTuneOptionsSchema = object({
@@ -23846,13 +24971,14 @@ var SuggestSharesResultSchema = object({
23846
24971
  nodes: array(SuggestedNodeShareSchema).readonly()
23847
24972
  });
23848
24973
  /**
23849
- * Where the node and device shares come from (D750, D755).
23850
- * - `hardware` (default) — computed by the system from each node's static
23851
- * capacity (its accelerators at their Auto tune models, from the measured
23852
- * latency table), recomputed whenever a node or device joins, leaves, is
23853
- * switched on or off, or changes model. No load input.
23854
- * - `benchmark` — the same, from each node's measured capacity (node
23855
- * benchmark results); a node without results falls back to `hardware`.
24974
+ * Where the node and device shares come from (D750, D755, D791).
24975
+ * - `benchmark` (default since D791) — each node's capacity as its own node
24976
+ * benchmark measured it; a node without fresh results is sized from
24977
+ * `hardware` and says so. Measured on the node beats the table.
24978
+ * - `hardware` — computed from each node's static capacity only (its
24979
+ * accelerators at their Auto tune models, from the latency table).
24980
+ * Both are recomputed whenever a node or device joins, leaves, is switched
24981
+ * on or off, changes model, or a benchmark result is written. No load input.
23856
24982
  * - `manual` — the operator's stored sliders.
23857
24983
  * Either way a node or device that cannot take sessions gives its share to
23858
24984
  * the others in proportion; the stored values are never rewritten for that.
@@ -23901,6 +25027,362 @@ var EffectiveSharesSchema = object({
23901
25027
  nodeWeights: record(string(), number()),
23902
25028
  deviceWeights: record(string(), record(string(), number()))
23903
25029
  });
25030
+ /**
25031
+ * Wire shapes of the node benchmark (D791): the operator's plan, the
25032
+ * preflight the confirmation shows, the run the orchestrator owns, what the
25033
+ * measuring runner reports, and the result rows Auto tune and the automatic
25034
+ * shares read.
25035
+ *
25036
+ * ONE node at a time, owned by the pipeline orchestrator. While a run is
25037
+ * active the cluster is in BENCHMARK MODE for that node: it is not a
25038
+ * detection candidate, camera pins naming it are ignored so its sessions move
25039
+ * elsewhere, and both come back when the mode ends — after a crash or a hub
25040
+ * restart too (a persisted manifest, reconciled against the registry).
25041
+ *
25042
+ * Two measurements, both on the node, driven by its own runner (frames never
25043
+ * cross a process at frame rate, D9):
25044
+ * - `device` — one accelerator × one candidate detector, root only, open
25045
+ * loop: how many streams at the camera rate it carries inside the frame
25046
+ * interval;
25047
+ * - `pipeline` — the chosen detector plus the operator's detail steps
25048
+ * (faces, plates, classifiers, CLIP…), on varied frames from the bench
25049
+ * clip: how many parallel sessions the node carries before latency, drops,
25050
+ * CPU, RAM or the event loop give out.
25051
+ */
25052
+ /** Defaults and bounds, one place. */
25053
+ var NODE_BENCHMARK_DEFAULTS = {
25054
+ fpsPerStream: 10,
25055
+ budgetMinutes: 45,
25056
+ minBudgetMinutes: 10,
25057
+ maxBudgetMinutes: 120,
25058
+ /** A result older than this no longer beats the table. */
25059
+ staleAfterDays: 30,
25060
+ /** Warm-in per ramp step (not accounted). */
25061
+ settleSec: 5,
25062
+ /** Accounted window per ramp step. */
25063
+ measureSec: 20,
25064
+ /** Longest the drain may take before the run is refused. */
25065
+ drainTimeoutSec: 120,
25066
+ /** Candidate models per device in one run. */
25067
+ maxModelsPerDevice: 6
25068
+ };
25069
+ /** The two measurements a run can make. */
25070
+ var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
25071
+ var NodeBenchmarkDevicePlanSchema = object({
25072
+ /** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
25073
+ deviceKey: string().min(1),
25074
+ /**
25075
+ * Root detector candidates for the `device` measurement, in the order
25076
+ * measured. The FIRST is the one the `pipeline` measurement runs.
25077
+ */
25078
+ modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
25079
+ });
25080
+ /** What the operator confirmed. */
25081
+ var NodeBenchmarkPlanSchema = object({
25082
+ nodeId: string().min(1),
25083
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25084
+ /** Which measurements run. At least one. */
25085
+ phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
25086
+ /**
25087
+ * Detail steps (catalog step ids under the root: faces, plates,
25088
+ * classifiers, CLIP…) the `pipeline` measurement enables. The root
25089
+ * detector always runs.
25090
+ */
25091
+ steps: array(string().min(1)).default([]),
25092
+ /** Offered rate of one stream / session. */
25093
+ fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
25094
+ /** Hard deadline: the mode ends and the cluster is restored when it passes. */
25095
+ budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
25096
+ /** Keep the models the run downloaded (default: delete what was not installed before). */
25097
+ keepDownloadedModels: boolean().default(false),
25098
+ /** Start although the other nodes' capacity does not cover the sessions running now. */
25099
+ acceptInsufficientHeadroom: boolean().default(false)
25100
+ });
25101
+ var NodeBenchmarkRefusalSchema = object({
25102
+ kind: _enum([
25103
+ "benchmark-active",
25104
+ "node-offline",
25105
+ "unknown-device",
25106
+ "no-phase",
25107
+ "insufficient-headroom"
25108
+ ]),
25109
+ detail: string(),
25110
+ overridable: boolean()
25111
+ });
25112
+ /** A camera whose detection leaves the node for the run. */
25113
+ var NodeBenchmarkMovingCameraSchema = object({
25114
+ deviceId: number(),
25115
+ /** Placed on the node now (a standing attach or a running session). */
25116
+ placedOnNode: boolean(),
25117
+ /** A node pin naming this node, ignored for the run. */
25118
+ pinnedToNode: boolean()
25119
+ });
25120
+ /** A camera that cannot leave: no other node can obtain its frames. */
25121
+ var NodeBenchmarkStayingCameraSchema = object({
25122
+ deviceId: number(),
25123
+ reason: literal("only-frame-source")
25124
+ });
25125
+ var NodeBenchmarkPreflightSchema = object({
25126
+ nodeId: string(),
25127
+ online: boolean(),
25128
+ moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
25129
+ /** Keep running on the node during the run; the result is flagged contaminated. */
25130
+ staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
25131
+ estimatedDurationMs: number(),
25132
+ /** The run ends and the cluster is restored at the latest after this long. */
25133
+ budgetMs: number(),
25134
+ phases: array(NodeBenchmarkPhaseSchema).readonly(),
25135
+ steps: array(string()).readonly(),
25136
+ devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
25137
+ /** Parallel sessions the cluster runs now, and what the other nodes can carry. */
25138
+ headroom: object({
25139
+ sessionsNow: number(),
25140
+ otherNodesCapacitySessions: number().nullable()
25141
+ }),
25142
+ refusals: array(NodeBenchmarkRefusalSchema).readonly(),
25143
+ canStart: boolean()
25144
+ });
25145
+ /** Where the measuring runner is. */
25146
+ var NodeBenchProgressSchema = object({
25147
+ phase: _enum([
25148
+ "preparing",
25149
+ "device",
25150
+ "pipeline",
25151
+ "cleanup"
25152
+ ]),
25153
+ deviceKey: string().nullable(),
25154
+ modelId: string().nullable(),
25155
+ /** Streams (device) or sessions (pipeline) of the step running now. */
25156
+ load: number().nullable(),
25157
+ cellsDone: number(),
25158
+ cellsTotal: number(),
25159
+ message: string()
25160
+ });
25161
+ /** What limited a ramp. `none` = the ramp ran out of steps still passing. */
25162
+ var NodeBenchLimitSchema = _enum([
25163
+ "p95",
25164
+ "drops",
25165
+ "errors",
25166
+ "stall",
25167
+ "cpu",
25168
+ "ram",
25169
+ "none"
25170
+ ]);
25171
+ var NodeBenchRampStepSchema = object({
25172
+ load: number(),
25173
+ pass: boolean(),
25174
+ p95Ms: number(),
25175
+ dropRatio: number(),
25176
+ /** Completed frames per second over the accounted window. */
25177
+ fps: number(),
25178
+ cpuPct: number().nullable(),
25179
+ ramFreePct: number().nullable(),
25180
+ failReasons: array(string()).readonly()
25181
+ });
25182
+ var NodeBenchCellSchema = discriminatedUnion("phase", [object({
25183
+ phase: literal("device"),
25184
+ deviceKey: string(),
25185
+ modelId: string(),
25186
+ /** Single-stream latency (the K = 1 step). */
25187
+ p50Ms: number(),
25188
+ p95Ms: number(),
25189
+ p99Ms: number(),
25190
+ /** Frames per second sustained at the last passing step. */
25191
+ fps: number(),
25192
+ /** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
25193
+ kMax: number(),
25194
+ limitedBy: NodeBenchLimitSchema,
25195
+ /** First call (model load + warm-up). */
25196
+ warmupMs: number(),
25197
+ ramp: array(NodeBenchRampStepSchema).readonly()
25198
+ }), object({
25199
+ phase: literal("pipeline"),
25200
+ deviceKey: string(),
25201
+ modelId: string(),
25202
+ steps: array(string()).readonly(),
25203
+ /** Parallel sessions at the camera rate the node carried; 0 = not even one. */
25204
+ maxSessions: number(),
25205
+ limitedBy: NodeBenchLimitSchema,
25206
+ /** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
25207
+ stepsFired: array(string()).readonly(),
25208
+ warmupMs: number(),
25209
+ ramp: array(NodeBenchRampStepSchema).readonly()
25210
+ })]);
25211
+ /**
25212
+ * What a result was measured ON. A result whose fingerprint no longer matches
25213
+ * the node no longer beats the table.
25214
+ */
25215
+ var NodeBenchFingerprintSchema = object({
25216
+ pipelineVersion: string().nullable(),
25217
+ cpuModel: string().nullable(),
25218
+ ramGb: number().nullable(),
25219
+ os: string().nullable(),
25220
+ /** Per device: the pool the cells ran on (runtime + tuning). */
25221
+ pools: record(string(), object({
25222
+ runtime: string(),
25223
+ numWorkers: number(),
25224
+ concurrency: number(),
25225
+ batchMode: string()
25226
+ })).default({})
25227
+ });
25228
+ /** The frames the run used. */
25229
+ var NodeBenchClipSchema = object({
25230
+ /** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
25231
+ id: string(),
25232
+ revision: string().nullable(),
25233
+ frames: number(),
25234
+ width: number(),
25235
+ height: number()
25236
+ });
25237
+ var NodeBenchRunnerInputSchema = object({
25238
+ runId: string().min(1),
25239
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25240
+ phases: array(NodeBenchmarkPhaseSchema).min(1),
25241
+ /** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
25242
+ steps: array(string()).default([]),
25243
+ fpsPerStream: number().int().min(1).max(30),
25244
+ /** The runner stops on its own past this instant, whatever the hub does. */
25245
+ deadlineAtMs: number(),
25246
+ settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
25247
+ measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
25248
+ keepDownloadedModels: boolean().default(false)
25249
+ });
25250
+ var NodeBenchRunnerStateSchema = _enum([
25251
+ "running",
25252
+ "done",
25253
+ "failed",
25254
+ "aborted"
25255
+ ]);
25256
+ var NodeBenchRunnerStatusSchema = object({
25257
+ runId: string(),
25258
+ nodeId: string(),
25259
+ state: NodeBenchRunnerStateSchema,
25260
+ progress: NodeBenchProgressSchema.nullable(),
25261
+ /** Every finished cell so far — a run stopped half way keeps what it measured. */
25262
+ cells: array(NodeBenchCellSchema).readonly(),
25263
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25264
+ clip: NodeBenchClipSchema.nullable(),
25265
+ /** Cameras seen running on the node during the run (they share its pools). */
25266
+ activeCameraIds: array(number()).readonly(),
25267
+ /** Models the run downloaded and then deleted (not installed before). */
25268
+ deletedModels: array(string()).readonly(),
25269
+ error: string().nullable(),
25270
+ startedAtMs: number(),
25271
+ finishedAtMs: number().nullable()
25272
+ });
25273
+ var NodeBenchmarkStateSchema = _enum([
25274
+ "draining",
25275
+ "measuring",
25276
+ "restoring",
25277
+ "done",
25278
+ "failed",
25279
+ "aborted"
25280
+ ]);
25281
+ /** Why a run ended. */
25282
+ var NodeBenchmarkEndReasonSchema = _enum([
25283
+ "completed",
25284
+ "operator-abort",
25285
+ "deadline",
25286
+ "node-lost",
25287
+ "runner-lost",
25288
+ "hub-restart",
25289
+ "drain-timeout",
25290
+ "failed"
25291
+ ]);
25292
+ var NodeBenchmarkRunSchema = object({
25293
+ runId: string(),
25294
+ nodeId: string(),
25295
+ state: NodeBenchmarkStateSchema,
25296
+ plan: NodeBenchmarkPlanSchema,
25297
+ startedAtMs: number(),
25298
+ deadlineAtMs: number(),
25299
+ finishedAtMs: number().nullable(),
25300
+ endReason: NodeBenchmarkEndReasonSchema.nullable(),
25301
+ error: string().nullable(),
25302
+ /** Cameras moved off the node for the run. */
25303
+ moved: array(number()).readonly(),
25304
+ /** Cameras that stayed (their only frame source is the node). */
25305
+ staying: array(number()).readonly(),
25306
+ /** Something else ran on the node's pools during the run. */
25307
+ contaminated: boolean(),
25308
+ progress: NodeBenchProgressSchema.nullable(),
25309
+ resultIds: array(string()).readonly()
25310
+ });
25311
+ /** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
25312
+ var NodeBenchmarkStatusSchema = object({
25313
+ /** The node the cluster is in benchmark mode for; null = none. */
25314
+ modeNodeId: string().nullable(),
25315
+ run: NodeBenchmarkRunSchema.nullable()
25316
+ });
25317
+ /**
25318
+ * One stored measurement — the only authority Auto tune and the automatic
25319
+ * shares read measured capacity from. Written by the orchestrator when a run
25320
+ * ends, never by anyone else.
25321
+ */
25322
+ var NodeBenchmarkResultSchema = object({
25323
+ id: string(),
25324
+ runId: string(),
25325
+ nodeId: string(),
25326
+ cell: NodeBenchCellSchema,
25327
+ fpsPerStream: number(),
25328
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25329
+ clip: NodeBenchClipSchema.nullable(),
25330
+ /** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
25331
+ contaminated: boolean(),
25332
+ stayingCameras: array(number()).readonly(),
25333
+ /** The run ended early; the cell itself completed. */
25334
+ partialRun: boolean(),
25335
+ measuredAtMs: number()
25336
+ });
25337
+ var ListNodeBenchmarkResultsInputSchema = object({
25338
+ nodeId: string().optional(),
25339
+ deviceKey: string().optional()
25340
+ });
25341
+ /** A result with its standing today: does it still beat the table? */
25342
+ var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
25343
+ /** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
25344
+ standing: _enum([
25345
+ "fresh",
25346
+ "stale",
25347
+ "superseded"
25348
+ ]),
25349
+ staleWhy: _enum([
25350
+ "age",
25351
+ "runtime",
25352
+ "pool-tuning"
25353
+ ]).nullable()
25354
+ });
25355
+ object({
25356
+ runId: string(),
25357
+ nodeId: string(),
25358
+ startedAtMs: number(),
25359
+ deadlineAtMs: number(),
25360
+ plan: NodeBenchmarkPlanSchema,
25361
+ moved: array(number()).readonly(),
25362
+ staying: array(number()).readonly()
25363
+ });
25364
+ /** Candidate detectors per device, for the plan editor. */
25365
+ var NodeBenchmarkCandidatesSchema = object({
25366
+ nodeId: string(),
25367
+ reachable: boolean(),
25368
+ devices: array(object({
25369
+ deviceKey: string(),
25370
+ enabled: boolean(),
25371
+ available: boolean(),
25372
+ /** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
25373
+ suggested: array(string()).readonly(),
25374
+ /** Every root detector the device has a build for. */
25375
+ all: array(string()).readonly(),
25376
+ /** The model the device runs now, when pinned. */
25377
+ currentModelId: string().nullable()
25378
+ })).readonly(),
25379
+ /** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
25380
+ steps: array(object({
25381
+ id: string(),
25382
+ name: string(),
25383
+ slot: string()
25384
+ })).readonly()
25385
+ });
23904
25386
  object({
23905
25387
  activeCameras: number(),
23906
25388
  throttledCameras: number(),
@@ -24989,7 +26471,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
24989
26471
  }), ParkedTrackFrameSchema.nullable()), method(object({
24990
26472
  deviceId: number(),
24991
26473
  trackId: string()
24992
- }), object({ released: number().int().nonnegative() }), { kind: "mutation" });
26474
+ }), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
26475
+ accepted: literal(true),
26476
+ runId: string()
26477
+ }), {
26478
+ kind: "mutation",
26479
+ auth: "admin"
26480
+ }), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
26481
+ kind: "mutation",
26482
+ auth: "admin"
26483
+ });
24993
26484
  var CameraPipelineConfigSchema = object({
24994
26485
  engine: PipelineEngineChoiceSchema.optional(),
24995
26486
  steps: array(PipelineStepInputSchema).readonly(),
@@ -25628,6 +27119,21 @@ method(object({
25628
27119
  }), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
25629
27120
  kind: "mutation",
25630
27121
  auth: "admin"
27122
+ }), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
27123
+ kind: literal("started"),
27124
+ runId: string()
27125
+ }), object({
27126
+ kind: literal("refused"),
27127
+ preflight: NodeBenchmarkPreflightSchema
27128
+ })]), {
27129
+ kind: "mutation",
27130
+ auth: "admin"
27131
+ }), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
27132
+ kind: "mutation",
27133
+ auth: "admin"
27134
+ }), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
27135
+ kind: "mutation",
27136
+ auth: "admin"
25631
27137
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
25632
27138
  deviceId: number(),
25633
27139
  addonId: string(),
@@ -30722,6 +32228,9 @@ var CreateIntegrationInputSchema = object({
30722
32228
  enabled: boolean().optional(),
30723
32229
  info: record(string(), unknown()).optional(),
30724
32230
  settings: record(string(), unknown()).optional(),
32231
+ /** Keys of `settings` the form's schema declares secret (by type) — kept in
32232
+ * the keychain, not the table (D787). */
32233
+ secretKeys: array(string()).optional(),
30725
32234
  skipRestart: boolean().optional()
30726
32235
  });
30727
32236
  var UpdateIntegrationInputSchema = object({
@@ -30745,7 +32254,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
30745
32254
  auth: "admin"
30746
32255
  }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
30747
32256
  id: string(),
30748
- settings: record(string(), unknown())
32257
+ settings: record(string(), unknown()),
32258
+ /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
32259
+ secretKeys: array(string()).optional()
30749
32260
  }), object({ success: boolean() }), {
30750
32261
  kind: "mutation",
30751
32262
  auth: "admin"
@@ -39450,6 +40961,90 @@ Object.freeze({
39450
40961
  addonId: null,
39451
40962
  access: "create"
39452
40963
  },
40964
+ "keychain.delete": {
40965
+ capName: "keychain",
40966
+ capScope: "system",
40967
+ addonId: null,
40968
+ access: "delete"
40969
+ },
40970
+ "keychain.getState": {
40971
+ capName: "keychain",
40972
+ capScope: "system",
40973
+ addonId: null,
40974
+ access: "view"
40975
+ },
40976
+ "keychain.listMeta": {
40977
+ capName: "keychain",
40978
+ capScope: "system",
40979
+ addonId: null,
40980
+ access: "view"
40981
+ },
40982
+ "keychain.put": {
40983
+ capName: "keychain",
40984
+ capScope: "system",
40985
+ addonId: null,
40986
+ access: "create"
40987
+ },
40988
+ "keychain.resolve": {
40989
+ capName: "keychain",
40990
+ capScope: "system",
40991
+ addonId: null,
40992
+ access: "view"
40993
+ },
40994
+ "keychainAdmin.deleteOrphans": {
40995
+ capName: "keychain-admin",
40996
+ capScope: "system",
40997
+ addonId: null,
40998
+ access: "delete"
40999
+ },
41000
+ "keychainAdmin.downloadRecoveryKey": {
41001
+ capName: "keychain-admin",
41002
+ capScope: "system",
41003
+ addonId: null,
41004
+ access: "create"
41005
+ },
41006
+ "keychainAdmin.listAudit": {
41007
+ capName: "keychain-admin",
41008
+ capScope: "system",
41009
+ addonId: null,
41010
+ access: "view"
41011
+ },
41012
+ "keychainAdmin.listSecrets": {
41013
+ capName: "keychain-admin",
41014
+ capScope: "system",
41015
+ addonId: null,
41016
+ access: "view"
41017
+ },
41018
+ "keychainAdmin.purgeRetiredKeys": {
41019
+ capName: "keychain-admin",
41020
+ capScope: "system",
41021
+ addonId: null,
41022
+ access: "delete"
41023
+ },
41024
+ "keychainAdmin.resetKeychain": {
41025
+ capName: "keychain-admin",
41026
+ capScope: "system",
41027
+ addonId: null,
41028
+ access: "delete"
41029
+ },
41030
+ "keychainAdmin.reveal": {
41031
+ capName: "keychain-admin",
41032
+ capScope: "system",
41033
+ addonId: null,
41034
+ access: "create"
41035
+ },
41036
+ "keychainAdmin.rotateMasterKey": {
41037
+ capName: "keychain-admin",
41038
+ capScope: "system",
41039
+ addonId: null,
41040
+ access: "create"
41041
+ },
41042
+ "keychainAdmin.status": {
41043
+ capName: "keychain-admin",
41044
+ capScope: "system",
41045
+ addonId: null,
41046
+ access: "view"
41047
+ },
39453
41048
  "lawnMowerControl.dock": {
39454
41049
  capName: "lawn-mower-control",
39455
41050
  capScope: "device",
@@ -40824,6 +42419,18 @@ Object.freeze({
40824
42419
  addonId: null,
40825
42420
  access: "create"
40826
42421
  },
42422
+ "pipelineAnalytics.addRetrainFrameFromRecording": {
42423
+ capName: "pipeline-analytics",
42424
+ capScope: "device",
42425
+ addonId: null,
42426
+ access: "create"
42427
+ },
42428
+ "pipelineAnalytics.addRetrainFramesToCollection": {
42429
+ capName: "pipeline-analytics",
42430
+ capScope: "device",
42431
+ addonId: null,
42432
+ access: "create"
42433
+ },
40827
42434
  "pipelineAnalytics.applyDeviceSettingsPatch": {
40828
42435
  capName: "pipeline-analytics",
40829
42436
  capScope: "device",
@@ -40872,12 +42479,24 @@ Object.freeze({
40872
42479
  addonId: null,
40873
42480
  access: "view"
40874
42481
  },
42482
+ "pipelineAnalytics.createRetrainCollection": {
42483
+ capName: "pipeline-analytics",
42484
+ capScope: "device",
42485
+ addonId: null,
42486
+ access: "create"
42487
+ },
40875
42488
  "pipelineAnalytics.deleteDeviceEvents": {
40876
42489
  capName: "pipeline-analytics",
40877
42490
  capScope: "device",
40878
42491
  addonId: null,
40879
42492
  access: "delete"
40880
42493
  },
42494
+ "pipelineAnalytics.deleteRetrainCollection": {
42495
+ capName: "pipeline-analytics",
42496
+ capScope: "device",
42497
+ addonId: null,
42498
+ access: "delete"
42499
+ },
40881
42500
  "pipelineAnalytics.deleteTracks": {
40882
42501
  capName: "pipeline-analytics",
40883
42502
  capScope: "device",
@@ -41082,6 +42701,24 @@ Object.freeze({
41082
42701
  addonId: null,
41083
42702
  access: "view"
41084
42703
  },
42704
+ "pipelineAnalytics.listRetrainAssistProfiles": {
42705
+ capName: "pipeline-analytics",
42706
+ capScope: "device",
42707
+ addonId: null,
42708
+ access: "view"
42709
+ },
42710
+ "pipelineAnalytics.listRetrainCollectionFrames": {
42711
+ capName: "pipeline-analytics",
42712
+ capScope: "device",
42713
+ addonId: null,
42714
+ access: "view"
42715
+ },
42716
+ "pipelineAnalytics.listRetrainCollections": {
42717
+ capName: "pipeline-analytics",
42718
+ capScope: "device",
42719
+ addonId: null,
42720
+ access: "view"
42721
+ },
41085
42722
  "pipelineAnalytics.listRetrainFrames": {
41086
42723
  capName: "pipeline-analytics",
41087
42724
  capScope: "device",
@@ -41130,6 +42767,12 @@ Object.freeze({
41130
42767
  addonId: null,
41131
42768
  access: "create"
41132
42769
  },
42770
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
42771
+ capName: "pipeline-analytics",
42772
+ capScope: "device",
42773
+ addonId: null,
42774
+ access: "create"
42775
+ },
41133
42776
  "pipelineAnalytics.pruneEvents": {
41134
42777
  capName: "pipeline-analytics",
41135
42778
  capScope: "device",
@@ -41184,6 +42827,18 @@ Object.freeze({
41184
42827
  addonId: null,
41185
42828
  access: "create"
41186
42829
  },
42830
+ "pipelineAnalytics.removeRetrainFrameFromCollection": {
42831
+ capName: "pipeline-analytics",
42832
+ capScope: "device",
42833
+ addonId: null,
42834
+ access: "delete"
42835
+ },
42836
+ "pipelineAnalytics.renameRetrainCollection": {
42837
+ capName: "pipeline-analytics",
42838
+ capScope: "device",
42839
+ addonId: null,
42840
+ access: "create"
42841
+ },
41187
42842
  "pipelineAnalytics.restageRetrainTrack": {
41188
42843
  capName: "pipeline-analytics",
41189
42844
  capScope: "device",
@@ -41472,6 +43127,12 @@ Object.freeze({
41472
43127
  addonId: null,
41473
43128
  access: "view"
41474
43129
  },
43130
+ "pipelineOrchestrator.abortNodeBenchmark": {
43131
+ capName: "pipeline-orchestrator",
43132
+ capScope: "system",
43133
+ addonId: null,
43134
+ access: "create"
43135
+ },
41475
43136
  "pipelineOrchestrator.applyAutoTune": {
41476
43137
  capName: "pipeline-orchestrator",
41477
43138
  capScope: "system",
@@ -41496,6 +43157,12 @@ Object.freeze({
41496
43157
  addonId: null,
41497
43158
  access: "create"
41498
43159
  },
43160
+ "pipelineOrchestrator.deleteNodeBenchmarkResult": {
43161
+ capName: "pipeline-orchestrator",
43162
+ capScope: "system",
43163
+ addonId: null,
43164
+ access: "delete"
43165
+ },
41499
43166
  "pipelineOrchestrator.getAgentLoad": {
41500
43167
  capName: "pipeline-orchestrator",
41501
43168
  capScope: "system",
@@ -41604,6 +43271,24 @@ Object.freeze({
41604
43271
  addonId: null,
41605
43272
  access: "view"
41606
43273
  },
43274
+ "pipelineOrchestrator.getNodeBenchmarkCandidates": {
43275
+ capName: "pipeline-orchestrator",
43276
+ capScope: "system",
43277
+ addonId: null,
43278
+ access: "view"
43279
+ },
43280
+ "pipelineOrchestrator.getNodeBenchmarkPreflight": {
43281
+ capName: "pipeline-orchestrator",
43282
+ capScope: "system",
43283
+ addonId: null,
43284
+ access: "view"
43285
+ },
43286
+ "pipelineOrchestrator.getNodeBenchmarkStatus": {
43287
+ capName: "pipeline-orchestrator",
43288
+ capScope: "system",
43289
+ addonId: null,
43290
+ access: "view"
43291
+ },
41607
43292
  "pipelineOrchestrator.getNodeInferenceDevices": {
41608
43293
  capName: "pipeline-orchestrator",
41609
43294
  capScope: "system",
@@ -41646,6 +43331,12 @@ Object.freeze({
41646
43331
  addonId: null,
41647
43332
  access: "view"
41648
43333
  },
43334
+ "pipelineOrchestrator.listNodeBenchmarkResults": {
43335
+ capName: "pipeline-orchestrator",
43336
+ capScope: "system",
43337
+ addonId: null,
43338
+ access: "view"
43339
+ },
41649
43340
  "pipelineOrchestrator.pauseForStorageMigration": {
41650
43341
  capName: "pipeline-orchestrator",
41651
43342
  capScope: "system",
@@ -41790,6 +43481,12 @@ Object.freeze({
41790
43481
  addonId: null,
41791
43482
  access: "create"
41792
43483
  },
43484
+ "pipelineOrchestrator.startNodeBenchmark": {
43485
+ capName: "pipeline-orchestrator",
43486
+ capScope: "system",
43487
+ addonId: null,
43488
+ access: "create"
43489
+ },
41793
43490
  "pipelineOrchestrator.suggestShares": {
41794
43491
  capName: "pipeline-orchestrator",
41795
43492
  capScope: "system",
@@ -41808,6 +43505,12 @@ Object.freeze({
41808
43505
  addonId: null,
41809
43506
  access: "create"
41810
43507
  },
43508
+ "pipelineRunner.abortNodeBench": {
43509
+ capName: "pipeline-runner",
43510
+ capScope: "system",
43511
+ addonId: null,
43512
+ access: "create"
43513
+ },
41811
43514
  "pipelineRunner.attachCamera": {
41812
43515
  capName: "pipeline-runner",
41813
43516
  capScope: "system",
@@ -41856,6 +43559,12 @@ Object.freeze({
41856
43559
  addonId: null,
41857
43560
  access: "view"
41858
43561
  },
43562
+ "pipelineRunner.getNodeBenchStatus": {
43563
+ capName: "pipeline-runner",
43564
+ capScope: "system",
43565
+ addonId: null,
43566
+ access: "view"
43567
+ },
41859
43568
  "pipelineRunner.getParkedTrackFrame": {
41860
43569
  capName: "pipeline-runner",
41861
43570
  capScope: "system",
@@ -41898,6 +43607,12 @@ Object.freeze({
41898
43607
  addonId: null,
41899
43608
  access: "create"
41900
43609
  },
43610
+ "pipelineRunner.startNodeBench": {
43611
+ capName: "pipeline-runner",
43612
+ capScope: "system",
43613
+ addonId: null,
43614
+ access: "create"
43615
+ },
41901
43616
  "plateGallery.assignPlate": {
41902
43617
  capName: "plate-gallery",
41903
43618
  capScope: "system",
@@ -46827,6 +48542,11 @@ Object.freeze({
46827
48542
  form: "single",
46828
48543
  optional: false
46829
48544
  }],
48545
+ "pipelineAnalytics.addRetrainFrameFromRecording": [{
48546
+ name: "deviceId",
48547
+ form: "single",
48548
+ optional: false
48549
+ }],
46830
48550
  "pipelineAnalytics.applyDeviceSettingsPatch": [{
46831
48551
  name: "deviceId",
46832
48552
  form: "single",
@@ -47017,6 +48737,11 @@ Object.freeze({
47017
48737
  form: "single",
47018
48738
  optional: false
47019
48739
  }],
48740
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
48741
+ name: "deviceId",
48742
+ form: "single",
48743
+ optional: false
48744
+ }],
47020
48745
  "pipelineAnalytics.pruneEventsBefore": [{
47021
48746
  name: "deviceId",
47022
48747
  form: "single",