@camstack/addon-provider-onvif 1.2.122 → 1.2.123

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.
Files changed (3) hide show
  1. package/dist/addon.js +1780 -55
  2. package/dist/addon.mjs +1780 -55
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -3,7 +3,7 @@ import { createRequire } from "node:module";
3
3
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
4
4
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
5
  //#endregion
6
- //#region ../types/dist/event-category-B_0XEcLF.mjs
6
+ //#region ../types/dist/event-category-DaIZi00R.mjs
7
7
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
8
8
  EventCategory["SystemBoot"] = "system.boot";
9
9
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -82,6 +82,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
82
82
  */
83
83
  EventCategory["AddonLoadFailed"] = "addon.load-failed";
84
84
  /**
85
+ * A keychain value was stored or removed (D787). Carries the ref, its
86
+ * owner and the new version — NEVER the value. A process holding the ref
87
+ * drops its cached copy and the owning `BaseAddon` re-resolves its config.
88
+ * Telemetry (D8): a process that misses it still revalidates by version.
89
+ */
90
+ EventCategory["KeychainChanged"] = "keychain.changed";
91
+ /**
85
92
  * Addon recovered from a previous failure. Emitted when an addon
86
93
  * transitions from `failed` back to `healthy` (typically via the
87
94
  * monitor's auto-retry loop, or after manual `addons.retryLoad`).
@@ -5374,7 +5381,7 @@ var ZodIssueCode = {
5374
5381
  var ZodFirstPartyTypeKind;
5375
5382
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5376
5383
  //#endregion
5377
- //#region ../types/dist/sleep-B0JG7-_F.mjs
5384
+ //#region ../types/dist/sleep-Cr5YOk3m.mjs
5378
5385
  /**
5379
5386
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5380
5387
  * window to float samples (D455).
@@ -5453,6 +5460,97 @@ function buildAlawTable() {
5453
5460
  }
5454
5461
  buildUlawTable();
5455
5462
  buildAlawTable();
5463
+ /** Is this field's stored value a credential? */
5464
+ function isSecretConfigField(field) {
5465
+ if (field.type === "password") return true;
5466
+ return "secret" in field && field.secret === true;
5467
+ }
5468
+ /**
5469
+ * Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
5470
+ * by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
5471
+ */
5472
+ function isKeychainStoredField(field) {
5473
+ if (!isSecretConfigField(field)) return false;
5474
+ if (field.type === "textarea" && field.isJson === true) return false;
5475
+ return !("storage" in field && field.storage === "inline");
5476
+ }
5477
+ /**
5478
+ * What a settings blob holds where a secret used to be.
5479
+ *
5480
+ * A keychain-stored field never holds its value. It holds a self-describing
5481
+ * MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
5482
+ * code can mistake it for a credential and no form can send it to a camera as
5483
+ * a password. The empty state is `null` / absent, never `''`.
5484
+ *
5485
+ * The same shapes travel to and from the admin UI:
5486
+ *
5487
+ * - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
5488
+ * (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
5489
+ * value is set, never the value.
5490
+ * - write: an untouched field submits the view back unchanged (KEEP); a typed
5491
+ * value is a plain non-empty string (CHANGE); the Clear button submits
5492
+ * {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
5493
+ * are KEEP — an empty string is what a defaults-fallback pushes back, and
5494
+ * treating it as "clear" is how a save destroyed a stored credential before.
5495
+ *
5496
+ * Pure and browser-safe.
5497
+ */
5498
+ var SECRET_CLEAR = { $secretClear: true };
5499
+ /** The `'***'` token D634 redaction writes for non-admins. */
5500
+ var LEGACY_DEVICE_REDACTION = "***";
5501
+ function isRecord$1(value) {
5502
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5503
+ }
5504
+ function makeSecretMarker(ref) {
5505
+ return {
5506
+ $secret: ref,
5507
+ v: 1
5508
+ };
5509
+ }
5510
+ /** A stored marker: an object whose `$secret` is a non-empty string. */
5511
+ function isSecretMarker(value) {
5512
+ if (!isRecord$1(value)) return false;
5513
+ const ref = value["$secret"];
5514
+ return typeof ref === "string" && ref.length > 0;
5515
+ }
5516
+ function isSecretClear(value) {
5517
+ return isRecord$1(value) && value["$secretClear"] === true;
5518
+ }
5519
+ /**
5520
+ * The UI view of a stored secret field value: a marker becomes "set", inline
5521
+ * plaintext becomes "set (inline)", nothing becomes `null`. A value never
5522
+ * survives this function.
5523
+ */
5524
+ function toSecretFieldView(stored) {
5525
+ if (isSecretMarker(stored)) return {
5526
+ $secret: stored.$secret,
5527
+ v: 1,
5528
+ set: true
5529
+ };
5530
+ if (typeof stored === "string" && stored.length > 0) return {
5531
+ $secret: null,
5532
+ v: 1,
5533
+ set: true,
5534
+ inline: true
5535
+ };
5536
+ return null;
5537
+ }
5538
+ /**
5539
+ * Classify an incoming value for a secret path. Only a non-empty string that is
5540
+ * not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
5541
+ * Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
5542
+ * `undefined`, a redaction token, a non-string — keeps what is stored.
5543
+ */
5544
+ function classifySecretWrite(incoming) {
5545
+ if (isSecretClear(incoming)) return { kind: "clear" };
5546
+ if (typeof incoming !== "string") return { kind: "keep" };
5547
+ if (incoming.length === 0) return { kind: "keep" };
5548
+ if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
5549
+ return {
5550
+ kind: "set",
5551
+ value: incoming
5552
+ };
5553
+ }
5456
5554
  Object.fromEntries([
5457
5555
  {
5458
5556
  id: "overview",
@@ -5624,33 +5722,19 @@ Object.fromEntries([
5624
5722
  function isValuelessField(field) {
5625
5723
  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";
5626
5724
  }
5627
- /**
5628
- * Merge a `ConfigUISchema` with a raw `values` record into a
5629
- * `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
5630
- * before returning to the admin UI. Groups are walked recursively.
5631
- *
5632
- * For each leaf field:
5633
- * - structural fields (`separator`, `info`, `button`) pass through unchanged
5634
- * - other fields get `value = values[key] ?? field.default ?? null`
5635
- *
5636
- * Unknown keys in `values` (keys not declared in the schema) are silently
5637
- * ignored — they don't contribute to the output. Missing keys fall back to
5638
- * the schema default or `null`. This mirrors the old backend behaviour where
5639
- * `FormBuilder` rendered `values[key] ?? field.default`.
5640
- */
5641
- function hydrateSchema(schema, values) {
5725
+ function hydrateSchema(schema, values, options = {}) {
5642
5726
  return {
5643
5727
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
5644
5728
  sections: schema.sections.map((section) => ({
5645
5729
  ...section,
5646
- fields: section.fields.map((field) => hydrateField(field, values))
5730
+ fields: section.fields.map((field) => hydrateField(field, values, options))
5647
5731
  }))
5648
5732
  };
5649
5733
  }
5650
- function hydrateField(field, values) {
5734
+ function hydrateField(field, values, options) {
5651
5735
  if (isValuelessField(field)) return field;
5652
5736
  if (field.type === "group") {
5653
- const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
5737
+ const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
5654
5738
  return {
5655
5739
  ...field,
5656
5740
  fields: hydratedChildren
@@ -5659,7 +5743,7 @@ function hydrateField(field, values) {
5659
5743
  if (field.type === "sub-tabs") {
5660
5744
  const hydratedTabs = field.tabs.map((tab) => ({
5661
5745
  ...tab,
5662
- fields: tab.fields.map((child) => hydrateField(child, values))
5746
+ fields: tab.fields.map((child) => hydrateField(child, values, options))
5663
5747
  }));
5664
5748
  return {
5665
5749
  ...field,
@@ -5669,6 +5753,33 @@ function hydrateField(field, values) {
5669
5753
  const key = field.key;
5670
5754
  const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
5671
5755
  const defaultValue = field.default;
5756
+ const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
5757
+ if (isKeychainStoredField(field) && asView(storedValue)) return {
5758
+ ...field,
5759
+ value: toSecretFieldView(storedValue)
5760
+ };
5761
+ if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
5762
+ ...field,
5763
+ value: null
5764
+ };
5765
+ if (field.type === "editable-array" && Array.isArray(storedValue)) {
5766
+ const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
5767
+ if (secretItemKeys.length > 0) {
5768
+ const rows = storedValue.map((row) => {
5769
+ if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
5770
+ const out = { ...row };
5771
+ for (const k of secretItemKeys) {
5772
+ const v = Reflect.get(row, k);
5773
+ if (asView(v)) out[k] = toSecretFieldView(v);
5774
+ }
5775
+ return out;
5776
+ });
5777
+ return {
5778
+ ...field,
5779
+ value: rows
5780
+ };
5781
+ }
5782
+ }
5672
5783
  if (field.multiple) {
5673
5784
  const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
5674
5785
  const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
@@ -5911,6 +6022,431 @@ function projectStore(store, perNodeKeys, nodeId) {
5911
6022
  }
5912
6023
  return out;
5913
6024
  }
6025
+ var GLOBAL_SCOPE = { kind: "global" };
6026
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6027
+ function globalSecretScope() {
6028
+ return GLOBAL_SCOPE;
6029
+ }
6030
+ function encodeSegment(value) {
6031
+ return encodeURIComponent(value);
6032
+ }
6033
+ /**
6034
+ * The field path of a value inside an array item, addressed by the item's id:
6035
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6036
+ * `providers[authentik].clientSecret`.
6037
+ */
6038
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6039
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6040
+ }
6041
+ /** A write to a secret path could not be stored in the keychain, so it was refused. */
6042
+ var KeychainWriteRefusedError = class extends Error {
6043
+ fieldPath;
6044
+ constructor(fieldPath, cause) {
6045
+ super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
6046
+ this.fieldPath = fieldPath;
6047
+ this.name = "KeychainWriteRefusedError";
6048
+ }
6049
+ };
6050
+ var KEEP = { kind: "keep" };
6051
+ function isRecord(value) {
6052
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6053
+ }
6054
+ function defaultMintId() {
6055
+ return globalThis.crypto.randomUUID();
6056
+ }
6057
+ /** Every marker ref anywhere under `value`. */
6058
+ function collectSecretMarkerRefs(value, out = []) {
6059
+ if (isSecretMarker(value)) {
6060
+ out.push(value.$secret);
6061
+ return out;
6062
+ }
6063
+ if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6064
+ else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6065
+ return out;
6066
+ }
6067
+ async function storedValueEquals(secrets, marker, candidate) {
6068
+ const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
6069
+ return resolved?.kind === "value" && resolved.value === candidate;
6070
+ }
6071
+ async function writeLeaf(ctx, incoming, stored, fieldPath) {
6072
+ const intent = classifySecretWrite(incoming);
6073
+ const ref = ctx.secrets.ref(ctx.scope, fieldPath);
6074
+ const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
6075
+ if (intent.kind === "keep") return KEEP;
6076
+ if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
6077
+ if (intent.kind === "clear") {
6078
+ if (storedIsOurs) ctx.deletes.push(ref);
6079
+ return {
6080
+ kind: "value",
6081
+ value: null
6082
+ };
6083
+ }
6084
+ if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
6085
+ kind: "value",
6086
+ value: stored
6087
+ };
6088
+ try {
6089
+ await ctx.secrets.put(ref, intent.value);
6090
+ } catch (err) {
6091
+ throw new KeychainWriteRefusedError(fieldPath, err);
6092
+ }
6093
+ return {
6094
+ kind: "value",
6095
+ value: makeSecretMarker(ref)
6096
+ };
6097
+ }
6098
+ /** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
6099
+ function applyMember(out, key, result, storedParent) {
6100
+ if (result.kind === "value") {
6101
+ out[key] = result.value;
6102
+ return;
6103
+ }
6104
+ if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
6105
+ else delete out[key];
6106
+ }
6107
+ async function writeMembers(ctx, children, incoming, stored, pathOf) {
6108
+ const out = { ...incoming };
6109
+ for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
6110
+ return out;
6111
+ }
6112
+ function rowId(row, idKey) {
6113
+ const raw = row[idKey];
6114
+ if (typeof raw === "string" && raw.length > 0) return raw;
6115
+ if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
6116
+ return null;
6117
+ }
6118
+ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6119
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6120
+ if (!Array.isArray(incoming)) {
6121
+ ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6122
+ return {
6123
+ kind: "value",
6124
+ value: incoming
6125
+ };
6126
+ }
6127
+ const storedById = /* @__PURE__ */ new Map();
6128
+ for (const row of storedRows) {
6129
+ const id = rowId(row, node.idKey);
6130
+ if (id !== null) storedById.set(id, row);
6131
+ }
6132
+ const kept = /* @__PURE__ */ new Set();
6133
+ const rows = [];
6134
+ for (const row of incoming) {
6135
+ if (!isRecord(row)) {
6136
+ rows.push(row);
6137
+ continue;
6138
+ }
6139
+ const id = rowId(row, node.idKey) ?? ctx.mintId();
6140
+ kept.add(id);
6141
+ const withId = {
6142
+ ...row,
6143
+ [node.idKey]: row[node.idKey] ?? id
6144
+ };
6145
+ if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
6146
+ const storedRow = storedById.get(id) ?? {};
6147
+ rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
6148
+ }
6149
+ for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
6150
+ return {
6151
+ kind: "value",
6152
+ value: rows
6153
+ };
6154
+ }
6155
+ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6156
+ switch (node.kind) {
6157
+ case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6158
+ case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6159
+ case "object": {
6160
+ if (!isRecord(incoming)) {
6161
+ if (incoming === void 0) return KEEP;
6162
+ ctx.deletes.push(...collectSecretMarkerRefs(stored));
6163
+ return {
6164
+ kind: "value",
6165
+ value: incoming
6166
+ };
6167
+ }
6168
+ const storedObj = isRecord(stored) ? stored : {};
6169
+ return {
6170
+ kind: "value",
6171
+ value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
6172
+ };
6173
+ }
6174
+ }
6175
+ }
6176
+ /** Split a perNode-scoped key (`key@nodeId`). */
6177
+ function splitNodeKey(key) {
6178
+ const at = key.indexOf("@");
6179
+ return at <= 0 ? {
6180
+ base: key,
6181
+ nodeId: null
6182
+ } : {
6183
+ base: key.slice(0, at),
6184
+ nodeId: key.slice(at + 1)
6185
+ };
6186
+ }
6187
+ /** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
6188
+ async function transformSecretWrite(input) {
6189
+ const deletes = [];
6190
+ const base = {
6191
+ secrets: input.secrets,
6192
+ mintId: input.mintId ?? defaultMintId,
6193
+ deletes,
6194
+ operatorWrite: input.operatorWrite === true
6195
+ };
6196
+ const out = {};
6197
+ for (const [key, incoming] of Object.entries(input.patch)) {
6198
+ const { base: baseKey, nodeId } = splitNodeKey(key);
6199
+ const node = input.tree.get(baseKey);
6200
+ if (node === void 0) {
6201
+ out[key] = incoming;
6202
+ continue;
6203
+ }
6204
+ const scope = nodeId !== null && nodeId.length > 0 ? {
6205
+ kind: "node",
6206
+ nodeId
6207
+ } : input.scope ?? globalSecretScope();
6208
+ const result = await writeNode({
6209
+ ...base,
6210
+ scope
6211
+ }, node, incoming, input.stored[key], baseKey);
6212
+ if (result.kind === "value") out[key] = result.value;
6213
+ }
6214
+ return {
6215
+ patch: out,
6216
+ afterWrite: async () => {
6217
+ if (deletes.length === 0) return { orphaned: [] };
6218
+ try {
6219
+ await input.secrets.delete([...new Set(deletes)]);
6220
+ return { orphaned: [] };
6221
+ } catch {
6222
+ return { orphaned: [...new Set(deletes)] };
6223
+ }
6224
+ }
6225
+ };
6226
+ }
6227
+ /**
6228
+ * Replace every marker in `value` with its keychain value. Returns the SAME
6229
+ * reference when there is no marker (no allocation, no keychain call).
6230
+ */
6231
+ async function resolveSecretMarkers(value, secrets) {
6232
+ const refs = collectSecretMarkerRefs(value);
6233
+ if (refs.length === 0) return {
6234
+ value,
6235
+ unresolved: []
6236
+ };
6237
+ const answers = await secrets.resolve(refs);
6238
+ const unresolved = [];
6239
+ for (const ref of new Set(refs)) {
6240
+ const answer = answers[ref];
6241
+ if (answer === void 0) unresolved.push({
6242
+ ref,
6243
+ reason: "not-initialized"
6244
+ });
6245
+ else if (answer.kind === "unavailable") unresolved.push({
6246
+ ref,
6247
+ reason: answer.reason
6248
+ });
6249
+ else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
6250
+ ref,
6251
+ reason: answer.kind
6252
+ });
6253
+ }
6254
+ const substitute = (v) => {
6255
+ if (isSecretMarker(v)) {
6256
+ const answer = answers[v.$secret];
6257
+ return answer?.kind === "value" ? {
6258
+ keep: true,
6259
+ value: answer.value
6260
+ } : {
6261
+ keep: false,
6262
+ value: void 0
6263
+ };
6264
+ }
6265
+ if (Array.isArray(v)) {
6266
+ const items = [];
6267
+ for (const item of v) {
6268
+ const s = substitute(item);
6269
+ if (s.keep) items.push(s.value);
6270
+ }
6271
+ return {
6272
+ keep: true,
6273
+ value: items
6274
+ };
6275
+ }
6276
+ if (isRecord(v)) {
6277
+ const out = {};
6278
+ for (const [k, child] of Object.entries(v)) {
6279
+ const s = substitute(child);
6280
+ if (s.keep) out[k] = s.value;
6281
+ }
6282
+ return {
6283
+ keep: true,
6284
+ value: out
6285
+ };
6286
+ }
6287
+ return {
6288
+ keep: true,
6289
+ value: v
6290
+ };
6291
+ };
6292
+ return {
6293
+ value: substitute(value).value,
6294
+ unresolved
6295
+ };
6296
+ }
6297
+ function touchesTree(tree, patch) {
6298
+ if (tree.size === 0) return false;
6299
+ for (const key of Object.keys(patch)) {
6300
+ const at = key.indexOf("@");
6301
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6302
+ }
6303
+ return false;
6304
+ }
6305
+ /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6306
+ async function readStoredAddonBlob(raw) {
6307
+ const threeWay = raw.readAddonStoreResult;
6308
+ if (threeWay === void 0) return raw.readAddonStore();
6309
+ const result = await threeWay.call(raw);
6310
+ if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6311
+ return result.kind === "missing" ? {} : result.value;
6312
+ }
6313
+ function createSecretAwareSettings(raw, opts) {
6314
+ const chains = /* @__PURE__ */ new Map();
6315
+ const serialize = (key, fn) => {
6316
+ const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
6317
+ const tail = next.catch(() => void 0);
6318
+ chains.set(key, tail);
6319
+ tail.then(() => {
6320
+ if (chains.get(key) === tail) chains.delete(key);
6321
+ });
6322
+ return next;
6323
+ };
6324
+ const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6325
+ if (!touchesTree(tree, patch)) return rawWrite(patch);
6326
+ return serialize(chainKey, async () => {
6327
+ const stored = await readStored();
6328
+ const result = await transformSecretWrite({
6329
+ tree,
6330
+ secrets: opts.secrets,
6331
+ patch,
6332
+ stored,
6333
+ ...scope !== void 0 ? { scope } : {},
6334
+ operatorWrite: opts.isOperatorWrite?.() === true
6335
+ });
6336
+ if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6337
+ const { orphaned } = await result.afterWrite();
6338
+ if (orphaned.length > 0) opts.onOrphaned(orphaned);
6339
+ });
6340
+ };
6341
+ const wrapped = {
6342
+ writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6343
+ writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6344
+ kind: "device",
6345
+ deviceId
6346
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6347
+ };
6348
+ return new Proxy(raw, { get(target, prop, receiver) {
6349
+ if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6350
+ if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6351
+ const value = Reflect.get(target, prop, receiver);
6352
+ return typeof value === "function" ? value.bind(target) : value;
6353
+ } });
6354
+ }
6355
+ /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6356
+ function withSecretAwareSettings(context, opts) {
6357
+ const raw = context.settings;
6358
+ if (raw === void 0) return context;
6359
+ const settings = createSecretAwareSettings(raw, opts);
6360
+ return new Proxy(context, { get(target, prop, receiver) {
6361
+ if (prop === "settings") return settings;
6362
+ return Reflect.get(target, prop, receiver);
6363
+ } });
6364
+ }
6365
+ var LEAF = { kind: "leaf" };
6366
+ var DEFAULT_ITEM_ID_KEY = "id";
6367
+ function collectFields(fields, out) {
6368
+ for (const field of fields) {
6369
+ if (field.type === "group") {
6370
+ collectFields(field.fields, out);
6371
+ continue;
6372
+ }
6373
+ if (field.type === "sub-tabs") {
6374
+ for (const tab of field.tabs) collectFields(tab.fields, out);
6375
+ continue;
6376
+ }
6377
+ if (field.type === "editable-array") {
6378
+ const item = /* @__PURE__ */ new Map();
6379
+ for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
6380
+ if (item.size > 0) out.set(field.key, {
6381
+ kind: "array",
6382
+ idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
6383
+ item
6384
+ });
6385
+ continue;
6386
+ }
6387
+ if (!("key" in field) || typeof field.key !== "string") continue;
6388
+ if (isKeychainStoredField(field)) out.set(field.key, LEAF);
6389
+ }
6390
+ }
6391
+ /** The secret tree a settings schema declares. */
6392
+ function secretTreeFromSchema(schema) {
6393
+ const out = /* @__PURE__ */ new Map();
6394
+ if (schema === null) return out;
6395
+ for (const section of schema.sections) collectFields(section.fields, out);
6396
+ return out;
6397
+ }
6398
+ /** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
6399
+ function parseSecretStatePath(path) {
6400
+ const segments = [];
6401
+ for (const raw of path.split(".")) {
6402
+ const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
6403
+ if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
6404
+ segments.push(m[2] !== void 0 ? {
6405
+ key: m[1],
6406
+ idKey: m[2]
6407
+ } : { key: m[1] });
6408
+ }
6409
+ if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
6410
+ if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
6411
+ return segments;
6412
+ }
6413
+ function insert(into, segments) {
6414
+ const [head, ...rest] = segments;
6415
+ if (head === void 0) return;
6416
+ if (rest.length === 0) {
6417
+ into.set(head.key, LEAF);
6418
+ return;
6419
+ }
6420
+ const existing = into.get(head.key);
6421
+ if (head.idKey !== void 0) {
6422
+ const item = new Map(existing?.kind === "array" ? existing.item : []);
6423
+ insert(item, rest);
6424
+ into.set(head.key, {
6425
+ kind: "array",
6426
+ idKey: head.idKey,
6427
+ item
6428
+ });
6429
+ return;
6430
+ }
6431
+ const children = new Map(existing?.kind === "object" ? existing.children : []);
6432
+ insert(children, rest);
6433
+ into.set(head.key, {
6434
+ kind: "object",
6435
+ children
6436
+ });
6437
+ }
6438
+ /** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
6439
+ function mergeSecretStatePaths(tree, paths) {
6440
+ if (paths.length === 0) return tree;
6441
+ const out = new Map(tree);
6442
+ for (const path of paths) insert(out, parseSecretStatePath(path));
6443
+ return out;
6444
+ }
6445
+ /** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
6446
+ var SECRET_RETRY_FIRST_MS = 5e3;
6447
+ var SECRET_RETRY_MAX_MS = 5 * 6e4;
6448
+ /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
6449
+ var SECRET_CHANGE_DEBOUNCE_MS = 250;
5914
6450
  /**
5915
6451
  * Base class for CamStack addons. Eliminates settings boilerplate:
5916
6452
  *
@@ -5980,6 +6516,25 @@ var BaseAddon = class {
5980
6516
  settingsStoreReady = false;
5981
6517
  /** Default config values. Provided via constructor. */
5982
6518
  defaults;
6519
+ /**
6520
+ * Hidden-state paths that hold secrets (D787) — values the addon writes
6521
+ * itself (`updateGlobalSettings`, `state()`) that no form field declares.
6522
+ * Stored in the keychain exactly like a `password` field. Syntax:
6523
+ * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
6524
+ * (`key[<id field>]` addresses array items by id, never by index).
6525
+ */
6526
+ secretStatePaths = [];
6527
+ _addonSecretTree = null;
6528
+ _deviceSecretTree = null;
6529
+ /** Refs the last resolved config pointed at — a change to one re-resolves. */
6530
+ _configSecretRefs = /* @__PURE__ */ new Set();
6531
+ _unresolvedSecrets = [];
6532
+ _secretRetryTimer = null;
6533
+ _secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
6534
+ _secretChangeTimer = null;
6535
+ _secretChangeUnsub = null;
6536
+ /** >0 while an OPERATOR's settings write is being applied. */
6537
+ _operatorWriteDepth = 0;
5983
6538
  constructor(defaults) {
5984
6539
  this.defaults = defaults;
5985
6540
  this._config = { ...defaults };
@@ -6015,8 +6570,18 @@ var BaseAddon = class {
6015
6570
  return this._config;
6016
6571
  }
6017
6572
  async initialize(context) {
6018
- this._ctx = context;
6573
+ const secrets = context.secrets;
6574
+ this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6575
+ secrets,
6576
+ addonTree: () => this.addonSecretTree(),
6577
+ deviceTree: () => this.deviceSecretTree(),
6578
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6579
+ isOperatorWrite: () => this._operatorWriteDepth > 0
6580
+ }) : context;
6019
6581
  await this.resolveConfig();
6582
+ if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6583
+ if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
6584
+ });
6020
6585
  const result = await this.onInitialize();
6021
6586
  this.emitLifecycle(EventCategory.AddonStarted);
6022
6587
  const normalized = normalizeAddonInitResult(result);
@@ -6049,6 +6614,12 @@ var BaseAddon = class {
6049
6614
  */
6050
6615
  async onHubReachable() {}
6051
6616
  async shutdown() {
6617
+ this._secretChangeUnsub?.();
6618
+ this._secretChangeUnsub = null;
6619
+ if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
6620
+ if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
6621
+ this._secretRetryTimer = null;
6622
+ this._secretChangeTimer = null;
6052
6623
  this.emitLifecycle(EventCategory.AddonStopped);
6053
6624
  if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
6054
6625
  await this.onShutdown();
@@ -6127,7 +6698,7 @@ var BaseAddon = class {
6127
6698
  return hydrateSchema(schema, overlay ? {
6128
6699
  ...projected,
6129
6700
  ...overlay
6130
- } : projected);
6701
+ } : projected, { inlineSecretsAsViews: true });
6131
6702
  }
6132
6703
  /**
6133
6704
  * The integration-level view of this addon's settings: exactly the sections
@@ -6176,7 +6747,7 @@ var BaseAddon = class {
6176
6747
  return hydrateSchema({
6177
6748
  ...schema,
6178
6749
  sections
6179
- }, projected);
6750
+ }, projected, { inlineSecretsAsViews: true });
6180
6751
  }
6181
6752
  /**
6182
6753
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -6230,18 +6801,50 @@ var BaseAddon = class {
6230
6801
  value: result.value[key]
6231
6802
  };
6232
6803
  }
6804
+ /**
6805
+ * The OPERATOR's write — a settings form or an admin API call, dispatched by
6806
+ * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
6807
+ * the operator sends is stored as sent even when it equals a pre-keychain
6808
+ * inline value: the operator re-entering a password is a change, an addon
6809
+ * writing back what it read is not (D787).
6810
+ */
6811
+ async updateGlobalSettingsAsOperator(patch, nodeId) {
6812
+ this._operatorWriteDepth++;
6813
+ try {
6814
+ await this.applyGlobalPatch(patch, nodeId);
6815
+ } finally {
6816
+ this._operatorWriteDepth--;
6817
+ }
6818
+ }
6233
6819
  async updateGlobalSettings(patch, nodeId) {
6820
+ await this.applyGlobalPatch(patch, nodeId);
6821
+ }
6822
+ /**
6823
+ * REMOVE stored secrets — their keychain values and their markers (D787).
6824
+ *
6825
+ * Writing `''` to a secret field KEEPS what is stored (an empty string is
6826
+ * what a defaults fallback writes back, and it must never destroy a
6827
+ * credential), so code that means "forget this token" says so here. Without
6828
+ * a keychain (an older kernel) it writes `''`, as such code always did.
6829
+ */
6830
+ async clearSecrets(keys, nodeId) {
6831
+ const tree = this.addonSecretTree();
6832
+ const keychain = this._ctx?.secrets !== void 0;
6833
+ const patch = {};
6834
+ for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
6835
+ await this.applyGlobalPatch(patch, nodeId);
6836
+ }
6837
+ async applyGlobalPatch(barePatch, nodeId) {
6234
6838
  const keys = this.perNodeKeys();
6235
6839
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6236
6840
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6237
- const barePatch = patch;
6238
6841
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6239
6842
  await this._ctx?.settings?.writeAddonStore(scoped);
6240
6843
  if (target !== localNode) return;
6241
6844
  await this.resolveConfig();
6242
6845
  await this.onConfigChanged();
6243
6846
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
6244
- this.maybeAutoRestart(patch, this.globalSettingsSchema());
6847
+ this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
6245
6848
  }
6246
6849
  /**
6247
6850
  * The set of field keys the global settings schema declares `perNode: true`
@@ -6266,7 +6869,7 @@ var BaseAddon = class {
6266
6869
  * time to return its response before the addon is torn down and
6267
6870
  * re-initialised by `AddonRegistryService.restartAddon`.
6268
6871
  */
6269
- maybeAutoRestart(patch, schema) {
6872
+ maybeAutoRestart(patchKeys, schema) {
6270
6873
  if (!schema) return;
6271
6874
  const restartKeys = /* @__PURE__ */ new Set();
6272
6875
  for (const section of schema.sections) for (const field of section.fields) {
@@ -6274,13 +6877,13 @@ var BaseAddon = class {
6274
6877
  if (field.requiresRestart) restartKeys.add(field.key);
6275
6878
  }
6276
6879
  if (restartKeys.size === 0) return;
6277
- if (!Object.keys(patch).some((k) => restartKeys.has(k))) return;
6880
+ if (!patchKeys.some((k) => restartKeys.has(k))) return;
6278
6881
  const ctx = this._ctx;
6279
6882
  if (!ctx) return;
6280
6883
  const addonId = ctx.id;
6281
6884
  setImmediate(() => {
6282
6885
  ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
6283
- ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: Object.keys(patch).filter((k) => restartKeys.has(k)) } });
6886
+ ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
6284
6887
  }).catch((err) => {
6285
6888
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
6286
6889
  });
@@ -6289,7 +6892,7 @@ var BaseAddon = class {
6289
6892
  async getDeviceSettings(deviceId) {
6290
6893
  const schema = this.deviceSettingsSchema();
6291
6894
  if (!schema) return { sections: [] };
6292
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
6895
+ return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6293
6896
  }
6294
6897
  async updateDeviceSettings(deviceId, patch) {
6295
6898
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -6419,7 +7022,7 @@ var BaseAddon = class {
6419
7022
  * selection at boot (absent scoped key ⇒ the constructor default wins).
6420
7023
  */
6421
7024
  async resolveConfig() {
6422
- const stored = await this.readAddonStoreWithRetry();
7025
+ const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
6423
7026
  const perNode = this.perNodeKeys();
6424
7027
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6425
7028
  const resolved = { ...this.defaults };
@@ -6444,7 +7047,7 @@ var BaseAddon = class {
6444
7047
  key,
6445
7048
  schema,
6446
7049
  fallback,
6447
- read: () => this.readAddonStoreWithRetry(),
7050
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
6448
7051
  write: async (patch) => {
6449
7052
  await this._ctx?.settings?.writeAddonStore(patch);
6450
7053
  },
@@ -6461,7 +7064,7 @@ var BaseAddon = class {
6461
7064
  key,
6462
7065
  schema,
6463
7066
  fallback,
6464
- read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
7067
+ read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
6465
7068
  write: async (patch) => {
6466
7069
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
6467
7070
  },
@@ -6473,6 +7076,70 @@ var BaseAddon = class {
6473
7076
  } })
6474
7077
  });
6475
7078
  }
7079
+ /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
7080
+ addonSecretTree() {
7081
+ this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
7082
+ return this._addonSecretTree;
7083
+ }
7084
+ deviceSecretTree() {
7085
+ this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7086
+ return this._deviceSecretTree;
7087
+ }
7088
+ /**
7089
+ * Secrets of this addon's stored config that could not be resolved on the
7090
+ * last read, with why. Non-empty means the addon is running WITHOUT them —
7091
+ * an addon whose function needs one should report itself degraded rather
7092
+ * than start on an empty credential.
7093
+ */
7094
+ get unresolvedSecrets() {
7095
+ return this._unresolvedSecrets;
7096
+ }
7097
+ /**
7098
+ * Substitute every keychain marker in a stored blob with its value. With no
7099
+ * keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
7100
+ * An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
7101
+ * value — and, when the cause can pass, retried with backoff. Nothing is
7102
+ * ever written back from here.
7103
+ */
7104
+ async resolveStoredSecrets(blob, trackForConfig = true) {
7105
+ const secrets = this._ctx?.secrets;
7106
+ if (secrets === void 0) return blob;
7107
+ const refs = collectSecretMarkerRefs(blob);
7108
+ if (trackForConfig) this._configSecretRefs = new Set(refs);
7109
+ if (refs.length === 0) {
7110
+ if (trackForConfig) this._unresolvedSecrets = [];
7111
+ return blob;
7112
+ }
7113
+ const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
7114
+ if (trackForConfig) {
7115
+ this._unresolvedSecrets = unresolved;
7116
+ if (unresolved.length > 0) {
7117
+ this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
7118
+ ref: u.ref,
7119
+ reason: u.reason
7120
+ })) } });
7121
+ if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
7122
+ this.scheduleSecretReresolve(this._secretRetryDelayMs);
7123
+ this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
7124
+ }
7125
+ } else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
7126
+ }
7127
+ return value;
7128
+ }
7129
+ /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7130
+ scheduleSecretReresolve(delayMs) {
7131
+ const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
7132
+ if (this[timerOf] !== null) return;
7133
+ const timer = setTimeout(() => {
7134
+ this[timerOf] = null;
7135
+ if (this._ctx === null) return;
7136
+ this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
7137
+ this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
7138
+ });
7139
+ }, delayMs);
7140
+ timer.unref?.();
7141
+ this[timerOf] = timer;
7142
+ }
6476
7143
  /**
6477
7144
  * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
6478
7145
  * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
@@ -13972,6 +14639,196 @@ id: union([string(), number()]) }), {
13972
14639
  kind: "mutation",
13973
14640
  auth: "admin"
13974
14641
  });
14642
+ /**
14643
+ * `keychain` — the hub's encrypted store of secret values (D787).
14644
+ *
14645
+ * Settings blobs never hold a secret: they hold a marker
14646
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
14647
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
14648
+ * is the OWNER's door to its own values: every method is owner-checked
14649
+ * against the CALLER, never against anything the caller claims.
14650
+ *
14651
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
14652
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
14653
+ * connection, the agent from its child's connection carried in
14654
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
14655
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
14656
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
14657
+ * identity against BUGS and misrouting, not against a malicious addon (every
14658
+ * runner is the same OS user): see the threat model in
14659
+ * `docs/design/2026-10-08-secrets-keychain.md`.
14660
+ *
14661
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
14662
+ * parses the input, so a session can never supply it, and the internal mount
14663
+ * floors every method to admin anyway (D240).
14664
+ *
14665
+ * Internal: addons reach it through `ctx.secrets`, never directly.
14666
+ */
14667
+ /** Why a value cannot be served right now. Never folded into "missing". */
14668
+ var KeychainUnavailableReasonSchema = _enum([
14669
+ "key-missing",
14670
+ "wrong-key",
14671
+ "key-file-unreadable",
14672
+ "store-unavailable",
14673
+ "not-initialized",
14674
+ "decrypt-failed"
14675
+ ]);
14676
+ var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
14677
+ state: literal("locked"),
14678
+ reason: KeychainUnavailableReasonSchema
14679
+ })]);
14680
+ var KeychainResolveEntrySchema = discriminatedUnion("kind", [
14681
+ object({
14682
+ kind: literal("value"),
14683
+ value: string(),
14684
+ version: number().int()
14685
+ }),
14686
+ object({ kind: literal("missing") }),
14687
+ object({
14688
+ kind: literal("unavailable"),
14689
+ reason: KeychainUnavailableReasonSchema
14690
+ }),
14691
+ object({ kind: literal("forbidden") })
14692
+ ]);
14693
+ var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
14694
+ /** Metadata of one stored value — never the value. */
14695
+ var KeychainSecretMetaSchema = object({
14696
+ ref: string(),
14697
+ owner: string(),
14698
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
14699
+ scope: string(),
14700
+ fieldPath: string(),
14701
+ version: number().int(),
14702
+ createdAt: number(),
14703
+ updatedAt: number(),
14704
+ /** `addon:<id>` | `user:<id>` | `system`. */
14705
+ updatedBy: string(),
14706
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
14707
+ lastReadAt: number().nullable()
14708
+ });
14709
+ var RefListSchema = array(string().min(1)).max(512);
14710
+ method(object({
14711
+ ref: string().min(1),
14712
+ value: string().min(1)
14713
+ }), object({
14714
+ ref: string(),
14715
+ version: number().int()
14716
+ }), {
14717
+ kind: "mutation",
14718
+ auth: "admin"
14719
+ }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
14720
+ kind: "mutation",
14721
+ auth: "admin"
14722
+ }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
14723
+ var KeychainKeySourceSchema = object({
14724
+ kind: _enum([
14725
+ "config-file",
14726
+ "previous-config-file",
14727
+ "platform",
14728
+ "default-file"
14729
+ ]),
14730
+ /** File sources only — a path is not a secret. */
14731
+ path: string().optional(),
14732
+ /**
14733
+ * True when a whole-volume backup of the data directory carries this key
14734
+ * next to the database it protects (the default file). The page warns.
14735
+ */
14736
+ sharesBackupWithDatabase: boolean()
14737
+ });
14738
+ var KeychainStatusSchema = object({
14739
+ keychain: KeychainStateSchema,
14740
+ /** The source of the master key in use; `null` while locked. */
14741
+ keySource: KeychainKeySourceSchema.nullable(),
14742
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
14743
+ configuredSource: KeychainKeySourceSchema,
14744
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
14745
+ fingerprint: string().nullable(),
14746
+ activeKeyId: string().nullable(),
14747
+ /**
14748
+ * The keychain unlocked with a NON-primary source: the configured primary
14749
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
14750
+ */
14751
+ rotationPending: boolean(),
14752
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
14753
+ retiredWraps: number().int(),
14754
+ recoveryKeyDownloadedAt: number().nullable(),
14755
+ secretCount: number().int()
14756
+ });
14757
+ /**
14758
+ * Whether a stored value is still pointed at by its owner's settings.
14759
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
14760
+ * never reported as an orphan (and never deleted as one).
14761
+ */
14762
+ var KeychainSecretUsageSchema = _enum([
14763
+ "in-use",
14764
+ "orphan",
14765
+ "unknown"
14766
+ ]);
14767
+ var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
14768
+ var KeychainAuditActionSchema = _enum([
14769
+ "put",
14770
+ "delete",
14771
+ "reveal",
14772
+ "rotate-master-key",
14773
+ "purge-retired-keys",
14774
+ "download-recovery-key",
14775
+ "delete-orphans",
14776
+ "reset",
14777
+ "initialize"
14778
+ ]);
14779
+ var KeychainAuditEntrySchema = object({
14780
+ id: string(),
14781
+ at: number(),
14782
+ action: KeychainAuditActionSchema,
14783
+ /** `addon:<id>` | `user:<id>` | `system`. */
14784
+ actor: string(),
14785
+ ref: string().nullable(),
14786
+ detail: string().nullable()
14787
+ });
14788
+ 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({
14789
+ value: string(),
14790
+ version: number().int()
14791
+ }), {
14792
+ kind: "mutation",
14793
+ auth: "admin",
14794
+ caller: "required"
14795
+ }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
14796
+ deleted: array(string()).readonly(),
14797
+ kept: array(object({
14798
+ ref: string(),
14799
+ usage: KeychainSecretUsageSchema
14800
+ })).readonly()
14801
+ }), {
14802
+ kind: "mutation",
14803
+ auth: "admin",
14804
+ caller: "required"
14805
+ }), method(object({}), object({
14806
+ fingerprint: string(),
14807
+ keySource: KeychainKeySourceSchema
14808
+ }), {
14809
+ kind: "mutation",
14810
+ auth: "admin",
14811
+ caller: "required"
14812
+ }), method(object({}), object({ purged: number().int() }), {
14813
+ kind: "mutation",
14814
+ auth: "admin",
14815
+ caller: "required"
14816
+ }), method(object({}), object({
14817
+ key: string(),
14818
+ fingerprint: string(),
14819
+ keySource: KeychainKeySourceSchema
14820
+ }), {
14821
+ kind: "mutation",
14822
+ auth: "admin",
14823
+ caller: "required"
14824
+ }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
14825
+ archivedCollection: string().nullable(),
14826
+ archived: number().int()
14827
+ }), {
14828
+ kind: "mutation",
14829
+ auth: "admin",
14830
+ caller: "required"
14831
+ });
13975
14832
  method(_void(), object({
13976
14833
  id: string(),
13977
14834
  name: string(),
@@ -15203,7 +16060,11 @@ var DeviceRegisterPayloadSchema = object({
15203
16060
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
15204
16061
  var DevicePersistConfigPayloadSchema = object({
15205
16062
  deviceId: number(),
15206
- data: record(string(), unknown())
16063
+ data: record(string(), unknown()),
16064
+ /** The paths the device's schema declares secret (D783), when the caller
16065
+ * knows them — those values are kept in the keychain, not the blob (D787).
16066
+ * Absent: the paths the device last reported at `registerDevice` apply. */
16067
+ secretConfigPaths: array(string()).optional()
15207
16068
  });
15208
16069
  /** What a migration actually did, per switch. `unreachable` is a first-class
15209
16070
  * answer: a camera that could not be asked is not a camera that was silenced. */
@@ -22182,8 +23043,23 @@ var RetrainMacroClassSchema = _enum([
22182
23043
  ]);
22183
23044
  /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
22184
23045
  var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
22185
- /** Did a human draw this box, or did the assist propose it? */
22186
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
23046
+ /**
23047
+ * Where a box came from. A machine-sourced box is a DRAFT on the page until
23048
+ * the operator confirms it; once saved it keeps its source as provenance.
23049
+ *
23050
+ * - `operator` — drawn by hand.
23051
+ * - `assist` — proposed by a detector run on the copy (the camera's own
23052
+ * model, or a larger teacher model).
23053
+ * - `pipeline` — the box the live pipeline actually drew on that frame, read
23054
+ * back from the track store (never a re-run).
23055
+ * - `llm` — proposed by a vision-capable LLM profile.
23056
+ */
23057
+ var RetrainAnnotationSourceSchema = _enum([
23058
+ "operator",
23059
+ "assist",
23060
+ "pipeline",
23061
+ "llm"
23062
+ ]);
22187
23063
  /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
22188
23064
  var RetrainBboxSchema = object({
22189
23065
  x: number(),
@@ -22201,7 +23077,8 @@ var RetrainBboxSchema = object({
22201
23077
  */
22202
23078
  var RetrainAnnotationSchema = object({
22203
23079
  id: string(),
22204
- trackId: string(),
23080
+ /** The frame's track. Absent on a recording still, which has none. */
23081
+ trackId: string().optional(),
22205
23082
  deviceId: number(),
22206
23083
  /** The COPY in retrain storage — never the source track's media key. */
22207
23084
  mediaKey: string(),
@@ -22250,13 +23127,47 @@ var RetrainFrameCandidateSchema = object({
22250
23127
  * fail, whatever became of the original. */
22251
23128
  copied: boolean()
22252
23129
  });
23130
+ /**
23131
+ * One box the live pipeline drew on a copied frame — what a correction starts
23132
+ * from. Derived when the frame is listed, from the track store: the subject
23133
+ * box recorded on the source media row when there is one, else the track
23134
+ * position nearest the frame's capture time. Never stored as an annotation
23135
+ * until the operator confirms it.
23136
+ */
23137
+ var RetrainPipelineBoxSchema = object({
23138
+ /** Normalised `[0,1]` against the full frame. */
23139
+ bbox: RetrainBboxSchema,
23140
+ macroClass: RetrainMacroClassSchema,
23141
+ label: string().optional(),
23142
+ subLabel: string().optional(),
23143
+ /** The detection score of the position used, when it was recorded. */
23144
+ score: number().optional(),
23145
+ /** The root model that produced the track, when it was recorded. */
23146
+ modelId: string().optional(),
23147
+ trackId: string(),
23148
+ /** `subject-box`: recorded on this very frame. `position`: the track's
23149
+ * position nearest the capture time, `deltaMs` away. */
23150
+ basis: _enum(["subject-box", "position"]),
23151
+ deltaMs: number()
23152
+ });
23153
+ /**
23154
+ * Where a retrain frame came from: a TRACK's stored media (copy-on-select),
23155
+ * or the RECORDING at an instant — the frame a model saw nothing in has no
23156
+ * track at all.
23157
+ */
23158
+ var RetrainFrameOriginSchema = _enum(["track", "recording"]);
22253
23159
  /** A frame the dataset OWNS: bytes copied at selection time. */
22254
23160
  var RetrainFrameSchema = object({
22255
23161
  frameId: string(),
22256
23162
  deviceId: number(),
22257
- trackId: string(),
22258
- /** Provenance only. It may already point at nothing — that is expected. */
22259
- sourceMediaId: number().int(),
23163
+ origin: RetrainFrameOriginSchema,
23164
+ /** The track it was copied from. Absent on a recording still. */
23165
+ trackId: string().optional(),
23166
+ /** Provenance only. It may already point at nothing — that is expected.
23167
+ * Absent on a recording still. */
23168
+ sourceMediaId: number().int().optional(),
23169
+ /** A recording still: the playhead instant it was taken at. */
23170
+ epochMs: number().optional(),
22260
23171
  sourceKind: MediaFileKindEnum,
22261
23172
  sizeBytes: number().int(),
22262
23173
  width: number().int(),
@@ -22267,7 +23178,12 @@ var RetrainFrameSchema = object({
22267
23178
  /** The operator's "every subject in this frame is boxed". Detector
22268
23179
  * evaluation keeps only complete frames: an unboxed subject would count as
22269
23180
  * a false positive. */
22270
- complete: boolean()
23181
+ complete: boolean(),
23182
+ /** The boxes the pipeline drew on this frame. Present on list answers;
23183
+ * empty when nothing the track store holds can be placed on it. */
23184
+ pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
23185
+ /** The named collections this frame belongs to. Present on list answers. */
23186
+ collectionIds: array(string()).readonly().optional()
22271
23187
  });
22272
23188
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
22273
23189
  var RetrainCopyRefusalSchema = _enum([
@@ -22298,6 +23214,8 @@ var RetrainFrameListSchema = object({
22298
23214
  var RetrainExportFilterSchema = object({
22299
23215
  deviceIds: array(number()).optional(),
22300
23216
  frameIds: array(string()).max(2e4).optional(),
23217
+ /** Only frames in at least one of these named collections. */
23218
+ collectionIds: array(string()).max(200).optional(),
22301
23219
  batchId: string().optional(),
22302
23220
  /** Only frames the operator marked complete (all subjects boxed). */
22303
23221
  completeOnly: boolean().optional()
@@ -22362,6 +23280,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
22362
23280
  reason: string(),
22363
23281
  detail: string().optional()
22364
23282
  })]);
23283
+ /** A named set over the retrain corpus — membership only, it owns no pixels. */
23284
+ var RetrainCollectionSchema = object({
23285
+ id: string(),
23286
+ name: string(),
23287
+ createdAt: number(),
23288
+ frameCount: number().int()
23289
+ });
23290
+ var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
23291
+ kind: literal("created"),
23292
+ collection: RetrainCollectionSchema
23293
+ }), object({
23294
+ kind: literal("refused"),
23295
+ reason: _enum(["empty-name", "duplicate-name"])
23296
+ })]);
23297
+ var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
23298
+ kind: literal("renamed"),
23299
+ collection: RetrainCollectionSchema
23300
+ }), object({
23301
+ kind: literal("refused"),
23302
+ reason: _enum([
23303
+ "empty-name",
23304
+ "duplicate-name",
23305
+ "unknown-collection"
23306
+ ])
23307
+ })]);
23308
+ /**
23309
+ * The outcome of adding the frame at a recording instant. Every refusal is
23310
+ * named: `still-unavailable` (not recording, a gap, or an undecodable frame —
23311
+ * `detail` says which), `still-busy` (the recorder is at its decode bound; try
23312
+ * again), `unreadable-image`, `write-failed`, `unknown-collection`.
23313
+ */
23314
+ var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
23315
+ kind: literal("added"),
23316
+ collectionId: string(),
23317
+ frame: RetrainFrameSchema,
23318
+ /** The moment was already in the dataset; nothing was decoded. */
23319
+ reused: boolean()
23320
+ }), object({
23321
+ kind: literal("refused"),
23322
+ reason: _enum([
23323
+ "unknown-collection",
23324
+ "still-unavailable",
23325
+ "still-busy",
23326
+ "unreadable-image",
23327
+ "write-failed"
23328
+ ]),
23329
+ detail: string().optional()
23330
+ })]);
23331
+ /** A vision LLM profile the AI assist may use, and where it sends the frame. */
23332
+ var RetrainAssistProfileSchema = object({
23333
+ id: string(),
23334
+ name: string(),
23335
+ model: string(),
23336
+ kind: string(),
23337
+ /** `true` when the frame would leave the house (a cloud vendor, or an
23338
+ * endpoint that is not on the local network). The page confirms each such
23339
+ * run, and the provider refuses one without `allowCloud`. */
23340
+ leavesHouse: boolean()
23341
+ });
23342
+ /** A box the AI assist proposed: a draft, plus the model's own reason. */
23343
+ var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
23344
+ /** What the AI assist said about a box that was already on the canvas. */
23345
+ var RetrainLlmReviewSchema = object({
23346
+ /** The `ref` the page sent the box under. */
23347
+ ref: string(),
23348
+ verdict: _enum([
23349
+ "confirmed",
23350
+ "wrong-class",
23351
+ "not-an-object",
23352
+ "uncertain"
23353
+ ]),
23354
+ suggestedClass: RetrainMacroClassSchema.optional(),
23355
+ reason: string()
23356
+ });
23357
+ /**
23358
+ * The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
23359
+ * model and its confidence) and reviews; items the model got wrong (a box off
23360
+ * the frame, an unasked class, an unknown ref) are dropped and counted in
23361
+ * `rejected`. A whole answer that is not the schema is `malformed-answer`.
23362
+ */
23363
+ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23364
+ kind: literal("proposed"),
23365
+ profileId: string(),
23366
+ model: string(),
23367
+ /** The frame was sent outside the house for this answer. */
23368
+ leftHouse: boolean(),
23369
+ proposals: array(RetrainLlmProposalSchema).readonly(),
23370
+ reviews: array(RetrainLlmReviewSchema).readonly(),
23371
+ rejected: number().int()
23372
+ }), object({
23373
+ kind: literal("refused"),
23374
+ reason: _enum([
23375
+ "unknown-frame",
23376
+ "unreadable-frame",
23377
+ "unknown-profile",
23378
+ "profile-disabled",
23379
+ "no-vision",
23380
+ "cloud-not-confirmed",
23381
+ "llm-error",
23382
+ "malformed-answer"
23383
+ ]),
23384
+ detail: string().optional()
23385
+ })]);
22365
23386
  /** The outcome of a lifecycle move owned by the retrain page. */
