@camstack/addon-export-google 0.1.87 → 0.1.89

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.
@@ -77,7 +77,7 @@ function createApiDeviceGateway(deps) {
77
77
  };
78
78
  }
79
79
  //#endregion
80
- //#region ../types/dist/event-category-BGmz_oxW.mjs
80
+ //#region ../types/dist/event-category-DaIZi00R.mjs
81
81
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
82
82
  EventCategory["SystemBoot"] = "system.boot";
83
83
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -156,6 +156,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
156
156
  */
157
157
  EventCategory["AddonLoadFailed"] = "addon.load-failed";
158
158
  /**
159
+ * A keychain value was stored or removed (D787). Carries the ref, its
160
+ * owner and the new version — NEVER the value. A process holding the ref
161
+ * drops its cached copy and the owning `BaseAddon` re-resolves its config.
162
+ * Telemetry (D8): a process that misses it still revalidates by version.
163
+ */
164
+ EventCategory["KeychainChanged"] = "keychain.changed";
165
+ /**
159
166
  * Addon recovered from a previous failure. Emitted when an addon
160
167
  * transitions from `failed` back to `healthy` (typically via the
161
168
  * monitor's auto-retry loop, or after manual `addons.retryLoad`).
@@ -578,15 +585,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
578
585
  EventCategory["AgentWsDisconnected"] = "agent.ws.disconnected";
579
586
  EventCategory["AgentBackupActivated"] = "agent.backup.activated";
580
587
  EventCategory["OrchestrationSettingsUpdated"] = "orchestration.settings-updated";
581
- /**
582
- * Per-agent hwaccel preference changed (user override set, cleared, or
583
- * re-probed). Observability event — decoders pull the current pref at
584
- * `createSession`, so running sessions keep their current backend until
585
- * they rotate naturally (camera add/remove, stream restart). Future
586
- * work can wire a listener in stream-broker that force-rotates live
587
- * sessions; for now this event powers logs + admin-UI toast feedback.
588
- */
589
- EventCategory["PipelineAgentHwaccelChanged"] = "pipeline.agent-hwaccel-changed";
590
588
  EventCategory["MotionAnalysis"] = "detection.motion-analysis";
591
589
  /** All raw motion zones from CCL before minArea filter — for UI debug overlay. */
592
590
  EventCategory["MotionZonesRaw"] = "detection.motion-zones-raw";
@@ -5457,7 +5455,7 @@ var ZodIssueCode = {
5457
5455
  var ZodFirstPartyTypeKind;
5458
5456
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5459
5457
  //#endregion
5460
- //#region ../types/dist/sleep-C16NCZR2.mjs
5458
+ //#region ../types/dist/sleep-Cr5YOk3m.mjs
5461
5459
  /**
5462
5460
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5463
5461
  * window to float samples (D455).
@@ -5536,6 +5534,97 @@ function buildAlawTable() {
5536
5534
  }
5537
5535
  buildUlawTable();
5538
5536
  buildAlawTable();
5537
+ /** Is this field's stored value a credential? */
5538
+ function isSecretConfigField(field) {
5539
+ if (field.type === "password") return true;
5540
+ return "secret" in field && field.secret === true;
5541
+ }
5542
+ /**
5543
+ * Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
5544
+ * by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
5545
+ */
5546
+ function isKeychainStoredField(field) {
5547
+ if (!isSecretConfigField(field)) return false;
5548
+ if (field.type === "textarea" && field.isJson === true) return false;
5549
+ return !("storage" in field && field.storage === "inline");
5550
+ }
5551
+ /**
5552
+ * What a settings blob holds where a secret used to be.
5553
+ *
5554
+ * A keychain-stored field never holds its value. It holds a self-describing
5555
+ * MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
5556
+ * code can mistake it for a credential and no form can send it to a camera as
5557
+ * a password. The empty state is `null` / absent, never `''`.
5558
+ *
5559
+ * The same shapes travel to and from the admin UI:
5560
+ *
5561
+ * - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
5562
+ * (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
5563
+ * value is set, never the value.
5564
+ * - write: an untouched field submits the view back unchanged (KEEP); a typed
5565
+ * value is a plain non-empty string (CHANGE); the Clear button submits
5566
+ * {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
5567
+ * are KEEP — an empty string is what a defaults-fallback pushes back, and
5568
+ * treating it as "clear" is how a save destroyed a stored credential before.
5569
+ *
5570
+ * Pure and browser-safe.
5571
+ */
5572
+ var SECRET_CLEAR = { $secretClear: true };
5573
+ /** The `'***'` token D634 redaction writes for non-admins. */
5574
+ var LEGACY_DEVICE_REDACTION = "***";
5575
+ function isRecord$1(value) {
5576
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5577
+ }
5578
+ function makeSecretMarker(ref) {
5579
+ return {
5580
+ $secret: ref,
5581
+ v: 1
5582
+ };
5583
+ }
5584
+ /** A stored marker: an object whose `$secret` is a non-empty string. */
5585
+ function isSecretMarker(value) {
5586
+ if (!isRecord$1(value)) return false;
5587
+ const ref = value["$secret"];
5588
+ return typeof ref === "string" && ref.length > 0;
5589
+ }
5590
+ function isSecretClear(value) {
5591
+ return isRecord$1(value) && value["$secretClear"] === true;
5592
+ }
5593
+ /**
5594
+ * The UI view of a stored secret field value: a marker becomes "set", inline
5595
+ * plaintext becomes "set (inline)", nothing becomes `null`. A value never
5596
+ * survives this function.
5597
+ */
5598
+ function toSecretFieldView(stored) {
5599
+ if (isSecretMarker(stored)) return {
5600
+ $secret: stored.$secret,
5601
+ v: 1,
5602
+ set: true
5603
+ };
5604
+ if (typeof stored === "string" && stored.length > 0) return {
5605
+ $secret: null,
5606
+ v: 1,
5607
+ set: true,
5608
+ inline: true
5609
+ };
5610
+ return null;
5611
+ }
5612
+ /**
5613
+ * Classify an incoming value for a secret path. Only a non-empty string that is
5614
+ * not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
5615
+ * Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
5616
+ * `undefined`, a redaction token, a non-string — keeps what is stored.
5617
+ */
5618
+ function classifySecretWrite(incoming) {
5619
+ if (isSecretClear(incoming)) return { kind: "clear" };
5620
+ if (typeof incoming !== "string") return { kind: "keep" };
5621
+ if (incoming.length === 0) return { kind: "keep" };
5622
+ if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
5623
+ return {
5624
+ kind: "set",
5625
+ value: incoming
5626
+ };
5627
+ }
5539
5628
  Object.fromEntries([
5540
5629
  {
5541
5630
  id: "overview",
@@ -5707,33 +5796,19 @@ Object.fromEntries([
5707
5796
  function isValuelessField(field) {
5708
5797
  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";
5709
5798
  }
5710
- /**
5711
- * Merge a `ConfigUISchema` with a raw `values` record into a
5712
- * `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
5713
- * before returning to the admin UI. Groups are walked recursively.
5714
- *
5715
- * For each leaf field:
5716
- * - structural fields (`separator`, `info`, `button`) pass through unchanged
5717
- * - other fields get `value = values[key] ?? field.default ?? null`
5718
- *
5719
- * Unknown keys in `values` (keys not declared in the schema) are silently
5720
- * ignored — they don't contribute to the output. Missing keys fall back to
5721
- * the schema default or `null`. This mirrors the old backend behaviour where
5722
- * `FormBuilder` rendered `values[key] ?? field.default`.
5723
- */
5724
- function hydrateSchema(schema, values) {
5799
+ function hydrateSchema(schema, values, options = {}) {
5725
5800
  return {
5726
5801
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
5727
5802
  sections: schema.sections.map((section) => ({
5728
5803
  ...section,
5729
- fields: section.fields.map((field) => hydrateField(field, values))
5804
+ fields: section.fields.map((field) => hydrateField(field, values, options))
5730
5805
  }))
5731
5806
  };
5732
5807
  }
5733
- function hydrateField(field, values) {
5808
+ function hydrateField(field, values, options) {
5734
5809
  if (isValuelessField(field)) return field;
5735
5810
  if (field.type === "group") {
5736
- const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
5811
+ const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
5737
5812
  return {
5738
5813
  ...field,
5739
5814
  fields: hydratedChildren
@@ -5742,7 +5817,7 @@ function hydrateField(field, values) {
5742
5817
  if (field.type === "sub-tabs") {
5743
5818
  const hydratedTabs = field.tabs.map((tab) => ({
5744
5819
  ...tab,
5745
- fields: tab.fields.map((child) => hydrateField(child, values))
5820
+ fields: tab.fields.map((child) => hydrateField(child, values, options))
5746
5821
  }));
5747
5822
  return {
5748
5823
  ...field,
@@ -5752,6 +5827,33 @@ function hydrateField(field, values) {
5752
5827
  const key = field.key;
5753
5828
  const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
5754
5829
  const defaultValue = field.default;
5830
+ const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
5831
+ if (isKeychainStoredField(field) && asView(storedValue)) return {
5832
+ ...field,
5833
+ value: toSecretFieldView(storedValue)
5834
+ };
5835
+ if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
5836
+ ...field,
5837
+ value: null
5838
+ };
5839
+ if (field.type === "editable-array" && Array.isArray(storedValue)) {
5840
+ const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
5841
+ if (secretItemKeys.length > 0) {
5842
+ const rows = storedValue.map((row) => {
5843
+ if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
5844
+ const out = { ...row };
5845
+ for (const k of secretItemKeys) {
5846
+ const v = Reflect.get(row, k);
5847
+ if (asView(v)) out[k] = toSecretFieldView(v);
5848
+ }
5849
+ return out;
5850
+ });
5851
+ return {
5852
+ ...field,
5853
+ value: rows
5854
+ };
5855
+ }
5856
+ }
5755
5857
  if (field.multiple) {
5756
5858
  const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
5757
5859
  const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
@@ -5994,6 +6096,431 @@ function projectStore(store, perNodeKeys, nodeId) {
5994
6096
  }
5995
6097
  return out;
5996
6098
  }
6099
+ var GLOBAL_SCOPE = { kind: "global" };
6100
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6101
+ function globalSecretScope() {
6102
+ return GLOBAL_SCOPE;
6103
+ }
6104
+ function encodeSegment(value) {
6105
+ return encodeURIComponent(value);
6106
+ }
6107
+ /**
6108
+ * The field path of a value inside an array item, addressed by the item's id:
6109
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6110
+ * `providers[authentik].clientSecret`.
6111
+ */
6112
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6113
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6114
+ }
6115
+ /** A write to a secret path could not be stored in the keychain, so it was refused. */
6116
+ var KeychainWriteRefusedError = class extends Error {
6117
+ fieldPath;
6118
+ constructor(fieldPath, cause) {
6119
+ super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
6120
+ this.fieldPath = fieldPath;
6121
+ this.name = "KeychainWriteRefusedError";
6122
+ }
6123
+ };
6124
+ var KEEP = { kind: "keep" };
6125
+ function isRecord(value) {
6126
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6127
+ }
6128
+ function defaultMintId() {
6129
+ return globalThis.crypto.randomUUID();
6130
+ }
6131
+ /** Every marker ref anywhere under `value`. */
6132
+ function collectSecretMarkerRefs(value, out = []) {
6133
+ if (isSecretMarker(value)) {
6134
+ out.push(value.$secret);
6135
+ return out;
6136
+ }
6137
+ if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6138
+ else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6139
+ return out;
6140
+ }
6141
+ async function storedValueEquals(secrets, marker, candidate) {
6142
+ const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
6143
+ return resolved?.kind === "value" && resolved.value === candidate;
6144
+ }
6145
+ async function writeLeaf(ctx, incoming, stored, fieldPath) {
6146
+ const intent = classifySecretWrite(incoming);
6147
+ const ref = ctx.secrets.ref(ctx.scope, fieldPath);
6148
+ const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
6149
+ if (intent.kind === "keep") return KEEP;
6150
+ if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
6151
+ if (intent.kind === "clear") {
6152
+ if (storedIsOurs) ctx.deletes.push(ref);
6153
+ return {
6154
+ kind: "value",
6155
+ value: null
6156
+ };
6157
+ }
6158
+ if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
6159
+ kind: "value",
6160
+ value: stored
6161
+ };
6162
+ try {
6163
+ await ctx.secrets.put(ref, intent.value);
6164
+ } catch (err) {
6165
+ throw new KeychainWriteRefusedError(fieldPath, err);
6166
+ }
6167
+ return {
6168
+ kind: "value",
6169
+ value: makeSecretMarker(ref)
6170
+ };
6171
+ }
6172
+ /** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
6173
+ function applyMember(out, key, result, storedParent) {
6174
+ if (result.kind === "value") {
6175
+ out[key] = result.value;
6176
+ return;
6177
+ }
6178
+ if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
6179
+ else delete out[key];
6180
+ }
6181
+ async function writeMembers(ctx, children, incoming, stored, pathOf) {
6182
+ const out = { ...incoming };
6183
+ for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
6184
+ return out;
6185
+ }
6186
+ function rowId(row, idKey) {
6187
+ const raw = row[idKey];
6188
+ if (typeof raw === "string" && raw.length > 0) return raw;
6189
+ if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
6190
+ return null;
6191
+ }
6192
+ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6193
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6194
+ if (!Array.isArray(incoming)) {
6195
+ ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6196
+ return {
6197
+ kind: "value",
6198
+ value: incoming
6199
+ };
6200
+ }
6201
+ const storedById = /* @__PURE__ */ new Map();
6202
+ for (const row of storedRows) {
6203
+ const id = rowId(row, node.idKey);
6204
+ if (id !== null) storedById.set(id, row);
6205
+ }
6206
+ const kept = /* @__PURE__ */ new Set();
6207
+ const rows = [];
6208
+ for (const row of incoming) {
6209
+ if (!isRecord(row)) {
6210
+ rows.push(row);
6211
+ continue;
6212
+ }
6213
+ const id = rowId(row, node.idKey) ?? ctx.mintId();
6214
+ kept.add(id);
6215
+ const withId = {
6216
+ ...row,
6217
+ [node.idKey]: row[node.idKey] ?? id
6218
+ };
6219
+ if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
6220
+ const storedRow = storedById.get(id) ?? {};
6221
+ rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
6222
+ }
6223
+ for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
6224
+ return {
6225
+ kind: "value",
6226
+ value: rows
6227
+ };
6228
+ }
6229
+ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6230
+ switch (node.kind) {
6231
+ case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6232
+ case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6233
+ case "object": {
6234
+ if (!isRecord(incoming)) {
6235
+ if (incoming === void 0) return KEEP;
6236
+ ctx.deletes.push(...collectSecretMarkerRefs(stored));
6237
+ return {
6238
+ kind: "value",
6239
+ value: incoming
6240
+ };
6241
+ }
6242
+ const storedObj = isRecord(stored) ? stored : {};
6243
+ return {
6244
+ kind: "value",
6245
+ value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
6246
+ };
6247
+ }
6248
+ }
6249
+ }
6250
+ /** Split a perNode-scoped key (`key@nodeId`). */
6251
+ function splitNodeKey(key) {
6252
+ const at = key.indexOf("@");
6253
+ return at <= 0 ? {
6254
+ base: key,
6255
+ nodeId: null
6256
+ } : {
6257
+ base: key.slice(0, at),
6258
+ nodeId: key.slice(at + 1)
6259
+ };
6260
+ }
6261
+ /** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
6262
+ async function transformSecretWrite(input) {
6263
+ const deletes = [];
6264
+ const base = {
6265
+ secrets: input.secrets,
6266
+ mintId: input.mintId ?? defaultMintId,
6267
+ deletes,
6268
+ operatorWrite: input.operatorWrite === true
6269
+ };
6270
+ const out = {};
6271
+ for (const [key, incoming] of Object.entries(input.patch)) {
6272
+ const { base: baseKey, nodeId } = splitNodeKey(key);
6273
+ const node = input.tree.get(baseKey);
6274
+ if (node === void 0) {
6275
+ out[key] = incoming;
6276
+ continue;
6277
+ }
6278
+ const scope = nodeId !== null && nodeId.length > 0 ? {
6279
+ kind: "node",
6280
+ nodeId
6281
+ } : input.scope ?? globalSecretScope();
6282
+ const result = await writeNode({
6283
+ ...base,
6284
+ scope
6285
+ }, node, incoming, input.stored[key], baseKey);
6286
+ if (result.kind === "value") out[key] = result.value;
6287
+ }
6288
+ return {
6289
+ patch: out,
6290
+ afterWrite: async () => {
6291
+ if (deletes.length === 0) return { orphaned: [] };
6292
+ try {
6293
+ await input.secrets.delete([...new Set(deletes)]);
6294
+ return { orphaned: [] };
6295
+ } catch {
6296
+ return { orphaned: [...new Set(deletes)] };
6297
+ }
6298
+ }
6299
+ };
6300
+ }
6301
+ /**
6302
+ * Replace every marker in `value` with its keychain value. Returns the SAME
6303
+ * reference when there is no marker (no allocation, no keychain call).
6304
+ */
6305
+ async function resolveSecretMarkers(value, secrets) {
6306
+ const refs = collectSecretMarkerRefs(value);
6307
+ if (refs.length === 0) return {
6308
+ value,
6309
+ unresolved: []
6310
+ };
6311
+ const answers = await secrets.resolve(refs);
6312
+ const unresolved = [];
6313
+ for (const ref of new Set(refs)) {
6314
+ const answer = answers[ref];
6315
+ if (answer === void 0) unresolved.push({
6316
+ ref,
6317
+ reason: "not-initialized"
6318
+ });
6319
+ else if (answer.kind === "unavailable") unresolved.push({
6320
+ ref,
6321
+ reason: answer.reason
6322
+ });
6323
+ else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
6324
+ ref,
6325
+ reason: answer.kind
6326
+ });
6327
+ }
6328
+ const substitute = (v) => {
6329
+ if (isSecretMarker(v)) {
6330
+ const answer = answers[v.$secret];
6331
+ return answer?.kind === "value" ? {
6332
+ keep: true,
6333
+ value: answer.value
6334
+ } : {
6335
+ keep: false,
6336
+ value: void 0
6337
+ };
6338
+ }
6339
+ if (Array.isArray(v)) {
6340
+ const items = [];
6341
+ for (const item of v) {
6342
+ const s = substitute(item);
6343
+ if (s.keep) items.push(s.value);
6344
+ }
6345
+ return {
6346
+ keep: true,
6347
+ value: items
6348
+ };
6349
+ }
6350
+ if (isRecord(v)) {
6351
+ const out = {};
6352
+ for (const [k, child] of Object.entries(v)) {
6353
+ const s = substitute(child);
6354
+ if (s.keep) out[k] = s.value;
6355
+ }
6356
+ return {
6357
+ keep: true,
6358
+ value: out
6359
+ };
6360
+ }
6361
+ return {
6362
+ keep: true,
6363
+ value: v
6364
+ };
6365
+ };
6366
+ return {
6367
+ value: substitute(value).value,
6368
+ unresolved
6369
+ };
6370
+ }
6371
+ function touchesTree(tree, patch) {
6372
+ if (tree.size === 0) return false;
6373
+ for (const key of Object.keys(patch)) {
6374
+ const at = key.indexOf("@");
6375
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6376
+ }
6377
+ return false;
6378
+ }
6379
+ /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6380
+ async function readStoredAddonBlob(raw) {
6381
+ const threeWay = raw.readAddonStoreResult;
6382
+ if (threeWay === void 0) return raw.readAddonStore();
6383
+ const result = await threeWay.call(raw);
6384
+ if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6385
+ return result.kind === "missing" ? {} : result.value;
6386
+ }
6387
+ function createSecretAwareSettings(raw, opts) {
6388
+ const chains = /* @__PURE__ */ new Map();
6389
+ const serialize = (key, fn) => {
6390
+ const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
6391
+ const tail = next.catch(() => void 0);
6392
+ chains.set(key, tail);
6393
+ tail.then(() => {
6394
+ if (chains.get(key) === tail) chains.delete(key);
6395
+ });
6396
+ return next;
6397
+ };
6398
+ const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6399
+ if (!touchesTree(tree, patch)) return rawWrite(patch);
6400
+ return serialize(chainKey, async () => {
6401
+ const stored = await readStored();
6402
+ const result = await transformSecretWrite({
6403
+ tree,
6404
+ secrets: opts.secrets,
6405
+ patch,
6406
+ stored,
6407
+ ...scope !== void 0 ? { scope } : {},
6408
+ operatorWrite: opts.isOperatorWrite?.() === true
6409
+ });
6410
+ if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6411
+ const { orphaned } = await result.afterWrite();
6412
+ if (orphaned.length > 0) opts.onOrphaned(orphaned);
6413
+ });
6414
+ };
6415
+ const wrapped = {
6416
+ writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6417
+ writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6418
+ kind: "device",
6419
+ deviceId
6420
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6421
+ };
6422
+ return new Proxy(raw, { get(target, prop, receiver) {
6423
+ if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6424
+ if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6425
+ const value = Reflect.get(target, prop, receiver);
6426
+ return typeof value === "function" ? value.bind(target) : value;
6427
+ } });
6428
+ }
6429
+ /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6430
+ function withSecretAwareSettings(context, opts) {
6431
+ const raw = context.settings;
6432
+ if (raw === void 0) return context;
6433
+ const settings = createSecretAwareSettings(raw, opts);
6434
+ return new Proxy(context, { get(target, prop, receiver) {
6435
+ if (prop === "settings") return settings;
6436
+ return Reflect.get(target, prop, receiver);
6437
+ } });
6438
+ }
6439
+ var LEAF = { kind: "leaf" };
6440
+ var DEFAULT_ITEM_ID_KEY = "id";
6441
+ function collectFields(fields, out) {
6442
+ for (const field of fields) {
6443
+ if (field.type === "group") {
6444
+ collectFields(field.fields, out);
6445
+ continue;
6446
+ }
6447
+ if (field.type === "sub-tabs") {
6448
+ for (const tab of field.tabs) collectFields(tab.fields, out);
6449
+ continue;
6450
+ }
6451
+ if (field.type === "editable-array") {
6452
+ const item = /* @__PURE__ */ new Map();
6453
+ for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
6454
+ if (item.size > 0) out.set(field.key, {
6455
+ kind: "array",
6456
+ idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
6457
+ item
6458
+ });
6459
+ continue;
6460
+ }
6461
+ if (!("key" in field) || typeof field.key !== "string") continue;
6462
+ if (isKeychainStoredField(field)) out.set(field.key, LEAF);
6463
+ }
6464
+ }
6465
+ /** The secret tree a settings schema declares. */
6466
+ function secretTreeFromSchema(schema) {
6467
+ const out = /* @__PURE__ */ new Map();
6468
+ if (schema === null) return out;
6469
+ for (const section of schema.sections) collectFields(section.fields, out);
6470
+ return out;
6471
+ }
6472
+ /** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
6473
+ function parseSecretStatePath(path) {
6474
+ const segments = [];
6475
+ for (const raw of path.split(".")) {
6476
+ const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
6477
+ if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
6478
+ segments.push(m[2] !== void 0 ? {
6479
+ key: m[1],
6480
+ idKey: m[2]
6481
+ } : { key: m[1] });
6482
+ }
6483
+ if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
6484
+ if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
6485
+ return segments;
6486
+ }
6487
+ function insert(into, segments) {
6488
+ const [head, ...rest] = segments;
6489
+ if (head === void 0) return;
6490
+ if (rest.length === 0) {
6491
+ into.set(head.key, LEAF);
6492
+ return;
6493
+ }
6494
+ const existing = into.get(head.key);
6495
+ if (head.idKey !== void 0) {
6496
+ const item = new Map(existing?.kind === "array" ? existing.item : []);
6497
+ insert(item, rest);
6498
+ into.set(head.key, {
6499
+ kind: "array",
6500
+ idKey: head.idKey,
6501
+ item
6502
+ });
6503
+ return;
6504
+ }
6505
+ const children = new Map(existing?.kind === "object" ? existing.children : []);
6506
+ insert(children, rest);
6507
+ into.set(head.key, {
6508
+ kind: "object",
6509
+ children
6510
+ });
6511
+ }
6512
+ /** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
6513
+ function mergeSecretStatePaths(tree, paths) {
6514
+ if (paths.length === 0) return tree;
6515
+ const out = new Map(tree);
6516
+ for (const path of paths) insert(out, parseSecretStatePath(path));
6517
+ return out;
6518
+ }
6519
+ /** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
6520
+ var SECRET_RETRY_FIRST_MS = 5e3;
6521
+ var SECRET_RETRY_MAX_MS = 5 * 6e4;
6522
+ /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
6523
+ var SECRET_CHANGE_DEBOUNCE_MS = 250;
5997
6524
  /**
5998
6525
  * Base class for CamStack addons. Eliminates settings boilerplate:
5999
6526
  *
@@ -6063,6 +6590,25 @@ var BaseAddon = class {
6063
6590
  settingsStoreReady = false;
6064
6591
  /** Default config values. Provided via constructor. */
6065
6592
  defaults;
6593
+ /**
6594
+ * Hidden-state paths that hold secrets (D787) — values the addon writes
6595
+ * itself (`updateGlobalSettings`, `state()`) that no form field declares.
6596
+ * Stored in the keychain exactly like a `password` field. Syntax:
6597
+ * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
6598
+ * (`key[<id field>]` addresses array items by id, never by index).
6599
+ */
6600
+ secretStatePaths = [];
6601
+ _addonSecretTree = null;
6602
+ _deviceSecretTree = null;
6603
+ /** Refs the last resolved config pointed at — a change to one re-resolves. */
6604
+ _configSecretRefs = /* @__PURE__ */ new Set();
6605
+ _unresolvedSecrets = [];
6606
+ _secretRetryTimer = null;
6607
+ _secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
6608
+ _secretChangeTimer = null;
6609
+ _secretChangeUnsub = null;
6610
+ /** >0 while an OPERATOR's settings write is being applied. */
6611
+ _operatorWriteDepth = 0;
6066
6612
  constructor(defaults) {
6067
6613
  this.defaults = defaults;
6068
6614
  this._config = { ...defaults };
@@ -6098,8 +6644,18 @@ var BaseAddon = class {
6098
6644
  return this._config;
6099
6645
  }
6100
6646
  async initialize(context) {
6101
- this._ctx = context;
6647
+ const secrets = context.secrets;
6648
+ this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6649
+ secrets,
6650
+ addonTree: () => this.addonSecretTree(),
6651
+ deviceTree: () => this.deviceSecretTree(),
6652
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6653
+ isOperatorWrite: () => this._operatorWriteDepth > 0
6654
+ }) : context;
6102
6655
  await this.resolveConfig();
6656
+ if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6657
+ if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
6658
+ });
6103
6659
  const result = await this.onInitialize();
6104
6660
  this.emitLifecycle(EventCategory.AddonStarted);
6105
6661
  const normalized = normalizeAddonInitResult(result);
@@ -6132,6 +6688,12 @@ var BaseAddon = class {
6132
6688
  */
6133
6689
  async onHubReachable() {}
6134
6690
  async shutdown() {
6691
+ this._secretChangeUnsub?.();
6692
+ this._secretChangeUnsub = null;
6693
+ if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
6694
+ if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
6695
+ this._secretRetryTimer = null;
6696
+ this._secretChangeTimer = null;
6135
6697
  this.emitLifecycle(EventCategory.AddonStopped);
6136
6698
  if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
6137
6699
  await this.onShutdown();
@@ -6210,7 +6772,7 @@ var BaseAddon = class {
6210
6772
  return hydrateSchema(schema, overlay ? {
6211
6773
  ...projected,
6212
6774
  ...overlay
6213
- } : projected);
6775
+ } : projected, { inlineSecretsAsViews: true });
6214
6776
  }
6215
6777
  /**
6216
6778
  * The integration-level view of this addon's settings: exactly the sections
@@ -6259,7 +6821,7 @@ var BaseAddon = class {
6259
6821
  return hydrateSchema({
6260
6822
  ...schema,
6261
6823
  sections
6262
- }, projected);
6824
+ }, projected, { inlineSecretsAsViews: true });
6263
6825
  }
6264
6826
  /**
6265
6827
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -6313,18 +6875,50 @@ var BaseAddon = class {
6313
6875
  value: result.value[key]
6314
6876
  };
6315
6877
  }
6878
+ /**
6879
+ * The OPERATOR's write — a settings form or an admin API call, dispatched by
6880
+ * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
6881
+ * the operator sends is stored as sent even when it equals a pre-keychain
6882
+ * inline value: the operator re-entering a password is a change, an addon
6883
+ * writing back what it read is not (D787).
6884
+ */
6885
+ async updateGlobalSettingsAsOperator(patch, nodeId) {
6886
+ this._operatorWriteDepth++;
6887
+ try {
6888
+ await this.applyGlobalPatch(patch, nodeId);
6889
+ } finally {
6890
+ this._operatorWriteDepth--;
6891
+ }
6892
+ }
6316
6893
  async updateGlobalSettings(patch, nodeId) {
6894
+ await this.applyGlobalPatch(patch, nodeId);
6895
+ }
6896
+ /**
6897
+ * REMOVE stored secrets — their keychain values and their markers (D787).
6898
+ *
6899
+ * Writing `''` to a secret field KEEPS what is stored (an empty string is
6900
+ * what a defaults fallback writes back, and it must never destroy a
6901
+ * credential), so code that means "forget this token" says so here. Without
6902
+ * a keychain (an older kernel) it writes `''`, as such code always did.
6903
+ */
6904
+ async clearSecrets(keys, nodeId) {
6905
+ const tree = this.addonSecretTree();
6906
+ const keychain = this._ctx?.secrets !== void 0;
6907
+ const patch = {};
6908
+ for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
6909
+ await this.applyGlobalPatch(patch, nodeId);
6910
+ }
6911
+ async applyGlobalPatch(barePatch, nodeId) {
6317
6912
  const keys = this.perNodeKeys();
6318
6913
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6319
6914
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6320
- const barePatch = patch;
6321
6915
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6322
6916
  await this._ctx?.settings?.writeAddonStore(scoped);
6323
6917
  if (target !== localNode) return;
6324
6918
  await this.resolveConfig();
6325
6919
  await this.onConfigChanged();
6326
6920
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
6327
- this.maybeAutoRestart(patch, this.globalSettingsSchema());
6921
+ this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
6328
6922
  }
6329
6923
  /**
6330
6924
  * The set of field keys the global settings schema declares `perNode: true`
@@ -6349,7 +6943,7 @@ var BaseAddon = class {
6349
6943
  * time to return its response before the addon is torn down and
6350
6944
  * re-initialised by `AddonRegistryService.restartAddon`.
6351
6945
  */
6352
- maybeAutoRestart(patch, schema) {
6946
+ maybeAutoRestart(patchKeys, schema) {
6353
6947
  if (!schema) return;
6354
6948
  const restartKeys = /* @__PURE__ */ new Set();
6355
6949
  for (const section of schema.sections) for (const field of section.fields) {
@@ -6357,13 +6951,13 @@ var BaseAddon = class {
6357
6951
  if (field.requiresRestart) restartKeys.add(field.key);
6358
6952
  }
6359
6953
  if (restartKeys.size === 0) return;
6360
- if (!Object.keys(patch).some((k) => restartKeys.has(k))) return;
6954
+ if (!patchKeys.some((k) => restartKeys.has(k))) return;
6361
6955
  const ctx = this._ctx;
6362
6956
  if (!ctx) return;
6363
6957
  const addonId = ctx.id;
6364
6958
  setImmediate(() => {
6365
6959
  ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
6366
- ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: Object.keys(patch).filter((k) => restartKeys.has(k)) } });
6960
+ ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
6367
6961
  }).catch((err) => {
6368
6962
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
6369
6963
  });
@@ -6372,7 +6966,7 @@ var BaseAddon = class {
6372
6966
  async getDeviceSettings(deviceId) {
6373
6967
  const schema = this.deviceSettingsSchema();
6374
6968
  if (!schema) return { sections: [] };
6375
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
6969
+ return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6376
6970
  }
6377
6971
  async updateDeviceSettings(deviceId, patch) {
6378
6972
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -6502,7 +7096,7 @@ var BaseAddon = class {
6502
7096
  * selection at boot (absent scoped key ⇒ the constructor default wins).
6503
7097
  */
6504
7098
  async resolveConfig() {
6505
- const stored = await this.readAddonStoreWithRetry();
7099
+ const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
6506
7100
  const perNode = this.perNodeKeys();
6507
7101
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6508
7102
  const resolved = { ...this.defaults };
@@ -6527,7 +7121,7 @@ var BaseAddon = class {
6527
7121
  key,
6528
7122
  schema,
6529
7123
  fallback,
6530
- read: () => this.readAddonStoreWithRetry(),
7124
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
6531
7125
  write: async (patch) => {
6532
7126
  await this._ctx?.settings?.writeAddonStore(patch);
6533
7127
  },
@@ -6544,7 +7138,7 @@ var BaseAddon = class {
6544
7138
  key,
6545
7139
  schema,
6546
7140
  fallback,
6547
- read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
7141
+ read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
6548
7142
  write: async (patch) => {
6549
7143
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
6550
7144
  },
@@ -6556,6 +7150,70 @@ var BaseAddon = class {
6556
7150
  } })
6557
7151
  });
6558
7152
  }
7153
+ /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
7154
+ addonSecretTree() {
7155
+ this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
7156
+ return this._addonSecretTree;
7157
+ }
7158
+ deviceSecretTree() {
7159
+ this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7160
+ return this._deviceSecretTree;
7161
+ }
7162
+ /**
7163
+ * Secrets of this addon's stored config that could not be resolved on the
7164
+ * last read, with why. Non-empty means the addon is running WITHOUT them —
7165
+ * an addon whose function needs one should report itself degraded rather
7166
+ * than start on an empty credential.
7167
+ */
7168
+ get unresolvedSecrets() {
7169
+ return this._unresolvedSecrets;
7170
+ }
7171
+ /**
7172
+ * Substitute every keychain marker in a stored blob with its value. With no
7173
+ * keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
7174
+ * An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
7175
+ * value — and, when the cause can pass, retried with backoff. Nothing is
7176
+ * ever written back from here.
7177
+ */
7178
+ async resolveStoredSecrets(blob, trackForConfig = true) {
7179
+ const secrets = this._ctx?.secrets;
7180
+ if (secrets === void 0) return blob;
7181
+ const refs = collectSecretMarkerRefs(blob);
7182
+ if (trackForConfig) this._configSecretRefs = new Set(refs);
7183
+ if (refs.length === 0) {
7184
+ if (trackForConfig) this._unresolvedSecrets = [];
7185
+ return blob;
7186
+ }
7187
+ const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
7188
+ if (trackForConfig) {
7189
+ this._unresolvedSecrets = unresolved;
7190
+ if (unresolved.length > 0) {
7191
+ this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
7192
+ ref: u.ref,
7193
+ reason: u.reason
7194
+ })) } });
7195
+ if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
7196
+ this.scheduleSecretReresolve(this._secretRetryDelayMs);
7197
+ this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
7198
+ }
7199
+ } else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
7200
+ }
7201
+ return value;
7202
+ }
7203
+ /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7204
+ scheduleSecretReresolve(delayMs) {
7205
+ const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
7206
+ if (this[timerOf] !== null) return;
7207
+ const timer = setTimeout(() => {
7208
+ this[timerOf] = null;
7209
+ if (this._ctx === null) return;
7210
+ this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
7211
+ this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
7212
+ });
7213
+ }, delayMs);
7214
+ timer.unref?.();
7215
+ this[timerOf] = timer;
7216
+ }
6559
7217
  /**
6560
7218
  * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
6561
7219
  * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
@@ -6823,32 +7481,12 @@ object({
6823
7481
  audioCodec: string().optional(),
6824
7482
  metadata: record(string(), unknown()).readonly().optional()
6825
7483
  });
6826
- var EncodedPacketSchema = object({
6827
- type: _enum(["video", "audio"]),
6828
- data: _instanceof(Uint8Array),
6829
- pts: number(),
6830
- dts: number(),
6831
- keyframe: boolean(),
6832
- codec: string()
6833
- });
6834
- var DecodedFrameSchema = object({
6835
- data: _instanceof(Uint8Array),
6836
- width: number(),
6837
- height: number(),
6838
- format: _enum([
6839
- "jpeg",
6840
- "rgb",
6841
- "bgr",
6842
- "yuv420",
6843
- "gray"
6844
- ]),
6845
- timestamp: number()
6846
- });
6847
7484
  /**
6848
7485
  * Wire schema for `FrameHandle` — a zero-pixel, serialisable reference to a
6849
7486
  * frame in a shared-memory ring (Phase 5 / D9). Mirrors the `FrameHandle` TS
6850
- * interface in `interfaces/frame-handle.ts` field-for-field so a decoder cap
6851
- * method (`pullHandles`) can carry handles over tRPC / Moleculer.
7487
+ * interface in `interfaces/frame-handle.ts` field-for-field so a cap method
7488
+ * (the runner's native-crop and pipeline-executor inputs) can carry handles
7489
+ * over tRPC / Moleculer.
6852
7490
  *
6853
7491
  * The `satisfies` assertion below pins this schema to the interface: if a
6854
7492
  * field is added to / removed from `FrameHandle` without a matching schema
@@ -6874,50 +7512,6 @@ var FrameHandleSchema = object({
6874
7512
  slotCount: number().int().positive()
6875
7513
  });
6876
7514
  /**
6877
- * Pixel format a frame-handle subscriber can request from the broker
6878
- * (Phase 5 / D9). The packed, raster subset of `FrameFormat` — the formats a
6879
- * `frameSink: 'shm'` decoder session can write into a `FrameRing` slot.
6880
- * `jpeg` is excluded: a variable-length stream is not a fixed-stride ring
6881
- * payload, and no decoded-frame consumer requests it over the shm plane.
6882
- */
6883
- var FrameHandleFormatSchema = _enum([
6884
- "rgb",
6885
- "bgr",
6886
- "yuv420",
6887
- "gray"
6888
- ]);
6889
- /**
6890
- * Input for `stream-broker.subscribeFrames` (Phase 5 / D9). A consumer asks the
6891
- * broker for a `FrameHandle` stream of one `format`; the broker maintains one
6892
- * shared-memory ring per `(brokerId, format)` actually requested, so a `gray`
6893
- * subscriber (motion) and an `rgb` subscriber (detection) each read the format
6894
- * they asked for with no broker-side conversion.
6895
- */
6896
- var SubscribeFramesInputSchema = object({
6897
- brokerId: string(),
6898
- format: FrameHandleFormatSchema,
6899
- /**
6900
- * Optional reader-side cadence hint in frames per second. The broker does
6901
- * NOT throttle — latest-wins ring reads drop frames implicitly for a slow
6902
- * consumer. The value is echoed back in `SubscribeFramesResult.maxFps` so
6903
- * the consumer can pace its own `pullFrameHandles` polling.
6904
- */
6905
- maxFps: number().positive().optional(),
6906
- /** Short caller-identity tag (`motion`, `detection`, …) for diagnostics. */
6907
- tag: string().optional()
6908
- });
6909
- /**
6910
- * Result of `stream-broker.subscribeFrames`. The consumer then polls
6911
- * `pullFrameHandles({ subscriptionId, maxCount })` and feeds each returned
6912
- * `FrameHandle` to a `FrameRingReader`.
6913
- */
6914
- var SubscribeFramesResultSchema = object({
6915
- /** Opaque id the consumer passes to `pullFrameHandles` / `unsubscribeFrames`. */
6916
- subscriptionId: string(),
6917
- /** Reader-side cadence hint (frames/s) — echoes `SubscribeFramesInput.maxFps`. */
6918
- maxFps: number().nonnegative()
6919
- });
6920
- /**
6921
7515
  * Wire schema for a decoded audio chunk (Phase 5 / D9). Mirrors the
6922
7516
  * `DecodedAudioChunk` TS interface in `interfaces/stream-broker.ts`: PCM
6923
7517
  * sample bytes plus the track parameters a consumer needs to interpret them.
@@ -6925,8 +7519,8 @@ var SubscribeFramesResultSchema = object({
6925
7519
  * Audio chunks are tiny (a ~500ms AudioCodecSession window is a few KB of
6926
7520
  * Float32 PCM), so unlike video frames they ship their bytes INLINE over
6927
7521
  * tRPC / Moleculer — no shared-memory plane. `data` is typed `Uint8Array`
6928
- * (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
6929
- * / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
7522
+ * (the wire-serialisable supertype of `Buffer`); a `Buffer` is assignable to
7523
+ * it.
6930
7524
  */
