@camstack/addon-provider-reolink 1.2.177 → 1.2.179

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 +3083 -577
  2. package/dist/addon.mjs +3083 -577
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -27,7 +27,7 @@ import { URL as URL$1 } from "url";
27
27
  import { spawn as spawn$1 } from "node:child_process";
28
28
  import os, { tmpdir } from "node:os";
29
29
  import { createReadStream } from "node:fs";
30
- //#region ../types/dist/event-category-BGmz_oxW.mjs
30
+ //#region ../types/dist/event-category-DaIZi00R.mjs
31
31
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
32
32
  EventCategory["SystemBoot"] = "system.boot";
33
33
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -106,6 +106,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
106
106
  */
107
107
  EventCategory["AddonLoadFailed"] = "addon.load-failed";
108
108
  /**
109
+ * A keychain value was stored or removed (D787). Carries the ref, its
110
+ * owner and the new version — NEVER the value. A process holding the ref
111
+ * drops its cached copy and the owning `BaseAddon` re-resolves its config.
112
+ * Telemetry (D8): a process that misses it still revalidates by version.
113
+ */
114
+ EventCategory["KeychainChanged"] = "keychain.changed";
115
+ /**
109
116
  * Addon recovered from a previous failure. Emitted when an addon
110
117
  * transitions from `failed` back to `healthy` (typically via the
111
118
  * monitor's auto-retry loop, or after manual `addons.retryLoad`).
@@ -528,15 +535,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
528
535
  EventCategory["AgentWsDisconnected"] = "agent.ws.disconnected";
529
536
  EventCategory["AgentBackupActivated"] = "agent.backup.activated";
530
537
  EventCategory["OrchestrationSettingsUpdated"] = "orchestration.settings-updated";
531
- /**
532
- * Per-agent hwaccel preference changed (user override set, cleared, or
533
- * re-probed). Observability event — decoders pull the current pref at
534
- * `createSession`, so running sessions keep their current backend until
535
- * they rotate naturally (camera add/remove, stream restart). Future
536
- * work can wire a listener in stream-broker that force-rotates live
537
- * sessions; for now this event powers logs + admin-UI toast feedback.
538
- */
539
- EventCategory["PipelineAgentHwaccelChanged"] = "pipeline.agent-hwaccel-changed";
540
538
  EventCategory["MotionAnalysis"] = "detection.motion-analysis";
541
539
  /** All raw motion zones from CCL before minArea filter — for UI debug overlay. */
542
540
  EventCategory["MotionZonesRaw"] = "detection.motion-zones-raw";
@@ -5407,7 +5405,7 @@ var ZodIssueCode = {
5407
5405
  var ZodFirstPartyTypeKind;
5408
5406
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5409
5407
  //#endregion
5410
- //#region ../types/dist/sleep-DXKLNFvA.mjs
5408
+ //#region ../types/dist/sleep-Cr5YOk3m.mjs
5411
5409
  /**
5412
5410
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5413
5411
  * window to float samples (D455).
@@ -5486,6 +5484,97 @@ function buildAlawTable() {
5486
5484
  }
5487
5485
  buildUlawTable();
5488
5486
  buildAlawTable();
5487
+ /** Is this field's stored value a credential? */
5488
+ function isSecretConfigField(field) {
5489
+ if (field.type === "password") return true;
5490
+ return "secret" in field && field.secret === true;
5491
+ }
5492
+ /**
5493
+ * Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
5494
+ * by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
5495
+ */
5496
+ function isKeychainStoredField(field) {
5497
+ if (!isSecretConfigField(field)) return false;
5498
+ if (field.type === "textarea" && field.isJson === true) return false;
5499
+ return !("storage" in field && field.storage === "inline");
5500
+ }
5501
+ /**
5502
+ * What a settings blob holds where a secret used to be.
5503
+ *
5504
+ * A keychain-stored field never holds its value. It holds a self-describing
5505
+ * MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
5506
+ * code can mistake it for a credential and no form can send it to a camera as
5507
+ * a password. The empty state is `null` / absent, never `''`.
5508
+ *
5509
+ * The same shapes travel to and from the admin UI:
5510
+ *
5511
+ * - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
5512
+ * (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
5513
+ * value is set, never the value.
5514
+ * - write: an untouched field submits the view back unchanged (KEEP); a typed
5515
+ * value is a plain non-empty string (CHANGE); the Clear button submits
5516
+ * {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
5517
+ * are KEEP — an empty string is what a defaults-fallback pushes back, and
5518
+ * treating it as "clear" is how a save destroyed a stored credential before.
5519
+ *
5520
+ * Pure and browser-safe.
5521
+ */
5522
+ var SECRET_CLEAR = { $secretClear: true };
5523
+ /** The `'***'` token D634 redaction writes for non-admins. */
5524
+ var LEGACY_DEVICE_REDACTION = "***";
5525
+ function isRecord$1(value) {
5526
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5527
+ }
5528
+ function makeSecretMarker(ref) {
5529
+ return {
5530
+ $secret: ref,
5531
+ v: 1
5532
+ };
5533
+ }
5534
+ /** A stored marker: an object whose `$secret` is a non-empty string. */
5535
+ function isSecretMarker(value) {
5536
+ if (!isRecord$1(value)) return false;
5537
+ const ref = value["$secret"];
5538
+ return typeof ref === "string" && ref.length > 0;
5539
+ }
5540
+ function isSecretClear(value) {
5541
+ return isRecord$1(value) && value["$secretClear"] === true;
5542
+ }
5543
+ /**
5544
+ * The UI view of a stored secret field value: a marker becomes "set", inline
5545
+ * plaintext becomes "set (inline)", nothing becomes `null`. A value never
5546
+ * survives this function.
5547
+ */
5548
+ function toSecretFieldView(stored) {
5549
+ if (isSecretMarker(stored)) return {
5550
+ $secret: stored.$secret,
5551
+ v: 1,
5552
+ set: true
5553
+ };
5554
+ if (typeof stored === "string" && stored.length > 0) return {
5555
+ $secret: null,
5556
+ v: 1,
5557
+ set: true,
5558
+ inline: true
5559
+ };
5560
+ return null;
5561
+ }
5562
+ /**
5563
+ * Classify an incoming value for a secret path. Only a non-empty string that is
5564
+ * not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
5565
+ * Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
5566
+ * `undefined`, a redaction token, a non-string — keeps what is stored.
5567
+ */
5568
+ function classifySecretWrite(incoming) {
5569
+ if (isSecretClear(incoming)) return { kind: "clear" };
5570
+ if (typeof incoming !== "string") return { kind: "keep" };
5571
+ if (incoming.length === 0) return { kind: "keep" };
5572
+ if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
5573
+ return {
5574
+ kind: "set",
5575
+ value: incoming
5576
+ };
5577
+ }
5489
5578
  Object.fromEntries([
5490
5579
  {
5491
5580
  id: "overview",
@@ -5657,33 +5746,19 @@ Object.fromEntries([
5657
5746
  function isValuelessField(field) {
5658
5747
  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";
5659
5748
  }
5660
- /**
5661
- * Merge a `ConfigUISchema` with a raw `values` record into a
5662
- * `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
5663
- * before returning to the admin UI. Groups are walked recursively.
5664
- *
5665
- * For each leaf field:
5666
- * - structural fields (`separator`, `info`, `button`) pass through unchanged
5667
- * - other fields get `value = values[key] ?? field.default ?? null`
5668
- *
5669
- * Unknown keys in `values` (keys not declared in the schema) are silently
5670
- * ignored — they don't contribute to the output. Missing keys fall back to
5671
- * the schema default or `null`. This mirrors the old backend behaviour where
5672
- * `FormBuilder` rendered `values[key] ?? field.default`.
5673
- */
5674
- function hydrateSchema(schema, values) {
5749
+ function hydrateSchema(schema, values, options = {}) {
5675
5750
  return {
5676
5751
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
5677
5752
  sections: schema.sections.map((section) => ({
5678
5753
  ...section,
5679
- fields: section.fields.map((field) => hydrateField(field, values))
5754
+ fields: section.fields.map((field) => hydrateField(field, values, options))
5680
5755
  }))
5681
5756
  };
5682
5757
  }
5683
- function hydrateField(field, values) {
5758
+ function hydrateField(field, values, options) {
5684
5759
  if (isValuelessField(field)) return field;
5685
5760
  if (field.type === "group") {
5686
- const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
5761
+ const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
5687
5762
  return {
5688
5763
  ...field,
5689
5764
  fields: hydratedChildren
@@ -5692,7 +5767,7 @@ function hydrateField(field, values) {
5692
5767
  if (field.type === "sub-tabs") {
5693
5768
  const hydratedTabs = field.tabs.map((tab) => ({
5694
5769
  ...tab,
5695
- fields: tab.fields.map((child) => hydrateField(child, values))
5770
+ fields: tab.fields.map((child) => hydrateField(child, values, options))
5696
5771
  }));
5697
5772
  return {
5698
5773
  ...field,
@@ -5702,6 +5777,33 @@ function hydrateField(field, values) {
5702
5777
  const key = field.key;
5703
5778
  const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
5704
5779
  const defaultValue = field.default;
5780
+ const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
5781
+ if (isKeychainStoredField(field) && asView(storedValue)) return {
5782
+ ...field,
5783
+ value: toSecretFieldView(storedValue)
5784
+ };
5785
+ if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
5786
+ ...field,
5787
+ value: null
5788
+ };
5789
+ if (field.type === "editable-array" && Array.isArray(storedValue)) {
5790
+ const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
5791
+ if (secretItemKeys.length > 0) {
5792
+ const rows = storedValue.map((row) => {
5793
+ if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
5794
+ const out = { ...row };
5795
+ for (const k of secretItemKeys) {
5796
+ const v = Reflect.get(row, k);
5797
+ if (asView(v)) out[k] = toSecretFieldView(v);
5798
+ }
5799
+ return out;
5800
+ });
5801
+ return {
5802
+ ...field,
5803
+ value: rows
5804
+ };
5805
+ }
5806
+ }
5705
5807
  if (field.multiple) {
5706
5808
  const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
5707
5809
  const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
@@ -5944,6 +6046,431 @@ function projectStore(store, perNodeKeys, nodeId) {
5944
6046
  }
5945
6047
  return out;
5946
6048
  }
6049
+ var GLOBAL_SCOPE = { kind: "global" };
6050
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6051
+ function globalSecretScope() {
6052
+ return GLOBAL_SCOPE;
6053
+ }
6054
+ function encodeSegment(value) {
6055
+ return encodeURIComponent(value);
6056
+ }
6057
+ /**
6058
+ * The field path of a value inside an array item, addressed by the item's id:
6059
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6060
+ * `providers[authentik].clientSecret`.
6061
+ */
6062
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6063
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6064
+ }
6065
+ /** A write to a secret path could not be stored in the keychain, so it was refused. */
6066
+ var KeychainWriteRefusedError = class extends Error {
6067
+ fieldPath;
6068
+ constructor(fieldPath, cause) {
6069
+ super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
6070
+ this.fieldPath = fieldPath;
6071
+ this.name = "KeychainWriteRefusedError";
6072
+ }
6073
+ };
6074
+ var KEEP = { kind: "keep" };
6075
+ function isRecord$2(value) {
6076
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6077
+ }
6078
+ function defaultMintId() {
6079
+ return globalThis.crypto.randomUUID();
6080
+ }
6081
+ /** Every marker ref anywhere under `value`. */
6082
+ function collectSecretMarkerRefs(value, out = []) {
6083
+ if (isSecretMarker(value)) {
6084
+ out.push(value.$secret);
6085
+ return out;
6086
+ }
6087
+ if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6088
+ else if (isRecord$2(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6089
+ return out;
6090
+ }
6091
+ async function storedValueEquals(secrets, marker, candidate) {
6092
+ const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
6093
+ return resolved?.kind === "value" && resolved.value === candidate;
6094
+ }
6095
+ async function writeLeaf(ctx, incoming, stored, fieldPath) {
6096
+ const intent = classifySecretWrite(incoming);
6097
+ const ref = ctx.secrets.ref(ctx.scope, fieldPath);
6098
+ const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
6099
+ if (intent.kind === "keep") return KEEP;
6100
+ if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
6101
+ if (intent.kind === "clear") {
6102
+ if (storedIsOurs) ctx.deletes.push(ref);
6103
+ return {
6104
+ kind: "value",
6105
+ value: null
6106
+ };
6107
+ }
6108
+ if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
6109
+ kind: "value",
6110
+ value: stored
6111
+ };
6112
+ try {
6113
+ await ctx.secrets.put(ref, intent.value);
6114
+ } catch (err) {
6115
+ throw new KeychainWriteRefusedError(fieldPath, err);
6116
+ }
6117
+ return {
6118
+ kind: "value",
6119
+ value: makeSecretMarker(ref)
6120
+ };
6121
+ }
6122
+ /** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
6123
+ function applyMember(out, key, result, storedParent) {
6124
+ if (result.kind === "value") {
6125
+ out[key] = result.value;
6126
+ return;
6127
+ }
6128
+ if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
6129
+ else delete out[key];
6130
+ }
6131
+ async function writeMembers(ctx, children, incoming, stored, pathOf) {
6132
+ const out = { ...incoming };
6133
+ for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
6134
+ return out;
6135
+ }
6136
+ function rowId(row, idKey) {
6137
+ const raw = row[idKey];
6138
+ if (typeof raw === "string" && raw.length > 0) return raw;
6139
+ if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
6140
+ return null;
6141
+ }
6142
+ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6143
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$2) : [];
6144
+ if (!Array.isArray(incoming)) {
6145
+ ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6146
+ return {
6147
+ kind: "value",
6148
+ value: incoming
6149
+ };
6150
+ }
6151
+ const storedById = /* @__PURE__ */ new Map();
6152
+ for (const row of storedRows) {
6153
+ const id = rowId(row, node.idKey);
6154
+ if (id !== null) storedById.set(id, row);
6155
+ }
6156
+ const kept = /* @__PURE__ */ new Set();
6157
+ const rows = [];
6158
+ for (const row of incoming) {
6159
+ if (!isRecord$2(row)) {
6160
+ rows.push(row);
6161
+ continue;
6162
+ }
6163
+ const id = rowId(row, node.idKey) ?? ctx.mintId();
6164
+ kept.add(id);
6165
+ const withId = {
6166
+ ...row,
6167
+ [node.idKey]: row[node.idKey] ?? id
6168
+ };
6169
+ if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
6170
+ const storedRow = storedById.get(id) ?? {};
6171
+ rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
6172
+ }
6173
+ for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
6174
+ return {
6175
+ kind: "value",
6176
+ value: rows
6177
+ };
6178
+ }
6179
+ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6180
+ switch (node.kind) {
6181
+ case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6182
+ case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6183
+ case "object": {
6184
+ if (!isRecord$2(incoming)) {
6185
+ if (incoming === void 0) return KEEP;
6186
+ ctx.deletes.push(...collectSecretMarkerRefs(stored));
6187
+ return {
6188
+ kind: "value",
6189
+ value: incoming
6190
+ };
6191
+ }
6192
+ const storedObj = isRecord$2(stored) ? stored : {};
6193
+ return {
6194
+ kind: "value",
6195
+ value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
6196
+ };
6197
+ }
6198
+ }
6199
+ }
6200
+ /** Split a perNode-scoped key (`key@nodeId`). */
6201
+ function splitNodeKey(key) {
6202
+ const at = key.indexOf("@");
6203
+ return at <= 0 ? {
6204
+ base: key,
6205
+ nodeId: null
6206
+ } : {
6207
+ base: key.slice(0, at),
6208
+ nodeId: key.slice(at + 1)
6209
+ };
6210
+ }
6211
+ /** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
6212
+ async function transformSecretWrite(input) {
6213
+ const deletes = [];
6214
+ const base = {
6215
+ secrets: input.secrets,
6216
+ mintId: input.mintId ?? defaultMintId,
6217
+ deletes,
6218
+ operatorWrite: input.operatorWrite === true
6219
+ };
6220
+ const out = {};
6221
+ for (const [key, incoming] of Object.entries(input.patch)) {
6222
+ const { base: baseKey, nodeId } = splitNodeKey(key);
6223
+ const node = input.tree.get(baseKey);
6224
+ if (node === void 0) {
6225
+ out[key] = incoming;
6226
+ continue;
6227
+ }
6228
+ const scope = nodeId !== null && nodeId.length > 0 ? {
6229
+ kind: "node",
6230
+ nodeId
6231
+ } : input.scope ?? globalSecretScope();
6232
+ const result = await writeNode({
6233
+ ...base,
6234
+ scope
6235
+ }, node, incoming, input.stored[key], baseKey);
6236
+ if (result.kind === "value") out[key] = result.value;
6237
+ }
6238
+ return {
6239
+ patch: out,
6240
+ afterWrite: async () => {
6241
+ if (deletes.length === 0) return { orphaned: [] };
6242
+ try {
6243
+ await input.secrets.delete([...new Set(deletes)]);
6244
+ return { orphaned: [] };
6245
+ } catch {
6246
+ return { orphaned: [...new Set(deletes)] };
6247
+ }
6248
+ }
6249
+ };
6250
+ }
6251
+ /**
6252
+ * Replace every marker in `value` with its keychain value. Returns the SAME
6253
+ * reference when there is no marker (no allocation, no keychain call).
6254
+ */
6255
+ async function resolveSecretMarkers(value, secrets) {
6256
+ const refs = collectSecretMarkerRefs(value);
6257
+ if (refs.length === 0) return {
6258
+ value,
6259
+ unresolved: []
6260
+ };
6261
+ const answers = await secrets.resolve(refs);
6262
+ const unresolved = [];
6263
+ for (const ref of new Set(refs)) {
6264
+ const answer = answers[ref];
6265
+ if (answer === void 0) unresolved.push({
6266
+ ref,
6267
+ reason: "not-initialized"
6268
+ });
6269
+ else if (answer.kind === "unavailable") unresolved.push({
6270
+ ref,
6271
+ reason: answer.reason
6272
+ });
6273
+ else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
6274
+ ref,
6275
+ reason: answer.kind
6276
+ });
6277
+ }
6278
+ const substitute = (v) => {
6279
+ if (isSecretMarker(v)) {
6280
+ const answer = answers[v.$secret];
6281
+ return answer?.kind === "value" ? {
6282
+ keep: true,
6283
+ value: answer.value
6284
+ } : {
6285
+ keep: false,
6286
+ value: void 0
6287
+ };
6288
+ }
6289
+ if (Array.isArray(v)) {
6290
+ const items = [];
6291
+ for (const item of v) {
6292
+ const s = substitute(item);
6293
+ if (s.keep) items.push(s.value);
6294
+ }
6295
+ return {
6296
+ keep: true,
6297
+ value: items
6298
+ };
6299
+ }
6300
+ if (isRecord$2(v)) {
6301
+ const out = {};
6302
+ for (const [k, child] of Object.entries(v)) {
6303
+ const s = substitute(child);
6304
+ if (s.keep) out[k] = s.value;
6305
+ }
6306
+ return {
6307
+ keep: true,
6308
+ value: out
6309
+ };
6310
+ }
6311
+ return {
6312
+ keep: true,
6313
+ value: v
6314
+ };
6315
+ };
6316
+ return {
6317
+ value: substitute(value).value,
6318
+ unresolved
6319
+ };
6320
+ }
6321
+ function touchesTree(tree, patch) {
6322
+ if (tree.size === 0) return false;
6323
+ for (const key of Object.keys(patch)) {
6324
+ const at = key.indexOf("@");
6325
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6326
+ }
6327
+ return false;
6328
+ }
6329
+ /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6330
+ async function readStoredAddonBlob(raw) {
6331
+ const threeWay = raw.readAddonStoreResult;
6332
+ if (threeWay === void 0) return raw.readAddonStore();
6333
+ const result = await threeWay.call(raw);
6334
+ if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6335
+ return result.kind === "missing" ? {} : result.value;
6336
+ }
6337
+ function createSecretAwareSettings(raw, opts) {
6338
+ const chains = /* @__PURE__ */ new Map();
6339
+ const serialize = (key, fn) => {
6340
+ const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
6341
+ const tail = next.catch(() => void 0);
6342
+ chains.set(key, tail);
6343
+ tail.then(() => {
6344
+ if (chains.get(key) === tail) chains.delete(key);
6345
+ });
6346
+ return next;
6347
+ };
6348
+ const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6349
+ if (!touchesTree(tree, patch)) return rawWrite(patch);
6350
+ return serialize(chainKey, async () => {
6351
+ const stored = await readStored();
6352
+ const result = await transformSecretWrite({
6353
+ tree,
6354
+ secrets: opts.secrets,
6355
+ patch,
6356
+ stored,
6357
+ ...scope !== void 0 ? { scope } : {},
6358
+ operatorWrite: opts.isOperatorWrite?.() === true
6359
+ });
6360
+ if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6361
+ const { orphaned } = await result.afterWrite();
6362
+ if (orphaned.length > 0) opts.onOrphaned(orphaned);
6363
+ });
6364
+ };
6365
+ const wrapped = {
6366
+ writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6367
+ writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6368
+ kind: "device",
6369
+ deviceId
6370
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6371
+ };
6372
+ return new Proxy(raw, { get(target, prop, receiver) {
6373
+ if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6374
+ if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6375
+ const value = Reflect.get(target, prop, receiver);
6376
+ return typeof value === "function" ? value.bind(target) : value;
6377
+ } });
6378
+ }
6379
+ /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6380
+ function withSecretAwareSettings(context, opts) {
6381
+ const raw = context.settings;
6382
+ if (raw === void 0) return context;
6383
+ const settings = createSecretAwareSettings(raw, opts);
6384
+ return new Proxy(context, { get(target, prop, receiver) {
6385
+ if (prop === "settings") return settings;
6386
+ return Reflect.get(target, prop, receiver);
6387
+ } });
6388
+ }
6389
+ var LEAF = { kind: "leaf" };
6390
+ var DEFAULT_ITEM_ID_KEY = "id";
6391
+ function collectFields(fields, out) {
6392
+ for (const field of fields) {
6393
+ if (field.type === "group") {
6394
+ collectFields(field.fields, out);
6395
+ continue;
6396
+ }
6397
+ if (field.type === "sub-tabs") {
6398
+ for (const tab of field.tabs) collectFields(tab.fields, out);
6399
+ continue;
6400
+ }
6401
+ if (field.type === "editable-array") {
6402
+ const item = /* @__PURE__ */ new Map();
6403
+ for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
6404
+ if (item.size > 0) out.set(field.key, {
6405
+ kind: "array",
6406
+ idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
6407
+ item
6408
+ });
6409
+ continue;
6410
+ }
6411
+ if (!("key" in field) || typeof field.key !== "string") continue;
6412
+ if (isKeychainStoredField(field)) out.set(field.key, LEAF);
6413
+ }
6414
+ }
6415
+ /** The secret tree a settings schema declares. */
6416
+ function secretTreeFromSchema(schema) {
6417
+ const out = /* @__PURE__ */ new Map();
6418
+ if (schema === null) return out;
6419
+ for (const section of schema.sections) collectFields(section.fields, out);
6420
+ return out;
6421
+ }
6422
+ /** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
6423
+ function parseSecretStatePath(path) {
6424
+ const segments = [];
6425
+ for (const raw of path.split(".")) {
6426
+ const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
6427
+ if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
6428
+ segments.push(m[2] !== void 0 ? {
6429
+ key: m[1],
6430
+ idKey: m[2]
6431
+ } : { key: m[1] });
6432
+ }
6433
+ if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
6434
+ if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
6435
+ return segments;
6436
+ }
6437
+ function insert(into, segments) {
6438
+ const [head, ...rest] = segments;
6439
+ if (head === void 0) return;
6440
+ if (rest.length === 0) {
6441
+ into.set(head.key, LEAF);
6442
+ return;
6443
+ }
6444
+ const existing = into.get(head.key);
6445
+ if (head.idKey !== void 0) {
6446
+ const item = new Map(existing?.kind === "array" ? existing.item : []);
6447
+ insert(item, rest);
6448
+ into.set(head.key, {
6449
+ kind: "array",
6450
+ idKey: head.idKey,
6451
+ item
6452
+ });
6453
+ return;
6454
+ }
6455
+ const children = new Map(existing?.kind === "object" ? existing.children : []);
6456
+ insert(children, rest);
6457
+ into.set(head.key, {
6458
+ kind: "object",
6459
+ children
6460
+ });
6461
+ }
6462
+ /** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
6463
+ function mergeSecretStatePaths(tree, paths) {
6464
+ if (paths.length === 0) return tree;
6465
+ const out = new Map(tree);
6466
+ for (const path of paths) insert(out, parseSecretStatePath(path));
6467
+ return out;
6468
+ }
6469
+ /** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
6470
+ var SECRET_RETRY_FIRST_MS = 5e3;
6471
+ var SECRET_RETRY_MAX_MS = 5 * 6e4;
6472
+ /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
6473
+ var SECRET_CHANGE_DEBOUNCE_MS = 250;
5947
6474
  /**
5948
6475
  * Base class for CamStack addons. Eliminates settings boilerplate:
5949
6476
  *
@@ -6013,6 +6540,25 @@ var BaseAddon = class {
6013
6540
  settingsStoreReady = false;
6014
6541
  /** Default config values. Provided via constructor. */
6015
6542
  defaults;
6543
+ /**
6544
+ * Hidden-state paths that hold secrets (D787) — values the addon writes
6545
+ * itself (`updateGlobalSettings`, `state()`) that no form field declares.
6546
+ * Stored in the keychain exactly like a `password` field. Syntax:
6547
+ * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
6548
+ * (`key[<id field>]` addresses array items by id, never by index).
6549
+ */
6550
+ secretStatePaths = [];
6551
+ _addonSecretTree = null;
6552
+ _deviceSecretTree = null;
6553
+ /** Refs the last resolved config pointed at — a change to one re-resolves. */
6554
+ _configSecretRefs = /* @__PURE__ */ new Set();
6555
+ _unresolvedSecrets = [];
6556
+ _secretRetryTimer = null;
6557
+ _secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
6558
+ _secretChangeTimer = null;
6559
+ _secretChangeUnsub = null;
6560
+ /** >0 while an OPERATOR's settings write is being applied. */
6561
+ _operatorWriteDepth = 0;
6016
6562
  constructor(defaults) {
6017
6563
  this.defaults = defaults;
6018
6564
  this._config = { ...defaults };
@@ -6048,8 +6594,18 @@ var BaseAddon = class {
6048
6594
  return this._config;
6049
6595
  }
6050
6596
  async initialize(context) {
6051
- this._ctx = context;
6597
+ const secrets = context.secrets;
6598
+ this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6599
+ secrets,
6600
+ addonTree: () => this.addonSecretTree(),
6601
+ deviceTree: () => this.deviceSecretTree(),
6602
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6603
+ isOperatorWrite: () => this._operatorWriteDepth > 0
6604
+ }) : context;
6052
6605
  await this.resolveConfig();
6606
+ if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6607
+ if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
6608
+ });
6053
6609
  const result = await this.onInitialize();
6054
6610
  this.emitLifecycle(EventCategory.AddonStarted);
6055
6611
  const normalized = normalizeAddonInitResult(result);
@@ -6082,6 +6638,12 @@ var BaseAddon = class {
6082
6638
  */
6083
6639
  async onHubReachable() {}
6084
6640
  async shutdown() {
6641
+ this._secretChangeUnsub?.();
6642
+ this._secretChangeUnsub = null;
6643
+ if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
6644
+ if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
6645
+ this._secretRetryTimer = null;
6646
+ this._secretChangeTimer = null;
6085
6647
  this.emitLifecycle(EventCategory.AddonStopped);
6086
6648
  if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
6087
6649
  await this.onShutdown();
@@ -6160,7 +6722,7 @@ var BaseAddon = class {
6160
6722
  return hydrateSchema(schema, overlay ? {
6161
6723
  ...projected,
6162
6724
  ...overlay
6163
- } : projected);
6725
+ } : projected, { inlineSecretsAsViews: true });
6164
6726
  }
6165
6727
  /**
6166
6728
  * The integration-level view of this addon's settings: exactly the sections
@@ -6209,7 +6771,7 @@ var BaseAddon = class {
6209
6771
  return hydrateSchema({
6210
6772
  ...schema,
6211
6773
  sections
6212
- }, projected);
6774
+ }, projected, { inlineSecretsAsViews: true });
6213
6775
  }
6214
6776
  /**
6215
6777
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -6263,18 +6825,50 @@ var BaseAddon = class {
6263
6825
  value: result.value[key]
6264
6826
  };
6265
6827
  }
6828
+ /**
6829
+ * The OPERATOR's write — a settings form or an admin API call, dispatched by
6830
+ * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
6831
+ * the operator sends is stored as sent even when it equals a pre-keychain
6832
+ * inline value: the operator re-entering a password is a change, an addon
6833
+ * writing back what it read is not (D787).
6834
+ */
6835
+ async updateGlobalSettingsAsOperator(patch, nodeId) {
6836
+ this._operatorWriteDepth++;
6837
+ try {
6838
+ await this.applyGlobalPatch(patch, nodeId);
6839
+ } finally {
6840
+ this._operatorWriteDepth--;
6841
+ }
6842
+ }
6266
6843
  async updateGlobalSettings(patch, nodeId) {
6844
+ await this.applyGlobalPatch(patch, nodeId);
6845
+ }
6846
+ /**
6847
+ * REMOVE stored secrets — their keychain values and their markers (D787).
6848
+ *
6849
+ * Writing `''` to a secret field KEEPS what is stored (an empty string is
6850
+ * what a defaults fallback writes back, and it must never destroy a
6851
+ * credential), so code that means "forget this token" says so here. Without
6852
+ * a keychain (an older kernel) it writes `''`, as such code always did.
6853
+ */
6854
+ async clearSecrets(keys, nodeId) {
6855
+ const tree = this.addonSecretTree();
6856
+ const keychain = this._ctx?.secrets !== void 0;
6857
+ const patch = {};
6858
+ for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
6859
+ await this.applyGlobalPatch(patch, nodeId);
6860
+ }
6861
+ async applyGlobalPatch(barePatch, nodeId) {
6267
6862
  const keys = this.perNodeKeys();
6268
6863
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6269
6864
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6270
- const barePatch = patch;
6271
6865
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6272
6866
  await this._ctx?.settings?.writeAddonStore(scoped);
6273
6867
  if (target !== localNode) return;
6274
6868
  await this.resolveConfig();
6275
6869
  await this.onConfigChanged();
6276
6870
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
6277
- this.maybeAutoRestart(patch, this.globalSettingsSchema());
6871
+ this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
6278
6872
  }
6279
6873
  /**
6280
6874
  * The set of field keys the global settings schema declares `perNode: true`
@@ -6299,7 +6893,7 @@ var BaseAddon = class {
6299
6893
  * time to return its response before the addon is torn down and
6300
6894
  * re-initialised by `AddonRegistryService.restartAddon`.
6301
6895
  */
6302
- maybeAutoRestart(patch, schema) {
6896
+ maybeAutoRestart(patchKeys, schema) {
6303
6897
  if (!schema) return;
6304
6898
  const restartKeys = /* @__PURE__ */ new Set();
6305
6899
  for (const section of schema.sections) for (const field of section.fields) {
@@ -6307,13 +6901,13 @@ var BaseAddon = class {
6307
6901
  if (field.requiresRestart) restartKeys.add(field.key);
6308
6902
  }
6309
6903
  if (restartKeys.size === 0) return;
6310
- if (!Object.keys(patch).some((k) => restartKeys.has(k))) return;
6904
+ if (!patchKeys.some((k) => restartKeys.has(k))) return;
6311
6905
  const ctx = this._ctx;
6312
6906
  if (!ctx) return;
6313
6907
  const addonId = ctx.id;
6314
6908
  setImmediate(() => {
6315
6909
  ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
6316
- ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: Object.keys(patch).filter((k) => restartKeys.has(k)) } });
6910
+ ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
6317
6911
  }).catch((err) => {
6318
6912
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
6319
6913
  });
@@ -6322,7 +6916,7 @@ var BaseAddon = class {
6322
6916
  async getDeviceSettings(deviceId) {
6323
6917
  const schema = this.deviceSettingsSchema();
6324
6918
  if (!schema) return { sections: [] };
6325
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
6919
+ return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6326
6920
  }
6327
6921
  async updateDeviceSettings(deviceId, patch) {
6328
6922
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -6452,7 +7046,7 @@ var BaseAddon = class {
6452
7046
  * selection at boot (absent scoped key ⇒ the constructor default wins).
6453
7047
  */
6454
7048
  async resolveConfig() {
6455
- const stored = await this.readAddonStoreWithRetry();
7049
+ const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
6456
7050
  const perNode = this.perNodeKeys();
6457
7051
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6458
7052
  const resolved = { ...this.defaults };
@@ -6477,7 +7071,7 @@ var BaseAddon = class {
6477
7071
  key,
6478
7072
  schema,
6479
7073
  fallback,
6480
- read: () => this.readAddonStoreWithRetry(),
7074
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
6481
7075
  write: async (patch) => {
6482
7076
  await this._ctx?.settings?.writeAddonStore(patch);
6483
7077
  },
@@ -6494,7 +7088,7 @@ var BaseAddon = class {
6494
7088
  key,
6495
7089
  schema,
6496
7090
  fallback,
6497
- read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
7091
+ read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
6498
7092
  write: async (patch) => {
6499
7093
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
6500
7094
  },
@@ -6506,6 +7100,70 @@ var BaseAddon = class {
6506
7100
  } })
6507
7101
  });
6508
7102
  }
7103
+ /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
7104
+ addonSecretTree() {
7105
+ this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
7106
+ return this._addonSecretTree;
7107
+ }
7108
+ deviceSecretTree() {
7109
+ this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7110
+ return this._deviceSecretTree;
7111
+ }
7112
+ /**
7113
+ * Secrets of this addon's stored config that could not be resolved on the
7114
+ * last read, with why. Non-empty means the addon is running WITHOUT them —
7115
+ * an addon whose function needs one should report itself degraded rather
7116
+ * than start on an empty credential.
7117
+ */
7118
+ get unresolvedSecrets() {
7119
+ return this._unresolvedSecrets;
7120
+ }
7121
+ /**
7122
+ * Substitute every keychain marker in a stored blob with its value. With no
7123
+ * keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
7124
+ * An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
7125
+ * value — and, when the cause can pass, retried with backoff. Nothing is
7126
+ * ever written back from here.
7127
+ */
7128
+ async resolveStoredSecrets(blob, trackForConfig = true) {
7129
+ const secrets = this._ctx?.secrets;
7130
+ if (secrets === void 0) return blob;
7131
+ const refs = collectSecretMarkerRefs(blob);
7132
+ if (trackForConfig) this._configSecretRefs = new Set(refs);
7133
+ if (refs.length === 0) {
7134
+ if (trackForConfig) this._unresolvedSecrets = [];
7135
+ return blob;
7136
+ }
7137
+ const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
7138
+ if (trackForConfig) {
7139
+ this._unresolvedSecrets = unresolved;
7140
+ if (unresolved.length > 0) {
7141
+ this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
7142
+ ref: u.ref,
7143
+ reason: u.reason
7144
+ })) } });
7145
+ if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
7146
+ this.scheduleSecretReresolve(this._secretRetryDelayMs);
7147
+ this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
7148
+ }
7149
+ } else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
7150
+ }
7151
+ return value;
7152
+ }
7153
+ /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7154
+ scheduleSecretReresolve(delayMs) {
7155
+ const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
7156
+ if (this[timerOf] !== null) return;
7157
+ const timer = setTimeout(() => {
7158
+ this[timerOf] = null;
7159
+ if (this._ctx === null) return;
7160
+ this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
7161
+ this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
7162
+ });
7163
+ }, delayMs);
7164
+ timer.unref?.();
7165
+ this[timerOf] = timer;
7166
+ }
6509
7167
  /**
6510
7168
  * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
6511
7169
  * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
@@ -6773,32 +7431,12 @@ object({
6773
7431
  audioCodec: string().optional(),
6774
7432
  metadata: record(string(), unknown()).readonly().optional()
6775
7433
  });
6776
- var EncodedPacketSchema = object({
6777
- type: _enum(["video", "audio"]),
6778
- data: _instanceof(Uint8Array),
6779
- pts: number(),
6780
- dts: number(),
6781
- keyframe: boolean(),
6782
- codec: string()
6783
- });
6784
- var DecodedFrameSchema = object({
6785
- data: _instanceof(Uint8Array),
6786
- width: number(),
6787
- height: number(),
6788
- format: _enum([
6789
- "jpeg",
6790
- "rgb",
6791
- "bgr",
6792
- "yuv420",
6793
- "gray"
6794
- ]),
6795
- timestamp: number()
6796
- });
6797
7434
  /**
6798
7435
  * Wire schema for `FrameHandle` — a zero-pixel, serialisable reference to a
6799
7436
  * frame in a shared-memory ring (Phase 5 / D9). Mirrors the `FrameHandle` TS
6800
- * interface in `interfaces/frame-handle.ts` field-for-field so a decoder cap
6801
- * method (`pullHandles`) can carry handles over tRPC / Moleculer.
7437
+ * interface in `interfaces/frame-handle.ts` field-for-field so a cap method
7438
+ * (the runner's native-crop and pipeline-executor inputs) can carry handles
7439
+ * over tRPC / Moleculer.
6802
7440
  *
6803
7441
  * The `satisfies` assertion below pins this schema to the interface: if a
6804
7442
  * field is added to / removed from `FrameHandle` without a matching schema
@@ -6824,50 +7462,6 @@ var FrameHandleSchema = object({
6824
7462
  slotCount: number().int().positive()
6825
7463
  });
6826
7464
  /**
6827
- * Pixel format a frame-handle subscriber can request from the broker
6828
- * (Phase 5 / D9). The packed, raster subset of `FrameFormat` — the formats a
6829
- * `frameSink: 'shm'` decoder session can write into a `FrameRing` slot.
6830
- * `jpeg` is excluded: a variable-length stream is not a fixed-stride ring
6831
- * payload, and no decoded-frame consumer requests it over the shm plane.
6832
- */
6833
- var FrameHandleFormatSchema = _enum([
6834
- "rgb",
6835
- "bgr",
6836
- "yuv420",
6837
- "gray"
6838
- ]);
6839
- /**
6840
- * Input for `stream-broker.subscribeFrames` (Phase 5 / D9). A consumer asks the
6841
- * broker for a `FrameHandle` stream of one `format`; the broker maintains one
6842
- * shared-memory ring per `(brokerId, format)` actually requested, so a `gray`
6843
- * subscriber (motion) and an `rgb` subscriber (detection) each read the format
6844
- * they asked for with no broker-side conversion.
6845
- */
6846
- var SubscribeFramesInputSchema = object({
6847
- brokerId: string(),
6848
- format: FrameHandleFormatSchema,
6849
- /**
6850
- * Optional reader-side cadence hint in frames per second. The broker does
6851
- * NOT throttle — latest-wins ring reads drop frames implicitly for a slow
6852
- * consumer. The value is echoed back in `SubscribeFramesResult.maxFps` so
6853
- * the consumer can pace its own `pullFrameHandles` polling.
6854
- */
6855
- maxFps: number().positive().optional(),
6856
- /** Short caller-identity tag (`motion`, `detection`, …) for diagnostics. */
6857
- tag: string().optional()
6858
- });
6859
- /**
6860
- * Result of `stream-broker.subscribeFrames`. The consumer then polls
6861
- * `pullFrameHandles({ subscriptionId, maxCount })` and feeds each returned
6862
- * `FrameHandle` to a `FrameRingReader`.
6863
- */
6864
- var SubscribeFramesResultSchema = object({
6865
- /** Opaque id the consumer passes to `pullFrameHandles` / `unsubscribeFrames`. */
6866
- subscriptionId: string(),
6867
- /** Reader-side cadence hint (frames/s) — echoes `SubscribeFramesInput.maxFps`. */
6868
- maxFps: number().nonnegative()
6869
- });
6870
- /**
6871
7465
  * Wire schema for a decoded audio chunk (Phase 5 / D9). Mirrors the
6872
7466
  * `DecodedAudioChunk` TS interface in `interfaces/stream-broker.ts`: PCM
6873
7467
  * sample bytes plus the track parameters a consumer needs to interpret them.
@@ -6875,8 +7469,8 @@ var SubscribeFramesResultSchema = object({
6875
7469
  * Audio chunks are tiny (a ~500ms AudioCodecSession window is a few KB of
6876
7470
  * Float32 PCM), so unlike video frames they ship their bytes INLINE over
6877
7471
  * tRPC / Moleculer — no shared-memory plane. `data` is typed `Uint8Array`
6878
- * (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
6879
- * / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
7472
+ * (the wire-serialisable supertype of `Buffer`); a `Buffer` is assignable to
7473
+ * it.
6880
7474
  */
