@camstack/addon-provider-onvif 1.2.121 → 1.2.123

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +2906 -504
  2. package/dist/addon.mjs +2906 -504
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -3,7 +3,7 @@ import { createRequire } from "node:module";
3
3
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
4
4
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
5
  //#endregion
6
- //#region ../types/dist/event-category-BGmz_oxW.mjs
6
+ //#region ../types/dist/event-category-DaIZi00R.mjs
7
7
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
8
8
  EventCategory["SystemBoot"] = "system.boot";
9
9
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -82,6 +82,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
82
82
  */
83
83
  EventCategory["AddonLoadFailed"] = "addon.load-failed";
84
84
  /**
85
+ * A keychain value was stored or removed (D787). Carries the ref, its
86
+ * owner and the new version — NEVER the value. A process holding the ref
87
+ * drops its cached copy and the owning `BaseAddon` re-resolves its config.
88
+ * Telemetry (D8): a process that misses it still revalidates by version.
89
+ */
90
+ EventCategory["KeychainChanged"] = "keychain.changed";
91
+ /**
85
92
  * Addon recovered from a previous failure. Emitted when an addon
86
93
  * transitions from `failed` back to `healthy` (typically via the
87
94
  * monitor's auto-retry loop, or after manual `addons.retryLoad`).
@@ -504,15 +511,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
504
511
  EventCategory["AgentWsDisconnected"] = "agent.ws.disconnected";
505
512
  EventCategory["AgentBackupActivated"] = "agent.backup.activated";
506
513
  EventCategory["OrchestrationSettingsUpdated"] = "orchestration.settings-updated";
507
- /**
508
- * Per-agent hwaccel preference changed (user override set, cleared, or
509
- * re-probed). Observability event — decoders pull the current pref at
510
- * `createSession`, so running sessions keep their current backend until
511
- * they rotate naturally (camera add/remove, stream restart). Future
512
- * work can wire a listener in stream-broker that force-rotates live
513
- * sessions; for now this event powers logs + admin-UI toast feedback.
514
- */
515
- EventCategory["PipelineAgentHwaccelChanged"] = "pipeline.agent-hwaccel-changed";
516
514
  EventCategory["MotionAnalysis"] = "detection.motion-analysis";
517
515
  /** All raw motion zones from CCL before minArea filter — for UI debug overlay. */
518
516
  EventCategory["MotionZonesRaw"] = "detection.motion-zones-raw";
@@ -5383,7 +5381,7 @@ var ZodIssueCode = {
5383
5381
  var ZodFirstPartyTypeKind;
5384
5382
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5385
5383
  //#endregion
5386
- //#region ../types/dist/sleep-DXKLNFvA.mjs
5384
+ //#region ../types/dist/sleep-Cr5YOk3m.mjs
5387
5385
  /**
5388
5386
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5389
5387
  * window to float samples (D455).
@@ -5462,6 +5460,97 @@ function buildAlawTable() {
5462
5460
  }
5463
5461
  buildUlawTable();
5464
5462
  buildAlawTable();
5463
+ /** Is this field's stored value a credential? */
5464
+ function isSecretConfigField(field) {
5465
+ if (field.type === "password") return true;
5466
+ return "secret" in field && field.secret === true;
5467
+ }
5468
+ /**
5469
+ * Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
5470
+ * by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
5471
+ */
5472
+ function isKeychainStoredField(field) {
5473
+ if (!isSecretConfigField(field)) return false;
5474
+ if (field.type === "textarea" && field.isJson === true) return false;
5475
+ return !("storage" in field && field.storage === "inline");
5476
+ }
5477
+ /**
5478
+ * What a settings blob holds where a secret used to be.
5479
+ *
5480
+ * A keychain-stored field never holds its value. It holds a self-describing
5481
+ * MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
5482
+ * code can mistake it for a credential and no form can send it to a camera as
5483
+ * a password. The empty state is `null` / absent, never `''`.
5484
+ *
5485
+ * The same shapes travel to and from the admin UI:
5486
+ *
5487
+ * - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
5488
+ * (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
5489
+ * value is set, never the value.
5490
+ * - write: an untouched field submits the view back unchanged (KEEP); a typed
5491
+ * value is a plain non-empty string (CHANGE); the Clear button submits
5492
+ * {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
5493
+ * are KEEP — an empty string is what a defaults-fallback pushes back, and
5494
+ * treating it as "clear" is how a save destroyed a stored credential before.
5495
+ *
5496
+ * Pure and browser-safe.
5497
+ */
5498
+ var SECRET_CLEAR = { $secretClear: true };
5499
+ /** The `'***'` token D634 redaction writes for non-admins. */
5500
+ var LEGACY_DEVICE_REDACTION = "***";
5501
+ function isRecord$1(value) {
5502
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5503
+ }
5504
+ function makeSecretMarker(ref) {
5505
+ return {
5506
+ $secret: ref,
5507
+ v: 1
5508
+ };
5509
+ }
5510
+ /** A stored marker: an object whose `$secret` is a non-empty string. */
5511
+ function isSecretMarker(value) {
5512
+ if (!isRecord$1(value)) return false;
5513
+ const ref = value["$secret"];
5514
+ return typeof ref === "string" && ref.length > 0;
5515
+ }
5516
+ function isSecretClear(value) {
5517
+ return isRecord$1(value) && value["$secretClear"] === true;
5518
+ }
5519
+ /**
5520
+ * The UI view of a stored secret field value: a marker becomes "set", inline
5521
+ * plaintext becomes "set (inline)", nothing becomes `null`. A value never
5522
+ * survives this function.
5523
+ */
5524
+ function toSecretFieldView(stored) {
5525
+ if (isSecretMarker(stored)) return {
5526
+ $secret: stored.$secret,
5527
+ v: 1,
5528
+ set: true
5529
+ };
5530
+ if (typeof stored === "string" && stored.length > 0) return {
5531
+ $secret: null,
5532
+ v: 1,
5533
+ set: true,
5534
+ inline: true
5535
+ };
5536
+ return null;
5537
+ }
5538
+ /**
5539
+ * Classify an incoming value for a secret path. Only a non-empty string that is
5540
+ * not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
5541
+ * Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
5542
+ * `undefined`, a redaction token, a non-string — keeps what is stored.
5543
+ */
5544
+ function classifySecretWrite(incoming) {
5545
+ if (isSecretClear(incoming)) return { kind: "clear" };
5546
+ if (typeof incoming !== "string") return { kind: "keep" };
5547
+ if (incoming.length === 0) return { kind: "keep" };
5548
+ if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
5549
+ return {
5550
+ kind: "set",
5551
+ value: incoming
5552
+ };
5553
+ }
5465
5554
  Object.fromEntries([
5466
5555
  {
5467
5556
  id: "overview",
@@ -5633,33 +5722,19 @@ Object.fromEntries([
5633
5722
  function isValuelessField(field) {
5634
5723
  return field.type === "separator" || field.type === "info" || field.type === "qr-code" || field.type === "button" || field.type === "object-array" || field.type === "widget" || field.type === "addon-action-button" || field.type === "device-action-button";
5635
5724
  }
5636
- /**
5637
- * Merge a `ConfigUISchema` with a raw `values` record into a
5638
- * `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
5639
- * before returning to the admin UI. Groups are walked recursively.
5640
- *
5641
- * For each leaf field:
5642
- * - structural fields (`separator`, `info`, `button`) pass through unchanged
5643
- * - other fields get `value = values[key] ?? field.default ?? null`
5644
- *
5645
- * Unknown keys in `values` (keys not declared in the schema) are silently
5646
- * ignored — they don't contribute to the output. Missing keys fall back to
5647
- * the schema default or `null`. This mirrors the old backend behaviour where
5648
- * `FormBuilder` rendered `values[key] ?? field.default`.
5649
- */
5650
- function hydrateSchema(schema, values) {
5725
+ function hydrateSchema(schema, values, options = {}) {
5651
5726
  return {
5652
5727
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
5653
5728
  sections: schema.sections.map((section) => ({
5654
5729
  ...section,
5655
- fields: section.fields.map((field) => hydrateField(field, values))
5730
+ fields: section.fields.map((field) => hydrateField(field, values, options))
5656
5731
  }))
5657
5732
  };
5658
5733
  }
5659
- function hydrateField(field, values) {
5734
+ function hydrateField(field, values, options) {
5660
5735
  if (isValuelessField(field)) return field;
5661
5736
  if (field.type === "group") {
5662
- const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
5737
+ const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
5663
5738
  return {
5664
5739
  ...field,
5665
5740
  fields: hydratedChildren
@@ -5668,7 +5743,7 @@ function hydrateField(field, values) {
5668
5743
  if (field.type === "sub-tabs") {
5669
5744
  const hydratedTabs = field.tabs.map((tab) => ({
5670
5745
  ...tab,
5671
- fields: tab.fields.map((child) => hydrateField(child, values))
5746
+ fields: tab.fields.map((child) => hydrateField(child, values, options))
5672
5747
  }));
5673
5748
  return {
5674
5749
  ...field,
@@ -5678,6 +5753,33 @@ function hydrateField(field, values) {
5678
5753
  const key = field.key;
5679
5754
  const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
5680
5755
  const defaultValue = field.default;
5756
+ const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
5757
+ if (isKeychainStoredField(field) && asView(storedValue)) return {
5758
+ ...field,
5759
+ value: toSecretFieldView(storedValue)
5760
+ };
5761
+ if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
5762
+ ...field,
5763
+ value: null
5764
+ };
5765
+ if (field.type === "editable-array" && Array.isArray(storedValue)) {
5766
+ const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
5767
+ if (secretItemKeys.length > 0) {
5768
+ const rows = storedValue.map((row) => {
5769
+ if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
5770
+ const out = { ...row };
5771
+ for (const k of secretItemKeys) {
5772
+ const v = Reflect.get(row, k);
5773
+ if (asView(v)) out[k] = toSecretFieldView(v);
5774
+ }
5775
+ return out;
5776
+ });
5777
+ return {
5778
+ ...field,
5779
+ value: rows
5780
+ };
5781
+ }
5782
+ }
5681
5783
  if (field.multiple) {
5682
5784
  const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
5683
5785
  const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
@@ -5920,6 +6022,431 @@ function projectStore(store, perNodeKeys, nodeId) {
5920
6022
  }
5921
6023
  return out;
5922
6024
  }
6025
+ var GLOBAL_SCOPE = { kind: "global" };
6026
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6027
+ function globalSecretScope() {
6028
+ return GLOBAL_SCOPE;
6029
+ }
6030
+ function encodeSegment(value) {
6031
+ return encodeURIComponent(value);
6032
+ }
6033
+ /**
6034
+ * The field path of a value inside an array item, addressed by the item's id:
6035
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6036
+ * `providers[authentik].clientSecret`.
6037
+ */
6038
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6039
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6040
+ }
6041
+ /** A write to a secret path could not be stored in the keychain, so it was refused. */
6042
+ var KeychainWriteRefusedError = class extends Error {
6043
+ fieldPath;
6044
+ constructor(fieldPath, cause) {
6045
+ super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
6046
+ this.fieldPath = fieldPath;
6047
+ this.name = "KeychainWriteRefusedError";
6048
+ }
6049
+ };
6050
+ var KEEP = { kind: "keep" };
6051
+ function isRecord(value) {
6052
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6053
+ }
6054
+ function defaultMintId() {
6055
+ return globalThis.crypto.randomUUID();
6056
+ }
6057
+ /** Every marker ref anywhere under `value`. */
6058
+ function collectSecretMarkerRefs(value, out = []) {
6059
+ if (isSecretMarker(value)) {
6060
+ out.push(value.$secret);
6061
+ return out;
6062
+ }
6063
+ if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6064
+ else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6065
+ return out;
6066
+ }
6067
+ async function storedValueEquals(secrets, marker, candidate) {
6068
+ const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
6069
+ return resolved?.kind === "value" && resolved.value === candidate;
6070
+ }
6071
+ async function writeLeaf(ctx, incoming, stored, fieldPath) {
6072
+ const intent = classifySecretWrite(incoming);
6073
+ const ref = ctx.secrets.ref(ctx.scope, fieldPath);
6074
+ const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
6075
+ if (intent.kind === "keep") return KEEP;
6076
+ if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
6077
+ if (intent.kind === "clear") {
6078
+ if (storedIsOurs) ctx.deletes.push(ref);
6079
+ return {
6080
+ kind: "value",
6081
+ value: null
6082
+ };
6083
+ }
6084
+ if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
6085
+ kind: "value",
6086
+ value: stored
6087
+ };
6088
+ try {
6089
+ await ctx.secrets.put(ref, intent.value);
6090
+ } catch (err) {
6091
+ throw new KeychainWriteRefusedError(fieldPath, err);
6092
+ }
6093
+ return {
6094
+ kind: "value",
6095
+ value: makeSecretMarker(ref)
6096
+ };
6097
+ }
6098
+ /** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
6099
+ function applyMember(out, key, result, storedParent) {
6100
+ if (result.kind === "value") {
6101
+ out[key] = result.value;
6102
+ return;
6103
+ }
6104
+ if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
6105
+ else delete out[key];
6106
+ }
6107
+ async function writeMembers(ctx, children, incoming, stored, pathOf) {
6108
+ const out = { ...incoming };
6109
+ for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
6110
+ return out;
6111
+ }
6112
+ function rowId(row, idKey) {
6113
+ const raw = row[idKey];
6114
+ if (typeof raw === "string" && raw.length > 0) return raw;
6115
+ if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
6116
+ return null;
6117
+ }
6118
+ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6119
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6120
+ if (!Array.isArray(incoming)) {
6121
+ ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6122
+ return {
6123
+ kind: "value",
6124
+ value: incoming
6125
+ };
6126
+ }
6127
+ const storedById = /* @__PURE__ */ new Map();
6128
+ for (const row of storedRows) {
6129
+ const id = rowId(row, node.idKey);
6130
+ if (id !== null) storedById.set(id, row);
6131
+ }
6132
+ const kept = /* @__PURE__ */ new Set();
6133
+ const rows = [];
6134
+ for (const row of incoming) {
6135
+ if (!isRecord(row)) {
6136
+ rows.push(row);
6137
+ continue;
6138
+ }
6139
+ const id = rowId(row, node.idKey) ?? ctx.mintId();
6140
+ kept.add(id);
6141
+ const withId = {
6142
+ ...row,
6143
+ [node.idKey]: row[node.idKey] ?? id
6144
+ };
6145
+ if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
6146
+ const storedRow = storedById.get(id) ?? {};
6147
+ rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
6148
+ }
6149
+ for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
6150
+ return {
6151
+ kind: "value",
6152
+ value: rows
6153
+ };
6154
+ }
6155
+ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6156
+ switch (node.kind) {
6157
+ case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6158
+ case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6159
+ case "object": {
6160
+ if (!isRecord(incoming)) {
6161
+ if (incoming === void 0) return KEEP;
6162
+ ctx.deletes.push(...collectSecretMarkerRefs(stored));
6163
+ return {
6164
+ kind: "value",
6165
+ value: incoming
6166
+ };
6167
+ }
6168
+ const storedObj = isRecord(stored) ? stored : {};
6169
+ return {
6170
+ kind: "value",
6171
+ value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
6172
+ };
6173
+ }
6174
+ }
6175
+ }
6176
+ /** Split a perNode-scoped key (`key@nodeId`). */
6177
+ function splitNodeKey(key) {
6178
+ const at = key.indexOf("@");
6179
+ return at <= 0 ? {
6180
+ base: key,
6181
+ nodeId: null
6182
+ } : {
6183
+ base: key.slice(0, at),
6184
+ nodeId: key.slice(at + 1)
6185
+ };
6186
+ }
6187
+ /** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
6188
+ async function transformSecretWrite(input) {
6189
+ const deletes = [];
6190
+ const base = {
6191
+ secrets: input.secrets,
6192
+ mintId: input.mintId ?? defaultMintId,
6193
+ deletes,
6194
+ operatorWrite: input.operatorWrite === true
6195
+ };
6196
+ const out = {};
6197
+ for (const [key, incoming] of Object.entries(input.patch)) {
6198
+ const { base: baseKey, nodeId } = splitNodeKey(key);
6199
+ const node = input.tree.get(baseKey);
6200
+ if (node === void 0) {
6201
+ out[key] = incoming;
6202
+ continue;
6203
+ }
6204
+ const scope = nodeId !== null && nodeId.length > 0 ? {
6205
+ kind: "node",
6206
+ nodeId
6207
+ } : input.scope ?? globalSecretScope();
6208
+ const result = await writeNode({
6209
+ ...base,
6210
+ scope
6211
+ }, node, incoming, input.stored[key], baseKey);
6212
+ if (result.kind === "value") out[key] = result.value;
6213
+ }
6214
+ return {
6215
+ patch: out,
6216
+ afterWrite: async () => {
6217
+ if (deletes.length === 0) return { orphaned: [] };
6218
+ try {
6219
+ await input.secrets.delete([...new Set(deletes)]);
6220
+ return { orphaned: [] };
6221
+ } catch {
6222
+ return { orphaned: [...new Set(deletes)] };
6223
+ }
6224
+ }
6225
+ };
6226
+ }
6227
+ /**
6228
+ * Replace every marker in `value` with its keychain value. Returns the SAME
6229
+ * reference when there is no marker (no allocation, no keychain call).
6230
+ */
6231
+ async function resolveSecretMarkers(value, secrets) {
6232
+ const refs = collectSecretMarkerRefs(value);
6233
+ if (refs.length === 0) return {
6234
+ value,
6235
+ unresolved: []
6236
+ };
6237
+ const answers = await secrets.resolve(refs);
6238
+ const unresolved = [];
6239
+ for (const ref of new Set(refs)) {
6240
+ const answer = answers[ref];
6241
+ if (answer === void 0) unresolved.push({
6242
+ ref,
6243
+ reason: "not-initialized"
6244
+ });
6245
+ else if (answer.kind === "unavailable") unresolved.push({
6246
+ ref,
6247
+ reason: answer.reason
6248
+ });
6249
+ else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
6250
+ ref,
6251
+ reason: answer.kind
6252
+ });
6253
+ }
6254
+ const substitute = (v) => {
6255
+ if (isSecretMarker(v)) {
6256
+ const answer = answers[v.$secret];
6257
+ return answer?.kind === "value" ? {
6258
+ keep: true,
6259
+ value: answer.value
6260
+ } : {
6261
+ keep: false,
6262
+ value: void 0
6263
+ };
6264
+ }
6265
+ if (Array.isArray(v)) {
6266
+ const items = [];
6267
+ for (const item of v) {
6268
+ const s = substitute(item);
6269
+ if (s.keep) items.push(s.value);
6270
+ }
6271
+ return {
6272
+ keep: true,
6273
+ value: items
6274
+ };
6275
+ }
6276
+ if (isRecord(v)) {
6277
+ const out = {};
6278
+ for (const [k, child] of Object.entries(v)) {
6279
+ const s = substitute(child);
6280
+ if (s.keep) out[k] = s.value;
6281
+ }
6282
+ return {
6283
+ keep: true,
6284
+ value: out
6285
+ };
6286
+ }
6287
+ return {
6288
+ keep: true,
6289
+ value: v
6290
+ };
6291
+ };
6292
+ return {
6293
+ value: substitute(value).value,
6294
+ unresolved
6295
+ };
6296
+ }
6297
+ function touchesTree(tree, patch) {
6298
+ if (tree.size === 0) return false;
6299
+ for (const key of Object.keys(patch)) {
6300
+ const at = key.indexOf("@");
6301
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6302
+ }
6303
+ return false;
6304
+ }
6305
+ /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6306
+ async function readStoredAddonBlob(raw) {
6307
+ const threeWay = raw.readAddonStoreResult;
6308
+ if (threeWay === void 0) return raw.readAddonStore();
6309
+ const result = await threeWay.call(raw);
6310
+ if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6311
+ return result.kind === "missing" ? {} : result.value;
6312
+ }
6313
+ function createSecretAwareSettings(raw, opts) {
6314
+ const chains = /* @__PURE__ */ new Map();
6315
+ const serialize = (key, fn) => {
6316
+ const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
6317
+ const tail = next.catch(() => void 0);
6318
+ chains.set(key, tail);
6319
+ tail.then(() => {
6320
+ if (chains.get(key) === tail) chains.delete(key);
6321
+ });
6322
+ return next;
6323
+ };
6324
+ const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6325
+ if (!touchesTree(tree, patch)) return rawWrite(patch);
6326
+ return serialize(chainKey, async () => {
6327
+ const stored = await readStored();
6328
+ const result = await transformSecretWrite({
6329
+ tree,
6330
+ secrets: opts.secrets,
6331
+ patch,
6332
+ stored,
6333
+ ...scope !== void 0 ? { scope } : {},
6334
+ operatorWrite: opts.isOperatorWrite?.() === true
6335
+ });
6336
+ if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6337
+ const { orphaned } = await result.afterWrite();
6338
+ if (orphaned.length > 0) opts.onOrphaned(orphaned);
6339
+ });
6340
+ };
6341
+ const wrapped = {
6342
+ writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6343
+ writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6344
+ kind: "device",
6345
+ deviceId
6346
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6347
+ };
6348
+ return new Proxy(raw, { get(target, prop, receiver) {
6349
+ if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6350
+ if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6351
+ const value = Reflect.get(target, prop, receiver);
6352
+ return typeof value === "function" ? value.bind(target) : value;
6353
+ } });
6354
+ }
6355
+ /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6356
+ function withSecretAwareSettings(context, opts) {
6357
+ const raw = context.settings;
6358
+ if (raw === void 0) return context;
6359
+ const settings = createSecretAwareSettings(raw, opts);
6360
+ return new Proxy(context, { get(target, prop, receiver) {
6361
+ if (prop === "settings") return settings;
6362
+ return Reflect.get(target, prop, receiver);
6363
+ } });
6364
+ }
6365
+ var LEAF = { kind: "leaf" };
6366
+ var DEFAULT_ITEM_ID_KEY = "id";
6367
+ function collectFields(fields, out) {
6368
+ for (const field of fields) {
6369
+ if (field.type === "group") {
6370
+ collectFields(field.fields, out);
6371
+ continue;
6372
+ }
6373
+ if (field.type === "sub-tabs") {
6374
+ for (const tab of field.tabs) collectFields(tab.fields, out);
6375
+ continue;
6376
+ }
6377
+ if (field.type === "editable-array") {
6378
+ const item = /* @__PURE__ */ new Map();
6379
+ for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
6380
+ if (item.size > 0) out.set(field.key, {
6381
+ kind: "array",
6382
+ idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
6383
+ item
6384
+ });
6385
+ continue;
6386
+ }
6387
+ if (!("key" in field) || typeof field.key !== "string") continue;
6388
+ if (isKeychainStoredField(field)) out.set(field.key, LEAF);
6389
+ }
6390
+ }
6391
+ /** The secret tree a settings schema declares. */
6392
+ function secretTreeFromSchema(schema) {
6393
+ const out = /* @__PURE__ */ new Map();
6394
+ if (schema === null) return out;
6395
+ for (const section of schema.sections) collectFields(section.fields, out);
6396
+ return out;
6397
+ }
6398
+ /** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
6399
+ function parseSecretStatePath(path) {
6400
+ const segments = [];
6401
+ for (const raw of path.split(".")) {
6402
+ const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
6403
+ if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
6404
+ segments.push(m[2] !== void 0 ? {
6405
+ key: m[1],
6406
+ idKey: m[2]
6407
+ } : { key: m[1] });
6408
+ }
6409
+ if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
6410
+ if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
6411
+ return segments;
6412
+ }
6413
+ function insert(into, segments) {
6414
+ const [head, ...rest] = segments;
6415
+ if (head === void 0) return;
6416
+ if (rest.length === 0) {
6417
+ into.set(head.key, LEAF);
6418
+ return;
6419
+ }
6420
+ const existing = into.get(head.key);
6421
+ if (head.idKey !== void 0) {
6422
+ const item = new Map(existing?.kind === "array" ? existing.item : []);
6423
+ insert(item, rest);
6424
+ into.set(head.key, {
6425
+ kind: "array",
6426
+ idKey: head.idKey,
6427
+ item
6428
+ });
6429
+ return;
6430
+ }
6431
+ const children = new Map(existing?.kind === "object" ? existing.children : []);
6432
+ insert(children, rest);
6433
+ into.set(head.key, {
6434
+ kind: "object",
6435
+ children
6436
+ });
6437
+ }
6438
+ /** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
6439
+ function mergeSecretStatePaths(tree, paths) {
6440
+ if (paths.length === 0) return tree;
6441
+ const out = new Map(tree);
6442
+ for (const path of paths) insert(out, parseSecretStatePath(path));
6443
+ return out;
6444
+ }
6445
+ /** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
6446
+ var SECRET_RETRY_FIRST_MS = 5e3;
6447
+ var SECRET_RETRY_MAX_MS = 5 * 6e4;
6448
+ /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
6449
+ var SECRET_CHANGE_DEBOUNCE_MS = 250;
5923
6450
  /**
5924
6451
  * Base class for CamStack addons. Eliminates settings boilerplate:
5925
6452
  *
@@ -5989,6 +6516,25 @@ var BaseAddon = class {
5989
6516
  settingsStoreReady = false;
5990
6517
  /** Default config values. Provided via constructor. */
5991
6518
  defaults;
6519
+ /**
6520
+ * Hidden-state paths that hold secrets (D787) — values the addon writes
6521
+ * itself (`updateGlobalSettings`, `state()`) that no form field declares.
6522
+ * Stored in the keychain exactly like a `password` field. Syntax:
6523
+ * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
6524
+ * (`key[<id field>]` addresses array items by id, never by index).
6525
+ */
6526
+ secretStatePaths = [];
6527
+ _addonSecretTree = null;
6528
+ _deviceSecretTree = null;
6529
+ /** Refs the last resolved config pointed at — a change to one re-resolves. */
6530
+ _configSecretRefs = /* @__PURE__ */ new Set();
6531
+ _unresolvedSecrets = [];
6532
+ _secretRetryTimer = null;
6533
+ _secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
6534
+ _secretChangeTimer = null;
6535
+ _secretChangeUnsub = null;
6536
+ /** >0 while an OPERATOR's settings write is being applied. */
6537
+ _operatorWriteDepth = 0;
5992
6538
  constructor(defaults) {
5993
6539
  this.defaults = defaults;
5994
6540
  this._config = { ...defaults };
@@ -6024,8 +6570,18 @@ var BaseAddon = class {
6024
6570
  return this._config;
6025
6571
  }
6026
6572
  async initialize(context) {
6027
- this._ctx = context;
6573
+ const secrets = context.secrets;
6574
+ this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6575
+ secrets,
6576
+ addonTree: () => this.addonSecretTree(),
6577
+ deviceTree: () => this.deviceSecretTree(),
6578
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6579
+ isOperatorWrite: () => this._operatorWriteDepth > 0
6580
+ }) : context;
6028
6581
  await this.resolveConfig();
6582
+ if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6583
+ if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
6584
+ });
6029
6585
  const result = await this.onInitialize();
6030
6586
  this.emitLifecycle(EventCategory.AddonStarted);
6031
6587
  const normalized = normalizeAddonInitResult(result);
@@ -6058,6 +6614,12 @@ var BaseAddon = class {
6058
6614
  */
6059
6615
  async onHubReachable() {}
6060
6616
  async shutdown() {
6617
+ this._secretChangeUnsub?.();
6618
+ this._secretChangeUnsub = null;
6619
+ if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
6620
+ if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
6621
+ this._secretRetryTimer = null;
6622
+ this._secretChangeTimer = null;
6061
6623
  this.emitLifecycle(EventCategory.AddonStopped);
6062
6624
  if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
6063
6625
  await this.onShutdown();
@@ -6136,7 +6698,7 @@ var BaseAddon = class {
6136
6698
  return hydrateSchema(schema, overlay ? {
6137
6699
  ...projected,
6138
6700
  ...overlay
6139
- } : projected);
6701
+ } : projected, { inlineSecretsAsViews: true });
6140
6702
  }
6141
6703
  /**
6142
6704
  * The integration-level view of this addon's settings: exactly the sections
@@ -6185,7 +6747,7 @@ var BaseAddon = class {
6185
6747
  return hydrateSchema({
6186
6748
  ...schema,
6187
6749
  sections
6188
- }, projected);
6750
+ }, projected, { inlineSecretsAsViews: true });
6189
6751
  }
6190
6752
  /**
6191
6753
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -6239,18 +6801,50 @@ var BaseAddon = class {
6239
6801
  value: result.value[key]
6240
6802
  };
6241
6803
  }
6804
+ /**
6805
+ * The OPERATOR's write — a settings form or an admin API call, dispatched by
6806
+ * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
6807
+ * the operator sends is stored as sent even when it equals a pre-keychain
6808
+ * inline value: the operator re-entering a password is a change, an addon
6809
+ * writing back what it read is not (D787).
6810
+ */
6811
+ async updateGlobalSettingsAsOperator(patch, nodeId) {
6812
+ this._operatorWriteDepth++;
6813
+ try {
6814
+ await this.applyGlobalPatch(patch, nodeId);
6815
+ } finally {
6816
+ this._operatorWriteDepth--;
6817
+ }
6818
+ }
6242
6819
  async updateGlobalSettings(patch, nodeId) {
6820
+ await this.applyGlobalPatch(patch, nodeId);
6821
+ }
6822
+ /**
6823
+ * REMOVE stored secrets — their keychain values and their markers (D787).
6824
+ *
6825
+ * Writing `''` to a secret field KEEPS what is stored (an empty string is
6826
+ * what a defaults fallback writes back, and it must never destroy a
6827
+ * credential), so code that means "forget this token" says so here. Without
6828
+ * a keychain (an older kernel) it writes `''`, as such code always did.
6829
+ */
6830
+ async clearSecrets(keys, nodeId) {
6831
+ const tree = this.addonSecretTree();
6832
+ const keychain = this._ctx?.secrets !== void 0;
6833
+ const patch = {};
6834
+ for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
6835
+ await this.applyGlobalPatch(patch, nodeId);
6836
+ }
6837
+ async applyGlobalPatch(barePatch, nodeId) {
6243
6838
  const keys = this.perNodeKeys();
6244
6839
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6245
6840
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6246
- const barePatch = patch;
6247
6841
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6248
6842
  await this._ctx?.settings?.writeAddonStore(scoped);
6249
6843
  if (target !== localNode) return;
6250
6844
  await this.resolveConfig();
6251
6845
  await this.onConfigChanged();
6252
6846
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
6253
- this.maybeAutoRestart(patch, this.globalSettingsSchema());
6847
+ this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
6254
6848
  }
6255
6849
  /**
6256
6850
  * The set of field keys the global settings schema declares `perNode: true`
@@ -6275,7 +6869,7 @@ var BaseAddon = class {
6275
6869
  * time to return its response before the addon is torn down and
6276
6870
  * re-initialised by `AddonRegistryService.restartAddon`.
6277
6871
  */
6278
- maybeAutoRestart(patch, schema) {
6872
+ maybeAutoRestart(patchKeys, schema) {
6279
6873
  if (!schema) return;
6280
6874
  const restartKeys = /* @__PURE__ */ new Set();
6281
6875
  for (const section of schema.sections) for (const field of section.fields) {
@@ -6283,13 +6877,13 @@ var BaseAddon = class {
6283
6877
  if (field.requiresRestart) restartKeys.add(field.key);
6284
6878
  }
6285
6879
  if (restartKeys.size === 0) return;
6286
- if (!Object.keys(patch).some((k) => restartKeys.has(k))) return;
6880
+ if (!patchKeys.some((k) => restartKeys.has(k))) return;
6287
6881
  const ctx = this._ctx;
6288
6882
  if (!ctx) return;
6289
6883
  const addonId = ctx.id;
6290
6884
  setImmediate(() => {
6291
6885
  ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
6292
- ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: Object.keys(patch).filter((k) => restartKeys.has(k)) } });
6886
+ ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
6293
6887
  }).catch((err) => {
6294
6888
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
6295
6889
  });
@@ -6298,7 +6892,7 @@ var BaseAddon = class {
6298
6892
  async getDeviceSettings(deviceId) {
6299
6893
  const schema = this.deviceSettingsSchema();
6300
6894
  if (!schema) return { sections: [] };
6301
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
6895
+ return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6302
6896
  }
6303
6897
  async updateDeviceSettings(deviceId, patch) {
6304
6898
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -6428,7 +7022,7 @@ var BaseAddon = class {
6428
7022
  * selection at boot (absent scoped key ⇒ the constructor default wins).
6429
7023
  */
6430
7024
  async resolveConfig() {
6431
- const stored = await this.readAddonStoreWithRetry();
7025
+ const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
6432
7026
  const perNode = this.perNodeKeys();
6433
7027
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6434
7028
  const resolved = { ...this.defaults };
@@ -6453,7 +7047,7 @@ var BaseAddon = class {
6453
7047
  key,
6454
7048
  schema,
6455
7049
  fallback,
6456
- read: () => this.readAddonStoreWithRetry(),
7050
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
6457
7051
  write: async (patch) => {
6458
7052
  await this._ctx?.settings?.writeAddonStore(patch);
6459
7053
  },
@@ -6470,7 +7064,7 @@ var BaseAddon = class {
6470
7064
  key,
6471
7065
  schema,
6472
7066
  fallback,
6473
- read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
7067
+ read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
6474
7068
  write: async (patch) => {
6475
7069
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
6476
7070
  },
@@ -6482,6 +7076,70 @@ var BaseAddon = class {
6482
7076
  } })
6483
7077
  });
6484
7078
  }
7079
+ /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
7080
+ addonSecretTree() {
7081
+ this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
7082
+ return this._addonSecretTree;
7083
+ }
7084
+ deviceSecretTree() {
7085
+ this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7086
+ return this._deviceSecretTree;
7087
+ }
7088
+ /**
7089
+ * Secrets of this addon's stored config that could not be resolved on the
7090
+ * last read, with why. Non-empty means the addon is running WITHOUT them —
7091
+ * an addon whose function needs one should report itself degraded rather
7092
+ * than start on an empty credential.
7093
+ */
7094
+ get unresolvedSecrets() {
7095
+ return this._unresolvedSecrets;
7096
+ }
7097
+ /**
7098
+ * Substitute every keychain marker in a stored blob with its value. With no
7099
+ * keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
7100
+ * An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
7101
+ * value — and, when the cause can pass, retried with backoff. Nothing is
7102
+ * ever written back from here.
7103
+ */
7104
+ async resolveStoredSecrets(blob, trackForConfig = true) {
7105
+ const secrets = this._ctx?.secrets;
7106
+ if (secrets === void 0) return blob;
7107
+ const refs = collectSecretMarkerRefs(blob);
7108
+ if (trackForConfig) this._configSecretRefs = new Set(refs);
7109
+ if (refs.length === 0) {
7110
+ if (trackForConfig) this._unresolvedSecrets = [];
7111
+ return blob;
7112
+ }
7113
+ const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
7114
+ if (trackForConfig) {
7115
+ this._unresolvedSecrets = unresolved;
7116
+ if (unresolved.length > 0) {
7117
+ this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
7118
+ ref: u.ref,
7119
+ reason: u.reason
7120
+ })) } });
7121
+ if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
7122
+ this.scheduleSecretReresolve(this._secretRetryDelayMs);
7123
+ this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
7124
+ }
7125
+ } else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
7126
+ }
7127
+ return value;
7128
+ }
7129
+ /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7130
+ scheduleSecretReresolve(delayMs) {
7131
+ const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
7132
+ if (this[timerOf] !== null) return;
7133
+ const timer = setTimeout(() => {
7134
+ this[timerOf] = null;
7135
+ if (this._ctx === null) return;
7136
+ this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
7137
+ this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
7138
+ });
7139
+ }, delayMs);
7140
+ timer.unref?.();
7141
+ this[timerOf] = timer;
7142
+ }
6485
7143
  /**
6486
7144
  * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
6487
7145
  * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
@@ -6749,32 +7407,12 @@ object({
6749
7407
  audioCodec: string().optional(),
6750
7408
  metadata: record(string(), unknown()).readonly().optional()
6751
7409
  });
6752
- var EncodedPacketSchema = object({
6753
- type: _enum(["video", "audio"]),
6754
- data: _instanceof(Uint8Array),
6755
- pts: number(),
6756
- dts: number(),
6757
- keyframe: boolean(),
6758
- codec: string()
6759
- });
6760
- var DecodedFrameSchema = object({
6761
- data: _instanceof(Uint8Array),
6762
- width: number(),
6763
- height: number(),
6764
- format: _enum([
6765
- "jpeg",
6766
- "rgb",
6767
- "bgr",
6768
- "yuv420",
6769
- "gray"
6770
- ]),
6771
- timestamp: number()
6772
- });
6773
7410
  /**
6774
7411
  * Wire schema for `FrameHandle` — a zero-pixel, serialisable reference to a
6775
7412
  * frame in a shared-memory ring (Phase 5 / D9). Mirrors the `FrameHandle` TS
6776
- * interface in `interfaces/frame-handle.ts` field-for-field so a decoder cap
6777
- * method (`pullHandles`) can carry handles over tRPC / Moleculer.
7413
+ * interface in `interfaces/frame-handle.ts` field-for-field so a cap method
7414
+ * (the runner's native-crop and pipeline-executor inputs) can carry handles
7415
+ * over tRPC / Moleculer.
6778
7416
  *
6779
7417
  * The `satisfies` assertion below pins this schema to the interface: if a
6780
7418
  * field is added to / removed from `FrameHandle` without a matching schema
@@ -6800,50 +7438,6 @@ var FrameHandleSchema = object({
6800
7438
  slotCount: number().int().positive()
6801
7439
  });
6802
7440
  /**
6803
- * Pixel format a frame-handle subscriber can request from the broker
6804
- * (Phase 5 / D9). The packed, raster subset of `FrameFormat` — the formats a
6805
- * `frameSink: 'shm'` decoder session can write into a `FrameRing` slot.
6806
- * `jpeg` is excluded: a variable-length stream is not a fixed-stride ring
6807
- * payload, and no decoded-frame consumer requests it over the shm plane.
6808
- */
6809
- var FrameHandleFormatSchema = _enum([
6810
- "rgb",
6811
- "bgr",
6812
- "yuv420",
6813
- "gray"
6814
- ]);
6815
- /**
6816
- * Input for `stream-broker.subscribeFrames` (Phase 5 / D9). A consumer asks the
6817
- * broker for a `FrameHandle` stream of one `format`; the broker maintains one
6818
- * shared-memory ring per `(brokerId, format)` actually requested, so a `gray`
6819
- * subscriber (motion) and an `rgb` subscriber (detection) each read the format
6820
- * they asked for with no broker-side conversion.
6821
- */
6822
- var SubscribeFramesInputSchema = object({
6823
- brokerId: string(),
6824
- format: FrameHandleFormatSchema,
6825
- /**
6826
- * Optional reader-side cadence hint in frames per second. The broker does
6827
- * NOT throttle — latest-wins ring reads drop frames implicitly for a slow
6828
- * consumer. The value is echoed back in `SubscribeFramesResult.maxFps` so
6829
- * the consumer can pace its own `pullFrameHandles` polling.
6830
- */
6831
- maxFps: number().positive().optional(),
6832
- /** Short caller-identity tag (`motion`, `detection`, …) for diagnostics. */
6833
- tag: string().optional()
6834
- });
6835
- /**
6836
- * Result of `stream-broker.subscribeFrames`. The consumer then polls
6837
- * `pullFrameHandles({ subscriptionId, maxCount })` and feeds each returned
6838
- * `FrameHandle` to a `FrameRingReader`.
6839
- */
6840
- var SubscribeFramesResultSchema = object({
6841
- /** Opaque id the consumer passes to `pullFrameHandles` / `unsubscribeFrames`. */
6842
- subscriptionId: string(),
6843
- /** Reader-side cadence hint (frames/s) — echoes `SubscribeFramesInput.maxFps`. */
6844
- maxFps: number().nonnegative()
6845
- });
6846
- /**
6847
7441
  * Wire schema for a decoded audio chunk (Phase 5 / D9). Mirrors the
6848
7442
  * `DecodedAudioChunk` TS interface in `interfaces/stream-broker.ts`: PCM
6849
7443
  * sample bytes plus the track parameters a consumer needs to interpret them.
@@ -6851,8 +7445,8 @@ var SubscribeFramesResultSchema = object({
6851
7445
  * Audio chunks are tiny (a ~500ms AudioCodecSession window is a few KB of
6852
7446
  * Float32 PCM), so unlike video frames they ship their bytes INLINE over
6853
7447
  * tRPC / Moleculer — no shared-memory plane. `data` is typed `Uint8Array`
6854
- * (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
6855
- * / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
7448
+ * (the wire-serialisable supertype of `Buffer`); a `Buffer` is assignable to
7449
+ * it.
6856
7450
  */