6931
7525
  var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
6932
7526
  var DecodedAudioChunkSchema = object({
@@ -6944,11 +7538,10 @@ var DecodedAudioChunkSchema = object({
6944
7538
  format: AudioChunkFormatSchema.optional()
6945
7539
  });
6946
7540
  /**
6947
- * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
6948
- * handle-free, ship-bytes-inline analogue of `subscribeFrames`: a consumer
6949
- * asks the broker for the decoded audio-chunk stream of one broker; the
6950
- * broker keeps a per-subscription bounded FIFO queue the consumer drains via
6951
- * `pullAudioChunks`.
7541
+ * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). Audio ships
7542
+ * its bytes inline: a consumer asks the broker for the decoded audio-chunk
7543
+ * stream of one broker; the broker keeps a per-subscription bounded FIFO queue
7544
+ * the consumer drains via `pullAudioChunks`.
6952
7545
  */
6953
7546
  var SubscribeAudioChunksInputSchema = object({
6954
7547
  brokerId: string(),
@@ -6979,9 +7572,7 @@ var BrokerStatsSchema = object({
6979
7572
  "stopped"
6980
7573
  ]),
6981
7574
  inputFps: number(),
6982
- decodeFps: number(),
6983
7575
  encodedSubscribers: number(),
6984
- decodedSubscribers: number(),
6985
7576
  uptimeMs: number(),
6986
7577
  bitrateKbps: number(),
6987
7578
  idrIntervalMs: number(),
@@ -6994,14 +7585,6 @@ var BrokerStatsSchema = object({
6994
7585
  preBufferMs: number(),
6995
7586
  preBufferPackets: number(),
6996
7587
  /**
6997
- * Moleculer node id of the decoder provider currently servicing this
6998
- * stream's decoded subscribers. `null` until the deferred decoder is
6999
- * created (no decoded clients yet, or codec not detected). Surfaces the
7000
- * runtime decoder placement so the UI can show "Decoder: <agent>" without
7001
- * a separate cap call per broker.
7002
- */
7003
- decoderNodeId: string().nullable(),
7004
- /**
7005
7588
  * Detected audio track parameters from the RTSP DESCRIBE / SDP. `null`
7006
7589
  * when the stream has no audio track or the broker is in cold start.
7007
7590
  * `supported = false` means the codec was detected but the local
@@ -8489,8 +9072,8 @@ function buildAddonRouteProvider(id, routes) {
8489
9072
  const reply = buildCapturingReply(envelope);
8490
9073
  const request = {
8491
9074
  params: {
8492
- ...input.params,
8493
- ...match.params
9075
+ ...match.params,
9076
+ ...input.params
8494
9077
  },
8495
9078
  query: input.query,
8496
9079
  body: input.body,
@@ -10472,70 +11055,6 @@ var StorageLocationDeclarationSchema = object({
10472
11055
  "backup"
10473
11056
  ]).optional()
10474
11057
  });
10475
- var DecoderStatsSchema = object({
10476
- inputFps: number(),
10477
- outputFps: number(),
10478
- avgDecodeTimeMs: number(),
10479
- droppedFrames: number(),
10480
- /**
10481
- * Pull-mode adaptive-fps telemetry (optional — only pull sessions run the
10482
- * lag-driven controller; push sessions omit these). `lagMs` is the EWMA of
10483
- * the decoder's real-time drift (rising = falling behind live); `adaptiveFps`
10484
- * is the current lag-throttled emit rate (≤ `effectiveFps` ceiling).
10485
- */
10486
- lagMs: number().optional(),
10487
- effectiveFps: number().optional(),
10488
- adaptiveFps: number().optional()
10489
- });
10490
- var DecoderSessionConfigSchema = object({
10491
- codec: string(),
10492
- maxFps: number().default(0),
10493
- outputFormat: _enum([
10494
- "jpeg",
10495
- "rgb",
10496
- "bgr",
10497
- "yuv420",
10498
- "gray"
10499
- ]).default("jpeg"),
10500
- scale: number().default(1),
10501
- width: number().optional(),
10502
- height: number().optional(),
10503
- /**
10504
- * Identifier of the camera this decoder session serves. Optional
10505
- * because the cap is generic (any caller could request decode), but
10506
- * stream-broker passes it so decoder logs include `deviceId` for
10507
- * per-camera filtering when diagnosing failures (e.g. node-av
10508
- * sendPacket errors on a single hung camera).
10509
- */
10510
- deviceId: number().int().nonnegative().optional(),
10511
- /**
10512
- * Free-form tag for log scoping. Stream-broker uses
10513
- * `broker:<deviceId>/<profile>`. Decoder session logger surfaces it
10514
- * on every line so `grep tag=broker:5/high` filters one camera
10515
- * profile cleanly.
10516
- */
10517
- tag: string().optional(),
10518
- /**
10519
- * Where the session delivers decoded frames (Phase 5 / D9):
10520
- *
10521
- * - `'callback'` (default) — the legacy pixel path: decoded frames are
10522
- * buffered as `DecodedFrame`s and drained via `pullFrames`.
10523
- * - `'shm'` — the shared-memory frame plane: decoded frames are written
10524
- * into an OS shared-memory ring and drained as zero-pixel
10525
- * `FrameHandle`s via `pullHandles`. A session is one mode or the
10526
- * other — `pullFrames` returns nothing for an `'shm'` session and
10527
- * `pullHandles` returns nothing for a `'callback'` session.
10528
- */
10529
- frameSink: _enum(["callback", "shm"]).default("callback"),
10530
- /**
10531
- * Per-camera decoder DEBUG facility. When `true`, a pull-mode session emits
10532
- * a throttled (~1Hz) structured `decoder debug` line (effective/adaptive fps,
10533
- * real-time lag, dropped-frame delta, avg decode time, hwaccel). Mirrors the
10534
- * stream-broker's `streamingDebug` gate — off by default so production logs
10535
- * stay quiet and the emit path pays zero per-frame cost when disabled.
10536
- */
10537
- debug: boolean().optional()
10538
- });
10539
11058
  /**
10540
11059
  * Per-component log CHANNELS — the gate a hot path consults, and the registry
10541
11060
  * an addon declares its channels in.
@@ -10686,7 +11205,18 @@ var LABEL_SUPPLY_STEP_IDS = [
10686
11205
  ];
10687
11206
  /** Steps whose box a root detection can BE. */
10688
11207
  var CROP_SUPPLY_STEP_IDS = ["plate-detection", "face-detection"];
10689
- [...LABEL_SUPPLY_STEP_IDS, ...CROP_SUPPLY_STEP_IDS];
11208
+ /**
11209
+ * Steps whose per-detection MASK a root detection can carry (D737). The live
11210
+ * mask step is `segmentation` — a frame-plane refiner that runs its own model
11211
+ * once per detection crop. (`instance-segmentation` is a dormant step id that
11212
+ * no camera tree carries.)
11213
+ */
11214
+ var MASK_SUPPLY_STEP_IDS = ["segmentation"];
11215
+ [
11216
+ ...LABEL_SUPPLY_STEP_IDS,
11217
+ ...CROP_SUPPLY_STEP_IDS,
11218
+ ...MASK_SUPPLY_STEP_IDS
11219
+ ];
10690
11220
  var MODEL_FORMATS = [
10691
11221
  "onnx",
10692
11222
  "coreml",
@@ -10715,7 +11245,53 @@ var ModelFormatEntrySchema = object({
10715
11245
  /** Multi-file payload (directory members or sibling files). */
10716
11246
  files: array(string()).readonly().optional(),
10717
11247
  /** Runtime(s) that can use this format. If omitted, inferred from ModelFormat key */
10718
- runtimes: array(_enum(["python"])).readonly().optional()
11248
+ runtimes: array(_enum(["python"])).readonly().optional(),
11249
+ /**
11250
+ * Content revision of the artefact, for one hosted OFF the CamStack mirror.
11251
+ * A format on the mirror leaves it unset: its revision (the sha256 of its
11252
+ * weight file) comes from the downloader's generated table, kept in step
11253
+ * with the mirror by `scripts/check-hosted-model-revisions.ts` (D744). A
11254
+ * node records the revision it downloaded next to the file
11255
+ * (`<file>.revision`); a copy with no record or a different one is stale
11256
+ * unless its weight file hashes to the revision, and a stale copy is
11257
+ * downloaded again, the old one serving until the new one is complete. No
11258
+ * revision at all ⇒ a file on disk is current, whatever it holds (D743).
11259
+ */
11260
+ revision: string().min(1).optional()
11261
+ });
11262
+ /**
11263
+ * What a node holds for one (model, format) (D746). `current` is a complete
11264
+ * copy at its catalog revision — exactly what `downloaded: true` means.
11265
+ * `stale` is bytes on disk that are not (yet) proven current under D743/D744:
11266
+ * no or a different revision record, or a missing sibling. `missing` is no
11267
+ * copy. `downloaded` alone folds `stale` into "not downloaded", which hid
11268
+ * reclaimable bytes and a copy about to be replaced.
11269
+ */
11270
+ var ModelOnDiskStateSchema = _enum([
11271
+ "current",
11272
+ "stale",
11273
+ "missing"
11274
+ ]);
11275
+ /**
11276
+ * The numeric precision of one format's BUILD (D746) — reported only when the
11277
+ * build states it (file-name token, an INT8 variant, an EdgeTPU compile, a
11278
+ * CamStack Core ML export). Absent means "not stated", never "fp32".
11279
+ */
11280
+ var ModelFormatPrecisionSchema = _enum([
11281
+ "fp32",
11282
+ "fp16",
11283
+ "int8"
11284
+ ]);
11285
+ /**
11286
+ * One format of one model as a node's `pipelineExecutor.getSchema` reports it.
11287
+ * `onDisk` / `precision` are optional for version skew: a runner that predates
11288
+ * them omits them, and a reader falls back to `downloaded`.
11289
+ */
11290
+ var PipelineModelFormatStatusSchema = object({
11291
+ downloaded: boolean(),
11292
+ sizeMB: number(),
11293
+ onDisk: ModelOnDiskStateSchema.optional(),
11294
+ precision: ModelFormatPrecisionSchema.optional()
10719
11295
  });
10720
11296
  /**
10721
11297
  * Extra file that must be downloaded alongside the model (e.g., labels JSON, dict.txt).
@@ -10829,25 +11405,36 @@ var ModelLicenseSchema = preprocess((value) => typeof value === "string" ? { wei
10829
11405
  * - `crop`: the root draws the box the step would have found (`license_plate`
10830
11406
  * for plate-detection, `face` for face-detection). The box becomes a detail
10831
11407
  * child of the `parentMacro` detection that contains it — never a track.
11408
+ * - `mask`: the root's decode emits an instance mask with every detection (a
11409
+ * YOLO26-seg root, D737) — the `segmentation` step's result, carried on the
11410
+ * detection in the shape that step produces. Derived from the model's
11411
+ * postprocessor on read, never stored by an import.
10832
11412
  */
10833
- var RootStepSupplySchema = discriminatedUnion("kind", [object({
10834
- kind: literal("label"),
10835
- stepId: _enum(LABEL_SUPPLY_STEP_IDS),
10836
- labelToEffect: record(string(), string()),
10837
- uncovered: array(string()).readonly()
10838
- }), object({
10839
- kind: literal("crop"),
10840
- stepId: _enum(CROP_SUPPLY_STEP_IDS),
10841
- rootLabels: array(string()).readonly(),
10842
- parentMacro: _enum(["vehicle", "person"]),
10843
- childClass: _enum(["plate", "face"]),
10844
- /**
10845
- * The root's smaller input side, stamped on read by `rootSuppliesOf` from
10846
- * the model entry — what a step's `minRootInputPx` gate judges. Never
10847
- * stored by an import.
10848
- */
10849
- rootInputPx: number().int().positive().optional()
10850
- })]);
11413
+ var RootStepSupplySchema = discriminatedUnion("kind", [
11414
+ object({
11415
+ kind: literal("label"),
11416
+ stepId: _enum(LABEL_SUPPLY_STEP_IDS),
11417
+ labelToEffect: record(string(), string()),
11418
+ uncovered: array(string()).readonly()
11419
+ }),
11420
+ object({
11421
+ kind: literal("crop"),
11422
+ stepId: _enum(CROP_SUPPLY_STEP_IDS),
11423
+ rootLabels: array(string()).readonly(),
11424
+ parentMacro: _enum(["vehicle", "person"]),
11425
+ childClass: _enum(["plate", "face"]),
11426
+ /**
11427
+ * The root's smaller input side, stamped on read by `rootSuppliesOf` from
11428
+ * the model entry — what a step's `minRootInputPx` gate judges. Never
11429
+ * stored by an import.
11430
+ */
11431
+ rootInputPx: number().int().positive().optional()
11432
+ }),
11433
+ object({
11434
+ kind: literal("mask"),
11435
+ stepId: _enum(MASK_SUPPLY_STEP_IDS)
11436
+ })
11437
+ ]);
10851
11438
  var ModelCatalogEntrySchema = object({
10852
11439
  id: string(),
10853
11440
  name: string(),
@@ -10913,6 +11500,35 @@ var ModelCatalogEntrySchema = object({
10913
11500
  */
10914
11501
  defaultConfidence: number().min(0).max(1).optional(),
10915
11502
  /**
11503
+ * Per-MODEL default of the per-class confidence floors (`minConfidence<Macro>`
11504
+ * on a detector step), keyed by macro class: `{ person: 0.45 }`. A class
11505
+ * absent here runs at the step slider's global default. The same row shape
11506
+ * the floor measurement produces (`model-floors.json`: modelId → floors), so
11507
+ * a measured table is copied in as-is. An operator override is bound to the
11508
+ * model it was made for and does not survive a model change (D738). A custom
11509
+ * / imported model may declare it; without it, the global defaults apply.
11510
+ */
11511
+ defaultClassFloors: record(string(), number().min(0).max(1)).optional(),
11512
+ /**
11513
+ * The inference precision this model's OpenVINO IR needs on an Intel GPU.
11514
+ * Absent ⇒ the device default (f16 on a GPU). Set to `'f32'` for an FP32 IR
11515
+ * that produces invalid output at f16 — measured 2026-10-07 for YOLO26
11516
+ * base IRs (`yolo26s`: 0 true / 146 false positives; `yolo26m*`: NaN
11517
+ * scores) on the Core Ultra iGPU and the N100. Threaded to the pool as
11518
+ * `PoolModelConfig.gpuInferencePrecision`; the pool sets
11519
+ * INFERENCE_PRECISION_HINT on a GPU only. Costs ~60% latency on the GPU.
11520
+ */
11521
+ gpuInferencePrecision: _enum(["f32", "f16"]).optional(),
11522
+ /**
11523
+ * ROOT detectors only: per supplied step (`animal-classifier`, …), the
11524
+ * minimum DETECTION score from which this root's own fine label (species,
11525
+ * vehicle type — D736 root supply) is taken (D741). Below it the detection
11526
+ * keeps its macro class without the fine label. `1` = never take it from
11527
+ * this root. Absent ⇒ no floor beyond the macro floor. The supplied step's
11528
+ * `minConfidence` slider, bound to the ROOT model, overrides it.
11529
+ */
11530
+ suppliedLabelFloors: record(string(), number().min(0).max(1)).optional(),
11531
+ /**
10916
11532
  * When true, the executor produces a landmark-aligned crop (similarity warp
10917
11533
  * onto the canonical template) before this step runs, instead of a plain
10918
11534
  * axis-aligned bbox crop. Required for face-recognition embedders (ArcFace):
@@ -12611,13 +13227,6 @@ var BrokerRtspClientSchema = object({
12611
13227
  lastRtpAt: number(),
12612
13228
  bytesSent: number()
12613
13229
  });
12614
- var BrokerDecodedClientSchema = object({
12615
- tag: string(),
12616
- subscribedAt: number(),
12617
- maxFps: number(),
12618
- framesDelivered: number(),
12619
- framesDropped: number()
12620
- });
12621
13230
  var BrokerAudioClientSchema = object({
12622
13231
  tag: string(),
12623
13232
  subscribedAt: number(),
@@ -12709,7 +13318,6 @@ var BrokerEncodedClientSchema = object({
12709
13318
  });
12710
13319
  var BrokerClientsSchema = object({
12711
13320
  rtsp: array(BrokerRtspClientSchema).readonly(),
12712
- decoded: array(BrokerDecodedClientSchema).readonly(),
12713
13321
  audio: array(BrokerAudioClientSchema).readonly(),
12714
13322
  encoded: array(BrokerEncodedClientSchema).readonly(),
12715
13323
  pipeClients: number(),
@@ -13078,11 +13686,7 @@ method(object({
13078
13686
  auth: "admin"
13079
13687
  }), method(object({ brokerId: string() }), BrokerClientsSchema), method(object({
13080
13688
  brokerId: string(),
13081
- channel: _enum([
13082
- "rtsp",
13083
- "decoded",
13084
- "audio"
13085
- ]),
13689
+ channel: _enum(["rtsp", "audio"]),
13086
13690
  handle: string()
13087
13691
  }), object({ killed: boolean() }), {
13088
13692
  kind: "mutation",
@@ -13117,10 +13721,7 @@ method(object({
13117
13721
  }), method(SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, { kind: "mutation" }), method(object({
13118
13722
  subscriptionId: string(),
13119
13723
  maxCount: number().int().positive().default(8)
13120
- }), array(DecodedAudioChunkSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(SubscribeFramesInputSchema, SubscribeFramesResultSchema, { kind: "mutation" }), method(object({
13121
- subscriptionId: string(),
13122
- maxCount: number().int().positive().default(4)
13123
- }), array(FrameHandleSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(object({
13724
+ }), array(DecodedAudioChunkSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(object({
13124
13725
  brokerId: string(),
13125
13726
  seconds: number().min(0).max(30)
13126
13727
  }), _void(), {
@@ -14278,53 +14879,201 @@ id: union([string(), number()]) }), {
14278
14879
  auth: "admin"
14279
14880
  });
14280
14881
  /**
14281
- * shm ring usage stats for a `frameSink: 'shm'` decoder session —
14282
- * exposed via `decoder.getShmStats` so downstream consumers can
14283
- * observe ring pressure (slot count, byte budget, hit/miss ratio).
14882
+ * `keychain` — the hub's encrypted store of secret values (D787).
14883
+ *
14884
+ * Settings blobs never hold a secret: they hold a marker
14885
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
14886
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
14887
+ * is the OWNER's door to its own values: every method is owner-checked
14888
+ * against the CALLER, never against anything the caller claims.
14889
+ *
14890
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
14891
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
14892
+ * connection, the agent from its child's connection carried in
14893
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
14894
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
14895
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
14896
+ * identity against BUGS and misrouting, not against a malicious addon (every
14897
+ * runner is the same OS user): see the threat model in
14898
+ * `docs/design/2026-10-08-secrets-keychain.md`.
14899
+ *
14900
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
14901
+ * parses the input, so a session can never supply it, and the internal mount
14902
+ * floors every method to admin anyway (D240).
14903
+ *
14904
+ * Internal: addons reach it through `ctx.secrets`, never directly.
14284
14905
  */
14285
- var ShmRingStatsSchema = object({
14286
- sessionId: string(),
14287
- slotCount: number().int(),
14288
- slotByteLength: number().int(),
14289
- segmentBytes: number().int(),
14290
- budgetMb: number().int(),
14291
- framesWritten: number().int(),
14292
- getFrameHits: number().int(),
14293
- getFrameMisses: number().int()
14294
- });
14295
- method(object({ codec: string() }), boolean()), method(_void(), object({
14906
+ /** Why a value cannot be served right now. Never folded into "missing". */
14907
+ var KeychainUnavailableReasonSchema = _enum([
14908
+ "key-missing",
14909
+ "wrong-key",
14910
+ "key-file-unreadable",
14911
+ "store-unavailable",
14912
+ "not-initialized",
14913
+ "decrypt-failed"
14914
+ ]);
14915
+ var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
14916
+ state: literal("locked"),
14917
+ reason: KeychainUnavailableReasonSchema
14918
+ })]);
14919
+ var KeychainResolveEntrySchema = discriminatedUnion("kind", [
14920
+ object({
14921
+ kind: literal("value"),
14922
+ value: string(),
14923
+ version: number().int()
14924
+ }),
14925
+ object({ kind: literal("missing") }),
14926
+ object({
14927
+ kind: literal("unavailable"),
14928
+ reason: KeychainUnavailableReasonSchema
14929
+ }),
14930
+ object({ kind: literal("forbidden") })
14931
+ ]);
14932
+ var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
14933
+ /** Metadata of one stored value — never the value. */
14934
+ var KeychainSecretMetaSchema = object({
14935
+ ref: string(),
14936
+ owner: string(),
14937
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
14938
+ scope: string(),
14939
+ fieldPath: string(),
14940
+ version: number().int(),
14941
+ createdAt: number(),
14942
+ updatedAt: number(),
14943
+ /** `addon:<id>` | `user:<id>` | `system`. */
14944
+ updatedBy: string(),
14945
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
14946
+ lastReadAt: number().nullable()
14947
+ });
14948
+ var RefListSchema = array(string().min(1)).max(512);
14949
+ method(object({
14950
+ ref: string().min(1),
14951
+ value: string().min(1)
14952
+ }), object({
14953
+ ref: string(),
14954
+ version: number().int()
14955
+ }), {
14956
+ kind: "mutation",
14957
+ auth: "admin"
14958
+ }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
14959
+ kind: "mutation",
14960
+ auth: "admin"
14961
+ }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
14962
+ var KeychainKeySourceSchema = object({
14963
+ kind: _enum([
14964
+ "config-file",
14965
+ "previous-config-file",
14966
+ "platform",
14967
+ "default-file"
14968
+ ]),
14969
+ /** File sources only — a path is not a secret. */
14970
+ path: string().optional(),
14971
+ /**
14972
+ * True when a whole-volume backup of the data directory carries this key
14973
+ * next to the database it protects (the default file). The page warns.
14974
+ */
14975
+ sharesBackupWithDatabase: boolean()
14976
+ });
14977
+ var KeychainStatusSchema = object({
14978
+ keychain: KeychainStateSchema,
14979
+ /** The source of the master key in use; `null` while locked. */
14980
+ keySource: KeychainKeySourceSchema.nullable(),
14981
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
14982
+ configuredSource: KeychainKeySourceSchema,
14983
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
14984
+ fingerprint: string().nullable(),
14985
+ activeKeyId: string().nullable(),
14986
+ /**
14987
+ * The keychain unlocked with a NON-primary source: the configured primary
14988
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
14989
+ */
14990
+ rotationPending: boolean(),
14991
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
14992
+ retiredWraps: number().int(),
14993
+ recoveryKeyDownloadedAt: number().nullable(),
14994
+ secretCount: number().int()
14995
+ });
14996
+ /**
14997
+ * Whether a stored value is still pointed at by its owner's settings.
14998
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
14999
+ * never reported as an orphan (and never deleted as one).
15000
+ */
15001
+ var KeychainSecretUsageSchema = _enum([
15002
+ "in-use",
15003
+ "orphan",
15004
+ "unknown"
15005
+ ]);
15006
+ var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
15007
+ var KeychainAuditActionSchema = _enum([
15008
+ "put",
15009
+ "delete",
15010
+ "reveal",
15011
+ "rotate-master-key",
15012
+ "purge-retired-keys",
15013
+ "download-recovery-key",
15014
+ "delete-orphans",
15015
+ "reset",
15016
+ "initialize"
15017
+ ]);
15018
+ var KeychainAuditEntrySchema = object({
15019
+ id: string(),
15020
+ at: number(),
15021
+ action: KeychainAuditActionSchema,
15022
+ /** `addon:<id>` | `user:<id>` | `system`. */
15023
+ actor: string(),
15024
+ ref: string().nullable(),
15025
+ detail: string().nullable()
15026
+ });
15027
+ 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({
15028
+ value: string(),
15029
+ version: number().int()
15030
+ }), {
15031
+ kind: "mutation",
15032
+ auth: "admin",
15033
+ caller: "required"
15034
+ }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
15035
+ deleted: array(string()).readonly(),
15036
+ kept: array(object({
15037
+ ref: string(),
15038
+ usage: KeychainSecretUsageSchema
15039
+ })).readonly()
15040
+ }), {
15041
+ kind: "mutation",
15042
+ auth: "admin",
15043
+ caller: "required"
15044
+ }), method(object({}), object({
15045
+ fingerprint: string(),
15046
+ keySource: KeychainKeySourceSchema
15047
+ }), {
15048
+ kind: "mutation",
15049
+ auth: "admin",
15050
+ caller: "required"
15051
+ }), method(object({}), object({ purged: number().int() }), {
15052
+ kind: "mutation",
15053
+ auth: "admin",
15054
+ caller: "required"
15055
+ }), method(object({}), object({
15056
+ key: string(),
15057
+ fingerprint: string(),
15058
+ keySource: KeychainKeySourceSchema
15059
+ }), {
15060
+ kind: "mutation",
15061
+ auth: "admin",
15062
+ caller: "required"
15063
+ }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15064
+ archivedCollection: string().nullable(),
15065
+ archived: number().int()
15066
+ }), {
15067
+ kind: "mutation",
15068
+ auth: "admin",
15069
+ caller: "required"
15070
+ });
15071
+ method(_void(), object({
14296
15072
  id: string(),
14297
15073
  name: string(),
14298
- isPullMode: boolean().optional(),
14299
- priority: number().optional(),
14300
15074
  hwaccel: string().optional(),
14301
15075
  probedBestHwaccel: string().optional()
14302
- })), method(DecoderSessionConfigSchema, object({
14303
- sessionId: string(),
14304
- nodeId: string()
14305
- })), method(object({ sessionId: string() }), _void()), method(object({
14306
- sessionId: string(),
14307
- packet: EncodedPacketSchema
14308
- }), _void()), method(object({
14309
- sessionId: string(),
14310
- url: string()
14311
- }), _void()), method(object({
14312
- sessionId: string(),
14313
- maxCount: number().default(1),
14314
- waitMs: number().optional()
14315
- }), array(DecodedFrameSchema)), method(object({
14316
- sessionId: string(),
14317
- maxCount: number().default(1),
14318
- waitMs: number().optional()
14319
- }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
14320
- sessionId: string(),
14321
- config: DecoderSessionConfigSchema.partial()
14322
- }), _void()), method(object({ sessionId: string() }), DecoderStatsSchema), method(_void(), array(object({
14323
- sessionId: string(),
14324
- codec: string(),
14325
- outputFormat: string(),
14326
- createdAtMs: number()
14327
- })).readonly()), method(_void(), object({ backend: string() }), {
15076
+ })), method(_void(), object({ backend: string() }), {
14328
15077
  kind: "mutation",
14329
15078
  auth: "admin"
14330
15079
  });
@@ -15161,6 +15910,10 @@ var DeviceInfoSchema = object({
15161
15910
  isCamera: boolean(),
15162
15911
  /** Current config values — serializable snapshot */
15163
15912
  config: record(string(), unknown()),
15913
+ /** Paths inside `config` the device's schema declares secret (D783) —
15914
+ * what the non-admin redaction withholds. Paths, never values. Absent
15915
+ * when the owning runner has not reported them. */
15916
+ secretConfigPaths: array(string()).optional(),
15164
15917
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
15165
15918
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
15166
15919
  metadata: record(string(), unknown()).nullable().optional(),
@@ -15366,12 +16119,22 @@ var DeviceRegisterPayloadSchema = object({
15366
16119
  * call (workers re-register on init), so probe-driven updates
15367
16120
  * (e.g. PTZ flag flipping after the abilities probe) propagate. */
15368
16121
  features: array(string()).optional(),
15369
- config: record(string(), unknown())
16122
+ config: record(string(), unknown()),
16123
+ /** Config paths the device's own schema DECLARES secret
16124
+ * (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
16125
+ * `connection.password`). Re-published on every register; the non-admin
16126
+ * redaction withholds them at any depth (D783). Optional: an older runner
16127
+ * omits it and the keyword backstop applies. */
16128
+ secretConfigPaths: array(string()).optional()
15370
16129
  });
15371
16130
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
15372
16131
  var DevicePersistConfigPayloadSchema = object({
15373
16132
  deviceId: number(),
15374
- data: record(string(), unknown())
16133
+ data: record(string(), unknown()),
16134
+ /** The paths the device's schema declares secret (D783), when the caller
16135
+ * knows them — those values are kept in the keychain, not the blob (D787).
16136
+ * Absent: the paths the device last reported at `registerDevice` apply. */
16137
+ secretConfigPaths: array(string()).optional()
15375
16138
  });
15376
16139
  /** What a migration actually did, per switch. `unreachable` is a first-class
15377
16140
  * answer: a camera that could not be asked is not a camera that was silenced. */
@@ -16193,6 +16956,12 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
16193
16956
  kind: "mutation",
16194
16957
  auth: "admin"
16195
16958
  });
16959
+ var HUB_ADDRESS_ROLES = [
16960
+ "appConnections",
16961
+ "notificationTaps",
16962
+ "internal",
16963
+ "publicEndpoint"
16964
+ ];
16196
16965
  /**
16197
16966
  * Transport bounds for AI capability methods.
16198
16967
  *
@@ -17019,7 +17788,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17019
17788
  icon: string().optional(),
17020
17789
  /** Addon-owned HTTP route the button navigates to (GET). */
17021
17790
  startUrl: string(),
17022
- stage: LoginStageEnum
17791
+ stage: LoginStageEnum,
17792
+ /**
17793
+ * The provider names an external identity a signed-in user can link to
17794
+ * their own account (D782): `auth.listLinkableProviders` /
17795
+ * `beginExternalLink` offer exactly the redirect methods that set this,
17796
+ * whatever their id. Absent / false — a login button only (magic-link).
17797
+ */
17798
+ linkable: boolean().optional()
17023
17799
  }),
