@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.js CHANGED
@@ -35,7 +35,7 @@ let node_os = require("node:os");
35
35
  node_os = require_chunk.__toESM(node_os);
36
36
  let node_fs = require("node:fs");
37
37
  node_fs = require_chunk.__toESM(node_fs, 1);
38
- //#region ../types/dist/event-category-BGmz_oxW.mjs
38
+ //#region ../types/dist/event-category-DaIZi00R.mjs
39
39
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
40
40
  EventCategory["SystemBoot"] = "system.boot";
41
41
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -114,6 +114,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
114
114
  */
115
115
  EventCategory["AddonLoadFailed"] = "addon.load-failed";
116
116
  /**
117
+ * A keychain value was stored or removed (D787). Carries the ref, its
118
+ * owner and the new version — NEVER the value. A process holding the ref
119
+ * drops its cached copy and the owning `BaseAddon` re-resolves its config.
120
+ * Telemetry (D8): a process that misses it still revalidates by version.
121
+ */
122
+ EventCategory["KeychainChanged"] = "keychain.changed";
123
+ /**
117
124
  * Addon recovered from a previous failure. Emitted when an addon
118
125
  * transitions from `failed` back to `healthy` (typically via the
119
126
  * monitor's auto-retry loop, or after manual `addons.retryLoad`).
@@ -536,15 +543,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
536
543
  EventCategory["AgentWsDisconnected"] = "agent.ws.disconnected";
537
544
  EventCategory["AgentBackupActivated"] = "agent.backup.activated";
538
545
  EventCategory["OrchestrationSettingsUpdated"] = "orchestration.settings-updated";
539
- /**
540
- * Per-agent hwaccel preference changed (user override set, cleared, or
541
- * re-probed). Observability event — decoders pull the current pref at
542
- * `createSession`, so running sessions keep their current backend until
543
- * they rotate naturally (camera add/remove, stream restart). Future
544
- * work can wire a listener in stream-broker that force-rotates live
545
- * sessions; for now this event powers logs + admin-UI toast feedback.
546
- */
547
- EventCategory["PipelineAgentHwaccelChanged"] = "pipeline.agent-hwaccel-changed";
548
546
  EventCategory["MotionAnalysis"] = "detection.motion-analysis";
549
547
  /** All raw motion zones from CCL before minArea filter — for UI debug overlay. */
550
548
  EventCategory["MotionZonesRaw"] = "detection.motion-zones-raw";
@@ -5415,7 +5413,7 @@ var ZodIssueCode = {
5415
5413
  var ZodFirstPartyTypeKind;
5416
5414
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5417
5415
  //#endregion
5418
- //#region ../types/dist/sleep-DXKLNFvA.mjs
5416
+ //#region ../types/dist/sleep-Cr5YOk3m.mjs
5419
5417
  /**
5420
5418
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5421
5419
  * window to float samples (D455).
@@ -5494,6 +5492,97 @@ function buildAlawTable() {
5494
5492
  }
5495
5493
  buildUlawTable();
5496
5494
  buildAlawTable();
5495
+ /** Is this field's stored value a credential? */
5496
+ function isSecretConfigField(field) {
5497
+ if (field.type === "password") return true;
5498
+ return "secret" in field && field.secret === true;
5499
+ }
5500
+ /**
5501
+ * Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
5502
+ * by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
5503
+ */
5504
+ function isKeychainStoredField(field) {
5505
+ if (!isSecretConfigField(field)) return false;
5506
+ if (field.type === "textarea" && field.isJson === true) return false;
5507
+ return !("storage" in field && field.storage === "inline");
5508
+ }
5509
+ /**
5510
+ * What a settings blob holds where a secret used to be.
5511
+ *
5512
+ * A keychain-stored field never holds its value. It holds a self-describing
5513
+ * MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
5514
+ * code can mistake it for a credential and no form can send it to a camera as
5515
+ * a password. The empty state is `null` / absent, never `''`.
5516
+ *
5517
+ * The same shapes travel to and from the admin UI:
5518
+ *
5519
+ * - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
5520
+ * (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
5521
+ * value is set, never the value.
5522
+ * - write: an untouched field submits the view back unchanged (KEEP); a typed
5523
+ * value is a plain non-empty string (CHANGE); the Clear button submits
5524
+ * {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
5525
+ * are KEEP — an empty string is what a defaults-fallback pushes back, and
5526
+ * treating it as "clear" is how a save destroyed a stored credential before.
5527
+ *
5528
+ * Pure and browser-safe.
5529
+ */
5530
+ var SECRET_CLEAR = { $secretClear: true };
5531
+ /** The `'***'` token D634 redaction writes for non-admins. */
5532
+ var LEGACY_DEVICE_REDACTION = "***";
5533
+ function isRecord$1(value) {
5534
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5535
+ }
5536
+ function makeSecretMarker(ref) {
5537
+ return {
5538
+ $secret: ref,
5539
+ v: 1
5540
+ };
5541
+ }
5542
+ /** A stored marker: an object whose `$secret` is a non-empty string. */
5543
+ function isSecretMarker(value) {
5544
+ if (!isRecord$1(value)) return false;
5545
+ const ref = value["$secret"];
5546
+ return typeof ref === "string" && ref.length > 0;
5547
+ }
5548
+ function isSecretClear(value) {
5549
+ return isRecord$1(value) && value["$secretClear"] === true;
5550
+ }
5551
+ /**
5552
+ * The UI view of a stored secret field value: a marker becomes "set", inline
5553
+ * plaintext becomes "set (inline)", nothing becomes `null`. A value never
5554
+ * survives this function.
5555
+ */
5556
+ function toSecretFieldView(stored) {
5557
+ if (isSecretMarker(stored)) return {
5558
+ $secret: stored.$secret,
5559
+ v: 1,
5560
+ set: true
5561
+ };
5562
+ if (typeof stored === "string" && stored.length > 0) return {
5563
+ $secret: null,
5564
+ v: 1,
5565
+ set: true,
5566
+ inline: true
5567
+ };
5568
+ return null;
5569
+ }
5570
+ /**
5571
+ * Classify an incoming value for a secret path. Only a non-empty string that is
5572
+ * not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
5573
+ * Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
5574
+ * `undefined`, a redaction token, a non-string — keeps what is stored.
5575
+ */
5576
+ function classifySecretWrite(incoming) {
5577
+ if (isSecretClear(incoming)) return { kind: "clear" };
5578
+ if (typeof incoming !== "string") return { kind: "keep" };
5579
+ if (incoming.length === 0) return { kind: "keep" };
5580
+ if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
5581
+ return {
5582
+ kind: "set",
5583
+ value: incoming
5584
+ };
5585
+ }
5497
5586
  Object.fromEntries([
5498
5587
  {
5499
5588
  id: "overview",
@@ -5665,33 +5754,19 @@ Object.fromEntries([
5665
5754
  function isValuelessField(field) {
5666
5755
  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";
5667
5756
  }
5668
- /**
5669
- * Merge a `ConfigUISchema` with a raw `values` record into a
5670
- * `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
5671
- * before returning to the admin UI. Groups are walked recursively.
5672
- *
5673
- * For each leaf field:
5674
- * - structural fields (`separator`, `info`, `button`) pass through unchanged
5675
- * - other fields get `value = values[key] ?? field.default ?? null`
5676
- *
5677
- * Unknown keys in `values` (keys not declared in the schema) are silently
5678
- * ignored — they don't contribute to the output. Missing keys fall back to
5679
- * the schema default or `null`. This mirrors the old backend behaviour where
5680
- * `FormBuilder` rendered `values[key] ?? field.default`.
5681
- */
5682
- function hydrateSchema(schema, values) {
5757
+ function hydrateSchema(schema, values, options = {}) {
5683
5758
  return {
5684
5759
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
5685
5760
  sections: schema.sections.map((section) => ({
5686
5761
  ...section,
5687
- fields: section.fields.map((field) => hydrateField(field, values))
5762
+ fields: section.fields.map((field) => hydrateField(field, values, options))
5688
5763
  }))
5689
5764
  };
5690
5765
  }
5691
- function hydrateField(field, values) {
5766
+ function hydrateField(field, values, options) {
5692
5767
  if (isValuelessField(field)) return field;
5693
5768
  if (field.type === "group") {
5694
- const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
5769
+ const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
5695
5770
  return {
5696
5771
  ...field,
5697
5772
  fields: hydratedChildren
@@ -5700,7 +5775,7 @@ function hydrateField(field, values) {
5700
5775
  if (field.type === "sub-tabs") {
5701
5776
  const hydratedTabs = field.tabs.map((tab) => ({
5702
5777
  ...tab,
5703
- fields: tab.fields.map((child) => hydrateField(child, values))
5778
+ fields: tab.fields.map((child) => hydrateField(child, values, options))
5704
5779
  }));
5705
5780
  return {
5706
5781
  ...field,
@@ -5710,6 +5785,33 @@ function hydrateField(field, values) {
5710
5785
  const key = field.key;
5711
5786
  const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
5712
5787
  const defaultValue = field.default;
5788
+ const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
5789
+ if (isKeychainStoredField(field) && asView(storedValue)) return {
5790
+ ...field,
5791
+ value: toSecretFieldView(storedValue)
5792
+ };
5793
+ if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
5794
+ ...field,
5795
+ value: null
5796
+ };
5797
+ if (field.type === "editable-array" && Array.isArray(storedValue)) {
5798
+ const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
5799
+ if (secretItemKeys.length > 0) {
5800
+ const rows = storedValue.map((row) => {
5801
+ if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
5802
+ const out = { ...row };
5803
+ for (const k of secretItemKeys) {
5804
+ const v = Reflect.get(row, k);
5805
+ if (asView(v)) out[k] = toSecretFieldView(v);
5806
+ }
5807
+ return out;
5808
+ });
5809
+ return {
5810
+ ...field,
5811
+ value: rows
5812
+ };
5813
+ }
5814
+ }
5713
5815
  if (field.multiple) {
5714
5816
  const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
5715
5817
  const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
@@ -5952,6 +6054,431 @@ function projectStore(store, perNodeKeys, nodeId) {
5952
6054
  }
5953
6055
  return out;
5954
6056
  }
6057
+ var GLOBAL_SCOPE = { kind: "global" };
6058
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6059
+ function globalSecretScope() {
6060
+ return GLOBAL_SCOPE;
6061
+ }
6062
+ function encodeSegment(value) {
6063
+ return encodeURIComponent(value);
6064
+ }
6065
+ /**
6066
+ * The field path of a value inside an array item, addressed by the item's id:
6067
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6068
+ * `providers[authentik].clientSecret`.
6069
+ */
6070
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6071
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6072
+ }
6073
+ /** A write to a secret path could not be stored in the keychain, so it was refused. */
6074
+ var KeychainWriteRefusedError = class extends Error {
6075
+ fieldPath;
6076
+ constructor(fieldPath, cause) {
6077
+ super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
6078
+ this.fieldPath = fieldPath;
6079
+ this.name = "KeychainWriteRefusedError";
6080
+ }
6081
+ };
6082
+ var KEEP = { kind: "keep" };
6083
+ function isRecord$2(value) {
6084
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6085
+ }
6086
+ function defaultMintId() {
6087
+ return globalThis.crypto.randomUUID();
6088
+ }
6089
+ /** Every marker ref anywhere under `value`. */
6090
+ function collectSecretMarkerRefs(value, out = []) {
6091
+ if (isSecretMarker(value)) {
6092
+ out.push(value.$secret);
6093
+ return out;
6094
+ }
6095
+ if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6096
+ else if (isRecord$2(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6097
+ return out;
6098
+ }
6099
+ async function storedValueEquals(secrets, marker, candidate) {
6100
+ const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
6101
+ return resolved?.kind === "value" && resolved.value === candidate;
6102
+ }
6103
+ async function writeLeaf(ctx, incoming, stored, fieldPath) {
6104
+ const intent = classifySecretWrite(incoming);
6105
+ const ref = ctx.secrets.ref(ctx.scope, fieldPath);
6106
+ const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
6107
+ if (intent.kind === "keep") return KEEP;
6108
+ if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
6109
+ if (intent.kind === "clear") {
6110
+ if (storedIsOurs) ctx.deletes.push(ref);
6111
+ return {
6112
+ kind: "value",
6113
+ value: null
6114
+ };
6115
+ }
6116
+ if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
6117
+ kind: "value",
6118
+ value: stored
6119
+ };
6120
+ try {
6121
+ await ctx.secrets.put(ref, intent.value);
6122
+ } catch (err) {
6123
+ throw new KeychainWriteRefusedError(fieldPath, err);
6124
+ }
6125
+ return {
6126
+ kind: "value",
6127
+ value: makeSecretMarker(ref)
6128
+ };
6129
+ }
6130
+ /** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
6131
+ function applyMember(out, key, result, storedParent) {
6132
+ if (result.kind === "value") {
6133
+ out[key] = result.value;
6134
+ return;
6135
+ }
6136
+ if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
6137
+ else delete out[key];
6138
+ }
6139
+ async function writeMembers(ctx, children, incoming, stored, pathOf) {
6140
+ const out = { ...incoming };
6141
+ for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
6142
+ return out;
6143
+ }
6144
+ function rowId(row, idKey) {
6145
+ const raw = row[idKey];
6146
+ if (typeof raw === "string" && raw.length > 0) return raw;
6147
+ if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
6148
+ return null;
6149
+ }
6150
+ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6151
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$2) : [];
6152
+ if (!Array.isArray(incoming)) {
6153
+ ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6154
+ return {
6155
+ kind: "value",
6156
+ value: incoming
6157
+ };
6158
+ }
6159
+ const storedById = /* @__PURE__ */ new Map();
6160
+ for (const row of storedRows) {
6161
+ const id = rowId(row, node.idKey);
6162
+ if (id !== null) storedById.set(id, row);
6163
+ }
6164
+ const kept = /* @__PURE__ */ new Set();
6165
+ const rows = [];
6166
+ for (const row of incoming) {
6167
+ if (!isRecord$2(row)) {
6168
+ rows.push(row);
6169
+ continue;
6170
+ }
6171
+ const id = rowId(row, node.idKey) ?? ctx.mintId();
6172
+ kept.add(id);
6173
+ const withId = {
6174
+ ...row,
6175
+ [node.idKey]: row[node.idKey] ?? id
6176
+ };
6177
+ if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
6178
+ const storedRow = storedById.get(id) ?? {};
6179
+ rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
6180
+ }
6181
+ for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
6182
+ return {
6183
+ kind: "value",
6184
+ value: rows
6185
+ };
6186
+ }
6187
+ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6188
+ switch (node.kind) {
6189
+ case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6190
+ case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6191
+ case "object": {
6192
+ if (!isRecord$2(incoming)) {
6193
+ if (incoming === void 0) return KEEP;
6194
+ ctx.deletes.push(...collectSecretMarkerRefs(stored));
6195
+ return {
6196
+ kind: "value",
6197
+ value: incoming
6198
+ };
6199
+ }
6200
+ const storedObj = isRecord$2(stored) ? stored : {};
6201
+ return {
6202
+ kind: "value",
6203
+ value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
6204
+ };
6205
+ }
6206
+ }
6207
+ }
6208
+ /** Split a perNode-scoped key (`key@nodeId`). */
6209
+ function splitNodeKey(key) {
6210
+ const at = key.indexOf("@");
6211
+ return at <= 0 ? {
6212
+ base: key,
6213
+ nodeId: null
6214
+ } : {
6215
+ base: key.slice(0, at),
6216
+ nodeId: key.slice(at + 1)
6217
+ };
6218
+ }
6219
+ /** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
6220
+ async function transformSecretWrite(input) {
6221
+ const deletes = [];
6222
+ const base = {
6223
+ secrets: input.secrets,
6224
+ mintId: input.mintId ?? defaultMintId,
6225
+ deletes,
6226
+ operatorWrite: input.operatorWrite === true
6227
+ };
6228
+ const out = {};
6229
+ for (const [key, incoming] of Object.entries(input.patch)) {
6230
+ const { base: baseKey, nodeId } = splitNodeKey(key);
6231
+ const node = input.tree.get(baseKey);
6232
+ if (node === void 0) {
6233
+ out[key] = incoming;
6234
+ continue;
6235
+ }
6236
+ const scope = nodeId !== null && nodeId.length > 0 ? {
6237
+ kind: "node",
6238
+ nodeId
6239
+ } : input.scope ?? globalSecretScope();
6240
+ const result = await writeNode({
6241
+ ...base,
6242
+ scope
6243
+ }, node, incoming, input.stored[key], baseKey);
6244
+ if (result.kind === "value") out[key] = result.value;
6245
+ }
6246
+ return {
6247
+ patch: out,
6248
+ afterWrite: async () => {
6249
+ if (deletes.length === 0) return { orphaned: [] };
6250
+ try {
6251
+ await input.secrets.delete([...new Set(deletes)]);
6252
+ return { orphaned: [] };
6253
+ } catch {
6254
+ return { orphaned: [...new Set(deletes)] };
6255
+ }
6256
+ }
6257
+ };
6258
+ }
6259
+ /**
6260
+ * Replace every marker in `value` with its keychain value. Returns the SAME
6261
+ * reference when there is no marker (no allocation, no keychain call).
6262
+ */
6263
+ async function resolveSecretMarkers(value, secrets) {
6264
+ const refs = collectSecretMarkerRefs(value);
6265
+ if (refs.length === 0) return {
6266
+ value,
6267
+ unresolved: []
6268
+ };
6269
+ const answers = await secrets.resolve(refs);
6270
+ const unresolved = [];
6271
+ for (const ref of new Set(refs)) {
6272
+ const answer = answers[ref];
6273
+ if (answer === void 0) unresolved.push({
6274
+ ref,
6275
+ reason: "not-initialized"
6276
+ });
6277
+ else if (answer.kind === "unavailable") unresolved.push({
6278
+ ref,
6279
+ reason: answer.reason
6280
+ });
6281
+ else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
6282
+ ref,
6283
+ reason: answer.kind
6284
+ });
6285
+ }
6286
+ const substitute = (v) => {
6287
+ if (isSecretMarker(v)) {
6288
+ const answer = answers[v.$secret];
6289
+ return answer?.kind === "value" ? {
6290
+ keep: true,
6291
+ value: answer.value
6292
+ } : {
6293
+ keep: false,
6294
+ value: void 0
6295
+ };
6296
+ }
6297
+ if (Array.isArray(v)) {
6298
+ const items = [];
6299
+ for (const item of v) {
6300
+ const s = substitute(item);
6301
+ if (s.keep) items.push(s.value);
6302
+ }
6303
+ return {
6304
+ keep: true,
6305
+ value: items
6306
+ };
6307
+ }
6308
+ if (isRecord$2(v)) {
6309
+ const out = {};
6310
+ for (const [k, child] of Object.entries(v)) {
6311
+ const s = substitute(child);
6312
+ if (s.keep) out[k] = s.value;
6313
+ }
6314
+ return {
6315
+ keep: true,
6316
+ value: out
6317
+ };
6318
+ }
6319
+ return {
6320
+ keep: true,
6321
+ value: v
6322
+ };
6323
+ };
6324
+ return {
6325
+ value: substitute(value).value,
6326
+ unresolved
6327
+ };
6328
+ }
6329
+ function touchesTree(tree, patch) {
6330
+ if (tree.size === 0) return false;
6331
+ for (const key of Object.keys(patch)) {
6332
+ const at = key.indexOf("@");
6333
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6334
+ }
6335
+ return false;
6336
+ }
6337
+ /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6338
+ async function readStoredAddonBlob(raw) {
6339
+ const threeWay = raw.readAddonStoreResult;
6340
+ if (threeWay === void 0) return raw.readAddonStore();
6341
+ const result = await threeWay.call(raw);
6342
+ if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6343
+ return result.kind === "missing" ? {} : result.value;
6344
+ }
6345
+ function createSecretAwareSettings(raw, opts) {
6346
+ const chains = /* @__PURE__ */ new Map();
6347
+ const serialize = (key, fn) => {
6348
+ const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
6349
+ const tail = next.catch(() => void 0);
6350
+ chains.set(key, tail);
6351
+ tail.then(() => {
6352
+ if (chains.get(key) === tail) chains.delete(key);
6353
+ });
6354
+ return next;
6355
+ };
6356
+ const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6357
+ if (!touchesTree(tree, patch)) return rawWrite(patch);
6358
+ return serialize(chainKey, async () => {
6359
+ const stored = await readStored();
6360
+ const result = await transformSecretWrite({
6361
+ tree,
6362
+ secrets: opts.secrets,
6363
+ patch,
6364
+ stored,
6365
+ ...scope !== void 0 ? { scope } : {},
6366
+ operatorWrite: opts.isOperatorWrite?.() === true
6367
+ });
6368
+ if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6369
+ const { orphaned } = await result.afterWrite();
6370
+ if (orphaned.length > 0) opts.onOrphaned(orphaned);
6371
+ });
6372
+ };
6373
+ const wrapped = {
6374
+ writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6375
+ writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6376
+ kind: "device",
6377
+ deviceId
6378
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6379
+ };
6380
+ return new Proxy(raw, { get(target, prop, receiver) {
6381
+ if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6382
+ if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6383
+ const value = Reflect.get(target, prop, receiver);
6384
+ return typeof value === "function" ? value.bind(target) : value;
6385
+ } });
6386
+ }
6387
+ /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6388
+ function withSecretAwareSettings(context, opts) {
6389
+ const raw = context.settings;
6390
+ if (raw === void 0) return context;
6391
+ const settings = createSecretAwareSettings(raw, opts);
6392
+ return new Proxy(context, { get(target, prop, receiver) {
6393
+ if (prop === "settings") return settings;
6394
+ return Reflect.get(target, prop, receiver);
6395
+ } });
6396
+ }
6397
+ var LEAF = { kind: "leaf" };
6398
+ var DEFAULT_ITEM_ID_KEY = "id";
6399
+ function collectFields(fields, out) {
6400
+ for (const field of fields) {
6401
+ if (field.type === "group") {
6402
+ collectFields(field.fields, out);
6403
+ continue;
6404
+ }
6405
+ if (field.type === "sub-tabs") {
6406
+ for (const tab of field.tabs) collectFields(tab.fields, out);
6407
+ continue;
6408
+ }
6409
+ if (field.type === "editable-array") {
6410
+ const item = /* @__PURE__ */ new Map();
6411
+ for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
6412
+ if (item.size > 0) out.set(field.key, {
6413
+ kind: "array",
6414
+ idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
6415
+ item
6416
+ });
6417
+ continue;
6418
+ }
6419
+ if (!("key" in field) || typeof field.key !== "string") continue;
6420
+ if (isKeychainStoredField(field)) out.set(field.key, LEAF);
6421
+ }
6422
+ }
6423
+ /** The secret tree a settings schema declares. */
6424
+ function secretTreeFromSchema(schema) {
6425
+ const out = /* @__PURE__ */ new Map();
6426
+ if (schema === null) return out;
6427
+ for (const section of schema.sections) collectFields(section.fields, out);
6428
+ return out;
6429
+ }
6430
+ /** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
6431
+ function parseSecretStatePath(path) {
6432
+ const segments = [];
6433
+ for (const raw of path.split(".")) {
6434
+ const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
6435
+ if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
6436
+ segments.push(m[2] !== void 0 ? {
6437
+ key: m[1],
6438
+ idKey: m[2]
6439
+ } : { key: m[1] });
6440
+ }
6441
+ if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
6442
+ if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
6443
+ return segments;
6444
+ }
6445
+ function insert(into, segments) {
6446
+ const [head, ...rest] = segments;
6447
+ if (head === void 0) return;
6448
+ if (rest.length === 0) {
6449
+ into.set(head.key, LEAF);
6450
+ return;
6451
+ }
6452
+ const existing = into.get(head.key);
6453
+ if (head.idKey !== void 0) {
6454
+ const item = new Map(existing?.kind === "array" ? existing.item : []);
6455
+ insert(item, rest);
6456
+ into.set(head.key, {
6457
+ kind: "array",
6458
+ idKey: head.idKey,
6459
+ item
6460
+ });
6461
+ return;
6462
+ }
6463
+ const children = new Map(existing?.kind === "object" ? existing.children : []);
6464
+ insert(children, rest);
6465
+ into.set(head.key, {
6466
+ kind: "object",
6467
+ children
6468
+ });
6469
+ }
6470
+ /** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
6471
+ function mergeSecretStatePaths(tree, paths) {
6472
+ if (paths.length === 0) return tree;
6473
+ const out = new Map(tree);
6474
+ for (const path of paths) insert(out, parseSecretStatePath(path));
6475
+ return out;
6476
+ }
6477
+ /** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
6478
+ var SECRET_RETRY_FIRST_MS = 5e3;
6479
+ var SECRET_RETRY_MAX_MS = 5 * 6e4;
6480
+ /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
6481
+ var SECRET_CHANGE_DEBOUNCE_MS = 250;
5955
6482
  /**
5956
6483
  * Base class for CamStack addons. Eliminates settings boilerplate:
5957
6484
  *
@@ -6021,6 +6548,25 @@ var BaseAddon = class {
6021
6548
  settingsStoreReady = false;
6022
6549
  /** Default config values. Provided via constructor. */
6023
6550
  defaults;
6551
+ /**
6552
+ * Hidden-state paths that hold secrets (D787) — values the addon writes
6553
+ * itself (`updateGlobalSettings`, `state()`) that no form field declares.
6554
+ * Stored in the keychain exactly like a `password` field. Syntax:
6555
+ * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
6556
+ * (`key[<id field>]` addresses array items by id, never by index).
6557
+ */
6558
+ secretStatePaths = [];
6559
+ _addonSecretTree = null;
6560
+ _deviceSecretTree = null;
6561
+ /** Refs the last resolved config pointed at — a change to one re-resolves. */
6562
+ _configSecretRefs = /* @__PURE__ */ new Set();
6563
+ _unresolvedSecrets = [];
6564
+ _secretRetryTimer = null;
6565
+ _secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
6566
+ _secretChangeTimer = null;
6567
+ _secretChangeUnsub = null;
6568
+ /** >0 while an OPERATOR's settings write is being applied. */
6569
+ _operatorWriteDepth = 0;
6024
6570
  constructor(defaults) {
6025
6571
  this.defaults = defaults;
6026
6572
  this._config = { ...defaults };
@@ -6056,8 +6602,18 @@ var BaseAddon = class {
6056
6602
  return this._config;
6057
6603
  }
6058
6604
  async initialize(context) {
6059
- this._ctx = context;
6605
+ const secrets = context.secrets;
6606
+ this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6607
+ secrets,
6608
+ addonTree: () => this.addonSecretTree(),
6609
+ deviceTree: () => this.deviceSecretTree(),
6610
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6611
+ isOperatorWrite: () => this._operatorWriteDepth > 0
6612
+ }) : context;
6060
6613
  await this.resolveConfig();
6614
+ if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6615
+ if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
6616
+ });
6061
6617
  const result = await this.onInitialize();
6062
6618
  this.emitLifecycle(EventCategory.AddonStarted);
6063
6619
  const normalized = normalizeAddonInitResult(result);
@@ -6090,6 +6646,12 @@ var BaseAddon = class {
6090
6646
  */
6091
6647
  async onHubReachable() {}
6092
6648
  async shutdown() {
6649
+ this._secretChangeUnsub?.();
6650
+ this._secretChangeUnsub = null;
6651
+ if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
6652
+ if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
6653
+ this._secretRetryTimer = null;
6654
+ this._secretChangeTimer = null;
6093
6655
  this.emitLifecycle(EventCategory.AddonStopped);
6094
6656
  if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
6095
6657
  await this.onShutdown();
@@ -6168,7 +6730,7 @@ var BaseAddon = class {
6168
6730
  return hydrateSchema(schema, overlay ? {
6169
6731
  ...projected,
6170
6732
  ...overlay
6171
- } : projected);
6733
+ } : projected, { inlineSecretsAsViews: true });
6172
6734
  }
6173
6735
  /**
6174
6736
  * The integration-level view of this addon's settings: exactly the sections
@@ -6217,7 +6779,7 @@ var BaseAddon = class {
6217
6779
  return hydrateSchema({
6218
6780
  ...schema,
6219
6781
  sections
6220
- }, projected);
6782
+ }, projected, { inlineSecretsAsViews: true });
6221
6783
  }
6222
6784
  /**
6223
6785
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -6271,18 +6833,50 @@ var BaseAddon = class {
6271
6833
  value: result.value[key]
6272
6834
  };
6273
6835
  }
6836
+ /**
6837
+ * The OPERATOR's write — a settings form or an admin API call, dispatched by
6838
+ * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
6839
+ * the operator sends is stored as sent even when it equals a pre-keychain
6840
+ * inline value: the operator re-entering a password is a change, an addon
6841
+ * writing back what it read is not (D787).
6842
+ */
6843
+ async updateGlobalSettingsAsOperator(patch, nodeId) {
6844
+ this._operatorWriteDepth++;
6845
+ try {
6846
+ await this.applyGlobalPatch(patch, nodeId);
6847
+ } finally {
6848
+ this._operatorWriteDepth--;
6849
+ }
6850
+ }
6274
6851
  async updateGlobalSettings(patch, nodeId) {
6852
+ await this.applyGlobalPatch(patch, nodeId);
6853
+ }
6854
+ /**
6855
+ * REMOVE stored secrets — their keychain values and their markers (D787).
6856
+ *
6857
+ * Writing `''` to a secret field KEEPS what is stored (an empty string is
6858
+ * what a defaults fallback writes back, and it must never destroy a
6859
+ * credential), so code that means "forget this token" says so here. Without
6860
+ * a keychain (an older kernel) it writes `''`, as such code always did.
6861
+ */
6862
+ async clearSecrets(keys, nodeId) {
6863
+ const tree = this.addonSecretTree();
6864
+ const keychain = this._ctx?.secrets !== void 0;
6865
+ const patch = {};
6866
+ for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
6867
+ await this.applyGlobalPatch(patch, nodeId);
6868
+ }
6869
+ async applyGlobalPatch(barePatch, nodeId) {
6275
6870
  const keys = this.perNodeKeys();
6276
6871
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6277
6872
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6278
- const barePatch = patch;
6279
6873
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6280
6874
  await this._ctx?.settings?.writeAddonStore(scoped);
6281
6875
  if (target !== localNode) return;
6282
6876
  await this.resolveConfig();
6283
6877
  await this.onConfigChanged();
6284
6878
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
6285
- this.maybeAutoRestart(patch, this.globalSettingsSchema());
6879
+ this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
6286
6880
  }
6287
6881
  /**
6288
6882
  * The set of field keys the global settings schema declares `perNode: true`
@@ -6307,7 +6901,7 @@ var BaseAddon = class {
6307
6901
  * time to return its response before the addon is torn down and
6308
6902
  * re-initialised by `AddonRegistryService.restartAddon`.
6309
6903
  */
6310
- maybeAutoRestart(patch, schema) {
6904
+ maybeAutoRestart(patchKeys, schema) {
6311
6905
  if (!schema) return;
6312
6906
  const restartKeys = /* @__PURE__ */ new Set();
6313
6907
  for (const section of schema.sections) for (const field of section.fields) {
@@ -6315,13 +6909,13 @@ var BaseAddon = class {
6315
6909
  if (field.requiresRestart) restartKeys.add(field.key);
6316
6910
  }
6317
6911
  if (restartKeys.size === 0) return;
6318
- if (!Object.keys(patch).some((k) => restartKeys.has(k))) return;
6912
+ if (!patchKeys.some((k) => restartKeys.has(k))) return;
6319
6913
  const ctx = this._ctx;
6320
6914
  if (!ctx) return;
6321
6915
  const addonId = ctx.id;
6322
6916
  setImmediate(() => {
6323
6917
  ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
6324
- ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: Object.keys(patch).filter((k) => restartKeys.has(k)) } });
6918
+ ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
6325
6919
  }).catch((err) => {
6326
6920
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
6327
6921
  });
@@ -6330,7 +6924,7 @@ var BaseAddon = class {
6330
6924
  async getDeviceSettings(deviceId) {
6331
6925
  const schema = this.deviceSettingsSchema();
6332
6926
  if (!schema) return { sections: [] };
6333
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
6927
+ return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6334
6928
  }
6335
6929
  async updateDeviceSettings(deviceId, patch) {
6336
6930
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -6460,7 +7054,7 @@ var BaseAddon = class {
6460
7054
  * selection at boot (absent scoped key ⇒ the constructor default wins).
6461
7055
  */
6462
7056
  async resolveConfig() {
6463
- const stored = await this.readAddonStoreWithRetry();
7057
+ const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
6464
7058
  const perNode = this.perNodeKeys();
6465
7059
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6466
7060
  const resolved = { ...this.defaults };
@@ -6485,7 +7079,7 @@ var BaseAddon = class {
6485
7079
  key,
6486
7080
  schema,
6487
7081
  fallback,
6488
- read: () => this.readAddonStoreWithRetry(),
7082
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
6489
7083
  write: async (patch) => {
6490
7084
  await this._ctx?.settings?.writeAddonStore(patch);
6491
7085
  },
@@ -6502,7 +7096,7 @@ var BaseAddon = class {
6502
7096
  key,
6503
7097
  schema,
6504
7098
  fallback,
6505
- read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
7099
+ read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
6506
7100
  write: async (patch) => {
6507
7101
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
6508
7102
  },
@@ -6514,6 +7108,70 @@ var BaseAddon = class {
6514
7108
  } })
6515
7109
  });
6516
7110
  }
7111
+ /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
7112
+ addonSecretTree() {
7113
+ this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
7114
+ return this._addonSecretTree;
7115
+ }
7116
+ deviceSecretTree() {
7117
+ this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7118
+ return this._deviceSecretTree;
7119
+ }
7120
+ /**
7121
+ * Secrets of this addon's stored config that could not be resolved on the
7122
+ * last read, with why. Non-empty means the addon is running WITHOUT them —
7123
+ * an addon whose function needs one should report itself degraded rather
7124
+ * than start on an empty credential.
7125
+ */
7126
+ get unresolvedSecrets() {
7127
+ return this._unresolvedSecrets;
7128
+ }
7129
+ /**
7130
+ * Substitute every keychain marker in a stored blob with its value. With no
7131
+ * keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
7132
+ * An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
7133
+ * value — and, when the cause can pass, retried with backoff. Nothing is
7134
+ * ever written back from here.
7135
+ */
7136
+ async resolveStoredSecrets(blob, trackForConfig = true) {
7137
+ const secrets = this._ctx?.secrets;
7138
+ if (secrets === void 0) return blob;
7139
+ const refs = collectSecretMarkerRefs(blob);
7140
+ if (trackForConfig) this._configSecretRefs = new Set(refs);
7141
+ if (refs.length === 0) {
7142
+ if (trackForConfig) this._unresolvedSecrets = [];
7143
+ return blob;
7144
+ }
7145
+ const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
7146
+ if (trackForConfig) {
7147
+ this._unresolvedSecrets = unresolved;
7148
+ if (unresolved.length > 0) {
7149
+ this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
7150
+ ref: u.ref,
7151
+ reason: u.reason
7152
+ })) } });
7153
+ if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
7154
+ this.scheduleSecretReresolve(this._secretRetryDelayMs);
7155
+ this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
7156
+ }
7157
+ } else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
7158
+ }
7159
+ return value;
7160
+ }
7161
+ /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7162
+ scheduleSecretReresolve(delayMs) {
7163
+ const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
7164
+ if (this[timerOf] !== null) return;
7165
+ const timer = setTimeout(() => {
7166
+ this[timerOf] = null;
7167
+ if (this._ctx === null) return;
7168
+ this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
7169
+ this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
7170
+ });
7171
+ }, delayMs);
7172
+ timer.unref?.();
7173
+ this[timerOf] = timer;
7174
+ }
6517
7175
  /**
6518
7176
  * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
6519
7177
  * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
@@ -6781,32 +7439,12 @@ object({
6781
7439
  audioCodec: string().optional(),
6782
7440
  metadata: record(string(), unknown()).readonly().optional()
6783
7441
  });
6784
- var EncodedPacketSchema = object({
6785
- type: _enum(["video", "audio"]),
6786
- data: _instanceof(Uint8Array),
6787
- pts: number(),
6788
- dts: number(),
6789
- keyframe: boolean(),
6790
- codec: string()
6791
- });
6792
- var DecodedFrameSchema = object({
6793
- data: _instanceof(Uint8Array),
6794
- width: number(),
6795
- height: number(),
6796
- format: _enum([
6797
- "jpeg",
6798
- "rgb",
6799
- "bgr",
6800
- "yuv420",
6801
- "gray"
6802
- ]),
6803
- timestamp: number()
6804
- });
6805
7442
  /**
6806
7443
  * Wire schema for `FrameHandle` — a zero-pixel, serialisable reference to a
6807
7444
  * frame in a shared-memory ring (Phase 5 / D9). Mirrors the `FrameHandle` TS
6808
- * interface in `interfaces/frame-handle.ts` field-for-field so a decoder cap
6809
- * method (`pullHandles`) can carry handles over tRPC / Moleculer.
7445
+ * interface in `interfaces/frame-handle.ts` field-for-field so a cap method
7446
+ * (the runner's native-crop and pipeline-executor inputs) can carry handles
7447
+ * over tRPC / Moleculer.
6810
7448
  *
6811
7449
  * The `satisfies` assertion below pins this schema to the interface: if a
6812
7450
  * field is added to / removed from `FrameHandle` without a matching schema
@@ -6832,50 +7470,6 @@ var FrameHandleSchema = object({
6832
7470
  slotCount: number().int().positive()
6833
7471
  });
6834
7472
  /**
6835
- * Pixel format a frame-handle subscriber can request from the broker
6836
- * (Phase 5 / D9). The packed, raster subset of `FrameFormat` — the formats a
6837
- * `frameSink: 'shm'` decoder session can write into a `FrameRing` slot.
6838
- * `jpeg` is excluded: a variable-length stream is not a fixed-stride ring
6839
- * payload, and no decoded-frame consumer requests it over the shm plane.
6840
- */
6841
- var FrameHandleFormatSchema = _enum([
6842
- "rgb",
6843
- "bgr",
6844
- "yuv420",
6845
- "gray"
6846
- ]);
6847
- /**
6848
- * Input for `stream-broker.subscribeFrames` (Phase 5 / D9). A consumer asks the
6849
- * broker for a `FrameHandle` stream of one `format`; the broker maintains one
6850
- * shared-memory ring per `(brokerId, format)` actually requested, so a `gray`
6851
- * subscriber (motion) and an `rgb` subscriber (detection) each read the format
6852
- * they asked for with no broker-side conversion.
6853
- */
6854
- var SubscribeFramesInputSchema = object({
6855
- brokerId: string(),
6856
- format: FrameHandleFormatSchema,
6857
- /**
6858
- * Optional reader-side cadence hint in frames per second. The broker does
6859
- * NOT throttle — latest-wins ring reads drop frames implicitly for a slow
6860
- * consumer. The value is echoed back in `SubscribeFramesResult.maxFps` so
6861
- * the consumer can pace its own `pullFrameHandles` polling.
6862
- */
6863
- maxFps: number().positive().optional(),
6864
- /** Short caller-identity tag (`motion`, `detection`, …) for diagnostics. */
6865
- tag: string().optional()
6866
- });
6867
- /**
6868
- * Result of `stream-broker.subscribeFrames`. The consumer then polls
6869
- * `pullFrameHandles({ subscriptionId, maxCount })` and feeds each returned
6870
- * `FrameHandle` to a `FrameRingReader`.
6871
- */
6872
- var SubscribeFramesResultSchema = object({
6873
- /** Opaque id the consumer passes to `pullFrameHandles` / `unsubscribeFrames`. */
6874
- subscriptionId: string(),
6875
- /** Reader-side cadence hint (frames/s) — echoes `SubscribeFramesInput.maxFps`. */
6876
- maxFps: number().nonnegative()
6877
- });
6878
- /**
6879
7473
  * Wire schema for a decoded audio chunk (Phase 5 / D9). Mirrors the
6880
7474
  * `DecodedAudioChunk` TS interface in `interfaces/stream-broker.ts`: PCM
6881
7475
  * sample bytes plus the track parameters a consumer needs to interpret them.
@@ -6883,8 +7477,8 @@ var SubscribeFramesResultSchema = object({
6883
7477
  * Audio chunks are tiny (a ~500ms AudioCodecSession window is a few KB of
6884
7478
  * Float32 PCM), so unlike video frames they ship their bytes INLINE over
6885
7479
  * tRPC / Moleculer — no shared-memory plane. `data` is typed `Uint8Array`
6886
- * (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
6887
- * / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
7480
+ * (the wire-serialisable supertype of `Buffer`); a `Buffer` is assignable to
7481
+ * it.
6888
7482
  */