6857
7451
  var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
6858
7452
  var DecodedAudioChunkSchema = object({
@@ -6870,11 +7464,10 @@ var DecodedAudioChunkSchema = object({
6870
7464
  format: AudioChunkFormatSchema.optional()
6871
7465
  });
6872
7466
  /**
6873
- * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
6874
- * handle-free, ship-bytes-inline analogue of `subscribeFrames`: a consumer
6875
- * asks the broker for the decoded audio-chunk stream of one broker; the
6876
- * broker keeps a per-subscription bounded FIFO queue the consumer drains via
6877
- * `pullAudioChunks`.
7467
+ * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). Audio ships
7468
+ * its bytes inline: a consumer asks the broker for the decoded audio-chunk
7469
+ * stream of one broker; the broker keeps a per-subscription bounded FIFO queue
7470
+ * the consumer drains via `pullAudioChunks`.
6878
7471
  */
6879
7472
  var SubscribeAudioChunksInputSchema = object({
6880
7473
  brokerId: string(),
@@ -6905,9 +7498,7 @@ var BrokerStatsSchema = object({
6905
7498
  "stopped"
6906
7499
  ]),
6907
7500
  inputFps: number(),
6908
- decodeFps: number(),
6909
7501
  encodedSubscribers: number(),
6910
- decodedSubscribers: number(),
6911
7502
  uptimeMs: number(),
6912
7503
  bitrateKbps: number(),
6913
7504
  idrIntervalMs: number(),
@@ -6920,14 +7511,6 @@ var BrokerStatsSchema = object({
6920
7511
  preBufferMs: number(),
6921
7512
  preBufferPackets: number(),
6922
7513
  /**
6923
- * Moleculer node id of the decoder provider currently servicing this
6924
- * stream's decoded subscribers. `null` until the deferred decoder is
6925
- * created (no decoded clients yet, or codec not detected). Surfaces the
6926
- * runtime decoder placement so the UI can show "Decoder: <agent>" without
6927
- * a separate cap call per broker.
6928
- */
6929
- decoderNodeId: string().nullable(),
6930
- /**
6931
7514
  * Detected audio track parameters from the RTSP DESCRIBE / SDP. `null`
6932
7515
  * when the stream has no audio track or the broker is in cold start.
6933
7516
  * `supported = false` means the codec was detected but the local
@@ -10259,70 +10842,6 @@ var StorageLocationDeclarationSchema = object({
10259
10842
  "backup"
10260
10843
  ]).optional()
10261
10844
  });
10262
- var DecoderStatsSchema = object({
10263
- inputFps: number(),
10264
- outputFps: number(),
10265
- avgDecodeTimeMs: number(),
10266
- droppedFrames: number(),
10267
- /**
10268
- * Pull-mode adaptive-fps telemetry (optional — only pull sessions run the
10269
- * lag-driven controller; push sessions omit these). `lagMs` is the EWMA of
10270
- * the decoder's real-time drift (rising = falling behind live); `adaptiveFps`
10271
- * is the current lag-throttled emit rate (≤ `effectiveFps` ceiling).
10272
- */
10273
- lagMs: number().optional(),
10274
- effectiveFps: number().optional(),
10275
- adaptiveFps: number().optional()
10276
- });
10277
- var DecoderSessionConfigSchema = object({
10278
- codec: string(),
10279
- maxFps: number().default(0),
10280
- outputFormat: _enum([
10281
- "jpeg",
10282
- "rgb",
10283
- "bgr",
10284
- "yuv420",
10285
- "gray"
10286
- ]).default("jpeg"),
10287
- scale: number().default(1),
10288
- width: number().optional(),
10289
- height: number().optional(),
10290
- /**
10291
- * Identifier of the camera this decoder session serves. Optional
10292
- * because the cap is generic (any caller could request decode), but
10293
- * stream-broker passes it so decoder logs include `deviceId` for
10294
- * per-camera filtering when diagnosing failures (e.g. node-av
10295
- * sendPacket errors on a single hung camera).
10296
- */
10297
- deviceId: number().int().nonnegative().optional(),
10298
- /**
10299
- * Free-form tag for log scoping. Stream-broker uses
10300
- * `broker:<deviceId>/<profile>`. Decoder session logger surfaces it
10301
- * on every line so `grep tag=broker:5/high` filters one camera
10302
- * profile cleanly.
10303
- */
10304
- tag: string().optional(),
10305
- /**
10306
- * Where the session delivers decoded frames (Phase 5 / D9):
10307
- *
10308
- * - `'callback'` (default) — the legacy pixel path: decoded frames are
10309
- * buffered as `DecodedFrame`s and drained via `pullFrames`.
10310
- * - `'shm'` — the shared-memory frame plane: decoded frames are written
10311
- * into an OS shared-memory ring and drained as zero-pixel
10312
- * `FrameHandle`s via `pullHandles`. A session is one mode or the
10313
- * other — `pullFrames` returns nothing for an `'shm'` session and
10314
- * `pullHandles` returns nothing for a `'callback'` session.
10315
- */
10316
- frameSink: _enum(["callback", "shm"]).default("callback"),
10317
- /**
10318
- * Per-camera decoder DEBUG facility. When `true`, a pull-mode session emits
10319
- * a throttled (~1Hz) structured `decoder debug` line (effective/adaptive fps,
10320
- * real-time lag, dropped-frame delta, avg decode time, hwaccel). Mirrors the
10321
- * stream-broker's `streamingDebug` gate — off by default so production logs
10322
- * stay quiet and the emit path pays zero per-frame cost when disabled.
10323
- */
10324
- debug: boolean().optional()
10325
- });
10326
10845
  /**
10327
10846
  * Per-component log CHANNELS — the gate a hot path consults, and the registry
10328
10847
  * an addon declares its channels in.
@@ -10465,6 +10984,26 @@ var ClipSearchStrictnessSchema = _enum([
10465
10984
  "balanced",
10466
10985
  "strict"
10467
10986
  ]);
10987
+ /** Steps whose effect a root label can BE. */
10988
+ var LABEL_SUPPLY_STEP_IDS = [
10989
+ "animal-classifier",
10990
+ "vehicle-classifier",
10991
+ "package-detection"
10992
+ ];
10993
+ /** Steps whose box a root detection can BE. */
10994
+ var CROP_SUPPLY_STEP_IDS = ["plate-detection", "face-detection"];
10995
+ /**
10996
+ * Steps whose per-detection MASK a root detection can carry (D737). The live
10997
+ * mask step is `segmentation` — a frame-plane refiner that runs its own model
10998
+ * once per detection crop. (`instance-segmentation` is a dormant step id that
10999
+ * no camera tree carries.)
11000
+ */
11001
+ var MASK_SUPPLY_STEP_IDS = ["segmentation"];
11002
+ [
11003
+ ...LABEL_SUPPLY_STEP_IDS,
11004
+ ...CROP_SUPPLY_STEP_IDS,
11005
+ ...MASK_SUPPLY_STEP_IDS
11006
+ ];
10468
11007
  var MODEL_FORMATS = [
10469
11008
  "onnx",
10470
11009
  "coreml",
@@ -10493,7 +11032,53 @@ var ModelFormatEntrySchema = object({
10493
11032
  /** Multi-file payload (directory members or sibling files). */
10494
11033
  files: array(string()).readonly().optional(),
10495
11034
  /** Runtime(s) that can use this format. If omitted, inferred from ModelFormat key */
10496
- runtimes: array(_enum(["python"])).readonly().optional()
11035
+ runtimes: array(_enum(["python"])).readonly().optional(),
11036
+ /**
11037
+ * Content revision of the artefact, for one hosted OFF the CamStack mirror.
11038
+ * A format on the mirror leaves it unset: its revision (the sha256 of its
11039
+ * weight file) comes from the downloader's generated table, kept in step
11040
+ * with the mirror by `scripts/check-hosted-model-revisions.ts` (D744). A
11041
+ * node records the revision it downloaded next to the file
11042
+ * (`<file>.revision`); a copy with no record or a different one is stale
11043
+ * unless its weight file hashes to the revision, and a stale copy is
11044
+ * downloaded again, the old one serving until the new one is complete. No
11045
+ * revision at all ⇒ a file on disk is current, whatever it holds (D743).
11046
+ */
11047
+ revision: string().min(1).optional()
11048
+ });
11049
+ /**
11050
+ * What a node holds for one (model, format) (D746). `current` is a complete
11051
+ * copy at its catalog revision — exactly what `downloaded: true` means.
11052
+ * `stale` is bytes on disk that are not (yet) proven current under D743/D744:
11053
+ * no or a different revision record, or a missing sibling. `missing` is no
11054
+ * copy. `downloaded` alone folds `stale` into "not downloaded", which hid
11055
+ * reclaimable bytes and a copy about to be replaced.
11056
+ */
11057
+ var ModelOnDiskStateSchema = _enum([
11058
+ "current",
11059
+ "stale",
11060
+ "missing"
11061
+ ]);
11062
+ /**
11063
+ * The numeric precision of one format's BUILD (D746) — reported only when the
11064
+ * build states it (file-name token, an INT8 variant, an EdgeTPU compile, a
11065
+ * CamStack Core ML export). Absent means "not stated", never "fp32".
11066
+ */
11067
+ var ModelFormatPrecisionSchema = _enum([
11068
+ "fp32",
11069
+ "fp16",
11070
+ "int8"
11071
+ ]);
11072
+ /**
11073
+ * One format of one model as a node's `pipelineExecutor.getSchema` reports it.
11074
+ * `onDisk` / `precision` are optional for version skew: a runner that predates
11075
+ * them omits them, and a reader falls back to `downloaded`.
11076
+ */
11077
+ var PipelineModelFormatStatusSchema = object({
11078
+ downloaded: boolean(),
11079
+ sizeMB: number(),
11080
+ onDisk: ModelOnDiskStateSchema.optional(),
11081
+ precision: ModelFormatPrecisionSchema.optional()
10497
11082
  });
10498
11083
  /**
10499
11084
  * Extra file that must be downloaded alongside the model (e.g., labels JSON, dict.txt).
@@ -10597,6 +11182,46 @@ var ModelLicenseSchema = preprocess((value) => typeof value === "string" ? { wei
10597
11182
  /** True when the weights or their data forbid commercial use. */
10598
11183
  nonCommercial: boolean().optional()
10599
11184
  }));
11185
+ /**
11186
+ * One step a ROOT detector can supply from its own output (D730) — see
11187
+ * `ModelCatalogEntry.suppliesSteps`.
11188
+ *
11189
+ * - `label`: the root's raw class IS the step's answer. `labelToEffect` maps
11190
+ * the root's label to the step's vocabulary; `uncovered` is the vocabulary
11191
+ * the root cannot produce (shown as unavailable, never a blocker).
11192
+ * - `crop`: the root draws the box the step would have found (`license_plate`
11193
+ * for plate-detection, `face` for face-detection). The box becomes a detail
11194
+ * child of the `parentMacro` detection that contains it — never a track.
11195
+ * - `mask`: the root's decode emits an instance mask with every detection (a
11196
+ * YOLO26-seg root, D737) — the `segmentation` step's result, carried on the
11197
+ * detection in the shape that step produces. Derived from the model's
11198
+ * postprocessor on read, never stored by an import.
11199
+ */
11200
+ var RootStepSupplySchema = discriminatedUnion("kind", [
11201
+ object({
11202
+ kind: literal("label"),
11203
+ stepId: _enum(LABEL_SUPPLY_STEP_IDS),
11204
+ labelToEffect: record(string(), string()),
11205
+ uncovered: array(string()).readonly()
11206
+ }),
11207
+ object({
11208
+ kind: literal("crop"),
11209
+ stepId: _enum(CROP_SUPPLY_STEP_IDS),
11210
+ rootLabels: array(string()).readonly(),
11211
+ parentMacro: _enum(["vehicle", "person"]),
11212
+ childClass: _enum(["plate", "face"]),
11213
+ /**
11214
+ * The root's smaller input side, stamped on read by `rootSuppliesOf` from
11215
+ * the model entry — what a step's `minRootInputPx` gate judges. Never
11216
+ * stored by an import.
11217
+ */
11218
+ rootInputPx: number().int().positive().optional()
11219
+ }),
11220
+ object({
11221
+ kind: literal("mask"),
11222
+ stepId: _enum(MASK_SUPPLY_STEP_IDS)
11223
+ })
11224
+ ]);
10600
11225
  var ModelCatalogEntrySchema = object({
10601
11226
  id: string(),
10602
11227
  name: string(),
@@ -10662,6 +11287,35 @@ var ModelCatalogEntrySchema = object({
10662
11287
  */
10663
11288
  defaultConfidence: number().min(0).max(1).optional(),
10664
11289
  /**
11290
+ * Per-MODEL default of the per-class confidence floors (`minConfidence<Macro>`
11291
+ * on a detector step), keyed by macro class: `{ person: 0.45 }`. A class
11292
+ * absent here runs at the step slider's global default. The same row shape
11293
+ * the floor measurement produces (`model-floors.json`: modelId → floors), so
11294
+ * a measured table is copied in as-is. An operator override is bound to the
11295
+ * model it was made for and does not survive a model change (D738). A custom
11296
+ * / imported model may declare it; without it, the global defaults apply.
11297
+ */
11298
+ defaultClassFloors: record(string(), number().min(0).max(1)).optional(),
11299
+ /**
11300
+ * The inference precision this model's OpenVINO IR needs on an Intel GPU.
11301
+ * Absent ⇒ the device default (f16 on a GPU). Set to `'f32'` for an FP32 IR
11302
+ * that produces invalid output at f16 — measured 2026-10-07 for YOLO26
11303
+ * base IRs (`yolo26s`: 0 true / 146 false positives; `yolo26m*`: NaN
11304
+ * scores) on the Core Ultra iGPU and the N100. Threaded to the pool as
11305
+ * `PoolModelConfig.gpuInferencePrecision`; the pool sets
11306
+ * INFERENCE_PRECISION_HINT on a GPU only. Costs ~60% latency on the GPU.
11307
+ */
11308
+ gpuInferencePrecision: _enum(["f32", "f16"]).optional(),
11309
+ /**
11310
+ * ROOT detectors only: per supplied step (`animal-classifier`, …), the
11311
+ * minimum DETECTION score from which this root's own fine label (species,
11312
+ * vehicle type — D736 root supply) is taken (D741). Below it the detection
11313
+ * keeps its macro class without the fine label. `1` = never take it from
11314
+ * this root. Absent ⇒ no floor beyond the macro floor. The supplied step's
11315
+ * `minConfidence` slider, bound to the ROOT model, overrides it.
11316
+ */
11317
+ suppliedLabelFloors: record(string(), number().min(0).max(1)).optional(),
11318
+ /**
10665
11319
  * When true, the executor produces a landmark-aligned crop (similarity warp
10666
11320
  * onto the canonical template) before this step runs, instead of a plain
10667
11321
  * axis-aligned bbox crop. Required for face-recognition embedders (ArcFace):
@@ -10723,6 +11377,16 @@ var ModelCatalogEntrySchema = object({
10723
11377
  */
10724
11378
  classMap: DetectionCatalogClassMapSchema.optional(),
10725
11379
  /**
11380
+ * The pipeline steps this ROOT detector can supply from its own output
11381
+ * (D730): its labels name a step's effect (`deer` for `animal-classifier`)
11382
+ * or draw a step's box (`license_plate` for `plate-detection`). Computed at
11383
+ * import from THIS model's labelmap by `deriveRootSupplies`, never written
11384
+ * by hand and never assumed per family; a row without it is derived on read
11385
+ * (`rootSuppliesOf`). Whether a camera uses it is the step's own
11386
+ * `useRootModel` flag (`resolveRootSupply`).
11387
+ */
11388
+ suppliesSteps: array(RootStepSupplySchema).readonly().optional(),
11389
+ /**
10726
11390
  * The model's CLIP feature-space contract (text encoder, dimension, vector
10727
11391
  * index, token window, search floor) — see `clip-model.ts`. Present ONLY on a
10728
11392
  * CLIP image encoder; its absence is what "not a CLIP model" means to the
@@ -12324,13 +12988,6 @@ var BrokerRtspClientSchema = object({
12324
12988
  lastRtpAt: number(),
12325
12989
  bytesSent: number()
12326
12990
  });
12327
- var BrokerDecodedClientSchema = object({
12328
- tag: string(),
12329
- subscribedAt: number(),
12330
- maxFps: number(),
12331
- framesDelivered: number(),
12332
- framesDropped: number()
12333
- });
12334
12991
  var BrokerAudioClientSchema = object({
12335
12992
  tag: string(),
12336
12993
  subscribedAt: number(),
@@ -12422,7 +13079,6 @@ var BrokerEncodedClientSchema = object({
12422
13079
  });
12423
13080
  var BrokerClientsSchema = object({
12424
13081
  rtsp: array(BrokerRtspClientSchema).readonly(),
12425
- decoded: array(BrokerDecodedClientSchema).readonly(),
12426
13082
  audio: array(BrokerAudioClientSchema).readonly(),
12427
13083
  encoded: array(BrokerEncodedClientSchema).readonly(),
12428
13084
  pipeClients: number(),
@@ -12791,11 +13447,7 @@ method(object({
12791
13447
  auth: "admin"
12792
13448
  }), method(object({ brokerId: string() }), BrokerClientsSchema), method(object({
12793
13449
  brokerId: string(),
12794
- channel: _enum([
12795
- "rtsp",
12796
- "decoded",
12797
- "audio"
12798
- ]),
13450
+ channel: _enum(["rtsp", "audio"]),
12799
13451
  handle: string()
12800
13452
  }), object({ killed: boolean() }), {
12801
13453
  kind: "mutation",
@@ -12830,10 +13482,7 @@ method(object({
12830
13482
  }), method(SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, { kind: "mutation" }), method(object({
12831
13483
  subscriptionId: string(),
12832
13484
  maxCount: number().int().positive().default(8)
12833
- }), array(DecodedAudioChunkSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(SubscribeFramesInputSchema, SubscribeFramesResultSchema, { kind: "mutation" }), method(object({
12834
- subscriptionId: string(),
12835
- maxCount: number().int().positive().default(4)
12836
- }), array(FrameHandleSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(object({
13485
+ }), array(DecodedAudioChunkSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(object({
12837
13486
  brokerId: string(),
12838
13487
  seconds: number().min(0).max(30)
12839
13488
  }), _void(), {
@@ -13991,53 +14640,201 @@ id: union([string(), number()]) }), {
13991
14640
  auth: "admin"
13992
14641
  });
13993
14642
  /**
13994
- * shm ring usage stats for a `frameSink: 'shm'` decoder session —
13995
- * exposed via `decoder.getShmStats` so downstream consumers can
13996
- * observe ring pressure (slot count, byte budget, hit/miss ratio).
14643
+ * `keychain` — the hub's encrypted store of secret values (D787).
14644
+ *
14645
+ * Settings blobs never hold a secret: they hold a marker
14646
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
14647
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
14648
+ * is the OWNER's door to its own values: every method is owner-checked
14649
+ * against the CALLER, never against anything the caller claims.
14650
+ *
14651
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
14652
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
14653
+ * connection, the agent from its child's connection carried in
14654
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
14655
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
14656
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
14657
+ * identity against BUGS and misrouting, not against a malicious addon (every
14658
+ * runner is the same OS user): see the threat model in
14659
+ * `docs/design/2026-10-08-secrets-keychain.md`.
14660
+ *
14661
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
14662
+ * parses the input, so a session can never supply it, and the internal mount
14663
+ * floors every method to admin anyway (D240).
14664
+ *
14665
+ * Internal: addons reach it through `ctx.secrets`, never directly.
13997
14666
  */
13998
- var ShmRingStatsSchema = object({
13999
- sessionId: string(),
14000
- slotCount: number().int(),
14001
- slotByteLength: number().int(),
14002
- segmentBytes: number().int(),
14003
- budgetMb: number().int(),
14004
- framesWritten: number().int(),
14005
- getFrameHits: number().int(),
14006
- getFrameMisses: number().int()
14007
- });
14008
- method(object({ codec: string() }), boolean()), method(_void(), object({
14667
+ /** Why a value cannot be served right now. Never folded into "missing". */
14668
+ var KeychainUnavailableReasonSchema = _enum([
14669
+ "key-missing",
14670
+ "wrong-key",
14671
+ "key-file-unreadable",
14672
+ "store-unavailable",
14673
+ "not-initialized",
14674
+ "decrypt-failed"
14675
+ ]);
14676
+ var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
14677
+ state: literal("locked"),
14678
+ reason: KeychainUnavailableReasonSchema
14679
+ })]);
14680
+ var KeychainResolveEntrySchema = discriminatedUnion("kind", [
14681
+ object({
14682
+ kind: literal("value"),
14683
+ value: string(),
14684
+ version: number().int()
14685
+ }),
14686
+ object({ kind: literal("missing") }),
14687
+ object({
14688
+ kind: literal("unavailable"),
14689
+ reason: KeychainUnavailableReasonSchema
14690
+ }),
14691
+ object({ kind: literal("forbidden") })
14692
+ ]);
14693
+ var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
14694
+ /** Metadata of one stored value — never the value. */
14695
+ var KeychainSecretMetaSchema = object({
14696
+ ref: string(),
14697
+ owner: string(),
14698
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
14699
+ scope: string(),
14700
+ fieldPath: string(),
14701
+ version: number().int(),
14702
+ createdAt: number(),
14703
+ updatedAt: number(),
14704
+ /** `addon:<id>` | `user:<id>` | `system`. */
14705
+ updatedBy: string(),
14706
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
14707
+ lastReadAt: number().nullable()
14708
+ });
14709
+ var RefListSchema = array(string().min(1)).max(512);
14710
+ method(object({
14711
+ ref: string().min(1),
14712
+ value: string().min(1)
14713
+ }), object({
14714
+ ref: string(),
14715
+ version: number().int()
14716
+ }), {
14717
+ kind: "mutation",
14718
+ auth: "admin"
14719
+ }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
14720
+ kind: "mutation",
14721
+ auth: "admin"
14722
+ }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
14723
+ var KeychainKeySourceSchema = object({
14724
+ kind: _enum([
14725
+ "config-file",
14726
+ "previous-config-file",
14727
+ "platform",
14728
+ "default-file"
14729
+ ]),
14730
+ /** File sources only — a path is not a secret. */
14731
+ path: string().optional(),
14732
+ /**
14733
+ * True when a whole-volume backup of the data directory carries this key
14734
+ * next to the database it protects (the default file). The page warns.
14735
+ */
14736
+ sharesBackupWithDatabase: boolean()
14737
+ });
14738
+ var KeychainStatusSchema = object({
14739
+ keychain: KeychainStateSchema,
14740
+ /** The source of the master key in use; `null` while locked. */
14741
+ keySource: KeychainKeySourceSchema.nullable(),
14742
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
14743
+ configuredSource: KeychainKeySourceSchema,
14744
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
14745
+ fingerprint: string().nullable(),
14746
+ activeKeyId: string().nullable(),
14747
+ /**
14748
+ * The keychain unlocked with a NON-primary source: the configured primary
14749
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
14750
+ */
14751
+ rotationPending: boolean(),
14752
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
14753
+ retiredWraps: number().int(),
14754
+ recoveryKeyDownloadedAt: number().nullable(),
14755
+ secretCount: number().int()
14756
+ });
14757
+ /**
14758
+ * Whether a stored value is still pointed at by its owner's settings.
14759
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
14760
+ * never reported as an orphan (and never deleted as one).
14761
+ */
14762
+ var KeychainSecretUsageSchema = _enum([
14763
+ "in-use",
14764
+ "orphan",
14765
+ "unknown"
14766
+ ]);
14767
+ var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
14768
+ var KeychainAuditActionSchema = _enum([
14769
+ "put",
14770
+ "delete",
14771
+ "reveal",
14772
+ "rotate-master-key",
14773
+ "purge-retired-keys",
14774
+ "download-recovery-key",
14775
+ "delete-orphans",
14776
+ "reset",
14777
+ "initialize"
14778
+ ]);
14779
+ var KeychainAuditEntrySchema = object({
14780
+ id: string(),
14781
+ at: number(),
14782
+ action: KeychainAuditActionSchema,
14783
+ /** `addon:<id>` | `user:<id>` | `system`. */
14784
+ actor: string(),
14785
+ ref: string().nullable(),
14786
+ detail: string().nullable()
14787
+ });
14788
+ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}), array(KeychainAdminSecretSchema).readonly(), { auth: "admin" }), method(object({ limit: number().int().min(1).max(500).optional() }), array(KeychainAuditEntrySchema).readonly(), { auth: "admin" }), method(object({ ref: string().min(1) }), object({
14789
+ value: string(),
14790
+ version: number().int()
14791
+ }), {
14792
+ kind: "mutation",
14793
+ auth: "admin",
14794
+ caller: "required"
14795
+ }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
14796
+ deleted: array(string()).readonly(),
14797
+ kept: array(object({
14798
+ ref: string(),
14799
+ usage: KeychainSecretUsageSchema
14800
+ })).readonly()
14801
+ }), {
14802
+ kind: "mutation",
14803
+ auth: "admin",
14804
+ caller: "required"
14805
+ }), method(object({}), object({
14806
+ fingerprint: string(),
14807
+ keySource: KeychainKeySourceSchema
14808
+ }), {
14809
+ kind: "mutation",
14810
+ auth: "admin",
14811
+ caller: "required"
14812
+ }), method(object({}), object({ purged: number().int() }), {
14813
+ kind: "mutation",
14814
+ auth: "admin",
14815
+ caller: "required"
14816
+ }), method(object({}), object({
14817
+ key: string(),
14818
+ fingerprint: string(),
14819
+ keySource: KeychainKeySourceSchema
14820
+ }), {
14821
+ kind: "mutation",
14822
+ auth: "admin",
14823
+ caller: "required"
14824
+ }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
14825
+ archivedCollection: string().nullable(),
14826
+ archived: number().int()
14827
+ }), {
14828
+ kind: "mutation",
14829
+ auth: "admin",
14830
+ caller: "required"
14831
+ });
14832
+ method(_void(), object({
14009
14833
  id: string(),
14010
14834
  name: string(),
14011
- isPullMode: boolean().optional(),
14012
- priority: number().optional(),
14013
14835
  hwaccel: string().optional(),
14014
14836
  probedBestHwaccel: string().optional()
14015
- })), method(DecoderSessionConfigSchema, object({
14016
- sessionId: string(),
14017
- nodeId: string()
14018
- })), method(object({ sessionId: string() }), _void()), method(object({
14019
- sessionId: string(),
14020
- packet: EncodedPacketSchema
14021
- }), _void()), method(object({
14022
- sessionId: string(),
14023
- url: string()
14024
- }), _void()), method(object({
14025
- sessionId: string(),
14026
- maxCount: number().default(1),
14027
- waitMs: number().optional()
14028
- }), array(DecodedFrameSchema)), method(object({
14029
- sessionId: string(),
14030
- maxCount: number().default(1),
14031
- waitMs: number().optional()
14032
- }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
14033
- sessionId: string(),
14034
- config: DecoderSessionConfigSchema.partial()
14035
- }), _void()), method(object({ sessionId: string() }), DecoderStatsSchema), method(_void(), array(object({
14036
- sessionId: string(),
14037
- codec: string(),
14038
- outputFormat: string(),
14039
- createdAtMs: number()
14040
- })).readonly()), method(_void(), object({ backend: string() }), {
14837
+ })), method(_void(), object({ backend: string() }), {
14041
14838
  kind: "mutation",
14042
14839
  auth: "admin"
14043
14840
  });