6881
7475
  var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
6882
7476
  var DecodedAudioChunkSchema = object({
@@ -6894,11 +7488,10 @@ var DecodedAudioChunkSchema = object({
6894
7488
  format: AudioChunkFormatSchema.optional()
6895
7489
  });
6896
7490
  /**
6897
- * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
6898
- * handle-free, ship-bytes-inline analogue of `subscribeFrames`: a consumer
6899
- * asks the broker for the decoded audio-chunk stream of one broker; the
6900
- * broker keeps a per-subscription bounded FIFO queue the consumer drains via
6901
- * `pullAudioChunks`.
7491
+ * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). Audio ships
7492
+ * its bytes inline: a consumer asks the broker for the decoded audio-chunk
7493
+ * stream of one broker; the broker keeps a per-subscription bounded FIFO queue
7494
+ * the consumer drains via `pullAudioChunks`.
6902
7495
  */
6903
7496
  var SubscribeAudioChunksInputSchema = object({
6904
7497
  brokerId: string(),
@@ -6929,9 +7522,7 @@ var BrokerStatsSchema = object({
6929
7522
  "stopped"
6930
7523
  ]),
6931
7524
  inputFps: number(),
6932
- decodeFps: number(),
6933
7525
  encodedSubscribers: number(),
6934
- decodedSubscribers: number(),
6935
7526
  uptimeMs: number(),
6936
7527
  bitrateKbps: number(),
6937
7528
  idrIntervalMs: number(),
@@ -6944,14 +7535,6 @@ var BrokerStatsSchema = object({
6944
7535
  preBufferMs: number(),
6945
7536
  preBufferPackets: number(),
6946
7537
  /**
6947
- * Moleculer node id of the decoder provider currently servicing this
6948
- * stream's decoded subscribers. `null` until the deferred decoder is
6949
- * created (no decoded clients yet, or codec not detected). Surfaces the
6950
- * runtime decoder placement so the UI can show "Decoder: <agent>" without
6951
- * a separate cap call per broker.
6952
- */
6953
- decoderNodeId: string().nullable(),
6954
- /**
6955
7538
  * Detected audio track parameters from the RTSP DESCRIBE / SDP. `null`
6956
7539
  * when the stream has no audio track or the broker is in cold start.
6957
7540
  * `supported = false` means the codec was detected but the local
@@ -7190,6 +7773,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
7190
7773
  kind: "mutation",
7191
7774
  auth: "admin"
7192
7775
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
7776
+ function defOf(schema) {
7777
+ return schema._zod?.def ?? {};
7778
+ }
7779
+ function declaredHere(schema) {
7780
+ return globalRegistry.get(schema)?.secret === true;
7781
+ }
7782
+ /** Wrapper kinds whose `innerType` is the field itself. */
7783
+ var WRAPPERS = new Set([
7784
+ "optional",
7785
+ "nullable",
7786
+ "default",
7787
+ "prefault",
7788
+ "catch",
7789
+ "readonly",
7790
+ "nonoptional"
7791
+ ]);
7792
+ /**
7793
+ * The schema layers that make up ONE field: the schema itself and every
7794
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
7795
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
7796
+ * `.transform` on `in`).
7797
+ */
7798
+ function layersOf(schema) {
7799
+ const out = [];
7800
+ const queue = [schema];
7801
+ while (queue.length > 0) {
7802
+ const s = queue.shift();
7803
+ if (!s || out.includes(s)) continue;
7804
+ out.push(s);
7805
+ const def = defOf(s);
7806
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
7807
+ if (def.type === "pipe") {
7808
+ if (def.in) queue.push(def.in);
7809
+ if (def.out) queue.push(def.out);
7810
+ }
7811
+ }
7812
+ return out;
7813
+ }
7814
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
7815
+ function isZodSecret(schema) {
7816
+ return layersOf(schema).some(declaredHere);
7817
+ }
7818
+ /**
7819
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
7820
+ * element of this array" (`connection.password`, `rows[].token`). A declared
7821
+ * object or array is reported as one path and not descended into — everything
7822
+ * under it is secret.
7823
+ */
7824
+ function collectZodSecretPaths(schema, prefix = "") {
7825
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
7826
+ const paths = [];
7827
+ for (const layer of layersOf(schema)) {
7828
+ const def = defOf(layer);
7829
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
7830
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
7831
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
7832
+ else if (def.type === "intersection") {
7833
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
7834
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
7835
+ }
7836
+ }
7837
+ return [...new Set(paths)];
7838
+ }
7193
7839
  /**
7194
7840
  * Promise-based timer helpers — used everywhere the codebase needs to
7195
7841
  * wait, back off, or schedule a retry. Before these helpers landed, each
@@ -10355,70 +11001,6 @@ var StorageLocationDeclarationSchema = object({
10355
11001
  "backup"
10356
11002
  ]).optional()
10357
11003
  });
10358
- var DecoderStatsSchema = object({
10359
- inputFps: number(),
10360
- outputFps: number(),
10361
- avgDecodeTimeMs: number(),
10362
- droppedFrames: number(),
10363
- /**
10364
- * Pull-mode adaptive-fps telemetry (optional — only pull sessions run the
10365
- * lag-driven controller; push sessions omit these). `lagMs` is the EWMA of
10366
- * the decoder's real-time drift (rising = falling behind live); `adaptiveFps`
10367
- * is the current lag-throttled emit rate (≤ `effectiveFps` ceiling).
10368
- */
10369
- lagMs: number().optional(),
10370
- effectiveFps: number().optional(),
10371
- adaptiveFps: number().optional()
10372
- });
10373
- var DecoderSessionConfigSchema = object({
10374
- codec: string(),
10375
- maxFps: number().default(0),
10376
- outputFormat: _enum([
10377
- "jpeg",
10378
- "rgb",
10379
- "bgr",
10380
- "yuv420",
10381
- "gray"
10382
- ]).default("jpeg"),
10383
- scale: number().default(1),
10384
- width: number().optional(),
10385
- height: number().optional(),
10386
- /**
10387
- * Identifier of the camera this decoder session serves. Optional
10388
- * because the cap is generic (any caller could request decode), but
10389
- * stream-broker passes it so decoder logs include `deviceId` for
10390
- * per-camera filtering when diagnosing failures (e.g. node-av
10391
- * sendPacket errors on a single hung camera).
10392
- */
10393
- deviceId: number().int().nonnegative().optional(),
10394
- /**
10395
- * Free-form tag for log scoping. Stream-broker uses
10396
- * `broker:<deviceId>/<profile>`. Decoder session logger surfaces it
10397
- * on every line so `grep tag=broker:5/high` filters one camera
10398
- * profile cleanly.
10399
- */
10400
- tag: string().optional(),
10401
- /**
10402
- * Where the session delivers decoded frames (Phase 5 / D9):
10403
- *
10404
- * - `'callback'` (default) — the legacy pixel path: decoded frames are
10405
- * buffered as `DecodedFrame`s and drained via `pullFrames`.
10406
- * - `'shm'` — the shared-memory frame plane: decoded frames are written
10407
- * into an OS shared-memory ring and drained as zero-pixel
10408
- * `FrameHandle`s via `pullHandles`. A session is one mode or the
10409
- * other — `pullFrames` returns nothing for an `'shm'` session and
10410
- * `pullHandles` returns nothing for a `'callback'` session.
10411
- */
10412
- frameSink: _enum(["callback", "shm"]).default("callback"),
10413
- /**
10414
- * Per-camera decoder DEBUG facility. When `true`, a pull-mode session emits
10415
- * a throttled (~1Hz) structured `decoder debug` line (effective/adaptive fps,
10416
- * real-time lag, dropped-frame delta, avg decode time, hwaccel). Mirrors the
10417
- * stream-broker's `streamingDebug` gate — off by default so production logs
10418
- * stay quiet and the emit path pays zero per-frame cost when disabled.
10419
- */
10420
- debug: boolean().optional()
10421
- });
10422
11004
  var EU_DST = {
10423
11005
  offsetHours: 1,
10424
11006
  startMonth: 3,
@@ -11093,57 +11675,26 @@ var ClipSearchStrictnessSchema = _enum([
11093
11675
  "balanced",
11094
11676
  "strict"
11095
11677
  ]);
11096
- new Set([
11097
- {
11098
- id: "person",
11099
- name: "Person"
11100
- },
11101
- {
11102
- id: "vehicle",
11103
- name: "Vehicle"
11104
- },
11105
- {
11106
- id: "animal",
11107
- name: "Animal"
11108
- },
11109
- {
11110
- id: "package",
11111
- name: "Package"
11112
- }
11113
- ].map((l) => l.id));
11114
- var COCO_TO_MACRO = {
11115
- mapping: {
11116
- person: "person",
11117
- bicycle: "vehicle",
11118
- car: "vehicle",
11119
- motorcycle: "vehicle",
11120
- airplane: "vehicle",
11121
- bus: "vehicle",
11122
- train: "vehicle",
11123
- truck: "vehicle",
11124
- boat: "vehicle",
11125
- bird: "animal",
11126
- cat: "animal",
11127
- dog: "animal",
11128
- horse: "animal",
11129
- sheep: "animal",
11130
- cow: "animal",
11131
- elephant: "animal",
11132
- bear: "animal",
11133
- zebra: "animal",
11134
- giraffe: "animal",
11135
- suitcase: "package",
11136
- backpack: "package",
11137
- handbag: "package"
11138
- },
11139
- preserveOriginal: false
11140
- };
11141
- /** Steps a root detector may declare it fills. */
11142
- var FILLABLE_STEP_IDS = [
11678
+ /** Steps whose effect a root label can BE. */
11679
+ var LABEL_SUPPLY_STEP_IDS = [
11143
11680
  "animal-classifier",
11144
11681
  "vehicle-classifier",
11145
11682
  "package-detection"
11146
11683
  ];
11684
+ /** Steps whose box a root detection can BE. */
11685
+ var CROP_SUPPLY_STEP_IDS = ["plate-detection", "face-detection"];
11686
+ /**
11687
+ * Steps whose per-detection MASK a root detection can carry (D737). The live
11688
+ * mask step is `segmentation` — a frame-plane refiner that runs its own model
11689
+ * once per detection crop. (`instance-segmentation` is a dormant step id that
11690
+ * no camera tree carries.)
11691
+ */
11692
+ var MASK_SUPPLY_STEP_IDS = ["segmentation"];
11693
+ [
11694
+ ...LABEL_SUPPLY_STEP_IDS,
11695
+ ...CROP_SUPPLY_STEP_IDS,
11696
+ ...MASK_SUPPLY_STEP_IDS
11697
+ ];
11147
11698
  var MODEL_FORMATS = [
11148
11699
  "onnx",
11149
11700
  "coreml",
@@ -11172,7 +11723,53 @@ var ModelFormatEntrySchema = object({
11172
11723
  /** Multi-file payload (directory members or sibling files). */
11173
11724
  files: array(string()).readonly().optional(),
11174
11725
  /** Runtime(s) that can use this format. If omitted, inferred from ModelFormat key */
11175
- runtimes: array(_enum(["python"])).readonly().optional()
11726
+ runtimes: array(_enum(["python"])).readonly().optional(),
11727
+ /**
11728
+ * Content revision of the artefact, for one hosted OFF the CamStack mirror.
11729
+ * A format on the mirror leaves it unset: its revision (the sha256 of its
11730
+ * weight file) comes from the downloader's generated table, kept in step
11731
+ * with the mirror by `scripts/check-hosted-model-revisions.ts` (D744). A
11732
+ * node records the revision it downloaded next to the file
11733
+ * (`<file>.revision`); a copy with no record or a different one is stale
11734
+ * unless its weight file hashes to the revision, and a stale copy is
11735
+ * downloaded again, the old one serving until the new one is complete. No
11736
+ * revision at all ⇒ a file on disk is current, whatever it holds (D743).
11737
+ */
11738
+ revision: string().min(1).optional()
11739
+ });
11740
+ /**
11741
+ * What a node holds for one (model, format) (D746). `current` is a complete
11742
+ * copy at its catalog revision — exactly what `downloaded: true` means.
11743
+ * `stale` is bytes on disk that are not (yet) proven current under D743/D744:
11744
+ * no or a different revision record, or a missing sibling. `missing` is no
11745
+ * copy. `downloaded` alone folds `stale` into "not downloaded", which hid
11746
+ * reclaimable bytes and a copy about to be replaced.
11747
+ */
11748
+ var ModelOnDiskStateSchema = _enum([
11749
+ "current",
11750
+ "stale",
11751
+ "missing"
11752
+ ]);
11753
+ /**
11754
+ * The numeric precision of one format's BUILD (D746) — reported only when the
11755
+ * build states it (file-name token, an INT8 variant, an EdgeTPU compile, a
11756
+ * CamStack Core ML export). Absent means "not stated", never "fp32".
11757
+ */
11758
+ var ModelFormatPrecisionSchema = _enum([
11759
+ "fp32",
11760
+ "fp16",
11761
+ "int8"
11762
+ ]);
11763
+ /**
11764
+ * One format of one model as a node's `pipelineExecutor.getSchema` reports it.
11765
+ * `onDisk` / `precision` are optional for version skew: a runner that predates
11766
+ * them omits them, and a reader falls back to `downloaded`.
11767
+ */
11768
+ var PipelineModelFormatStatusSchema = object({
11769
+ downloaded: boolean(),
11770
+ sizeMB: number(),
11771
+ onDisk: ModelOnDiskStateSchema.optional(),
11772
+ precision: ModelFormatPrecisionSchema.optional()
11176
11773
  });
11177
11774
  /**
11178
11775
  * Extra file that must be downloaded alongside the model (e.g., labels JSON, dict.txt).
@@ -11276,12 +11873,46 @@ var ModelLicenseSchema = preprocess((value) => typeof value === "string" ? { wei
11276
11873
  /** True when the weights or their data forbid commercial use. */
11277
11874
  nonCommercial: boolean().optional()
11278
11875
  }));
11279
- /** One `fillsClassifierEffects` entry — see `ModelCatalogEntry.fillsClassifierEffects`. */
11280
- var FillsClassifierEffectSchema = object({
11281
- stepId: _enum(FILLABLE_STEP_IDS),
11282
- labelToEffect: record(string(), string()),
11283
- uncovered: array(string()).readonly()
11284
- });
11876
+ /**
11877
+ * One step a ROOT detector can supply from its own output (D730) — see
11878
+ * `ModelCatalogEntry.suppliesSteps`.
11879
+ *
11880
+ * - `label`: the root's raw class IS the step's answer. `labelToEffect` maps
11881
+ * the root's label to the step's vocabulary; `uncovered` is the vocabulary
11882
+ * the root cannot produce (shown as unavailable, never a blocker).
11883
+ * - `crop`: the root draws the box the step would have found (`license_plate`
11884
+ * for plate-detection, `face` for face-detection). The box becomes a detail
11885
+ * child of the `parentMacro` detection that contains it — never a track.
11886
+ * - `mask`: the root's decode emits an instance mask with every detection (a
11887
+ * YOLO26-seg root, D737) — the `segmentation` step's result, carried on the
11888
+ * detection in the shape that step produces. Derived from the model's
11889
+ * postprocessor on read, never stored by an import.
11890
+ */
11891
+ var RootStepSupplySchema = discriminatedUnion("kind", [
11892
+ object({
11893
+ kind: literal("label"),
11894
+ stepId: _enum(LABEL_SUPPLY_STEP_IDS),
11895
+ labelToEffect: record(string(), string()),
11896
+ uncovered: array(string()).readonly()
11897
+ }),
11898
+ object({
11899
+ kind: literal("crop"),
11900
+ stepId: _enum(CROP_SUPPLY_STEP_IDS),
11901
+ rootLabels: array(string()).readonly(),
11902
+ parentMacro: _enum(["vehicle", "person"]),
11903
+ childClass: _enum(["plate", "face"]),
11904
+ /**
11905
+ * The root's smaller input side, stamped on read by `rootSuppliesOf` from
11906
+ * the model entry — what a step's `minRootInputPx` gate judges. Never
11907
+ * stored by an import.
11908
+ */
11909
+ rootInputPx: number().int().positive().optional()
11910
+ }),
11911
+ object({
11912
+ kind: literal("mask"),
11913
+ stepId: _enum(MASK_SUPPLY_STEP_IDS)
11914
+ })
11915
+ ]);
11285
11916
  var ModelCatalogEntrySchema = object({
11286
11917
  id: string(),
11287
11918
  name: string(),
@@ -11347,6 +11978,35 @@ var ModelCatalogEntrySchema = object({
11347
11978
  */
11348
11979
  defaultConfidence: number().min(0).max(1).optional(),
11349
11980
  /**
11981
+ * Per-MODEL default of the per-class confidence floors (`minConfidence<Macro>`
11982
+ * on a detector step), keyed by macro class: `{ person: 0.45 }`. A class
11983
+ * absent here runs at the step slider's global default. The same row shape
11984
+ * the floor measurement produces (`model-floors.json`: modelId → floors), so
11985
+ * a measured table is copied in as-is. An operator override is bound to the
11986
+ * model it was made for and does not survive a model change (D738). A custom
11987
+ * / imported model may declare it; without it, the global defaults apply.
11988
+ */
11989
+ defaultClassFloors: record(string(), number().min(0).max(1)).optional(),
11990
+ /**
11991
+ * The inference precision this model's OpenVINO IR needs on an Intel GPU.
11992
+ * Absent ⇒ the device default (f16 on a GPU). Set to `'f32'` for an FP32 IR
11993
+ * that produces invalid output at f16 — measured 2026-10-07 for YOLO26
11994
+ * base IRs (`yolo26s`: 0 true / 146 false positives; `yolo26m*`: NaN
11995
+ * scores) on the Core Ultra iGPU and the N100. Threaded to the pool as
11996
+ * `PoolModelConfig.gpuInferencePrecision`; the pool sets
11997
+ * INFERENCE_PRECISION_HINT on a GPU only. Costs ~60% latency on the GPU.
11998
+ */
11999
+ gpuInferencePrecision: _enum(["f32", "f16"]).optional(),
12000
+ /**
12001
+ * ROOT detectors only: per supplied step (`animal-classifier`, …), the
12002
+ * minimum DETECTION score from which this root's own fine label (species,
12003
+ * vehicle type — D736 root supply) is taken (D741). Below it the detection
12004
+ * keeps its macro class without the fine label. `1` = never take it from
12005
+ * this root. Absent ⇒ no floor beyond the macro floor. The supplied step's
12006
+ * `minConfidence` slider, bound to the ROOT model, overrides it.
12007
+ */
12008
+ suppliedLabelFloors: record(string(), number().min(0).max(1)).optional(),
12009
+ /**
11350
12010
  * When true, the executor produces a landmark-aligned crop (similarity warp
11351
12011
  * onto the canonical template) before this step runs, instead of a plain
11352
12012
  * axis-aligned bbox crop. Required for face-recognition embedders (ArcFace):
@@ -11408,15 +12068,15 @@ var ModelCatalogEntrySchema = object({
11408
12068
  */
11409
12069
  classMap: DetectionCatalogClassMapSchema.optional(),
11410
12070
  /**
11411
- * The pipeline steps this ROOT detector already does the work of (D715):
11412
- * its labels name the effect the step exists to produce (`deer` for
11413
- * `animal-classifier`, `package` for `package-detection`). Derived from the
11414
- * labelmap by `deriveClassifierFills`, never hand-written; a COCO model
11415
- * declares none. Whether a declaration is honoured is the step's own
11416
- * `labelLink` policy (`resolveLabelLink`). `labelToEffect` values are in
11417
- * `FILLABLE_STEP_VOCABULARIES` (guard `check-label-link-vocabulary`).
12071
+ * The pipeline steps this ROOT detector can supply from its own output
12072
+ * (D730): its labels name a step's effect (`deer` for `animal-classifier`)
12073
+ * or draw a step's box (`license_plate` for `plate-detection`). Computed at
12074
+ * import from THIS model's labelmap by `deriveRootSupplies`, never written
12075
+ * by hand and never assumed per family; a row without it is derived on read
12076
+ * (`rootSuppliesOf`). Whether a camera uses it is the step's own
12077
+ * `useRootModel` flag (`resolveRootSupply`).
11418
12078
  */
11419
- fillsClassifierEffects: array(FillsClassifierEffectSchema).readonly().optional(),
12079
+ suppliesSteps: array(RootStepSupplySchema).readonly().optional(),
11420
12080
  /**
11421
12081
  * The model's CLIP feature-space contract (text encoder, dimension, vector
11422
12082
  * index, token window, search floor) — see `clip-model.ts`. Present ONLY on a
@@ -13019,13 +13679,6 @@ var BrokerRtspClientSchema = object({
13019
13679
  lastRtpAt: number(),
13020
13680
  bytesSent: number()
13021
13681
  });
13022
- var BrokerDecodedClientSchema = object({
13023
- tag: string(),
13024
- subscribedAt: number(),
13025
- maxFps: number(),
13026
- framesDelivered: number(),
13027
- framesDropped: number()
13028
- });
13029
13682
  var BrokerAudioClientSchema = object({
13030
13683
  tag: string(),
13031
13684
  subscribedAt: number(),
@@ -13117,7 +13770,6 @@ var BrokerEncodedClientSchema = object({
13117
13770
  });
13118
13771
  var BrokerClientsSchema = object({
13119
13772
  rtsp: array(BrokerRtspClientSchema).readonly(),
13120
- decoded: array(BrokerDecodedClientSchema).readonly(),
13121
13773
  audio: array(BrokerAudioClientSchema).readonly(),
13122
13774
  encoded: array(BrokerEncodedClientSchema).readonly(),
13123
13775
  pipeClients: number(),
@@ -13486,11 +14138,7 @@ method(object({
13486
14138
  auth: "admin"
13487
14139
  }), method(object({ brokerId: string() }), BrokerClientsSchema), method(object({
13488
14140
  brokerId: string(),
13489
- channel: _enum([
13490
- "rtsp",
13491
- "decoded",
13492
- "audio"
13493
- ]),
14141
+ channel: _enum(["rtsp", "audio"]),
13494
14142
  handle: string()
13495
14143
  }), object({ killed: boolean() }), {
13496
14144
  kind: "mutation",
@@ -13525,10 +14173,7 @@ method(object({
13525
14173
  }), method(SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, { kind: "mutation" }), method(object({
13526
14174
  subscriptionId: string(),
13527
14175
  maxCount: number().int().positive().default(8)
13528
- }), array(DecodedAudioChunkSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(SubscribeFramesInputSchema, SubscribeFramesResultSchema, { kind: "mutation" }), method(object({
13529
- subscriptionId: string(),
13530
- maxCount: number().int().positive().default(4)
13531
- }), array(FrameHandleSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(object({
14176
+ }), array(DecodedAudioChunkSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(object({
13532
14177
  brokerId: string(),
13533
14178
  seconds: number().min(0).max(30)
13534
14179
  }), _void(), {
@@ -14788,53 +15433,201 @@ id: union([string(), number()]) }), {
14788
15433
  auth: "admin"
14789
15434
  });
14790
15435
  /**
14791
- * shm ring usage stats for a `frameSink: 'shm'` decoder session —
14792
- * exposed via `decoder.getShmStats` so downstream consumers can
14793
- * observe ring pressure (slot count, byte budget, hit/miss ratio).
15436
+ * `keychain` — the hub's encrypted store of secret values (D787).
15437
+ *
15438
+ * Settings blobs never hold a secret: they hold a marker
15439
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
15440
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
15441
+ * is the OWNER's door to its own values: every method is owner-checked
15442
+ * against the CALLER, never against anything the caller claims.
15443
+ *
15444
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
15445
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
15446
+ * connection, the agent from its child's connection carried in
15447
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
15448
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
15449
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
15450
+ * identity against BUGS and misrouting, not against a malicious addon (every
15451
+ * runner is the same OS user): see the threat model in
15452
+ * `docs/design/2026-10-08-secrets-keychain.md`.
15453
+ *
15454
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
15455
+ * parses the input, so a session can never supply it, and the internal mount
15456
+ * floors every method to admin anyway (D240).
15457
+ *
15458
+ * Internal: addons reach it through `ctx.secrets`, never directly.
15459
+ */
15460
+ /** Why a value cannot be served right now. Never folded into "missing". */
15461
+ var KeychainUnavailableReasonSchema = _enum([
15462
+ "key-missing",
15463
+ "wrong-key",
15464
+ "key-file-unreadable",
15465
+ "store-unavailable",
15466
+ "not-initialized",
15467
+ "decrypt-failed"
15468
+ ]);
15469
+ var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
15470
+ state: literal("locked"),
15471
+ reason: KeychainUnavailableReasonSchema
15472
+ })]);
15473
+ var KeychainResolveEntrySchema = discriminatedUnion("kind", [
15474
+ object({
15475
+ kind: literal("value"),
15476
+ value: string(),
15477
+ version: number().int()
15478
+ }),
15479
+ object({ kind: literal("missing") }),
15480
+ object({
15481
+ kind: literal("unavailable"),
15482
+ reason: KeychainUnavailableReasonSchema
15483
+ }),
15484
+ object({ kind: literal("forbidden") })
15485
+ ]);
15486
+ var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
15487
+ /** Metadata of one stored value — never the value. */
15488
+ var KeychainSecretMetaSchema = object({
15489
+ ref: string(),
15490
+ owner: string(),
15491
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
15492
+ scope: string(),
15493
+ fieldPath: string(),
15494
+ version: number().int(),
15495
+ createdAt: number(),
15496
+ updatedAt: number(),
15497
+ /** `addon:<id>` | `user:<id>` | `system`. */
15498
+ updatedBy: string(),
15499
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
15500
+ lastReadAt: number().nullable()
15501
+ });
15502
+ var RefListSchema = array(string().min(1)).max(512);
15503
+ method(object({
15504
+ ref: string().min(1),
15505
+ value: string().min(1)
15506
+ }), object({
15507
+ ref: string(),
15508
+ version: number().int()
15509
+ }), {
15510
+ kind: "mutation",
15511
+ auth: "admin"
15512
+ }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
15513
+ kind: "mutation",
15514
+ auth: "admin"
15515
+ }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
15516
+ var KeychainKeySourceSchema = object({
15517
+ kind: _enum([
15518
+ "config-file",
15519
+ "previous-config-file",
15520
+ "platform",
15521
+ "default-file"
15522
+ ]),
15523
+ /** File sources only — a path is not a secret. */
15524
+ path: string().optional(),
15525
+ /**
15526
+ * True when a whole-volume backup of the data directory carries this key
15527
+ * next to the database it protects (the default file). The page warns.
15528
+ */
15529
+ sharesBackupWithDatabase: boolean()
15530
+ });
15531
+ var KeychainStatusSchema = object({
15532
+ keychain: KeychainStateSchema,
15533
+ /** The source of the master key in use; `null` while locked. */
15534
+ keySource: KeychainKeySourceSchema.nullable(),
15535
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
15536
+ configuredSource: KeychainKeySourceSchema,
15537
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
15538
+ fingerprint: string().nullable(),
15539
+ activeKeyId: string().nullable(),
15540
+ /**
15541
+ * The keychain unlocked with a NON-primary source: the configured primary
15542
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
15543
+ */
15544
+ rotationPending: boolean(),
15545
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
15546
+ retiredWraps: number().int(),
15547
+ recoveryKeyDownloadedAt: number().nullable(),
15548
+ secretCount: number().int()
15549
+ });
15550
+ /**
15551
+ * Whether a stored value is still pointed at by its owner's settings.
15552
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
15553
+ * never reported as an orphan (and never deleted as one).
14794
15554
  */
14795
- var ShmRingStatsSchema = object({
14796
- sessionId: string(),
14797
- slotCount: number().int(),
14798
- slotByteLength: number().int(),
14799
- segmentBytes: number().int(),
14800
- budgetMb: number().int(),
14801
- framesWritten: number().int(),
14802
- getFrameHits: number().int(),
14803
- getFrameMisses: number().int()
14804
- });
14805
- method(object({ codec: string() }), boolean()), method(_void(), object({
15555
+ var KeychainSecretUsageSchema = _enum([
15556
+ "in-use",
15557
+ "orphan",
15558
+ "unknown"
15559
+ ]);
15560
+ var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
15561
+ var KeychainAuditActionSchema = _enum([
15562
+ "put",
15563
+ "delete",
15564
+ "reveal",
15565
+ "rotate-master-key",
15566
+ "purge-retired-keys",
15567
+ "download-recovery-key",
15568
+ "delete-orphans",
15569
+ "reset",
15570
+ "initialize"
15571
+ ]);
15572
+ var KeychainAuditEntrySchema = object({
15573
+ id: string(),
15574
+ at: number(),
15575
+ action: KeychainAuditActionSchema,
15576
+ /** `addon:<id>` | `user:<id>` | `system`. */
15577
+ actor: string(),
15578
+ ref: string().nullable(),
15579
+ detail: string().nullable()
15580
+ });
15581
+ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}), array(KeychainAdminSecretSchema).readonly(), { auth: "admin" }), method(object({ limit: number().int().min(1).max(500).optional() }), array(KeychainAuditEntrySchema).readonly(), { auth: "admin" }), method(object({ ref: string().min(1) }), object({
15582
+ value: string(),
15583
+ version: number().int()
15584
+ }), {
15585
+ kind: "mutation",
15586
+ auth: "admin",
15587
+ caller: "required"
15588
+ }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
15589
+ deleted: array(string()).readonly(),
15590
+ kept: array(object({
15591
+ ref: string(),
15592
+ usage: KeychainSecretUsageSchema
15593
+ })).readonly()
15594
+ }), {
15595
+ kind: "mutation",
15596
+ auth: "admin",
15597
+ caller: "required"
15598
+ }), method(object({}), object({
15599
+ fingerprint: string(),
15600
+ keySource: KeychainKeySourceSchema
15601
+ }), {
15602
+ kind: "mutation",
15603
+ auth: "admin",
15604
+ caller: "required"
15605
+ }), method(object({}), object({ purged: number().int() }), {
15606
+ kind: "mutation",
15607
+ auth: "admin",
15608
+ caller: "required"
15609
+ }), method(object({}), object({
15610
+ key: string(),
15611
+ fingerprint: string(),
15612
+ keySource: KeychainKeySourceSchema
15613
+ }), {
15614
+ kind: "mutation",
15615
+ auth: "admin",
15616
+ caller: "required"
15617
+ }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15618
+ archivedCollection: string().nullable(),
15619
+ archived: number().int()
15620
+ }), {
15621
+ kind: "mutation",
15622
+ auth: "admin",
15623
+ caller: "required"
15624
+ });
15625
+ method(_void(), object({
14806
15626
  id: string(),
14807
15627
  name: string(),
14808
- isPullMode: boolean().optional(),
14809
- priority: number().optional(),
14810
15628
  hwaccel: string().optional(),
14811
15629
  probedBestHwaccel: string().optional()
14812
- })), method(DecoderSessionConfigSchema, object({
14813
- sessionId: string(),
14814
- nodeId: string()
14815
- })), method(object({ sessionId: string() }), _void()), method(object({
14816
- sessionId: string(),
14817
- packet: EncodedPacketSchema
14818
- }), _void()), method(object({
14819
- sessionId: string(),
14820
- url: string()
14821
- }), _void()), method(object({
14822
- sessionId: string(),
14823
- maxCount: number().default(1),
14824
- waitMs: number().optional()
14825
- }), array(DecodedFrameSchema)), method(object({
14826
- sessionId: string(),
14827
- maxCount: number().default(1),
14828
- waitMs: number().optional()
14829
- }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
14830
- sessionId: string(),
14831
- config: DecoderSessionConfigSchema.partial()
14832
- }), _void()), method(object({ sessionId: string() }), DecoderStatsSchema), method(_void(), array(object({
14833
- sessionId: string(),
14834
- codec: string(),
14835
- outputFormat: string(),
14836
- createdAtMs: number()
14837
- })).readonly()), method(_void(), object({ backend: string() }), {
15630
+ })), method(_void(), object({ backend: string() }), {
14838
15631
  kind: "mutation",
14839
15632
  auth: "admin"
14840
15633
  });
