@camstack/addon-post-analysis 1.2.343 → 1.2.345

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 (15) hide show
  1. package/dist/{clip-model-registry-Cd_y9S4U.js → clip-model-registry-Bd8rsIjt.js} +2133 -57
  2. package/dist/{clip-model-registry-DZz3e781.mjs → clip-model-registry-CIbZ6YOF.mjs} +2133 -57
  3. package/dist/embedding-encoder/index.js +1 -1
  4. package/dist/embedding-encoder/index.mjs +1 -1
  5. package/dist/pipeline-analytics/_stub.js +2 -2
  6. package/dist/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-DrdO3Pxp.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-DTenVWiv.mjs} +2 -2
  7. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DTOF9hbS.mjs +26 -0
  8. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DUrhEd38.mjs +26 -0
  9. package/dist/pipeline-analytics/{hostInit-DPNnWr-m.mjs → hostInit-BO3gbCue.mjs} +2 -2
  10. package/dist/pipeline-analytics/index.js +2391 -405
  11. package/dist/pipeline-analytics/index.mjs +2391 -405
  12. package/dist/pipeline-analytics/remoteEntry.js +1 -1
  13. package/package.json +1 -1
  14. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DEq-B6oq.mjs +0 -26
  15. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CiTUMvVf.mjs +0 -26
@@ -30,7 +30,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  }) : target, mod));
31
31
  //#endregion
32
32
  let node_crypto = require("node:crypto");
33
- //#region ../types/dist/event-category-B_0XEcLF.mjs
33
+ //#region ../types/dist/event-category-DaIZi00R.mjs
34
34
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
35
35
  EventCategory["SystemBoot"] = "system.boot";
36
36
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -109,6 +109,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
109
109
  */
110
110
  EventCategory["AddonLoadFailed"] = "addon.load-failed";