@@ -15043,6 +15840,10 @@ var DeviceInfoSchema = object({
15043
15840
  isCamera: boolean(),
15044
15841
  /** Current config values — serializable snapshot */
15045
15842
  config: record(string(), unknown()),
15843
+ /** Paths inside `config` the device's schema declares secret (D783) —
15844
+ * what the non-admin redaction withholds. Paths, never values. Absent
15845
+ * when the owning runner has not reported them. */
15846
+ secretConfigPaths: array(string()).optional(),
15046
15847
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
15047
15848
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
15048
15849
  metadata: record(string(), unknown()).nullable().optional(),
@@ -15248,12 +16049,22 @@ var DeviceRegisterPayloadSchema = object({
15248
16049
  * call (workers re-register on init), so probe-driven updates
15249
16050
  * (e.g. PTZ flag flipping after the abilities probe) propagate. */
15250
16051
  features: array(string()).optional(),
15251
- config: record(string(), unknown())
16052
+ config: record(string(), unknown()),
16053
+ /** Config paths the device's own schema DECLARES secret
16054
+ * (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
16055
+ * `connection.password`). Re-published on every register; the non-admin
16056
+ * redaction withholds them at any depth (D783). Optional: an older runner
16057
+ * omits it and the keyword backstop applies. */
16058
+ secretConfigPaths: array(string()).optional()
15252
16059
  });
15253
16060
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
15254
16061
  var DevicePersistConfigPayloadSchema = object({
15255
16062
  deviceId: number(),
15256
- data: record(string(), unknown())
16063
+ data: record(string(), unknown()),
16064
+ /** The paths the device's schema declares secret (D783), when the caller
16065
+ * knows them — those values are kept in the keychain, not the blob (D787).
16066
+ * Absent: the paths the device last reported at `registerDevice` apply. */
16067
+ secretConfigPaths: array(string()).optional()
15257
16068
  });
15258
16069
  /** What a migration actually did, per switch. `unreachable` is a first-class
15259
16070
  * answer: a camera that could not be asked is not a camera that was silenced. */
@@ -16075,6 +16886,12 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
16075
16886
  kind: "mutation",
16076
16887
  auth: "admin"
16077
16888
  });
16889
+ var HUB_ADDRESS_ROLES = [
16890
+ "appConnections",
16891
+ "notificationTaps",
16892
+ "internal",
16893
+ "publicEndpoint"
16894
+ ];
16078
16895
  /**
16079
16896
  * Transport bounds for AI capability methods.
16080
16897
  *
@@ -16901,7 +17718,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
16901
17718
  icon: string().optional(),
16902
17719
  /** Addon-owned HTTP route the button navigates to (GET). */
16903
17720
  startUrl: string(),
16904
- stage: LoginStageEnum
17721
+ stage: LoginStageEnum,
17722
+ /**
17723
+ * The provider names an external identity a signed-in user can link to
17724
+ * their own account (D782): `auth.listLinkableProviders` /
17725
+ * `beginExternalLink` offer exactly the redirect methods that set this,
17726
+ * whatever their id. Absent / false — a login button only (magic-link).
17727
+ */
17728
+ linkable: boolean().optional()
16905
17729
  }),
