@camstack/addon-tailscale 1.2.119 → 1.2.120

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.
@@ -26,7 +26,7 @@ let node_os = require("node:os");
26
26
  node_os = __toESM(node_os);
27
27
  let node_path = require("node:path");
28
28
  node_path = __toESM(node_path);
29
- //#region ../types/dist/event-category-B_0XEcLF.mjs
29
+ //#region ../types/dist/event-category-DaIZi00R.mjs
30
30
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
31
31
  EventCategory["SystemBoot"] = "system.boot";
32
32
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -105,6 +105,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
105
105
  */
106
106
  EventCategory["AddonLoadFailed"] = "addon.load-failed";
107
107
  /**
108
+ * A keychain value was stored or removed (D787). Carries the ref, its
109
+ * owner and the new version — NEVER the value. A process holding the ref
110
+ * drops its cached copy and the owning `BaseAddon` re-resolves its config.
111
+ * Telemetry (D8): a process that misses it still revalidates by version.
112
+ */
113
+ EventCategory["KeychainChanged"] = "keychain.changed";
114
+ /**
108
115
  * Addon recovered from a previous failure. Emitted when an addon
109
116
  * transitions from `failed` back to `healthy` (typically via the
110
117
  * monitor's auto-retry loop, or after manual `addons.retryLoad`).
@@ -5397,7 +5404,7 @@ var ZodIssueCode = {
5397
5404
  var ZodFirstPartyTypeKind;
5398
5405
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5399
5406
  //#endregion
5400
- //#region ../types/dist/sleep-B0JG7-_F.mjs
5407
+ //#region ../types/dist/sleep-Cr5YOk3m.mjs
5401
5408
  /**
5402
5409
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5403
5410
  * window to float samples (D455).
@@ -5476,6 +5483,97 @@ function buildAlawTable() {
5476
5483
  }
5477
5484
  buildUlawTable();
5478
5485
  buildAlawTable();
5486
+ /** Is this field's stored value a credential? */
5487
+ function isSecretConfigField(field) {
5488
+ if (field.type === "password") return true;
5489
+ return "secret" in field && field.secret === true;
5490
+ }
5491
+ /**
5492
+ * Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
5493
+ * by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
5494
+ */
5495
+ function isKeychainStoredField(field) {
5496
+ if (!isSecretConfigField(field)) return false;
5497
+ if (field.type === "textarea" && field.isJson === true) return false;
5498
+ return !("storage" in field && field.storage === "inline");
5499
+ }
5500
+ /**
5501
+ * What a settings blob holds where a secret used to be.
5502
+ *
5503
+ * A keychain-stored field never holds its value. It holds a self-describing
5504
+ * MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
5505
+ * code can mistake it for a credential and no form can send it to a camera as
5506
+ * a password. The empty state is `null` / absent, never `''`.
5507
+ *
5508
+ * The same shapes travel to and from the admin UI:
5509
+ *
5510
+ * - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
5511
+ * (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
5512
+ * value is set, never the value.
5513
+ * - write: an untouched field submits the view back unchanged (KEEP); a typed
5514
+ * value is a plain non-empty string (CHANGE); the Clear button submits
5515
+ * {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
5516
+ * are KEEP — an empty string is what a defaults-fallback pushes back, and
5517
+ * treating it as "clear" is how a save destroyed a stored credential before.
5518
+ *
5519
+ * Pure and browser-safe.
5520
+ */
5521
+ var SECRET_CLEAR = { $secretClear: true };
5522
+ /** The `'***'` token D634 redaction writes for non-admins. */
5523
+ var LEGACY_DEVICE_REDACTION = "***";
5524
+ function isRecord$1(value) {
5525
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5526
+ }
5527
+ function makeSecretMarker(ref) {
5528
+ return {
5529
+ $secret: ref,
5530
+ v: 1
5531
+ };
5532
+ }
5533
+ /** A stored marker: an object whose `$secret` is a non-empty string. */
5534
+ function isSecretMarker(value) {
5535
+ if (!isRecord$1(value)) return false;
5536
+ const ref = value["$secret"];
5537
+ return typeof ref === "string" && ref.length > 0;
5538
+ }
5539
+ function isSecretClear(value) {
5540
+ return isRecord$1(value) && value["$secretClear"] === true;
5541
+ }
5542
+ /**
5543
+ * The UI view of a stored secret field value: a marker becomes "set", inline
5544
+ * plaintext becomes "set (inline)", nothing becomes `null`. A value never
5545
+ * survives this function.
5546
+ */
5547
+ function toSecretFieldView(stored) {
5548
+ if (isSecretMarker(stored)) return {
5549
+ $secret: stored.$secret,
5550
+ v: 1,
5551
+ set: true
5552
+ };
5553
+ if (typeof stored === "string" && stored.length > 0) return {
5554
+ $secret: null,
5555
+ v: 1,
5556
+ set: true,
5557
+ inline: true
5558
+ };
5559
+ return null;
5560
+ }
5561
+ /**
5562
+ * Classify an incoming value for a secret path. Only a non-empty string that is
5563
+ * not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
5564
+ * Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
5565
+ * `undefined`, a redaction token, a non-string — keeps what is stored.
5566
+ */
5567
+ function classifySecretWrite(incoming) {
5568
+ if (isSecretClear(incoming)) return { kind: "clear" };
5569
+ if (typeof incoming !== "string") return { kind: "keep" };
5570
+ if (incoming.length === 0) return { kind: "keep" };
5571
+ if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
5572
+ return {
5573
+ kind: "set",
5574
+ value: incoming
5575
+ };
5576
+ }
5479
5577
  Object.fromEntries([
5480
5578
  {
5481
5579
  id: "overview",
@@ -5647,33 +5745,19 @@ Object.fromEntries([
5647
5745
  function isValuelessField(field) {
5648
5746
  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";
5649
5747
  }
5650
- /**
5651
- * Merge a `ConfigUISchema` with a raw `values` record into a
5652
- * `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
5653
- * before returning to the admin UI. Groups are walked recursively.
5654
- *
5655
- * For each leaf field:
5656
- * - structural fields (`separator`, `info`, `button`) pass through unchanged
5657
- * - other fields get `value = values[key] ?? field.default ?? null`
5658
- *
5659
- * Unknown keys in `values` (keys not declared in the schema) are silently
5660
- * ignored — they don't contribute to the output. Missing keys fall back to
5661
- * the schema default or `null`. This mirrors the old backend behaviour where
5662
- * `FormBuilder` rendered `values[key] ?? field.default`.
5663
- */
5664
- function hydrateSchema(schema, values) {
5748
+ function hydrateSchema(schema, values, options = {}) {
5665
5749
  return {
5666
5750
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
5667
5751
  sections: schema.sections.map((section) => ({
5668
5752
  ...section,
5669
- fields: section.fields.map((field) => hydrateField(field, values))
5753
+ fields: section.fields.map((field) => hydrateField(field, values, options))
5670
5754
  }))
5671
5755
  };
5672
5756
  }
5673
- function hydrateField(field, values) {
5757
+ function hydrateField(field, values, options) {
5674
5758
  if (isValuelessField(field)) return field;
5675
5759
  if (field.type === "group") {
5676
- const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
5760
+ const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
5677
5761
  return {
5678
5762
  ...field,
5679
5763
  fields: hydratedChildren
@@ -5682,7 +5766,7 @@ function hydrateField(field, values) {
5682
5766
  if (field.type === "sub-tabs") {
5683
5767
  const hydratedTabs = field.tabs.map((tab) => ({
5684
5768
  ...tab,
5685
- fields: tab.fields.map((child) => hydrateField(child, values))
5769
+ fields: tab.fields.map((child) => hydrateField(child, values, options))
5686
5770
  }));
5687
5771
  return {
5688
5772
  ...field,
@@ -5692,6 +5776,33 @@ function hydrateField(field, values) {
5692
5776
  const key = field.key;
5693
5777
  const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
5694
5778
  const defaultValue = field.default;
5779
+ const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
5780
+ if (isKeychainStoredField(field) && asView(storedValue)) return {
5781
+ ...field,
5782
+ value: toSecretFieldView(storedValue)
5783
+ };
5784
+ if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
5785
+ ...field,
5786
+ value: null
5787
+ };
5788
+ if (field.type === "editable-array" && Array.isArray(storedValue)) {
5789
+ const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
5790
+ if (secretItemKeys.length > 0) {
5791
+ const rows = storedValue.map((row) => {
5792
+ if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
5793
+ const out = { ...row };
5794
+ for (const k of secretItemKeys) {
5795
+ const v = Reflect.get(row, k);
5796
+ if (asView(v)) out[k] = toSecretFieldView(v);
5797
+ }
5798
+ return out;
5799
+ });
5800
+ return {
5801
+ ...field,
5802
+ value: rows
5803
+ };
5804
+ }
5805
+ }
5695
5806
  if (field.multiple) {
5696
5807
  const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
5697
5808
  const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
@@ -5934,6 +6045,431 @@ function projectStore(store, perNodeKeys, nodeId) {
5934
6045
  }
5935
6046
  return out;
5936
6047
  }
6048
+ var GLOBAL_SCOPE = { kind: "global" };
6049
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6050
+ function globalSecretScope() {
6051
+ return GLOBAL_SCOPE;
6052
+ }
6053
+ function encodeSegment(value) {
6054
+ return encodeURIComponent(value);
6055
+ }
6056
+ /**
6057
+ * The field path of a value inside an array item, addressed by the item's id:
6058
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6059
+ * `providers[authentik].clientSecret`.
6060
+ */
6061
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6062
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6063
+ }
6064
+ /** A write to a secret path could not be stored in the keychain, so it was refused. */
6065
+ var KeychainWriteRefusedError = class extends Error {
6066
+ fieldPath;
6067
+ constructor(fieldPath, cause) {
6068
+ super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
6069
+ this.fieldPath = fieldPath;
6070
+ this.name = "KeychainWriteRefusedError";
6071
+ }
6072
+ };
6073
+ var KEEP = { kind: "keep" };
6074
+ function isRecord(value) {
6075
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6076
+ }
6077
+ function defaultMintId() {
6078
+ return globalThis.crypto.randomUUID();
6079
+ }
6080
+ /** Every marker ref anywhere under `value`. */
6081
+ function collectSecretMarkerRefs(value, out = []) {
6082
+ if (isSecretMarker(value)) {
6083
+ out.push(value.$secret);
6084
+ return out;
6085
+ }
6086
+ if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6087
+ else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6088
+ return out;
6089
+ }
6090
+ async function storedValueEquals(secrets, marker, candidate) {
6091
+ const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
6092
+ return resolved?.kind === "value" && resolved.value === candidate;
6093
+ }
6094
+ async function writeLeaf(ctx, incoming, stored, fieldPath) {
6095
+ const intent = classifySecretWrite(incoming);
6096
+ const ref = ctx.secrets.ref(ctx.scope, fieldPath);
6097
+ const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
6098
+ if (intent.kind === "keep") return KEEP;
6099
+ if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
6100
+ if (intent.kind === "clear") {
6101
+ if (storedIsOurs) ctx.deletes.push(ref);
6102
+ return {
6103
+ kind: "value",
6104
+ value: null
6105
+ };
6106
+ }
6107
+ if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
6108
+ kind: "value",
6109
+ value: stored
6110
+ };
6111
+ try {
6112
+ await ctx.secrets.put(ref, intent.value);
6113
+ } catch (err) {
6114
+ throw new KeychainWriteRefusedError(fieldPath, err);
6115
+ }
6116
+ return {
6117
+ kind: "value",
6118
+ value: makeSecretMarker(ref)
6119
+ };
6120
+ }
6121
+ /** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
6122
+ function applyMember(out, key, result, storedParent) {
6123
+ if (result.kind === "value") {
6124
+ out[key] = result.value;
6125
+ return;
6126
+ }
6127
+ if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
6128
+ else delete out[key];
6129
+ }
6130
+ async function writeMembers(ctx, children, incoming, stored, pathOf) {
6131
+ const out = { ...incoming };
6132
+ for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
6133
+ return out;
6134
+ }
6135
+ function rowId(row, idKey) {
6136
+ const raw = row[idKey];
6137
+ if (typeof raw === "string" && raw.length > 0) return raw;
6138
+ if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
6139
+ return null;
6140
+ }
6141
+ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6142
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6143
+ if (!Array.isArray(incoming)) {
6144
+ ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6145
+ return {
6146
+ kind: "value",
6147
+ value: incoming
6148
+ };
6149
+ }
6150
+ const storedById = /* @__PURE__ */ new Map();
6151
+ for (const row of storedRows) {
6152
+ const id = rowId(row, node.idKey);
6153
+ if (id !== null) storedById.set(id, row);
6154
+ }
6155
+ const kept = /* @__PURE__ */ new Set();
6156
+ const rows = [];
6157
+ for (const row of incoming) {
6158
+ if (!isRecord(row)) {
6159
+ rows.push(row);
6160
+ continue;
6161
+ }
6162
+ const id = rowId(row, node.idKey) ?? ctx.mintId();
6163
+ kept.add(id);
6164
+ const withId = {
6165
+ ...row,
6166
+ [node.idKey]: row[node.idKey] ?? id
6167
+ };
6168
+ if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
6169
+ const storedRow = storedById.get(id) ?? {};
6170
+ rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
6171
+ }
6172
+ for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
6173
+ return {
6174
+ kind: "value",
6175
+ value: rows
6176
+ };
6177
+ }
6178
+ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6179
+ switch (node.kind) {
6180
+ case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6181
+ case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6182
+ case "object": {
6183
+ if (!isRecord(incoming)) {
6184
+ if (incoming === void 0) return KEEP;
6185
+ ctx.deletes.push(...collectSecretMarkerRefs(stored));
6186
+ return {
6187
+ kind: "value",
6188
+ value: incoming
6189
+ };
6190
+ }
6191
+ const storedObj = isRecord(stored) ? stored : {};
6192
+ return {
6193
+ kind: "value",
6194
+ value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
6195
+ };
6196
+ }
6197
+ }
6198
+ }
6199
+ /** Split a perNode-scoped key (`key@nodeId`). */
6200
+ function splitNodeKey(key) {
6201
+ const at = key.indexOf("@");
6202
+ return at <= 0 ? {
6203
+ base: key,
6204
+ nodeId: null
6205
+ } : {
6206
+ base: key.slice(0, at),
6207
+ nodeId: key.slice(at + 1)
6208
+ };
6209
+ }
6210
+ /** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
6211
+ async function transformSecretWrite(input) {
6212
+ const deletes = [];
6213
+ const base = {
6214
+ secrets: input.secrets,
6215
+ mintId: input.mintId ?? defaultMintId,
6216
+ deletes,
6217
+ operatorWrite: input.operatorWrite === true
6218
+ };
6219
+ const out = {};
6220
+ for (const [key, incoming] of Object.entries(input.patch)) {
6221
+ const { base: baseKey, nodeId } = splitNodeKey(key);
6222
+ const node = input.tree.get(baseKey);
6223
+ if (node === void 0) {
6224
+ out[key] = incoming;
6225
+ continue;
6226
+ }
6227
+ const scope = nodeId !== null && nodeId.length > 0 ? {
6228
+ kind: "node",
6229
+ nodeId
6230
+ } : input.scope ?? globalSecretScope();
6231
+ const result = await writeNode({
6232
+ ...base,
6233
+ scope
6234
+ }, node, incoming, input.stored[key], baseKey);
6235
+ if (result.kind === "value") out[key] = result.value;
6236
+ }
6237
+ return {
6238
+ patch: out,
6239
+ afterWrite: async () => {
6240
+ if (deletes.length === 0) return { orphaned: [] };
6241
+ try {
6242
+ await input.secrets.delete([...new Set(deletes)]);
6243
+ return { orphaned: [] };
6244
+ } catch {
6245
+ return { orphaned: [...new Set(deletes)] };
6246
+ }
6247
+ }
6248
+ };
6249
+ }
6250
+ /**
6251
+ * Replace every marker in `value` with its keychain value. Returns the SAME
6252
+ * reference when there is no marker (no allocation, no keychain call).
6253
+ */
6254
+ async function resolveSecretMarkers(value, secrets) {
6255
+ const refs = collectSecretMarkerRefs(value);
6256
+ if (refs.length === 0) return {
6257
+ value,
6258
+ unresolved: []
6259
+ };
6260
+ const answers = await secrets.resolve(refs);
6261
+ const unresolved = [];
6262
+ for (const ref of new Set(refs)) {
6263
+ const answer = answers[ref];
6264
+ if (answer === void 0) unresolved.push({
6265
+ ref,
6266
+ reason: "not-initialized"
6267
+ });
6268
+ else if (answer.kind === "unavailable") unresolved.push({
6269
+ ref,
6270
+ reason: answer.reason
6271
+ });
6272
+ else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
6273
+ ref,
6274
+ reason: answer.kind
6275
+ });
6276
+ }
6277
+ const substitute = (v) => {
6278
+ if (isSecretMarker(v)) {
6279
+ const answer = answers[v.$secret];
6280
+ return answer?.kind === "value" ? {
6281
+ keep: true,
6282
+ value: answer.value
6283
+ } : {
6284
+ keep: false,
6285
+ value: void 0
6286
+ };
6287
+ }
6288
+ if (Array.isArray(v)) {
6289
+ const items = [];
6290
+ for (const item of v) {
6291
+ const s = substitute(item);
6292
+ if (s.keep) items.push(s.value);
6293
+ }
6294
+ return {
6295
+ keep: true,
6296
+ value: items
6297
+ };
6298
+ }
6299
+ if (isRecord(v)) {
6300
+ const out = {};
6301
+ for (const [k, child] of Object.entries(v)) {
6302
+ const s = substitute(child);
6303
+ if (s.keep) out[k] = s.value;
6304
+ }
6305
+ return {
6306
+ keep: true,
6307
+ value: out
6308
+ };
6309
+ }
6310
+ return {
6311
+ keep: true,
6312
+ value: v
6313
+ };
6314
+ };
6315
+ return {
6316
+ value: substitute(value).value,
6317
+ unresolved
6318
+ };
6319
+ }
6320
+ function touchesTree(tree, patch) {
6321
+ if (tree.size === 0) return false;
6322
+ for (const key of Object.keys(patch)) {
6323
+ const at = key.indexOf("@");
6324
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6325
+ }
6326
+ return false;
6327
+ }
6328
+ /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6329
+ async function readStoredAddonBlob(raw) {
6330
+ const threeWay = raw.readAddonStoreResult;
6331
+ if (threeWay === void 0) return raw.readAddonStore();
6332
+ const result = await threeWay.call(raw);
6333
+ if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6334
+ return result.kind === "missing" ? {} : result.value;
6335
+ }
6336
+ function createSecretAwareSettings(raw, opts) {
6337
+ const chains = /* @__PURE__ */ new Map();
6338
+ const serialize = (key, fn) => {
6339
+ const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
6340
+ const tail = next.catch(() => void 0);
6341
+ chains.set(key, tail);
6342
+ tail.then(() => {
6343
+ if (chains.get(key) === tail) chains.delete(key);
6344
+ });
6345
+ return next;
6346
+ };
6347
+ const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6348
+ if (!touchesTree(tree, patch)) return rawWrite(patch);
6349
+ return serialize(chainKey, async () => {
6350
+ const stored = await readStored();
6351
+ const result = await transformSecretWrite({
6352
+ tree,
6353
+ secrets: opts.secrets,
6354
+ patch,
6355
+ stored,
6356
+ ...scope !== void 0 ? { scope } : {},
6357
+ operatorWrite: opts.isOperatorWrite?.() === true
6358
+ });
6359
+ if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6360
+ const { orphaned } = await result.afterWrite();
6361
+ if (orphaned.length > 0) opts.onOrphaned(orphaned);
6362
+ });
6363
+ };
6364
+ const wrapped = {
6365
+ writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6366
+ writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6367
+ kind: "device",
6368
+ deviceId
6369
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6370
+ };
6371
+ return new Proxy(raw, { get(target, prop, receiver) {
6372
+ if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6373
+ if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6374
+ const value = Reflect.get(target, prop, receiver);
6375
+ return typeof value === "function" ? value.bind(target) : value;
6376
+ } });
6377
+ }
6378
+ /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6379
+ function withSecretAwareSettings(context, opts) {
6380
+ const raw = context.settings;
6381
+ if (raw === void 0) return context;
6382
+ const settings = createSecretAwareSettings(raw, opts);
6383
+ return new Proxy(context, { get(target, prop, receiver) {
6384
+ if (prop === "settings") return settings;
6385
+ return Reflect.get(target, prop, receiver);
6386
+ } });
6387
+ }
6388
+ var LEAF = { kind: "leaf" };
6389
+ var DEFAULT_ITEM_ID_KEY = "id";
6390
+ function collectFields(fields, out) {
6391
+ for (const field of fields) {
6392
+ if (field.type === "group") {
6393
+ collectFields(field.fields, out);
6394
+ continue;
6395
+ }
6396
+ if (field.type === "sub-tabs") {
6397
+ for (const tab of field.tabs) collectFields(tab.fields, out);
6398
+ continue;
6399
+ }
6400
+ if (field.type === "editable-array") {
6401
+ const item = /* @__PURE__ */ new Map();
6402
+ for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
6403
+ if (item.size > 0) out.set(field.key, {
6404
+ kind: "array",
6405
+ idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
6406
+ item
6407
+ });
6408
+ continue;
6409
+ }
6410
+ if (!("key" in field) || typeof field.key !== "string") continue;
6411
+ if (isKeychainStoredField(field)) out.set(field.key, LEAF);
6412
+ }
6413
+ }
6414
+ /** The secret tree a settings schema declares. */
6415
+ function secretTreeFromSchema(schema) {
6416
+ const out = /* @__PURE__ */ new Map();
6417
+ if (schema === null) return out;
6418
+ for (const section of schema.sections) collectFields(section.fields, out);
6419
+ return out;
6420
+ }
6421
+ /** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
6422
+ function parseSecretStatePath(path) {
6423
+ const segments = [];
6424
+ for (const raw of path.split(".")) {
6425
+ const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
6426
+ if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
6427
+ segments.push(m[2] !== void 0 ? {
6428
+ key: m[1],
6429
+ idKey: m[2]
6430
+ } : { key: m[1] });
6431
+ }
6432
+ if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
6433
+ if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
6434
+ return segments;
6435
+ }
6436
+ function insert(into, segments) {
6437
+ const [head, ...rest] = segments;
6438
+ if (head === void 0) return;
6439
+ if (rest.length === 0) {
6440
+ into.set(head.key, LEAF);
6441
+ return;
6442
+ }
6443
+ const existing = into.get(head.key);
6444
+ if (head.idKey !== void 0) {
6445
+ const item = new Map(existing?.kind === "array" ? existing.item : []);
6446
+ insert(item, rest);
6447
+ into.set(head.key, {
6448
+ kind: "array",
6449
+ idKey: head.idKey,
6450
+ item
6451
+ });
6452
+ return;
6453
+ }
6454
+ const children = new Map(existing?.kind === "object" ? existing.children : []);
6455
+ insert(children, rest);
6456
+ into.set(head.key, {
6457
+ kind: "object",
6458
+ children
6459
+ });
6460
+ }
6461
+ /** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
6462
+ function mergeSecretStatePaths(tree, paths) {
6463
+ if (paths.length === 0) return tree;
6464
+ const out = new Map(tree);
6465
+ for (const path of paths) insert(out, parseSecretStatePath(path));
6466
+ return out;
6467
+ }
6468
+ /** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
6469
+ var SECRET_RETRY_FIRST_MS = 5e3;
6470
+ var SECRET_RETRY_MAX_MS = 5 * 6e4;
6471
+ /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
6472
+ var SECRET_CHANGE_DEBOUNCE_MS = 250;
5937
6473
  /**
5938
6474
  * Base class for CamStack addons. Eliminates settings boilerplate:
5939
6475
  *
@@ -6003,6 +6539,25 @@ var BaseAddon = class {
6003
6539
  settingsStoreReady = false;
6004
6540
  /** Default config values. Provided via constructor. */
6005
6541
  defaults;
6542
+ /**
6543
+ * Hidden-state paths that hold secrets (D787) — values the addon writes
6544
+ * itself (`updateGlobalSettings`, `state()`) that no form field declares.
6545
+ * Stored in the keychain exactly like a `password` field. Syntax:
6546
+ * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
6547
+ * (`key[<id field>]` addresses array items by id, never by index).
6548
+ */
6549
+ secretStatePaths = [];
6550
+ _addonSecretTree = null;
6551
+ _deviceSecretTree = null;
6552
+ /** Refs the last resolved config pointed at — a change to one re-resolves. */
6553
+ _configSecretRefs = /* @__PURE__ */ new Set();
6554
+ _unresolvedSecrets = [];
6555
+ _secretRetryTimer = null;
6556
+ _secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
6557
+ _secretChangeTimer = null;
6558
+ _secretChangeUnsub = null;
6559
+ /** >0 while an OPERATOR's settings write is being applied. */
6560
+ _operatorWriteDepth = 0;
6006
6561
  constructor(defaults) {
6007
6562
  this.defaults = defaults;
6008
6563
  this._config = { ...defaults };
@@ -6038,8 +6593,18 @@ var BaseAddon = class {
6038
6593
  return this._config;
6039
6594
  }
6040
6595
  async initialize(context) {
6041
- this._ctx = context;
6596
+ const secrets = context.secrets;
6597
+ this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6598
+ secrets,
6599
+ addonTree: () => this.addonSecretTree(),
6600
+ deviceTree: () => this.deviceSecretTree(),
6601
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6602
+ isOperatorWrite: () => this._operatorWriteDepth > 0
6603
+ }) : context;
6042
6604
  await this.resolveConfig();
6605
+ if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6606
+ if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
6607
+ });
6043
6608
  const result = await this.onInitialize();
6044
6609
  this.emitLifecycle(EventCategory.AddonStarted);
6045
6610
  const normalized = normalizeAddonInitResult(result);
@@ -6072,6 +6637,12 @@ var BaseAddon = class {
6072
6637
  */
6073
6638
  async onHubReachable() {}
6074
6639
  async shutdown() {
6640
+ this._secretChangeUnsub?.();
6641
+ this._secretChangeUnsub = null;
6642
+ if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
6643
+ if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
6644
+ this._secretRetryTimer = null;
6645
+ this._secretChangeTimer = null;
6075
6646
  this.emitLifecycle(EventCategory.AddonStopped);
6076
6647
  if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
6077
6648
  await this.onShutdown();
@@ -6150,7 +6721,7 @@ var BaseAddon = class {
6150
6721
  return hydrateSchema(schema, overlay ? {
6151
6722
  ...projected,
6152
6723
  ...overlay
6153
- } : projected);
6724
+ } : projected, { inlineSecretsAsViews: true });
6154
6725
  }
6155
6726
  /**
6156
6727
  * The integration-level view of this addon's settings: exactly the sections
@@ -6199,7 +6770,7 @@ var BaseAddon = class {
6199
6770
  return hydrateSchema({
6200
6771
  ...schema,
6201
6772
  sections
6202
- }, projected);
6773
+ }, projected, { inlineSecretsAsViews: true });
6203
6774
  }
6204
6775
  /**
6205
6776
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -6253,18 +6824,50 @@ var BaseAddon = class {
6253
6824
  value: result.value[key]
6254
6825
  };
6255
6826
  }
6827
+ /**
6828
+ * The OPERATOR's write — a settings form or an admin API call, dispatched by
6829
+ * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
6830
+ * the operator sends is stored as sent even when it equals a pre-keychain
6831
+ * inline value: the operator re-entering a password is a change, an addon
6832
+ * writing back what it read is not (D787).
6833
+ */
6834
+ async updateGlobalSettingsAsOperator(patch, nodeId) {
6835
+ this._operatorWriteDepth++;
6836
+ try {
6837
+ await this.applyGlobalPatch(patch, nodeId);
6838
+ } finally {
6839
+ this._operatorWriteDepth--;
6840
+ }
6841
+ }
6256
6842
  async updateGlobalSettings(patch, nodeId) {
6843
+ await this.applyGlobalPatch(patch, nodeId);
6844
+ }
6845
+ /**
6846
+ * REMOVE stored secrets — their keychain values and their markers (D787).
6847
+ *
6848
+ * Writing `''` to a secret field KEEPS what is stored (an empty string is
6849
+ * what a defaults fallback writes back, and it must never destroy a
6850
+ * credential), so code that means "forget this token" says so here. Without
6851
+ * a keychain (an older kernel) it writes `''`, as such code always did.
6852
+ */
6853
+ async clearSecrets(keys, nodeId) {
6854
+ const tree = this.addonSecretTree();
6855
+ const keychain = this._ctx?.secrets !== void 0;
6856
+ const patch = {};
6857
+ for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
6858
+ await this.applyGlobalPatch(patch, nodeId);
6859
+ }
6860
+ async applyGlobalPatch(barePatch, nodeId) {
6257
6861
  const keys = this.perNodeKeys();
6258
6862
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6259
6863
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6260
- const barePatch = patch;
6261
6864
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6262
6865
  await this._ctx?.settings?.writeAddonStore(scoped);
6263
6866
  if (target !== localNode) return;
6264
6867
  await this.resolveConfig();
6265
6868
  await this.onConfigChanged();
6266
6869
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
6267
- this.maybeAutoRestart(patch, this.globalSettingsSchema());
6870
+ this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
6268
6871
  }
6269
6872
  /**
6270
6873
  * The set of field keys the global settings schema declares `perNode: true`
@@ -6289,7 +6892,7 @@ var BaseAddon = class {
6289
6892
  * time to return its response before the addon is torn down and
6290
6893
  * re-initialised by `AddonRegistryService.restartAddon`.
6291
6894
  */
6292
- maybeAutoRestart(patch, schema) {
6895
+ maybeAutoRestart(patchKeys, schema) {
6293
6896
  if (!schema) return;
6294
6897
  const restartKeys = /* @__PURE__ */ new Set();
6295
6898
  for (const section of schema.sections) for (const field of section.fields) {
@@ -6297,13 +6900,13 @@ var BaseAddon = class {
6297
6900
  if (field.requiresRestart) restartKeys.add(field.key);
6298
6901
  }
6299
6902
  if (restartKeys.size === 0) return;
6300
- if (!Object.keys(patch).some((k) => restartKeys.has(k))) return;
6903
+ if (!patchKeys.some((k) => restartKeys.has(k))) return;
6301
6904
  const ctx = this._ctx;
6302
6905
  if (!ctx) return;
6303
6906
  const addonId = ctx.id;
6304
6907
  setImmediate(() => {
6305
6908
  ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
6306
- ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: Object.keys(patch).filter((k) => restartKeys.has(k)) } });
6909
+ ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
6307
6910
  }).catch((err) => {
6308
6911
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
6309
6912
  });
@@ -6312,7 +6915,7 @@ var BaseAddon = class {
6312
6915
  async getDeviceSettings(deviceId) {
6313
6916
  const schema = this.deviceSettingsSchema();
6314
6917
  if (!schema) return { sections: [] };
6315
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
6918
+ return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6316
6919
  }
6317
6920
  async updateDeviceSettings(deviceId, patch) {
6318
6921
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -6442,7 +7045,7 @@ var BaseAddon = class {
6442
7045
  * selection at boot (absent scoped key ⇒ the constructor default wins).
6443
7046
  */
6444
7047
  async resolveConfig() {
6445
- const stored = await this.readAddonStoreWithRetry();
7048
+ const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
6446
7049
  const perNode = this.perNodeKeys();
6447
7050
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6448
7051
  const resolved = { ...this.defaults };
@@ -6467,7 +7070,7 @@ var BaseAddon = class {
6467
7070
  key,
6468
7071
  schema,
6469
7072
  fallback,
6470
- read: () => this.readAddonStoreWithRetry(),
7073
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
6471
7074
  write: async (patch) => {
6472
7075
  await this._ctx?.settings?.writeAddonStore(patch);
6473
7076
  },
@@ -6484,7 +7087,7 @@ var BaseAddon = class {
6484
7087
  key,
6485
7088
  schema,
6486
7089
  fallback,
6487
- read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
7090
+ read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
6488
7091
  write: async (patch) => {
6489
7092
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
6490
7093
  },
@@ -6496,6 +7099,70 @@ var BaseAddon = class {
6496
7099
  } })
6497
7100
  });
6498
7101
  }
7102
+ /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
7103
+ addonSecretTree() {
7104
+ this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
7105
+ return this._addonSecretTree;
7106
+ }
7107
+ deviceSecretTree() {
7108
+ this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7109
+ return this._deviceSecretTree;
7110
+ }
7111
+ /**
7112
+ * Secrets of this addon's stored config that could not be resolved on the
7113
+ * last read, with why. Non-empty means the addon is running WITHOUT them —
7114
+ * an addon whose function needs one should report itself degraded rather
7115
+ * than start on an empty credential.
7116
+ */
7117
+ get unresolvedSecrets() {
7118
+ return this._unresolvedSecrets;
7119
+ }
7120
+ /**
7121
+ * Substitute every keychain marker in a stored blob with its value. With no
7122
+ * keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
7123
+ * An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
7124
+ * value — and, when the cause can pass, retried with backoff. Nothing is
7125
+ * ever written back from here.
7126
+ */
7127
+ async resolveStoredSecrets(blob, trackForConfig = true) {
7128
+ const secrets = this._ctx?.secrets;
7129
+ if (secrets === void 0) return blob;
7130
+ const refs = collectSecretMarkerRefs(blob);
7131
+ if (trackForConfig) this._configSecretRefs = new Set(refs);
7132
+ if (refs.length === 0) {
7133
+ if (trackForConfig) this._unresolvedSecrets = [];
7134
+ return blob;
7135
+ }
7136
+ const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
7137
+ if (trackForConfig) {
7138
+ this._unresolvedSecrets = unresolved;
7139
+ if (unresolved.length > 0) {
7140
+ this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
7141
+ ref: u.ref,
7142
+ reason: u.reason
7143
+ })) } });
7144
+ if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
7145
+ this.scheduleSecretReresolve(this._secretRetryDelayMs);
7146
+ this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
7147
+ }
7148
+ } else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
7149
+ }
7150
+ return value;
7151
+ }
7152
+ /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7153
+ scheduleSecretReresolve(delayMs) {
7154
+ const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
7155
+ if (this[timerOf] !== null) return;
7156
+ const timer = setTimeout(() => {
7157
+ this[timerOf] = null;
7158
+ if (this._ctx === null) return;
7159
+ this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
7160
+ this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
7161
+ });
7162
+ }, delayMs);
7163
+ timer.unref?.();
7164
+ this[timerOf] = timer;
7165
+ }
6499
7166
  /**
6500
7167
  * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
6501
7168
  * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
@@ -14019,6 +14686,196 @@ id: union([string(), number()]) }), {
14019
14686
  kind: "mutation",
14020
14687
  auth: "admin"
14021
14688
  });
14689
+ /**
14690
+ * `keychain` — the hub's encrypted store of secret values (D787).
14691
+ *
14692
+ * Settings blobs never hold a secret: they hold a marker
14693
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
14694
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
14695
+ * is the OWNER's door to its own values: every method is owner-checked
14696
+ * against the CALLER, never against anything the caller claims.
14697
+ *
14698
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
14699
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
14700
+ * connection, the agent from its child's connection carried in
14701
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
14702
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
14703
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
14704
+ * identity against BUGS and misrouting, not against a malicious addon (every
14705
+ * runner is the same OS user): see the threat model in
14706
+ * `docs/design/2026-10-08-secrets-keychain.md`.
14707
+ *
14708
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
14709
+ * parses the input, so a session can never supply it, and the internal mount
14710
+ * floors every method to admin anyway (D240).
14711
+ *
14712
+ * Internal: addons reach it through `ctx.secrets`, never directly.
14713
+ */
14714
+ /** Why a value cannot be served right now. Never folded into "missing". */
14715
+ var KeychainUnavailableReasonSchema = _enum([
14716
+ "key-missing",
14717
+ "wrong-key",
14718
+ "key-file-unreadable",
14719
+ "store-unavailable",
14720
+ "not-initialized",
14721
+ "decrypt-failed"
14722
+ ]);
14723
+ var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
14724
+ state: literal("locked"),
14725
+ reason: KeychainUnavailableReasonSchema
14726
+ })]);
14727
+ var KeychainResolveEntrySchema = discriminatedUnion("kind", [
14728
+ object({
14729
+ kind: literal("value"),
14730
+ value: string(),
14731
+ version: number().int()
14732
+ }),
14733
+ object({ kind: literal("missing") }),
14734
+ object({
14735
+ kind: literal("unavailable"),
14736
+ reason: KeychainUnavailableReasonSchema
14737
+ }),
14738
+ object({ kind: literal("forbidden") })
14739
+ ]);
14740
+ var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
14741
+ /** Metadata of one stored value — never the value. */
14742
+ var KeychainSecretMetaSchema = object({
14743
+ ref: string(),
14744
+ owner: string(),
14745
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
14746
+ scope: string(),
14747
+ fieldPath: string(),
14748
+ version: number().int(),
14749
+ createdAt: number(),
14750
+ updatedAt: number(),
14751
+ /** `addon:<id>` | `user:<id>` | `system`. */
14752
+ updatedBy: string(),
14753
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
14754
+ lastReadAt: number().nullable()
14755
+ });
14756
+ var RefListSchema = array(string().min(1)).max(512);
14757
+ method(object({
14758
+ ref: string().min(1),
14759
+ value: string().min(1)
14760
+ }), object({
14761
+ ref: string(),
14762
+ version: number().int()
14763
+ }), {
14764
+ kind: "mutation",
14765
+ auth: "admin"
14766
+ }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
14767
+ kind: "mutation",
14768
+ auth: "admin"
14769
+ }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
14770
+ var KeychainKeySourceSchema = object({
14771
+ kind: _enum([
14772
+ "config-file",
14773
+ "previous-config-file",
14774
+ "platform",
14775
+ "default-file"
14776
+ ]),
14777
+ /** File sources only — a path is not a secret. */
14778
+ path: string().optional(),
14779
+ /**
14780
+ * True when a whole-volume backup of the data directory carries this key
14781
+ * next to the database it protects (the default file). The page warns.
14782
+ */
14783
+ sharesBackupWithDatabase: boolean()
14784
+ });
14785
+ var KeychainStatusSchema = object({
14786
+ keychain: KeychainStateSchema,
14787
+ /** The source of the master key in use; `null` while locked. */
14788
+ keySource: KeychainKeySourceSchema.nullable(),
14789
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
14790
+ configuredSource: KeychainKeySourceSchema,
14791
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
14792
+ fingerprint: string().nullable(),
14793
+ activeKeyId: string().nullable(),
14794
+ /**
14795
+ * The keychain unlocked with a NON-primary source: the configured primary
14796
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
14797
+ */
14798
+ rotationPending: boolean(),
14799
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
14800
+ retiredWraps: number().int(),
14801
+ recoveryKeyDownloadedAt: number().nullable(),
14802
+ secretCount: number().int()
14803
+ });
14804
+ /**
14805
+ * Whether a stored value is still pointed at by its owner's settings.
14806
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
14807
+ * never reported as an orphan (and never deleted as one).
14808
+ */
14809
+ var KeychainSecretUsageSchema = _enum([
14810
+ "in-use",
14811
+ "orphan",
14812
+ "unknown"
14813
+ ]);
14814
+ var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
14815
+ var KeychainAuditActionSchema = _enum([
14816
+ "put",
14817
+ "delete",
14818
+ "reveal",
14819
+ "rotate-master-key",
14820
+ "purge-retired-keys",
14821
+ "download-recovery-key",
14822
+ "delete-orphans",
14823
+ "reset",
14824
+ "initialize"
14825
+ ]);
14826
+ var KeychainAuditEntrySchema = object({
14827
+ id: string(),
14828
+ at: number(),
14829
+ action: KeychainAuditActionSchema,
14830
+ /** `addon:<id>` | `user:<id>` | `system`. */
14831
+ actor: string(),
14832
+ ref: string().nullable(),
14833
+ detail: string().nullable()
14834
+ });
14835
+ 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({
14836
+ value: string(),
14837
+ version: number().int()
14838
+ }), {
14839
+ kind: "mutation",
14840
+ auth: "admin",
14841
+ caller: "required"
14842
+ }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
14843
+ deleted: array(string()).readonly(),
14844
+ kept: array(object({
14845
+ ref: string(),
14846
+ usage: KeychainSecretUsageSchema
14847
+ })).readonly()
14848
+ }), {
14849
+ kind: "mutation",
14850
+ auth: "admin",
14851
+ caller: "required"
14852
+ }), method(object({}), object({
14853
+ fingerprint: string(),
14854
+ keySource: KeychainKeySourceSchema
14855
+ }), {
14856
+ kind: "mutation",
14857
+ auth: "admin",
14858
+ caller: "required"
14859
+ }), method(object({}), object({ purged: number().int() }), {
14860
+ kind: "mutation",
14861
+ auth: "admin",
14862
+ caller: "required"
14863
+ }), method(object({}), object({
14864
+ key: string(),
14865
+ fingerprint: string(),
14866
+ keySource: KeychainKeySourceSchema
14867
+ }), {
14868
+ kind: "mutation",
14869
+ auth: "admin",
14870
+ caller: "required"
14871
+ }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
14872
+ archivedCollection: string().nullable(),
14873
+ archived: number().int()
14874
+ }), {
14875
+ kind: "mutation",
14876
+ auth: "admin",
14877
+ caller: "required"
14878
+ });
14022
14879
  method(_void(), object({
14023
14880
  id: string(),
14024
14881
  name: string(),
@@ -15056,7 +15913,11 @@ var DeviceRegisterPayloadSchema = object({
15056
15913
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
15057
15914
  var DevicePersistConfigPayloadSchema = object({
15058
15915
  deviceId: number(),
15059
- data: record(string(), unknown())
15916
+ data: record(string(), unknown()),
15917
+ /** The paths the device's schema declares secret (D783), when the caller
15918
+ * knows them — those values are kept in the keychain, not the blob (D787).
15919
+ * Absent: the paths the device last reported at `registerDevice` apply. */
15920
+ secretConfigPaths: array(string()).optional()
15060
15921
  });
15061
15922
  /** What a migration actually did, per switch. `unreachable` is a first-class
15062
15923
  * answer: a camera that could not be asked is not a camera that was silenced. */
@@ -22052,8 +22913,23 @@ var RetrainMacroClassSchema = _enum([
22052
22913
  ]);
22053
22914
  /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
22054
22915
  var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
22055
- /** Did a human draw this box, or did the assist propose it? */
22056
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
22916
+ /**
22917
+ * Where a box came from. A machine-sourced box is a DRAFT on the page until
22918
+ * the operator confirms it; once saved it keeps its source as provenance.
22919
+ *
22920
+ * - `operator` — drawn by hand.
22921
+ * - `assist` — proposed by a detector run on the copy (the camera's own
22922
+ * model, or a larger teacher model).
22923
+ * - `pipeline` — the box the live pipeline actually drew on that frame, read
22924
+ * back from the track store (never a re-run).
22925
+ * - `llm` — proposed by a vision-capable LLM profile.
22926
+ */
22927
+ var RetrainAnnotationSourceSchema = _enum([
22928
+ "operator",
22929
+ "assist",
22930
+ "pipeline",
22931
+ "llm"
22932
+ ]);
22057
22933
  /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
22058
22934
  var RetrainBboxSchema = object({
22059
22935
  x: number(),
@@ -22071,7 +22947,8 @@ var RetrainBboxSchema = object({
22071
22947
  */
22072
22948
  var RetrainAnnotationSchema = object({
22073
22949
  id: string(),
22074
- trackId: string(),
22950
+ /** The frame's track. Absent on a recording still, which has none. */
22951
+ trackId: string().optional(),
22075
22952
  deviceId: number(),
22076
22953
  /** The COPY in retrain storage — never the source track's media key. */
22077
22954
  mediaKey: string(),
@@ -22120,13 +22997,47 @@ var RetrainFrameCandidateSchema = object({
22120
22997
  * fail, whatever became of the original. */
22121
22998
  copied: boolean()
22122
22999
  });
23000
+ /**
23001
+ * One box the live pipeline drew on a copied frame — what a correction starts
23002
+ * from. Derived when the frame is listed, from the track store: the subject
23003
+ * box recorded on the source media row when there is one, else the track
23004
+ * position nearest the frame's capture time. Never stored as an annotation
23005
+ * until the operator confirms it.
23006
+ */
23007
+ var RetrainPipelineBoxSchema = object({
23008
+ /** Normalised `[0,1]` against the full frame. */
23009
+ bbox: RetrainBboxSchema,
23010
+ macroClass: RetrainMacroClassSchema,
23011
+ label: string().optional(),
23012
+ subLabel: string().optional(),
23013
+ /** The detection score of the position used, when it was recorded. */
23014
+ score: number().optional(),
23015
+ /** The root model that produced the track, when it was recorded. */
23016
+ modelId: string().optional(),
23017
+ trackId: string(),
23018
+ /** `subject-box`: recorded on this very frame. `position`: the track's
23019
+ * position nearest the capture time, `deltaMs` away. */
23020
+ basis: _enum(["subject-box", "position"]),
23021
+ deltaMs: number()
23022
+ });
23023
+ /**
23024
+ * Where a retrain frame came from: a TRACK's stored media (copy-on-select),
23025
+ * or the RECORDING at an instant — the frame a model saw nothing in has no
23026
+ * track at all.
23027
+ */
23028
+ var RetrainFrameOriginSchema = _enum(["track", "recording"]);
22123
23029
  /** A frame the dataset OWNS: bytes copied at selection time. */
22124
23030
  var RetrainFrameSchema = object({
22125
23031
  frameId: string(),
22126
23032
  deviceId: number(),
22127
- trackId: string(),
22128
- /** Provenance only. It may already point at nothing — that is expected. */
22129
- sourceMediaId: number().int(),
23033
+ origin: RetrainFrameOriginSchema,
23034
+ /** The track it was copied from. Absent on a recording still. */
23035
+ trackId: string().optional(),
23036
+ /** Provenance only. It may already point at nothing — that is expected.
23037
+ * Absent on a recording still. */
23038
+ sourceMediaId: number().int().optional(),
23039
+ /** A recording still: the playhead instant it was taken at. */
23040
+ epochMs: number().optional(),
22130
23041
  sourceKind: MediaFileKindEnum,
22131
23042
  sizeBytes: number().int(),
22132
23043
  width: number().int(),
@@ -22137,7 +23048,12 @@ var RetrainFrameSchema = object({
22137
23048
  /** The operator's "every subject in this frame is boxed". Detector
22138
23049
  * evaluation keeps only complete frames: an unboxed subject would count as
22139
23050
  * a false positive. */
22140
- complete: boolean()
23051
+ complete: boolean(),
23052
+ /** The boxes the pipeline drew on this frame. Present on list answers;
23053
+ * empty when nothing the track store holds can be placed on it. */
23054
+ pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
23055
+ /** The named collections this frame belongs to. Present on list answers. */
23056
+ collectionIds: array(string()).readonly().optional()
22141
23057
  });
22142
23058
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
22143
23059
  var RetrainCopyRefusalSchema = _enum([
@@ -22168,6 +23084,8 @@ var RetrainFrameListSchema = object({
22168
23084
  var RetrainExportFilterSchema = object({
22169
23085
  deviceIds: array(number()).optional(),
22170
23086
  frameIds: array(string()).max(2e4).optional(),
23087
+ /** Only frames in at least one of these named collections. */
23088
+ collectionIds: array(string()).max(200).optional(),
22171
23089
  batchId: string().optional(),
22172
23090
  /** Only frames the operator marked complete (all subjects boxed). */
22173
23091
  completeOnly: boolean().optional()
@@ -22232,6 +23150,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
22232
23150
  reason: string(),
22233
23151
  detail: string().optional()
22234
23152
  })]);
23153
+ /** A named set over the retrain corpus — membership only, it owns no pixels. */
23154
+ var RetrainCollectionSchema = object({
23155
+ id: string(),
23156
+ name: string(),
23157
+ createdAt: number(),
23158
+ frameCount: number().int()
23159
+ });
23160
+ var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
23161
+ kind: literal("created"),
23162
+ collection: RetrainCollectionSchema
23163
+ }), object({
23164
+ kind: literal("refused"),
23165
+ reason: _enum(["empty-name", "duplicate-name"])
23166
+ })]);
23167
+ var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
23168
+ kind: literal("renamed"),
23169
+ collection: RetrainCollectionSchema
23170
+ }), object({
23171
+ kind: literal("refused"),
23172
+ reason: _enum([
23173
+ "empty-name",
23174
+ "duplicate-name",
23175
+ "unknown-collection"
23176
+ ])
23177
+ })]);
23178
+ /**
23179
+ * The outcome of adding the frame at a recording instant. Every refusal is
23180
+ * named: `still-unavailable` (not recording, a gap, or an undecodable frame —
23181
+ * `detail` says which), `still-busy` (the recorder is at its decode bound; try
23182
+ * again), `unreadable-image`, `write-failed`, `unknown-collection`.
23183
+ */
23184
+ var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
23185
+ kind: literal("added"),
23186
+ collectionId: string(),
23187
+ frame: RetrainFrameSchema,
23188
+ /** The moment was already in the dataset; nothing was decoded. */
23189
+ reused: boolean()
23190
+ }), object({
23191
+ kind: literal("refused"),
23192
+ reason: _enum([
23193
+ "unknown-collection",
23194
+ "still-unavailable",
23195
+ "still-busy",
23196
+ "unreadable-image",
23197
+ "write-failed"
23198
+ ]),
23199
+ detail: string().optional()
23200
+ })]);
23201
+ /** A vision LLM profile the AI assist may use, and where it sends the frame. */
23202
+ var RetrainAssistProfileSchema = object({
23203
+ id: string(),
23204
+ name: string(),
23205
+ model: string(),
23206
+ kind: string(),
23207
+ /** `true` when the frame would leave the house (a cloud vendor, or an
23208
+ * endpoint that is not on the local network). The page confirms each such
23209
+ * run, and the provider refuses one without `allowCloud`. */
23210
+ leavesHouse: boolean()
23211
+ });
23212
+ /** A box the AI assist proposed: a draft, plus the model's own reason. */
23213
+ var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
23214
+ /** What the AI assist said about a box that was already on the canvas. */
23215
+ var RetrainLlmReviewSchema = object({
23216
+ /** The `ref` the page sent the box under. */
23217
+ ref: string(),
23218
+ verdict: _enum([
23219
+ "confirmed",
23220
+ "wrong-class",
23221
+ "not-an-object",
23222
+ "uncertain"
23223
+ ]),
23224
+ suggestedClass: RetrainMacroClassSchema.optional(),
23225
+ reason: string()
23226
+ });
23227
+ /**
23228
+ * The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
23229
+ * model and its confidence) and reviews; items the model got wrong (a box off
23230
+ * the frame, an unasked class, an unknown ref) are dropped and counted in
23231
+ * `rejected`. A whole answer that is not the schema is `malformed-answer`.
23232
+ */
23233
+ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23234
+ kind: literal("proposed"),
23235
+ profileId: string(),
23236
+ model: string(),
23237
+ /** The frame was sent outside the house for this answer. */
23238
+ leftHouse: boolean(),
23239
+ proposals: array(RetrainLlmProposalSchema).readonly(),
23240
+ reviews: array(RetrainLlmReviewSchema).readonly(),
23241
+ rejected: number().int()
23242
+ }), object({
23243
+ kind: literal("refused"),
23244
+ reason: _enum([
23245
+ "unknown-frame",
23246
+ "unreadable-frame",
23247
+ "unknown-profile",
23248
+ "profile-disabled",
23249
+ "no-vision",
23250
+ "cloud-not-confirmed",
23251
+ "llm-error",
23252
+ "malformed-answer"
23253
+ ]),
23254
+ detail: string().optional()
23255
+ })]);
22235
23256
  /** The outcome of a lifecycle move owned by the retrain page. */