@@ -15947,6 +16740,10 @@ var DeviceInfoSchema = object({
15947
16740
  isCamera: boolean(),
15948
16741
  /** Current config values — serializable snapshot */
15949
16742
  config: record(string(), unknown()),
16743
+ /** Paths inside `config` the device's schema declares secret (D783) —
16744
+ * what the non-admin redaction withholds. Paths, never values. Absent
16745
+ * when the owning runner has not reported them. */
16746
+ secretConfigPaths: array(string()).optional(),
15950
16747
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
15951
16748
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
15952
16749
  metadata: record(string(), unknown()).nullable().optional(),
@@ -16152,12 +16949,22 @@ var DeviceRegisterPayloadSchema = object({
16152
16949
  * call (workers re-register on init), so probe-driven updates
16153
16950
  * (e.g. PTZ flag flipping after the abilities probe) propagate. */
16154
16951
  features: array(string()).optional(),
16155
- config: record(string(), unknown())
16952
+ config: record(string(), unknown()),
16953
+ /** Config paths the device's own schema DECLARES secret
16954
+ * (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
16955
+ * `connection.password`). Re-published on every register; the non-admin
16956
+ * redaction withholds them at any depth (D783). Optional: an older runner
16957
+ * omits it and the keyword backstop applies. */
16958
+ secretConfigPaths: array(string()).optional()
16156
16959
  });
16157
16960
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
16158
16961
  var DevicePersistConfigPayloadSchema = object({
16159
16962
  deviceId: number(),
16160
- data: record(string(), unknown())
16963
+ data: record(string(), unknown()),
16964
+ /** The paths the device's schema declares secret (D783), when the caller
16965
+ * knows them — those values are kept in the keychain, not the blob (D787).
16966
+ * Absent: the paths the device last reported at `registerDevice` apply. */
16967
+ secretConfigPaths: array(string()).optional()
16161
16968
  });
16162
16969
  /** What a migration actually did, per switch. `unreachable` is a first-class
16163
16970
  * answer: a camera that could not be asked is not a camera that was silenced. */
@@ -16998,6 +17805,12 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
16998
17805
  kind: "mutation",
16999
17806
  auth: "admin"
17000
17807
  });
17808
+ var HUB_ADDRESS_ROLES = [
17809
+ "appConnections",
17810
+ "notificationTaps",
17811
+ "internal",
17812
+ "publicEndpoint"
17813
+ ];
17001
17814
  /**
17002
17815
  * Transport bounds for AI capability methods.
17003
17816
  *
@@ -17845,7 +18658,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17845
18658
  icon: string().optional(),
17846
18659
  /** Addon-owned HTTP route the button navigates to (GET). */
17847
18660
  startUrl: string(),
17848
- stage: LoginStageEnum
18661
+ stage: LoginStageEnum,
18662
+ /**
18663
+ * The provider names an external identity a signed-in user can link to
18664
+ * their own account (D782): `auth.listLinkableProviders` /
18665
+ * `beginExternalLink` offer exactly the redirect methods that set this,
18666
+ * whatever their id. Absent / false — a login button only (magic-link).
18667
+ */
18668
+ linkable: boolean().optional()
17849
18669
  }),
17850
18670
  object({
17851
18671
  kind: literal("widget"),
@@ -18781,6 +19601,51 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
18781
19601
  kind: "mutation",
18782
19602
  auth: "admin"
18783
19603
  });