16906
17730
  object({
16907
17731
  kind: literal("widget"),
@@ -18639,6 +19463,8 @@ var NcSystemEventKindSchema = _enum([
18639
19463
  "stream-offline",
18640
19464
  "node-online",
18641
19465
  "node-offline",
19466
+ "node-restarting",
19467
+ "node-updating",
18642
19468
  "node-inference-unavailable",
18643
19469
  "detection-blind",
18644
19470
  "addon-crash-loop",
@@ -20244,7 +21070,13 @@ var NcAlarmModeDelaysListSchema = array(object({
20244
21070
  * Absent = false (logged, not sent). Even when true it is not sent when that same sensor
20245
21071
  * is the one that starts the entry delay — the entry-delay notification already names it.
20246
21072
  */
20247
- notifySensorRewatched: boolean().optional()
21073
+ notifySensorRewatched: boolean().optional(),
21074
+ /**
21075
+ * D735: notify "ignored" when a sensor this arm bypassed really MOVED while armed (its own
21076
+ * change time is after the arm) and set nothing off. Absent = false (logged, not sent). A
21077
+ * re-sync, a recovery from `unavailable` or a duplicate is never announced, switch or not.
21078
+ */
21079
+ notifySensorIgnored: boolean().optional()
20248
21080
  })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
20249
21081
  var NcAlarmModeDelaysEditListSchema = array(object({
20250
21082
  mode: AlarmArmModeSchema,
@@ -20257,7 +21089,9 @@ var NcAlarmModeDelaysEditListSchema = array(object({
20257
21089
  /** D706: set the switch, or `null` to clear it (back to the default, false). */
20258
21090
  notifyDuringEntryDelay: boolean().nullable().optional(),
20259
21091
  /** D706: set the switch, or `null` to clear it (back to the default, false). */
20260
- notifySensorRewatched: boolean().nullable().optional()
21092
+ notifySensorRewatched: boolean().nullable().optional(),
21093
+ /** D735: set the switch, or `null` to clear it (back to the default, false). */
21094
+ notifySensorIgnored: boolean().nullable().optional()
20261
21095
  })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
20262
21096
  /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
20263
21097
  var NcAlarmNonBlockingEditSchema = object({
@@ -21235,8 +22069,8 @@ Object.freeze(Object.fromEntries([{
21235
22069
  var CLUSTER_STEP_SETTING_FIELDS = [{
21236
22070
  stepId: "face-embedding",
21237
22071
  key: "minLandmarkFaceSize",
21238
- label: "Min face size for recognition (detection px)",
21239
- 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.",
22072
+ label: "Min face size to embed (detection-frame px)",
22073
+ 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.",
21240
22074
  type: "slider",
21241
22075
  min: 0,
21242
22076
  max: 64,
@@ -22209,8 +23043,23 @@ var RetrainMacroClassSchema = _enum([
22209
23043
  ]);
22210
23044
  /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
22211
23045
  var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
22212
- /** Did a human draw this box, or did the assist propose it? */
22213
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
23046
+ /**
23047
+ * Where a box came from. A machine-sourced box is a DRAFT on the page until
23048
+ * the operator confirms it; once saved it keeps its source as provenance.
23049
+ *
23050
+ * - `operator` — drawn by hand.
23051
+ * - `assist` — proposed by a detector run on the copy (the camera's own
23052
+ * model, or a larger teacher model).
23053
+ * - `pipeline` — the box the live pipeline actually drew on that frame, read
23054
+ * back from the track store (never a re-run).
23055
+ * - `llm` — proposed by a vision-capable LLM profile.
23056
+ */
23057
+ var RetrainAnnotationSourceSchema = _enum([
23058
+ "operator",
23059
+ "assist",
23060
+ "pipeline",
23061
+ "llm"
23062
+ ]);
22214
23063
  /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
22215
23064
  var RetrainBboxSchema = object({
22216
23065
  x: number(),
@@ -22228,7 +23077,8 @@ var RetrainBboxSchema = object({
22228
23077
  */
22229
23078
  var RetrainAnnotationSchema = object({
22230
23079
  id: string(),
22231
- trackId: string(),
23080
+ /** The frame's track. Absent on a recording still, which has none. */
23081
+ trackId: string().optional(),
22232
23082
  deviceId: number(),
22233
23083
  /** The COPY in retrain storage — never the source track's media key. */
22234
23084
  mediaKey: string(),
@@ -22277,18 +23127,63 @@ var RetrainFrameCandidateSchema = object({
22277
23127
  * fail, whatever became of the original. */
22278
23128
  copied: boolean()
22279
23129
  });
23130
+ /**
23131
+ * One box the live pipeline drew on a copied frame — what a correction starts
23132
+ * from. Derived when the frame is listed, from the track store: the subject
23133
+ * box recorded on the source media row when there is one, else the track
23134
+ * position nearest the frame's capture time. Never stored as an annotation
23135
+ * until the operator confirms it.
23136
+ */
23137
+ var RetrainPipelineBoxSchema = object({
23138
+ /** Normalised `[0,1]` against the full frame. */
23139
+ bbox: RetrainBboxSchema,
23140
+ macroClass: RetrainMacroClassSchema,
23141
+ label: string().optional(),
23142
+ subLabel: string().optional(),
23143
+ /** The detection score of the position used, when it was recorded. */
23144
+ score: number().optional(),
23145
+ /** The root model that produced the track, when it was recorded. */
23146
+ modelId: string().optional(),
23147
+ trackId: string(),
23148
+ /** `subject-box`: recorded on this very frame. `position`: the track's
23149
+ * position nearest the capture time, `deltaMs` away. */
23150
+ basis: _enum(["subject-box", "position"]),
23151
+ deltaMs: number()
23152
+ });
23153
+ /**
23154
+ * Where a retrain frame came from: a TRACK's stored media (copy-on-select),
23155
+ * or the RECORDING at an instant — the frame a model saw nothing in has no
23156
+ * track at all.
23157
+ */
23158
+ var RetrainFrameOriginSchema = _enum(["track", "recording"]);
22280
23159
  /** A frame the dataset OWNS: bytes copied at selection time. */
22281
23160
  var RetrainFrameSchema = object({
22282
23161
  frameId: string(),
22283
23162
  deviceId: number(),
22284
- trackId: string(),
22285
- /** Provenance only. It may already point at nothing — that is expected. */
22286
- sourceMediaId: number().int(),
23163
+ origin: RetrainFrameOriginSchema,
23164
+ /** The track it was copied from. Absent on a recording still. */
23165
+ trackId: string().optional(),
23166
+ /** Provenance only. It may already point at nothing — that is expected.
23167
+ * Absent on a recording still. */
23168
+ sourceMediaId: number().int().optional(),
23169
+ /** A recording still: the playhead instant it was taken at. */
23170
+ epochMs: number().optional(),
22287
23171
  sourceKind: MediaFileKindEnum,
22288
23172
  sizeBytes: number().int(),
22289
23173
  width: number().int(),
22290
23174
  height: number().int(),
22291
- copiedAt: number()
23175
+ copiedAt: number(),
23176
+ /** When the CAMERA captured the frame. Absent on a copy taken before D785. */
23177
+ capturedAt: number().optional(),
23178
+ /** The operator's "every subject in this frame is boxed". Detector
23179
+ * evaluation keeps only complete frames: an unboxed subject would count as
23180
+ * a false positive. */
23181
+ complete: boolean(),
23182
+ /** The boxes the pipeline drew on this frame. Present on list answers;
23183
+ * empty when nothing the track store holds can be placed on it. */
23184
+ pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
23185
+ /** The named collections this frame belongs to. Present on list answers. */
23186
+ collectionIds: array(string()).readonly().optional()
22292
23187
  });
22293
23188
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
22294
23189
  var RetrainCopyRefusalSchema = _enum([
@@ -22309,6 +23204,53 @@ var RetrainFrameListSchema = object({
22309
23204
  /** What the page pre-selects — the native key frame when one survives. */
22310
23205
  autoPickMediaId: number().int().optional()
22311
23206
  });
23207
+ /**
23208
+ * Which frames an annotated export carries. Every field narrows; an empty
23209
+ * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23210
+ * list owned by whoever trains (the training orchestrator), so `frameIds` is
23211
+ * the primitive a version export uses; `batchId` re-selects what an earlier
23212
+ * export carried (`exportedInBatch`).
23213
+ */
23214
+ var RetrainExportFilterSchema = object({
23215
+ deviceIds: array(number()).optional(),
23216
+ frameIds: array(string()).max(2e4).optional(),
23217
+ /** Only frames in at least one of these named collections. */
23218
+ collectionIds: array(string()).max(200).optional(),
23219
+ batchId: string().optional(),
23220
+ /** Only frames the operator marked complete (all subjects boxed). */
23221
+ completeOnly: boolean().optional()
23222
+ });
23223
+ /**
23224
+ * `frames`: the full frame copies, boxes in `annotations.json`.
23225
+ * `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
23226
+ * convention — the classifier layout.
23227
+ */
23228
+ var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
23229
+ /**
23230
+ * Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
23231
+ * the archive, sent chunk by chunk. Covers a presigned PUT and a provider
23232
+ * addon's data-plane upload route alike. Headers are sent verbatim and never
23233
+ * logged.
23234
+ */
23235
+ var RetrainArchiveTargetSchema = object({
23236
+ kind: literal("http"),
23237
+ method: _enum(["PUT", "POST"]),
23238
+ url: string().url(),
23239
+ headers: record(string(), string()).optional()
23240
+ });
23241
+ var RetrainArchiveResultSchema = object({
23242
+ batchId: string(),
23243
+ frames: number().int(),
23244
+ crops: number().int(),
23245
+ annotations: number().int(),
23246
+ /** Frames planned but not shipped (unreadable copy, path too long). */
23247
+ missing: number().int(),
23248
+ bytes: number().int(),
23249
+ /** sha256 of the exact bytes sent. */
23250
+ sha256: string(),
23251
+ /** The target's HTTP status. */
23252
+ status: number().int()
23253
+ });
22312
23254
  /** What the operator asked the assist to look for. */
22313
23255
  var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
22314
23256
  kind: literal("package"),
@@ -22338,6 +23280,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
22338
23280
  reason: string(),
22339
23281
  detail: string().optional()
22340
23282
  })]);
23283
+ /** A named set over the retrain corpus — membership only, it owns no pixels. */
23284
+ var RetrainCollectionSchema = object({
23285
+ id: string(),
23286
+ name: string(),
23287
+ createdAt: number(),
23288
+ frameCount: number().int()
23289
+ });
23290
+ var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
23291
+ kind: literal("created"),
23292
+ collection: RetrainCollectionSchema
23293
+ }), object({
23294
+ kind: literal("refused"),
23295
+ reason: _enum(["empty-name", "duplicate-name"])
23296
+ })]);
23297
+ var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
23298
+ kind: literal("renamed"),
23299
+ collection: RetrainCollectionSchema
23300
+ }), object({
23301
+ kind: literal("refused"),
23302
+ reason: _enum([
23303
+ "empty-name",
23304
+ "duplicate-name",
23305
+ "unknown-collection"
23306
+ ])
23307
+ })]);
23308
+ /**
23309
+ * The outcome of adding the frame at a recording instant. Every refusal is
23310
+ * named: `still-unavailable` (not recording, a gap, or an undecodable frame —
23311
+ * `detail` says which), `still-busy` (the recorder is at its decode bound; try
23312
+ * again), `unreadable-image`, `write-failed`, `unknown-collection`.
23313
+ */
23314
+ var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
23315
+ kind: literal("added"),
23316
+ collectionId: string(),
23317
+ frame: RetrainFrameSchema,
23318
+ /** The moment was already in the dataset; nothing was decoded. */
23319
+ reused: boolean()
23320
+ }), object({
23321
+ kind: literal("refused"),
23322
+ reason: _enum([
23323
+ "unknown-collection",
23324
+ "still-unavailable",
23325
+ "still-busy",
23326
+ "unreadable-image",
23327
+ "write-failed"
23328
+ ]),
23329
+ detail: string().optional()
23330
+ })]);
23331
+ /** A vision LLM profile the AI assist may use, and where it sends the frame. */
23332
+ var RetrainAssistProfileSchema = object({
23333
+ id: string(),
23334
+ name: string(),
23335
+ model: string(),
23336
+ kind: string(),
23337
+ /** `true` when the frame would leave the house (a cloud vendor, or an
23338
+ * endpoint that is not on the local network). The page confirms each such
23339
+ * run, and the provider refuses one without `allowCloud`. */
23340
+ leavesHouse: boolean()
23341
+ });
23342
+ /** A box the AI assist proposed: a draft, plus the model's own reason. */
23343
+ var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
23344
+ /** What the AI assist said about a box that was already on the canvas. */
23345
+ var RetrainLlmReviewSchema = object({
23346
+ /** The `ref` the page sent the box under. */
23347
+ ref: string(),
23348
+ verdict: _enum([
23349
+ "confirmed",
23350
+ "wrong-class",
23351
+ "not-an-object",
23352
+ "uncertain"
23353
+ ]),
23354
+ suggestedClass: RetrainMacroClassSchema.optional(),
23355
+ reason: string()
23356
+ });
23357
+ /**
23358
+ * The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
23359
+ * model and its confidence) and reviews; items the model got wrong (a box off
23360
+ * the frame, an unasked class, an unknown ref) are dropped and counted in
23361
+ * `rejected`. A whole answer that is not the schema is `malformed-answer`.
23362
+ */
23363
+ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23364
+ kind: literal("proposed"),
23365
+ profileId: string(),
23366
+ model: string(),
23367
+ /** The frame was sent outside the house for this answer. */
23368
+ leftHouse: boolean(),
23369
+ proposals: array(RetrainLlmProposalSchema).readonly(),
23370
+ reviews: array(RetrainLlmReviewSchema).readonly(),
23371
+ rejected: number().int()
23372
+ }), object({
23373
+ kind: literal("refused"),
23374
+ reason: _enum([
23375
+ "unknown-frame",
23376
+ "unreadable-frame",
23377
+ "unknown-profile",
23378
+ "profile-disabled",
23379
+ "no-vision",
23380
+ "cloud-not-confirmed",
23381
+ "llm-error",
23382
+ "malformed-answer"
23383
+ ]),
23384
+ detail: string().optional()
23385
+ })]);
22341
23386
  /** The outcome of a lifecycle move owned by the retrain page. */
22342
23387
  var RetrainTransitionResultSchema = object({
22343
23388
  trackId: string(),
@@ -23055,7 +24100,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23055
24100
  auth: "admin"
23056
24101
  }), method(object({
23057
24102
  deviceId: number(),
23058
- trackId: string(),
24103
+ trackId: string().optional(),
23059
24104
  frameId: string()
23060
24105
  }), object({
23061
24106
  removed: boolean(),
@@ -23072,7 +24117,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23072
24117
  auth: "admin"
23073
24118
  }), method(object({
23074
24119
  deviceId: number(),
23075
- trackId: string(),
24120
+ /** The frame's track, when it has one — checked against the frame. */
24121
+ trackId: string().optional(),
23076
24122
  frameId: string(),
23077
24123
  subject: RetrainAssistSubjectSchema,
23078
24124
  /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
@@ -23080,12 +24126,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23080
24126
  }), RetrainAssistResultSchema, {
23081
24127
  kind: "mutation",
23082
24128
  auth: "admin"
23083
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
24129
+ }), method(object({
24130
+ trackId: string().optional(),
24131
+ frameIds: array(string()).max(2e3).optional()
24132
+ }), array(RetrainAnnotationSchema).readonly(), {
23084
24133
  kind: "query",
23085
24134
  auth: "admin"
23086
24135
  }), method(object({
23087
24136
  deviceId: number(),
23088
- trackId: string(),
24137
+ /** The frame's track, when it has one — checked against the frame. */
24138
+ trackId: string().optional(),
23089
24139
  frameId: string(),
23090
24140
  annotations: array(RetrainAnnotationDraftSchema)
23091
24141
  }), array(RetrainAnnotationSchema).readonly(), {
@@ -23103,7 +24153,91 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23103
24153
  }), RetrainTransitionResultSchema, {
23104
24154
  kind: "mutation",
23105
24155
  auth: "admin"
23106
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
24156
+ }), method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string() }), {
24157
+ kind: "query",
24158
+ auth: "admin"
24159
+ }), method(object({
24160
+ deviceId: number(),
24161
+ trackId: string().optional(),
24162
+ frameId: string(),
24163
+ complete: boolean()
24164
+ }), RetrainFrameSchema, {
24165
+ kind: "mutation",
24166
+ auth: "admin"
24167
+ }), method(object({
24168
+ filter: RetrainExportFilterSchema,
24169
+ layout: RetrainExportLayoutSchema,
24170
+ target: RetrainArchiveTargetSchema
24171
+ }), RetrainArchiveResultSchema, {
24172
+ kind: "mutation",
24173
+ auth: "admin",
24174
+ timeoutMs: 60 * 6e4
24175
+ }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24176
+ kind: "query",
24177
+ auth: "admin"
24178
+ }), method(object({
24179
+ deviceId: number(),
24180
+ trackId: string().optional(),
24181
+ frameId: string(),
24182
+ profileId: string(),
24183
+ classes: array(RetrainMacroClassSchema).min(1),
24184
+ boxes: array(object({
24185
+ ref: string(),
24186
+ bbox: RetrainBboxSchema,
24187
+ macroClass: RetrainMacroClassSchema,
24188
+ label: string().optional()
24189
+ })).max(50),
24190
+ allowCloud: boolean()
24191
+ }), RetrainLlmAssistResultSchema, {
24192
+ kind: "mutation",
24193
+ auth: "admin",
24194
+ timeoutMs: 18e4
24195
+ }), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
24196
+ kind: "mutation",
24197
+ auth: "admin"
24198
+ }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24199
+ kind: "query",
24200
+ auth: "admin"
24201
+ }), method(object({
24202
+ id: string(),
24203
+ name: string().max(120)
24204
+ }), RetrainCollectionRenameResultSchema, {
24205
+ kind: "mutation",
24206
+ auth: "admin"
24207
+ }), method(object({ id: string() }), object({
24208
+ deleted: boolean(),
24209
+ removedFrames: number().int()
24210
+ }), {
24211
+ kind: "mutation",
24212
+ auth: "admin"
24213
+ }), method(object({
24214
+ collectionId: string(),
24215
+ deviceId: number(),
24216
+ epochMs: number()
24217
+ }), AddRetrainFrameFromRecordingResultSchema, {
24218
+ kind: "mutation",
24219
+ auth: "admin",
24220
+ timeoutMs: 6e4
24221
+ }), method(object({
24222
+ collectionId: string(),
24223
+ frameIds: array(string()).min(1).max(500)
24224
+ }), object({
24225
+ added: number().int(),
24226
+ alreadyMember: number().int(),
24227
+ unknownFrameIds: array(string()).readonly()
24228
+ }), {
24229
+ kind: "mutation",
24230
+ auth: "admin"
24231
+ }), method(object({
24232
+ collectionId: string(),
24233
+ frameId: string()
24234
+ }), object({
24235
+ removed: boolean(),
24236
+ deletedFrame: boolean()
24237
+ }), {
24238
+ kind: "mutation",
24239
+ auth: "admin"
24240
+ }), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
23107
24241
  kind: "query",
23108
24242
  auth: "admin"
23109
24243
  }), method(object({
@@ -23156,6 +24290,34 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23156
24290
  timestamp: number()
23157
24291
  });
23158
24292
  /**
24293
+ * A root model's boxes standing in for one crop-kind step's own inference
24294
+ * (D730) — see `runPipeline.suppliedRoot`.
24295
+ */
24296
+ var SuppliedRootOutputSchema = object({
24297
+ stepId: string(),
24298
+ /** The root model that drew the boxes — stamped on the result. */
24299
+ modelId: string(),
24300
+ detections: array(object({
24301
+ /** `[x1, y1, x2, y2]` in the pixels of the call's image. */
24302
+ bbox: tuple([
24303
+ number(),
24304
+ number(),
24305
+ number(),
24306
+ number()
24307
+ ]),
24308
+ score: number(),
24309
+ /**
24310
+ * Five facial landmarks in the same pixels — a face the step's own
24311
+ * detector already re-found inside a root face box (D730), so its
24312
+ * embedder child aligns it exactly as it aligns any detected face.
24313
+ */
24314
+ landmarks: array(object({
24315
+ x: number(),
24316
+ y: number()
24317
+ })).optional()
24318
+ })).min(1)
24319
+ });
24320
+ /**
23159
24321
  * Reference to the frame's retained NATIVE surface + the parent crop's placement
23160
24322
  * within the frame, so the executor can re-cut a leaf child ROI at native
23161
24323
  * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
@@ -23203,7 +24365,7 @@ var FrameRefSchema = object({
23203
24365
  timestamp: number(),
23204
24366
  capturedAt: number().optional()
23205
24367
  });
23206
- var ModelFormatSchema$1 = _enum([
24368
+ var ModelFormatSchema$2 = _enum([
23207
24369
  "onnx",
23208
24370
  "coreml",
23209
24371
  "openvino",
@@ -23221,7 +24383,7 @@ var PipelineSlotSchema = _enum([
23221
24383
  var PipelineEngineChoiceSchema = object({
23222
24384
  runtime: literal("python"),
23223
24385
  backend: string(),
23224
- format: ModelFormatSchema$1,
24386
+ format: ModelFormatSchema$2,
23225
24387
  device: string().optional()
23226
24388
  });
23227
24389
  /**
@@ -23260,32 +24422,15 @@ var PipelineDefaultStepSchema = lazy(() => object({
23260
24422
  group: string().optional(),
23261
24423
  settings: record(string(), unknown()).optional()
23262
24424
  }));
23263
- var PipelineTemplateStepSchema = lazy(() => object({
23264
- addonId: string(),
23265
- enabled: boolean(),
23266
- modelId: string(),
23267
- children: array(PipelineTemplateStepSchema).readonly(),
23268
- settings: record(string(), unknown()).optional()
23269
- }));
23270
- var PipelineTemplateSchema$1 = object({
23271
- id: string(),
23272
- name: string(),
23273
- createdAt: string(),
23274
- updatedAt: string(),
23275
- engine: PipelineEngineChoiceSchema,
23276
- steps: array(PipelineTemplateStepSchema).readonly()
23277
- });
23278
24425
  var PipelineModelOptionSchema = object({
23279
24426
  id: string(),
23280
24427
  name: string(),
23281
- formats: record(string(), object({
23282
- downloaded: boolean(),
23283
- sizeMB: number()
23284
- })),
24428
+ formats: record(string(), PipelineModelFormatStatusSchema),
23285
24429
  group: ModelVariantGroupSchema.optional(),
23286
24430
  legacy: boolean().optional(),
23287
24431
  provider: ModelProviderIdSchema.optional(),
23288
- defaultConfidence: number().optional()
24432
+ defaultConfidence: number().optional(),
24433
+ suppliesSteps: array(RootStepSupplySchema).readonly().optional()
23289
24434
  });
23290
24435
  var ConfigFieldBridge = custom();
23291
24436
  var PipelineAddonSchemaSchema = object({
@@ -23447,6 +24592,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
23447
24592
  }), {
23448
24593
  kind: "mutation",
23449
24594
  auth: "admin"
24595
+ }), method(object({
24596
+ nodeId: string(),
24597
+ deviceIds: array(number()).readonly().optional(),
24598
+ dryRun: boolean()
24599
+ }), object({
24600
+ entries: array(object({
24601
+ deviceId: number(),
24602
+ keys: array(string()).readonly()
24603
+ })).readonly(),
24604
+ refused: array(object({
24605
+ deviceId: number(),
24606
+ reason: string()
24607
+ })).readonly()
24608
+ }), {
24609
+ kind: "mutation",
24610
+ auth: "admin"
23450
24611
  }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
23451
24612
  /** `<backend>:<device>`, e.g. `openvino:gpu`. */
23452
24613
  deviceKey: string(),
@@ -23472,22 +24633,14 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
23472
24633
  }), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(object({
23473
24634
  steps: array(PipelineStepInputSchema),
23474
24635
  deviceKey: string().optional()
23475
- }), PipelineValidationResultSchema), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
23476
- name: string(),
23477
- steps: array(PipelineTemplateStepSchema).readonly(),
23478
- engine: PipelineEngineChoiceSchema
23479
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
23480
- id: string(),
23481
- name: string().optional(),
23482
- steps: array(PipelineTemplateStepSchema).readonly().optional()
23483
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
24636
+ }), PipelineValidationResultSchema), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
23484
24637
  addonId: string(),
23485
24638
  modelId: string(),
23486
- format: ModelFormatSchema$1
24639
+ format: ModelFormatSchema$2
23487
24640
  }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
23488
24641
  addonId: string(),
23489
24642
  modelId: string(),
23490
- format: ModelFormatSchema$1
24643
+ format: ModelFormatSchema$2
23491
24644
  }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
23492
24645
  steps: array(PipelineStepInputSchema).min(1),
23493
24646
  frame: FrameInputSchema.optional(),
@@ -23553,7 +24706,16 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
23553
24706
  * `device-not-servable`), and nothing reaches the camera's live