17024
17800
  object({
17025
17801
  kind: literal("widget"),
@@ -20364,7 +21140,13 @@ var NcAlarmModeDelaysListSchema = array(object({
20364
21140
  * Absent = false (logged, not sent). Even when true it is not sent when that same sensor
20365
21141
  * is the one that starts the entry delay — the entry-delay notification already names it.
20366
21142
  */
20367
- notifySensorRewatched: boolean().optional()
21143
+ notifySensorRewatched: boolean().optional(),
21144
+ /**
21145
+ * D735: notify "ignored" when a sensor this arm bypassed really MOVED while armed (its own
21146
+ * change time is after the arm) and set nothing off. Absent = false (logged, not sent). A
21147
+ * re-sync, a recovery from `unavailable` or a duplicate is never announced, switch or not.
21148
+ */
21149
+ notifySensorIgnored: boolean().optional()
20368
21150
  })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
20369
21151
  var NcAlarmModeDelaysEditListSchema = array(object({
20370
21152
  mode: AlarmArmModeSchema,
@@ -20377,7 +21159,9 @@ var NcAlarmModeDelaysEditListSchema = array(object({
20377
21159
  /** D706: set the switch, or `null` to clear it (back to the default, false). */
20378
21160
  notifyDuringEntryDelay: boolean().nullable().optional(),
20379
21161
  /** D706: set the switch, or `null` to clear it (back to the default, false). */
20380
- notifySensorRewatched: boolean().nullable().optional()
21162
+ notifySensorRewatched: boolean().nullable().optional(),
21163
+ /** D735: set the switch, or `null` to clear it (back to the default, false). */
21164
+ notifySensorIgnored: boolean().nullable().optional()
20381
21165
  })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
20382
21166
  /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
20383
21167
  var NcAlarmNonBlockingEditSchema = object({
@@ -21371,8 +22155,8 @@ Object.freeze(Object.fromEntries([{
21371
22155
  var CLUSTER_STEP_SETTING_FIELDS = [{
21372
22156
  stepId: "face-embedding",
21373
22157
  key: "minLandmarkFaceSize",
21374
- label: "Min face size for recognition (detection px)",
21375
- 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.",
22158
+ label: "Min face size to embed (detection-frame px)",
22159
+ 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.",
21376
22160
  type: "slider",
21377
22161
  min: 0,
21378
22162
  max: 64,
@@ -22345,8 +23129,23 @@ var RetrainMacroClassSchema = _enum([
22345
23129
  ]);
22346
23130
  /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
22347
23131
  var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
22348
- /** Did a human draw this box, or did the assist propose it? */
22349
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
23132
+ /**
23133
+ * Where a box came from. A machine-sourced box is a DRAFT on the page until
23134
+ * the operator confirms it; once saved it keeps its source as provenance.
23135
+ *
23136
+ * - `operator` — drawn by hand.
23137
+ * - `assist` — proposed by a detector run on the copy (the camera's own
23138
+ * model, or a larger teacher model).
23139
+ * - `pipeline` — the box the live pipeline actually drew on that frame, read
23140
+ * back from the track store (never a re-run).
23141
+ * - `llm` — proposed by a vision-capable LLM profile.
23142
+ */
23143
+ var RetrainAnnotationSourceSchema = _enum([
23144
+ "operator",
23145
+ "assist",
23146
+ "pipeline",
23147
+ "llm"
23148
+ ]);
22350
23149
  /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
22351
23150
  var RetrainBboxSchema = object({
22352
23151
  x: number(),
@@ -22364,7 +23163,8 @@ var RetrainBboxSchema = object({
22364
23163
  */
22365
23164
  var RetrainAnnotationSchema = object({
22366
23165
  id: string(),
22367
- trackId: string(),
23166
+ /** The frame's track. Absent on a recording still, which has none. */
23167
+ trackId: string().optional(),
22368
23168
  deviceId: number(),
22369
23169
  /** The COPY in retrain storage — never the source track's media key. */
22370
23170
  mediaKey: string(),
@@ -22413,18 +23213,63 @@ var RetrainFrameCandidateSchema = object({
22413
23213
  * fail, whatever became of the original. */
22414
23214
  copied: boolean()
22415
23215
  });
23216
+ /**
23217
+ * One box the live pipeline drew on a copied frame — what a correction starts
23218
+ * from. Derived when the frame is listed, from the track store: the subject
23219
+ * box recorded on the source media row when there is one, else the track
23220
+ * position nearest the frame's capture time. Never stored as an annotation
23221
+ * until the operator confirms it.
23222
+ */
23223
+ var RetrainPipelineBoxSchema = object({
23224
+ /** Normalised `[0,1]` against the full frame. */
23225
+ bbox: RetrainBboxSchema,
23226
+ macroClass: RetrainMacroClassSchema,
23227
+ label: string().optional(),
23228
+ subLabel: string().optional(),
23229
+ /** The detection score of the position used, when it was recorded. */
23230
+ score: number().optional(),
23231
+ /** The root model that produced the track, when it was recorded. */
23232
+ modelId: string().optional(),
23233
+ trackId: string(),
23234
+ /** `subject-box`: recorded on this very frame. `position`: the track's
23235
+ * position nearest the capture time, `deltaMs` away. */
23236
+ basis: _enum(["subject-box", "position"]),
23237
+ deltaMs: number()
23238
+ });
23239
+ /**
23240
+ * Where a retrain frame came from: a TRACK's stored media (copy-on-select),
23241
+ * or the RECORDING at an instant — the frame a model saw nothing in has no
23242
+ * track at all.
23243
+ */
23244
+ var RetrainFrameOriginSchema = _enum(["track", "recording"]);
22416
23245
  /** A frame the dataset OWNS: bytes copied at selection time. */
22417
23246
  var RetrainFrameSchema = object({
22418
23247
  frameId: string(),
22419
23248
  deviceId: number(),
22420
- trackId: string(),
22421
- /** Provenance only. It may already point at nothing — that is expected. */
22422
- sourceMediaId: number().int(),
23249
+ origin: RetrainFrameOriginSchema,
23250
+ /** The track it was copied from. Absent on a recording still. */
23251
+ trackId: string().optional(),
23252
+ /** Provenance only. It may already point at nothing — that is expected.
23253
+ * Absent on a recording still. */
23254
+ sourceMediaId: number().int().optional(),
23255
+ /** A recording still: the playhead instant it was taken at. */
23256
+ epochMs: number().optional(),
22423
23257
  sourceKind: MediaFileKindEnum,
22424
23258
  sizeBytes: number().int(),
22425
23259
  width: number().int(),
22426
23260
  height: number().int(),
22427
- copiedAt: number()
23261
+ copiedAt: number(),
23262
+ /** When the CAMERA captured the frame. Absent on a copy taken before D785. */
23263
+ capturedAt: number().optional(),
23264
+ /** The operator's "every subject in this frame is boxed". Detector
23265
+ * evaluation keeps only complete frames: an unboxed subject would count as
23266
+ * a false positive. */
23267
+ complete: boolean(),
23268
+ /** The boxes the pipeline drew on this frame. Present on list answers;
23269
+ * empty when nothing the track store holds can be placed on it. */
23270
+ pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
23271
+ /** The named collections this frame belongs to. Present on list answers. */
23272
+ collectionIds: array(string()).readonly().optional()
22428
23273
  });
22429
23274
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
22430
23275
  var RetrainCopyRefusalSchema = _enum([
@@ -22445,6 +23290,53 @@ var RetrainFrameListSchema = object({
22445
23290
  /** What the page pre-selects — the native key frame when one survives. */
22446
23291
  autoPickMediaId: number().int().optional()
22447
23292
  });
23293
+ /**
23294
+ * Which frames an annotated export carries. Every field narrows; an empty
23295
+ * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23296
+ * list owned by whoever trains (the training orchestrator), so `frameIds` is
23297
+ * the primitive a version export uses; `batchId` re-selects what an earlier
23298
+ * export carried (`exportedInBatch`).
23299
+ */
23300
+ var RetrainExportFilterSchema = object({
23301
+ deviceIds: array(number()).optional(),
23302
+ frameIds: array(string()).max(2e4).optional(),
23303
+ /** Only frames in at least one of these named collections. */
23304
+ collectionIds: array(string()).max(200).optional(),
23305
+ batchId: string().optional(),
23306
+ /** Only frames the operator marked complete (all subjects boxed). */
23307
+ completeOnly: boolean().optional()
23308
+ });
23309
+ /**
23310
+ * `frames`: the full frame copies, boxes in `annotations.json`.
23311
+ * `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
23312
+ * convention — the classifier layout.
23313
+ */
23314
+ var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
23315
+ /**
23316
+ * Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
23317
+ * the archive, sent chunk by chunk. Covers a presigned PUT and a provider
23318
+ * addon's data-plane upload route alike. Headers are sent verbatim and never
23319
+ * logged.
23320
+ */
23321
+ var RetrainArchiveTargetSchema = object({
23322
+ kind: literal("http"),
23323
+ method: _enum(["PUT", "POST"]),
23324
+ url: string().url(),
23325
+ headers: record(string(), string()).optional()
23326
+ });
23327
+ var RetrainArchiveResultSchema = object({
23328
+ batchId: string(),
23329
+ frames: number().int(),
23330
+ crops: number().int(),
23331
+ annotations: number().int(),
23332
+ /** Frames planned but not shipped (unreadable copy, path too long). */
23333
+ missing: number().int(),
23334
+ bytes: number().int(),
23335
+ /** sha256 of the exact bytes sent. */
23336
+ sha256: string(),
23337
+ /** The target's HTTP status. */
23338
+ status: number().int()
23339
+ });
22448
23340
  /** What the operator asked the assist to look for. */
22449
23341
  var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
22450
23342
  kind: literal("package"),
@@ -22474,6 +23366,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
22474
23366
  reason: string(),
22475
23367
  detail: string().optional()
22476
23368
  })]);
23369
+ /** A named set over the retrain corpus — membership only, it owns no pixels. */
23370
+ var RetrainCollectionSchema = object({
23371
+ id: string(),
23372
+ name: string(),
23373
+ createdAt: number(),
23374
+ frameCount: number().int()
23375
+ });
23376
+ var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
23377
+ kind: literal("created"),
23378
+ collection: RetrainCollectionSchema
23379
+ }), object({
23380
+ kind: literal("refused"),
23381
+ reason: _enum(["empty-name", "duplicate-name"])
23382
+ })]);
23383
+ var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
23384
+ kind: literal("renamed"),
23385
+ collection: RetrainCollectionSchema
23386
+ }), object({
23387
+ kind: literal("refused"),
23388
+ reason: _enum([
23389
+ "empty-name",
23390
+ "duplicate-name",
23391
+ "unknown-collection"
23392
+ ])
23393
+ })]);
23394
+ /**
23395
+ * The outcome of adding the frame at a recording instant. Every refusal is
23396
+ * named: `still-unavailable` (not recording, a gap, or an undecodable frame —
23397
+ * `detail` says which), `still-busy` (the recorder is at its decode bound; try
23398
+ * again), `unreadable-image`, `write-failed`, `unknown-collection`.
23399
+ */
23400
+ var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
23401
+ kind: literal("added"),
23402
+ collectionId: string(),
23403
+ frame: RetrainFrameSchema,
23404
+ /** The moment was already in the dataset; nothing was decoded. */
23405
+ reused: boolean()
23406
+ }), object({
23407
+ kind: literal("refused"),
23408
+ reason: _enum([
23409
+ "unknown-collection",
23410
+ "still-unavailable",
23411
+ "still-busy",
23412
+ "unreadable-image",
23413
+ "write-failed"
23414
+ ]),
23415
+ detail: string().optional()
23416
+ })]);
23417
+ /** A vision LLM profile the AI assist may use, and where it sends the frame. */
23418
+ var RetrainAssistProfileSchema = object({
23419
+ id: string(),
23420
+ name: string(),
23421
+ model: string(),
23422
+ kind: string(),
23423
+ /** `true` when the frame would leave the house (a cloud vendor, or an
23424
+ * endpoint that is not on the local network). The page confirms each such
23425
+ * run, and the provider refuses one without `allowCloud`. */
23426
+ leavesHouse: boolean()
23427
+ });
23428
+ /** A box the AI assist proposed: a draft, plus the model's own reason. */
23429
+ var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
23430
+ /** What the AI assist said about a box that was already on the canvas. */
23431
+ var RetrainLlmReviewSchema = object({
23432
+ /** The `ref` the page sent the box under. */
23433
+ ref: string(),
23434
+ verdict: _enum([
23435
+ "confirmed",
23436
+ "wrong-class",
23437
+ "not-an-object",
23438
+ "uncertain"
23439
+ ]),
23440
+ suggestedClass: RetrainMacroClassSchema.optional(),
23441
+ reason: string()
23442
+ });
23443
+ /**
23444
+ * The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
23445
+ * model and its confidence) and reviews; items the model got wrong (a box off
23446
+ * the frame, an unasked class, an unknown ref) are dropped and counted in
23447
+ * `rejected`. A whole answer that is not the schema is `malformed-answer`.
23448
+ */
23449
+ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23450
+ kind: literal("proposed"),
23451
+ profileId: string(),
23452
+ model: string(),
23453
+ /** The frame was sent outside the house for this answer. */
23454
+ leftHouse: boolean(),
23455
+ proposals: array(RetrainLlmProposalSchema).readonly(),
23456
+ reviews: array(RetrainLlmReviewSchema).readonly(),
23457
+ rejected: number().int()
23458
+ }), object({
23459
+ kind: literal("refused"),
23460
+ reason: _enum([
23461
+ "unknown-frame",
23462
+ "unreadable-frame",
23463
+ "unknown-profile",
23464
+ "profile-disabled",
23465
+ "no-vision",
23466
+ "cloud-not-confirmed",
23467
+ "llm-error",
23468
+ "malformed-answer"
23469
+ ]),
23470
+ detail: string().optional()
23471
+ })]);
22477
23472
  /** The outcome of a lifecycle move owned by the retrain page. */
22478
23473
  var RetrainTransitionResultSchema = object({
22479
23474
  trackId: string(),
@@ -23191,7 +24186,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23191
24186
  auth: "admin"
23192
24187
  }), method(object({
23193
24188
  deviceId: number(),
23194
- trackId: string(),
24189
+ trackId: string().optional(),
23195
24190
  frameId: string()
23196
24191
  }), object({
23197
24192
  removed: boolean(),
@@ -23208,7 +24203,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23208
24203
  auth: "admin"
23209
24204
  }), method(object({
23210
24205
  deviceId: number(),
23211
- trackId: string(),
24206
+ /** The frame's track, when it has one — checked against the frame. */
24207
+ trackId: string().optional(),
23212
24208
  frameId: string(),
23213
24209
  subject: RetrainAssistSubjectSchema,
23214
24210
  /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
@@ -23216,12 +24212,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23216
24212
  }), RetrainAssistResultSchema, {
23217
24213
  kind: "mutation",
23218
24214
  auth: "admin"
23219
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
24215
+ }), method(object({
24216
+ trackId: string().optional(),
24217
+ frameIds: array(string()).max(2e3).optional()
24218
+ }), array(RetrainAnnotationSchema).readonly(), {
23220
24219
  kind: "query",
23221
24220
  auth: "admin"
23222
24221
  }), method(object({
23223
24222
  deviceId: number(),
23224
- trackId: string(),
24223
+ /** The frame's track, when it has one — checked against the frame. */
24224
+ trackId: string().optional(),
23225
24225
  frameId: string(),
23226
24226
  annotations: array(RetrainAnnotationDraftSchema)
23227
24227
  }), array(RetrainAnnotationSchema).readonly(), {
@@ -23239,7 +24239,91 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23239
24239
  }), RetrainTransitionResultSchema, {
23240
24240
  kind: "mutation",
23241
24241
  auth: "admin"
23242
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
24242
+ }), method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string() }), {
24243
+ kind: "query",
24244
+ auth: "admin"
24245
+ }), method(object({
24246
+ deviceId: number(),
24247
+ trackId: string().optional(),
24248
+ frameId: string(),
24249
+ complete: boolean()
24250
+ }), RetrainFrameSchema, {
24251
+ kind: "mutation",
24252
+ auth: "admin"
24253
+ }), method(object({
24254
+ filter: RetrainExportFilterSchema,
24255
+ layout: RetrainExportLayoutSchema,
24256
+ target: RetrainArchiveTargetSchema
24257
+ }), RetrainArchiveResultSchema, {
24258
+ kind: "mutation",
24259
+ auth: "admin",
24260
+ timeoutMs: 60 * 6e4
24261
+ }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24262
+ kind: "query",
24263
+ auth: "admin"
24264
+ }), method(object({
24265
+ deviceId: number(),
24266
+ trackId: string().optional(),
24267
+ frameId: string(),
24268
+ profileId: string(),
24269
+ classes: array(RetrainMacroClassSchema).min(1),
24270
+ boxes: array(object({
24271
+ ref: string(),
24272
+ bbox: RetrainBboxSchema,
24273
+ macroClass: RetrainMacroClassSchema,
24274
+ label: string().optional()
24275
+ })).max(50),
24276
+ allowCloud: boolean()
24277
+ }), RetrainLlmAssistResultSchema, {
24278
+ kind: "mutation",
24279
+ auth: "admin",
24280
+ timeoutMs: 18e4
24281
+ }), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
24282
+ kind: "mutation",
24283
+ auth: "admin"
24284
+ }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24285
+ kind: "query",
24286
+ auth: "admin"
24287
+ }), method(object({
24288
+ id: string(),
24289
+ name: string().max(120)
24290
+ }), RetrainCollectionRenameResultSchema, {
24291
+ kind: "mutation",
24292
+ auth: "admin"
24293
+ }), method(object({ id: string() }), object({
24294
+ deleted: boolean(),
24295
+ removedFrames: number().int()
24296
+ }), {
24297
+ kind: "mutation",
24298
+ auth: "admin"
24299
+ }), method(object({
24300
+ collectionId: string(),
24301
+ deviceId: number(),
24302
+ epochMs: number()
24303
+ }), AddRetrainFrameFromRecordingResultSchema, {
24304
+ kind: "mutation",
24305
+ auth: "admin",
24306
+ timeoutMs: 6e4
24307
+ }), method(object({
24308
+ collectionId: string(),
24309
+ frameIds: array(string()).min(1).max(500)
24310
+ }), object({
24311
+ added: number().int(),
24312
+ alreadyMember: number().int(),
24313
+ unknownFrameIds: array(string()).readonly()
24314
+ }), {
24315
+ kind: "mutation",
24316
+ auth: "admin"
24317
+ }), method(object({
24318
+ collectionId: string(),
24319
+ frameId: string()
24320
+ }), object({
24321
+ removed: boolean(),
24322
+ deletedFrame: boolean()
24323
+ }), {
24324
+ kind: "mutation",
24325
+ auth: "admin"
24326
+ }), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
23243
24327
  kind: "query",