22236
23257
  var RetrainTransitionResultSchema = object({
22237
23258
  trackId: string(),
@@ -22949,7 +23970,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22949
23970
  auth: "admin"
22950
23971
  }), method(object({
22951
23972
  deviceId: number(),
22952
- trackId: string(),
23973
+ trackId: string().optional(),
22953
23974
  frameId: string()
22954
23975
  }), object({
22955
23976
  removed: boolean(),
@@ -22966,7 +23987,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22966
23987
  auth: "admin"
22967
23988
  }), method(object({
22968
23989
  deviceId: number(),
22969
- trackId: string(),
23990
+ /** The frame's track, when it has one — checked against the frame. */
23991
+ trackId: string().optional(),
22970
23992
  frameId: string(),
22971
23993
  subject: RetrainAssistSubjectSchema,
22972
23994
  /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
@@ -22974,12 +23996,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22974
23996
  }), RetrainAssistResultSchema, {
22975
23997
  kind: "mutation",
22976
23998
  auth: "admin"
22977
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
23999
+ }), method(object({
24000
+ trackId: string().optional(),
24001
+ frameIds: array(string()).max(2e3).optional()
24002
+ }), array(RetrainAnnotationSchema).readonly(), {
22978
24003
  kind: "query",
22979
24004
  auth: "admin"
22980
24005
  }), method(object({
22981
24006
  deviceId: number(),
22982
- trackId: string(),
24007
+ /** The frame's track, when it has one — checked against the frame. */
24008
+ trackId: string().optional(),
22983
24009
  frameId: string(),
22984
24010
  annotations: array(RetrainAnnotationDraftSchema)
22985
24011
  }), array(RetrainAnnotationSchema).readonly(), {
@@ -23002,7 +24028,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23002
24028
  auth: "admin"
23003
24029
  }), method(object({
23004
24030
  deviceId: number(),
23005
- trackId: string(),
24031
+ trackId: string().optional(),
23006
24032
  frameId: string(),
23007
24033
  complete: boolean()
23008
24034
  }), RetrainFrameSchema, {
@@ -23016,6 +24042,74 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23016
24042
  kind: "mutation",
23017
24043
  auth: "admin",
23018
24044
  timeoutMs: 60 * 6e4
24045
+ }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24046
+ kind: "query",
24047
+ auth: "admin"
24048
+ }), method(object({
24049
+ deviceId: number(),
24050
+ trackId: string().optional(),
24051
+ frameId: string(),
24052
+ profileId: string(),
24053
+ classes: array(RetrainMacroClassSchema).min(1),
24054
+ boxes: array(object({
24055
+ ref: string(),
24056
+ bbox: RetrainBboxSchema,
24057
+ macroClass: RetrainMacroClassSchema,
24058
+ label: string().optional()
24059
+ })).max(50),
24060
+ allowCloud: boolean()
24061
+ }), RetrainLlmAssistResultSchema, {
24062
+ kind: "mutation",
24063
+ auth: "admin",
24064
+ timeoutMs: 18e4
24065
+ }), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
24066
+ kind: "mutation",
24067
+ auth: "admin"
24068
+ }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24069
+ kind: "query",
24070
+ auth: "admin"
24071
+ }), method(object({
24072
+ id: string(),
24073
+ name: string().max(120)
24074
+ }), RetrainCollectionRenameResultSchema, {
24075
+ kind: "mutation",
24076
+ auth: "admin"
24077
+ }), method(object({ id: string() }), object({
24078
+ deleted: boolean(),
24079
+ removedFrames: number().int()
24080
+ }), {
24081
+ kind: "mutation",
24082
+ auth: "admin"
24083
+ }), method(object({
24084
+ collectionId: string(),
24085
+ deviceId: number(),
24086
+ epochMs: number()
24087
+ }), AddRetrainFrameFromRecordingResultSchema, {
24088
+ kind: "mutation",
24089
+ auth: "admin",
24090
+ timeoutMs: 6e4
24091
+ }), method(object({
24092
+ collectionId: string(),
24093
+ frameIds: array(string()).min(1).max(500)
24094
+ }), object({
24095
+ added: number().int(),
24096
+ alreadyMember: number().int(),
24097
+ unknownFrameIds: array(string()).readonly()
24098
+ }), {
24099
+ kind: "mutation",
24100
+ auth: "admin"
24101
+ }), method(object({
24102
+ collectionId: string(),
24103
+ frameId: string()
24104
+ }), object({
24105
+ removed: boolean(),
24106
+ deletedFrame: boolean()
24107
+ }), {
24108
+ kind: "mutation",
24109
+ auth: "admin"
24110
+ }), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
24111
+ kind: "query",
24112
+ auth: "admin"
23019
24113
  }), method(object({
23020
24114
  /** Which of the three event tables owns the row. */
23021
24115
  ownerType: EventOwnerTypeSchema,
@@ -23639,13 +24733,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
23639
24733
  object({
23640
24734
  kind: literal("no-family-build"),
23641
24735
  format: ModelFormatSchema$1
24736
+ }),
24737
+ object({
24738
+ kind: literal("kept-custom-pin"),
24739
+ modelId: string(),
24740
+ deviceKey: string()
23642
24741
  })
23643
24742
  ]);
24743
+ /** Why a device is left exactly as it is, whatever the plan would pick (D786). */
24744
+ var KeptReasonSchema = _enum(["custom-pin"]);
24745
+ /**
24746
+ * Where a choice's latency came from (D791): this node's own benchmark
24747
+ * result, or the hardware-class table. Measured on the node beats the table.
24748
+ */
24749
+ var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
24750
+ kind: literal("node-benchmark"),
24751
+ resultId: string(),
24752
+ measuredAtMs: number()
24753
+ })]);
23644
24754
  var DeviceModelChoiceSchema = object({
23645
24755
  modelId: string(),
23646
24756
  p50Ms: number(),
23647
24757
  fps: number(),
23648
24758
  measured: boolean(),
24759
+ /** Absent on a plan from before D791 — read as the table. */
24760
+ source: LatencySourceSchema.optional(),
23649
24761
  /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
23650
24762
  capacitySessions: number(),
23651
24763
  personRecall: number()
@@ -23656,6 +24768,8 @@ var DeviceRecommendationSchema = object({
23656
24768
  enabled: boolean(),
23657
24769
  available: boolean(),
23658
24770
  chosen: DeviceModelChoiceSchema.nullable(),
24771
+ /** Present when the device is kept as is: Apply writes nothing on it. */
24772
+ kept: KeptReasonSchema.optional(),
23659
24773
  reasons: array(RecommendationReasonSchema).readonly()
23660
24774
  });
23661
24775
  var NodeRecommendationSchema = object({
@@ -23709,6 +24823,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
23709
24823
  kind: literal("coral-enabled"),
23710
24824
  nodeId: string(),
23711
24825
  deviceKey: string()
24826
+ }),
24827
+ object({
24828
+ kind: literal("custom-pin-kept"),
24829
+ nodeId: string(),
24830
+ deviceKey: string().nullable(),
24831
+ deviceId: number().nullable(),
24832
+ modelId: string()
24833
+ }),
24834
+ object({
24835
+ kind: literal("custom-registry-unreadable"),
24836
+ error: string()
23712
24837
  })
23713
24838
  ]);