23554
24707
  * trace stream. Absent ⇒ unchanged behaviour.
23555
24708
  */
23556
- replay: literal(true).optional()
24709
+ replay: literal(true).optional(),
24710
+ /**
24711
+ * Root-supplied detections for the tree's ROOT step (D730). Set by
24712
+ * `runDetailSubtree` when the camera's root model supplies a crop-kind
24713
+ * step (a Frigate+ `license_plate` for `plate-detection`): the step is
24714
+ * NOT inferred, these boxes are its output, and its children (the plate
24715
+ * reader) run on them through their own crop policy. Boxes are in the
24716
+ * PIXELS of the image this call carries. Absent ⇒ the root step runs.
24717
+ */
24718
+ suppliedRoot: SuppliedRootOutputSchema.optional()
23557
24719
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
23558
24720
  steps: array(PipelineStepInputSchema).min(1),
23559
24721
  frames: array(FrameInputSchema).min(1).max(255),
@@ -23635,6 +24797,763 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
23635
24797
  filename: string().optional(),
23636
24798
  settings: record(string(), unknown()).optional()
23637
24799
  }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
24800
+ /**
24801
+ * The wire shapes of the Auto tune plan and apply (D745), used by the
24802
+ * `pipeline-orchestrator` cap. The recommender's own types
24803
+ * (`recommend.ts`) are the TS face of the same data; these
24804
+ * schemas are what crosses the cap boundary.
24805
+ */
24806
+ var ModelFormatSchema$1 = _enum(MODEL_FORMATS);
24807
+ /** The operator's range for it. */
24808
+ var MIN_SESSIONS_PER_DEVICE_RANGE = {
24809
+ min: 1,
24810
+ max: 8
24811
+ };
24812
+ var HardwareClassIdSchema = _enum([
24813
+ "intel-core-ultra",
24814
+ "intel-n-series",
24815
+ "apple-m-base",
24816
+ "apple-m-pro",
24817
+ "unknown"
24818
+ ]);
24819
+ var AcceleratorKindSchema = _enum([
24820
+ "intel-npu",
24821
+ "intel-igpu",
24822
+ "x86-cpu",
24823
+ "arm-cpu",
24824
+ "apple-ane",
24825
+ "coral"
24826
+ ]);
24827
+ var RecommendationReasonSchema = discriminatedUnion("kind", [
24828
+ object({
24829
+ kind: literal("capacity"),
24830
+ sessions: number(),
24831
+ minSessions: number()
24832
+ }),
24833
+ object({
24834
+ kind: literal("tie-faster"),
24835
+ over: string(),
24836
+ recallDelta: number()
24837
+ }),
24838
+ object({
24839
+ kind: literal("stepped-down"),
24840
+ from: string(),
24841
+ to: string(),
24842
+ limitedBy: string()
24843
+ }),
24844
+ object({
24845
+ kind: literal("no-fit-lightest"),
24846
+ sessions: number(),
24847
+ minSessions: number()
24848
+ }),
24849
+ object({
24850
+ kind: literal("derived-latency"),
24851
+ modelId: string()
24852
+ }),
24853
+ object({ kind: literal("cpu-device") }),
24854
+ object({ kind: literal("coral-untouched") }),
24855
+ object({ kind: literal("device-disabled") }),
24856
+ object({ kind: literal("device-unavailable") }),
24857
+ object({ kind: literal("node-offline") }),
24858
+ object({ kind: literal("no-hardware-facts") }),
24859
+ object({
24860
+ kind: literal("no-measured-data"),
24861
+ hardwareClass: HardwareClassIdSchema
24862
+ }),
24863
+ object({
24864
+ kind: literal("no-family-build"),
24865
+ format: ModelFormatSchema$1
24866
+ }),
24867
+ object({
24868
+ kind: literal("kept-custom-pin"),
24869
+ modelId: string(),
24870
+ deviceKey: string()
24871
+ })
24872
+ ]);
24873
+ /** Why a device is left exactly as it is, whatever the plan would pick (D786). */
24874
+ var KeptReasonSchema = _enum(["custom-pin"]);
24875
+ /**
24876
+ * Where a choice's latency came from (D791): this node's own benchmark
24877
+ * result, or the hardware-class table. Measured on the node beats the table.
24878
+ */
24879
+ var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
24880
+ kind: literal("node-benchmark"),
24881
+ resultId: string(),
24882
+ measuredAtMs: number()
24883
+ })]);
24884
+ var DeviceModelChoiceSchema = object({
24885
+ modelId: string(),
24886
+ p50Ms: number(),
24887
+ fps: number(),
24888
+ measured: boolean(),
24889
+ /** Absent on a plan from before D791 — read as the table. */
24890
+ source: LatencySourceSchema.optional(),
24891
+ /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
24892
+ capacitySessions: number(),
24893
+ personRecall: number()
24894
+ });
24895
+ var DeviceRecommendationSchema = object({
24896
+ deviceKey: string(),
24897
+ accelerator: AcceleratorKindSchema.nullable(),
24898
+ enabled: boolean(),
24899
+ available: boolean(),
24900
+ chosen: DeviceModelChoiceSchema.nullable(),
24901
+ /** Present when the device is kept as is: Apply writes nothing on it. */
24902
+ kept: KeptReasonSchema.optional(),
24903
+ reasons: array(RecommendationReasonSchema).readonly()
24904
+ });
24905
+ var NodeRecommendationSchema = object({
24906
+ nodeId: string(),
24907
+ reachable: boolean(),
24908
+ hardwareClass: HardwareClassIdSchema.nullable(),
24909
+ cpuModel: string().nullable(),
24910
+ skipped: boolean(),
24911
+ acceleratorModelId: string().nullable(),
24912
+ devices: array(DeviceRecommendationSchema).readonly(),
24913
+ reasons: array(RecommendationReasonSchema).readonly()
24914
+ });
24915
+ var ModelPinChangeSchema = object({
24916
+ stepId: string(),
24917
+ before: string().nullable(),
24918
+ after: string().nullable()
24919
+ });
24920
+ var NodeDeviceChangeSchema = object({
24921
+ nodeId: string(),
24922
+ deviceKey: string(),
24923
+ madeExplicit: boolean(),
24924
+ modelPins: array(ModelPinChangeSchema).readonly(),
24925
+ thresholds: array(object({
24926
+ stepId: string(),
24927
+ keys: array(string()).readonly()
24928
+ })).readonly()
24929
+ });
24930
+ var CameraOverrideClearSchema = object({
24931
+ deviceId: number(),
24932
+ source: _enum(["step-override", "wholesale"]),
24933
+ nodeId: string(),
24934
+ deviceKey: string().nullable(),
24935
+ stepId: string(),
24936
+ modelIdBefore: string().nullable(),
24937
+ keys: array(string()).readonly()
24938
+ });
24939
+ var DetectorStoreClearSchema = object({
24940
+ deviceId: number(),
24941
+ keys: array(string()).readonly()
24942
+ });
24943
+ var AutoTuneWarningSchema = discriminatedUnion("kind", [
24944
+ object({
24945
+ kind: literal("detector-store-cluster-wide"),
24946
+ skippedNodes: array(string()).readonly()
24947
+ }),
24948
+ object({
24949
+ kind: literal("detector-store-unreadable"),
24950
+ error: string()
24951
+ }),
24952
+ object({
24953
+ kind: literal("coral-enabled"),
24954
+ nodeId: string(),
24955
+ deviceKey: string()
24956
+ }),
24957
+ object({
24958
+ kind: literal("custom-pin-kept"),
24959
+ nodeId: string(),
24960
+ deviceKey: string().nullable(),
24961
+ deviceId: number().nullable(),
24962
+ modelId: string()
24963
+ }),
24964
+ object({
24965
+ kind: literal("custom-registry-unreadable"),
24966
+ error: string()
24967
+ })
24968
+ ]);
24969
+ var AutoTuneOptionsSchema = object({
24970
+ /** Share of each accelerator's throughput kept free (0.3–0.5). */
24971
+ headroom: number().min(.3).max(.5).default(.4),
24972
+ /**
24973
+ * The least number of parallel sessions every device must sustain at the
24974
+ * camera rate with the headroom kept free (D755). The most accurate model
24975
+ * that reaches it wins.
24976
+ */
24977
+ minSessionsPerDevice: number().int().min(MIN_SESSIONS_PER_DEVICE_RANGE.min).max(MIN_SESSIONS_PER_DEVICE_RANGE.max).default(2)
24978
+ });
24979
+ var AutoTunePlanSchema = object({
24980
+ /** Hash of everything the apply will write — the apply refuses a different one. */
24981
+ planHash: string(),
24982
+ family: literal("yolov9"),
24983
+ headroom: number(),
24984
+ minSessionsPerDevice: number(),
24985
+ /** The detection rate a session is counted at (the fastest camera running the pipeline root). */
24986
+ cameraFps: number(),
24987
+ generatedAt: number(),
24988
+ nodes: array(NodeRecommendationSchema).readonly(),
24989
+ nodeChanges: array(NodeDeviceChangeSchema).readonly(),
24990
+ cameraClears: array(CameraOverrideClearSchema).readonly(),
24991
+ detectorStoreClears: array(DetectorStoreClearSchema).readonly(),
24992
+ warnings: array(AutoTuneWarningSchema).readonly()
24993
+ });
24994
+ var AutoTuneApplyInputSchema = object({
24995
+ planHash: string(),
24996
+ headroom: number().min(.3).max(.5).default(.4),
24997
+ minSessionsPerDevice: number().int().min(MIN_SESSIONS_PER_DEVICE_RANGE.min).max(MIN_SESSIONS_PER_DEVICE_RANGE.max).default(2)
24998
+ });
24999
+ var AutoTunePhaseResultSchema = object({
25000
+ phase: _enum([
25001
+ "download",
25002
+ "camera-overrides",
25003
+ "detector-thresholds",
25004
+ "node-models",
25005
+ "redispatch"
25006
+ ]),
25007
+ ok: boolean(),
25008
+ detail: string()
25009
+ });
25010
+ var AutoTuneApplyResultSchema = discriminatedUnion("kind", [
25011
+ object({
25012
+ kind: literal("applied"),
25013
+ planHash: string(),
25014
+ phases: array(AutoTunePhaseResultSchema).readonly()
25015
+ }),
25016
+ object({
25017
+ kind: literal("aborted"),
25018
+ phases: array(AutoTunePhaseResultSchema).readonly()
25019
+ }),
25020
+ object({
25021
+ kind: literal("stale"),
25022
+ plan: AutoTunePlanSchema
25023
+ }),
25024
+ object({
25025
+ kind: literal("refused"),
25026
+ reason: _enum(["apply-in-progress"])
25027
+ })
25028
+ ]);
25029
+ /**
25030
+ * Wire shapes of the Load balancing surface (D748): the session placement
25031
+ * policy, the atomic share write, the observed placement statistics, the
25032
+ * hardware share suggestion and the stale device pins.
25033
+ */
25034
+ /**
25035
+ * How a new detection session picks its node and device.
25036
+ * - `least-loaded` — the historical rule: lowest `attached / weight`, a
25037
+ * constant node order at a tie (D37). An idle node always ties at 0, so a
25038
+ * weight only bites once a node already holds a session.
25039
+ * - `share` — the share of PARALLEL sessions is held to the weights, and a
25040
+ * full or drowning node yields to a free one (D748).
25041
+ */
25042
+ var SessionPlacementPolicySchema = _enum(["least-loaded", "share"]);
25043
+ var LoadBalancingSharesInputSchema = object({
25044
+ /** nodeId → share (> 0). A node left out keeps its weight. */
25045
+ nodes: record(string(), number().positive()).default({}),
25046
+ /** nodeId → deviceKey → share (> 0). A device left out keeps its weight. */
25047
+ devices: record(string(), record(string(), number().positive())).default({})
25048
+ });
25049
+ var PlacementStatsInputSchema = object({
25050
+ /** Window the observed shares are averaged over (default 1 h, max 24 h). */
25051
+ windowMs: number().int().min(6e4).max(1440 * 60 * 1e3).default(3600 * 1e3) });
25052
+ var PlacementDeviceStatsSchema = object({
25053
+ deviceKey: string(),
25054
+ /** Sessions running on this device now. */
25055
+ sessionsNow: number(),
25056
+ /** Sessions started on this device inside the window. */
25057
+ sessionsStarted: number(),
25058
+ /** Time-weighted share of the node's parallel sessions over the window (0–1); null = no session ran. */
25059
+ observedShare: number().nullable()
25060
+ });
25061
+ var PlacementNodeStatsSchema = object({
25062
+ nodeId: string(),
25063
+ sessionsNow: number(),
25064
+ sessionsStarted: number(),
25065
+ /** Time-weighted share of the cluster's parallel sessions over the window (0–1); null = none ran. */
25066
+ observedShare: number().nullable(),
25067
+ /** Most sessions this node ran at once inside the window. */
25068
+ peakSessions: number(),
25069
+ /** Sessions a share election handed elsewhere because this node was full or drowning. */
25070
+ yieldsAway: number(),
25071
+ devices: array(PlacementDeviceStatsSchema).readonly()
25072
+ });
25073
+ /** A camera's device pin that the session path cannot honour. */
25074
+ var StaleDevicePinSchema = object({
25075
+ deviceId: number(),
25076
+ deviceKey: string(),
25077
+ /** `disabled` — the key exists on some node but is not enabled anywhere; `absent` — no node has it. */
25078
+ reason: _enum(["disabled", "absent"])
25079
+ });
25080
+ var PlacementStatsSchema = object({
25081
+ policy: SessionPlacementPolicySchema,
25082
+ windowMs: number(),
25083
+ /** How much of the window was actually observed (the hub keeps it in memory). */
25084
+ observedForMs: number(),
25085
+ sessionsNow: number(),
25086
+ /** Most parallel sessions across the cluster inside the window. */
25087
+ clusterPeakSessions: number(),
25088
+ nodes: array(PlacementNodeStatsSchema).readonly(),
25089
+ stalePins: array(StaleDevicePinSchema).readonly()
25090
+ });
25091
+ /**
25092
+ * Where an automatic share's capacity comes from (D755).
25093
+ * - `hardware` — the static capacity of each device at its Auto tune model:
25094
+ * the measured latency table for the node's hardware class.
25095
+ * - `benchmark` — the node's own measured capacity (node benchmark results).
25096
+ * A node with no results falls back to `hardware`, and says so.
25097
+ */
25098
+ var CapacitySourceSchema = _enum(["hardware", "benchmark"]);
25099
+ /** Why a node under the `benchmark` source was sized from hardware instead. */
25100
+ var CapacityFallbackSchema = _enum(["no-benchmark-results", "partial-benchmark-results"]);
25101
+ var SuggestSharesInputSchema = object({
25102
+ headroom: number().min(.3).max(.5).default(.4),
25103
+ /** Default `hardware`. */
25104
+ source: CapacitySourceSchema.default("hardware")
25105
+ });
25106
+ var SuggestedDeviceShareSchema = object({
25107
+ deviceKey: string(),
25108
+ /** Share of the node (0–100, rounded). */
25109
+ share: number(),
25110
+ modelId: string().nullable(),
25111
+ /** Inferences per second at that model, from the measured table; null when sized by a benchmark. */
25112
+ fps: number().nullable(),
25113
+ /** False for a table cell derived from another chip; true for a measured cell or a benchmark. */
25114
+ measured: boolean(),
25115
+ /**
25116
+ * Advisory session cap: ⌊fps × (1 − headroom) / camera fps⌋ from the table,
25117
+ * or the benchmark's measured max sessions. Never enforced.
25118
+ */
25119
+ suggestedMaxSessions: number().nullable()
25120
+ });
25121
+ var SuggestedNodeShareSchema = object({
25122
+ nodeId: string(),
25123
+ /** Share of the cluster (0–100, rounded); null = node skipped (offline, unknown hardware). */
25124
+ share: number().nullable(),
25125
+ /** Parallel sessions the node sustains at the suggested models with the headroom kept free. */
25126
+ capacitySessions: number(),
25127
+ devices: array(SuggestedDeviceShareSchema).readonly(),
25128
+ skippedReason: string().nullable(),
25129
+ /** What this node's capacity was read from; null when the node is skipped. */
25130
+ capacitySource: CapacitySourceSchema.nullable(),
25131
+ /** Set when the `benchmark` source was asked for and this node used `hardware`. */
25132
+ capacityFallback: CapacityFallbackSchema.nullable()
25133
+ });
25134
+ var SuggestSharesResultSchema = object({
25135
+ headroom: number(),
25136
+ /** The source asked for; each node says what it actually used. */
25137
+ source: CapacitySourceSchema,
25138
+ /** Camera detection rate the capacity is counted in (the fastest camera's fps). */
25139
+ cameraFps: number(),
25140
+ /** The Auto tune capacity floor the models were picked at. */
25141
+ minSessionsPerDevice: number(),
25142
+ nodes: array(SuggestedNodeShareSchema).readonly()
25143
+ });
25144
+ /**
25145
+ * Where the node and device shares come from (D750, D755, D791).
25146
+ * - `benchmark` (default since D791) — each node's capacity as its own node
25147
+ * benchmark measured it; a node without fresh results is sized from
25148
+ * `hardware` and says so. Measured on the node beats the table.
25149
+ * - `hardware` — computed from each node's static capacity only (its
25150
+ * accelerators at their Auto tune models, from the latency table).
25151
+ * Both are recomputed whenever a node or device joins, leaves, is switched
25152
+ * on or off, changes model, or a benchmark result is written. No load input.
25153
+ * - `manual` — the operator's stored sliders.
25154
+ * Either way a node or device that cannot take sessions gives its share to
25155
+ * the others in proportion; the stored values are never rewritten for that.
25156
+ */
25157
+ var ShareSourceSchema = _enum([
25158
+ "hardware",
25159
+ "benchmark",
25160
+ "manual"
25161
+ ]);
25162
+ var SetShareSourceInputSchema = object({ source: ShareSourceSchema });
25163
+ object({
25164
+ nodes: record(string(), number()),
25165
+ devices: record(string(), record(string(), number()))
25166
+ });
25167
+ var EffectiveDeviceShareSchema = object({
25168
+ deviceKey: string(),
25169
+ /** Can take sessions now (enabled, available, can run the root). */
25170
+ eligible: boolean(),
25171
+ /** The share the source assigns, as a percentage of the node's devices. */
25172
+ configuredPct: number(),
25173
+ /** The share actually used, after an ineligible device's share went to the others. */
25174
+ effectivePct: number()
25175
+ });
25176
+ var EffectiveNodeShareSchema = object({
25177
+ nodeId: string(),
25178
+ eligible: boolean(),
25179
+ configuredPct: number(),
25180
+ effectivePct: number(),
25181
+ /** Automatic sources: what this node's share was computed from; null under `manual` or before the first answer. */
25182
+ capacitySource: CapacitySourceSchema.nullable(),
25183
+ /** Automatic `benchmark`: why this node used `hardware` instead. */
25184
+ capacityFallback: CapacityFallbackSchema.nullable(),
25185
+ devices: array(EffectiveDeviceShareSchema).readonly()
25186
+ });
25187
+ var EffectiveSharesSchema = object({
25188
+ source: ShareSourceSchema,
25189
+ policy: SessionPlacementPolicySchema,
25190
+ /** An automatic source with no computed answer yet: the stored sliders are used meanwhile. */
25191
+ autoPending: boolean(),
25192
+ /** When the automatic shares were last computed (ms epoch); null = never. */
25193
+ computedAt: number().nullable(),
25194
+ /** What made the system recompute them last. */
25195
+ trigger: string().nullable(),
25196
+ nodes: array(EffectiveNodeShareSchema).readonly(),
25197
+ /** The relative weights the election reads (before eligibility). */
25198
+ nodeWeights: record(string(), number()),
25199
+ deviceWeights: record(string(), record(string(), number()))
25200
+ });
25201
+ /**
25202
+ * Wire shapes of the node benchmark (D791): the operator's plan, the
25203
+ * preflight the confirmation shows, the run the orchestrator owns, what the
25204
+ * measuring runner reports, and the result rows Auto tune and the automatic
25205
+ * shares read.
25206
+ *
25207
+ * ONE node at a time, owned by the pipeline orchestrator. While a run is
25208
+ * active the cluster is in BENCHMARK MODE for that node: it is not a
25209
+ * detection candidate, camera pins naming it are ignored so its sessions move
25210
+ * elsewhere, and both come back when the mode ends — after a crash or a hub
25211
+ * restart too (a persisted manifest, reconciled against the registry).
25212
+ *
25213
+ * Two measurements, both on the node, driven by its own runner (frames never
25214
+ * cross a process at frame rate, D9):
25215
+ * - `device` — one accelerator × one candidate detector, root only, open
25216
+ * loop: how many streams at the camera rate it carries inside the frame
25217
+ * interval;
25218
+ * - `pipeline` — the chosen detector plus the operator's detail steps
25219
+ * (faces, plates, classifiers, CLIP…), on varied frames from the bench
25220
+ * clip: how many parallel sessions the node carries before latency, drops,
25221
+ * CPU, RAM or the event loop give out.
25222
+ */
25223
+ /** Defaults and bounds, one place. */
25224
+ var NODE_BENCHMARK_DEFAULTS = {
25225
+ fpsPerStream: 10,
25226
+ budgetMinutes: 45,
25227
+ minBudgetMinutes: 10,
25228
+ maxBudgetMinutes: 120,
25229
+ /** A result older than this no longer beats the table. */
25230
+ staleAfterDays: 30,
25231
+ /** Warm-in per ramp step (not accounted). */
25232
+ settleSec: 5,
25233
+ /** Accounted window per ramp step. */
25234
+ measureSec: 20,
25235
+ /** Longest the drain may take before the run is refused. */
25236
+ drainTimeoutSec: 120,
25237
+ /** Candidate models per device in one run. */
25238
+ maxModelsPerDevice: 6
25239
+ };
25240
+ /** The two measurements a run can make. */
25241
+ var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
25242
+ var NodeBenchmarkDevicePlanSchema = object({
25243
+ /** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
25244
+ deviceKey: string().min(1),
25245
+ /**
25246
+ * Root detector candidates for the `device` measurement, in the order
25247
+ * measured. The FIRST is the one the `pipeline` measurement runs.
25248
+ */
25249
+ modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
25250
+ });
25251
+ /** What the operator confirmed. */
25252
+ var NodeBenchmarkPlanSchema = object({
25253
+ nodeId: string().min(1),
25254
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25255
+ /** Which measurements run. At least one. */
25256
+ phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
25257
+ /**
25258
+ * Detail steps (catalog step ids under the root: faces, plates,
25259
+ * classifiers, CLIP…) the `pipeline` measurement enables. The root
25260
+ * detector always runs.
25261
+ */
25262
+ steps: array(string().min(1)).default([]),
25263
+ /** Offered rate of one stream / session. */
25264
+ fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
25265
+ /** Hard deadline: the mode ends and the cluster is restored when it passes. */
25266
+ budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
25267
+ /** Keep the models the run downloaded (default: delete what was not installed before). */
25268
+ keepDownloadedModels: boolean().default(false),
25269
+ /** Start although the other nodes' capacity does not cover the sessions running now. */
25270
+ acceptInsufficientHeadroom: boolean().default(false)
25271
+ });
25272
+ var NodeBenchmarkRefusalSchema = object({
25273
+ kind: _enum([
25274
+ "benchmark-active",
25275
+ "node-offline",
25276
+ "unknown-device",
25277
+ "no-phase",
25278
+ "insufficient-headroom"
25279
+ ]),
25280
+ detail: string(),
25281
+ overridable: boolean()
25282
+ });
25283
+ /** A camera whose detection leaves the node for the run. */
25284
+ var NodeBenchmarkMovingCameraSchema = object({
25285
+ deviceId: number(),
25286
+ /** Placed on the node now (a standing attach or a running session). */
25287
+ placedOnNode: boolean(),
25288
+ /** A node pin naming this node, ignored for the run. */
25289
+ pinnedToNode: boolean()
25290
+ });
25291
+ /** A camera that cannot leave: no other node can obtain its frames. */
25292
+ var NodeBenchmarkStayingCameraSchema = object({
25293
+ deviceId: number(),
25294
+ reason: literal("only-frame-source")
25295
+ });
25296
+ var NodeBenchmarkPreflightSchema = object({
25297
+ nodeId: string(),
25298
+ online: boolean(),
25299
+ moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
25300
+ /** Keep running on the node during the run; the result is flagged contaminated. */
25301
+ staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
25302
+ estimatedDurationMs: number(),
25303
+ /** The run ends and the cluster is restored at the latest after this long. */
25304
+ budgetMs: number(),
25305
+ phases: array(NodeBenchmarkPhaseSchema).readonly(),
25306
+ steps: array(string()).readonly(),
25307
+ devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
25308
+ /** Parallel sessions the cluster runs now, and what the other nodes can carry. */
25309
+ headroom: object({
25310
+ sessionsNow: number(),
25311
+ otherNodesCapacitySessions: number().nullable()
25312
+ }),
25313
+ refusals: array(NodeBenchmarkRefusalSchema).readonly(),
25314
+ canStart: boolean()
25315
+ });
25316
+ /** Where the measuring runner is. */
25317
+ var NodeBenchProgressSchema = object({
25318
+ phase: _enum([
25319
+ "preparing",
25320
+ "device",
25321
+ "pipeline",
25322
+ "cleanup"
25323
+ ]),
25324
+ deviceKey: string().nullable(),
25325
+ modelId: string().nullable(),
25326
+ /** Streams (device) or sessions (pipeline) of the step running now. */
25327
+ load: number().nullable(),
25328
+ cellsDone: number(),
25329
+ cellsTotal: number(),
25330
+ message: string()
25331
+ });
25332
+ /** What limited a ramp. `none` = the ramp ran out of steps still passing. */
25333
+ var NodeBenchLimitSchema = _enum([
25334
+ "p95",
25335
+ "drops",
25336
+ "errors",
25337
+ "stall",
25338
+ "cpu",
25339
+ "ram",
25340
+ "none"
25341
+ ]);
25342
+ var NodeBenchRampStepSchema = object({
25343
+ load: number(),
25344
+ pass: boolean(),
25345
+ p95Ms: number(),
25346
+ dropRatio: number(),
25347
+ /** Completed frames per second over the accounted window. */
25348
+ fps: number(),
25349
+ cpuPct: number().nullable(),
25350
+ ramFreePct: number().nullable(),
25351
+ failReasons: array(string()).readonly()
25352
+ });
25353
+ var NodeBenchCellSchema = discriminatedUnion("phase", [object({
25354
+ phase: literal("device"),
25355
+ deviceKey: string(),
25356
+ modelId: string(),
25357
+ /** Single-stream latency (the K = 1 step). */
25358
+ p50Ms: number(),
25359
+ p95Ms: number(),
25360
+ p99Ms: number(),
25361
+ /** Frames per second sustained at the last passing step. */
25362
+ fps: number(),
25363
+ /** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
25364
+ kMax: number(),
25365
+ limitedBy: NodeBenchLimitSchema,
25366
+ /** First call (model load + warm-up). */
25367
+ warmupMs: number(),
25368
+ ramp: array(NodeBenchRampStepSchema).readonly()
25369
+ }), object({
25370
+ phase: literal("pipeline"),
25371
+ deviceKey: string(),
25372
+ modelId: string(),
25373
+ steps: array(string()).readonly(),
25374
+ /** Parallel sessions at the camera rate the node carried; 0 = not even one. */
25375
+ maxSessions: number(),
25376
+ limitedBy: NodeBenchLimitSchema,
25377
+ /** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
25378
+ stepsFired: array(string()).readonly(),
25379
+ warmupMs: number(),
25380
+ ramp: array(NodeBenchRampStepSchema).readonly()
25381
+ })]);
25382
+ /**
25383
+ * What a result was measured ON. A result whose fingerprint no longer matches
25384
+ * the node no longer beats the table.
25385
+ */
25386
+ var NodeBenchFingerprintSchema = object({
25387
+ pipelineVersion: string().nullable(),
25388
+ cpuModel: string().nullable(),
25389
+ ramGb: number().nullable(),
25390
+ os: string().nullable(),
25391
+ /** Per device: the pool the cells ran on (runtime + tuning). */
25392
+ pools: record(string(), object({
25393
+ runtime: string(),
25394
+ numWorkers: number(),
25395
+ concurrency: number(),
25396
+ batchMode: string()
25397
+ })).default({})
25398
+ });
25399
+ /** The frames the run used. */
25400
+ var NodeBenchClipSchema = object({
25401
+ /** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
25402
+ id: string(),
25403
+ revision: string().nullable(),
25404
+ frames: number(),
25405
+ width: number(),
25406
+ height: number()
25407
+ });
25408
+ var NodeBenchRunnerInputSchema = object({
25409
+ runId: string().min(1),
25410
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25411
+ phases: array(NodeBenchmarkPhaseSchema).min(1),
25412
+ /** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
25413
+ steps: array(string()).default([]),
25414
+ fpsPerStream: number().int().min(1).max(30),
25415
+ /** The runner stops on its own past this instant, whatever the hub does. */
25416
+ deadlineAtMs: number(),
25417
+ settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
25418
+ measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
25419
+ keepDownloadedModels: boolean().default(false)
25420
+ });
25421
+ var NodeBenchRunnerStateSchema = _enum([
25422
+ "running",
25423
+ "done",
25424
+ "failed",
25425
+ "aborted"
25426
+ ]);
25427
+ var NodeBenchRunnerStatusSchema = object({
25428
+ runId: string(),
25429
+ nodeId: string(),
25430
+ state: NodeBenchRunnerStateSchema,
25431
+ progress: NodeBenchProgressSchema.nullable(),
25432
+ /** Every finished cell so far — a run stopped half way keeps what it measured. */
25433
+ cells: array(NodeBenchCellSchema).readonly(),
25434
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25435
+ clip: NodeBenchClipSchema.nullable(),
25436
+ /** Cameras seen running on the node during the run (they share its pools). */
25437
+ activeCameraIds: array(number()).readonly(),
25438
+ /** Models the run downloaded and then deleted (not installed before). */
25439
+ deletedModels: array(string()).readonly(),
25440
+ error: string().nullable(),
25441
+ startedAtMs: number(),
25442
+ finishedAtMs: number().nullable()
25443
+ });
25444
+ var NodeBenchmarkStateSchema = _enum([
25445
+ "draining",
25446
+ "measuring",
25447
+ "restoring",
25448
+ "done",
25449
+ "failed",
25450
+ "aborted"
25451
+ ]);
25452
+ /** Why a run ended. */
25453
+ var NodeBenchmarkEndReasonSchema = _enum([
25454
+ "completed",
25455
+ "operator-abort",
25456
+ "deadline",
25457
+ "node-lost",
25458
+ "runner-lost",
25459
+ "hub-restart",
25460
+ "drain-timeout",
25461
+ "failed"
25462
+ ]);
25463
+ var NodeBenchmarkRunSchema = object({
25464
+ runId: string(),
25465
+ nodeId: string(),
25466
+ state: NodeBenchmarkStateSchema,
25467
+ plan: NodeBenchmarkPlanSchema,
25468
+ startedAtMs: number(),
25469
+ deadlineAtMs: number(),
25470
+ finishedAtMs: number().nullable(),
25471
+ endReason: NodeBenchmarkEndReasonSchema.nullable(),
25472
+ error: string().nullable(),
25473
+ /** Cameras moved off the node for the run. */
25474
+ moved: array(number()).readonly(),
25475
+ /** Cameras that stayed (their only frame source is the node). */
25476
+ staying: array(number()).readonly(),
25477
+ /** Something else ran on the node's pools during the run. */
25478
+ contaminated: boolean(),
25479
+ progress: NodeBenchProgressSchema.nullable(),
25480
+ resultIds: array(string()).readonly()
25481
+ });
25482
+ /** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
25483
+ var NodeBenchmarkStatusSchema = object({
25484
+ /** The node the cluster is in benchmark mode for; null = none. */
25485
+ modeNodeId: string().nullable(),
25486
+ run: NodeBenchmarkRunSchema.nullable()
25487
+ });
25488
+ /**
25489
+ * One stored measurement — the only authority Auto tune and the automatic
25490
+ * shares read measured capacity from. Written by the orchestrator when a run
25491
+ * ends, never by anyone else.
25492
+ */
25493
+ var NodeBenchmarkResultSchema = object({
25494
+ id: string(),
25495
+ runId: string(),
25496
+ nodeId: string(),
25497
+ cell: NodeBenchCellSchema,
25498
+ fpsPerStream: number(),
25499
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25500
+ clip: NodeBenchClipSchema.nullable(),
25501
+ /** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
25502
+ contaminated: boolean(),
25503
+ stayingCameras: array(number()).readonly(),
25504
+ /** The run ended early; the cell itself completed. */
25505
+ partialRun: boolean(),
25506
+ measuredAtMs: number()
25507
+ });
25508
+ var ListNodeBenchmarkResultsInputSchema = object({
25509
+ nodeId: string().optional(),
25510
+ deviceKey: string().optional()
25511
+ });
25512
+ /** A result with its standing today: does it still beat the table? */
25513
+ var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
25514
+ /** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
25515
+ standing: _enum([
25516
+ "fresh",
25517
+ "stale",
25518
+ "superseded"
25519
+ ]),
25520
+ staleWhy: _enum([
25521
+ "age",
25522
+ "runtime",
25523
+ "pool-tuning"
25524
+ ]).nullable()
25525
+ });
25526
+ object({
25527
+ runId: string(),
25528
+ nodeId: string(),
25529
+ startedAtMs: number(),
25530
+ deadlineAtMs: number(),
25531
+ plan: NodeBenchmarkPlanSchema,
25532
+ moved: array(number()).readonly(),
25533
+ staying: array(number()).readonly()
25534
+ });
25535
+ /** Candidate detectors per device, for the plan editor. */
25536
+ var NodeBenchmarkCandidatesSchema = object({
25537
+ nodeId: string(),
25538
+ reachable: boolean(),
25539
+ devices: array(object({
25540
+ deviceKey: string(),
25541
+ enabled: boolean(),
25542
+ available: boolean(),
25543
+ /** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
25544
+ suggested: array(string()).readonly(),
25545
+ /** Every root detector the device has a build for. */
25546
+ all: array(string()).readonly(),
25547
+ /** The model the device runs now, when pinned. */
25548
+ currentModelId: string().nullable()
25549
+ })).readonly(),
25550
+ /** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
25551
+ steps: array(object({
25552
+ id: string(),
25553
+ name: string(),
25554
+ slot: string()
25555
+ })).readonly()
25556
+ });
23638
25557
  object({
23639
25558
  activeCameras: number(),
23640
25559
  throttledCameras: number(),
@@ -24512,14 +26431,15 @@ var RunnerLocalLoadSchema = object({
24512
26431
  * Per-inference-device live load (multi-device C4). One entry per deviceKey
24513
26432
  * this runner currently has attached cameras on, so the orchestrator's second
24514
26433
  * `balance()` pass (over a node's devices) weights on real per-pool session
24515
- * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
24516
- * per device is 0 until the pool backlog gets a public accessor (follow-up).
26434
+ * counts. Empty on single-device / pre-multi-device runners. There is no
26435
+ * per-device queue depth: the inference pool's backlog has no accessor, and
26436
+ * a field that always read 0 was removed rather than shown as a measurement
26437
+ * (D762).
24517
26438
  */
24518
26439
  devices: array(object({
24519
26440
  deviceKey: string(),
24520
26441
  backend: string(),
24521
- attachedCameras: number(),
24522
- queueDepthTotal: number()
26442
+ attachedCameras: number()
24523
26443
  })).default([]),
24524
26444
  /** Hardware capability flags reported by this node. */
24525
26445
  hardware: object({
@@ -24655,7 +26575,22 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
24655
26575
  */
24656
26576
  cropJpeg: string().optional(),
24657
26577
  parent: DetailParentSchema,
24658
- steps: array(string()).optional()
26578
+ steps: array(string()).optional(),
26579
+ /**
26580
+ * The camera's root model already drew this step's boxes (D730): a
26581
+ * `license_plate` inside the parent vehicle. The named step is NOT
26582
+ * inferred — these FRAME-space boxes are its output — and its
26583
+ * requested children (the plate reader) run on them. Absent ⇒ every
26584
+ * requested step infers as before.
26585
+ */
26586
+ supplied: object({
26587
+ stepId: string(),
26588
+ modelId: string(),
26589
+ boxes: array(object({
26590
+ bbox: NativeCropBboxSchema,
26591
+ score: number()
26592
+ })).min(1)
26593
+ }).optional()
24659
26594
  }), object({ details: array(DetailResultSchema) }).nullable(), { kind: "mutation" }), method(object({
24660
26595
  /** Catalog step id, e.g. `clip-embedding`. */
24661
26596
  stepId: string(),
@@ -24707,7 +26642,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
24707
26642
  }), ParkedTrackFrameSchema.nullable()), method(object({
24708
26643
  deviceId: number(),
24709
26644
  trackId: string()
24710
- }), object({ released: number().int().nonnegative() }), { kind: "mutation" });
26645
+ }), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
26646
+ accepted: literal(true),
26647
+ runId: string()
26648
+ }), {
26649
+ kind: "mutation",
26650
+ auth: "admin"
26651
+ }), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
26652
+ kind: "mutation",
26653
+ auth: "admin"
26654
+ });
24711
26655
  var CameraPipelineConfigSchema = object({
24712
26656
  engine: PipelineEngineChoiceSchema.optional(),
24713
26657
  steps: array(PipelineStepInputSchema).readonly(),
@@ -24718,14 +26662,6 @@ var CameraPipelineConfigSchema = object({
24718
26662
  settings: record(string(), unknown()).readonly().optional()
24719
26663
  }).nullable().optional()
24720
26664
  });