23244
24328
  auth: "admin"
23245
24329
  }), method(object({
@@ -23367,7 +24451,7 @@ var FrameRefSchema = object({
23367
24451
  timestamp: number(),
23368
24452
  capturedAt: number().optional()
23369
24453
  });
23370
- var ModelFormatSchema$1 = _enum([
24454
+ var ModelFormatSchema$2 = _enum([
23371
24455
  "onnx",
23372
24456
  "coreml",
23373
24457
  "openvino",
@@ -23385,7 +24469,7 @@ var PipelineSlotSchema = _enum([
23385
24469
  var PipelineEngineChoiceSchema = object({
23386
24470
  runtime: literal("python"),
23387
24471
  backend: string(),
23388
- format: ModelFormatSchema$1,
24472
+ format: ModelFormatSchema$2,
23389
24473
  device: string().optional()
23390
24474
  });
23391
24475
  /**
@@ -23424,28 +24508,10 @@ var PipelineDefaultStepSchema = lazy(() => object({
23424
24508
  group: string().optional(),
23425
24509
  settings: record(string(), unknown()).optional()
23426
24510
  }));
23427
- var PipelineTemplateStepSchema = lazy(() => object({
23428
- addonId: string(),
23429
- enabled: boolean(),
23430
- modelId: string(),
23431
- children: array(PipelineTemplateStepSchema).readonly(),
23432
- settings: record(string(), unknown()).optional()
23433
- }));
23434
- var PipelineTemplateSchema$1 = object({
23435
- id: string(),
23436
- name: string(),
23437
- createdAt: string(),
23438
- updatedAt: string(),
23439
- engine: PipelineEngineChoiceSchema,
23440
- steps: array(PipelineTemplateStepSchema).readonly()
23441
- });
23442
24511
  var PipelineModelOptionSchema = object({
23443
24512
  id: string(),
23444
24513
  name: string(),
23445
- formats: record(string(), object({
23446
- downloaded: boolean(),
23447
- sizeMB: number()
23448
- })),
24514
+ formats: record(string(), PipelineModelFormatStatusSchema),
23449
24515
  group: ModelVariantGroupSchema.optional(),
23450
24516
  legacy: boolean().optional(),
23451
24517
  provider: ModelProviderIdSchema.optional(),
@@ -23612,6 +24678,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
23612
24678
  }), {
23613
24679
  kind: "mutation",
23614
24680
  auth: "admin"
24681
+ }), method(object({
24682
+ nodeId: string(),
24683
+ deviceIds: array(number()).readonly().optional(),
24684
+ dryRun: boolean()
24685
+ }), object({
24686
+ entries: array(object({
24687
+ deviceId: number(),
24688
+ keys: array(string()).readonly()
24689
+ })).readonly(),
24690
+ refused: array(object({
24691
+ deviceId: number(),
24692
+ reason: string()
24693
+ })).readonly()
24694
+ }), {
24695
+ kind: "mutation",
24696
+ auth: "admin"
23615
24697
  }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
23616
24698
  /** `<backend>:<device>`, e.g. `openvino:gpu`. */
23617
24699
  deviceKey: string(),
@@ -23637,22 +24719,14 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
23637
24719
  }), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(object({
23638
24720
  steps: array(PipelineStepInputSchema),
23639
24721
  deviceKey: string().optional()
23640
- }), PipelineValidationResultSchema), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
23641
- name: string(),
23642
- steps: array(PipelineTemplateStepSchema).readonly(),
23643
- engine: PipelineEngineChoiceSchema
23644
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
23645
- id: string(),
23646
- name: string().optional(),
23647
- steps: array(PipelineTemplateStepSchema).readonly().optional()
23648
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
24722
+ }), PipelineValidationResultSchema), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
23649
24723
  addonId: string(),
23650
24724
  modelId: string(),
23651
- format: ModelFormatSchema$1
24725
+ format: ModelFormatSchema$2
23652
24726
  }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
23653
24727
  addonId: string(),
23654
24728
  modelId: string(),
23655
- format: ModelFormatSchema$1
24729
+ format: ModelFormatSchema$2
23656
24730
  }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
23657
24731
  steps: array(PipelineStepInputSchema).min(1),
23658
24732
  frame: FrameInputSchema.optional(),
@@ -23809,6 +24883,763 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
23809
24883
  filename: string().optional(),
23810
24884
  settings: record(string(), unknown()).optional()
23811
24885
  }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
24886
+ /**
24887
+ * The wire shapes of the Auto tune plan and apply (D745), used by the
24888
+ * `pipeline-orchestrator` cap. The recommender's own types
24889
+ * (`recommend.ts`) are the TS face of the same data; these
24890
+ * schemas are what crosses the cap boundary.
24891
+ */
24892
+ var ModelFormatSchema$1 = _enum(MODEL_FORMATS);
24893
+ /** The operator's range for it. */
24894
+ var MIN_SESSIONS_PER_DEVICE_RANGE = {
24895
+ min: 1,
24896
+ max: 8
24897
+ };
24898
+ var HardwareClassIdSchema = _enum([
24899
+ "intel-core-ultra",
24900
+ "intel-n-series",
24901
+ "apple-m-base",
24902
+ "apple-m-pro",
24903
+ "unknown"
24904
+ ]);
24905
+ var AcceleratorKindSchema = _enum([
24906
+ "intel-npu",
24907
+ "intel-igpu",
24908
+ "x86-cpu",
24909
+ "arm-cpu",
24910
+ "apple-ane",
24911
+ "coral"
24912
+ ]);
24913
+ var RecommendationReasonSchema = discriminatedUnion("kind", [
24914
+ object({
24915
+ kind: literal("capacity"),
24916
+ sessions: number(),
24917
+ minSessions: number()
24918
+ }),
24919
+ object({
24920
+ kind: literal("tie-faster"),
24921
+ over: string(),
24922
+ recallDelta: number()
24923
+ }),
24924
+ object({
24925
+ kind: literal("stepped-down"),
24926
+ from: string(),
24927
+ to: string(),
24928
+ limitedBy: string()
24929
+ }),
24930
+ object({
24931
+ kind: literal("no-fit-lightest"),
24932
+ sessions: number(),
24933
+ minSessions: number()
24934
+ }),
24935
+ object({
24936
+ kind: literal("derived-latency"),
24937
+ modelId: string()
24938
+ }),
24939
+ object({ kind: literal("cpu-device") }),
24940
+ object({ kind: literal("coral-untouched") }),
24941
+ object({ kind: literal("device-disabled") }),
24942
+ object({ kind: literal("device-unavailable") }),
24943
+ object({ kind: literal("node-offline") }),
24944
+ object({ kind: literal("no-hardware-facts") }),
24945
+ object({
24946
+ kind: literal("no-measured-data"),
24947
+ hardwareClass: HardwareClassIdSchema
24948
+ }),
24949
+ object({
24950
+ kind: literal("no-family-build"),
24951
+ format: ModelFormatSchema$1
24952
+ }),
24953
+ object({
24954
+ kind: literal("kept-custom-pin"),
24955
+ modelId: string(),
24956
+ deviceKey: string()
24957
+ })
24958
+ ]);
24959
+ /** Why a device is left exactly as it is, whatever the plan would pick (D786). */
24960
+ var KeptReasonSchema = _enum(["custom-pin"]);
24961
+ /**
24962
+ * Where a choice's latency came from (D791): this node's own benchmark
24963
+ * result, or the hardware-class table. Measured on the node beats the table.
24964
+ */
24965
+ var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
24966
+ kind: literal("node-benchmark"),
24967
+ resultId: string(),
24968
+ measuredAtMs: number()
24969
+ })]);
24970
+ var DeviceModelChoiceSchema = object({
24971
+ modelId: string(),
24972
+ p50Ms: number(),
24973
+ fps: number(),
24974
+ measured: boolean(),
24975
+ /** Absent on a plan from before D791 — read as the table. */
24976
+ source: LatencySourceSchema.optional(),
24977
+ /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
24978
+ capacitySessions: number(),
24979
+ personRecall: number()
24980
+ });
24981
+ var DeviceRecommendationSchema = object({
24982
+ deviceKey: string(),
24983
+ accelerator: AcceleratorKindSchema.nullable(),
24984
+ enabled: boolean(),
24985
+ available: boolean(),
24986
+ chosen: DeviceModelChoiceSchema.nullable(),
24987
+ /** Present when the device is kept as is: Apply writes nothing on it. */
24988
+ kept: KeptReasonSchema.optional(),
24989
+ reasons: array(RecommendationReasonSchema).readonly()
24990
+ });
24991
+ var NodeRecommendationSchema = object({
24992
+ nodeId: string(),
24993
+ reachable: boolean(),
24994
+ hardwareClass: HardwareClassIdSchema.nullable(),
24995
+ cpuModel: string().nullable(),
24996
+ skipped: boolean(),
24997
+ acceleratorModelId: string().nullable(),
24998
+ devices: array(DeviceRecommendationSchema).readonly(),
24999
+ reasons: array(RecommendationReasonSchema).readonly()
25000
+ });
25001
+ var ModelPinChangeSchema = object({
25002
+ stepId: string(),
25003
+ before: string().nullable(),
25004
+ after: string().nullable()
25005
+ });
25006
+ var NodeDeviceChangeSchema = object({
25007
+ nodeId: string(),
25008
+ deviceKey: string(),
25009
+ madeExplicit: boolean(),
25010
+ modelPins: array(ModelPinChangeSchema).readonly(),
25011
+ thresholds: array(object({
25012
+ stepId: string(),
25013
+ keys: array(string()).readonly()
25014
+ })).readonly()
25015
+ });
25016
+ var CameraOverrideClearSchema = object({
25017
+ deviceId: number(),
25018
+ source: _enum(["step-override", "wholesale"]),
25019
+ nodeId: string(),
25020
+ deviceKey: string().nullable(),
25021
+ stepId: string(),
25022
+ modelIdBefore: string().nullable(),
25023
+ keys: array(string()).readonly()
25024
+ });
25025
+ var DetectorStoreClearSchema = object({
25026
+ deviceId: number(),
25027
+ keys: array(string()).readonly()
25028
+ });
25029
+ var AutoTuneWarningSchema = discriminatedUnion("kind", [
25030
+ object({
25031
+ kind: literal("detector-store-cluster-wide"),
25032
+ skippedNodes: array(string()).readonly()
25033
+ }),
25034
+ object({
25035
+ kind: literal("detector-store-unreadable"),
25036
+ error: string()
25037
+ }),
25038
+ object({
25039
+ kind: literal("coral-enabled"),
25040
+ nodeId: string(),
25041
+ deviceKey: string()
25042
+ }),
25043
+ object({
25044
+ kind: literal("custom-pin-kept"),
25045
+ nodeId: string(),
25046
+ deviceKey: string().nullable(),
25047
+ deviceId: number().nullable(),
25048
+ modelId: string()
25049
+ }),
25050
+ object({
25051
+ kind: literal("custom-registry-unreadable"),
25052
+ error: string()
25053
+ })
25054
+ ]);
25055
+ var AutoTuneOptionsSchema = object({
25056
+ /** Share of each accelerator's throughput kept free (0.3–0.5). */
25057
+ headroom: number().min(.3).max(.5).default(.4),
25058
+ /**
25059
+ * The least number of parallel sessions every device must sustain at the
25060
+ * camera rate with the headroom kept free (D755). The most accurate model
25061
+ * that reaches it wins.
25062
+ */
25063
+ minSessionsPerDevice: number().int().min(MIN_SESSIONS_PER_DEVICE_RANGE.min).max(MIN_SESSIONS_PER_DEVICE_RANGE.max).default(2)
25064
+ });
25065
+ var AutoTunePlanSchema = object({
25066
+ /** Hash of everything the apply will write — the apply refuses a different one. */
25067
+ planHash: string(),
25068
+ family: literal("yolov9"),
25069
+ headroom: number(),
25070
+ minSessionsPerDevice: number(),
25071
+ /** The detection rate a session is counted at (the fastest camera running the pipeline root). */
25072
+ cameraFps: number(),
25073
+ generatedAt: number(),
25074
+ nodes: array(NodeRecommendationSchema).readonly(),
25075
+ nodeChanges: array(NodeDeviceChangeSchema).readonly(),
25076
+ cameraClears: array(CameraOverrideClearSchema).readonly(),
25077
+ detectorStoreClears: array(DetectorStoreClearSchema).readonly(),
25078
+ warnings: array(AutoTuneWarningSchema).readonly()
25079
+ });
25080
+ var AutoTuneApplyInputSchema = object({
25081
+ planHash: string(),
25082
+ headroom: number().min(.3).max(.5).default(.4),
25083
+ minSessionsPerDevice: number().int().min(MIN_SESSIONS_PER_DEVICE_RANGE.min).max(MIN_SESSIONS_PER_DEVICE_RANGE.max).default(2)
25084
+ });
25085
+ var AutoTunePhaseResultSchema = object({
25086
+ phase: _enum([
25087
+ "download",
25088
+ "camera-overrides",
25089
+ "detector-thresholds",
25090
+ "node-models",
25091
+ "redispatch"
25092
+ ]),
25093
+ ok: boolean(),
25094
+ detail: string()
25095
+ });
25096
+ var AutoTuneApplyResultSchema = discriminatedUnion("kind", [
25097
+ object({
25098
+ kind: literal("applied"),
25099
+ planHash: string(),
25100
+ phases: array(AutoTunePhaseResultSchema).readonly()
25101
+ }),
25102
+ object({
25103
+ kind: literal("aborted"),
25104
+ phases: array(AutoTunePhaseResultSchema).readonly()
25105
+ }),
25106
+ object({
25107
+ kind: literal("stale"),
25108
+ plan: AutoTunePlanSchema
25109
+ }),
25110
+ object({
25111
+ kind: literal("refused"),
25112
+ reason: _enum(["apply-in-progress"])
25113
+ })
25114
+ ]);
25115
+ /**
25116
+ * Wire shapes of the Load balancing surface (D748): the session placement
25117
+ * policy, the atomic share write, the observed placement statistics, the
25118
+ * hardware share suggestion and the stale device pins.
25119
+ */
25120
+ /**
25121
+ * How a new detection session picks its node and device.
25122
+ * - `least-loaded` — the historical rule: lowest `attached / weight`, a
25123
+ * constant node order at a tie (D37). An idle node always ties at 0, so a
25124
+ * weight only bites once a node already holds a session.
25125
+ * - `share` — the share of PARALLEL sessions is held to the weights, and a
25126
+ * full or drowning node yields to a free one (D748).
25127
+ */
25128
+ var SessionPlacementPolicySchema = _enum(["least-loaded", "share"]);
25129
+ var LoadBalancingSharesInputSchema = object({
25130
+ /** nodeId → share (> 0). A node left out keeps its weight. */
25131
+ nodes: record(string(), number().positive()).default({}),
25132
+ /** nodeId → deviceKey → share (> 0). A device left out keeps its weight. */
25133
+ devices: record(string(), record(string(), number().positive())).default({})
25134
+ });
25135
+ var PlacementStatsInputSchema = object({
25136
+ /** Window the observed shares are averaged over (default 1 h, max 24 h). */
25137
+ windowMs: number().int().min(6e4).max(1440 * 60 * 1e3).default(3600 * 1e3) });
25138
+ var PlacementDeviceStatsSchema = object({
25139
+ deviceKey: string(),
25140
+ /** Sessions running on this device now. */
25141
+ sessionsNow: number(),
25142
+ /** Sessions started on this device inside the window. */
25143
+ sessionsStarted: number(),
25144
+ /** Time-weighted share of the node's parallel sessions over the window (0–1); null = no session ran. */
25145
+ observedShare: number().nullable()
25146
+ });
25147
+ var PlacementNodeStatsSchema = object({
25148
+ nodeId: string(),
25149
+ sessionsNow: number(),
25150
+ sessionsStarted: number(),
25151
+ /** Time-weighted share of the cluster's parallel sessions over the window (0–1); null = none ran. */
25152
+ observedShare: number().nullable(),
25153
+ /** Most sessions this node ran at once inside the window. */
25154
+ peakSessions: number(),
25155
+ /** Sessions a share election handed elsewhere because this node was full or drowning. */
25156
+ yieldsAway: number(),
25157
+ devices: array(PlacementDeviceStatsSchema).readonly()
25158
+ });
25159
+ /** A camera's device pin that the session path cannot honour. */
25160
+ var StaleDevicePinSchema = object({
25161
+ deviceId: number(),
25162
+ deviceKey: string(),
25163
+ /** `disabled` — the key exists on some node but is not enabled anywhere; `absent` — no node has it. */
25164
+ reason: _enum(["disabled", "absent"])
25165
+ });
25166
+ var PlacementStatsSchema = object({
25167
+ policy: SessionPlacementPolicySchema,
25168
+ windowMs: number(),
25169
+ /** How much of the window was actually observed (the hub keeps it in memory). */
25170
+ observedForMs: number(),
25171
+ sessionsNow: number(),
25172
+ /** Most parallel sessions across the cluster inside the window. */
25173
+ clusterPeakSessions: number(),
25174
+ nodes: array(PlacementNodeStatsSchema).readonly(),
25175
+ stalePins: array(StaleDevicePinSchema).readonly()
25176
+ });
25177
+ /**
25178
+ * Where an automatic share's capacity comes from (D755).
25179
+ * - `hardware` — the static capacity of each device at its Auto tune model:
25180
+ * the measured latency table for the node's hardware class.
25181
+ * - `benchmark` — the node's own measured capacity (node benchmark results).
25182
+ * A node with no results falls back to `hardware`, and says so.
25183
+ */
25184
+ var CapacitySourceSchema = _enum(["hardware", "benchmark"]);
25185
+ /** Why a node under the `benchmark` source was sized from hardware instead. */
25186
+ var CapacityFallbackSchema = _enum(["no-benchmark-results", "partial-benchmark-results"]);
25187
+ var SuggestSharesInputSchema = object({
25188
+ headroom: number().min(.3).max(.5).default(.4),
25189
+ /** Default `hardware`. */
25190
+ source: CapacitySourceSchema.default("hardware")
25191
+ });
25192
+ var SuggestedDeviceShareSchema = object({
25193
+ deviceKey: string(),
25194
+ /** Share of the node (0–100, rounded). */
25195
+ share: number(),
25196
+ modelId: string().nullable(),
25197
+ /** Inferences per second at that model, from the measured table; null when sized by a benchmark. */
25198
+ fps: number().nullable(),
25199
+ /** False for a table cell derived from another chip; true for a measured cell or a benchmark. */
25200
+ measured: boolean(),
25201
+ /**
25202
+ * Advisory session cap: ⌊fps × (1 − headroom) / camera fps⌋ from the table,
25203
+ * or the benchmark's measured max sessions. Never enforced.
25204
+ */
25205
+ suggestedMaxSessions: number().nullable()
25206
+ });
25207
+ var SuggestedNodeShareSchema = object({
25208
+ nodeId: string(),
25209
+ /** Share of the cluster (0–100, rounded); null = node skipped (offline, unknown hardware). */
25210
+ share: number().nullable(),
25211
+ /** Parallel sessions the node sustains at the suggested models with the headroom kept free. */
25212
+ capacitySessions: number(),
25213
+ devices: array(SuggestedDeviceShareSchema).readonly(),
25214
+ skippedReason: string().nullable(),
25215
+ /** What this node's capacity was read from; null when the node is skipped. */
25216
+ capacitySource: CapacitySourceSchema.nullable(),
25217
+ /** Set when the `benchmark` source was asked for and this node used `hardware`. */
25218
+ capacityFallback: CapacityFallbackSchema.nullable()
25219
+ });
25220
+ var SuggestSharesResultSchema = object({
25221
+ headroom: number(),
25222
+ /** The source asked for; each node says what it actually used. */
25223
+ source: CapacitySourceSchema,
25224
+ /** Camera detection rate the capacity is counted in (the fastest camera's fps). */
25225
+ cameraFps: number(),
25226
+ /** The Auto tune capacity floor the models were picked at. */
25227
+ minSessionsPerDevice: number(),
25228
+ nodes: array(SuggestedNodeShareSchema).readonly()
25229
+ });
25230
+ /**
25231
+ * Where the node and device shares come from (D750, D755, D791).
25232
+ * - `benchmark` (default since D791) — each node's capacity as its own node
25233
+ * benchmark measured it; a node without fresh results is sized from
25234
+ * `hardware` and says so. Measured on the node beats the table.
25235
+ * - `hardware` — computed from each node's static capacity only (its
25236
+ * accelerators at their Auto tune models, from the latency table).
25237
+ * Both are recomputed whenever a node or device joins, leaves, is switched
25238
+ * on or off, changes model, or a benchmark result is written. No load input.
25239
+ * - `manual` — the operator's stored sliders.
25240
+ * Either way a node or device that cannot take sessions gives its share to
25241
+ * the others in proportion; the stored values are never rewritten for that.
25242
+ */
25243
+ var ShareSourceSchema = _enum([
25244
+ "hardware",
25245
+ "benchmark",
25246
+ "manual"
25247
+ ]);
25248
+ var SetShareSourceInputSchema = object({ source: ShareSourceSchema });
25249
+ object({
25250
+ nodes: record(string(), number()),
25251
+ devices: record(string(), record(string(), number()))
25252
+ });
25253
+ var EffectiveDeviceShareSchema = object({
25254
+ deviceKey: string(),
25255
+ /** Can take sessions now (enabled, available, can run the root). */
25256
+ eligible: boolean(),
25257
+ /** The share the source assigns, as a percentage of the node's devices. */
25258
+ configuredPct: number(),
25259
+ /** The share actually used, after an ineligible device's share went to the others. */
25260
+ effectivePct: number()
25261
+ });
25262
+ var EffectiveNodeShareSchema = object({
25263
+ nodeId: string(),
25264
+ eligible: boolean(),
25265
+ configuredPct: number(),
25266
+ effectivePct: number(),
25267
+ /** Automatic sources: what this node's share was computed from; null under `manual` or before the first answer. */
25268
+ capacitySource: CapacitySourceSchema.nullable(),
25269
+ /** Automatic `benchmark`: why this node used `hardware` instead. */
25270
+ capacityFallback: CapacityFallbackSchema.nullable(),
25271
+ devices: array(EffectiveDeviceShareSchema).readonly()
25272
+ });
25273
+ var EffectiveSharesSchema = object({
25274
+ source: ShareSourceSchema,
25275
+ policy: SessionPlacementPolicySchema,
25276
+ /** An automatic source with no computed answer yet: the stored sliders are used meanwhile. */
25277
+ autoPending: boolean(),
25278
+ /** When the automatic shares were last computed (ms epoch); null = never. */
25279
+ computedAt: number().nullable(),
25280
+ /** What made the system recompute them last. */
25281
+ trigger: string().nullable(),
25282
+ nodes: array(EffectiveNodeShareSchema).readonly(),
25283
+ /** The relative weights the election reads (before eligibility). */
25284
+ nodeWeights: record(string(), number()),
25285
+ deviceWeights: record(string(), record(string(), number()))
25286
+ });
25287
+ /**
25288
+ * Wire shapes of the node benchmark (D791): the operator's plan, the
25289
+ * preflight the confirmation shows, the run the orchestrator owns, what the
25290
+ * measuring runner reports, and the result rows Auto tune and the automatic
25291
+ * shares read.
25292
+ *
25293
+ * ONE node at a time, owned by the pipeline orchestrator. While a run is
25294
+ * active the cluster is in BENCHMARK MODE for that node: it is not a
25295
+ * detection candidate, camera pins naming it are ignored so its sessions move
25296
+ * elsewhere, and both come back when the mode ends — after a crash or a hub
25297
+ * restart too (a persisted manifest, reconciled against the registry).
25298
+ *
25299
+ * Two measurements, both on the node, driven by its own runner (frames never
25300
+ * cross a process at frame rate, D9):
25301
+ * - `device` — one accelerator × one candidate detector, root only, open
25302
+ * loop: how many streams at the camera rate it carries inside the frame
25303
+ * interval;
25304
+ * - `pipeline` — the chosen detector plus the operator's detail steps
25305
+ * (faces, plates, classifiers, CLIP…), on varied frames from the bench
25306
+ * clip: how many parallel sessions the node carries before latency, drops,
25307
+ * CPU, RAM or the event loop give out.
25308
+ */
25309
+ /** Defaults and bounds, one place. */
25310
+ var NODE_BENCHMARK_DEFAULTS = {
25311
+ fpsPerStream: 10,
25312
+ budgetMinutes: 45,
25313
+ minBudgetMinutes: 10,
25314
+ maxBudgetMinutes: 120,
25315
+ /** A result older than this no longer beats the table. */
25316
+ staleAfterDays: 30,
25317
+ /** Warm-in per ramp step (not accounted). */
25318
+ settleSec: 5,
25319
+ /** Accounted window per ramp step. */
25320
+ measureSec: 20,
25321
+ /** Longest the drain may take before the run is refused. */
25322
+ drainTimeoutSec: 120,
25323
+ /** Candidate models per device in one run. */
25324
+ maxModelsPerDevice: 6
25325
+ };
25326
+ /** The two measurements a run can make. */
25327
+ var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
25328
+ var NodeBenchmarkDevicePlanSchema = object({
25329
+ /** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
25330
+ deviceKey: string().min(1),
25331
+ /**
25332
+ * Root detector candidates for the `device` measurement, in the order
25333
+ * measured. The FIRST is the one the `pipeline` measurement runs.
25334
+ */
25335
+ modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
25336
+ });
25337
+ /** What the operator confirmed. */
25338
+ var NodeBenchmarkPlanSchema = object({
25339
+ nodeId: string().min(1),
25340
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25341
+ /** Which measurements run. At least one. */
25342
+ phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
25343
+ /**
25344
+ * Detail steps (catalog step ids under the root: faces, plates,
25345
+ * classifiers, CLIP…) the `pipeline` measurement enables. The root
25346
+ * detector always runs.
25347
+ */
25348
+ steps: array(string().min(1)).default([]),
25349
+ /** Offered rate of one stream / session. */
25350
+ fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
25351
+ /** Hard deadline: the mode ends and the cluster is restored when it passes. */
25352
+ budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
25353
+ /** Keep the models the run downloaded (default: delete what was not installed before). */
25354
+ keepDownloadedModels: boolean().default(false),
25355
+ /** Start although the other nodes' capacity does not cover the sessions running now. */
25356
+ acceptInsufficientHeadroom: boolean().default(false)
25357
+ });
25358
+ var NodeBenchmarkRefusalSchema = object({
25359
+ kind: _enum([
25360
+ "benchmark-active",
25361
+ "node-offline",
25362
+ "unknown-device",
25363
+ "no-phase",
25364
+ "insufficient-headroom"
25365
+ ]),
25366
+ detail: string(),
25367
+ overridable: boolean()
25368
+ });
25369
+ /** A camera whose detection leaves the node for the run. */
25370
+ var NodeBenchmarkMovingCameraSchema = object({
25371
+ deviceId: number(),
25372
+ /** Placed on the node now (a standing attach or a running session). */
25373
+ placedOnNode: boolean(),
25374
+ /** A node pin naming this node, ignored for the run. */
25375
+ pinnedToNode: boolean()
25376
+ });
25377
+ /** A camera that cannot leave: no other node can obtain its frames. */
25378
+ var NodeBenchmarkStayingCameraSchema = object({
25379
+ deviceId: number(),
25380
+ reason: literal("only-frame-source")
25381
+ });
25382
+ var NodeBenchmarkPreflightSchema = object({
25383
+ nodeId: string(),
25384
+ online: boolean(),
25385
+ moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
25386
+ /** Keep running on the node during the run; the result is flagged contaminated. */
25387
+ staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
25388
+ estimatedDurationMs: number(),
25389
+ /** The run ends and the cluster is restored at the latest after this long. */
25390
+ budgetMs: number(),
25391
+ phases: array(NodeBenchmarkPhaseSchema).readonly(),
25392
+ steps: array(string()).readonly(),
25393
+ devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
25394
+ /** Parallel sessions the cluster runs now, and what the other nodes can carry. */
25395
+ headroom: object({
25396
+ sessionsNow: number(),
25397
+ otherNodesCapacitySessions: number().nullable()
25398
+ }),
25399
+ refusals: array(NodeBenchmarkRefusalSchema).readonly(),
25400
+ canStart: boolean()
25401
+ });
25402
+ /** Where the measuring runner is. */
25403
+ var NodeBenchProgressSchema = object({
25404
+ phase: _enum([
25405
+ "preparing",
25406
+ "device",
25407
+ "pipeline",
25408
+ "cleanup"
25409
+ ]),
25410
+ deviceKey: string().nullable(),
25411
+ modelId: string().nullable(),
25412
+ /** Streams (device) or sessions (pipeline) of the step running now. */
25413
+ load: number().nullable(),
25414
+ cellsDone: number(),
25415
+ cellsTotal: number(),
25416
+ message: string()
25417
+ });
25418
+ /** What limited a ramp. `none` = the ramp ran out of steps still passing. */
25419
+ var NodeBenchLimitSchema = _enum([
25420
+ "p95",
25421
+ "drops",
25422
+ "errors",
25423
+ "stall",
25424
+ "cpu",
25425
+ "ram",
25426
+ "none"
25427
+ ]);
25428
+ var NodeBenchRampStepSchema = object({
25429
+ load: number(),
25430
+ pass: boolean(),
25431
+ p95Ms: number(),
25432
+ dropRatio: number(),
25433
+ /** Completed frames per second over the accounted window. */
25434
+ fps: number(),
25435
+ cpuPct: number().nullable(),
25436
+ ramFreePct: number().nullable(),
25437
+ failReasons: array(string()).readonly()
25438
+ });
25439
+ var NodeBenchCellSchema = discriminatedUnion("phase", [object({
25440
+ phase: literal("device"),
25441
+ deviceKey: string(),
25442
+ modelId: string(),
25443
+ /** Single-stream latency (the K = 1 step). */
25444
+ p50Ms: number(),
25445
+ p95Ms: number(),
25446
+ p99Ms: number(),
25447
+ /** Frames per second sustained at the last passing step. */
25448
+ fps: number(),
25449
+ /** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
25450
+ kMax: number(),
25451
+ limitedBy: NodeBenchLimitSchema,
25452
+ /** First call (model load + warm-up). */
25453
+ warmupMs: number(),
25454
+ ramp: array(NodeBenchRampStepSchema).readonly()
25455
+ }), object({
25456
+ phase: literal("pipeline"),
25457
+ deviceKey: string(),
25458
+ modelId: string(),
25459
+ steps: array(string()).readonly(),
25460
+ /** Parallel sessions at the camera rate the node carried; 0 = not even one. */
25461
+ maxSessions: number(),
25462
+ limitedBy: NodeBenchLimitSchema,
25463
+ /** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
25464
+ stepsFired: array(string()).readonly(),
25465
+ warmupMs: number(),
25466
+ ramp: array(NodeBenchRampStepSchema).readonly()
25467
+ })]);
25468
+ /**
25469
+ * What a result was measured ON. A result whose fingerprint no longer matches
25470
+ * the node no longer beats the table.
25471
+ */
25472
+ var NodeBenchFingerprintSchema = object({
25473
+ pipelineVersion: string().nullable(),
25474
+ cpuModel: string().nullable(),
25475
+ ramGb: number().nullable(),
25476
+ os: string().nullable(),
25477
+ /** Per device: the pool the cells ran on (runtime + tuning). */
25478
+ pools: record(string(), object({
25479
+ runtime: string(),
25480
+ numWorkers: number(),
25481
+ concurrency: number(),
25482
+ batchMode: string()
25483
+ })).default({})
25484
+ });
25485
+ /** The frames the run used. */
25486
+ var NodeBenchClipSchema = object({
25487
+ /** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
25488
+ id: string(),
25489
+ revision: string().nullable(),
25490
+ frames: number(),
25491
+ width: number(),
25492
+ height: number()
25493
+ });
25494
+ var NodeBenchRunnerInputSchema = object({
25495
+ runId: string().min(1),
25496
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25497
+ phases: array(NodeBenchmarkPhaseSchema).min(1),
25498
+ /** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
25499
+ steps: array(string()).default([]),
25500
+ fpsPerStream: number().int().min(1).max(30),
25501
+ /** The runner stops on its own past this instant, whatever the hub does. */
25502
+ deadlineAtMs: number(),
25503
+ settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
25504
+ measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
25505
+ keepDownloadedModels: boolean().default(false)
25506
+ });
25507
+ var NodeBenchRunnerStateSchema = _enum([
25508
+ "running",
25509
+ "done",
25510
+ "failed",
25511
+ "aborted"
25512
+ ]);
25513
+ var NodeBenchRunnerStatusSchema = object({
25514
+ runId: string(),
25515
+ nodeId: string(),
25516
+ state: NodeBenchRunnerStateSchema,
25517
+ progress: NodeBenchProgressSchema.nullable(),
25518
+ /** Every finished cell so far — a run stopped half way keeps what it measured. */
25519
+ cells: array(NodeBenchCellSchema).readonly(),
25520
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25521
+ clip: NodeBenchClipSchema.nullable(),
25522
+ /** Cameras seen running on the node during the run (they share its pools). */
25523
+ activeCameraIds: array(number()).readonly(),
25524
+ /** Models the run downloaded and then deleted (not installed before). */
25525
+ deletedModels: array(string()).readonly(),
25526
+ error: string().nullable(),
25527
+ startedAtMs: number(),
25528
+ finishedAtMs: number().nullable()
25529
+ });
25530
+ var NodeBenchmarkStateSchema = _enum([
25531
+ "draining",
25532
+ "measuring",
25533
+ "restoring",
25534
+ "done",
25535
+ "failed",
25536
+ "aborted"
25537
+ ]);
25538
+ /** Why a run ended. */
25539
+ var NodeBenchmarkEndReasonSchema = _enum([
25540
+ "completed",
25541
+ "operator-abort",
25542
+ "deadline",
25543
+ "node-lost",
25544
+ "runner-lost",
25545
+ "hub-restart",
25546
+ "drain-timeout",
25547
+ "failed"
25548
+ ]);
25549
+ var NodeBenchmarkRunSchema = object({
25550
+ runId: string(),
25551
+ nodeId: string(),
25552
+ state: NodeBenchmarkStateSchema,
25553
+ plan: NodeBenchmarkPlanSchema,
25554
+ startedAtMs: number(),
25555
+ deadlineAtMs: number(),
25556
+ finishedAtMs: number().nullable(),
25557
+ endReason: NodeBenchmarkEndReasonSchema.nullable(),
25558
+ error: string().nullable(),
25559
+ /** Cameras moved off the node for the run. */
25560
+ moved: array(number()).readonly(),
25561
+ /** Cameras that stayed (their only frame source is the node). */
25562
+ staying: array(number()).readonly(),
25563
+ /** Something else ran on the node's pools during the run. */
25564
+ contaminated: boolean(),
25565
+ progress: NodeBenchProgressSchema.nullable(),
25566
+ resultIds: array(string()).readonly()
25567
+ });
25568
+ /** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
25569
+ var NodeBenchmarkStatusSchema = object({
25570
+ /** The node the cluster is in benchmark mode for; null = none. */
25571
+ modeNodeId: string().nullable(),
25572
+ run: NodeBenchmarkRunSchema.nullable()
25573
+ });
25574
+ /**
25575
+ * One stored measurement — the only authority Auto tune and the automatic
25576
+ * shares read measured capacity from. Written by the orchestrator when a run
25577
+ * ends, never by anyone else.
25578
+ */
25579
+ var NodeBenchmarkResultSchema = object({
25580
+ id: string(),
25581
+ runId: string(),
25582
+ nodeId: string(),
25583
+ cell: NodeBenchCellSchema,
25584
+ fpsPerStream: number(),
25585
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25586
+ clip: NodeBenchClipSchema.nullable(),
25587
+ /** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
25588
+ contaminated: boolean(),
25589
+ stayingCameras: array(number()).readonly(),
25590
+ /** The run ended early; the cell itself completed. */
25591
+ partialRun: boolean(),
25592
+ measuredAtMs: number()
25593
+ });
25594
+ var ListNodeBenchmarkResultsInputSchema = object({
25595
+ nodeId: string().optional(),
25596
+ deviceKey: string().optional()
25597
+ });
25598
+ /** A result with its standing today: does it still beat the table? */
25599
+ var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
25600
+ /** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
25601
+ standing: _enum([
25602
+ "fresh",
25603
+ "stale",
25604
+ "superseded"
25605
+ ]),
25606
+ staleWhy: _enum([
25607
+ "age",
25608
+ "runtime",
25609
+ "pool-tuning"
25610
+ ]).nullable()
25611
+ });
25612
+ object({
25613
+ runId: string(),
25614
+ nodeId: string(),
25615
+ startedAtMs: number(),
25616
+ deadlineAtMs: number(),
25617
+ plan: NodeBenchmarkPlanSchema,
25618
+ moved: array(number()).readonly(),
25619
+ staying: array(number()).readonly()
25620
+ });
25621
+ /** Candidate detectors per device, for the plan editor. */
25622
+ var NodeBenchmarkCandidatesSchema = object({
25623
+ nodeId: string(),
25624
+ reachable: boolean(),
25625
+ devices: array(object({
25626
+ deviceKey: string(),
25627
+ enabled: boolean(),
25628
+ available: boolean(),
25629
+ /** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
25630
+ suggested: array(string()).readonly(),
25631
+ /** Every root detector the device has a build for. */
25632
+ all: array(string()).readonly(),
25633
+ /** The model the device runs now, when pinned. */
25634
+ currentModelId: string().nullable()
25635
+ })).readonly(),
25636
+ /** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
25637
+ steps: array(object({
25638
+ id: string(),
25639
+ name: string(),
25640
+ slot: string()
25641
+ })).readonly()
25642
+ });
23812
25643
  object({
23813
25644
  activeCameras: number(),
23814
25645
  throttledCameras: number(),
@@ -24686,14 +26517,15 @@ var RunnerLocalLoadSchema = object({
24686
26517
  * Per-inference-device live load (multi-device C4). One entry per deviceKey
24687
26518
  * this runner currently has attached cameras on, so the orchestrator's second
24688
26519
  * `balance()` pass (over a node's devices) weights on real per-pool session
24689
- * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
24690
- * per device is 0 until the pool backlog gets a public accessor (follow-up).
26520
+ * counts. Empty on single-device / pre-multi-device runners. There is no
26521
+ * per-device queue depth: the inference pool's backlog has no accessor, and
26522
+ * a field that always read 0 was removed rather than shown as a measurement
26523
+ * (D762).
24691
26524
  */
24692
26525
  devices: array(object({
24693
26526
  deviceKey: string(),
24694
26527
  backend: string(),
24695
- attachedCameras: number(),
24696
- queueDepthTotal: number()
26528
+ attachedCameras: number()
24697
26529
  })).default([]),
24698
26530
  /** Hardware capability flags reported by this node. */
24699
26531
  hardware: object({
@@ -24896,7 +26728,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
24896
26728
  }), ParkedTrackFrameSchema.nullable()), method(object({
24897
26729
  deviceId: number(),
24898
26730
  trackId: string()
24899
- }), object({ released: number().int().nonnegative() }), { kind: "mutation" });
26731
+ }), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
26732
+ accepted: literal(true),
26733
+ runId: string()
26734
+ }), {
26735
+ kind: "mutation",
26736
+ auth: "admin"
26737
+ }), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
26738
+ kind: "mutation",
26739
+ auth: "admin"
26740
+ });
24900
26741
  var CameraPipelineConfigSchema = object({
24901
26742
  engine: PipelineEngineChoiceSchema.optional(),
24902
26743
  steps: array(PipelineStepInputSchema).readonly(),
@@ -24907,14 +26748,6 @@ var CameraPipelineConfigSchema = object({
24907
26748
  settings: record(string(), unknown()).readonly().optional()
24908
26749
  }).nullable().optional()
24909
26750
  });