6889
7483
  var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
6890
7484
  var DecodedAudioChunkSchema = object({
@@ -6902,11 +7496,10 @@ var DecodedAudioChunkSchema = object({
6902
7496
  format: AudioChunkFormatSchema.optional()
6903
7497
  });
6904
7498
  /**
6905
- * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
6906
- * handle-free, ship-bytes-inline analogue of `subscribeFrames`: a consumer
6907
- * asks the broker for the decoded audio-chunk stream of one broker; the
6908
- * broker keeps a per-subscription bounded FIFO queue the consumer drains via
6909
- * `pullAudioChunks`.
7499
+ * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). Audio ships
7500
+ * its bytes inline: a consumer asks the broker for the decoded audio-chunk
7501
+ * stream of one broker; the broker keeps a per-subscription bounded FIFO queue
7502
+ * the consumer drains via `pullAudioChunks`.
6910
7503
  */
6911
7504
  var SubscribeAudioChunksInputSchema = object({
6912
7505
  brokerId: string(),
@@ -6937,9 +7530,7 @@ var BrokerStatsSchema = object({
6937
7530
  "stopped"
6938
7531
  ]),
6939
7532
  inputFps: number(),
6940
- decodeFps: number(),
6941
7533
  encodedSubscribers: number(),
6942
- decodedSubscribers: number(),
6943
7534
  uptimeMs: number(),
6944
7535
  bitrateKbps: number(),
6945
7536
  idrIntervalMs: number(),
@@ -6952,14 +7543,6 @@ var BrokerStatsSchema = object({
6952
7543
  preBufferMs: number(),
6953
7544
  preBufferPackets: number(),
6954
7545
  /**
6955
- * Moleculer node id of the decoder provider currently servicing this
6956
- * stream's decoded subscribers. `null` until the deferred decoder is
6957
- * created (no decoded clients yet, or codec not detected). Surfaces the
6958
- * runtime decoder placement so the UI can show "Decoder: <agent>" without
6959
- * a separate cap call per broker.
6960
- */
6961
- decoderNodeId: string().nullable(),
6962
- /**
6963
7546
  * Detected audio track parameters from the RTSP DESCRIBE / SDP. `null`
6964
7547
  * when the stream has no audio track or the broker is in cold start.
6965
7548
  * `supported = false` means the codec was detected but the local
@@ -7198,6 +7781,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
7198
7781
  kind: "mutation",
7199
7782
  auth: "admin"
7200
7783
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
7784
+ function defOf(schema) {
7785
+ return schema._zod?.def ?? {};
7786
+ }
7787
+ function declaredHere(schema) {
7788
+ return globalRegistry.get(schema)?.secret === true;
7789
+ }
7790
+ /** Wrapper kinds whose `innerType` is the field itself. */
7791
+ var WRAPPERS = new Set([
7792
+ "optional",
7793
+ "nullable",
7794
+ "default",
7795
+ "prefault",
7796
+ "catch",
7797
+ "readonly",
7798
+ "nonoptional"
7799
+ ]);
7800
+ /**
7801
+ * The schema layers that make up ONE field: the schema itself and every
7802
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
7803
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
7804
+ * `.transform` on `in`).
7805
+ */
7806
+ function layersOf(schema) {
7807
+ const out = [];
7808
+ const queue = [schema];
7809
+ while (queue.length > 0) {
7810
+ const s = queue.shift();
7811
+ if (!s || out.includes(s)) continue;
7812
+ out.push(s);
7813
+ const def = defOf(s);
7814
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
7815
+ if (def.type === "pipe") {
7816
+ if (def.in) queue.push(def.in);
7817
+ if (def.out) queue.push(def.out);
7818
+ }
7819
+ }
7820
+ return out;
7821
+ }
7822
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
7823
+ function isZodSecret(schema) {
7824
+ return layersOf(schema).some(declaredHere);
7825
+ }
7826
+ /**
7827
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
7828
+ * element of this array" (`connection.password`, `rows[].token`). A declared
7829
+ * object or array is reported as one path and not descended into — everything
7830
+ * under it is secret.
7831
+ */
7832
+ function collectZodSecretPaths(schema, prefix = "") {
7833
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
7834
+ const paths = [];
7835
+ for (const layer of layersOf(schema)) {
7836
+ const def = defOf(layer);
7837
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
7838
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
7839
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
7840
+ else if (def.type === "intersection") {
7841
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
7842
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
7843
+ }
7844
+ }
7845
+ return [...new Set(paths)];
7846
+ }
7201
7847
  /**
7202
7848
  * Promise-based timer helpers — used everywhere the codebase needs to
7203
7849
  * wait, back off, or schedule a retry. Before these helpers landed, each
@@ -10363,70 +11009,6 @@ var StorageLocationDeclarationSchema = object({
10363
11009
  "backup"
10364
11010
  ]).optional()
10365
11011
  });
10366
- var DecoderStatsSchema = object({
10367
- inputFps: number(),
10368
- outputFps: number(),
10369
- avgDecodeTimeMs: number(),
10370
- droppedFrames: number(),
10371
- /**
10372
- * Pull-mode adaptive-fps telemetry (optional — only pull sessions run the
10373
- * lag-driven controller; push sessions omit these). `lagMs` is the EWMA of
10374
- * the decoder's real-time drift (rising = falling behind live); `adaptiveFps`
10375
- * is the current lag-throttled emit rate (≤ `effectiveFps` ceiling).
10376
- */
10377
- lagMs: number().optional(),
10378
- effectiveFps: number().optional(),
10379
- adaptiveFps: number().optional()
10380
- });
10381
- var DecoderSessionConfigSchema = object({
10382
- codec: string(),
10383
- maxFps: number().default(0),
10384
- outputFormat: _enum([
10385
- "jpeg",
10386
- "rgb",
10387
- "bgr",
10388
- "yuv420",
10389
- "gray"
10390
- ]).default("jpeg"),
10391
- scale: number().default(1),
10392
- width: number().optional(),
10393
- height: number().optional(),
10394
- /**
10395
- * Identifier of the camera this decoder session serves. Optional
10396
- * because the cap is generic (any caller could request decode), but
10397
- * stream-broker passes it so decoder logs include `deviceId` for
10398
- * per-camera filtering when diagnosing failures (e.g. node-av
10399
- * sendPacket errors on a single hung camera).
10400
- */
10401
- deviceId: number().int().nonnegative().optional(),
10402
- /**
10403
- * Free-form tag for log scoping. Stream-broker uses
10404
- * `broker:<deviceId>/<profile>`. Decoder session logger surfaces it
10405
- * on every line so `grep tag=broker:5/high` filters one camera
10406
- * profile cleanly.
10407
- */
10408
- tag: string().optional(),
10409
- /**
10410
- * Where the session delivers decoded frames (Phase 5 / D9):
10411
- *
10412
- * - `'callback'` (default) — the legacy pixel path: decoded frames are
10413
- * buffered as `DecodedFrame`s and drained via `pullFrames`.
10414
- * - `'shm'` — the shared-memory frame plane: decoded frames are written
10415
- * into an OS shared-memory ring and drained as zero-pixel
10416
- * `FrameHandle`s via `pullHandles`. A session is one mode or the
10417
- * other — `pullFrames` returns nothing for an `'shm'` session and
10418
- * `pullHandles` returns nothing for a `'callback'` session.
10419
- */
10420
- frameSink: _enum(["callback", "shm"]).default("callback"),
10421
- /**
10422
- * Per-camera decoder DEBUG facility. When `true`, a pull-mode session emits
10423
- * a throttled (~1Hz) structured `decoder debug` line (effective/adaptive fps,
10424
- * real-time lag, dropped-frame delta, avg decode time, hwaccel). Mirrors the
10425
- * stream-broker's `streamingDebug` gate — off by default so production logs
10426
- * stay quiet and the emit path pays zero per-frame cost when disabled.
10427
- */
10428
- debug: boolean().optional()
10429
- });
10430
11012
  var EU_DST = {
10431
11013
  offsetHours: 1,
10432
11014
  startMonth: 3,
@@ -11101,57 +11683,26 @@ var ClipSearchStrictnessSchema = _enum([
11101
11683
  "balanced",
11102
11684
  "strict"
11103
11685
  ]);
11104
- new Set([
11105
- {
11106
- id: "person",
11107
- name: "Person"
11108
- },
11109
- {
11110
- id: "vehicle",
11111
- name: "Vehicle"
11112
- },
11113
- {
11114
- id: "animal",
11115
- name: "Animal"
11116
- },
11117
- {
11118
- id: "package",
11119
- name: "Package"
11120
- }
11121
- ].map((l) => l.id));
11122
- var COCO_TO_MACRO = {
11123
- mapping: {
11124
- person: "person",
11125
- bicycle: "vehicle",
11126
- car: "vehicle",
11127
- motorcycle: "vehicle",
11128
- airplane: "vehicle",
11129
- bus: "vehicle",
11130
- train: "vehicle",
11131
- truck: "vehicle",
11132
- boat: "vehicle",
11133
- bird: "animal",
11134
- cat: "animal",
11135
- dog: "animal",
11136
- horse: "animal",
11137
- sheep: "animal",
11138
- cow: "animal",
11139
- elephant: "animal",
11140
- bear: "animal",
11141
- zebra: "animal",
11142
- giraffe: "animal",
11143
- suitcase: "package",
11144
- backpack: "package",
11145
- handbag: "package"
11146
- },
11147
- preserveOriginal: false
11148
- };
11149
- /** Steps a root detector may declare it fills. */
11150
- var FILLABLE_STEP_IDS = [
11686
+ /** Steps whose effect a root label can BE. */
11687
+ var LABEL_SUPPLY_STEP_IDS = [
11151
11688
  "animal-classifier",
11152
11689
  "vehicle-classifier",
11153
11690
  "package-detection"
11154
11691
  ];
11692
+ /** Steps whose box a root detection can BE. */
11693
+ var CROP_SUPPLY_STEP_IDS = ["plate-detection", "face-detection"];
11694
+ /**
11695
+ * Steps whose per-detection MASK a root detection can carry (D737). The live
11696
+ * mask step is `segmentation` — a frame-plane refiner that runs its own model
11697
+ * once per detection crop. (`instance-segmentation` is a dormant step id that
11698
+ * no camera tree carries.)
11699
+ */
11700
+ var MASK_SUPPLY_STEP_IDS = ["segmentation"];
11701
+ [
11702
+ ...LABEL_SUPPLY_STEP_IDS,
11703
+ ...CROP_SUPPLY_STEP_IDS,
11704
+ ...MASK_SUPPLY_STEP_IDS
11705
+ ];
11155
11706
  var MODEL_FORMATS = [
11156
11707
  "onnx",
11157
11708
  "coreml",
@@ -11180,7 +11731,53 @@ var ModelFormatEntrySchema = object({
11180
11731
  /** Multi-file payload (directory members or sibling files). */
11181
11732
  files: array(string()).readonly().optional(),
11182
11733
  /** Runtime(s) that can use this format. If omitted, inferred from ModelFormat key */
11183
- runtimes: array(_enum(["python"])).readonly().optional()
11734
+ runtimes: array(_enum(["python"])).readonly().optional(),
11735
+ /**
11736
+ * Content revision of the artefact, for one hosted OFF the CamStack mirror.
11737
+ * A format on the mirror leaves it unset: its revision (the sha256 of its
11738
+ * weight file) comes from the downloader's generated table, kept in step
11739
+ * with the mirror by `scripts/check-hosted-model-revisions.ts` (D744). A
11740
+ * node records the revision it downloaded next to the file
11741
+ * (`<file>.revision`); a copy with no record or a different one is stale
11742
+ * unless its weight file hashes to the revision, and a stale copy is
11743
+ * downloaded again, the old one serving until the new one is complete. No
11744
+ * revision at all ⇒ a file on disk is current, whatever it holds (D743).
11745
+ */
11746
+ revision: string().min(1).optional()
11747
+ });
11748
+ /**
11749
+ * What a node holds for one (model, format) (D746). `current` is a complete
11750
+ * copy at its catalog revision — exactly what `downloaded: true` means.
11751
+ * `stale` is bytes on disk that are not (yet) proven current under D743/D744:
11752
+ * no or a different revision record, or a missing sibling. `missing` is no
11753
+ * copy. `downloaded` alone folds `stale` into "not downloaded", which hid
11754
+ * reclaimable bytes and a copy about to be replaced.
11755
+ */
11756
+ var ModelOnDiskStateSchema = _enum([
11757
+ "current",
11758
+ "stale",
11759
+ "missing"
11760
+ ]);
11761
+ /**
11762
+ * The numeric precision of one format's BUILD (D746) — reported only when the
11763
+ * build states it (file-name token, an INT8 variant, an EdgeTPU compile, a
11764
+ * CamStack Core ML export). Absent means "not stated", never "fp32".
11765
+ */
11766
+ var ModelFormatPrecisionSchema = _enum([
11767
+ "fp32",
11768
+ "fp16",
11769
+ "int8"
11770
+ ]);
11771
+ /**
11772
+ * One format of one model as a node's `pipelineExecutor.getSchema` reports it.
11773
+ * `onDisk` / `precision` are optional for version skew: a runner that predates
11774
+ * them omits them, and a reader falls back to `downloaded`.
11775
+ */
11776
+ var PipelineModelFormatStatusSchema = object({
11777
+ downloaded: boolean(),
11778
+ sizeMB: number(),
11779
+ onDisk: ModelOnDiskStateSchema.optional(),
11780
+ precision: ModelFormatPrecisionSchema.optional()
11184
11781
  });
11185
11782
  /**
11186
11783
  * Extra file that must be downloaded alongside the model (e.g., labels JSON, dict.txt).
@@ -11284,12 +11881,46 @@ var ModelLicenseSchema = preprocess((value) => typeof value === "string" ? { wei
11284
11881
  /** True when the weights or their data forbid commercial use. */
11285
11882
  nonCommercial: boolean().optional()
11286
11883
  }));
11287
- /** One `fillsClassifierEffects` entry — see `ModelCatalogEntry.fillsClassifierEffects`. */
11288
- var FillsClassifierEffectSchema = object({
11289
- stepId: _enum(FILLABLE_STEP_IDS),
11290
- labelToEffect: record(string(), string()),
11291
- uncovered: array(string()).readonly()
11292
- });
11884
+ /**
11885
+ * One step a ROOT detector can supply from its own output (D730) — see
11886
+ * `ModelCatalogEntry.suppliesSteps`.
11887
+ *
11888
+ * - `label`: the root's raw class IS the step's answer. `labelToEffect` maps
11889
+ * the root's label to the step's vocabulary; `uncovered` is the vocabulary
11890
+ * the root cannot produce (shown as unavailable, never a blocker).
11891
+ * - `crop`: the root draws the box the step would have found (`license_plate`
11892
+ * for plate-detection, `face` for face-detection). The box becomes a detail
11893
+ * child of the `parentMacro` detection that contains it — never a track.
11894
+ * - `mask`: the root's decode emits an instance mask with every detection (a
11895
+ * YOLO26-seg root, D737) — the `segmentation` step's result, carried on the
11896
+ * detection in the shape that step produces. Derived from the model's
11897
+ * postprocessor on read, never stored by an import.
11898
+ */
11899
+ var RootStepSupplySchema = discriminatedUnion("kind", [
11900
+ object({
11901
+ kind: literal("label"),
11902
+ stepId: _enum(LABEL_SUPPLY_STEP_IDS),
11903
+ labelToEffect: record(string(), string()),
11904
+ uncovered: array(string()).readonly()
11905
+ }),
11906
+ object({
11907
+ kind: literal("crop"),
11908
+ stepId: _enum(CROP_SUPPLY_STEP_IDS),
11909
+ rootLabels: array(string()).readonly(),
11910
+ parentMacro: _enum(["vehicle", "person"]),
11911
+ childClass: _enum(["plate", "face"]),
11912
+ /**
11913
+ * The root's smaller input side, stamped on read by `rootSuppliesOf` from
11914
+ * the model entry — what a step's `minRootInputPx` gate judges. Never
11915
+ * stored by an import.
11916
+ */
11917
+ rootInputPx: number().int().positive().optional()
11918
+ }),
11919
+ object({
11920
+ kind: literal("mask"),
11921
+ stepId: _enum(MASK_SUPPLY_STEP_IDS)
11922
+ })
11923
+ ]);
11293
11924
  var ModelCatalogEntrySchema = object({
11294
11925
  id: string(),
11295
11926
  name: string(),
@@ -11355,6 +11986,35 @@ var ModelCatalogEntrySchema = object({
11355
11986
  */
11356
11987
  defaultConfidence: number().min(0).max(1).optional(),
11357
11988
  /**
11989
+ * Per-MODEL default of the per-class confidence floors (`minConfidence<Macro>`
11990
+ * on a detector step), keyed by macro class: `{ person: 0.45 }`. A class
11991
+ * absent here runs at the step slider's global default. The same row shape
11992
+ * the floor measurement produces (`model-floors.json`: modelId → floors), so
11993
+ * a measured table is copied in as-is. An operator override is bound to the
11994
+ * model it was made for and does not survive a model change (D738). A custom
11995
+ * / imported model may declare it; without it, the global defaults apply.
11996
+ */
11997
+ defaultClassFloors: record(string(), number().min(0).max(1)).optional(),
11998
+ /**
11999
+ * The inference precision this model's OpenVINO IR needs on an Intel GPU.
12000
+ * Absent ⇒ the device default (f16 on a GPU). Set to `'f32'` for an FP32 IR
12001
+ * that produces invalid output at f16 — measured 2026-10-07 for YOLO26
12002
+ * base IRs (`yolo26s`: 0 true / 146 false positives; `yolo26m*`: NaN
12003
+ * scores) on the Core Ultra iGPU and the N100. Threaded to the pool as
12004
+ * `PoolModelConfig.gpuInferencePrecision`; the pool sets
12005
+ * INFERENCE_PRECISION_HINT on a GPU only. Costs ~60% latency on the GPU.
12006
+ */
12007
+ gpuInferencePrecision: _enum(["f32", "f16"]).optional(),
12008
+ /**
12009
+ * ROOT detectors only: per supplied step (`animal-classifier`, …), the
12010
+ * minimum DETECTION score from which this root's own fine label (species,
12011
+ * vehicle type — D736 root supply) is taken (D741). Below it the detection
12012
+ * keeps its macro class without the fine label. `1` = never take it from
12013
+ * this root. Absent ⇒ no floor beyond the macro floor. The supplied step's
12014
+ * `minConfidence` slider, bound to the ROOT model, overrides it.
12015
+ */
12016
+ suppliedLabelFloors: record(string(), number().min(0).max(1)).optional(),
12017
+ /**
11358
12018
  * When true, the executor produces a landmark-aligned crop (similarity warp
11359
12019
  * onto the canonical template) before this step runs, instead of a plain
11360
12020
  * axis-aligned bbox crop. Required for face-recognition embedders (ArcFace):
@@ -11416,15 +12076,15 @@ var ModelCatalogEntrySchema = object({
11416
12076
  */
11417
12077
  classMap: DetectionCatalogClassMapSchema.optional(),
11418
12078
  /**
11419
- * The pipeline steps this ROOT detector already does the work of (D715):
11420
- * its labels name the effect the step exists to produce (`deer` for
11421
- * `animal-classifier`, `package` for `package-detection`). Derived from the
11422
- * labelmap by `deriveClassifierFills`, never hand-written; a COCO model
11423
- * declares none. Whether a declaration is honoured is the step's own
11424
- * `labelLink` policy (`resolveLabelLink`). `labelToEffect` values are in
11425
- * `FILLABLE_STEP_VOCABULARIES` (guard `check-label-link-vocabulary`).
12079
+ * The pipeline steps this ROOT detector can supply from its own output
12080
+ * (D730): its labels name a step's effect (`deer` for `animal-classifier`)
12081
+ * or draw a step's box (`license_plate` for `plate-detection`). Computed at
12082
+ * import from THIS model's labelmap by `deriveRootSupplies`, never written
12083
+ * by hand and never assumed per family; a row without it is derived on read
12084
+ * (`rootSuppliesOf`). Whether a camera uses it is the step's own
12085
+ * `useRootModel` flag (`resolveRootSupply`).
11426
12086
  */
11427
- fillsClassifierEffects: array(FillsClassifierEffectSchema).readonly().optional(),
12087
+ suppliesSteps: array(RootStepSupplySchema).readonly().optional(),
11428
12088
  /**
11429
12089
  * The model's CLIP feature-space contract (text encoder, dimension, vector
11430
12090
  * index, token window, search floor) — see `clip-model.ts`. Present ONLY on a
@@ -13027,13 +13687,6 @@ var BrokerRtspClientSchema = object({
13027
13687
  lastRtpAt: number(),
13028
13688
  bytesSent: number()
13029
13689
  });
13030
- var BrokerDecodedClientSchema = object({
13031
- tag: string(),
13032
- subscribedAt: number(),
13033
- maxFps: number(),
13034
- framesDelivered: number(),
13035
- framesDropped: number()
13036
- });
13037
13690
  var BrokerAudioClientSchema = object({
13038
13691
  tag: string(),
13039
13692
  subscribedAt: number(),
@@ -13125,7 +13778,6 @@ var BrokerEncodedClientSchema = object({
13125
13778
  });
13126
13779
  var BrokerClientsSchema = object({
13127
13780
  rtsp: array(BrokerRtspClientSchema).readonly(),
13128
- decoded: array(BrokerDecodedClientSchema).readonly(),
13129
13781
  audio: array(BrokerAudioClientSchema).readonly(),
13130
13782
  encoded: array(BrokerEncodedClientSchema).readonly(),
13131
13783
  pipeClients: number(),
@@ -13494,11 +14146,7 @@ method(object({
13494
14146
  auth: "admin"
13495
14147
  }), method(object({ brokerId: string() }), BrokerClientsSchema), method(object({
13496
14148
  brokerId: string(),
13497
- channel: _enum([
13498
- "rtsp",
13499
- "decoded",
13500
- "audio"
13501
- ]),
14149
+ channel: _enum(["rtsp", "audio"]),
13502
14150
  handle: string()
13503
14151
  }), object({ killed: boolean() }), {
13504
14152
  kind: "mutation",
@@ -13533,10 +14181,7 @@ method(object({
13533
14181
  }), method(SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, { kind: "mutation" }), method(object({
13534
14182
  subscriptionId: string(),
13535
14183
  maxCount: number().int().positive().default(8)
13536
- }), array(DecodedAudioChunkSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(SubscribeFramesInputSchema, SubscribeFramesResultSchema, { kind: "mutation" }), method(object({
13537
- subscriptionId: string(),
13538
- maxCount: number().int().positive().default(4)
13539
- }), array(FrameHandleSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(object({
14184
+ }), array(DecodedAudioChunkSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(object({
13540
14185
  brokerId: string(),
13541
14186
  seconds: number().min(0).max(30)
13542
14187
  }), _void(), {
@@ -14796,53 +15441,201 @@ id: union([string(), number()]) }), {
14796
15441
  auth: "admin"
14797
15442
  });
14798
15443
  /**
14799
- * shm ring usage stats for a `frameSink: 'shm'` decoder session —
14800
- * exposed via `decoder.getShmStats` so downstream consumers can
14801
- * observe ring pressure (slot count, byte budget, hit/miss ratio).
15444
+ * `keychain` — the hub's encrypted store of secret values (D787).
15445
+ *
15446
+ * Settings blobs never hold a secret: they hold a marker
15447
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
15448
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
15449
+ * is the OWNER's door to its own values: every method is owner-checked
15450
+ * against the CALLER, never against anything the caller claims.
15451
+ *
15452
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
15453
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
15454
+ * connection, the agent from its child's connection carried in
15455
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
15456
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
15457
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
15458
+ * identity against BUGS and misrouting, not against a malicious addon (every
15459
+ * runner is the same OS user): see the threat model in
15460
+ * `docs/design/2026-10-08-secrets-keychain.md`.
15461
+ *
15462
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
15463
+ * parses the input, so a session can never supply it, and the internal mount
15464
+ * floors every method to admin anyway (D240).
15465
+ *
15466
+ * Internal: addons reach it through `ctx.secrets`, never directly.
15467
+ */
15468
+ /** Why a value cannot be served right now. Never folded into "missing". */
15469
+ var KeychainUnavailableReasonSchema = _enum([
15470
+ "key-missing",
15471
+ "wrong-key",
15472
+ "key-file-unreadable",
15473
+ "store-unavailable",
15474
+ "not-initialized",
15475
+ "decrypt-failed"
15476
+ ]);
15477
+ var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
15478
+ state: literal("locked"),
15479
+ reason: KeychainUnavailableReasonSchema
15480
+ })]);
15481
+ var KeychainResolveEntrySchema = discriminatedUnion("kind", [
15482
+ object({
15483
+ kind: literal("value"),
15484
+ value: string(),
15485
+ version: number().int()
15486
+ }),
15487
+ object({ kind: literal("missing") }),
15488
+ object({
15489
+ kind: literal("unavailable"),
15490
+ reason: KeychainUnavailableReasonSchema
15491
+ }),
15492
+ object({ kind: literal("forbidden") })
15493
+ ]);
15494
+ var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
15495
+ /** Metadata of one stored value — never the value. */
15496
+ var KeychainSecretMetaSchema = object({
15497
+ ref: string(),
15498
+ owner: string(),
15499
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
15500
+ scope: string(),
15501
+ fieldPath: string(),
15502
+ version: number().int(),
15503
+ createdAt: number(),
15504
+ updatedAt: number(),
15505
+ /** `addon:<id>` | `user:<id>` | `system`. */
15506
+ updatedBy: string(),
15507
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
15508
+ lastReadAt: number().nullable()
15509
+ });
15510
+ var RefListSchema = array(string().min(1)).max(512);
15511
+ method(object({
15512
+ ref: string().min(1),
15513
+ value: string().min(1)
15514
+ }), object({
15515
+ ref: string(),
15516
+ version: number().int()
15517
+ }), {
15518
+ kind: "mutation",
15519
+ auth: "admin"
15520
+ }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
15521
+ kind: "mutation",
15522
+ auth: "admin"
15523
+ }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
15524
+ var KeychainKeySourceSchema = object({
15525
+ kind: _enum([
15526
+ "config-file",
15527
+ "previous-config-file",
15528
+ "platform",
15529
+ "default-file"
15530
+ ]),
15531
+ /** File sources only — a path is not a secret. */
15532
+ path: string().optional(),
15533
+ /**
15534
+ * True when a whole-volume backup of the data directory carries this key
15535
+ * next to the database it protects (the default file). The page warns.
15536
+ */
15537
+ sharesBackupWithDatabase: boolean()
15538
+ });
15539
+ var KeychainStatusSchema = object({
15540
+ keychain: KeychainStateSchema,
15541
+ /** The source of the master key in use; `null` while locked. */
15542
+ keySource: KeychainKeySourceSchema.nullable(),
15543
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
15544
+ configuredSource: KeychainKeySourceSchema,
15545
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
15546
+ fingerprint: string().nullable(),
15547
+ activeKeyId: string().nullable(),
15548
+ /**
15549
+ * The keychain unlocked with a NON-primary source: the configured primary
15550
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
15551
+ */
15552
+ rotationPending: boolean(),
15553
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
15554
+ retiredWraps: number().int(),
15555
+ recoveryKeyDownloadedAt: number().nullable(),
15556
+ secretCount: number().int()
15557
+ });
15558
+ /**
15559
+ * Whether a stored value is still pointed at by its owner's settings.
15560
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
15561
+ * never reported as an orphan (and never deleted as one).
14802
15562
  */
14803
- var ShmRingStatsSchema = object({
14804
- sessionId: string(),
14805
- slotCount: number().int(),
14806
- slotByteLength: number().int(),
14807
- segmentBytes: number().int(),
14808
- budgetMb: number().int(),
14809
- framesWritten: number().int(),
14810
- getFrameHits: number().int(),
14811
- getFrameMisses: number().int()
14812
- });
14813
- method(object({ codec: string() }), boolean()), method(_void(), object({
15563
+ var KeychainSecretUsageSchema = _enum([
15564
+ "in-use",
15565
+ "orphan",
15566
+ "unknown"
15567
+ ]);
15568
+ var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
15569
+ var KeychainAuditActionSchema = _enum([
15570
+ "put",
15571
+ "delete",
15572
+ "reveal",
15573
+ "rotate-master-key",
15574
+ "purge-retired-keys",
15575
+ "download-recovery-key",
15576
+ "delete-orphans",
15577
+ "reset",
15578
+ "initialize"
15579
+ ]);
15580
+ var KeychainAuditEntrySchema = object({
15581
+ id: string(),
15582
+ at: number(),
15583
+ action: KeychainAuditActionSchema,
15584
+ /** `addon:<id>` | `user:<id>` | `system`. */
15585
+ actor: string(),
15586
+ ref: string().nullable(),
15587
+ detail: string().nullable()
15588
+ });
15589
+ 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({
15590
+ value: string(),
15591
+ version: number().int()
15592
+ }), {
15593
+ kind: "mutation",
15594
+ auth: "admin",
15595
+ caller: "required"
15596
+ }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
15597
+ deleted: array(string()).readonly(),
15598
+ kept: array(object({
15599
+ ref: string(),
15600
+ usage: KeychainSecretUsageSchema
15601
+ })).readonly()
15602
+ }), {
15603
+ kind: "mutation",
15604
+ auth: "admin",
15605
+ caller: "required"
15606
+ }), method(object({}), object({
15607
+ fingerprint: string(),
15608
+ keySource: KeychainKeySourceSchema
15609
+ }), {
15610
+ kind: "mutation",
15611
+ auth: "admin",
15612
+ caller: "required"
15613
+ }), method(object({}), object({ purged: number().int() }), {
15614
+ kind: "mutation",
15615
+ auth: "admin",
15616
+ caller: "required"
15617
+ }), method(object({}), object({
15618
+ key: string(),
15619
+ fingerprint: string(),
15620
+ keySource: KeychainKeySourceSchema
15621
+ }), {
15622
+ kind: "mutation",
15623
+ auth: "admin",
15624
+ caller: "required"
15625
+ }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15626
+ archivedCollection: string().nullable(),
15627
+ archived: number().int()
15628
+ }), {
15629
+ kind: "mutation",
15630
+ auth: "admin",
15631
+ caller: "required"
15632
+ });
15633
+ method(_void(), object({
14814
15634
  id: string(),
14815
15635
  name: string(),
14816
- isPullMode: boolean().optional(),
14817
- priority: number().optional(),
14818
15636
  hwaccel: string().optional(),
14819
15637
  probedBestHwaccel: string().optional()
14820
- })), method(DecoderSessionConfigSchema, object({
14821
- sessionId: string(),
14822
- nodeId: string()
14823
- })), method(object({ sessionId: string() }), _void()), method(object({
14824
- sessionId: string(),
14825
- packet: EncodedPacketSchema
14826
- }), _void()), method(object({
14827
- sessionId: string(),
14828
- url: string()
14829
- }), _void()), method(object({
14830
- sessionId: string(),
14831
- maxCount: number().default(1),
14832
- waitMs: number().optional()
14833
- }), array(DecodedFrameSchema)), method(object({
14834
- sessionId: string(),
14835
- maxCount: number().default(1),
14836
- waitMs: number().optional()
14837
- }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
14838
- sessionId: string(),
14839
- config: DecoderSessionConfigSchema.partial()
14840
- }), _void()), method(object({ sessionId: string() }), DecoderStatsSchema), method(_void(), array(object({
14841
- sessionId: string(),
14842
- codec: string(),
14843
- outputFormat: string(),
14844
- createdAtMs: number()
14845
- })).readonly()), method(_void(), object({ backend: string() }), {
15638
+ })), method(_void(), object({ backend: string() }), {
14846
15639
  kind: "mutation",
14847
15640
  auth: "admin"
14848
15641
  });
