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