22366
23387
  var RetrainTransitionResultSchema = object({
22367
23388
  trackId: string(),
@@ -23079,7 +24100,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23079
24100
  auth: "admin"
23080
24101
  }), method(object({
23081
24102
  deviceId: number(),
23082
- trackId: string(),
24103
+ trackId: string().optional(),
23083
24104
  frameId: string()
23084
24105
  }), object({
23085
24106
  removed: boolean(),
@@ -23096,7 +24117,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23096
24117
  auth: "admin"
23097
24118
  }), method(object({
23098
24119
  deviceId: number(),
23099
- trackId: string(),
24120
+ /** The frame's track, when it has one — checked against the frame. */
24121
+ trackId: string().optional(),
23100
24122
  frameId: string(),
23101
24123
  subject: RetrainAssistSubjectSchema,
23102
24124
  /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
@@ -23104,12 +24126,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23104
24126
  }), RetrainAssistResultSchema, {
23105
24127
  kind: "mutation",
23106
24128
  auth: "admin"
23107
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
24129
+ }), method(object({
24130
+ trackId: string().optional(),
24131
+ frameIds: array(string()).max(2e3).optional()
24132
+ }), array(RetrainAnnotationSchema).readonly(), {
23108
24133
  kind: "query",
23109
24134
  auth: "admin"
23110
24135
  }), method(object({
23111
24136
  deviceId: number(),
23112
- trackId: string(),
24137
+ /** The frame's track, when it has one — checked against the frame. */
24138
+ trackId: string().optional(),
23113
24139
  frameId: string(),
23114
24140
  annotations: array(RetrainAnnotationDraftSchema)
23115
24141
  }), array(RetrainAnnotationSchema).readonly(), {
@@ -23132,7 +24158,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23132
24158
  auth: "admin"
23133
24159
  }), method(object({
23134
24160
  deviceId: number(),
23135
- trackId: string(),
24161
+ trackId: string().optional(),
23136
24162
  frameId: string(),
23137
24163
  complete: boolean()
23138
24164
  }), RetrainFrameSchema, {
@@ -23146,6 +24172,74 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23146
24172
  kind: "mutation",
23147
24173
  auth: "admin",
23148
24174
  timeoutMs: 60 * 6e4
24175
+ }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24176
+ kind: "query",
24177
+ auth: "admin"
24178
+ }), method(object({
24179
+ deviceId: number(),
24180
+ trackId: string().optional(),
24181
+ frameId: string(),
24182
+ profileId: string(),
24183
+ classes: array(RetrainMacroClassSchema).min(1),
24184
+ boxes: array(object({
24185
+ ref: string(),
24186
+ bbox: RetrainBboxSchema,
24187
+ macroClass: RetrainMacroClassSchema,
24188
+ label: string().optional()
24189
+ })).max(50),
24190
+ allowCloud: boolean()
24191
+ }), RetrainLlmAssistResultSchema, {
24192
+ kind: "mutation",
24193
+ auth: "admin",
24194
+ timeoutMs: 18e4
24195
+ }), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
24196
+ kind: "mutation",
24197
+ auth: "admin"
24198
+ }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24199
+ kind: "query",
24200
+ auth: "admin"
24201
+ }), method(object({
24202
+ id: string(),
24203
+ name: string().max(120)
24204
+ }), RetrainCollectionRenameResultSchema, {
24205
+ kind: "mutation",
24206
+ auth: "admin"
24207
+ }), method(object({ id: string() }), object({
24208
+ deleted: boolean(),
24209
+ removedFrames: number().int()
24210
+ }), {
24211
+ kind: "mutation",
24212
+ auth: "admin"
24213
+ }), method(object({
24214
+ collectionId: string(),
24215
+ deviceId: number(),
24216
+ epochMs: number()
24217
+ }), AddRetrainFrameFromRecordingResultSchema, {
24218
+ kind: "mutation",
24219
+ auth: "admin",
24220
+ timeoutMs: 6e4
24221
+ }), method(object({
24222
+ collectionId: string(),
24223
+ frameIds: array(string()).min(1).max(500)
24224
+ }), object({
24225
+ added: number().int(),
24226
+ alreadyMember: number().int(),
24227
+ unknownFrameIds: array(string()).readonly()
24228
+ }), {
24229
+ kind: "mutation",
24230
+ auth: "admin"
24231
+ }), method(object({
24232
+ collectionId: string(),
24233
+ frameId: string()
24234
+ }), object({
24235
+ removed: boolean(),
24236
+ deletedFrame: boolean()
24237
+ }), {
24238
+ kind: "mutation",
24239
+ auth: "admin"
24240
+ }), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
24241
+ kind: "query",
24242
+ auth: "admin"
23149
24243
  }), method(object({
23150
24244
  /** Which of the three event tables owns the row. */
23151
24245
  ownerType: EventOwnerTypeSchema,
@@ -23769,13 +24863,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
23769
24863
  object({
23770
24864
  kind: literal("no-family-build"),
23771
24865
  format: ModelFormatSchema$1
24866
+ }),
24867
+ object({
24868
+ kind: literal("kept-custom-pin"),
24869
+ modelId: string(),
24870
+ deviceKey: string()
23772
24871
  })
23773
24872
  ]);
24873
+ /** Why a device is left exactly as it is, whatever the plan would pick (D786). */
24874
+ var KeptReasonSchema = _enum(["custom-pin"]);
24875
+ /**
24876
+ * Where a choice's latency came from (D791): this node's own benchmark
24877
+ * result, or the hardware-class table. Measured on the node beats the table.
24878
+ */
24879
+ var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
24880
+ kind: literal("node-benchmark"),
24881
+ resultId: string(),
24882
+ measuredAtMs: number()
24883
+ })]);
23774
24884
  var DeviceModelChoiceSchema = object({
23775
24885
  modelId: string(),
23776
24886
  p50Ms: number(),
23777
24887
  fps: number(),
23778
24888
  measured: boolean(),
24889
+ /** Absent on a plan from before D791 — read as the table. */
24890
+ source: LatencySourceSchema.optional(),
23779
24891
  /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
23780
24892
  capacitySessions: number(),
23781
24893
  personRecall: number()
@@ -23786,6 +24898,8 @@ var DeviceRecommendationSchema = object({
23786
24898
  enabled: boolean(),
23787
24899
  available: boolean(),
23788
24900
  chosen: DeviceModelChoiceSchema.nullable(),
24901
+ /** Present when the device is kept as is: Apply writes nothing on it. */
24902
+ kept: KeptReasonSchema.optional(),
23789
24903
  reasons: array(RecommendationReasonSchema).readonly()
23790
24904
  });
23791
24905
  var NodeRecommendationSchema = object({
@@ -23839,6 +24953,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
23839
24953
  kind: literal("coral-enabled"),
23840
24954
  nodeId: string(),
23841
24955
  deviceKey: string()
24956
+ }),
24957
+ object({
24958
+ kind: literal("custom-pin-kept"),
24959
+ nodeId: string(),
24960
+ deviceKey: string().nullable(),
24961
+ deviceId: number().nullable(),
24962
+ modelId: string()
24963
+ }),
24964
+ object({
24965
+ kind: literal("custom-registry-unreadable"),
24966
+ error: string()
23842
24967
  })
23843
24968
  ]);