@@ -15955,6 +16748,10 @@ var DeviceInfoSchema = object({
15955
16748
  isCamera: boolean(),
15956
16749
  /** Current config values — serializable snapshot */
15957
16750
  config: record(string(), unknown()),
16751
+ /** Paths inside `config` the device's schema declares secret (D783) —
16752
+ * what the non-admin redaction withholds. Paths, never values. Absent
16753
+ * when the owning runner has not reported them. */
16754
+ secretConfigPaths: array(string()).optional(),
15958
16755
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
15959
16756
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
15960
16757
  metadata: record(string(), unknown()).nullable().optional(),
@@ -16160,12 +16957,22 @@ var DeviceRegisterPayloadSchema = object({
16160
16957
  * call (workers re-register on init), so probe-driven updates
16161
16958
  * (e.g. PTZ flag flipping after the abilities probe) propagate. */
16162
16959
  features: array(string()).optional(),
16163
- config: record(string(), unknown())
16960
+ config: record(string(), unknown()),
16961
+ /** Config paths the device's own schema DECLARES secret
16962
+ * (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
16963
+ * `connection.password`). Re-published on every register; the non-admin
16964
+ * redaction withholds them at any depth (D783). Optional: an older runner
16965
+ * omits it and the keyword backstop applies. */
16966
+ secretConfigPaths: array(string()).optional()
16164
16967
  });
16165
16968
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
16166
16969
  var DevicePersistConfigPayloadSchema = object({
16167
16970
  deviceId: number(),
16168
- data: record(string(), unknown())
16971
+ data: record(string(), unknown()),
16972
+ /** The paths the device's schema declares secret (D783), when the caller
16973
+ * knows them — those values are kept in the keychain, not the blob (D787).
16974
+ * Absent: the paths the device last reported at `registerDevice` apply. */
16975
+ secretConfigPaths: array(string()).optional()
16169
16976
  });
16170
16977
  /** What a migration actually did, per switch. `unreachable` is a first-class
16171
16978
  * answer: a camera that could not be asked is not a camera that was silenced. */
@@ -17006,6 +17813,12 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
17006
17813
  kind: "mutation",
17007
17814
  auth: "admin"
17008
17815
  });
17816
+ var HUB_ADDRESS_ROLES = [
17817
+ "appConnections",
17818
+ "notificationTaps",
17819
+ "internal",
17820
+ "publicEndpoint"
17821
+ ];
17009
17822
  /**
17010
17823
  * Transport bounds for AI capability methods.
17011
17824
  *
@@ -17853,7 +18666,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17853
18666
  icon: string().optional(),
17854
18667
  /** Addon-owned HTTP route the button navigates to (GET). */
17855
18668
  startUrl: string(),
17856
- stage: LoginStageEnum
18669
+ stage: LoginStageEnum,
18670
+ /**
18671
+ * The provider names an external identity a signed-in user can link to
18672
+ * their own account (D782): `auth.listLinkableProviders` /
18673
+ * `beginExternalLink` offer exactly the redirect methods that set this,
18674
+ * whatever their id. Absent / false — a login button only (magic-link).
18675
+ */
18676
+ linkable: boolean().optional()
17857
18677
  }),
17858
18678
  object({
17859
18679
  kind: literal("widget"),
@@ -18789,6 +19609,51 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
18789
19609
  kind: "mutation",
18790
19610
  auth: "admin"
18791
19611
  });
