@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.
@@ -1,7 +1,7 @@
1
1
  import * as fs from "node:fs/promises";
2
2
  import * as os from "node:os";
3
3
  import * as path from "node:path";
4
- //#region ../types/dist/event-category-B_0XEcLF.mjs
4
+ //#region ../types/dist/event-category-DaIZi00R.mjs
5
5
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
6
6
  EventCategory["SystemBoot"] = "system.boot";
7
7
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -80,6 +80,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
80
80
  */
81
81
  EventCategory["AddonLoadFailed"] = "addon.load-failed";
82
82
  /**
83
+ * A keychain value was stored or removed (D787). Carries the ref, its
84
+ * owner and the new version — NEVER the value. A process holding the ref
85
+ * drops its cached copy and the owning `BaseAddon` re-resolves its config.
86
+ * Telemetry (D8): a process that misses it still revalidates by version.
87
+ */
88
+ EventCategory["KeychainChanged"] = "keychain.changed";
89
+ /**
83
90
  * Addon recovered from a previous failure. Emitted when an addon
84
91
  * transitions from `failed` back to `healthy` (typically via the
85
92
  * monitor's auto-retry loop, or after manual `addons.retryLoad`).
@@ -5372,7 +5379,7 @@ var ZodIssueCode = {
5372
5379
  var ZodFirstPartyTypeKind;
5373
5380
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5374
5381
  //#endregion
5375
- //#region ../types/dist/sleep-B0JG7-_F.mjs
5382
+ //#region ../types/dist/sleep-Cr5YOk3m.mjs
5376
5383
  /**
5377
5384
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5378
5385
  * window to float samples (D455).
@@ -5451,6 +5458,97 @@ function buildAlawTable() {
5451
5458
  }
5452
5459
  buildUlawTable();
5453
5460
  buildAlawTable();
5461
+ /** Is this field's stored value a credential? */
5462
+ function isSecretConfigField(field) {
5463
+ if (field.type === "password") return true;
5464
+ return "secret" in field && field.secret === true;
5465
+ }
5466
+ /**
5467
+ * Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
5468
+ * by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
5469
+ */
5470
+ function isKeychainStoredField(field) {
5471
+ if (!isSecretConfigField(field)) return false;
5472
+ if (field.type === "textarea" && field.isJson === true) return false;
5473
+ return !("storage" in field && field.storage === "inline");
5474
+ }
5475
+ /**
5476
+ * What a settings blob holds where a secret used to be.
5477
+ *
5478
+ * A keychain-stored field never holds its value. It holds a self-describing
5479
+ * MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
5480
+ * code can mistake it for a credential and no form can send it to a camera as
5481
+ * a password. The empty state is `null` / absent, never `''`.
5482
+ *
5483
+ * The same shapes travel to and from the admin UI:
5484
+ *
5485
+ * - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
5486
+ * (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
5487
+ * value is set, never the value.
5488
+ * - write: an untouched field submits the view back unchanged (KEEP); a typed
5489
+ * value is a plain non-empty string (CHANGE); the Clear button submits
5490
+ * {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
5491
+ * are KEEP — an empty string is what a defaults-fallback pushes back, and
5492
+ * treating it as "clear" is how a save destroyed a stored credential before.
5493
+ *
5494
+ * Pure and browser-safe.
5495
+ */
5496
+ var SECRET_CLEAR = { $secretClear: true };
5497
+ /** The `'***'` token D634 redaction writes for non-admins. */
5498
+ var LEGACY_DEVICE_REDACTION = "***";
5499
+ function isRecord$1(value) {
5500
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5501
+ }
5502
+ function makeSecretMarker(ref) {
5503
+ return {
5504
+ $secret: ref,
5505
+ v: 1
5506
+ };
5507
+ }
5508
+ /** A stored marker: an object whose `$secret` is a non-empty string. */
5509
+ function isSecretMarker(value) {
5510
+ if (!isRecord$1(value)) return false;
5511
+ const ref = value["$secret"];
5512
+ return typeof ref === "string" && ref.length > 0;
5513
+ }
5514
+ function isSecretClear(value) {
5515
+ return isRecord$1(value) && value["$secretClear"] === true;
5516
+ }
5517
+ /**
5518
+ * The UI view of a stored secret field value: a marker becomes "set", inline
5519
+ * plaintext becomes "set (inline)", nothing becomes `null`. A value never
5520
+ * survives this function.
5521
+ */
5522
+ function toSecretFieldView(stored) {
5523
+ if (isSecretMarker(stored)) return {
5524
+ $secret: stored.$secret,
5525
+ v: 1,
5526
+ set: true
5527
+ };
5528
+ if (typeof stored === "string" && stored.length > 0) return {
5529
+ $secret: null,
5530
+ v: 1,
5531
+ set: true,
5532
+ inline: true
5533
+ };
5534
+ return null;
5535
+ }
5536
+ /**
5537
+ * Classify an incoming value for a secret path. Only a non-empty string that is
5538
+ * not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
5539
+ * Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
5540
+ * `undefined`, a redaction token, a non-string — keeps what is stored.
5541
+ */
5542
+ function classifySecretWrite(incoming) {
5543
+ if (isSecretClear(incoming)) return { kind: "clear" };
5544
+ if (typeof incoming !== "string") return { kind: "keep" };
5545
+ if (incoming.length === 0) return { kind: "keep" };
5546
+ if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
5547
+ return {
5548
+ kind: "set",
5549
+ value: incoming
5550
+ };
5551
+ }
5454
5552
  Object.fromEntries([
5455
5553
  {
5456
5554
  id: "overview",
@@ -5622,33 +5720,19 @@ Object.fromEntries([
5622
5720
  function isValuelessField(field) {
5623
5721
  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";
5624
5722
  }
5625
- /**
5626
- * Merge a `ConfigUISchema` with a raw `values` record into a
5627
- * `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
5628
- * before returning to the admin UI. Groups are walked recursively.
5629
- *
5630
- * For each leaf field:
5631
- * - structural fields (`separator`, `info`, `button`) pass through unchanged
5632
- * - other fields get `value = values[key] ?? field.default ?? null`
5633
- *
5634
- * Unknown keys in `values` (keys not declared in the schema) are silently
5635
- * ignored — they don't contribute to the output. Missing keys fall back to
5636
- * the schema default or `null`. This mirrors the old backend behaviour where
5637
- * `FormBuilder` rendered `values[key] ?? field.default`.
5638
- */
5639
- function hydrateSchema(schema, values) {
5723
+ function hydrateSchema(schema, values, options = {}) {
5640
5724
  return {
5641
5725
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
5642
5726
  sections: schema.sections.map((section) => ({
5643
5727
  ...section,
5644
- fields: section.fields.map((field) => hydrateField(field, values))
5728
+ fields: section.fields.map((field) => hydrateField(field, values, options))
5645
5729
  }))
5646
5730
  };
5647
5731
  }
5648
- function hydrateField(field, values) {
5732
+ function hydrateField(field, values, options) {
5649
5733
  if (isValuelessField(field)) return field;
5650
5734
  if (field.type === "group") {
5651
- const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
5735
+ const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
5652
5736
  return {
5653
5737
  ...field,
5654
5738
  fields: hydratedChildren
@@ -5657,7 +5741,7 @@ function hydrateField(field, values) {
5657
5741
  if (field.type === "sub-tabs") {
5658
5742
  const hydratedTabs = field.tabs.map((tab) => ({
5659
5743
  ...tab,
5660
- fields: tab.fields.map((child) => hydrateField(child, values))
5744
+ fields: tab.fields.map((child) => hydrateField(child, values, options))
5661
5745
  }));
5662
5746
  return {
5663
5747
  ...field,
@@ -5667,6 +5751,33 @@ function hydrateField(field, values) {
5667
5751
  const key = field.key;
5668
5752
  const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
5669
5753
  const defaultValue = field.default;
5754
+ const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
5755
+ if (isKeychainStoredField(field) && asView(storedValue)) return {
5756
+ ...field,
5757
+ value: toSecretFieldView(storedValue)
5758
+ };
5759
+ if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
5760
+ ...field,
5761
+ value: null
5762
+ };
5763
+ if (field.type === "editable-array" && Array.isArray(storedValue)) {
5764
+ const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
5765
+ if (secretItemKeys.length > 0) {
5766
+ const rows = storedValue.map((row) => {
5767
+ if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
5768
+ const out = { ...row };
5769
+ for (const k of secretItemKeys) {
5770
+ const v = Reflect.get(row, k);
5771
+ if (asView(v)) out[k] = toSecretFieldView(v);
5772
+ }
5773
+ return out;
5774
+ });
5775
+ return {
5776
+ ...field,
5777
+ value: rows
5778
+ };
5779
+ }
5780
+ }
5670
5781
  if (field.multiple) {
5671
5782
  const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
5672
5783
  const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
@@ -5909,6 +6020,431 @@ function projectStore(store, perNodeKeys, nodeId) {
5909
6020
  }
5910
6021
  return out;
5911
6022
  }
6023
+ var GLOBAL_SCOPE = { kind: "global" };
6024
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6025
+ function globalSecretScope() {
6026
+ return GLOBAL_SCOPE;
6027
+ }
6028
+ function encodeSegment(value) {
6029
+ return encodeURIComponent(value);
6030
+ }
6031
+ /**
6032
+ * The field path of a value inside an array item, addressed by the item's id:
6033
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6034
+ * `providers[authentik].clientSecret`.
6035
+ */
6036
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6037
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6038
+ }
6039
+ /** A write to a secret path could not be stored in the keychain, so it was refused. */
6040
+ var KeychainWriteRefusedError = class extends Error {
6041
+ fieldPath;
6042
+ constructor(fieldPath, cause) {
6043
+ super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
6044
+ this.fieldPath = fieldPath;
6045
+ this.name = "KeychainWriteRefusedError";
6046
+ }
6047
+ };
6048
+ var KEEP = { kind: "keep" };
6049
+ function isRecord(value) {
6050
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6051
+ }
6052
+ function defaultMintId() {
6053
+ return globalThis.crypto.randomUUID();
6054
+ }
6055
+ /** Every marker ref anywhere under `value`. */
6056
+ function collectSecretMarkerRefs(value, out = []) {
6057
+ if (isSecretMarker(value)) {
6058
+ out.push(value.$secret);
6059
+ return out;
6060
+ }
6061
+ if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6062
+ else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6063
+ return out;
6064
+ }
6065
+ async function storedValueEquals(secrets, marker, candidate) {
6066
+ const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
6067
+ return resolved?.kind === "value" && resolved.value === candidate;
6068
+ }
6069
+ async function writeLeaf(ctx, incoming, stored, fieldPath) {
6070
+ const intent = classifySecretWrite(incoming);
6071
+ const ref = ctx.secrets.ref(ctx.scope, fieldPath);
6072
+ const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
6073
+ if (intent.kind === "keep") return KEEP;
6074
+ if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
6075
+ if (intent.kind === "clear") {
6076
+ if (storedIsOurs) ctx.deletes.push(ref);
6077
+ return {
6078
+ kind: "value",
6079
+ value: null
6080
+ };
6081
+ }
6082
+ if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
6083
+ kind: "value",
6084
+ value: stored
6085
+ };
6086
+ try {
6087
+ await ctx.secrets.put(ref, intent.value);
6088
+ } catch (err) {
6089
+ throw new KeychainWriteRefusedError(fieldPath, err);
6090
+ }
6091
+ return {
6092
+ kind: "value",
6093
+ value: makeSecretMarker(ref)
6094
+ };
6095
+ }
6096
+ /** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
6097
+ function applyMember(out, key, result, storedParent) {
6098
+ if (result.kind === "value") {
6099
+ out[key] = result.value;
6100
+ return;
6101
+ }
6102
+ if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
6103
+ else delete out[key];
6104
+ }
6105
+ async function writeMembers(ctx, children, incoming, stored, pathOf) {
6106
+ const out = { ...incoming };
6107
+ for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
6108
+ return out;
6109
+ }
6110
+ function rowId(row, idKey) {
6111
+ const raw = row[idKey];
6112
+ if (typeof raw === "string" && raw.length > 0) return raw;
6113
+ if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
6114
+ return null;
6115
+ }
6116
+ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6117
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6118
+ if (!Array.isArray(incoming)) {
6119
+ ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6120
+ return {
6121
+ kind: "value",
6122
+ value: incoming
6123
+ };
6124
+ }
6125
+ const storedById = /* @__PURE__ */ new Map();
6126
+ for (const row of storedRows) {
6127
+ const id = rowId(row, node.idKey);
6128
+ if (id !== null) storedById.set(id, row);
6129
+ }
6130
+ const kept = /* @__PURE__ */ new Set();
6131
+ const rows = [];
6132
+ for (const row of incoming) {
6133
+ if (!isRecord(row)) {
6134
+ rows.push(row);
6135
+ continue;
6136
+ }
6137
+ const id = rowId(row, node.idKey) ?? ctx.mintId();
6138
+ kept.add(id);
6139
+ const withId = {
6140
+ ...row,
6141
+ [node.idKey]: row[node.idKey] ?? id
6142
+ };
6143
+ if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
6144
+ const storedRow = storedById.get(id) ?? {};
6145
+ rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
6146
+ }
6147
+ for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
6148
+ return {
6149
+ kind: "value",
6150
+ value: rows
6151
+ };
6152
+ }
6153
+ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6154
+ switch (node.kind) {
6155
+ case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6156
+ case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6157
+ case "object": {
6158
+ if (!isRecord(incoming)) {
6159
+ if (incoming === void 0) return KEEP;
6160
+ ctx.deletes.push(...collectSecretMarkerRefs(stored));
6161
+ return {
6162
+ kind: "value",
6163
+ value: incoming
6164
+ };
6165
+ }
6166
+ const storedObj = isRecord(stored) ? stored : {};
6167
+ return {
6168
+ kind: "value",
6169
+ value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
6170
+ };
6171
+ }
6172
+ }
6173
+ }
6174
+ /** Split a perNode-scoped key (`key@nodeId`). */
6175
+ function splitNodeKey(key) {
6176
+ const at = key.indexOf("@");
6177
+ return at <= 0 ? {
6178
+ base: key,
6179
+ nodeId: null
6180
+ } : {
6181
+ base: key.slice(0, at),
6182
+ nodeId: key.slice(at + 1)
6183
+ };
6184
+ }
6185
+ /** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
6186
+ async function transformSecretWrite(input) {
6187
+ const deletes = [];
6188
+ const base = {
6189
+ secrets: input.secrets,
6190
+ mintId: input.mintId ?? defaultMintId,
6191
+ deletes,
6192
+ operatorWrite: input.operatorWrite === true
6193
+ };
6194
+ const out = {};
6195
+ for (const [key, incoming] of Object.entries(input.patch)) {
6196
+ const { base: baseKey, nodeId } = splitNodeKey(key);
6197
+ const node = input.tree.get(baseKey);
6198
+ if (node === void 0) {
6199
+ out[key] = incoming;
6200
+ continue;
6201
+ }
6202
+ const scope = nodeId !== null && nodeId.length > 0 ? {
6203
+ kind: "node",
6204
+ nodeId
6205
+ } : input.scope ?? globalSecretScope();
6206
+ const result = await writeNode({
6207
+ ...base,
6208
+ scope
6209
+ }, node, incoming, input.stored[key], baseKey);
6210
+ if (result.kind === "value") out[key] = result.value;
6211
+ }
6212
+ return {
6213
+ patch: out,
6214
+ afterWrite: async () => {
6215
+ if (deletes.length === 0) return { orphaned: [] };
6216
+ try {
6217
+ await input.secrets.delete([...new Set(deletes)]);
6218
+ return { orphaned: [] };
6219
+ } catch {
6220
+ return { orphaned: [...new Set(deletes)] };
6221
+ }
6222
+ }
6223
+ };
6224
+ }
6225
+ /**
6226
+ * Replace every marker in `value` with its keychain value. Returns the SAME
6227
+ * reference when there is no marker (no allocation, no keychain call).
6228
+ */
6229
+ async function resolveSecretMarkers(value, secrets) {
6230
+ const refs = collectSecretMarkerRefs(value);
6231
+ if (refs.length === 0) return {
6232
+ value,
6233
+ unresolved: []
6234
+ };
6235
+ const answers = await secrets.resolve(refs);
6236
+ const unresolved = [];
6237
+ for (const ref of new Set(refs)) {
6238
+ const answer = answers[ref];
6239
+ if (answer === void 0) unresolved.push({
6240
+ ref,
6241
+ reason: "not-initialized"
6242
+ });
6243
+ else if (answer.kind === "unavailable") unresolved.push({
6244
+ ref,
6245
+ reason: answer.reason
6246
+ });
6247
+ else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
6248
+ ref,
6249
+ reason: answer.kind
6250
+ });
6251
+ }
6252
+ const substitute = (v) => {
6253
+ if (isSecretMarker(v)) {
6254
+ const answer = answers[v.$secret];
6255
+ return answer?.kind === "value" ? {
6256
+ keep: true,
6257
+ value: answer.value
6258
+ } : {
6259
+ keep: false,
6260
+ value: void 0
6261
+ };
6262
+ }
6263
+ if (Array.isArray(v)) {
6264
+ const items = [];
6265
+ for (const item of v) {
6266
+ const s = substitute(item);
6267
+ if (s.keep) items.push(s.value);
6268
+ }
6269
+ return {
6270
+ keep: true,
6271
+ value: items
6272
+ };
6273
+ }
6274
+ if (isRecord(v)) {
6275
+ const out = {};
6276
+ for (const [k, child] of Object.entries(v)) {
6277
+ const s = substitute(child);
6278
+ if (s.keep) out[k] = s.value;
6279
+ }
6280
+ return {
6281
+ keep: true,
6282
+ value: out
6283
+ };
6284
+ }
6285
+ return {
6286
+ keep: true,
6287
+ value: v
6288
+ };
6289
+ };
6290
+ return {
6291
+ value: substitute(value).value,
6292
+ unresolved
6293
+ };
6294
+ }
6295
+ function touchesTree(tree, patch) {
6296
+ if (tree.size === 0) return false;
6297
+ for (const key of Object.keys(patch)) {
6298
+ const at = key.indexOf("@");
6299
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6300
+ }
6301
+ return false;
6302
+ }
6303
+ /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6304
+ async function readStoredAddonBlob(raw) {
6305
+ const threeWay = raw.readAddonStoreResult;
6306
+ if (threeWay === void 0) return raw.readAddonStore();
6307
+ const result = await threeWay.call(raw);
6308
+ if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6309
+ return result.kind === "missing" ? {} : result.value;
6310
+ }
6311
+ function createSecretAwareSettings(raw, opts) {
6312
+ const chains = /* @__PURE__ */ new Map();
6313
+ const serialize = (key, fn) => {
6314
+ const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
6315
+ const tail = next.catch(() => void 0);
6316
+ chains.set(key, tail);
6317
+ tail.then(() => {
6318
+ if (chains.get(key) === tail) chains.delete(key);
6319
+ });
6320
+ return next;
6321
+ };
6322
+ const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6323
+ if (!touchesTree(tree, patch)) return rawWrite(patch);
6324
+ return serialize(chainKey, async () => {
6325
+ const stored = await readStored();
6326
+ const result = await transformSecretWrite({
6327
+ tree,
6328
+ secrets: opts.secrets,
6329
+ patch,
6330
+ stored,
6331
+ ...scope !== void 0 ? { scope } : {},
6332
+ operatorWrite: opts.isOperatorWrite?.() === true
6333
+ });
6334
+ if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6335
+ const { orphaned } = await result.afterWrite();
6336
+ if (orphaned.length > 0) opts.onOrphaned(orphaned);
6337
+ });
6338
+ };
6339
+ const wrapped = {
6340
+ writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6341
+ writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6342
+ kind: "device",
6343
+ deviceId
6344
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6345
+ };
6346
+ return new Proxy(raw, { get(target, prop, receiver) {
6347
+ if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6348
+ if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6349
+ const value = Reflect.get(target, prop, receiver);
6350
+ return typeof value === "function" ? value.bind(target) : value;
6351
+ } });
6352
+ }
6353
+ /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6354
+ function withSecretAwareSettings(context, opts) {
6355
+ const raw = context.settings;
6356
+ if (raw === void 0) return context;
6357
+ const settings = createSecretAwareSettings(raw, opts);
6358
+ return new Proxy(context, { get(target, prop, receiver) {
6359
+ if (prop === "settings") return settings;
6360
+ return Reflect.get(target, prop, receiver);
6361
+ } });
6362
+ }
6363
+ var LEAF = { kind: "leaf" };
6364
+ var DEFAULT_ITEM_ID_KEY = "id";
6365
+ function collectFields(fields, out) {
6366
+ for (const field of fields) {
6367
+ if (field.type === "group") {
6368
+ collectFields(field.fields, out);
6369
+ continue;
6370
+ }
6371
+ if (field.type === "sub-tabs") {
6372
+ for (const tab of field.tabs) collectFields(tab.fields, out);
6373
+ continue;
6374
+ }
6375
+ if (field.type === "editable-array") {
6376
+ const item = /* @__PURE__ */ new Map();
6377
+ for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
6378
+ if (item.size > 0) out.set(field.key, {
6379
+ kind: "array",
6380
+ idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
6381
+ item
6382
+ });
6383
+ continue;
6384
+ }
6385
+ if (!("key" in field) || typeof field.key !== "string") continue;
6386
+ if (isKeychainStoredField(field)) out.set(field.key, LEAF);
6387
+ }
6388
+ }
6389
+ /** The secret tree a settings schema declares. */
6390
+ function secretTreeFromSchema(schema) {
6391
+ const out = /* @__PURE__ */ new Map();
6392
+ if (schema === null) return out;
6393
+ for (const section of schema.sections) collectFields(section.fields, out);
6394
+ return out;
6395
+ }
6396
+ /** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
6397
+ function parseSecretStatePath(path) {
6398
+ const segments = [];
6399
+ for (const raw of path.split(".")) {
6400
+ const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
6401
+ if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
6402
+ segments.push(m[2] !== void 0 ? {
6403
+ key: m[1],
6404
+ idKey: m[2]
6405
+ } : { key: m[1] });
6406
+ }
6407
+ if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
6408
+ if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
6409
+ return segments;
6410
+ }
6411
+ function insert(into, segments) {
6412
+ const [head, ...rest] = segments;
6413
+ if (head === void 0) return;
6414
+ if (rest.length === 0) {
6415
+ into.set(head.key, LEAF);
6416
+ return;
6417
+ }
6418
+ const existing = into.get(head.key);
6419
+ if (head.idKey !== void 0) {
6420
+ const item = new Map(existing?.kind === "array" ? existing.item : []);
6421
+ insert(item, rest);
6422
+ into.set(head.key, {
6423
+ kind: "array",
6424
+ idKey: head.idKey,
6425
+ item
6426
+ });
6427
+ return;
6428
+ }
6429
+ const children = new Map(existing?.kind === "object" ? existing.children : []);
6430
+ insert(children, rest);
6431
+ into.set(head.key, {
6432
+ kind: "object",
6433
+ children
6434
+ });
6435
+ }
6436
+ /** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
6437
+ function mergeSecretStatePaths(tree, paths) {
6438
+ if (paths.length === 0) return tree;
6439
+ const out = new Map(tree);
6440
+ for (const path of paths) insert(out, parseSecretStatePath(path));
6441
+ return out;
6442
+ }
6443
+ /** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
6444
+ var SECRET_RETRY_FIRST_MS = 5e3;
6445
+ var SECRET_RETRY_MAX_MS = 5 * 6e4;
6446
+ /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
6447
+ var SECRET_CHANGE_DEBOUNCE_MS = 250;
5912
6448
  /**
5913
6449
  * Base class for CamStack addons. Eliminates settings boilerplate:
5914
6450
  *
@@ -5978,6 +6514,25 @@ var BaseAddon = class {
5978
6514
  settingsStoreReady = false;
5979
6515
  /** Default config values. Provided via constructor. */
5980
6516
  defaults;
6517
+ /**
6518
+ * Hidden-state paths that hold secrets (D787) — values the addon writes
6519
+ * itself (`updateGlobalSettings`, `state()`) that no form field declares.
6520
+ * Stored in the keychain exactly like a `password` field. Syntax:
6521
+ * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
6522
+ * (`key[<id field>]` addresses array items by id, never by index).
6523
+ */
6524
+ secretStatePaths = [];
6525
+ _addonSecretTree = null;
6526
+ _deviceSecretTree = null;
6527
+ /** Refs the last resolved config pointed at — a change to one re-resolves. */
6528
+ _configSecretRefs = /* @__PURE__ */ new Set();
6529
+ _unresolvedSecrets = [];
6530
+ _secretRetryTimer = null;
6531
+ _secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
6532
+ _secretChangeTimer = null;
6533
+ _secretChangeUnsub = null;
6534
+ /** >0 while an OPERATOR's settings write is being applied. */
6535
+ _operatorWriteDepth = 0;
5981
6536
  constructor(defaults) {
5982
6537
  this.defaults = defaults;
5983
6538
  this._config = { ...defaults };
@@ -6013,8 +6568,18 @@ var BaseAddon = class {
6013
6568
  return this._config;
6014
6569
  }
6015
6570
  async initialize(context) {
6016
- this._ctx = context;
6571
+ const secrets = context.secrets;
6572
+ this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6573
+ secrets,
6574
+ addonTree: () => this.addonSecretTree(),
6575
+ deviceTree: () => this.deviceSecretTree(),
6576
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6577
+ isOperatorWrite: () => this._operatorWriteDepth > 0
6578
+ }) : context;
6017
6579
  await this.resolveConfig();
6580
+ if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6581
+ if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
6582
+ });
6018
6583
  const result = await this.onInitialize();
6019
6584
  this.emitLifecycle(EventCategory.AddonStarted);
6020
6585
  const normalized = normalizeAddonInitResult(result);
@@ -6047,6 +6612,12 @@ var BaseAddon = class {
6047
6612
  */
6048
6613
  async onHubReachable() {}
6049
6614
  async shutdown() {
6615
+ this._secretChangeUnsub?.();
6616
+ this._secretChangeUnsub = null;
6617
+ if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
6618
+ if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
6619
+ this._secretRetryTimer = null;
6620
+ this._secretChangeTimer = null;
6050
6621
  this.emitLifecycle(EventCategory.AddonStopped);
6051
6622
  if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
6052
6623
  await this.onShutdown();
@@ -6125,7 +6696,7 @@ var BaseAddon = class {
6125
6696
  return hydrateSchema(schema, overlay ? {
6126
6697
  ...projected,
6127
6698
  ...overlay
6128
- } : projected);
6699
+ } : projected, { inlineSecretsAsViews: true });
6129
6700
  }
6130
6701
  /**
6131
6702
  * The integration-level view of this addon's settings: exactly the sections
@@ -6174,7 +6745,7 @@ var BaseAddon = class {
6174
6745
  return hydrateSchema({
6175
6746
  ...schema,
6176
6747
  sections
6177
- }, projected);
6748
+ }, projected, { inlineSecretsAsViews: true });
6178
6749
  }
6179
6750
  /**
6180
6751
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -6228,18 +6799,50 @@ var BaseAddon = class {
6228
6799
  value: result.value[key]
6229
6800
  };
6230
6801
  }
6802
+ /**
6803
+ * The OPERATOR's write — a settings form or an admin API call, dispatched by
6804
+ * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
6805
+ * the operator sends is stored as sent even when it equals a pre-keychain
6806
+ * inline value: the operator re-entering a password is a change, an addon
6807
+ * writing back what it read is not (D787).
6808
+ */
6809
+ async updateGlobalSettingsAsOperator(patch, nodeId) {
6810
+ this._operatorWriteDepth++;
6811
+ try {
6812
+ await this.applyGlobalPatch(patch, nodeId);
6813
+ } finally {
6814
+ this._operatorWriteDepth--;
6815
+ }
6816
+ }
6231
6817
  async updateGlobalSettings(patch, nodeId) {
6818
+ await this.applyGlobalPatch(patch, nodeId);
6819
+ }
6820
+ /**
6821
+ * REMOVE stored secrets — their keychain values and their markers (D787).
6822
+ *
6823
+ * Writing `''` to a secret field KEEPS what is stored (an empty string is
6824
+ * what a defaults fallback writes back, and it must never destroy a
6825
+ * credential), so code that means "forget this token" says so here. Without
6826
+ * a keychain (an older kernel) it writes `''`, as such code always did.
6827
+ */
6828
+ async clearSecrets(keys, nodeId) {
6829
+ const tree = this.addonSecretTree();
6830
+ const keychain = this._ctx?.secrets !== void 0;
6831
+ const patch = {};
6832
+ for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
6833
+ await this.applyGlobalPatch(patch, nodeId);
6834
+ }
6835
+ async applyGlobalPatch(barePatch, nodeId) {
6232
6836
  const keys = this.perNodeKeys();
6233
6837
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6234
6838
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6235
- const barePatch = patch;
6236
6839
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6237
6840
  await this._ctx?.settings?.writeAddonStore(scoped);
6238
6841
  if (target !== localNode) return;
6239
6842
  await this.resolveConfig();
6240
6843
  await this.onConfigChanged();
6241
6844
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
6242
- this.maybeAutoRestart(patch, this.globalSettingsSchema());
6845
+ this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
6243
6846
  }
6244
6847
  /**
6245
6848
  * The set of field keys the global settings schema declares `perNode: true`
@@ -6264,7 +6867,7 @@ var BaseAddon = class {
6264
6867
  * time to return its response before the addon is torn down and
6265
6868
  * re-initialised by `AddonRegistryService.restartAddon`.
6266
6869
  */
6267
- maybeAutoRestart(patch, schema) {
6870
+ maybeAutoRestart(patchKeys, schema) {
6268
6871
  if (!schema) return;
6269
6872
  const restartKeys = /* @__PURE__ */ new Set();
6270
6873
  for (const section of schema.sections) for (const field of section.fields) {
@@ -6272,13 +6875,13 @@ var BaseAddon = class {
6272
6875
  if (field.requiresRestart) restartKeys.add(field.key);
6273
6876
  }
6274
6877
  if (restartKeys.size === 0) return;
6275
- if (!Object.keys(patch).some((k) => restartKeys.has(k))) return;
6878
+ if (!patchKeys.some((k) => restartKeys.has(k))) return;
6276
6879
  const ctx = this._ctx;
6277
6880
  if (!ctx) return;
6278
6881
  const addonId = ctx.id;
6279
6882
  setImmediate(() => {
6280
6883
  ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
6281
- ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: Object.keys(patch).filter((k) => restartKeys.has(k)) } });
6884
+ ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
6282
6885
  }).catch((err) => {
6283
6886
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
6284
6887
  });
@@ -6287,7 +6890,7 @@ var BaseAddon = class {
6287
6890
  async getDeviceSettings(deviceId) {
6288
6891
  const schema = this.deviceSettingsSchema();
6289
6892
  if (!schema) return { sections: [] };
6290
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
6893
+ return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6291
6894
  }
6292
6895
  async updateDeviceSettings(deviceId, patch) {
6293
6896
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -6417,7 +7020,7 @@ var BaseAddon = class {
6417
7020
  * selection at boot (absent scoped key ⇒ the constructor default wins).
6418
7021
  */
6419
7022
  async resolveConfig() {
6420
- const stored = await this.readAddonStoreWithRetry();
7023
+ const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
6421
7024
  const perNode = this.perNodeKeys();
6422
7025
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6423
7026
  const resolved = { ...this.defaults };
@@ -6442,7 +7045,7 @@ var BaseAddon = class {
6442
7045
  key,
6443
7046
  schema,
6444
7047
  fallback,
6445
- read: () => this.readAddonStoreWithRetry(),
7048
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
6446
7049
  write: async (patch) => {
6447
7050
  await this._ctx?.settings?.writeAddonStore(patch);
6448
7051
  },
@@ -6459,7 +7062,7 @@ var BaseAddon = class {
6459
7062
  key,
6460
7063
  schema,
6461
7064
  fallback,
6462
- read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
7065
+ read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
6463
7066
  write: async (patch) => {
6464
7067
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
6465
7068
  },
@@ -6471,6 +7074,70 @@ var BaseAddon = class {
6471
7074
  } })
6472
7075
  });
6473
7076
  }
7077
+ /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
7078
+ addonSecretTree() {
7079
+ this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
7080
+ return this._addonSecretTree;
7081
+ }
7082
+ deviceSecretTree() {
7083
+ this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7084
+ return this._deviceSecretTree;
7085
+ }
7086
+ /**
7087
+ * Secrets of this addon's stored config that could not be resolved on the
7088
+ * last read, with why. Non-empty means the addon is running WITHOUT them —
7089
+ * an addon whose function needs one should report itself degraded rather
7090
+ * than start on an empty credential.
7091
+ */
7092
+ get unresolvedSecrets() {
7093
+ return this._unresolvedSecrets;
7094
+ }
7095
+ /**
7096
+ * Substitute every keychain marker in a stored blob with its value. With no
7097
+ * keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
7098
+ * An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
7099
+ * value — and, when the cause can pass, retried with backoff. Nothing is
7100
+ * ever written back from here.
7101
+ */
7102
+ async resolveStoredSecrets(blob, trackForConfig = true) {
7103
+ const secrets = this._ctx?.secrets;
7104
+ if (secrets === void 0) return blob;
7105
+ const refs = collectSecretMarkerRefs(blob);
7106
+ if (trackForConfig) this._configSecretRefs = new Set(refs);
7107
+ if (refs.length === 0) {
7108
+ if (trackForConfig) this._unresolvedSecrets = [];
7109
+ return blob;
7110
+ }
7111
+ const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
7112
+ if (trackForConfig) {
7113
+ this._unresolvedSecrets = unresolved;
7114
+ if (unresolved.length > 0) {
7115
+ this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
7116
+ ref: u.ref,
7117
+ reason: u.reason
7118
+ })) } });
7119
+ if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
7120
+ this.scheduleSecretReresolve(this._secretRetryDelayMs);
7121
+ this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
7122
+ }
7123
+ } else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
7124
+ }
7125
+ return value;
7126
+ }
7127
+ /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7128
+ scheduleSecretReresolve(delayMs) {
7129
+ const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
7130
+ if (this[timerOf] !== null) return;
7131
+ const timer = setTimeout(() => {
7132
+ this[timerOf] = null;
7133
+ if (this._ctx === null) return;
7134
+ this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
7135
+ this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
7136
+ });
7137
+ }, delayMs);
7138
+ timer.unref?.();
7139
+ this[timerOf] = timer;
7140
+ }
6474
7141
  /**
6475
7142
  * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
6476
7143
  * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
@@ -13994,6 +14661,196 @@ id: union([string(), number()]) }), {
13994
14661
  kind: "mutation",
13995
14662
  auth: "admin"
13996
14663
  });
14664
+ /**
14665
+ * `keychain` — the hub's encrypted store of secret values (D787).
14666
+ *
14667
+ * Settings blobs never hold a secret: they hold a marker
14668
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
14669
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
14670
+ * is the OWNER's door to its own values: every method is owner-checked
14671
+ * against the CALLER, never against anything the caller claims.
14672
+ *
14673
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
14674
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
14675
+ * connection, the agent from its child's connection carried in
14676
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
14677
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
14678
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
14679
+ * identity against BUGS and misrouting, not against a malicious addon (every
14680
+ * runner is the same OS user): see the threat model in
14681
+ * `docs/design/2026-10-08-secrets-keychain.md`.
14682
+ *
14683
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
14684
+ * parses the input, so a session can never supply it, and the internal mount
14685
+ * floors every method to admin anyway (D240).
14686
+ *
14687
+ * Internal: addons reach it through `ctx.secrets`, never directly.
14688
+ */
14689
+ /** Why a value cannot be served right now. Never folded into "missing". */
14690
+ var KeychainUnavailableReasonSchema = _enum([
14691
+ "key-missing",
14692
+ "wrong-key",
14693
+ "key-file-unreadable",
14694
+ "store-unavailable",
14695
+ "not-initialized",
14696
+ "decrypt-failed"
14697
+ ]);
14698
+ var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
14699
+ state: literal("locked"),
14700
+ reason: KeychainUnavailableReasonSchema
14701
+ })]);
14702
+ var KeychainResolveEntrySchema = discriminatedUnion("kind", [
14703
+ object({
14704
+ kind: literal("value"),
14705
+ value: string(),
14706
+ version: number().int()
14707
+ }),
14708
+ object({ kind: literal("missing") }),
14709
+ object({
14710
+ kind: literal("unavailable"),
14711
+ reason: KeychainUnavailableReasonSchema
14712
+ }),
14713
+ object({ kind: literal("forbidden") })
14714
+ ]);
14715
+ var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
14716
+ /** Metadata of one stored value — never the value. */
14717
+ var KeychainSecretMetaSchema = object({
14718
+ ref: string(),
14719
+ owner: string(),
14720
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
14721
+ scope: string(),
14722
+ fieldPath: string(),
14723
+ version: number().int(),
14724
+ createdAt: number(),
14725
+ updatedAt: number(),
14726
+ /** `addon:<id>` | `user:<id>` | `system`. */
14727
+ updatedBy: string(),
14728
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
14729
+ lastReadAt: number().nullable()
14730
+ });
14731
+ var RefListSchema = array(string().min(1)).max(512);
14732
+ method(object({
14733
+ ref: string().min(1),
14734
+ value: string().min(1)
14735
+ }), object({
14736
+ ref: string(),
14737
+ version: number().int()
14738
+ }), {
14739
+ kind: "mutation",
14740
+ auth: "admin"
14741
+ }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
14742
+ kind: "mutation",
14743
+ auth: "admin"
14744
+ }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
14745
+ var KeychainKeySourceSchema = object({
14746
+ kind: _enum([
14747
+ "config-file",
14748
+ "previous-config-file",
14749
+ "platform",
14750
+ "default-file"
14751
+ ]),
14752
+ /** File sources only — a path is not a secret. */
14753
+ path: string().optional(),
14754
+ /**
14755
+ * True when a whole-volume backup of the data directory carries this key
14756
+ * next to the database it protects (the default file). The page warns.
14757
+ */
14758
+ sharesBackupWithDatabase: boolean()
14759
+ });
14760
+ var KeychainStatusSchema = object({
14761
+ keychain: KeychainStateSchema,
14762
+ /** The source of the master key in use; `null` while locked. */
14763
+ keySource: KeychainKeySourceSchema.nullable(),
14764
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
14765
+ configuredSource: KeychainKeySourceSchema,
14766
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
14767
+ fingerprint: string().nullable(),
14768
+ activeKeyId: string().nullable(),
14769
+ /**
14770
+ * The keychain unlocked with a NON-primary source: the configured primary
14771
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
14772
+ */
14773
+ rotationPending: boolean(),
14774
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
14775
+ retiredWraps: number().int(),
14776
+ recoveryKeyDownloadedAt: number().nullable(),
14777
+ secretCount: number().int()
14778
+ });
14779
+ /**
14780
+ * Whether a stored value is still pointed at by its owner's settings.
14781
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
14782
+ * never reported as an orphan (and never deleted as one).
14783
+ */
14784
+ var KeychainSecretUsageSchema = _enum([
14785
+ "in-use",
14786
+ "orphan",
14787
+ "unknown"
14788
+ ]);
14789
+ var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
14790
+ var KeychainAuditActionSchema = _enum([
14791
+ "put",
14792
+ "delete",
14793
+ "reveal",
14794
+ "rotate-master-key",
14795
+ "purge-retired-keys",
14796
+ "download-recovery-key",
14797
+ "delete-orphans",
14798
+ "reset",
14799
+ "initialize"
14800
+ ]);
14801
+ var KeychainAuditEntrySchema = object({
14802
+ id: string(),
14803
+ at: number(),
14804
+ action: KeychainAuditActionSchema,
14805
+ /** `addon:<id>` | `user:<id>` | `system`. */
14806
+ actor: string(),
14807
+ ref: string().nullable(),
14808
+ detail: string().nullable()
14809
+ });
14810
+ 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({
14811
+ value: string(),
14812
+ version: number().int()
14813
+ }), {
14814
+ kind: "mutation",
14815
+ auth: "admin",
14816
+ caller: "required"
14817
+ }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
14818
+ deleted: array(string()).readonly(),
14819
+ kept: array(object({
14820
+ ref: string(),
14821
+ usage: KeychainSecretUsageSchema
14822
+ })).readonly()
14823
+ }), {
14824
+ kind: "mutation",
14825
+ auth: "admin",
14826
+ caller: "required"
14827
+ }), method(object({}), object({
14828
+ fingerprint: string(),
14829
+ keySource: KeychainKeySourceSchema
14830
+ }), {
14831
+ kind: "mutation",
14832
+ auth: "admin",
14833
+ caller: "required"
14834
+ }), method(object({}), object({ purged: number().int() }), {
14835
+ kind: "mutation",
14836
+ auth: "admin",
14837
+ caller: "required"
14838
+ }), method(object({}), object({
14839
+ key: string(),
14840
+ fingerprint: string(),
14841
+ keySource: KeychainKeySourceSchema
14842
+ }), {
14843
+ kind: "mutation",
14844
+ auth: "admin",
14845
+ caller: "required"
14846
+ }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
14847
+ archivedCollection: string().nullable(),
14848
+ archived: number().int()
14849
+ }), {
14850
+ kind: "mutation",
14851
+ auth: "admin",
14852
+ caller: "required"
14853
+ });
13997
14854
  method(_void(), object({
13998
14855
  id: string(),
13999
14856
  name: string(),
@@ -15031,7 +15888,11 @@ var DeviceRegisterPayloadSchema = object({
15031
15888
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
15032
15889
  var DevicePersistConfigPayloadSchema = object({
15033
15890
  deviceId: number(),
15034
- data: record(string(), unknown())
15891
+ data: record(string(), unknown()),
15892
+ /** The paths the device's schema declares secret (D783), when the caller
15893
+ * knows them — those values are kept in the keychain, not the blob (D787).
15894
+ * Absent: the paths the device last reported at `registerDevice` apply. */
15895
+ secretConfigPaths: array(string()).optional()
15035
15896
  });
15036
15897
  /** What a migration actually did, per switch. `unreachable` is a first-class
15037
15898
  * answer: a camera that could not be asked is not a camera that was silenced. */
@@ -22027,8 +22888,23 @@ var RetrainMacroClassSchema = _enum([
22027
22888
  ]);
22028
22889
  /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
22029
22890
  var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
22030
- /** Did a human draw this box, or did the assist propose it? */
22031
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
22891
+ /**
22892
+ * Where a box came from. A machine-sourced box is a DRAFT on the page until
22893
+ * the operator confirms it; once saved it keeps its source as provenance.
22894
+ *
22895
+ * - `operator` — drawn by hand.
22896
+ * - `assist` — proposed by a detector run on the copy (the camera's own
22897
+ * model, or a larger teacher model).
22898
+ * - `pipeline` — the box the live pipeline actually drew on that frame, read
22899
+ * back from the track store (never a re-run).
22900
+ * - `llm` — proposed by a vision-capable LLM profile.
22901
+ */
22902
+ var RetrainAnnotationSourceSchema = _enum([
22903
+ "operator",
22904
+ "assist",
22905
+ "pipeline",
22906
+ "llm"
22907
+ ]);
22032
22908
  /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
22033
22909
  var RetrainBboxSchema = object({
22034
22910
  x: number(),
@@ -22046,7 +22922,8 @@ var RetrainBboxSchema = object({
22046
22922
  */
22047
22923
  var RetrainAnnotationSchema = object({
22048
22924
  id: string(),
22049
- trackId: string(),
22925
+ /** The frame's track. Absent on a recording still, which has none. */
22926
+ trackId: string().optional(),
22050
22927
  deviceId: number(),
22051
22928
  /** The COPY in retrain storage — never the source track's media key. */
22052
22929
  mediaKey: string(),
@@ -22095,13 +22972,47 @@ var RetrainFrameCandidateSchema = object({
22095
22972
  * fail, whatever became of the original. */
22096
22973
  copied: boolean()
22097
22974
  });
22975
+ /**
22976
+ * One box the live pipeline drew on a copied frame — what a correction starts
22977
+ * from. Derived when the frame is listed, from the track store: the subject
22978
+ * box recorded on the source media row when there is one, else the track
22979
+ * position nearest the frame's capture time. Never stored as an annotation
22980
+ * until the operator confirms it.
22981
+ */
22982
+ var RetrainPipelineBoxSchema = object({
22983
+ /** Normalised `[0,1]` against the full frame. */
22984
+ bbox: RetrainBboxSchema,
22985
+ macroClass: RetrainMacroClassSchema,
22986
+ label: string().optional(),
22987
+ subLabel: string().optional(),
22988
+ /** The detection score of the position used, when it was recorded. */
22989
+ score: number().optional(),
22990
+ /** The root model that produced the track, when it was recorded. */
22991
+ modelId: string().optional(),
22992
+ trackId: string(),
22993
+ /** `subject-box`: recorded on this very frame. `position`: the track's
22994
+ * position nearest the capture time, `deltaMs` away. */
22995
+ basis: _enum(["subject-box", "position"]),
22996
+ deltaMs: number()
22997
+ });
22998
+ /**
22999
+ * Where a retrain frame came from: a TRACK's stored media (copy-on-select),
23000
+ * or the RECORDING at an instant — the frame a model saw nothing in has no
23001
+ * track at all.
23002
+ */
23003
+ var RetrainFrameOriginSchema = _enum(["track", "recording"]);
22098
23004
  /** A frame the dataset OWNS: bytes copied at selection time. */
22099
23005
  var RetrainFrameSchema = object({
22100
23006
  frameId: string(),
22101
23007
  deviceId: number(),
22102
- trackId: string(),
22103
- /** Provenance only. It may already point at nothing — that is expected. */
22104
- sourceMediaId: number().int(),
23008
+ origin: RetrainFrameOriginSchema,
23009
+ /** The track it was copied from. Absent on a recording still. */
23010
+ trackId: string().optional(),
23011
+ /** Provenance only. It may already point at nothing — that is expected.
23012
+ * Absent on a recording still. */
23013
+ sourceMediaId: number().int().optional(),
23014
+ /** A recording still: the playhead instant it was taken at. */
23015
+ epochMs: number().optional(),
22105
23016
  sourceKind: MediaFileKindEnum,
22106
23017
  sizeBytes: number().int(),
22107
23018
  width: number().int(),
@@ -22112,7 +23023,12 @@ var RetrainFrameSchema = object({
22112
23023
  /** The operator's "every subject in this frame is boxed". Detector
22113
23024
  * evaluation keeps only complete frames: an unboxed subject would count as
22114
23025
  * a false positive. */
22115
- complete: boolean()
23026
+ complete: boolean(),
23027
+ /** The boxes the pipeline drew on this frame. Present on list answers;
23028
+ * empty when nothing the track store holds can be placed on it. */
23029
+ pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
23030
+ /** The named collections this frame belongs to. Present on list answers. */
23031
+ collectionIds: array(string()).readonly().optional()
22116
23032
  });
22117
23033
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
22118
23034
  var RetrainCopyRefusalSchema = _enum([
@@ -22143,6 +23059,8 @@ var RetrainFrameListSchema = object({
22143
23059
  var RetrainExportFilterSchema = object({
22144
23060
  deviceIds: array(number()).optional(),
22145
23061
  frameIds: array(string()).max(2e4).optional(),
23062
+ /** Only frames in at least one of these named collections. */
23063
+ collectionIds: array(string()).max(200).optional(),
22146
23064
  batchId: string().optional(),
22147
23065
  /** Only frames the operator marked complete (all subjects boxed). */
22148
23066
  completeOnly: boolean().optional()
@@ -22207,6 +23125,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
22207
23125
  reason: string(),
22208
23126
  detail: string().optional()
22209
23127
  })]);
23128
+ /** A named set over the retrain corpus — membership only, it owns no pixels. */
23129
+ var RetrainCollectionSchema = object({
23130
+ id: string(),
23131
+ name: string(),
23132
+ createdAt: number(),
23133
+ frameCount: number().int()
23134
+ });
23135
+ var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
23136
+ kind: literal("created"),
23137
+ collection: RetrainCollectionSchema
23138
+ }), object({
23139
+ kind: literal("refused"),
23140
+ reason: _enum(["empty-name", "duplicate-name"])
23141
+ })]);
23142
+ var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
23143
+ kind: literal("renamed"),
23144
+ collection: RetrainCollectionSchema
23145
+ }), object({
23146
+ kind: literal("refused"),
23147
+ reason: _enum([
23148
+ "empty-name",
23149
+ "duplicate-name",
23150
+ "unknown-collection"
23151
+ ])
23152
+ })]);
23153
+ /**
23154
+ * The outcome of adding the frame at a recording instant. Every refusal is
23155
+ * named: `still-unavailable` (not recording, a gap, or an undecodable frame —
23156
+ * `detail` says which), `still-busy` (the recorder is at its decode bound; try
23157
+ * again), `unreadable-image`, `write-failed`, `unknown-collection`.
23158
+ */
23159
+ var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
23160
+ kind: literal("added"),
23161
+ collectionId: string(),
23162
+ frame: RetrainFrameSchema,
23163
+ /** The moment was already in the dataset; nothing was decoded. */
23164
+ reused: boolean()
23165
+ }), object({
23166
+ kind: literal("refused"),
23167
+ reason: _enum([
23168
+ "unknown-collection",
23169
+ "still-unavailable",
23170
+ "still-busy",
23171
+ "unreadable-image",
23172
+ "write-failed"
23173
+ ]),
23174
+ detail: string().optional()
23175
+ })]);
23176
+ /** A vision LLM profile the AI assist may use, and where it sends the frame. */
23177
+ var RetrainAssistProfileSchema = object({
23178
+ id: string(),
23179
+ name: string(),
23180
+ model: string(),
23181
+ kind: string(),
23182
+ /** `true` when the frame would leave the house (a cloud vendor, or an
23183
+ * endpoint that is not on the local network). The page confirms each such
23184
+ * run, and the provider refuses one without `allowCloud`. */
23185
+ leavesHouse: boolean()
23186
+ });
23187
+ /** A box the AI assist proposed: a draft, plus the model's own reason. */
23188
+ var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
23189
+ /** What the AI assist said about a box that was already on the canvas. */
23190
+ var RetrainLlmReviewSchema = object({
23191
+ /** The `ref` the page sent the box under. */
23192
+ ref: string(),
23193
+ verdict: _enum([
23194
+ "confirmed",
23195
+ "wrong-class",
23196
+ "not-an-object",
23197
+ "uncertain"
23198
+ ]),
23199
+ suggestedClass: RetrainMacroClassSchema.optional(),
23200
+ reason: string()
23201
+ });
23202
+ /**
23203
+ * The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
23204
+ * model and its confidence) and reviews; items the model got wrong (a box off
23205
+ * the frame, an unasked class, an unknown ref) are dropped and counted in
23206
+ * `rejected`. A whole answer that is not the schema is `malformed-answer`.
23207
+ */
23208
+ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23209
+ kind: literal("proposed"),
23210
+ profileId: string(),
23211
+ model: string(),
23212
+ /** The frame was sent outside the house for this answer. */
23213
+ leftHouse: boolean(),
23214
+ proposals: array(RetrainLlmProposalSchema).readonly(),
23215
+ reviews: array(RetrainLlmReviewSchema).readonly(),
23216
+ rejected: number().int()
23217
+ }), object({
23218
+ kind: literal("refused"),
23219
+ reason: _enum([
23220
+ "unknown-frame",
23221
+ "unreadable-frame",
23222
+ "unknown-profile",
23223
+ "profile-disabled",
23224
+ "no-vision",
23225
+ "cloud-not-confirmed",
23226
+ "llm-error",
23227
+ "malformed-answer"
23228
+ ]),
23229
+ detail: string().optional()
23230
+ })]);
22210
23231
  /** The outcome of a lifecycle move owned by the retrain page. */