19604
+ new Set([
19605
+ {
19606
+ id: "person",
19607
+ name: "Person"
19608
+ },
19609
+ {
19610
+ id: "vehicle",
19611
+ name: "Vehicle"
19612
+ },
19613
+ {
19614
+ id: "animal",
19615
+ name: "Animal"
19616
+ },
19617
+ {
19618
+ id: "package",
19619
+ name: "Package"
19620
+ }
19621
+ ].map((l) => l.id));
19622
+ var COCO_TO_MACRO = {
19623
+ mapping: {
19624
+ person: "person",
19625
+ bicycle: "vehicle",
19626
+ car: "vehicle",
19627
+ motorcycle: "vehicle",
19628
+ airplane: "vehicle",
19629
+ bus: "vehicle",
19630
+ train: "vehicle",
19631
+ truck: "vehicle",
19632
+ boat: "vehicle",
19633
+ bird: "animal",
19634
+ cat: "animal",
19635
+ dog: "animal",
19636
+ horse: "animal",
19637
+ sheep: "animal",
19638
+ cow: "animal",
19639
+ elephant: "animal",
19640
+ bear: "animal",
19641
+ zebra: "animal",
19642
+ giraffe: "animal",
19643
+ suitcase: "package",
19644
+ backpack: "package",
19645
+ handbag: "package"
19646
+ },
19647
+ preserveOriginal: false
19648
+ };
18784
19649
  var AUDIO_MACRO_LABELS = [
18785
19650
  {
18786
19651
  id: "speech",
@@ -21183,7 +22048,13 @@ var NcAlarmModeDelaysListSchema = array(object({
21183
22048
  * Absent = false (logged, not sent). Even when true it is not sent when that same sensor
21184
22049
  * is the one that starts the entry delay — the entry-delay notification already names it.
21185
22050
  */
21186
- notifySensorRewatched: boolean().optional()
22051
+ notifySensorRewatched: boolean().optional(),
22052
+ /**
22053
+ * D735: notify "ignored" when a sensor this arm bypassed really MOVED while armed (its own
22054
+ * change time is after the arm) and set nothing off. Absent = false (logged, not sent). A
22055
+ * re-sync, a recovery from `unavailable` or a duplicate is never announced, switch or not.
22056
+ */
22057
+ notifySensorIgnored: boolean().optional()
21187
22058
  })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
21188
22059
  var NcAlarmModeDelaysEditListSchema = array(object({
21189
22060
  mode: AlarmArmModeSchema,
@@ -21196,7 +22067,9 @@ var NcAlarmModeDelaysEditListSchema = array(object({
21196
22067
  /** D706: set the switch, or `null` to clear it (back to the default, false). */
21197
22068
  notifyDuringEntryDelay: boolean().nullable().optional(),
21198
22069
  /** D706: set the switch, or `null` to clear it (back to the default, false). */
21199
- notifySensorRewatched: boolean().nullable().optional()
22070
+ notifySensorRewatched: boolean().nullable().optional(),
22071
+ /** D735: set the switch, or `null` to clear it (back to the default, false). */
22072
+ notifySensorIgnored: boolean().nullable().optional()
21200
22073
  })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
21201
22074
  /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
21202
22075
  var NcAlarmNonBlockingEditSchema = object({
@@ -22174,8 +23047,8 @@ Object.freeze(Object.fromEntries([{
22174
23047
  var CLUSTER_STEP_SETTING_FIELDS = [{
22175
23048
  stepId: "face-embedding",
22176
23049
  key: "minLandmarkFaceSize",
22177
- label: "Min face size for recognition (detection px)",
22178
- description: "Refuse to embed a face smaller than this IN THE DETECTION FRAME. Applies to every node — the enrolled gallery is one index, and two admission floors would fill it from two policies. 0 disables the gate.",
23050
+ label: "Min face size to embed (detection-frame px)",
23051
+ description: "Faces smaller than this in the small frame the detector sees are not embedded, so they can never be recognised. Below it the face cannot be aligned reliably and a bad embedding matches everyone. Same value on every node. 0 = no limit.",
22179
23052
  type: "slider",
22180
23053
  min: 0,
22181
23054
  max: 64,
@@ -23148,8 +24021,23 @@ var RetrainMacroClassSchema = _enum([
23148
24021
  ]);
23149
24022
  /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
23150
24023
  var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
23151
- /** Did a human draw this box, or did the assist propose it? */
23152
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
24024
+ /**
24025
+ * Where a box came from. A machine-sourced box is a DRAFT on the page until
24026
+ * the operator confirms it; once saved it keeps its source as provenance.
24027
+ *
24028
+ * - `operator` — drawn by hand.
24029
+ * - `assist` — proposed by a detector run on the copy (the camera's own
24030
+ * model, or a larger teacher model).
24031
+ * - `pipeline` — the box the live pipeline actually drew on that frame, read
24032
+ * back from the track store (never a re-run).
24033
+ * - `llm` — proposed by a vision-capable LLM profile.
24034
+ */
24035
+ var RetrainAnnotationSourceSchema = _enum([
24036
+ "operator",
24037
+ "assist",
24038
+ "pipeline",
24039
+ "llm"
24040
+ ]);
23153
24041
  /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
23154
24042
  var RetrainBboxSchema = object({
23155
24043
  x: number(),
@@ -23167,7 +24055,8 @@ var RetrainBboxSchema = object({
23167
24055
  */
23168
24056
  var RetrainAnnotationSchema = object({
23169
24057
  id: string(),
23170
- trackId: string(),
24058
+ /** The frame's track. Absent on a recording still, which has none. */
24059
+ trackId: string().optional(),
23171
24060
  deviceId: number(),
23172
24061
  /** The COPY in retrain storage — never the source track's media key. */
23173
24062
  mediaKey: string(),
@@ -23216,18 +24105,63 @@ var RetrainFrameCandidateSchema = object({
23216
24105
  * fail, whatever became of the original. */
23217
24106
  copied: boolean()
23218
24107
  });
24108
+ /**
24109
+ * One box the live pipeline drew on a copied frame — what a correction starts
24110
+ * from. Derived when the frame is listed, from the track store: the subject
24111
+ * box recorded on the source media row when there is one, else the track
24112
+ * position nearest the frame's capture time. Never stored as an annotation
24113
+ * until the operator confirms it.
24114
+ */
24115
+ var RetrainPipelineBoxSchema = object({
24116
+ /** Normalised `[0,1]` against the full frame. */
24117
+ bbox: RetrainBboxSchema,
24118
+ macroClass: RetrainMacroClassSchema,
24119
+ label: string().optional(),
24120
+ subLabel: string().optional(),
24121
+ /** The detection score of the position used, when it was recorded. */
24122
+ score: number().optional(),
24123
+ /** The root model that produced the track, when it was recorded. */
24124
+ modelId: string().optional(),
24125
+ trackId: string(),
24126
+ /** `subject-box`: recorded on this very frame. `position`: the track's
24127
+ * position nearest the capture time, `deltaMs` away. */
24128
+ basis: _enum(["subject-box", "position"]),
24129
+ deltaMs: number()
24130
+ });
24131
+ /**
24132
+ * Where a retrain frame came from: a TRACK's stored media (copy-on-select),
24133
+ * or the RECORDING at an instant — the frame a model saw nothing in has no
24134
+ * track at all.
24135
+ */
24136
+ var RetrainFrameOriginSchema = _enum(["track", "recording"]);
23219
24137
  /** A frame the dataset OWNS: bytes copied at selection time. */
23220
24138
  var RetrainFrameSchema = object({
23221
24139
  frameId: string(),
23222
24140
  deviceId: number(),
23223
- trackId: string(),
23224
- /** Provenance only. It may already point at nothing — that is expected. */
23225
- sourceMediaId: number().int(),
24141
+ origin: RetrainFrameOriginSchema,
24142
+ /** The track it was copied from. Absent on a recording still. */
24143
+ trackId: string().optional(),
24144
+ /** Provenance only. It may already point at nothing — that is expected.
24145
+ * Absent on a recording still. */
24146
+ sourceMediaId: number().int().optional(),
24147
+ /** A recording still: the playhead instant it was taken at. */
24148
+ epochMs: number().optional(),
23226
24149
  sourceKind: MediaFileKindEnum,
23227
24150
  sizeBytes: number().int(),
23228
24151
  width: number().int(),
23229
24152
  height: number().int(),
23230
- copiedAt: number()
24153
+ copiedAt: number(),
24154
+ /** When the CAMERA captured the frame. Absent on a copy taken before D785. */
24155
+ capturedAt: number().optional(),
24156
+ /** The operator's "every subject in this frame is boxed". Detector
24157
+ * evaluation keeps only complete frames: an unboxed subject would count as
24158
+ * a false positive. */
24159
+ complete: boolean(),
24160
+ /** The boxes the pipeline drew on this frame. Present on list answers;
24161
+ * empty when nothing the track store holds can be placed on it. */
24162
+ pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
24163
+ /** The named collections this frame belongs to. Present on list answers. */
24164
+ collectionIds: array(string()).readonly().optional()
23231
24165
  });
23232
24166
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
23233
24167
  var RetrainCopyRefusalSchema = _enum([
@@ -23248,6 +24182,53 @@ var RetrainFrameListSchema = object({
23248
24182
  /** What the page pre-selects — the native key frame when one survives. */
23249
24183
  autoPickMediaId: number().int().optional()
23250
24184
  });
24185
+ /**
24186
+ * Which frames an annotated export carries. Every field narrows; an empty
24187
+ * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
24188
+ * list owned by whoever trains (the training orchestrator), so `frameIds` is
24189
+ * the primitive a version export uses; `batchId` re-selects what an earlier
24190
+ * export carried (`exportedInBatch`).
24191
+ */
24192
+ var RetrainExportFilterSchema = object({
24193
+ deviceIds: array(number()).optional(),
24194
+ frameIds: array(string()).max(2e4).optional(),
24195
+ /** Only frames in at least one of these named collections. */
24196
+ collectionIds: array(string()).max(200).optional(),
24197
+ batchId: string().optional(),
24198
+ /** Only frames the operator marked complete (all subjects boxed). */
24199
+ completeOnly: boolean().optional()
24200
+ });
24201
+ /**
24202
+ * `frames`: the full frame copies, boxes in `annotations.json`.
24203
+ * `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
24204
+ * convention — the classifier layout.
24205
+ */
24206
+ var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
24207
+ /**
24208
+ * Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
24209
+ * the archive, sent chunk by chunk. Covers a presigned PUT and a provider
24210
+ * addon's data-plane upload route alike. Headers are sent verbatim and never
24211
+ * logged.
24212
+ */
24213
+ var RetrainArchiveTargetSchema = object({
24214
+ kind: literal("http"),
24215
+ method: _enum(["PUT", "POST"]),
24216
+ url: string().url(),
24217
+ headers: record(string(), string()).optional()
24218
+ });
24219
+ var RetrainArchiveResultSchema = object({
24220
+ batchId: string(),
24221
+ frames: number().int(),
24222
+ crops: number().int(),
24223
+ annotations: number().int(),
24224
+ /** Frames planned but not shipped (unreadable copy, path too long). */
24225
+ missing: number().int(),
24226
+ bytes: number().int(),
24227
+ /** sha256 of the exact bytes sent. */
24228
+ sha256: string(),
24229
+ /** The target's HTTP status. */
24230
+ status: number().int()
24231
+ });
23251
24232
  /** What the operator asked the assist to look for. */
23252
24233
  var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
23253
24234
  kind: literal("package"),
@@ -23277,6 +24258,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
23277
24258
  reason: string(),
23278
24259
  detail: string().optional()
23279
24260
  })]);
24261
+ /** A named set over the retrain corpus — membership only, it owns no pixels. */
24262
+ var RetrainCollectionSchema = object({
24263
+ id: string(),
24264
+ name: string(),
24265
+ createdAt: number(),
24266
+ frameCount: number().int()
24267
+ });
24268
+ var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
24269
+ kind: literal("created"),
24270
+ collection: RetrainCollectionSchema
24271
+ }), object({
24272
+ kind: literal("refused"),
24273
+ reason: _enum(["empty-name", "duplicate-name"])
24274
+ })]);
24275
+ var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
24276
+ kind: literal("renamed"),
24277
+ collection: RetrainCollectionSchema
24278
+ }), object({
24279
+ kind: literal("refused"),
24280
+ reason: _enum([
24281
+ "empty-name",
24282
+ "duplicate-name",
24283
+ "unknown-collection"
24284
+ ])
24285
+ })]);
24286
+ /**
24287
+ * The outcome of adding the frame at a recording instant. Every refusal is
24288
+ * named: `still-unavailable` (not recording, a gap, or an undecodable frame —
24289
+ * `detail` says which), `still-busy` (the recorder is at its decode bound; try
24290
+ * again), `unreadable-image`, `write-failed`, `unknown-collection`.
24291
+ */
24292
+ var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
24293
+ kind: literal("added"),
24294
+ collectionId: string(),
24295
+ frame: RetrainFrameSchema,
24296
+ /** The moment was already in the dataset; nothing was decoded. */
24297
+ reused: boolean()
24298
+ }), object({
24299
+ kind: literal("refused"),
24300
+ reason: _enum([
24301
+ "unknown-collection",
24302
+ "still-unavailable",
24303
+ "still-busy",
24304
+ "unreadable-image",
24305
+ "write-failed"
24306
+ ]),
24307
+ detail: string().optional()
24308
+ })]);
24309
+ /** A vision LLM profile the AI assist may use, and where it sends the frame. */
24310
+ var RetrainAssistProfileSchema = object({
24311
+ id: string(),
24312
+ name: string(),
24313
+ model: string(),
24314
+ kind: string(),
24315
+ /** `true` when the frame would leave the house (a cloud vendor, or an
24316
+ * endpoint that is not on the local network). The page confirms each such
24317
+ * run, and the provider refuses one without `allowCloud`. */
24318
+ leavesHouse: boolean()
24319
+ });
24320
+ /** A box the AI assist proposed: a draft, plus the model's own reason. */
24321
+ var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
24322
+ /** What the AI assist said about a box that was already on the canvas. */
24323
+ var RetrainLlmReviewSchema = object({
24324
+ /** The `ref` the page sent the box under. */
24325
+ ref: string(),
24326
+ verdict: _enum([
24327
+ "confirmed",
24328
+ "wrong-class",
24329
+ "not-an-object",
24330
+ "uncertain"
24331
+ ]),
24332
+ suggestedClass: RetrainMacroClassSchema.optional(),
24333
+ reason: string()
24334
+ });
24335
+ /**
24336
+ * The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
24337
+ * model and its confidence) and reviews; items the model got wrong (a box off
24338
+ * the frame, an unasked class, an unknown ref) are dropped and counted in
24339
+ * `rejected`. A whole answer that is not the schema is `malformed-answer`.
24340
+ */
24341
+ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
24342
+ kind: literal("proposed"),
24343
+ profileId: string(),
24344
+ model: string(),
24345
+ /** The frame was sent outside the house for this answer. */
24346
+ leftHouse: boolean(),
24347
+ proposals: array(RetrainLlmProposalSchema).readonly(),
24348
+ reviews: array(RetrainLlmReviewSchema).readonly(),
24349
+ rejected: number().int()
24350
+ }), object({
24351
+ kind: literal("refused"),
24352
+ reason: _enum([
24353
+ "unknown-frame",
24354
+ "unreadable-frame",
24355
+ "unknown-profile",
24356
+ "profile-disabled",
24357
+ "no-vision",
24358
+ "cloud-not-confirmed",
24359
+ "llm-error",
24360
+ "malformed-answer"
24361
+ ]),
24362
+ detail: string().optional()
24363
+ })]);
23280
24364
  /** The outcome of a lifecycle move owned by the retrain page. */
23281
24365
  var RetrainTransitionResultSchema = object({
23282
24366
  trackId: string(),
@@ -23994,7 +25078,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23994
25078
  auth: "admin"
23995
25079
  }), method(object({
23996
25080
  deviceId: number(),
23997
- trackId: string(),
25081
+ trackId: string().optional(),
23998
25082
  frameId: string()
23999
25083
  }), object({
24000
25084
  removed: boolean(),
@@ -24011,7 +25095,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24011
25095
  auth: "admin"
24012
25096
  }), method(object({
24013
25097
  deviceId: number(),
24014
- trackId: string(),
25098
+ /** The frame's track, when it has one — checked against the frame. */
25099
+ trackId: string().optional(),
24015
25100
  frameId: string(),
24016
25101
  subject: RetrainAssistSubjectSchema,
24017
25102
  /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
@@ -24019,12 +25104,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24019
25104
  }), RetrainAssistResultSchema, {
24020
25105
  kind: "mutation",
24021
25106
  auth: "admin"
24022
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
25107
+ }), method(object({
25108
+ trackId: string().optional(),
25109
+ frameIds: array(string()).max(2e3).optional()
25110
+ }), array(RetrainAnnotationSchema).readonly(), {
24023
25111
  kind: "query",
24024
25112
  auth: "admin"
24025
25113
  }), method(object({
24026
25114
  deviceId: number(),
24027
- trackId: string(),
25115
+ /** The frame's track, when it has one — checked against the frame. */
25116
+ trackId: string().optional(),
24028
25117
  frameId: string(),
24029
25118
  annotations: array(RetrainAnnotationDraftSchema)
24030
25119
  }), array(RetrainAnnotationSchema).readonly(), {
@@ -24042,7 +25131,91 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24042
25131
  }), RetrainTransitionResultSchema, {
24043
25132
  kind: "mutation",
24044
25133
  auth: "admin"
24045
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
25134
+ }), method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string() }), {
25135
+ kind: "query",
25136
+ auth: "admin"
25137
+ }), method(object({
25138
+ deviceId: number(),
25139
+ trackId: string().optional(),
25140
+ frameId: string(),
25141
+ complete: boolean()
25142
+ }), RetrainFrameSchema, {
25143
+ kind: "mutation",
25144
+ auth: "admin"
25145
+ }), method(object({
25146
+ filter: RetrainExportFilterSchema,
25147
+ layout: RetrainExportLayoutSchema,
25148
+ target: RetrainArchiveTargetSchema
25149
+ }), RetrainArchiveResultSchema, {
25150
+ kind: "mutation",
25151
+ auth: "admin",
25152
+ timeoutMs: 60 * 6e4
25153
+ }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
25154
+ kind: "query",
25155
+ auth: "admin"
25156
+ }), method(object({
25157
+ deviceId: number(),
25158
+ trackId: string().optional(),
25159
+ frameId: string(),
25160
+ profileId: string(),
25161
+ classes: array(RetrainMacroClassSchema).min(1),
25162
+ boxes: array(object({
25163
+ ref: string(),
25164
+ bbox: RetrainBboxSchema,
25165
+ macroClass: RetrainMacroClassSchema,
25166
+ label: string().optional()
25167
+ })).max(50),
25168
+ allowCloud: boolean()
25169
+ }), RetrainLlmAssistResultSchema, {
25170
+ kind: "mutation",
25171
+ auth: "admin",
25172
+ timeoutMs: 18e4
25173
+ }), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
25174
+ kind: "mutation",
25175
+ auth: "admin"
25176
+ }), method(object({}), array(RetrainCollectionSchema).readonly(), {
25177
+ kind: "query",
25178
+ auth: "admin"
25179
+ }), method(object({
25180
+ id: string(),
25181
+ name: string().max(120)
25182
+ }), RetrainCollectionRenameResultSchema, {
25183
+ kind: "mutation",
25184
+ auth: "admin"
25185
+ }), method(object({ id: string() }), object({
25186
+ deleted: boolean(),
25187
+ removedFrames: number().int()
25188
+ }), {
25189
+ kind: "mutation",
25190
+ auth: "admin"
25191
+ }), method(object({
25192
+ collectionId: string(),
25193
+ deviceId: number(),
25194
+ epochMs: number()
25195
+ }), AddRetrainFrameFromRecordingResultSchema, {
25196
+ kind: "mutation",
25197
+ auth: "admin",
25198
+ timeoutMs: 6e4
25199
+ }), method(object({
25200
+ collectionId: string(),
25201
+ frameIds: array(string()).min(1).max(500)
25202
+ }), object({
25203
+ added: number().int(),
25204
+ alreadyMember: number().int(),
25205
+ unknownFrameIds: array(string()).readonly()
25206
+ }), {
25207
+ kind: "mutation",
25208
+ auth: "admin"
25209
+ }), method(object({
25210
+ collectionId: string(),
25211
+ frameId: string()
25212
+ }), object({
25213
+ removed: boolean(),
25214
+ deletedFrame: boolean()
25215
+ }), {
25216
+ kind: "mutation",
25217
+ auth: "admin"
25218
+ }), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
24046
25219
  kind: "query",
24047
25220
  auth: "admin"
24048
25221
  }), method(object({
@@ -24095,6 +25268,34 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24095
25268
  timestamp: number()
24096
25269
  });
24097
25270
  /**
25271
+ * A root model's boxes standing in for one crop-kind step's own inference
25272
+ * (D730) — see `runPipeline.suppliedRoot`.
25273
+ */
25274
+ var SuppliedRootOutputSchema = object({
25275
+ stepId: string(),
25276
+ /** The root model that drew the boxes — stamped on the result. */
25277
+ modelId: string(),
25278
+ detections: array(object({
25279
+ /** `[x1, y1, x2, y2]` in the pixels of the call's image. */
25280
+ bbox: tuple([
25281
+ number(),
25282
+ number(),
25283
+ number(),
25284
+ number()
25285
+ ]),
25286
+ score: number(),
25287
+ /**
25288
+ * Five facial landmarks in the same pixels — a face the step's own
25289
+ * detector already re-found inside a root face box (D730), so its
25290
+ * embedder child aligns it exactly as it aligns any detected face.
25291
+ */
25292
+ landmarks: array(object({
25293
+ x: number(),
25294
+ y: number()
25295
+ })).optional()
25296
+ })).min(1)
25297
+ });
25298
+ /**
24098
25299
  * Reference to the frame's retained NATIVE surface + the parent crop's placement
24099
25300
  * within the frame, so the executor can re-cut a leaf child ROI at native
24100
25301
  * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
@@ -24142,7 +25343,7 @@ var FrameRefSchema = object({
24142
25343
  timestamp: number(),
24143
25344
  capturedAt: number().optional()
24144
25345
  });
24145
- var ModelFormatSchema$1 = _enum([
25346
+ var ModelFormatSchema$2 = _enum([
24146
25347
  "onnx",
24147
25348
  "coreml",
24148
25349
  "openvino",
@@ -24160,7 +25361,7 @@ var PipelineSlotSchema = _enum([
24160
25361
  var PipelineEngineChoiceSchema = object({
24161
25362
  runtime: literal("python"),
24162
25363
  backend: string(),
24163
- format: ModelFormatSchema$1,
25364
+ format: ModelFormatSchema$2,
24164
25365
  device: string().optional()
24165
25366
  });
24166
25367
  /**
@@ -24199,33 +25400,15 @@ var PipelineDefaultStepSchema = lazy(() => object({
24199
25400
  group: string().optional(),
24200
25401
  settings: record(string(), unknown()).optional()
24201
25402
  }));
24202
- var PipelineTemplateStepSchema = lazy(() => object({
24203
- addonId: string(),
24204
- enabled: boolean(),
24205
- modelId: string(),
24206
- children: array(PipelineTemplateStepSchema).readonly(),
24207
- settings: record(string(), unknown()).optional()
24208
- }));
24209
- var PipelineTemplateSchema$1 = object({
24210
- id: string(),
24211
- name: string(),
24212
- createdAt: string(),
24213
- updatedAt: string(),
24214
- engine: PipelineEngineChoiceSchema,
24215
- steps: array(PipelineTemplateStepSchema).readonly()
24216
- });
24217
25403
  var PipelineModelOptionSchema = object({
24218
25404
  id: string(),
24219
25405
  name: string(),
24220
- formats: record(string(), object({
24221
- downloaded: boolean(),
24222
- sizeMB: number()
24223
- })),
25406
+ formats: record(string(), PipelineModelFormatStatusSchema),
24224
25407
  group: ModelVariantGroupSchema.optional(),
24225
25408
  legacy: boolean().optional(),
24226
25409
  provider: ModelProviderIdSchema.optional(),
24227
25410
  defaultConfidence: number().optional(),
24228
- fillsClassifierEffects: array(FillsClassifierEffectSchema).readonly().optional()
25411
+ suppliesSteps: array(RootStepSupplySchema).readonly().optional()
24229
25412
  });
24230
25413
  var ConfigFieldBridge = custom();
24231
25414
  var PipelineAddonSchemaSchema = object({
@@ -24387,6 +25570,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
24387
25570
  }), {
24388
25571
  kind: "mutation",
24389
25572
  auth: "admin"
25573
+ }), method(object({
25574
+ nodeId: string(),
25575
+ deviceIds: array(number()).readonly().optional(),
25576
+ dryRun: boolean()
25577
+ }), object({
25578
+ entries: array(object({
25579
+ deviceId: number(),
25580
+ keys: array(string()).readonly()
25581
+ })).readonly(),
25582
+ refused: array(object({
25583
+ deviceId: number(),
25584
+ reason: string()
25585
+ })).readonly()
25586
+ }), {
25587
+ kind: "mutation",
25588
+ auth: "admin"
24390
25589
  }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
24391
25590
  /** `<backend>:<device>`, e.g. `openvino:gpu`. */
24392
25591
  deviceKey: string(),
@@ -24412,22 +25611,14 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
24412
25611
  }), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(object({
24413
25612
  steps: array(PipelineStepInputSchema),
24414
25613
  deviceKey: string().optional()
24415
- }), PipelineValidationResultSchema), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
24416
- name: string(),
24417
- steps: array(PipelineTemplateStepSchema).readonly(),
24418
- engine: PipelineEngineChoiceSchema
24419
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
24420
- id: string(),
24421
- name: string().optional(),
24422
- steps: array(PipelineTemplateStepSchema).readonly().optional()
24423
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
25614
+ }), PipelineValidationResultSchema), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
24424
25615
  addonId: string(),
24425
25616
  modelId: string(),
24426
- format: ModelFormatSchema$1
25617
+ format: ModelFormatSchema$2
24427
25618
  }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
24428
25619
  addonId: string(),
24429
25620
  modelId: string(),
24430
- format: ModelFormatSchema$1
25621
+ format: ModelFormatSchema$2
24431
25622
  }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
24432
25623
  steps: array(PipelineStepInputSchema).min(1),
24433
25624
  frame: FrameInputSchema.optional(),
@@ -24493,7 +25684,16 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
24493
25684
  * `device-not-servable`), and nothing reaches the camera's live
24494
25685
  * trace stream. Absent ⇒ unchanged behaviour.
24495
25686
  */
24496
- replay: literal(true).optional()
25687
+ replay: literal(true).optional(),
25688
+ /**
25689
+ * Root-supplied detections for the tree's ROOT step (D730). Set by
25690
+ * `runDetailSubtree` when the camera's root model supplies a crop-kind
25691
+ * step (a Frigate+ `license_plate` for `plate-detection`): the step is
25692
+ * NOT inferred, these boxes are its output, and its children (the plate
25693
+ * reader) run on them through their own crop policy. Boxes are in the
25694
+ * PIXELS of the image this call carries. Absent ⇒ the root step runs.
25695
+ */
25696
+ suppliedRoot: SuppliedRootOutputSchema.optional()
24497
25697
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
24498
25698
  steps: array(PipelineStepInputSchema).min(1),
24499
25699
  frames: array(FrameInputSchema).min(1).max(255),
@@ -24575,6 +25775,763 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
24575
25775
  filename: string().optional(),
24576
25776
  settings: record(string(), unknown()).optional()
24577
25777
  }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