24721
- var PipelineTemplateSchema = object({
24722
- id: string(),
24723
- name: string(),
24724
- description: string().optional(),
24725
- config: CameraPipelineConfigSchema,
24726
- createdAt: string(),
24727
- updatedAt: string()
24728
- });
24729
26665
  var DeviceStepConfigSchema = object({
24730
26666
  modelId: string().optional(),
24731
26667
  settings: record(string(), unknown()).optional(),
@@ -24799,9 +26735,10 @@ var CameraStepOverridePatchSchema = object({
24799
26735
  modelId: string().optional(),
24800
26736
  settings: record(string(), unknown()).readonly().optional()
24801
26737
  });
26738
+ var CameraStepSettingsSchema = record(string(), record(string(), unknown()).readonly());
24802
26739
  var CameraPipelineSettingsSchema = object({
24803
- pinnedAgentNodeId: string().optional(),
24804
26740
  stepToggles: record(string(), boolean()).optional(),
26741
+ stepSettings: CameraStepSettingsSchema.optional(),
24805
26742
  stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
24806
26743
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
24807
26744
  });
@@ -24834,7 +26771,10 @@ var PipelineAssignmentSchema = object({
24834
26771
  });
24835
26772
  /**
24836
26773
  * Per-agent load summary surfaced to the load balancer + dashboards.
24837
- * Aggregated from each runner's `getLocalLoad` cap call.
26774
+ * Aggregated from each runner's `getLocalLoad` cap call. In the
26775
+ * `getAgentLoad` report, a single-device node's default-pool sessions (no
26776
+ * `deviceKey`) are credited to its one eligible device in `load.devices` —
26777
+ * the default pool IS that device (D745); the balancer's census stays raw.
24838
26778
  */
24839
26779
  var AgentLoadSummarySchema = object({
24840
26780
  nodeId: string(),
@@ -24923,26 +26863,27 @@ var CameraBrokerStatusSchema = object({
24923
26863
  width: number(),
24924
26864
  height: number(),
24925
26865
  subscribers: number(),
24926
- inFps: number(),
24927
- outFps: number()
26866
+ /**
26867
+ * Encoded packets/s the broker receives from the camera. null when the
26868
+ * broker's stats read failed — unknown, never 0 (a 0 here reads as a stall).
26869
+ * There is no output rate: decoding runs in the session decode workers, not
26870
+ * in the broker, so the broker's own decoded-frame rate is 0 on every live
26871
+ * camera and is not served (D758).
26872
+ */
26873
+ inFps: number().nullable()
24928
26874
  })).readonly(),
24929
26875
  webrtcSessions: number(),
24930
26876
  rtspRestream: boolean()
24931
26877
  });
24932
- /** Shared-memory ring statistics within the decoder block. */
24933
- var CameraDecoderShmSchema = object({
24934
- framesWritten: number(),
24935
- getFrameHits: number(),
24936
- getFrameMisses: number(),
24937
- budgetMb: number()
24938
- });
24939
- /** Decoder block — null when the decoder stage is unreachable or inactive. */
24940
- var CameraDecoderStatusSchema = object({
24941
- nodeId: string(),
24942
- formats: array(string()).readonly(),
24943
- sessionCount: number(),
24944
- shm: CameraDecoderShmSchema
24945
- });
26878
+ /**
26879
+ * Decoder block — WHERE decode runs (co-located with the detection node by
26880
+ * construction); null when the camera has no detection node. It carries no
26881
+ * frame counter: the shared-memory plane whose counters it used to serve is
26882
+ * gone, and those fields read 0 forever. Whether frames actually flow is read
26883
+ * from `detection.actualFps` (frames delivered to and processed by the
26884
+ * detector), never from a counter nothing feeds.
26885
+ */
26886
+ var CameraDecoderStatusSchema = object({ nodeId: string() });
24946
26887
  /** Motion block — null when motion detection is not active for this device. */
24947
26888
  var CameraMotionStatusSchema = object({
24948
26889
  enabled: boolean(),
@@ -25299,12 +27240,6 @@ method(object({
25299
27240
  }), object({ success: literal(true) }), {
25300
27241
  kind: "mutation",
25301
27242
  auth: "admin"
25302
- }), method(object({
25303
- agentNodeId: string(),
25304
- detectWeight: number().positive().nullable()
25305
- }), object({ success: literal(true) }), {
25306
- kind: "mutation",
25307
- auth: "admin"
25308
27243
  }), method(object({
25309
27244
  agentNodeId: string(),
25310
27245
  detect: boolean().nullable().optional(),
@@ -25346,6 +27281,30 @@ method(object({
25346
27281
  }), {
25347
27282
  kind: "mutation",
25348
27283
  auth: "admin"
27284
+ }), method(AutoTuneOptionsSchema, AutoTunePlanSchema, { auth: "admin" }), method(AutoTuneApplyInputSchema, AutoTuneApplyResultSchema, {
27285
+ kind: "mutation",
27286
+ auth: "admin"
27287
+ }), method(LoadBalancingSharesInputSchema, object({ success: literal(true) }), {
27288
+ kind: "mutation",
27289
+ auth: "admin"
27290
+ }), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
27291
+ kind: "mutation",
27292
+ auth: "admin"
27293
+ }), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
27294
+ kind: literal("started"),
27295
+ runId: string()
27296
+ }), object({
27297
+ kind: literal("refused"),
27298
+ preflight: NodeBenchmarkPreflightSchema
27299
+ })]), {
27300
+ kind: "mutation",
27301
+ auth: "admin"
27302
+ }), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
27303
+ kind: "mutation",
27304
+ auth: "admin"
27305
+ }), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
27306
+ kind: "mutation",
27307
+ auth: "admin"
25349
27308
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
25350
27309
  deviceId: number(),
25351
27310
  addonId: string(),
@@ -25362,6 +27321,13 @@ method(object({
25362
27321
  }), object({ success: literal(true) }), {
25363
27322
  kind: "mutation",
25364
27323
  auth: "admin"
27324
+ }), method(object({
27325
+ deviceId: number(),
27326
+ addonId: string(),
27327
+ settings: record(string(), unknown()).nullable()
27328
+ }), object({ success: literal(true) }), {
27329
+ kind: "mutation",
27330
+ auth: "admin"
25365
27331
  }), method(object({
25366
27332
  deviceId: number(),
25367
27333
  agentNodeId: string(),
@@ -25385,25 +27351,7 @@ method(object({
25385
27351
  }), method(_void(), DiskReconcileJobSchema, {
25386
27352
  kind: "mutation",
25387
27353
  auth: "admin"
25388
- }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
25389
- name: string(),
25390
- description: string().optional(),
25391
- config: CameraPipelineConfigSchema
25392
- }), PipelineTemplateSchema, {
25393
- kind: "mutation",
25394
- auth: "admin"
25395
- }), method(object({
25396
- id: string(),
25397
- name: string().optional(),
25398
- description: string().optional(),
25399
- config: CameraPipelineConfigSchema.optional()
25400
- }), PipelineTemplateSchema, {
25401
- kind: "mutation",
25402
- auth: "admin"
25403
- }), method(object({ id: string() }), object({ success: literal(true) }), {
25404
- kind: "mutation",
25405
- auth: "admin"
25406
- });
27354
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" });
25407
27355
  /**
25408
27356
  * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
25409
27357
  * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
@@ -26097,7 +28045,19 @@ var SsoBridgeClaimsSchema = object({
26097
28045
  * editing a descriptor must not retroactively extend or shorten a link the
26098
28046
  * operator already consented to.
26099
28047
  */
26100
- refreshTtl: union([number().int().positive(), literal("never")]).optional()
28048
+ refreshTtl: union([number().int().positive(), literal("never")]).optional(),
28049
+ /**
28050
+ * Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
28051
+ * that was started from a signed-in user's "Link" button: the finish then
28052
+ * links this identity to the intent's user instead of signing anyone in.
28053
+ * The handle carries no user id — the hub resolves it, single-use.
28054
+ */
28055
+ linkIntent: string().optional(),
28056
+ /**
28057
+ * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28058
+ * subject is unique only per issuer, so a link is bound to it.
28059
+ */
28060
+ issuer: string().optional()
26101
28061
  });
26102
28062
  method(object({
26103
28063
  claims: SsoBridgeClaimsSchema,
@@ -27727,8 +29687,6 @@ var WebrtcStreamChoiceSchema = object({
27727
29687
  ]).nullable(),
27728
29688
  /** Input FPS from the camera (null for adaptive). */
27729
29689
  inputFps: number().nullable(),
27730
- /** Decoded FPS (null for adaptive). */
27731
- decodeFps: number().nullable(),
27732
29690
  /** Bitrate in kbps (null for adaptive). */
27733
29691
  bitrateKbps: number().nullable()
27734
29692
  });
@@ -28005,7 +29963,22 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
28005
29963
  * field their hints were silently stripped by the schema and the
28006
29964
  * adaptive ladder started blind on the client's display size.
28007
29965
  */
28008
- hints: webrtcClientHintsSchema.optional()
29966
+ hints: webrtcClientHintsSchema.optional(),
29967
+ /**
29968
+ * Talk-back (D771): relay the PEER's audio to the device's speaker
29969
+ * through the `intercom` cap's push-talk triple. When `true` and the
29970
+ * offer lets the peer send audio, the answer's audio is `sendrecv`
29971
+ * and every inbound frame goes to `intercom.pushTalkAudio` for this
29972
+ * `deviceId`; absent/false answers `sendonly`, as for every viewer.
29973
+ *
29974
+ * TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
29975
+ * with `intercom`, when the linked user may control that camera. The
29976
+ * hub STRIPS it from every request-bound call (a browser), exactly as
29977
+ * it overwrites `relayOnly` — a viewer's talk permission is the
29978
+ * intercom cap's own surface (share tokens gate it there), and this
29979
+ * flag must not become a second door to the camera's speaker.
29980
+ */
29981
+ talkback: boolean().optional()
28009
29982
  }), object({
28010
29983
  sessionId: string(),
28011
29984
  sdpAnswer: string()
@@ -28060,6 +30033,14 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
28060
30033
  */
28061
30034
  alive: boolean()
28062
30035
  })), method(object({
30036
+ deviceId: number().int().nonnegative(),
30037
+ sessionId: string(),
30038
+ downlinkMbps: number().nonnegative()
30039
+ }), object({
30040
+ outcome: _enum(["switching", "held"]),
30041
+ tier: CamProfileSchema.nullable(),
30042
+ reason: string()
30043
+ }), { kind: "mutation" }), method(object({
28063
30044
  deviceId: number().int().nonnegative(),
28064
30045
  sessionId: string()
28065
30046
  }), WebrtcSessionDebugSchema, { kind: "query" });