19612
+ new Set([
19613
+ {
19614
+ id: "person",
19615
+ name: "Person"
19616
+ },
19617
+ {
19618
+ id: "vehicle",
19619
+ name: "Vehicle"
19620
+ },
19621
+ {
19622
+ id: "animal",
19623
+ name: "Animal"
19624
+ },
19625
+ {
19626
+ id: "package",
19627
+ name: "Package"
19628
+ }
19629
+ ].map((l) => l.id));
19630
+ var COCO_TO_MACRO = {
19631
+ mapping: {
19632
+ person: "person",
19633
+ bicycle: "vehicle",
19634
+ car: "vehicle",
19635
+ motorcycle: "vehicle",
19636
+ airplane: "vehicle",
19637
+ bus: "vehicle",
19638
+ train: "vehicle",
19639
+ truck: "vehicle",
19640
+ boat: "vehicle",
19641
+ bird: "animal",
19642
+ cat: "animal",
19643
+ dog: "animal",
19644
+ horse: "animal",
19645
+ sheep: "animal",
19646
+ cow: "animal",
19647
+ elephant: "animal",
19648
+ bear: "animal",
19649
+ zebra: "animal",
19650
+ giraffe: "animal",
19651
+ suitcase: "package",
19652
+ backpack: "package",
19653
+ handbag: "package"
19654
+ },
19655
+ preserveOriginal: false
19656
+ };
18792
19657
  var AUDIO_MACRO_LABELS = [
18793
19658
  {
18794
19659
  id: "speech",
@@ -21191,7 +22056,13 @@ var NcAlarmModeDelaysListSchema = array(object({
21191
22056
  * Absent = false (logged, not sent). Even when true it is not sent when that same sensor
21192
22057
  * is the one that starts the entry delay — the entry-delay notification already names it.
21193
22058
  */
21194
- notifySensorRewatched: boolean().optional()
22059
+ notifySensorRewatched: boolean().optional(),
22060
+ /**
22061
+ * D735: notify "ignored" when a sensor this arm bypassed really MOVED while armed (its own
22062
+ * change time is after the arm) and set nothing off. Absent = false (logged, not sent). A
22063
+ * re-sync, a recovery from `unavailable` or a duplicate is never announced, switch or not.
22064
+ */
22065
+ notifySensorIgnored: boolean().optional()
21195
22066
  })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
21196
22067
  var NcAlarmModeDelaysEditListSchema = array(object({
21197
22068
  mode: AlarmArmModeSchema,
@@ -21204,7 +22075,9 @@ var NcAlarmModeDelaysEditListSchema = array(object({
21204
22075
  /** D706: set the switch, or `null` to clear it (back to the default, false). */
21205
22076
  notifyDuringEntryDelay: boolean().nullable().optional(),
21206
22077
  /** D706: set the switch, or `null` to clear it (back to the default, false). */
21207
- notifySensorRewatched: boolean().nullable().optional()
22078
+ notifySensorRewatched: boolean().nullable().optional(),
22079
+ /** D735: set the switch, or `null` to clear it (back to the default, false). */
22080
+ notifySensorIgnored: boolean().nullable().optional()
21208
22081
  })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
21209
22082
  /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
21210
22083
  var NcAlarmNonBlockingEditSchema = object({
@@ -22182,8 +23055,8 @@ Object.freeze(Object.fromEntries([{
22182
23055
  var CLUSTER_STEP_SETTING_FIELDS = [{
22183
23056
  stepId: "face-embedding",
22184
23057
  key: "minLandmarkFaceSize",
22185
- label: "Min face size for recognition (detection px)",
22186
- 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.",
23058
+ label: "Min face size to embed (detection-frame px)",
23059
+ 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.",
22187
23060
  type: "slider",
22188
23061
  min: 0,
22189
23062
  max: 64,
@@ -23156,8 +24029,23 @@ var RetrainMacroClassSchema = _enum([
23156
24029
  ]);
23157
24030
  /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
23158
24031
  var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
23159
- /** Did a human draw this box, or did the assist propose it? */
23160
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
24032
+ /**
24033
+ * Where a box came from. A machine-sourced box is a DRAFT on the page until
24034
+ * the operator confirms it; once saved it keeps its source as provenance.
24035
+ *
24036
+ * - `operator` — drawn by hand.
24037
+ * - `assist` — proposed by a detector run on the copy (the camera's own
24038
+ * model, or a larger teacher model).
24039
+ * - `pipeline` — the box the live pipeline actually drew on that frame, read
24040
+ * back from the track store (never a re-run).
24041
+ * - `llm` — proposed by a vision-capable LLM profile.
24042
+ */
24043
+ var RetrainAnnotationSourceSchema = _enum([
24044
+ "operator",
24045
+ "assist",
24046
+ "pipeline",
24047
+ "llm"
24048
+ ]);
23161
24049
  /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
23162
24050
  var RetrainBboxSchema = object({
23163
24051
  x: number(),
@@ -23175,7 +24063,8 @@ var RetrainBboxSchema = object({
23175
24063
  */
23176
24064
  var RetrainAnnotationSchema = object({
23177
24065
  id: string(),
23178
- trackId: string(),
24066
+ /** The frame's track. Absent on a recording still, which has none. */
24067
+ trackId: string().optional(),
23179
24068
  deviceId: number(),
23180
24069
  /** The COPY in retrain storage — never the source track's media key. */
23181
24070
  mediaKey: string(),
@@ -23224,18 +24113,63 @@ var RetrainFrameCandidateSchema = object({
23224
24113
  * fail, whatever became of the original. */
23225
24114
  copied: boolean()
23226
24115
  });
24116
+ /**
24117
+ * One box the live pipeline drew on a copied frame — what a correction starts
24118
+ * from. Derived when the frame is listed, from the track store: the subject
24119
+ * box recorded on the source media row when there is one, else the track
24120
+ * position nearest the frame's capture time. Never stored as an annotation
24121
+ * until the operator confirms it.
24122
+ */
24123
+ var RetrainPipelineBoxSchema = object({
24124
+ /** Normalised `[0,1]` against the full frame. */
24125
+ bbox: RetrainBboxSchema,
24126
+ macroClass: RetrainMacroClassSchema,
24127
+ label: string().optional(),
24128
+ subLabel: string().optional(),
24129
+ /** The detection score of the position used, when it was recorded. */
24130
+ score: number().optional(),
24131
+ /** The root model that produced the track, when it was recorded. */
24132
+ modelId: string().optional(),
24133
+ trackId: string(),
24134
+ /** `subject-box`: recorded on this very frame. `position`: the track's
24135
+ * position nearest the capture time, `deltaMs` away. */
24136
+ basis: _enum(["subject-box", "position"]),
24137
+ deltaMs: number()
24138
+ });
24139
+ /**
24140
+ * Where a retrain frame came from: a TRACK's stored media (copy-on-select),
24141
+ * or the RECORDING at an instant — the frame a model saw nothing in has no
24142
+ * track at all.
24143
+ */
24144
+ var RetrainFrameOriginSchema = _enum(["track", "recording"]);
23227
24145
  /** A frame the dataset OWNS: bytes copied at selection time. */
23228
24146
  var RetrainFrameSchema = object({
23229
24147
  frameId: string(),
23230
24148
  deviceId: number(),
23231
- trackId: string(),
23232
- /** Provenance only. It may already point at nothing — that is expected. */
23233
- sourceMediaId: number().int(),
24149
+ origin: RetrainFrameOriginSchema,
24150
+ /** The track it was copied from. Absent on a recording still. */
24151
+ trackId: string().optional(),
24152
+ /** Provenance only. It may already point at nothing — that is expected.
24153
+ * Absent on a recording still. */
24154
+ sourceMediaId: number().int().optional(),
24155
+ /** A recording still: the playhead instant it was taken at. */
24156
+ epochMs: number().optional(),
23234
24157
  sourceKind: MediaFileKindEnum,
23235
24158
  sizeBytes: number().int(),
23236
24159
  width: number().int(),
23237
24160
  height: number().int(),
23238
- copiedAt: number()
24161
+ copiedAt: number(),
24162
+ /** When the CAMERA captured the frame. Absent on a copy taken before D785. */
24163
+ capturedAt: number().optional(),
24164
+ /** The operator's "every subject in this frame is boxed". Detector
24165
+ * evaluation keeps only complete frames: an unboxed subject would count as
24166
+ * a false positive. */
24167
+ complete: boolean(),
24168
+ /** The boxes the pipeline drew on this frame. Present on list answers;
24169
+ * empty when nothing the track store holds can be placed on it. */
24170
+ pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
24171
+ /** The named collections this frame belongs to. Present on list answers. */
24172
+ collectionIds: array(string()).readonly().optional()
23239
24173
  });
23240
24174
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
23241
24175
  var RetrainCopyRefusalSchema = _enum([
@@ -23256,6 +24190,53 @@ var RetrainFrameListSchema = object({
23256
24190
  /** What the page pre-selects — the native key frame when one survives. */
23257
24191
  autoPickMediaId: number().int().optional()
23258
24192
  });
24193
+ /**
24194
+ * Which frames an annotated export carries. Every field narrows; an empty
24195
+ * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
24196
+ * list owned by whoever trains (the training orchestrator), so `frameIds` is
24197
+ * the primitive a version export uses; `batchId` re-selects what an earlier
24198
+ * export carried (`exportedInBatch`).
24199
+ */
24200
+ var RetrainExportFilterSchema = object({
24201
+ deviceIds: array(number()).optional(),
24202
+ frameIds: array(string()).max(2e4).optional(),
24203
+ /** Only frames in at least one of these named collections. */
24204
+ collectionIds: array(string()).max(200).optional(),
24205
+ batchId: string().optional(),
24206
+ /** Only frames the operator marked complete (all subjects boxed). */
24207
+ completeOnly: boolean().optional()
24208
+ });
24209
+ /**
24210
+ * `frames`: the full frame copies, boxes in `annotations.json`.
24211
+ * `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
24212
+ * convention — the classifier layout.
24213
+ */
24214
+ var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
24215
+ /**
24216
+ * Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
24217
+ * the archive, sent chunk by chunk. Covers a presigned PUT and a provider
24218
+ * addon's data-plane upload route alike. Headers are sent verbatim and never
24219
+ * logged.
24220
+ */
24221
+ var RetrainArchiveTargetSchema = object({
24222
+ kind: literal("http"),
24223
+ method: _enum(["PUT", "POST"]),
24224
+ url: string().url(),
24225
+ headers: record(string(), string()).optional()
24226
+ });
24227
+ var RetrainArchiveResultSchema = object({
24228
+ batchId: string(),
24229
+ frames: number().int(),
24230
+ crops: number().int(),
24231
+ annotations: number().int(),
24232
+ /** Frames planned but not shipped (unreadable copy, path too long). */
24233
+ missing: number().int(),
24234
+ bytes: number().int(),
24235
+ /** sha256 of the exact bytes sent. */
24236
+ sha256: string(),
24237
+ /** The target's HTTP status. */
24238
+ status: number().int()
24239
+ });
23259
24240
  /** What the operator asked the assist to look for. */
23260
24241
  var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
23261
24242
  kind: literal("package"),
@@ -23285,6 +24266,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
23285
24266
  reason: string(),
23286
24267
  detail: string().optional()
23287
24268
  })]);
24269
+ /** A named set over the retrain corpus — membership only, it owns no pixels. */
24270
+ var RetrainCollectionSchema = object({
24271
+ id: string(),
24272
+ name: string(),
24273
+ createdAt: number(),
24274
+ frameCount: number().int()
24275
+ });
24276
+ var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
24277
+ kind: literal("created"),
24278
+ collection: RetrainCollectionSchema
24279
+ }), object({
24280
+ kind: literal("refused"),
24281
+ reason: _enum(["empty-name", "duplicate-name"])
24282
+ })]);
24283
+ var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
24284
+ kind: literal("renamed"),
24285
+ collection: RetrainCollectionSchema
24286
+ }), object({
24287
+ kind: literal("refused"),
24288
+ reason: _enum([
24289
+ "empty-name",
24290
+ "duplicate-name",
24291
+ "unknown-collection"
24292
+ ])
24293
+ })]);
24294
+ /**
24295
+ * The outcome of adding the frame at a recording instant. Every refusal is
24296
+ * named: `still-unavailable` (not recording, a gap, or an undecodable frame —
24297
+ * `detail` says which), `still-busy` (the recorder is at its decode bound; try
24298
+ * again), `unreadable-image`, `write-failed`, `unknown-collection`.
24299
+ */
24300
+ var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
24301
+ kind: literal("added"),
24302
+ collectionId: string(),
24303
+ frame: RetrainFrameSchema,
24304
+ /** The moment was already in the dataset; nothing was decoded. */
24305
+ reused: boolean()
24306
+ }), object({
24307
+ kind: literal("refused"),
24308
+ reason: _enum([
24309
+ "unknown-collection",
24310
+ "still-unavailable",
24311
+ "still-busy",
24312
+ "unreadable-image",
24313
+ "write-failed"
24314
+ ]),
24315
+ detail: string().optional()
24316
+ })]);
24317
+ /** A vision LLM profile the AI assist may use, and where it sends the frame. */
24318
+ var RetrainAssistProfileSchema = object({
24319
+ id: string(),
24320
+ name: string(),
24321
+ model: string(),
24322
+ kind: string(),
24323
+ /** `true` when the frame would leave the house (a cloud vendor, or an
24324
+ * endpoint that is not on the local network). The page confirms each such
24325
+ * run, and the provider refuses one without `allowCloud`. */
24326
+ leavesHouse: boolean()
24327
+ });
24328
+ /** A box the AI assist proposed: a draft, plus the model's own reason. */
24329
+ var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
24330
+ /** What the AI assist said about a box that was already on the canvas. */
24331
+ var RetrainLlmReviewSchema = object({
24332
+ /** The `ref` the page sent the box under. */
24333
+ ref: string(),
24334
+ verdict: _enum([
24335
+ "confirmed",
24336
+ "wrong-class",
24337
+ "not-an-object",
24338
+ "uncertain"
24339
+ ]),
24340
+ suggestedClass: RetrainMacroClassSchema.optional(),
24341
+ reason: string()
24342
+ });
24343
+ /**
24344
+ * The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
24345
+ * model and its confidence) and reviews; items the model got wrong (a box off
24346
+ * the frame, an unasked class, an unknown ref) are dropped and counted in
24347
+ * `rejected`. A whole answer that is not the schema is `malformed-answer`.
24348
+ */
24349
+ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
24350
+ kind: literal("proposed"),
24351
+ profileId: string(),
24352
+ model: string(),
24353
+ /** The frame was sent outside the house for this answer. */
24354
+ leftHouse: boolean(),
24355
+ proposals: array(RetrainLlmProposalSchema).readonly(),
24356
+ reviews: array(RetrainLlmReviewSchema).readonly(),
24357
+ rejected: number().int()
24358
+ }), object({
24359
+ kind: literal("refused"),
24360
+ reason: _enum([
24361
+ "unknown-frame",
24362
+ "unreadable-frame",
24363
+ "unknown-profile",
24364
+ "profile-disabled",
24365
+ "no-vision",
24366
+ "cloud-not-confirmed",
24367
+ "llm-error",
24368
+ "malformed-answer"
24369
+ ]),
24370
+ detail: string().optional()
24371
+ })]);
23288
24372
  /** The outcome of a lifecycle move owned by the retrain page. */
23289
24373
  var RetrainTransitionResultSchema = object({
23290
24374
  trackId: string(),
@@ -24002,7 +25086,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24002
25086
  auth: "admin"
24003
25087
  }), method(object({
24004
25088
  deviceId: number(),
24005
- trackId: string(),
25089
+ trackId: string().optional(),
24006
25090
  frameId: string()
24007
25091
  }), object({
24008
25092
  removed: boolean(),
@@ -24019,7 +25103,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24019
25103
  auth: "admin"
24020
25104
  }), method(object({
24021
25105
  deviceId: number(),
24022
- trackId: string(),
25106
+ /** The frame's track, when it has one — checked against the frame. */
25107
+ trackId: string().optional(),
24023
25108
  frameId: string(),
24024
25109
  subject: RetrainAssistSubjectSchema,
24025
25110
  /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
@@ -24027,12 +25112,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24027
25112
  }), RetrainAssistResultSchema, {
24028
25113
  kind: "mutation",
24029
25114
  auth: "admin"
24030
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
25115
+ }), method(object({
25116
+ trackId: string().optional(),
25117
+ frameIds: array(string()).max(2e3).optional()
25118
+ }), array(RetrainAnnotationSchema).readonly(), {
24031
25119
  kind: "query",
24032
25120
  auth: "admin"
24033
25121
  }), method(object({
24034
25122
  deviceId: number(),
24035
- trackId: string(),
25123
+ /** The frame's track, when it has one — checked against the frame. */
25124
+ trackId: string().optional(),
24036
25125
  frameId: string(),
24037
25126
  annotations: array(RetrainAnnotationDraftSchema)
24038
25127
  }), array(RetrainAnnotationSchema).readonly(), {
@@ -24050,7 +25139,91 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24050
25139
  }), RetrainTransitionResultSchema, {
24051
25140
  kind: "mutation",
24052
25141
  auth: "admin"
24053
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
25142
+ }), method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string() }), {
25143
+ kind: "query",
25144
+ auth: "admin"
25145
+ }), method(object({
25146
+ deviceId: number(),
25147
+ trackId: string().optional(),
25148
+ frameId: string(),
25149
+ complete: boolean()
25150
+ }), RetrainFrameSchema, {
25151
+ kind: "mutation",
25152
+ auth: "admin"
25153
+ }), method(object({
25154
+ filter: RetrainExportFilterSchema,
25155
+ layout: RetrainExportLayoutSchema,
25156
+ target: RetrainArchiveTargetSchema
25157
+ }), RetrainArchiveResultSchema, {
25158
+ kind: "mutation",
25159
+ auth: "admin",
25160
+ timeoutMs: 60 * 6e4
25161
+ }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
25162
+ kind: "query",
25163
+ auth: "admin"
25164
+ }), method(object({
25165
+ deviceId: number(),
25166
+ trackId: string().optional(),
25167
+ frameId: string(),
25168
+ profileId: string(),
25169
+ classes: array(RetrainMacroClassSchema).min(1),
25170
+ boxes: array(object({
25171
+ ref: string(),
25172
+ bbox: RetrainBboxSchema,
25173
+ macroClass: RetrainMacroClassSchema,
25174
+ label: string().optional()
25175
+ })).max(50),
25176
+ allowCloud: boolean()
25177
+ }), RetrainLlmAssistResultSchema, {
25178
+ kind: "mutation",
25179
+ auth: "admin",
25180
+ timeoutMs: 18e4
25181
+ }), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
25182
+ kind: "mutation",
25183
+ auth: "admin"
25184
+ }), method(object({}), array(RetrainCollectionSchema).readonly(), {
25185
+ kind: "query",
25186
+ auth: "admin"
25187
+ }), method(object({
25188
+ id: string(),
25189
+ name: string().max(120)
25190
+ }), RetrainCollectionRenameResultSchema, {
25191
+ kind: "mutation",
25192
+ auth: "admin"
25193
+ }), method(object({ id: string() }), object({
25194
+ deleted: boolean(),
25195
+ removedFrames: number().int()
25196
+ }), {
25197
+ kind: "mutation",
25198
+ auth: "admin"
25199
+ }), method(object({
25200
+ collectionId: string(),
25201
+ deviceId: number(),
25202
+ epochMs: number()
25203
+ }), AddRetrainFrameFromRecordingResultSchema, {
25204
+ kind: "mutation",
25205
+ auth: "admin",
25206
+ timeoutMs: 6e4
25207
+ }), method(object({
25208
+ collectionId: string(),
25209
+ frameIds: array(string()).min(1).max(500)
25210
+ }), object({
25211
+ added: number().int(),
25212
+ alreadyMember: number().int(),
25213
+ unknownFrameIds: array(string()).readonly()
25214
+ }), {
25215
+ kind: "mutation",
25216
+ auth: "admin"
25217
+ }), method(object({
25218
+ collectionId: string(),
25219
+ frameId: string()
25220
+ }), object({
25221
+ removed: boolean(),
25222
+ deletedFrame: boolean()
25223
+ }), {
25224
+ kind: "mutation",
25225
+ auth: "admin"
25226
+ }), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
24054
25227
  kind: "query",
24055
25228
  auth: "admin"
24056
25229
  }), method(object({
@@ -24103,6 +25276,34 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
24103
25276
  timestamp: number()
24104
25277
  });
24105
25278
  /**
25279
+ * A root model's boxes standing in for one crop-kind step's own inference
25280
+ * (D730) — see `runPipeline.suppliedRoot`.
25281
+ */
25282
+ var SuppliedRootOutputSchema = object({
25283
+ stepId: string(),
25284
+ /** The root model that drew the boxes — stamped on the result. */
25285
+ modelId: string(),
25286
+ detections: array(object({
25287
+ /** `[x1, y1, x2, y2]` in the pixels of the call's image. */
25288
+ bbox: tuple([
25289
+ number(),
25290
+ number(),
25291
+ number(),
25292
+ number()
25293
+ ]),
25294
+ score: number(),
25295
+ /**
25296
+ * Five facial landmarks in the same pixels — a face the step's own
25297
+ * detector already re-found inside a root face box (D730), so its
25298
+ * embedder child aligns it exactly as it aligns any detected face.
25299
+ */
25300
+ landmarks: array(object({
25301
+ x: number(),
25302
+ y: number()
25303
+ })).optional()
25304
+ })).min(1)
25305
+ });
25306
+ /**
24106
25307
  * Reference to the frame's retained NATIVE surface + the parent crop's placement
24107
25308
  * within the frame, so the executor can re-cut a leaf child ROI at native
24108
25309
  * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
@@ -24150,7 +25351,7 @@ var FrameRefSchema = object({
24150
25351
  timestamp: number(),
24151
25352
  capturedAt: number().optional()
24152
25353
  });
24153
- var ModelFormatSchema$1 = _enum([
25354
+ var ModelFormatSchema$2 = _enum([
24154
25355
  "onnx",
24155
25356
  "coreml",
24156
25357
  "openvino",
@@ -24168,7 +25369,7 @@ var PipelineSlotSchema = _enum([
24168
25369
  var PipelineEngineChoiceSchema = object({
24169
25370
  runtime: literal("python"),
24170
25371
  backend: string(),
24171
- format: ModelFormatSchema$1,
25372
+ format: ModelFormatSchema$2,
24172
25373
  device: string().optional()
24173
25374
  });
24174
25375
  /**
@@ -24207,33 +25408,15 @@ var PipelineDefaultStepSchema = lazy(() => object({
24207
25408
  group: string().optional(),
24208
25409
  settings: record(string(), unknown()).optional()
24209
25410
  }));
24210
- var PipelineTemplateStepSchema = lazy(() => object({
24211
- addonId: string(),
24212
- enabled: boolean(),
24213
- modelId: string(),
24214
- children: array(PipelineTemplateStepSchema).readonly(),
24215
- settings: record(string(), unknown()).optional()
24216
- }));
24217
- var PipelineTemplateSchema$1 = object({
24218
- id: string(),
24219
- name: string(),
24220
- createdAt: string(),
24221
- updatedAt: string(),
24222
- engine: PipelineEngineChoiceSchema,
24223
- steps: array(PipelineTemplateStepSchema).readonly()
24224
- });
24225
25411
  var PipelineModelOptionSchema = object({
24226
25412
  id: string(),
24227
25413
  name: string(),
24228
- formats: record(string(), object({
24229
- downloaded: boolean(),
24230
- sizeMB: number()
24231
- })),
25414
+ formats: record(string(), PipelineModelFormatStatusSchema),
24232
25415
  group: ModelVariantGroupSchema.optional(),
24233
25416
  legacy: boolean().optional(),
24234
25417
  provider: ModelProviderIdSchema.optional(),
24235
25418
  defaultConfidence: number().optional(),
24236
- fillsClassifierEffects: array(FillsClassifierEffectSchema).readonly().optional()
25419
+ suppliesSteps: array(RootStepSupplySchema).readonly().optional()
24237
25420
  });
24238
25421
  var ConfigFieldBridge = custom();
24239
25422
  var PipelineAddonSchemaSchema = object({
@@ -24395,6 +25578,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
24395
25578
  }), {
24396
25579
  kind: "mutation",
24397
25580
  auth: "admin"
25581
+ }), method(object({
25582
+ nodeId: string(),
25583
+ deviceIds: array(number()).readonly().optional(),
25584
+ dryRun: boolean()
25585
+ }), object({
25586
+ entries: array(object({
25587
+ deviceId: number(),
25588
+ keys: array(string()).readonly()
25589
+ })).readonly(),
25590
+ refused: array(object({
25591
+ deviceId: number(),
25592
+ reason: string()
25593
+ })).readonly()
25594
+ }), {
25595
+ kind: "mutation",
25596
+ auth: "admin"
24398
25597
  }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
24399
25598
  /** `<backend>:<device>`, e.g. `openvino:gpu`. */
24400
25599
  deviceKey: string(),
@@ -24420,22 +25619,14 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
24420
25619
  }), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(object({
24421
25620
  steps: array(PipelineStepInputSchema),
24422
25621
  deviceKey: string().optional()
24423
- }), PipelineValidationResultSchema), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
24424
- name: string(),
24425
- steps: array(PipelineTemplateStepSchema).readonly(),
24426
- engine: PipelineEngineChoiceSchema
24427
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
24428
- id: string(),
24429
- name: string().optional(),
24430
- steps: array(PipelineTemplateStepSchema).readonly().optional()
24431
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
25622
+ }), PipelineValidationResultSchema), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
24432
25623
  addonId: string(),
24433
25624
  modelId: string(),
24434
- format: ModelFormatSchema$1
25625
+ format: ModelFormatSchema$2
24435
25626
  }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
24436
25627
  addonId: string(),
24437
25628
  modelId: string(),
24438
- format: ModelFormatSchema$1
25629
+ format: ModelFormatSchema$2
24439
25630
  }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
24440
25631
  steps: array(PipelineStepInputSchema).min(1),
24441
25632
  frame: FrameInputSchema.optional(),
@@ -24501,7 +25692,16 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
24501
25692
  * `device-not-servable`), and nothing reaches the camera's live
24502
25693
  * trace stream. Absent ⇒ unchanged behaviour.
24503
25694
  */
24504
- replay: literal(true).optional()
25695
+ replay: literal(true).optional(),
25696
+ /**
25697
+ * Root-supplied detections for the tree's ROOT step (D730). Set by
25698
+ * `runDetailSubtree` when the camera's root model supplies a crop-kind
25699
+ * step (a Frigate+ `license_plate` for `plate-detection`): the step is
25700
+ * NOT inferred, these boxes are its output, and its children (the plate
25701
+ * reader) run on them through their own crop policy. Boxes are in the
25702
+ * PIXELS of the image this call carries. Absent ⇒ the root step runs.
25703
+ */
25704
+ suppliedRoot: SuppliedRootOutputSchema.optional()
24505
25705
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
24506
25706
  steps: array(PipelineStepInputSchema).min(1),
24507
25707
  frames: array(FrameInputSchema).min(1).max(255),
@@ -24583,6 +25783,763 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
24583
25783
  filename: string().optional(),
24584
25784
  settings: record(string(), unknown()).optional()
24585
25785
  }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
