@camstack/addon-matter-broker 0.2.121 → 0.2.123

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +2046 -63
  2. package/dist/addon.mjs +2046 -63
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -13,7 +13,7 @@ let node_stream_promises = require("node:stream/promises");
13
13
  let node_net = require("node:net");
14
14
  let node_dgram = require("node:dgram");
15
15
  node_dgram = require_esm.__toESM(node_dgram, 1);
16
- //#region ../types/dist/event-category-B_0XEcLF.mjs
16
+ //#region ../types/dist/event-category-DaIZi00R.mjs
17
17
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
18
18
  EventCategory["SystemBoot"] = "system.boot";
19
19
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -92,6 +92,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
92
92
  */
93
93
  EventCategory["AddonLoadFailed"] = "addon.load-failed";
94
94
  /**
95
+ * A keychain value was stored or removed (D787). Carries the ref, its
96
+ * owner and the new version — NEVER the value. A process holding the ref
97
+ * drops its cached copy and the owning `BaseAddon` re-resolves its config.
98
+ * Telemetry (D8): a process that misses it still revalidates by version.
99
+ */
100
+ EventCategory["KeychainChanged"] = "keychain.changed";
101
+ /**
95
102
  * Addon recovered from a previous failure. Emitted when an addon
96
103
  * transitions from `failed` back to `healthy` (typically via the
97
104
  * monitor's auto-retry loop, or after manual `addons.retryLoad`).
@@ -5384,7 +5391,7 @@ var ZodIssueCode = {
5384
5391
  var ZodFirstPartyTypeKind;
5385
5392
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5386
5393
  //#endregion
5387
- //#region ../types/dist/sleep-BNeXenvr.mjs
5394
+ //#region ../types/dist/sleep-Cr5YOk3m.mjs
5388
5395
  /**
5389
5396
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5390
5397
  * window to float samples (D455).
@@ -5463,6 +5470,97 @@ function buildAlawTable() {
5463
5470
  }
5464
5471
  buildUlawTable();
5465
5472
  buildAlawTable();
5473
+ /** Is this field's stored value a credential? */
5474
+ function isSecretConfigField(field) {
5475
+ if (field.type === "password") return true;
5476
+ return "secret" in field && field.secret === true;
5477
+ }
5478
+ /**
5479
+ * Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
5480
+ * by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
5481
+ */
5482
+ function isKeychainStoredField(field) {
5483
+ if (!isSecretConfigField(field)) return false;
5484
+ if (field.type === "textarea" && field.isJson === true) return false;
5485
+ return !("storage" in field && field.storage === "inline");
5486
+ }
5487
+ /**
5488
+ * What a settings blob holds where a secret used to be.
5489
+ *
5490
+ * A keychain-stored field never holds its value. It holds a self-describing
5491
+ * MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
5492
+ * code can mistake it for a credential and no form can send it to a camera as
5493
+ * a password. The empty state is `null` / absent, never `''`.
5494
+ *
5495
+ * The same shapes travel to and from the admin UI:
5496
+ *
5497
+ * - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
5498
+ * (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
5499
+ * value is set, never the value.
5500
+ * - write: an untouched field submits the view back unchanged (KEEP); a typed
5501
+ * value is a plain non-empty string (CHANGE); the Clear button submits
5502
+ * {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
5503
+ * are KEEP — an empty string is what a defaults-fallback pushes back, and
5504
+ * treating it as "clear" is how a save destroyed a stored credential before.
5505
+ *
5506
+ * Pure and browser-safe.
5507
+ */
5508
+ var SECRET_CLEAR = { $secretClear: true };
5509
+ /** The `'***'` token D634 redaction writes for non-admins. */
5510
+ var LEGACY_DEVICE_REDACTION = "***";
5511
+ function isRecord$1$1(value) {
5512
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5513
+ }
5514
+ function makeSecretMarker(ref) {
5515
+ return {
5516
+ $secret: ref,
5517
+ v: 1
5518
+ };
5519
+ }
5520
+ /** A stored marker: an object whose `$secret` is a non-empty string. */
5521
+ function isSecretMarker(value) {
5522
+ if (!isRecord$1$1(value)) return false;
5523
+ const ref = value["$secret"];
5524
+ return typeof ref === "string" && ref.length > 0;
5525
+ }
5526
+ function isSecretClear(value) {
5527
+ return isRecord$1$1(value) && value["$secretClear"] === true;
5528
+ }
5529
+ /**
5530
+ * The UI view of a stored secret field value: a marker becomes "set", inline
5531
+ * plaintext becomes "set (inline)", nothing becomes `null`. A value never
5532
+ * survives this function.
5533
+ */
5534
+ function toSecretFieldView(stored) {
5535
+ if (isSecretMarker(stored)) return {
5536
+ $secret: stored.$secret,
5537
+ v: 1,
5538
+ set: true
5539
+ };
5540
+ if (typeof stored === "string" && stored.length > 0) return {
5541
+ $secret: null,
5542
+ v: 1,
5543
+ set: true,
5544
+ inline: true
5545
+ };
5546
+ return null;
5547
+ }
5548
+ /**
5549
+ * Classify an incoming value for a secret path. Only a non-empty string that is
5550
+ * not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
5551
+ * Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
5552
+ * `undefined`, a redaction token, a non-string — keeps what is stored.
5553
+ */
5554
+ function classifySecretWrite(incoming) {
5555
+ if (isSecretClear(incoming)) return { kind: "clear" };
5556
+ if (typeof incoming !== "string") return { kind: "keep" };
5557
+ if (incoming.length === 0) return { kind: "keep" };
5558
+ if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
5559
+ return {
5560
+ kind: "set",
5561
+ value: incoming
5562
+ };
5563
+ }
5466
5564
  Object.fromEntries([
5467
5565
  {
5468
5566
  id: "overview",
@@ -5634,33 +5732,19 @@ Object.fromEntries([
5634
5732
  function isValuelessField(field) {
5635
5733
  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";
5636
5734
  }
5637
- /**
5638
- * Merge a `ConfigUISchema` with a raw `values` record into a
5639
- * `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
5640
- * before returning to the admin UI. Groups are walked recursively.
5641
- *
5642
- * For each leaf field:
5643
- * - structural fields (`separator`, `info`, `button`) pass through unchanged
5644
- * - other fields get `value = values[key] ?? field.default ?? null`
5645
- *
5646
- * Unknown keys in `values` (keys not declared in the schema) are silently
5647
- * ignored — they don't contribute to the output. Missing keys fall back to
5648
- * the schema default or `null`. This mirrors the old backend behaviour where
5649
- * `FormBuilder` rendered `values[key] ?? field.default`.
5650
- */
5651
- function hydrateSchema(schema, values) {
5735
+ function hydrateSchema(schema, values, options = {}) {
5652
5736
  return {
5653
5737
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
5654
5738
  sections: schema.sections.map((section) => ({
5655
5739
  ...section,
5656
- fields: section.fields.map((field) => hydrateField(field, values))
5740
+ fields: section.fields.map((field) => hydrateField(field, values, options))
5657
5741
  }))
5658
5742
  };
5659
5743
  }
5660
- function hydrateField(field, values) {
5744
+ function hydrateField(field, values, options) {
5661
5745
  if (isValuelessField(field)) return field;
5662
5746
  if (field.type === "group") {
5663
- const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
5747
+ const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
5664
5748
  return {
5665
5749
  ...field,
5666
5750
  fields: hydratedChildren
@@ -5669,7 +5753,7 @@ function hydrateField(field, values) {
5669
5753
  if (field.type === "sub-tabs") {
5670
5754
  const hydratedTabs = field.tabs.map((tab) => ({
5671
5755
  ...tab,
5672
- fields: tab.fields.map((child) => hydrateField(child, values))
5756
+ fields: tab.fields.map((child) => hydrateField(child, values, options))
5673
5757
  }));
5674
5758
  return {
5675
5759
  ...field,
@@ -5679,6 +5763,33 @@ function hydrateField(field, values) {
5679
5763
  const key = field.key;
5680
5764
  const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
5681
5765
  const defaultValue = field.default;
5766
+ const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
5767
+ if (isKeychainStoredField(field) && asView(storedValue)) return {
5768
+ ...field,
5769
+ value: toSecretFieldView(storedValue)
5770
+ };
5771
+ if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
5772
+ ...field,
5773
+ value: null
5774
+ };
5775
+ if (field.type === "editable-array" && Array.isArray(storedValue)) {
5776
+ const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
5777
+ if (secretItemKeys.length > 0) {
5778
+ const rows = storedValue.map((row) => {
5779
+ if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
5780
+ const out = { ...row };
5781
+ for (const k of secretItemKeys) {
5782
+ const v = Reflect.get(row, k);
5783
+ if (asView(v)) out[k] = toSecretFieldView(v);
5784
+ }
5785
+ return out;
5786
+ });
5787
+ return {
5788
+ ...field,
5789
+ value: rows
5790
+ };
5791
+ }
5792
+ }
5682
5793
  if (field.multiple) {
5683
5794
  const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
5684
5795
  const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
@@ -5921,6 +6032,431 @@ function projectStore(store, perNodeKeys, nodeId) {
5921
6032
  }
5922
6033
  return out;
5923
6034
  }
6035
+ var GLOBAL_SCOPE = { kind: "global" };
6036
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6037
+ function globalSecretScope() {
6038
+ return GLOBAL_SCOPE;
6039
+ }
6040
+ function encodeSegment(value) {
6041
+ return encodeURIComponent(value);
6042
+ }
6043
+ /**
6044
+ * The field path of a value inside an array item, addressed by the item's id:
6045
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6046
+ * `providers[authentik].clientSecret`.
6047
+ */
6048
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6049
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6050
+ }
6051
+ /** A write to a secret path could not be stored in the keychain, so it was refused. */
6052
+ var KeychainWriteRefusedError = class extends Error {
6053
+ fieldPath;
6054
+ constructor(fieldPath, cause) {
6055
+ super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
6056
+ this.fieldPath = fieldPath;
6057
+ this.name = "KeychainWriteRefusedError";
6058
+ }
6059
+ };
6060
+ var KEEP = { kind: "keep" };
6061
+ function isRecord$2(value) {
6062
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6063
+ }
6064
+ function defaultMintId() {
6065
+ return globalThis.crypto.randomUUID();
6066
+ }
6067
+ /** Every marker ref anywhere under `value`. */
6068
+ function collectSecretMarkerRefs(value, out = []) {
6069
+ if (isSecretMarker(value)) {
6070
+ out.push(value.$secret);
6071
+ return out;
6072
+ }
6073
+ if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6074
+ else if (isRecord$2(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6075
+ return out;
6076
+ }
6077
+ async function storedValueEquals(secrets, marker, candidate) {
6078
+ const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
6079
+ return resolved?.kind === "value" && resolved.value === candidate;
6080
+ }
6081
+ async function writeLeaf(ctx, incoming, stored, fieldPath) {
6082
+ const intent = classifySecretWrite(incoming);
6083
+ const ref = ctx.secrets.ref(ctx.scope, fieldPath);
6084
+ const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
6085
+ if (intent.kind === "keep") return KEEP;
6086
+ if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
6087
+ if (intent.kind === "clear") {
6088
+ if (storedIsOurs) ctx.deletes.push(ref);
6089
+ return {
6090
+ kind: "value",
6091
+ value: null
6092
+ };
6093
+ }
6094
+ if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
6095
+ kind: "value",
6096
+ value: stored
6097
+ };
6098
+ try {
6099
+ await ctx.secrets.put(ref, intent.value);
6100
+ } catch (err) {
6101
+ throw new KeychainWriteRefusedError(fieldPath, err);
6102
+ }
6103
+ return {
6104
+ kind: "value",
6105
+ value: makeSecretMarker(ref)
6106
+ };
6107
+ }
6108
+ /** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
6109
+ function applyMember(out, key, result, storedParent) {
6110
+ if (result.kind === "value") {
6111
+ out[key] = result.value;
6112
+ return;
6113
+ }
6114
+ if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
6115
+ else delete out[key];
6116
+ }
6117
+ async function writeMembers(ctx, children, incoming, stored, pathOf) {
6118
+ const out = { ...incoming };
6119
+ for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
6120
+ return out;
6121
+ }
6122
+ function rowId(row, idKey) {
6123
+ const raw = row[idKey];
6124
+ if (typeof raw === "string" && raw.length > 0) return raw;
6125
+ if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
6126
+ return null;
6127
+ }
6128
+ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6129
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$2) : [];
6130
+ if (!Array.isArray(incoming)) {
6131
+ ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6132
+ return {
6133
+ kind: "value",
6134
+ value: incoming
6135
+ };
6136
+ }
6137
+ const storedById = /* @__PURE__ */ new Map();
6138
+ for (const row of storedRows) {
6139
+ const id = rowId(row, node.idKey);
6140
+ if (id !== null) storedById.set(id, row);
6141
+ }
6142
+ const kept = /* @__PURE__ */ new Set();
6143
+ const rows = [];
6144
+ for (const row of incoming) {
6145
+ if (!isRecord$2(row)) {
6146
+ rows.push(row);
6147
+ continue;
6148
+ }
6149
+ const id = rowId(row, node.idKey) ?? ctx.mintId();
6150
+ kept.add(id);
6151
+ const withId = {
6152
+ ...row,
6153
+ [node.idKey]: row[node.idKey] ?? id
6154
+ };
6155
+ if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
6156
+ const storedRow = storedById.get(id) ?? {};
6157
+ rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
6158
+ }
6159
+ for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
6160
+ return {
6161
+ kind: "value",
6162
+ value: rows
6163
+ };
6164
+ }
6165
+ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6166
+ switch (node.kind) {
6167
+ case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6168
+ case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6169
+ case "object": {
6170
+ if (!isRecord$2(incoming)) {
6171
+ if (incoming === void 0) return KEEP;
6172
+ ctx.deletes.push(...collectSecretMarkerRefs(stored));
6173
+ return {
6174
+ kind: "value",
6175
+ value: incoming
6176
+ };
6177
+ }
6178
+ const storedObj = isRecord$2(stored) ? stored : {};
6179
+ return {
6180
+ kind: "value",
6181
+ value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
6182
+ };
6183
+ }
6184
+ }
6185
+ }
6186
+ /** Split a perNode-scoped key (`key@nodeId`). */
6187
+ function splitNodeKey(key) {
6188
+ const at = key.indexOf("@");
6189
+ return at <= 0 ? {
6190
+ base: key,
6191
+ nodeId: null
6192
+ } : {
6193
+ base: key.slice(0, at),
6194
+ nodeId: key.slice(at + 1)
6195
+ };
6196
+ }
6197
+ /** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
6198
+ async function transformSecretWrite(input) {
6199
+ const deletes = [];
6200
+ const base = {
6201
+ secrets: input.secrets,
6202
+ mintId: input.mintId ?? defaultMintId,
6203
+ deletes,
6204
+ operatorWrite: input.operatorWrite === true
6205
+ };
6206
+ const out = {};
6207
+ for (const [key, incoming] of Object.entries(input.patch)) {
6208
+ const { base: baseKey, nodeId } = splitNodeKey(key);
6209
+ const node = input.tree.get(baseKey);
6210
+ if (node === void 0) {
6211
+ out[key] = incoming;
6212
+ continue;
6213
+ }
6214
+ const scope = nodeId !== null && nodeId.length > 0 ? {
6215
+ kind: "node",
6216
+ nodeId
6217
+ } : input.scope ?? globalSecretScope();
6218
+ const result = await writeNode({
6219
+ ...base,
6220
+ scope
6221
+ }, node, incoming, input.stored[key], baseKey);
6222
+ if (result.kind === "value") out[key] = result.value;
6223
+ }
6224
+ return {
6225
+ patch: out,
6226
+ afterWrite: async () => {
6227
+ if (deletes.length === 0) return { orphaned: [] };
6228
+ try {
6229
+ await input.secrets.delete([...new Set(deletes)]);
6230
+ return { orphaned: [] };
6231
+ } catch {
6232
+ return { orphaned: [...new Set(deletes)] };
6233
+ }
6234
+ }
6235
+ };
6236
+ }
6237
+ /**
6238
+ * Replace every marker in `value` with its keychain value. Returns the SAME
6239
+ * reference when there is no marker (no allocation, no keychain call).
6240
+ */
6241
+ async function resolveSecretMarkers(value, secrets) {
6242
+ const refs = collectSecretMarkerRefs(value);
6243
+ if (refs.length === 0) return {
6244
+ value,
6245
+ unresolved: []
6246
+ };
6247
+ const answers = await secrets.resolve(refs);
6248
+ const unresolved = [];
6249
+ for (const ref of new Set(refs)) {
6250
+ const answer = answers[ref];
6251
+ if (answer === void 0) unresolved.push({
6252
+ ref,
6253
+ reason: "not-initialized"
6254
+ });
6255
+ else if (answer.kind === "unavailable") unresolved.push({
6256
+ ref,
6257
+ reason: answer.reason
6258
+ });
6259
+ else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
6260
+ ref,
6261
+ reason: answer.kind
6262
+ });
6263
+ }
6264
+ const substitute = (v) => {
6265
+ if (isSecretMarker(v)) {
6266
+ const answer = answers[v.$secret];
6267
+ return answer?.kind === "value" ? {
6268
+ keep: true,
6269
+ value: answer.value
6270
+ } : {
6271
+ keep: false,
6272
+ value: void 0
6273
+ };
6274
+ }
6275
+ if (Array.isArray(v)) {
6276
+ const items = [];
6277
+ for (const item of v) {
6278
+ const s = substitute(item);
6279
+ if (s.keep) items.push(s.value);
6280
+ }
6281
+ return {
6282
+ keep: true,
6283
+ value: items
6284
+ };
6285
+ }
6286
+ if (isRecord$2(v)) {
6287
+ const out = {};
6288
+ for (const [k, child] of Object.entries(v)) {
6289
+ const s = substitute(child);
6290
+ if (s.keep) out[k] = s.value;
6291
+ }
6292
+ return {
6293
+ keep: true,
6294
+ value: out
6295
+ };
6296
+ }
6297
+ return {
6298
+ keep: true,
6299
+ value: v
6300
+ };
6301
+ };
6302
+ return {
6303
+ value: substitute(value).value,
6304
+ unresolved
6305
+ };
6306
+ }
6307
+ function touchesTree(tree, patch) {
6308
+ if (tree.size === 0) return false;
6309
+ for (const key of Object.keys(patch)) {
6310
+ const at = key.indexOf("@");
6311
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6312
+ }
6313
+ return false;
6314
+ }
6315
+ /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6316
+ async function readStoredAddonBlob(raw) {
6317
+ const threeWay = raw.readAddonStoreResult;
6318
+ if (threeWay === void 0) return raw.readAddonStore();
6319
+ const result = await threeWay.call(raw);
6320
+ if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6321
+ return result.kind === "missing" ? {} : result.value;
6322
+ }
6323
+ function createSecretAwareSettings(raw, opts) {
6324
+ const chains = /* @__PURE__ */ new Map();
6325
+ const serialize = (key, fn) => {
6326
+ const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
6327
+ const tail = next.catch(() => void 0);
6328
+ chains.set(key, tail);
6329
+ tail.then(() => {
6330
+ if (chains.get(key) === tail) chains.delete(key);
6331
+ });
6332
+ return next;
6333
+ };
6334
+ const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6335
+ if (!touchesTree(tree, patch)) return rawWrite(patch);
6336
+ return serialize(chainKey, async () => {
6337
+ const stored = await readStored();
6338
+ const result = await transformSecretWrite({
6339
+ tree,
6340
+ secrets: opts.secrets,
6341
+ patch,
6342
+ stored,
6343
+ ...scope !== void 0 ? { scope } : {},
6344
+ operatorWrite: opts.isOperatorWrite?.() === true
6345
+ });
6346
+ if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6347
+ const { orphaned } = await result.afterWrite();
6348
+ if (orphaned.length > 0) opts.onOrphaned(orphaned);
6349
+ });
6350
+ };
6351
+ const wrapped = {
6352
+ writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6353
+ writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6354
+ kind: "device",
6355
+ deviceId
6356
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6357
+ };
6358
+ return new Proxy(raw, { get(target, prop, receiver) {
6359
+ if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6360
+ if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6361
+ const value = Reflect.get(target, prop, receiver);
6362
+ return typeof value === "function" ? value.bind(target) : value;
6363
+ } });
6364
+ }
6365
+ /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6366
+ function withSecretAwareSettings(context, opts) {
6367
+ const raw = context.settings;
6368
+ if (raw === void 0) return context;
6369
+ const settings = createSecretAwareSettings(raw, opts);
6370
+ return new Proxy(context, { get(target, prop, receiver) {
6371
+ if (prop === "settings") return settings;
6372
+ return Reflect.get(target, prop, receiver);
6373
+ } });
6374
+ }
6375
+ var LEAF = { kind: "leaf" };
6376
+ var DEFAULT_ITEM_ID_KEY = "id";
6377
+ function collectFields(fields, out) {
6378
+ for (const field of fields) {
6379
+ if (field.type === "group") {
6380
+ collectFields(field.fields, out);
6381
+ continue;
6382
+ }
6383
+ if (field.type === "sub-tabs") {
6384
+ for (const tab of field.tabs) collectFields(tab.fields, out);
6385
+ continue;
6386
+ }
6387
+ if (field.type === "editable-array") {
6388
+ const item = /* @__PURE__ */ new Map();
6389
+ for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
6390
+ if (item.size > 0) out.set(field.key, {
6391
+ kind: "array",
6392
+ idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
6393
+ item
6394
+ });
6395
+ continue;
6396
+ }
6397
+ if (!("key" in field) || typeof field.key !== "string") continue;
6398
+ if (isKeychainStoredField(field)) out.set(field.key, LEAF);
6399
+ }
6400
+ }
6401
+ /** The secret tree a settings schema declares. */
6402
+ function secretTreeFromSchema(schema) {
6403
+ const out = /* @__PURE__ */ new Map();
6404
+ if (schema === null) return out;
6405
+ for (const section of schema.sections) collectFields(section.fields, out);
6406
+ return out;
6407
+ }
6408
+ /** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
6409
+ function parseSecretStatePath(path) {
6410
+ const segments = [];
6411
+ for (const raw of path.split(".")) {
6412
+ const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
6413
+ if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
6414
+ segments.push(m[2] !== void 0 ? {
6415
+ key: m[1],
6416
+ idKey: m[2]
6417
+ } : { key: m[1] });
6418
+ }
6419
+ if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
6420
+ if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
6421
+ return segments;
6422
+ }
6423
+ function insert(into, segments) {
6424
+ const [head, ...rest] = segments;
6425
+ if (head === void 0) return;
6426
+ if (rest.length === 0) {
6427
+ into.set(head.key, LEAF);
6428
+ return;
6429
+ }
6430
+ const existing = into.get(head.key);
6431
+ if (head.idKey !== void 0) {
6432
+ const item = new Map(existing?.kind === "array" ? existing.item : []);
6433
+ insert(item, rest);
6434
+ into.set(head.key, {
6435
+ kind: "array",
6436
+ idKey: head.idKey,
6437
+ item
6438
+ });
6439
+ return;
6440
+ }
6441
+ const children = new Map(existing?.kind === "object" ? existing.children : []);
6442
+ insert(children, rest);
6443
+ into.set(head.key, {
6444
+ kind: "object",
6445
+ children
6446
+ });
6447
+ }
6448
+ /** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
6449
+ function mergeSecretStatePaths(tree, paths) {
6450
+ if (paths.length === 0) return tree;
6451
+ const out = new Map(tree);
6452
+ for (const path of paths) insert(out, parseSecretStatePath(path));
6453
+ return out;
6454
+ }
6455
+ /** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
6456
+ var SECRET_RETRY_FIRST_MS = 5e3;
6457
+ var SECRET_RETRY_MAX_MS = 5 * 6e4;
6458
+ /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
6459
+ var SECRET_CHANGE_DEBOUNCE_MS = 250;
5924
6460
  /**
5925
6461
  * Base class for CamStack addons. Eliminates settings boilerplate:
5926
6462
  *
@@ -5990,6 +6526,25 @@ var BaseAddon = class {
5990
6526
  settingsStoreReady = false;
5991
6527
  /** Default config values. Provided via constructor. */
5992
6528
  defaults;
6529
+ /**
6530
+ * Hidden-state paths that hold secrets (D787) — values the addon writes
6531
+ * itself (`updateGlobalSettings`, `state()`) that no form field declares.
6532
+ * Stored in the keychain exactly like a `password` field. Syntax:
6533
+ * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
6534
+ * (`key[<id field>]` addresses array items by id, never by index).
6535
+ */
6536
+ secretStatePaths = [];
6537
+ _addonSecretTree = null;
6538
+ _deviceSecretTree = null;
6539
+ /** Refs the last resolved config pointed at — a change to one re-resolves. */
6540
+ _configSecretRefs = /* @__PURE__ */ new Set();
6541
+ _unresolvedSecrets = [];
6542
+ _secretRetryTimer = null;
6543
+ _secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
6544
+ _secretChangeTimer = null;
6545
+ _secretChangeUnsub = null;
6546
+ /** >0 while an OPERATOR's settings write is being applied. */
6547
+ _operatorWriteDepth = 0;
5993
6548
  constructor(defaults) {
5994
6549
  this.defaults = defaults;
5995
6550
  this._config = { ...defaults };
@@ -6025,8 +6580,18 @@ var BaseAddon = class {
6025
6580
  return this._config;
6026
6581
  }
6027
6582
  async initialize(context) {
6028
- this._ctx = context;
6583
+ const secrets = context.secrets;
6584
+ this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6585
+ secrets,
6586
+ addonTree: () => this.addonSecretTree(),
6587
+ deviceTree: () => this.deviceSecretTree(),
6588
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6589
+ isOperatorWrite: () => this._operatorWriteDepth > 0
6590
+ }) : context;
6029
6591
  await this.resolveConfig();
6592
+ if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6593
+ if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
6594
+ });
6030
6595
  const result = await this.onInitialize();
6031
6596
  this.emitLifecycle(EventCategory.AddonStarted);
6032
6597
  const normalized = normalizeAddonInitResult(result);
@@ -6059,6 +6624,12 @@ var BaseAddon = class {
6059
6624
  */
6060
6625
  async onHubReachable() {}
6061
6626
  async shutdown() {
6627
+ this._secretChangeUnsub?.();
6628
+ this._secretChangeUnsub = null;
6629
+ if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
6630
+ if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
6631
+ this._secretRetryTimer = null;
6632
+ this._secretChangeTimer = null;
6062
6633
  this.emitLifecycle(EventCategory.AddonStopped);
6063
6634
  if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
6064
6635
  await this.onShutdown();
@@ -6137,7 +6708,7 @@ var BaseAddon = class {
6137
6708
  return hydrateSchema(schema, overlay ? {
6138
6709
  ...projected,
6139
6710
  ...overlay
6140
- } : projected);
6711
+ } : projected, { inlineSecretsAsViews: true });
6141
6712
  }
6142
6713
  /**
6143
6714
  * The integration-level view of this addon's settings: exactly the sections
@@ -6186,7 +6757,7 @@ var BaseAddon = class {
6186
6757
  return hydrateSchema({
6187
6758
  ...schema,
6188
6759
  sections
6189
- }, projected);
6760
+ }, projected, { inlineSecretsAsViews: true });
6190
6761
  }
6191
6762
  /**
6192
6763
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -6240,18 +6811,50 @@ var BaseAddon = class {
6240
6811
  value: result.value[key]
6241
6812
  };
6242
6813
  }
6814
+ /**
6815
+ * The OPERATOR's write — a settings form or an admin API call, dispatched by
6816
+ * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
6817
+ * the operator sends is stored as sent even when it equals a pre-keychain
6818
+ * inline value: the operator re-entering a password is a change, an addon
6819
+ * writing back what it read is not (D787).
6820
+ */
6821
+ async updateGlobalSettingsAsOperator(patch, nodeId) {
6822
+ this._operatorWriteDepth++;
6823
+ try {
6824
+ await this.applyGlobalPatch(patch, nodeId);
6825
+ } finally {
6826
+ this._operatorWriteDepth--;
6827
+ }
6828
+ }
6243
6829
  async updateGlobalSettings(patch, nodeId) {
6830
+ await this.applyGlobalPatch(patch, nodeId);
6831
+ }
6832
+ /**
6833
+ * REMOVE stored secrets — their keychain values and their markers (D787).
6834
+ *
6835
+ * Writing `''` to a secret field KEEPS what is stored (an empty string is
6836
+ * what a defaults fallback writes back, and it must never destroy a
6837
+ * credential), so code that means "forget this token" says so here. Without
6838
+ * a keychain (an older kernel) it writes `''`, as such code always did.
6839
+ */
6840
+ async clearSecrets(keys, nodeId) {
6841
+ const tree = this.addonSecretTree();
6842
+ const keychain = this._ctx?.secrets !== void 0;
6843
+ const patch = {};
6844
+ for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
6845
+ await this.applyGlobalPatch(patch, nodeId);
6846
+ }
6847
+ async applyGlobalPatch(barePatch, nodeId) {
6244
6848
  const keys = this.perNodeKeys();
6245
6849
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6246
6850
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6247
- const barePatch = patch;
6248
6851
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6249
6852
  await this._ctx?.settings?.writeAddonStore(scoped);
6250
6853
  if (target !== localNode) return;
6251
6854
  await this.resolveConfig();
6252
6855
  await this.onConfigChanged();
6253
6856
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
6254
- this.maybeAutoRestart(patch, this.globalSettingsSchema());
6857
+ this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
6255
6858
  }
6256
6859
  /**
6257
6860
  * The set of field keys the global settings schema declares `perNode: true`
@@ -6276,7 +6879,7 @@ var BaseAddon = class {
6276
6879
  * time to return its response before the addon is torn down and
6277
6880
  * re-initialised by `AddonRegistryService.restartAddon`.
6278
6881
  */
6279
- maybeAutoRestart(patch, schema) {
6882
+ maybeAutoRestart(patchKeys, schema) {
6280
6883
  if (!schema) return;
6281
6884
  const restartKeys = /* @__PURE__ */ new Set();
6282
6885
  for (const section of schema.sections) for (const field of section.fields) {
@@ -6284,13 +6887,13 @@ var BaseAddon = class {
6284
6887
  if (field.requiresRestart) restartKeys.add(field.key);
6285
6888
  }
6286
6889
  if (restartKeys.size === 0) return;
6287
- if (!Object.keys(patch).some((k) => restartKeys.has(k))) return;
6890
+ if (!patchKeys.some((k) => restartKeys.has(k))) return;
6288
6891
  const ctx = this._ctx;
6289
6892
  if (!ctx) return;
6290
6893
  const addonId = ctx.id;
6291
6894
  setImmediate(() => {
6292
6895
  ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
6293
- ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: Object.keys(patch).filter((k) => restartKeys.has(k)) } });
6896
+ ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
6294
6897
  }).catch((err) => {
6295
6898
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
6296
6899
  });
@@ -6299,7 +6902,7 @@ var BaseAddon = class {
6299
6902
  async getDeviceSettings(deviceId) {
6300
6903
  const schema = this.deviceSettingsSchema();
6301
6904
  if (!schema) return { sections: [] };
6302
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
6905
+ return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6303
6906
  }
6304
6907
  async updateDeviceSettings(deviceId, patch) {
6305
6908
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -6429,7 +7032,7 @@ var BaseAddon = class {
6429
7032
  * selection at boot (absent scoped key ⇒ the constructor default wins).
6430
7033
  */
6431
7034
  async resolveConfig() {
6432
- const stored = await this.readAddonStoreWithRetry();
7035
+ const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
6433
7036
  const perNode = this.perNodeKeys();
6434
7037
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6435
7038
  const resolved = { ...this.defaults };
@@ -6454,7 +7057,7 @@ var BaseAddon = class {
6454
7057
  key,
6455
7058
  schema,
6456
7059
  fallback,
6457
- read: () => this.readAddonStoreWithRetry(),
7060
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
6458
7061
  write: async (patch) => {
6459
7062
  await this._ctx?.settings?.writeAddonStore(patch);
6460
7063
  },
@@ -6471,7 +7074,7 @@ var BaseAddon = class {
6471
7074
  key,
6472
7075
  schema,
6473
7076
  fallback,
6474
- read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
7077
+ read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
6475
7078
  write: async (patch) => {
6476
7079
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
6477
7080
  },
@@ -6483,6 +7086,70 @@ var BaseAddon = class {
6483
7086
  } })
6484
7087
  });
6485
7088
  }
7089
+ /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
7090
+ addonSecretTree() {
7091
+ this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
7092
+ return this._addonSecretTree;
7093
+ }
7094
+ deviceSecretTree() {
7095
+ this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7096
+ return this._deviceSecretTree;
7097
+ }
7098
+ /**
7099
+ * Secrets of this addon's stored config that could not be resolved on the
7100
+ * last read, with why. Non-empty means the addon is running WITHOUT them —
7101
+ * an addon whose function needs one should report itself degraded rather
7102
+ * than start on an empty credential.
7103
+ */
7104
+ get unresolvedSecrets() {
7105
+ return this._unresolvedSecrets;
7106
+ }
7107
+ /**
7108
+ * Substitute every keychain marker in a stored blob with its value. With no
7109
+ * keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
7110
+ * An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
7111
+ * value — and, when the cause can pass, retried with backoff. Nothing is
7112
+ * ever written back from here.
7113
+ */
7114
+ async resolveStoredSecrets(blob, trackForConfig = true) {
7115
+ const secrets = this._ctx?.secrets;
7116
+ if (secrets === void 0) return blob;
7117
+ const refs = collectSecretMarkerRefs(blob);
7118
+ if (trackForConfig) this._configSecretRefs = new Set(refs);
7119
+ if (refs.length === 0) {
7120
+ if (trackForConfig) this._unresolvedSecrets = [];
7121
+ return blob;
7122
+ }
7123
+ const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
7124
+ if (trackForConfig) {
7125
+ this._unresolvedSecrets = unresolved;
7126
+ if (unresolved.length > 0) {
7127
+ this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
7128
+ ref: u.ref,
7129
+ reason: u.reason
7130
+ })) } });
7131
+ if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
7132
+ this.scheduleSecretReresolve(this._secretRetryDelayMs);
7133
+ this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
7134
+ }
7135
+ } else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
7136
+ }
7137
+ return value;
7138
+ }
7139
+ /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7140
+ scheduleSecretReresolve(delayMs) {
7141
+ const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
7142
+ if (this[timerOf] !== null) return;
7143
+ const timer = setTimeout(() => {
7144
+ this[timerOf] = null;
7145
+ if (this._ctx === null) return;
7146
+ this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
7147
+ this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
7148
+ });
7149
+ }, delayMs);
7150
+ timer.unref?.();
7151
+ this[timerOf] = timer;
7152
+ }
6486
7153
  /**
6487
7154
  * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
6488
7155
  * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
@@ -7058,6 +7725,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
7058
7725
  kind: "mutation",
7059
7726
  auth: "admin"
7060
7727
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
7728
+ function defOf(schema) {
7729
+ return schema._zod?.def ?? {};
7730
+ }
7731
+ function declaredHere(schema) {
7732
+ return globalRegistry.get(schema)?.secret === true;
7733
+ }
7734
+ /** Wrapper kinds whose `innerType` is the field itself. */
7735
+ var WRAPPERS = new Set([
7736
+ "optional",
7737
+ "nullable",
7738
+ "default",
7739
+ "prefault",
7740
+ "catch",
7741
+ "readonly",
7742
+ "nonoptional"
7743
+ ]);
7744
+ /**
7745
+ * The schema layers that make up ONE field: the schema itself and every
7746
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
7747
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
7748
+ * `.transform` on `in`).
7749
+ */
7750
+ function layersOf(schema) {
7751
+ const out = [];
7752
+ const queue = [schema];
7753
+ while (queue.length > 0) {
7754
+ const s = queue.shift();
7755
+ if (!s || out.includes(s)) continue;
7756
+ out.push(s);
7757
+ const def = defOf(s);
7758
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
7759
+ if (def.type === "pipe") {
7760
+ if (def.in) queue.push(def.in);
7761
+ if (def.out) queue.push(def.out);
7762
+ }
7763
+ }
7764
+ return out;
7765
+ }
7766
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
7767
+ function isZodSecret(schema) {
7768
+ return layersOf(schema).some(declaredHere);
7769
+ }
7770
+ /**
7771
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
7772
+ * element of this array" (`connection.password`, `rows[].token`). A declared
7773
+ * object or array is reported as one path and not descended into — everything
7774
+ * under it is secret.
7775
+ */
7776
+ function collectZodSecretPaths(schema, prefix = "") {
7777
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
7778
+ const paths = [];
7779
+ for (const layer of layersOf(schema)) {
7780
+ const def = defOf(layer);
7781
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
7782
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
7783
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
7784
+ else if (def.type === "intersection") {
7785
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
7786
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
7787
+ }
7788
+ }
7789
+ return [...new Set(paths)];
7790
+ }
7061
7791
  //#endregion