22211
23232
  var RetrainTransitionResultSchema = object({
22212
23233
  trackId: string(),
@@ -22924,7 +23945,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22924
23945
  auth: "admin"
22925
23946
  }), method(object({
22926
23947
  deviceId: number(),
22927
- trackId: string(),
23948
+ trackId: string().optional(),
22928
23949
  frameId: string()
22929
23950
  }), object({
22930
23951
  removed: boolean(),
@@ -22941,7 +23962,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22941
23962
  auth: "admin"
22942
23963
  }), method(object({
22943
23964
  deviceId: number(),
22944
- trackId: string(),
23965
+ /** The frame's track, when it has one — checked against the frame. */
23966
+ trackId: string().optional(),
22945
23967
  frameId: string(),
22946
23968
  subject: RetrainAssistSubjectSchema,
22947
23969
  /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
@@ -22949,12 +23971,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22949
23971
  }), RetrainAssistResultSchema, {
22950
23972
  kind: "mutation",
22951
23973
  auth: "admin"
22952
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
23974
+ }), method(object({
23975
+ trackId: string().optional(),
23976
+ frameIds: array(string()).max(2e3).optional()
23977
+ }), array(RetrainAnnotationSchema).readonly(), {
22953
23978
  kind: "query",
22954
23979
  auth: "admin"
22955
23980
  }), method(object({
22956
23981
  deviceId: number(),
22957
- trackId: string(),
23982
+ /** The frame's track, when it has one — checked against the frame. */
23983
+ trackId: string().optional(),
22958
23984
  frameId: string(),
22959
23985
  annotations: array(RetrainAnnotationDraftSchema)
22960
23986
  }), array(RetrainAnnotationSchema).readonly(), {
@@ -22977,7 +24003,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22977
24003
  auth: "admin"
22978
24004
  }), method(object({
22979
24005
  deviceId: number(),
22980
- trackId: string(),
24006
+ trackId: string().optional(),
22981
24007
  frameId: string(),
22982
24008
  complete: boolean()
22983
24009
  }), RetrainFrameSchema, {
@@ -22991,6 +24017,74 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22991
24017
  kind: "mutation",
22992
24018
  auth: "admin",
22993
24019
  timeoutMs: 60 * 6e4
24020
+ }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24021
+ kind: "query",
24022
+ auth: "admin"
24023
+ }), method(object({
24024
+ deviceId: number(),
24025
+ trackId: string().optional(),
24026
+ frameId: string(),
24027
+ profileId: string(),
24028
+ classes: array(RetrainMacroClassSchema).min(1),
24029
+ boxes: array(object({
24030
+ ref: string(),
24031
+ bbox: RetrainBboxSchema,
24032
+ macroClass: RetrainMacroClassSchema,
24033
+ label: string().optional()
24034
+ })).max(50),
24035
+ allowCloud: boolean()
24036
+ }), RetrainLlmAssistResultSchema, {
24037
+ kind: "mutation",
24038
+ auth: "admin",
24039
+ timeoutMs: 18e4
24040
+ }), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
24041
+ kind: "mutation",
24042
+ auth: "admin"
24043
+ }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24044
+ kind: "query",
24045
+ auth: "admin"
24046
+ }), method(object({
24047
+ id: string(),
24048
+ name: string().max(120)
24049
+ }), RetrainCollectionRenameResultSchema, {
24050
+ kind: "mutation",
24051
+ auth: "admin"
24052
+ }), method(object({ id: string() }), object({
24053
+ deleted: boolean(),
24054
+ removedFrames: number().int()
24055
+ }), {
24056
+ kind: "mutation",
24057
+ auth: "admin"
24058
+ }), method(object({
24059
+ collectionId: string(),
24060
+ deviceId: number(),
24061
+ epochMs: number()
24062
+ }), AddRetrainFrameFromRecordingResultSchema, {
24063
+ kind: "mutation",
24064
+ auth: "admin",
24065
+ timeoutMs: 6e4
24066
+ }), method(object({
24067
+ collectionId: string(),
24068
+ frameIds: array(string()).min(1).max(500)
24069
+ }), object({
24070
+ added: number().int(),
24071
+ alreadyMember: number().int(),
24072
+ unknownFrameIds: array(string()).readonly()
24073
+ }), {
24074
+ kind: "mutation",
24075
+ auth: "admin"
24076
+ }), method(object({
24077
+ collectionId: string(),
24078
+ frameId: string()
24079
+ }), object({
24080
+ removed: boolean(),
24081
+ deletedFrame: boolean()
24082
+ }), {
24083
+ kind: "mutation",
24084
+ auth: "admin"
24085
+ }), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
24086
+ kind: "query",
24087
+ auth: "admin"
22994
24088
  }), method(object({
22995
24089
  /** Which of the three event tables owns the row. */
22996
24090
  ownerType: EventOwnerTypeSchema,
@@ -23614,13 +24708,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
23614
24708
  object({
23615
24709
  kind: literal("no-family-build"),
23616
24710
  format: ModelFormatSchema$1
24711
+ }),
24712
+ object({
24713
+ kind: literal("kept-custom-pin"),
24714
+ modelId: string(),
24715
+ deviceKey: string()
23617
24716
  })
23618
24717
  ]);
24718
+ /** Why a device is left exactly as it is, whatever the plan would pick (D786). */
24719
+ var KeptReasonSchema = _enum(["custom-pin"]);
24720
+ /**
24721
+ * Where a choice's latency came from (D791): this node's own benchmark
24722
+ * result, or the hardware-class table. Measured on the node beats the table.
24723
+ */
24724
+ var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
24725
+ kind: literal("node-benchmark"),
24726
+ resultId: string(),
24727
+ measuredAtMs: number()
24728
+ })]);
23619
24729
  var DeviceModelChoiceSchema = object({
23620
24730
  modelId: string(),
23621
24731
  p50Ms: number(),
23622
24732
  fps: number(),
23623
24733
  measured: boolean(),
24734
+ /** Absent on a plan from before D791 — read as the table. */
24735
+ source: LatencySourceSchema.optional(),
23624
24736
  /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
23625
24737
  capacitySessions: number(),
23626
24738
  personRecall: number()
@@ -23631,6 +24743,8 @@ var DeviceRecommendationSchema = object({
23631
24743
  enabled: boolean(),
23632
24744
  available: boolean(),
23633
24745
  chosen: DeviceModelChoiceSchema.nullable(),
24746
+ /** Present when the device is kept as is: Apply writes nothing on it. */
24747
+ kept: KeptReasonSchema.optional(),
23634
24748
  reasons: array(RecommendationReasonSchema).readonly()
23635
24749
  });
23636
24750
  var NodeRecommendationSchema = object({
@@ -23684,6 +24798,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
23684
24798
  kind: literal("coral-enabled"),
23685
24799
  nodeId: string(),
23686
24800
  deviceKey: string()
24801
+ }),
24802
+ object({
24803
+ kind: literal("custom-pin-kept"),
24804
+ nodeId: string(),
24805
+ deviceKey: string().nullable(),
24806
+ deviceId: number().nullable(),
24807
+ modelId: string()
24808
+ }),
24809
+ object({
24810
+ kind: literal("custom-registry-unreadable"),
24811
+ error: string()
23687
24812
  })
23688
24813
  ]);