25786
+ /**
25787
+ * The wire shapes of the Auto tune plan and apply (D745), used by the
25788
+ * `pipeline-orchestrator` cap. The recommender's own types
25789
+ * (`recommend.ts`) are the TS face of the same data; these
25790
+ * schemas are what crosses the cap boundary.
25791
+ */
25792
+ var ModelFormatSchema$1 = _enum(MODEL_FORMATS);
25793
+ /** The operator's range for it. */
25794
+ var MIN_SESSIONS_PER_DEVICE_RANGE = {
25795
+ min: 1,
25796
+ max: 8
25797
+ };
25798
+ var HardwareClassIdSchema = _enum([
25799
+ "intel-core-ultra",
25800
+ "intel-n-series",
25801
+ "apple-m-base",
25802
+ "apple-m-pro",
25803
+ "unknown"
25804
+ ]);
25805
+ var AcceleratorKindSchema = _enum([
25806
+ "intel-npu",
25807
+ "intel-igpu",
25808
+ "x86-cpu",
25809
+ "arm-cpu",
25810
+ "apple-ane",
25811
+ "coral"
25812
+ ]);
25813
+ var RecommendationReasonSchema = discriminatedUnion("kind", [
25814
+ object({
25815
+ kind: literal("capacity"),
25816
+ sessions: number(),
25817
+ minSessions: number()
25818
+ }),
25819
+ object({
25820
+ kind: literal("tie-faster"),
25821
+ over: string(),
25822
+ recallDelta: number()
25823
+ }),
25824
+ object({
25825
+ kind: literal("stepped-down"),
25826
+ from: string(),
25827
+ to: string(),
25828
+ limitedBy: string()
25829
+ }),
25830
+ object({
25831
+ kind: literal("no-fit-lightest"),
25832
+ sessions: number(),
25833
+ minSessions: number()
25834
+ }),
25835
+ object({
25836
+ kind: literal("derived-latency"),
25837
+ modelId: string()
25838
+ }),
25839
+ object({ kind: literal("cpu-device") }),
25840
+ object({ kind: literal("coral-untouched") }),
25841
+ object({ kind: literal("device-disabled") }),
25842
+ object({ kind: literal("device-unavailable") }),
25843
+ object({ kind: literal("node-offline") }),
25844
+ object({ kind: literal("no-hardware-facts") }),
25845
+ object({
25846
+ kind: literal("no-measured-data"),
25847
+ hardwareClass: HardwareClassIdSchema
25848
+ }),
25849
+ object({
25850
+ kind: literal("no-family-build"),
25851
+ format: ModelFormatSchema$1
25852
+ }),
25853
+ object({
25854
+ kind: literal("kept-custom-pin"),
25855
+ modelId: string(),
25856
+ deviceKey: string()
25857
+ })
25858
+ ]);
25859
+ /** Why a device is left exactly as it is, whatever the plan would pick (D786). */
25860
+ var KeptReasonSchema = _enum(["custom-pin"]);
25861
+ /**
25862
+ * Where a choice's latency came from (D791): this node's own benchmark
25863
+ * result, or the hardware-class table. Measured on the node beats the table.
25864
+ */
25865
+ var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
25866
+ kind: literal("node-benchmark"),
25867
+ resultId: string(),
25868
+ measuredAtMs: number()
25869
+ })]);
25870
+ var DeviceModelChoiceSchema = object({
25871
+ modelId: string(),
25872
+ p50Ms: number(),
25873
+ fps: number(),
25874
+ measured: boolean(),
25875
+ /** Absent on a plan from before D791 — read as the table. */
25876
+ source: LatencySourceSchema.optional(),
25877
+ /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
25878
+ capacitySessions: number(),
25879
+ personRecall: number()
25880
+ });
25881
+ var DeviceRecommendationSchema = object({
25882
+ deviceKey: string(),
25883
+ accelerator: AcceleratorKindSchema.nullable(),
25884
+ enabled: boolean(),
25885
+ available: boolean(),
25886
+ chosen: DeviceModelChoiceSchema.nullable(),
25887
+ /** Present when the device is kept as is: Apply writes nothing on it. */
25888
+ kept: KeptReasonSchema.optional(),
25889
+ reasons: array(RecommendationReasonSchema).readonly()
25890
+ });
25891
+ var NodeRecommendationSchema = object({
25892
+ nodeId: string(),
25893
+ reachable: boolean(),
25894
+ hardwareClass: HardwareClassIdSchema.nullable(),
25895
+ cpuModel: string().nullable(),
25896
+ skipped: boolean(),
25897
+ acceleratorModelId: string().nullable(),
25898
+ devices: array(DeviceRecommendationSchema).readonly(),
25899
+ reasons: array(RecommendationReasonSchema).readonly()
25900
+ });
25901
+ var ModelPinChangeSchema = object({
25902
+ stepId: string(),
25903
+ before: string().nullable(),
25904
+ after: string().nullable()
25905
+ });
25906
+ var NodeDeviceChangeSchema = object({
25907
+ nodeId: string(),
25908
+ deviceKey: string(),
25909
+ madeExplicit: boolean(),
25910
+ modelPins: array(ModelPinChangeSchema).readonly(),
25911
+ thresholds: array(object({
25912
+ stepId: string(),
25913
+ keys: array(string()).readonly()
25914
+ })).readonly()
25915
+ });
25916
+ var CameraOverrideClearSchema = object({
25917
+ deviceId: number(),
25918
+ source: _enum(["step-override", "wholesale"]),
25919
+ nodeId: string(),
25920
+ deviceKey: string().nullable(),
25921
+ stepId: string(),
25922
+ modelIdBefore: string().nullable(),
25923
+ keys: array(string()).readonly()
25924
+ });
25925
+ var DetectorStoreClearSchema = object({
25926
+ deviceId: number(),
25927
+ keys: array(string()).readonly()
25928
+ });
25929
+ var AutoTuneWarningSchema = discriminatedUnion("kind", [
25930
+ object({
25931
+ kind: literal("detector-store-cluster-wide"),
25932
+ skippedNodes: array(string()).readonly()
25933
+ }),
25934
+ object({
25935
+ kind: literal("detector-store-unreadable"),
25936
+ error: string()
25937
+ }),
25938
+ object({
25939
+ kind: literal("coral-enabled"),
25940
+ nodeId: string(),
25941
+ deviceKey: string()
25942
+ }),
25943
+ object({
25944
+ kind: literal("custom-pin-kept"),
25945
+ nodeId: string(),
25946
+ deviceKey: string().nullable(),
25947
+ deviceId: number().nullable(),
25948
+ modelId: string()
25949
+ }),
25950
+ object({
25951
+ kind: literal("custom-registry-unreadable"),
25952
+ error: string()
25953
+ })
25954
+ ]);
25955
+ var AutoTuneOptionsSchema = object({
25956
+ /** Share of each accelerator's throughput kept free (0.3–0.5). */
25957
+ headroom: number().min(.3).max(.5).default(.4),
25958
+ /**
25959
+ * The least number of parallel sessions every device must sustain at the
25960
+ * camera rate with the headroom kept free (D755). The most accurate model
25961
+ * that reaches it wins.
25962
+ */
25963
+ minSessionsPerDevice: number().int().min(MIN_SESSIONS_PER_DEVICE_RANGE.min).max(MIN_SESSIONS_PER_DEVICE_RANGE.max).default(2)
25964
+ });
25965
+ var AutoTunePlanSchema = object({
25966
+ /** Hash of everything the apply will write — the apply refuses a different one. */
25967
+ planHash: string(),
25968
+ family: literal("yolov9"),
25969
+ headroom: number(),
25970
+ minSessionsPerDevice: number(),
25971
+ /** The detection rate a session is counted at (the fastest camera running the pipeline root). */
25972
+ cameraFps: number(),
25973
+ generatedAt: number(),
25974
+ nodes: array(NodeRecommendationSchema).readonly(),
25975
+ nodeChanges: array(NodeDeviceChangeSchema).readonly(),
25976
+ cameraClears: array(CameraOverrideClearSchema).readonly(),
25977
+ detectorStoreClears: array(DetectorStoreClearSchema).readonly(),
25978
+ warnings: array(AutoTuneWarningSchema).readonly()
25979
+ });
25980
+ var AutoTuneApplyInputSchema = object({
25981
+ planHash: string(),
25982
+ headroom: number().min(.3).max(.5).default(.4),
25983
+ minSessionsPerDevice: number().int().min(MIN_SESSIONS_PER_DEVICE_RANGE.min).max(MIN_SESSIONS_PER_DEVICE_RANGE.max).default(2)
25984
+ });
25985
+ var AutoTunePhaseResultSchema = object({
25986
+ phase: _enum([
25987
+ "download",
25988
+ "camera-overrides",
25989
+ "detector-thresholds",
25990
+ "node-models",
25991
+ "redispatch"
25992
+ ]),
25993
+ ok: boolean(),
25994
+ detail: string()
25995
+ });
25996
+ var AutoTuneApplyResultSchema = discriminatedUnion("kind", [
25997
+ object({
25998
+ kind: literal("applied"),
25999
+ planHash: string(),
26000
+ phases: array(AutoTunePhaseResultSchema).readonly()
26001
+ }),
26002
+ object({
26003
+ kind: literal("aborted"),
26004
+ phases: array(AutoTunePhaseResultSchema).readonly()
26005
+ }),
26006
+ object({
26007
+ kind: literal("stale"),
26008
+ plan: AutoTunePlanSchema
26009
+ }),
26010
+ object({
26011
+ kind: literal("refused"),
26012
+ reason: _enum(["apply-in-progress"])
26013
+ })
26014
+ ]);
26015
+ /**
26016
+ * Wire shapes of the Load balancing surface (D748): the session placement
26017
+ * policy, the atomic share write, the observed placement statistics, the
26018
+ * hardware share suggestion and the stale device pins.
26019
+ */
26020
+ /**
26021
+ * How a new detection session picks its node and device.
26022
+ * - `least-loaded` — the historical rule: lowest `attached / weight`, a
26023
+ * constant node order at a tie (D37). An idle node always ties at 0, so a
26024
+ * weight only bites once a node already holds a session.
26025
+ * - `share` — the share of PARALLEL sessions is held to the weights, and a
26026
+ * full or drowning node yields to a free one (D748).
26027
+ */
26028
+ var SessionPlacementPolicySchema = _enum(["least-loaded", "share"]);
26029
+ var LoadBalancingSharesInputSchema = object({
26030
+ /** nodeId → share (> 0). A node left out keeps its weight. */
26031
+ nodes: record(string(), number().positive()).default({}),
26032
+ /** nodeId → deviceKey → share (> 0). A device left out keeps its weight. */
26033
+ devices: record(string(), record(string(), number().positive())).default({})
26034
+ });
26035
+ var PlacementStatsInputSchema = object({
26036
+ /** Window the observed shares are averaged over (default 1 h, max 24 h). */
26037
+ windowMs: number().int().min(6e4).max(1440 * 60 * 1e3).default(3600 * 1e3) });
26038
+ var PlacementDeviceStatsSchema = object({
26039
+ deviceKey: string(),
26040
+ /** Sessions running on this device now. */
26041
+ sessionsNow: number(),
26042
+ /** Sessions started on this device inside the window. */
26043
+ sessionsStarted: number(),
26044
+ /** Time-weighted share of the node's parallel sessions over the window (0–1); null = no session ran. */
26045
+ observedShare: number().nullable()
26046
+ });
26047
+ var PlacementNodeStatsSchema = object({
26048
+ nodeId: string(),
26049
+ sessionsNow: number(),
26050
+ sessionsStarted: number(),
26051
+ /** Time-weighted share of the cluster's parallel sessions over the window (0–1); null = none ran. */
26052
+ observedShare: number().nullable(),
26053
+ /** Most sessions this node ran at once inside the window. */
26054
+ peakSessions: number(),
26055
+ /** Sessions a share election handed elsewhere because this node was full or drowning. */
26056
+ yieldsAway: number(),
26057
+ devices: array(PlacementDeviceStatsSchema).readonly()
26058
+ });
26059
+ /** A camera's device pin that the session path cannot honour. */
26060
+ var StaleDevicePinSchema = object({
26061
+ deviceId: number(),
26062
+ deviceKey: string(),
26063
+ /** `disabled` — the key exists on some node but is not enabled anywhere; `absent` — no node has it. */
26064
+ reason: _enum(["disabled", "absent"])
26065
+ });
26066
+ var PlacementStatsSchema = object({
26067
+ policy: SessionPlacementPolicySchema,
26068
+ windowMs: number(),
26069
+ /** How much of the window was actually observed (the hub keeps it in memory). */
26070
+ observedForMs: number(),
26071
+ sessionsNow: number(),
26072
+ /** Most parallel sessions across the cluster inside the window. */
26073
+ clusterPeakSessions: number(),
26074
+ nodes: array(PlacementNodeStatsSchema).readonly(),
26075
+ stalePins: array(StaleDevicePinSchema).readonly()
26076
+ });
26077
+ /**
26078
+ * Where an automatic share's capacity comes from (D755).
26079
+ * - `hardware` — the static capacity of each device at its Auto tune model:
26080
+ * the measured latency table for the node's hardware class.
26081
+ * - `benchmark` — the node's own measured capacity (node benchmark results).
26082
+ * A node with no results falls back to `hardware`, and says so.
26083
+ */
26084
+ var CapacitySourceSchema = _enum(["hardware", "benchmark"]);
26085
+ /** Why a node under the `benchmark` source was sized from hardware instead. */
26086
+ var CapacityFallbackSchema = _enum(["no-benchmark-results", "partial-benchmark-results"]);
26087
+ var SuggestSharesInputSchema = object({
26088
+ headroom: number().min(.3).max(.5).default(.4),
26089
+ /** Default `hardware`. */
26090
+ source: CapacitySourceSchema.default("hardware")
26091
+ });
26092
+ var SuggestedDeviceShareSchema = object({
26093
+ deviceKey: string(),
26094
+ /** Share of the node (0–100, rounded). */
26095
+ share: number(),
26096
+ modelId: string().nullable(),
26097
+ /** Inferences per second at that model, from the measured table; null when sized by a benchmark. */
26098
+ fps: number().nullable(),
26099
+ /** False for a table cell derived from another chip; true for a measured cell or a benchmark. */
26100
+ measured: boolean(),
26101
+ /**
26102
+ * Advisory session cap: ⌊fps × (1 − headroom) / camera fps⌋ from the table,
26103
+ * or the benchmark's measured max sessions. Never enforced.
26104
+ */
26105
+ suggestedMaxSessions: number().nullable()
26106
+ });
26107
+ var SuggestedNodeShareSchema = object({
26108
+ nodeId: string(),
26109
+ /** Share of the cluster (0–100, rounded); null = node skipped (offline, unknown hardware). */
26110
+ share: number().nullable(),
26111
+ /** Parallel sessions the node sustains at the suggested models with the headroom kept free. */
26112
+ capacitySessions: number(),
26113
+ devices: array(SuggestedDeviceShareSchema).readonly(),
26114
+ skippedReason: string().nullable(),
26115
+ /** What this node's capacity was read from; null when the node is skipped. */
26116
+ capacitySource: CapacitySourceSchema.nullable(),
26117
+ /** Set when the `benchmark` source was asked for and this node used `hardware`. */
26118
+ capacityFallback: CapacityFallbackSchema.nullable()
26119
+ });
26120
+ var SuggestSharesResultSchema = object({
26121
+ headroom: number(),
26122
+ /** The source asked for; each node says what it actually used. */
26123
+ source: CapacitySourceSchema,
26124
+ /** Camera detection rate the capacity is counted in (the fastest camera's fps). */
26125
+ cameraFps: number(),
26126
+ /** The Auto tune capacity floor the models were picked at. */
26127
+ minSessionsPerDevice: number(),
26128
+ nodes: array(SuggestedNodeShareSchema).readonly()
26129
+ });
26130
+ /**
26131
+ * Where the node and device shares come from (D750, D755, D791).
26132
+ * - `benchmark` (default since D791) — each node's capacity as its own node
26133
+ * benchmark measured it; a node without fresh results is sized from
26134
+ * `hardware` and says so. Measured on the node beats the table.
26135
+ * - `hardware` — computed from each node's static capacity only (its
26136
+ * accelerators at their Auto tune models, from the latency table).
26137
+ * Both are recomputed whenever a node or device joins, leaves, is switched
26138
+ * on or off, changes model, or a benchmark result is written. No load input.
26139
+ * - `manual` — the operator's stored sliders.
26140
+ * Either way a node or device that cannot take sessions gives its share to
26141
+ * the others in proportion; the stored values are never rewritten for that.
26142
+ */
26143
+ var ShareSourceSchema = _enum([
26144
+ "hardware",
26145
+ "benchmark",
26146
+ "manual"
26147
+ ]);
26148
+ var SetShareSourceInputSchema = object({ source: ShareSourceSchema });
26149
+ object({
26150
+ nodes: record(string(), number()),
26151
+ devices: record(string(), record(string(), number()))
26152
+ });
26153
+ var EffectiveDeviceShareSchema = object({
26154
+ deviceKey: string(),
26155
+ /** Can take sessions now (enabled, available, can run the root). */
26156
+ eligible: boolean(),
26157
+ /** The share the source assigns, as a percentage of the node's devices. */
26158
+ configuredPct: number(),
26159
+ /** The share actually used, after an ineligible device's share went to the others. */
26160
+ effectivePct: number()
26161
+ });
26162
+ var EffectiveNodeShareSchema = object({
26163
+ nodeId: string(),
26164
+ eligible: boolean(),
26165
+ configuredPct: number(),
26166
+ effectivePct: number(),
26167
+ /** Automatic sources: what this node's share was computed from; null under `manual` or before the first answer. */
26168
+ capacitySource: CapacitySourceSchema.nullable(),
26169
+ /** Automatic `benchmark`: why this node used `hardware` instead. */
26170
+ capacityFallback: CapacityFallbackSchema.nullable(),
26171
+ devices: array(EffectiveDeviceShareSchema).readonly()
26172
+ });
26173
+ var EffectiveSharesSchema = object({
26174
+ source: ShareSourceSchema,
26175
+ policy: SessionPlacementPolicySchema,
26176
+ /** An automatic source with no computed answer yet: the stored sliders are used meanwhile. */
26177
+ autoPending: boolean(),
26178
+ /** When the automatic shares were last computed (ms epoch); null = never. */
26179
+ computedAt: number().nullable(),
26180
+ /** What made the system recompute them last. */
26181
+ trigger: string().nullable(),
26182
+ nodes: array(EffectiveNodeShareSchema).readonly(),
26183
+ /** The relative weights the election reads (before eligibility). */
26184
+ nodeWeights: record(string(), number()),
26185
+ deviceWeights: record(string(), record(string(), number()))
26186
+ });
26187
+ /**
26188
+ * Wire shapes of the node benchmark (D791): the operator's plan, the
26189
+ * preflight the confirmation shows, the run the orchestrator owns, what the
26190
+ * measuring runner reports, and the result rows Auto tune and the automatic
26191
+ * shares read.
26192
+ *
26193
+ * ONE node at a time, owned by the pipeline orchestrator. While a run is
26194
+ * active the cluster is in BENCHMARK MODE for that node: it is not a
26195
+ * detection candidate, camera pins naming it are ignored so its sessions move
26196
+ * elsewhere, and both come back when the mode ends — after a crash or a hub
26197
+ * restart too (a persisted manifest, reconciled against the registry).
26198
+ *
26199
+ * Two measurements, both on the node, driven by its own runner (frames never
26200
+ * cross a process at frame rate, D9):
26201
+ * - `device` — one accelerator × one candidate detector, root only, open
26202
+ * loop: how many streams at the camera rate it carries inside the frame
26203
+ * interval;
26204
+ * - `pipeline` — the chosen detector plus the operator's detail steps
26205
+ * (faces, plates, classifiers, CLIP…), on varied frames from the bench
26206
+ * clip: how many parallel sessions the node carries before latency, drops,
26207
+ * CPU, RAM or the event loop give out.
26208
+ */
26209
+ /** Defaults and bounds, one place. */
26210
+ var NODE_BENCHMARK_DEFAULTS = {
26211
+ fpsPerStream: 10,
26212
+ budgetMinutes: 45,
26213
+ minBudgetMinutes: 10,
26214
+ maxBudgetMinutes: 120,
26215
+ /** A result older than this no longer beats the table. */
26216
+ staleAfterDays: 30,
26217
+ /** Warm-in per ramp step (not accounted). */
26218
+ settleSec: 5,
26219
+ /** Accounted window per ramp step. */
26220
+ measureSec: 20,
26221
+ /** Longest the drain may take before the run is refused. */
26222
+ drainTimeoutSec: 120,
26223
+ /** Candidate models per device in one run. */
26224
+ maxModelsPerDevice: 6
26225
+ };
26226
+ /** The two measurements a run can make. */
26227
+ var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
26228
+ var NodeBenchmarkDevicePlanSchema = object({
26229
+ /** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
26230
+ deviceKey: string().min(1),
26231
+ /**
26232
+ * Root detector candidates for the `device` measurement, in the order
26233
+ * measured. The FIRST is the one the `pipeline` measurement runs.
26234
+ */
26235
+ modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
26236
+ });
26237
+ /** What the operator confirmed. */
26238
+ var NodeBenchmarkPlanSchema = object({
26239
+ nodeId: string().min(1),
26240
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
26241
+ /** Which measurements run. At least one. */
26242
+ phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
26243
+ /**
26244
+ * Detail steps (catalog step ids under the root: faces, plates,
26245
+ * classifiers, CLIP…) the `pipeline` measurement enables. The root
26246
+ * detector always runs.
26247
+ */
26248
+ steps: array(string().min(1)).default([]),
26249
+ /** Offered rate of one stream / session. */
26250
+ fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
26251
+ /** Hard deadline: the mode ends and the cluster is restored when it passes. */
26252
+ budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
26253
+ /** Keep the models the run downloaded (default: delete what was not installed before). */
26254
+ keepDownloadedModels: boolean().default(false),
26255
+ /** Start although the other nodes' capacity does not cover the sessions running now. */
26256
+ acceptInsufficientHeadroom: boolean().default(false)
26257
+ });
26258
+ var NodeBenchmarkRefusalSchema = object({
26259
+ kind: _enum([
26260
+ "benchmark-active",
26261
+ "node-offline",
26262
+ "unknown-device",
26263
+ "no-phase",
26264
+ "insufficient-headroom"
26265
+ ]),
26266
+ detail: string(),
26267
+ overridable: boolean()
26268
+ });
26269
+ /** A camera whose detection leaves the node for the run. */
26270
+ var NodeBenchmarkMovingCameraSchema = object({
26271
+ deviceId: number(),
26272
+ /** Placed on the node now (a standing attach or a running session). */
26273
+ placedOnNode: boolean(),
26274
+ /** A node pin naming this node, ignored for the run. */
26275
+ pinnedToNode: boolean()
26276
+ });
26277
+ /** A camera that cannot leave: no other node can obtain its frames. */
26278
+ var NodeBenchmarkStayingCameraSchema = object({
26279
+ deviceId: number(),
26280
+ reason: literal("only-frame-source")
26281
+ });
26282
+ var NodeBenchmarkPreflightSchema = object({
26283
+ nodeId: string(),
26284
+ online: boolean(),
26285
+ moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
26286
+ /** Keep running on the node during the run; the result is flagged contaminated. */
26287
+ staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
26288
+ estimatedDurationMs: number(),
26289
+ /** The run ends and the cluster is restored at the latest after this long. */
26290
+ budgetMs: number(),
26291
+ phases: array(NodeBenchmarkPhaseSchema).readonly(),
26292
+ steps: array(string()).readonly(),
26293
+ devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
26294
+ /** Parallel sessions the cluster runs now, and what the other nodes can carry. */
26295
+ headroom: object({
26296
+ sessionsNow: number(),
26297
+ otherNodesCapacitySessions: number().nullable()
26298
+ }),
26299
+ refusals: array(NodeBenchmarkRefusalSchema).readonly(),
26300
+ canStart: boolean()
26301
+ });
26302
+ /** Where the measuring runner is. */
26303
+ var NodeBenchProgressSchema = object({
26304
+ phase: _enum([
26305
+ "preparing",
26306
+ "device",
26307
+ "pipeline",
26308
+ "cleanup"
26309
+ ]),
26310
+ deviceKey: string().nullable(),
26311
+ modelId: string().nullable(),
26312
+ /** Streams (device) or sessions (pipeline) of the step running now. */
26313
+ load: number().nullable(),
26314
+ cellsDone: number(),
26315
+ cellsTotal: number(),
26316
+ message: string()
26317
+ });
26318
+ /** What limited a ramp. `none` = the ramp ran out of steps still passing. */
26319
+ var NodeBenchLimitSchema = _enum([
26320
+ "p95",
26321
+ "drops",
26322
+ "errors",
26323
+ "stall",
26324
+ "cpu",
26325
+ "ram",
26326
+ "none"
26327
+ ]);
26328
+ var NodeBenchRampStepSchema = object({
26329
+ load: number(),
26330
+ pass: boolean(),
26331
+ p95Ms: number(),
26332
+ dropRatio: number(),
26333
+ /** Completed frames per second over the accounted window. */
26334
+ fps: number(),
26335
+ cpuPct: number().nullable(),
26336
+ ramFreePct: number().nullable(),
26337
+ failReasons: array(string()).readonly()
26338
+ });
26339
+ var NodeBenchCellSchema = discriminatedUnion("phase", [object({
26340
+ phase: literal("device"),
26341
+ deviceKey: string(),
26342
+ modelId: string(),
26343
+ /** Single-stream latency (the K = 1 step). */
26344
+ p50Ms: number(),
26345
+ p95Ms: number(),
26346
+ p99Ms: number(),
26347
+ /** Frames per second sustained at the last passing step. */
26348
+ fps: number(),
26349
+ /** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
26350
+ kMax: number(),
26351
+ limitedBy: NodeBenchLimitSchema,
26352
+ /** First call (model load + warm-up). */
26353
+ warmupMs: number(),
26354
+ ramp: array(NodeBenchRampStepSchema).readonly()
26355
+ }), object({
26356
+ phase: literal("pipeline"),
26357
+ deviceKey: string(),
26358
+ modelId: string(),
26359
+ steps: array(string()).readonly(),
26360
+ /** Parallel sessions at the camera rate the node carried; 0 = not even one. */
26361
+ maxSessions: number(),
26362
+ limitedBy: NodeBenchLimitSchema,
26363
+ /** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
26364
+ stepsFired: array(string()).readonly(),
26365
+ warmupMs: number(),
26366
+ ramp: array(NodeBenchRampStepSchema).readonly()
26367
+ })]);
26368
+ /**
26369
+ * What a result was measured ON. A result whose fingerprint no longer matches
26370
+ * the node no longer beats the table.
26371
+ */
26372
+ var NodeBenchFingerprintSchema = object({
26373
+ pipelineVersion: string().nullable(),
26374
+ cpuModel: string().nullable(),
26375
+ ramGb: number().nullable(),
26376
+ os: string().nullable(),
26377
+ /** Per device: the pool the cells ran on (runtime + tuning). */
26378
+ pools: record(string(), object({
26379
+ runtime: string(),
26380
+ numWorkers: number(),
26381
+ concurrency: number(),
26382
+ batchMode: string()
26383
+ })).default({})
26384
+ });
26385
+ /** The frames the run used. */
26386
+ var NodeBenchClipSchema = object({
26387
+ /** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
26388
+ id: string(),
26389
+ revision: string().nullable(),
26390
+ frames: number(),
26391
+ width: number(),
26392
+ height: number()
26393
+ });
26394
+ var NodeBenchRunnerInputSchema = object({
26395
+ runId: string().min(1),
26396
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
26397
+ phases: array(NodeBenchmarkPhaseSchema).min(1),
26398
+ /** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
26399
+ steps: array(string()).default([]),
26400
+ fpsPerStream: number().int().min(1).max(30),
26401
+ /** The runner stops on its own past this instant, whatever the hub does. */
26402
+ deadlineAtMs: number(),
26403
+ settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
26404
+ measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
26405
+ keepDownloadedModels: boolean().default(false)
26406
+ });
26407
+ var NodeBenchRunnerStateSchema = _enum([
26408
+ "running",
26409
+ "done",
26410
+ "failed",
26411
+ "aborted"
26412
+ ]);
26413
+ var NodeBenchRunnerStatusSchema = object({
26414
+ runId: string(),
26415
+ nodeId: string(),
26416
+ state: NodeBenchRunnerStateSchema,
26417
+ progress: NodeBenchProgressSchema.nullable(),
26418
+ /** Every finished cell so far — a run stopped half way keeps what it measured. */
26419
+ cells: array(NodeBenchCellSchema).readonly(),
26420
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
26421
+ clip: NodeBenchClipSchema.nullable(),
26422
+ /** Cameras seen running on the node during the run (they share its pools). */
26423
+ activeCameraIds: array(number()).readonly(),
26424
+ /** Models the run downloaded and then deleted (not installed before). */
26425
+ deletedModels: array(string()).readonly(),
26426
+ error: string().nullable(),
26427
+ startedAtMs: number(),
26428
+ finishedAtMs: number().nullable()
26429
+ });
26430
+ var NodeBenchmarkStateSchema = _enum([
26431
+ "draining",
26432
+ "measuring",
26433
+ "restoring",
26434
+ "done",
26435
+ "failed",
26436
+ "aborted"
26437
+ ]);
26438
+ /** Why a run ended. */
26439
+ var NodeBenchmarkEndReasonSchema = _enum([
26440
+ "completed",
26441
+ "operator-abort",
26442
+ "deadline",
26443
+ "node-lost",
26444
+ "runner-lost",
26445
+ "hub-restart",
26446
+ "drain-timeout",
26447
+ "failed"
26448
+ ]);
26449
+ var NodeBenchmarkRunSchema = object({
26450
+ runId: string(),
26451
+ nodeId: string(),
26452
+ state: NodeBenchmarkStateSchema,
26453
+ plan: NodeBenchmarkPlanSchema,
26454
+ startedAtMs: number(),
26455
+ deadlineAtMs: number(),
26456
+ finishedAtMs: number().nullable(),
26457
+ endReason: NodeBenchmarkEndReasonSchema.nullable(),
26458
+ error: string().nullable(),
26459
+ /** Cameras moved off the node for the run. */
26460
+ moved: array(number()).readonly(),
26461
+ /** Cameras that stayed (their only frame source is the node). */
26462
+ staying: array(number()).readonly(),
26463
+ /** Something else ran on the node's pools during the run. */
26464
+ contaminated: boolean(),
26465
+ progress: NodeBenchProgressSchema.nullable(),
26466
+ resultIds: array(string()).readonly()
26467
+ });
26468
+ /** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
26469
+ var NodeBenchmarkStatusSchema = object({
26470
+ /** The node the cluster is in benchmark mode for; null = none. */
26471
+ modeNodeId: string().nullable(),
26472
+ run: NodeBenchmarkRunSchema.nullable()
26473
+ });
26474
+ /**
26475
+ * One stored measurement — the only authority Auto tune and the automatic
26476
+ * shares read measured capacity from. Written by the orchestrator when a run
26477
+ * ends, never by anyone else.
26478
+ */
26479
+ var NodeBenchmarkResultSchema = object({
26480
+ id: string(),
26481
+ runId: string(),
26482
+ nodeId: string(),
26483
+ cell: NodeBenchCellSchema,
26484
+ fpsPerStream: number(),
26485
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
26486
+ clip: NodeBenchClipSchema.nullable(),
26487
+ /** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
26488
+ contaminated: boolean(),
26489
+ stayingCameras: array(number()).readonly(),
26490
+ /** The run ended early; the cell itself completed. */
26491
+ partialRun: boolean(),
26492
+ measuredAtMs: number()
26493
+ });
26494
+ var ListNodeBenchmarkResultsInputSchema = object({
26495
+ nodeId: string().optional(),
26496
+ deviceKey: string().optional()
26497
+ });
26498
+ /** A result with its standing today: does it still beat the table? */
26499
+ var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
26500
+ /** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
26501
+ standing: _enum([
26502
+ "fresh",
26503
+ "stale",
26504
+ "superseded"
26505
+ ]),
26506
+ staleWhy: _enum([
26507
+ "age",
26508
+ "runtime",
26509
+ "pool-tuning"
26510
+ ]).nullable()
26511
+ });
26512
+ object({
26513
+ runId: string(),
26514
+ nodeId: string(),
26515
+ startedAtMs: number(),
26516
+ deadlineAtMs: number(),
26517
+ plan: NodeBenchmarkPlanSchema,
26518
+ moved: array(number()).readonly(),
26519
+ staying: array(number()).readonly()
26520
+ });
26521
+ /** Candidate detectors per device, for the plan editor. */
26522
+ var NodeBenchmarkCandidatesSchema = object({
26523
+ nodeId: string(),
26524
+ reachable: boolean(),
26525
+ devices: array(object({
26526
+ deviceKey: string(),
26527
+ enabled: boolean(),
26528
+ available: boolean(),
26529
+ /** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
26530
+ suggested: array(string()).readonly(),
26531
+ /** Every root detector the device has a build for. */
26532
+ all: array(string()).readonly(),
26533
+ /** The model the device runs now, when pinned. */
26534
+ currentModelId: string().nullable()
26535
+ })).readonly(),
26536
+ /** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
26537
+ steps: array(object({
26538
+ id: string(),
26539
+ name: string(),
26540
+ slot: string()
26541
+ })).readonly()
26542
+ });
24586
26543
  object({
24587
26544
  activeCameras: number(),
24588
26545
  throttledCameras: number(),
@@ -25500,14 +27457,15 @@ var RunnerLocalLoadSchema = object({
25500
27457
  * Per-inference-device live load (multi-device C4). One entry per deviceKey
25501
27458
  * this runner currently has attached cameras on, so the orchestrator's second
25502
27459
  * `balance()` pass (over a node's devices) weights on real per-pool session
25503
- * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
25504
- * per device is 0 until the pool backlog gets a public accessor (follow-up).
27460
+ * counts. Empty on single-device / pre-multi-device runners. There is no
27461
+ * per-device queue depth: the inference pool's backlog has no accessor, and
27462
+ * a field that always read 0 was removed rather than shown as a measurement
27463
+ * (D762).
25505
27464
  */
25506
27465
  devices: array(object({
25507
27466
  deviceKey: string(),
25508
27467
  backend: string(),
25509
- attachedCameras: number(),
25510
- queueDepthTotal: number()
27468
+ attachedCameras: number()
25511
27469
  })).default([]),
25512
27470
  /** Hardware capability flags reported by this node. */
25513
27471
  hardware: object({
@@ -25643,7 +27601,22 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
25643
27601
  */
25644
27602
  cropJpeg: string().optional(),
25645
27603
  parent: DetailParentSchema,
25646
- steps: array(string()).optional()
27604
+ steps: array(string()).optional(),
27605
+ /**
27606
+ * The camera's root model already drew this step's boxes (D730): a
27607
+ * `license_plate` inside the parent vehicle. The named step is NOT
27608
+ * inferred — these FRAME-space boxes are its output — and its
27609
+ * requested children (the plate reader) run on them. Absent ⇒ every
27610
+ * requested step infers as before.
27611
+ */
27612
+ supplied: object({
27613
+ stepId: string(),
27614
+ modelId: string(),
27615
+ boxes: array(object({
27616
+ bbox: NativeCropBboxSchema,
27617
+ score: number()
27618
+ })).min(1)
27619
+ }).optional()
25647
27620
  }), object({ details: array(DetailResultSchema) }).nullable(), { kind: "mutation" }), method(object({
25648
27621
  /** Catalog step id, e.g. `clip-embedding`. */
25649
27622
  stepId: string(),
@@ -25695,7 +27668,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
25695
27668
  }), ParkedTrackFrameSchema.nullable()), method(object({
25696
27669
  deviceId: number(),
25697
27670
  trackId: string()
25698
- }), object({ released: number().int().nonnegative() }), { kind: "mutation" });
27671
+ }), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
27672
+ accepted: literal(true),
27673
+ runId: string()
27674
+ }), {
27675
+ kind: "mutation",
27676
+ auth: "admin"
27677
+ }), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
27678
+ kind: "mutation",
27679
+ auth: "admin"
27680
+ });
25699
27681
  var CameraPipelineConfigSchema = object({
25700
27682
  engine: PipelineEngineChoiceSchema.optional(),
25701
27683
  steps: array(PipelineStepInputSchema).readonly(),
@@ -25706,14 +27688,6 @@ var CameraPipelineConfigSchema = object({
25706
27688
  settings: record(string(), unknown()).readonly().optional()
25707
27689
  }).nullable().optional()
25708
27690
  });