7062
7792
  //#region ../types/dist/err-msg-DX6i_MY4.mjs
7063
7793
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
@@ -14137,6 +14867,196 @@ id: union([string$2(), number()]) }), {
14137
14867
  kind: "mutation",
14138
14868
  auth: "admin"
14139
14869
  });
14870
+ /**
14871
+ * `keychain` — the hub's encrypted store of secret values (D787).
14872
+ *
14873
+ * Settings blobs never hold a secret: they hold a marker
14874
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
14875
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
14876
+ * is the OWNER's door to its own values: every method is owner-checked
14877
+ * against the CALLER, never against anything the caller claims.
14878
+ *
14879
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
14880
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
14881
+ * connection, the agent from its child's connection carried in
14882
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
14883
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
14884
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
14885
+ * identity against BUGS and misrouting, not against a malicious addon (every
14886
+ * runner is the same OS user): see the threat model in
14887
+ * `docs/design/2026-10-08-secrets-keychain.md`.
14888
+ *
14889
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
14890
+ * parses the input, so a session can never supply it, and the internal mount
14891
+ * floors every method to admin anyway (D240).
14892
+ *
14893
+ * Internal: addons reach it through `ctx.secrets`, never directly.
14894
+ */
14895
+ /** Why a value cannot be served right now. Never folded into "missing". */
14896
+ var KeychainUnavailableReasonSchema = _enum([
14897
+ "key-missing",
14898
+ "wrong-key",
14899
+ "key-file-unreadable",
14900
+ "store-unavailable",
14901
+ "not-initialized",
14902
+ "decrypt-failed"
14903
+ ]);
14904
+ var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
14905
+ state: literal("locked"),
14906
+ reason: KeychainUnavailableReasonSchema
14907
+ })]);
14908
+ var KeychainResolveEntrySchema = discriminatedUnion("kind", [
14909
+ object({
14910
+ kind: literal("value"),
14911
+ value: string$2(),
14912
+ version: number().int()
14913
+ }),
14914
+ object({ kind: literal("missing") }),
14915
+ object({
14916
+ kind: literal("unavailable"),
14917
+ reason: KeychainUnavailableReasonSchema
14918
+ }),
14919
+ object({ kind: literal("forbidden") })
14920
+ ]);
14921
+ var KeychainResolveResultSchema = record(string$2(), KeychainResolveEntrySchema);
14922
+ /** Metadata of one stored value — never the value. */
14923
+ var KeychainSecretMetaSchema = object({
14924
+ ref: string$2(),
14925
+ owner: string$2(),
14926
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
14927
+ scope: string$2(),
14928
+ fieldPath: string$2(),
14929
+ version: number().int(),
14930
+ createdAt: number(),
14931
+ updatedAt: number(),
14932
+ /** `addon:<id>` | `user:<id>` | `system`. */
14933
+ updatedBy: string$2(),
14934
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
14935
+ lastReadAt: number().nullable()
14936
+ });
14937
+ var RefListSchema = array(string$2().min(1)).max(512);
14938
+ method(object({
14939
+ ref: string$2().min(1),
14940
+ value: string$2().min(1)
14941
+ }), object({
14942
+ ref: string$2(),
14943
+ version: number().int()
14944
+ }), {
14945
+ kind: "mutation",
14946
+ auth: "admin"
14947
+ }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
14948
+ kind: "mutation",
14949
+ auth: "admin"
14950
+ }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
14951
+ var KeychainKeySourceSchema = object({
14952
+ kind: _enum([
14953
+ "config-file",
14954
+ "previous-config-file",
14955
+ "platform",
14956
+ "default-file"
14957
+ ]),
14958
+ /** File sources only — a path is not a secret. */
14959
+ path: string$2().optional(),
14960
+ /**
14961
+ * True when a whole-volume backup of the data directory carries this key
14962
+ * next to the database it protects (the default file). The page warns.
14963
+ */
14964
+ sharesBackupWithDatabase: boolean()
14965
+ });
14966
+ var KeychainStatusSchema = object({
14967
+ keychain: KeychainStateSchema,
14968
+ /** The source of the master key in use; `null` while locked. */
14969
+ keySource: KeychainKeySourceSchema.nullable(),
14970
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
14971
+ configuredSource: KeychainKeySourceSchema,
14972
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
14973
+ fingerprint: string$2().nullable(),
14974
+ activeKeyId: string$2().nullable(),
14975
+ /**
14976
+ * The keychain unlocked with a NON-primary source: the configured primary
14977
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
14978
+ */
14979
+ rotationPending: boolean(),
14980
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
14981
+ retiredWraps: number().int(),
14982
+ recoveryKeyDownloadedAt: number().nullable(),
14983
+ secretCount: number().int()
14984
+ });
14985
+ /**
14986
+ * Whether a stored value is still pointed at by its owner's settings.
14987
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
14988
+ * never reported as an orphan (and never deleted as one).
14989
+ */
14990
+ var KeychainSecretUsageSchema = _enum([
14991
+ "in-use",
14992
+ "orphan",
14993
+ "unknown"
14994
+ ]);
14995
+ var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
14996
+ var KeychainAuditActionSchema = _enum([
14997
+ "put",
14998
+ "delete",
14999
+ "reveal",
15000
+ "rotate-master-key",
15001
+ "purge-retired-keys",
15002
+ "download-recovery-key",
15003
+ "delete-orphans",
15004
+ "reset",
15005
+ "initialize"
15006
+ ]);
15007
+ var KeychainAuditEntrySchema = object({
15008
+ id: string$2(),
15009
+ at: number(),
15010
+ action: KeychainAuditActionSchema,
15011
+ /** `addon:<id>` | `user:<id>` | `system`. */
15012
+ actor: string$2(),
15013
+ ref: string$2().nullable(),
15014
+ detail: string$2().nullable()
15015
+ });
15016
+ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}), array(KeychainAdminSecretSchema).readonly(), { auth: "admin" }), method(object({ limit: number().int().min(1).max(500).optional() }), array(KeychainAuditEntrySchema).readonly(), { auth: "admin" }), method(object({ ref: string$2().min(1) }), object({
15017
+ value: string$2(),
15018
+ version: number().int()
15019
+ }), {
15020
+ kind: "mutation",
15021
+ auth: "admin",
15022
+ caller: "required"
15023
+ }), method(object({ refs: array(string$2().min(1)).max(1e3) }), object({
15024
+ deleted: array(string$2()).readonly(),
15025
+ kept: array(object({
15026
+ ref: string$2(),
15027
+ usage: KeychainSecretUsageSchema
15028
+ })).readonly()
15029
+ }), {
15030
+ kind: "mutation",
15031
+ auth: "admin",
15032
+ caller: "required"
15033
+ }), method(object({}), object({
15034
+ fingerprint: string$2(),
15035
+ keySource: KeychainKeySourceSchema
15036
+ }), {
15037
+ kind: "mutation",
15038
+ auth: "admin",
15039
+ caller: "required"
15040
+ }), method(object({}), object({ purged: number().int() }), {
15041
+ kind: "mutation",
15042
+ auth: "admin",
15043
+ caller: "required"
15044
+ }), method(object({}), object({
15045
+ key: string$2(),
15046
+ fingerprint: string$2(),
15047
+ keySource: KeychainKeySourceSchema
15048
+ }), {
15049
+ kind: "mutation",
15050
+ auth: "admin",
15051
+ caller: "required"
15052
+ }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15053
+ archivedCollection: string$2().nullable(),
15054
+ archived: number().int()
15055
+ }), {
15056
+ kind: "mutation",
15057
+ auth: "admin",
15058
+ caller: "required"
15059
+ });
14140
15060
  method(_void(), object({
14141
15061
  id: string$2(),
14142
15062
  name: string$2(),
@@ -15159,6 +16079,10 @@ var DeviceInfoSchema = object({
15159
16079
  isCamera: boolean(),
15160
16080
  /** Current config values — serializable snapshot */
15161
16081
  config: record(string$2(), unknown()),
16082
+ /** Paths inside `config` the device's schema declares secret (D783) —
16083
+ * what the non-admin redaction withholds. Paths, never values. Absent
16084
+ * when the owning runner has not reported them. */
16085
+ secretConfigPaths: array(string$2()).optional(),
15162
16086
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
15163
16087
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
15164
16088
  metadata: record(string$2(), unknown()).nullable().optional(),
@@ -15364,12 +16288,22 @@ var DeviceRegisterPayloadSchema = object({
15364
16288
  * call (workers re-register on init), so probe-driven updates
15365
16289
  * (e.g. PTZ flag flipping after the abilities probe) propagate. */
15366
16290
  features: array(string$2()).optional(),
15367
- config: record(string$2(), unknown())
16291
+ config: record(string$2(), unknown()),
16292
+ /** Config paths the device's own schema DECLARES secret
16293
+ * (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
16294
+ * `connection.password`). Re-published on every register; the non-admin
16295
+ * redaction withholds them at any depth (D783). Optional: an older runner
16296
+ * omits it and the keyword backstop applies. */
16297
+ secretConfigPaths: array(string$2()).optional()
15368
16298
  });
15369
16299
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
15370
16300
  var DevicePersistConfigPayloadSchema = object({
15371
16301
  deviceId: number(),
15372
- data: record(string$2(), unknown())
16302
+ data: record(string$2(), unknown()),
16303
+ /** The paths the device's schema declares secret (D783), when the caller
16304
+ * knows them — those values are kept in the keychain, not the blob (D787).
16305
+ * Absent: the paths the device last reported at `registerDevice` apply. */
16306
+ secretConfigPaths: array(string$2()).optional()
15373
16307
  });
15374
16308
  /** What a migration actually did, per switch. `unreachable` is a first-class
15375
16309
  * answer: a camera that could not be asked is not a camera that was silenced. */
@@ -17023,7 +17957,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17023
17957
  icon: string$2().optional(),
17024
17958
  /** Addon-owned HTTP route the button navigates to (GET). */
17025
17959
  startUrl: string$2(),
17026
- stage: LoginStageEnum
17960
+ stage: LoginStageEnum,
17961
+ /**
17962
+ * The provider names an external identity a signed-in user can link to
17963
+ * their own account (D782): `auth.listLinkableProviders` /
17964
+ * `beginExternalLink` offer exactly the redirect methods that set this,
17965
+ * whatever their id. Absent / false — a login button only (magic-link).
17966
+ */
17967
+ linkable: boolean().optional()
17027
17968
  }),
17028
17969
  object({
17029
17970
  kind: literal("widget"),
@@ -22379,8 +23320,23 @@ var RetrainMacroClassSchema = _enum([
22379
23320
  ]);
22380
23321
  /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
22381
23322
  var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
22382
- /** Did a human draw this box, or did the assist propose it? */
22383
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
23323
+ /**
23324
+ * Where a box came from. A machine-sourced box is a DRAFT on the page until
23325
+ * the operator confirms it; once saved it keeps its source as provenance.
23326
+ *
23327
+ * - `operator` — drawn by hand.
23328
+ * - `assist` — proposed by a detector run on the copy (the camera's own
23329
+ * model, or a larger teacher model).
23330
+ * - `pipeline` — the box the live pipeline actually drew on that frame, read
23331
+ * back from the track store (never a re-run).
23332
+ * - `llm` — proposed by a vision-capable LLM profile.
23333
+ */
23334
+ var RetrainAnnotationSourceSchema = _enum([
23335
+ "operator",
23336
+ "assist",
23337
+ "pipeline",
23338
+ "llm"
23339
+ ]);
22384
23340
  /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
22385
23341
  var RetrainBboxSchema = object({
22386
23342
  x: number(),
@@ -22398,7 +23354,8 @@ var RetrainBboxSchema = object({
22398
23354
  */
22399
23355
  var RetrainAnnotationSchema = object({
22400
23356
  id: string$2(),
22401
- trackId: string$2(),
23357
+ /** The frame's track. Absent on a recording still, which has none. */
23358
+ trackId: string$2().optional(),
22402
23359
  deviceId: number(),
22403
23360
  /** The COPY in retrain storage — never the source track's media key. */
22404
23361
  mediaKey: string$2(),
@@ -22447,18 +23404,63 @@ var RetrainFrameCandidateSchema = object({
22447
23404
  * fail, whatever became of the original. */
22448
23405
  copied: boolean()
22449
23406
  });
23407
+ /**
23408
+ * One box the live pipeline drew on a copied frame — what a correction starts
23409
+ * from. Derived when the frame is listed, from the track store: the subject
23410
+ * box recorded on the source media row when there is one, else the track
23411
+ * position nearest the frame's capture time. Never stored as an annotation
23412
+ * until the operator confirms it.
23413
+ */
23414
+ var RetrainPipelineBoxSchema = object({
23415
+ /** Normalised `[0,1]` against the full frame. */
23416
+ bbox: RetrainBboxSchema,
23417
+ macroClass: RetrainMacroClassSchema,
23418
+ label: string$2().optional(),
23419
+ subLabel: string$2().optional(),
23420
+ /** The detection score of the position used, when it was recorded. */
23421
+ score: number().optional(),
23422
+ /** The root model that produced the track, when it was recorded. */
23423
+ modelId: string$2().optional(),
23424
+ trackId: string$2(),
23425
+ /** `subject-box`: recorded on this very frame. `position`: the track's
23426
+ * position nearest the capture time, `deltaMs` away. */
23427
+ basis: _enum(["subject-box", "position"]),
23428
+ deltaMs: number()
23429
+ });
23430
+ /**
23431
+ * Where a retrain frame came from: a TRACK's stored media (copy-on-select),
23432
+ * or the RECORDING at an instant — the frame a model saw nothing in has no
23433
+ * track at all.
23434
+ */
23435
+ var RetrainFrameOriginSchema = _enum(["track", "recording"]);
22450
23436
  /** A frame the dataset OWNS: bytes copied at selection time. */
22451
23437
  var RetrainFrameSchema = object({
22452
23438
  frameId: string$2(),
22453
23439
  deviceId: number(),
22454
- trackId: string$2(),
22455
- /** Provenance only. It may already point at nothing — that is expected. */
22456
- sourceMediaId: number().int(),
23440
+ origin: RetrainFrameOriginSchema,
23441
+ /** The track it was copied from. Absent on a recording still. */
23442
+ trackId: string$2().optional(),
23443
+ /** Provenance only. It may already point at nothing — that is expected.
23444
+ * Absent on a recording still. */
23445
+ sourceMediaId: number().int().optional(),
23446
+ /** A recording still: the playhead instant it was taken at. */
23447
+ epochMs: number().optional(),
22457
23448
  sourceKind: MediaFileKindEnum,
22458
23449
  sizeBytes: number().int(),
22459
23450
  width: number().int(),
22460
23451
  height: number().int(),
22461
- copiedAt: number()
23452
+ copiedAt: number(),
23453
+ /** When the CAMERA captured the frame. Absent on a copy taken before D785. */
23454
+ capturedAt: number().optional(),
23455
+ /** The operator's "every subject in this frame is boxed". Detector
23456
+ * evaluation keeps only complete frames: an unboxed subject would count as
23457
+ * a false positive. */
23458
+ complete: boolean(),
23459
+ /** The boxes the pipeline drew on this frame. Present on list answers;
23460
+ * empty when nothing the track store holds can be placed on it. */
23461
+ pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
23462
+ /** The named collections this frame belongs to. Present on list answers. */
23463
+ collectionIds: array(string$2()).readonly().optional()
22462
23464
  });
22463
23465
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
22464
23466
  var RetrainCopyRefusalSchema = _enum([
@@ -22479,6 +23481,53 @@ var RetrainFrameListSchema = object({
22479
23481
  /** What the page pre-selects — the native key frame when one survives. */
22480
23482
  autoPickMediaId: number().int().optional()
22481
23483
  });
23484
+ /**
23485
+ * Which frames an annotated export carries. Every field narrows; an empty
23486
+ * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23487
+ * list owned by whoever trains (the training orchestrator), so `frameIds` is
23488
+ * the primitive a version export uses; `batchId` re-selects what an earlier
23489
+ * export carried (`exportedInBatch`).
23490
+ */
23491
+ var RetrainExportFilterSchema = object({
23492
+ deviceIds: array(number()).optional(),
23493
+ frameIds: array(string$2()).max(2e4).optional(),
23494
+ /** Only frames in at least one of these named collections. */
23495
+ collectionIds: array(string$2()).max(200).optional(),
23496
+ batchId: string$2().optional(),
23497
+ /** Only frames the operator marked complete (all subjects boxed). */
23498
+ completeOnly: boolean().optional()
23499
+ });
23500
+ /**
23501
+ * `frames`: the full frame copies, boxes in `annotations.json`.
23502
+ * `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
23503
+ * convention — the classifier layout.
23504
+ */
23505
+ var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
23506
+ /**
23507
+ * Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
23508
+ * the archive, sent chunk by chunk. Covers a presigned PUT and a provider
23509
+ * addon's data-plane upload route alike. Headers are sent verbatim and never
23510
+ * logged.
23511
+ */
23512
+ var RetrainArchiveTargetSchema = object({
23513
+ kind: literal("http"),
23514
+ method: _enum(["PUT", "POST"]),
23515
+ url: string$2().url(),
23516
+ headers: record(string$2(), string$2()).optional()
23517
+ });
23518
+ var RetrainArchiveResultSchema = object({
23519
+ batchId: string$2(),
23520
+ frames: number().int(),
23521
+ crops: number().int(),
23522
+ annotations: number().int(),
23523
+ /** Frames planned but not shipped (unreadable copy, path too long). */
23524
+ missing: number().int(),
23525
+ bytes: number().int(),
23526
+ /** sha256 of the exact bytes sent. */
23527
+ sha256: string$2(),
23528
+ /** The target's HTTP status. */
23529
+ status: number().int()
23530
+ });
22482
23531
  /** What the operator asked the assist to look for. */
22483
23532
  var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
22484
23533
  kind: literal("package"),
@@ -22508,6 +23557,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
22508
23557
  reason: string$2(),
22509
23558
  detail: string$2().optional()
22510
23559
  })]);
23560
+ /** A named set over the retrain corpus — membership only, it owns no pixels. */
23561
+ var RetrainCollectionSchema = object({
23562
+ id: string$2(),
23563
+ name: string$2(),
23564
+ createdAt: number(),
23565
+ frameCount: number().int()
23566
+ });
23567
+ var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
23568
+ kind: literal("created"),
23569
+ collection: RetrainCollectionSchema
23570
+ }), object({
23571
+ kind: literal("refused"),
23572
+ reason: _enum(["empty-name", "duplicate-name"])
23573
+ })]);
23574
+ var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
23575
+ kind: literal("renamed"),
23576
+ collection: RetrainCollectionSchema
23577
+ }), object({
23578
+ kind: literal("refused"),
23579
+ reason: _enum([
23580
+ "empty-name",
23581
+ "duplicate-name",
23582
+ "unknown-collection"
23583
+ ])
23584
+ })]);
23585
+ /**
23586
+ * The outcome of adding the frame at a recording instant. Every refusal is
23587
+ * named: `still-unavailable` (not recording, a gap, or an undecodable frame —
23588
+ * `detail` says which), `still-busy` (the recorder is at its decode bound; try
23589
+ * again), `unreadable-image`, `write-failed`, `unknown-collection`.
23590
+ */
23591
+ var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
23592
+ kind: literal("added"),
23593
+ collectionId: string$2(),
23594
+ frame: RetrainFrameSchema,
23595
+ /** The moment was already in the dataset; nothing was decoded. */
23596
+ reused: boolean()
23597
+ }), object({
23598
+ kind: literal("refused"),
23599
+ reason: _enum([
23600
+ "unknown-collection",
23601
+ "still-unavailable",
23602
+ "still-busy",
23603
+ "unreadable-image",
23604
+ "write-failed"
23605
+ ]),
23606
+ detail: string$2().optional()
23607
+ })]);
23608
+ /** A vision LLM profile the AI assist may use, and where it sends the frame. */
23609
+ var RetrainAssistProfileSchema = object({
23610
+ id: string$2(),
23611
+ name: string$2(),
23612
+ model: string$2(),
23613
+ kind: string$2(),
23614
+ /** `true` when the frame would leave the house (a cloud vendor, or an
23615
+ * endpoint that is not on the local network). The page confirms each such
23616
+ * run, and the provider refuses one without `allowCloud`. */
23617
+ leavesHouse: boolean()
23618
+ });
23619
+ /** A box the AI assist proposed: a draft, plus the model's own reason. */
23620
+ var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string$2() });
23621
+ /** What the AI assist said about a box that was already on the canvas. */
23622
+ var RetrainLlmReviewSchema = object({
23623
+ /** The `ref` the page sent the box under. */
23624
+ ref: string$2(),
23625
+ verdict: _enum([
23626
+ "confirmed",
23627
+ "wrong-class",
23628
+ "not-an-object",
23629
+ "uncertain"
23630
+ ]),
23631
+ suggestedClass: RetrainMacroClassSchema.optional(),
23632
+ reason: string$2()
23633
+ });
23634
+ /**
23635
+ * The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
23636
+ * model and its confidence) and reviews; items the model got wrong (a box off
23637
+ * the frame, an unasked class, an unknown ref) are dropped and counted in
23638
+ * `rejected`. A whole answer that is not the schema is `malformed-answer`.
23639
+ */
23640
+ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23641
+ kind: literal("proposed"),
23642
+ profileId: string$2(),
23643
+ model: string$2(),
23644
+ /** The frame was sent outside the house for this answer. */
23645
+ leftHouse: boolean(),
23646
+ proposals: array(RetrainLlmProposalSchema).readonly(),
23647
+ reviews: array(RetrainLlmReviewSchema).readonly(),
23648
+ rejected: number().int()
23649
+ }), object({
23650
+ kind: literal("refused"),
23651
+ reason: _enum([
23652
+ "unknown-frame",
23653
+ "unreadable-frame",
23654
+ "unknown-profile",
23655
+ "profile-disabled",
23656
+ "no-vision",
23657
+ "cloud-not-confirmed",
23658
+ "llm-error",
23659
+ "malformed-answer"
23660
+ ]),
23661
+ detail: string$2().optional()
23662
+ })]);
22511
23663
  /** The outcome of a lifecycle move owned by the retrain page. */
