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