25778
+ /**
25779
+ * The wire shapes of the Auto tune plan and apply (D745), used by the
25780
+ * `pipeline-orchestrator` cap. The recommender's own types
25781
+ * (`recommend.ts`) are the TS face of the same data; these
25782
+ * schemas are what crosses the cap boundary.
25783
+ */
25784
+ var ModelFormatSchema$1 = _enum(MODEL_FORMATS);
25785
+ /** The operator's range for it. */
25786
+ var MIN_SESSIONS_PER_DEVICE_RANGE = {
25787
+ min: 1,
25788
+ max: 8
25789
+ };
25790
+ var HardwareClassIdSchema = _enum([
25791
+ "intel-core-ultra",
25792
+ "intel-n-series",
25793
+ "apple-m-base",
25794
+ "apple-m-pro",
25795
+ "unknown"
25796
+ ]);
25797
+ var AcceleratorKindSchema = _enum([
25798
+ "intel-npu",
25799
+ "intel-igpu",
25800
+ "x86-cpu",
25801
+ "arm-cpu",
25802
+ "apple-ane",
25803
+ "coral"
25804
+ ]);
25805
+ var RecommendationReasonSchema = discriminatedUnion("kind", [
25806
+ object({
25807
+ kind: literal("capacity"),
25808
+ sessions: number(),
25809
+ minSessions: number()
25810
+ }),
25811
+ object({
25812
+ kind: literal("tie-faster"),
25813
+ over: string(),
25814
+ recallDelta: number()
25815
+ }),
25816
+ object({
25817
+ kind: literal("stepped-down"),
25818
+ from: string(),
25819
+ to: string(),
25820
+ limitedBy: string()
25821
+ }),
25822
+ object({
25823
+ kind: literal("no-fit-lightest"),
25824
+ sessions: number(),
25825
+ minSessions: number()
25826
+ }),
25827
+ object({
25828
+ kind: literal("derived-latency"),
25829
+ modelId: string()
25830
+ }),
25831
+ object({ kind: literal("cpu-device") }),
25832
+ object({ kind: literal("coral-untouched") }),
25833
+ object({ kind: literal("device-disabled") }),
25834
+ object({ kind: literal("device-unavailable") }),
25835
+ object({ kind: literal("node-offline") }),
25836
+ object({ kind: literal("no-hardware-facts") }),
25837
+ object({
25838
+ kind: literal("no-measured-data"),
25839
+ hardwareClass: HardwareClassIdSchema
25840
+ }),
25841
+ object({
25842
+ kind: literal("no-family-build"),
25843
+ format: ModelFormatSchema$1
25844
+ }),
25845
+ object({
25846
+ kind: literal("kept-custom-pin"),
25847
+ modelId: string(),
25848
+ deviceKey: string()
25849
+ })
25850
+ ]);
25851
+ /** Why a device is left exactly as it is, whatever the plan would pick (D786). */
25852
+ var KeptReasonSchema = _enum(["custom-pin"]);
25853
+ /**
25854
+ * Where a choice's latency came from (D791): this node's own benchmark
25855
+ * result, or the hardware-class table. Measured on the node beats the table.
25856
+ */
25857
+ var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
25858
+ kind: literal("node-benchmark"),
25859
+ resultId: string(),
25860
+ measuredAtMs: number()
25861
+ })]);
25862
+ var DeviceModelChoiceSchema = object({
25863
+ modelId: string(),
25864
+ p50Ms: number(),
25865
+ fps: number(),
25866
+ measured: boolean(),
25867
+ /** Absent on a plan from before D791 — read as the table. */
25868
+ source: LatencySourceSchema.optional(),
25869
+ /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
25870
+ capacitySessions: number(),
25871
+ personRecall: number()
25872
+ });
25873
+ var DeviceRecommendationSchema = object({
25874
+ deviceKey: string(),
25875
+ accelerator: AcceleratorKindSchema.nullable(),
25876
+ enabled: boolean(),
25877
+ available: boolean(),
25878
+ chosen: DeviceModelChoiceSchema.nullable(),
25879
+ /** Present when the device is kept as is: Apply writes nothing on it. */
25880
+ kept: KeptReasonSchema.optional(),
25881
+ reasons: array(RecommendationReasonSchema).readonly()
25882
+ });
25883
+ var NodeRecommendationSchema = object({
25884
+ nodeId: string(),
25885
+ reachable: boolean(),
25886
+ hardwareClass: HardwareClassIdSchema.nullable(),
25887
+ cpuModel: string().nullable(),
25888
+ skipped: boolean(),
25889
+ acceleratorModelId: string().nullable(),
25890
+ devices: array(DeviceRecommendationSchema).readonly(),
25891
+ reasons: array(RecommendationReasonSchema).readonly()
25892
+ });
25893
+ var ModelPinChangeSchema = object({
25894
+ stepId: string(),
25895
+ before: string().nullable(),
25896
+ after: string().nullable()
25897
+ });
25898
+ var NodeDeviceChangeSchema = object({
25899
+ nodeId: string(),
25900
+ deviceKey: string(),
25901
+ madeExplicit: boolean(),
25902
+ modelPins: array(ModelPinChangeSchema).readonly(),
25903
+ thresholds: array(object({
25904
+ stepId: string(),
25905
+ keys: array(string()).readonly()
25906
+ })).readonly()
25907
+ });
25908
+ var CameraOverrideClearSchema = object({
25909
+ deviceId: number(),
25910
+ source: _enum(["step-override", "wholesale"]),
25911
+ nodeId: string(),
25912
+ deviceKey: string().nullable(),
25913
+ stepId: string(),
25914
+ modelIdBefore: string().nullable(),
25915
+ keys: array(string()).readonly()
25916
+ });
25917
+ var DetectorStoreClearSchema = object({
25918
+ deviceId: number(),
25919
+ keys: array(string()).readonly()
25920
+ });
25921
+ var AutoTuneWarningSchema = discriminatedUnion("kind", [
25922
+ object({
25923
+ kind: literal("detector-store-cluster-wide"),
25924
+ skippedNodes: array(string()).readonly()
25925
+ }),
25926
+ object({
25927
+ kind: literal("detector-store-unreadable"),
25928
+ error: string()
25929
+ }),
25930
+ object({
25931
+ kind: literal("coral-enabled"),
25932
+ nodeId: string(),
25933
+ deviceKey: string()
25934
+ }),
25935
+ object({
25936
+ kind: literal("custom-pin-kept"),
25937
+ nodeId: string(),
25938
+ deviceKey: string().nullable(),
25939
+ deviceId: number().nullable(),
25940
+ modelId: string()
25941
+ }),
25942
+ object({
25943
+ kind: literal("custom-registry-unreadable"),
25944
+ error: string()
25945
+ })
25946
+ ]);
25947
+ var AutoTuneOptionsSchema = object({
25948
+ /** Share of each accelerator's throughput kept free (0.3–0.5). */
25949
+ headroom: number().min(.3).max(.5).default(.4),
25950
+ /**
25951
+ * The least number of parallel sessions every device must sustain at the
25952
+ * camera rate with the headroom kept free (D755). The most accurate model
25953
+ * that reaches it wins.
25954
+ */
25955
+ minSessionsPerDevice: number().int().min(MIN_SESSIONS_PER_DEVICE_RANGE.min).max(MIN_SESSIONS_PER_DEVICE_RANGE.max).default(2)
25956
+ });
25957
+ var AutoTunePlanSchema = object({
25958
+ /** Hash of everything the apply will write — the apply refuses a different one. */
25959
+ planHash: string(),
25960
+ family: literal("yolov9"),
25961
+ headroom: number(),
25962
+ minSessionsPerDevice: number(),
25963
+ /** The detection rate a session is counted at (the fastest camera running the pipeline root). */
25964
+ cameraFps: number(),
25965
+ generatedAt: number(),
25966
+ nodes: array(NodeRecommendationSchema).readonly(),
25967
+ nodeChanges: array(NodeDeviceChangeSchema).readonly(),
25968
+ cameraClears: array(CameraOverrideClearSchema).readonly(),
25969
+ detectorStoreClears: array(DetectorStoreClearSchema).readonly(),
25970
+ warnings: array(AutoTuneWarningSchema).readonly()
25971
+ });
25972
+ var AutoTuneApplyInputSchema = object({
25973
+ planHash: string(),
25974
+ headroom: number().min(.3).max(.5).default(.4),
25975
+ minSessionsPerDevice: number().int().min(MIN_SESSIONS_PER_DEVICE_RANGE.min).max(MIN_SESSIONS_PER_DEVICE_RANGE.max).default(2)
25976
+ });
25977
+ var AutoTunePhaseResultSchema = object({
25978
+ phase: _enum([
25979
+ "download",
25980
+ "camera-overrides",
25981
+ "detector-thresholds",
25982
+ "node-models",
25983
+ "redispatch"
25984
+ ]),
25985
+ ok: boolean(),
25986
+ detail: string()
25987
+ });
25988
+ var AutoTuneApplyResultSchema = discriminatedUnion("kind", [
25989
+ object({
25990
+ kind: literal("applied"),
25991
+ planHash: string(),
25992
+ phases: array(AutoTunePhaseResultSchema).readonly()
25993
+ }),
25994
+ object({
25995
+ kind: literal("aborted"),
25996
+ phases: array(AutoTunePhaseResultSchema).readonly()
25997
+ }),
25998
+ object({
25999
+ kind: literal("stale"),
26000
+ plan: AutoTunePlanSchema
26001
+ }),
26002
+ object({
26003
+ kind: literal("refused"),
26004
+ reason: _enum(["apply-in-progress"])
26005
+ })
26006
+ ]);
26007
+ /**
26008
+ * Wire shapes of the Load balancing surface (D748): the session placement
26009
+ * policy, the atomic share write, the observed placement statistics, the
26010
+ * hardware share suggestion and the stale device pins.
26011
+ */
26012
+ /**
26013
+ * How a new detection session picks its node and device.
26014
+ * - `least-loaded` — the historical rule: lowest `attached / weight`, a
26015
+ * constant node order at a tie (D37). An idle node always ties at 0, so a
26016
+ * weight only bites once a node already holds a session.
26017
+ * - `share` — the share of PARALLEL sessions is held to the weights, and a
26018
+ * full or drowning node yields to a free one (D748).
26019
+ */
26020
+ var SessionPlacementPolicySchema = _enum(["least-loaded", "share"]);
26021
+ var LoadBalancingSharesInputSchema = object({
26022
+ /** nodeId → share (> 0). A node left out keeps its weight. */
26023
+ nodes: record(string(), number().positive()).default({}),
26024
+ /** nodeId → deviceKey → share (> 0). A device left out keeps its weight. */
26025
+ devices: record(string(), record(string(), number().positive())).default({})
26026
+ });
26027
+ var PlacementStatsInputSchema = object({
26028
+ /** Window the observed shares are averaged over (default 1 h, max 24 h). */
26029
+ windowMs: number().int().min(6e4).max(1440 * 60 * 1e3).default(3600 * 1e3) });
26030
+ var PlacementDeviceStatsSchema = object({
26031
+ deviceKey: string(),
26032
+ /** Sessions running on this device now. */
26033
+ sessionsNow: number(),
26034
+ /** Sessions started on this device inside the window. */
26035
+ sessionsStarted: number(),
26036
+ /** Time-weighted share of the node's parallel sessions over the window (0–1); null = no session ran. */
26037
+ observedShare: number().nullable()
26038
+ });
26039
+ var PlacementNodeStatsSchema = object({
26040
+ nodeId: string(),
26041
+ sessionsNow: number(),
26042
+ sessionsStarted: number(),
26043
+ /** Time-weighted share of the cluster's parallel sessions over the window (0–1); null = none ran. */
26044
+ observedShare: number().nullable(),
26045
+ /** Most sessions this node ran at once inside the window. */
26046
+ peakSessions: number(),
26047
+ /** Sessions a share election handed elsewhere because this node was full or drowning. */
26048
+ yieldsAway: number(),
26049
+ devices: array(PlacementDeviceStatsSchema).readonly()
26050
+ });
26051
+ /** A camera's device pin that the session path cannot honour. */
26052
+ var StaleDevicePinSchema = object({
26053
+ deviceId: number(),
26054
+ deviceKey: string(),
26055
+ /** `disabled` — the key exists on some node but is not enabled anywhere; `absent` — no node has it. */
26056
+ reason: _enum(["disabled", "absent"])
26057
+ });
26058
+ var PlacementStatsSchema = object({
26059
+ policy: SessionPlacementPolicySchema,
26060
+ windowMs: number(),
26061
+ /** How much of the window was actually observed (the hub keeps it in memory). */
26062
+ observedForMs: number(),
26063
+ sessionsNow: number(),
26064
+ /** Most parallel sessions across the cluster inside the window. */
26065
+ clusterPeakSessions: number(),
26066
+ nodes: array(PlacementNodeStatsSchema).readonly(),
26067
+ stalePins: array(StaleDevicePinSchema).readonly()
26068
+ });
26069
+ /**
26070
+ * Where an automatic share's capacity comes from (D755).
26071
+ * - `hardware` — the static capacity of each device at its Auto tune model:
26072
+ * the measured latency table for the node's hardware class.
26073
+ * - `benchmark` — the node's own measured capacity (node benchmark results).
26074
+ * A node with no results falls back to `hardware`, and says so.
26075
+ */
26076
+ var CapacitySourceSchema = _enum(["hardware", "benchmark"]);
26077
+ /** Why a node under the `benchmark` source was sized from hardware instead. */
26078
+ var CapacityFallbackSchema = _enum(["no-benchmark-results", "partial-benchmark-results"]);
26079
+ var SuggestSharesInputSchema = object({
26080
+ headroom: number().min(.3).max(.5).default(.4),
26081
+ /** Default `hardware`. */
26082
+ source: CapacitySourceSchema.default("hardware")
26083
+ });
26084
+ var SuggestedDeviceShareSchema = object({
26085
+ deviceKey: string(),
26086
+ /** Share of the node (0–100, rounded). */
26087
+ share: number(),
26088
+ modelId: string().nullable(),
26089
+ /** Inferences per second at that model, from the measured table; null when sized by a benchmark. */
26090
+ fps: number().nullable(),
26091
+ /** False for a table cell derived from another chip; true for a measured cell or a benchmark. */
26092
+ measured: boolean(),
26093
+ /**
26094
+ * Advisory session cap: ⌊fps × (1 − headroom) / camera fps⌋ from the table,
26095
+ * or the benchmark's measured max sessions. Never enforced.
26096
+ */
26097
+ suggestedMaxSessions: number().nullable()
26098
+ });
26099
+ var SuggestedNodeShareSchema = object({
26100
+ nodeId: string(),
26101
+ /** Share of the cluster (0–100, rounded); null = node skipped (offline, unknown hardware). */
26102
+ share: number().nullable(),
26103
+ /** Parallel sessions the node sustains at the suggested models with the headroom kept free. */
26104
+ capacitySessions: number(),
26105
+ devices: array(SuggestedDeviceShareSchema).readonly(),
26106
+ skippedReason: string().nullable(),
26107
+ /** What this node's capacity was read from; null when the node is skipped. */
26108
+ capacitySource: CapacitySourceSchema.nullable(),
26109
+ /** Set when the `benchmark` source was asked for and this node used `hardware`. */
26110
+ capacityFallback: CapacityFallbackSchema.nullable()
26111
+ });
26112
+ var SuggestSharesResultSchema = object({
26113
+ headroom: number(),
26114
+ /** The source asked for; each node says what it actually used. */
26115
+ source: CapacitySourceSchema,
26116
+ /** Camera detection rate the capacity is counted in (the fastest camera's fps). */
26117
+ cameraFps: number(),
26118
+ /** The Auto tune capacity floor the models were picked at. */
26119
+ minSessionsPerDevice: number(),
26120
+ nodes: array(SuggestedNodeShareSchema).readonly()
26121
+ });
26122
+ /**
26123
+ * Where the node and device shares come from (D750, D755, D791).
26124
+ * - `benchmark` (default since D791) — each node's capacity as its own node
26125
+ * benchmark measured it; a node without fresh results is sized from
26126
+ * `hardware` and says so. Measured on the node beats the table.
26127
+ * - `hardware` — computed from each node's static capacity only (its
26128
+ * accelerators at their Auto tune models, from the latency table).
26129
+ * Both are recomputed whenever a node or device joins, leaves, is switched
26130
+ * on or off, changes model, or a benchmark result is written. No load input.
26131
+ * - `manual` — the operator's stored sliders.
26132
+ * Either way a node or device that cannot take sessions gives its share to
26133
+ * the others in proportion; the stored values are never rewritten for that.
26134
+ */
26135
+ var ShareSourceSchema = _enum([
26136
+ "hardware",
26137
+ "benchmark",
26138
+ "manual"
26139
+ ]);
26140
+ var SetShareSourceInputSchema = object({ source: ShareSourceSchema });
26141
+ object({
26142
+ nodes: record(string(), number()),
26143
+ devices: record(string(), record(string(), number()))
26144
+ });
26145
+ var EffectiveDeviceShareSchema = object({
26146
+ deviceKey: string(),
26147
+ /** Can take sessions now (enabled, available, can run the root). */
26148
+ eligible: boolean(),
26149
+ /** The share the source assigns, as a percentage of the node's devices. */
26150
+ configuredPct: number(),
26151
+ /** The share actually used, after an ineligible device's share went to the others. */
26152
+ effectivePct: number()
26153
+ });
26154
+ var EffectiveNodeShareSchema = object({
26155
+ nodeId: string(),
26156
+ eligible: boolean(),
26157
+ configuredPct: number(),
26158
+ effectivePct: number(),
26159
+ /** Automatic sources: what this node's share was computed from; null under `manual` or before the first answer. */
26160
+ capacitySource: CapacitySourceSchema.nullable(),
26161
+ /** Automatic `benchmark`: why this node used `hardware` instead. */
26162
+ capacityFallback: CapacityFallbackSchema.nullable(),
26163
+ devices: array(EffectiveDeviceShareSchema).readonly()
26164
+ });
26165
+ var EffectiveSharesSchema = object({
26166
+ source: ShareSourceSchema,
26167
+ policy: SessionPlacementPolicySchema,
26168
+ /** An automatic source with no computed answer yet: the stored sliders are used meanwhile. */
26169
+ autoPending: boolean(),
26170
+ /** When the automatic shares were last computed (ms epoch); null = never. */
26171
+ computedAt: number().nullable(),
26172
+ /** What made the system recompute them last. */
26173
+ trigger: string().nullable(),
26174
+ nodes: array(EffectiveNodeShareSchema).readonly(),
26175
+ /** The relative weights the election reads (before eligibility). */
26176
+ nodeWeights: record(string(), number()),
26177
+ deviceWeights: record(string(), record(string(), number()))
26178
+ });
26179
+ /**
26180
+ * Wire shapes of the node benchmark (D791): the operator's plan, the
26181
+ * preflight the confirmation shows, the run the orchestrator owns, what the
26182
+ * measuring runner reports, and the result rows Auto tune and the automatic
26183
+ * shares read.
26184
+ *
26185
+ * ONE node at a time, owned by the pipeline orchestrator. While a run is
26186
+ * active the cluster is in BENCHMARK MODE for that node: it is not a
26187
+ * detection candidate, camera pins naming it are ignored so its sessions move
26188
+ * elsewhere, and both come back when the mode ends — after a crash or a hub
26189
+ * restart too (a persisted manifest, reconciled against the registry).
26190
+ *
26191
+ * Two measurements, both on the node, driven by its own runner (frames never
26192
+ * cross a process at frame rate, D9):
26193
+ * - `device` — one accelerator × one candidate detector, root only, open
26194
+ * loop: how many streams at the camera rate it carries inside the frame
26195
+ * interval;
26196
+ * - `pipeline` — the chosen detector plus the operator's detail steps
26197
+ * (faces, plates, classifiers, CLIP…), on varied frames from the bench
26198
+ * clip: how many parallel sessions the node carries before latency, drops,
26199
+ * CPU, RAM or the event loop give out.
26200
+ */
26201
+ /** Defaults and bounds, one place. */
26202
+ var NODE_BENCHMARK_DEFAULTS = {
26203
+ fpsPerStream: 10,
26204
+ budgetMinutes: 45,
26205
+ minBudgetMinutes: 10,
26206
+ maxBudgetMinutes: 120,
26207
+ /** A result older than this no longer beats the table. */
26208
+ staleAfterDays: 30,
26209
+ /** Warm-in per ramp step (not accounted). */
26210
+ settleSec: 5,
26211
+ /** Accounted window per ramp step. */
26212
+ measureSec: 20,
26213
+ /** Longest the drain may take before the run is refused. */
26214
+ drainTimeoutSec: 120,
26215
+ /** Candidate models per device in one run. */
26216
+ maxModelsPerDevice: 6
26217
+ };
26218
+ /** The two measurements a run can make. */
26219
+ var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
26220
+ var NodeBenchmarkDevicePlanSchema = object({
26221
+ /** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
26222
+ deviceKey: string().min(1),
26223
+ /**
26224
+ * Root detector candidates for the `device` measurement, in the order
26225
+ * measured. The FIRST is the one the `pipeline` measurement runs.
26226
+ */
26227
+ modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
26228
+ });
26229
+ /** What the operator confirmed. */
26230
+ var NodeBenchmarkPlanSchema = object({
26231
+ nodeId: string().min(1),
26232
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
26233
+ /** Which measurements run. At least one. */
26234
+ phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
26235
+ /**
26236
+ * Detail steps (catalog step ids under the root: faces, plates,
26237
+ * classifiers, CLIP…) the `pipeline` measurement enables. The root
26238
+ * detector always runs.
26239
+ */
26240
+ steps: array(string().min(1)).default([]),
26241
+ /** Offered rate of one stream / session. */
26242
+ fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
26243
+ /** Hard deadline: the mode ends and the cluster is restored when it passes. */
26244
+ budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
26245
+ /** Keep the models the run downloaded (default: delete what was not installed before). */
26246
+ keepDownloadedModels: boolean().default(false),
26247
+ /** Start although the other nodes' capacity does not cover the sessions running now. */
26248
+ acceptInsufficientHeadroom: boolean().default(false)
26249
+ });
26250
+ var NodeBenchmarkRefusalSchema = object({
26251
+ kind: _enum([
26252
+ "benchmark-active",
26253
+ "node-offline",
26254
+ "unknown-device",
26255
+ "no-phase",
26256
+ "insufficient-headroom"
26257
+ ]),
26258
+ detail: string(),
26259
+ overridable: boolean()
26260
+ });
26261
+ /** A camera whose detection leaves the node for the run. */
26262
+ var NodeBenchmarkMovingCameraSchema = object({
26263
+ deviceId: number(),
26264
+ /** Placed on the node now (a standing attach or a running session). */
26265
+ placedOnNode: boolean(),
26266
+ /** A node pin naming this node, ignored for the run. */
26267
+ pinnedToNode: boolean()
26268
+ });
26269
+ /** A camera that cannot leave: no other node can obtain its frames. */
26270
+ var NodeBenchmarkStayingCameraSchema = object({
26271
+ deviceId: number(),
26272
+ reason: literal("only-frame-source")
26273
+ });
26274
+ var NodeBenchmarkPreflightSchema = object({
26275
+ nodeId: string(),
26276
+ online: boolean(),
26277
+ moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
26278
+ /** Keep running on the node during the run; the result is flagged contaminated. */
26279
+ staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
26280
+ estimatedDurationMs: number(),
26281
+ /** The run ends and the cluster is restored at the latest after this long. */
26282
+ budgetMs: number(),
26283
+ phases: array(NodeBenchmarkPhaseSchema).readonly(),
26284
+ steps: array(string()).readonly(),
26285
+ devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
26286
+ /** Parallel sessions the cluster runs now, and what the other nodes can carry. */
26287
+ headroom: object({
26288
+ sessionsNow: number(),
26289
+ otherNodesCapacitySessions: number().nullable()
26290
+ }),
26291
+ refusals: array(NodeBenchmarkRefusalSchema).readonly(),
26292
+ canStart: boolean()
26293
+ });
26294
+ /** Where the measuring runner is. */
26295
+ var NodeBenchProgressSchema = object({
26296
+ phase: _enum([
26297
+ "preparing",
26298
+ "device",
26299
+ "pipeline",
26300
+ "cleanup"
26301
+ ]),
26302
+ deviceKey: string().nullable(),
26303
+ modelId: string().nullable(),
26304
+ /** Streams (device) or sessions (pipeline) of the step running now. */
26305
+ load: number().nullable(),
26306
+ cellsDone: number(),
26307
+ cellsTotal: number(),
26308
+ message: string()
26309
+ });
26310
+ /** What limited a ramp. `none` = the ramp ran out of steps still passing. */
26311
+ var NodeBenchLimitSchema = _enum([
26312
+ "p95",
26313
+ "drops",
26314
+ "errors",
26315
+ "stall",
26316
+ "cpu",
26317
+ "ram",
26318
+ "none"
26319
+ ]);
26320
+ var NodeBenchRampStepSchema = object({
26321
+ load: number(),
26322
+ pass: boolean(),
26323
+ p95Ms: number(),
26324
+ dropRatio: number(),
26325
+ /** Completed frames per second over the accounted window. */
26326
+ fps: number(),
26327
+ cpuPct: number().nullable(),
26328
+ ramFreePct: number().nullable(),
26329
+ failReasons: array(string()).readonly()
26330
+ });
26331
+ var NodeBenchCellSchema = discriminatedUnion("phase", [object({
26332
+ phase: literal("device"),
26333
+ deviceKey: string(),
26334
+ modelId: string(),
26335
+ /** Single-stream latency (the K = 1 step). */
26336
+ p50Ms: number(),
26337
+ p95Ms: number(),
26338
+ p99Ms: number(),
26339
+ /** Frames per second sustained at the last passing step. */
26340
+ fps: number(),
26341
+ /** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
26342
+ kMax: number(),
26343
+ limitedBy: NodeBenchLimitSchema,
26344
+ /** First call (model load + warm-up). */
26345
+ warmupMs: number(),
26346
+ ramp: array(NodeBenchRampStepSchema).readonly()
26347
+ }), object({
26348
+ phase: literal("pipeline"),
26349
+ deviceKey: string(),
26350
+ modelId: string(),
26351
+ steps: array(string()).readonly(),
26352
+ /** Parallel sessions at the camera rate the node carried; 0 = not even one. */
26353
+ maxSessions: number(),
26354
+ limitedBy: NodeBenchLimitSchema,
26355
+ /** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
26356
+ stepsFired: array(string()).readonly(),
26357
+ warmupMs: number(),
26358
+ ramp: array(NodeBenchRampStepSchema).readonly()
26359
+ })]);
26360
+ /**
26361
+ * What a result was measured ON. A result whose fingerprint no longer matches
26362
+ * the node no longer beats the table.
26363
+ */
26364
+ var NodeBenchFingerprintSchema = object({
26365
+ pipelineVersion: string().nullable(),
26366
+ cpuModel: string().nullable(),
26367
+ ramGb: number().nullable(),
26368
+ os: string().nullable(),
26369
+ /** Per device: the pool the cells ran on (runtime + tuning). */
26370
+ pools: record(string(), object({
26371
+ runtime: string(),
26372
+ numWorkers: number(),
26373
+ concurrency: number(),
26374
+ batchMode: string()
26375
+ })).default({})
26376
+ });
26377
+ /** The frames the run used. */
26378
+ var NodeBenchClipSchema = object({
26379
+ /** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
26380
+ id: string(),
26381
+ revision: string().nullable(),
26382
+ frames: number(),
26383
+ width: number(),
26384
+ height: number()
26385
+ });
26386
+ var NodeBenchRunnerInputSchema = object({
26387
+ runId: string().min(1),
26388
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
26389
+ phases: array(NodeBenchmarkPhaseSchema).min(1),
26390
+ /** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
26391
+ steps: array(string()).default([]),
26392
+ fpsPerStream: number().int().min(1).max(30),
26393
+ /** The runner stops on its own past this instant, whatever the hub does. */
26394
+ deadlineAtMs: number(),
26395
+ settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
26396
+ measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
26397
+ keepDownloadedModels: boolean().default(false)
26398
+ });
26399
+ var NodeBenchRunnerStateSchema = _enum([
26400
+ "running",
26401
+ "done",
26402
+ "failed",
26403
+ "aborted"
26404
+ ]);
26405
+ var NodeBenchRunnerStatusSchema = object({
26406
+ runId: string(),
26407
+ nodeId: string(),
26408
+ state: NodeBenchRunnerStateSchema,
26409
+ progress: NodeBenchProgressSchema.nullable(),
26410
+ /** Every finished cell so far — a run stopped half way keeps what it measured. */
26411
+ cells: array(NodeBenchCellSchema).readonly(),
26412
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
26413
+ clip: NodeBenchClipSchema.nullable(),
26414
+ /** Cameras seen running on the node during the run (they share its pools). */
26415
+ activeCameraIds: array(number()).readonly(),
26416
+ /** Models the run downloaded and then deleted (not installed before). */
26417
+ deletedModels: array(string()).readonly(),
26418
+ error: string().nullable(),
26419
+ startedAtMs: number(),
26420
+ finishedAtMs: number().nullable()
26421
+ });
26422
+ var NodeBenchmarkStateSchema = _enum([
26423
+ "draining",
26424
+ "measuring",
26425
+ "restoring",
26426
+ "done",
26427
+ "failed",
26428
+ "aborted"
26429
+ ]);
26430
+ /** Why a run ended. */
26431
+ var NodeBenchmarkEndReasonSchema = _enum([
26432
+ "completed",
26433
+ "operator-abort",
26434
+ "deadline",
26435
+ "node-lost",
26436
+ "runner-lost",
26437
+ "hub-restart",
26438
+ "drain-timeout",
26439
+ "failed"
26440
+ ]);
26441
+ var NodeBenchmarkRunSchema = object({
26442
+ runId: string(),
26443
+ nodeId: string(),
26444
+ state: NodeBenchmarkStateSchema,
26445
+ plan: NodeBenchmarkPlanSchema,
26446
+ startedAtMs: number(),
26447
+ deadlineAtMs: number(),
26448
+ finishedAtMs: number().nullable(),
26449
+ endReason: NodeBenchmarkEndReasonSchema.nullable(),
26450
+ error: string().nullable(),
26451
+ /** Cameras moved off the node for the run. */
26452
+ moved: array(number()).readonly(),
26453
+ /** Cameras that stayed (their only frame source is the node). */
26454
+ staying: array(number()).readonly(),
26455
+ /** Something else ran on the node's pools during the run. */
26456
+ contaminated: boolean(),
26457
+ progress: NodeBenchProgressSchema.nullable(),
26458
+ resultIds: array(string()).readonly()
26459
+ });
26460
+ /** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
26461
+ var NodeBenchmarkStatusSchema = object({
26462
+ /** The node the cluster is in benchmark mode for; null = none. */
26463
+ modeNodeId: string().nullable(),
26464
+ run: NodeBenchmarkRunSchema.nullable()
26465
+ });
26466
+ /**
26467
+ * One stored measurement — the only authority Auto tune and the automatic
26468
+ * shares read measured capacity from. Written by the orchestrator when a run
26469
+ * ends, never by anyone else.
26470
+ */
26471
+ var NodeBenchmarkResultSchema = object({
26472
+ id: string(),
26473
+ runId: string(),
26474
+ nodeId: string(),
26475
+ cell: NodeBenchCellSchema,
26476
+ fpsPerStream: number(),
26477
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
26478
+ clip: NodeBenchClipSchema.nullable(),
26479
+ /** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
26480
+ contaminated: boolean(),
26481
+ stayingCameras: array(number()).readonly(),
26482
+ /** The run ended early; the cell itself completed. */
26483
+ partialRun: boolean(),
26484
+ measuredAtMs: number()
26485
+ });
26486
+ var ListNodeBenchmarkResultsInputSchema = object({
26487
+ nodeId: string().optional(),
26488
+ deviceKey: string().optional()
26489
+ });
26490
+ /** A result with its standing today: does it still beat the table? */
26491
+ var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
26492
+ /** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
26493
+ standing: _enum([
26494
+ "fresh",
26495
+ "stale",
26496
+ "superseded"
26497
+ ]),
26498
+ staleWhy: _enum([
26499
+ "age",
26500
+ "runtime",
26501
+ "pool-tuning"
26502
+ ]).nullable()
26503
+ });
26504
+ object({
26505
+ runId: string(),
26506
+ nodeId: string(),
26507
+ startedAtMs: number(),
26508
+ deadlineAtMs: number(),
26509
+ plan: NodeBenchmarkPlanSchema,
26510
+ moved: array(number()).readonly(),
26511
+ staying: array(number()).readonly()
26512
+ });
26513
+ /** Candidate detectors per device, for the plan editor. */
26514
+ var NodeBenchmarkCandidatesSchema = object({
26515
+ nodeId: string(),
26516
+ reachable: boolean(),
26517
+ devices: array(object({
26518
+ deviceKey: string(),
26519
+ enabled: boolean(),
26520
+ available: boolean(),
26521
+ /** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
26522
+ suggested: array(string()).readonly(),
26523
+ /** Every root detector the device has a build for. */
26524
+ all: array(string()).readonly(),
26525
+ /** The model the device runs now, when pinned. */
26526
+ currentModelId: string().nullable()
26527
+ })).readonly(),
26528
+ /** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
26529
+ steps: array(object({
26530
+ id: string(),
26531
+ name: string(),
26532
+ slot: string()
26533
+ })).readonly()
26534
+ });
24578
26535
  object({
24579
26536
  activeCameras: number(),
24580
26537
  throttledCameras: number(),
@@ -25492,14 +27449,15 @@ var RunnerLocalLoadSchema = object({
25492
27449
  * Per-inference-device live load (multi-device C4). One entry per deviceKey
25493
27450
  * this runner currently has attached cameras on, so the orchestrator's second
25494
27451
  * `balance()` pass (over a node's devices) weights on real per-pool session
25495
- * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
25496
- * per device is 0 until the pool backlog gets a public accessor (follow-up).
27452
+ * counts. Empty on single-device / pre-multi-device runners. There is no
27453
+ * per-device queue depth: the inference pool's backlog has no accessor, and
27454
+ * a field that always read 0 was removed rather than shown as a measurement
27455
+ * (D762).
25497
27456
  */
25498
27457
  devices: array(object({
25499
27458
  deviceKey: string(),
25500
27459
  backend: string(),
25501
- attachedCameras: number(),
25502
- queueDepthTotal: number()
27460
+ attachedCameras: number()
25503
27461
  })).default([]),
25504
27462
  /** Hardware capability flags reported by this node. */
25505
27463
  hardware: object({
@@ -25635,7 +27593,22 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
25635
27593
  */
25636
27594
  cropJpeg: string().optional(),
25637
27595
  parent: DetailParentSchema,
25638
- steps: array(string()).optional()
27596
+ steps: array(string()).optional(),
27597
+ /**
27598
+ * The camera's root model already drew this step's boxes (D730): a
27599
+ * `license_plate` inside the parent vehicle. The named step is NOT
27600
+ * inferred — these FRAME-space boxes are its output — and its
27601
+ * requested children (the plate reader) run on them. Absent ⇒ every
27602
+ * requested step infers as before.
27603
+ */
27604
+ supplied: object({
27605
+ stepId: string(),
27606
+ modelId: string(),
27607
+ boxes: array(object({
27608
+ bbox: NativeCropBboxSchema,
27609
+ score: number()
27610
+ })).min(1)
27611
+ }).optional()
25639
27612
  }), object({ details: array(DetailResultSchema) }).nullable(), { kind: "mutation" }), method(object({
25640
27613
  /** Catalog step id, e.g. `clip-embedding`. */
25641
27614
  stepId: string(),
@@ -25687,7 +27660,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
25687
27660
  }), ParkedTrackFrameSchema.nullable()), method(object({
25688
27661
  deviceId: number(),
25689
27662
  trackId: string()
25690
- }), object({ released: number().int().nonnegative() }), { kind: "mutation" });
27663
+ }), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
27664
+ accepted: literal(true),
27665
+ runId: string()
27666
+ }), {
27667
+ kind: "mutation",
27668
+ auth: "admin"
27669
+ }), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
27670
+ kind: "mutation",
27671
+ auth: "admin"
27672
+ });
25691
27673
  var CameraPipelineConfigSchema = object({
25692
27674
  engine: PipelineEngineChoiceSchema.optional(),
25693
27675
  steps: array(PipelineStepInputSchema).readonly(),
@@ -25698,14 +27680,6 @@ var CameraPipelineConfigSchema = object({
25698
27680
  settings: record(string(), unknown()).readonly().optional()
25699
27681
  }).nullable().optional()
25700
27682
  });