22512
23664
  var RetrainTransitionResultSchema = object({
22513
23665
  trackId: string$2(),
@@ -23225,7 +24377,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23225
24377
  auth: "admin"
23226
24378
  }), method(object({
23227
24379
  deviceId: number(),
23228
- trackId: string$2(),
24380
+ trackId: string$2().optional(),
23229
24381
  frameId: string$2()
23230
24382
  }), object({
23231
24383
  removed: boolean(),
@@ -23242,7 +24394,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23242
24394
  auth: "admin"
23243
24395
  }), method(object({
23244
24396
  deviceId: number(),
23245
- trackId: string$2(),
24397
+ /** The frame's track, when it has one — checked against the frame. */
24398
+ trackId: string$2().optional(),
23246
24399
  frameId: string$2(),
23247
24400
  subject: RetrainAssistSubjectSchema,
23248
24401
  /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
@@ -23250,12 +24403,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23250
24403
  }), RetrainAssistResultSchema, {
23251
24404
  kind: "mutation",
23252
24405
  auth: "admin"
23253
- }), method(object({ trackId: string$2() }), array(RetrainAnnotationSchema).readonly(), {
24406
+ }), method(object({
24407
+ trackId: string$2().optional(),
24408
+ frameIds: array(string$2()).max(2e3).optional()
24409
+ }), array(RetrainAnnotationSchema).readonly(), {
23254
24410
  kind: "query",
23255
24411
  auth: "admin"
23256
24412
  }), method(object({
23257
24413
  deviceId: number(),
23258
- trackId: string$2(),
24414
+ /** The frame's track, when it has one — checked against the frame. */
24415
+ trackId: string$2().optional(),
23259
24416
  frameId: string$2(),
23260
24417
  annotations: array(RetrainAnnotationDraftSchema)
23261
24418
  }), array(RetrainAnnotationSchema).readonly(), {
@@ -23273,7 +24430,91 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23273
24430
  }), RetrainTransitionResultSchema, {
23274
24431
  kind: "mutation",
23275
24432
  auth: "admin"
23276
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string$2() }), {
24433
+ }), method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string$2() }), {
24434
+ kind: "query",
24435
+ auth: "admin"
24436
+ }), method(object({
24437
+ deviceId: number(),
24438
+ trackId: string$2().optional(),
24439
+ frameId: string$2(),
24440
+ complete: boolean()
24441
+ }), RetrainFrameSchema, {
24442
+ kind: "mutation",
24443
+ auth: "admin"
24444
+ }), method(object({
24445
+ filter: RetrainExportFilterSchema,
24446
+ layout: RetrainExportLayoutSchema,
24447
+ target: RetrainArchiveTargetSchema
24448
+ }), RetrainArchiveResultSchema, {
24449
+ kind: "mutation",
24450
+ auth: "admin",
24451
+ timeoutMs: 60 * 6e4
24452
+ }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24453
+ kind: "query",
24454
+ auth: "admin"
24455
+ }), method(object({
24456
+ deviceId: number(),
24457
+ trackId: string$2().optional(),
24458
+ frameId: string$2(),
24459
+ profileId: string$2(),
24460
+ classes: array(RetrainMacroClassSchema).min(1),
24461
+ boxes: array(object({
24462
+ ref: string$2(),
24463
+ bbox: RetrainBboxSchema,
24464
+ macroClass: RetrainMacroClassSchema,
24465
+ label: string$2().optional()
24466
+ })).max(50),
24467
+ allowCloud: boolean()
24468
+ }), RetrainLlmAssistResultSchema, {
24469
+ kind: "mutation",
24470
+ auth: "admin",
24471
+ timeoutMs: 18e4
24472
+ }), method(object({ name: string$2().max(120) }), RetrainCollectionCreateResultSchema, {
24473
+ kind: "mutation",
24474
+ auth: "admin"
24475
+ }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24476
+ kind: "query",
24477
+ auth: "admin"
24478
+ }), method(object({
24479
+ id: string$2(),
24480
+ name: string$2().max(120)
24481
+ }), RetrainCollectionRenameResultSchema, {
24482
+ kind: "mutation",
24483
+ auth: "admin"
24484
+ }), method(object({ id: string$2() }), object({
24485
+ deleted: boolean(),
24486
+ removedFrames: number().int()
24487
+ }), {
24488
+ kind: "mutation",
24489
+ auth: "admin"
24490
+ }), method(object({
24491
+ collectionId: string$2(),
24492
+ deviceId: number(),
24493
+ epochMs: number()
24494
+ }), AddRetrainFrameFromRecordingResultSchema, {
24495
+ kind: "mutation",
24496
+ auth: "admin",
24497
+ timeoutMs: 6e4
24498
+ }), method(object({
24499
+ collectionId: string$2(),
24500
+ frameIds: array(string$2()).min(1).max(500)
24501
+ }), object({
24502
+ added: number().int(),
24503
+ alreadyMember: number().int(),
24504
+ unknownFrameIds: array(string$2()).readonly()
24505
+ }), {
24506
+ kind: "mutation",
24507
+ auth: "admin"
24508
+ }), method(object({
24509
+ collectionId: string$2(),
24510
+ frameId: string$2()
24511
+ }), object({
24512
+ removed: boolean(),
24513
+ deletedFrame: boolean()
24514
+ }), {
24515
+ kind: "mutation",
24516
+ auth: "admin"
24517
+ }), method(object({ collectionId: string$2() }), array(RetrainFrameSchema).readonly(), {
23277
24518
  kind: "query",
23278
24519
  auth: "admin"
23279
24520
  }), method(object({
@@ -23899,13 +25140,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
23899
25140
  object({
23900
25141
  kind: literal("no-family-build"),
23901
25142
  format: ModelFormatSchema$1
25143
+ }),
25144
+ object({
25145
+ kind: literal("kept-custom-pin"),
25146
+ modelId: string$2(),
25147
+ deviceKey: string$2()
23902
25148
  })
23903
25149
  ]);
25150
+ /** Why a device is left exactly as it is, whatever the plan would pick (D786). */
25151
+ var KeptReasonSchema = _enum(["custom-pin"]);
25152
+ /**
25153
+ * Where a choice's latency came from (D791): this node's own benchmark
25154
+ * result, or the hardware-class table. Measured on the node beats the table.
25155
+ */
25156
+ var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
25157
+ kind: literal("node-benchmark"),
25158
+ resultId: string$2(),
25159
+ measuredAtMs: number()
25160
+ })]);
23904
25161
  var DeviceModelChoiceSchema = object({
23905
25162
  modelId: string$2(),
23906
25163
  p50Ms: number(),
23907
25164
  fps: number(),
23908
25165
  measured: boolean(),
25166
+ /** Absent on a plan from before D791 — read as the table. */
25167
+ source: LatencySourceSchema.optional(),
23909
25168
  /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
23910
25169
  capacitySessions: number(),
23911
25170
  personRecall: number()
@@ -23916,6 +25175,8 @@ var DeviceRecommendationSchema = object({
23916
25175
  enabled: boolean(),
23917
25176
  available: boolean(),
23918
25177
  chosen: DeviceModelChoiceSchema.nullable(),
25178
+ /** Present when the device is kept as is: Apply writes nothing on it. */
25179
+ kept: KeptReasonSchema.optional(),
23919
25180
  reasons: array(RecommendationReasonSchema).readonly()
23920
25181
  });
23921
25182
  var NodeRecommendationSchema = object({
@@ -23969,6 +25230,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
23969
25230
  kind: literal("coral-enabled"),
23970
25231
  nodeId: string$2(),
23971
25232
  deviceKey: string$2()
25233
+ }),
25234
+ object({
25235
+ kind: literal("custom-pin-kept"),
25236
+ nodeId: string$2(),
25237
+ deviceKey: string$2().nullable(),
25238
+ deviceId: number().nullable(),
25239
+ modelId: string$2()
25240
+ }),
25241
+ object({
25242
+ kind: literal("custom-registry-unreadable"),
25243
+ error: string$2()
23972
25244
  })
23973
25245
  ]);