23844
24969
  var AutoTuneOptionsSchema = object({
@@ -24017,13 +25142,14 @@ var SuggestSharesResultSchema = object({
24017
25142
  nodes: array(SuggestedNodeShareSchema).readonly()
24018
25143
  });
24019
25144
  /**
24020
- * Where the node and device shares come from (D750, D755).
24021
- * - `hardware` (default) — computed by the system from each node's static
24022
- * capacity (its accelerators at their Auto tune models, from the measured
24023
- * latency table), recomputed whenever a node or device joins, leaves, is
24024
- * switched on or off, or changes model. No load input.
24025
- * - `benchmark` — the same, from each node's measured capacity (node
24026
- * benchmark results); a node without results falls back to `hardware`.
25145
+ * Where the node and device shares come from (D750, D755, D791).
25146
+ * - `benchmark` (default since D791) — each node's capacity as its own node
25147
+ * benchmark measured it; a node without fresh results is sized from
25148
+ * `hardware` and says so. Measured on the node beats the table.
25149
+ * - `hardware` — computed from each node's static capacity only (its
25150
+ * accelerators at their Auto tune models, from the latency table).
25151
+ * Both are recomputed whenever a node or device joins, leaves, is switched
25152
+ * on or off, changes model, or a benchmark result is written. No load input.
24027
25153
  * - `manual` — the operator's stored sliders.
24028
25154
  * Either way a node or device that cannot take sessions gives its share to
24029
25155
  * the others in proportion; the stored values are never rewritten for that.
@@ -24072,6 +25198,362 @@ var EffectiveSharesSchema = object({
24072
25198
  nodeWeights: record(string(), number()),
24073
25199
  deviceWeights: record(string(), record(string(), number()))
24074
25200
  });
25201
+ /**
25202
+ * Wire shapes of the node benchmark (D791): the operator's plan, the
25203
+ * preflight the confirmation shows, the run the orchestrator owns, what the
25204
+ * measuring runner reports, and the result rows Auto tune and the automatic
25205
+ * shares read.
25206
+ *
25207
+ * ONE node at a time, owned by the pipeline orchestrator. While a run is
25208
+ * active the cluster is in BENCHMARK MODE for that node: it is not a
25209
+ * detection candidate, camera pins naming it are ignored so its sessions move
25210
+ * elsewhere, and both come back when the mode ends — after a crash or a hub
25211
+ * restart too (a persisted manifest, reconciled against the registry).
25212
+ *
25213
+ * Two measurements, both on the node, driven by its own runner (frames never
25214
+ * cross a process at frame rate, D9):
25215
+ * - `device` — one accelerator × one candidate detector, root only, open
25216
+ * loop: how many streams at the camera rate it carries inside the frame
25217
+ * interval;
25218
+ * - `pipeline` — the chosen detector plus the operator's detail steps
25219
+ * (faces, plates, classifiers, CLIP…), on varied frames from the bench
25220
+ * clip: how many parallel sessions the node carries before latency, drops,
25221
+ * CPU, RAM or the event loop give out.
25222
+ */
25223
+ /** Defaults and bounds, one place. */
25224
+ var NODE_BENCHMARK_DEFAULTS = {
25225
+ fpsPerStream: 10,
25226
+ budgetMinutes: 45,
25227
+ minBudgetMinutes: 10,
25228
+ maxBudgetMinutes: 120,
25229
+ /** A result older than this no longer beats the table. */
25230
+ staleAfterDays: 30,
25231
+ /** Warm-in per ramp step (not accounted). */
25232
+ settleSec: 5,
25233
+ /** Accounted window per ramp step. */
25234
+ measureSec: 20,
25235
+ /** Longest the drain may take before the run is refused. */
25236
+ drainTimeoutSec: 120,
25237
+ /** Candidate models per device in one run. */
25238
+ maxModelsPerDevice: 6
25239
+ };
25240
+ /** The two measurements a run can make. */
25241
+ var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
25242
+ var NodeBenchmarkDevicePlanSchema = object({
25243
+ /** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
25244
+ deviceKey: string().min(1),
25245
+ /**
25246
+ * Root detector candidates for the `device` measurement, in the order
25247
+ * measured. The FIRST is the one the `pipeline` measurement runs.
25248
+ */
25249
+ modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
25250
+ });
25251
+ /** What the operator confirmed. */
25252
+ var NodeBenchmarkPlanSchema = object({
25253
+ nodeId: string().min(1),
25254
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25255
+ /** Which measurements run. At least one. */
25256
+ phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
25257
+ /**
25258
+ * Detail steps (catalog step ids under the root: faces, plates,
25259
+ * classifiers, CLIP…) the `pipeline` measurement enables. The root
25260
+ * detector always runs.
25261
+ */
25262
+ steps: array(string().min(1)).default([]),
25263
+ /** Offered rate of one stream / session. */
25264
+ fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
25265
+ /** Hard deadline: the mode ends and the cluster is restored when it passes. */
25266
+ budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
25267
+ /** Keep the models the run downloaded (default: delete what was not installed before). */
25268
+ keepDownloadedModels: boolean().default(false),
25269
+ /** Start although the other nodes' capacity does not cover the sessions running now. */
25270
+ acceptInsufficientHeadroom: boolean().default(false)
25271
+ });
25272
+ var NodeBenchmarkRefusalSchema = object({
25273
+ kind: _enum([
25274
+ "benchmark-active",
25275
+ "node-offline",
25276
+ "unknown-device",
25277
+ "no-phase",
25278
+ "insufficient-headroom"
25279
+ ]),
25280
+ detail: string(),
25281
+ overridable: boolean()
25282
+ });
25283
+ /** A camera whose detection leaves the node for the run. */
25284
+ var NodeBenchmarkMovingCameraSchema = object({
25285
+ deviceId: number(),
25286
+ /** Placed on the node now (a standing attach or a running session). */
25287
+ placedOnNode: boolean(),
25288
+ /** A node pin naming this node, ignored for the run. */
25289
+ pinnedToNode: boolean()
25290
+ });
25291
+ /** A camera that cannot leave: no other node can obtain its frames. */
25292
+ var NodeBenchmarkStayingCameraSchema = object({
25293
+ deviceId: number(),
25294
+ reason: literal("only-frame-source")
25295
+ });
25296
+ var NodeBenchmarkPreflightSchema = object({
25297
+ nodeId: string(),
25298
+ online: boolean(),
25299
+ moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
25300
+ /** Keep running on the node during the run; the result is flagged contaminated. */
25301
+ staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
25302
+ estimatedDurationMs: number(),
25303
+ /** The run ends and the cluster is restored at the latest after this long. */
25304
+ budgetMs: number(),
25305
+ phases: array(NodeBenchmarkPhaseSchema).readonly(),
25306
+ steps: array(string()).readonly(),
25307
+ devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
25308
+ /** Parallel sessions the cluster runs now, and what the other nodes can carry. */
25309
+ headroom: object({
25310
+ sessionsNow: number(),
25311
+ otherNodesCapacitySessions: number().nullable()
25312
+ }),
25313
+ refusals: array(NodeBenchmarkRefusalSchema).readonly(),
25314
+ canStart: boolean()
25315
+ });
25316
+ /** Where the measuring runner is. */
25317
+ var NodeBenchProgressSchema = object({
25318
+ phase: _enum([
25319
+ "preparing",
25320
+ "device",
25321
+ "pipeline",
25322
+ "cleanup"
25323
+ ]),
25324
+ deviceKey: string().nullable(),
25325
+ modelId: string().nullable(),
25326
+ /** Streams (device) or sessions (pipeline) of the step running now. */
25327
+ load: number().nullable(),
25328
+ cellsDone: number(),
25329
+ cellsTotal: number(),
25330
+ message: string()
25331
+ });
25332
+ /** What limited a ramp. `none` = the ramp ran out of steps still passing. */
25333
+ var NodeBenchLimitSchema = _enum([
25334
+ "p95",
25335
+ "drops",
25336
+ "errors",
25337
+ "stall",
25338
+ "cpu",
25339
+ "ram",
25340
+ "none"
25341
+ ]);
25342
+ var NodeBenchRampStepSchema = object({
25343
+ load: number(),
25344
+ pass: boolean(),
25345
+ p95Ms: number(),
25346
+ dropRatio: number(),
25347
+ /** Completed frames per second over the accounted window. */
25348
+ fps: number(),
25349
+ cpuPct: number().nullable(),
25350
+ ramFreePct: number().nullable(),
25351
+ failReasons: array(string()).readonly()
25352
+ });
25353
+ var NodeBenchCellSchema = discriminatedUnion("phase", [object({
25354
+ phase: literal("device"),
25355
+ deviceKey: string(),
25356
+ modelId: string(),
25357
+ /** Single-stream latency (the K = 1 step). */
25358
+ p50Ms: number(),
25359
+ p95Ms: number(),
25360
+ p99Ms: number(),
25361
+ /** Frames per second sustained at the last passing step. */
25362
+ fps: number(),
25363
+ /** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
25364
+ kMax: number(),
25365
+ limitedBy: NodeBenchLimitSchema,
25366
+ /** First call (model load + warm-up). */
25367
+ warmupMs: number(),
25368
+ ramp: array(NodeBenchRampStepSchema).readonly()
25369
+ }), object({
25370
+ phase: literal("pipeline"),
25371
+ deviceKey: string(),
25372
+ modelId: string(),
25373
+ steps: array(string()).readonly(),
25374
+ /** Parallel sessions at the camera rate the node carried; 0 = not even one. */
25375
+ maxSessions: number(),
25376
+ limitedBy: NodeBenchLimitSchema,
25377
+ /** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
25378
+ stepsFired: array(string()).readonly(),
25379
+ warmupMs: number(),
25380
+ ramp: array(NodeBenchRampStepSchema).readonly()
25381
+ })]);
25382
+ /**
25383
+ * What a result was measured ON. A result whose fingerprint no longer matches
25384
+ * the node no longer beats the table.
25385
+ */
25386
+ var NodeBenchFingerprintSchema = object({
25387
+ pipelineVersion: string().nullable(),
25388
+ cpuModel: string().nullable(),
25389
+ ramGb: number().nullable(),
25390
+ os: string().nullable(),
25391
+ /** Per device: the pool the cells ran on (runtime + tuning). */
25392
+ pools: record(string(), object({
25393
+ runtime: string(),
25394
+ numWorkers: number(),
25395
+ concurrency: number(),
25396
+ batchMode: string()
25397
+ })).default({})
25398
+ });
25399
+ /** The frames the run used. */
25400
+ var NodeBenchClipSchema = object({
25401
+ /** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
25402
+ id: string(),
25403
+ revision: string().nullable(),
25404
+ frames: number(),
25405
+ width: number(),
25406
+ height: number()
25407
+ });
25408
+ var NodeBenchRunnerInputSchema = object({
25409
+ runId: string().min(1),
25410
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25411
+ phases: array(NodeBenchmarkPhaseSchema).min(1),
25412
+ /** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
25413
+ steps: array(string()).default([]),
25414
+ fpsPerStream: number().int().min(1).max(30),
25415
+ /** The runner stops on its own past this instant, whatever the hub does. */
25416
+ deadlineAtMs: number(),
25417
+ settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
25418
+ measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
25419
+ keepDownloadedModels: boolean().default(false)
25420
+ });
25421
+ var NodeBenchRunnerStateSchema = _enum([
25422
+ "running",
25423
+ "done",
25424
+ "failed",
25425
+ "aborted"
25426
+ ]);
25427
+ var NodeBenchRunnerStatusSchema = object({
25428
+ runId: string(),
25429
+ nodeId: string(),
25430
+ state: NodeBenchRunnerStateSchema,
25431
+ progress: NodeBenchProgressSchema.nullable(),
25432
+ /** Every finished cell so far — a run stopped half way keeps what it measured. */
25433
+ cells: array(NodeBenchCellSchema).readonly(),
25434
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25435
+ clip: NodeBenchClipSchema.nullable(),
25436
+ /** Cameras seen running on the node during the run (they share its pools). */
25437
+ activeCameraIds: array(number()).readonly(),
25438
+ /** Models the run downloaded and then deleted (not installed before). */
25439
+ deletedModels: array(string()).readonly(),
25440
+ error: string().nullable(),
25441
+ startedAtMs: number(),
25442
+ finishedAtMs: number().nullable()
25443
+ });
25444
+ var NodeBenchmarkStateSchema = _enum([
25445
+ "draining",
25446
+ "measuring",
25447
+ "restoring",
25448
+ "done",
25449
+ "failed",
25450
+ "aborted"
25451
+ ]);
25452
+ /** Why a run ended. */
25453
+ var NodeBenchmarkEndReasonSchema = _enum([
25454
+ "completed",
25455
+ "operator-abort",
25456
+ "deadline",
25457
+ "node-lost",
25458
+ "runner-lost",
25459
+ "hub-restart",
25460
+ "drain-timeout",
25461
+ "failed"
25462
+ ]);
25463
+ var NodeBenchmarkRunSchema = object({
25464
+ runId: string(),
25465
+ nodeId: string(),
25466
+ state: NodeBenchmarkStateSchema,
25467
+ plan: NodeBenchmarkPlanSchema,
25468
+ startedAtMs: number(),
25469
+ deadlineAtMs: number(),
25470
+ finishedAtMs: number().nullable(),
25471
+ endReason: NodeBenchmarkEndReasonSchema.nullable(),
25472
+ error: string().nullable(),
25473
+ /** Cameras moved off the node for the run. */
25474
+ moved: array(number()).readonly(),
25475
+ /** Cameras that stayed (their only frame source is the node). */
25476
+ staying: array(number()).readonly(),
25477
+ /** Something else ran on the node's pools during the run. */
25478
+ contaminated: boolean(),
25479
+ progress: NodeBenchProgressSchema.nullable(),
25480
+ resultIds: array(string()).readonly()
25481
+ });
25482
+ /** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
25483
+ var NodeBenchmarkStatusSchema = object({
25484
+ /** The node the cluster is in benchmark mode for; null = none. */
25485
+ modeNodeId: string().nullable(),
25486
+ run: NodeBenchmarkRunSchema.nullable()
25487
+ });
25488
+ /**
25489
+ * One stored measurement — the only authority Auto tune and the automatic
25490
+ * shares read measured capacity from. Written by the orchestrator when a run
25491
+ * ends, never by anyone else.
25492
+ */
25493
+ var NodeBenchmarkResultSchema = object({
25494
+ id: string(),
25495
+ runId: string(),
25496
+ nodeId: string(),
25497
+ cell: NodeBenchCellSchema,
25498
+ fpsPerStream: number(),
25499
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25500
+ clip: NodeBenchClipSchema.nullable(),
25501
+ /** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
25502
+ contaminated: boolean(),
25503
+ stayingCameras: array(number()).readonly(),
25504
+ /** The run ended early; the cell itself completed. */
25505
+ partialRun: boolean(),
25506
+ measuredAtMs: number()
25507
+ });
25508
+ var ListNodeBenchmarkResultsInputSchema = object({
25509
+ nodeId: string().optional(),
25510
+ deviceKey: string().optional()
25511
+ });
25512
+ /** A result with its standing today: does it still beat the table? */
25513
+ var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
25514
+ /** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
25515
+ standing: _enum([
25516
+ "fresh",
25517
+ "stale",
25518
+ "superseded"
25519
+ ]),
25520
+ staleWhy: _enum([
25521
+ "age",
25522
+ "runtime",
25523
+ "pool-tuning"
25524
+ ]).nullable()
25525
+ });
25526
+ object({
25527
+ runId: string(),
25528
+ nodeId: string(),
25529
+ startedAtMs: number(),
25530
+ deadlineAtMs: number(),
25531
+ plan: NodeBenchmarkPlanSchema,
25532
+ moved: array(number()).readonly(),
25533
+ staying: array(number()).readonly()
25534
+ });
25535
+ /** Candidate detectors per device, for the plan editor. */
25536
+ var NodeBenchmarkCandidatesSchema = object({
25537
+ nodeId: string(),
25538
+ reachable: boolean(),
25539
+ devices: array(object({
25540
+ deviceKey: string(),
25541
+ enabled: boolean(),
25542
+ available: boolean(),
25543
+ /** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
25544
+ suggested: array(string()).readonly(),
25545
+ /** Every root detector the device has a build for. */
25546
+ all: array(string()).readonly(),
25547
+ /** The model the device runs now, when pinned. */
25548
+ currentModelId: string().nullable()
25549
+ })).readonly(),
25550
+ /** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
25551
+ steps: array(object({
25552
+ id: string(),
25553
+ name: string(),
25554
+ slot: string()
25555
+ })).readonly()
25556
+ });
24075
25557
  object({
24076
25558
  activeCameras: number(),
24077
25559
  throttledCameras: number(),
@@ -25160,7 +26642,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
25160
26642
  }), ParkedTrackFrameSchema.nullable()), method(object({
25161
26643
  deviceId: number(),
25162
26644
  trackId: string()
25163
- }), object({ released: number().int().nonnegative() }), { kind: "mutation" });
26645
+ }), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
26646
+ accepted: literal(true),
26647
+ runId: string()
26648
+ }), {
26649
+ kind: "mutation",
26650
+ auth: "admin"
26651
+ }), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
26652
+ kind: "mutation",
26653
+ auth: "admin"
26654
+ });
25164
26655
  var CameraPipelineConfigSchema = object({
25165
26656
  engine: PipelineEngineChoiceSchema.optional(),
25166
26657
  steps: array(PipelineStepInputSchema).readonly(),
@@ -25799,6 +27290,21 @@ method(object({
25799
27290
  }), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
25800
27291
  kind: "mutation",
25801
27292
  auth: "admin"
27293
+ }), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
27294
+ kind: literal("started"),
27295
+ runId: string()
27296
+ }), object({
27297
+ kind: literal("refused"),
27298
+ preflight: NodeBenchmarkPreflightSchema
27299
+ })]), {
27300
+ kind: "mutation",
27301
+ auth: "admin"
27302
+ }), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
27303
+ kind: "mutation",
27304
+ auth: "admin"
27305
+ }), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
27306
+ kind: "mutation",
27307
+ auth: "admin"
25802
27308
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
25803
27309
  deviceId: number(),
25804
27310
  addonId: string(),
@@ -30984,6 +32490,9 @@ var CreateIntegrationInputSchema = object({
30984
32490
  enabled: boolean().optional(),
30985
32491
  info: record(string(), unknown()).optional(),
30986
32492
  settings: record(string(), unknown()).optional(),
32493
+ /** Keys of `settings` the form's schema declares secret (by type) — kept in
32494
+ * the keychain, not the table (D787). */
32495
+ secretKeys: array(string()).optional(),
30987
32496
  skipRestart: boolean().optional()
30988
32497
  });
30989
32498
  var UpdateIntegrationInputSchema = object({
@@ -31007,7 +32516,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
31007
32516
  auth: "admin"
31008
32517
  }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
31009
32518
  id: string(),
31010
- settings: record(string(), unknown())
32519
+ settings: record(string(), unknown()),
32520
+ /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
32521
+ secretKeys: array(string()).optional()
31011
32522
  }), object({ success: boolean() }), {
31012
32523
  kind: "mutation",
31013
32524
  auth: "admin"
@@ -40623,6 +42134,90 @@ Object.freeze({
40623
42134
  addonId: null,
40624
42135
  access: "create"
40625
42136
  },
42137
+ "keychain.delete": {
42138
+ capName: "keychain",
42139
+ capScope: "system",
42140
+ addonId: null,
42141
+ access: "delete"
42142
+ },
42143
+ "keychain.getState": {
42144
+ capName: "keychain",
42145
+ capScope: "system",
42146
+ addonId: null,
42147
+ access: "view"
42148
+ },
42149
+ "keychain.listMeta": {
42150
+ capName: "keychain",
42151
+ capScope: "system",
42152
+ addonId: null,
42153
+ access: "view"
42154
+ },
42155
+ "keychain.put": {
42156
+ capName: "keychain",
42157
+ capScope: "system",
42158
+ addonId: null,
42159
+ access: "create"
42160
+ },
42161
+ "keychain.resolve": {
42162
+ capName: "keychain",
42163
+ capScope: "system",
42164
+ addonId: null,
42165
+ access: "view"
42166
+ },
42167
+ "keychainAdmin.deleteOrphans": {
42168
+ capName: "keychain-admin",
42169
+ capScope: "system",
42170
+ addonId: null,
42171
+ access: "delete"
42172
+ },
42173
+ "keychainAdmin.downloadRecoveryKey": {
42174
+ capName: "keychain-admin",
42175
+ capScope: "system",
42176
+ addonId: null,
42177
+ access: "create"
42178
+ },
42179
+ "keychainAdmin.listAudit": {
42180
+ capName: "keychain-admin",
42181
+ capScope: "system",
42182
+ addonId: null,
42183
+ access: "view"
42184
+ },
42185
+ "keychainAdmin.listSecrets": {
42186
+ capName: "keychain-admin",
42187
+ capScope: "system",
42188
+ addonId: null,
42189
+ access: "view"
42190
+ },
42191
+ "keychainAdmin.purgeRetiredKeys": {
42192
+ capName: "keychain-admin",
42193
+ capScope: "system",
42194
+ addonId: null,
42195
+ access: "delete"
42196
+ },
42197
+ "keychainAdmin.resetKeychain": {
42198
+ capName: "keychain-admin",
42199
+ capScope: "system",
42200
+ addonId: null,
42201
+ access: "delete"
42202
+ },
42203
+ "keychainAdmin.reveal": {
42204
+ capName: "keychain-admin",
42205
+ capScope: "system",
42206
+ addonId: null,
42207
+ access: "create"
42208
+ },
42209
+ "keychainAdmin.rotateMasterKey": {
42210
+ capName: "keychain-admin",
42211
+ capScope: "system",
42212
+ addonId: null,
42213
+ access: "create"
42214
+ },
42215
+ "keychainAdmin.status": {
42216
+ capName: "keychain-admin",
42217
+ capScope: "system",
42218
+ addonId: null,
42219
+ access: "view"
42220
+ },
40626
42221
  "lawnMowerControl.dock": {
40627
42222
  capName: "lawn-mower-control",
40628
42223
  capScope: "device",
@@ -41997,6 +43592,18 @@ Object.freeze({
41997
43592
  addonId: null,
41998
43593
  access: "create"
41999
43594
  },
43595
+ "pipelineAnalytics.addRetrainFrameFromRecording": {
43596
+ capName: "pipeline-analytics",
43597
+ capScope: "device",
43598
+ addonId: null,
43599
+ access: "create"
43600
+ },
43601
+ "pipelineAnalytics.addRetrainFramesToCollection": {
43602
+ capName: "pipeline-analytics",
43603
+ capScope: "device",
43604
+ addonId: null,
43605
+ access: "create"
43606
+ },
42000
43607
  "pipelineAnalytics.applyDeviceSettingsPatch": {
42001
43608
  capName: "pipeline-analytics",
42002
43609
  capScope: "device",
@@ -42045,12 +43652,24 @@ Object.freeze({
42045
43652
  addonId: null,
42046
43653
  access: "view"
42047
43654
  },
43655
+ "pipelineAnalytics.createRetrainCollection": {
43656
+ capName: "pipeline-analytics",
43657
+ capScope: "device",
43658
+ addonId: null,
43659
+ access: "create"
43660
+ },
42048
43661
  "pipelineAnalytics.deleteDeviceEvents": {
42049
43662
  capName: "pipeline-analytics",
42050
43663
  capScope: "device",
42051
43664
  addonId: null,
42052
43665
  access: "delete"
42053
43666
  },
43667
+ "pipelineAnalytics.deleteRetrainCollection": {
43668
+ capName: "pipeline-analytics",
43669
+ capScope: "device",
43670
+ addonId: null,
43671
+ access: "delete"
43672
+ },
42054
43673
  "pipelineAnalytics.deleteTracks": {
42055
43674
  capName: "pipeline-analytics",
42056
43675
  capScope: "device",
@@ -42255,6 +43874,24 @@ Object.freeze({
42255
43874
  addonId: null,
42256
43875
  access: "view"
42257
43876
  },
43877
+ "pipelineAnalytics.listRetrainAssistProfiles": {
43878
+ capName: "pipeline-analytics",
43879
+ capScope: "device",
43880
+ addonId: null,
43881
+ access: "view"
43882
+ },
43883
+ "pipelineAnalytics.listRetrainCollectionFrames": {
43884
+ capName: "pipeline-analytics",
43885
+ capScope: "device",
43886
+ addonId: null,
43887
+ access: "view"
43888
+ },
43889
+ "pipelineAnalytics.listRetrainCollections": {
43890
+ capName: "pipeline-analytics",
43891
+ capScope: "device",
43892
+ addonId: null,
43893
+ access: "view"
43894
+ },
42258
43895
  "pipelineAnalytics.listRetrainFrames": {
42259
43896
  capName: "pipeline-analytics",
42260
43897
  capScope: "device",
@@ -42303,6 +43940,12 @@ Object.freeze({
42303
43940
  addonId: null,
42304
43941
  access: "create"
42305
43942
  },
43943
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
43944
+ capName: "pipeline-analytics",
43945
+ capScope: "device",
43946
+ addonId: null,
43947
+ access: "create"
43948
+ },
42306
43949
  "pipelineAnalytics.pruneEvents": {
42307
43950
  capName: "pipeline-analytics",
42308
43951
  capScope: "device",
@@ -42357,6 +44000,18 @@ Object.freeze({
42357
44000
  addonId: null,
42358
44001
  access: "create"
42359
44002
  },
44003
+ "pipelineAnalytics.removeRetrainFrameFromCollection": {
44004
+ capName: "pipeline-analytics",
44005
+ capScope: "device",
44006
+ addonId: null,
44007
+ access: "delete"
44008
+ },
44009
+ "pipelineAnalytics.renameRetrainCollection": {
44010
+ capName: "pipeline-analytics",
44011
+ capScope: "device",
44012
+ addonId: null,
44013
+ access: "create"
44014
+ },
42360
44015
  "pipelineAnalytics.restageRetrainTrack": {
42361
44016
  capName: "pipeline-analytics",
42362
44017
  capScope: "device",
@@ -42645,6 +44300,12 @@ Object.freeze({
42645
44300
  addonId: null,
42646
44301
  access: "view"
42647
44302
  },
44303
+ "pipelineOrchestrator.abortNodeBenchmark": {
44304
+ capName: "pipeline-orchestrator",
44305
+ capScope: "system",
44306
+ addonId: null,
44307
+ access: "create"
44308
+ },
42648
44309
  "pipelineOrchestrator.applyAutoTune": {
42649
44310
  capName: "pipeline-orchestrator",
42650
44311
  capScope: "system",
@@ -42669,6 +44330,12 @@ Object.freeze({
42669
44330
  addonId: null,
42670
44331
  access: "create"
42671
44332
  },
44333
+ "pipelineOrchestrator.deleteNodeBenchmarkResult": {
44334
+ capName: "pipeline-orchestrator",
44335
+ capScope: "system",
44336
+ addonId: null,
44337
+ access: "delete"
44338
+ },
42672
44339
  "pipelineOrchestrator.getAgentLoad": {
42673
44340
  capName: "pipeline-orchestrator",
42674
44341
  capScope: "system",
@@ -42777,6 +44444,24 @@ Object.freeze({
42777
44444
  addonId: null,
42778
44445
  access: "view"
42779
44446
  },
44447
+ "pipelineOrchestrator.getNodeBenchmarkCandidates": {
44448
+ capName: "pipeline-orchestrator",
44449
+ capScope: "system",
44450
+ addonId: null,
44451
+ access: "view"
44452
+ },
44453
+ "pipelineOrchestrator.getNodeBenchmarkPreflight": {
44454
+ capName: "pipeline-orchestrator",
44455
+ capScope: "system",
44456
+ addonId: null,
44457
+ access: "view"
44458
+ },
44459
+ "pipelineOrchestrator.getNodeBenchmarkStatus": {
44460
+ capName: "pipeline-orchestrator",
44461
+ capScope: "system",
44462
+ addonId: null,
44463
+ access: "view"
44464
+ },
42780
44465
  "pipelineOrchestrator.getNodeInferenceDevices": {
42781
44466
  capName: "pipeline-orchestrator",
42782
44467
  capScope: "system",
@@ -42819,6 +44504,12 @@ Object.freeze({
42819
44504
  addonId: null,
42820
44505
  access: "view"
42821
44506
  },
44507
+ "pipelineOrchestrator.listNodeBenchmarkResults": {
44508
+ capName: "pipeline-orchestrator",
44509
+ capScope: "system",
44510
+ addonId: null,
44511
+ access: "view"
44512
+ },
42822
44513
  "pipelineOrchestrator.pauseForStorageMigration": {
42823
44514
  capName: "pipeline-orchestrator",
42824
44515
  capScope: "system",
@@ -42963,6 +44654,12 @@ Object.freeze({
42963
44654
  addonId: null,
42964
44655
  access: "create"
42965
44656
  },
44657
+ "pipelineOrchestrator.startNodeBenchmark": {
44658
+ capName: "pipeline-orchestrator",
44659
+ capScope: "system",
44660
+ addonId: null,
44661
+ access: "create"
44662
+ },
42966
44663
  "pipelineOrchestrator.suggestShares": {
42967
44664
  capName: "pipeline-orchestrator",
42968
44665
  capScope: "system",
@@ -42981,6 +44678,12 @@ Object.freeze({
42981
44678
  addonId: null,
42982
44679
  access: "create"
42983
44680
  },
44681
+ "pipelineRunner.abortNodeBench": {
44682
+ capName: "pipeline-runner",
44683
+ capScope: "system",
44684
+ addonId: null,
44685
+ access: "create"
44686
+ },
42984
44687
  "pipelineRunner.attachCamera": {
42985
44688
  capName: "pipeline-runner",
42986
44689
  capScope: "system",
@@ -43029,6 +44732,12 @@ Object.freeze({
43029
44732
  addonId: null,
43030
44733
  access: "view"
43031
44734
  },
44735
+ "pipelineRunner.getNodeBenchStatus": {
44736
+ capName: "pipeline-runner",
44737
+ capScope: "system",
44738
+ addonId: null,
44739
+ access: "view"
44740
+ },
43032
44741
  "pipelineRunner.getParkedTrackFrame": {
43033
44742
  capName: "pipeline-runner",
43034
44743
  capScope: "system",
@@ -43071,6 +44780,12 @@ Object.freeze({
43071
44780
  addonId: null,
43072
44781
  access: "create"
43073
44782
  },
44783
+ "pipelineRunner.startNodeBench": {
44784
+ capName: "pipeline-runner",
44785
+ capScope: "system",
44786
+ addonId: null,
44787
+ access: "create"
44788
+ },
43074
44789
  "plateGallery.assignPlate": {
43075
44790
  capName: "plate-gallery",
43076
44791
  capScope: "system",
@@ -48066,6 +49781,11 @@ Object.freeze({
48066
49781
  form: "single",
48067
49782
  optional: false
48068
49783
  }],
49784
+ "pipelineAnalytics.addRetrainFrameFromRecording": [{
49785
+ name: "deviceId",
49786
+ form: "single",
49787
+ optional: false
49788
+ }],
48069
49789
  "pipelineAnalytics.applyDeviceSettingsPatch": [{
48070
49790
  name: "deviceId",
48071
49791
  form: "single",
@@ -48256,6 +49976,11 @@ Object.freeze({
48256
49976
  form: "single",
48257
49977
  optional: false
48258
49978
  }],
49979
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
49980
+ name: "deviceId",
49981
+ form: "single",
49982
+ optional: false
49983
+ }],
48259
49984
  "pipelineAnalytics.pruneEventsBefore": [{
48260
49985
  name: "deviceId",
48261
49986
  form: "single",