23714
24839
  var AutoTuneOptionsSchema = object({
@@ -23887,13 +25012,14 @@ var SuggestSharesResultSchema = object({
23887
25012
  nodes: array(SuggestedNodeShareSchema).readonly()
23888
25013
  });
23889
25014
  /**
23890
- * Where the node and device shares come from (D750, D755).
23891
- * - `hardware` (default) — computed by the system from each node's static
23892
- * capacity (its accelerators at their Auto tune models, from the measured
23893
- * latency table), recomputed whenever a node or device joins, leaves, is
23894
- * switched on or off, or changes model. No load input.
23895
- * - `benchmark` — the same, from each node's measured capacity (node
23896
- * benchmark results); a node without results falls back to `hardware`.
25015
+ * Where the node and device shares come from (D750, D755, D791).
25016
+ * - `benchmark` (default since D791) — each node's capacity as its own node
25017
+ * benchmark measured it; a node without fresh results is sized from
25018
+ * `hardware` and says so. Measured on the node beats the table.
25019
+ * - `hardware` — computed from each node's static capacity only (its
25020
+ * accelerators at their Auto tune models, from the latency table).
25021
+ * Both are recomputed whenever a node or device joins, leaves, is switched
25022
+ * on or off, changes model, or a benchmark result is written. No load input.
23897
25023
  * - `manual` — the operator's stored sliders.
23898
25024
  * Either way a node or device that cannot take sessions gives its share to
23899
25025
  * the others in proportion; the stored values are never rewritten for that.
@@ -23942,6 +25068,362 @@ var EffectiveSharesSchema = object({
23942
25068
  nodeWeights: record(string(), number()),
23943
25069
  deviceWeights: record(string(), record(string(), number()))
23944
25070
  });
25071
+ /**
25072
+ * Wire shapes of the node benchmark (D791): the operator's plan, the
25073
+ * preflight the confirmation shows, the run the orchestrator owns, what the
25074
+ * measuring runner reports, and the result rows Auto tune and the automatic
25075
+ * shares read.
25076
+ *
25077
+ * ONE node at a time, owned by the pipeline orchestrator. While a run is
25078
+ * active the cluster is in BENCHMARK MODE for that node: it is not a
25079
+ * detection candidate, camera pins naming it are ignored so its sessions move
25080
+ * elsewhere, and both come back when the mode ends — after a crash or a hub
25081
+ * restart too (a persisted manifest, reconciled against the registry).
25082
+ *
25083
+ * Two measurements, both on the node, driven by its own runner (frames never
25084
+ * cross a process at frame rate, D9):
25085
+ * - `device` — one accelerator × one candidate detector, root only, open
25086
+ * loop: how many streams at the camera rate it carries inside the frame
25087
+ * interval;
25088
+ * - `pipeline` — the chosen detector plus the operator's detail steps
25089
+ * (faces, plates, classifiers, CLIP…), on varied frames from the bench
25090
+ * clip: how many parallel sessions the node carries before latency, drops,
25091
+ * CPU, RAM or the event loop give out.
25092
+ */
25093
+ /** Defaults and bounds, one place. */
25094
+ var NODE_BENCHMARK_DEFAULTS = {
25095
+ fpsPerStream: 10,
25096
+ budgetMinutes: 45,
25097
+ minBudgetMinutes: 10,
25098
+ maxBudgetMinutes: 120,
25099
+ /** A result older than this no longer beats the table. */
25100
+ staleAfterDays: 30,
25101
+ /** Warm-in per ramp step (not accounted). */
25102
+ settleSec: 5,
25103
+ /** Accounted window per ramp step. */
25104
+ measureSec: 20,
25105
+ /** Longest the drain may take before the run is refused. */
25106
+ drainTimeoutSec: 120,
25107
+ /** Candidate models per device in one run. */
25108
+ maxModelsPerDevice: 6
25109
+ };
25110
+ /** The two measurements a run can make. */
25111
+ var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
25112
+ var NodeBenchmarkDevicePlanSchema = object({
25113
+ /** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
25114
+ deviceKey: string().min(1),
25115
+ /**
25116
+ * Root detector candidates for the `device` measurement, in the order
25117
+ * measured. The FIRST is the one the `pipeline` measurement runs.
25118
+ */
25119
+ modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
25120
+ });
25121
+ /** What the operator confirmed. */
25122
+ var NodeBenchmarkPlanSchema = object({
25123
+ nodeId: string().min(1),
25124
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25125
+ /** Which measurements run. At least one. */
25126
+ phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
25127
+ /**
25128
+ * Detail steps (catalog step ids under the root: faces, plates,
25129
+ * classifiers, CLIP…) the `pipeline` measurement enables. The root
25130
+ * detector always runs.
25131
+ */
25132
+ steps: array(string().min(1)).default([]),
25133
+ /** Offered rate of one stream / session. */
25134
+ fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
25135
+ /** Hard deadline: the mode ends and the cluster is restored when it passes. */
25136
+ budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
25137
+ /** Keep the models the run downloaded (default: delete what was not installed before). */
25138
+ keepDownloadedModels: boolean().default(false),
25139
+ /** Start although the other nodes' capacity does not cover the sessions running now. */
25140
+ acceptInsufficientHeadroom: boolean().default(false)
25141
+ });
25142
+ var NodeBenchmarkRefusalSchema = object({
25143
+ kind: _enum([
25144
+ "benchmark-active",
25145
+ "node-offline",
25146
+ "unknown-device",
25147
+ "no-phase",
25148
+ "insufficient-headroom"
25149
+ ]),
25150
+ detail: string(),
25151
+ overridable: boolean()
25152
+ });
25153
+ /** A camera whose detection leaves the node for the run. */
25154
+ var NodeBenchmarkMovingCameraSchema = object({
25155
+ deviceId: number(),
25156
+ /** Placed on the node now (a standing attach or a running session). */
25157
+ placedOnNode: boolean(),
25158
+ /** A node pin naming this node, ignored for the run. */
25159
+ pinnedToNode: boolean()
25160
+ });
25161
+ /** A camera that cannot leave: no other node can obtain its frames. */
25162
+ var NodeBenchmarkStayingCameraSchema = object({
25163
+ deviceId: number(),
25164
+ reason: literal("only-frame-source")
25165
+ });
25166
+ var NodeBenchmarkPreflightSchema = object({
25167
+ nodeId: string(),
25168
+ online: boolean(),
25169
+ moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
25170
+ /** Keep running on the node during the run; the result is flagged contaminated. */
25171
+ staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
25172
+ estimatedDurationMs: number(),
25173
+ /** The run ends and the cluster is restored at the latest after this long. */
25174
+ budgetMs: number(),
25175
+ phases: array(NodeBenchmarkPhaseSchema).readonly(),
25176
+ steps: array(string()).readonly(),
25177
+ devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
25178
+ /** Parallel sessions the cluster runs now, and what the other nodes can carry. */
25179
+ headroom: object({
25180
+ sessionsNow: number(),
25181
+ otherNodesCapacitySessions: number().nullable()
25182
+ }),
25183
+ refusals: array(NodeBenchmarkRefusalSchema).readonly(),
25184
+ canStart: boolean()
25185
+ });
25186
+ /** Where the measuring runner is. */
25187
+ var NodeBenchProgressSchema = object({
25188
+ phase: _enum([
25189
+ "preparing",
25190
+ "device",
25191
+ "pipeline",
25192
+ "cleanup"
25193
+ ]),
25194
+ deviceKey: string().nullable(),
25195
+ modelId: string().nullable(),
25196
+ /** Streams (device) or sessions (pipeline) of the step running now. */
25197
+ load: number().nullable(),
25198
+ cellsDone: number(),
25199
+ cellsTotal: number(),
25200
+ message: string()
25201
+ });
25202
+ /** What limited a ramp. `none` = the ramp ran out of steps still passing. */
25203
+ var NodeBenchLimitSchema = _enum([
25204
+ "p95",
25205
+ "drops",
25206
+ "errors",
25207
+ "stall",
25208
+ "cpu",
25209
+ "ram",
25210
+ "none"
25211
+ ]);
25212
+ var NodeBenchRampStepSchema = object({
25213
+ load: number(),
25214
+ pass: boolean(),
25215
+ p95Ms: number(),
25216
+ dropRatio: number(),
25217
+ /** Completed frames per second over the accounted window. */
25218
+ fps: number(),
25219
+ cpuPct: number().nullable(),
25220
+ ramFreePct: number().nullable(),
25221
+ failReasons: array(string()).readonly()
25222
+ });
25223
+ var NodeBenchCellSchema = discriminatedUnion("phase", [object({
25224
+ phase: literal("device"),
25225
+ deviceKey: string(),
25226
+ modelId: string(),
25227
+ /** Single-stream latency (the K = 1 step). */
25228
+ p50Ms: number(),
25229
+ p95Ms: number(),
25230
+ p99Ms: number(),
25231
+ /** Frames per second sustained at the last passing step. */
25232
+ fps: number(),
25233
+ /** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
25234
+ kMax: number(),
25235
+ limitedBy: NodeBenchLimitSchema,
25236
+ /** First call (model load + warm-up). */
25237
+ warmupMs: number(),
25238
+ ramp: array(NodeBenchRampStepSchema).readonly()
25239
+ }), object({
25240
+ phase: literal("pipeline"),
25241
+ deviceKey: string(),
25242
+ modelId: string(),
25243
+ steps: array(string()).readonly(),
25244
+ /** Parallel sessions at the camera rate the node carried; 0 = not even one. */
25245
+ maxSessions: number(),
25246
+ limitedBy: NodeBenchLimitSchema,
25247
+ /** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
25248
+ stepsFired: array(string()).readonly(),
25249
+ warmupMs: number(),
25250
+ ramp: array(NodeBenchRampStepSchema).readonly()
25251
+ })]);
25252
+ /**
25253
+ * What a result was measured ON. A result whose fingerprint no longer matches
25254
+ * the node no longer beats the table.
25255
+ */
25256
+ var NodeBenchFingerprintSchema = object({
25257
+ pipelineVersion: string().nullable(),
25258
+ cpuModel: string().nullable(),
25259
+ ramGb: number().nullable(),
25260
+ os: string().nullable(),
25261
+ /** Per device: the pool the cells ran on (runtime + tuning). */
25262
+ pools: record(string(), object({
25263
+ runtime: string(),
25264
+ numWorkers: number(),
25265
+ concurrency: number(),
25266
+ batchMode: string()
25267
+ })).default({})
25268
+ });
25269
+ /** The frames the run used. */
25270
+ var NodeBenchClipSchema = object({
25271
+ /** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
25272
+ id: string(),
25273
+ revision: string().nullable(),
25274
+ frames: number(),
25275
+ width: number(),
25276
+ height: number()
25277
+ });
25278
+ var NodeBenchRunnerInputSchema = object({
25279
+ runId: string().min(1),
25280
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25281
+ phases: array(NodeBenchmarkPhaseSchema).min(1),
25282
+ /** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
25283
+ steps: array(string()).default([]),
25284
+ fpsPerStream: number().int().min(1).max(30),
25285
+ /** The runner stops on its own past this instant, whatever the hub does. */
25286
+ deadlineAtMs: number(),
25287
+ settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
25288
+ measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
25289
+ keepDownloadedModels: boolean().default(false)
25290
+ });
25291
+ var NodeBenchRunnerStateSchema = _enum([
25292
+ "running",
25293
+ "done",
25294
+ "failed",
25295
+ "aborted"
25296
+ ]);
25297
+ var NodeBenchRunnerStatusSchema = object({
25298
+ runId: string(),
25299
+ nodeId: string(),
25300
+ state: NodeBenchRunnerStateSchema,
25301
+ progress: NodeBenchProgressSchema.nullable(),
25302
+ /** Every finished cell so far — a run stopped half way keeps what it measured. */
25303
+ cells: array(NodeBenchCellSchema).readonly(),
25304
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25305
+ clip: NodeBenchClipSchema.nullable(),
25306
+ /** Cameras seen running on the node during the run (they share its pools). */
25307
+ activeCameraIds: array(number()).readonly(),
25308
+ /** Models the run downloaded and then deleted (not installed before). */
25309
+ deletedModels: array(string()).readonly(),
25310
+ error: string().nullable(),
25311
+ startedAtMs: number(),
25312
+ finishedAtMs: number().nullable()
25313
+ });
25314
+ var NodeBenchmarkStateSchema = _enum([
25315
+ "draining",
25316
+ "measuring",
25317
+ "restoring",
25318
+ "done",
25319
+ "failed",
25320
+ "aborted"
25321
+ ]);
25322
+ /** Why a run ended. */
25323
+ var NodeBenchmarkEndReasonSchema = _enum([
25324
+ "completed",
25325
+ "operator-abort",
25326
+ "deadline",
25327
+ "node-lost",
25328
+ "runner-lost",
25329
+ "hub-restart",
25330
+ "drain-timeout",
25331
+ "failed"
25332
+ ]);
25333
+ var NodeBenchmarkRunSchema = object({
25334
+ runId: string(),
25335
+ nodeId: string(),
25336
+ state: NodeBenchmarkStateSchema,
25337
+ plan: NodeBenchmarkPlanSchema,
25338
+ startedAtMs: number(),
25339
+ deadlineAtMs: number(),
25340
+ finishedAtMs: number().nullable(),
25341
+ endReason: NodeBenchmarkEndReasonSchema.nullable(),
25342
+ error: string().nullable(),
25343
+ /** Cameras moved off the node for the run. */
25344
+ moved: array(number()).readonly(),
25345
+ /** Cameras that stayed (their only frame source is the node). */
25346
+ staying: array(number()).readonly(),
25347
+ /** Something else ran on the node's pools during the run. */
25348
+ contaminated: boolean(),
25349
+ progress: NodeBenchProgressSchema.nullable(),
25350
+ resultIds: array(string()).readonly()
25351
+ });
25352
+ /** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
25353
+ var NodeBenchmarkStatusSchema = object({
25354
+ /** The node the cluster is in benchmark mode for; null = none. */
25355
+ modeNodeId: string().nullable(),
25356
+ run: NodeBenchmarkRunSchema.nullable()
25357
+ });
25358
+ /**
25359
+ * One stored measurement — the only authority Auto tune and the automatic
25360
+ * shares read measured capacity from. Written by the orchestrator when a run
25361
+ * ends, never by anyone else.
25362
+ */
25363
+ var NodeBenchmarkResultSchema = object({
25364
+ id: string(),
25365
+ runId: string(),
25366
+ nodeId: string(),
25367
+ cell: NodeBenchCellSchema,
25368
+ fpsPerStream: number(),
25369
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25370
+ clip: NodeBenchClipSchema.nullable(),
25371
+ /** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
25372
+ contaminated: boolean(),
25373
+ stayingCameras: array(number()).readonly(),
25374
+ /** The run ended early; the cell itself completed. */
25375
+ partialRun: boolean(),
25376
+ measuredAtMs: number()
25377
+ });
25378
+ var ListNodeBenchmarkResultsInputSchema = object({
25379
+ nodeId: string().optional(),
25380
+ deviceKey: string().optional()
25381
+ });
25382
+ /** A result with its standing today: does it still beat the table? */
25383
+ var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
25384
+ /** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
25385
+ standing: _enum([
25386
+ "fresh",
25387
+ "stale",
25388
+ "superseded"
25389
+ ]),
25390
+ staleWhy: _enum([
25391
+ "age",
25392
+ "runtime",
25393
+ "pool-tuning"
25394
+ ]).nullable()
25395
+ });
25396
+ object({
25397
+ runId: string(),
25398
+ nodeId: string(),
25399
+ startedAtMs: number(),
25400
+ deadlineAtMs: number(),
25401
+ plan: NodeBenchmarkPlanSchema,
25402
+ moved: array(number()).readonly(),
25403
+ staying: array(number()).readonly()
25404
+ });
25405
+ /** Candidate detectors per device, for the plan editor. */
25406
+ var NodeBenchmarkCandidatesSchema = object({
25407
+ nodeId: string(),
25408
+ reachable: boolean(),
25409
+ devices: array(object({
25410
+ deviceKey: string(),
25411
+ enabled: boolean(),
25412
+ available: boolean(),
25413
+ /** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
25414
+ suggested: array(string()).readonly(),
25415
+ /** Every root detector the device has a build for. */
25416
+ all: array(string()).readonly(),
25417
+ /** The model the device runs now, when pinned. */
25418
+ currentModelId: string().nullable()
25419
+ })).readonly(),
25420
+ /** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
25421
+ steps: array(object({
25422
+ id: string(),
25423
+ name: string(),
25424
+ slot: string()
25425
+ })).readonly()
25426
+ });
23945
25427
  object({
23946
25428
  activeCameras: number(),
23947
25429
  throttledCameras: number(),
@@ -25030,7 +26512,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
25030
26512
  }), ParkedTrackFrameSchema.nullable()), method(object({
25031
26513
  deviceId: number(),
25032
26514
  trackId: string()
25033
- }), object({ released: number().int().nonnegative() }), { kind: "mutation" });
26515
+ }), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
26516
+ accepted: literal(true),
26517
+ runId: string()
26518
+ }), {
26519
+ kind: "mutation",
26520
+ auth: "admin"
26521
+ }), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
26522
+ kind: "mutation",
26523
+ auth: "admin"
26524
+ });
25034
26525
  var CameraPipelineConfigSchema = object({
25035
26526
  engine: PipelineEngineChoiceSchema.optional(),
25036
26527
  steps: array(PipelineStepInputSchema).readonly(),
@@ -25669,6 +27160,21 @@ method(object({
25669
27160
  }), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
25670
27161
  kind: "mutation",
25671
27162
  auth: "admin"
27163
+ }), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
27164
+ kind: literal("started"),
27165
+ runId: string()
27166
+ }), object({
27167
+ kind: literal("refused"),
27168
+ preflight: NodeBenchmarkPreflightSchema
27169
+ })]), {
27170
+ kind: "mutation",
27171
+ auth: "admin"
27172
+ }), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
27173
+ kind: "mutation",
27174
+ auth: "admin"
27175
+ }), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
27176
+ kind: "mutation",
27177
+ auth: "admin"
25672
27178
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
25673
27179
  deviceId: number(),
25674
27180
  addonId: string(),
@@ -30750,6 +32256,9 @@ var CreateIntegrationInputSchema = object({
30750
32256
  enabled: boolean().optional(),
30751
32257
  info: record(string(), unknown()).optional(),
30752
32258
  settings: record(string(), unknown()).optional(),
32259
+ /** Keys of `settings` the form's schema declares secret (by type) — kept in
32260
+ * the keychain, not the table (D787). */
32261
+ secretKeys: array(string()).optional(),
30753
32262
  skipRestart: boolean().optional()
30754
32263
  });
30755
32264
  var UpdateIntegrationInputSchema = object({
@@ -30773,7 +32282,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
30773
32282
  auth: "admin"
30774
32283
  }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
30775
32284
  id: string(),
30776
- settings: record(string(), unknown())
32285
+ settings: record(string(), unknown()),
32286
+ /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
32287
+ secretKeys: array(string()).optional()
30777
32288
  }), object({ success: boolean() }), {
30778
32289
  kind: "mutation",
30779
32290
  auth: "admin"
@@ -39539,6 +41050,90 @@ Object.freeze({
39539
41050
  addonId: null,
39540
41051
  access: "create"
39541
41052
  },
41053
+ "keychain.delete": {
41054
+ capName: "keychain",
41055
+ capScope: "system",
41056
+ addonId: null,
41057
+ access: "delete"
41058
+ },
41059
+ "keychain.getState": {
41060
+ capName: "keychain",
41061
+ capScope: "system",
41062
+ addonId: null,
41063
+ access: "view"
41064
+ },
41065
+ "keychain.listMeta": {
41066
+ capName: "keychain",
41067
+ capScope: "system",
41068
+ addonId: null,
41069
+ access: "view"
41070
+ },
41071
+ "keychain.put": {
41072
+ capName: "keychain",
41073
+ capScope: "system",
41074
+ addonId: null,
41075
+ access: "create"
41076
+ },
41077
+ "keychain.resolve": {
41078
+ capName: "keychain",
41079
+ capScope: "system",
41080
+ addonId: null,
41081
+ access: "view"
41082
+ },
41083
+ "keychainAdmin.deleteOrphans": {
41084
+ capName: "keychain-admin",
41085
+ capScope: "system",
41086
+ addonId: null,
41087
+ access: "delete"
41088
+ },
41089
+ "keychainAdmin.downloadRecoveryKey": {
41090
+ capName: "keychain-admin",
41091
+ capScope: "system",
41092
+ addonId: null,
41093
+ access: "create"
41094
+ },
41095
+ "keychainAdmin.listAudit": {
41096
+ capName: "keychain-admin",
41097
+ capScope: "system",
41098
+ addonId: null,
41099
+ access: "view"
41100
+ },
41101
+ "keychainAdmin.listSecrets": {
41102
+ capName: "keychain-admin",
41103
+ capScope: "system",
41104
+ addonId: null,
41105
+ access: "view"
41106
+ },
41107
+ "keychainAdmin.purgeRetiredKeys": {
41108
+ capName: "keychain-admin",
41109
+ capScope: "system",
41110
+ addonId: null,
41111
+ access: "delete"
41112
+ },
41113
+ "keychainAdmin.resetKeychain": {
41114
+ capName: "keychain-admin",
41115
+ capScope: "system",
41116
+ addonId: null,
41117
+ access: "delete"
41118
+ },
41119
+ "keychainAdmin.reveal": {
41120
+ capName: "keychain-admin",
41121
+ capScope: "system",
41122
+ addonId: null,
41123
+ access: "create"
41124
+ },
41125
+ "keychainAdmin.rotateMasterKey": {
41126
+ capName: "keychain-admin",
41127
+ capScope: "system",
41128
+ addonId: null,
41129
+ access: "create"
41130
+ },
41131
+ "keychainAdmin.status": {
41132
+ capName: "keychain-admin",
41133
+ capScope: "system",
41134
+ addonId: null,
41135
+ access: "view"
41136
+ },
39542
41137
  "lawnMowerControl.dock": {
39543
41138
  capName: "lawn-mower-control",
39544
41139
  capScope: "device",
@@ -40913,6 +42508,18 @@ Object.freeze({
40913
42508
  addonId: null,
40914
42509
  access: "create"
40915
42510
  },
42511
+ "pipelineAnalytics.addRetrainFrameFromRecording": {
42512
+ capName: "pipeline-analytics",
42513
+ capScope: "device",
42514
+ addonId: null,
42515
+ access: "create"
42516
+ },
42517
+ "pipelineAnalytics.addRetrainFramesToCollection": {
42518
+ capName: "pipeline-analytics",
42519
+ capScope: "device",
42520
+ addonId: null,
42521
+ access: "create"
42522
+ },
40916
42523
  "pipelineAnalytics.applyDeviceSettingsPatch": {
40917
42524
  capName: "pipeline-analytics",
40918
42525
  capScope: "device",
@@ -40961,12 +42568,24 @@ Object.freeze({
40961
42568
  addonId: null,
40962
42569
  access: "view"
40963
42570
  },
42571
+ "pipelineAnalytics.createRetrainCollection": {
42572
+ capName: "pipeline-analytics",
42573
+ capScope: "device",
42574
+ addonId: null,
42575
+ access: "create"
42576
+ },
40964
42577
  "pipelineAnalytics.deleteDeviceEvents": {
40965
42578
  capName: "pipeline-analytics",
40966
42579
  capScope: "device",
40967
42580
  addonId: null,
40968
42581
  access: "delete"
40969
42582
  },
42583
+ "pipelineAnalytics.deleteRetrainCollection": {
42584
+ capName: "pipeline-analytics",
42585
+ capScope: "device",
42586
+ addonId: null,
42587
+ access: "delete"
42588
+ },
40970
42589
  "pipelineAnalytics.deleteTracks": {
40971
42590
  capName: "pipeline-analytics",
40972
42591
  capScope: "device",
@@ -41171,6 +42790,24 @@ Object.freeze({
41171
42790
  addonId: null,
41172
42791
  access: "view"
41173
42792
  },
42793
+ "pipelineAnalytics.listRetrainAssistProfiles": {
42794
+ capName: "pipeline-analytics",
42795
+ capScope: "device",
42796
+ addonId: null,
42797
+ access: "view"
42798
+ },
42799
+ "pipelineAnalytics.listRetrainCollectionFrames": {
42800
+ capName: "pipeline-analytics",
42801
+ capScope: "device",
42802
+ addonId: null,
42803
+ access: "view"
42804
+ },
42805
+ "pipelineAnalytics.listRetrainCollections": {
42806
+ capName: "pipeline-analytics",
42807
+ capScope: "device",
42808
+ addonId: null,
42809
+ access: "view"
42810
+ },
41174
42811
  "pipelineAnalytics.listRetrainFrames": {
41175
42812
  capName: "pipeline-analytics",
41176
42813
  capScope: "device",
@@ -41219,6 +42856,12 @@ Object.freeze({
41219
42856
  addonId: null,
41220
42857
  access: "create"
41221
42858
  },
42859
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
42860
+ capName: "pipeline-analytics",
42861
+ capScope: "device",
42862
+ addonId: null,
42863
+ access: "create"
42864
+ },
41222
42865
  "pipelineAnalytics.pruneEvents": {
41223
42866
  capName: "pipeline-analytics",
41224
42867
  capScope: "device",
@@ -41273,6 +42916,18 @@ Object.freeze({
41273
42916
  addonId: null,
41274
42917
  access: "create"
41275
42918
  },
42919
+ "pipelineAnalytics.removeRetrainFrameFromCollection": {
42920
+ capName: "pipeline-analytics",
42921
+ capScope: "device",
42922
+ addonId: null,
42923
+ access: "delete"
42924
+ },
42925
+ "pipelineAnalytics.renameRetrainCollection": {
42926
+ capName: "pipeline-analytics",
42927
+ capScope: "device",
42928
+ addonId: null,
42929
+ access: "create"
42930
+ },
41276
42931
  "pipelineAnalytics.restageRetrainTrack": {
41277
42932
  capName: "pipeline-analytics",
41278
42933
  capScope: "device",
@@ -41561,6 +43216,12 @@ Object.freeze({
41561
43216
  addonId: null,
41562
43217
  access: "view"
41563
43218
  },
43219
+ "pipelineOrchestrator.abortNodeBenchmark": {
43220
+ capName: "pipeline-orchestrator",
43221
+ capScope: "system",
43222
+ addonId: null,
43223
+ access: "create"
43224
+ },
41564
43225
  "pipelineOrchestrator.applyAutoTune": {
41565
43226
  capName: "pipeline-orchestrator",
41566
43227
  capScope: "system",
@@ -41585,6 +43246,12 @@ Object.freeze({
41585
43246
  addonId: null,
41586
43247
  access: "create"
41587
43248
  },
43249
+ "pipelineOrchestrator.deleteNodeBenchmarkResult": {
43250
+ capName: "pipeline-orchestrator",
43251
+ capScope: "system",
43252
+ addonId: null,
43253
+ access: "delete"
43254
+ },
41588
43255
  "pipelineOrchestrator.getAgentLoad": {
41589
43256
  capName: "pipeline-orchestrator",
41590
43257
  capScope: "system",
@@ -41693,6 +43360,24 @@ Object.freeze({
41693
43360
  addonId: null,
41694
43361
  access: "view"
41695
43362
  },
43363
+ "pipelineOrchestrator.getNodeBenchmarkCandidates": {
43364
+ capName: "pipeline-orchestrator",
43365
+ capScope: "system",
43366
+ addonId: null,
43367
+ access: "view"
43368
+ },
43369
+ "pipelineOrchestrator.getNodeBenchmarkPreflight": {
43370
+ capName: "pipeline-orchestrator",
43371
+ capScope: "system",
43372
+ addonId: null,
43373
+ access: "view"
43374
+ },
43375
+ "pipelineOrchestrator.getNodeBenchmarkStatus": {
43376
+ capName: "pipeline-orchestrator",
43377
+ capScope: "system",
43378
+ addonId: null,
43379
+ access: "view"
43380
+ },
41696
43381
  "pipelineOrchestrator.getNodeInferenceDevices": {
41697
43382
  capName: "pipeline-orchestrator",
41698
43383
  capScope: "system",
@@ -41735,6 +43420,12 @@ Object.freeze({
41735
43420
  addonId: null,
41736
43421
  access: "view"
41737
43422
  },
43423
+ "pipelineOrchestrator.listNodeBenchmarkResults": {
43424
+ capName: "pipeline-orchestrator",
43425
+ capScope: "system",
43426
+ addonId: null,
43427
+ access: "view"
43428
+ },
41738
43429
  "pipelineOrchestrator.pauseForStorageMigration": {
41739
43430
  capName: "pipeline-orchestrator",
41740
43431
  capScope: "system",
@@ -41879,6 +43570,12 @@ Object.freeze({
41879
43570
  addonId: null,
41880
43571
  access: "create"
41881
43572
  },
43573
+ "pipelineOrchestrator.startNodeBenchmark": {
43574
+ capName: "pipeline-orchestrator",
43575
+ capScope: "system",
43576
+ addonId: null,
43577
+ access: "create"
43578
+ },
41882
43579
  "pipelineOrchestrator.suggestShares": {
41883
43580
  capName: "pipeline-orchestrator",
41884
43581
  capScope: "system",
@@ -41897,6 +43594,12 @@ Object.freeze({
41897
43594
  addonId: null,
41898
43595
  access: "create"
41899
43596
  },
43597
+ "pipelineRunner.abortNodeBench": {
43598
+ capName: "pipeline-runner",
43599
+ capScope: "system",
43600
+ addonId: null,
43601
+ access: "create"
43602
+ },
41900
43603
  "pipelineRunner.attachCamera": {
41901
43604
  capName: "pipeline-runner",
41902
43605
  capScope: "system",
@@ -41945,6 +43648,12 @@ Object.freeze({
41945
43648
  addonId: null,
41946
43649
  access: "view"
41947
43650
  },
43651
+ "pipelineRunner.getNodeBenchStatus": {
43652
+ capName: "pipeline-runner",
43653
+ capScope: "system",
43654
+ addonId: null,
43655
+ access: "view"
43656
+ },
41948
43657
  "pipelineRunner.getParkedTrackFrame": {
41949
43658
  capName: "pipeline-runner",
41950
43659
  capScope: "system",
@@ -41987,6 +43696,12 @@ Object.freeze({
41987
43696
  addonId: null,
41988
43697
  access: "create"
41989
43698
  },
43699
+ "pipelineRunner.startNodeBench": {
43700
+ capName: "pipeline-runner",
43701
+ capScope: "system",
43702
+ addonId: null,
43703
+ access: "create"
43704
+ },
41990
43705
  "plateGallery.assignPlate": {
41991
43706
  capName: "plate-gallery",
41992
43707
  capScope: "system",
@@ -46916,6 +48631,11 @@ Object.freeze({
46916
48631
  form: "single",
46917
48632
  optional: false
46918
48633
  }],
48634
+ "pipelineAnalytics.addRetrainFrameFromRecording": [{
48635
+ name: "deviceId",
48636
+ form: "single",
48637
+ optional: false
48638
+ }],
46919
48639
  "pipelineAnalytics.applyDeviceSettingsPatch": [{
46920
48640
  name: "deviceId",
46921
48641
  form: "single",
@@ -47106,6 +48826,11 @@ Object.freeze({
47106
48826
  form: "single",
47107
48827
  optional: false
47108
48828
  }],
48829
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
48830
+ name: "deviceId",
48831
+ form: "single",
48832
+ optional: false
48833
+ }],
47109
48834
  "pipelineAnalytics.pruneEventsBefore": [{
47110
48835
  name: "deviceId",
47111
48836
  form: "single",