25709
- var PipelineTemplateSchema = object({
25710
- id: string(),
25711
- name: string(),
25712
- description: string().optional(),
25713
- config: CameraPipelineConfigSchema,
25714
- createdAt: string(),
25715
- updatedAt: string()
25716
- });
25717
27691
  var DeviceStepConfigSchema = object({
25718
27692
  modelId: string().optional(),
25719
27693
  settings: record(string(), unknown()).optional(),
@@ -25787,9 +27761,10 @@ var CameraStepOverridePatchSchema = object({
25787
27761
  modelId: string().optional(),
25788
27762
  settings: record(string(), unknown()).readonly().optional()
25789
27763
  });
27764
+ var CameraStepSettingsSchema = record(string(), record(string(), unknown()).readonly());
25790
27765
  var CameraPipelineSettingsSchema = object({
25791
- pinnedAgentNodeId: string().optional(),
25792
27766
  stepToggles: record(string(), boolean()).optional(),
27767
+ stepSettings: CameraStepSettingsSchema.optional(),
25793
27768
  stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
25794
27769
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
25795
27770
  });
@@ -25822,7 +27797,10 @@ var PipelineAssignmentSchema = object({
25822
27797
  });
25823
27798
  /**
25824
27799
  * Per-agent load summary surfaced to the load balancer + dashboards.
25825
- * Aggregated from each runner's `getLocalLoad` cap call.
27800
+ * Aggregated from each runner's `getLocalLoad` cap call. In the
27801
+ * `getAgentLoad` report, a single-device node's default-pool sessions (no
27802
+ * `deviceKey`) are credited to its one eligible device in `load.devices` —
27803
+ * the default pool IS that device (D745); the balancer's census stays raw.
25826
27804
  */
25827
27805
  var AgentLoadSummarySchema = object({
25828
27806
  nodeId: string(),
@@ -25911,26 +27889,27 @@ var CameraBrokerStatusSchema = object({
25911
27889
  width: number(),
25912
27890
  height: number(),
25913
27891
  subscribers: number(),
25914
- inFps: number(),
25915
- outFps: number()
27892
+ /**
27893
+ * Encoded packets/s the broker receives from the camera. null when the
27894
+ * broker's stats read failed — unknown, never 0 (a 0 here reads as a stall).
27895
+ * There is no output rate: decoding runs in the session decode workers, not
27896
+ * in the broker, so the broker's own decoded-frame rate is 0 on every live
27897
+ * camera and is not served (D758).
27898
+ */
27899
+ inFps: number().nullable()
25916
27900
  })).readonly(),
25917
27901
  webrtcSessions: number(),
25918
27902
  rtspRestream: boolean()
25919
27903
  });
25920
- /** Shared-memory ring statistics within the decoder block. */
25921
- var CameraDecoderShmSchema = object({
25922
- framesWritten: number(),
25923
- getFrameHits: number(),
25924
- getFrameMisses: number(),
25925
- budgetMb: number()
25926
- });
25927
- /** Decoder block — null when the decoder stage is unreachable or inactive. */
25928
- var CameraDecoderStatusSchema = object({
25929
- nodeId: string(),
25930
- formats: array(string()).readonly(),
25931
- sessionCount: number(),
25932
- shm: CameraDecoderShmSchema
25933
- });
27904
+ /**
27905
+ * Decoder block — WHERE decode runs (co-located with the detection node by
27906
+ * construction); null when the camera has no detection node. It carries no
27907
+ * frame counter: the shared-memory plane whose counters it used to serve is
27908
+ * gone, and those fields read 0 forever. Whether frames actually flow is read
27909
+ * from `detection.actualFps` (frames delivered to and processed by the
27910
+ * detector), never from a counter nothing feeds.
27911
+ */
27912
+ var CameraDecoderStatusSchema = object({ nodeId: string() });
25934
27913
  /** Motion block — null when motion detection is not active for this device. */
25935
27914
  var CameraMotionStatusSchema = object({
25936
27915
  enabled: boolean(),
@@ -26287,12 +28266,6 @@ method(object({
26287
28266
  }), object({ success: literal(true) }), {
26288
28267
  kind: "mutation",
26289
28268
  auth: "admin"
26290
- }), method(object({
26291
- agentNodeId: string(),
26292
- detectWeight: number().positive().nullable()
26293
- }), object({ success: literal(true) }), {
26294
- kind: "mutation",
26295
- auth: "admin"
26296
28269
  }), method(object({
26297
28270
  agentNodeId: string(),
26298
28271
  detect: boolean().nullable().optional(),
@@ -26334,6 +28307,30 @@ method(object({
26334
28307
  }), {
26335
28308
  kind: "mutation",
26336
28309
  auth: "admin"
28310
+ }), method(AutoTuneOptionsSchema, AutoTunePlanSchema, { auth: "admin" }), method(AutoTuneApplyInputSchema, AutoTuneApplyResultSchema, {
28311
+ kind: "mutation",
28312
+ auth: "admin"
28313
+ }), method(LoadBalancingSharesInputSchema, object({ success: literal(true) }), {
28314
+ kind: "mutation",
28315
+ auth: "admin"
28316
+ }), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
28317
+ kind: "mutation",
28318
+ auth: "admin"
28319
+ }), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
28320
+ kind: literal("started"),
28321
+ runId: string()
28322
+ }), object({
28323
+ kind: literal("refused"),
28324
+ preflight: NodeBenchmarkPreflightSchema
28325
+ })]), {
28326
+ kind: "mutation",
28327
+ auth: "admin"
28328
+ }), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
28329
+ kind: "mutation",
28330
+ auth: "admin"
28331
+ }), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
28332
+ kind: "mutation",
28333
+ auth: "admin"
26337
28334
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
26338
28335
  deviceId: number(),
26339
28336
  addonId: string(),
@@ -26350,6 +28347,13 @@ method(object({
26350
28347
  }), object({ success: literal(true) }), {
26351
28348
  kind: "mutation",
26352
28349
  auth: "admin"
28350
+ }), method(object({
28351
+ deviceId: number(),
28352
+ addonId: string(),
28353
+ settings: record(string(), unknown()).nullable()
28354
+ }), object({ success: literal(true) }), {
28355
+ kind: "mutation",
28356
+ auth: "admin"
26353
28357
  }), method(object({
26354
28358
  deviceId: number(),
26355
28359
  agentNodeId: string(),
@@ -26373,25 +28377,7 @@ method(object({
26373
28377
  }), method(_void(), DiskReconcileJobSchema, {
26374
28378
  kind: "mutation",
26375
28379
  auth: "admin"
26376
- }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
26377
- name: string(),
26378
- description: string().optional(),
26379
- config: CameraPipelineConfigSchema
26380
- }), PipelineTemplateSchema, {
26381
- kind: "mutation",
26382
- auth: "admin"
26383
- }), method(object({
26384
- id: string(),
26385
- name: string().optional(),
26386
- description: string().optional(),
26387
- config: CameraPipelineConfigSchema.optional()
26388
- }), PipelineTemplateSchema, {
26389
- kind: "mutation",
26390
- auth: "admin"
26391
- }), method(object({ id: string() }), object({ success: literal(true) }), {
26392
- kind: "mutation",
26393
- auth: "admin"
26394
- });
28380
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" });
26395
28381
  /**
26396
28382
  * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
26397
28383
  * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
@@ -27085,7 +29071,19 @@ var SsoBridgeClaimsSchema = object({
27085
29071
  * editing a descriptor must not retroactively extend or shorten a link the
27086
29072
  * operator already consented to.
27087
29073
  */
27088
- refreshTtl: union([number().int().positive(), literal("never")]).optional()
29074
+ refreshTtl: union([number().int().positive(), literal("never")]).optional(),
29075
+ /**
29076
+ * Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
29077
+ * that was started from a signed-in user's "Link" button: the finish then
29078
+ * links this identity to the intent's user instead of signing anyone in.
29079
+ * The handle carries no user id — the hub resolves it, single-use.
29080
+ */
29081
+ linkIntent: string().optional(),
29082
+ /**
29083
+ * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
29084
+ * subject is unique only per issuer, so a link is bound to it.
29085
+ */
29086
+ issuer: string().optional()
27089
29087
  });
27090
29088
  method(object({
27091
29089
  claims: SsoBridgeClaimsSchema,
@@ -29162,8 +31160,6 @@ var WebrtcStreamChoiceSchema = object({
29162
31160
  ]).nullable(),
29163
31161
  /** Input FPS from the camera (null for adaptive). */
29164
31162
  inputFps: number().nullable(),
29165
- /** Decoded FPS (null for adaptive). */
29166
- decodeFps: number().nullable(),
29167
31163
  /** Bitrate in kbps (null for adaptive). */
29168
31164
  bitrateKbps: number().nullable()
29169
31165
  });
@@ -29440,7 +31436,22 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
29440
31436
  * field their hints were silently stripped by the schema and the
29441
31437
  * adaptive ladder started blind on the client's display size.
29442
31438
  */
29443
- hints: webrtcClientHintsSchema.optional()
31439
+ hints: webrtcClientHintsSchema.optional(),
31440
+ /**
31441
+ * Talk-back (D771): relay the PEER's audio to the device's speaker
31442
+ * through the `intercom` cap's push-talk triple. When `true` and the
31443
+ * offer lets the peer send audio, the answer's audio is `sendrecv`
31444
+ * and every inbound frame goes to `intercom.pushTalkAudio` for this
31445
+ * `deviceId`; absent/false answers `sendonly`, as for every viewer.
31446
+ *
31447
+ * TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
31448
+ * with `intercom`, when the linked user may control that camera. The
31449
+ * hub STRIPS it from every request-bound call (a browser), exactly as
31450
+ * it overwrites `relayOnly` — a viewer's talk permission is the
31451
+ * intercom cap's own surface (share tokens gate it there), and this
31452
+ * flag must not become a second door to the camera's speaker.
31453
+ */
31454
+ talkback: boolean().optional()
29444
31455
  }), object({
29445
31456
  sessionId: string(),
29446
31457
  sdpAnswer: string()
@@ -29495,6 +31506,14 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
29495
31506
  */
29496
31507
  alive: boolean()
29497
31508
  })), method(object({
31509
+ deviceId: number().int().nonnegative(),
31510
+ sessionId: string(),
31511
+ downlinkMbps: number().nonnegative()
31512
+ }), object({
31513
+ outcome: _enum(["switching", "held"]),
31514
+ tier: CamProfileSchema.nullable(),
31515
+ reason: string()
31516
+ }), { kind: "mutation" }), method(object({
29498
31517
  deviceId: number().int().nonnegative(),
29499
31518
  sessionId: string()
29500
31519
  }), WebrtcSessionDebugSchema, { kind: "query" });
@@ -29734,6 +31753,59 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
29734
31753
  var RestartAddonResultSchema = unknown();
29735
31754
  var InstallPackageResultSchema = unknown();
29736
31755
  var ReloadPackagesResultSchema = unknown();