24910
- var PipelineTemplateSchema = object({
24911
- id: string(),
24912
- name: string(),
24913
- description: string().optional(),
24914
- config: CameraPipelineConfigSchema,
24915
- createdAt: string(),
24916
- updatedAt: string()
24917
- });
24918
26751
  var DeviceStepConfigSchema = object({
24919
26752
  modelId: string().optional(),
24920
26753
  settings: record(string(), unknown()).optional(),
@@ -24988,9 +26821,10 @@ var CameraStepOverridePatchSchema = object({
24988
26821
  modelId: string().optional(),
24989
26822
  settings: record(string(), unknown()).readonly().optional()
24990
26823
  });
26824
+ var CameraStepSettingsSchema = record(string(), record(string(), unknown()).readonly());
24991
26825
  var CameraPipelineSettingsSchema = object({
24992
- pinnedAgentNodeId: string().optional(),
24993
26826
  stepToggles: record(string(), boolean()).optional(),
26827
+ stepSettings: CameraStepSettingsSchema.optional(),
24994
26828
  stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
24995
26829
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
24996
26830
  });
@@ -25023,7 +26857,10 @@ var PipelineAssignmentSchema = object({
25023
26857
  });
25024
26858
  /**
25025
26859
  * Per-agent load summary surfaced to the load balancer + dashboards.
25026
- * Aggregated from each runner's `getLocalLoad` cap call.
26860
+ * Aggregated from each runner's `getLocalLoad` cap call. In the
26861
+ * `getAgentLoad` report, a single-device node's default-pool sessions (no
26862
+ * `deviceKey`) are credited to its one eligible device in `load.devices` —
26863
+ * the default pool IS that device (D745); the balancer's census stays raw.
25027
26864
  */
25028
26865
  var AgentLoadSummarySchema = object({
25029
26866
  nodeId: string(),
@@ -25112,26 +26949,27 @@ var CameraBrokerStatusSchema = object({
25112
26949
  width: number(),
25113
26950
  height: number(),
25114
26951
  subscribers: number(),
25115
- inFps: number(),
25116
- outFps: number()
26952
+ /**
26953
+ * Encoded packets/s the broker receives from the camera. null when the
26954
+ * broker's stats read failed — unknown, never 0 (a 0 here reads as a stall).
26955
+ * There is no output rate: decoding runs in the session decode workers, not
26956
+ * in the broker, so the broker's own decoded-frame rate is 0 on every live
26957
+ * camera and is not served (D758).
26958
+ */
26959
+ inFps: number().nullable()
25117
26960
  })).readonly(),
25118
26961
  webrtcSessions: number(),
25119
26962
  rtspRestream: boolean()
25120
26963
  });
25121
- /** Shared-memory ring statistics within the decoder block. */
25122
- var CameraDecoderShmSchema = object({
25123
- framesWritten: number(),
25124
- getFrameHits: number(),
25125
- getFrameMisses: number(),
25126
- budgetMb: number()
25127
- });
25128
- /** Decoder block — null when the decoder stage is unreachable or inactive. */
25129
- var CameraDecoderStatusSchema = object({
25130
- nodeId: string(),
25131
- formats: array(string()).readonly(),
25132
- sessionCount: number(),
25133
- shm: CameraDecoderShmSchema
25134
- });
26964
+ /**
26965
+ * Decoder block — WHERE decode runs (co-located with the detection node by
26966
+ * construction); null when the camera has no detection node. It carries no
26967
+ * frame counter: the shared-memory plane whose counters it used to serve is
26968
+ * gone, and those fields read 0 forever. Whether frames actually flow is read
26969
+ * from `detection.actualFps` (frames delivered to and processed by the
26970
+ * detector), never from a counter nothing feeds.
26971
+ */
26972
+ var CameraDecoderStatusSchema = object({ nodeId: string() });
25135
26973
  /** Motion block — null when motion detection is not active for this device. */
25136
26974
  var CameraMotionStatusSchema = object({
25137
26975
  enabled: boolean(),
@@ -25488,12 +27326,6 @@ method(object({
25488
27326
  }), object({ success: literal(true) }), {
25489
27327
  kind: "mutation",
25490
27328
  auth: "admin"
25491
- }), method(object({
25492
- agentNodeId: string(),
25493
- detectWeight: number().positive().nullable()
25494
- }), object({ success: literal(true) }), {
25495
- kind: "mutation",
25496
- auth: "admin"
25497
27329
  }), method(object({
25498
27330
  agentNodeId: string(),
25499
27331
  detect: boolean().nullable().optional(),
@@ -25535,6 +27367,30 @@ method(object({
25535
27367
  }), {
25536
27368
  kind: "mutation",
25537
27369
  auth: "admin"
27370
+ }), method(AutoTuneOptionsSchema, AutoTunePlanSchema, { auth: "admin" }), method(AutoTuneApplyInputSchema, AutoTuneApplyResultSchema, {
27371
+ kind: "mutation",
27372
+ auth: "admin"
27373
+ }), method(LoadBalancingSharesInputSchema, object({ success: literal(true) }), {
27374
+ kind: "mutation",
27375
+ auth: "admin"
27376
+ }), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
27377
+ kind: "mutation",
27378
+ auth: "admin"
27379
+ }), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
27380
+ kind: literal("started"),
27381
+ runId: string()
27382
+ }), object({
27383
+ kind: literal("refused"),
27384
+ preflight: NodeBenchmarkPreflightSchema
27385
+ })]), {
27386
+ kind: "mutation",
27387
+ auth: "admin"
27388
+ }), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
27389
+ kind: "mutation",
27390
+ auth: "admin"
27391
+ }), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
27392
+ kind: "mutation",
27393
+ auth: "admin"
25538
27394
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
25539
27395
  deviceId: number(),