25701
- var PipelineTemplateSchema = object({
25702
- id: string(),
25703
- name: string(),
25704
- description: string().optional(),
25705
- config: CameraPipelineConfigSchema,
25706
- createdAt: string(),
25707
- updatedAt: string()
25708
- });
25709
27683
  var DeviceStepConfigSchema = object({
25710
27684
  modelId: string().optional(),
25711
27685
  settings: record(string(), unknown()).optional(),
@@ -25779,9 +27753,10 @@ var CameraStepOverridePatchSchema = object({
25779
27753
  modelId: string().optional(),
25780
27754
  settings: record(string(), unknown()).readonly().optional()
25781
27755
  });
27756
+ var CameraStepSettingsSchema = record(string(), record(string(), unknown()).readonly());
25782
27757
  var CameraPipelineSettingsSchema = object({
25783
- pinnedAgentNodeId: string().optional(),
25784
27758
  stepToggles: record(string(), boolean()).optional(),
27759
+ stepSettings: CameraStepSettingsSchema.optional(),
25785
27760
  stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
25786
27761
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
25787
27762
  });
@@ -25814,7 +27789,10 @@ var PipelineAssignmentSchema = object({
25814
27789
  });
25815
27790
  /**
25816
27791
  * Per-agent load summary surfaced to the load balancer + dashboards.
25817
- * Aggregated from each runner's `getLocalLoad` cap call.
27792
+ * Aggregated from each runner's `getLocalLoad` cap call. In the
27793
+ * `getAgentLoad` report, a single-device node's default-pool sessions (no
27794
+ * `deviceKey`) are credited to its one eligible device in `load.devices` —
27795
+ * the default pool IS that device (D745); the balancer's census stays raw.
25818
27796
  */
25819
27797
  var AgentLoadSummarySchema = object({
25820
27798
  nodeId: string(),
@@ -25903,26 +27881,27 @@ var CameraBrokerStatusSchema = object({
25903
27881
  width: number(),
25904
27882
  height: number(),
25905
27883
  subscribers: number(),
25906
- inFps: number(),
25907
- outFps: number()
27884
+ /**
27885
+ * Encoded packets/s the broker receives from the camera. null when the
27886
+ * broker's stats read failed — unknown, never 0 (a 0 here reads as a stall).
27887
+ * There is no output rate: decoding runs in the session decode workers, not
27888
+ * in the broker, so the broker's own decoded-frame rate is 0 on every live
27889
+ * camera and is not served (D758).
27890
+ */
27891
+ inFps: number().nullable()
25908
27892
  })).readonly(),
25909
27893
  webrtcSessions: number(),
25910
27894
  rtspRestream: boolean()
25911
27895
  });
25912
- /** Shared-memory ring statistics within the decoder block. */
25913
- var CameraDecoderShmSchema = object({
25914
- framesWritten: number(),
25915
- getFrameHits: number(),
25916
- getFrameMisses: number(),
25917
- budgetMb: number()
25918
- });
25919
- /** Decoder block — null when the decoder stage is unreachable or inactive. */
25920
- var CameraDecoderStatusSchema = object({
25921
- nodeId: string(),
25922
- formats: array(string()).readonly(),
25923
- sessionCount: number(),
25924
- shm: CameraDecoderShmSchema
25925
- });
27896
+ /**
27897
+ * Decoder block — WHERE decode runs (co-located with the detection node by
27898
+ * construction); null when the camera has no detection node. It carries no
27899
+ * frame counter: the shared-memory plane whose counters it used to serve is
27900
+ * gone, and those fields read 0 forever. Whether frames actually flow is read
27901
+ * from `detection.actualFps` (frames delivered to and processed by the
27902
+ * detector), never from a counter nothing feeds.
27903
+ */
27904
+ var CameraDecoderStatusSchema = object({ nodeId: string() });
25926
27905
  /** Motion block — null when motion detection is not active for this device. */
25927
27906
  var CameraMotionStatusSchema = object({
25928
27907
  enabled: boolean(),
@@ -26279,12 +28258,6 @@ method(object({
26279
28258
  }), object({ success: literal(true) }), {
26280
28259
  kind: "mutation",
26281
28260
  auth: "admin"
26282
- }), method(object({
26283
- agentNodeId: string(),
26284
- detectWeight: number().positive().nullable()
26285
- }), object({ success: literal(true) }), {
26286
- kind: "mutation",
26287
- auth: "admin"
26288
28261
  }), method(object({
26289
28262
  agentNodeId: string(),
26290
28263
  detect: boolean().nullable().optional(),
@@ -26326,6 +28299,30 @@ method(object({
26326
28299
  }), {
26327
28300
  kind: "mutation",
26328
28301
  auth: "admin"
28302
+ }), method(AutoTuneOptionsSchema, AutoTunePlanSchema, { auth: "admin" }), method(AutoTuneApplyInputSchema, AutoTuneApplyResultSchema, {
28303
+ kind: "mutation",
28304
+ auth: "admin"
28305
+ }), method(LoadBalancingSharesInputSchema, object({ success: literal(true) }), {
28306
+ kind: "mutation",
28307
+ auth: "admin"
28308
+ }), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
28309
+ kind: "mutation",
28310
+ auth: "admin"
28311
+ }), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
28312
+ kind: literal("started"),
28313
+ runId: string()
28314
+ }), object({
28315
+ kind: literal("refused"),
28316
+ preflight: NodeBenchmarkPreflightSchema
28317
+ })]), {
28318
+ kind: "mutation",
28319
+ auth: "admin"
28320
+ }), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
28321
+ kind: "mutation",
28322
+ auth: "admin"
28323
+ }), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
28324
+ kind: "mutation",
28325
+ auth: "admin"
26329
28326
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
26330
28327
  deviceId: number(),
26331
28328
  addonId: string(),
@@ -26342,6 +28339,13 @@ method(object({
26342
28339
  }), object({ success: literal(true) }), {
26343
28340
  kind: "mutation",
26344
28341
  auth: "admin"
28342
+ }), method(object({
28343
+ deviceId: number(),
28344
+ addonId: string(),
28345
+ settings: record(string(), unknown()).nullable()
28346
+ }), object({ success: literal(true) }), {
28347
+ kind: "mutation",
28348
+ auth: "admin"
26345
28349
  }), method(object({
26346
28350
  deviceId: number(),
26347
28351
  agentNodeId: string(),
@@ -26365,25 +28369,7 @@ method(object({
26365
28369
  }), method(_void(), DiskReconcileJobSchema, {
26366
28370
  kind: "mutation",
26367
28371
  auth: "admin"
26368
- }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
26369
- name: string(),
26370
- description: string().optional(),
26371
- config: CameraPipelineConfigSchema
26372
- }), PipelineTemplateSchema, {
26373
- kind: "mutation",
26374
- auth: "admin"
26375
- }), method(object({
26376
- id: string(),
26377
- name: string().optional(),
26378
- description: string().optional(),
26379
- config: CameraPipelineConfigSchema.optional()
26380
- }), PipelineTemplateSchema, {
26381
- kind: "mutation",
26382
- auth: "admin"
26383
- }), method(object({ id: string() }), object({ success: literal(true) }), {
26384
- kind: "mutation",
26385
- auth: "admin"
26386
- });
28372
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" });
26387
28373
  /**
26388
28374
  * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
26389
28375
  * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
@@ -27077,7 +29063,19 @@ var SsoBridgeClaimsSchema = object({
27077
29063
  * editing a descriptor must not retroactively extend or shorten a link the
27078
29064
  * operator already consented to.
27079
29065
  */
27080
- refreshTtl: union([number().int().positive(), literal("never")]).optional()
29066
+ refreshTtl: union([number().int().positive(), literal("never")]).optional(),
29067
+ /**
29068
+ * Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
29069
+ * that was started from a signed-in user's "Link" button: the finish then
29070
+ * links this identity to the intent's user instead of signing anyone in.
29071
+ * The handle carries no user id — the hub resolves it, single-use.
29072
+ */
29073
+ linkIntent: string().optional(),
29074
+ /**
29075
+ * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
29076
+ * subject is unique only per issuer, so a link is bound to it.
29077
+ */
29078
+ issuer: string().optional()
27081
29079
  });
27082
29080
  method(object({
27083
29081
  claims: SsoBridgeClaimsSchema,
@@ -29154,8 +31152,6 @@ var WebrtcStreamChoiceSchema = object({
29154
31152
  ]).nullable(),
29155
31153
  /** Input FPS from the camera (null for adaptive). */
29156
31154
  inputFps: number().nullable(),
29157
- /** Decoded FPS (null for adaptive). */
29158
- decodeFps: number().nullable(),
29159
31155
  /** Bitrate in kbps (null for adaptive). */
29160
31156
  bitrateKbps: number().nullable()
29161
31157
  });
@@ -29432,7 +31428,22 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
29432
31428
  * field their hints were silently stripped by the schema and the
29433
31429
  * adaptive ladder started blind on the client's display size.
29434
31430
  */
29435
- hints: webrtcClientHintsSchema.optional()
31431
+ hints: webrtcClientHintsSchema.optional(),
31432
+ /**
31433
+ * Talk-back (D771): relay the PEER's audio to the device's speaker
31434
+ * through the `intercom` cap's push-talk triple. When `true` and the
31435
+ * offer lets the peer send audio, the answer's audio is `sendrecv`
31436
+ * and every inbound frame goes to `intercom.pushTalkAudio` for this
31437
+ * `deviceId`; absent/false answers `sendonly`, as for every viewer.
31438
+ *
31439
+ * TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
31440
+ * with `intercom`, when the linked user may control that camera. The
31441
+ * hub STRIPS it from every request-bound call (a browser), exactly as
31442
+ * it overwrites `relayOnly` — a viewer's talk permission is the
31443
+ * intercom cap's own surface (share tokens gate it there), and this
31444
+ * flag must not become a second door to the camera's speaker.
31445
+ */
31446
+ talkback: boolean().optional()
29436
31447
  }), object({
29437
31448
  sessionId: string(),
29438
31449
  sdpAnswer: string()
@@ -29487,6 +31498,14 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
29487
31498
  */
29488
31499
  alive: boolean()
29489
31500
  })), method(object({
31501
+ deviceId: number().int().nonnegative(),
31502
+ sessionId: string(),
31503
+ downlinkMbps: number().nonnegative()
31504
+ }), object({
31505
+ outcome: _enum(["switching", "held"]),
31506
+ tier: CamProfileSchema.nullable(),
31507
+ reason: string()
31508
+ }), { kind: "mutation" }), method(object({
29490
31509
  deviceId: number().int().nonnegative(),
29491
31510
  sessionId: string()
29492
31511
  }), WebrtcSessionDebugSchema, { kind: "query" });
@@ -29726,6 +31745,59 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
29726
31745
  var RestartAddonResultSchema = unknown();
29727
31746
  var InstallPackageResultSchema = unknown();
29728
31747
  var ReloadPackagesResultSchema = unknown();