@@ -28299,6 +30280,59 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
28299
30280
  var RestartAddonResultSchema = unknown();
28300
30281
  var InstallPackageResultSchema = unknown();
28301
30282
  var ReloadPackagesResultSchema = unknown();
30283
+ /**
30284
+ * What an uninstall did on ONE node.
30285
+ * - `uninstalled` — removed: runner(s) stopped, caps gone, code deleted.
30286
+ * - `not-installed` — the node did not have it (nothing to do).
30287
+ * - `refused` — protected / bootstrap package; nothing touched.
30288
+ * - `failed` — attempted and did not complete; `error` says why.
30289
+ * - `pending-reconnect` — the node is OFFLINE: its record was pruned so the
30290
+ * back-fill never returns the package, and the stale-addon sweep removes the
30291
+ * copy when the node registers again (only once the hub no longer has it).
30292
+ */
30293
+ var UninstallNodeOutcomeSchema = _enum([
30294
+ "uninstalled",
30295
+ "not-installed",
30296
+ "refused",
30297
+ "failed",
30298
+ "pending-reconnect"
30299
+ ]);
30300
+ var UninstallNodeResultSchema = object({
30301
+ nodeId: string(),
30302
+ outcome: UninstallNodeOutcomeSchema,
30303
+ error: string().optional(),
30304
+ addonIds: array(string()).readonly(),
30305
+ runnersStopped: array(string()).readonly(),
30306
+ warnings: array(string()).readonly()
30307
+ });
30308
+ var UninstallPackageResultSchema = object({
30309
+ /** Every targeted node ended `uninstalled`, `not-installed` or `pending-reconnect`. */
30310
+ success: boolean(),
30311
+ packageName: string(),
30312
+ results: array(UninstallNodeResultSchema).readonly()
30313
+ });
30314
+ /**
30315
+ * `unreachable` lists online agents whose status read FAILED — absence from
30316
+ * `installations` is only "not installed" for a node that answered (D315).
30317
+ */
30318
+ var PackageInstallationsSchema = object({
30319
+ installations: array(object({
30320
+ packageName: string(),
30321
+ nodeId: string(),
30322
+ nodeName: string(),
30323
+ isHub: boolean(),
30324
+ isOnline: boolean(),
30325
+ version: string().nullable(),
30326
+ addonIds: array(string()).readonly(),
30327
+ source: _enum(["live", "recorded"]),
30328
+ /** The hub installs this package too. `false` on an agent row = an orphan. */
30329
+ onHub: boolean()
30330
+ })).readonly(),
30331
+ unreachable: array(object({
30332
+ nodeId: string(),
30333
+ error: string()
30334
+ })).readonly()
30335
+ });
28302
30336
  var BulkUpdateItemStatusSchema = _enum([
28303
30337
  "queued",
28304
30338
  "updating",
@@ -28381,10 +30415,14 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
28381
30415
  }), method(object({ packageName: string() }), InstallPackageResultSchema, {
28382
30416
  kind: "mutation",
28383
30417
  auth: "admin"
28384
- }), method(_void(), boolean()), method(_void(), array(unknown()).readonly()), method(object({ packageName: string() }), unknown(), {
30418
+ }), method(_void(), boolean()), method(_void(), array(unknown()).readonly()), method(object({
30419
+ packageName: string().min(1),
30420
+ nodeId: string().optional(),
30421
+ everywhere: boolean().optional()
30422
+ }), UninstallPackageResultSchema, {
28385
30423
  kind: "mutation",
28386
30424
  auth: "admin"
28387
- }), method(_void(), ReloadPackagesResultSchema, {
30425
+ }), method(object({ packageName: string().optional() }), PackageInstallationsSchema, { auth: "admin" }), method(_void(), ReloadPackagesResultSchema, {
28388
30426
  kind: "mutation",
28389
30427
  auth: "admin"
28390
30428
  }), method(object({ query: string().optional() }), array(SearchResultSchema)), method(object({ nodeId: string().optional() }), array(PackageUpdateSchema).readonly(), { auth: "admin" }), method(object({
@@ -30452,6 +32490,9 @@ var CreateIntegrationInputSchema = object({
30452
32490
  enabled: boolean().optional(),
30453
32491
  info: record(string(), unknown()).optional(),
30454
32492
  settings: record(string(), unknown()).optional(),
32493
+ /** Keys of `settings` the form's schema declares secret (by type) — kept in
32494
+ * the keychain, not the table (D787). */
32495
+ secretKeys: array(string()).optional(),
30455
32496
  skipRestart: boolean().optional()
30456
32497
  });
30457
32498
  var UpdateIntegrationInputSchema = object({
@@ -30475,7 +32516,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
30475
32516
  auth: "admin"
30476
32517
  }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
30477
32518
  id: string(),
30478
- settings: record(string(), unknown())
32519
+ settings: record(string(), unknown()),
32520
+ /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
32521
+ secretKeys: array(string()).optional()
30479
32522
  }), object({ success: boolean() }), {
30480
32523
  kind: "mutation",
30481
32524
  auth: "admin"
@@ -30735,7 +32778,8 @@ var ConnectionEndpointSchema = object({
30735
32778
  "lan-ipv6",
30736
32779
  "public",
30737
32780
  "loopback",
30738
- "app-link"
32781
+ "app-link",
32782
+ "custom"
30739
32783
  ]),
30740
32784
  /**
30741
32785
  * Originating-interface kind — `lan`/`wifi`/`docker`/`vpn`/`other`/
@@ -30804,7 +32848,7 @@ var GetConnectionEndpointsResultSchema = object({
30804
32848
  localPort: AdvertisedLocalPortSchema
30805
32849
  });
30806
32850
  /**
30807
- * The address flagged for notification links. `baseUrl: null` = AUTO, which
32851
+ * The address flagged for notification taps (`notificationTaps`). `baseUrl: null` = AUTO, which
30808
32852
  * since D709 is the CamStack app link; `resolved` reports the effective value,
30809
32853
  * so the UI can show it either way.
30810
32854
  */
@@ -30837,6 +32881,72 @@ var ViewerEndpointsSchema = object({
30837
32881
  /** What the ranking currently resolves to (may be empty if nothing is up). */
30838
32882
  resolved: array(string()).readonly()
30839
32883
  });
32884
+ /**
32885
+ * DEPRECATED compatibility shape of `getHubAddresses` (D729 amendment, kept
32886
+ * for addons built against it): `cluster` is the `internal` role, `browser`
32887
+ * the `publicEndpoint` role; `override` is the flagged address.
32888
+ */
32889
+ var HubAddressSnapshotSchema = object({
32890
+ override: string().nullable(),
32891
+ resolved: string().nullable(),
32892
+ source: _enum([
32893
+ "override",
32894
+ "auto",
32895
+ "none"
32896
+ ])
32897
+ });
32898
+ var HubAddressesSchema = object({
32899
+ cluster: HubAddressSnapshotSchema,
32900
+ browser: HubAddressSnapshotSchema
32901
+ });
32902
+ /**
32903
+ * What an address is used for (`hub-address.ts`, D734). `appConnections` is
32904
+ * many-valued; `notificationTaps`, `publicEndpoint` and `internal` are carried
32905
+ * by at most one address.
32906
+ */
32907
+ var HubAddressRoleSchema = _enum(HUB_ADDRESS_ROLES);
32908
+ var RoleSourceSchema = _enum([
32909
+ "flagged",
32910
+ "auto",
32911
+ "none"
32912
+ ]);
32913
+ /** One single-valued role: the flagged address, the one in use, and why. */
32914
+ var HubAddressRoleResolutionSchema = object({
32915
+ /** The address carrying the flag, or null = automatic. */
32916
+ flagged: string().nullable(),
32917
+ /** The address in use, or null when nothing qualifies (never loopback). */
32918
+ resolved: string().nullable(),
32919
+ source: RoleSourceSchema
32920
+ });
32921
+ var HubAppConnectionsResolutionSchema = object({
32922
+ /** The addresses flagged `appConnections`, or empty = automatic. */
32923
+ flagged: array(string()).readonly(),
32924
+ /** What the apps race right now. */
32925
+ resolved: array(string()).readonly(),
32926
+ source: RoleSourceSchema
32927
+ });
32928
+ var HubAddressBookSchema = object({
32929
+ rows: array(ConnectionEndpointSchema.extend({
32930
+ /** In the hub's detected palette right now. */
32931
+ detected: boolean(),
32932
+ /** Entered by the operator (removable). */
32933
+ custom: boolean(),
32934
+ /** The roles explicitly flagged on this address. */
32935
+ flags: array(HubAddressRoleSchema).readonly(),
32936
+ /** The roles this address serves right now — flagged or automatic. */
32937
+ inUse: array(HubAddressRoleSchema).readonly(),
32938
+ /** The roles this address may be flagged with. */
32939
+ eligible: array(HubAddressRoleSchema).readonly()
32940
+ })).readonly(),
32941
+ roles: object({
32942
+ appConnections: HubAppConnectionsResolutionSchema,
32943
+ notificationTaps: HubAddressRoleResolutionSchema,
32944
+ internal: HubAddressRoleResolutionSchema,
32945
+ publicEndpoint: HubAddressRoleResolutionSchema
32946
+ }),
32947
+ /** The `hub=` an app link carries (D709), or null. */
32948
+ appLinkHub: string().nullable()
32949
+ });
30840
32950
  var AllowedAddressesSchema = object({
30841
32951
  /**
30842
32952
  * Allowlist of interface addresses operators have explicitly opted
@@ -30880,10 +32990,27 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
30880
32990
  * tunnel always emits `https://` regardless. */
30881
32991
  scheme: _enum(["http", "https"]).optional(),
30882
32992
  /** Append the CamStack app link entry (`kind: 'app-link'`, D709) —
30883
- * an address notification links can be flagged with, not a hub
32993
+ * an address notification taps can be flagged with, not a hub
30884
32994
  * route. Default `false`: racers and rankers never see it. */
30885
32995
  includeAppLink: boolean().optional()
30886
- }), 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, {
32996
+ }), 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({
32997
+ baseUrl: string(),
32998
+ label: string().max(80)
32999
+ }), HubAddressBookSchema, {
33000
+ kind: "mutation",
33001
+ auth: "admin"
33002
+ }), method(object({ baseUrl: string() }), HubAddressBookSchema, {
33003
+ kind: "mutation",
33004
+ auth: "admin"
33005
+ }), method(object({
33006
+ role: HubAddressRoleSchema,
33007
+ baseUrl: string().nullable(),
33008
+ enabled: boolean(),
33009
+ acceptInsecureHttp: boolean().optional()
33010
+ }), HubAddressBookSchema, {
33011
+ kind: "mutation",
33012
+ auth: "admin"
33013
+ }), 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, {
30887
33014
  kind: "mutation",
30888
33015
  auth: "admin"
30889
33016
  }), method(object({
@@ -31273,7 +33400,8 @@ object({
31273
33400
  * writes this slice (not even a boot seed), and neither does the runner's
31274
33401
  * phase machine: its phase is "a session is attached" for every on-motion
31275
33402
  * session, not motion, and it now has its own `DetectionPhaseTransition`.
31276
- * A provider's `isDetected` answers from the hub's slice.
33403
+ * A provider's `isDetected` and `getStatus` answer from the hub's slice
33404
+ * (`hubMotionNativeProvider`).
31277
33405
  * - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
31278
33406
  * imports) — the provider pushes both edges itself, from the upstream
31279
33407
  * system's own state change. That is the sensor's own fact.
@@ -35991,6 +38119,32 @@ var TotpStatusSchema = object({
35991
38119
  /** Null when no row exists OR the row is still pending confirmation. */
35992
38120
  confirmedAt: number().nullable()
35993
38121
  });
38122
+ /**
38123
+ * user-management — singleton capability for user accounts, API keys,
38124
+ * and scoped tokens.
38125
+ *
38126
+ * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
38127
+ * — the subset check on `setUserScopes` / `createScopedToken` is moot
38128
+ * because non-admins never reach these. If/when we open non-admin
38129
+ * delegation, structural caller-scope subset check goes inside the
38130
+ * provider.
38131
+ */
38132
+ var ExternalIdentitySchema = object({
38133
+ /** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
38134
+ provider: string(),
38135
+ /** The IdP's stable subject (`sub`) for this account. */
38136
+ subject: string(),
38137
+ /** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
38138
+ issuer: string(),
38139
+ userId: string(),
38140
+ /** What the IdP called the account at link time (username / email) — display only. */
38141
+ label: string().optional(),
38142
+ linkedAt: number()
38143
+ });
38144
+ var ExternalIdentityKeySchema = object({
38145
+ provider: string().min(1),
38146
+ subject: string().min(1)
38147
+ });
35994
38148
  method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
35995
38149
  kind: "mutation",
35996
38150
  auth: "admin",
@@ -36104,7 +38258,22 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
36104
38258
  userId: string(),
36105
38259
  username: string(),
36106
38260
  scopes: array(TokenScopeSchema)
36107
- }).nullable(), { access: "view" }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
38261
+ }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
38262
+ userId: string(),
38263
+ issuer: string()
38264
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
38265
+ userId: string(),
38266
+ issuer: string().min(1),
38267
+ label: string().optional()
38268
+ }), object({ success: literal(true) }), {
38269
+ kind: "mutation",
38270
+ auth: "admin",
38271
+ access: "create"
38272
+ }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
38273
+ kind: "mutation",
38274
+ auth: "admin",
38275
+ access: "delete"
38276
+ }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
36108
38277
  kind: "mutation",
36109
38278
  auth: "admin",
36110
38279
  access: "delete"