111
111
  /**
112
+ * A keychain value was stored or removed (D787). Carries the ref, its
113
+ * owner and the new version — NEVER the value. A process holding the ref
114
+ * drops its cached copy and the owning `BaseAddon` re-resolves its config.
115
+ * Telemetry (D8): a process that misses it still revalidates by version.
116
+ */
117
+ EventCategory["KeychainChanged"] = "keychain.changed";
118
+ /**
112
119
  * Addon recovered from a previous failure. Emitted when an addon
113
120
  * transitions from `failed` back to `healthy` (typically via the
114
121
  * monitor's auto-retry loop, or after manual `addons.retryLoad`).
@@ -5473,7 +5480,7 @@ var ZodIssueCode = {
5473
5480
  var ZodFirstPartyTypeKind;
5474
5481
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5475
5482
  //#endregion
5476
- //#region ../types/dist/sleep-B0JG7-_F.mjs
5483
+ //#region ../types/dist/sleep-DujUvOcb.mjs
5477
5484
  /**
5478
5485
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5479
5486
  * window to float samples (D455).
@@ -5552,6 +5559,97 @@ function buildAlawTable() {
5552
5559
  }
5553
5560
  buildUlawTable();
5554
5561
  buildAlawTable();
5562
+ /** Is this field's stored value a credential? */
5563
+ function isSecretConfigField(field) {
5564
+ if (field.type === "password") return true;
5565
+ return "secret" in field && field.secret === true;
5566
+ }
5567
+ /**
5568
+ * Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
5569
+ * by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
5570
+ */
5571
+ function isKeychainStoredField(field) {
5572
+ if (!isSecretConfigField(field)) return false;
5573
+ if (field.type === "textarea" && field.isJson === true) return false;
5574
+ return !("storage" in field && field.storage === "inline");
5575
+ }
5576
+ /**
5577
+ * What a settings blob holds where a secret used to be.
5578
+ *
5579
+ * A keychain-stored field never holds its value. It holds a self-describing
5580
+ * MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
5581
+ * code can mistake it for a credential and no form can send it to a camera as
5582
+ * a password. The empty state is `null` / absent, never `''`.
5583
+ *
5584
+ * The same shapes travel to and from the admin UI:
5585
+ *
5586
+ * - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
5587
+ * (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
5588
+ * value is set, never the value.
5589
+ * - write: an untouched field submits the view back unchanged (KEEP); a typed
5590
+ * value is a plain non-empty string (CHANGE); the Clear button submits
5591
+ * {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
5592
+ * are KEEP — an empty string is what a defaults-fallback pushes back, and
5593
+ * treating it as "clear" is how a save destroyed a stored credential before.
5594
+ *
5595
+ * Pure and browser-safe.
5596
+ */
5597
+ var SECRET_CLEAR = { $secretClear: true };
5598
+ /** The `'***'` token D634 redaction writes for non-admins. */
5599
+ var LEGACY_DEVICE_REDACTION = "***";
5600
+ function isRecord$1(value) {
5601
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5602
+ }
5603
+ function makeSecretMarker(ref) {
5604
+ return {
5605
+ $secret: ref,
5606
+ v: 1
5607
+ };
5608
+ }
5609
+ /** A stored marker: an object whose `$secret` is a non-empty string. */
5610
+ function isSecretMarker(value) {
5611
+ if (!isRecord$1(value)) return false;
5612
+ const ref = value["$secret"];
5613
+ return typeof ref === "string" && ref.length > 0;
5614
+ }
5615
+ function isSecretClear(value) {
5616
+ return isRecord$1(value) && value["$secretClear"] === true;
5617
+ }
5618
+ /**
5619
+ * The UI view of a stored secret field value: a marker becomes "set", inline
5620
+ * plaintext becomes "set (inline)", nothing becomes `null`. A value never
5621
+ * survives this function.
5622
+ */
5623
+ function toSecretFieldView(stored) {
5624
+ if (isSecretMarker(stored)) return {
5625
+ $secret: stored.$secret,
5626
+ v: 1,
5627
+ set: true
5628
+ };
5629
+ if (typeof stored === "string" && stored.length > 0) return {
5630
+ $secret: null,
5631
+ v: 1,
5632
+ set: true,
5633
+ inline: true
5634
+ };
5635
+ return null;
5636
+ }
5637
+ /**
5638
+ * Classify an incoming value for a secret path. Only a non-empty string that is
5639
+ * not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
5640
+ * Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
5641
+ * `undefined`, a redaction token, a non-string — keeps what is stored.
5642
+ */
5643
+ function classifySecretWrite(incoming) {
5644
+ if (isSecretClear(incoming)) return { kind: "clear" };
5645
+ if (typeof incoming !== "string") return { kind: "keep" };
5646
+ if (incoming.length === 0) return { kind: "keep" };
5647
+ if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
5648
+ return {
5649
+ kind: "set",
5650
+ value: incoming
5651
+ };
5652
+ }
5555
5653
  Object.fromEntries([
5556
5654
  {
5557
5655
  id: "overview",
@@ -5723,33 +5821,19 @@ Object.fromEntries([
5723
5821
  function isValuelessField(field) {
5724
5822
  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";
5725
5823
  }
5726
- /**
5727
- * Merge a `ConfigUISchema` with a raw `values` record into a
5728
- * `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
5729
- * before returning to the admin UI. Groups are walked recursively.
5730
- *
5731
- * For each leaf field:
5732
- * - structural fields (`separator`, `info`, `button`) pass through unchanged
5733
- * - other fields get `value = values[key] ?? field.default ?? null`
5734
- *
5735
- * Unknown keys in `values` (keys not declared in the schema) are silently
5736
- * ignored — they don't contribute to the output. Missing keys fall back to
5737
- * the schema default or `null`. This mirrors the old backend behaviour where
5738
- * `FormBuilder` rendered `values[key] ?? field.default`.
5739
- */
5740
- function hydrateSchema(schema, values) {
5824
+ function hydrateSchema(schema, values, options = {}) {
5741
5825
  return {
5742
5826
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
5743
5827
  sections: schema.sections.map((section) => ({
5744
5828
  ...section,
5745
- fields: section.fields.map((field) => hydrateField(field, values))
5829
+ fields: section.fields.map((field) => hydrateField(field, values, options))
5746
5830
  }))
5747
5831
  };
5748
5832
  }
5749
- function hydrateField(field, values) {
5833
+ function hydrateField(field, values, options) {
5750
5834
  if (isValuelessField(field)) return field;
5751
5835
  if (field.type === "group") {
5752
- const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
5836
+ const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
5753
5837
  return {
5754
5838
  ...field,
5755
5839
  fields: hydratedChildren
@@ -5758,7 +5842,7 @@ function hydrateField(field, values) {
5758
5842
  if (field.type === "sub-tabs") {
5759
5843
  const hydratedTabs = field.tabs.map((tab) => ({
5760
5844
  ...tab,
5761
- fields: tab.fields.map((child) => hydrateField(child, values))
5845
+ fields: tab.fields.map((child) => hydrateField(child, values, options))
5762
5846
  }));
5763
5847
  return {
5764
5848
  ...field,
@@ -5768,6 +5852,33 @@ function hydrateField(field, values) {
5768
5852
  const key = field.key;
5769
5853
  const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
5770
5854
  const defaultValue = field.default;
5855
+ const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
5856
+ if (isKeychainStoredField(field) && asView(storedValue)) return {
5857
+ ...field,
5858
+ value: toSecretFieldView(storedValue)
5859
+ };
5860
+ if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
5861
+ ...field,
5862
+ value: null
5863
+ };
5864
+ if (field.type === "editable-array" && Array.isArray(storedValue)) {
5865
+ const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
5866
+ if (secretItemKeys.length > 0) {
5867
+ const rows = storedValue.map((row) => {
5868
+ if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
5869
+ const out = { ...row };
5870
+ for (const k of secretItemKeys) {
5871
+ const v = Reflect.get(row, k);
5872
+ if (asView(v)) out[k] = toSecretFieldView(v);
5873
+ }
5874
+ return out;
5875
+ });
5876
+ return {
5877
+ ...field,
5878
+ value: rows
5879
+ };
5880
+ }
5881
+ }
5771
5882
  if (field.multiple) {
5772
5883
  const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
5773
5884
  const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
@@ -6010,6 +6121,431 @@ function projectStore(store, perNodeKeys, nodeId) {
6010
6121
  }
6011
6122
  return out;
6012
6123
  }
6124
+ var GLOBAL_SCOPE = { kind: "global" };
6125
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6126
+ function globalSecretScope() {
6127
+ return GLOBAL_SCOPE;
6128
+ }
6129
+ function encodeSegment(value) {
6130
+ return encodeURIComponent(value);
6131
+ }
6132
+ /**
6133
+ * The field path of a value inside an array item, addressed by the item's id:
6134
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6135
+ * `providers[authentik].clientSecret`.
6136
+ */
6137
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6138
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6139
+ }
6140
+ /** A write to a secret path could not be stored in the keychain, so it was refused. */
6141
+ var KeychainWriteRefusedError = class extends Error {
6142
+ fieldPath;
6143
+ constructor(fieldPath, cause) {
6144
+ super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
6145
+ this.fieldPath = fieldPath;
6146
+ this.name = "KeychainWriteRefusedError";
6147
+ }
6148
+ };
6149
+ var KEEP = { kind: "keep" };
6150
+ function isRecord(value) {
6151
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6152
+ }
6153
+ function defaultMintId() {
6154
+ return globalThis.crypto.randomUUID();
6155
+ }
6156
+ /** Every marker ref anywhere under `value`. */
6157
+ function collectSecretMarkerRefs(value, out = []) {
6158
+ if (isSecretMarker(value)) {
6159
+ out.push(value.$secret);
6160
+ return out;
6161
+ }
6162
+ if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6163
+ else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6164
+ return out;
6165
+ }
6166
+ async function storedValueEquals(secrets, marker, candidate) {
6167
+ const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
6168
+ return resolved?.kind === "value" && resolved.value === candidate;
6169
+ }
6170
+ async function writeLeaf(ctx, incoming, stored, fieldPath) {
6171
+ const intent = classifySecretWrite(incoming);
6172
+ const ref = ctx.secrets.ref(ctx.scope, fieldPath);
6173
+ const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
6174
+ if (intent.kind === "keep") return KEEP;
6175
+ if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
6176
+ if (intent.kind === "clear") {
6177
+ if (storedIsOurs) ctx.deletes.push(ref);
6178
+ return {
6179
+ kind: "value",
6180
+ value: null
6181
+ };
6182
+ }
6183
+ if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
6184
+ kind: "value",
6185
+ value: stored
6186
+ };
6187
+ try {
6188
+ await ctx.secrets.put(ref, intent.value);
6189
+ } catch (err) {
6190
+ throw new KeychainWriteRefusedError(fieldPath, err);
6191
+ }
6192
+ return {
6193
+ kind: "value",
6194
+ value: makeSecretMarker(ref)
6195
+ };
6196
+ }
6197
+ /** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
6198
+ function applyMember(out, key, result, storedParent) {
6199
+ if (result.kind === "value") {
6200
+ out[key] = result.value;
6201
+ return;
6202
+ }
6203
+ if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
6204
+ else delete out[key];
6205
+ }
6206
+ async function writeMembers(ctx, children, incoming, stored, pathOf) {
6207
+ const out = { ...incoming };
6208
+ for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
6209
+ return out;
6210
+ }
6211
+ function rowId(row, idKey) {
6212
+ const raw = row[idKey];
6213
+ if (typeof raw === "string" && raw.length > 0) return raw;
6214
+ if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
6215
+ return null;
6216
+ }
6217
+ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6218
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6219
+ if (!Array.isArray(incoming)) {
6220
+ ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6221
+ return {
6222
+ kind: "value",
6223
+ value: incoming
6224
+ };
6225
+ }
6226
+ const storedById = /* @__PURE__ */ new Map();
6227
+ for (const row of storedRows) {
6228
+ const id = rowId(row, node.idKey);
6229
+ if (id !== null) storedById.set(id, row);
6230
+ }
6231
+ const kept = /* @__PURE__ */ new Set();
6232
+ const rows = [];
6233
+ for (const row of incoming) {
6234
+ if (!isRecord(row)) {
6235
+ rows.push(row);
6236
+ continue;
6237
+ }
6238
+ const id = rowId(row, node.idKey) ?? ctx.mintId();
6239
+ kept.add(id);
6240
+ const withId = {
6241
+ ...row,
6242
+ [node.idKey]: row[node.idKey] ?? id
6243
+ };
6244
+ if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
6245
+ const storedRow = storedById.get(id) ?? {};
6246
+ rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
6247
+ }
6248
+ for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
6249
+ return {
6250
+ kind: "value",
6251
+ value: rows
6252
+ };
6253
+ }
6254
+ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6255
+ switch (node.kind) {
6256
+ case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6257
+ case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6258
+ case "object": {
6259
+ if (!isRecord(incoming)) {
6260
+ if (incoming === void 0) return KEEP;
6261
+ ctx.deletes.push(...collectSecretMarkerRefs(stored));
6262
+ return {
6263
+ kind: "value",
6264
+ value: incoming
6265
+ };
6266
+ }
6267
+ const storedObj = isRecord(stored) ? stored : {};
6268
+ return {
6269
+ kind: "value",
6270
+ value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
6271
+ };
6272
+ }
6273
+ }
6274
+ }
6275
+ /** Split a perNode-scoped key (`key@nodeId`). */
6276
+ function splitNodeKey(key) {
6277
+ const at = key.indexOf("@");
6278
+ return at <= 0 ? {
6279
+ base: key,
6280
+ nodeId: null
6281
+ } : {
6282
+ base: key.slice(0, at),
6283
+ nodeId: key.slice(at + 1)
6284
+ };
6285
+ }
6286
+ /** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
6287
+ async function transformSecretWrite(input) {
6288
+ const deletes = [];
6289
+ const base = {
6290
+ secrets: input.secrets,
6291
+ mintId: input.mintId ?? defaultMintId,
6292
+ deletes,
6293
+ operatorWrite: input.operatorWrite === true
6294
+ };
6295
+ const out = {};
6296
+ for (const [key, incoming] of Object.entries(input.patch)) {
6297
+ const { base: baseKey, nodeId } = splitNodeKey(key);
6298
+ const node = input.tree.get(baseKey);
6299
+ if (node === void 0) {
6300
+ out[key] = incoming;
6301
+ continue;
6302
+ }
6303
+ const scope = nodeId !== null && nodeId.length > 0 ? {
6304
+ kind: "node",
6305
+ nodeId
6306
+ } : input.scope ?? globalSecretScope();
6307
+ const result = await writeNode({
6308
+ ...base,
6309
+ scope
6310
+ }, node, incoming, input.stored[key], baseKey);
6311
+ if (result.kind === "value") out[key] = result.value;
6312
+ }
6313
+ return {
6314
+ patch: out,
6315
+ afterWrite: async () => {
6316
+ if (deletes.length === 0) return { orphaned: [] };
6317
+ try {
6318
+ await input.secrets.delete([...new Set(deletes)]);
6319
+ return { orphaned: [] };
6320
+ } catch {
6321
+ return { orphaned: [...new Set(deletes)] };
6322
+ }
6323
+ }
6324
+ };
6325
+ }
6326
+ /**
6327
+ * Replace every marker in `value` with its keychain value. Returns the SAME
6328
+ * reference when there is no marker (no allocation, no keychain call).
6329
+ */
6330
+ async function resolveSecretMarkers(value, secrets) {
6331
+ const refs = collectSecretMarkerRefs(value);
6332
+ if (refs.length === 0) return {
6333
+ value,
6334
+ unresolved: []
6335
+ };
6336
+ const answers = await secrets.resolve(refs);
6337
+ const unresolved = [];
6338
+ for (const ref of new Set(refs)) {
6339
+ const answer = answers[ref];
6340
+ if (answer === void 0) unresolved.push({
6341
+ ref,
6342
+ reason: "not-initialized"
6343
+ });
6344
+ else if (answer.kind === "unavailable") unresolved.push({
6345
+ ref,
6346
+ reason: answer.reason
6347
+ });
6348
+ else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
6349
+ ref,
6350
+ reason: answer.kind
6351
+ });
6352
+ }
6353
+ const substitute = (v) => {
6354
+ if (isSecretMarker(v)) {
6355
+ const answer = answers[v.$secret];
6356
+ return answer?.kind === "value" ? {
6357
+ keep: true,
6358
+ value: answer.value
6359
+ } : {
6360
+ keep: false,
6361
+ value: void 0
6362
+ };
6363
+ }
6364
+ if (Array.isArray(v)) {
6365
+ const items = [];
6366
+ for (const item of v) {
6367
+ const s = substitute(item);
6368
+ if (s.keep) items.push(s.value);
6369
+ }
6370
+ return {
6371
+ keep: true,
6372
+ value: items
6373
+ };
6374
+ }
6375
+ if (isRecord(v)) {
6376
+ const out = {};
6377
+ for (const [k, child] of Object.entries(v)) {
6378
+ const s = substitute(child);
6379
+ if (s.keep) out[k] = s.value;
6380
+ }
6381
+ return {
6382
+ keep: true,
6383
+ value: out
6384
+ };
6385
+ }
6386
+ return {
6387
+ keep: true,
6388
+ value: v
6389
+ };
6390
+ };
6391
+ return {
6392
+ value: substitute(value).value,
6393
+ unresolved
6394
+ };
6395
+ }
6396
+ function touchesTree(tree, patch) {
6397
+ if (tree.size === 0) return false;
6398
+ for (const key of Object.keys(patch)) {
6399
+ const at = key.indexOf("@");
6400
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6401
+ }
6402
+ return false;
6403
+ }
6404
+ /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6405
+ async function readStoredAddonBlob(raw) {
6406
+ const threeWay = raw.readAddonStoreResult;
6407
+ if (threeWay === void 0) return raw.readAddonStore();
6408
+ const result = await threeWay.call(raw);
6409
+ if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6410
+ return result.kind === "missing" ? {} : result.value;
6411
+ }
6412
+ function createSecretAwareSettings(raw, opts) {
6413
+ const chains = /* @__PURE__ */ new Map();
6414
+ const serialize = (key, fn) => {
6415
+ const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
6416
+ const tail = next.catch(() => void 0);
6417
+ chains.set(key, tail);
6418
+ tail.then(() => {
6419
+ if (chains.get(key) === tail) chains.delete(key);
6420
+ });
6421
+ return next;
6422
+ };
6423
+ const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6424
+ if (!touchesTree(tree, patch)) return rawWrite(patch);
6425
+ return serialize(chainKey, async () => {
6426
+ const stored = await readStored();
6427
+ const result = await transformSecretWrite({
6428
+ tree,
6429
+ secrets: opts.secrets,
6430
+ patch,
6431
+ stored,
6432
+ ...scope !== void 0 ? { scope } : {},
6433
+ operatorWrite: opts.isOperatorWrite?.() === true
6434
+ });
6435
+ if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6436
+ const { orphaned } = await result.afterWrite();
6437
+ if (orphaned.length > 0) opts.onOrphaned(orphaned);
6438
+ });
6439
+ };
6440
+ const wrapped = {
6441
+ writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6442
+ writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6443
+ kind: "device",
6444
+ deviceId
6445
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6446
+ };
6447
+ return new Proxy(raw, { get(target, prop, receiver) {
6448
+ if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6449
+ if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6450
+ const value = Reflect.get(target, prop, receiver);
6451
+ return typeof value === "function" ? value.bind(target) : value;
6452
+ } });
6453
+ }
6454
+ /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6455
+ function withSecretAwareSettings(context, opts) {
6456
+ const raw = context.settings;
6457
+ if (raw === void 0) return context;
6458
+ const settings = createSecretAwareSettings(raw, opts);
6459
+ return new Proxy(context, { get(target, prop, receiver) {
6460
+ if (prop === "settings") return settings;
6461
+ return Reflect.get(target, prop, receiver);
6462
+ } });
6463
+ }
6464
+ var LEAF = { kind: "leaf" };
6465
+ var DEFAULT_ITEM_ID_KEY = "id";
6466
+ function collectFields(fields, out) {
6467
+ for (const field of fields) {
6468
+ if (field.type === "group") {
6469
+ collectFields(field.fields, out);
6470
+ continue;
6471
+ }
6472
+ if (field.type === "sub-tabs") {
6473
+ for (const tab of field.tabs) collectFields(tab.fields, out);
6474
+ continue;
6475
+ }
6476
+ if (field.type === "editable-array") {
6477
+ const item = /* @__PURE__ */ new Map();
6478
+ for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
6479
+ if (item.size > 0) out.set(field.key, {
6480
+ kind: "array",
6481
+ idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
6482
+ item
6483
+ });
6484
+ continue;
6485
+ }
6486
+ if (!("key" in field) || typeof field.key !== "string") continue;
6487
+ if (isKeychainStoredField(field)) out.set(field.key, LEAF);
6488
+ }
6489
+ }
6490
+ /** The secret tree a settings schema declares. */
6491
+ function secretTreeFromSchema(schema) {
6492
+ const out = /* @__PURE__ */ new Map();
6493
+ if (schema === null) return out;
6494
+ for (const section of schema.sections) collectFields(section.fields, out);
6495
+ return out;
6496
+ }
6497
+ /** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
6498
+ function parseSecretStatePath(path) {
6499
+ const segments = [];
6500
+ for (const raw of path.split(".")) {
6501
+ const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
6502
+ if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
6503
+ segments.push(m[2] !== void 0 ? {
6504
+ key: m[1],
6505
+ idKey: m[2]
6506
+ } : { key: m[1] });
6507
+ }
6508
+ if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
6509
+ if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
6510
+ return segments;
6511
+ }
6512
+ function insert(into, segments) {
6513
+ const [head, ...rest] = segments;
6514
+ if (head === void 0) return;
6515
+ if (rest.length === 0) {
6516
+ into.set(head.key, LEAF);
6517
+ return;
6518
+ }
6519
+ const existing = into.get(head.key);
6520
+ if (head.idKey !== void 0) {
6521
+ const item = new Map(existing?.kind === "array" ? existing.item : []);
6522
+ insert(item, rest);
6523
+ into.set(head.key, {
6524
+ kind: "array",
6525
+ idKey: head.idKey,
6526
+ item
6527
+ });
6528
+ return;
6529
+ }
6530
+ const children = new Map(existing?.kind === "object" ? existing.children : []);
6531
+ insert(children, rest);
6532
+ into.set(head.key, {
6533
+ kind: "object",
6534
+ children
6535
+ });
6536
+ }
6537
+ /** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
6538
+ function mergeSecretStatePaths(tree, paths) {
6539
+ if (paths.length === 0) return tree;
6540
+ const out = new Map(tree);
6541
+ for (const path of paths) insert(out, parseSecretStatePath(path));
6542
+ return out;
6543
+ }
6544
+ /** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
6545
+ var SECRET_RETRY_FIRST_MS = 5e3;
6546
+ var SECRET_RETRY_MAX_MS = 5 * 6e4;
6547
+ /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
6548
+ var SECRET_CHANGE_DEBOUNCE_MS = 250;
6013
6549
  /**
6014
6550
  * Base class for CamStack addons. Eliminates settings boilerplate:
6015
6551
  *
@@ -6079,6 +6615,25 @@ var BaseAddon = class {
6079
6615
  settingsStoreReady = false;
6080
6616
  /** Default config values. Provided via constructor. */
6081
6617
  defaults;
6618
+ /**
6619
+ * Hidden-state paths that hold secrets (D787) — values the addon writes
6620
+ * itself (`updateGlobalSettings`, `state()`) that no form field declares.
6621
+ * Stored in the keychain exactly like a `password` field. Syntax:
6622
+ * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
6623
+ * (`key[<id field>]` addresses array items by id, never by index).
6624
+ */
6625
+ secretStatePaths = [];
6626
+ _addonSecretTree = null;
6627
+ _deviceSecretTree = null;
6628
+ /** Refs the last resolved config pointed at — a change to one re-resolves. */
6629
+ _configSecretRefs = /* @__PURE__ */ new Set();
6630
+ _unresolvedSecrets = [];
6631
+ _secretRetryTimer = null;
6632
+ _secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
6633
+ _secretChangeTimer = null;
6634
+ _secretChangeUnsub = null;
6635
+ /** >0 while an OPERATOR's settings write is being applied. */
6636
+ _operatorWriteDepth = 0;
6082
6637
  constructor(defaults) {
6083
6638
  this.defaults = defaults;
6084
6639
  this._config = { ...defaults };
@@ -6114,8 +6669,18 @@ var BaseAddon = class {
6114
6669
  return this._config;
6115
6670
  }
6116
6671
  async initialize(context) {
6117
- this._ctx = context;
6672
+ const secrets = context.secrets;
6673
+ this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6674
+ secrets,
6675
+ addonTree: () => this.addonSecretTree(),
6676
+ deviceTree: () => this.deviceSecretTree(),
6677
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6678
+ isOperatorWrite: () => this._operatorWriteDepth > 0
6679
+ }) : context;
6118
6680
  await this.resolveConfig();
6681
+ if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6682
+ if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
6683
+ });
6119
6684
  const result = await this.onInitialize();
6120
6685
  this.emitLifecycle(EventCategory.AddonStarted);
6121
6686
  const normalized = normalizeAddonInitResult(result);
@@ -6148,6 +6713,12 @@ var BaseAddon = class {
6148
6713
  */
6149
6714
  async onHubReachable() {}
6150
6715
  async shutdown() {
6716
+ this._secretChangeUnsub?.();
6717
+ this._secretChangeUnsub = null;
6718
+ if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
6719
+ if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
6720
+ this._secretRetryTimer = null;
6721
+ this._secretChangeTimer = null;
6151
6722
  this.emitLifecycle(EventCategory.AddonStopped);
6152
6723
  if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
6153
6724
  await this.onShutdown();
@@ -6226,7 +6797,7 @@ var BaseAddon = class {
6226
6797
  return hydrateSchema(schema, overlay ? {
6227
6798
  ...projected,
6228
6799
  ...overlay
6229
- } : projected);
6800
+ } : projected, { inlineSecretsAsViews: true });
6230
6801
  }
6231
6802
  /**
6232
6803
  * The integration-level view of this addon's settings: exactly the sections
@@ -6275,7 +6846,7 @@ var BaseAddon = class {
6275
6846
  return hydrateSchema({
6276
6847
  ...schema,
6277
6848
  sections
6278
- }, projected);
6849
+ }, projected, { inlineSecretsAsViews: true });
6279
6850
  }
6280
6851
  /**
6281
6852
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -6329,18 +6900,50 @@ var BaseAddon = class {
6329
6900
  value: result.value[key]
6330
6901
  };
6331
6902
  }
6903
+ /**
6904
+ * The OPERATOR's write — a settings form or an admin API call, dispatched by
6905
+ * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
6906
+ * the operator sends is stored as sent even when it equals a pre-keychain
6907
+ * inline value: the operator re-entering a password is a change, an addon
6908
+ * writing back what it read is not (D787).
6909
+ */
6910
+ async updateGlobalSettingsAsOperator(patch, nodeId) {
6911
+ this._operatorWriteDepth++;
6912
+ try {
6913
+ await this.applyGlobalPatch(patch, nodeId);
6914
+ } finally {
6915
+ this._operatorWriteDepth--;
6916
+ }
6917
+ }
6332
6918
  async updateGlobalSettings(patch, nodeId) {
6919
+ await this.applyGlobalPatch(patch, nodeId);
6920
+ }
6921
+ /**
6922
+ * REMOVE stored secrets — their keychain values and their markers (D787).
6923
+ *
6924
+ * Writing `''` to a secret field KEEPS what is stored (an empty string is
6925
+ * what a defaults fallback writes back, and it must never destroy a
6926
+ * credential), so code that means "forget this token" says so here. Without
6927
+ * a keychain (an older kernel) it writes `''`, as such code always did.
6928
+ */
6929
+ async clearSecrets(keys, nodeId) {
6930
+ const tree = this.addonSecretTree();
6931
+ const keychain = this._ctx?.secrets !== void 0;
6932
+ const patch = {};
6933
+ for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
6934
+ await this.applyGlobalPatch(patch, nodeId);
6935
+ }
6936
+ async applyGlobalPatch(barePatch, nodeId) {
6333
6937
  const keys = this.perNodeKeys();
6334
6938
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6335
6939
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6336
- const barePatch = patch;
6337
6940
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6338
6941
  await this._ctx?.settings?.writeAddonStore(scoped);
6339
6942
  if (target !== localNode) return;
6340
6943
  await this.resolveConfig();
6341
6944
  await this.onConfigChanged();
6342
6945
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
6343
- this.maybeAutoRestart(patch, this.globalSettingsSchema());
6946
+ this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
6344
6947
  }
6345
6948
  /**
6346
6949
  * The set of field keys the global settings schema declares `perNode: true`
@@ -6365,7 +6968,7 @@ var BaseAddon = class {
6365
6968
  * time to return its response before the addon is torn down and
6366
6969
  * re-initialised by `AddonRegistryService.restartAddon`.
6367
6970
  */
6368
- maybeAutoRestart(patch, schema) {
6971
+ maybeAutoRestart(patchKeys, schema) {
6369
6972
  if (!schema) return;
6370
6973
  const restartKeys = /* @__PURE__ */ new Set();
6371
6974
  for (const section of schema.sections) for (const field of section.fields) {
@@ -6373,13 +6976,13 @@ var BaseAddon = class {
6373
6976
  if (field.requiresRestart) restartKeys.add(field.key);
6374
6977
  }
6375
6978
  if (restartKeys.size === 0) return;
6376
- if (!Object.keys(patch).some((k) => restartKeys.has(k))) return;
6979
+ if (!patchKeys.some((k) => restartKeys.has(k))) return;
6377
6980
  const ctx = this._ctx;
6378
6981
  if (!ctx) return;
6379
6982
  const addonId = ctx.id;
6380
6983
  setImmediate(() => {
6381
6984
  ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
6382
- ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: Object.keys(patch).filter((k) => restartKeys.has(k)) } });
6985
+ ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
6383
6986
  }).catch((err) => {
6384
6987
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
6385
6988
  });
@@ -6388,7 +6991,7 @@ var BaseAddon = class {
6388
6991
  async getDeviceSettings(deviceId) {
6389
6992
  const schema = this.deviceSettingsSchema();
6390
6993
  if (!schema) return { sections: [] };
6391
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
6994
+ return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6392
6995
  }
6393
6996
  async updateDeviceSettings(deviceId, patch) {
6394
6997
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -6518,7 +7121,7 @@ var BaseAddon = class {
6518
7121
  * selection at boot (absent scoped key ⇒ the constructor default wins).
6519
7122
  */
6520
7123
  async resolveConfig() {
6521
- const stored = await this.readAddonStoreWithRetry();
7124
+ const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
6522
7125
  const perNode = this.perNodeKeys();
6523
7126
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6524
7127
  const resolved = { ...this.defaults };
@@ -6543,7 +7146,7 @@ var BaseAddon = class {
6543
7146
  key,
6544
7147
  schema,
6545
7148
  fallback,
6546
- read: () => this.readAddonStoreWithRetry(),
7149
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
6547
7150
  write: async (patch) => {
6548
7151
  await this._ctx?.settings?.writeAddonStore(patch);
6549
7152
  },
@@ -6560,7 +7163,7 @@ var BaseAddon = class {
6560
7163
  key,
6561
7164
  schema,
6562
7165
  fallback,
6563
- read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
7166
+ read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
6564
7167
  write: async (patch) => {
6565
7168
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
6566
7169
  },
@@ -6572,6 +7175,70 @@ var BaseAddon = class {
6572
7175
  } })
6573
7176
  });
6574
7177
  }
7178
+ /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
7179
+ addonSecretTree() {
7180
+ this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
7181
+ return this._addonSecretTree;
7182
+ }
7183
+ deviceSecretTree() {
7184
+ this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7185
+ return this._deviceSecretTree;
7186
+ }
7187
+ /**
7188
+ * Secrets of this addon's stored config that could not be resolved on the
7189
+ * last read, with why. Non-empty means the addon is running WITHOUT them —
7190
+ * an addon whose function needs one should report itself degraded rather
7191
+ * than start on an empty credential.
7192
+ */
7193
+ get unresolvedSecrets() {
7194
+ return this._unresolvedSecrets;
7195
+ }
7196
+ /**
7197
+ * Substitute every keychain marker in a stored blob with its value. With no
7198
+ * keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
7199
+ * An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
7200
+ * value — and, when the cause can pass, retried with backoff. Nothing is
7201
+ * ever written back from here.
7202
+ */
7203
+ async resolveStoredSecrets(blob, trackForConfig = true) {
7204
+ const secrets = this._ctx?.secrets;
7205
+ if (secrets === void 0) return blob;
7206
+ const refs = collectSecretMarkerRefs(blob);
7207
+ if (trackForConfig) this._configSecretRefs = new Set(refs);
7208
+ if (refs.length === 0) {
7209
+ if (trackForConfig) this._unresolvedSecrets = [];
7210
+ return blob;
7211
+ }
7212
+ const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
7213
+ if (trackForConfig) {
7214
+ this._unresolvedSecrets = unresolved;
7215
+ if (unresolved.length > 0) {
7216
+ this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
7217
+ ref: u.ref,
7218
+ reason: u.reason
7219
+ })) } });
7220
+ if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
7221
+ this.scheduleSecretReresolve(this._secretRetryDelayMs);
7222
+ this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
7223
+ }
7224
+ } else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
7225
+ }
7226
+ return value;
7227
+ }
7228
+ /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7229
+ scheduleSecretReresolve(delayMs) {
7230
+ const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
7231
+ if (this[timerOf] !== null) return;
7232
+ const timer = setTimeout(() => {
7233
+ this[timerOf] = null;
7234
+ if (this._ctx === null) return;
7235
+ this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
7236
+ this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
7237
+ });
7238
+ }, delayMs);
7239
+ timer.unref?.();
7240
+ this[timerOf] = timer;
7241
+ }
6575
7242
  /**
6576
7243
  * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
6577
7244
  * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
@@ -7336,6 +8003,69 @@ var deviceOpsCapability = {
7336
8003
  getRawState: method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" })
7337
8004
  }
7338
8005
  };
8006
+ function defOf(schema) {
8007
+ return schema._zod?.def ?? {};
8008
+ }
8009
+ function declaredHere(schema) {
8010
+ return globalRegistry.get(schema)?.secret === true;
8011
+ }
8012
+ /** Wrapper kinds whose `innerType` is the field itself. */
8013
+ var WRAPPERS = new Set([
8014
+ "optional",
8015
+ "nullable",
8016
+ "default",
8017
+ "prefault",
8018
+ "catch",
8019
+ "readonly",
8020
+ "nonoptional"
8021
+ ]);
8022
+ /**
8023
+ * The schema layers that make up ONE field: the schema itself and every
8024
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
8025
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8026
+ * `.transform` on `in`).
8027
+ */
8028
+ function layersOf(schema) {
8029
+ const out = [];
8030
+ const queue = [schema];
8031
+ while (queue.length > 0) {
8032
+ const s = queue.shift();
8033
+ if (!s || out.includes(s)) continue;
8034
+ out.push(s);
8035
+ const def = defOf(s);
8036
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8037
+ if (def.type === "pipe") {
8038
+ if (def.in) queue.push(def.in);
8039
+ if (def.out) queue.push(def.out);
8040
+ }
8041
+ }
8042
+ return out;
8043
+ }
8044
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
8045
+ function isZodSecret(schema) {
8046
+ return layersOf(schema).some(declaredHere);
8047
+ }
8048
+ /**
8049
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
8050
+ * element of this array" (`connection.password`, `rows[].token`). A declared
8051
+ * object or array is reported as one path and not descended into — everything
8052
+ * under it is secret.
8053
+ */
8054
+ function collectZodSecretPaths(schema, prefix = "") {
8055
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8056
+ const paths = [];
8057
+ for (const layer of layersOf(schema)) {
8058
+ const def = defOf(layer);
8059
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8060
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8061
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8062
+ else if (def.type === "intersection") {
8063
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8064
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8065
+ }
8066
+ }
8067
+ return [...new Set(paths)];
8068
+ }
7339
8069
  /**
7340
8070
  * AUTO-GENERATED by scripts/generate-device-scoped-caps.ts — DO NOT EDIT.
7341
8071
  *
@@ -16317,6 +17047,254 @@ id: union([string(), number()]) }), {
16317
17047
  })
16318
17048
  }
16319
17049
  };
17050
+ /**
17051
+ * `keychain` — the hub's encrypted store of secret values (D787).
17052
+ *
17053
+ * Settings blobs never hold a secret: they hold a marker
17054
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
17055
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
17056
+ * is the OWNER's door to its own values: every method is owner-checked
17057
+ * against the CALLER, never against anything the caller claims.
17058
+ *
17059
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
17060
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
17061
+ * connection, the agent from its child's connection carried in
17062
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
17063
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
17064
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
17065
+ * identity against BUGS and misrouting, not against a malicious addon (every
17066
+ * runner is the same OS user): see the threat model in
17067
+ * `docs/design/2026-10-08-secrets-keychain.md`.
17068
+ *
17069
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
17070
+ * parses the input, so a session can never supply it, and the internal mount
17071
+ * floors every method to admin anyway (D240).
17072
+ *
17073
+ * Internal: addons reach it through `ctx.secrets`, never directly.
17074
+ */
17075
+ /** Why a value cannot be served right now. Never folded into "missing". */
17076
+ var KeychainUnavailableReasonSchema = _enum([
17077
+ "key-missing",
17078
+ "wrong-key",
17079
+ "key-file-unreadable",
17080
+ "store-unavailable",
17081
+ "not-initialized",
17082
+ "decrypt-failed"
17083
+ ]);
17084
+ var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
17085
+ state: literal("locked"),
17086
+ reason: KeychainUnavailableReasonSchema
17087
+ })]);
17088
+ var KeychainResolveEntrySchema = discriminatedUnion("kind", [
17089
+ object({
17090
+ kind: literal("value"),
17091
+ value: string(),
17092
+ version: number().int()
17093
+ }),
17094
+ object({ kind: literal("missing") }),
17095
+ object({
17096
+ kind: literal("unavailable"),
17097
+ reason: KeychainUnavailableReasonSchema
17098
+ }),
17099
+ object({ kind: literal("forbidden") })
17100
+ ]);
17101
+ var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
17102
+ /** Metadata of one stored value — never the value. */
17103
+ var KeychainSecretMetaSchema = object({
17104
+ ref: string(),
17105
+ owner: string(),
17106
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
17107
+ scope: string(),
17108
+ fieldPath: string(),
17109
+ version: number().int(),
17110
+ createdAt: number(),
17111
+ updatedAt: number(),
17112
+ /** `addon:<id>` | `user:<id>` | `system`. */
17113
+ updatedBy: string(),
17114
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
17115
+ lastReadAt: number().nullable()
17116
+ });
17117
+ var RefListSchema = array(string().min(1)).max(512);
17118
+ var keychainCapability = {
17119
+ name: "keychain",
17120
+ scope: "system",
17121
+ mode: "singleton",
17122
+ internal: true,
17123
+ methods: {
17124
+ /** Store (or replace) the caller's value at `ref`. Refused while locked. */
17125
+ put: method(object({
17126
+ ref: string().min(1),
17127
+ value: string().min(1)
17128
+ }), object({
17129
+ ref: string(),
17130
+ version: number().int()
17131
+ }), {
17132
+ kind: "mutation",
17133
+ auth: "admin"
17134
+ }),
17135
+ /**
17136
+ * Resolve the caller's refs in one round-trip. A locked keychain answers
17137
+ * `unavailable` per ref — never `missing`, never an empty value.
17138
+ */
17139
+ resolve: method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }),
17140
+ /** Remove the caller's refs. Unknown refs are ignored. */
17141
+ delete: method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
17142
+ kind: "mutation",
17143
+ auth: "admin"
17144
+ }),
17145
+ /** The caller's own refs, metadata only. */
17146
+ listMeta: method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }),
17147
+ /** Whether values can be served — the save path refuses a write while locked. */
17148
+ getState: method(object({}), KeychainStateSchema, { auth: "admin" })
17149
+ }
17150
+ };
17151
+ var KeychainKeySourceSchema = object({
17152
+ kind: _enum([
17153
+ "config-file",
17154
+ "previous-config-file",
17155
+ "platform",
17156
+ "default-file"
17157
+ ]),
17158
+ /** File sources only — a path is not a secret. */
17159
+ path: string().optional(),
17160
+ /**
17161
+ * True when a whole-volume backup of the data directory carries this key
17162
+ * next to the database it protects (the default file). The page warns.
17163
+ */
17164
+ sharesBackupWithDatabase: boolean()
17165
+ });
17166
+ var KeychainStatusSchema = object({
17167
+ keychain: KeychainStateSchema,
17168
+ /** The source of the master key in use; `null` while locked. */
17169
+ keySource: KeychainKeySourceSchema.nullable(),
17170
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
17171
+ configuredSource: KeychainKeySourceSchema,
17172
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
17173
+ fingerprint: string().nullable(),
17174
+ activeKeyId: string().nullable(),
17175
+ /**
17176
+ * The keychain unlocked with a NON-primary source: the configured primary
17177
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
17178
+ */
17179
+ rotationPending: boolean(),
17180
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
17181
+ retiredWraps: number().int(),
17182
+ recoveryKeyDownloadedAt: number().nullable(),
17183
+ secretCount: number().int()
17184
+ });
17185
+ /**
17186
+ * Whether a stored value is still pointed at by its owner's settings.
17187
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
17188
+ * never reported as an orphan (and never deleted as one).
17189
+ */
17190
+ var KeychainSecretUsageSchema = _enum([
17191
+ "in-use",
17192
+ "orphan",
17193
+ "unknown"
17194
+ ]);
17195
+ var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
17196
+ var KeychainAuditActionSchema = _enum([
17197
+ "put",
17198
+ "delete",
17199
+ "reveal",
17200
+ "rotate-master-key",
17201
+ "purge-retired-keys",
17202
+ "download-recovery-key",
17203
+ "delete-orphans",
17204
+ "reset",
17205
+ "initialize"
17206
+ ]);
17207
+ var KeychainAuditEntrySchema = object({
17208
+ id: string(),
17209
+ at: number(),
17210
+ action: KeychainAuditActionSchema,
17211
+ /** `addon:<id>` | `user:<id>` | `system`. */
17212
+ actor: string(),
17213
+ ref: string().nullable(),
17214
+ detail: string().nullable()
17215
+ });
17216
+ var keychainAdminCapability = {
17217
+ name: "keychain-admin",
17218
+ scope: "system",
17219
+ mode: "singleton",
17220
+ methods: {
17221
+ status: method(object({}), KeychainStatusSchema, { auth: "admin" }),
17222
+ listSecrets: method(object({}), array(KeychainAdminSecretSchema).readonly(), { auth: "admin" }),
17223
+ listAudit: method(object({ limit: number().int().min(1).max(500).optional() }), array(KeychainAuditEntrySchema).readonly(), { auth: "admin" }),
17224
+ /**
17225
+ * Show one value to the operator. Audited. The UI hides it again after a
17226
+ * few seconds; nothing caches it.
17227
+ */
17228
+ reveal: method(object({ ref: string().min(1) }), object({
17229
+ value: string(),
17230
+ version: number().int()
17231
+ }), {
17232
+ kind: "mutation",
17233
+ auth: "admin",
17234
+ caller: "required"
17235
+ }),
17236
+ /** Delete refs no owner points at any more. Re-checked here; `unknown` is kept. */
17237
+ deleteOrphans: method(object({ refs: array(string().min(1)).max(1e3) }), object({
17238
+ deleted: array(string()).readonly(),
17239
+ kept: array(object({
17240
+ ref: string(),
17241
+ usage: KeychainSecretUsageSchema
17242
+ })).readonly()
17243
+ }), {
17244
+ kind: "mutation",
17245
+ auth: "admin",
17246
+ caller: "required"
17247
+ }),
17248
+ /**
17249
+ * Wrap the data key under the configured primary master key.
17250
+ *
17251
+ * Pending rotation (the keychain unlocked with a previous source): re-wrap
17252
+ * under the primary. Otherwise, with the default file as primary: generate
17253
+ * a new master key, write it there, re-wrap. A file or OS-keychain primary
17254
+ * that is already in use cannot be replaced from here — put the new key at
17255
+ * the source, keep the old one as `keychain.previousKeyFile`, restart, and
17256
+ * rotate. No value is re-encrypted either way; the previous wrap is kept
17257
+ * (retired) until purged.
17258
+ */
17259
+ rotateMasterKey: method(object({}), object({
17260
+ fingerprint: string(),
17261
+ keySource: KeychainKeySourceSchema
17262
+ }), {
17263
+ kind: "mutation",
17264
+ auth: "admin",
17265
+ caller: "required"
17266
+ }),
17267
+ purgeRetiredKeys: method(object({}), object({ purged: number().int() }), {
17268
+ kind: "mutation",
17269
+ auth: "admin",
17270
+ caller: "required"
17271
+ }),
17272
+ /** The master key, base64. Audited; marks the recovery copy as taken. */
17273
+ downloadRecoveryKey: method(object({}), object({
17274
+ key: string(),
17275
+ fingerprint: string(),
17276
+ keySource: KeychainKeySourceSchema
17277
+ }), {
17278
+ kind: "mutation",
17279
+ auth: "admin",
17280
+ caller: "required"
17281
+ }),
17282
+ /**
17283
+ * Lost-key recovery: archive every stored value into a
17284
+ * `keychain:secrets-orphaned-<ts>` table and start over with a new data
17285
+ * key. Every secret field then reads "not set". Requires the typed
17286
+ * confirmation {@link KEYCHAIN_RESET_CONFIRMATION}.
17287
+ */
17288
+ resetKeychain: method(object({ confirm: literal("RESET KEYCHAIN") }), object({
17289
+ archivedCollection: string().nullable(),
17290
+ archived: number().int()
17291
+ }), {
17292
+ kind: "mutation",
17293
+ auth: "admin",
17294
+ caller: "required"
17295
+ })
17296
+ }
17297
+ };
16320
17298
  var decoderCapability = {
16321
17299
  name: "decoder",
16322
17300
  scope: "system",
@@ -17672,7 +18650,11 @@ var DeviceRegisterPayloadSchema = object({
17672
18650
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
17673
18651
  var DevicePersistConfigPayloadSchema = object({
17674
18652
  deviceId: number(),
17675
- data: record(string(), unknown())
18653
+ data: record(string(), unknown()),
18654
+ /** The paths the device's schema declares secret (D783), when the caller
18655
+ * knows them — those values are kept in the keychain, not the blob (D787).
18656
+ * Absent: the paths the device last reported at `registerDevice` apply. */
18657
+ secretConfigPaths: array(string()).optional()
17676
18658
  });
17677
18659
  /** What a migration actually did, per switch. `unreachable` is a first-class
17678
18660
  * answer: a camera that could not be asked is not a camera that was silenced. */
@@ -26924,8 +27906,23 @@ var RetrainMacroClassSchema = _enum([
26924
27906
  ]);
26925
27907
  /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
26926
27908
  var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
26927
- /** Did a human draw this box, or did the assist propose it? */
26928
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
27909
+ /**
27910
+ * Where a box came from. A machine-sourced box is a DRAFT on the page until
27911
+ * the operator confirms it; once saved it keeps its source as provenance.
27912
+ *
27913
+ * - `operator` — drawn by hand.
27914
+ * - `assist` — proposed by a detector run on the copy (the camera's own
27915
+ * model, or a larger teacher model).
27916
+ * - `pipeline` — the box the live pipeline actually drew on that frame, read
27917
+ * back from the track store (never a re-run).
27918
+ * - `llm` — proposed by a vision-capable LLM profile.
27919
+ */
27920
+ var RetrainAnnotationSourceSchema = _enum([
27921
+ "operator",
27922
+ "assist",
27923
+ "pipeline",
27924
+ "llm"
27925
+ ]);
26929
27926
  /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
26930
27927
  var RetrainBboxSchema = object({
26931
27928
  x: number(),
@@ -26943,7 +27940,8 @@ var RetrainBboxSchema = object({
26943
27940
  */
26944
27941
  var RetrainAnnotationSchema = object({
26945
27942
  id: string(),
26946
- trackId: string(),
27943
+ /** The frame's track. Absent on a recording still, which has none. */
27944
+ trackId: string().optional(),
26947
27945
  deviceId: number(),
26948
27946
  /** The COPY in retrain storage — never the source track's media key. */
26949
27947
  mediaKey: string(),
@@ -26992,13 +27990,47 @@ var RetrainFrameCandidateSchema = object({
26992
27990
  * fail, whatever became of the original. */
26993
27991
  copied: boolean()
26994
27992
  });
27993
+ /**
27994
+ * One box the live pipeline drew on a copied frame — what a correction starts
27995
+ * from. Derived when the frame is listed, from the track store: the subject
27996
+ * box recorded on the source media row when there is one, else the track
27997
+ * position nearest the frame's capture time. Never stored as an annotation
27998
+ * until the operator confirms it.
27999
+ */
28000
+ var RetrainPipelineBoxSchema = object({
28001
+ /** Normalised `[0,1]` against the full frame. */
28002
+ bbox: RetrainBboxSchema,
28003
+ macroClass: RetrainMacroClassSchema,
28004
+ label: string().optional(),
28005
+ subLabel: string().optional(),
28006
+ /** The detection score of the position used, when it was recorded. */
28007
+ score: number().optional(),
28008
+ /** The root model that produced the track, when it was recorded. */
28009
+ modelId: string().optional(),
28010
+ trackId: string(),
28011
+ /** `subject-box`: recorded on this very frame. `position`: the track's
28012
+ * position nearest the capture time, `deltaMs` away. */
28013
+ basis: _enum(["subject-box", "position"]),
28014
+ deltaMs: number()
28015
+ });
28016
+ /**
28017
+ * Where a retrain frame came from: a TRACK's stored media (copy-on-select),
28018
+ * or the RECORDING at an instant — the frame a model saw nothing in has no
28019
+ * track at all.
28020
+ */
28021
+ var RetrainFrameOriginSchema = _enum(["track", "recording"]);
26995
28022
  /** A frame the dataset OWNS: bytes copied at selection time. */
26996
28023
  var RetrainFrameSchema = object({
26997
28024
  frameId: string(),
26998
28025
  deviceId: number(),
26999
- trackId: string(),
27000
- /** Provenance only. It may already point at nothing — that is expected. */
27001
- sourceMediaId: number().int(),
28026
+ origin: RetrainFrameOriginSchema,
28027
+ /** The track it was copied from. Absent on a recording still. */
28028
+ trackId: string().optional(),
28029
+ /** Provenance only. It may already point at nothing — that is expected.
28030
+ * Absent on a recording still. */
28031
+ sourceMediaId: number().int().optional(),
28032
+ /** A recording still: the playhead instant it was taken at. */
28033
+ epochMs: number().optional(),
27002
28034
  sourceKind: MediaFileKindEnum,
27003
28035
  sizeBytes: number().int(),
27004
28036
  width: number().int(),
@@ -27009,7 +28041,12 @@ var RetrainFrameSchema = object({
27009
28041
  /** The operator's "every subject in this frame is boxed". Detector
27010
28042
  * evaluation keeps only complete frames: an unboxed subject would count as
27011
28043
  * a false positive. */
27012
- complete: boolean()
28044
+ complete: boolean(),
28045
+ /** The boxes the pipeline drew on this frame. Present on list answers;
28046
+ * empty when nothing the track store holds can be placed on it. */
28047
+ pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
28048
+ /** The named collections this frame belongs to. Present on list answers. */
28049
+ collectionIds: array(string()).readonly().optional()
27013
28050
  });
27014
28051
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
27015
28052
  var RetrainCopyRefusalSchema = _enum([
@@ -27040,6 +28077,11 @@ var RetrainFrameListSchema = object({
27040
28077
  var RetrainExportFilterSchema = object({
27041
28078
  deviceIds: array(number()).optional(),
27042
28079
  frameIds: array(string()).max(2e4).optional(),
28080
+ /** Only frames in at least one of these named collections. */
28081
+ collectionIds: array(string()).max(200).optional(),
28082
+ /** Exactly the frames of this dataset version (and its completeOnly). An
28083
+ * unknown id selects nothing. */
28084
+ datasetVersionId: string().optional(),
27043
28085
  batchId: string().optional(),
27044
28086
  /** Only frames the operator marked complete (all subjects boxed). */
27045
28087
  completeOnly: boolean().optional()
@@ -27104,6 +28146,170 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
27104
28146
  reason: string(),
27105
28147
  detail: string().optional()
27106
28148
  })]);
28149
+ /** A named set over the retrain corpus — membership only, it owns no pixels. */
28150
+ var RetrainCollectionSchema = object({
28151
+ id: string(),
28152
+ name: string(),
28153
+ createdAt: number(),
28154
+ frameCount: number().int()
28155
+ });
28156
+ var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
28157
+ kind: literal("created"),
28158
+ collection: RetrainCollectionSchema
28159
+ }), object({
28160
+ kind: literal("refused"),
28161
+ reason: _enum(["empty-name", "duplicate-name"])
28162
+ })]);
28163
+ var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
28164
+ kind: literal("renamed"),
28165
+ collection: RetrainCollectionSchema
28166
+ }), object({
28167
+ kind: literal("refused"),
28168
+ reason: _enum([
28169
+ "empty-name",
28170
+ "duplicate-name",
28171
+ "unknown-collection"
28172
+ ])
28173
+ })]);
28174
+ /**
28175
+ * The outcome of adding the frame at a recording instant. Every refusal is
28176
+ * named: `still-unavailable` (not recording, a gap, or an undecodable frame —
28177
+ * `detail` says which), `still-busy` (the recorder is at its decode bound; try
28178
+ * again), `unreadable-image`, `write-failed`, `unknown-collection`.
28179
+ */
28180
+ var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
28181
+ kind: literal("added"),
28182
+ collectionId: string(),
28183
+ frame: RetrainFrameSchema,
28184
+ /** The moment was already in the dataset; nothing was decoded. */
28185
+ reused: boolean()
28186
+ }), object({
28187
+ kind: literal("refused"),
28188
+ reason: _enum([
28189
+ "unknown-collection",
28190
+ "still-unavailable",
28191
+ "still-busy",
28192
+ "unreadable-image",
28193
+ "write-failed"
28194
+ ]),
28195
+ detail: string().optional()
28196
+ })]);
28197
+ /** A vision LLM profile the AI assist may use, and where it sends the frame. */
28198
+ var RetrainAssistProfileSchema = object({
28199
+ id: string(),
28200
+ name: string(),
28201
+ model: string(),
28202
+ kind: string(),
28203
+ /** `true` when the frame would leave the house (a cloud vendor, or an
28204
+ * endpoint that is not on the local network). The page confirms each such
28205
+ * run, and the provider refuses one without `allowCloud`. */
28206
+ leavesHouse: boolean()
28207
+ });
28208
+ /** A box the AI assist proposed: a draft, plus the model's own reason. */
28209
+ var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
28210
+ /** What the AI assist said about a box that was already on the canvas. */
28211
+ var RetrainLlmReviewSchema = object({
28212
+ /** The `ref` the page sent the box under. */
28213
+ ref: string(),
28214
+ verdict: _enum([
28215
+ "confirmed",
28216
+ "wrong-class",
28217
+ "not-an-object",
28218
+ "uncertain"
28219
+ ]),
28220
+ suggestedClass: RetrainMacroClassSchema.optional(),
28221
+ reason: string()
28222
+ });
28223
+ /**
28224
+ * The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
28225
+ * model and its confidence) and reviews; items the model got wrong (a box off
28226
+ * the frame, an unasked class, an unknown ref) are dropped and counted in
28227
+ * `rejected`. A whole answer that is not the schema is `malformed-answer`.
28228
+ */
28229
+ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
28230
+ kind: literal("proposed"),
28231
+ profileId: string(),
28232
+ model: string(),
28233
+ /** The frame was sent outside the house for this answer. */
28234
+ leftHouse: boolean(),
28235
+ proposals: array(RetrainLlmProposalSchema).readonly(),
28236
+ reviews: array(RetrainLlmReviewSchema).readonly(),
28237
+ rejected: number().int()
28238
+ }), object({
28239
+ kind: literal("refused"),
28240
+ reason: _enum([
28241
+ "unknown-frame",
28242
+ "unreadable-frame",
28243
+ "unknown-profile",
28244
+ "profile-disabled",
28245
+ "no-vision",
28246
+ "cloud-not-confirmed",
28247
+ "llm-error",
28248
+ "malformed-answer"
28249
+ ]),
28250
+ detail: string().optional()
28251
+ })]);
28252
+ /** What a dataset version is cut from. Every field narrows. */
28253
+ var RetrainDatasetSelectionSchema = object({
28254
+ deviceIds: array(number()).readonly().optional(),
28255
+ collectionIds: array(string()).max(200).readonly().optional(),
28256
+ frameIds: array(string()).max(2e4).readonly().optional()
28257
+ });
28258
+ /** The counts a dataset is judged by. */
28259
+ var RetrainDatasetStatsSchema = object({
28260
+ frames: number().int(),
28261
+ completeFrames: number().int(),
28262
+ /** `completeFrames / frames`, 0..1. */
28263
+ completeness: number(),
28264
+ /** Boxes to learn (model errors excluded). */
28265
+ subjects: number().int(),
28266
+ modelErrors: number().int(),
28267
+ /** Complete frames with no subject. */
28268
+ hardNegatives: number().int(),
28269
+ /** Subjects per class × camera × day/night. */
28270
+ cells: array(object({
28271
+ macroClass: string(),
28272
+ deviceId: number(),
28273
+ lighting: _enum([
28274
+ "day",
28275
+ "night",
28276
+ "unknown"
28277
+ ]),
28278
+ subjects: number().int(),
28279
+ frames: number().int()
28280
+ })).readonly(),
28281
+ cameras: array(object({
28282
+ deviceId: number(),
28283
+ frames: number().int(),
28284
+ completeFrames: number().int()
28285
+ })).readonly()
28286
+ });
28287
+ /** An immutable dataset version, without its frame list. */
28288
+ var RetrainDatasetVersionSchema = object({
28289
+ id: string(),
28290
+ name: string(),
28291
+ createdAt: number(),
28292
+ selection: RetrainDatasetSelectionSchema,
28293
+ layout: RetrainExportLayoutSchema,
28294
+ completeOnly: boolean(),
28295
+ frameCount: number().int(),
28296
+ /** sha256 of what the frames taught when the version was frozen. */
28297
+ annotationHash: string(),
28298
+ /** The export manifest schema the version was cut under. */
28299
+ manifestSchema: string(),
28300
+ stats: RetrainDatasetStatsSchema
28301
+ });
28302
+ var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
28303
+ kind: literal("created"),
28304
+ version: RetrainDatasetVersionSchema
28305
+ }), object({
28306
+ kind: literal("refused"),
28307
+ reason: _enum([
28308
+ "empty-name",
28309
+ "duplicate-name",
28310
+ "no-frames"
28311
+ ])
28312
+ })]);
27107
28313
  /** The outcome of a lifecycle move owned by the retrain page. */