25540
27396
  addonId: string(),
@@ -25551,6 +27407,13 @@ method(object({
25551
27407
  }), object({ success: literal(true) }), {
25552
27408
  kind: "mutation",
25553
27409
  auth: "admin"
27410
+ }), method(object({
27411
+ deviceId: number(),
27412
+ addonId: string(),
27413
+ settings: record(string(), unknown()).nullable()
27414
+ }), object({ success: literal(true) }), {
27415
+ kind: "mutation",
27416
+ auth: "admin"
25554
27417
  }), method(object({
25555
27418
  deviceId: number(),
25556
27419
  agentNodeId: string(),
@@ -25574,25 +27437,7 @@ method(object({
25574
27437
  }), method(_void(), DiskReconcileJobSchema, {
25575
27438
  kind: "mutation",
25576
27439
  auth: "admin"
25577
- }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
25578
- name: string(),
25579
- description: string().optional(),
25580
- config: CameraPipelineConfigSchema
25581
- }), PipelineTemplateSchema, {
25582
- kind: "mutation",
25583
- auth: "admin"
25584
- }), method(object({
25585
- id: string(),
25586
- name: string().optional(),
25587
- description: string().optional(),
25588
- config: CameraPipelineConfigSchema.optional()
25589
- }), PipelineTemplateSchema, {
25590
- kind: "mutation",
25591
- auth: "admin"
25592
- }), method(object({ id: string() }), object({ success: literal(true) }), {
25593
- kind: "mutation",
25594
- auth: "admin"
25595
- });
27440
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" });
25596
27441
  /**
25597
27442
  * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
25598
27443
  * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
@@ -26182,7 +28027,19 @@ var SsoBridgeClaimsSchema = object({
26182
28027
  * editing a descriptor must not retroactively extend or shorten a link the
26183
28028
  * operator already consented to.
26184
28029
  */
26185
- refreshTtl: union([number().int().positive(), literal("never")]).optional()
28030
+ refreshTtl: union([number().int().positive(), literal("never")]).optional(),
28031
+ /**
28032
+ * Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
28033
+ * that was started from a signed-in user's "Link" button: the finish then
28034
+ * links this identity to the intent's user instead of signing anyone in.
28035
+ * The handle carries no user id — the hub resolves it, single-use.
28036
+ */
28037
+ linkIntent: string().optional(),
28038
+ /**
28039
+ * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28040
+ * subject is unique only per issuer, so a link is bound to it.
28041
+ */
28042
+ issuer: string().optional()
26186
28043
  });