@@ -36496,6 +38665,16 @@ DeviceType.Camera, method(object({
36496
38665
  package: array(ZoneRuleSchema).readonly()
36497
38666
  });
36498
38667
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
38668
+ Object.freeze({
38669
+ person: .5,
38670
+ vehicle: .5,
38671
+ animal: .5
38672
+ });
38673
+ Object.freeze({
38674
+ person: .65,
38675
+ vehicle: .65,
38676
+ animal: .65
38677
+ });
36499
38678
  /**
36500
38679
  * Accessory device helpers — shared across drivers.
36501
38680
  *
@@ -37489,6 +39668,12 @@ Object.freeze({
37489
39668
  addonId: null,
37490
39669
  access: "view"
37491
39670
  },
39671
+ "addons.listInstallations": {
39672
+ capName: "addons",
39673
+ capScope: "system",
39674
+ addonId: null,
39675
+ access: "view"
39676
+ },
37492
39677
  "addons.listJobs": {
37493
39678
  capName: "addons",
37494
39679
  capScope: "system",
@@ -38671,90 +40856,18 @@ Object.freeze({
38671
40856
  addonId: null,
38672
40857
  access: "create"
38673
40858
  },
38674
- "decoder.createSession": {
38675
- capName: "decoder",
38676
- capScope: "system",
38677
- addonId: null,
38678
- access: "view"
38679
- },
38680
- "decoder.destroySession": {
38681
- capName: "decoder",
38682
- capScope: "system",
38683
- addonId: null,
38684
- access: "delete"
38685
- },
38686
- "decoder.getFrame": {
38687
- capName: "decoder",
38688
- capScope: "system",
38689
- addonId: null,
38690
- access: "view"
38691
- },
38692
40859
  "decoder.getInfo": {
38693
40860
  capName: "decoder",
38694
40861
  capScope: "system",
38695
40862
  addonId: null,
38696
40863
  access: "view"
38697
40864
  },
38698
- "decoder.getShmStats": {
38699
- capName: "decoder",
38700
- capScope: "system",
38701
- addonId: null,
38702
- access: "view"
38703
- },
38704
- "decoder.getStats": {
38705
- capName: "decoder",
38706
- capScope: "system",
38707
- addonId: null,
38708
- access: "view"
38709
- },
38710
- "decoder.listActiveSessions": {
38711
- capName: "decoder",
38712
- capScope: "system",
38713
- addonId: null,
38714
- access: "view"
38715
- },
38716
- "decoder.openStream": {
38717
- capName: "decoder",
38718
- capScope: "system",
38719
- addonId: null,
38720
- access: "view"
38721
- },
38722
- "decoder.pullFrames": {
38723
- capName: "decoder",
38724
- capScope: "system",
38725
- addonId: null,
38726
- access: "view"
38727
- },
38728
- "decoder.pullHandles": {
38729
- capName: "decoder",
38730
- capScope: "system",
38731
- addonId: null,
38732
- access: "view"
38733
- },
38734
- "decoder.pushPacket": {
38735
- capName: "decoder",
38736
- capScope: "system",
38737
- addonId: null,
38738
- access: "view"
38739
- },
38740
40865
  "decoder.reprobeHwaccel": {
38741
40866
  capName: "decoder",
38742
40867
  capScope: "system",
38743
40868
  addonId: null,
38744
40869
  access: "create"
38745
40870
  },
38746
- "decoder.supportsCodec": {
38747
- capName: "decoder",
38748
- capScope: "system",
38749
- addonId: null,
38750
- access: "view"
38751
- },
38752
- "decoder.updateConfig": {
38753
- capName: "decoder",
38754
- capScope: "system",
38755
- addonId: null,
38756
- access: "view"
38757
- },
38758
40871
  "detectionPipeline.applyDeviceSettingsPatch": {
38759
40872
  capName: "detection-pipeline",
38760
40873
  capScope: "device",
@@ -40021,6 +42134,90 @@ Object.freeze({
40021
42134
  addonId: null,
40022
42135
  access: "create"
40023
42136
  },
42137
+ "keychain.delete": {
42138
+ capName: "keychain",
42139
+ capScope: "system",
42140
+ addonId: null,
42141
+ access: "delete"
42142
+ },
42143
+ "keychain.getState": {
42144
+ capName: "keychain",
42145
+ capScope: "system",
42146
+ addonId: null,
42147
+ access: "view"
42148
+ },
42149
+ "keychain.listMeta": {
42150
+ capName: "keychain",
42151
+ capScope: "system",
42152
+ addonId: null,
42153
+ access: "view"
42154
+ },
42155
+ "keychain.put": {
42156
+ capName: "keychain",
42157
+ capScope: "system",
42158
+ addonId: null,
42159
+ access: "create"
42160
+ },
42161
+ "keychain.resolve": {
42162
+ capName: "keychain",
42163
+ capScope: "system",
42164
+ addonId: null,
42165
+ access: "view"
42166
+ },
42167
+ "keychainAdmin.deleteOrphans": {
42168
+ capName: "keychain-admin",
42169
+ capScope: "system",
42170
+ addonId: null,
42171
+ access: "delete"
42172
+ },
42173
+ "keychainAdmin.downloadRecoveryKey": {
42174
+ capName: "keychain-admin",
42175
+ capScope: "system",
42176
+ addonId: null,
42177
+ access: "create"
42178
+ },
42179
+ "keychainAdmin.listAudit": {
42180
+ capName: "keychain-admin",
42181
+ capScope: "system",
42182
+ addonId: null,
42183
+ access: "view"
42184
+ },
42185
+ "keychainAdmin.listSecrets": {
42186
+ capName: "keychain-admin",
42187
+ capScope: "system",
42188
+ addonId: null,
42189
+ access: "view"
42190
+ },
42191
+ "keychainAdmin.purgeRetiredKeys": {
42192
+ capName: "keychain-admin",
42193
+ capScope: "system",
42194
+ addonId: null,
42195
+ access: "delete"
42196
+ },
42197
+ "keychainAdmin.resetKeychain": {
42198
+ capName: "keychain-admin",
42199
+ capScope: "system",
42200
+ addonId: null,
42201
+ access: "delete"
42202
+ },
42203
+ "keychainAdmin.reveal": {
42204
+ capName: "keychain-admin",
42205
+ capScope: "system",
42206
+ addonId: null,
42207
+ access: "create"
42208
+ },
42209
+ "keychainAdmin.rotateMasterKey": {
42210
+ capName: "keychain-admin",
42211
+ capScope: "system",
42212
+ addonId: null,
42213
+ access: "create"
42214
+ },
42215
+ "keychainAdmin.status": {
42216
+ capName: "keychain-admin",
42217
+ capScope: "system",
42218
+ addonId: null,
42219
+ access: "view"
42220
+ },
40024
42221
  "lawnMowerControl.dock": {
40025
42222
  capName: "lawn-mower-control",
40026
42223
  capScope: "device",
@@ -40243,12 +42440,24 @@ Object.freeze({
40243
42440
  addonId: null,
40244
42441
  access: "view"
40245
42442
  },
42443
+ "localNetwork.addCustomAddress": {
42444
+ capName: "local-network",
42445
+ capScope: "system",
42446
+ addonId: null,
42447
+ access: "create"
42448
+ },
40246
42449
  "localNetwork.downloadCa": {
40247
42450
  capName: "local-network",
40248
42451
  capScope: "system",
40249
42452
  addonId: null,
40250
42453
  access: "view"
40251
42454
  },
42455
+ "localNetwork.getAddresses": {
42456
+ capName: "local-network",
42457
+ capScope: "system",
42458
+ addonId: null,
42459
+ access: "view"
42460
+ },
40252
42461
  "localNetwork.getAllowedAddresses": {
40253
42462
  capName: "local-network",
40254
42463
  capScope: "system",
@@ -40261,6 +42470,12 @@ Object.freeze({
40261
42470
  addonId: null,
40262
42471
  access: "view"
40263
42472
  },
42473
+ "localNetwork.getHubAddresses": {
42474
+ capName: "local-network",
42475
+ capScope: "system",
42476
+ addonId: null,
42477
+ access: "view"
42478
+ },
40264
42479
  "localNetwork.getNotificationEndpoint": {
40265
42480
  capName: "local-network",
40266
42481
  capScope: "system",
@@ -40297,6 +42512,12 @@ Object.freeze({
40297
42512
  addonId: null,
40298
42513
  access: "create"
40299
42514
  },
42515
+ "localNetwork.removeCustomAddress": {
42516
+ capName: "local-network",
42517
+ capScope: "system",
42518
+ addonId: null,
42519
+ access: "delete"
42520
+ },
40300
42521
  "localNetwork.resetAllowlistToBestMatch": {
40301
42522
  capName: "local-network",
40302
42523
  capScope: "system",
@@ -40309,6 +42530,12 @@ Object.freeze({
40309
42530
  addonId: null,
40310
42531
  access: "create"
40311
42532
  },
42533
+ "localNetwork.setAddressRole": {
42534
+ capName: "local-network",
42535
+ capScope: "system",
42536
+ addonId: null,
42537
+ access: "create"
42538
+ },
40312
42539
  "localNetwork.setAllowedAddresses": {
40313
42540
  capName: "local-network",
40314
42541
  capScope: "system",
@@ -41365,6 +43592,18 @@ Object.freeze({
41365
43592
  addonId: null,
41366
43593
  access: "create"
41367
43594
  },
43595
+ "pipelineAnalytics.addRetrainFrameFromRecording": {
43596
+ capName: "pipeline-analytics",
43597
+ capScope: "device",
43598
+ addonId: null,
43599
+ access: "create"
43600
+ },
43601
+ "pipelineAnalytics.addRetrainFramesToCollection": {
43602
+ capName: "pipeline-analytics",
43603
+ capScope: "device",
43604
+ addonId: null,
43605
+ access: "create"
43606
+ },
41368
43607
  "pipelineAnalytics.applyDeviceSettingsPatch": {
41369
43608
  capName: "pipeline-analytics",
41370
43609
  capScope: "device",
@@ -41413,12 +43652,24 @@ Object.freeze({
41413
43652
  addonId: null,
41414
43653
  access: "view"
41415
43654
  },
43655
+ "pipelineAnalytics.createRetrainCollection": {
43656
+ capName: "pipeline-analytics",
43657
+ capScope: "device",
43658
+ addonId: null,
43659
+ access: "create"
43660
+ },
41416
43661
  "pipelineAnalytics.deleteDeviceEvents": {
41417
43662
  capName: "pipeline-analytics",
41418
43663
  capScope: "device",
41419
43664
  addonId: null,
41420
43665
  access: "delete"
41421
43666
  },
43667
+ "pipelineAnalytics.deleteRetrainCollection": {
43668
+ capName: "pipeline-analytics",
43669
+ capScope: "device",
43670
+ addonId: null,
43671
+ access: "delete"
43672
+ },
41422
43673
  "pipelineAnalytics.deleteTracks": {
41423
43674
  capName: "pipeline-analytics",
41424
43675
  capScope: "device",
@@ -41623,6 +43874,24 @@ Object.freeze({
41623
43874
  addonId: null,
41624
43875
  access: "view"
41625
43876
  },
43877
+ "pipelineAnalytics.listRetrainAssistProfiles": {
43878
+ capName: "pipeline-analytics",
43879
+ capScope: "device",
43880
+ addonId: null,
43881
+ access: "view"
43882
+ },
43883
+ "pipelineAnalytics.listRetrainCollectionFrames": {
43884
+ capName: "pipeline-analytics",
43885
+ capScope: "device",
43886
+ addonId: null,
43887
+ access: "view"
43888
+ },
43889
+ "pipelineAnalytics.listRetrainCollections": {
43890
+ capName: "pipeline-analytics",
43891
+ capScope: "device",
43892
+ addonId: null,
43893
+ access: "view"
43894
+ },
41626
43895
  "pipelineAnalytics.listRetrainFrames": {
41627
43896
  capName: "pipeline-analytics",
41628
43897
  capScope: "device",
@@ -41671,6 +43940,12 @@ Object.freeze({
41671
43940
  addonId: null,
41672
43941
  access: "create"
41673
43942
  },
43943
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
43944
+ capName: "pipeline-analytics",
43945
+ capScope: "device",
43946
+ addonId: null,
43947
+ access: "create"
43948
+ },
41674
43949
  "pipelineAnalytics.pruneEvents": {
41675
43950
  capName: "pipeline-analytics",
41676
43951
  capScope: "device",
@@ -41725,6 +44000,18 @@ Object.freeze({
41725
44000
  addonId: null,
41726
44001
  access: "create"
41727
44002
  },
44003
+ "pipelineAnalytics.removeRetrainFrameFromCollection": {
44004
+ capName: "pipeline-analytics",
44005
+ capScope: "device",
44006
+ addonId: null,
44007
+ access: "delete"
44008
+ },
44009
+ "pipelineAnalytics.renameRetrainCollection": {
44010
+ capName: "pipeline-analytics",
44011
+ capScope: "device",
44012
+ addonId: null,
44013
+ access: "create"
44014
+ },
41728
44015
  "pipelineAnalytics.restageRetrainTrack": {
41729
44016
  capName: "pipeline-analytics",
41730
44017
  capScope: "device",
@@ -41755,6 +44042,12 @@ Object.freeze({
41755
44042
  addonId: null,
41756
44043
  access: "create"
41757
44044
  },
44045
+ "pipelineAnalytics.setRetrainFrameComplete": {
44046
+ capName: "pipeline-analytics",
44047
+ capScope: "device",
44048
+ addonId: null,
44049
+ access: "create"
44050
+ },
41758
44051
  "pipelineAnalytics.setTrackFlags": {
41759
44052
  capName: "pipeline-analytics",
41760
44053
  capScope: "device",
@@ -41791,6 +44084,12 @@ Object.freeze({
41791
44084
  addonId: null,
41792
44085
  access: "delete"
41793
44086
  },
44087
+ "pipelineAnalytics.writeRetrainArchive": {
44088
+ capName: "pipeline-analytics",
44089
+ capScope: "device",
44090
+ addonId: null,
44091
+ access: "create"
44092
+ },
41794
44093
  "pipelineExecutor.cacheFrameInPool": {
41795
44094
  capName: "pipeline-executor",
41796
44095
  capScope: "system",
@@ -41803,13 +44102,13 @@ Object.freeze({
41803
44102
  addonId: null,
41804
44103
  access: "delete"
41805
44104
  },
41806
- "pipelineExecutor.deleteModel": {
44105
+ "pipelineExecutor.clearModelBoundDeviceOverrides": {
41807
44106
  capName: "pipeline-executor",
41808
44107
  capScope: "system",
41809
44108
  addonId: null,
41810
44109
  access: "delete"
41811
44110
  },
41812
- "pipelineExecutor.deleteTemplate": {
44111
+ "pipelineExecutor.deleteModel": {
41813
44112
  capName: "pipeline-executor",
41814
44113
  capScope: "system",
41815
44114
  addonId: null,
@@ -41953,12 +44252,6 @@ Object.freeze({
41953
44252
  addonId: null,
41954
44253
  access: "view"
41955
44254
  },
41956
- "pipelineExecutor.listTemplates": {
41957
- capName: "pipeline-executor",
41958
- capScope: "system",
41959
- addonId: null,
41960
- access: "view"
41961
- },
41962
44255
  "pipelineExecutor.rearmInferenceDevice": {
41963
44256
  capName: "pipeline-executor",
41964
44257
  capScope: "system",
@@ -41983,12 +44276,6 @@ Object.freeze({
41983
44276
  addonId: null,
41984
44277
  access: "create"
41985
44278
  },
41986
- "pipelineExecutor.saveTemplate": {
41987
- capName: "pipeline-executor",
41988
- capScope: "system",
41989
- addonId: null,
41990
- access: "create"
41991
- },
41992
44279
  "pipelineExecutor.setVideoPipelineSteps": {
41993
44280
  capName: "pipeline-executor",
41994
44281
  capScope: "system",
@@ -42007,17 +44294,23 @@ Object.freeze({
42007
44294
  addonId: null,
42008
44295
  access: "create"
42009
44296
  },
42010
- "pipelineExecutor.updateTemplate": {
44297
+ "pipelineExecutor.validatePipeline": {
42011
44298
  capName: "pipeline-executor",
42012
44299
  capScope: "system",
42013
44300
  addonId: null,
44301
+ access: "view"
44302
+ },
44303
+ "pipelineOrchestrator.abortNodeBenchmark": {
44304
+ capName: "pipeline-orchestrator",
44305
+ capScope: "system",
44306
+ addonId: null,
42014
44307
  access: "create"
42015
44308
  },
42016
- "pipelineExecutor.validatePipeline": {
42017
- capName: "pipeline-executor",
44309
+ "pipelineOrchestrator.applyAutoTune": {
44310
+ capName: "pipeline-orchestrator",
42018
44311
  capScope: "system",
42019
44312
  addonId: null,
42020
- access: "view"
44313
+ access: "create"
42021
44314
  },
42022
44315
  "pipelineOrchestrator.applyDeviceSettingsPatch": {
42023
44316
  capName: "pipeline-orchestrator",
@@ -42037,7 +44330,7 @@ Object.freeze({
42037
44330
  addonId: null,
42038
44331
  access: "create"
42039
44332
  },
42040
- "pipelineOrchestrator.deleteTemplate": {
44333
+ "pipelineOrchestrator.deleteNodeBenchmarkResult": {
42041
44334
  capName: "pipeline-orchestrator",
42042
44335
  capScope: "system",
42043
44336
  addonId: null,
@@ -42133,6 +44426,12 @@ Object.freeze({
42133
44426
  addonId: null,
42134
44427
  access: "view"
42135
44428
  },
44429
+ "pipelineOrchestrator.getEffectiveShares": {
44430
+ capName: "pipeline-orchestrator",
44431
+ capScope: "system",
44432
+ addonId: null,
44433
+ access: "view"
44434
+ },
42136
44435
  "pipelineOrchestrator.getGlobalMetrics": {
42137
44436
  capName: "pipeline-orchestrator",
42138
44437
  capScope: "system",
@@ -42145,6 +44444,24 @@ Object.freeze({
42145
44444
  addonId: null,
42146
44445
  access: "view"
42147
44446
  },
44447
+ "pipelineOrchestrator.getNodeBenchmarkCandidates": {
44448
+ capName: "pipeline-orchestrator",
44449
+ capScope: "system",
44450
+ addonId: null,
44451
+ access: "view"
44452
+ },
44453
+ "pipelineOrchestrator.getNodeBenchmarkPreflight": {
44454
+ capName: "pipeline-orchestrator",
44455
+ capScope: "system",
44456
+ addonId: null,
44457
+ access: "view"
44458
+ },
44459
+ "pipelineOrchestrator.getNodeBenchmarkStatus": {
44460
+ capName: "pipeline-orchestrator",
44461
+ capScope: "system",
44462
+ addonId: null,
44463
+ access: "view"
44464
+ },
42148
44465
  "pipelineOrchestrator.getNodeInferenceDevices": {
42149
44466
  capName: "pipeline-orchestrator",
42150
44467
  capScope: "system",
@@ -42169,6 +44486,12 @@ Object.freeze({
42169
44486
  addonId: null,
42170
44487
  access: "view"
42171
44488
  },
44489
+ "pipelineOrchestrator.getPlacementStats": {
44490
+ capName: "pipeline-orchestrator",
44491
+ capScope: "system",
44492
+ addonId: null,
44493
+ access: "view"
44494
+ },
42172
44495
  "pipelineOrchestrator.getReconcileFromDiskStatus": {
42173
44496
  capName: "pipeline-orchestrator",
42174
44497
  capScope: "system",
@@ -42181,7 +44504,7 @@ Object.freeze({
42181
44504
  addonId: null,
42182
44505
  access: "view"
42183
44506
  },
42184
- "pipelineOrchestrator.listTemplates": {
44507
+ "pipelineOrchestrator.listNodeBenchmarkResults": {
42185
44508
  capName: "pipeline-orchestrator",
42186
44509
  capScope: "system",
42187
44510
  addonId: null,
@@ -42193,6 +44516,12 @@ Object.freeze({
42193
44516
  addonId: null,
42194
44517
  access: "create"
42195
44518
  },
44519
+ "pipelineOrchestrator.planAutoTune": {
44520
+ capName: "pipeline-orchestrator",
44521
+ capScope: "system",
44522
+ addonId: null,
44523
+ access: "view"
44524
+ },
42196
44525
  "pipelineOrchestrator.rebalance": {
42197
44526
  capName: "pipeline-orchestrator",
42198
44527
  capScope: "system",
@@ -42235,12 +44564,6 @@ Object.freeze({
42235
44564
  addonId: null,
42236
44565
  access: "create"
42237
44566
  },
42238
- "pipelineOrchestrator.saveTemplate": {
42239
- capName: "pipeline-orchestrator",
42240
- capScope: "system",
42241
- addonId: null,
42242
- access: "create"
42243
- },
42244
44567
  "pipelineOrchestrator.setAgentCapabilities": {
42245
44568
  capName: "pipeline-orchestrator",
42246
44569
  capScope: "system",
@@ -42253,12 +44576,6 @@ Object.freeze({
42253
44576
  addonId: null,
42254
44577
  access: "create"
42255
44578
  },
42256
- "pipelineOrchestrator.setAgentDetectWeight": {
42257
- capName: "pipeline-orchestrator",
42258
- capScope: "system",
42259
- addonId: null,
42260
- access: "create"
42261
- },
42262
44579
  "pipelineOrchestrator.setAgentInferenceDevices": {
42263
44580
  capName: "pipeline-orchestrator",
42264
44581
  capScope: "system",
@@ -42295,6 +44612,12 @@ Object.freeze({
42295
44612
  addonId: null,
42296
44613
  access: "create"
42297
44614
  },
44615
+ "pipelineOrchestrator.setCameraStepSettings": {
44616
+ capName: "pipeline-orchestrator",
44617
+ capScope: "system",
44618
+ addonId: null,
44619
+ access: "create"
44620
+ },
42298
44621
  "pipelineOrchestrator.setCameraStepToggle": {
42299
44622
  capName: "pipeline-orchestrator",
42300
44623
  capScope: "system",
@@ -42313,12 +44636,36 @@ Object.freeze({
42313
44636
  addonId: null,
42314
44637
  access: "create"
42315
44638
  },
44639
+ "pipelineOrchestrator.setLoadBalancingShares": {
44640
+ capName: "pipeline-orchestrator",
44641
+ capScope: "system",
44642
+ addonId: null,
44643
+ access: "create"
44644
+ },
42316
44645
  "pipelineOrchestrator.setPipelineDevicePin": {
42317
44646
  capName: "pipeline-orchestrator",
42318
44647
  capScope: "system",
42319
44648
  addonId: null,
42320
44649
  access: "create"
42321
44650
  },
44651
+ "pipelineOrchestrator.setShareSource": {
44652
+ capName: "pipeline-orchestrator",
44653
+ capScope: "system",
44654
+ addonId: null,
44655
+ access: "create"
44656
+ },
44657
+ "pipelineOrchestrator.startNodeBenchmark": {
44658
+ capName: "pipeline-orchestrator",
44659
+ capScope: "system",
44660
+ addonId: null,
44661
+ access: "create"
44662
+ },
44663
+ "pipelineOrchestrator.suggestShares": {
44664
+ capName: "pipeline-orchestrator",
44665
+ capScope: "system",
44666
+ addonId: null,
44667
+ access: "view"
44668
+ },
42322
44669
  "pipelineOrchestrator.unassignAudio": {
42323
44670
  capName: "pipeline-orchestrator",
42324
44671
  capScope: "system",
@@ -42331,8 +44678,8 @@ Object.freeze({
42331
44678
  addonId: null,
42332
44679
  access: "create"
42333
44680
  },
42334
- "pipelineOrchestrator.updateTemplate": {
42335
- capName: "pipeline-orchestrator",
44681
+ "pipelineRunner.abortNodeBench": {
44682
+ capName: "pipeline-runner",
42336
44683
  capScope: "system",
42337
44684
  addonId: null,
42338
44685
  access: "create"
@@ -42385,6 +44732,12 @@ Object.freeze({
42385
44732
  addonId: null,
42386
44733
  access: "view"
42387
44734
  },
44735
+ "pipelineRunner.getNodeBenchStatus": {
44736
+ capName: "pipeline-runner",
44737
+ capScope: "system",
44738
+ addonId: null,
44739
+ access: "view"
44740
+ },
42388
44741
  "pipelineRunner.getParkedTrackFrame": {
42389
44742
  capName: "pipeline-runner",
42390
44743
  capScope: "system",
@@ -42427,6 +44780,12 @@ Object.freeze({
42427
44780
  addonId: null,
42428
44781
  access: "create"
42429
44782
  },
44783
+ "pipelineRunner.startNodeBench": {
44784
+ capName: "pipeline-runner",
44785
+ capScope: "system",
44786
+ addonId: null,
44787
+ access: "create"
44788
+ },
42430
44789
  "plateGallery.assignPlate": {
42431
44790
  capName: "plate-gallery",
42432
44791
  capScope: "system",
@@ -43771,12 +46130,6 @@ Object.freeze({
43771
46130
  addonId: null,
43772
46131
  access: "view"
43773
46132
  },
43774
- "streamBroker.pullFrameHandles": {
43775
- capName: "stream-broker",
43776
- capScope: "system",
43777
- addonId: null,
43778
- access: "view"
43779
- },
43780
46133
  "streamBroker.regenerateRtspToken": {
43781
46134
  capName: "stream-broker",
43782
46135
  capScope: "system",
@@ -43843,12 +46196,6 @@ Object.freeze({
43843
46196
  addonId: null,
43844
46197
  access: "create"
43845
46198
  },
43846
- "streamBroker.subscribeFrames": {
43847
- capName: "stream-broker",
43848
- capScope: "system",
43849
- addonId: null,
43850
- access: "create"
43851
- },
43852
46199
  "streamBroker.unassignProfile": {
43853
46200
  capName: "stream-broker",
43854
46201
  capScope: "system",
@@ -43861,12 +46208,6 @@ Object.freeze({
43861
46208
  addonId: null,
43862
46209
  access: "create"
43863
46210
  },
43864
- "streamBroker.unsubscribeFrames": {
43865
- capName: "stream-broker",
43866
- capScope: "system",
43867
- addonId: null,
43868
- access: "create"
43869
- },
43870
46211
  "streamCatalog.getCatalog": {
43871
46212
  capName: "stream-catalog",
43872
46213
  capScope: "device",
@@ -44161,18 +46502,36 @@ Object.freeze({
44161
46502
  addonId: null,
44162
46503
  access: "delete"
44163
46504
  },
46505
+ "userManagement.findUserByExternalIdentity": {
46506
+ capName: "user-management",
46507
+ capScope: "system",
46508
+ addonId: null,
46509
+ access: "view"
46510
+ },
44164
46511
  "userManagement.getTotpStatus": {
44165
46512
  capName: "user-management",
44166
46513
  capScope: "system",
44167
46514
  addonId: null,
44168
46515
  access: "view"
44169
46516
  },
46517
+ "userManagement.linkExternalIdentity": {
46518
+ capName: "user-management",
46519
+ capScope: "system",
46520
+ addonId: null,
46521
+ access: "create"
46522
+ },
44170
46523
  "userManagement.listApiKeys": {
44171
46524
  capName: "user-management",
44172
46525
  capScope: "system",
44173
46526
  addonId: null,
44174
46527
  access: "view"
44175
46528
  },
46529
+ "userManagement.listExternalIdentities": {
46530
+ capName: "user-management",
46531
+ capScope: "system",
46532
+ addonId: null,
46533
+ access: "view"
46534
+ },
44176
46535
  "userManagement.listOauthSessions": {
44177
46536
  capName: "user-management",
44178
46537
  capScope: "system",
@@ -44251,6 +46610,12 @@ Object.freeze({
44251
46610
  addonId: null,
44252
46611
  access: "create"
44253
46612
  },
46613
+ "userManagement.unlinkExternalIdentity": {
46614
+ capName: "user-management",
46615
+ capScope: "system",
46616
+ addonId: null,
46617
+ access: "delete"
46618
+ },
44254
46619
  "userManagement.updateUser": {
44255
46620
  capName: "user-management",
44256
46621
  capScope: "system",
@@ -44563,6 +46928,12 @@ Object.freeze({
44563
46928
  addonId: null,
44564
46929
  access: "create"
44565
46930
  },
46931
+ "webrtcSession.applyDownlinkProbe": {
46932
+ capName: "webrtc-session",
46933
+ capScope: "device",
46934
+ addonId: null,
46935
+ access: "create"
46936
+ },
44566
46937
  "webrtcSession.closeSession": {
44567
46938
  capName: "webrtc-session",
44568
46939
  capScope: "device",
@@ -46440,11 +48811,6 @@ Object.freeze({
46440
48811
  form: "single",
46441
48812
  optional: false
46442
48813
  }],
46443
- "decoder.createSession": [{
46444
- name: "deviceId",
46445
- form: "single",
46446
- optional: true
46447
- }],
46448
48814
  "detectionPipeline.applyDeviceSettingsPatch": [{
46449
48815
  name: "deviceId",
46450
48816
  form: "single",
@@ -47415,6 +49781,11 @@ Object.freeze({
47415
49781
  form: "single",
47416
49782
  optional: false
47417
49783
  }],
49784
+ "pipelineAnalytics.addRetrainFrameFromRecording": [{
49785
+ name: "deviceId",
49786
+ form: "single",
49787
+ optional: false
49788
+ }],
47418
49789
  "pipelineAnalytics.applyDeviceSettingsPatch": [{
47419
49790
  name: "deviceId",
47420
49791
  form: "single",
@@ -47605,6 +49976,11 @@ Object.freeze({
47605
49976
  form: "single",
47606
49977
  optional: false
47607
49978
  }],
49979
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
49980
+ name: "deviceId",
49981
+ form: "single",
49982
+ optional: false
49983
+ }],
47608
49984
  "pipelineAnalytics.pruneEventsBefore": [{
47609
49985
  name: "deviceId",
47610
49986
  form: "single",
@@ -47655,6 +50031,11 @@ Object.freeze({
47655
50031
  form: "single",
47656
50032
  optional: false
47657
50033
  }],
50034
+ "pipelineAnalytics.setRetrainFrameComplete": [{
50035
+ name: "deviceId",
50036
+ form: "single",
50037
+ optional: false
50038
+ }],
47658
50039
  "pipelineAnalytics.setTrackFlags": [{
47659
50040
  name: "deviceId",
47660
50041
  form: "single",
@@ -47675,6 +50056,11 @@ Object.freeze({
47675
50056
  form: "single",
47676
50057
  optional: false
47677
50058
  }],
50059
+ "pipelineExecutor.clearModelBoundDeviceOverrides": [{
50060
+ name: "deviceIds",
50061
+ form: "array",
50062
+ optional: true
50063
+ }],
47678
50064
  "pipelineExecutor.runPipeline": [{
47679
50065
  name: "deviceId",
47680
50066
  form: "single",
@@ -47780,6 +50166,11 @@ Object.freeze({
47780
50166
  form: "single",
47781
50167
  optional: false
47782
50168
  }],
50169
+ "pipelineOrchestrator.setCameraStepSettings": [{
50170
+ name: "deviceId",
50171
+ form: "single",
50172
+ optional: false
50173
+ }],
47783
50174
  "pipelineOrchestrator.setCameraStepToggle": [{
47784
50175
  name: "deviceId",
47785
50176
  form: "single",
@@ -48551,6 +50942,11 @@ Object.freeze({
48551
50942
  form: "single",
48552
50943
  optional: false
48553
50944
  }],
50945
+ "webrtcSession.applyDownlinkProbe": [{
50946
+ name: "deviceId",
50947
+ form: "single",
50948
+ optional: false
50949
+ }],
48554
50950
  "webrtcSession.closeSession": [{
48555
50951
  name: "deviceId",
48556
50952
  form: "single",
@@ -48780,6 +51176,8 @@ new Map(Object.entries({
48780
51176
  "detection-blind": "device-events",
48781
51177
  "node-online": "system",
48782
51178
  "node-offline": "system",
51179
+ "node-restarting": "system",
51180
+ "node-updating": "system",
48783
51181
  "node-inference-unavailable": "system",
48784
51182
  "addon-crash-loop": "system",
48785
51183
  "addon-update-available": "system",
@@ -48857,6 +51255,7 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
48857
51255
  kinds: [
48858
51256
  "node-offline",
48859
51257
  "node-online",
51258
+ "node-restarting",
48860
51259
  "node-inference-unavailable"
48861
51260
  ]
48862
51261
  },
@@ -48878,6 +51277,7 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
48878
51277
  label: "Server & container updates",
48879
51278
  kinds: [
48880
51279
  "server-update-available",
51280
+ "node-updating",
48881
51281
  "server-updated",
48882
51282
  "wrapper-update-available"
48883
51283
  ]
@@ -49025,6 +51425,7 @@ var STATE_SUMMARY_SECTION_VARS = [
49025
51425
  kinds: [
49026
51426
  "node-offline",
49027
51427
  "node-online",
51428
+ "node-restarting",
49028
51429
  "node-inference-unavailable"
49029
51430
  ]
49030
51431
  },
@@ -49046,6 +51447,7 @@ var STATE_SUMMARY_SECTION_VARS = [
49046
51447
  example: "server 1.2.377 → 1.2.378",
49047
51448
  kinds: [
49048
51449
  "server-update-available",
51450
+ "node-updating",
49049
51451
  "server-updated",
49050
51452
  "wrapper-update-available"
49051
51453
  ]
@@ -49078,7 +51480,7 @@ var STATE_SUMMARY_VARS = [
49078
51480
  {
49079
51481
  name: "summarySection",
49080
51482
  label: "Summary: this section",
49081
- description: "The section a per-section summary row is about (D698); on a summary sent as one message, every section it reports, comma-separated.",
51483
+ description: "The section a per-section summary row is about; on a summary sent as one message, every section it reports, comma-separated.",
49082
51484
  example: "Batterie scariche",
49083
51485
  group: "system",
49084
51486
  families: ["rule"],
@@ -58646,7 +61048,7 @@ var onvifCameraSchema = object({
58646
61048
  host: string().describe("Camera IP address or hostname"),
58647
61049
  port: number().default(80).describe("ONVIF port (default: 80)"),
58648
61050
  username: string().default("").describe("ONVIF username"),
58649
- password: string().default("").describe("ONVIF password"),
61051
+ password: string().default("").describe("ONVIF password").meta({ secret: true }),
58650
61052
  rtspUrl: string().describe("Primary RTSP stream URL"),
58651
61053
  subStreamUrl: string().default("").describe("Sub-stream RTSP URL (optional)"),
58652
61054
  snapshotUrl: string().default("").describe("Native snapshot URL (optional)"),