27108
28314
  var RetrainTransitionResultSchema = object({
27109
28315
  trackId: string(),
@@ -28320,7 +29526,7 @@ var pipelineAnalyticsCapability = {
28320
29526
  * a frame leaves the dataset before export. */
28321
29527
  deselectRetrainFrame: method(object({
28322
29528
  deviceId: number(),
28323
- trackId: string(),
29529
+ trackId: string().optional(),
28324
29530
  frameId: string()
28325
29531
  }), object({
28326
29532
  removed: boolean(),
@@ -28363,7 +29569,8 @@ var pipelineAnalyticsCapability = {
28363
29569
  */
28364
29570
  proposeRetrainAnnotations: method(object({
28365
29571
  deviceId: number(),
28366
- trackId: string(),
29572
+ /** The frame's track, when it has one — checked against the frame. */
29573
+ trackId: string().optional(),
28367
29574
  frameId: string(),
28368
29575
  subject: RetrainAssistSubjectSchema,
28369
29576
  /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
@@ -28372,8 +29579,12 @@ var pipelineAnalyticsCapability = {
28372
29579
  kind: "mutation",
28373
29580
  auth: "admin"
28374
29581
  }),
28375
- /** Every annotation on a track, oldest first. */
28376
- listRetrainAnnotations: method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
29582
+ /** Every annotation on a track, or on named frames (a recording still has
29583
+ * no track), oldest first. One of the two is required. */
29584
+ listRetrainAnnotations: method(object({
29585
+ trackId: string().optional(),
29586
+ frameIds: array(string()).max(2e3).optional()
29587
+ }), array(RetrainAnnotationSchema).readonly(), {
28377
29588
  kind: "query",
28378
29589
  auth: "admin"
28379
29590
  }),
@@ -28392,7 +29603,8 @@ var pipelineAnalyticsCapability = {
28392
29603
  */
28393
29604
  saveRetrainAnnotations: method(object({
28394
29605
  deviceId: number(),
28395
- trackId: string(),
29606
+ /** The frame's track, when it has one — checked against the frame. */
29607
+ trackId: string().optional(),
28396
29608
  frameId: string(),
28397
29609
  annotations: array(RetrainAnnotationDraftSchema)
28398
29610
  }), array(RetrainAnnotationSchema).readonly(), {
@@ -28455,7 +29667,7 @@ var pipelineAnalyticsCapability = {
28455
29667
  */
28456
29668
  setRetrainFrameComplete: method(object({
28457
29669
  deviceId: number(),
28458
- trackId: string(),
29670
+ trackId: string().optional(),
28459
29671
  frameId: string(),
28460
29672
  complete: boolean()
28461
29673
  }), RetrainFrameSchema, {
@@ -28478,6 +29690,162 @@ var pipelineAnalyticsCapability = {
28478
29690
  auth: "admin",
28479
29691
  timeoutMs: 60 * 6e4
28480
29692
  }),
29693
+ /** The counts a selection would freeze — class × camera × day/night,
29694
+ * completeness — without freezing anything. Index reads only. */
29695
+ previewRetrainDataset: method(object({
29696
+ selection: RetrainDatasetSelectionSchema,
29697
+ completeOnly: boolean().optional()
29698
+ }), RetrainDatasetStatsSchema, {
29699
+ kind: "query",
29700
+ auth: "admin"
29701
+ }),
29702
+ /**
29703
+ * Freeze a dataset version: the frames the selection yields (the same plan
29704
+ * the annotated export builds), the hash of what they teach, the export
29705
+ * parameters and the counts. Immutable — a different selection is a new
29706
+ * version. Export it with `getRetrainExportUrl({ datasetVersionId })`.
29707
+ */
29708
+ createRetrainDatasetVersion: method(object({
29709
+ name: string().max(120),
29710
+ selection: RetrainDatasetSelectionSchema,
29711
+ layout: RetrainExportLayoutSchema,
29712
+ completeOnly: boolean()
29713
+ }), CreateRetrainDatasetVersionResultSchema, {
29714
+ kind: "mutation",
29715
+ auth: "admin",
29716
+ timeoutMs: 12e4
29717
+ }),
29718
+ /** Every dataset version, newest first. */
29719
+ listRetrainDatasetVersions: method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
29720
+ kind: "query",
29721
+ auth: "admin"
29722
+ }),
29723
+ /** Delete a version. Its frames stay in the dataset. */
29724
+ deleteRetrainDatasetVersion: method(object({ id: string() }), object({ deleted: boolean() }), {
29725
+ kind: "mutation",
29726
+ auth: "admin"
29727
+ }),
29728
+ /** Does the corpus still teach what the version froze? `missingFrames`
29729
+ * counts frames that left the dataset (or lost every box and tick). */
29730
+ verifyRetrainDatasetVersion: method(object({ id: string() }), object({
29731
+ found: boolean(),
29732
+ annotationHash: string(),
29733
+ matches: boolean(),
29734
+ missingFrames: number().int()
29735
+ }), {
29736
+ kind: "query",
29737
+ auth: "admin",
29738
+ timeoutMs: 12e4
29739
+ }),
29740
+ /** The enabled, vision-capable LLM profiles, each saying whether a frame
29741
+ * sent to it leaves the house. */
29742
+ listRetrainAssistProfiles: method(object({}), array(RetrainAssistProfileSchema).readonly(), {
29743
+ kind: "query",
29744
+ auth: "admin"
29745
+ }),
29746
+ /**
29747
+ * Ask a vision LLM (the `llm` capability) about ONE copied frame: list the
29748
+ * objects of `classes` with boxes, and review the boxes already on the
29749
+ * canvas (sent by `ref`). Answers drafts (`source: 'llm'`) and reviews —
29750
+ * nothing is stored, nothing is accepted. A profile that sends the frame
29751
+ * outside the house is refused unless `allowCloud` says the operator
29752
+ * confirmed this run.
29753
+ */
29754
+ proposeRetrainAnnotationsWithLlm: method(object({
29755
+ deviceId: number(),
29756
+ trackId: string().optional(),
29757
+ frameId: string(),
29758
+ profileId: string(),
29759
+ classes: array(RetrainMacroClassSchema).min(1),
29760
+ boxes: array(object({
29761
+ ref: string(),
29762
+ bbox: RetrainBboxSchema,
29763
+ macroClass: RetrainMacroClassSchema,
29764
+ label: string().optional()
29765
+ })).max(50),
29766
+ allowCloud: boolean()
29767
+ }), RetrainLlmAssistResultSchema, {
29768
+ kind: "mutation",
29769
+ auth: "admin",
29770
+ timeoutMs: 18e4
29771
+ }),
29772
+ /**
29773
+ * Create a named collection — a set over the retrain corpus ("packages
29774
+ * porch night"). Names are unique case-insensitively and never empty;
29775
+ * both refusals are named.
29776
+ */
29777
+ createRetrainCollection: method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
29778
+ kind: "mutation",
29779
+ auth: "admin"
29780
+ }),
29781
+ /** Every collection, newest first, with its frame count. */
29782
+ listRetrainCollections: method(object({}), array(RetrainCollectionSchema).readonly(), {
29783
+ kind: "query",
29784
+ auth: "admin"
29785
+ }),
29786
+ renameRetrainCollection: method(object({
29787
+ id: string(),
29788
+ name: string().max(120)
29789
+ }), RetrainCollectionRenameResultSchema, {
29790
+ kind: "mutation",
29791
+ auth: "admin"
29792
+ }),
29793
+ /**
29794
+ * Delete a collection. Its recording stills that no other collection
29795
+ * holds are deleted with their annotations (nothing else reaches them);
29796
+ * frames copied from tracks always stay in the dataset.
29797
+ */
29798
+ deleteRetrainCollection: method(object({ id: string() }), object({
29799
+ deleted: boolean(),
29800
+ removedFrames: number().int()
29801
+ }), {
29802
+ kind: "mutation",
29803
+ auth: "admin"
29804
+ }),
29805
+ /**
29806
+ * Add the frame at a recording instant to a collection — the frame the
29807
+ * model may have seen NOTHING in. The recorder re-decodes the native
29808
+ * frame at `epochMs`; the dataset copies it (trackless, durable). The same
29809
+ * moment twice is one copy. Every refusal is named.
29810
+ */
29811
+ addRetrainFrameFromRecording: method(object({
29812
+ collectionId: string(),
29813
+ deviceId: number(),
29814
+ epochMs: number()
29815
+ }), AddRetrainFrameFromRecordingResultSchema, {
29816
+ kind: "mutation",
29817
+ auth: "admin",
29818
+ timeoutMs: 6e4
29819
+ }),
29820
+ /** Add frames already in the dataset to a collection. */
29821
+ addRetrainFramesToCollection: method(object({
29822
+ collectionId: string(),
29823
+ frameIds: array(string()).min(1).max(500)
29824
+ }), object({
29825
+ added: number().int(),
29826
+ alreadyMember: number().int(),
29827
+ unknownFrameIds: array(string()).readonly()
29828
+ }), {
29829
+ kind: "mutation",
29830
+ auth: "admin"
29831
+ }),
29832
+ /** Remove a frame from a collection. A recording still left in no
29833
+ * collection is deleted with its annotations (`deletedFrame`). */
29834
+ removeRetrainFrameFromCollection: method(object({
29835
+ collectionId: string(),
29836
+ frameId: string()
29837
+ }), object({
29838
+ removed: boolean(),
29839
+ deletedFrame: boolean()
29840
+ }), {
29841
+ kind: "mutation",
29842
+ auth: "admin"
29843
+ }),
29844
+ /** The frames of a collection, with their pipeline boxes. */
29845
+ listRetrainCollectionFrames: method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
29846
+ kind: "query",
29847
+ auth: "admin"
29848
+ }),
28481
29849
  /**
28482
29850
  * The media an EVENT owns.
28483
29851
  *
@@ -29417,13 +30785,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
29417
30785
  object({
29418
30786
  kind: literal("no-family-build"),
29419
30787
  format: ModelFormatSchema$1
30788
+ }),
30789
+ object({
30790
+ kind: literal("kept-custom-pin"),
30791
+ modelId: string(),
30792
+ deviceKey: string()
29420
30793
  })
29421
30794
  ]);
30795
+ /** Why a device is left exactly as it is, whatever the plan would pick (D786). */
30796
+ var KeptReasonSchema = _enum(["custom-pin"]);
30797
+ /**
30798
+ * Where a choice's latency came from (D791): this node's own benchmark
30799
+ * result, or the hardware-class table. Measured on the node beats the table.
30800
+ */
30801
+ var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
30802
+ kind: literal("node-benchmark"),
30803
+ resultId: string(),
30804
+ measuredAtMs: number()
30805
+ })]);
29422
30806
  var DeviceModelChoiceSchema = object({
29423
30807
  modelId: string(),
29424
30808
  p50Ms: number(),
29425
30809
  fps: number(),
29426
30810
  measured: boolean(),
30811
+ /** Absent on a plan from before D791 — read as the table. */
30812
+ source: LatencySourceSchema.optional(),
29427
30813
  /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
29428
30814
  capacitySessions: number(),
29429
30815
  personRecall: number()
@@ -29434,6 +30820,8 @@ var DeviceRecommendationSchema = object({
29434
30820
  enabled: boolean(),
29435
30821
  available: boolean(),
29436
30822
  chosen: DeviceModelChoiceSchema.nullable(),
30823
+ /** Present when the device is kept as is: Apply writes nothing on it. */
30824
+ kept: KeptReasonSchema.optional(),
29437
30825
  reasons: array(RecommendationReasonSchema).readonly()
29438
30826
  });
29439
30827
  var NodeRecommendationSchema = object({
@@ -29487,6 +30875,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
29487
30875
  kind: literal("coral-enabled"),
29488
30876
  nodeId: string(),
29489
30877
  deviceKey: string()
30878
+ }),
30879
+ object({
30880
+ kind: literal("custom-pin-kept"),
30881
+ nodeId: string(),
30882
+ deviceKey: string().nullable(),
30883
+ deviceId: number().nullable(),
30884
+ modelId: string()
30885
+ }),
30886
+ object({
30887
+ kind: literal("custom-registry-unreadable"),
30888
+ error: string()
29490
30889
  })
29491
30890
  ]);
29492
30891
  var AutoTuneOptionsSchema = object({
@@ -29665,13 +31064,14 @@ var SuggestSharesResultSchema = object({
29665
31064
  nodes: array(SuggestedNodeShareSchema).readonly()
29666
31065
  });
29667
31066
  /**
29668
- * Where the node and device shares come from (D750, D755).
29669
- * - `hardware` (default) — computed by the system from each node's static
29670
- * capacity (its accelerators at their Auto tune models, from the measured
29671
- * latency table), recomputed whenever a node or device joins, leaves, is
29672
- * switched on or off, or changes model. No load input.
29673
- * - `benchmark` — the same, from each node's measured capacity (node
29674
- * benchmark results); a node without results falls back to `hardware`.
31067
+ * Where the node and device shares come from (D750, D755, D791).
31068
+ * - `benchmark` (default since D791) — each node's capacity as its own node
31069
+ * benchmark measured it; a node without fresh results is sized from
31070
+ * `hardware` and says so. Measured on the node beats the table.
31071
+ * - `hardware` — computed from each node's static capacity only (its
31072
+ * accelerators at their Auto tune models, from the latency table).
31073
+ * Both are recomputed whenever a node or device joins, leaves, is switched
31074
+ * on or off, changes model, or a benchmark result is written. No load input.
29675
31075
  * - `manual` — the operator's stored sliders.
29676
31076
  * Either way a node or device that cannot take sessions gives its share to
29677
31077
  * the others in proportion; the stored values are never rewritten for that.
@@ -29720,6 +31120,362 @@ var EffectiveSharesSchema = object({
29720
31120
  nodeWeights: record(string(), number()),
29721
31121
  deviceWeights: record(string(), record(string(), number()))
29722
31122
  });
31123
+ /**
31124
+ * Wire shapes of the node benchmark (D791): the operator's plan, the
31125
+ * preflight the confirmation shows, the run the orchestrator owns, what the
31126
+ * measuring runner reports, and the result rows Auto tune and the automatic
31127
+ * shares read.
31128
+ *
31129
+ * ONE node at a time, owned by the pipeline orchestrator. While a run is
31130
+ * active the cluster is in BENCHMARK MODE for that node: it is not a
31131
+ * detection candidate, camera pins naming it are ignored so its sessions move
31132
+ * elsewhere, and both come back when the mode ends — after a crash or a hub
31133
+ * restart too (a persisted manifest, reconciled against the registry).
31134
+ *
31135
+ * Two measurements, both on the node, driven by its own runner (frames never
31136
+ * cross a process at frame rate, D9):
31137
+ * - `device` — one accelerator × one candidate detector, root only, open
31138
+ * loop: how many streams at the camera rate it carries inside the frame
31139
+ * interval;
31140
+ * - `pipeline` — the chosen detector plus the operator's detail steps
31141
+ * (faces, plates, classifiers, CLIP…), on varied frames from the bench
31142
+ * clip: how many parallel sessions the node carries before latency, drops,
31143
+ * CPU, RAM or the event loop give out.
31144
+ */
31145
+ /** Defaults and bounds, one place. */
31146
+ var NODE_BENCHMARK_DEFAULTS = {
31147
+ fpsPerStream: 10,
31148
+ budgetMinutes: 45,
31149
+ minBudgetMinutes: 10,
31150
+ maxBudgetMinutes: 120,
31151
+ /** A result older than this no longer beats the table. */
31152
+ staleAfterDays: 30,
31153
+ /** Warm-in per ramp step (not accounted). */
31154
+ settleSec: 5,
31155
+ /** Accounted window per ramp step. */
31156
+ measureSec: 20,
31157
+ /** Longest the drain may take before the run is refused. */
31158
+ drainTimeoutSec: 120,
31159
+ /** Candidate models per device in one run. */
31160
+ maxModelsPerDevice: 6
31161
+ };
31162
+ /** The two measurements a run can make. */
31163
+ var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
31164
+ var NodeBenchmarkDevicePlanSchema = object({
31165
+ /** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
31166
+ deviceKey: string().min(1),
31167
+ /**
31168
+ * Root detector candidates for the `device` measurement, in the order
31169
+ * measured. The FIRST is the one the `pipeline` measurement runs.
31170
+ */
31171
+ modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
31172
+ });
31173
+ /** What the operator confirmed. */
31174
+ var NodeBenchmarkPlanSchema = object({
31175
+ nodeId: string().min(1),
31176
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
31177
+ /** Which measurements run. At least one. */
31178
+ phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
31179
+ /**
31180
+ * Detail steps (catalog step ids under the root: faces, plates,
31181
+ * classifiers, CLIP…) the `pipeline` measurement enables. The root
31182
+ * detector always runs.
31183
+ */
31184
+ steps: array(string().min(1)).default([]),
31185
+ /** Offered rate of one stream / session. */
31186
+ fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
31187
+ /** Hard deadline: the mode ends and the cluster is restored when it passes. */
31188
+ budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
31189
+ /** Keep the models the run downloaded (default: delete what was not installed before). */
31190
+ keepDownloadedModels: boolean().default(false),
31191
+ /** Start although the other nodes' capacity does not cover the sessions running now. */
31192
+ acceptInsufficientHeadroom: boolean().default(false)
31193
+ });
31194
+ var NodeBenchmarkRefusalSchema = object({
31195
+ kind: _enum([
31196
+ "benchmark-active",
31197
+ "node-offline",
31198
+ "unknown-device",
31199
+ "no-phase",
31200
+ "insufficient-headroom"
31201
+ ]),
31202
+ detail: string(),
31203
+ overridable: boolean()
31204
+ });
31205
+ /** A camera whose detection leaves the node for the run. */
31206
+ var NodeBenchmarkMovingCameraSchema = object({
31207
+ deviceId: number(),
31208
+ /** Placed on the node now (a standing attach or a running session). */
31209
+ placedOnNode: boolean(),
31210
+ /** A node pin naming this node, ignored for the run. */
31211
+ pinnedToNode: boolean()
31212
+ });
31213
+ /** A camera that cannot leave: no other node can obtain its frames. */
31214
+ var NodeBenchmarkStayingCameraSchema = object({
31215
+ deviceId: number(),
31216
+ reason: literal("only-frame-source")
31217
+ });
31218
+ var NodeBenchmarkPreflightSchema = object({
31219
+ nodeId: string(),
31220
+ online: boolean(),
31221
+ moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
31222
+ /** Keep running on the node during the run; the result is flagged contaminated. */
31223
+ staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
31224
+ estimatedDurationMs: number(),
31225
+ /** The run ends and the cluster is restored at the latest after this long. */
31226
+ budgetMs: number(),
31227
+ phases: array(NodeBenchmarkPhaseSchema).readonly(),
31228
+ steps: array(string()).readonly(),
31229
+ devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
31230
+ /** Parallel sessions the cluster runs now, and what the other nodes can carry. */
31231
+ headroom: object({
31232
+ sessionsNow: number(),
31233
+ otherNodesCapacitySessions: number().nullable()
31234
+ }),
31235
+ refusals: array(NodeBenchmarkRefusalSchema).readonly(),
31236
+ canStart: boolean()
31237
+ });
31238
+ /** Where the measuring runner is. */
31239
+ var NodeBenchProgressSchema = object({
31240
+ phase: _enum([
31241
+ "preparing",
31242
+ "device",
31243
+ "pipeline",
31244
+ "cleanup"
31245
+ ]),
31246
+ deviceKey: string().nullable(),
31247
+ modelId: string().nullable(),
31248
+ /** Streams (device) or sessions (pipeline) of the step running now. */
31249
+ load: number().nullable(),
31250
+ cellsDone: number(),
31251
+ cellsTotal: number(),
31252
+ message: string()
31253
+ });
31254
+ /** What limited a ramp. `none` = the ramp ran out of steps still passing. */
31255
+ var NodeBenchLimitSchema = _enum([
31256
+ "p95",
31257
+ "drops",
31258
+ "errors",
31259
+ "stall",
31260
+ "cpu",
31261
+ "ram",
31262
+ "none"
31263
+ ]);
31264
+ var NodeBenchRampStepSchema = object({
31265
+ load: number(),
31266
+ pass: boolean(),
31267
+ p95Ms: number(),
31268
+ dropRatio: number(),
31269
+ /** Completed frames per second over the accounted window. */
31270
+ fps: number(),
31271
+ cpuPct: number().nullable(),
31272
+ ramFreePct: number().nullable(),
31273
+ failReasons: array(string()).readonly()
31274
+ });
31275
+ var NodeBenchCellSchema = discriminatedUnion("phase", [object({
31276
+ phase: literal("device"),
31277
+ deviceKey: string(),
31278
+ modelId: string(),
31279
+ /** Single-stream latency (the K = 1 step). */
31280
+ p50Ms: number(),
31281
+ p95Ms: number(),
31282
+ p99Ms: number(),
31283
+ /** Frames per second sustained at the last passing step. */
31284
+ fps: number(),
31285
+ /** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
31286
+ kMax: number(),
31287
+ limitedBy: NodeBenchLimitSchema,
31288
+ /** First call (model load + warm-up). */
31289
+ warmupMs: number(),
31290
+ ramp: array(NodeBenchRampStepSchema).readonly()
31291
+ }), object({
31292
+ phase: literal("pipeline"),
31293
+ deviceKey: string(),
31294
+ modelId: string(),
31295
+ steps: array(string()).readonly(),
31296
+ /** Parallel sessions at the camera rate the node carried; 0 = not even one. */
31297
+ maxSessions: number(),
31298
+ limitedBy: NodeBenchLimitSchema,
31299
+ /** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
31300
+ stepsFired: array(string()).readonly(),
31301
+ warmupMs: number(),
31302
+ ramp: array(NodeBenchRampStepSchema).readonly()
31303
+ })]);
31304
+ /**
31305
+ * What a result was measured ON. A result whose fingerprint no longer matches
31306
+ * the node no longer beats the table.
31307
+ */
31308
+ var NodeBenchFingerprintSchema = object({
31309
+ pipelineVersion: string().nullable(),
31310
+ cpuModel: string().nullable(),
31311
+ ramGb: number().nullable(),
31312
+ os: string().nullable(),
31313
+ /** Per device: the pool the cells ran on (runtime + tuning). */
31314
+ pools: record(string(), object({
31315
+ runtime: string(),
31316
+ numWorkers: number(),
31317
+ concurrency: number(),
31318
+ batchMode: string()
31319
+ })).default({})
31320
+ });
31321
+ /** The frames the run used. */
31322
+ var NodeBenchClipSchema = object({
31323
+ /** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
31324
+ id: string(),
31325
+ revision: string().nullable(),
31326
+ frames: number(),
31327
+ width: number(),
31328
+ height: number()
31329
+ });
31330
+ var NodeBenchRunnerInputSchema = object({
31331
+ runId: string().min(1),
31332
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
31333
+ phases: array(NodeBenchmarkPhaseSchema).min(1),
31334
+ /** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
31335
+ steps: array(string()).default([]),
31336
+ fpsPerStream: number().int().min(1).max(30),
31337
+ /** The runner stops on its own past this instant, whatever the hub does. */
31338
+ deadlineAtMs: number(),
31339
+ settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
31340
+ measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
31341
+ keepDownloadedModels: boolean().default(false)
31342
+ });
31343
+ var NodeBenchRunnerStateSchema = _enum([
31344
+ "running",
31345
+ "done",
31346
+ "failed",
31347
+ "aborted"
31348
+ ]);
31349
+ var NodeBenchRunnerStatusSchema = object({
31350
+ runId: string(),
31351
+ nodeId: string(),
31352
+ state: NodeBenchRunnerStateSchema,
31353
+ progress: NodeBenchProgressSchema.nullable(),
31354
+ /** Every finished cell so far — a run stopped half way keeps what it measured. */
31355
+ cells: array(NodeBenchCellSchema).readonly(),
31356
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
31357
+ clip: NodeBenchClipSchema.nullable(),
31358
+ /** Cameras seen running on the node during the run (they share its pools). */
31359
+ activeCameraIds: array(number()).readonly(),
31360
+ /** Models the run downloaded and then deleted (not installed before). */
31361
+ deletedModels: array(string()).readonly(),
31362
+ error: string().nullable(),
31363
+ startedAtMs: number(),
31364
+ finishedAtMs: number().nullable()
31365
+ });
31366
+ var NodeBenchmarkStateSchema = _enum([
31367
+ "draining",
31368
+ "measuring",
31369
+ "restoring",
31370
+ "done",
31371
+ "failed",
31372
+ "aborted"
31373
+ ]);
31374
+ /** Why a run ended. */
31375
+ var NodeBenchmarkEndReasonSchema = _enum([
31376
+ "completed",
31377
+ "operator-abort",
31378
+ "deadline",
31379
+ "node-lost",
31380
+ "runner-lost",
31381
+ "hub-restart",
31382
+ "drain-timeout",
31383
+ "failed"
31384
+ ]);
31385
+ var NodeBenchmarkRunSchema = object({
31386
+ runId: string(),
31387
+ nodeId: string(),
31388
+ state: NodeBenchmarkStateSchema,
31389
+ plan: NodeBenchmarkPlanSchema,
31390
+ startedAtMs: number(),
31391
+ deadlineAtMs: number(),
31392
+ finishedAtMs: number().nullable(),
31393
+ endReason: NodeBenchmarkEndReasonSchema.nullable(),
31394
+ error: string().nullable(),
31395
+ /** Cameras moved off the node for the run. */
31396
+ moved: array(number()).readonly(),
31397
+ /** Cameras that stayed (their only frame source is the node). */
31398
+ staying: array(number()).readonly(),
31399
+ /** Something else ran on the node's pools during the run. */
31400
+ contaminated: boolean(),
31401
+ progress: NodeBenchProgressSchema.nullable(),
31402
+ resultIds: array(string()).readonly()
31403
+ });
31404
+ /** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
31405
+ var NodeBenchmarkStatusSchema = object({
31406
+ /** The node the cluster is in benchmark mode for; null = none. */
31407
+ modeNodeId: string().nullable(),
31408
+ run: NodeBenchmarkRunSchema.nullable()
31409
+ });
31410
+ /**
31411
+ * One stored measurement — the only authority Auto tune and the automatic
31412
+ * shares read measured capacity from. Written by the orchestrator when a run
31413
+ * ends, never by anyone else.
31414
+ */
31415
+ var NodeBenchmarkResultSchema = object({
31416
+ id: string(),
31417
+ runId: string(),
31418
+ nodeId: string(),
31419
+ cell: NodeBenchCellSchema,
31420
+ fpsPerStream: number(),
31421
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
31422
+ clip: NodeBenchClipSchema.nullable(),
31423
+ /** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
31424
+ contaminated: boolean(),
31425
+ stayingCameras: array(number()).readonly(),
31426
+ /** The run ended early; the cell itself completed. */
31427
+ partialRun: boolean(),
31428
+ measuredAtMs: number()
31429
+ });
31430
+ var ListNodeBenchmarkResultsInputSchema = object({
31431
+ nodeId: string().optional(),
31432
+ deviceKey: string().optional()
31433
+ });
31434
+ /** A result with its standing today: does it still beat the table? */
31435
+ var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
31436
+ /** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
31437
+ standing: _enum([
31438
+ "fresh",
31439
+ "stale",
31440
+ "superseded"
31441
+ ]),
31442
+ staleWhy: _enum([
31443
+ "age",
31444
+ "runtime",
31445
+ "pool-tuning"
31446
+ ]).nullable()
31447
+ });
31448
+ object({
31449
+ runId: string(),
31450
+ nodeId: string(),
31451
+ startedAtMs: number(),
31452
+ deadlineAtMs: number(),
31453
+ plan: NodeBenchmarkPlanSchema,
31454
+ moved: array(number()).readonly(),
31455
+ staying: array(number()).readonly()
31456
+ });
31457
+ /** Candidate detectors per device, for the plan editor. */
31458
+ var NodeBenchmarkCandidatesSchema = object({
31459
+ nodeId: string(),
31460
+ reachable: boolean(),
31461
+ devices: array(object({
31462
+ deviceKey: string(),
31463
+ enabled: boolean(),
31464
+ available: boolean(),
31465
+ /** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
31466
+ suggested: array(string()).readonly(),
31467
+ /** Every root detector the device has a build for. */
31468
+ all: array(string()).readonly(),
31469
+ /** The model the device runs now, when pinned. */
31470
+ currentModelId: string().nullable()
31471
+ })).readonly(),
31472
+ /** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
31473
+ steps: array(object({
31474
+ id: string(),
31475
+ name: string(),
31476
+ slot: string()
31477
+ })).readonly()
31478
+ });
29723
31479
  object({
29724
31480
  activeCameras: number(),
29725
31481
  throttledCameras: number(),
@@ -31038,7 +32794,30 @@ var pipelineRunnerCapability = {
31038
32794
  releaseParkedTrackFrames: method(object({
31039
32795
  deviceId: number(),
31040
32796
  trackId: string()
31041
- }), object({ released: number().int().nonnegative() }), { kind: "mutation" })
32797
+ }), object({ released: number().int().nonnegative() }), { kind: "mutation" }),
32798
+ /**
32799
+ * Start measuring THIS node for the orchestrator's node benchmark: the
32800
+ * bench clip decoded once into RAM, each device × candidate detector on an
32801
+ * open-loop ramp (`device`), then the chosen pipeline with the requested
32802
+ * detail steps (`pipeline`). Everything runs in-process with the executor
32803
+ * — no frame crosses a node (D9) — and writes nothing: no track, event,
32804
+ * media or notification. Reached by `nodePin(nodeId)`. Answers at once;
32805
+ * one run per node; the run stops itself at `deadlineAtMs`.
32806
+ */
32807
+ startNodeBench: method(NodeBenchRunnerInputSchema, object({
32808
+ accepted: literal(true),
32809
+ runId: string()
32810
+ }), {
32811
+ kind: "mutation",
32812
+ auth: "admin"
32813
+ }),
32814
+ /** The run's progress and every finished cell; null when this runner does not know `runId`. */
32815
+ getNodeBenchStatus: method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }),
32816
+ /** Stop the run; what it finished is kept. */
32817
+ abortNodeBench: method(object({ runId: string() }), object({ aborted: boolean() }), {
32818
+ kind: "mutation",
32819
+ auth: "admin"
32820
+ })
31042
32821
  }
31043
32822
  };
31044
32823
  var CameraPipelineConfigSchema = object({
@@ -31966,6 +33745,51 @@ var pipelineOrchestratorCapability = {
31966
33745
  kind: "mutation",
31967
33746
  auth: "admin"
31968
33747
  }),
33748
+ /**
33749
+ * Node benchmark — what a run of this plan would do, without doing it:
33750
+ * the cameras that leave the node, those that cannot (the node is their
33751
+ * only frame source; they stay and flag the run), the estimated duration
33752
+ * and every reason it may not start. The confirmation shows this.
33753
+ */
33754
+ getNodeBenchmarkPreflight: method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }),
33755
+ /**
33756
+ * Node benchmark — start ONE run (cluster-wide lock). The orchestrator
33757
+ * persists a restore manifest, enters benchmark mode for the node (out of
33758
+ * placement, its camera pins ignored, nothing rewritten), drains it, drives
33759
+ * the node's own runner, then restores — always, including after an
33760
+ * abort, a lost node or a hub restart. Answers at once; poll
33761
+ * `getNodeBenchmarkStatus`. Refused runs carry the preflight.
33762
+ */
33763
+ startNodeBenchmark: method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
33764
+ kind: literal("started"),
33765
+ runId: string()
33766
+ }), object({
33767
+ kind: literal("refused"),
33768
+ preflight: NodeBenchmarkPreflightSchema
33769
+ })]), {
33770
+ kind: "mutation",
33771
+ auth: "admin"
33772
+ }),
33773
+ /** Node benchmark — the active run (or the last one) and the node in benchmark mode. */
33774
+ getNodeBenchmarkStatus: method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }),
33775
+ /** Node benchmark — stop the active run; the cluster is restored as it was. */
33776
+ abortNodeBenchmark: method(object({ runId: string() }), object({ aborted: boolean() }), {
33777
+ kind: "mutation",
33778
+ auth: "admin"
33779
+ }),
33780
+ /**
33781
+ * Node benchmark — root detector candidates per device (what Auto tune
33782
+ * would pick first, then the family) and the detail steps the node's
33783
+ * catalog offers, for the plan editor.
33784
+ */
33785
+ getNodeBenchmarkCandidates: method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }),
33786
+ /** Node benchmark — stored results, newest first, each with its standing today. */
33787
+ listNodeBenchmarkResults: method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }),
33788
+ /** Node benchmark — delete one result; Auto tune and the shares stop reading it. */
33789
+ deleteNodeBenchmarkResult: method(object({ id: string() }), object({ deleted: boolean() }), {
33790
+ kind: "mutation",
33791
+ auth: "admin"
33792
+ }),
31969
33793
  /** Read one camera's settings. Null when never touched (inherits agent defaults fully). */