23974
25246
  var AutoTuneOptionsSchema = object({
@@ -24147,13 +25419,14 @@ var SuggestSharesResultSchema = object({
24147
25419
  nodes: array(SuggestedNodeShareSchema).readonly()
24148
25420
  });
24149
25421
  /**
24150
- * Where the node and device shares come from (D750, D755).
24151
- * - `hardware` (default) — computed by the system from each node's static
24152
- * capacity (its accelerators at their Auto tune models, from the measured
24153
- * latency table), recomputed whenever a node or device joins, leaves, is
24154
- * switched on or off, or changes model. No load input.
24155
- * - `benchmark` — the same, from each node's measured capacity (node
24156
- * benchmark results); a node without results falls back to `hardware`.
25422
+ * Where the node and device shares come from (D750, D755, D791).
25423
+ * - `benchmark` (default since D791) — each node's capacity as its own node
25424
+ * benchmark measured it; a node without fresh results is sized from
25425
+ * `hardware` and says so. Measured on the node beats the table.
25426
+ * - `hardware` — computed from each node's static capacity only (its
25427
+ * accelerators at their Auto tune models, from the latency table).
25428
+ * Both are recomputed whenever a node or device joins, leaves, is switched
25429
+ * on or off, changes model, or a benchmark result is written. No load input.
24157
25430
  * - `manual` — the operator's stored sliders.
24158
25431
  * Either way a node or device that cannot take sessions gives its share to
24159
25432
  * the others in proportion; the stored values are never rewritten for that.
@@ -24202,6 +25475,362 @@ var EffectiveSharesSchema = object({
24202
25475
  nodeWeights: record(string$2(), number()),
24203
25476
  deviceWeights: record(string$2(), record(string$2(), number()))
24204
25477
  });
25478
+ /**
25479
+ * Wire shapes of the node benchmark (D791): the operator's plan, the
25480
+ * preflight the confirmation shows, the run the orchestrator owns, what the
25481
+ * measuring runner reports, and the result rows Auto tune and the automatic
25482
+ * shares read.
25483
+ *
25484
+ * ONE node at a time, owned by the pipeline orchestrator. While a run is
25485
+ * active the cluster is in BENCHMARK MODE for that node: it is not a
25486
+ * detection candidate, camera pins naming it are ignored so its sessions move
25487
+ * elsewhere, and both come back when the mode ends — after a crash or a hub
25488
+ * restart too (a persisted manifest, reconciled against the registry).
25489
+ *
25490
+ * Two measurements, both on the node, driven by its own runner (frames never
25491
+ * cross a process at frame rate, D9):
25492
+ * - `device` — one accelerator × one candidate detector, root only, open
25493
+ * loop: how many streams at the camera rate it carries inside the frame
25494
+ * interval;
25495
+ * - `pipeline` — the chosen detector plus the operator's detail steps
25496
+ * (faces, plates, classifiers, CLIP…), on varied frames from the bench
25497
+ * clip: how many parallel sessions the node carries before latency, drops,
25498
+ * CPU, RAM or the event loop give out.
25499
+ */
25500
+ /** Defaults and bounds, one place. */
25501
+ var NODE_BENCHMARK_DEFAULTS = {
25502
+ fpsPerStream: 10,
25503
+ budgetMinutes: 45,
25504
+ minBudgetMinutes: 10,
25505
+ maxBudgetMinutes: 120,
25506
+ /** A result older than this no longer beats the table. */
25507
+ staleAfterDays: 30,
25508
+ /** Warm-in per ramp step (not accounted). */
25509
+ settleSec: 5,
25510
+ /** Accounted window per ramp step. */
25511
+ measureSec: 20,
25512
+ /** Longest the drain may take before the run is refused. */
25513
+ drainTimeoutSec: 120,
25514
+ /** Candidate models per device in one run. */
25515
+ maxModelsPerDevice: 6
25516
+ };
25517
+ /** The two measurements a run can make. */
25518
+ var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
25519
+ var NodeBenchmarkDevicePlanSchema = object({
25520
+ /** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
25521
+ deviceKey: string$2().min(1),
25522
+ /**
25523
+ * Root detector candidates for the `device` measurement, in the order
25524
+ * measured. The FIRST is the one the `pipeline` measurement runs.
25525
+ */
25526
+ modelIds: array(string$2().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
25527
+ });
25528
+ /** What the operator confirmed. */
25529
+ var NodeBenchmarkPlanSchema = object({
25530
+ nodeId: string$2().min(1),
25531
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25532
+ /** Which measurements run. At least one. */
25533
+ phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
25534
+ /**
25535
+ * Detail steps (catalog step ids under the root: faces, plates,
25536
+ * classifiers, CLIP…) the `pipeline` measurement enables. The root
25537
+ * detector always runs.
25538
+ */
25539
+ steps: array(string$2().min(1)).default([]),
25540
+ /** Offered rate of one stream / session. */
25541
+ fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
25542
+ /** Hard deadline: the mode ends and the cluster is restored when it passes. */
25543
+ budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
25544
+ /** Keep the models the run downloaded (default: delete what was not installed before). */
25545
+ keepDownloadedModels: boolean().default(false),
25546
+ /** Start although the other nodes' capacity does not cover the sessions running now. */
25547
+ acceptInsufficientHeadroom: boolean().default(false)
25548
+ });
25549
+ var NodeBenchmarkRefusalSchema = object({
25550
+ kind: _enum([
25551
+ "benchmark-active",
25552
+ "node-offline",
25553
+ "unknown-device",
25554
+ "no-phase",
25555
+ "insufficient-headroom"
25556
+ ]),
25557
+ detail: string$2(),
25558
+ overridable: boolean()
25559
+ });
25560
+ /** A camera whose detection leaves the node for the run. */
25561
+ var NodeBenchmarkMovingCameraSchema = object({
25562
+ deviceId: number(),
25563
+ /** Placed on the node now (a standing attach or a running session). */
25564
+ placedOnNode: boolean(),
25565
+ /** A node pin naming this node, ignored for the run. */
25566
+ pinnedToNode: boolean()
25567
+ });
25568
+ /** A camera that cannot leave: no other node can obtain its frames. */
25569
+ var NodeBenchmarkStayingCameraSchema = object({
25570
+ deviceId: number(),
25571
+ reason: literal("only-frame-source")
25572
+ });
25573
+ var NodeBenchmarkPreflightSchema = object({
25574
+ nodeId: string$2(),
25575
+ online: boolean(),
25576
+ moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
25577
+ /** Keep running on the node during the run; the result is flagged contaminated. */
25578
+ staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
25579
+ estimatedDurationMs: number(),
25580
+ /** The run ends and the cluster is restored at the latest after this long. */
25581
+ budgetMs: number(),
25582
+ phases: array(NodeBenchmarkPhaseSchema).readonly(),
25583
+ steps: array(string$2()).readonly(),
25584
+ devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
25585
+ /** Parallel sessions the cluster runs now, and what the other nodes can carry. */
25586
+ headroom: object({
25587
+ sessionsNow: number(),
25588
+ otherNodesCapacitySessions: number().nullable()
25589
+ }),
25590
+ refusals: array(NodeBenchmarkRefusalSchema).readonly(),
25591
+ canStart: boolean()
25592
+ });
25593
+ /** Where the measuring runner is. */
25594
+ var NodeBenchProgressSchema = object({
25595
+ phase: _enum([
25596
+ "preparing",
25597
+ "device",
25598
+ "pipeline",
25599
+ "cleanup"
25600
+ ]),
25601
+ deviceKey: string$2().nullable(),
25602
+ modelId: string$2().nullable(),
25603
+ /** Streams (device) or sessions (pipeline) of the step running now. */
25604
+ load: number().nullable(),
25605
+ cellsDone: number(),
25606
+ cellsTotal: number(),
25607
+ message: string$2()
25608
+ });
25609
+ /** What limited a ramp. `none` = the ramp ran out of steps still passing. */
25610
+ var NodeBenchLimitSchema = _enum([
25611
+ "p95",
25612
+ "drops",
25613
+ "errors",
25614
+ "stall",
25615
+ "cpu",
25616
+ "ram",
25617
+ "none"
25618
+ ]);
25619
+ var NodeBenchRampStepSchema = object({
25620
+ load: number(),
25621
+ pass: boolean(),
25622
+ p95Ms: number(),
25623
+ dropRatio: number(),
25624
+ /** Completed frames per second over the accounted window. */
25625
+ fps: number(),
25626
+ cpuPct: number().nullable(),
25627
+ ramFreePct: number().nullable(),
25628
+ failReasons: array(string$2()).readonly()
25629
+ });
25630
+ var NodeBenchCellSchema = discriminatedUnion("phase", [object({
25631
+ phase: literal("device"),
25632
+ deviceKey: string$2(),
25633
+ modelId: string$2(),
25634
+ /** Single-stream latency (the K = 1 step). */
25635
+ p50Ms: number(),
25636
+ p95Ms: number(),
25637
+ p99Ms: number(),
25638
+ /** Frames per second sustained at the last passing step. */
25639
+ fps: number(),
25640
+ /** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
25641
+ kMax: number(),
25642
+ limitedBy: NodeBenchLimitSchema,
25643
+ /** First call (model load + warm-up). */
25644
+ warmupMs: number(),
25645
+ ramp: array(NodeBenchRampStepSchema).readonly()
25646
+ }), object({
25647
+ phase: literal("pipeline"),
25648
+ deviceKey: string$2(),
25649
+ modelId: string$2(),
25650
+ steps: array(string$2()).readonly(),
25651
+ /** Parallel sessions at the camera rate the node carried; 0 = not even one. */
25652
+ maxSessions: number(),
25653
+ limitedBy: NodeBenchLimitSchema,
25654
+ /** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
25655
+ stepsFired: array(string$2()).readonly(),
25656
+ warmupMs: number(),
25657
+ ramp: array(NodeBenchRampStepSchema).readonly()
25658
+ })]);
25659
+ /**
25660
+ * What a result was measured ON. A result whose fingerprint no longer matches
25661
+ * the node no longer beats the table.
25662
+ */
25663
+ var NodeBenchFingerprintSchema = object({
25664
+ pipelineVersion: string$2().nullable(),
25665
+ cpuModel: string$2().nullable(),
25666
+ ramGb: number().nullable(),
25667
+ os: string$2().nullable(),
25668
+ /** Per device: the pool the cells ran on (runtime + tuning). */
25669
+ pools: record(string$2(), object({
25670
+ runtime: string$2(),
25671
+ numWorkers: number(),
25672
+ concurrency: number(),
25673
+ batchMode: string$2()
25674
+ })).default({})
25675
+ });
25676
+ /** The frames the run used. */
25677
+ var NodeBenchClipSchema = object({
25678
+ /** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
25679
+ id: string$2(),
25680
+ revision: string$2().nullable(),
25681
+ frames: number(),
25682
+ width: number(),
25683
+ height: number()
25684
+ });
25685
+ var NodeBenchRunnerInputSchema = object({
25686
+ runId: string$2().min(1),
25687
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25688
+ phases: array(NodeBenchmarkPhaseSchema).min(1),
25689
+ /** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
25690
+ steps: array(string$2()).default([]),
25691
+ fpsPerStream: number().int().min(1).max(30),
25692
+ /** The runner stops on its own past this instant, whatever the hub does. */
25693
+ deadlineAtMs: number(),
25694
+ settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
25695
+ measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
25696
+ keepDownloadedModels: boolean().default(false)
25697
+ });
25698
+ var NodeBenchRunnerStateSchema = _enum([
25699
+ "running",
25700
+ "done",
25701
+ "failed",
25702
+ "aborted"
25703
+ ]);
25704
+ var NodeBenchRunnerStatusSchema = object({
25705
+ runId: string$2(),
25706
+ nodeId: string$2(),
25707
+ state: NodeBenchRunnerStateSchema,
25708
+ progress: NodeBenchProgressSchema.nullable(),
25709
+ /** Every finished cell so far — a run stopped half way keeps what it measured. */
25710
+ cells: array(NodeBenchCellSchema).readonly(),
25711
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25712
+ clip: NodeBenchClipSchema.nullable(),
25713
+ /** Cameras seen running on the node during the run (they share its pools). */
25714
+ activeCameraIds: array(number()).readonly(),
25715
+ /** Models the run downloaded and then deleted (not installed before). */
25716
+ deletedModels: array(string$2()).readonly(),
25717
+ error: string$2().nullable(),
25718
+ startedAtMs: number(),
25719
+ finishedAtMs: number().nullable()
25720
+ });
25721
+ var NodeBenchmarkStateSchema = _enum([
25722
+ "draining",
25723
+ "measuring",
25724
+ "restoring",
25725
+ "done",
25726
+ "failed",
25727
+ "aborted"
25728
+ ]);
25729
+ /** Why a run ended. */
25730
+ var NodeBenchmarkEndReasonSchema = _enum([
25731
+ "completed",
25732
+ "operator-abort",
25733
+ "deadline",
25734
+ "node-lost",
25735
+ "runner-lost",
25736
+ "hub-restart",
25737
+ "drain-timeout",
25738
+ "failed"
25739
+ ]);
25740
+ var NodeBenchmarkRunSchema = object({
25741
+ runId: string$2(),
25742
+ nodeId: string$2(),
25743
+ state: NodeBenchmarkStateSchema,
25744
+ plan: NodeBenchmarkPlanSchema,
25745
+ startedAtMs: number(),
25746
+ deadlineAtMs: number(),
25747
+ finishedAtMs: number().nullable(),
25748
+ endReason: NodeBenchmarkEndReasonSchema.nullable(),
25749
+ error: string$2().nullable(),
25750
+ /** Cameras moved off the node for the run. */
25751
+ moved: array(number()).readonly(),
25752
+ /** Cameras that stayed (their only frame source is the node). */
25753
+ staying: array(number()).readonly(),
25754
+ /** Something else ran on the node's pools during the run. */
25755
+ contaminated: boolean(),
25756
+ progress: NodeBenchProgressSchema.nullable(),
25757
+ resultIds: array(string$2()).readonly()
25758
+ });
25759
+ /** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
25760
+ var NodeBenchmarkStatusSchema = object({
25761
+ /** The node the cluster is in benchmark mode for; null = none. */
25762
+ modeNodeId: string$2().nullable(),
25763
+ run: NodeBenchmarkRunSchema.nullable()
25764
+ });
25765
+ /**
25766
+ * One stored measurement — the only authority Auto tune and the automatic
25767
+ * shares read measured capacity from. Written by the orchestrator when a run
25768
+ * ends, never by anyone else.
25769
+ */
25770
+ var NodeBenchmarkResultSchema = object({
25771
+ id: string$2(),
25772
+ runId: string$2(),
25773
+ nodeId: string$2(),
25774
+ cell: NodeBenchCellSchema,
25775
+ fpsPerStream: number(),
25776
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25777
+ clip: NodeBenchClipSchema.nullable(),
25778
+ /** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
25779
+ contaminated: boolean(),
25780
+ stayingCameras: array(number()).readonly(),
25781
+ /** The run ended early; the cell itself completed. */
25782
+ partialRun: boolean(),
25783
+ measuredAtMs: number()
25784
+ });
25785
+ var ListNodeBenchmarkResultsInputSchema = object({
25786
+ nodeId: string$2().optional(),
25787
+ deviceKey: string$2().optional()
25788
+ });
25789
+ /** A result with its standing today: does it still beat the table? */
25790
+ var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
25791
+ /** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
25792
+ standing: _enum([
25793
+ "fresh",
25794
+ "stale",
25795
+ "superseded"
25796
+ ]),
25797
+ staleWhy: _enum([
25798
+ "age",
25799
+ "runtime",
25800
+ "pool-tuning"
25801
+ ]).nullable()
25802
+ });
25803
+ object({
25804
+ runId: string$2(),
25805
+ nodeId: string$2(),
25806
+ startedAtMs: number(),
25807
+ deadlineAtMs: number(),
25808
+ plan: NodeBenchmarkPlanSchema,
25809
+ moved: array(number()).readonly(),
25810
+ staying: array(number()).readonly()
25811
+ });
25812
+ /** Candidate detectors per device, for the plan editor. */
25813
+ var NodeBenchmarkCandidatesSchema = object({
25814
+ nodeId: string$2(),
25815
+ reachable: boolean(),
25816
+ devices: array(object({
25817
+ deviceKey: string$2(),
25818
+ enabled: boolean(),
25819
+ available: boolean(),
25820
+ /** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
25821
+ suggested: array(string$2()).readonly(),
25822
+ /** Every root detector the device has a build for. */
25823
+ all: array(string$2()).readonly(),
25824
+ /** The model the device runs now, when pinned. */
25825
+ currentModelId: string$2().nullable()
25826
+ })).readonly(),
25827
+ /** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
25828
+ steps: array(object({
25829
+ id: string$2(),
25830
+ name: string$2(),
25831
+ slot: string$2()
25832
+ })).readonly()
25833
+ });
24205
25834
  object({
24206
25835
  activeCameras: number(),
24207
25836
  throttledCameras: number(),
@@ -25330,7 +26959,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
25330
26959
  }), ParkedTrackFrameSchema.nullable()), method(object({
25331
26960
  deviceId: number(),
25332
26961
  trackId: string$2()
25333
- }), object({ released: number().int().nonnegative() }), { kind: "mutation" });
26962
+ }), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
26963
+ accepted: literal(true),
26964
+ runId: string$2()
26965
+ }), {
26966
+ kind: "mutation",
26967
+ auth: "admin"
26968
+ }), method(object({ runId: string$2() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string$2() }), object({ aborted: boolean() }), {
26969
+ kind: "mutation",
26970
+ auth: "admin"
26971
+ });
25334
26972
  var CameraPipelineConfigSchema = object({
25335
26973
  engine: PipelineEngineChoiceSchema.optional(),
25336
26974
  steps: array(PipelineStepInputSchema).readonly(),
@@ -25969,6 +27607,21 @@ method(object({
25969
27607
  }), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
25970
27608
  kind: "mutation",
25971
27609
  auth: "admin"
27610
+ }), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
27611
+ kind: literal("started"),
27612
+ runId: string$2()
27613
+ }), object({
27614
+ kind: literal("refused"),
27615
+ preflight: NodeBenchmarkPreflightSchema
27616
+ })]), {
27617
+ kind: "mutation",
27618
+ auth: "admin"
27619
+ }), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string$2() }), object({ aborted: boolean() }), {
27620
+ kind: "mutation",
27621
+ auth: "admin"
27622
+ }), method(object({ nodeId: string$2() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string$2() }), object({ deleted: boolean() }), {
27623
+ kind: "mutation",
27624
+ auth: "admin"
25972
27625
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
25973
27626
  deviceId: number(),
25974
27627
  addonId: string$2(),
@@ -26605,7 +28258,19 @@ var SsoBridgeClaimsSchema = object({
26605
28258
  * editing a descriptor must not retroactively extend or shorten a link the
26606
28259
  * operator already consented to.
26607
28260
  */
26608
- refreshTtl: union([number().int().positive(), literal("never")]).optional()
28261
+ refreshTtl: union([number().int().positive(), literal("never")]).optional(),
28262
+ /**
28263
+ * Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
28264
+ * that was started from a signed-in user's "Link" button: the finish then
28265
+ * links this identity to the intent's user instead of signing anyone in.
28266
+ * The handle carries no user id — the hub resolves it, single-use.
28267
+ */
28268
+ linkIntent: string$2().optional(),
28269
+ /**
28270
+ * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28271
+ * subject is unique only per issuer, so a link is bound to it.
28272
+ */
28273
+ issuer: string$2().optional()
26609
28274
  });
26610
28275
  method(object({
26611
28276
  claims: SsoBridgeClaimsSchema,
@@ -28540,7 +30205,22 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
28540
30205
  * field their hints were silently stripped by the schema and the
28541
30206
  * adaptive ladder started blind on the client's display size.
28542
30207
  */
28543
- hints: webrtcClientHintsSchema.optional()
30208
+ hints: webrtcClientHintsSchema.optional(),
30209
+ /**
30210
+ * Talk-back (D771): relay the PEER's audio to the device's speaker
30211
+ * through the `intercom` cap's push-talk triple. When `true` and the
30212
+ * offer lets the peer send audio, the answer's audio is `sendrecv`
30213
+ * and every inbound frame goes to `intercom.pushTalkAudio` for this
30214
+ * `deviceId`; absent/false answers `sendonly`, as for every viewer.
30215
+ *
30216
+ * TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
30217
+ * with `intercom`, when the linked user may control that camera. The
30218
+ * hub STRIPS it from every request-bound call (a browser), exactly as
30219
+ * it overwrites `relayOnly` — a viewer's talk permission is the
30220
+ * intercom cap's own surface (share tokens gate it there), and this
30221
+ * flag must not become a second door to the camera's speaker.
30222
+ */
30223
+ talkback: boolean().optional()
28544
30224
  }), object({
28545
30225
  sessionId: string$2(),
28546
30226
  sdpAnswer: string$2()
@@ -32066,6 +33746,9 @@ var CreateIntegrationInputSchema = object({
32066
33746
  enabled: boolean().optional(),
32067
33747
  info: record(string$2(), unknown()).optional(),
32068
33748
  settings: record(string$2(), unknown()).optional(),
33749
+ /** Keys of `settings` the form's schema declares secret (by type) — kept in
33750
+ * the keychain, not the table (D787). */
33751
+ secretKeys: array(string$2()).optional(),
32069
33752
  skipRestart: boolean().optional()
32070
33753
  });
32071
33754
  var UpdateIntegrationInputSchema = object({
@@ -32089,7 +33772,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string$2
32089
33772
  auth: "admin"
32090
33773
  }), method(object({ id: string$2() }), record(string$2(), unknown()), { auth: "admin" }), method(object({
32091
33774
  id: string$2(),
32092
- settings: record(string$2(), unknown())
33775
+ settings: record(string$2(), unknown()),
33776
+ /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
33777
+ secretKeys: array(string$2()).optional()
32093
33778
  }), object({ success: boolean() }), {
32094
33779
  kind: "mutation",
32095
33780
  auth: "admin"
@@ -38911,6 +40596,32 @@ var TotpStatusSchema = object({
38911
40596
  /** Null when no row exists OR the row is still pending confirmation. */
38912
40597
  confirmedAt: number().nullable()
38913
40598
  });
40599
+ /**
40600
+ * user-management — singleton capability for user accounts, API keys,
40601
+ * and scoped tokens.
40602
+ *
40603
+ * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
40604
+ * — the subset check on `setUserScopes` / `createScopedToken` is moot
40605
+ * because non-admins never reach these. If/when we open non-admin
40606
+ * delegation, structural caller-scope subset check goes inside the
40607
+ * provider.
40608
+ */
40609
+ var ExternalIdentitySchema = object({
40610
+ /** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
40611
+ provider: string$2(),
40612
+ /** The IdP's stable subject (`sub`) for this account. */
40613
+ subject: string$2(),
40614
+ /** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
40615
+ issuer: string$2(),
40616
+ userId: string$2(),
40617
+ /** What the IdP called the account at link time (username / email) — display only. */
40618
+ label: string$2().optional(),
40619
+ linkedAt: number()
40620
+ });
40621
+ var ExternalIdentityKeySchema = object({
40622
+ provider: string$2().min(1),
40623
+ subject: string$2().min(1)
40624
+ });
38914
40625
  method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
38915
40626
  kind: "mutation",
38916
40627
  auth: "admin",
@@ -39024,7 +40735,22 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
39024
40735
  userId: string$2(),
39025
40736
  username: string$2(),
39026
40737
  scopes: array(TokenScopeSchema)
39027
- }).nullable(), { access: "view" }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string$2() }), object({ success: boolean() }), {
40738
+ }).nullable(), { access: "view" }), method(object({ userId: string$2() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
40739
+ userId: string$2(),
40740
+ issuer: string$2()
40741
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
40742
+ userId: string$2(),
40743
+ issuer: string$2().min(1),
40744
+ label: string$2().optional()
40745
+ }), object({ success: literal(true) }), {
40746
+ kind: "mutation",
40747
+ auth: "admin",
40748
+ access: "create"
40749
+ }), method(ExternalIdentityKeySchema.extend({ userId: string$2() }), object({ success: boolean() }), {
40750
+ kind: "mutation",
40751
+ auth: "admin",
40752
+ access: "delete"
40753
+ }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string$2() }), object({ success: boolean() }), {
39028
40754
  kind: "mutation",
39029
40755
  auth: "admin",
39030
40756
  access: "delete"
@@ -40211,7 +41937,8 @@ var BaseDevice = class {
40211
41937
  this.role = options.role;
40212
41938
  this.parentDeviceId = ctx.parentDeviceId;
40213
41939
  const seedData = ctx.persistedConfig ?? {};
40214
- this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data), seedData, ({ droppedKeys, issues }) => {
41940
+ const declaredSecretPaths = collectZodSecretPaths(schema);
41941
+ this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
40215
41942
  ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
40216
41943
  tags: {
40217
41944
  deviceId: ctx.id,
@@ -43900,6 +45627,90 @@ Object.freeze({
43900
45627
  addonId: null,
43901
45628
  access: "create"
43902
45629
  },
45630
+ "keychain.delete": {
45631
+ capName: "keychain",
45632
+ capScope: "system",
45633
+ addonId: null,
45634
+ access: "delete"
45635
+ },
45636
+ "keychain.getState": {
45637
+ capName: "keychain",
45638
+ capScope: "system",
45639
+ addonId: null,
45640
+ access: "view"
45641
+ },
45642
+ "keychain.listMeta": {
45643
+ capName: "keychain",
45644
+ capScope: "system",
45645
+ addonId: null,
45646
+ access: "view"
45647
+ },
45648
+ "keychain.put": {
45649
+ capName: "keychain",
45650
+ capScope: "system",
45651
+ addonId: null,
45652
+ access: "create"
45653
+ },
45654
+ "keychain.resolve": {
45655
+ capName: "keychain",
45656
+ capScope: "system",
45657
+ addonId: null,
45658
+ access: "view"
45659
+ },
45660
+ "keychainAdmin.deleteOrphans": {
45661
+ capName: "keychain-admin",
45662
+ capScope: "system",
45663
+ addonId: null,
45664
+ access: "delete"
45665
+ },
45666
+ "keychainAdmin.downloadRecoveryKey": {
45667
+ capName: "keychain-admin",
45668
+ capScope: "system",
45669
+ addonId: null,
45670
+ access: "create"
45671
+ },
45672
+ "keychainAdmin.listAudit": {
45673
+ capName: "keychain-admin",
45674
+ capScope: "system",
45675
+ addonId: null,
45676
+ access: "view"
45677
+ },
45678
+ "keychainAdmin.listSecrets": {
45679
+ capName: "keychain-admin",
45680
+ capScope: "system",
45681
+ addonId: null,
45682
+ access: "view"
45683
+ },
45684
+ "keychainAdmin.purgeRetiredKeys": {
45685
+ capName: "keychain-admin",
45686
+ capScope: "system",
45687
+ addonId: null,
45688
+ access: "delete"
45689
+ },
45690
+ "keychainAdmin.resetKeychain": {
45691
+ capName: "keychain-admin",
45692
+ capScope: "system",
45693
+ addonId: null,
45694
+ access: "delete"
45695
+ },
45696
+ "keychainAdmin.reveal": {
45697
+ capName: "keychain-admin",
45698
+ capScope: "system",
45699
+ addonId: null,
45700
+ access: "create"
45701
+ },
45702
+ "keychainAdmin.rotateMasterKey": {
45703
+ capName: "keychain-admin",
45704
+ capScope: "system",
45705
+ addonId: null,
45706
+ access: "create"
45707
+ },
45708
+ "keychainAdmin.status": {
45709
+ capName: "keychain-admin",
45710
+ capScope: "system",
45711
+ addonId: null,
45712
+ access: "view"
45713
+ },
43903
45714
  "lawnMowerControl.dock": {
43904
45715
  capName: "lawn-mower-control",
43905
45716
  capScope: "device",
@@ -45274,6 +47085,18 @@ Object.freeze({
45274
47085
  addonId: null,
45275
47086
  access: "create"
45276
47087
  },
47088
+ "pipelineAnalytics.addRetrainFrameFromRecording": {
47089
+ capName: "pipeline-analytics",
47090
+ capScope: "device",
47091
+ addonId: null,
47092
+ access: "create"
47093
+ },
47094
+ "pipelineAnalytics.addRetrainFramesToCollection": {
47095
+ capName: "pipeline-analytics",
47096
+ capScope: "device",
47097
+ addonId: null,
47098
+ access: "create"
47099
+ },
45277
47100
  "pipelineAnalytics.applyDeviceSettingsPatch": {
45278
47101
  capName: "pipeline-analytics",
45279
47102
  capScope: "device",
@@ -45322,12 +47145,24 @@ Object.freeze({
45322
47145
  addonId: null,
45323
47146
  access: "view"
45324
47147
  },
47148
+ "pipelineAnalytics.createRetrainCollection": {
47149
+ capName: "pipeline-analytics",
47150
+ capScope: "device",
47151
+ addonId: null,
47152
+ access: "create"
47153
+ },
45325
47154
  "pipelineAnalytics.deleteDeviceEvents": {
45326
47155
  capName: "pipeline-analytics",
45327
47156
  capScope: "device",
45328
47157
  addonId: null,
45329
47158
  access: "delete"
45330
47159
  },
47160
+ "pipelineAnalytics.deleteRetrainCollection": {
47161
+ capName: "pipeline-analytics",
47162
+ capScope: "device",
47163
+ addonId: null,
47164
+ access: "delete"
47165
+ },
45331
47166
  "pipelineAnalytics.deleteTracks": {
45332
47167
  capName: "pipeline-analytics",
45333
47168
  capScope: "device",
@@ -45532,6 +47367,24 @@ Object.freeze({
45532
47367
  addonId: null,
45533
47368
  access: "view"
45534
47369
  },
47370
+ "pipelineAnalytics.listRetrainAssistProfiles": {
47371
+ capName: "pipeline-analytics",
47372
+ capScope: "device",
47373
+ addonId: null,
47374
+ access: "view"
47375
+ },
47376
+ "pipelineAnalytics.listRetrainCollectionFrames": {
47377
+ capName: "pipeline-analytics",
47378
+ capScope: "device",
47379
+ addonId: null,
47380
+ access: "view"
47381
+ },
47382
+ "pipelineAnalytics.listRetrainCollections": {
47383
+ capName: "pipeline-analytics",
47384
+ capScope: "device",
47385
+ addonId: null,
47386
+ access: "view"
47387
+ },
45535
47388
  "pipelineAnalytics.listRetrainFrames": {
45536
47389
  capName: "pipeline-analytics",
45537
47390
  capScope: "device",
@@ -45580,6 +47433,12 @@ Object.freeze({
45580
47433
  addonId: null,
45581
47434
  access: "create"
45582
47435
  },
47436
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
47437
+ capName: "pipeline-analytics",
47438
+ capScope: "device",
47439
+ addonId: null,
47440
+ access: "create"
47441
+ },
45583
47442
  "pipelineAnalytics.pruneEvents": {
45584
47443
  capName: "pipeline-analytics",
45585
47444
  capScope: "device",
@@ -45634,6 +47493,18 @@ Object.freeze({
45634
47493
  addonId: null,
45635
47494
  access: "create"
45636
47495
  },
47496
+ "pipelineAnalytics.removeRetrainFrameFromCollection": {
47497
+ capName: "pipeline-analytics",
47498
+ capScope: "device",
47499
+ addonId: null,
47500
+ access: "delete"
47501
+ },
47502
+ "pipelineAnalytics.renameRetrainCollection": {
47503
+ capName: "pipeline-analytics",
47504
+ capScope: "device",
47505
+ addonId: null,
47506
+ access: "create"
47507
+ },
45637
47508
  "pipelineAnalytics.restageRetrainTrack": {
45638
47509
  capName: "pipeline-analytics",
45639
47510
  capScope: "device",
@@ -45664,6 +47535,12 @@ Object.freeze({
45664
47535
  addonId: null,
45665
47536
  access: "create"
45666
47537
  },
47538
+ "pipelineAnalytics.setRetrainFrameComplete": {
47539
+ capName: "pipeline-analytics",
47540
+ capScope: "device",
47541
+ addonId: null,
47542
+ access: "create"
47543
+ },
45667
47544
  "pipelineAnalytics.setTrackFlags": {
45668
47545
  capName: "pipeline-analytics",
45669
47546
  capScope: "device",
@@ -45700,6 +47577,12 @@ Object.freeze({
45700
47577
  addonId: null,
45701
47578
  access: "delete"
45702
47579
  },
47580
+ "pipelineAnalytics.writeRetrainArchive": {
47581
+ capName: "pipeline-analytics",
47582
+ capScope: "device",
47583
+ addonId: null,
47584
+ access: "create"
47585
+ },
45703
47586
  "pipelineExecutor.cacheFrameInPool": {
45704
47587
  capName: "pipeline-executor",
45705
47588
  capScope: "system",
@@ -45910,6 +47793,12 @@ Object.freeze({
45910
47793
  addonId: null,
45911
47794
  access: "view"
45912
47795
  },
47796
+ "pipelineOrchestrator.abortNodeBenchmark": {
47797
+ capName: "pipeline-orchestrator",
47798
+ capScope: "system",
47799
+ addonId: null,
47800
+ access: "create"
47801
+ },
45913
47802
  "pipelineOrchestrator.applyAutoTune": {
45914
47803
  capName: "pipeline-orchestrator",
45915
47804
  capScope: "system",
@@ -45934,6 +47823,12 @@ Object.freeze({
45934
47823
  addonId: null,
45935
47824
  access: "create"
45936
47825
  },
47826
+ "pipelineOrchestrator.deleteNodeBenchmarkResult": {
47827
+ capName: "pipeline-orchestrator",
47828
+ capScope: "system",
47829
+ addonId: null,
47830
+ access: "delete"
47831
+ },
45937
47832
  "pipelineOrchestrator.getAgentLoad": {
45938
47833
  capName: "pipeline-orchestrator",
45939
47834
  capScope: "system",
@@ -46042,6 +47937,24 @@ Object.freeze({
46042
47937
  addonId: null,
46043
47938
  access: "view"
46044
47939
  },
47940
+ "pipelineOrchestrator.getNodeBenchmarkCandidates": {
47941
+ capName: "pipeline-orchestrator",
47942
+ capScope: "system",
47943
+ addonId: null,
47944
+ access: "view"
47945
+ },
47946
+ "pipelineOrchestrator.getNodeBenchmarkPreflight": {
47947
+ capName: "pipeline-orchestrator",
47948
+ capScope: "system",
47949
+ addonId: null,
47950
+ access: "view"
47951
+ },
47952
+ "pipelineOrchestrator.getNodeBenchmarkStatus": {
47953
+ capName: "pipeline-orchestrator",
47954
+ capScope: "system",
47955
+ addonId: null,
47956
+ access: "view"
47957
+ },
46045
47958
  "pipelineOrchestrator.getNodeInferenceDevices": {
46046
47959
  capName: "pipeline-orchestrator",
46047
47960
  capScope: "system",
@@ -46084,6 +47997,12 @@ Object.freeze({
46084
47997
  addonId: null,
46085
47998
  access: "view"
46086
47999
  },
48000
+ "pipelineOrchestrator.listNodeBenchmarkResults": {
48001
+ capName: "pipeline-orchestrator",
48002
+ capScope: "system",
48003
+ addonId: null,
48004
+ access: "view"
48005
+ },
46087
48006
  "pipelineOrchestrator.pauseForStorageMigration": {
46088
48007
  capName: "pipeline-orchestrator",
46089
48008
  capScope: "system",
@@ -46228,6 +48147,12 @@ Object.freeze({
46228
48147
  addonId: null,
46229
48148
  access: "create"
46230
48149
  },
48150
+ "pipelineOrchestrator.startNodeBenchmark": {
48151
+ capName: "pipeline-orchestrator",
48152
+ capScope: "system",
48153
+ addonId: null,
48154
+ access: "create"
48155
+ },
46231
48156
  "pipelineOrchestrator.suggestShares": {
46232
48157
  capName: "pipeline-orchestrator",
46233
48158
  capScope: "system",
@@ -46246,6 +48171,12 @@ Object.freeze({
46246
48171
  addonId: null,
46247
48172
  access: "create"
46248
48173
  },
48174
+ "pipelineRunner.abortNodeBench": {
48175
+ capName: "pipeline-runner",
48176
+ capScope: "system",
48177
+ addonId: null,
48178
+ access: "create"
48179
+ },
46249
48180
  "pipelineRunner.attachCamera": {
46250
48181
  capName: "pipeline-runner",
46251
48182
  capScope: "system",
@@ -46294,6 +48225,12 @@ Object.freeze({
46294
48225
  addonId: null,
46295
48226
  access: "view"
46296
48227
  },
48228
+ "pipelineRunner.getNodeBenchStatus": {
48229
+ capName: "pipeline-runner",
48230
+ capScope: "system",
48231
+ addonId: null,
48232
+ access: "view"
48233
+ },
46297
48234
  "pipelineRunner.getParkedTrackFrame": {
46298
48235
  capName: "pipeline-runner",
46299
48236
  capScope: "system",
@@ -46336,6 +48273,12 @@ Object.freeze({
46336
48273
  addonId: null,
46337
48274
  access: "create"
46338
48275
  },
48276
+ "pipelineRunner.startNodeBench": {
48277
+ capName: "pipeline-runner",
48278
+ capScope: "system",
48279
+ addonId: null,
48280
+ access: "create"
48281
+ },
46339
48282
  "plateGallery.assignPlate": {
46340
48283
  capName: "plate-gallery",
46341
48284
  capScope: "system",
@@ -48052,18 +49995,36 @@ Object.freeze({
48052
49995
  addonId: null,
48053
49996
  access: "delete"
48054
49997
  },
49998
+ "userManagement.findUserByExternalIdentity": {
49999
+ capName: "user-management",
50000
+ capScope: "system",
50001
+ addonId: null,
50002
+ access: "view"
50003
+ },
48055
50004
  "userManagement.getTotpStatus": {
48056
50005
  capName: "user-management",
48057
50006
  capScope: "system",
48058
50007
  addonId: null,
48059
50008
  access: "view"
48060
50009
  },
50010
+ "userManagement.linkExternalIdentity": {
50011
+ capName: "user-management",
50012
+ capScope: "system",
50013
+ addonId: null,
50014
+ access: "create"
50015
+ },
48061
50016
  "userManagement.listApiKeys": {
48062
50017
  capName: "user-management",
48063
50018
  capScope: "system",
48064
50019
  addonId: null,
48065
50020
  access: "view"
48066
50021
  },
50022
+ "userManagement.listExternalIdentities": {
50023
+ capName: "user-management",
50024
+ capScope: "system",
50025
+ addonId: null,
50026
+ access: "view"
50027
+ },
48067
50028
  "userManagement.listOauthSessions": {
48068
50029
  capName: "user-management",
48069
50030
  capScope: "system",
@@ -48142,6 +50103,12 @@ Object.freeze({
48142
50103
  addonId: null,
48143
50104
  access: "create"
48144
50105
  },
50106
+ "userManagement.unlinkExternalIdentity": {
50107
+ capName: "user-management",
50108
+ capScope: "system",
50109
+ addonId: null,
50110
+ access: "delete"
50111
+ },
48145
50112
  "userManagement.updateUser": {
48146
50113
  capName: "user-management",
48147
50114
  capScope: "system",
@@ -51241,6 +53208,11 @@ Object.freeze({
51241
53208
  form: "single",
51242
53209
  optional: false
51243
53210
  }],
53211
+ "pipelineAnalytics.addRetrainFrameFromRecording": [{
53212
+ name: "deviceId",
53213
+ form: "single",
53214
+ optional: false
53215
+ }],
51244
53216
  "pipelineAnalytics.applyDeviceSettingsPatch": [{
51245
53217
  name: "deviceId",
51246
53218
  form: "single",
@@ -51431,6 +53403,11 @@ Object.freeze({
51431
53403
  form: "single",
51432
53404
  optional: false
51433
53405
  }],
53406
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
53407
+ name: "deviceId",
53408
+ form: "single",
53409
+ optional: false
53410
+ }],
51434
53411
  "pipelineAnalytics.pruneEventsBefore": [{
51435
53412
  name: "deviceId",
51436
53413
  form: "single",
@@ -51481,6 +53458,11 @@ Object.freeze({
51481
53458
  form: "single",
51482
53459
  optional: false
51483
53460
  }],
53461
+ "pipelineAnalytics.setRetrainFrameComplete": [{
53462
+ name: "deviceId",
53463
+ form: "single",
53464
+ optional: false
53465
+ }],
51484
53466
  "pipelineAnalytics.setTrackFlags": [{
51485
53467
  name: "deviceId",
51486
53468
  form: "single",
@@ -163479,11 +165461,11 @@ var MatterBrokerRegistry = class {
163479
165461
  */
163480
165462
  var matterConnectionSchema = object({
163481
165463
  /** Optional Thread operational dataset (hex) for Thread device onboarding. */
163482
- threadDataset: string$2().default("").describe("Thread operational dataset (hex) — required only for Thread devices"),
165464
+ threadDataset: string$2().default("").describe("Thread operational dataset (hex) — required only for Thread devices").meta({ secret: true }),
163483
165465
  /** Optional Wi-Fi SSID for Wi-Fi device onboarding over BLE. */
163484
165466
  wifiSsid: string$2().default("").describe("Wi-Fi SSID — required only for BLE Wi-Fi onboarding"),
163485
165467
  /** Optional Wi-Fi password for Wi-Fi device onboarding over BLE. */
163486
- wifiPassword: string$2().default("").describe("Wi-Fi password (optional)"),
165468
+ wifiPassword: string$2().default("").describe("Wi-Fi password (optional)").meta({ secret: true }),
163487
165469
  /** PULL-reconcile interval for the commissioned-node inventory. */
163488
165470
  reconcileIntervalMs: preprocess((v) => v === "" || v === null ? void 0 : v, number().int().min(1e4).max(864e5).default(3e5)).describe("Node-inventory reconcile interval (ms)")
163489
165471
  });
@@ -163514,6 +165496,7 @@ function buildConnectionFormSchema() {
163514
165496
  {
163515
165497
  type: "text",
163516
165498
  key: "threadDataset",
165499
+ secret: true,
163517
165500
  label: "Thread operational dataset (hex, optional)",
163518
165501
  placeholder: "0e08000000000001…"
163519
165502
  },