31748
+ /**
31749
+ * What an uninstall did on ONE node.
31750
+ * - `uninstalled` — removed: runner(s) stopped, caps gone, code deleted.
31751
+ * - `not-installed` — the node did not have it (nothing to do).
31752
+ * - `refused` — protected / bootstrap package; nothing touched.
31753
+ * - `failed` — attempted and did not complete; `error` says why.
31754
+ * - `pending-reconnect` — the node is OFFLINE: its record was pruned so the
31755
+ * back-fill never returns the package, and the stale-addon sweep removes the
31756
+ * copy when the node registers again (only once the hub no longer has it).
31757
+ */
31758
+ var UninstallNodeOutcomeSchema = _enum([
31759
+ "uninstalled",
31760
+ "not-installed",
31761
+ "refused",
31762
+ "failed",
31763
+ "pending-reconnect"
31764
+ ]);
31765
+ var UninstallNodeResultSchema = object({
31766
+ nodeId: string(),
31767
+ outcome: UninstallNodeOutcomeSchema,
31768
+ error: string().optional(),
31769
+ addonIds: array(string()).readonly(),
31770
+ runnersStopped: array(string()).readonly(),
31771
+ warnings: array(string()).readonly()
31772
+ });
31773
+ var UninstallPackageResultSchema = object({
31774
+ /** Every targeted node ended `uninstalled`, `not-installed` or `pending-reconnect`. */
31775
+ success: boolean(),
31776
+ packageName: string(),
31777
+ results: array(UninstallNodeResultSchema).readonly()
31778
+ });
31779
+ /**
31780
+ * `unreachable` lists online agents whose status read FAILED — absence from
31781
+ * `installations` is only "not installed" for a node that answered (D315).
31782
+ */
31783
+ var PackageInstallationsSchema = object({
31784
+ installations: array(object({
31785
+ packageName: string(),
31786
+ nodeId: string(),
31787
+ nodeName: string(),
31788
+ isHub: boolean(),
31789
+ isOnline: boolean(),
31790
+ version: string().nullable(),
31791
+ addonIds: array(string()).readonly(),
31792
+ source: _enum(["live", "recorded"]),
31793
+ /** The hub installs this package too. `false` on an agent row = an orphan. */
31794
+ onHub: boolean()
31795
+ })).readonly(),
31796
+ unreachable: array(object({
31797
+ nodeId: string(),
31798
+ error: string()
31799
+ })).readonly()
31800
+ });
29729
31801
  var BulkUpdateItemStatusSchema = _enum([
29730
31802
  "queued",
29731
31803
  "updating",
@@ -29808,10 +31880,14 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
29808
31880
  }), method(object({ packageName: string() }), InstallPackageResultSchema, {
29809
31881
  kind: "mutation",
29810
31882
  auth: "admin"
29811
- }), method(_void(), boolean()), method(_void(), array(unknown()).readonly()), method(object({ packageName: string() }), unknown(), {
31883
+ }), method(_void(), boolean()), method(_void(), array(unknown()).readonly()), method(object({
31884
+ packageName: string().min(1),
31885
+ nodeId: string().optional(),
31886
+ everywhere: boolean().optional()
31887
+ }), UninstallPackageResultSchema, {
29812
31888
  kind: "mutation",
29813
31889
  auth: "admin"
29814
- }), method(_void(), ReloadPackagesResultSchema, {
31890
+ }), method(object({ packageName: string().optional() }), PackageInstallationsSchema, { auth: "admin" }), method(_void(), ReloadPackagesResultSchema, {
29815
31891
  kind: "mutation",
29816
31892
  auth: "admin"
29817
31893
  }), method(object({ query: string().optional() }), array(SearchResultSchema)), method(object({ nodeId: string().optional() }), array(PackageUpdateSchema).readonly(), { auth: "admin" }), method(object({
@@ -32876,6 +34952,9 @@ var CreateIntegrationInputSchema = object({
32876
34952
  enabled: boolean().optional(),
32877
34953
  info: record(string(), unknown()).optional(),
32878
34954
  settings: record(string(), unknown()).optional(),
34955
+ /** Keys of `settings` the form's schema declares secret (by type) — kept in
34956
+ * the keychain, not the table (D787). */
34957
+ secretKeys: array(string()).optional(),
32879
34958
  skipRestart: boolean().optional()
32880
34959
  });
32881
34960
  var UpdateIntegrationInputSchema = object({
@@ -32899,7 +34978,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
32899
34978
  auth: "admin"
32900
34979
  }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
32901
34980
  id: string(),
32902
- settings: record(string(), unknown())
34981
+ settings: record(string(), unknown()),
34982
+ /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
34983
+ secretKeys: array(string()).optional()
32903
34984
  }), object({ success: boolean() }), {
32904
34985
  kind: "mutation",
32905
34986
  auth: "admin"
@@ -33298,7 +35379,8 @@ var ConnectionEndpointSchema = object({
33298
35379
  "lan-ipv6",
33299
35380
  "public",
33300
35381
  "loopback",
33301
- "app-link"
35382
+ "app-link",
35383
+ "custom"
33302
35384
  ]),
33303
35385
  /**
33304
35386
  * Originating-interface kind — `lan`/`wifi`/`docker`/`vpn`/`other`/
@@ -33367,7 +35449,7 @@ var GetConnectionEndpointsResultSchema = object({
33367
35449
  localPort: AdvertisedLocalPortSchema
33368
35450
  });
33369
35451
  /**
33370
- * The address flagged for notification links. `baseUrl: null` = AUTO, which
35452
+ * The address flagged for notification taps (`notificationTaps`). `baseUrl: null` = AUTO, which
33371
35453
  * since D709 is the CamStack app link; `resolved` reports the effective value,
33372
35454
  * so the UI can show it either way.
33373
35455
  */
@@ -33400,6 +35482,72 @@ var ViewerEndpointsSchema = object({
33400
35482
  /** What the ranking currently resolves to (may be empty if nothing is up). */
33401
35483
  resolved: array(string()).readonly()
33402
35484
  });
35485
+ /**
35486
+ * DEPRECATED compatibility shape of `getHubAddresses` (D729 amendment, kept
35487
+ * for addons built against it): `cluster` is the `internal` role, `browser`
35488
+ * the `publicEndpoint` role; `override` is the flagged address.
35489
+ */
35490
+ var HubAddressSnapshotSchema = object({
35491
+ override: string().nullable(),
35492
+ resolved: string().nullable(),
35493
+ source: _enum([
35494
+ "override",
35495
+ "auto",
35496
+ "none"
35497
+ ])
35498
+ });
35499
+ var HubAddressesSchema = object({
35500
+ cluster: HubAddressSnapshotSchema,
35501
+ browser: HubAddressSnapshotSchema
35502
+ });
35503
+ /**
35504
+ * What an address is used for (`hub-address.ts`, D734). `appConnections` is
35505
+ * many-valued; `notificationTaps`, `publicEndpoint` and `internal` are carried
35506
+ * by at most one address.
35507
+ */
35508
+ var HubAddressRoleSchema = _enum(HUB_ADDRESS_ROLES);
35509
+ var RoleSourceSchema = _enum([
35510
+ "flagged",
35511
+ "auto",
35512
+ "none"
35513
+ ]);
35514
+ /** One single-valued role: the flagged address, the one in use, and why. */
35515
+ var HubAddressRoleResolutionSchema = object({
35516
+ /** The address carrying the flag, or null = automatic. */
35517
+ flagged: string().nullable(),
35518
+ /** The address in use, or null when nothing qualifies (never loopback). */
35519
+ resolved: string().nullable(),
35520
+ source: RoleSourceSchema
35521
+ });
35522
+ var HubAppConnectionsResolutionSchema = object({
35523
+ /** The addresses flagged `appConnections`, or empty = automatic. */
35524
+ flagged: array(string()).readonly(),
35525
+ /** What the apps race right now. */
35526
+ resolved: array(string()).readonly(),
35527
+ source: RoleSourceSchema
35528
+ });
35529
+ var HubAddressBookSchema = object({
35530
+ rows: array(ConnectionEndpointSchema.extend({
35531
+ /** In the hub's detected palette right now. */
35532
+ detected: boolean(),
35533
+ /** Entered by the operator (removable). */
35534
+ custom: boolean(),
35535
+ /** The roles explicitly flagged on this address. */
35536
+ flags: array(HubAddressRoleSchema).readonly(),
35537
+ /** The roles this address serves right now — flagged or automatic. */
35538
+ inUse: array(HubAddressRoleSchema).readonly(),
35539
+ /** The roles this address may be flagged with. */
35540
+ eligible: array(HubAddressRoleSchema).readonly()
35541
+ })).readonly(),
35542
+ roles: object({
35543
+ appConnections: HubAppConnectionsResolutionSchema,
35544
+ notificationTaps: HubAddressRoleResolutionSchema,
35545
+ internal: HubAddressRoleResolutionSchema,
35546
+ publicEndpoint: HubAddressRoleResolutionSchema
35547
+ }),
35548
+ /** The `hub=` an app link carries (D709), or null. */
35549
+ appLinkHub: string().nullable()
35550
+ });
33403
35551
  var AllowedAddressesSchema = object({
33404
35552
  /**
33405
35553
  * Allowlist of interface addresses operators have explicitly opted
@@ -33443,10 +35591,27 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
33443
35591
  * tunnel always emits `https://` regardless. */
33444
35592
  scheme: _enum(["http", "https"]).optional(),
33445
35593
  /** Append the CamStack app link entry (`kind: 'app-link'`, D709) —
33446
- * an address notification links can be flagged with, not a hub
35594
+ * an address notification taps can be flagged with, not a hub
33447
35595
  * route. Default `false`: racers and rankers never see it. */
33448
35596
  includeAppLink: boolean().optional()
33449
- }), GetConnectionEndpointsResultSchema), method(_void(), NotificationEndpointSchema), method(object({ baseUrl: string().nullable() }), NotificationEndpointSchema, { kind: "mutation" }), method(_void(), ViewerEndpointsSchema), method(object({ baseUrls: array(string()).readonly() }), ViewerEndpointsSchema, { kind: "mutation" }), method(_void(), AllowedAddressesSchema), method(AllowedAddressesSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), AllowedAddressesSchema, { kind: "mutation" }), method(_void(), TlsStatusSchema), method(object({ reason: string().optional() }), TlsStatusSchema, {
35597
+ }), GetConnectionEndpointsResultSchema), method(_void(), NotificationEndpointSchema), method(object({ baseUrl: string().nullable() }), NotificationEndpointSchema, { kind: "mutation" }), method(_void(), ViewerEndpointsSchema), method(object({ baseUrls: array(string()).readonly() }), ViewerEndpointsSchema, { kind: "mutation" }), method(object({ scheme: _enum(["http", "https"]).optional() }).optional(), HubAddressBookSchema), method(object({
35598
+ baseUrl: string(),
35599
+ label: string().max(80)
35600
+ }), HubAddressBookSchema, {
35601
+ kind: "mutation",
35602
+ auth: "admin"
35603
+ }), method(object({ baseUrl: string() }), HubAddressBookSchema, {
35604
+ kind: "mutation",
35605
+ auth: "admin"
35606
+ }), method(object({
35607
+ role: HubAddressRoleSchema,
35608
+ baseUrl: string().nullable(),
35609
+ enabled: boolean(),
35610
+ acceptInsecureHttp: boolean().optional()
35611
+ }), HubAddressBookSchema, {
35612
+ kind: "mutation",
35613
+ auth: "admin"
35614
+ }), method(_void(), HubAddressesSchema), method(_void(), AllowedAddressesSchema), method(AllowedAddressesSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), AllowedAddressesSchema, { kind: "mutation" }), method(_void(), TlsStatusSchema), method(object({ reason: string().optional() }), TlsStatusSchema, {
33450
35615
  kind: "mutation",
33451
35616
  auth: "admin"
33452
35617
  }), method(object({
@@ -40207,6 +42372,32 @@ var TotpStatusSchema = object({
40207
42372
  /** Null when no row exists OR the row is still pending confirmation. */
40208
42373
  confirmedAt: number().nullable()
40209
42374
  });
42375
+ /**
42376
+ * user-management — singleton capability for user accounts, API keys,
42377
+ * and scoped tokens.
42378
+ *
42379
+ * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
42380
+ * — the subset check on `setUserScopes` / `createScopedToken` is moot
42381
+ * because non-admins never reach these. If/when we open non-admin
42382
+ * delegation, structural caller-scope subset check goes inside the
42383
+ * provider.
42384
+ */
42385
+ var ExternalIdentitySchema = object({
42386
+ /** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
42387
+ provider: string(),
42388
+ /** The IdP's stable subject (`sub`) for this account. */
42389
+ subject: string(),
42390
+ /** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
42391
+ issuer: string(),
42392
+ userId: string(),
42393
+ /** What the IdP called the account at link time (username / email) — display only. */
42394
+ label: string().optional(),
42395
+ linkedAt: number()
42396
+ });
42397
+ var ExternalIdentityKeySchema = object({
42398
+ provider: string().min(1),
42399
+ subject: string().min(1)
42400
+ });
40210
42401
  method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
40211
42402
  kind: "mutation",
40212
42403
  auth: "admin",
@@ -40320,7 +42511,22 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40320
42511
  userId: string(),
40321
42512
  username: string(),
40322
42513
  scopes: array(TokenScopeSchema)
40323
- }).nullable(), { access: "view" }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
42514
+ }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
42515
+ userId: string(),
42516
+ issuer: string()
42517
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
42518
+ userId: string(),
42519
+ issuer: string().min(1),
42520
+ label: string().optional()
42521
+ }), object({ success: literal(true) }), {
42522
+ kind: "mutation",
42523
+ auth: "admin",
42524
+ access: "create"
42525
+ }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
42526
+ kind: "mutation",
42527
+ auth: "admin",
42528
+ access: "delete"
42529
+ }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
40324
42530
  kind: "mutation",
40325
42531
  auth: "admin",
40326
42532
  access: "delete"
@@ -41022,6 +43228,16 @@ var zoneRulesCapability = {
41022
43228
  durability: "restored"
41023
43229
  };
41024
43230
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
43231
+ Object.freeze({
43232
+ person: .5,
43233
+ vehicle: .5,
43234
+ animal: .5
43235
+ });
43236
+ Object.freeze({
43237
+ person: .65,
43238
+ vehicle: .65,
43239
+ animal: .65
43240
+ });
41025
43241
  /**
41026
43242
  * Accessory device helpers — shared across drivers.
41027
43243
  *
@@ -41512,7 +43728,8 @@ var BaseDevice = class {
41512
43728
  this.role = options.role;
41513
43729
  this.parentDeviceId = ctx.parentDeviceId;
41514
43730
  const seedData = ctx.persistedConfig ?? {};
41515
- this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data), seedData, ({ droppedKeys, issues }) => {
43731
+ const declaredSecretPaths = collectZodSecretPaths(schema);
43732
+ this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
41516
43733
  ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
41517
43734
  tags: {
41518
43735
  deviceId: ctx.id,
@@ -42746,6 +44963,12 @@ Object.freeze({
42746
44963
  addonId: null,
42747
44964
  access: "view"
42748
44965
  },
44966
+ "addons.listInstallations": {
44967
+ capName: "addons",
44968
+ capScope: "system",
44969
+ addonId: null,
44970
+ access: "view"
44971
+ },
42749
44972
  "addons.listJobs": {
42750
44973
  capName: "addons",
42751
44974
  capScope: "system",
@@ -43928,90 +46151,18 @@ Object.freeze({
43928
46151
  addonId: null,
43929
46152
  access: "create"
43930
46153
  },
43931
- "decoder.createSession": {
43932
- capName: "decoder",
43933
- capScope: "system",
43934
- addonId: null,
43935
- access: "view"
43936
- },
43937
- "decoder.destroySession": {
43938
- capName: "decoder",
43939
- capScope: "system",
43940
- addonId: null,
43941
- access: "delete"
43942
- },
43943
- "decoder.getFrame": {
43944
- capName: "decoder",
43945
- capScope: "system",
43946
- addonId: null,
43947
- access: "view"
43948
- },
43949
46154
  "decoder.getInfo": {
43950
46155
  capName: "decoder",
43951
46156
  capScope: "system",
43952
46157
  addonId: null,
43953
46158
  access: "view"
43954
46159
  },
43955
- "decoder.getShmStats": {
43956
- capName: "decoder",
43957
- capScope: "system",
43958
- addonId: null,
43959
- access: "view"
43960
- },
43961
- "decoder.getStats": {
43962
- capName: "decoder",
43963
- capScope: "system",
43964
- addonId: null,
43965
- access: "view"
43966
- },
43967
- "decoder.listActiveSessions": {
43968
- capName: "decoder",
43969
- capScope: "system",
43970
- addonId: null,
43971
- access: "view"
43972
- },
43973
- "decoder.openStream": {
43974
- capName: "decoder",
43975
- capScope: "system",
43976
- addonId: null,
43977
- access: "view"
43978
- },
43979
- "decoder.pullFrames": {
43980
- capName: "decoder",
43981
- capScope: "system",
43982
- addonId: null,
43983
- access: "view"
43984
- },
43985
- "decoder.pullHandles": {
43986
- capName: "decoder",
43987
- capScope: "system",
43988
- addonId: null,
43989
- access: "view"
43990
- },
43991
- "decoder.pushPacket": {
43992
- capName: "decoder",
43993
- capScope: "system",
43994
- addonId: null,
43995
- access: "view"
43996
- },
43997
46160
  "decoder.reprobeHwaccel": {
43998
46161
  capName: "decoder",
43999
46162
  capScope: "system",
44000
46163
  addonId: null,
44001
46164
  access: "create"
44002
46165
  },
44003
- "decoder.supportsCodec": {
44004
- capName: "decoder",
44005
- capScope: "system",
44006
- addonId: null,
44007
- access: "view"
44008
- },
44009
- "decoder.updateConfig": {
44010
- capName: "decoder",
44011
- capScope: "system",
44012
- addonId: null,
44013
- access: "view"
44014
- },
44015
46166
  "detectionPipeline.applyDeviceSettingsPatch": {
44016
46167
  capName: "detection-pipeline",
44017
46168
  capScope: "device",
@@ -45278,6 +47429,90 @@ Object.freeze({
45278
47429
  addonId: null,
45279
47430
  access: "create"
45280
47431
  },
47432
+ "keychain.delete": {
47433
+ capName: "keychain",
47434
+ capScope: "system",
47435
+ addonId: null,
47436
+ access: "delete"
47437
+ },
47438
+ "keychain.getState": {
47439
+ capName: "keychain",
47440
+ capScope: "system",
47441
+ addonId: null,
47442
+ access: "view"
47443
+ },
47444
+ "keychain.listMeta": {
47445
+ capName: "keychain",
47446
+ capScope: "system",
47447
+ addonId: null,
47448
+ access: "view"
47449
+ },
47450
+ "keychain.put": {
47451
+ capName: "keychain",
47452
+ capScope: "system",
47453
+ addonId: null,
47454
+ access: "create"
47455
+ },
47456
+ "keychain.resolve": {
47457
+ capName: "keychain",
47458
+ capScope: "system",
47459
+ addonId: null,
47460
+ access: "view"
47461
+ },
47462
+ "keychainAdmin.deleteOrphans": {
47463
+ capName: "keychain-admin",
47464
+ capScope: "system",
47465
+ addonId: null,
47466
+ access: "delete"
47467
+ },
47468
+ "keychainAdmin.downloadRecoveryKey": {
47469
+ capName: "keychain-admin",
47470
+ capScope: "system",
47471
+ addonId: null,
47472
+ access: "create"
47473
+ },
47474
+ "keychainAdmin.listAudit": {
47475
+ capName: "keychain-admin",
47476
+ capScope: "system",
47477
+ addonId: null,
47478
+ access: "view"
47479
+ },
47480
+ "keychainAdmin.listSecrets": {
47481
+ capName: "keychain-admin",
47482
+ capScope: "system",
47483
+ addonId: null,
47484
+ access: "view"
47485
+ },
47486
+ "keychainAdmin.purgeRetiredKeys": {
47487
+ capName: "keychain-admin",
47488
+ capScope: "system",
47489
+ addonId: null,
47490
+ access: "delete"
47491
+ },
47492
+ "keychainAdmin.resetKeychain": {
47493
+ capName: "keychain-admin",
47494
+ capScope: "system",
47495
+ addonId: null,
47496
+ access: "delete"
47497
+ },
47498
+ "keychainAdmin.reveal": {
47499
+ capName: "keychain-admin",
47500
+ capScope: "system",
47501
+ addonId: null,
47502
+ access: "create"
47503
+ },
47504
+ "keychainAdmin.rotateMasterKey": {
47505
+ capName: "keychain-admin",
47506
+ capScope: "system",
47507
+ addonId: null,
47508
+ access: "create"
47509
+ },
47510
+ "keychainAdmin.status": {
47511
+ capName: "keychain-admin",
47512
+ capScope: "system",
47513
+ addonId: null,
47514
+ access: "view"
47515
+ },
45281
47516
  "lawnMowerControl.dock": {
45282
47517
  capName: "lawn-mower-control",
45283
47518
  capScope: "device",
@@ -45500,12 +47735,24 @@ Object.freeze({
45500
47735
  addonId: null,
45501
47736
  access: "view"
45502
47737
  },
47738
+ "localNetwork.addCustomAddress": {
47739
+ capName: "local-network",
47740
+ capScope: "system",
47741
+ addonId: null,
47742
+ access: "create"
47743
+ },
45503
47744
  "localNetwork.downloadCa": {
45504
47745
  capName: "local-network",
45505
47746
  capScope: "system",
45506
47747
  addonId: null,
45507
47748
  access: "view"
45508
47749
  },
47750
+ "localNetwork.getAddresses": {
47751
+ capName: "local-network",
47752
+ capScope: "system",
47753
+ addonId: null,
47754
+ access: "view"
47755
+ },
45509
47756
  "localNetwork.getAllowedAddresses": {
45510
47757
  capName: "local-network",
45511
47758
  capScope: "system",
@@ -45518,6 +47765,12 @@ Object.freeze({
45518
47765
  addonId: null,
45519
47766
  access: "view"
45520
47767
  },
47768
+ "localNetwork.getHubAddresses": {
47769
+ capName: "local-network",
47770
+ capScope: "system",
47771
+ addonId: null,
47772
+ access: "view"
47773
+ },
45521
47774
  "localNetwork.getNotificationEndpoint": {
45522
47775
  capName: "local-network",
45523
47776
  capScope: "system",
@@ -45554,6 +47807,12 @@ Object.freeze({
45554
47807
  addonId: null,
45555
47808
  access: "create"
45556
47809
  },
47810
+ "localNetwork.removeCustomAddress": {
47811
+ capName: "local-network",
47812
+ capScope: "system",
47813
+ addonId: null,
47814
+ access: "delete"
47815
+ },
45557
47816
  "localNetwork.resetAllowlistToBestMatch": {
45558
47817
  capName: "local-network",
45559
47818
  capScope: "system",
@@ -45566,6 +47825,12 @@ Object.freeze({
45566
47825
  addonId: null,
45567
47826
  access: "create"
45568
47827
  },
47828
+ "localNetwork.setAddressRole": {
47829
+ capName: "local-network",
47830
+ capScope: "system",
47831
+ addonId: null,
47832
+ access: "create"
47833
+ },
45569
47834
  "localNetwork.setAllowedAddresses": {
45570
47835
  capName: "local-network",
45571
47836
  capScope: "system",
@@ -46622,6 +48887,18 @@ Object.freeze({
46622
48887
  addonId: null,
46623
48888
  access: "create"
46624
48889
  },
48890
+ "pipelineAnalytics.addRetrainFrameFromRecording": {
48891
+ capName: "pipeline-analytics",
48892
+ capScope: "device",
48893
+ addonId: null,
48894
+ access: "create"
48895
+ },
48896
+ "pipelineAnalytics.addRetrainFramesToCollection": {
48897
+ capName: "pipeline-analytics",
48898
+ capScope: "device",
48899
+ addonId: null,
48900
+ access: "create"
48901
+ },
46625
48902
  "pipelineAnalytics.applyDeviceSettingsPatch": {
46626
48903
  capName: "pipeline-analytics",
46627
48904
  capScope: "device",
@@ -46670,12 +48947,24 @@ Object.freeze({
46670
48947
  addonId: null,
46671
48948
  access: "view"
46672
48949
  },
48950
+ "pipelineAnalytics.createRetrainCollection": {
48951
+ capName: "pipeline-analytics",
48952
+ capScope: "device",
48953
+ addonId: null,
48954
+ access: "create"
48955
+ },
46673
48956
  "pipelineAnalytics.deleteDeviceEvents": {
46674
48957
  capName: "pipeline-analytics",
46675
48958
  capScope: "device",
46676
48959
  addonId: null,
46677
48960
  access: "delete"
46678
48961
  },
48962
+ "pipelineAnalytics.deleteRetrainCollection": {
48963
+ capName: "pipeline-analytics",
48964
+ capScope: "device",
48965
+ addonId: null,
48966
+ access: "delete"
48967
+ },
46679
48968
  "pipelineAnalytics.deleteTracks": {
46680
48969
  capName: "pipeline-analytics",
46681
48970
  capScope: "device",
@@ -46880,6 +49169,24 @@ Object.freeze({
46880
49169
  addonId: null,
46881
49170
  access: "view"
46882
49171
  },
49172
+ "pipelineAnalytics.listRetrainAssistProfiles": {
49173
+ capName: "pipeline-analytics",
49174
+ capScope: "device",
49175
+ addonId: null,
49176
+ access: "view"
49177
+ },
49178
+ "pipelineAnalytics.listRetrainCollectionFrames": {
49179
+ capName: "pipeline-analytics",
49180
+ capScope: "device",
49181
+ addonId: null,
49182
+ access: "view"
49183
+ },
49184
+ "pipelineAnalytics.listRetrainCollections": {
49185
+ capName: "pipeline-analytics",
49186
+ capScope: "device",
49187
+ addonId: null,
49188
+ access: "view"
49189
+ },
46883
49190
  "pipelineAnalytics.listRetrainFrames": {
46884
49191
  capName: "pipeline-analytics",
46885
49192
  capScope: "device",
@@ -46928,6 +49235,12 @@ Object.freeze({
46928
49235
  addonId: null,
46929
49236
  access: "create"
46930
49237
  },
49238
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
49239
+ capName: "pipeline-analytics",
49240
+ capScope: "device",
49241
+ addonId: null,
49242
+ access: "create"
49243
+ },
46931
49244
  "pipelineAnalytics.pruneEvents": {
46932
49245
  capName: "pipeline-analytics",
46933
49246
  capScope: "device",
@@ -46982,6 +49295,18 @@ Object.freeze({
46982
49295
  addonId: null,
46983
49296
  access: "create"
46984
49297
  },
49298
+ "pipelineAnalytics.removeRetrainFrameFromCollection": {
49299
+ capName: "pipeline-analytics",
49300
+ capScope: "device",
49301
+ addonId: null,
49302
+ access: "delete"
49303
+ },
49304
+ "pipelineAnalytics.renameRetrainCollection": {
49305
+ capName: "pipeline-analytics",
49306
+ capScope: "device",
49307
+ addonId: null,
49308
+ access: "create"
49309
+ },
46985
49310
  "pipelineAnalytics.restageRetrainTrack": {
46986
49311
  capName: "pipeline-analytics",
46987
49312
  capScope: "device",
@@ -47012,6 +49337,12 @@ Object.freeze({
47012
49337
  addonId: null,
47013
49338
  access: "create"
47014
49339
  },
49340
+ "pipelineAnalytics.setRetrainFrameComplete": {
49341
+ capName: "pipeline-analytics",
49342
+ capScope: "device",
49343
+ addonId: null,
49344
+ access: "create"
49345
+ },
47015
49346
  "pipelineAnalytics.setTrackFlags": {
47016
49347
  capName: "pipeline-analytics",
47017
49348
  capScope: "device",
@@ -47048,6 +49379,12 @@ Object.freeze({
47048
49379
  addonId: null,
47049
49380
  access: "delete"
47050
49381
  },
49382
+ "pipelineAnalytics.writeRetrainArchive": {
49383
+ capName: "pipeline-analytics",
49384
+ capScope: "device",
49385
+ addonId: null,
49386
+ access: "create"
49387
+ },
47051
49388
  "pipelineExecutor.cacheFrameInPool": {
47052
49389
  capName: "pipeline-executor",
47053
49390
  capScope: "system",
@@ -47060,13 +49397,13 @@ Object.freeze({
47060
49397
  addonId: null,
47061
49398
  access: "delete"
47062
49399
  },
47063
- "pipelineExecutor.deleteModel": {
49400
+ "pipelineExecutor.clearModelBoundDeviceOverrides": {
47064
49401
  capName: "pipeline-executor",
47065
49402
  capScope: "system",
47066
49403
  addonId: null,
47067
49404
  access: "delete"
47068
49405
  },
47069
- "pipelineExecutor.deleteTemplate": {
49406
+ "pipelineExecutor.deleteModel": {
47070
49407
  capName: "pipeline-executor",
47071
49408
  capScope: "system",
47072
49409
  addonId: null,
@@ -47210,12 +49547,6 @@ Object.freeze({
47210
49547
  addonId: null,
47211
49548
  access: "view"
47212
49549
  },
47213
- "pipelineExecutor.listTemplates": {
47214
- capName: "pipeline-executor",
47215
- capScope: "system",
47216
- addonId: null,
47217
- access: "view"
47218
- },
47219
49550
  "pipelineExecutor.rearmInferenceDevice": {
47220
49551
  capName: "pipeline-executor",
47221
49552
  capScope: "system",
@@ -47240,12 +49571,6 @@ Object.freeze({
47240
49571
  addonId: null,
47241
49572
  access: "create"
47242
49573
  },
47243
- "pipelineExecutor.saveTemplate": {
47244
- capName: "pipeline-executor",
47245
- capScope: "system",
47246
- addonId: null,
47247
- access: "create"
47248
- },
47249
49574
  "pipelineExecutor.setVideoPipelineSteps": {
47250
49575
  capName: "pipeline-executor",
47251
49576
  capScope: "system",
@@ -47264,17 +49589,23 @@ Object.freeze({
47264
49589
  addonId: null,
47265
49590
  access: "create"
47266
49591
  },
47267
- "pipelineExecutor.updateTemplate": {
49592
+ "pipelineExecutor.validatePipeline": {
47268
49593
  capName: "pipeline-executor",
47269
49594
  capScope: "system",
47270
49595
  addonId: null,
49596
+ access: "view"
49597
+ },
49598
+ "pipelineOrchestrator.abortNodeBenchmark": {
49599
+ capName: "pipeline-orchestrator",
49600
+ capScope: "system",
49601
+ addonId: null,
47271
49602
  access: "create"
47272
49603
  },
47273
- "pipelineExecutor.validatePipeline": {
47274
- capName: "pipeline-executor",
49604
+ "pipelineOrchestrator.applyAutoTune": {
49605
+ capName: "pipeline-orchestrator",
47275
49606
  capScope: "system",
47276
49607
  addonId: null,
47277
- access: "view"
49608
+ access: "create"
47278
49609
  },
47279
49610
  "pipelineOrchestrator.applyDeviceSettingsPatch": {
47280
49611
  capName: "pipeline-orchestrator",
@@ -47294,7 +49625,7 @@ Object.freeze({
47294
49625
  addonId: null,
47295
49626
  access: "create"
47296
49627
  },
47297
- "pipelineOrchestrator.deleteTemplate": {
49628
+ "pipelineOrchestrator.deleteNodeBenchmarkResult": {
47298
49629
  capName: "pipeline-orchestrator",
47299
49630
  capScope: "system",
47300
49631
  addonId: null,
@@ -47390,6 +49721,12 @@ Object.freeze({
47390
49721
  addonId: null,
47391
49722
  access: "view"
47392
49723
  },
49724
+ "pipelineOrchestrator.getEffectiveShares": {
49725
+ capName: "pipeline-orchestrator",
49726
+ capScope: "system",
49727
+ addonId: null,
49728
+ access: "view"
49729
+ },
47393
49730
  "pipelineOrchestrator.getGlobalMetrics": {
47394
49731
  capName: "pipeline-orchestrator",
47395
49732
  capScope: "system",
@@ -47402,6 +49739,24 @@ Object.freeze({
47402
49739
  addonId: null,
47403
49740
  access: "view"
47404
49741
  },
49742
+ "pipelineOrchestrator.getNodeBenchmarkCandidates": {
49743
+ capName: "pipeline-orchestrator",
49744
+ capScope: "system",
49745
+ addonId: null,
49746
+ access: "view"
49747
+ },
49748
+ "pipelineOrchestrator.getNodeBenchmarkPreflight": {
49749
+ capName: "pipeline-orchestrator",
49750
+ capScope: "system",
49751
+ addonId: null,
49752
+ access: "view"
49753
+ },
49754
+ "pipelineOrchestrator.getNodeBenchmarkStatus": {
49755
+ capName: "pipeline-orchestrator",
49756
+ capScope: "system",
49757
+ addonId: null,
49758
+ access: "view"
49759
+ },
47405
49760
  "pipelineOrchestrator.getNodeInferenceDevices": {
47406
49761
  capName: "pipeline-orchestrator",
47407
49762
  capScope: "system",
@@ -47426,6 +49781,12 @@ Object.freeze({
47426
49781
  addonId: null,
47427
49782
  access: "view"
47428
49783
  },
49784
+ "pipelineOrchestrator.getPlacementStats": {
49785
+ capName: "pipeline-orchestrator",
49786
+ capScope: "system",
49787
+ addonId: null,
49788
+ access: "view"
49789
+ },
47429
49790
  "pipelineOrchestrator.getReconcileFromDiskStatus": {
47430
49791
  capName: "pipeline-orchestrator",
47431
49792
  capScope: "system",
@@ -47438,7 +49799,7 @@ Object.freeze({
47438
49799
  addonId: null,
47439
49800
  access: "view"
47440
49801
  },
47441
- "pipelineOrchestrator.listTemplates": {
49802
+ "pipelineOrchestrator.listNodeBenchmarkResults": {
47442
49803
  capName: "pipeline-orchestrator",
47443
49804
  capScope: "system",
47444
49805
  addonId: null,
@@ -47450,6 +49811,12 @@ Object.freeze({
47450
49811
  addonId: null,
47451
49812
  access: "create"
47452
49813
  },
49814
+ "pipelineOrchestrator.planAutoTune": {
49815
+ capName: "pipeline-orchestrator",
49816
+ capScope: "system",
49817
+ addonId: null,
49818
+ access: "view"
49819
+ },
47453
49820
  "pipelineOrchestrator.rebalance": {
47454
49821
  capName: "pipeline-orchestrator",
47455
49822
  capScope: "system",
@@ -47492,12 +49859,6 @@ Object.freeze({
47492
49859
  addonId: null,
47493
49860
  access: "create"
47494
49861
  },
47495
- "pipelineOrchestrator.saveTemplate": {
47496
- capName: "pipeline-orchestrator",
47497
- capScope: "system",
47498
- addonId: null,
47499
- access: "create"
47500
- },
47501
49862
  "pipelineOrchestrator.setAgentCapabilities": {
47502
49863
  capName: "pipeline-orchestrator",
47503
49864
  capScope: "system",
@@ -47510,12 +49871,6 @@ Object.freeze({
47510
49871
  addonId: null,
47511
49872
  access: "create"
47512
49873
  },
47513
- "pipelineOrchestrator.setAgentDetectWeight": {
47514
- capName: "pipeline-orchestrator",
47515
- capScope: "system",
47516
- addonId: null,
47517
- access: "create"
47518
- },
47519
49874
  "pipelineOrchestrator.setAgentInferenceDevices": {
47520
49875
  capName: "pipeline-orchestrator",
47521
49876
  capScope: "system",
@@ -47552,6 +49907,12 @@ Object.freeze({
47552
49907
  addonId: null,
47553
49908
  access: "create"
47554
49909
  },
49910
+ "pipelineOrchestrator.setCameraStepSettings": {
49911
+ capName: "pipeline-orchestrator",
49912
+ capScope: "system",
49913
+ addonId: null,
49914
+ access: "create"
49915
+ },
47555
49916
  "pipelineOrchestrator.setCameraStepToggle": {
47556
49917
  capName: "pipeline-orchestrator",
47557
49918
  capScope: "system",
@@ -47570,12 +49931,36 @@ Object.freeze({
47570
49931
  addonId: null,
47571
49932
  access: "create"
47572
49933
  },
49934
+ "pipelineOrchestrator.setLoadBalancingShares": {
49935
+ capName: "pipeline-orchestrator",
49936
+ capScope: "system",
49937
+ addonId: null,
49938
+ access: "create"
49939
+ },
47573
49940
  "pipelineOrchestrator.setPipelineDevicePin": {
47574
49941
  capName: "pipeline-orchestrator",
47575
49942
  capScope: "system",
47576
49943
  addonId: null,
47577
49944
  access: "create"
47578
49945
  },
49946
+ "pipelineOrchestrator.setShareSource": {
49947
+ capName: "pipeline-orchestrator",
49948
+ capScope: "system",
49949
+ addonId: null,
49950
+ access: "create"
49951
+ },
49952
+ "pipelineOrchestrator.startNodeBenchmark": {
49953
+ capName: "pipeline-orchestrator",
49954
+ capScope: "system",
49955
+ addonId: null,
49956
+ access: "create"
49957
+ },
49958
+ "pipelineOrchestrator.suggestShares": {
49959
+ capName: "pipeline-orchestrator",
49960
+ capScope: "system",
49961
+ addonId: null,
49962
+ access: "view"
49963
+ },
47579
49964
  "pipelineOrchestrator.unassignAudio": {
47580
49965
  capName: "pipeline-orchestrator",
47581
49966
  capScope: "system",
@@ -47588,8 +49973,8 @@ Object.freeze({
47588
49973
  addonId: null,
47589
49974
  access: "create"
47590
49975
  },
47591
- "pipelineOrchestrator.updateTemplate": {
47592
- capName: "pipeline-orchestrator",
49976
+ "pipelineRunner.abortNodeBench": {
49977
+ capName: "pipeline-runner",
47593
49978
  capScope: "system",
47594
49979
  addonId: null,
47595
49980
  access: "create"
@@ -47642,6 +50027,12 @@ Object.freeze({
47642
50027
  addonId: null,
47643
50028
  access: "view"
47644
50029
  },
50030
+ "pipelineRunner.getNodeBenchStatus": {
50031
+ capName: "pipeline-runner",
50032
+ capScope: "system",
50033
+ addonId: null,
50034
+ access: "view"
50035
+ },
47645
50036
  "pipelineRunner.getParkedTrackFrame": {
47646
50037
  capName: "pipeline-runner",
47647
50038
  capScope: "system",
@@ -47684,6 +50075,12 @@ Object.freeze({
47684
50075
  addonId: null,
47685
50076
  access: "create"
47686
50077
  },
50078
+ "pipelineRunner.startNodeBench": {
50079
+ capName: "pipeline-runner",
50080
+ capScope: "system",
50081
+ addonId: null,
50082
+ access: "create"
50083
+ },
47687
50084
  "plateGallery.assignPlate": {
47688
50085
  capName: "plate-gallery",
47689
50086
  capScope: "system",
@@ -49028,12 +51425,6 @@ Object.freeze({
49028
51425
  addonId: null,
49029
51426
  access: "view"
49030
51427
  },
49031
- "streamBroker.pullFrameHandles": {
49032
- capName: "stream-broker",
49033
- capScope: "system",
49034
- addonId: null,
49035
- access: "view"
49036
- },
49037
51428
  "streamBroker.regenerateRtspToken": {
49038
51429
  capName: "stream-broker",
49039
51430
  capScope: "system",
@@ -49100,12 +51491,6 @@ Object.freeze({
49100
51491
  addonId: null,
49101
51492
  access: "create"
49102
51493
  },
49103
- "streamBroker.subscribeFrames": {
49104
- capName: "stream-broker",
49105
- capScope: "system",
49106
- addonId: null,
49107
- access: "create"
49108
- },
49109
51494
  "streamBroker.unassignProfile": {
49110
51495
  capName: "stream-broker",
49111
51496
  capScope: "system",
@@ -49118,12 +51503,6 @@ Object.freeze({
49118
51503
  addonId: null,
49119
51504
  access: "create"
49120
51505
  },
49121
- "streamBroker.unsubscribeFrames": {
49122
- capName: "stream-broker",
49123
- capScope: "system",
49124
- addonId: null,
49125
- access: "create"
49126
- },
49127
51506
  "streamCatalog.getCatalog": {
49128
51507
  capName: "stream-catalog",
49129
51508
  capScope: "device",
@@ -49418,18 +51797,36 @@ Object.freeze({
49418
51797
  addonId: null,
49419
51798
  access: "delete"
49420
51799
  },
51800
+ "userManagement.findUserByExternalIdentity": {
51801
+ capName: "user-management",
51802
+ capScope: "system",
51803
+ addonId: null,
51804
+ access: "view"
51805
+ },
49421
51806
  "userManagement.getTotpStatus": {
49422
51807
  capName: "user-management",
49423
51808
  capScope: "system",
49424
51809
  addonId: null,
49425
51810
  access: "view"
49426
51811
  },
51812
+ "userManagement.linkExternalIdentity": {
51813
+ capName: "user-management",
51814
+ capScope: "system",
51815
+ addonId: null,
51816
+ access: "create"
51817
+ },
49427
51818
  "userManagement.listApiKeys": {
49428
51819
  capName: "user-management",
49429
51820
  capScope: "system",
49430
51821
  addonId: null,
49431
51822
  access: "view"
49432
51823
  },
51824
+ "userManagement.listExternalIdentities": {
51825
+ capName: "user-management",
51826
+ capScope: "system",
51827
+ addonId: null,
51828
+ access: "view"
51829
+ },
49433
51830
  "userManagement.listOauthSessions": {
49434
51831
  capName: "user-management",
49435
51832
  capScope: "system",
@@ -49508,6 +51905,12 @@ Object.freeze({
49508
51905
  addonId: null,
49509
51906
  access: "create"
49510
51907
  },
51908
+ "userManagement.unlinkExternalIdentity": {
51909
+ capName: "user-management",
51910
+ capScope: "system",
51911
+ addonId: null,
51912
+ access: "delete"
51913
+ },
49511
51914
  "userManagement.updateUser": {
49512
51915
  capName: "user-management",
49513
51916
  capScope: "system",
@@ -49820,6 +52223,12 @@ Object.freeze({
49820
52223
  addonId: null,
49821
52224
  access: "create"
49822
52225
  },
52226
+ "webrtcSession.applyDownlinkProbe": {
52227
+ capName: "webrtc-session",
52228
+ capScope: "device",
52229
+ addonId: null,
52230
+ access: "create"
52231
+ },
49823
52232
  "webrtcSession.closeSession": {
49824
52233
  capName: "webrtc-session",
49825
52234
  capScope: "device",
@@ -51783,11 +54192,6 @@ Object.freeze({
51783
54192
  form: "single",
51784
54193
  optional: false
51785
54194
  }],
51786
- "decoder.createSession": [{
51787
- name: "deviceId",
51788
- form: "single",
51789
- optional: true
51790
- }],
51791
54195
  "detectionPipeline.applyDeviceSettingsPatch": [{
51792
54196
  name: "deviceId",
51793
54197
  form: "single",
@@ -52758,6 +55162,11 @@ Object.freeze({
52758
55162
  form: "single",
52759
55163
  optional: false
52760
55164
  }],
55165
+ "pipelineAnalytics.addRetrainFrameFromRecording": [{
55166
+ name: "deviceId",
55167
+ form: "single",
55168
+ optional: false
55169
+ }],
52761
55170
  "pipelineAnalytics.applyDeviceSettingsPatch": [{
52762
55171
  name: "deviceId",
52763
55172
  form: "single",
@@ -52948,6 +55357,11 @@ Object.freeze({
52948
55357
  form: "single",
52949
55358
  optional: false
52950
55359
  }],
55360
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
55361
+ name: "deviceId",
55362
+ form: "single",
55363
+ optional: false
55364
+ }],
52951
55365
  "pipelineAnalytics.pruneEventsBefore": [{
52952
55366
  name: "deviceId",
52953
55367
  form: "single",
@@ -52998,6 +55412,11 @@ Object.freeze({
52998
55412
  form: "single",
52999
55413
  optional: false
53000
55414
  }],
55415
+ "pipelineAnalytics.setRetrainFrameComplete": [{
55416
+ name: "deviceId",
55417
+ form: "single",
55418
+ optional: false
55419
+ }],
53001
55420
  "pipelineAnalytics.setTrackFlags": [{
53002
55421
  name: "deviceId",
53003
55422
  form: "single",
@@ -53018,6 +55437,11 @@ Object.freeze({
53018
55437
  form: "single",
53019
55438
  optional: false
53020
55439
  }],
55440
+ "pipelineExecutor.clearModelBoundDeviceOverrides": [{
55441
+ name: "deviceIds",
55442
+ form: "array",
55443
+ optional: true
55444
+ }],
53021
55445
  "pipelineExecutor.runPipeline": [{
53022
55446
  name: "deviceId",
53023
55447
  form: "single",
@@ -53123,6 +55547,11 @@ Object.freeze({
53123
55547
  form: "single",
53124
55548
  optional: false
53125
55549
  }],
55550
+ "pipelineOrchestrator.setCameraStepSettings": [{
55551
+ name: "deviceId",
55552
+ form: "single",
55553
+ optional: false
55554
+ }],
53126
55555
  "pipelineOrchestrator.setCameraStepToggle": [{
53127
55556
  name: "deviceId",
53128
55557
  form: "single",
@@ -53894,6 +56323,11 @@ Object.freeze({
53894
56323
  form: "single",
53895
56324
  optional: false
53896
56325
  }],
56326
+ "webrtcSession.applyDownlinkProbe": [{
56327
+ name: "deviceId",
56328
+ form: "single",
56329
+ optional: false
56330
+ }],
53897
56331
  "webrtcSession.closeSession": [{
53898
56332
  name: "deviceId",
53899
56333
  form: "single",
@@ -54427,7 +56861,7 @@ var STATE_SUMMARY_VARS = [
54427
56861
  {
54428
56862
  name: "summarySection",
54429
56863
  label: "Summary: this section",
54430
- description: "The section a per-section summary row is about (D698); on a summary sent as one message, every section it reports, comma-separated.",
56864
+ description: "The section a per-section summary row is about; on a summary sent as one message, every section it reports, comma-separated.",
54431
56865
  example: "Batterie scariche",
54432
56866
  group: "system",
54433
56867
  families: ["rule"],
@@ -156085,7 +158519,7 @@ function buildInitialStatus2(config, enabled) {
156085
158519
  * Node-only (`node:child_process`), so it lives under `@camstack/types/node`.
156086
158520
  */