31756
+ /**
31757
+ * What an uninstall did on ONE node.
31758
+ * - `uninstalled` — removed: runner(s) stopped, caps gone, code deleted.
31759
+ * - `not-installed` — the node did not have it (nothing to do).
31760
+ * - `refused` — protected / bootstrap package; nothing touched.
31761
+ * - `failed` — attempted and did not complete; `error` says why.
31762
+ * - `pending-reconnect` — the node is OFFLINE: its record was pruned so the
31763
+ * back-fill never returns the package, and the stale-addon sweep removes the
31764
+ * copy when the node registers again (only once the hub no longer has it).
31765
+ */
31766
+ var UninstallNodeOutcomeSchema = _enum([
31767
+ "uninstalled",
31768
+ "not-installed",
31769
+ "refused",
31770
+ "failed",
31771
+ "pending-reconnect"
31772
+ ]);
31773
+ var UninstallNodeResultSchema = object({
31774
+ nodeId: string(),
31775
+ outcome: UninstallNodeOutcomeSchema,
31776
+ error: string().optional(),
31777
+ addonIds: array(string()).readonly(),
31778
+ runnersStopped: array(string()).readonly(),
31779
+ warnings: array(string()).readonly()
31780
+ });
31781
+ var UninstallPackageResultSchema = object({
31782
+ /** Every targeted node ended `uninstalled`, `not-installed` or `pending-reconnect`. */
31783
+ success: boolean(),
31784
+ packageName: string(),
31785
+ results: array(UninstallNodeResultSchema).readonly()
31786
+ });
31787
+ /**
31788
+ * `unreachable` lists online agents whose status read FAILED — absence from
31789
+ * `installations` is only "not installed" for a node that answered (D315).
31790
+ */
31791
+ var PackageInstallationsSchema = object({
31792
+ installations: array(object({
31793
+ packageName: string(),
31794
+ nodeId: string(),
31795
+ nodeName: string(),
31796
+ isHub: boolean(),
31797
+ isOnline: boolean(),
31798
+ version: string().nullable(),
31799
+ addonIds: array(string()).readonly(),
31800
+ source: _enum(["live", "recorded"]),
31801
+ /** The hub installs this package too. `false` on an agent row = an orphan. */
31802
+ onHub: boolean()
31803
+ })).readonly(),
31804
+ unreachable: array(object({
31805
+ nodeId: string(),
31806
+ error: string()
31807
+ })).readonly()
31808
+ });
29737
31809
  var BulkUpdateItemStatusSchema = _enum([
29738
31810
  "queued",
29739
31811
  "updating",
@@ -29816,10 +31888,14 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
29816
31888
  }), method(object({ packageName: string() }), InstallPackageResultSchema, {
29817
31889
  kind: "mutation",
29818
31890
  auth: "admin"
29819
- }), method(_void(), boolean()), method(_void(), array(unknown()).readonly()), method(object({ packageName: string() }), unknown(), {
31891
+ }), method(_void(), boolean()), method(_void(), array(unknown()).readonly()), method(object({
31892
+ packageName: string().min(1),
31893
+ nodeId: string().optional(),
31894
+ everywhere: boolean().optional()
31895
+ }), UninstallPackageResultSchema, {
29820
31896
  kind: "mutation",
29821
31897
  auth: "admin"
29822
- }), method(_void(), ReloadPackagesResultSchema, {
31898
+ }), method(object({ packageName: string().optional() }), PackageInstallationsSchema, { auth: "admin" }), method(_void(), ReloadPackagesResultSchema, {
29823
31899
  kind: "mutation",
29824
31900
  auth: "admin"
29825
31901
  }), method(object({ query: string().optional() }), array(SearchResultSchema)), method(object({ nodeId: string().optional() }), array(PackageUpdateSchema).readonly(), { auth: "admin" }), method(object({
@@ -32884,6 +34960,9 @@ var CreateIntegrationInputSchema = object({
32884
34960
  enabled: boolean().optional(),
32885
34961
  info: record(string(), unknown()).optional(),
32886
34962
  settings: record(string(), unknown()).optional(),
34963
+ /** Keys of `settings` the form's schema declares secret (by type) — kept in
34964
+ * the keychain, not the table (D787). */
34965
+ secretKeys: array(string()).optional(),
32887
34966
  skipRestart: boolean().optional()
32888
34967
  });
32889
34968
  var UpdateIntegrationInputSchema = object({
@@ -32907,7 +34986,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
32907
34986
  auth: "admin"
32908
34987
  }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
32909
34988
  id: string(),
32910
- settings: record(string(), unknown())
34989
+ settings: record(string(), unknown()),
34990
+ /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
34991
+ secretKeys: array(string()).optional()
32911
34992
  }), object({ success: boolean() }), {
32912
34993
  kind: "mutation",
32913
34994
  auth: "admin"
@@ -33306,7 +35387,8 @@ var ConnectionEndpointSchema = object({
33306
35387
  "lan-ipv6",
33307
35388
  "public",
33308
35389
  "loopback",
33309
- "app-link"
35390
+ "app-link",
35391
+ "custom"
33310
35392
  ]),
33311
35393
  /**
33312
35394
  * Originating-interface kind — `lan`/`wifi`/`docker`/`vpn`/`other`/
@@ -33375,7 +35457,7 @@ var GetConnectionEndpointsResultSchema = object({
33375
35457
  localPort: AdvertisedLocalPortSchema
33376
35458
  });
33377
35459
  /**
33378
- * The address flagged for notification links. `baseUrl: null` = AUTO, which
35460
+ * The address flagged for notification taps (`notificationTaps`). `baseUrl: null` = AUTO, which
33379
35461
  * since D709 is the CamStack app link; `resolved` reports the effective value,
33380
35462
  * so the UI can show it either way.
33381
35463
  */
@@ -33408,6 +35490,72 @@ var ViewerEndpointsSchema = object({
33408
35490
  /** What the ranking currently resolves to (may be empty if nothing is up). */
33409
35491
  resolved: array(string()).readonly()
33410
35492
  });
35493
+ /**
35494
+ * DEPRECATED compatibility shape of `getHubAddresses` (D729 amendment, kept
35495
+ * for addons built against it): `cluster` is the `internal` role, `browser`
35496
+ * the `publicEndpoint` role; `override` is the flagged address.
35497
+ */
35498
+ var HubAddressSnapshotSchema = object({
35499
+ override: string().nullable(),
35500
+ resolved: string().nullable(),
35501
+ source: _enum([
35502
+ "override",
35503
+ "auto",
35504
+ "none"
35505
+ ])
35506
+ });
35507
+ var HubAddressesSchema = object({
35508
+ cluster: HubAddressSnapshotSchema,
35509
+ browser: HubAddressSnapshotSchema
35510
+ });
35511
+ /**
35512
+ * What an address is used for (`hub-address.ts`, D734). `appConnections` is
35513
+ * many-valued; `notificationTaps`, `publicEndpoint` and `internal` are carried
35514
+ * by at most one address.
35515
+ */
35516
+ var HubAddressRoleSchema = _enum(HUB_ADDRESS_ROLES);
35517
+ var RoleSourceSchema = _enum([
35518
+ "flagged",
35519
+ "auto",
35520
+ "none"
35521
+ ]);
35522
+ /** One single-valued role: the flagged address, the one in use, and why. */
35523
+ var HubAddressRoleResolutionSchema = object({
35524
+ /** The address carrying the flag, or null = automatic. */
35525
+ flagged: string().nullable(),
35526
+ /** The address in use, or null when nothing qualifies (never loopback). */
35527
+ resolved: string().nullable(),
35528
+ source: RoleSourceSchema
35529
+ });
35530
+ var HubAppConnectionsResolutionSchema = object({
35531
+ /** The addresses flagged `appConnections`, or empty = automatic. */
35532
+ flagged: array(string()).readonly(),
35533
+ /** What the apps race right now. */
35534
+ resolved: array(string()).readonly(),
35535
+ source: RoleSourceSchema
35536
+ });
35537
+ var HubAddressBookSchema = object({
35538
+ rows: array(ConnectionEndpointSchema.extend({
35539
+ /** In the hub's detected palette right now. */
35540
+ detected: boolean(),
35541
+ /** Entered by the operator (removable). */
35542
+ custom: boolean(),
35543
+ /** The roles explicitly flagged on this address. */
35544
+ flags: array(HubAddressRoleSchema).readonly(),
35545
+ /** The roles this address serves right now — flagged or automatic. */
35546
+ inUse: array(HubAddressRoleSchema).readonly(),
35547
+ /** The roles this address may be flagged with. */
35548
+ eligible: array(HubAddressRoleSchema).readonly()
35549
+ })).readonly(),
35550
+ roles: object({
35551
+ appConnections: HubAppConnectionsResolutionSchema,
35552
+ notificationTaps: HubAddressRoleResolutionSchema,
35553
+ internal: HubAddressRoleResolutionSchema,
35554
+ publicEndpoint: HubAddressRoleResolutionSchema
35555
+ }),
35556
+ /** The `hub=` an app link carries (D709), or null. */
35557
+ appLinkHub: string().nullable()
35558
+ });
33411
35559
  var AllowedAddressesSchema = object({
33412
35560
  /**
33413
35561
  * Allowlist of interface addresses operators have explicitly opted
@@ -33451,10 +35599,27 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
33451
35599
  * tunnel always emits `https://` regardless. */
33452
35600
  scheme: _enum(["http", "https"]).optional(),
33453
35601
  /** Append the CamStack app link entry (`kind: 'app-link'`, D709) —
33454
- * an address notification links can be flagged with, not a hub
35602
+ * an address notification taps can be flagged with, not a hub
33455
35603
  * route. Default `false`: racers and rankers never see it. */
33456
35604
  includeAppLink: boolean().optional()
33457
- }), 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, {
35605
+ }), 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({
35606
+ baseUrl: string(),
35607
+ label: string().max(80)
35608
+ }), HubAddressBookSchema, {
35609
+ kind: "mutation",
35610
+ auth: "admin"
35611
+ }), method(object({ baseUrl: string() }), HubAddressBookSchema, {
35612
+ kind: "mutation",
35613
+ auth: "admin"
35614
+ }), method(object({
35615
+ role: HubAddressRoleSchema,
35616
+ baseUrl: string().nullable(),
35617
+ enabled: boolean(),
35618
+ acceptInsecureHttp: boolean().optional()
35619
+ }), HubAddressBookSchema, {
35620
+ kind: "mutation",
35621
+ auth: "admin"
35622
+ }), 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, {
33458
35623
  kind: "mutation",
33459
35624
  auth: "admin"
33460
35625
  }), method(object({
@@ -40215,6 +42380,32 @@ var TotpStatusSchema = object({
40215
42380
  /** Null when no row exists OR the row is still pending confirmation. */
40216
42381
  confirmedAt: number().nullable()
40217
42382
  });
42383
+ /**
42384
+ * user-management — singleton capability for user accounts, API keys,
42385
+ * and scoped tokens.
42386
+ *
42387
+ * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
42388
+ * — the subset check on `setUserScopes` / `createScopedToken` is moot
42389
+ * because non-admins never reach these. If/when we open non-admin
42390
+ * delegation, structural caller-scope subset check goes inside the
42391
+ * provider.
42392
+ */
42393
+ var ExternalIdentitySchema = object({
42394
+ /** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
42395
+ provider: string(),
42396
+ /** The IdP's stable subject (`sub`) for this account. */
42397
+ subject: string(),
42398
+ /** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
42399
+ issuer: string(),
42400
+ userId: string(),
42401
+ /** What the IdP called the account at link time (username / email) — display only. */
42402
+ label: string().optional(),
42403
+ linkedAt: number()
42404
+ });
42405
+ var ExternalIdentityKeySchema = object({
42406
+ provider: string().min(1),
42407
+ subject: string().min(1)
42408
+ });
40218
42409
  method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
40219
42410
  kind: "mutation",
40220
42411
  auth: "admin",
@@ -40328,7 +42519,22 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
40328
42519
  userId: string(),
40329
42520
  username: string(),
40330
42521
  scopes: array(TokenScopeSchema)
40331
- }).nullable(), { access: "view" }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
42522
+ }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
42523
+ userId: string(),
42524
+ issuer: string()
42525
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
42526
+ userId: string(),
42527
+ issuer: string().min(1),
42528
+ label: string().optional()
42529
+ }), object({ success: literal(true) }), {
42530
+ kind: "mutation",
42531
+ auth: "admin",
42532
+ access: "create"
42533
+ }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
42534
+ kind: "mutation",
42535
+ auth: "admin",
42536
+ access: "delete"
42537
+ }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
40332
42538
  kind: "mutation",
40333
42539
  auth: "admin",
40334
42540
  access: "delete"
@@ -41030,6 +43236,16 @@ var zoneRulesCapability = {
41030
43236
  durability: "restored"
41031
43237
  };
41032
43238
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
43239
+ Object.freeze({
43240
+ person: .5,
43241
+ vehicle: .5,
43242
+ animal: .5
43243
+ });
43244
+ Object.freeze({
43245
+ person: .65,
43246
+ vehicle: .65,
43247
+ animal: .65
43248
+ });
41033
43249
  /**
41034
43250
  * Accessory device helpers — shared across drivers.
41035
43251
  *
@@ -41520,7 +43736,8 @@ var BaseDevice = class {
41520
43736
  this.role = options.role;
41521
43737
  this.parentDeviceId = ctx.parentDeviceId;
41522
43738
  const seedData = ctx.persistedConfig ?? {};
41523
- this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data), seedData, ({ droppedKeys, issues }) => {
43739
+ const declaredSecretPaths = collectZodSecretPaths(schema);
43740
+ this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
41524
43741
  ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
41525
43742
  tags: {
41526
43743
  deviceId: ctx.id,
@@ -42754,6 +44971,12 @@ Object.freeze({
42754
44971
  addonId: null,
42755
44972
  access: "view"
42756
44973
  },
44974
+ "addons.listInstallations": {
44975
+ capName: "addons",
44976
+ capScope: "system",
44977
+ addonId: null,
44978
+ access: "view"
44979
+ },
42757
44980
  "addons.listJobs": {
42758
44981
  capName: "addons",
42759
44982
  capScope: "system",
@@ -43936,90 +46159,18 @@ Object.freeze({
43936
46159
  addonId: null,
43937
46160
  access: "create"
43938
46161
  },
43939
- "decoder.createSession": {
43940
- capName: "decoder",
43941
- capScope: "system",
43942
- addonId: null,
43943
- access: "view"
43944
- },
43945
- "decoder.destroySession": {
43946
- capName: "decoder",
43947
- capScope: "system",
43948
- addonId: null,
43949
- access: "delete"
43950
- },
43951
- "decoder.getFrame": {
43952
- capName: "decoder",
43953
- capScope: "system",
43954
- addonId: null,
43955
- access: "view"
43956
- },
43957
46162
  "decoder.getInfo": {
43958
46163
  capName: "decoder",
43959
46164
  capScope: "system",
43960
46165
  addonId: null,
43961
46166
  access: "view"
43962
46167
  },
43963
- "decoder.getShmStats": {
43964
- capName: "decoder",
43965
- capScope: "system",
43966
- addonId: null,
43967
- access: "view"
43968
- },
43969
- "decoder.getStats": {
43970
- capName: "decoder",
43971
- capScope: "system",
43972
- addonId: null,
43973
- access: "view"
43974
- },
43975
- "decoder.listActiveSessions": {
43976
- capName: "decoder",
43977
- capScope: "system",
43978
- addonId: null,
43979
- access: "view"
43980
- },
43981
- "decoder.openStream": {
43982
- capName: "decoder",
43983
- capScope: "system",
43984
- addonId: null,
43985
- access: "view"
43986
- },
43987
- "decoder.pullFrames": {
43988
- capName: "decoder",
43989
- capScope: "system",
43990
- addonId: null,
43991
- access: "view"
43992
- },
43993
- "decoder.pullHandles": {
43994
- capName: "decoder",
43995
- capScope: "system",
43996
- addonId: null,
43997
- access: "view"
43998
- },
43999
- "decoder.pushPacket": {
44000
- capName: "decoder",
44001
- capScope: "system",
44002
- addonId: null,
44003
- access: "view"
44004
- },
44005
46168
  "decoder.reprobeHwaccel": {
44006
46169
  capName: "decoder",
44007
46170
  capScope: "system",
44008
46171
  addonId: null,
44009
46172
  access: "create"
44010
46173
  },
44011
- "decoder.supportsCodec": {
44012
- capName: "decoder",
44013
- capScope: "system",
44014
- addonId: null,
44015
- access: "view"
44016
- },
44017
- "decoder.updateConfig": {
44018
- capName: "decoder",
44019
- capScope: "system",
44020
- addonId: null,
44021
- access: "view"
44022
- },
44023
46174
  "detectionPipeline.applyDeviceSettingsPatch": {
44024
46175
  capName: "detection-pipeline",
44025
46176
  capScope: "device",
@@ -45286,6 +47437,90 @@ Object.freeze({
45286
47437
  addonId: null,
45287
47438
  access: "create"
45288
47439
  },
47440
+ "keychain.delete": {
47441
+ capName: "keychain",
47442
+ capScope: "system",
47443
+ addonId: null,
47444
+ access: "delete"
47445
+ },
47446
+ "keychain.getState": {
47447
+ capName: "keychain",
47448
+ capScope: "system",
47449
+ addonId: null,
47450
+ access: "view"
47451
+ },
47452
+ "keychain.listMeta": {
47453
+ capName: "keychain",
47454
+ capScope: "system",
47455
+ addonId: null,
47456
+ access: "view"
47457
+ },
47458
+ "keychain.put": {
47459
+ capName: "keychain",
47460
+ capScope: "system",
47461
+ addonId: null,
47462
+ access: "create"
47463
+ },
47464
+ "keychain.resolve": {
47465
+ capName: "keychain",
47466
+ capScope: "system",
47467
+ addonId: null,
47468
+ access: "view"
47469
+ },
47470
+ "keychainAdmin.deleteOrphans": {
47471
+ capName: "keychain-admin",
47472
+ capScope: "system",
47473
+ addonId: null,
47474
+ access: "delete"
47475
+ },
47476
+ "keychainAdmin.downloadRecoveryKey": {
47477
+ capName: "keychain-admin",
47478
+ capScope: "system",
47479
+ addonId: null,
47480
+ access: "create"
47481
+ },
47482
+ "keychainAdmin.listAudit": {
47483
+ capName: "keychain-admin",
47484
+ capScope: "system",
47485
+ addonId: null,
47486
+ access: "view"
47487
+ },
47488
+ "keychainAdmin.listSecrets": {
47489
+ capName: "keychain-admin",
47490
+ capScope: "system",
47491
+ addonId: null,
47492
+ access: "view"
47493
+ },
47494
+ "keychainAdmin.purgeRetiredKeys": {
47495
+ capName: "keychain-admin",
47496
+ capScope: "system",
47497
+ addonId: null,
47498
+ access: "delete"
47499
+ },
47500
+ "keychainAdmin.resetKeychain": {
47501
+ capName: "keychain-admin",
47502
+ capScope: "system",
47503
+ addonId: null,
47504
+ access: "delete"
47505
+ },
47506
+ "keychainAdmin.reveal": {
47507
+ capName: "keychain-admin",
47508
+ capScope: "system",
47509
+ addonId: null,
47510
+ access: "create"
47511
+ },
47512
+ "keychainAdmin.rotateMasterKey": {
47513
+ capName: "keychain-admin",
47514
+ capScope: "system",
47515
+ addonId: null,
47516
+ access: "create"
47517
+ },
47518
+ "keychainAdmin.status": {
47519
+ capName: "keychain-admin",
47520
+ capScope: "system",
47521
+ addonId: null,
47522
+ access: "view"
47523
+ },
45289
47524
  "lawnMowerControl.dock": {
45290
47525
  capName: "lawn-mower-control",
45291
47526
  capScope: "device",
@@ -45508,12 +47743,24 @@ Object.freeze({
45508
47743
  addonId: null,
45509
47744
  access: "view"
45510
47745
  },
47746
+ "localNetwork.addCustomAddress": {
47747
+ capName: "local-network",
47748
+ capScope: "system",
47749
+ addonId: null,
47750
+ access: "create"
47751
+ },
45511
47752
  "localNetwork.downloadCa": {
45512
47753
  capName: "local-network",
45513
47754
  capScope: "system",
45514
47755
  addonId: null,
45515
47756
  access: "view"
45516
47757
  },
47758
+ "localNetwork.getAddresses": {
47759
+ capName: "local-network",
47760
+ capScope: "system",
47761
+ addonId: null,
47762
+ access: "view"
47763
+ },
45517
47764
  "localNetwork.getAllowedAddresses": {
45518
47765
  capName: "local-network",
45519
47766
  capScope: "system",
@@ -45526,6 +47773,12 @@ Object.freeze({
45526
47773
  addonId: null,
45527
47774
  access: "view"
45528
47775
  },
47776
+ "localNetwork.getHubAddresses": {
47777
+ capName: "local-network",
47778
+ capScope: "system",
47779
+ addonId: null,
47780
+ access: "view"
47781
+ },
45529
47782
  "localNetwork.getNotificationEndpoint": {
45530
47783
  capName: "local-network",
45531
47784
  capScope: "system",
@@ -45562,6 +47815,12 @@ Object.freeze({
45562
47815
  addonId: null,
45563
47816
  access: "create"
45564
47817
  },
47818
+ "localNetwork.removeCustomAddress": {
47819
+ capName: "local-network",
47820
+ capScope: "system",
47821
+ addonId: null,
47822
+ access: "delete"
47823
+ },
45565
47824
  "localNetwork.resetAllowlistToBestMatch": {
45566
47825
  capName: "local-network",
45567
47826
  capScope: "system",
@@ -45574,6 +47833,12 @@ Object.freeze({
45574
47833
  addonId: null,
45575
47834
  access: "create"
45576
47835
  },
47836
+ "localNetwork.setAddressRole": {
47837
+ capName: "local-network",
47838
+ capScope: "system",
47839
+ addonId: null,
47840
+ access: "create"
47841
+ },
45577
47842
  "localNetwork.setAllowedAddresses": {
45578
47843
  capName: "local-network",
45579
47844
  capScope: "system",
@@ -46630,6 +48895,18 @@ Object.freeze({
46630
48895
  addonId: null,
46631
48896
  access: "create"
46632
48897
  },
48898
+ "pipelineAnalytics.addRetrainFrameFromRecording": {
48899
+ capName: "pipeline-analytics",
48900
+ capScope: "device",
48901
+ addonId: null,
48902
+ access: "create"
48903
+ },
48904
+ "pipelineAnalytics.addRetrainFramesToCollection": {
48905
+ capName: "pipeline-analytics",
48906
+ capScope: "device",
48907
+ addonId: null,
48908
+ access: "create"
48909
+ },
46633
48910
  "pipelineAnalytics.applyDeviceSettingsPatch": {
46634
48911
  capName: "pipeline-analytics",
46635
48912
  capScope: "device",
@@ -46678,12 +48955,24 @@ Object.freeze({
46678
48955
  addonId: null,
46679
48956
  access: "view"
46680
48957
  },
48958
+ "pipelineAnalytics.createRetrainCollection": {
48959
+ capName: "pipeline-analytics",
48960
+ capScope: "device",
48961
+ addonId: null,
48962
+ access: "create"
48963
+ },
46681
48964
  "pipelineAnalytics.deleteDeviceEvents": {
46682
48965
  capName: "pipeline-analytics",
46683
48966
  capScope: "device",
46684
48967
  addonId: null,
46685
48968
  access: "delete"
46686
48969
  },
48970
+ "pipelineAnalytics.deleteRetrainCollection": {
48971
+ capName: "pipeline-analytics",
48972
+ capScope: "device",
48973
+ addonId: null,
48974
+ access: "delete"
48975
+ },
46687
48976
  "pipelineAnalytics.deleteTracks": {
46688
48977
  capName: "pipeline-analytics",
46689
48978
  capScope: "device",
@@ -46888,6 +49177,24 @@ Object.freeze({
46888
49177
  addonId: null,
46889
49178
  access: "view"
46890
49179
  },
49180
+ "pipelineAnalytics.listRetrainAssistProfiles": {
49181
+ capName: "pipeline-analytics",
49182
+ capScope: "device",
49183
+ addonId: null,
49184
+ access: "view"
49185
+ },
49186
+ "pipelineAnalytics.listRetrainCollectionFrames": {
49187
+ capName: "pipeline-analytics",
49188
+ capScope: "device",
49189
+ addonId: null,
49190
+ access: "view"
49191
+ },
49192
+ "pipelineAnalytics.listRetrainCollections": {
49193
+ capName: "pipeline-analytics",
49194
+ capScope: "device",
49195
+ addonId: null,
49196
+ access: "view"
49197
+ },
46891
49198
  "pipelineAnalytics.listRetrainFrames": {
46892
49199
  capName: "pipeline-analytics",
46893
49200
  capScope: "device",
@@ -46936,6 +49243,12 @@ Object.freeze({
46936
49243
  addonId: null,
46937
49244
  access: "create"
46938
49245
  },
49246
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
49247
+ capName: "pipeline-analytics",
49248
+ capScope: "device",
49249
+ addonId: null,
49250
+ access: "create"
49251
+ },
46939
49252
  "pipelineAnalytics.pruneEvents": {
46940
49253
  capName: "pipeline-analytics",
46941
49254
  capScope: "device",
@@ -46990,6 +49303,18 @@ Object.freeze({
46990
49303
  addonId: null,
46991
49304
  access: "create"
46992
49305
  },
49306
+ "pipelineAnalytics.removeRetrainFrameFromCollection": {
49307
+ capName: "pipeline-analytics",
49308
+ capScope: "device",
49309
+ addonId: null,
49310
+ access: "delete"
49311
+ },
49312
+ "pipelineAnalytics.renameRetrainCollection": {
49313
+ capName: "pipeline-analytics",
49314
+ capScope: "device",
49315
+ addonId: null,
49316
+ access: "create"
49317
+ },
46993
49318
  "pipelineAnalytics.restageRetrainTrack": {
46994
49319
  capName: "pipeline-analytics",
46995
49320
  capScope: "device",
@@ -47020,6 +49345,12 @@ Object.freeze({
47020
49345
  addonId: null,
47021
49346
  access: "create"
47022
49347
  },
49348
+ "pipelineAnalytics.setRetrainFrameComplete": {
49349
+ capName: "pipeline-analytics",
49350
+ capScope: "device",
49351
+ addonId: null,
49352
+ access: "create"
49353
+ },
47023
49354
  "pipelineAnalytics.setTrackFlags": {
47024
49355
  capName: "pipeline-analytics",
47025
49356
  capScope: "device",
@@ -47056,6 +49387,12 @@ Object.freeze({
47056
49387
  addonId: null,
47057
49388
  access: "delete"
47058
49389
  },
49390
+ "pipelineAnalytics.writeRetrainArchive": {
49391
+ capName: "pipeline-analytics",
49392
+ capScope: "device",
49393
+ addonId: null,
49394
+ access: "create"
49395
+ },
47059
49396
  "pipelineExecutor.cacheFrameInPool": {
47060
49397
  capName: "pipeline-executor",
47061
49398
  capScope: "system",
@@ -47068,13 +49405,13 @@ Object.freeze({
47068
49405
  addonId: null,
47069
49406
  access: "delete"
47070
49407
  },
47071
- "pipelineExecutor.deleteModel": {
49408
+ "pipelineExecutor.clearModelBoundDeviceOverrides": {
47072
49409
  capName: "pipeline-executor",
47073
49410
  capScope: "system",
47074
49411
  addonId: null,
47075
49412
  access: "delete"
47076
49413
  },
47077
- "pipelineExecutor.deleteTemplate": {
49414
+ "pipelineExecutor.deleteModel": {
47078
49415
  capName: "pipeline-executor",
47079
49416
  capScope: "system",
47080
49417
  addonId: null,
@@ -47218,12 +49555,6 @@ Object.freeze({
47218
49555
  addonId: null,
47219
49556
  access: "view"
47220
49557
  },
47221
- "pipelineExecutor.listTemplates": {
47222
- capName: "pipeline-executor",
47223
- capScope: "system",
47224
- addonId: null,
47225
- access: "view"
47226
- },
47227
49558
  "pipelineExecutor.rearmInferenceDevice": {
47228
49559
  capName: "pipeline-executor",
47229
49560
  capScope: "system",
@@ -47248,12 +49579,6 @@ Object.freeze({
47248
49579
  addonId: null,
47249
49580
  access: "create"
47250
49581
  },
47251
- "pipelineExecutor.saveTemplate": {
47252
- capName: "pipeline-executor",
47253
- capScope: "system",
47254
- addonId: null,
47255
- access: "create"
47256
- },
47257
49582
  "pipelineExecutor.setVideoPipelineSteps": {
47258
49583
  capName: "pipeline-executor",
47259
49584
  capScope: "system",
@@ -47272,17 +49597,23 @@ Object.freeze({
47272
49597
  addonId: null,
47273
49598
  access: "create"
47274
49599
  },
47275
- "pipelineExecutor.updateTemplate": {
49600
+ "pipelineExecutor.validatePipeline": {
47276
49601
  capName: "pipeline-executor",
47277
49602
  capScope: "system",
47278
49603
  addonId: null,
49604
+ access: "view"
49605
+ },
49606
+ "pipelineOrchestrator.abortNodeBenchmark": {
49607
+ capName: "pipeline-orchestrator",
49608
+ capScope: "system",
49609
+ addonId: null,
47279
49610
  access: "create"
47280
49611
  },
47281
- "pipelineExecutor.validatePipeline": {
47282
- capName: "pipeline-executor",
49612
+ "pipelineOrchestrator.applyAutoTune": {
49613
+ capName: "pipeline-orchestrator",
47283
49614
  capScope: "system",
47284
49615
  addonId: null,
47285
- access: "view"
49616
+ access: "create"
47286
49617
  },
47287
49618
  "pipelineOrchestrator.applyDeviceSettingsPatch": {
47288
49619
  capName: "pipeline-orchestrator",
@@ -47302,7 +49633,7 @@ Object.freeze({
47302
49633
  addonId: null,
47303
49634
  access: "create"
47304
49635
  },
47305
- "pipelineOrchestrator.deleteTemplate": {
49636
+ "pipelineOrchestrator.deleteNodeBenchmarkResult": {
47306
49637
  capName: "pipeline-orchestrator",
47307
49638
  capScope: "system",
47308
49639
  addonId: null,
@@ -47398,6 +49729,12 @@ Object.freeze({
47398
49729
  addonId: null,
47399
49730
  access: "view"
47400
49731
  },
49732
+ "pipelineOrchestrator.getEffectiveShares": {
49733
+ capName: "pipeline-orchestrator",
49734
+ capScope: "system",
49735
+ addonId: null,
49736
+ access: "view"
49737
+ },
47401
49738
  "pipelineOrchestrator.getGlobalMetrics": {
47402
49739
  capName: "pipeline-orchestrator",
47403
49740
  capScope: "system",
@@ -47410,6 +49747,24 @@ Object.freeze({
47410
49747
  addonId: null,
47411
49748
  access: "view"
47412
49749
  },
49750
+ "pipelineOrchestrator.getNodeBenchmarkCandidates": {
49751
+ capName: "pipeline-orchestrator",
49752
+ capScope: "system",
49753
+ addonId: null,
49754
+ access: "view"
49755
+ },
49756
+ "pipelineOrchestrator.getNodeBenchmarkPreflight": {
49757
+ capName: "pipeline-orchestrator",
49758
+ capScope: "system",
49759
+ addonId: null,
49760
+ access: "view"
49761
+ },
49762
+ "pipelineOrchestrator.getNodeBenchmarkStatus": {
49763
+ capName: "pipeline-orchestrator",
49764
+ capScope: "system",
49765
+ addonId: null,
49766
+ access: "view"
49767
+ },
47413
49768
  "pipelineOrchestrator.getNodeInferenceDevices": {
47414
49769
  capName: "pipeline-orchestrator",
47415
49770
  capScope: "system",
@@ -47434,6 +49789,12 @@ Object.freeze({
47434
49789
  addonId: null,
47435
49790
  access: "view"
47436
49791
  },
49792
+ "pipelineOrchestrator.getPlacementStats": {
49793
+ capName: "pipeline-orchestrator",
49794
+ capScope: "system",
49795
+ addonId: null,
49796
+ access: "view"
49797
+ },
47437
49798
  "pipelineOrchestrator.getReconcileFromDiskStatus": {
47438
49799
  capName: "pipeline-orchestrator",
47439
49800
  capScope: "system",
@@ -47446,7 +49807,7 @@ Object.freeze({
47446
49807
  addonId: null,
47447
49808
  access: "view"
47448
49809
  },
47449
- "pipelineOrchestrator.listTemplates": {
49810
+ "pipelineOrchestrator.listNodeBenchmarkResults": {
47450
49811
  capName: "pipeline-orchestrator",
47451
49812
  capScope: "system",
47452
49813
  addonId: null,
@@ -47458,6 +49819,12 @@ Object.freeze({
47458
49819
  addonId: null,
47459
49820
  access: "create"
47460
49821
  },
49822
+ "pipelineOrchestrator.planAutoTune": {
49823
+ capName: "pipeline-orchestrator",
49824
+ capScope: "system",
49825
+ addonId: null,
49826
+ access: "view"
49827
+ },
47461
49828
  "pipelineOrchestrator.rebalance": {
47462
49829
  capName: "pipeline-orchestrator",
47463
49830
  capScope: "system",
@@ -47500,12 +49867,6 @@ Object.freeze({
47500
49867
  addonId: null,
47501
49868
  access: "create"
47502
49869
  },
47503
- "pipelineOrchestrator.saveTemplate": {
47504
- capName: "pipeline-orchestrator",
47505
- capScope: "system",
47506
- addonId: null,
47507
- access: "create"
47508
- },
47509
49870
  "pipelineOrchestrator.setAgentCapabilities": {
47510
49871
  capName: "pipeline-orchestrator",
47511
49872
  capScope: "system",
@@ -47518,12 +49879,6 @@ Object.freeze({
47518
49879
  addonId: null,
47519
49880
  access: "create"
47520
49881
  },
47521
- "pipelineOrchestrator.setAgentDetectWeight": {
47522
- capName: "pipeline-orchestrator",
47523
- capScope: "system",
47524
- addonId: null,
47525
- access: "create"
47526
- },
47527
49882
  "pipelineOrchestrator.setAgentInferenceDevices": {
47528
49883
  capName: "pipeline-orchestrator",
47529
49884
  capScope: "system",
@@ -47560,6 +49915,12 @@ Object.freeze({
47560
49915
  addonId: null,
47561
49916
  access: "create"
47562
49917
  },
49918
+ "pipelineOrchestrator.setCameraStepSettings": {
49919
+ capName: "pipeline-orchestrator",
49920
+ capScope: "system",
49921
+ addonId: null,
49922
+ access: "create"
49923
+ },
47563
49924
  "pipelineOrchestrator.setCameraStepToggle": {
47564
49925
  capName: "pipeline-orchestrator",
47565
49926
  capScope: "system",
@@ -47578,12 +49939,36 @@ Object.freeze({
47578
49939
  addonId: null,
47579
49940
  access: "create"
47580
49941
  },
49942
+ "pipelineOrchestrator.setLoadBalancingShares": {
49943
+ capName: "pipeline-orchestrator",
49944
+ capScope: "system",
49945
+ addonId: null,
49946
+ access: "create"
49947
+ },
47581
49948
  "pipelineOrchestrator.setPipelineDevicePin": {
47582
49949
  capName: "pipeline-orchestrator",
47583
49950
  capScope: "system",
47584
49951
  addonId: null,
47585
49952
  access: "create"
47586
49953
  },
49954
+ "pipelineOrchestrator.setShareSource": {
49955
+ capName: "pipeline-orchestrator",
49956
+ capScope: "system",
49957
+ addonId: null,
49958
+ access: "create"
49959
+ },
49960
+ "pipelineOrchestrator.startNodeBenchmark": {
49961
+ capName: "pipeline-orchestrator",
49962
+ capScope: "system",
49963
+ addonId: null,
49964
+ access: "create"
49965
+ },
49966
+ "pipelineOrchestrator.suggestShares": {
49967
+ capName: "pipeline-orchestrator",
49968
+ capScope: "system",
49969
+ addonId: null,
49970
+ access: "view"
49971
+ },
47587
49972
  "pipelineOrchestrator.unassignAudio": {
47588
49973
  capName: "pipeline-orchestrator",
47589
49974
  capScope: "system",
@@ -47596,8 +49981,8 @@ Object.freeze({
47596
49981
  addonId: null,
47597
49982
  access: "create"
47598
49983
  },
47599
- "pipelineOrchestrator.updateTemplate": {
47600
- capName: "pipeline-orchestrator",
49984
+ "pipelineRunner.abortNodeBench": {
49985
+ capName: "pipeline-runner",
47601
49986
  capScope: "system",
47602
49987
  addonId: null,
47603
49988
  access: "create"
@@ -47650,6 +50035,12 @@ Object.freeze({
47650
50035
  addonId: null,
47651
50036
  access: "view"
47652
50037
  },
50038
+ "pipelineRunner.getNodeBenchStatus": {
50039
+ capName: "pipeline-runner",
50040
+ capScope: "system",
50041
+ addonId: null,
50042
+ access: "view"
50043
+ },
47653
50044
  "pipelineRunner.getParkedTrackFrame": {
47654
50045
  capName: "pipeline-runner",
47655
50046
  capScope: "system",
@@ -47692,6 +50083,12 @@ Object.freeze({
47692
50083
  addonId: null,
47693
50084
  access: "create"
47694
50085
  },
50086
+ "pipelineRunner.startNodeBench": {
50087
+ capName: "pipeline-runner",
50088
+ capScope: "system",
50089
+ addonId: null,
50090
+ access: "create"
50091
+ },
47695
50092
  "plateGallery.assignPlate": {
47696
50093
  capName: "plate-gallery",
47697
50094
  capScope: "system",
@@ -49036,12 +51433,6 @@ Object.freeze({
49036
51433
  addonId: null,
49037
51434
  access: "view"
49038
51435
  },
49039
- "streamBroker.pullFrameHandles": {
49040
- capName: "stream-broker",
49041
- capScope: "system",
49042
- addonId: null,
49043
- access: "view"
49044
- },
49045
51436
  "streamBroker.regenerateRtspToken": {
49046
51437
  capName: "stream-broker",
49047
51438
  capScope: "system",
@@ -49108,12 +51499,6 @@ Object.freeze({
49108
51499
  addonId: null,
49109
51500
  access: "create"
49110
51501
  },
49111
- "streamBroker.subscribeFrames": {
49112
- capName: "stream-broker",
49113
- capScope: "system",
49114
- addonId: null,
49115
- access: "create"
49116
- },
49117
51502
  "streamBroker.unassignProfile": {
49118
51503
  capName: "stream-broker",
49119
51504
  capScope: "system",
@@ -49126,12 +51511,6 @@ Object.freeze({
49126
51511
  addonId: null,
49127
51512
  access: "create"
49128
51513
  },
49129
- "streamBroker.unsubscribeFrames": {
49130
- capName: "stream-broker",
49131
- capScope: "system",
49132
- addonId: null,
49133
- access: "create"
49134
- },
49135
51514
  "streamCatalog.getCatalog": {
49136
51515
  capName: "stream-catalog",
49137
51516
  capScope: "device",
@@ -49426,18 +51805,36 @@ Object.freeze({
49426
51805
  addonId: null,
49427
51806
  access: "delete"
49428
51807
  },
51808
+ "userManagement.findUserByExternalIdentity": {
51809
+ capName: "user-management",
51810
+ capScope: "system",
51811
+ addonId: null,
51812
+ access: "view"
51813
+ },
49429
51814
  "userManagement.getTotpStatus": {
49430
51815
  capName: "user-management",
49431
51816
  capScope: "system",
49432
51817
  addonId: null,
49433
51818
  access: "view"
49434
51819
  },
51820
+ "userManagement.linkExternalIdentity": {
51821
+ capName: "user-management",
51822
+ capScope: "system",
51823
+ addonId: null,
51824
+ access: "create"
51825
+ },
49435
51826
  "userManagement.listApiKeys": {
49436
51827
  capName: "user-management",
49437
51828
  capScope: "system",
49438
51829
  addonId: null,
49439
51830
  access: "view"
49440
51831
  },
51832
+ "userManagement.listExternalIdentities": {
51833
+ capName: "user-management",
51834
+ capScope: "system",
51835
+ addonId: null,
51836
+ access: "view"
51837
+ },
49441
51838
  "userManagement.listOauthSessions": {
49442
51839
  capName: "user-management",
49443
51840
  capScope: "system",
@@ -49516,6 +51913,12 @@ Object.freeze({
49516
51913
  addonId: null,
49517
51914
  access: "create"
49518
51915
  },
51916
+ "userManagement.unlinkExternalIdentity": {
51917
+ capName: "user-management",
51918
+ capScope: "system",
51919
+ addonId: null,
51920
+ access: "delete"
51921
+ },
49519
51922
  "userManagement.updateUser": {
49520
51923
  capName: "user-management",
49521
51924
  capScope: "system",
@@ -49828,6 +52231,12 @@ Object.freeze({
49828
52231
  addonId: null,
49829
52232
  access: "create"
49830
52233
  },
52234
+ "webrtcSession.applyDownlinkProbe": {
52235
+ capName: "webrtc-session",
52236
+ capScope: "device",
52237
+ addonId: null,
52238
+ access: "create"
52239
+ },
49831
52240
  "webrtcSession.closeSession": {
49832
52241
  capName: "webrtc-session",
49833
52242
  capScope: "device",
@@ -51791,11 +54200,6 @@ Object.freeze({
51791
54200
  form: "single",
51792
54201
  optional: false
51793
54202
  }],
51794
- "decoder.createSession": [{
51795
- name: "deviceId",
51796
- form: "single",
51797
- optional: true
51798
- }],
51799
54203
  "detectionPipeline.applyDeviceSettingsPatch": [{
51800
54204
  name: "deviceId",
51801
54205
  form: "single",
@@ -52766,6 +55170,11 @@ Object.freeze({
52766
55170
  form: "single",
52767
55171
  optional: false
52768
55172
  }],
55173
+ "pipelineAnalytics.addRetrainFrameFromRecording": [{
55174
+ name: "deviceId",
55175
+ form: "single",
55176
+ optional: false
55177
+ }],
52769
55178
  "pipelineAnalytics.applyDeviceSettingsPatch": [{
52770
55179
  name: "deviceId",
52771
55180
  form: "single",
@@ -52956,6 +55365,11 @@ Object.freeze({
52956
55365
  form: "single",
52957
55366
  optional: false
52958
55367
  }],
55368
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
55369
+ name: "deviceId",
55370
+ form: "single",
55371
+ optional: false
55372
+ }],
52959
55373
  "pipelineAnalytics.pruneEventsBefore": [{
52960
55374
  name: "deviceId",
52961
55375
  form: "single",
@@ -53006,6 +55420,11 @@ Object.freeze({
53006
55420
  form: "single",
53007
55421
  optional: false
53008
55422
  }],
55423
+ "pipelineAnalytics.setRetrainFrameComplete": [{
55424
+ name: "deviceId",
55425
+ form: "single",
55426
+ optional: false
55427
+ }],
53009
55428
  "pipelineAnalytics.setTrackFlags": [{
53010
55429
  name: "deviceId",
53011
55430
  form: "single",
@@ -53026,6 +55445,11 @@ Object.freeze({
53026
55445
  form: "single",
53027
55446
  optional: false
53028
55447
  }],
55448
+ "pipelineExecutor.clearModelBoundDeviceOverrides": [{
55449
+ name: "deviceIds",
55450
+ form: "array",
55451
+ optional: true
55452
+ }],
53029
55453
  "pipelineExecutor.runPipeline": [{
53030
55454
  name: "deviceId",
53031
55455
  form: "single",
@@ -53131,6 +55555,11 @@ Object.freeze({
53131
55555
  form: "single",
53132
55556
  optional: false
53133
55557
  }],
55558
+ "pipelineOrchestrator.setCameraStepSettings": [{
55559
+ name: "deviceId",
55560
+ form: "single",
55561
+ optional: false
55562
+ }],
53134
55563
  "pipelineOrchestrator.setCameraStepToggle": [{
53135
55564
  name: "deviceId",
53136
55565
  form: "single",
@@ -53902,6 +56331,11 @@ Object.freeze({
53902
56331
  form: "single",
53903
56332
  optional: false
53904
56333
  }],
56334
+ "webrtcSession.applyDownlinkProbe": [{
56335
+ name: "deviceId",
56336
+ form: "single",
56337
+ optional: false
56338
+ }],
53905
56339
  "webrtcSession.closeSession": [{
53906
56340
  name: "deviceId",
53907
56341
  form: "single",
@@ -54435,7 +56869,7 @@ var STATE_SUMMARY_VARS = [
54435
56869
  {
54436
56870
  name: "summarySection",
54437
56871
  label: "Summary: this section",
54438
- description: "The section a per-section summary row is about (D698); on a summary sent as one message, every section it reports, comma-separated.",
56872
+ description: "The section a per-section summary row is about; on a summary sent as one message, every section it reports, comma-separated.",
54439
56873
  example: "Batterie scariche",
54440
56874
  group: "system",
54441
56875
  families: ["rule"],
@@ -156093,7 +158527,7 @@ function buildInitialStatus2(config, enabled) {
156093
158527
  * Node-only (`node:child_process`), so it lives under `@camstack/types/node`.
156094
158528
  */