23689
24814
  var AutoTuneOptionsSchema = object({
@@ -23862,13 +24987,14 @@ var SuggestSharesResultSchema = object({
23862
24987
  nodes: array(SuggestedNodeShareSchema).readonly()
23863
24988
  });
23864
24989
  /**
23865
- * Where the node and device shares come from (D750, D755).
23866
- * - `hardware` (default) — computed by the system from each node's static
23867
- * capacity (its accelerators at their Auto tune models, from the measured
23868
- * latency table), recomputed whenever a node or device joins, leaves, is
23869
- * switched on or off, or changes model. No load input.
23870
- * - `benchmark` — the same, from each node's measured capacity (node
23871
- * benchmark results); a node without results falls back to `hardware`.
24990
+ * Where the node and device shares come from (D750, D755, D791).
24991
+ * - `benchmark` (default since D791) — each node's capacity as its own node
24992
+ * benchmark measured it; a node without fresh results is sized from
24993
+ * `hardware` and says so. Measured on the node beats the table.
24994
+ * - `hardware` — computed from each node's static capacity only (its
24995
+ * accelerators at their Auto tune models, from the latency table).
24996
+ * Both are recomputed whenever a node or device joins, leaves, is switched
24997
+ * on or off, changes model, or a benchmark result is written. No load input.
23872
24998
  * - `manual` — the operator's stored sliders.
23873
24999
  * Either way a node or device that cannot take sessions gives its share to
23874
25000
  * the others in proportion; the stored values are never rewritten for that.
@@ -23917,6 +25043,362 @@ var EffectiveSharesSchema = object({
23917
25043
  nodeWeights: record(string(), number()),
23918
25044
  deviceWeights: record(string(), record(string(), number()))
23919
25045
  });
25046
+ /**
25047
+ * Wire shapes of the node benchmark (D791): the operator's plan, the
25048
+ * preflight the confirmation shows, the run the orchestrator owns, what the
25049
+ * measuring runner reports, and the result rows Auto tune and the automatic
25050
+ * shares read.
25051
+ *
25052
+ * ONE node at a time, owned by the pipeline orchestrator. While a run is
25053
+ * active the cluster is in BENCHMARK MODE for that node: it is not a
25054
+ * detection candidate, camera pins naming it are ignored so its sessions move
25055
+ * elsewhere, and both come back when the mode ends — after a crash or a hub
25056
+ * restart too (a persisted manifest, reconciled against the registry).
25057
+ *
25058
+ * Two measurements, both on the node, driven by its own runner (frames never
25059
+ * cross a process at frame rate, D9):
25060
+ * - `device` — one accelerator × one candidate detector, root only, open
25061
+ * loop: how many streams at the camera rate it carries inside the frame
25062
+ * interval;
25063
+ * - `pipeline` — the chosen detector plus the operator's detail steps
25064
+ * (faces, plates, classifiers, CLIP…), on varied frames from the bench
25065
+ * clip: how many parallel sessions the node carries before latency, drops,
25066
+ * CPU, RAM or the event loop give out.
25067
+ */
25068
+ /** Defaults and bounds, one place. */
25069
+ var NODE_BENCHMARK_DEFAULTS = {
25070
+ fpsPerStream: 10,
25071
+ budgetMinutes: 45,
25072
+ minBudgetMinutes: 10,
25073
+ maxBudgetMinutes: 120,
25074
+ /** A result older than this no longer beats the table. */
25075
+ staleAfterDays: 30,
25076
+ /** Warm-in per ramp step (not accounted). */
25077
+ settleSec: 5,
25078
+ /** Accounted window per ramp step. */
25079
+ measureSec: 20,
25080
+ /** Longest the drain may take before the run is refused. */
25081
+ drainTimeoutSec: 120,
25082
+ /** Candidate models per device in one run. */
25083
+ maxModelsPerDevice: 6
25084
+ };
25085
+ /** The two measurements a run can make. */
25086
+ var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
25087
+ var NodeBenchmarkDevicePlanSchema = object({
25088
+ /** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
25089
+ deviceKey: string().min(1),
25090
+ /**
25091
+ * Root detector candidates for the `device` measurement, in the order
25092
+ * measured. The FIRST is the one the `pipeline` measurement runs.
25093
+ */
25094
+ modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
25095
+ });
25096
+ /** What the operator confirmed. */
25097
+ var NodeBenchmarkPlanSchema = object({
25098
+ nodeId: string().min(1),
25099
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25100
+ /** Which measurements run. At least one. */
25101
+ phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
25102
+ /**
25103
+ * Detail steps (catalog step ids under the root: faces, plates,
25104
+ * classifiers, CLIP…) the `pipeline` measurement enables. The root
25105
+ * detector always runs.
25106
+ */
25107
+ steps: array(string().min(1)).default([]),
25108
+ /** Offered rate of one stream / session. */
25109
+ fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
25110
+ /** Hard deadline: the mode ends and the cluster is restored when it passes. */
25111
+ budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
25112
+ /** Keep the models the run downloaded (default: delete what was not installed before). */
25113
+ keepDownloadedModels: boolean().default(false),
25114
+ /** Start although the other nodes' capacity does not cover the sessions running now. */
25115
+ acceptInsufficientHeadroom: boolean().default(false)
25116
+ });
25117
+ var NodeBenchmarkRefusalSchema = object({
25118
+ kind: _enum([
25119
+ "benchmark-active",
25120
+ "node-offline",
25121
+ "unknown-device",
25122
+ "no-phase",
25123
+ "insufficient-headroom"
25124
+ ]),
25125
+ detail: string(),
25126
+ overridable: boolean()
25127
+ });
25128
+ /** A camera whose detection leaves the node for the run. */
25129
+ var NodeBenchmarkMovingCameraSchema = object({
25130
+ deviceId: number(),
25131
+ /** Placed on the node now (a standing attach or a running session). */
25132
+ placedOnNode: boolean(),
25133
+ /** A node pin naming this node, ignored for the run. */
25134
+ pinnedToNode: boolean()
25135
+ });
25136
+ /** A camera that cannot leave: no other node can obtain its frames. */
25137
+ var NodeBenchmarkStayingCameraSchema = object({
25138
+ deviceId: number(),
25139
+ reason: literal("only-frame-source")
25140
+ });
25141
+ var NodeBenchmarkPreflightSchema = object({
25142
+ nodeId: string(),
25143
+ online: boolean(),
25144
+ moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
25145
+ /** Keep running on the node during the run; the result is flagged contaminated. */
25146
+ staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
25147
+ estimatedDurationMs: number(),
25148
+ /** The run ends and the cluster is restored at the latest after this long. */
25149
+ budgetMs: number(),
25150
+ phases: array(NodeBenchmarkPhaseSchema).readonly(),
25151
+ steps: array(string()).readonly(),
25152
+ devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
25153
+ /** Parallel sessions the cluster runs now, and what the other nodes can carry. */
25154
+ headroom: object({
25155
+ sessionsNow: number(),
25156
+ otherNodesCapacitySessions: number().nullable()
25157
+ }),
25158
+ refusals: array(NodeBenchmarkRefusalSchema).readonly(),
25159
+ canStart: boolean()
25160
+ });
25161
+ /** Where the measuring runner is. */
25162
+ var NodeBenchProgressSchema = object({
25163
+ phase: _enum([
25164
+ "preparing",
25165
+ "device",
25166
+ "pipeline",
25167
+ "cleanup"
25168
+ ]),
25169
+ deviceKey: string().nullable(),
25170
+ modelId: string().nullable(),
25171
+ /** Streams (device) or sessions (pipeline) of the step running now. */
25172
+ load: number().nullable(),
25173
+ cellsDone: number(),
25174
+ cellsTotal: number(),
25175
+ message: string()
25176
+ });
25177
+ /** What limited a ramp. `none` = the ramp ran out of steps still passing. */
25178
+ var NodeBenchLimitSchema = _enum([
25179
+ "p95",
25180
+ "drops",
25181
+ "errors",
25182
+ "stall",
25183
+ "cpu",
25184
+ "ram",
25185
+ "none"
25186
+ ]);
25187
+ var NodeBenchRampStepSchema = object({
25188
+ load: number(),
25189
+ pass: boolean(),
25190
+ p95Ms: number(),
25191
+ dropRatio: number(),
25192
+ /** Completed frames per second over the accounted window. */
25193
+ fps: number(),
25194
+ cpuPct: number().nullable(),
25195
+ ramFreePct: number().nullable(),
25196
+ failReasons: array(string()).readonly()
25197
+ });
25198
+ var NodeBenchCellSchema = discriminatedUnion("phase", [object({
25199
+ phase: literal("device"),
25200
+ deviceKey: string(),
25201
+ modelId: string(),
25202
+ /** Single-stream latency (the K = 1 step). */
25203
+ p50Ms: number(),
25204
+ p95Ms: number(),
25205
+ p99Ms: number(),
25206
+ /** Frames per second sustained at the last passing step. */
25207
+ fps: number(),
25208
+ /** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
25209
+ kMax: number(),
25210
+ limitedBy: NodeBenchLimitSchema,
25211
+ /** First call (model load + warm-up). */
25212
+ warmupMs: number(),
25213
+ ramp: array(NodeBenchRampStepSchema).readonly()
25214
+ }), object({
25215
+ phase: literal("pipeline"),
25216
+ deviceKey: string(),
25217
+ modelId: string(),
25218
+ steps: array(string()).readonly(),
25219
+ /** Parallel sessions at the camera rate the node carried; 0 = not even one. */
25220
+ maxSessions: number(),
25221
+ limitedBy: NodeBenchLimitSchema,
25222
+ /** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
25223
+ stepsFired: array(string()).readonly(),
25224
+ warmupMs: number(),
25225
+ ramp: array(NodeBenchRampStepSchema).readonly()
25226
+ })]);
25227
+ /**
25228
+ * What a result was measured ON. A result whose fingerprint no longer matches
25229
+ * the node no longer beats the table.
25230
+ */
25231
+ var NodeBenchFingerprintSchema = object({
25232
+ pipelineVersion: string().nullable(),
25233
+ cpuModel: string().nullable(),
25234
+ ramGb: number().nullable(),
25235
+ os: string().nullable(),
25236
+ /** Per device: the pool the cells ran on (runtime + tuning). */
25237
+ pools: record(string(), object({
25238
+ runtime: string(),
25239
+ numWorkers: number(),
25240
+ concurrency: number(),
25241
+ batchMode: string()
25242
+ })).default({})
25243
+ });
25244
+ /** The frames the run used. */
25245
+ var NodeBenchClipSchema = object({
25246
+ /** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
25247
+ id: string(),
25248
+ revision: string().nullable(),
25249
+ frames: number(),
25250
+ width: number(),
25251
+ height: number()
25252
+ });
25253
+ var NodeBenchRunnerInputSchema = object({
25254
+ runId: string().min(1),
25255
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25256
+ phases: array(NodeBenchmarkPhaseSchema).min(1),
25257
+ /** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
25258
+ steps: array(string()).default([]),
25259
+ fpsPerStream: number().int().min(1).max(30),
25260
+ /** The runner stops on its own past this instant, whatever the hub does. */
25261
+ deadlineAtMs: number(),
25262
+ settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
25263
+ measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
25264
+ keepDownloadedModels: boolean().default(false)
25265
+ });
25266
+ var NodeBenchRunnerStateSchema = _enum([
25267
+ "running",
25268
+ "done",
25269
+ "failed",
25270
+ "aborted"
25271
+ ]);
25272
+ var NodeBenchRunnerStatusSchema = object({
25273
+ runId: string(),
25274
+ nodeId: string(),
25275
+ state: NodeBenchRunnerStateSchema,
25276
+ progress: NodeBenchProgressSchema.nullable(),
25277
+ /** Every finished cell so far — a run stopped half way keeps what it measured. */
25278
+ cells: array(NodeBenchCellSchema).readonly(),
25279
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25280
+ clip: NodeBenchClipSchema.nullable(),
25281
+ /** Cameras seen running on the node during the run (they share its pools). */
25282
+ activeCameraIds: array(number()).readonly(),
25283
+ /** Models the run downloaded and then deleted (not installed before). */
25284
+ deletedModels: array(string()).readonly(),
25285
+ error: string().nullable(),
25286
+ startedAtMs: number(),
25287
+ finishedAtMs: number().nullable()
25288
+ });
25289
+ var NodeBenchmarkStateSchema = _enum([
25290
+ "draining",
25291
+ "measuring",
25292
+ "restoring",
25293
+ "done",
25294
+ "failed",
25295
+ "aborted"
25296
+ ]);
25297
+ /** Why a run ended. */
25298
+ var NodeBenchmarkEndReasonSchema = _enum([
25299
+ "completed",
25300
+ "operator-abort",
25301
+ "deadline",
25302
+ "node-lost",
25303
+ "runner-lost",
25304
+ "hub-restart",
25305
+ "drain-timeout",
25306
+ "failed"
25307
+ ]);
25308
+ var NodeBenchmarkRunSchema = object({
25309
+ runId: string(),
25310
+ nodeId: string(),
25311
+ state: NodeBenchmarkStateSchema,
25312
+ plan: NodeBenchmarkPlanSchema,
25313
+ startedAtMs: number(),
25314
+ deadlineAtMs: number(),
25315
+ finishedAtMs: number().nullable(),
25316
+ endReason: NodeBenchmarkEndReasonSchema.nullable(),
25317
+ error: string().nullable(),
25318
+ /** Cameras moved off the node for the run. */
25319
+ moved: array(number()).readonly(),
25320
+ /** Cameras that stayed (their only frame source is the node). */
25321
+ staying: array(number()).readonly(),
25322
+ /** Something else ran on the node's pools during the run. */
25323
+ contaminated: boolean(),
25324
+ progress: NodeBenchProgressSchema.nullable(),
25325
+ resultIds: array(string()).readonly()
25326
+ });
25327
+ /** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
25328
+ var NodeBenchmarkStatusSchema = object({
25329
+ /** The node the cluster is in benchmark mode for; null = none. */
25330
+ modeNodeId: string().nullable(),
25331
+ run: NodeBenchmarkRunSchema.nullable()
25332
+ });
25333
+ /**
25334
+ * One stored measurement — the only authority Auto tune and the automatic
25335
+ * shares read measured capacity from. Written by the orchestrator when a run
25336
+ * ends, never by anyone else.
25337
+ */
25338
+ var NodeBenchmarkResultSchema = object({
25339
+ id: string(),
25340
+ runId: string(),
25341
+ nodeId: string(),
25342
+ cell: NodeBenchCellSchema,
25343
+ fpsPerStream: number(),
25344
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25345
+ clip: NodeBenchClipSchema.nullable(),
25346
+ /** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
25347
+ contaminated: boolean(),
25348
+ stayingCameras: array(number()).readonly(),
25349
+ /** The run ended early; the cell itself completed. */
25350
+ partialRun: boolean(),
25351
+ measuredAtMs: number()
25352
+ });
25353
+ var ListNodeBenchmarkResultsInputSchema = object({
25354
+ nodeId: string().optional(),
25355
+ deviceKey: string().optional()
25356
+ });
25357
+ /** A result with its standing today: does it still beat the table? */
25358
+ var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
25359
+ /** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
25360
+ standing: _enum([
25361
+ "fresh",
25362
+ "stale",
25363
+ "superseded"
25364
+ ]),
25365
+ staleWhy: _enum([
25366
+ "age",
25367
+ "runtime",
25368
+ "pool-tuning"
25369
+ ]).nullable()
25370
+ });
25371
+ object({
25372
+ runId: string(),
25373
+ nodeId: string(),
25374
+ startedAtMs: number(),
25375
+ deadlineAtMs: number(),
25376
+ plan: NodeBenchmarkPlanSchema,
25377
+ moved: array(number()).readonly(),
25378
+ staying: array(number()).readonly()
25379
+ });
25380
+ /** Candidate detectors per device, for the plan editor. */
25381
+ var NodeBenchmarkCandidatesSchema = object({
25382
+ nodeId: string(),
25383
+ reachable: boolean(),
25384
+ devices: array(object({
25385
+ deviceKey: string(),
25386
+ enabled: boolean(),
25387
+ available: boolean(),
25388
+ /** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
25389
+ suggested: array(string()).readonly(),
25390
+ /** Every root detector the device has a build for. */
25391
+ all: array(string()).readonly(),
25392
+ /** The model the device runs now, when pinned. */
25393
+ currentModelId: string().nullable()
25394
+ })).readonly(),
25395
+ /** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
25396
+ steps: array(object({
25397
+ id: string(),
25398
+ name: string(),
25399
+ slot: string()
25400
+ })).readonly()
25401
+ });
23920
25402
  object({
23921
25403
  activeCameras: number(),
23922
25404
  throttledCameras: number(),
@@ -25005,7 +26487,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
25005
26487
  }), ParkedTrackFrameSchema.nullable()), method(object({
25006
26488
  deviceId: number(),
25007
26489
  trackId: string()
25008
- }), object({ released: number().int().nonnegative() }), { kind: "mutation" });
26490
+ }), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
26491
+ accepted: literal(true),
26492
+ runId: string()
26493
+ }), {
26494
+ kind: "mutation",
26495
+ auth: "admin"
26496
+ }), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
26497
+ kind: "mutation",
26498
+ auth: "admin"
26499
+ });
25009
26500
  var CameraPipelineConfigSchema = object({
25010
26501
  engine: PipelineEngineChoiceSchema.optional(),
25011
26502
  steps: array(PipelineStepInputSchema).readonly(),
@@ -25644,6 +27135,21 @@ method(object({
25644
27135
  }), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
25645
27136
  kind: "mutation",
25646
27137
  auth: "admin"
27138
+ }), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
27139
+ kind: literal("started"),
27140
+ runId: string()
27141
+ }), object({
27142
+ kind: literal("refused"),
27143
+ preflight: NodeBenchmarkPreflightSchema
27144
+ })]), {
27145
+ kind: "mutation",
27146
+ auth: "admin"
27147
+ }), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
27148
+ kind: "mutation",
27149
+ auth: "admin"
27150
+ }), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
27151
+ kind: "mutation",
27152
+ auth: "admin"
25647
27153
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
25648
27154
  deviceId: number(),
25649
27155
  addonId: string(),
@@ -30725,6 +32231,9 @@ var CreateIntegrationInputSchema = object({
30725
32231
  enabled: boolean().optional(),
30726
32232
  info: record(string(), unknown()).optional(),
30727
32233
  settings: record(string(), unknown()).optional(),
32234
+ /** Keys of `settings` the form's schema declares secret (by type) — kept in
32235
+ * the keychain, not the table (D787). */
32236
+ secretKeys: array(string()).optional(),
30728
32237
  skipRestart: boolean().optional()
30729
32238
  });
30730
32239
  var UpdateIntegrationInputSchema = object({
@@ -30748,7 +32257,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
30748
32257
  auth: "admin"
30749
32258
  }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
30750
32259
  id: string(),
30751
- settings: record(string(), unknown())
32260
+ settings: record(string(), unknown()),
32261
+ /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
32262
+ secretKeys: array(string()).optional()
30752
32263
  }), object({ success: boolean() }), {
30753
32264
  kind: "mutation",
30754
32265
  auth: "admin"
@@ -39514,6 +41025,90 @@ Object.freeze({
39514
41025
  addonId: null,
39515
41026
  access: "create"
39516
41027
  },
41028
+ "keychain.delete": {
41029
+ capName: "keychain",
41030
+ capScope: "system",
41031
+ addonId: null,
41032
+ access: "delete"
41033
+ },
41034
+ "keychain.getState": {
41035
+ capName: "keychain",
41036
+ capScope: "system",
41037
+ addonId: null,
41038
+ access: "view"
41039
+ },
41040
+ "keychain.listMeta": {
41041
+ capName: "keychain",
41042
+ capScope: "system",
41043
+ addonId: null,
41044
+ access: "view"
41045
+ },
41046
+ "keychain.put": {
41047
+ capName: "keychain",
41048
+ capScope: "system",
41049
+ addonId: null,
41050
+ access: "create"
41051
+ },
41052
+ "keychain.resolve": {
41053
+ capName: "keychain",
41054
+ capScope: "system",
41055
+ addonId: null,
41056
+ access: "view"
41057
+ },
41058
+ "keychainAdmin.deleteOrphans": {
41059
+ capName: "keychain-admin",
41060
+ capScope: "system",
41061
+ addonId: null,
41062
+ access: "delete"
41063
+ },
41064
+ "keychainAdmin.downloadRecoveryKey": {
41065
+ capName: "keychain-admin",
41066
+ capScope: "system",
41067
+ addonId: null,
41068
+ access: "create"
41069
+ },
41070
+ "keychainAdmin.listAudit": {
41071
+ capName: "keychain-admin",
41072
+ capScope: "system",
41073
+ addonId: null,
41074
+ access: "view"
41075
+ },
41076
+ "keychainAdmin.listSecrets": {
41077
+ capName: "keychain-admin",
41078
+ capScope: "system",
41079
+ addonId: null,
41080
+ access: "view"
41081
+ },
41082
+ "keychainAdmin.purgeRetiredKeys": {
41083
+ capName: "keychain-admin",
41084
+ capScope: "system",
41085
+ addonId: null,
41086
+ access: "delete"
41087
+ },
41088
+ "keychainAdmin.resetKeychain": {
41089
+ capName: "keychain-admin",
41090
+ capScope: "system",
41091
+ addonId: null,
41092
+ access: "delete"
41093
+ },
41094
+ "keychainAdmin.reveal": {
41095
+ capName: "keychain-admin",
41096
+ capScope: "system",
41097
+ addonId: null,
41098
+ access: "create"
41099
+ },
41100
+ "keychainAdmin.rotateMasterKey": {
41101
+ capName: "keychain-admin",
41102
+ capScope: "system",
41103
+ addonId: null,
41104
+ access: "create"
41105
+ },
41106
+ "keychainAdmin.status": {
41107
+ capName: "keychain-admin",
41108
+ capScope: "system",
41109
+ addonId: null,
41110
+ access: "view"
41111
+ },
39517
41112
  "lawnMowerControl.dock": {
39518
41113
  capName: "lawn-mower-control",
39519
41114
  capScope: "device",
@@ -40888,6 +42483,18 @@ Object.freeze({
40888
42483
  addonId: null,
40889
42484
  access: "create"
40890
42485
  },
42486
+ "pipelineAnalytics.addRetrainFrameFromRecording": {
42487
+ capName: "pipeline-analytics",
42488
+ capScope: "device",
42489
+ addonId: null,
42490
+ access: "create"
42491
+ },
42492
+ "pipelineAnalytics.addRetrainFramesToCollection": {
42493
+ capName: "pipeline-analytics",
42494
+ capScope: "device",
42495
+ addonId: null,
42496
+ access: "create"
42497
+ },
40891
42498
  "pipelineAnalytics.applyDeviceSettingsPatch": {
40892
42499
  capName: "pipeline-analytics",
40893
42500
  capScope: "device",
@@ -40936,12 +42543,24 @@ Object.freeze({
40936
42543
  addonId: null,
40937
42544
  access: "view"
40938
42545
  },
42546
+ "pipelineAnalytics.createRetrainCollection": {
42547
+ capName: "pipeline-analytics",
42548
+ capScope: "device",
42549
+ addonId: null,
42550
+ access: "create"
42551
+ },
40939
42552
  "pipelineAnalytics.deleteDeviceEvents": {
40940
42553
  capName: "pipeline-analytics",
40941
42554
  capScope: "device",
40942
42555
  addonId: null,
40943
42556
  access: "delete"
40944
42557
  },
42558
+ "pipelineAnalytics.deleteRetrainCollection": {
42559
+ capName: "pipeline-analytics",
42560
+ capScope: "device",
42561
+ addonId: null,
42562
+ access: "delete"
42563
+ },
40945
42564
  "pipelineAnalytics.deleteTracks": {
40946
42565
  capName: "pipeline-analytics",
40947
42566
  capScope: "device",
@@ -41146,6 +42765,24 @@ Object.freeze({
41146
42765
  addonId: null,
41147
42766
  access: "view"
41148
42767
  },
42768
+ "pipelineAnalytics.listRetrainAssistProfiles": {
42769
+ capName: "pipeline-analytics",
42770
+ capScope: "device",
42771
+ addonId: null,
42772
+ access: "view"
42773
+ },
42774
+ "pipelineAnalytics.listRetrainCollectionFrames": {
42775
+ capName: "pipeline-analytics",
42776
+ capScope: "device",
42777
+ addonId: null,
42778
+ access: "view"
42779
+ },
42780
+ "pipelineAnalytics.listRetrainCollections": {
42781
+ capName: "pipeline-analytics",
42782
+ capScope: "device",
42783
+ addonId: null,
42784
+ access: "view"
42785
+ },
41149
42786
  "pipelineAnalytics.listRetrainFrames": {
41150
42787
  capName: "pipeline-analytics",
41151
42788
  capScope: "device",
@@ -41194,6 +42831,12 @@ Object.freeze({
41194
42831
  addonId: null,
41195
42832
  access: "create"
41196
42833
  },
42834
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
42835
+ capName: "pipeline-analytics",
42836
+ capScope: "device",
42837
+ addonId: null,
42838
+ access: "create"
42839
+ },
41197
42840
  "pipelineAnalytics.pruneEvents": {
41198
42841
  capName: "pipeline-analytics",
41199
42842
  capScope: "device",
@@ -41248,6 +42891,18 @@ Object.freeze({
41248
42891
  addonId: null,
41249
42892
  access: "create"
41250
42893
  },
42894
+ "pipelineAnalytics.removeRetrainFrameFromCollection": {
42895
+ capName: "pipeline-analytics",
42896
+ capScope: "device",
42897
+ addonId: null,
42898
+ access: "delete"
42899
+ },
42900
+ "pipelineAnalytics.renameRetrainCollection": {
42901
+ capName: "pipeline-analytics",
42902
+ capScope: "device",
42903
+ addonId: null,
42904
+ access: "create"
42905
+ },
41251
42906
  "pipelineAnalytics.restageRetrainTrack": {
41252
42907
  capName: "pipeline-analytics",
41253
42908
  capScope: "device",
@@ -41536,6 +43191,12 @@ Object.freeze({
41536
43191
  addonId: null,
41537
43192
  access: "view"
41538
43193
  },
43194
+ "pipelineOrchestrator.abortNodeBenchmark": {
43195
+ capName: "pipeline-orchestrator",
43196
+ capScope: "system",
43197
+ addonId: null,
43198
+ access: "create"
43199
+ },
41539
43200
  "pipelineOrchestrator.applyAutoTune": {
41540
43201
  capName: "pipeline-orchestrator",
41541
43202
  capScope: "system",
@@ -41560,6 +43221,12 @@ Object.freeze({
41560
43221
  addonId: null,
41561
43222
  access: "create"
41562
43223
  },
43224
+ "pipelineOrchestrator.deleteNodeBenchmarkResult": {
43225
+ capName: "pipeline-orchestrator",
43226
+ capScope: "system",
43227
+ addonId: null,
43228
+ access: "delete"
43229
+ },
41563
43230
  "pipelineOrchestrator.getAgentLoad": {
41564
43231
  capName: "pipeline-orchestrator",
41565
43232
  capScope: "system",
@@ -41668,6 +43335,24 @@ Object.freeze({
41668
43335
  addonId: null,
41669
43336
  access: "view"
41670
43337
  },
43338
+ "pipelineOrchestrator.getNodeBenchmarkCandidates": {
43339
+ capName: "pipeline-orchestrator",
43340
+ capScope: "system",
43341
+ addonId: null,
43342
+ access: "view"
43343
+ },
43344
+ "pipelineOrchestrator.getNodeBenchmarkPreflight": {
43345
+ capName: "pipeline-orchestrator",
43346
+ capScope: "system",
43347
+ addonId: null,
43348
+ access: "view"
43349
+ },
43350
+ "pipelineOrchestrator.getNodeBenchmarkStatus": {
43351
+ capName: "pipeline-orchestrator",
43352
+ capScope: "system",
43353
+ addonId: null,
43354
+ access: "view"
43355
+ },
41671
43356
  "pipelineOrchestrator.getNodeInferenceDevices": {
41672
43357
  capName: "pipeline-orchestrator",
41673
43358
  capScope: "system",
@@ -41710,6 +43395,12 @@ Object.freeze({
41710
43395
  addonId: null,
41711
43396
  access: "view"
41712
43397
  },
43398
+ "pipelineOrchestrator.listNodeBenchmarkResults": {
43399
+ capName: "pipeline-orchestrator",
43400
+ capScope: "system",
43401
+ addonId: null,
43402
+ access: "view"
43403
+ },
41713
43404
  "pipelineOrchestrator.pauseForStorageMigration": {
41714
43405
  capName: "pipeline-orchestrator",
41715
43406
  capScope: "system",
@@ -41854,6 +43545,12 @@ Object.freeze({
41854
43545
  addonId: null,
41855
43546
  access: "create"
41856
43547
  },
43548
+ "pipelineOrchestrator.startNodeBenchmark": {
43549
+ capName: "pipeline-orchestrator",
43550
+ capScope: "system",
43551
+ addonId: null,
43552
+ access: "create"
43553
+ },
41857
43554
  "pipelineOrchestrator.suggestShares": {
41858
43555
  capName: "pipeline-orchestrator",
41859
43556
  capScope: "system",
@@ -41872,6 +43569,12 @@ Object.freeze({
41872
43569
  addonId: null,
41873
43570
  access: "create"
41874
43571
  },
43572
+ "pipelineRunner.abortNodeBench": {
43573
+ capName: "pipeline-runner",
43574
+ capScope: "system",
43575
+ addonId: null,
43576
+ access: "create"
43577
+ },
41875
43578
  "pipelineRunner.attachCamera": {
41876
43579
  capName: "pipeline-runner",
41877
43580
  capScope: "system",
@@ -41920,6 +43623,12 @@ Object.freeze({
41920
43623
  addonId: null,
41921
43624
  access: "view"
41922
43625
  },
43626
+ "pipelineRunner.getNodeBenchStatus": {
43627
+ capName: "pipeline-runner",
43628
+ capScope: "system",
43629
+ addonId: null,
43630
+ access: "view"
43631
+ },
41923
43632
  "pipelineRunner.getParkedTrackFrame": {
41924
43633
  capName: "pipeline-runner",
41925
43634
  capScope: "system",
@@ -41962,6 +43671,12 @@ Object.freeze({
41962
43671
  addonId: null,
41963
43672
  access: "create"
41964
43673
  },
43674
+ "pipelineRunner.startNodeBench": {
43675
+ capName: "pipeline-runner",
43676
+ capScope: "system",
43677
+ addonId: null,
43678
+ access: "create"
43679
+ },
41965
43680
  "plateGallery.assignPlate": {
41966
43681
  capName: "plate-gallery",
41967
43682
  capScope: "system",
@@ -46891,6 +48606,11 @@ Object.freeze({
46891
48606
  form: "single",
46892
48607
  optional: false
46893
48608
  }],
48609
+ "pipelineAnalytics.addRetrainFrameFromRecording": [{
48610
+ name: "deviceId",
48611
+ form: "single",
48612
+ optional: false
48613
+ }],
46894
48614
  "pipelineAnalytics.applyDeviceSettingsPatch": [{
46895
48615
  name: "deviceId",
46896
48616
  form: "single",
@@ -47081,6 +48801,11 @@ Object.freeze({
47081
48801
  form: "single",
47082
48802
  optional: false
47083
48803
  }],
48804
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
48805
+ name: "deviceId",
48806
+ form: "single",
48807
+ optional: false
48808
+ }],
47084
48809
  "pipelineAnalytics.pruneEventsBefore": [{
47085
48810
  name: "deviceId",
47086
48811
  form: "single",