156087
158521
  /** The detail a site refusing for want of a binary puts in its refusal. */
156088
- var NO_PINNED_FFMPEG_DETAIL = "no pinned ffmpeg on this node (D540)";
158522
+ var NO_PINNED_FFMPEG_DETAIL = "no pinned ffmpeg on this node";
156089
158523
  /**
156090
158524
  * {@link pinnedFfmpegSpawner}, asked at the point of use through the node's
156091
158525
  * resolver (`memoizePinnedFfmpeg`). A site that keeps the RESOLVER rather than
@@ -156225,7 +158659,7 @@ var reolinkCameraSchema = object({
156225
158659
  host: string().describe("Camera IP or hostname"),
156226
158660
  port: number().default(9e3).describe("Baichuan port (default 9000)"),
156227
158661
  username: string().default("admin").describe("Username"),
156228
- password: string().describe("Password"),
158662
+ password: string().describe("Password").meta({ secret: true }),
156229
158663
  /**
156230
158664
  * Transport mode resolved at creation time by autodetect (Slice 15).
156231
158665
  * - `tcp` : standard TCP-based Baichuan (regular cameras, NVR/Hub)
@@ -156906,7 +159340,7 @@ var reolinkHubSchema = object({
156906
159340
  host: string().describe("Hub IP or hostname"),
156907
159341
  port: number().default(9e3).describe("Baichuan port (default 9000)"),
156908
159342
  username: string().default("admin"),
156909
- password: string(),
159343
+ password: string().meta({ secret: true }),
156910
159344
  /** Hubs are TCP-only on supported firmwares — kept here for symmetry. */
156911
159345
  transport: _enum(["tcp", "udp"]).default("tcp"),
156912
159346
  /** UID is unused on Hubs (no UDP discovery), but persisted for symmetry. */
@@ -164688,6 +167122,31 @@ function createAccessoryDevice(kind, ctx, parent) {
164688
167122
  }
164689
167123
  //#endregion
164690
167124
  //#region src/accessory-probe-flags.ts
167125
+ /**
167126
+ * Pure helpers that decide which probe flags drive accessory-child
167127
+ * derivation, and whether a Reolink camera has *ever* been probed.
167128
+ *
167129
+ * Why this exists as its own module: the `feature-probe` runtime-state
167130
+ * slice is the live, in-session source of the camera's ability flags
167131
+ * (`hasSiren` / `hasFloodlight` / `hasPirSensor` / …). It is rehydrated
167132
+ * on restart, BUT a camera whose Baichuan `getDeviceCapabilities`
167133
+ * round-trip is slow or flaky (observed: a doorbell that times out the
167134
+ * kernel's 30s `onProbe` window on every boot) restores with an empty
167135
+ * slice (`lastProbedAt === 0`). The `deviceCache` config blob — written
167136
+ * alongside the slice on the LAST successful probe and preserved across
167137
+ * restarts by the camera schema's `.loose()` passthrough — still carries
167138
+ * that probe's flags plus a `probedAt` stamp.
167139
+ *
167140
+ * Deriving accessory specs from the `deviceCache` fallback lets the
167141
+ * kernel re-spawn the persisted accessory children (and therefore
167142
+ * re-mount their kernel-managed `device-ops` provider) even when this
167143
+ * session's live probe never completes. Without it, every accessory of
167144
+ * a slow-probing camera is left as a DB row with no live provider
167145
+ * ("device-ops not registered for device N").
167146
+ *
167147
+ * Kept pure (no `this`, no I/O) so the slice-vs-cache precedence is
167148
+ * unit-testable without standing up a full camera device.
167149
+ */
164691
167150
  var FLAG_KEYS = [
164692
167151
  "hasBattery",
164693
167152
  "hasPtz",
@@ -164725,6 +167184,43 @@ function resolveAccessoryProbeFlags(sliceProbed, sliceFlags, deviceCache) {
164725
167184
  }
164726
167185
  return out;
164727
167186
  }
167187
+ /**
167188
+ * The `deviceCache` blob a successful feature probe leaves behind: the
167189
+ * previous blob, plus the `probedAt` stamp and every boolean ability flag
167190
+ * the probe resolved. This is what lets {@link resolveAccessoryProbeFlags}
167191
+ * fall back on the next boot — a battery camera asleep at boot skips its
167192
+ * probe, and the `feature-probe` slice alone does not carry the flags
167193
+ * across a provider restart. Returns a new object; `previous` is untouched.
167194
+ */
167195
+ function withPersistedProbe(previous, flags, probedAt) {
167196
+ const persisted = {};
167197
+ for (const key of FLAG_KEYS) {
167198
+ const value = flags[key];
167199
+ if (typeof value === "boolean") persisted[key] = value;
167200
+ }
167201
+ return {
167202
+ ...previous,
167203
+ ...persisted,
167204
+ probedAt
167205
+ };
167206
+ }
167207
+ /** The accessory children a probe flag set spawns, in spawn order. */
167208
+ var ACCESSORY_FLAGS = [
167209
+ ["hasSiren", AccessoryKind.Siren],
167210
+ ["hasFloodlight", AccessoryKind.Floodlight],
167211
+ ["hasPirSensor", AccessoryKind.PirSensor]
167212
+ ];
167213
+ /**
167214
+ * Accessory kinds a camera should spawn: none until it has EVER probed
167215
+ * (live slice this session, or a persisted `probedAt`), then one per
167216
+ * ability flag that is exactly `true` — live slice first, persisted
167217
+ * `deviceCache` flags as the fallback.
167218
+ */
167219
+ function accessoryKindsFor(sliceProbed, sliceFlags, deviceCache) {
167220
+ if (!hasEverProbed(sliceProbed, deviceCache)) return [];
167221
+ const flags = resolveAccessoryProbeFlags(sliceProbed, sliceFlags, deviceCache);
167222
+ return ACCESSORY_FLAGS.filter(([flag]) => flags[flag] === true).map(([, kind]) => kind);
167223
+ }
164728
167224
  //#endregion
164729
167225
  //#region src/metadata-populator.ts
164730
167226
  var EXTENDED_INFO_TAGS = [
@@ -167540,9 +170036,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
167540
170036
  * parent register.
167541
170037
  */
167542
170038
  getAccessoryChildren() {
167543
- const deviceCache = this.config.get("deviceCache");
167544
- if (!hasEverProbed(this.hasProbed(), deviceCache)) return [];
167545
- const probe = resolveAccessoryProbeFlags(this.hasProbed(), this.getProbeFlags(), deviceCache);
170039
+ const kinds = accessoryKindsFor(this.hasProbed(), this.getProbeFlags(), this.config.get("deviceCache"));
167546
170040
  const out = [];
167547
170041
  const push = (kind, type, label) => {
167548
170042
  out.push({
@@ -167558,9 +170052,9 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
167558
170052
  factory: (ctx) => createAccessoryDevice(kind, ctx, this)
167559
170053
  });
167560
170054
  };
167561
- if (probe.hasSiren === true) push(AccessoryKind.Siren, DeviceType.Siren, ACCESSORY_LABEL[AccessoryKind.Siren]);
167562
- if (probe.hasFloodlight === true) push(AccessoryKind.Floodlight, DeviceType.Light, ACCESSORY_LABEL[AccessoryKind.Floodlight]);
167563
- if (probe.hasPirSensor === true) push(AccessoryKind.PirSensor, DeviceType.Switch, ACCESSORY_LABEL[AccessoryKind.PirSensor]);
170055
+ if (kinds.includes(AccessoryKind.Siren)) push(AccessoryKind.Siren, DeviceType.Siren, ACCESSORY_LABEL[AccessoryKind.Siren]);
170056
+ if (kinds.includes(AccessoryKind.Floodlight)) push(AccessoryKind.Floodlight, DeviceType.Light, ACCESSORY_LABEL[AccessoryKind.Floodlight]);
170057
+ if (kinds.includes(AccessoryKind.PirSensor)) push(AccessoryKind.PirSensor, DeviceType.Switch, ACCESSORY_LABEL[AccessoryKind.PirSensor]);
167564
170058
  return out;
167565
170059
  }
167566
170060
  /**
@@ -172011,6 +174505,14 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
172011
174505
  meta: { error: err instanceof Error ? err.message : String(err) }
172012
174506
  });
172013
174507
  }
174508
+ if (!this.hasProbed()) try {
174509
+ await this.reprobe();
174510
+ } catch (err) {
174511
+ this.ctx.logger.debug("onWakeTransition: feature probe failed — next wake retries", {
174512
+ tags: { deviceId: this.id },
174513
+ meta: { error: err instanceof Error ? err.message : String(err) }
174514
+ });
174515
+ }
172014
174516
  await this.warmCapSlicesOnWake();
172015
174517
  await this.warmSnapshotOnWake();
172016
174518
  await this.alignAuxDevicesState("wake");
@@ -174079,6 +176581,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
174079
176581
  let hasBattery;
174080
176582
  let hasPirSensor;
174081
176583
  let hasAutotrack;
176584
+ let capabilitiesRead = false;
174082
176585
  try {
174083
176586
  channelCount = await api.getChannelCount();
174084
176587
  } catch {}
@@ -174092,6 +176595,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
174092
176595
  hasBattery = capabilities.hasBattery;
174093
176596
  hasPirSensor = capabilities.hasPir;
174094
176597
  hasAutotrack = capabilities.hasAutotracking;
176598
+ capabilitiesRead = true;
174095
176599
  } catch (err) {
174096
176600
  this.ctx.logger.debug("getDeviceCapabilities failed — leaving flags unset", {
174097
176601
  tags: { deviceId: this.id },
@@ -174128,12 +176632,12 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
174128
176632
  };
174129
176633
  this.runtimeState.setCapState("feature-probe", next);
174130
176634
  try {
174131
- const previous = this.config.get("deviceCache") ?? {};
174132
- await this.config.setAll({ deviceCache: {
174133
- ...previous,
176635
+ const identity = {
176636
+ ...this.config.get("deviceCache") ?? {},
174134
176637
  ...inferredDeviceType ? { deviceType: inferredDeviceType } : {},
174135
176638
  ...channelCount !== void 0 ? { channelCount } : {}
174136
- } });
176639
+ };
176640
+ await this.config.setAll({ deviceCache: capabilitiesRead ? withPersistedProbe(identity, flags, now) : identity });
174137
176641
  } catch (err) {
174138
176642
  this.ctx.logger.debug("deviceCache identity persist failed (non-fatal)", {
174139
176643
  tags: { deviceId: this.id },
@@ -176584,6 +179088,8 @@ async function enrichHostIdentifiersFromLiveApi(detection, logger) {
176584
179088
  }
176585
179089
  }
176586
179090
  var ReolinkProviderAddon = class extends BaseDeviceProvider {
179091
+ /** The email-push SMTP password is hidden state — kept in the keychain (D787). */
179092
+ secretStatePaths = ["emailPushAuthPassword"];
176587
179093
  addonId = REOLINK_ADDON_ID;
176588
179094
  providerName = "Reolink";
176589
179095
  deviceClasses = {