31970
33794
  getCameraSettings: method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()),
31971
33795
  /** Set or clear the 3-state toggle for one (camera, addonId). Pass `enabled: null` to clear and revert to agent default. */
@@ -39446,6 +41270,9 @@ var CreateIntegrationInputSchema = object({
39446
41270
  enabled: boolean().optional(),
39447
41271
  info: record(string(), unknown()).optional(),
39448
41272
  settings: record(string(), unknown()).optional(),
41273
+ /** Keys of `settings` the form's schema declares secret (by type) — kept in
41274
+ * the keychain, not the table (D787). */
41275
+ secretKeys: array(string()).optional(),
39449
41276
  skipRestart: boolean().optional()
39450
41277
  });
39451
41278
  var UpdateIntegrationInputSchema = object({
@@ -39481,7 +41308,9 @@ var integrationsCapability = {
39481
41308
  getSettings: method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }),
39482
41309
  setSettings: method(object({
39483
41310
  id: string(),
39484
- settings: record(string(), unknown())
41311
+ settings: record(string(), unknown()),
41312
+ /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
41313
+ secretKeys: array(string()).optional()
39485
41314
  }), object({ success: boolean() }), {
39486
41315
  kind: "mutation",
39487
41316
  auth: "admin"
@@ -48804,7 +50633,8 @@ var BaseDevice = class {
48804
50633
  this.role = options.role;
48805
50634
  this.parentDeviceId = ctx.parentDeviceId;
48806
50635
  const seedData = ctx.persistedConfig ?? {};
48807
- this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data), seedData, ({ droppedKeys, issues }) => {
50636
+ const declaredSecretPaths = collectZodSecretPaths(schema);
50637
+ this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
48808
50638
  ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
48809
50639
  tags: {
48810
50640
  deviceId: ctx.id,
@@ -52016,6 +53846,90 @@ Object.freeze({
52016
53846
  addonId: null,
52017
53847
  access: "create"
52018
53848
  },
53849
+ "keychain.delete": {
53850
+ capName: "keychain",
53851
+ capScope: "system",
53852
+ addonId: null,
53853
+ access: "delete"
53854
+ },
53855
+ "keychain.getState": {
53856
+ capName: "keychain",
53857
+ capScope: "system",
53858
+ addonId: null,
53859
+ access: "view"
53860
+ },
53861
+ "keychain.listMeta": {
53862
+ capName: "keychain",
53863
+ capScope: "system",
53864
+ addonId: null,
53865
+ access: "view"
53866
+ },
53867
+ "keychain.put": {
53868
+ capName: "keychain",
53869
+ capScope: "system",
53870
+ addonId: null,
53871
+ access: "create"
53872
+ },
53873
+ "keychain.resolve": {
53874
+ capName: "keychain",
53875
+ capScope: "system",
53876
+ addonId: null,
53877
+ access: "view"
53878
+ },
53879
+ "keychainAdmin.deleteOrphans": {
53880
+ capName: "keychain-admin",
53881
+ capScope: "system",
53882
+ addonId: null,
53883
+ access: "delete"
53884
+ },
53885
+ "keychainAdmin.downloadRecoveryKey": {
53886
+ capName: "keychain-admin",
53887
+ capScope: "system",
53888
+ addonId: null,
53889
+ access: "create"
53890
+ },
53891
+ "keychainAdmin.listAudit": {
53892
+ capName: "keychain-admin",
53893
+ capScope: "system",
53894
+ addonId: null,
53895
+ access: "view"
53896
+ },
53897
+ "keychainAdmin.listSecrets": {
53898
+ capName: "keychain-admin",
53899
+ capScope: "system",
53900
+ addonId: null,
53901
+ access: "view"
53902
+ },
53903
+ "keychainAdmin.purgeRetiredKeys": {
53904
+ capName: "keychain-admin",
53905
+ capScope: "system",
53906
+ addonId: null,
53907
+ access: "delete"
53908
+ },
53909
+ "keychainAdmin.resetKeychain": {
53910
+ capName: "keychain-admin",
53911
+ capScope: "system",
53912
+ addonId: null,
53913
+ access: "delete"
53914
+ },
53915
+ "keychainAdmin.reveal": {
53916
+ capName: "keychain-admin",
53917
+ capScope: "system",
53918
+ addonId: null,
53919
+ access: "create"
53920
+ },
53921
+ "keychainAdmin.rotateMasterKey": {
53922
+ capName: "keychain-admin",
53923
+ capScope: "system",
53924
+ addonId: null,
53925
+ access: "create"
53926
+ },
53927
+ "keychainAdmin.status": {
53928
+ capName: "keychain-admin",
53929
+ capScope: "system",
53930
+ addonId: null,
53931
+ access: "view"
53932
+ },
52019
53933
  "lawnMowerControl.dock": {
52020
53934
  capName: "lawn-mower-control",
52021
53935
  capScope: "device",
@@ -53390,6 +55304,18 @@ Object.freeze({
53390
55304
  addonId: null,
53391
55305
  access: "create"
53392
55306
  },
55307
+ "pipelineAnalytics.addRetrainFrameFromRecording": {
55308
+ capName: "pipeline-analytics",
55309
+ capScope: "device",
55310
+ addonId: null,
55311
+ access: "create"
55312
+ },
55313
+ "pipelineAnalytics.addRetrainFramesToCollection": {
55314
+ capName: "pipeline-analytics",
55315
+ capScope: "device",
55316
+ addonId: null,
55317
+ access: "create"
55318
+ },
53393
55319
  "pipelineAnalytics.applyDeviceSettingsPatch": {
53394
55320
  capName: "pipeline-analytics",
53395
55321
  capScope: "device",
@@ -53438,12 +55364,36 @@ Object.freeze({
53438
55364
  addonId: null,
53439
55365
  access: "view"
53440
55366
  },
55367
+ "pipelineAnalytics.createRetrainCollection": {
55368
+ capName: "pipeline-analytics",
55369
+ capScope: "device",
55370
+ addonId: null,
55371
+ access: "create"
55372
+ },
55373
+ "pipelineAnalytics.createRetrainDatasetVersion": {
55374
+ capName: "pipeline-analytics",
55375
+ capScope: "device",
55376
+ addonId: null,
55377
+ access: "create"
55378
+ },
53441
55379
  "pipelineAnalytics.deleteDeviceEvents": {
53442
55380
  capName: "pipeline-analytics",
53443
55381
  capScope: "device",
53444
55382
  addonId: null,
53445
55383
  access: "delete"
53446
55384
  },
55385
+ "pipelineAnalytics.deleteRetrainCollection": {
55386
+ capName: "pipeline-analytics",
55387
+ capScope: "device",
55388
+ addonId: null,
55389
+ access: "delete"
55390
+ },
55391
+ "pipelineAnalytics.deleteRetrainDatasetVersion": {
55392
+ capName: "pipeline-analytics",
55393
+ capScope: "device",
55394
+ addonId: null,
55395
+ access: "delete"
55396
+ },
53447
55397
  "pipelineAnalytics.deleteTracks": {
53448
55398
  capName: "pipeline-analytics",
53449
55399
  capScope: "device",
@@ -53648,6 +55598,30 @@ Object.freeze({
53648
55598
  addonId: null,
53649
55599
  access: "view"
53650
55600
  },
55601
+ "pipelineAnalytics.listRetrainAssistProfiles": {
55602
+ capName: "pipeline-analytics",
55603
+ capScope: "device",
55604
+ addonId: null,
55605
+ access: "view"
55606
+ },
55607
+ "pipelineAnalytics.listRetrainCollectionFrames": {
55608
+ capName: "pipeline-analytics",
55609
+ capScope: "device",
55610
+ addonId: null,
55611
+ access: "view"
55612
+ },
55613
+ "pipelineAnalytics.listRetrainCollections": {
55614
+ capName: "pipeline-analytics",
55615
+ capScope: "device",
55616
+ addonId: null,
55617
+ access: "view"
55618
+ },
55619
+ "pipelineAnalytics.listRetrainDatasetVersions": {
55620
+ capName: "pipeline-analytics",
55621
+ capScope: "device",
55622
+ addonId: null,
55623
+ access: "view"
55624
+ },
53651
55625
  "pipelineAnalytics.listRetrainFrames": {
53652
55626
  capName: "pipeline-analytics",
53653
55627
  capScope: "device",
@@ -53690,12 +55664,24 @@ Object.freeze({
53690
55664
  addonId: null,
53691
55665
  access: "create"
53692
55666
  },
55667
+ "pipelineAnalytics.previewRetrainDataset": {
55668
+ capName: "pipeline-analytics",
55669
+ capScope: "device",
55670
+ addonId: null,
55671
+ access: "view"
55672
+ },
53693
55673
  "pipelineAnalytics.proposeRetrainAnnotations": {
53694
55674
  capName: "pipeline-analytics",
53695
55675
  capScope: "device",
53696
55676
  addonId: null,
53697
55677
  access: "create"
53698
55678
  },
55679
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
55680
+ capName: "pipeline-analytics",
55681
+ capScope: "device",
55682
+ addonId: null,
55683
+ access: "create"
55684
+ },
53699
55685
  "pipelineAnalytics.pruneEvents": {
53700
55686
  capName: "pipeline-analytics",
53701
55687
  capScope: "device",
@@ -53750,6 +55736,18 @@ Object.freeze({
53750
55736
  addonId: null,
53751
55737
  access: "create"
53752
55738
  },
55739
+ "pipelineAnalytics.removeRetrainFrameFromCollection": {
55740
+ capName: "pipeline-analytics",
55741
+ capScope: "device",
55742
+ addonId: null,
55743
+ access: "delete"
55744
+ },
55745
+ "pipelineAnalytics.renameRetrainCollection": {
55746
+ capName: "pipeline-analytics",
55747
+ capScope: "device",
55748
+ addonId: null,
55749
+ access: "create"
55750
+ },
53753
55751
  "pipelineAnalytics.restageRetrainTrack": {
53754
55752
  capName: "pipeline-analytics",
53755
55753
  capScope: "device",
@@ -53810,6 +55808,12 @@ Object.freeze({
53810
55808
  addonId: null,
53811
55809
  access: "create"
53812
55810
  },
55811
+ "pipelineAnalytics.verifyRetrainDatasetVersion": {
55812
+ capName: "pipeline-analytics",
55813
+ capScope: "device",
55814
+ addonId: null,
55815
+ access: "view"
55816
+ },
53813
55817
  "pipelineAnalytics.wipeAllAnalytics": {
53814
55818
  capName: "pipeline-analytics",
53815
55819
  capScope: "device",
@@ -54038,6 +56042,12 @@ Object.freeze({
54038
56042
  addonId: null,
54039
56043
  access: "view"
54040
56044
  },
56045
+ "pipelineOrchestrator.abortNodeBenchmark": {
56046
+ capName: "pipeline-orchestrator",
56047
+ capScope: "system",
56048
+ addonId: null,
56049
+ access: "create"
56050
+ },
54041
56051
  "pipelineOrchestrator.applyAutoTune": {
54042
56052
  capName: "pipeline-orchestrator",
54043
56053
  capScope: "system",
@@ -54062,6 +56072,12 @@ Object.freeze({
54062
56072
  addonId: null,
54063
56073
  access: "create"
54064
56074
  },
56075
+ "pipelineOrchestrator.deleteNodeBenchmarkResult": {
56076
+ capName: "pipeline-orchestrator",
56077
+ capScope: "system",
56078
+ addonId: null,
56079
+ access: "delete"
56080
+ },
54065
56081
  "pipelineOrchestrator.getAgentLoad": {
54066
56082
  capName: "pipeline-orchestrator",
54067
56083
  capScope: "system",
@@ -54170,6 +56186,24 @@ Object.freeze({
54170
56186
  addonId: null,
54171
56187
  access: "view"
54172
56188
  },
56189
+ "pipelineOrchestrator.getNodeBenchmarkCandidates": {
56190
+ capName: "pipeline-orchestrator",
56191
+ capScope: "system",
56192
+ addonId: null,
56193
+ access: "view"
56194
+ },
56195
+ "pipelineOrchestrator.getNodeBenchmarkPreflight": {
56196
+ capName: "pipeline-orchestrator",
56197
+ capScope: "system",
56198
+ addonId: null,
56199
+ access: "view"
56200
+ },
56201
+ "pipelineOrchestrator.getNodeBenchmarkStatus": {
56202
+ capName: "pipeline-orchestrator",
56203
+ capScope: "system",
56204
+ addonId: null,
56205
+ access: "view"
56206
+ },
54173
56207
  "pipelineOrchestrator.getNodeInferenceDevices": {
54174
56208
  capName: "pipeline-orchestrator",
54175
56209
  capScope: "system",
@@ -54212,6 +56246,12 @@ Object.freeze({
54212
56246
  addonId: null,
54213
56247
  access: "view"
54214
56248
  },
56249
+ "pipelineOrchestrator.listNodeBenchmarkResults": {
56250
+ capName: "pipeline-orchestrator",
56251
+ capScope: "system",
56252
+ addonId: null,
56253
+ access: "view"
56254
+ },
54215
56255
  "pipelineOrchestrator.pauseForStorageMigration": {
54216
56256
  capName: "pipeline-orchestrator",
54217
56257
  capScope: "system",
@@ -54356,6 +56396,12 @@ Object.freeze({
54356
56396
  addonId: null,
54357
56397
  access: "create"
54358
56398
  },
56399
+ "pipelineOrchestrator.startNodeBenchmark": {
56400
+ capName: "pipeline-orchestrator",
56401
+ capScope: "system",
56402
+ addonId: null,
56403
+ access: "create"
56404
+ },
54359
56405
  "pipelineOrchestrator.suggestShares": {
54360
56406
  capName: "pipeline-orchestrator",
54361
56407
  capScope: "system",
@@ -54374,6 +56420,12 @@ Object.freeze({
54374
56420
  addonId: null,
54375
56421
  access: "create"
54376
56422
  },
56423
+ "pipelineRunner.abortNodeBench": {
56424
+ capName: "pipeline-runner",
56425
+ capScope: "system",
56426
+ addonId: null,
56427
+ access: "create"
56428
+ },
54377
56429
  "pipelineRunner.attachCamera": {
54378
56430
  capName: "pipeline-runner",
54379
56431
  capScope: "system",
@@ -54422,6 +56474,12 @@ Object.freeze({
54422
56474
  addonId: null,
54423
56475
  access: "view"
54424
56476
  },
56477
+ "pipelineRunner.getNodeBenchStatus": {
56478
+ capName: "pipeline-runner",
56479
+ capScope: "system",
56480
+ addonId: null,
56481
+ access: "view"
56482
+ },
54425
56483
  "pipelineRunner.getParkedTrackFrame": {
54426
56484
  capName: "pipeline-runner",
54427
56485
  capScope: "system",
@@ -54464,6 +56522,12 @@ Object.freeze({
54464
56522
  addonId: null,
54465
56523
  access: "create"
54466
56524
  },
56525
+ "pipelineRunner.startNodeBench": {
56526
+ capName: "pipeline-runner",
56527
+ capScope: "system",
56528
+ addonId: null,
56529
+ access: "create"
56530
+ },
54467
56531
  "plateGallery.assignPlate": {
54468
56532
  capName: "plate-gallery",
54469
56533
  capScope: "system",
@@ -58143,6 +60207,8 @@ var ALL_CAPABILITY_DEFINITIONS = [
58143
60207
  imageSettingsCapability,
58144
60208
  integrationsCapability,
58145
60209
  intercomCapability,
60210
+ keychainCapability,
60211
+ keychainAdminCapability,
58146
60212
  lawnMowerControlCapability,
58147
60213
  llmCapability,
58148
60214
  llmRuntimeCapability,
@@ -59569,6 +61635,11 @@ Object.freeze({
59569
61635
  form: "single",
59570
61636
  optional: false
59571
61637
  }],
61638
+ "pipelineAnalytics.addRetrainFrameFromRecording": [{
61639
+ name: "deviceId",
61640
+ form: "single",
61641
+ optional: false
61642
+ }],
59572
61643
  "pipelineAnalytics.applyDeviceSettingsPatch": [{
59573
61644
  name: "deviceId",
59574
61645
  form: "single",
@@ -59759,6 +61830,11 @@ Object.freeze({
59759
61830
  form: "single",
59760
61831
  optional: false
59761
61832
  }],
61833
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
61834
+ name: "deviceId",
61835
+ form: "single",
61836
+ optional: false
61837
+ }],
59762
61838
  "pipelineAnalytics.pruneEventsBefore": [{
59763
61839
  name: "deviceId",
59764
61840
  form: "single",