156095
158529
  /** The detail a site refusing for want of a binary puts in its refusal. */
156096
- var NO_PINNED_FFMPEG_DETAIL = "no pinned ffmpeg on this node (D540)";
158530
+ var NO_PINNED_FFMPEG_DETAIL = "no pinned ffmpeg on this node";
156097
158531
  /**
156098
158532
  * {@link pinnedFfmpegSpawner}, asked at the point of use through the node's
156099
158533
  * resolver (`memoizePinnedFfmpeg`). A site that keeps the RESOLVER rather than
@@ -156233,7 +158667,7 @@ var reolinkCameraSchema = object({
156233
158667
  host: string().describe("Camera IP or hostname"),
156234
158668
  port: number().default(9e3).describe("Baichuan port (default 9000)"),
156235
158669
  username: string().default("admin").describe("Username"),
156236
- password: string().describe("Password"),
158670
+ password: string().describe("Password").meta({ secret: true }),
156237
158671
  /**
156238
158672
  * Transport mode resolved at creation time by autodetect (Slice 15).
156239
158673
  * - `tcp` : standard TCP-based Baichuan (regular cameras, NVR/Hub)
@@ -156914,7 +159348,7 @@ var reolinkHubSchema = object({
156914
159348
  host: string().describe("Hub IP or hostname"),
156915
159349
  port: number().default(9e3).describe("Baichuan port (default 9000)"),
156916
159350
  username: string().default("admin"),
156917
- password: string(),
159351
+ password: string().meta({ secret: true }),
156918
159352
  /** Hubs are TCP-only on supported firmwares — kept here for symmetry. */
156919
159353
  transport: _enum(["tcp", "udp"]).default("tcp"),
156920
159354
  /** UID is unused on Hubs (no UDP discovery), but persisted for symmetry. */
@@ -164696,6 +167130,31 @@ function createAccessoryDevice(kind, ctx, parent) {
164696
167130
  }
164697
167131
  //#endregion
164698
167132
  //#region src/accessory-probe-flags.ts
167133
+ /**
167134
+ * Pure helpers that decide which probe flags drive accessory-child
167135
+ * derivation, and whether a Reolink camera has *ever* been probed.
167136
+ *
167137
+ * Why this exists as its own module: the `feature-probe` runtime-state
167138
+ * slice is the live, in-session source of the camera's ability flags
167139
+ * (`hasSiren` / `hasFloodlight` / `hasPirSensor` / …). It is rehydrated
167140
+ * on restart, BUT a camera whose Baichuan `getDeviceCapabilities`
167141
+ * round-trip is slow or flaky (observed: a doorbell that times out the
167142
+ * kernel's 30s `onProbe` window on every boot) restores with an empty
167143
+ * slice (`lastProbedAt === 0`). The `deviceCache` config blob — written
167144
+ * alongside the slice on the LAST successful probe and preserved across
167145
+ * restarts by the camera schema's `.loose()` passthrough — still carries
167146
+ * that probe's flags plus a `probedAt` stamp.
167147
+ *
167148
+ * Deriving accessory specs from the `deviceCache` fallback lets the
167149
+ * kernel re-spawn the persisted accessory children (and therefore
167150
+ * re-mount their kernel-managed `device-ops` provider) even when this
167151
+ * session's live probe never completes. Without it, every accessory of
167152
+ * a slow-probing camera is left as a DB row with no live provider
167153
+ * ("device-ops not registered for device N").
167154
+ *
167155
+ * Kept pure (no `this`, no I/O) so the slice-vs-cache precedence is
167156
+ * unit-testable without standing up a full camera device.
167157
+ */
164699
167158
  var FLAG_KEYS = [
164700
167159
  "hasBattery",
164701
167160
  "hasPtz",
@@ -164733,6 +167192,43 @@ function resolveAccessoryProbeFlags(sliceProbed, sliceFlags, deviceCache) {
164733
167192
  }
164734
167193
  return out;
164735
167194
  }
167195
+ /**
167196
+ * The `deviceCache` blob a successful feature probe leaves behind: the
167197
+ * previous blob, plus the `probedAt` stamp and every boolean ability flag
167198
+ * the probe resolved. This is what lets {@link resolveAccessoryProbeFlags}
167199
+ * fall back on the next boot — a battery camera asleep at boot skips its
167200
+ * probe, and the `feature-probe` slice alone does not carry the flags
167201
+ * across a provider restart. Returns a new object; `previous` is untouched.
167202
+ */
167203
+ function withPersistedProbe(previous, flags, probedAt) {
167204
+ const persisted = {};
167205
+ for (const key of FLAG_KEYS) {
167206
+ const value = flags[key];
167207
+ if (typeof value === "boolean") persisted[key] = value;
167208
+ }
167209
+ return {
167210
+ ...previous,
167211
+ ...persisted,
167212
+ probedAt
167213
+ };
167214
+ }
167215
+ /** The accessory children a probe flag set spawns, in spawn order. */
167216
+ var ACCESSORY_FLAGS = [
167217
+ ["hasSiren", AccessoryKind.Siren],
167218
+ ["hasFloodlight", AccessoryKind.Floodlight],
167219
+ ["hasPirSensor", AccessoryKind.PirSensor]
167220
+ ];
167221
+ /**
167222
+ * Accessory kinds a camera should spawn: none until it has EVER probed
167223
+ * (live slice this session, or a persisted `probedAt`), then one per
167224
+ * ability flag that is exactly `true` — live slice first, persisted
167225
+ * `deviceCache` flags as the fallback.
167226
+ */
167227
+ function accessoryKindsFor(sliceProbed, sliceFlags, deviceCache) {
167228
+ if (!hasEverProbed(sliceProbed, deviceCache)) return [];
167229
+ const flags = resolveAccessoryProbeFlags(sliceProbed, sliceFlags, deviceCache);
167230
+ return ACCESSORY_FLAGS.filter(([flag]) => flags[flag] === true).map(([, kind]) => kind);
167231
+ }
164736
167232
  //#endregion
164737
167233
  //#region src/metadata-populator.ts
164738
167234
  var EXTENDED_INFO_TAGS = [
@@ -167548,9 +170044,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
167548
170044
  * parent register.
167549
170045
  */
167550
170046
  getAccessoryChildren() {
167551
- const deviceCache = this.config.get("deviceCache");
167552
- if (!hasEverProbed(this.hasProbed(), deviceCache)) return [];
167553
- const probe = resolveAccessoryProbeFlags(this.hasProbed(), this.getProbeFlags(), deviceCache);
170047
+ const kinds = accessoryKindsFor(this.hasProbed(), this.getProbeFlags(), this.config.get("deviceCache"));
167554
170048
  const out = [];
167555
170049
  const push = (kind, type, label) => {
167556
170050
  out.push({
@@ -167566,9 +170060,9 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
167566
170060
  factory: (ctx) => createAccessoryDevice(kind, ctx, this)
167567
170061
  });
167568
170062
  };
167569
- if (probe.hasSiren === true) push(AccessoryKind.Siren, DeviceType.Siren, ACCESSORY_LABEL[AccessoryKind.Siren]);
167570
- if (probe.hasFloodlight === true) push(AccessoryKind.Floodlight, DeviceType.Light, ACCESSORY_LABEL[AccessoryKind.Floodlight]);
167571
- if (probe.hasPirSensor === true) push(AccessoryKind.PirSensor, DeviceType.Switch, ACCESSORY_LABEL[AccessoryKind.PirSensor]);
170063
+ if (kinds.includes(AccessoryKind.Siren)) push(AccessoryKind.Siren, DeviceType.Siren, ACCESSORY_LABEL[AccessoryKind.Siren]);
170064
+ if (kinds.includes(AccessoryKind.Floodlight)) push(AccessoryKind.Floodlight, DeviceType.Light, ACCESSORY_LABEL[AccessoryKind.Floodlight]);
170065
+ if (kinds.includes(AccessoryKind.PirSensor)) push(AccessoryKind.PirSensor, DeviceType.Switch, ACCESSORY_LABEL[AccessoryKind.PirSensor]);
167572
170066
  return out;
167573
170067
  }
167574
170068
  /**
@@ -172019,6 +174513,14 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
172019
174513
  meta: { error: err instanceof Error ? err.message : String(err) }
172020
174514
  });
172021
174515
  }
174516
+ if (!this.hasProbed()) try {
174517
+ await this.reprobe();
174518
+ } catch (err) {
174519
+ this.ctx.logger.debug("onWakeTransition: feature probe failed — next wake retries", {
174520
+ tags: { deviceId: this.id },
174521
+ meta: { error: err instanceof Error ? err.message : String(err) }
174522
+ });
174523
+ }
172022
174524
  await this.warmCapSlicesOnWake();
172023
174525
  await this.warmSnapshotOnWake();
172024
174526
  await this.alignAuxDevicesState("wake");
@@ -174087,6 +176589,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
174087
176589
  let hasBattery;
174088
176590
  let hasPirSensor;
174089
176591
  let hasAutotrack;
176592
+ let capabilitiesRead = false;
174090
176593
  try {
174091
176594
  channelCount = await api.getChannelCount();
174092
176595
  } catch {}
@@ -174100,6 +176603,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
174100
176603
  hasBattery = capabilities.hasBattery;
174101
176604
  hasPirSensor = capabilities.hasPir;
174102
176605
  hasAutotrack = capabilities.hasAutotracking;
176606
+ capabilitiesRead = true;
174103
176607
  } catch (err) {
174104
176608
  this.ctx.logger.debug("getDeviceCapabilities failed — leaving flags unset", {
174105
176609
  tags: { deviceId: this.id },
@@ -174136,12 +176640,12 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
174136
176640
  };
174137
176641
  this.runtimeState.setCapState("feature-probe", next);
174138
176642
  try {
174139
- const previous = this.config.get("deviceCache") ?? {};
174140
- await this.config.setAll({ deviceCache: {
174141
- ...previous,
176643
+ const identity = {
176644
+ ...this.config.get("deviceCache") ?? {},
174142
176645
  ...inferredDeviceType ? { deviceType: inferredDeviceType } : {},
174143
176646
  ...channelCount !== void 0 ? { channelCount } : {}
174144
- } });
176647
+ };
176648
+ await this.config.setAll({ deviceCache: capabilitiesRead ? withPersistedProbe(identity, flags, now) : identity });
174145
176649
  } catch (err) {
174146
176650
  this.ctx.logger.debug("deviceCache identity persist failed (non-fatal)", {
174147
176651
  tags: { deviceId: this.id },
@@ -176592,6 +179096,8 @@ async function enrichHostIdentifiersFromLiveApi(detection, logger) {
176592
179096
  }
176593
179097
  }
176594
179098
  var ReolinkProviderAddon = class extends BaseDeviceProvider {
179099
+ /** The email-push SMTP password is hidden state — kept in the keychain (D787). */
179100
+ secretStatePaths = ["emailPushAuthPassword"];
176595
179101
  addonId = REOLINK_ADDON_ID;
176596
179102
  providerName = "Reolink";
176597
179103
  deviceClasses = {