26187
28044
  method(object({
26188
28045
  claims: SsoBridgeClaimsSchema,
@@ -27812,8 +29669,6 @@ var WebrtcStreamChoiceSchema = object({
27812
29669
  ]).nullable(),
27813
29670
  /** Input FPS from the camera (null for adaptive). */
27814
29671
  inputFps: number().nullable(),
27815
- /** Decoded FPS (null for adaptive). */
27816
- decodeFps: number().nullable(),
27817
29672
  /** Bitrate in kbps (null for adaptive). */
27818
29673
  bitrateKbps: number().nullable()
27819
29674
  });
@@ -28090,7 +29945,22 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
28090
29945
  * field their hints were silently stripped by the schema and the
28091
29946
  * adaptive ladder started blind on the client's display size.
28092
29947
  */
28093
- hints: webrtcClientHintsSchema.optional()
29948
+ hints: webrtcClientHintsSchema.optional(),
29949
+ /**
29950
+ * Talk-back (D771): relay the PEER's audio to the device's speaker
29951
+ * through the `intercom` cap's push-talk triple. When `true` and the
29952
+ * offer lets the peer send audio, the answer's audio is `sendrecv`
29953
+ * and every inbound frame goes to `intercom.pushTalkAudio` for this
29954
+ * `deviceId`; absent/false answers `sendonly`, as for every viewer.
29955
+ *
29956
+ * TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
29957
+ * with `intercom`, when the linked user may control that camera. The
29958
+ * hub STRIPS it from every request-bound call (a browser), exactly as
29959
+ * it overwrites `relayOnly` — a viewer's talk permission is the
29960
+ * intercom cap's own surface (share tokens gate it there), and this
29961
+ * flag must not become a second door to the camera's speaker.
29962
+ */
29963
+ talkback: boolean().optional()
28094
29964
  }), object({
28095
29965
  sessionId: string(),
28096
29966
  sdpAnswer: string()
@@ -28392,6 +30262,59 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
28392
30262
  var RestartAddonResultSchema = unknown();
28393
30263
  var InstallPackageResultSchema = unknown();
28394
30264
  var ReloadPackagesResultSchema = unknown();
30265
+ /**
30266
+ * What an uninstall did on ONE node.
30267
+ * - `uninstalled` — removed: runner(s) stopped, caps gone, code deleted.
30268
+ * - `not-installed` — the node did not have it (nothing to do).
30269
+ * - `refused` — protected / bootstrap package; nothing touched.
30270
+ * - `failed` — attempted and did not complete; `error` says why.
30271
+ * - `pending-reconnect` — the node is OFFLINE: its record was pruned so the
30272
+ * back-fill never returns the package, and the stale-addon sweep removes the
30273
+ * copy when the node registers again (only once the hub no longer has it).
30274
+ */
30275
+ var UninstallNodeOutcomeSchema = _enum([
30276
+ "uninstalled",
30277
+ "not-installed",
30278
+ "refused",
30279
+ "failed",
30280
+ "pending-reconnect"
30281
+ ]);
30282
+ var UninstallNodeResultSchema = object({
30283
+ nodeId: string(),
30284
+ outcome: UninstallNodeOutcomeSchema,
30285
+ error: string().optional(),
30286
+ addonIds: array(string()).readonly(),
30287
+ runnersStopped: array(string()).readonly(),
30288
+ warnings: array(string()).readonly()
30289
+ });
30290
+ var UninstallPackageResultSchema = object({
30291
+ /** Every targeted node ended `uninstalled`, `not-installed` or `pending-reconnect`. */
30292
+ success: boolean(),
30293
+ packageName: string(),
30294
+ results: array(UninstallNodeResultSchema).readonly()
30295
+ });
30296
+ /**
30297
+ * `unreachable` lists online agents whose status read FAILED — absence from
30298
+ * `installations` is only "not installed" for a node that answered (D315).
30299
+ */
30300
+ var PackageInstallationsSchema = object({
30301
+ installations: array(object({
30302
+ packageName: string(),
30303
+ nodeId: string(),
30304
+ nodeName: string(),
30305
+ isHub: boolean(),
30306
+ isOnline: boolean(),
30307
+ version: string().nullable(),
30308
+ addonIds: array(string()).readonly(),
30309
+ source: _enum(["live", "recorded"]),
30310
+ /** The hub installs this package too. `false` on an agent row = an orphan. */
30311
+ onHub: boolean()
30312
+ })).readonly(),
30313
+ unreachable: array(object({
30314
+ nodeId: string(),
30315
+ error: string()
30316
+ })).readonly()
30317
+ });
28395
30318
  var BulkUpdateItemStatusSchema = _enum([
28396
30319
  "queued",
28397
30320
  "updating",
@@ -28474,10 +30397,14 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
28474
30397
  }), method(object({ packageName: string() }), InstallPackageResultSchema, {
28475
30398
  kind: "mutation",
28476
30399
  auth: "admin"
28477
- }), method(_void(), boolean()), method(_void(), array(unknown()).readonly()), method(object({ packageName: string() }), unknown(), {
30400
+ }), method(_void(), boolean()), method(_void(), array(unknown()).readonly()), method(object({
30401
+ packageName: string().min(1),
30402
+ nodeId: string().optional(),
30403
+ everywhere: boolean().optional()
30404
+ }), UninstallPackageResultSchema, {
28478
30405
  kind: "mutation",
28479
30406
  auth: "admin"
28480
- }), method(_void(), ReloadPackagesResultSchema, {
30407
+ }), method(object({ packageName: string().optional() }), PackageInstallationsSchema, { auth: "admin" }), method(_void(), ReloadPackagesResultSchema, {
28481
30408
  kind: "mutation",
28482
30409
  auth: "admin"
28483
30410
  }), method(object({ query: string().optional() }), array(SearchResultSchema)), method(object({ nodeId: string().optional() }), array(PackageUpdateSchema).readonly(), { auth: "admin" }), method(object({
@@ -30557,6 +32484,9 @@ var CreateIntegrationInputSchema = object({
30557
32484
  enabled: boolean().optional(),
30558
32485
  info: record(string(), unknown()).optional(),
30559
32486
  settings: record(string(), unknown()).optional(),
32487
+ /** Keys of `settings` the form's schema declares secret (by type) — kept in
32488
+ * the keychain, not the table (D787). */
32489
+ secretKeys: array(string()).optional(),
30560
32490
  skipRestart: boolean().optional()
30561
32491
  });
30562
32492
  var UpdateIntegrationInputSchema = object({
@@ -30580,7 +32510,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
30580
32510
  auth: "admin"
30581
32511
  }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
30582
32512
  id: string(),
30583
- settings: record(string(), unknown())
32513
+ settings: record(string(), unknown()),
32514
+ /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
32515
+ secretKeys: array(string()).optional()
30584
32516
  }), object({ success: boolean() }), {
30585
32517
  kind: "mutation",
30586
32518
  auth: "admin"
@@ -30910,7 +32842,7 @@ var GetConnectionEndpointsResultSchema = object({
30910
32842
  localPort: AdvertisedLocalPortSchema
30911
32843
  });
30912
32844
  /**
30913
- * The address flagged for notification links. `baseUrl: null` = AUTO, which
32845
+ * The address flagged for notification taps (`notificationTaps`). `baseUrl: null` = AUTO, which
30914
32846
  * since D709 is the CamStack app link; `resolved` reports the effective value,
30915
32847
  * so the UI can show it either way.
30916
32848
  */
@@ -30945,8 +32877,8 @@ var ViewerEndpointsSchema = object({
30945
32877
  });
30946
32878
  /**
30947
32879
  * DEPRECATED compatibility shape of `getHubAddresses` (D729 amendment, kept
30948
- * one release for addons built against it): `cluster` is the `agents` role,
30949
- * `browser` the `signIn` role; `override` is the flagged address.
32880
+ * for addons built against it): `cluster` is the `internal` role, `browser`
32881
+ * the `publicEndpoint` role; `override` is the flagged address.
30950
32882
  */
30951
32883
  var HubAddressSnapshotSchema = object({
30952
32884
  override: string().nullable(),
@@ -30962,15 +32894,11 @@ var HubAddressesSchema = object({
30962
32894
  browser: HubAddressSnapshotSchema
30963
32895
  });
30964
32896
  /**
30965
- * What an address is used for (`hub-address.ts`). `viewer` is many-valued;
30966
- * `notifications`, `agents` and `signIn` are carried by at most one address.
32897
+ * What an address is used for (`hub-address.ts`, D734). `appConnections` is
32898
+ * many-valued; `notificationTaps`, `publicEndpoint` and `internal` are carried
32899
+ * by at most one address.
30967
32900
  */
30968
- var HubAddressRoleSchema = _enum([
30969
- "viewer",
30970
- "notifications",
30971
- "agents",
30972
- "signIn"
30973
- ]);
32901
+ var HubAddressRoleSchema = _enum(HUB_ADDRESS_ROLES);
30974
32902
  var RoleSourceSchema = _enum([
30975
32903
  "flagged",
30976
32904
  "auto",
@@ -30984,8 +32912,8 @@ var HubAddressRoleResolutionSchema = object({
30984
32912
  resolved: string().nullable(),
30985
32913
  source: RoleSourceSchema
30986
32914
  });
30987
- var HubViewerResolutionSchema = object({
30988
- /** The addresses flagged `viewer`, or empty = automatic. */
32915
+ var HubAppConnectionsResolutionSchema = object({
32916
+ /** The addresses flagged `appConnections`, or empty = automatic. */
30989
32917
  flagged: array(string()).readonly(),
30990
32918
  /** What the apps race right now. */
30991
32919
  resolved: array(string()).readonly(),
@@ -31005,10 +32933,10 @@ var HubAddressBookSchema = object({
31005
32933
  eligible: array(HubAddressRoleSchema).readonly()
31006
32934
  })).readonly(),
31007
32935
  roles: object({
31008
- viewer: HubViewerResolutionSchema,
31009
- notifications: HubAddressRoleResolutionSchema,
31010
- agents: HubAddressRoleResolutionSchema,
31011
- signIn: HubAddressRoleResolutionSchema
32936
+ appConnections: HubAppConnectionsResolutionSchema,
32937
+ notificationTaps: HubAddressRoleResolutionSchema,
32938
+ internal: HubAddressRoleResolutionSchema,
32939
+ publicEndpoint: HubAddressRoleResolutionSchema
31012
32940
  }),
31013
32941
  /** The `hub=` an app link carries (D709), or null. */
31014
32942
  appLinkHub: string().nullable()
@@ -31056,7 +32984,7 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
31056
32984
  * tunnel always emits `https://` regardless. */
31057
32985
  scheme: _enum(["http", "https"]).optional(),
31058
32986
  /** Append the CamStack app link entry (`kind: 'app-link'`, D709) —
31059
- * an address notification links can be flagged with, not a hub
32987
+ * an address notification taps can be flagged with, not a hub
31060
32988
  * route. Default `false`: racers and rankers never see it. */
31061
32989
  includeAppLink: boolean().optional()
31062
32990
  }), 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({
@@ -36100,6 +38028,32 @@ var TotpStatusSchema = object({
36100
38028
  /** Null when no row exists OR the row is still pending confirmation. */
36101
38029
  confirmedAt: number().nullable()
36102
38030
  });
38031
+ /**
38032
+ * user-management — singleton capability for user accounts, API keys,
38033
+ * and scoped tokens.
38034
+ *
38035
+ * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
38036
+ * — the subset check on `setUserScopes` / `createScopedToken` is moot
38037
+ * because non-admins never reach these. If/when we open non-admin
38038
+ * delegation, structural caller-scope subset check goes inside the
38039
+ * provider.
38040
+ */
38041
+ var ExternalIdentitySchema = object({
38042
+ /** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
38043
+ provider: string(),
38044
+ /** The IdP's stable subject (`sub`) for this account. */
38045
+ subject: string(),
38046
+ /** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
38047
+ issuer: string(),
38048
+ userId: string(),
38049
+ /** What the IdP called the account at link time (username / email) — display only. */
38050
+ label: string().optional(),
38051
+ linkedAt: number()
38052
+ });
38053
+ var ExternalIdentityKeySchema = object({
38054
+ provider: string().min(1),
38055
+ subject: string().min(1)
38056
+ });
36103
38057
  method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
36104
38058
  kind: "mutation",
36105
38059
  auth: "admin",
@@ -36213,7 +38167,22 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
36213
38167
  userId: string(),
36214
38168
  username: string(),
36215
38169
  scopes: array(TokenScopeSchema)
36216
- }).nullable(), { access: "view" }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
38170
+ }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
38171
+ userId: string(),
38172
+ issuer: string()
38173
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
38174
+ userId: string(),
38175
+ issuer: string().min(1),
38176
+ label: string().optional()
38177
+ }), object({ success: literal(true) }), {
38178
+ kind: "mutation",
38179
+ auth: "admin",
38180
+ access: "create"
38181
+ }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
38182
+ kind: "mutation",
38183
+ auth: "admin",
38184
+ access: "delete"
38185
+ }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
36217
38186
  kind: "mutation",
36218
38187
  auth: "admin",
36219
38188
  access: "delete"
@@ -36605,6 +38574,16 @@ DeviceType.Camera, method(object({
36605
38574
  package: array(ZoneRuleSchema).readonly()
36606
38575
  });
36607
38576
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
38577
+ Object.freeze({
38578
+ person: .5,
38579
+ vehicle: .5,
38580
+ animal: .5
38581
+ });
38582
+ Object.freeze({
38583
+ person: .65,
38584
+ vehicle: .65,
38585
+ animal: .65
38586
+ });
36608
38587
  /**
36609
38588
  * Accessory device helpers — shared across drivers.
36610
38589
  *
@@ -36779,6 +38758,12 @@ Object.freeze({
36779
38758
  addonId: null,
36780
38759
  access: "view"
36781
38760
  },
38761
+ "addons.listInstallations": {
38762
+ capName: "addons",
38763
+ capScope: "system",
38764
+ addonId: null,
38765
+ access: "view"
38766
+ },
36782
38767
  "addons.listJobs": {
36783
38768
  capName: "addons",
36784
38769
  capScope: "system",
@@ -37961,90 +39946,18 @@ Object.freeze({
37961
39946
  addonId: null,
37962
39947
  access: "create"
37963
39948
  },
37964
- "decoder.createSession": {
37965
- capName: "decoder",
37966
- capScope: "system",
37967
- addonId: null,
37968
- access: "view"
37969
- },
37970
- "decoder.destroySession": {
37971
- capName: "decoder",
37972
- capScope: "system",
37973
- addonId: null,
37974
- access: "delete"
37975
- },
37976
- "decoder.getFrame": {
37977
- capName: "decoder",
37978
- capScope: "system",
37979
- addonId: null,
37980
- access: "view"
37981
- },
37982
39949
  "decoder.getInfo": {
37983
39950
  capName: "decoder",
37984
39951
  capScope: "system",
37985
39952
  addonId: null,
37986
39953
  access: "view"
37987
39954
  },
37988
- "decoder.getShmStats": {
37989
- capName: "decoder",
37990
- capScope: "system",
37991
- addonId: null,
37992
- access: "view"
37993
- },
37994
- "decoder.getStats": {
37995
- capName: "decoder",
37996
- capScope: "system",
37997
- addonId: null,
37998
- access: "view"
37999
- },
38000
- "decoder.listActiveSessions": {
38001
- capName: "decoder",
38002
- capScope: "system",
38003
- addonId: null,
38004
- access: "view"
38005
- },
38006
- "decoder.openStream": {
38007
- capName: "decoder",
38008
- capScope: "system",
38009
- addonId: null,
38010
- access: "view"
38011
- },
38012
- "decoder.pullFrames": {
38013
- capName: "decoder",
38014
- capScope: "system",
38015
- addonId: null,
38016
- access: "view"
38017
- },
38018
- "decoder.pullHandles": {
38019
- capName: "decoder",
38020
- capScope: "system",
38021
- addonId: null,
38022
- access: "view"
38023
- },
38024
- "decoder.pushPacket": {
38025
- capName: "decoder",
38026
- capScope: "system",
38027
- addonId: null,
38028
- access: "view"
38029
- },
38030
39955
  "decoder.reprobeHwaccel": {
38031
39956
  capName: "decoder",
38032
39957
  capScope: "system",
38033
39958
  addonId: null,
38034
39959
  access: "create"
38035
39960
  },
38036
- "decoder.supportsCodec": {
38037
- capName: "decoder",
38038
- capScope: "system",
38039
- addonId: null,
38040
- access: "view"
38041
- },
38042
- "decoder.updateConfig": {
38043
- capName: "decoder",
38044
- capScope: "system",
38045
- addonId: null,
38046
- access: "view"
38047
- },
38048
39961
  "detectionPipeline.applyDeviceSettingsPatch": {
38049
39962
  capName: "detection-pipeline",
38050
39963
  capScope: "device",
@@ -39311,6 +41224,90 @@ Object.freeze({
39311
41224
  addonId: null,
39312
41225
  access: "create"
39313
41226
  },
41227
+ "keychain.delete": {
41228
+ capName: "keychain",
41229
+ capScope: "system",
41230
+ addonId: null,
41231
+ access: "delete"
41232
+ },
41233
+ "keychain.getState": {
41234
+ capName: "keychain",
41235
+ capScope: "system",
41236
+ addonId: null,
41237
+ access: "view"
41238
+ },
41239
+ "keychain.listMeta": {
41240
+ capName: "keychain",
41241
+ capScope: "system",
41242
+ addonId: null,
41243
+ access: "view"
41244
+ },
41245
+ "keychain.put": {
41246
+ capName: "keychain",
41247
+ capScope: "system",
41248
+ addonId: null,
41249
+ access: "create"
41250
+ },
41251
+ "keychain.resolve": {
41252
+ capName: "keychain",
41253
+ capScope: "system",
41254
+ addonId: null,
41255
+ access: "view"
41256
+ },
41257
+ "keychainAdmin.deleteOrphans": {
41258
+ capName: "keychain-admin",
41259
+ capScope: "system",
41260
+ addonId: null,
41261
+ access: "delete"
41262
+ },
41263
+ "keychainAdmin.downloadRecoveryKey": {
41264
+ capName: "keychain-admin",
41265
+ capScope: "system",
41266
+ addonId: null,
41267
+ access: "create"
41268
+ },
41269
+ "keychainAdmin.listAudit": {
41270
+ capName: "keychain-admin",
41271
+ capScope: "system",
41272
+ addonId: null,
41273
+ access: "view"
41274
+ },
41275
+ "keychainAdmin.listSecrets": {
41276
+ capName: "keychain-admin",
41277
+ capScope: "system",
41278
+ addonId: null,
41279
+ access: "view"
41280
+ },
41281
+ "keychainAdmin.purgeRetiredKeys": {
41282
+ capName: "keychain-admin",
41283
+ capScope: "system",
41284
+ addonId: null,
41285
+ access: "delete"
41286
+ },
41287
+ "keychainAdmin.resetKeychain": {
41288
+ capName: "keychain-admin",
41289
+ capScope: "system",
41290
+ addonId: null,
41291
+ access: "delete"
41292
+ },
41293
+ "keychainAdmin.reveal": {
41294
+ capName: "keychain-admin",
41295
+ capScope: "system",
41296
+ addonId: null,
41297
+ access: "create"
41298
+ },
41299
+ "keychainAdmin.rotateMasterKey": {
41300
+ capName: "keychain-admin",
41301
+ capScope: "system",
41302
+ addonId: null,
41303
+ access: "create"
41304
+ },
41305
+ "keychainAdmin.status": {
41306
+ capName: "keychain-admin",
41307
+ capScope: "system",
41308
+ addonId: null,
41309
+ access: "view"
41310
+ },
39314
41311
  "lawnMowerControl.dock": {
39315
41312
  capName: "lawn-mower-control",
39316
41313
  capScope: "device",
@@ -40685,6 +42682,18 @@ Object.freeze({
40685
42682
  addonId: null,
40686
42683
  access: "create"
40687
42684
  },
42685
+ "pipelineAnalytics.addRetrainFrameFromRecording": {
42686
+ capName: "pipeline-analytics",
42687
+ capScope: "device",
42688
+ addonId: null,
42689
+ access: "create"
42690
+ },
42691
+ "pipelineAnalytics.addRetrainFramesToCollection": {
42692
+ capName: "pipeline-analytics",
42693
+ capScope: "device",
42694
+ addonId: null,
42695
+ access: "create"
42696
+ },
40688
42697
  "pipelineAnalytics.applyDeviceSettingsPatch": {
40689
42698
  capName: "pipeline-analytics",
40690
42699
  capScope: "device",
@@ -40733,12 +42742,24 @@ Object.freeze({
40733
42742
  addonId: null,
40734
42743
  access: "view"
40735
42744
  },
42745
+ "pipelineAnalytics.createRetrainCollection": {
42746
+ capName: "pipeline-analytics",
42747
+ capScope: "device",
42748
+ addonId: null,
42749
+ access: "create"
42750
+ },
40736
42751
  "pipelineAnalytics.deleteDeviceEvents": {
40737
42752
  capName: "pipeline-analytics",
40738
42753
  capScope: "device",
40739
42754
  addonId: null,
40740
42755
  access: "delete"
40741
42756
  },
42757
+ "pipelineAnalytics.deleteRetrainCollection": {
42758
+ capName: "pipeline-analytics",
42759
+ capScope: "device",
42760
+ addonId: null,
42761
+ access: "delete"
42762
+ },
40742
42763
  "pipelineAnalytics.deleteTracks": {
40743
42764
  capName: "pipeline-analytics",
40744
42765
  capScope: "device",
@@ -40943,6 +42964,24 @@ Object.freeze({
40943
42964
  addonId: null,
40944
42965
  access: "view"
40945
42966
  },
42967
+ "pipelineAnalytics.listRetrainAssistProfiles": {
42968
+ capName: "pipeline-analytics",
42969
+ capScope: "device",
42970
+ addonId: null,
42971
+ access: "view"
42972
+ },
42973
+ "pipelineAnalytics.listRetrainCollectionFrames": {
42974
+ capName: "pipeline-analytics",
42975
+ capScope: "device",
42976
+ addonId: null,
42977
+ access: "view"
42978
+ },
42979
+ "pipelineAnalytics.listRetrainCollections": {
42980
+ capName: "pipeline-analytics",
42981
+ capScope: "device",
42982
+ addonId: null,
42983
+ access: "view"
42984
+ },
40946
42985
  "pipelineAnalytics.listRetrainFrames": {
40947
42986
  capName: "pipeline-analytics",
40948
42987
  capScope: "device",
@@ -40991,6 +43030,12 @@ Object.freeze({
40991
43030
  addonId: null,
40992
43031
  access: "create"
40993
43032
  },
43033
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
43034
+ capName: "pipeline-analytics",
43035
+ capScope: "device",
43036
+ addonId: null,
43037
+ access: "create"
43038
+ },
40994
43039
  "pipelineAnalytics.pruneEvents": {
40995
43040
  capName: "pipeline-analytics",
40996
43041
  capScope: "device",
@@ -41045,6 +43090,18 @@ Object.freeze({
41045
43090
  addonId: null,
41046
43091
  access: "create"
41047
43092
  },
43093
+ "pipelineAnalytics.removeRetrainFrameFromCollection": {
43094
+ capName: "pipeline-analytics",
43095
+ capScope: "device",
43096
+ addonId: null,
43097
+ access: "delete"
43098
+ },
43099
+ "pipelineAnalytics.renameRetrainCollection": {
43100
+ capName: "pipeline-analytics",
43101
+ capScope: "device",
43102
+ addonId: null,
43103
+ access: "create"
43104
+ },
41048
43105
  "pipelineAnalytics.restageRetrainTrack": {
41049
43106
  capName: "pipeline-analytics",
41050
43107
  capScope: "device",
@@ -41075,6 +43132,12 @@ Object.freeze({
41075
43132
  addonId: null,
41076
43133
  access: "create"
41077
43134
  },
43135
+ "pipelineAnalytics.setRetrainFrameComplete": {
43136
+ capName: "pipeline-analytics",
43137
+ capScope: "device",
43138
+ addonId: null,
43139
+ access: "create"
43140
+ },
41078
43141
  "pipelineAnalytics.setTrackFlags": {
41079
43142
  capName: "pipeline-analytics",
41080
43143
  capScope: "device",
@@ -41111,6 +43174,12 @@ Object.freeze({
41111
43174
  addonId: null,
41112
43175
  access: "delete"
41113
43176
  },
43177
+ "pipelineAnalytics.writeRetrainArchive": {
43178
+ capName: "pipeline-analytics",
43179
+ capScope: "device",
43180
+ addonId: null,
43181
+ access: "create"
43182
+ },
41114
43183
  "pipelineExecutor.cacheFrameInPool": {
41115
43184
  capName: "pipeline-executor",
41116
43185
  capScope: "system",
@@ -41123,13 +43192,13 @@ Object.freeze({
41123
43192
  addonId: null,
41124
43193
  access: "delete"
41125
43194
  },
41126
- "pipelineExecutor.deleteModel": {
43195
+ "pipelineExecutor.clearModelBoundDeviceOverrides": {
41127
43196
  capName: "pipeline-executor",
41128
43197
  capScope: "system",
41129
43198
  addonId: null,
41130
43199
  access: "delete"
41131
43200
  },
41132
- "pipelineExecutor.deleteTemplate": {
43201
+ "pipelineExecutor.deleteModel": {
41133
43202
  capName: "pipeline-executor",
41134
43203
  capScope: "system",
41135
43204
  addonId: null,
@@ -41273,12 +43342,6 @@ Object.freeze({
41273
43342
  addonId: null,
41274
43343
  access: "view"
41275
43344
  },
41276
- "pipelineExecutor.listTemplates": {
41277
- capName: "pipeline-executor",
41278
- capScope: "system",
41279
- addonId: null,
41280
- access: "view"
41281
- },
41282
43345
  "pipelineExecutor.rearmInferenceDevice": {
41283
43346
  capName: "pipeline-executor",
41284
43347
  capScope: "system",
@@ -41303,12 +43366,6 @@ Object.freeze({
41303
43366
  addonId: null,
41304
43367
  access: "create"
41305
43368
  },
41306
- "pipelineExecutor.saveTemplate": {
41307
- capName: "pipeline-executor",
41308
- capScope: "system",
41309
- addonId: null,
41310
- access: "create"
41311
- },
41312
43369
  "pipelineExecutor.setVideoPipelineSteps": {
41313
43370
  capName: "pipeline-executor",
41314
43371
  capScope: "system",
@@ -41327,17 +43384,23 @@ Object.freeze({
41327
43384
  addonId: null,
41328
43385
  access: "create"
41329
43386
  },
41330
- "pipelineExecutor.updateTemplate": {
43387
+ "pipelineExecutor.validatePipeline": {
41331
43388
  capName: "pipeline-executor",
41332
43389
  capScope: "system",
41333
43390
  addonId: null,
43391
+ access: "view"
43392
+ },
43393
+ "pipelineOrchestrator.abortNodeBenchmark": {
43394
+ capName: "pipeline-orchestrator",
43395
+ capScope: "system",
43396
+ addonId: null,
41334
43397
  access: "create"
41335
43398
  },
41336
- "pipelineExecutor.validatePipeline": {
41337
- capName: "pipeline-executor",
43399
+ "pipelineOrchestrator.applyAutoTune": {
43400
+ capName: "pipeline-orchestrator",
41338
43401
  capScope: "system",
41339
43402
  addonId: null,
41340
- access: "view"
43403
+ access: "create"
41341
43404
  },
41342
43405
  "pipelineOrchestrator.applyDeviceSettingsPatch": {
41343
43406
  capName: "pipeline-orchestrator",
@@ -41357,7 +43420,7 @@ Object.freeze({
41357
43420
  addonId: null,
41358
43421
  access: "create"
41359
43422
  },
41360
- "pipelineOrchestrator.deleteTemplate": {
43423
+ "pipelineOrchestrator.deleteNodeBenchmarkResult": {
41361
43424
  capName: "pipeline-orchestrator",
41362
43425
  capScope: "system",
41363
43426
  addonId: null,
@@ -41453,6 +43516,12 @@ Object.freeze({
41453
43516
  addonId: null,
41454
43517
  access: "view"
41455
43518
  },
43519
+ "pipelineOrchestrator.getEffectiveShares": {
43520
+ capName: "pipeline-orchestrator",
43521
+ capScope: "system",
43522
+ addonId: null,
43523
+ access: "view"
43524
+ },
41456
43525
  "pipelineOrchestrator.getGlobalMetrics": {
41457
43526
  capName: "pipeline-orchestrator",
41458
43527
  capScope: "system",
@@ -41465,6 +43534,24 @@ Object.freeze({
41465
43534
  addonId: null,
41466
43535
  access: "view"
41467
43536
  },
43537
+ "pipelineOrchestrator.getNodeBenchmarkCandidates": {
43538
+ capName: "pipeline-orchestrator",
43539
+ capScope: "system",
43540
+ addonId: null,
43541
+ access: "view"
43542
+ },
43543
+ "pipelineOrchestrator.getNodeBenchmarkPreflight": {
43544
+ capName: "pipeline-orchestrator",
43545
+ capScope: "system",
43546
+ addonId: null,
43547
+ access: "view"
43548
+ },
43549
+ "pipelineOrchestrator.getNodeBenchmarkStatus": {
43550
+ capName: "pipeline-orchestrator",
43551
+ capScope: "system",
43552
+ addonId: null,
43553
+ access: "view"
43554
+ },
41468
43555
  "pipelineOrchestrator.getNodeInferenceDevices": {
41469
43556
  capName: "pipeline-orchestrator",
41470
43557
  capScope: "system",
@@ -41489,6 +43576,12 @@ Object.freeze({
41489
43576
  addonId: null,
41490
43577
  access: "view"
41491
43578
  },
43579
+ "pipelineOrchestrator.getPlacementStats": {
43580
+ capName: "pipeline-orchestrator",
43581
+ capScope: "system",
43582
+ addonId: null,
43583
+ access: "view"
43584
+ },
41492
43585
  "pipelineOrchestrator.getReconcileFromDiskStatus": {
41493
43586
  capName: "pipeline-orchestrator",
41494
43587
  capScope: "system",
@@ -41501,7 +43594,7 @@ Object.freeze({
41501
43594
  addonId: null,
41502
43595
  access: "view"
41503
43596
  },
41504
- "pipelineOrchestrator.listTemplates": {
43597
+ "pipelineOrchestrator.listNodeBenchmarkResults": {
41505
43598
  capName: "pipeline-orchestrator",
41506
43599
  capScope: "system",
41507
43600
  addonId: null,
@@ -41513,6 +43606,12 @@ Object.freeze({
41513
43606
  addonId: null,
41514
43607
  access: "create"
41515
43608
  },
43609
+ "pipelineOrchestrator.planAutoTune": {
43610
+ capName: "pipeline-orchestrator",
43611
+ capScope: "system",
43612
+ addonId: null,
43613
+ access: "view"
43614
+ },
41516
43615
  "pipelineOrchestrator.rebalance": {
41517
43616
  capName: "pipeline-orchestrator",
41518
43617
  capScope: "system",
@@ -41555,12 +43654,6 @@ Object.freeze({
41555
43654
  addonId: null,
41556
43655
  access: "create"
41557
43656
  },
41558
- "pipelineOrchestrator.saveTemplate": {
41559
- capName: "pipeline-orchestrator",
41560
- capScope: "system",
41561
- addonId: null,
41562
- access: "create"
41563
- },
41564
43657
  "pipelineOrchestrator.setAgentCapabilities": {
41565
43658
  capName: "pipeline-orchestrator",
41566
43659
  capScope: "system",
@@ -41573,12 +43666,6 @@ Object.freeze({
41573
43666
  addonId: null,
41574
43667
  access: "create"
41575
43668
  },
41576
- "pipelineOrchestrator.setAgentDetectWeight": {
41577
- capName: "pipeline-orchestrator",
41578
- capScope: "system",
41579
- addonId: null,
41580
- access: "create"
41581
- },
41582
43669
  "pipelineOrchestrator.setAgentInferenceDevices": {
41583
43670
  capName: "pipeline-orchestrator",
41584
43671
  capScope: "system",
@@ -41615,6 +43702,12 @@ Object.freeze({
41615
43702
  addonId: null,
41616
43703
  access: "create"
41617
43704
  },
43705
+ "pipelineOrchestrator.setCameraStepSettings": {
43706
+ capName: "pipeline-orchestrator",
43707
+ capScope: "system",
43708
+ addonId: null,
43709
+ access: "create"
43710
+ },
41618
43711
  "pipelineOrchestrator.setCameraStepToggle": {
41619
43712
  capName: "pipeline-orchestrator",
41620
43713
  capScope: "system",
@@ -41633,12 +43726,36 @@ Object.freeze({
41633
43726
  addonId: null,
41634
43727
  access: "create"
41635
43728
  },
43729
+ "pipelineOrchestrator.setLoadBalancingShares": {
43730
+ capName: "pipeline-orchestrator",
43731
+ capScope: "system",
43732
+ addonId: null,
43733
+ access: "create"
43734
+ },
41636
43735
  "pipelineOrchestrator.setPipelineDevicePin": {
41637
43736
  capName: "pipeline-orchestrator",
41638
43737
  capScope: "system",
41639
43738
  addonId: null,
41640
43739
  access: "create"
41641
43740
  },
43741
+ "pipelineOrchestrator.setShareSource": {
43742
+ capName: "pipeline-orchestrator",
43743
+ capScope: "system",
43744
+ addonId: null,
43745
+ access: "create"
43746
+ },
43747
+ "pipelineOrchestrator.startNodeBenchmark": {
43748
+ capName: "pipeline-orchestrator",
43749
+ capScope: "system",
43750
+ addonId: null,
43751
+ access: "create"
43752
+ },
43753
+ "pipelineOrchestrator.suggestShares": {
43754
+ capName: "pipeline-orchestrator",
43755
+ capScope: "system",
43756
+ addonId: null,
43757
+ access: "view"
43758
+ },
41642
43759
  "pipelineOrchestrator.unassignAudio": {
41643
43760
  capName: "pipeline-orchestrator",
41644
43761
  capScope: "system",
@@ -41651,8 +43768,8 @@ Object.freeze({
41651
43768
  addonId: null,
41652
43769
  access: "create"
41653
43770
  },
41654
- "pipelineOrchestrator.updateTemplate": {
41655
- capName: "pipeline-orchestrator",
43771
+ "pipelineRunner.abortNodeBench": {
43772
+ capName: "pipeline-runner",
41656
43773
  capScope: "system",
41657
43774
  addonId: null,
41658
43775
  access: "create"
@@ -41705,6 +43822,12 @@ Object.freeze({
41705
43822
  addonId: null,
41706
43823
  access: "view"
41707
43824
  },
43825
+ "pipelineRunner.getNodeBenchStatus": {
43826
+ capName: "pipeline-runner",
43827
+ capScope: "system",
43828
+ addonId: null,
43829
+ access: "view"
43830
+ },
41708
43831
  "pipelineRunner.getParkedTrackFrame": {
41709
43832
  capName: "pipeline-runner",
41710
43833
  capScope: "system",
@@ -41747,6 +43870,12 @@ Object.freeze({
41747
43870
  addonId: null,
41748
43871
  access: "create"
41749
43872
  },
43873
+ "pipelineRunner.startNodeBench": {
43874
+ capName: "pipeline-runner",
43875
+ capScope: "system",
43876
+ addonId: null,
43877
+ access: "create"
43878
+ },
41750
43879
  "plateGallery.assignPlate": {
41751
43880
  capName: "plate-gallery",
41752
43881
  capScope: "system",
@@ -43091,12 +45220,6 @@ Object.freeze({
43091
45220
  addonId: null,
43092
45221
  access: "view"
43093
45222
  },
43094
- "streamBroker.pullFrameHandles": {
43095
- capName: "stream-broker",
43096
- capScope: "system",
43097
- addonId: null,
43098
- access: "view"
43099
- },
43100
45223
  "streamBroker.regenerateRtspToken": {
43101
45224
  capName: "stream-broker",
43102
45225
  capScope: "system",
@@ -43163,12 +45286,6 @@ Object.freeze({
43163
45286
  addonId: null,
43164
45287
  access: "create"
43165
45288
  },
43166
- "streamBroker.subscribeFrames": {
43167
- capName: "stream-broker",
43168
- capScope: "system",
43169
- addonId: null,
43170
- access: "create"
43171
- },
43172
45289
  "streamBroker.unassignProfile": {
43173
45290
  capName: "stream-broker",
43174
45291
  capScope: "system",
@@ -43181,12 +45298,6 @@ Object.freeze({
43181
45298
  addonId: null,
43182
45299
  access: "create"
43183
45300
  },
43184
- "streamBroker.unsubscribeFrames": {
43185
- capName: "stream-broker",
43186
- capScope: "system",
43187
- addonId: null,
43188
- access: "create"
43189
- },
43190
45301
  "streamCatalog.getCatalog": {
43191
45302
  capName: "stream-catalog",
43192
45303
  capScope: "device",
@@ -43481,18 +45592,36 @@ Object.freeze({
43481
45592
  addonId: null,
43482
45593
  access: "delete"
43483
45594
  },
45595
+ "userManagement.findUserByExternalIdentity": {
45596
+ capName: "user-management",
45597
+ capScope: "system",
45598
+ addonId: null,
45599
+ access: "view"
45600
+ },
43484
45601
  "userManagement.getTotpStatus": {
43485
45602
  capName: "user-management",
43486
45603
  capScope: "system",
43487
45604
  addonId: null,
43488
45605
  access: "view"
43489
45606
  },
45607
+ "userManagement.linkExternalIdentity": {
45608
+ capName: "user-management",
45609
+ capScope: "system",
45610
+ addonId: null,
45611
+ access: "create"
45612
+ },
43490
45613
  "userManagement.listApiKeys": {
43491
45614
  capName: "user-management",
43492
45615
  capScope: "system",
43493
45616
  addonId: null,
43494
45617
  access: "view"
43495
45618
  },
45619
+ "userManagement.listExternalIdentities": {
45620
+ capName: "user-management",
45621
+ capScope: "system",
45622
+ addonId: null,
45623
+ access: "view"
45624
+ },
43496
45625
  "userManagement.listOauthSessions": {
43497
45626
  capName: "user-management",
43498
45627
  capScope: "system",
@@ -43571,6 +45700,12 @@ Object.freeze({
43571
45700
  addonId: null,
43572
45701
  access: "create"
43573
45702
  },
45703
+ "userManagement.unlinkExternalIdentity": {
45704
+ capName: "user-management",
45705
+ capScope: "system",
45706
+ addonId: null,
45707
+ access: "delete"
45708
+ },
43574
45709
  "userManagement.updateUser": {
43575
45710
  capName: "user-management",
43576
45711
  capScope: "system",
@@ -45700,11 +47835,6 @@ Object.freeze({
45700
47835
  form: "single",
45701
47836
  optional: false
45702
47837
  }],
45703
- "decoder.createSession": [{
45704
- name: "deviceId",
45705
- form: "single",
45706
- optional: true
45707
- }],
45708
47838
  "detectionPipeline.applyDeviceSettingsPatch": [{
45709
47839
  name: "deviceId",
45710
47840
  form: "single",
@@ -46675,6 +48805,11 @@ Object.freeze({
46675
48805
  form: "single",
46676
48806
  optional: false
46677
48807
  }],
48808
+ "pipelineAnalytics.addRetrainFrameFromRecording": [{
48809
+ name: "deviceId",
48810
+ form: "single",
48811
+ optional: false
48812
+ }],
46678
48813
  "pipelineAnalytics.applyDeviceSettingsPatch": [{
46679
48814
  name: "deviceId",
46680
48815
  form: "single",
@@ -46865,6 +49000,11 @@ Object.freeze({
46865
49000
  form: "single",
46866
49001
  optional: false
46867
49002
  }],
49003
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
49004
+ name: "deviceId",
49005
+ form: "single",
49006
+ optional: false
49007
+ }],
46868
49008
  "pipelineAnalytics.pruneEventsBefore": [{
46869
49009
  name: "deviceId",
46870
49010
  form: "single",
@@ -46915,6 +49055,11 @@ Object.freeze({
46915
49055
  form: "single",
46916
49056
  optional: false
46917
49057
  }],
49058
+ "pipelineAnalytics.setRetrainFrameComplete": [{
49059
+ name: "deviceId",
49060
+ form: "single",
49061
+ optional: false
49062
+ }],
46918
49063
  "pipelineAnalytics.setTrackFlags": [{
46919
49064
  name: "deviceId",
46920
49065
  form: "single",
@@ -46935,6 +49080,11 @@ Object.freeze({
46935
49080
  form: "single",
46936
49081
  optional: false
46937
49082
  }],
49083
+ "pipelineExecutor.clearModelBoundDeviceOverrides": [{
49084
+ name: "deviceIds",
49085
+ form: "array",
49086
+ optional: true
49087
+ }],
46938
49088
  "pipelineExecutor.runPipeline": [{
46939
49089
  name: "deviceId",
46940
49090
  form: "single",
@@ -47040,6 +49190,11 @@ Object.freeze({
47040
49190
  form: "single",
47041
49191
  optional: false
47042
49192
  }],
49193
+ "pipelineOrchestrator.setCameraStepSettings": [{
49194
+ name: "deviceId",
49195
+ form: "single",
49196
+ optional: false
49197
+ }],
47043
49198
  "pipelineOrchestrator.setCameraStepToggle": [{
47044
49199
  name: "deviceId",
47045
49200
  form: "single",
@@ -48960,10 +51115,11 @@ var MB = 1024 * 1024;
48960
51115
  /**
48961
51116
  * Google Home export — customActions catalog.
48962
51117
  *
48963
- * One entry. The settings form's `type: 'button'` field dispatches through the
48964
- * generic `api.addons.custom.mutate({ addonId, action, input })` channel, so a
48965
- * button here costs no capability, no codegen and no framework publish train —
48966
- * the catalog travels inside this addon's own bundle.
51118
+ * One entry. The settings form's `addon-action-button` dispatches through the
51119
+ * generic `api.addons.custom.mutate({ addonId, action, input })` channel and
51120
+ * shows the result under the button, so a button here costs no capability, no
51121
+ * codegen and no framework publish train — the catalog travels inside this
51122
+ * addon's own bundle. Admin-only: it writes this addon's settings.
48967
51123
  */
48968
51124
  var exportGoogleActions = defineCustomActions({
48969
51125
  /**
@@ -48979,8 +51135,13 @@ var exportGoogleActions = defineCustomActions({
48979
51135
  detectPublicHubUrl: customAction(object({}).optional(), object({
48980
51136
  publicHubUrl: string(),
48981
51137
  detectedPublicHubUrl: string(),
48982
- filled: boolean()
48983
- }), { kind: "mutation" }) });
51138
+ filled: boolean(),
51139
+ /** One sentence saying what happened, for the button. */
51140
+ summary: string()
51141
+ }), {
51142
+ kind: "mutation",
51143
+ auth: "admin"
51144
+ }) });
48984
51145
  //#endregion
48985
51146
  //#region src/google-home/trait-catalog.ts
48986
51147
  /**
@@ -50009,6 +52170,14 @@ var refreshPublicHubUrl = async (deps) => {
50009
52170
  else if (resolution.publicHubUrl.length === 0) deps.logger.warn("export-google: public hub URL still unset after detection — the Google console URLs cannot be rendered until one is available", { meta: { detectedCount: detected.length } });
50010
52171
  return resolution;
50011
52172
  };
52173
+ /** What "Detect external address" did, in one sentence for the button. */
52174
+ function describeDetectResult(result) {
52175
+ const { publicHubUrl, detectedPublicHubUrl, filled } = result;
52176
+ if (filled) return `Filled in ${publicHubUrl}.`;
52177
+ if (detectedPublicHubUrl.length === 0) return publicHubUrl.length > 0 ? `No public HTTPS address detected; your value ${publicHubUrl} was kept.` : "No public HTTPS address detected. Set up remote access first.";
52178
+ if (detectedPublicHubUrl === publicHubUrl) return `Detected ${publicHubUrl}, already in use.`;
52179
+ return `Detected ${detectedPublicHubUrl}; your value ${publicHubUrl} was kept.`;
52180
+ }
50012
52181
  //#endregion
50013
52182
  //#region src/types.ts
50014
52183
  var DEFAULT_SETTINGS = {
@@ -50191,11 +52360,15 @@ var ExportGoogleAddon = class extends BaseAddon {
50191
52360
  persist: (patch) => this.updateGlobalSettings(patch),
50192
52361
  logger: this.ctx.logger
50193
52362
  });
50194
- return {
52363
+ const result = {
50195
52364
  publicHubUrl: resolution.publicHubUrl,
50196
52365
  detectedPublicHubUrl: resolution.detectedPublicHubUrl,
50197
52366
  filled: resolution.defaulted
50198
52367
  };
52368
+ return {
52369
+ ...result,
52370
+ summary: describeDetectResult(result)
52371
+ };
50199
52372
  }
50200
52373
  async onShutdown() {
50201
52374
  this.gateway = null;
@@ -50274,7 +52447,7 @@ var ExportGoogleAddon = class extends BaseAddon {
50274
52447
  globalSettingsSchema() {
50275
52448
  return this.schema({ sections: [{
50276
52449
  id: ADDON_ID,
50277
- title: "Google Home export",
52450
+ title: "Connection",
50278
52451
  description: "Publishes switches, dimmable lights, locks and covers to Google Home. The hub answers Google directly — no cloud function, and no Google credential is stored here.",
50279
52452
  columns: 1,
50280
52453
  fields: [
@@ -50304,13 +52477,15 @@ var ExportGoogleAddon = class extends BaseAddon {
50304
52477
  ...buildPublicHubUrlNotice(this.publicHubUrlState())
50305
52478
  },
50306
52479
  {
50307
- type: "button",
52480
+ type: "addon-action-button",
52481
+ addonId: ADDON_ID,
50308
52482
  key: "__detect-public-hub-url",
50309
52483
  label: "External address",
50310
52484
  description: "Re-scan the connected remote-access providers. Fills the field above when it is empty; a value you set is left exactly as it is.",
50311
52485
  buttonLabel: "Detect external address",
50312
52486
  action: "detectPublicHubUrl",
50313
- variant: "default"
52487
+ variant: "default",
52488
+ successMessage: "{summary}"
50314
52489
  }
50315
52490
  ]
50316
52491
  }] });