@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.
@@ -73,7 +73,7 @@ function createApiDeviceGateway(deps) {
73
73
  };
74
74
  }
75
75
  //#endregion
76
- //#region ../types/dist/event-category-BGmz_oxW.mjs
76
+ //#region ../types/dist/event-category-DaIZi00R.mjs
77
77
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
78
78
  EventCategory["SystemBoot"] = "system.boot";
79
79
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -152,6 +152,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
152
152
  */
153
153
  EventCategory["AddonLoadFailed"] = "addon.load-failed";
154
154
  /**
155
+ * A keychain value was stored or removed (D787). Carries the ref, its
156
+ * owner and the new version — NEVER the value. A process holding the ref
157
+ * drops its cached copy and the owning `BaseAddon` re-resolves its config.
158
+ * Telemetry (D8): a process that misses it still revalidates by version.
159
+ */
160
+ EventCategory["KeychainChanged"] = "keychain.changed";
161
+ /**
155
162
  * Addon recovered from a previous failure. Emitted when an addon
156
163
  * transitions from `failed` back to `healthy` (typically via the
157
164
  * monitor's auto-retry loop, or after manual `addons.retryLoad`).
@@ -574,15 +581,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
574
581
  EventCategory["AgentWsDisconnected"] = "agent.ws.disconnected";
575
582
  EventCategory["AgentBackupActivated"] = "agent.backup.activated";
576
583
  EventCategory["OrchestrationSettingsUpdated"] = "orchestration.settings-updated";
577
- /**
578
- * Per-agent hwaccel preference changed (user override set, cleared, or
579
- * re-probed). Observability event — decoders pull the current pref at
580
- * `createSession`, so running sessions keep their current backend until
581
- * they rotate naturally (camera add/remove, stream restart). Future
582
- * work can wire a listener in stream-broker that force-rotates live
583
- * sessions; for now this event powers logs + admin-UI toast feedback.
584
- */
585
- EventCategory["PipelineAgentHwaccelChanged"] = "pipeline.agent-hwaccel-changed";
586
584
  EventCategory["MotionAnalysis"] = "detection.motion-analysis";
587
585
  /** All raw motion zones from CCL before minArea filter — for UI debug overlay. */
588
586
  EventCategory["MotionZonesRaw"] = "detection.motion-zones-raw";
@@ -5453,7 +5451,7 @@ var ZodIssueCode = {
5453
5451
  var ZodFirstPartyTypeKind;
5454
5452
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5455
5453
  //#endregion
5456
- //#region ../types/dist/sleep-C16NCZR2.mjs
5454
+ //#region ../types/dist/sleep-Cr5YOk3m.mjs
5457
5455
  /**
5458
5456
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5459
5457
  * window to float samples (D455).
@@ -5532,6 +5530,97 @@ function buildAlawTable() {
5532
5530
  }
5533
5531
  buildUlawTable();
5534
5532
  buildAlawTable();
5533
+ /** Is this field's stored value a credential? */
5534
+ function isSecretConfigField(field) {
5535
+ if (field.type === "password") return true;
5536
+ return "secret" in field && field.secret === true;
5537
+ }
5538
+ /**
5539
+ * Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
5540
+ * by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
5541
+ */
5542
+ function isKeychainStoredField(field) {
5543
+ if (!isSecretConfigField(field)) return false;
5544
+ if (field.type === "textarea" && field.isJson === true) return false;
5545
+ return !("storage" in field && field.storage === "inline");
5546
+ }
5547
+ /**
5548
+ * What a settings blob holds where a secret used to be.
5549
+ *
5550
+ * A keychain-stored field never holds its value. It holds a self-describing
5551
+ * MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
5552
+ * code can mistake it for a credential and no form can send it to a camera as
5553
+ * a password. The empty state is `null` / absent, never `''`.
5554
+ *
5555
+ * The same shapes travel to and from the admin UI:
5556
+ *
5557
+ * - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
5558
+ * (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
5559
+ * value is set, never the value.
5560
+ * - write: an untouched field submits the view back unchanged (KEEP); a typed
5561
+ * value is a plain non-empty string (CHANGE); the Clear button submits
5562
+ * {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
5563
+ * are KEEP — an empty string is what a defaults-fallback pushes back, and
5564
+ * treating it as "clear" is how a save destroyed a stored credential before.
5565
+ *
5566
+ * Pure and browser-safe.
5567
+ */
5568
+ var SECRET_CLEAR = { $secretClear: true };
5569
+ /** The `'***'` token D634 redaction writes for non-admins. */
5570
+ var LEGACY_DEVICE_REDACTION = "***";
5571
+ function isRecord$1(value) {
5572
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5573
+ }
5574
+ function makeSecretMarker(ref) {
5575
+ return {
5576
+ $secret: ref,
5577
+ v: 1
5578
+ };
5579
+ }
5580
+ /** A stored marker: an object whose `$secret` is a non-empty string. */
5581
+ function isSecretMarker(value) {
5582
+ if (!isRecord$1(value)) return false;
5583
+ const ref = value["$secret"];
5584
+ return typeof ref === "string" && ref.length > 0;
5585
+ }
5586
+ function isSecretClear(value) {
5587
+ return isRecord$1(value) && value["$secretClear"] === true;
5588
+ }
5589
+ /**
5590
+ * The UI view of a stored secret field value: a marker becomes "set", inline
5591
+ * plaintext becomes "set (inline)", nothing becomes `null`. A value never
5592
+ * survives this function.
5593
+ */
5594
+ function toSecretFieldView(stored) {
5595
+ if (isSecretMarker(stored)) return {
5596
+ $secret: stored.$secret,
5597
+ v: 1,
5598
+ set: true
5599
+ };
5600
+ if (typeof stored === "string" && stored.length > 0) return {
5601
+ $secret: null,
5602
+ v: 1,
5603
+ set: true,
5604
+ inline: true
5605
+ };
5606
+ return null;
5607
+ }
5608
+ /**
5609
+ * Classify an incoming value for a secret path. Only a non-empty string that is
5610
+ * not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
5611
+ * Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
5612
+ * `undefined`, a redaction token, a non-string — keeps what is stored.
5613
+ */
5614
+ function classifySecretWrite(incoming) {
5615
+ if (isSecretClear(incoming)) return { kind: "clear" };
5616
+ if (typeof incoming !== "string") return { kind: "keep" };
5617
+ if (incoming.length === 0) return { kind: "keep" };
5618
+ if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
5619
+ return {
5620
+ kind: "set",
5621
+ value: incoming
5622
+ };
5623
+ }
5535
5624
  Object.fromEntries([
5536
5625
  {
5537
5626
  id: "overview",
@@ -5703,33 +5792,19 @@ Object.fromEntries([
5703
5792
  function isValuelessField(field) {
5704
5793
  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";
5705
5794
  }
5706
- /**
5707
- * Merge a `ConfigUISchema` with a raw `values` record into a
5708
- * `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
5709
- * before returning to the admin UI. Groups are walked recursively.
5710
- *
5711
- * For each leaf field:
5712
- * - structural fields (`separator`, `info`, `button`) pass through unchanged
5713
- * - other fields get `value = values[key] ?? field.default ?? null`
5714
- *
5715
- * Unknown keys in `values` (keys not declared in the schema) are silently
5716
- * ignored — they don't contribute to the output. Missing keys fall back to
5717
- * the schema default or `null`. This mirrors the old backend behaviour where
5718
- * `FormBuilder` rendered `values[key] ?? field.default`.
5719
- */
5720
- function hydrateSchema(schema, values) {
5795
+ function hydrateSchema(schema, values, options = {}) {
5721
5796
  return {
5722
5797
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
5723
5798
  sections: schema.sections.map((section) => ({
5724
5799
  ...section,
5725
- fields: section.fields.map((field) => hydrateField(field, values))
5800
+ fields: section.fields.map((field) => hydrateField(field, values, options))
5726
5801
  }))
5727
5802
  };
5728
5803
  }
5729
- function hydrateField(field, values) {
5804
+ function hydrateField(field, values, options) {
5730
5805
  if (isValuelessField(field)) return field;
5731
5806
  if (field.type === "group") {
5732
- const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
5807
+ const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
5733
5808
  return {
5734
5809
  ...field,
5735
5810
  fields: hydratedChildren
@@ -5738,7 +5813,7 @@ function hydrateField(field, values) {
5738
5813
  if (field.type === "sub-tabs") {
5739
5814
  const hydratedTabs = field.tabs.map((tab) => ({
5740
5815
  ...tab,
5741
- fields: tab.fields.map((child) => hydrateField(child, values))
5816
+ fields: tab.fields.map((child) => hydrateField(child, values, options))
5742
5817
  }));
5743
5818
  return {
5744
5819
  ...field,
@@ -5748,6 +5823,33 @@ function hydrateField(field, values) {
5748
5823
  const key = field.key;
5749
5824
  const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
5750
5825
  const defaultValue = field.default;
5826
+ const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
5827
+ if (isKeychainStoredField(field) && asView(storedValue)) return {
5828
+ ...field,
5829
+ value: toSecretFieldView(storedValue)
5830
+ };
5831
+ if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
5832
+ ...field,
5833
+ value: null
5834
+ };
5835
+ if (field.type === "editable-array" && Array.isArray(storedValue)) {
5836
+ const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
5837
+ if (secretItemKeys.length > 0) {
5838
+ const rows = storedValue.map((row) => {
5839
+ if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
5840
+ const out = { ...row };
5841
+ for (const k of secretItemKeys) {
5842
+ const v = Reflect.get(row, k);
5843
+ if (asView(v)) out[k] = toSecretFieldView(v);
5844
+ }
5845
+ return out;
5846
+ });
5847
+ return {
5848
+ ...field,
5849
+ value: rows
5850
+ };
5851
+ }
5852
+ }
5751
5853
  if (field.multiple) {
5752
5854
  const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
5753
5855
  const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
@@ -5990,6 +6092,431 @@ function projectStore(store, perNodeKeys, nodeId) {
5990
6092
  }
5991
6093
  return out;
5992
6094
  }
6095
+ var GLOBAL_SCOPE = { kind: "global" };
6096
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6097
+ function globalSecretScope() {
6098
+ return GLOBAL_SCOPE;
6099
+ }
6100
+ function encodeSegment(value) {
6101
+ return encodeURIComponent(value);
6102
+ }
6103
+ /**
6104
+ * The field path of a value inside an array item, addressed by the item's id:
6105
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6106
+ * `providers[authentik].clientSecret`.
6107
+ */
6108
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6109
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6110
+ }
6111
+ /** A write to a secret path could not be stored in the keychain, so it was refused. */
6112
+ var KeychainWriteRefusedError = class extends Error {
6113
+ fieldPath;
6114
+ constructor(fieldPath, cause) {
6115
+ super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
6116
+ this.fieldPath = fieldPath;
6117
+ this.name = "KeychainWriteRefusedError";
6118
+ }
6119
+ };
6120
+ var KEEP = { kind: "keep" };
6121
+ function isRecord(value) {
6122
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6123
+ }
6124
+ function defaultMintId() {
6125
+ return globalThis.crypto.randomUUID();
6126
+ }
6127
+ /** Every marker ref anywhere under `value`. */
6128
+ function collectSecretMarkerRefs(value, out = []) {
6129
+ if (isSecretMarker(value)) {
6130
+ out.push(value.$secret);
6131
+ return out;
6132
+ }
6133
+ if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6134
+ else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6135
+ return out;
6136
+ }
6137
+ async function storedValueEquals(secrets, marker, candidate) {
6138
+ const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
6139
+ return resolved?.kind === "value" && resolved.value === candidate;
6140
+ }
6141
+ async function writeLeaf(ctx, incoming, stored, fieldPath) {
6142
+ const intent = classifySecretWrite(incoming);
6143
+ const ref = ctx.secrets.ref(ctx.scope, fieldPath);
6144
+ const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
6145
+ if (intent.kind === "keep") return KEEP;
6146
+ if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
6147
+ if (intent.kind === "clear") {
6148
+ if (storedIsOurs) ctx.deletes.push(ref);
6149
+ return {
6150
+ kind: "value",
6151
+ value: null
6152
+ };
6153
+ }
6154
+ if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
6155
+ kind: "value",
6156
+ value: stored
6157
+ };
6158
+ try {
6159
+ await ctx.secrets.put(ref, intent.value);
6160
+ } catch (err) {
6161
+ throw new KeychainWriteRefusedError(fieldPath, err);
6162
+ }
6163
+ return {
6164
+ kind: "value",
6165
+ value: makeSecretMarker(ref)
6166
+ };
6167
+ }
6168
+ /** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
6169
+ function applyMember(out, key, result, storedParent) {
6170
+ if (result.kind === "value") {
6171
+ out[key] = result.value;
6172
+ return;
6173
+ }
6174
+ if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
6175
+ else delete out[key];
6176
+ }
6177
+ async function writeMembers(ctx, children, incoming, stored, pathOf) {
6178
+ const out = { ...incoming };
6179
+ for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
6180
+ return out;
6181
+ }
6182
+ function rowId(row, idKey) {
6183
+ const raw = row[idKey];
6184
+ if (typeof raw === "string" && raw.length > 0) return raw;
6185
+ if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
6186
+ return null;
6187
+ }
6188
+ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6189
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6190
+ if (!Array.isArray(incoming)) {
6191
+ ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6192
+ return {
6193
+ kind: "value",
6194
+ value: incoming
6195
+ };
6196
+ }
6197
+ const storedById = /* @__PURE__ */ new Map();
6198
+ for (const row of storedRows) {
6199
+ const id = rowId(row, node.idKey);
6200
+ if (id !== null) storedById.set(id, row);
6201
+ }
6202
+ const kept = /* @__PURE__ */ new Set();
6203
+ const rows = [];
6204
+ for (const row of incoming) {
6205
+ if (!isRecord(row)) {
6206
+ rows.push(row);
6207
+ continue;
6208
+ }
6209
+ const id = rowId(row, node.idKey) ?? ctx.mintId();
6210
+ kept.add(id);
6211
+ const withId = {
6212
+ ...row,
6213
+ [node.idKey]: row[node.idKey] ?? id
6214
+ };
6215
+ if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
6216
+ const storedRow = storedById.get(id) ?? {};
6217
+ rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
6218
+ }
6219
+ for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
6220
+ return {
6221
+ kind: "value",
6222
+ value: rows
6223
+ };
6224
+ }
6225
+ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6226
+ switch (node.kind) {
6227
+ case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6228
+ case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6229
+ case "object": {
6230
+ if (!isRecord(incoming)) {
6231
+ if (incoming === void 0) return KEEP;
6232
+ ctx.deletes.push(...collectSecretMarkerRefs(stored));
6233
+ return {
6234
+ kind: "value",
6235
+ value: incoming
6236
+ };
6237
+ }
6238
+ const storedObj = isRecord(stored) ? stored : {};
6239
+ return {
6240
+ kind: "value",
6241
+ value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
6242
+ };
6243
+ }
6244
+ }
6245
+ }
6246
+ /** Split a perNode-scoped key (`key@nodeId`). */
6247
+ function splitNodeKey(key) {
6248
+ const at = key.indexOf("@");
6249
+ return at <= 0 ? {
6250
+ base: key,
6251
+ nodeId: null
6252
+ } : {
6253
+ base: key.slice(0, at),
6254
+ nodeId: key.slice(at + 1)
6255
+ };
6256
+ }
6257
+ /** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
6258
+ async function transformSecretWrite(input) {
6259
+ const deletes = [];
6260
+ const base = {
6261
+ secrets: input.secrets,
6262
+ mintId: input.mintId ?? defaultMintId,
6263
+ deletes,
6264
+ operatorWrite: input.operatorWrite === true
6265
+ };
6266
+ const out = {};
6267
+ for (const [key, incoming] of Object.entries(input.patch)) {
6268
+ const { base: baseKey, nodeId } = splitNodeKey(key);
6269
+ const node = input.tree.get(baseKey);
6270
+ if (node === void 0) {
6271
+ out[key] = incoming;
6272
+ continue;
6273
+ }
6274
+ const scope = nodeId !== null && nodeId.length > 0 ? {
6275
+ kind: "node",
6276
+ nodeId
6277
+ } : input.scope ?? globalSecretScope();
6278
+ const result = await writeNode({
6279
+ ...base,
6280
+ scope
6281
+ }, node, incoming, input.stored[key], baseKey);
6282
+ if (result.kind === "value") out[key] = result.value;
6283
+ }
6284
+ return {
6285
+ patch: out,
6286
+ afterWrite: async () => {
6287
+ if (deletes.length === 0) return { orphaned: [] };
6288
+ try {
6289
+ await input.secrets.delete([...new Set(deletes)]);
6290
+ return { orphaned: [] };
6291
+ } catch {
6292
+ return { orphaned: [...new Set(deletes)] };
6293
+ }
6294
+ }
6295
+ };
6296
+ }
6297
+ /**
6298
+ * Replace every marker in `value` with its keychain value. Returns the SAME
6299
+ * reference when there is no marker (no allocation, no keychain call).
6300
+ */
6301
+ async function resolveSecretMarkers(value, secrets) {
6302
+ const refs = collectSecretMarkerRefs(value);
6303
+ if (refs.length === 0) return {
6304
+ value,
6305
+ unresolved: []
6306
+ };
6307
+ const answers = await secrets.resolve(refs);
6308
+ const unresolved = [];
6309
+ for (const ref of new Set(refs)) {
6310
+ const answer = answers[ref];
6311
+ if (answer === void 0) unresolved.push({
6312
+ ref,
6313
+ reason: "not-initialized"
6314
+ });
6315
+ else if (answer.kind === "unavailable") unresolved.push({
6316
+ ref,
6317
+ reason: answer.reason
6318
+ });
6319
+ else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
6320
+ ref,
6321
+ reason: answer.kind
6322
+ });
6323
+ }
6324
+ const substitute = (v) => {
6325
+ if (isSecretMarker(v)) {
6326
+ const answer = answers[v.$secret];
6327
+ return answer?.kind === "value" ? {
6328
+ keep: true,
6329
+ value: answer.value
6330
+ } : {
6331
+ keep: false,
6332
+ value: void 0
6333
+ };
6334
+ }
6335
+ if (Array.isArray(v)) {
6336
+ const items = [];
6337
+ for (const item of v) {
6338
+ const s = substitute(item);
6339
+ if (s.keep) items.push(s.value);
6340
+ }
6341
+ return {
6342
+ keep: true,
6343
+ value: items
6344
+ };
6345
+ }
6346
+ if (isRecord(v)) {
6347
+ const out = {};
6348
+ for (const [k, child] of Object.entries(v)) {
6349
+ const s = substitute(child);
6350
+ if (s.keep) out[k] = s.value;
6351
+ }
6352
+ return {
6353
+ keep: true,
6354
+ value: out
6355
+ };
6356
+ }
6357
+ return {
6358
+ keep: true,
6359
+ value: v
6360
+ };
6361
+ };
6362
+ return {
6363
+ value: substitute(value).value,
6364
+ unresolved
6365
+ };
6366
+ }
6367
+ function touchesTree(tree, patch) {
6368
+ if (tree.size === 0) return false;
6369
+ for (const key of Object.keys(patch)) {
6370
+ const at = key.indexOf("@");
6371
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6372
+ }
6373
+ return false;
6374
+ }
6375
+ /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6376
+ async function readStoredAddonBlob(raw) {
6377
+ const threeWay = raw.readAddonStoreResult;
6378
+ if (threeWay === void 0) return raw.readAddonStore();
6379
+ const result = await threeWay.call(raw);
6380
+ if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6381
+ return result.kind === "missing" ? {} : result.value;
6382
+ }
6383
+ function createSecretAwareSettings(raw, opts) {
6384
+ const chains = /* @__PURE__ */ new Map();
6385
+ const serialize = (key, fn) => {
6386
+ const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
6387
+ const tail = next.catch(() => void 0);
6388
+ chains.set(key, tail);
6389
+ tail.then(() => {
6390
+ if (chains.get(key) === tail) chains.delete(key);
6391
+ });
6392
+ return next;
6393
+ };
6394
+ const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6395
+ if (!touchesTree(tree, patch)) return rawWrite(patch);
6396
+ return serialize(chainKey, async () => {
6397
+ const stored = await readStored();
6398
+ const result = await transformSecretWrite({
6399
+ tree,
6400
+ secrets: opts.secrets,
6401
+ patch,
6402
+ stored,
6403
+ ...scope !== void 0 ? { scope } : {},
6404
+ operatorWrite: opts.isOperatorWrite?.() === true
6405
+ });
6406
+ if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6407
+ const { orphaned } = await result.afterWrite();
6408
+ if (orphaned.length > 0) opts.onOrphaned(orphaned);
6409
+ });
6410
+ };
6411
+ const wrapped = {
6412
+ writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6413
+ writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6414
+ kind: "device",
6415
+ deviceId
6416
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6417
+ };
6418
+ return new Proxy(raw, { get(target, prop, receiver) {
6419
+ if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6420
+ if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6421
+ const value = Reflect.get(target, prop, receiver);
6422
+ return typeof value === "function" ? value.bind(target) : value;
6423
+ } });
6424
+ }
6425
+ /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6426
+ function withSecretAwareSettings(context, opts) {
6427
+ const raw = context.settings;
6428
+ if (raw === void 0) return context;
6429
+ const settings = createSecretAwareSettings(raw, opts);
6430
+ return new Proxy(context, { get(target, prop, receiver) {
6431
+ if (prop === "settings") return settings;
6432
+ return Reflect.get(target, prop, receiver);
6433
+ } });
6434
+ }
6435
+ var LEAF = { kind: "leaf" };
6436
+ var DEFAULT_ITEM_ID_KEY = "id";
6437
+ function collectFields(fields, out) {
6438
+ for (const field of fields) {
6439
+ if (field.type === "group") {
6440
+ collectFields(field.fields, out);
6441
+ continue;
6442
+ }
6443
+ if (field.type === "sub-tabs") {
6444
+ for (const tab of field.tabs) collectFields(tab.fields, out);
6445
+ continue;
6446
+ }
6447
+ if (field.type === "editable-array") {
6448
+ const item = /* @__PURE__ */ new Map();
6449
+ for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
6450
+ if (item.size > 0) out.set(field.key, {
6451
+ kind: "array",
6452
+ idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
6453
+ item
6454
+ });
6455
+ continue;
6456
+ }
6457
+ if (!("key" in field) || typeof field.key !== "string") continue;
6458
+ if (isKeychainStoredField(field)) out.set(field.key, LEAF);
6459
+ }
6460
+ }
6461
+ /** The secret tree a settings schema declares. */
6462
+ function secretTreeFromSchema(schema) {
6463
+ const out = /* @__PURE__ */ new Map();
6464
+ if (schema === null) return out;
6465
+ for (const section of schema.sections) collectFields(section.fields, out);
6466
+ return out;
6467
+ }
6468
+ /** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
6469
+ function parseSecretStatePath(path) {
6470
+ const segments = [];
6471
+ for (const raw of path.split(".")) {
6472
+ const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
6473
+ if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
6474
+ segments.push(m[2] !== void 0 ? {
6475
+ key: m[1],
6476
+ idKey: m[2]
6477
+ } : { key: m[1] });
6478
+ }
6479
+ if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
6480
+ if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
6481
+ return segments;
6482
+ }
6483
+ function insert(into, segments) {
6484
+ const [head, ...rest] = segments;
6485
+ if (head === void 0) return;
6486
+ if (rest.length === 0) {
6487
+ into.set(head.key, LEAF);
6488
+ return;
6489
+ }
6490
+ const existing = into.get(head.key);
6491
+ if (head.idKey !== void 0) {
6492
+ const item = new Map(existing?.kind === "array" ? existing.item : []);
6493
+ insert(item, rest);
6494
+ into.set(head.key, {
6495
+ kind: "array",
6496
+ idKey: head.idKey,
6497
+ item
6498
+ });
6499
+ return;
6500
+ }
6501
+ const children = new Map(existing?.kind === "object" ? existing.children : []);
6502
+ insert(children, rest);
6503
+ into.set(head.key, {
6504
+ kind: "object",
6505
+ children
6506
+ });
6507
+ }
6508
+ /** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
6509
+ function mergeSecretStatePaths(tree, paths) {
6510
+ if (paths.length === 0) return tree;
6511
+ const out = new Map(tree);
6512
+ for (const path of paths) insert(out, parseSecretStatePath(path));
6513
+ return out;
6514
+ }
6515
+ /** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
6516
+ var SECRET_RETRY_FIRST_MS = 5e3;
6517
+ var SECRET_RETRY_MAX_MS = 5 * 6e4;
6518
+ /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
6519
+ var SECRET_CHANGE_DEBOUNCE_MS = 250;
5993
6520
  /**
5994
6521
  * Base class for CamStack addons. Eliminates settings boilerplate:
5995
6522
  *
@@ -6059,6 +6586,25 @@ var BaseAddon = class {
6059
6586
  settingsStoreReady = false;
6060
6587
  /** Default config values. Provided via constructor. */
6061
6588
  defaults;
6589
+ /**
6590
+ * Hidden-state paths that hold secrets (D787) — values the addon writes
6591
+ * itself (`updateGlobalSettings`, `state()`) that no form field declares.
6592
+ * Stored in the keychain exactly like a `password` field. Syntax:
6593
+ * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
6594
+ * (`key[<id field>]` addresses array items by id, never by index).
6595
+ */
6596
+ secretStatePaths = [];
6597
+ _addonSecretTree = null;
6598
+ _deviceSecretTree = null;
6599
+ /** Refs the last resolved config pointed at — a change to one re-resolves. */
6600
+ _configSecretRefs = /* @__PURE__ */ new Set();
6601
+ _unresolvedSecrets = [];
6602
+ _secretRetryTimer = null;
6603
+ _secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
6604
+ _secretChangeTimer = null;
6605
+ _secretChangeUnsub = null;
6606
+ /** >0 while an OPERATOR's settings write is being applied. */
6607
+ _operatorWriteDepth = 0;
6062
6608
  constructor(defaults) {
6063
6609
  this.defaults = defaults;
6064
6610
  this._config = { ...defaults };
@@ -6094,8 +6640,18 @@ var BaseAddon = class {
6094
6640
  return this._config;
6095
6641
  }
6096
6642
  async initialize(context) {
6097
- this._ctx = context;
6643
+ const secrets = context.secrets;
6644
+ this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6645
+ secrets,
6646
+ addonTree: () => this.addonSecretTree(),
6647
+ deviceTree: () => this.deviceSecretTree(),
6648
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6649
+ isOperatorWrite: () => this._operatorWriteDepth > 0
6650
+ }) : context;
6098
6651
  await this.resolveConfig();
6652
+ if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6653
+ if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
6654
+ });
6099
6655
  const result = await this.onInitialize();
6100
6656
  this.emitLifecycle(EventCategory.AddonStarted);
6101
6657
  const normalized = normalizeAddonInitResult(result);
@@ -6128,6 +6684,12 @@ var BaseAddon = class {
6128
6684
  */
6129
6685
  async onHubReachable() {}
6130
6686
  async shutdown() {
6687
+ this._secretChangeUnsub?.();
6688
+ this._secretChangeUnsub = null;
6689
+ if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
6690
+ if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
6691
+ this._secretRetryTimer = null;
6692
+ this._secretChangeTimer = null;
6131
6693
  this.emitLifecycle(EventCategory.AddonStopped);
6132
6694
  if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
6133
6695
  await this.onShutdown();
@@ -6206,7 +6768,7 @@ var BaseAddon = class {
6206
6768
  return hydrateSchema(schema, overlay ? {
6207
6769
  ...projected,
6208
6770
  ...overlay
6209
- } : projected);
6771
+ } : projected, { inlineSecretsAsViews: true });
6210
6772
  }
6211
6773
  /**
6212
6774
  * The integration-level view of this addon's settings: exactly the sections
@@ -6255,7 +6817,7 @@ var BaseAddon = class {
6255
6817
  return hydrateSchema({
6256
6818
  ...schema,
6257
6819
  sections
6258
- }, projected);
6820
+ }, projected, { inlineSecretsAsViews: true });
6259
6821
  }
6260
6822
  /**
6261
6823
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -6309,18 +6871,50 @@ var BaseAddon = class {
6309
6871
  value: result.value[key]
6310
6872
  };
6311
6873
  }
6874
+ /**
6875
+ * The OPERATOR's write — a settings form or an admin API call, dispatched by
6876
+ * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
6877
+ * the operator sends is stored as sent even when it equals a pre-keychain
6878
+ * inline value: the operator re-entering a password is a change, an addon
6879
+ * writing back what it read is not (D787).
6880
+ */
6881
+ async updateGlobalSettingsAsOperator(patch, nodeId) {
6882
+ this._operatorWriteDepth++;
6883
+ try {
6884
+ await this.applyGlobalPatch(patch, nodeId);
6885
+ } finally {
6886
+ this._operatorWriteDepth--;
6887
+ }
6888
+ }
6312
6889
  async updateGlobalSettings(patch, nodeId) {
6890
+ await this.applyGlobalPatch(patch, nodeId);
6891
+ }
6892
+ /**
6893
+ * REMOVE stored secrets — their keychain values and their markers (D787).
6894
+ *
6895
+ * Writing `''` to a secret field KEEPS what is stored (an empty string is
6896
+ * what a defaults fallback writes back, and it must never destroy a
6897
+ * credential), so code that means "forget this token" says so here. Without
6898
+ * a keychain (an older kernel) it writes `''`, as such code always did.
6899
+ */
6900
+ async clearSecrets(keys, nodeId) {
6901
+ const tree = this.addonSecretTree();
6902
+ const keychain = this._ctx?.secrets !== void 0;
6903
+ const patch = {};
6904
+ for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
6905
+ await this.applyGlobalPatch(patch, nodeId);
6906
+ }
6907
+ async applyGlobalPatch(barePatch, nodeId) {
6313
6908
  const keys = this.perNodeKeys();
6314
6909
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6315
6910
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6316
- const barePatch = patch;
6317
6911
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6318
6912
  await this._ctx?.settings?.writeAddonStore(scoped);
6319
6913
  if (target !== localNode) return;
6320
6914
  await this.resolveConfig();
6321
6915
  await this.onConfigChanged();
6322
6916
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
6323
- this.maybeAutoRestart(patch, this.globalSettingsSchema());
6917
+ this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
6324
6918
  }
6325
6919
  /**
6326
6920
  * The set of field keys the global settings schema declares `perNode: true`
@@ -6345,7 +6939,7 @@ var BaseAddon = class {
6345
6939
  * time to return its response before the addon is torn down and
6346
6940
  * re-initialised by `AddonRegistryService.restartAddon`.
6347
6941
  */
6348
- maybeAutoRestart(patch, schema) {
6942
+ maybeAutoRestart(patchKeys, schema) {
6349
6943
  if (!schema) return;
6350
6944
  const restartKeys = /* @__PURE__ */ new Set();
6351
6945
  for (const section of schema.sections) for (const field of section.fields) {
@@ -6353,13 +6947,13 @@ var BaseAddon = class {
6353
6947
  if (field.requiresRestart) restartKeys.add(field.key);
6354
6948
  }
6355
6949
  if (restartKeys.size === 0) return;
6356
- if (!Object.keys(patch).some((k) => restartKeys.has(k))) return;
6950
+ if (!patchKeys.some((k) => restartKeys.has(k))) return;
6357
6951
  const ctx = this._ctx;
6358
6952
  if (!ctx) return;
6359
6953
  const addonId = ctx.id;
6360
6954
  setImmediate(() => {
6361
6955
  ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
6362
- ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: Object.keys(patch).filter((k) => restartKeys.has(k)) } });
6956
+ ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
6363
6957
  }).catch((err) => {
6364
6958
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
6365
6959
  });
@@ -6368,7 +6962,7 @@ var BaseAddon = class {
6368
6962
  async getDeviceSettings(deviceId) {
6369
6963
  const schema = this.deviceSettingsSchema();
6370
6964
  if (!schema) return { sections: [] };
6371
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
6965
+ return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6372
6966
  }
6373
6967
  async updateDeviceSettings(deviceId, patch) {
6374
6968
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -6498,7 +7092,7 @@ var BaseAddon = class {
6498
7092
  * selection at boot (absent scoped key ⇒ the constructor default wins).
6499
7093
  */
6500
7094
  async resolveConfig() {
6501
- const stored = await this.readAddonStoreWithRetry();
7095
+ const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
6502
7096
  const perNode = this.perNodeKeys();
6503
7097
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6504
7098
  const resolved = { ...this.defaults };
@@ -6523,7 +7117,7 @@ var BaseAddon = class {
6523
7117
  key,
6524
7118
  schema,
6525
7119
  fallback,
6526
- read: () => this.readAddonStoreWithRetry(),
7120
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
6527
7121
  write: async (patch) => {
6528
7122
  await this._ctx?.settings?.writeAddonStore(patch);
6529
7123
  },
@@ -6540,7 +7134,7 @@ var BaseAddon = class {
6540
7134
  key,
6541
7135
  schema,
6542
7136
  fallback,
6543
- read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
7137
+ read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
6544
7138
  write: async (patch) => {
6545
7139
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
6546
7140
  },
@@ -6552,6 +7146,70 @@ var BaseAddon = class {
6552
7146
  } })
6553
7147
  });
6554
7148
  }
7149
+ /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
7150
+ addonSecretTree() {
7151
+ this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
7152
+ return this._addonSecretTree;
7153
+ }
7154
+ deviceSecretTree() {
7155
+ this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7156
+ return this._deviceSecretTree;
7157
+ }
7158
+ /**
7159
+ * Secrets of this addon's stored config that could not be resolved on the
7160
+ * last read, with why. Non-empty means the addon is running WITHOUT them —
7161
+ * an addon whose function needs one should report itself degraded rather
7162
+ * than start on an empty credential.
7163
+ */
7164
+ get unresolvedSecrets() {
7165
+ return this._unresolvedSecrets;
7166
+ }
7167
+ /**
7168
+ * Substitute every keychain marker in a stored blob with its value. With no
7169
+ * keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
7170
+ * An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
7171
+ * value — and, when the cause can pass, retried with backoff. Nothing is
7172
+ * ever written back from here.
7173
+ */
7174
+ async resolveStoredSecrets(blob, trackForConfig = true) {
7175
+ const secrets = this._ctx?.secrets;
7176
+ if (secrets === void 0) return blob;
7177
+ const refs = collectSecretMarkerRefs(blob);
7178
+ if (trackForConfig) this._configSecretRefs = new Set(refs);
7179
+ if (refs.length === 0) {
7180
+ if (trackForConfig) this._unresolvedSecrets = [];
7181
+ return blob;
7182
+ }
7183
+ const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
7184
+ if (trackForConfig) {
7185
+ this._unresolvedSecrets = unresolved;
7186
+ if (unresolved.length > 0) {
7187
+ this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
7188
+ ref: u.ref,
7189
+ reason: u.reason
7190
+ })) } });
7191
+ if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
7192
+ this.scheduleSecretReresolve(this._secretRetryDelayMs);
7193
+ this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
7194
+ }
7195
+ } else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
7196
+ }
7197
+ return value;
7198
+ }
7199
+ /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7200
+ scheduleSecretReresolve(delayMs) {
7201
+ const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
7202
+ if (this[timerOf] !== null) return;
7203
+ const timer = setTimeout(() => {
7204
+ this[timerOf] = null;
7205
+ if (this._ctx === null) return;
7206
+ this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
7207
+ this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
7208
+ });
7209
+ }, delayMs);
7210
+ timer.unref?.();
7211
+ this[timerOf] = timer;
7212
+ }
6555
7213
  /**
6556
7214
  * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
6557
7215
  * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
@@ -6819,32 +7477,12 @@ object({
6819
7477
  audioCodec: string().optional(),
6820
7478
  metadata: record(string(), unknown()).readonly().optional()
6821
7479
  });
6822
- var EncodedPacketSchema = object({
6823
- type: _enum(["video", "audio"]),
6824
- data: _instanceof(Uint8Array),
6825
- pts: number(),
6826
- dts: number(),
6827
- keyframe: boolean(),
6828
- codec: string()
6829
- });
6830
- var DecodedFrameSchema = object({
6831
- data: _instanceof(Uint8Array),
6832
- width: number(),
6833
- height: number(),
6834
- format: _enum([
6835
- "jpeg",
6836
- "rgb",
6837
- "bgr",
6838
- "yuv420",
6839
- "gray"
6840
- ]),
6841
- timestamp: number()
6842
- });
6843
7480
  /**
6844
7481
  * Wire schema for `FrameHandle` — a zero-pixel, serialisable reference to a
6845
7482
  * frame in a shared-memory ring (Phase 5 / D9). Mirrors the `FrameHandle` TS
6846
- * interface in `interfaces/frame-handle.ts` field-for-field so a decoder cap
6847
- * method (`pullHandles`) can carry handles over tRPC / Moleculer.
7483
+ * interface in `interfaces/frame-handle.ts` field-for-field so a cap method
7484
+ * (the runner's native-crop and pipeline-executor inputs) can carry handles
7485
+ * over tRPC / Moleculer.
6848
7486
  *
6849
7487
  * The `satisfies` assertion below pins this schema to the interface: if a
6850
7488
  * field is added to / removed from `FrameHandle` without a matching schema
@@ -6870,50 +7508,6 @@ var FrameHandleSchema = object({
6870
7508
  slotCount: number().int().positive()
6871
7509
  });
6872
7510
  /**
6873
- * Pixel format a frame-handle subscriber can request from the broker
6874
- * (Phase 5 / D9). The packed, raster subset of `FrameFormat` — the formats a
6875
- * `frameSink: 'shm'` decoder session can write into a `FrameRing` slot.
6876
- * `jpeg` is excluded: a variable-length stream is not a fixed-stride ring
6877
- * payload, and no decoded-frame consumer requests it over the shm plane.
6878
- */
6879
- var FrameHandleFormatSchema = _enum([
6880
- "rgb",
6881
- "bgr",
6882
- "yuv420",
6883
- "gray"
6884
- ]);
6885
- /**
6886
- * Input for `stream-broker.subscribeFrames` (Phase 5 / D9). A consumer asks the
6887
- * broker for a `FrameHandle` stream of one `format`; the broker maintains one
6888
- * shared-memory ring per `(brokerId, format)` actually requested, so a `gray`
6889
- * subscriber (motion) and an `rgb` subscriber (detection) each read the format
6890
- * they asked for with no broker-side conversion.
6891
- */
6892
- var SubscribeFramesInputSchema = object({
6893
- brokerId: string(),
6894
- format: FrameHandleFormatSchema,
6895
- /**
6896
- * Optional reader-side cadence hint in frames per second. The broker does
6897
- * NOT throttle — latest-wins ring reads drop frames implicitly for a slow
6898
- * consumer. The value is echoed back in `SubscribeFramesResult.maxFps` so
6899
- * the consumer can pace its own `pullFrameHandles` polling.
6900
- */
6901
- maxFps: number().positive().optional(),
6902
- /** Short caller-identity tag (`motion`, `detection`, …) for diagnostics. */
6903
- tag: string().optional()
6904
- });
6905
- /**
6906
- * Result of `stream-broker.subscribeFrames`. The consumer then polls
6907
- * `pullFrameHandles({ subscriptionId, maxCount })` and feeds each returned
6908
- * `FrameHandle` to a `FrameRingReader`.
6909
- */
6910
- var SubscribeFramesResultSchema = object({
6911
- /** Opaque id the consumer passes to `pullFrameHandles` / `unsubscribeFrames`. */
6912
- subscriptionId: string(),
6913
- /** Reader-side cadence hint (frames/s) — echoes `SubscribeFramesInput.maxFps`. */
6914
- maxFps: number().nonnegative()
6915
- });
6916
- /**
6917
7511
  * Wire schema for a decoded audio chunk (Phase 5 / D9). Mirrors the
6918
7512
  * `DecodedAudioChunk` TS interface in `interfaces/stream-broker.ts`: PCM
6919
7513
  * sample bytes plus the track parameters a consumer needs to interpret them.
@@ -6921,8 +7515,8 @@ var SubscribeFramesResultSchema = object({
6921
7515
  * Audio chunks are tiny (a ~500ms AudioCodecSession window is a few KB of
6922
7516
  * Float32 PCM), so unlike video frames they ship their bytes INLINE over
6923
7517
  * tRPC / Moleculer — no shared-memory plane. `data` is typed `Uint8Array`
6924
- * (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
6925
- * / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
7518
+ * (the wire-serialisable supertype of `Buffer`); a `Buffer` is assignable to
7519
+ * it.
6926
7520
  */
6927
7521
  var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
6928
7522
  var DecodedAudioChunkSchema = object({
@@ -6940,11 +7534,10 @@ var DecodedAudioChunkSchema = object({
6940
7534
  format: AudioChunkFormatSchema.optional()
6941
7535
  });
6942
7536
  /**
6943
- * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
6944
- * handle-free, ship-bytes-inline analogue of `subscribeFrames`: a consumer
6945
- * asks the broker for the decoded audio-chunk stream of one broker; the
6946
- * broker keeps a per-subscription bounded FIFO queue the consumer drains via
6947
- * `pullAudioChunks`.
7537
+ * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). Audio ships
7538
+ * its bytes inline: a consumer asks the broker for the decoded audio-chunk
7539
+ * stream of one broker; the broker keeps a per-subscription bounded FIFO queue
7540
+ * the consumer drains via `pullAudioChunks`.
6948
7541
  */
6949
7542
  var SubscribeAudioChunksInputSchema = object({
6950
7543
  brokerId: string(),
@@ -6975,9 +7568,7 @@ var BrokerStatsSchema = object({
6975
7568
  "stopped"
6976
7569
  ]),
6977
7570
  inputFps: number(),
6978
- decodeFps: number(),
6979
7571
  encodedSubscribers: number(),
6980
- decodedSubscribers: number(),
6981
7572
  uptimeMs: number(),
6982
7573
  bitrateKbps: number(),
6983
7574
  idrIntervalMs: number(),
@@ -6990,14 +7581,6 @@ var BrokerStatsSchema = object({
6990
7581
  preBufferMs: number(),
6991
7582
  preBufferPackets: number(),
6992
7583
  /**
6993
- * Moleculer node id of the decoder provider currently servicing this
6994
- * stream's decoded subscribers. `null` until the deferred decoder is
6995
- * created (no decoded clients yet, or codec not detected). Surfaces the
6996
- * runtime decoder placement so the UI can show "Decoder: <agent>" without
6997
- * a separate cap call per broker.
6998
- */
6999
- decoderNodeId: string().nullable(),
7000
- /**
7001
7584
  * Detected audio track parameters from the RTSP DESCRIBE / SDP. `null`
7002
7585
  * when the stream has no audio track or the broker is in cold start.
7003
7586
  * `supported = false` means the codec was detected but the local
@@ -8485,8 +9068,8 @@ function buildAddonRouteProvider(id, routes) {
8485
9068
  const reply = buildCapturingReply(envelope);
8486
9069
  const request = {
8487
9070
  params: {
8488
- ...input.params,
8489
- ...match.params
9071
+ ...match.params,
9072
+ ...input.params
8490
9073
  },
8491
9074
  query: input.query,
8492
9075
  body: input.body,
@@ -10468,70 +11051,6 @@ var StorageLocationDeclarationSchema = object({
10468
11051
  "backup"
10469
11052
  ]).optional()
10470
11053
  });
10471
- var DecoderStatsSchema = object({
10472
- inputFps: number(),
10473
- outputFps: number(),
10474
- avgDecodeTimeMs: number(),
10475
- droppedFrames: number(),
10476
- /**
10477
- * Pull-mode adaptive-fps telemetry (optional — only pull sessions run the
10478
- * lag-driven controller; push sessions omit these). `lagMs` is the EWMA of
10479
- * the decoder's real-time drift (rising = falling behind live); `adaptiveFps`
10480
- * is the current lag-throttled emit rate (≤ `effectiveFps` ceiling).
10481
- */
10482
- lagMs: number().optional(),
10483
- effectiveFps: number().optional(),
10484
- adaptiveFps: number().optional()
10485
- });
10486
- var DecoderSessionConfigSchema = object({
10487
- codec: string(),
10488
- maxFps: number().default(0),
10489
- outputFormat: _enum([
10490
- "jpeg",
10491
- "rgb",
10492
- "bgr",
10493
- "yuv420",
10494
- "gray"
10495
- ]).default("jpeg"),
10496
- scale: number().default(1),
10497
- width: number().optional(),
10498
- height: number().optional(),
10499
- /**
10500
- * Identifier of the camera this decoder session serves. Optional
10501
- * because the cap is generic (any caller could request decode), but
10502
- * stream-broker passes it so decoder logs include `deviceId` for
10503
- * per-camera filtering when diagnosing failures (e.g. node-av
10504
- * sendPacket errors on a single hung camera).
10505
- */
10506
- deviceId: number().int().nonnegative().optional(),
10507
- /**
10508
- * Free-form tag for log scoping. Stream-broker uses
10509
- * `broker:<deviceId>/<profile>`. Decoder session logger surfaces it
10510
- * on every line so `grep tag=broker:5/high` filters one camera
10511
- * profile cleanly.
10512
- */
10513
- tag: string().optional(),
10514
- /**
10515
- * Where the session delivers decoded frames (Phase 5 / D9):
10516
- *
10517
- * - `'callback'` (default) — the legacy pixel path: decoded frames are
10518
- * buffered as `DecodedFrame`s and drained via `pullFrames`.
10519
- * - `'shm'` — the shared-memory frame plane: decoded frames are written
10520
- * into an OS shared-memory ring and drained as zero-pixel
10521
- * `FrameHandle`s via `pullHandles`. A session is one mode or the
10522
- * other — `pullFrames` returns nothing for an `'shm'` session and
10523
- * `pullHandles` returns nothing for a `'callback'` session.
10524
- */
10525
- frameSink: _enum(["callback", "shm"]).default("callback"),
10526
- /**
10527
- * Per-camera decoder DEBUG facility. When `true`, a pull-mode session emits
10528
- * a throttled (~1Hz) structured `decoder debug` line (effective/adaptive fps,
10529
- * real-time lag, dropped-frame delta, avg decode time, hwaccel). Mirrors the
10530
- * stream-broker's `streamingDebug` gate — off by default so production logs
10531
- * stay quiet and the emit path pays zero per-frame cost when disabled.
10532
- */
10533
- debug: boolean().optional()
10534
- });
10535
11054
  /**
10536
11055
  * Per-component log CHANNELS — the gate a hot path consults, and the registry
10537
11056
  * an addon declares its channels in.
@@ -10682,7 +11201,18 @@ var LABEL_SUPPLY_STEP_IDS = [
10682
11201
  ];
10683
11202
  /** Steps whose box a root detection can BE. */
10684
11203
  var CROP_SUPPLY_STEP_IDS = ["plate-detection", "face-detection"];
10685
- [...LABEL_SUPPLY_STEP_IDS, ...CROP_SUPPLY_STEP_IDS];
11204
+ /**
11205
+ * Steps whose per-detection MASK a root detection can carry (D737). The live
11206
+ * mask step is `segmentation` — a frame-plane refiner that runs its own model
11207
+ * once per detection crop. (`instance-segmentation` is a dormant step id that
11208
+ * no camera tree carries.)
11209
+ */
11210
+ var MASK_SUPPLY_STEP_IDS = ["segmentation"];
11211
+ [
11212
+ ...LABEL_SUPPLY_STEP_IDS,
11213
+ ...CROP_SUPPLY_STEP_IDS,
11214
+ ...MASK_SUPPLY_STEP_IDS
11215
+ ];
10686
11216
  var MODEL_FORMATS = [
10687
11217
  "onnx",
10688
11218
  "coreml",
@@ -10711,7 +11241,53 @@ var ModelFormatEntrySchema = object({
10711
11241
  /** Multi-file payload (directory members or sibling files). */
10712
11242
  files: array(string()).readonly().optional(),
10713
11243
  /** Runtime(s) that can use this format. If omitted, inferred from ModelFormat key */
10714
- runtimes: array(_enum(["python"])).readonly().optional()
11244
+ runtimes: array(_enum(["python"])).readonly().optional(),
11245
+ /**
11246
+ * Content revision of the artefact, for one hosted OFF the CamStack mirror.
11247
+ * A format on the mirror leaves it unset: its revision (the sha256 of its
11248
+ * weight file) comes from the downloader's generated table, kept in step
11249
+ * with the mirror by `scripts/check-hosted-model-revisions.ts` (D744). A
11250
+ * node records the revision it downloaded next to the file
11251
+ * (`<file>.revision`); a copy with no record or a different one is stale
11252
+ * unless its weight file hashes to the revision, and a stale copy is
11253
+ * downloaded again, the old one serving until the new one is complete. No
11254
+ * revision at all ⇒ a file on disk is current, whatever it holds (D743).
11255
+ */
11256
+ revision: string().min(1).optional()
11257
+ });
11258
+ /**
11259
+ * What a node holds for one (model, format) (D746). `current` is a complete
11260
+ * copy at its catalog revision — exactly what `downloaded: true` means.
11261
+ * `stale` is bytes on disk that are not (yet) proven current under D743/D744:
11262
+ * no or a different revision record, or a missing sibling. `missing` is no
11263
+ * copy. `downloaded` alone folds `stale` into "not downloaded", which hid
11264
+ * reclaimable bytes and a copy about to be replaced.
11265
+ */
11266
+ var ModelOnDiskStateSchema = _enum([
11267
+ "current",
11268
+ "stale",
11269
+ "missing"
11270
+ ]);
11271
+ /**
11272
+ * The numeric precision of one format's BUILD (D746) — reported only when the
11273
+ * build states it (file-name token, an INT8 variant, an EdgeTPU compile, a
11274
+ * CamStack Core ML export). Absent means "not stated", never "fp32".
11275
+ */
11276
+ var ModelFormatPrecisionSchema = _enum([
11277
+ "fp32",
11278
+ "fp16",
11279
+ "int8"
11280
+ ]);
11281
+ /**
11282
+ * One format of one model as a node's `pipelineExecutor.getSchema` reports it.
11283
+ * `onDisk` / `precision` are optional for version skew: a runner that predates
11284
+ * them omits them, and a reader falls back to `downloaded`.
11285
+ */
11286
+ var PipelineModelFormatStatusSchema = object({
11287
+ downloaded: boolean(),
11288
+ sizeMB: number(),
11289
+ onDisk: ModelOnDiskStateSchema.optional(),
11290
+ precision: ModelFormatPrecisionSchema.optional()
10715
11291
  });
10716
11292
  /**
10717
11293
  * Extra file that must be downloaded alongside the model (e.g., labels JSON, dict.txt).
@@ -10825,25 +11401,36 @@ var ModelLicenseSchema = preprocess((value) => typeof value === "string" ? { wei
10825
11401
  * - `crop`: the root draws the box the step would have found (`license_plate`
10826
11402
  * for plate-detection, `face` for face-detection). The box becomes a detail
10827
11403
  * child of the `parentMacro` detection that contains it — never a track.
11404
+ * - `mask`: the root's decode emits an instance mask with every detection (a
11405
+ * YOLO26-seg root, D737) — the `segmentation` step's result, carried on the
11406
+ * detection in the shape that step produces. Derived from the model's
11407
+ * postprocessor on read, never stored by an import.
10828
11408
  */
10829
- var RootStepSupplySchema = discriminatedUnion("kind", [object({
10830
- kind: literal("label"),
10831
- stepId: _enum(LABEL_SUPPLY_STEP_IDS),
10832
- labelToEffect: record(string(), string()),
10833
- uncovered: array(string()).readonly()
10834
- }), object({
10835
- kind: literal("crop"),
10836
- stepId: _enum(CROP_SUPPLY_STEP_IDS),
10837
- rootLabels: array(string()).readonly(),
10838
- parentMacro: _enum(["vehicle", "person"]),
10839
- childClass: _enum(["plate", "face"]),
10840
- /**
10841
- * The root's smaller input side, stamped on read by `rootSuppliesOf` from
10842
- * the model entry — what a step's `minRootInputPx` gate judges. Never
10843
- * stored by an import.
10844
- */
10845
- rootInputPx: number().int().positive().optional()
10846
- })]);
11409
+ var RootStepSupplySchema = discriminatedUnion("kind", [
11410
+ object({
11411
+ kind: literal("label"),
11412
+ stepId: _enum(LABEL_SUPPLY_STEP_IDS),
11413
+ labelToEffect: record(string(), string()),
11414
+ uncovered: array(string()).readonly()
11415
+ }),
11416
+ object({
11417
+ kind: literal("crop"),
11418
+ stepId: _enum(CROP_SUPPLY_STEP_IDS),
11419
+ rootLabels: array(string()).readonly(),
11420
+ parentMacro: _enum(["vehicle", "person"]),
11421
+ childClass: _enum(["plate", "face"]),
11422
+ /**
11423
+ * The root's smaller input side, stamped on read by `rootSuppliesOf` from
11424
+ * the model entry — what a step's `minRootInputPx` gate judges. Never
11425
+ * stored by an import.
11426
+ */
11427
+ rootInputPx: number().int().positive().optional()
11428
+ }),
11429
+ object({
11430
+ kind: literal("mask"),
11431
+ stepId: _enum(MASK_SUPPLY_STEP_IDS)
11432
+ })
11433
+ ]);
10847
11434
  var ModelCatalogEntrySchema = object({
10848
11435
  id: string(),
10849
11436
  name: string(),
@@ -10909,6 +11496,35 @@ var ModelCatalogEntrySchema = object({
10909
11496
  */
10910
11497
  defaultConfidence: number().min(0).max(1).optional(),
10911
11498
  /**
11499
+ * Per-MODEL default of the per-class confidence floors (`minConfidence<Macro>`
11500
+ * on a detector step), keyed by macro class: `{ person: 0.45 }`. A class
11501
+ * absent here runs at the step slider's global default. The same row shape
11502
+ * the floor measurement produces (`model-floors.json`: modelId → floors), so
11503
+ * a measured table is copied in as-is. An operator override is bound to the
11504
+ * model it was made for and does not survive a model change (D738). A custom
11505
+ * / imported model may declare it; without it, the global defaults apply.
11506
+ */
11507
+ defaultClassFloors: record(string(), number().min(0).max(1)).optional(),
11508
+ /**
11509
+ * The inference precision this model's OpenVINO IR needs on an Intel GPU.
11510
+ * Absent ⇒ the device default (f16 on a GPU). Set to `'f32'` for an FP32 IR
11511
+ * that produces invalid output at f16 — measured 2026-10-07 for YOLO26
11512
+ * base IRs (`yolo26s`: 0 true / 146 false positives; `yolo26m*`: NaN
11513
+ * scores) on the Core Ultra iGPU and the N100. Threaded to the pool as
11514
+ * `PoolModelConfig.gpuInferencePrecision`; the pool sets
11515
+ * INFERENCE_PRECISION_HINT on a GPU only. Costs ~60% latency on the GPU.
11516
+ */
11517
+ gpuInferencePrecision: _enum(["f32", "f16"]).optional(),
11518
+ /**
11519
+ * ROOT detectors only: per supplied step (`animal-classifier`, …), the
11520
+ * minimum DETECTION score from which this root's own fine label (species,
11521
+ * vehicle type — D736 root supply) is taken (D741). Below it the detection
11522
+ * keeps its macro class without the fine label. `1` = never take it from
11523
+ * this root. Absent ⇒ no floor beyond the macro floor. The supplied step's
11524
+ * `minConfidence` slider, bound to the ROOT model, overrides it.
11525
+ */
11526
+ suppliedLabelFloors: record(string(), number().min(0).max(1)).optional(),
11527
+ /**
10912
11528
  * When true, the executor produces a landmark-aligned crop (similarity warp
10913
11529
  * onto the canonical template) before this step runs, instead of a plain
10914
11530
  * axis-aligned bbox crop. Required for face-recognition embedders (ArcFace):
@@ -12607,13 +13223,6 @@ var BrokerRtspClientSchema = object({
12607
13223
  lastRtpAt: number(),
12608
13224
  bytesSent: number()
12609
13225
  });
12610
- var BrokerDecodedClientSchema = object({
12611
- tag: string(),
12612
- subscribedAt: number(),
12613
- maxFps: number(),
12614
- framesDelivered: number(),
12615
- framesDropped: number()
12616
- });
12617
13226
  var BrokerAudioClientSchema = object({
12618
13227
  tag: string(),
12619
13228
  subscribedAt: number(),
@@ -12705,7 +13314,6 @@ var BrokerEncodedClientSchema = object({
12705
13314
  });
12706
13315
  var BrokerClientsSchema = object({
12707
13316
  rtsp: array(BrokerRtspClientSchema).readonly(),
12708
- decoded: array(BrokerDecodedClientSchema).readonly(),
12709
13317
  audio: array(BrokerAudioClientSchema).readonly(),
12710
13318
  encoded: array(BrokerEncodedClientSchema).readonly(),
12711
13319
  pipeClients: number(),
@@ -13074,11 +13682,7 @@ method(object({
13074
13682
  auth: "admin"
13075
13683
  }), method(object({ brokerId: string() }), BrokerClientsSchema), method(object({
13076
13684
  brokerId: string(),
13077
- channel: _enum([
13078
- "rtsp",
13079
- "decoded",
13080
- "audio"
13081
- ]),
13685
+ channel: _enum(["rtsp", "audio"]),
13082
13686
  handle: string()
13083
13687
  }), object({ killed: boolean() }), {
13084
13688
  kind: "mutation",
@@ -13113,10 +13717,7 @@ method(object({
13113
13717
  }), method(SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, { kind: "mutation" }), method(object({
13114
13718
  subscriptionId: string(),
13115
13719
  maxCount: number().int().positive().default(8)
13116
- }), array(DecodedAudioChunkSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(SubscribeFramesInputSchema, SubscribeFramesResultSchema, { kind: "mutation" }), method(object({
13117
- subscriptionId: string(),
13118
- maxCount: number().int().positive().default(4)
13119
- }), array(FrameHandleSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(object({
13720
+ }), array(DecodedAudioChunkSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(object({
13120
13721
  brokerId: string(),
13121
13722
  seconds: number().min(0).max(30)
13122
13723
  }), _void(), {
@@ -14274,53 +14875,201 @@ id: union([string(), number()]) }), {
14274
14875
  auth: "admin"
14275
14876
  });
14276
14877
  /**
14277
- * shm ring usage stats for a `frameSink: 'shm'` decoder session —
14278
- * exposed via `decoder.getShmStats` so downstream consumers can
14279
- * observe ring pressure (slot count, byte budget, hit/miss ratio).
14878
+ * `keychain` — the hub's encrypted store of secret values (D787).
14879
+ *
14880
+ * Settings blobs never hold a secret: they hold a marker
14881
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
14882
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
14883
+ * is the OWNER's door to its own values: every method is owner-checked
14884
+ * against the CALLER, never against anything the caller claims.
14885
+ *
14886
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
14887
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
14888
+ * connection, the agent from its child's connection carried in
14889
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
14890
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
14891
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
14892
+ * identity against BUGS and misrouting, not against a malicious addon (every
14893
+ * runner is the same OS user): see the threat model in
14894
+ * `docs/design/2026-10-08-secrets-keychain.md`.
14895
+ *
14896
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
14897
+ * parses the input, so a session can never supply it, and the internal mount
14898
+ * floors every method to admin anyway (D240).
14899
+ *
14900
+ * Internal: addons reach it through `ctx.secrets`, never directly.
14280
14901
  */
14281
- var ShmRingStatsSchema = object({
14282
- sessionId: string(),
14283
- slotCount: number().int(),
14284
- slotByteLength: number().int(),
14285
- segmentBytes: number().int(),
14286
- budgetMb: number().int(),
14287
- framesWritten: number().int(),
14288
- getFrameHits: number().int(),
14289
- getFrameMisses: number().int()
14290
- });
14291
- method(object({ codec: string() }), boolean()), method(_void(), object({
14902
+ /** Why a value cannot be served right now. Never folded into "missing". */
14903
+ var KeychainUnavailableReasonSchema = _enum([
14904
+ "key-missing",
14905
+ "wrong-key",
14906
+ "key-file-unreadable",
14907
+ "store-unavailable",
14908
+ "not-initialized",
14909
+ "decrypt-failed"
14910
+ ]);
14911
+ var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
14912
+ state: literal("locked"),
14913
+ reason: KeychainUnavailableReasonSchema
14914
+ })]);
14915
+ var KeychainResolveEntrySchema = discriminatedUnion("kind", [
14916
+ object({
14917
+ kind: literal("value"),
14918
+ value: string(),
14919
+ version: number().int()
14920
+ }),
14921
+ object({ kind: literal("missing") }),
14922
+ object({
14923
+ kind: literal("unavailable"),
14924
+ reason: KeychainUnavailableReasonSchema
14925
+ }),
14926
+ object({ kind: literal("forbidden") })
14927
+ ]);
14928
+ var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
14929
+ /** Metadata of one stored value — never the value. */
14930
+ var KeychainSecretMetaSchema = object({
14931
+ ref: string(),
14932
+ owner: string(),
14933
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
14934
+ scope: string(),
14935
+ fieldPath: string(),
14936
+ version: number().int(),
14937
+ createdAt: number(),
14938
+ updatedAt: number(),
14939
+ /** `addon:<id>` | `user:<id>` | `system`. */
14940
+ updatedBy: string(),
14941
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
14942
+ lastReadAt: number().nullable()
14943
+ });
14944
+ var RefListSchema = array(string().min(1)).max(512);
14945
+ method(object({
14946
+ ref: string().min(1),
14947
+ value: string().min(1)
14948
+ }), object({
14949
+ ref: string(),
14950
+ version: number().int()
14951
+ }), {
14952
+ kind: "mutation",
14953
+ auth: "admin"
14954
+ }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
14955
+ kind: "mutation",
14956
+ auth: "admin"
14957
+ }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
14958
+ var KeychainKeySourceSchema = object({
14959
+ kind: _enum([
14960
+ "config-file",
14961
+ "previous-config-file",
14962
+ "platform",
14963
+ "default-file"
14964
+ ]),
14965
+ /** File sources only — a path is not a secret. */
14966
+ path: string().optional(),
14967
+ /**
14968
+ * True when a whole-volume backup of the data directory carries this key
14969
+ * next to the database it protects (the default file). The page warns.
14970
+ */
14971
+ sharesBackupWithDatabase: boolean()
14972
+ });
14973
+ var KeychainStatusSchema = object({
14974
+ keychain: KeychainStateSchema,
14975
+ /** The source of the master key in use; `null` while locked. */
14976
+ keySource: KeychainKeySourceSchema.nullable(),
14977
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
14978
+ configuredSource: KeychainKeySourceSchema,
14979
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
14980
+ fingerprint: string().nullable(),
14981
+ activeKeyId: string().nullable(),
14982
+ /**
14983
+ * The keychain unlocked with a NON-primary source: the configured primary
14984
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
14985
+ */
14986
+ rotationPending: boolean(),
14987
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
14988
+ retiredWraps: number().int(),
14989
+ recoveryKeyDownloadedAt: number().nullable(),
14990
+ secretCount: number().int()
14991
+ });
14992
+ /**
14993
+ * Whether a stored value is still pointed at by its owner's settings.
14994
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
14995
+ * never reported as an orphan (and never deleted as one).
14996
+ */
14997
+ var KeychainSecretUsageSchema = _enum([
14998
+ "in-use",
14999
+ "orphan",
15000
+ "unknown"
15001
+ ]);
15002
+ var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
15003
+ var KeychainAuditActionSchema = _enum([
15004
+ "put",
15005
+ "delete",
15006
+ "reveal",
15007
+ "rotate-master-key",
15008
+ "purge-retired-keys",
15009
+ "download-recovery-key",
15010
+ "delete-orphans",
15011
+ "reset",
15012
+ "initialize"
15013
+ ]);
15014
+ var KeychainAuditEntrySchema = object({
15015
+ id: string(),
15016
+ at: number(),
15017
+ action: KeychainAuditActionSchema,
15018
+ /** `addon:<id>` | `user:<id>` | `system`. */
15019
+ actor: string(),
15020
+ ref: string().nullable(),
15021
+ detail: string().nullable()
15022
+ });
15023
+ 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({
15024
+ value: string(),
15025
+ version: number().int()
15026
+ }), {
15027
+ kind: "mutation",
15028
+ auth: "admin",
15029
+ caller: "required"
15030
+ }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
15031
+ deleted: array(string()).readonly(),
15032
+ kept: array(object({
15033
+ ref: string(),
15034
+ usage: KeychainSecretUsageSchema
15035
+ })).readonly()
15036
+ }), {
15037
+ kind: "mutation",
15038
+ auth: "admin",
15039
+ caller: "required"
15040
+ }), method(object({}), object({
15041
+ fingerprint: string(),
15042
+ keySource: KeychainKeySourceSchema
15043
+ }), {
15044
+ kind: "mutation",
15045
+ auth: "admin",
15046
+ caller: "required"
15047
+ }), method(object({}), object({ purged: number().int() }), {
15048
+ kind: "mutation",
15049
+ auth: "admin",
15050
+ caller: "required"
15051
+ }), method(object({}), object({
15052
+ key: string(),
15053
+ fingerprint: string(),
15054
+ keySource: KeychainKeySourceSchema
15055
+ }), {
15056
+ kind: "mutation",
15057
+ auth: "admin",
15058
+ caller: "required"
15059
+ }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
15060
+ archivedCollection: string().nullable(),
15061
+ archived: number().int()
15062
+ }), {
15063
+ kind: "mutation",
15064
+ auth: "admin",
15065
+ caller: "required"
15066
+ });
15067
+ method(_void(), object({
14292
15068
  id: string(),
14293
15069
  name: string(),
14294
- isPullMode: boolean().optional(),
14295
- priority: number().optional(),
14296
15070
  hwaccel: string().optional(),
14297
15071
  probedBestHwaccel: string().optional()
14298
- })), method(DecoderSessionConfigSchema, object({
14299
- sessionId: string(),
14300
- nodeId: string()
14301
- })), method(object({ sessionId: string() }), _void()), method(object({
14302
- sessionId: string(),
14303
- packet: EncodedPacketSchema
14304
- }), _void()), method(object({
14305
- sessionId: string(),
14306
- url: string()
14307
- }), _void()), method(object({
14308
- sessionId: string(),
14309
- maxCount: number().default(1),
14310
- waitMs: number().optional()
14311
- }), array(DecodedFrameSchema)), method(object({
14312
- sessionId: string(),
14313
- maxCount: number().default(1),
14314
- waitMs: number().optional()
14315
- }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
14316
- sessionId: string(),
14317
- config: DecoderSessionConfigSchema.partial()
14318
- }), _void()), method(object({ sessionId: string() }), DecoderStatsSchema), method(_void(), array(object({
14319
- sessionId: string(),
14320
- codec: string(),
14321
- outputFormat: string(),
14322
- createdAtMs: number()
14323
- })).readonly()), method(_void(), object({ backend: string() }), {
15072
+ })), method(_void(), object({ backend: string() }), {
14324
15073
  kind: "mutation",
14325
15074
  auth: "admin"
14326
15075
  });
@@ -15157,6 +15906,10 @@ var DeviceInfoSchema = object({
15157
15906
  isCamera: boolean(),
15158
15907
  /** Current config values — serializable snapshot */
15159
15908
  config: record(string(), unknown()),
15909
+ /** Paths inside `config` the device's schema declares secret (D783) —
15910
+ * what the non-admin redaction withholds. Paths, never values. Absent
15911
+ * when the owning runner has not reported them. */
15912
+ secretConfigPaths: array(string()).optional(),
15160
15913
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
15161
15914
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
15162
15915
  metadata: record(string(), unknown()).nullable().optional(),
@@ -15362,12 +16115,22 @@ var DeviceRegisterPayloadSchema = object({
15362
16115
  * call (workers re-register on init), so probe-driven updates
15363
16116
  * (e.g. PTZ flag flipping after the abilities probe) propagate. */
15364
16117
  features: array(string()).optional(),
15365
- config: record(string(), unknown())
16118
+ config: record(string(), unknown()),
16119
+ /** Config paths the device's own schema DECLARES secret
16120
+ * (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
16121
+ * `connection.password`). Re-published on every register; the non-admin
16122
+ * redaction withholds them at any depth (D783). Optional: an older runner
16123
+ * omits it and the keyword backstop applies. */
16124
+ secretConfigPaths: array(string()).optional()
15366
16125
  });
15367
16126
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
15368
16127
  var DevicePersistConfigPayloadSchema = object({
15369
16128
  deviceId: number(),
15370
- data: record(string(), unknown())
16129
+ data: record(string(), unknown()),
16130
+ /** The paths the device's schema declares secret (D783), when the caller
16131
+ * knows them — those values are kept in the keychain, not the blob (D787).
16132
+ * Absent: the paths the device last reported at `registerDevice` apply. */
16133
+ secretConfigPaths: array(string()).optional()
15371
16134
  });
15372
16135
  /** What a migration actually did, per switch. `unreachable` is a first-class
15373
16136
  * answer: a camera that could not be asked is not a camera that was silenced. */
@@ -16189,6 +16952,12 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
16189
16952
  kind: "mutation",
16190
16953
  auth: "admin"
16191
16954
  });
16955
+ var HUB_ADDRESS_ROLES = [
16956
+ "appConnections",
16957
+ "notificationTaps",
16958
+ "internal",
16959
+ "publicEndpoint"
16960
+ ];
16192
16961
  /**
16193
16962
  * Transport bounds for AI capability methods.
16194
16963
  *
@@ -17015,7 +17784,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
17015
17784
  icon: string().optional(),
17016
17785
  /** Addon-owned HTTP route the button navigates to (GET). */
17017
17786
  startUrl: string(),
17018
- stage: LoginStageEnum
17787
+ stage: LoginStageEnum,
17788
+ /**
17789
+ * The provider names an external identity a signed-in user can link to
17790
+ * their own account (D782): `auth.listLinkableProviders` /
17791
+ * `beginExternalLink` offer exactly the redirect methods that set this,
17792
+ * whatever their id. Absent / false — a login button only (magic-link).
17793
+ */
17794
+ linkable: boolean().optional()
17019
17795
  }),
17020
17796
  object({
17021
17797
  kind: literal("widget"),
@@ -20360,7 +21136,13 @@ var NcAlarmModeDelaysListSchema = array(object({
20360
21136
  * Absent = false (logged, not sent). Even when true it is not sent when that same sensor
20361
21137
  * is the one that starts the entry delay — the entry-delay notification already names it.
20362
21138
  */
20363
- notifySensorRewatched: boolean().optional()
21139
+ notifySensorRewatched: boolean().optional(),
21140
+ /**
21141
+ * D735: notify "ignored" when a sensor this arm bypassed really MOVED while armed (its own
21142
+ * change time is after the arm) and set nothing off. Absent = false (logged, not sent). A
21143
+ * re-sync, a recovery from `unavailable` or a duplicate is never announced, switch or not.
21144
+ */
21145
+ notifySensorIgnored: boolean().optional()
20364
21146
  })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
20365
21147
  var NcAlarmModeDelaysEditListSchema = array(object({
20366
21148
  mode: AlarmArmModeSchema,
@@ -20373,7 +21155,9 @@ var NcAlarmModeDelaysEditListSchema = array(object({
20373
21155
  /** D706: set the switch, or `null` to clear it (back to the default, false). */
20374
21156
  notifyDuringEntryDelay: boolean().nullable().optional(),
20375
21157
  /** D706: set the switch, or `null` to clear it (back to the default, false). */
20376
- notifySensorRewatched: boolean().nullable().optional()
21158
+ notifySensorRewatched: boolean().nullable().optional(),
21159
+ /** D735: set the switch, or `null` to clear it (back to the default, false). */
21160
+ notifySensorIgnored: boolean().nullable().optional()
20377
21161
  })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
20378
21162
  /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
20379
21163
  var NcAlarmNonBlockingEditSchema = object({
@@ -21367,8 +22151,8 @@ Object.freeze(Object.fromEntries([{
21367
22151
  var CLUSTER_STEP_SETTING_FIELDS = [{
21368
22152
  stepId: "face-embedding",
21369
22153
  key: "minLandmarkFaceSize",
21370
- label: "Min face size for recognition (detection px)",
21371
- 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.",
22154
+ label: "Min face size to embed (detection-frame px)",
22155
+ 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.",
21372
22156
  type: "slider",
21373
22157
  min: 0,
21374
22158
  max: 64,
@@ -22341,8 +23125,23 @@ var RetrainMacroClassSchema = _enum([
22341
23125
  ]);
22342
23126
  /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
22343
23127
  var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
22344
- /** Did a human draw this box, or did the assist propose it? */
22345
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
23128
+ /**
23129
+ * Where a box came from. A machine-sourced box is a DRAFT on the page until
23130
+ * the operator confirms it; once saved it keeps its source as provenance.
23131
+ *
23132
+ * - `operator` — drawn by hand.
23133
+ * - `assist` — proposed by a detector run on the copy (the camera's own
23134
+ * model, or a larger teacher model).
23135
+ * - `pipeline` — the box the live pipeline actually drew on that frame, read
23136
+ * back from the track store (never a re-run).
23137
+ * - `llm` — proposed by a vision-capable LLM profile.
23138
+ */
23139
+ var RetrainAnnotationSourceSchema = _enum([
23140
+ "operator",
23141
+ "assist",
23142
+ "pipeline",
23143
+ "llm"
23144
+ ]);
22346
23145
  /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
22347
23146
  var RetrainBboxSchema = object({
22348
23147
  x: number(),
@@ -22360,7 +23159,8 @@ var RetrainBboxSchema = object({
22360
23159
  */
22361
23160
  var RetrainAnnotationSchema = object({
22362
23161
  id: string(),
22363
- trackId: string(),
23162
+ /** The frame's track. Absent on a recording still, which has none. */
23163
+ trackId: string().optional(),
22364
23164
  deviceId: number(),
22365
23165
  /** The COPY in retrain storage — never the source track's media key. */
22366
23166
  mediaKey: string(),
@@ -22409,18 +23209,63 @@ var RetrainFrameCandidateSchema = object({
22409
23209
  * fail, whatever became of the original. */
22410
23210
  copied: boolean()
22411
23211
  });
23212
+ /**
23213
+ * One box the live pipeline drew on a copied frame — what a correction starts
23214
+ * from. Derived when the frame is listed, from the track store: the subject
23215
+ * box recorded on the source media row when there is one, else the track
23216
+ * position nearest the frame's capture time. Never stored as an annotation
23217
+ * until the operator confirms it.
23218
+ */
23219
+ var RetrainPipelineBoxSchema = object({
23220
+ /** Normalised `[0,1]` against the full frame. */
23221
+ bbox: RetrainBboxSchema,
23222
+ macroClass: RetrainMacroClassSchema,
23223
+ label: string().optional(),
23224
+ subLabel: string().optional(),
23225
+ /** The detection score of the position used, when it was recorded. */
23226
+ score: number().optional(),
23227
+ /** The root model that produced the track, when it was recorded. */
23228
+ modelId: string().optional(),
23229
+ trackId: string(),
23230
+ /** `subject-box`: recorded on this very frame. `position`: the track's
23231
+ * position nearest the capture time, `deltaMs` away. */
23232
+ basis: _enum(["subject-box", "position"]),
23233
+ deltaMs: number()
23234
+ });
23235
+ /**
23236
+ * Where a retrain frame came from: a TRACK's stored media (copy-on-select),
23237
+ * or the RECORDING at an instant — the frame a model saw nothing in has no
23238
+ * track at all.
23239
+ */
23240
+ var RetrainFrameOriginSchema = _enum(["track", "recording"]);
22412
23241
  /** A frame the dataset OWNS: bytes copied at selection time. */
22413
23242
  var RetrainFrameSchema = object({
22414
23243
  frameId: string(),
22415
23244
  deviceId: number(),
22416
- trackId: string(),
22417
- /** Provenance only. It may already point at nothing — that is expected. */
22418
- sourceMediaId: number().int(),
23245
+ origin: RetrainFrameOriginSchema,
23246
+ /** The track it was copied from. Absent on a recording still. */
23247
+ trackId: string().optional(),
23248
+ /** Provenance only. It may already point at nothing — that is expected.
23249
+ * Absent on a recording still. */
23250
+ sourceMediaId: number().int().optional(),
23251
+ /** A recording still: the playhead instant it was taken at. */
23252
+ epochMs: number().optional(),
22419
23253
  sourceKind: MediaFileKindEnum,
22420
23254
  sizeBytes: number().int(),
22421
23255
  width: number().int(),
22422
23256
  height: number().int(),
22423
- copiedAt: number()
23257
+ copiedAt: number(),
23258
+ /** When the CAMERA captured the frame. Absent on a copy taken before D785. */
23259
+ capturedAt: number().optional(),
23260
+ /** The operator's "every subject in this frame is boxed". Detector
23261
+ * evaluation keeps only complete frames: an unboxed subject would count as
23262
+ * a false positive. */
23263
+ complete: boolean(),
23264
+ /** The boxes the pipeline drew on this frame. Present on list answers;
23265
+ * empty when nothing the track store holds can be placed on it. */
23266
+ pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
23267
+ /** The named collections this frame belongs to. Present on list answers. */
23268
+ collectionIds: array(string()).readonly().optional()
22424
23269
  });
22425
23270
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
22426
23271
  var RetrainCopyRefusalSchema = _enum([
@@ -22441,6 +23286,53 @@ var RetrainFrameListSchema = object({
22441
23286
  /** What the page pre-selects — the native key frame when one survives. */
22442
23287
  autoPickMediaId: number().int().optional()
22443
23288
  });
23289
+ /**
23290
+ * Which frames an annotated export carries. Every field narrows; an empty
23291
+ * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23292
+ * list owned by whoever trains (the training orchestrator), so `frameIds` is
23293
+ * the primitive a version export uses; `batchId` re-selects what an earlier
23294
+ * export carried (`exportedInBatch`).
23295
+ */
23296
+ var RetrainExportFilterSchema = object({
23297
+ deviceIds: array(number()).optional(),
23298
+ frameIds: array(string()).max(2e4).optional(),
23299
+ /** Only frames in at least one of these named collections. */
23300
+ collectionIds: array(string()).max(200).optional(),
23301
+ batchId: string().optional(),
23302
+ /** Only frames the operator marked complete (all subjects boxed). */
23303
+ completeOnly: boolean().optional()
23304
+ });
23305
+ /**
23306
+ * `frames`: the full frame copies, boxes in `annotations.json`.
23307
+ * `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
23308
+ * convention — the classifier layout.
23309
+ */
23310
+ var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
23311
+ /**
23312
+ * Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
23313
+ * the archive, sent chunk by chunk. Covers a presigned PUT and a provider
23314
+ * addon's data-plane upload route alike. Headers are sent verbatim and never
23315
+ * logged.
23316
+ */
23317
+ var RetrainArchiveTargetSchema = object({
23318
+ kind: literal("http"),
23319
+ method: _enum(["PUT", "POST"]),
23320
+ url: string().url(),
23321
+ headers: record(string(), string()).optional()
23322
+ });
23323
+ var RetrainArchiveResultSchema = object({
23324
+ batchId: string(),
23325
+ frames: number().int(),
23326
+ crops: number().int(),
23327
+ annotations: number().int(),
23328
+ /** Frames planned but not shipped (unreadable copy, path too long). */
23329
+ missing: number().int(),
23330
+ bytes: number().int(),
23331
+ /** sha256 of the exact bytes sent. */
23332
+ sha256: string(),
23333
+ /** The target's HTTP status. */
23334
+ status: number().int()
23335
+ });
22444
23336
  /** What the operator asked the assist to look for. */
22445
23337
  var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
22446
23338
  kind: literal("package"),
@@ -22470,6 +23362,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
22470
23362
  reason: string(),
22471
23363
  detail: string().optional()
22472
23364
  })]);
23365
+ /** A named set over the retrain corpus — membership only, it owns no pixels. */
23366
+ var RetrainCollectionSchema = object({
23367
+ id: string(),
23368
+ name: string(),
23369
+ createdAt: number(),
23370
+ frameCount: number().int()
23371
+ });
23372
+ var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
23373
+ kind: literal("created"),
23374
+ collection: RetrainCollectionSchema
23375
+ }), object({
23376
+ kind: literal("refused"),
23377
+ reason: _enum(["empty-name", "duplicate-name"])
23378
+ })]);
23379
+ var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
23380
+ kind: literal("renamed"),
23381
+ collection: RetrainCollectionSchema
23382
+ }), object({
23383
+ kind: literal("refused"),
23384
+ reason: _enum([
23385
+ "empty-name",
23386
+ "duplicate-name",
23387
+ "unknown-collection"
23388
+ ])
23389
+ })]);
23390
+ /**
23391
+ * The outcome of adding the frame at a recording instant. Every refusal is
23392
+ * named: `still-unavailable` (not recording, a gap, or an undecodable frame —
23393
+ * `detail` says which), `still-busy` (the recorder is at its decode bound; try
23394
+ * again), `unreadable-image`, `write-failed`, `unknown-collection`.
23395
+ */
23396
+ var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
23397
+ kind: literal("added"),
23398
+ collectionId: string(),
23399
+ frame: RetrainFrameSchema,
23400
+ /** The moment was already in the dataset; nothing was decoded. */
23401
+ reused: boolean()
23402
+ }), object({
23403
+ kind: literal("refused"),
23404
+ reason: _enum([
23405
+ "unknown-collection",
23406
+ "still-unavailable",
23407
+ "still-busy",
23408
+ "unreadable-image",
23409
+ "write-failed"
23410
+ ]),
23411
+ detail: string().optional()
23412
+ })]);
23413
+ /** A vision LLM profile the AI assist may use, and where it sends the frame. */
23414
+ var RetrainAssistProfileSchema = object({
23415
+ id: string(),
23416
+ name: string(),
23417
+ model: string(),
23418
+ kind: string(),
23419
+ /** `true` when the frame would leave the house (a cloud vendor, or an
23420
+ * endpoint that is not on the local network). The page confirms each such
23421
+ * run, and the provider refuses one without `allowCloud`. */
23422
+ leavesHouse: boolean()
23423
+ });
23424
+ /** A box the AI assist proposed: a draft, plus the model's own reason. */
23425
+ var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
23426
+ /** What the AI assist said about a box that was already on the canvas. */
23427
+ var RetrainLlmReviewSchema = object({
23428
+ /** The `ref` the page sent the box under. */
23429
+ ref: string(),
23430
+ verdict: _enum([
23431
+ "confirmed",
23432
+ "wrong-class",
23433
+ "not-an-object",
23434
+ "uncertain"
23435
+ ]),
23436
+ suggestedClass: RetrainMacroClassSchema.optional(),
23437
+ reason: string()
23438
+ });
23439
+ /**
23440
+ * The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
23441
+ * model and its confidence) and reviews; items the model got wrong (a box off
23442
+ * the frame, an unasked class, an unknown ref) are dropped and counted in
23443
+ * `rejected`. A whole answer that is not the schema is `malformed-answer`.
23444
+ */
23445
+ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23446
+ kind: literal("proposed"),
23447
+ profileId: string(),
23448
+ model: string(),
23449
+ /** The frame was sent outside the house for this answer. */
23450
+ leftHouse: boolean(),
23451
+ proposals: array(RetrainLlmProposalSchema).readonly(),
23452
+ reviews: array(RetrainLlmReviewSchema).readonly(),
23453
+ rejected: number().int()
23454
+ }), object({
23455
+ kind: literal("refused"),
23456
+ reason: _enum([
23457
+ "unknown-frame",
23458
+ "unreadable-frame",
23459
+ "unknown-profile",
23460
+ "profile-disabled",
23461
+ "no-vision",
23462
+ "cloud-not-confirmed",
23463
+ "llm-error",
23464
+ "malformed-answer"
23465
+ ]),
23466
+ detail: string().optional()
23467
+ })]);
22473
23468
  /** The outcome of a lifecycle move owned by the retrain page. */
22474
23469
  var RetrainTransitionResultSchema = object({
22475
23470
  trackId: string(),
@@ -23187,7 +24182,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23187
24182
  auth: "admin"
23188
24183
  }), method(object({
23189
24184
  deviceId: number(),
23190
- trackId: string(),
24185
+ trackId: string().optional(),
23191
24186
  frameId: string()
23192
24187
  }), object({
23193
24188
  removed: boolean(),
@@ -23204,7 +24199,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23204
24199
  auth: "admin"
23205
24200
  }), method(object({
23206
24201
  deviceId: number(),
23207
- trackId: string(),
24202
+ /** The frame's track, when it has one — checked against the frame. */
24203
+ trackId: string().optional(),
23208
24204
  frameId: string(),
23209
24205
  subject: RetrainAssistSubjectSchema,
23210
24206
  /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
@@ -23212,12 +24208,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23212
24208
  }), RetrainAssistResultSchema, {
23213
24209
  kind: "mutation",
23214
24210
  auth: "admin"
23215
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
24211
+ }), method(object({
24212
+ trackId: string().optional(),
24213
+ frameIds: array(string()).max(2e3).optional()
24214
+ }), array(RetrainAnnotationSchema).readonly(), {
23216
24215
  kind: "query",
23217
24216
  auth: "admin"
23218
24217
  }), method(object({
23219
24218
  deviceId: number(),
23220
- trackId: string(),
24219
+ /** The frame's track, when it has one — checked against the frame. */
24220
+ trackId: string().optional(),
23221
24221
  frameId: string(),
23222
24222
  annotations: array(RetrainAnnotationDraftSchema)
23223
24223
  }), array(RetrainAnnotationSchema).readonly(), {
@@ -23235,7 +24235,91 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23235
24235
  }), RetrainTransitionResultSchema, {
23236
24236
  kind: "mutation",
23237
24237
  auth: "admin"
23238
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
24238
+ }), method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string() }), {
24239
+ kind: "query",
24240
+ auth: "admin"
24241
+ }), method(object({
24242
+ deviceId: number(),
24243
+ trackId: string().optional(),
24244
+ frameId: string(),
24245
+ complete: boolean()
24246
+ }), RetrainFrameSchema, {
24247
+ kind: "mutation",
24248
+ auth: "admin"
24249
+ }), method(object({
24250
+ filter: RetrainExportFilterSchema,
24251
+ layout: RetrainExportLayoutSchema,
24252
+ target: RetrainArchiveTargetSchema
24253
+ }), RetrainArchiveResultSchema, {
24254
+ kind: "mutation",
24255
+ auth: "admin",
24256
+ timeoutMs: 60 * 6e4
24257
+ }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24258
+ kind: "query",
24259
+ auth: "admin"
24260
+ }), method(object({
24261
+ deviceId: number(),
24262
+ trackId: string().optional(),
24263
+ frameId: string(),
24264
+ profileId: string(),
24265
+ classes: array(RetrainMacroClassSchema).min(1),
24266
+ boxes: array(object({
24267
+ ref: string(),
24268
+ bbox: RetrainBboxSchema,
24269
+ macroClass: RetrainMacroClassSchema,
24270
+ label: string().optional()
24271
+ })).max(50),
24272
+ allowCloud: boolean()
24273
+ }), RetrainLlmAssistResultSchema, {
24274
+ kind: "mutation",
24275
+ auth: "admin",
24276
+ timeoutMs: 18e4
24277
+ }), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
24278
+ kind: "mutation",
24279
+ auth: "admin"
24280
+ }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24281
+ kind: "query",
24282
+ auth: "admin"
24283
+ }), method(object({
24284
+ id: string(),
24285
+ name: string().max(120)
24286
+ }), RetrainCollectionRenameResultSchema, {
24287
+ kind: "mutation",
24288
+ auth: "admin"
24289
+ }), method(object({ id: string() }), object({
24290
+ deleted: boolean(),
24291
+ removedFrames: number().int()
24292
+ }), {
24293
+ kind: "mutation",
24294
+ auth: "admin"
24295
+ }), method(object({
24296
+ collectionId: string(),
24297
+ deviceId: number(),
24298
+ epochMs: number()
24299
+ }), AddRetrainFrameFromRecordingResultSchema, {
24300
+ kind: "mutation",
24301
+ auth: "admin",
24302
+ timeoutMs: 6e4
24303
+ }), method(object({
24304
+ collectionId: string(),
24305
+ frameIds: array(string()).min(1).max(500)
24306
+ }), object({
24307
+ added: number().int(),
24308
+ alreadyMember: number().int(),
24309
+ unknownFrameIds: array(string()).readonly()
24310
+ }), {
24311
+ kind: "mutation",
24312
+ auth: "admin"
24313
+ }), method(object({
24314
+ collectionId: string(),
24315
+ frameId: string()
24316
+ }), object({
24317
+ removed: boolean(),
24318
+ deletedFrame: boolean()
24319
+ }), {
24320
+ kind: "mutation",
24321
+ auth: "admin"
24322
+ }), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
23239
24323
  kind: "query",
23240
24324
  auth: "admin"
23241
24325
  }), method(object({
@@ -23363,7 +24447,7 @@ var FrameRefSchema = object({
23363
24447
  timestamp: number(),
23364
24448
  capturedAt: number().optional()
23365
24449
  });
23366
- var ModelFormatSchema$1 = _enum([
24450
+ var ModelFormatSchema$2 = _enum([
23367
24451
  "onnx",
23368
24452
  "coreml",
23369
24453
  "openvino",
@@ -23381,7 +24465,7 @@ var PipelineSlotSchema = _enum([
23381
24465
  var PipelineEngineChoiceSchema = object({
23382
24466
  runtime: literal("python"),
23383
24467
  backend: string(),
23384
- format: ModelFormatSchema$1,
24468
+ format: ModelFormatSchema$2,
23385
24469
  device: string().optional()
23386
24470
  });
23387
24471
  /**
@@ -23420,28 +24504,10 @@ var PipelineDefaultStepSchema = lazy(() => object({
23420
24504
  group: string().optional(),
23421
24505
  settings: record(string(), unknown()).optional()
23422
24506
  }));
23423
- var PipelineTemplateStepSchema = lazy(() => object({
23424
- addonId: string(),
23425
- enabled: boolean(),
23426
- modelId: string(),
23427
- children: array(PipelineTemplateStepSchema).readonly(),
23428
- settings: record(string(), unknown()).optional()
23429
- }));
23430
- var PipelineTemplateSchema$1 = object({
23431
- id: string(),
23432
- name: string(),
23433
- createdAt: string(),
23434
- updatedAt: string(),
23435
- engine: PipelineEngineChoiceSchema,
23436
- steps: array(PipelineTemplateStepSchema).readonly()
23437
- });
23438
24507
  var PipelineModelOptionSchema = object({
23439
24508
  id: string(),
23440
24509
  name: string(),
23441
- formats: record(string(), object({
23442
- downloaded: boolean(),
23443
- sizeMB: number()
23444
- })),
24510
+ formats: record(string(), PipelineModelFormatStatusSchema),
23445
24511
  group: ModelVariantGroupSchema.optional(),
23446
24512
  legacy: boolean().optional(),
23447
24513
  provider: ModelProviderIdSchema.optional(),
@@ -23608,6 +24674,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
23608
24674
  }), {
23609
24675
  kind: "mutation",
23610
24676
  auth: "admin"
24677
+ }), method(object({
24678
+ nodeId: string(),
24679
+ deviceIds: array(number()).readonly().optional(),
24680
+ dryRun: boolean()
24681
+ }), object({
24682
+ entries: array(object({
24683
+ deviceId: number(),
24684
+ keys: array(string()).readonly()
24685
+ })).readonly(),
24686
+ refused: array(object({
24687
+ deviceId: number(),
24688
+ reason: string()
24689
+ })).readonly()
24690
+ }), {
24691
+ kind: "mutation",
24692
+ auth: "admin"
23611
24693
  }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
23612
24694
  /** `<backend>:<device>`, e.g. `openvino:gpu`. */
23613
24695
  deviceKey: string(),
@@ -23633,22 +24715,14 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
23633
24715
  }), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(object({
23634
24716
  steps: array(PipelineStepInputSchema),
23635
24717
  deviceKey: string().optional()
23636
- }), PipelineValidationResultSchema), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
23637
- name: string(),
23638
- steps: array(PipelineTemplateStepSchema).readonly(),
23639
- engine: PipelineEngineChoiceSchema
23640
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
23641
- id: string(),
23642
- name: string().optional(),
23643
- steps: array(PipelineTemplateStepSchema).readonly().optional()
23644
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
24718
+ }), PipelineValidationResultSchema), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
23645
24719
  addonId: string(),
23646
24720
  modelId: string(),
23647
- format: ModelFormatSchema$1
24721
+ format: ModelFormatSchema$2
23648
24722
  }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
23649
24723
  addonId: string(),
23650
24724
  modelId: string(),
23651
- format: ModelFormatSchema$1
24725
+ format: ModelFormatSchema$2
23652
24726
  }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
23653
24727
  steps: array(PipelineStepInputSchema).min(1),
23654
24728
  frame: FrameInputSchema.optional(),
@@ -23805,6 +24879,763 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
23805
24879
  filename: string().optional(),
23806
24880
  settings: record(string(), unknown()).optional()
23807
24881
  }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
24882
+ /**
24883
+ * The wire shapes of the Auto tune plan and apply (D745), used by the
24884
+ * `pipeline-orchestrator` cap. The recommender's own types
24885
+ * (`recommend.ts`) are the TS face of the same data; these
24886
+ * schemas are what crosses the cap boundary.
24887
+ */
24888
+ var ModelFormatSchema$1 = _enum(MODEL_FORMATS);
24889
+ /** The operator's range for it. */
24890
+ var MIN_SESSIONS_PER_DEVICE_RANGE = {
24891
+ min: 1,
24892
+ max: 8
24893
+ };
24894
+ var HardwareClassIdSchema = _enum([
24895
+ "intel-core-ultra",
24896
+ "intel-n-series",
24897
+ "apple-m-base",
24898
+ "apple-m-pro",
24899
+ "unknown"
24900
+ ]);
24901
+ var AcceleratorKindSchema = _enum([
24902
+ "intel-npu",
24903
+ "intel-igpu",
24904
+ "x86-cpu",
24905
+ "arm-cpu",
24906
+ "apple-ane",
24907
+ "coral"
24908
+ ]);
24909
+ var RecommendationReasonSchema = discriminatedUnion("kind", [
24910
+ object({
24911
+ kind: literal("capacity"),
24912
+ sessions: number(),
24913
+ minSessions: number()
24914
+ }),
24915
+ object({
24916
+ kind: literal("tie-faster"),
24917
+ over: string(),
24918
+ recallDelta: number()
24919
+ }),
24920
+ object({
24921
+ kind: literal("stepped-down"),
24922
+ from: string(),
24923
+ to: string(),
24924
+ limitedBy: string()
24925
+ }),
24926
+ object({
24927
+ kind: literal("no-fit-lightest"),
24928
+ sessions: number(),
24929
+ minSessions: number()
24930
+ }),
24931
+ object({
24932
+ kind: literal("derived-latency"),
24933
+ modelId: string()
24934
+ }),
24935
+ object({ kind: literal("cpu-device") }),
24936
+ object({ kind: literal("coral-untouched") }),
24937
+ object({ kind: literal("device-disabled") }),
24938
+ object({ kind: literal("device-unavailable") }),
24939
+ object({ kind: literal("node-offline") }),
24940
+ object({ kind: literal("no-hardware-facts") }),
24941
+ object({
24942
+ kind: literal("no-measured-data"),
24943
+ hardwareClass: HardwareClassIdSchema
24944
+ }),
24945
+ object({
24946
+ kind: literal("no-family-build"),
24947
+ format: ModelFormatSchema$1
24948
+ }),
24949
+ object({
24950
+ kind: literal("kept-custom-pin"),
24951
+ modelId: string(),
24952
+ deviceKey: string()
24953
+ })
24954
+ ]);
24955
+ /** Why a device is left exactly as it is, whatever the plan would pick (D786). */
24956
+ var KeptReasonSchema = _enum(["custom-pin"]);
24957
+ /**
24958
+ * Where a choice's latency came from (D791): this node's own benchmark
24959
+ * result, or the hardware-class table. Measured on the node beats the table.
24960
+ */
24961
+ var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
24962
+ kind: literal("node-benchmark"),
24963
+ resultId: string(),
24964
+ measuredAtMs: number()
24965
+ })]);
24966
+ var DeviceModelChoiceSchema = object({
24967
+ modelId: string(),
24968
+ p50Ms: number(),
24969
+ fps: number(),
24970
+ measured: boolean(),
24971
+ /** Absent on a plan from before D791 — read as the table. */
24972
+ source: LatencySourceSchema.optional(),
24973
+ /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
24974
+ capacitySessions: number(),
24975
+ personRecall: number()
24976
+ });
24977
+ var DeviceRecommendationSchema = object({
24978
+ deviceKey: string(),
24979
+ accelerator: AcceleratorKindSchema.nullable(),
24980
+ enabled: boolean(),
24981
+ available: boolean(),
24982
+ chosen: DeviceModelChoiceSchema.nullable(),
24983
+ /** Present when the device is kept as is: Apply writes nothing on it. */
24984
+ kept: KeptReasonSchema.optional(),
24985
+ reasons: array(RecommendationReasonSchema).readonly()
24986
+ });
24987
+ var NodeRecommendationSchema = object({
24988
+ nodeId: string(),
24989
+ reachable: boolean(),
24990
+ hardwareClass: HardwareClassIdSchema.nullable(),
24991
+ cpuModel: string().nullable(),
24992
+ skipped: boolean(),
24993
+ acceleratorModelId: string().nullable(),
24994
+ devices: array(DeviceRecommendationSchema).readonly(),
24995
+ reasons: array(RecommendationReasonSchema).readonly()
24996
+ });
24997
+ var ModelPinChangeSchema = object({
24998
+ stepId: string(),
24999
+ before: string().nullable(),
25000
+ after: string().nullable()
25001
+ });
25002
+ var NodeDeviceChangeSchema = object({
25003
+ nodeId: string(),
25004
+ deviceKey: string(),
25005
+ madeExplicit: boolean(),
25006
+ modelPins: array(ModelPinChangeSchema).readonly(),
25007
+ thresholds: array(object({
25008
+ stepId: string(),
25009
+ keys: array(string()).readonly()
25010
+ })).readonly()
25011
+ });
25012
+ var CameraOverrideClearSchema = object({
25013
+ deviceId: number(),
25014
+ source: _enum(["step-override", "wholesale"]),
25015
+ nodeId: string(),
25016
+ deviceKey: string().nullable(),
25017
+ stepId: string(),
25018
+ modelIdBefore: string().nullable(),
25019
+ keys: array(string()).readonly()
25020
+ });
25021
+ var DetectorStoreClearSchema = object({
25022
+ deviceId: number(),
25023
+ keys: array(string()).readonly()
25024
+ });
25025
+ var AutoTuneWarningSchema = discriminatedUnion("kind", [
25026
+ object({
25027
+ kind: literal("detector-store-cluster-wide"),
25028
+ skippedNodes: array(string()).readonly()
25029
+ }),
25030
+ object({
25031
+ kind: literal("detector-store-unreadable"),
25032
+ error: string()
25033
+ }),
25034
+ object({
25035
+ kind: literal("coral-enabled"),
25036
+ nodeId: string(),
25037
+ deviceKey: string()
25038
+ }),
25039
+ object({
25040
+ kind: literal("custom-pin-kept"),
25041
+ nodeId: string(),
25042
+ deviceKey: string().nullable(),
25043
+ deviceId: number().nullable(),
25044
+ modelId: string()
25045
+ }),
25046
+ object({
25047
+ kind: literal("custom-registry-unreadable"),
25048
+ error: string()
25049
+ })
25050
+ ]);
25051
+ var AutoTuneOptionsSchema = object({
25052
+ /** Share of each accelerator's throughput kept free (0.3–0.5). */
25053
+ headroom: number().min(.3).max(.5).default(.4),
25054
+ /**
25055
+ * The least number of parallel sessions every device must sustain at the
25056
+ * camera rate with the headroom kept free (D755). The most accurate model
25057
+ * that reaches it wins.
25058
+ */
25059
+ minSessionsPerDevice: number().int().min(MIN_SESSIONS_PER_DEVICE_RANGE.min).max(MIN_SESSIONS_PER_DEVICE_RANGE.max).default(2)
25060
+ });
25061
+ var AutoTunePlanSchema = object({
25062
+ /** Hash of everything the apply will write — the apply refuses a different one. */
25063
+ planHash: string(),
25064
+ family: literal("yolov9"),
25065
+ headroom: number(),
25066
+ minSessionsPerDevice: number(),
25067
+ /** The detection rate a session is counted at (the fastest camera running the pipeline root). */
25068
+ cameraFps: number(),
25069
+ generatedAt: number(),
25070
+ nodes: array(NodeRecommendationSchema).readonly(),
25071
+ nodeChanges: array(NodeDeviceChangeSchema).readonly(),
25072
+ cameraClears: array(CameraOverrideClearSchema).readonly(),
25073
+ detectorStoreClears: array(DetectorStoreClearSchema).readonly(),
25074
+ warnings: array(AutoTuneWarningSchema).readonly()
25075
+ });
25076
+ var AutoTuneApplyInputSchema = object({
25077
+ planHash: string(),
25078
+ headroom: number().min(.3).max(.5).default(.4),
25079
+ minSessionsPerDevice: number().int().min(MIN_SESSIONS_PER_DEVICE_RANGE.min).max(MIN_SESSIONS_PER_DEVICE_RANGE.max).default(2)
25080
+ });
25081
+ var AutoTunePhaseResultSchema = object({
25082
+ phase: _enum([
25083
+ "download",
25084
+ "camera-overrides",
25085
+ "detector-thresholds",
25086
+ "node-models",
25087
+ "redispatch"
25088
+ ]),
25089
+ ok: boolean(),
25090
+ detail: string()
25091
+ });
25092
+ var AutoTuneApplyResultSchema = discriminatedUnion("kind", [
25093
+ object({
25094
+ kind: literal("applied"),
25095
+ planHash: string(),
25096
+ phases: array(AutoTunePhaseResultSchema).readonly()
25097
+ }),
25098
+ object({
25099
+ kind: literal("aborted"),
25100
+ phases: array(AutoTunePhaseResultSchema).readonly()
25101
+ }),
25102
+ object({
25103
+ kind: literal("stale"),
25104
+ plan: AutoTunePlanSchema
25105
+ }),
25106
+ object({
25107
+ kind: literal("refused"),
25108
+ reason: _enum(["apply-in-progress"])
25109
+ })
25110
+ ]);
25111
+ /**
25112
+ * Wire shapes of the Load balancing surface (D748): the session placement
25113
+ * policy, the atomic share write, the observed placement statistics, the
25114
+ * hardware share suggestion and the stale device pins.
25115
+ */
25116
+ /**
25117
+ * How a new detection session picks its node and device.
25118
+ * - `least-loaded` — the historical rule: lowest `attached / weight`, a
25119
+ * constant node order at a tie (D37). An idle node always ties at 0, so a
25120
+ * weight only bites once a node already holds a session.
25121
+ * - `share` — the share of PARALLEL sessions is held to the weights, and a
25122
+ * full or drowning node yields to a free one (D748).
25123
+ */
25124
+ var SessionPlacementPolicySchema = _enum(["least-loaded", "share"]);
25125
+ var LoadBalancingSharesInputSchema = object({
25126
+ /** nodeId → share (> 0). A node left out keeps its weight. */
25127
+ nodes: record(string(), number().positive()).default({}),
25128
+ /** nodeId → deviceKey → share (> 0). A device left out keeps its weight. */
25129
+ devices: record(string(), record(string(), number().positive())).default({})
25130
+ });
25131
+ var PlacementStatsInputSchema = object({
25132
+ /** Window the observed shares are averaged over (default 1 h, max 24 h). */
25133
+ windowMs: number().int().min(6e4).max(1440 * 60 * 1e3).default(3600 * 1e3) });
25134
+ var PlacementDeviceStatsSchema = object({
25135
+ deviceKey: string(),
25136
+ /** Sessions running on this device now. */
25137
+ sessionsNow: number(),
25138
+ /** Sessions started on this device inside the window. */
25139
+ sessionsStarted: number(),
25140
+ /** Time-weighted share of the node's parallel sessions over the window (0–1); null = no session ran. */
25141
+ observedShare: number().nullable()
25142
+ });
25143
+ var PlacementNodeStatsSchema = object({
25144
+ nodeId: string(),
25145
+ sessionsNow: number(),
25146
+ sessionsStarted: number(),
25147
+ /** Time-weighted share of the cluster's parallel sessions over the window (0–1); null = none ran. */
25148
+ observedShare: number().nullable(),
25149
+ /** Most sessions this node ran at once inside the window. */
25150
+ peakSessions: number(),
25151
+ /** Sessions a share election handed elsewhere because this node was full or drowning. */
25152
+ yieldsAway: number(),
25153
+ devices: array(PlacementDeviceStatsSchema).readonly()
25154
+ });
25155
+ /** A camera's device pin that the session path cannot honour. */
25156
+ var StaleDevicePinSchema = object({
25157
+ deviceId: number(),
25158
+ deviceKey: string(),
25159
+ /** `disabled` — the key exists on some node but is not enabled anywhere; `absent` — no node has it. */
25160
+ reason: _enum(["disabled", "absent"])
25161
+ });
25162
+ var PlacementStatsSchema = object({
25163
+ policy: SessionPlacementPolicySchema,
25164
+ windowMs: number(),
25165
+ /** How much of the window was actually observed (the hub keeps it in memory). */
25166
+ observedForMs: number(),
25167
+ sessionsNow: number(),
25168
+ /** Most parallel sessions across the cluster inside the window. */
25169
+ clusterPeakSessions: number(),
25170
+ nodes: array(PlacementNodeStatsSchema).readonly(),
25171
+ stalePins: array(StaleDevicePinSchema).readonly()
25172
+ });
25173
+ /**
25174
+ * Where an automatic share's capacity comes from (D755).
25175
+ * - `hardware` — the static capacity of each device at its Auto tune model:
25176
+ * the measured latency table for the node's hardware class.
25177
+ * - `benchmark` — the node's own measured capacity (node benchmark results).
25178
+ * A node with no results falls back to `hardware`, and says so.
25179
+ */
25180
+ var CapacitySourceSchema = _enum(["hardware", "benchmark"]);
25181
+ /** Why a node under the `benchmark` source was sized from hardware instead. */
25182
+ var CapacityFallbackSchema = _enum(["no-benchmark-results", "partial-benchmark-results"]);
25183
+ var SuggestSharesInputSchema = object({
25184
+ headroom: number().min(.3).max(.5).default(.4),
25185
+ /** Default `hardware`. */
25186
+ source: CapacitySourceSchema.default("hardware")
25187
+ });
25188
+ var SuggestedDeviceShareSchema = object({
25189
+ deviceKey: string(),
25190
+ /** Share of the node (0–100, rounded). */
25191
+ share: number(),
25192
+ modelId: string().nullable(),
25193
+ /** Inferences per second at that model, from the measured table; null when sized by a benchmark. */
25194
+ fps: number().nullable(),
25195
+ /** False for a table cell derived from another chip; true for a measured cell or a benchmark. */
25196
+ measured: boolean(),
25197
+ /**
25198
+ * Advisory session cap: ⌊fps × (1 − headroom) / camera fps⌋ from the table,
25199
+ * or the benchmark's measured max sessions. Never enforced.
25200
+ */
25201
+ suggestedMaxSessions: number().nullable()
25202
+ });
25203
+ var SuggestedNodeShareSchema = object({
25204
+ nodeId: string(),
25205
+ /** Share of the cluster (0–100, rounded); null = node skipped (offline, unknown hardware). */
25206
+ share: number().nullable(),
25207
+ /** Parallel sessions the node sustains at the suggested models with the headroom kept free. */
25208
+ capacitySessions: number(),
25209
+ devices: array(SuggestedDeviceShareSchema).readonly(),
25210
+ skippedReason: string().nullable(),
25211
+ /** What this node's capacity was read from; null when the node is skipped. */
25212
+ capacitySource: CapacitySourceSchema.nullable(),
25213
+ /** Set when the `benchmark` source was asked for and this node used `hardware`. */
25214
+ capacityFallback: CapacityFallbackSchema.nullable()
25215
+ });
25216
+ var SuggestSharesResultSchema = object({
25217
+ headroom: number(),
25218
+ /** The source asked for; each node says what it actually used. */
25219
+ source: CapacitySourceSchema,
25220
+ /** Camera detection rate the capacity is counted in (the fastest camera's fps). */
25221
+ cameraFps: number(),
25222
+ /** The Auto tune capacity floor the models were picked at. */
25223
+ minSessionsPerDevice: number(),
25224
+ nodes: array(SuggestedNodeShareSchema).readonly()
25225
+ });
25226
+ /**
25227
+ * Where the node and device shares come from (D750, D755, D791).
25228
+ * - `benchmark` (default since D791) — each node's capacity as its own node
25229
+ * benchmark measured it; a node without fresh results is sized from
25230
+ * `hardware` and says so. Measured on the node beats the table.
25231
+ * - `hardware` — computed from each node's static capacity only (its
25232
+ * accelerators at their Auto tune models, from the latency table).
25233
+ * Both are recomputed whenever a node or device joins, leaves, is switched
25234
+ * on or off, changes model, or a benchmark result is written. No load input.
25235
+ * - `manual` — the operator's stored sliders.
25236
+ * Either way a node or device that cannot take sessions gives its share to
25237
+ * the others in proportion; the stored values are never rewritten for that.
25238
+ */
25239
+ var ShareSourceSchema = _enum([
25240
+ "hardware",
25241
+ "benchmark",
25242
+ "manual"
25243
+ ]);
25244
+ var SetShareSourceInputSchema = object({ source: ShareSourceSchema });
25245
+ object({
25246
+ nodes: record(string(), number()),
25247
+ devices: record(string(), record(string(), number()))
25248
+ });
25249
+ var EffectiveDeviceShareSchema = object({
25250
+ deviceKey: string(),
25251
+ /** Can take sessions now (enabled, available, can run the root). */
25252
+ eligible: boolean(),
25253
+ /** The share the source assigns, as a percentage of the node's devices. */
25254
+ configuredPct: number(),
25255
+ /** The share actually used, after an ineligible device's share went to the others. */
25256
+ effectivePct: number()
25257
+ });
25258
+ var EffectiveNodeShareSchema = object({
25259
+ nodeId: string(),
25260
+ eligible: boolean(),
25261
+ configuredPct: number(),
25262
+ effectivePct: number(),
25263
+ /** Automatic sources: what this node's share was computed from; null under `manual` or before the first answer. */
25264
+ capacitySource: CapacitySourceSchema.nullable(),
25265
+ /** Automatic `benchmark`: why this node used `hardware` instead. */
25266
+ capacityFallback: CapacityFallbackSchema.nullable(),
25267
+ devices: array(EffectiveDeviceShareSchema).readonly()
25268
+ });
25269
+ var EffectiveSharesSchema = object({
25270
+ source: ShareSourceSchema,
25271
+ policy: SessionPlacementPolicySchema,
25272
+ /** An automatic source with no computed answer yet: the stored sliders are used meanwhile. */
25273
+ autoPending: boolean(),
25274
+ /** When the automatic shares were last computed (ms epoch); null = never. */
25275
+ computedAt: number().nullable(),
25276
+ /** What made the system recompute them last. */
25277
+ trigger: string().nullable(),
25278
+ nodes: array(EffectiveNodeShareSchema).readonly(),
25279
+ /** The relative weights the election reads (before eligibility). */
25280
+ nodeWeights: record(string(), number()),
25281
+ deviceWeights: record(string(), record(string(), number()))
25282
+ });
25283
+ /**
25284
+ * Wire shapes of the node benchmark (D791): the operator's plan, the
25285
+ * preflight the confirmation shows, the run the orchestrator owns, what the
25286
+ * measuring runner reports, and the result rows Auto tune and the automatic
25287
+ * shares read.
25288
+ *
25289
+ * ONE node at a time, owned by the pipeline orchestrator. While a run is
25290
+ * active the cluster is in BENCHMARK MODE for that node: it is not a
25291
+ * detection candidate, camera pins naming it are ignored so its sessions move
25292
+ * elsewhere, and both come back when the mode ends — after a crash or a hub
25293
+ * restart too (a persisted manifest, reconciled against the registry).
25294
+ *
25295
+ * Two measurements, both on the node, driven by its own runner (frames never
25296
+ * cross a process at frame rate, D9):
25297
+ * - `device` — one accelerator × one candidate detector, root only, open
25298
+ * loop: how many streams at the camera rate it carries inside the frame
25299
+ * interval;
25300
+ * - `pipeline` — the chosen detector plus the operator's detail steps
25301
+ * (faces, plates, classifiers, CLIP…), on varied frames from the bench
25302
+ * clip: how many parallel sessions the node carries before latency, drops,
25303
+ * CPU, RAM or the event loop give out.
25304
+ */
25305
+ /** Defaults and bounds, one place. */
25306
+ var NODE_BENCHMARK_DEFAULTS = {
25307
+ fpsPerStream: 10,
25308
+ budgetMinutes: 45,
25309
+ minBudgetMinutes: 10,
25310
+ maxBudgetMinutes: 120,
25311
+ /** A result older than this no longer beats the table. */
25312
+ staleAfterDays: 30,
25313
+ /** Warm-in per ramp step (not accounted). */
25314
+ settleSec: 5,
25315
+ /** Accounted window per ramp step. */
25316
+ measureSec: 20,
25317
+ /** Longest the drain may take before the run is refused. */
25318
+ drainTimeoutSec: 120,
25319
+ /** Candidate models per device in one run. */
25320
+ maxModelsPerDevice: 6
25321
+ };
25322
+ /** The two measurements a run can make. */
25323
+ var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
25324
+ var NodeBenchmarkDevicePlanSchema = object({
25325
+ /** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
25326
+ deviceKey: string().min(1),
25327
+ /**
25328
+ * Root detector candidates for the `device` measurement, in the order
25329
+ * measured. The FIRST is the one the `pipeline` measurement runs.
25330
+ */
25331
+ modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
25332
+ });
25333
+ /** What the operator confirmed. */
25334
+ var NodeBenchmarkPlanSchema = object({
25335
+ nodeId: string().min(1),
25336
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25337
+ /** Which measurements run. At least one. */
25338
+ phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
25339
+ /**
25340
+ * Detail steps (catalog step ids under the root: faces, plates,
25341
+ * classifiers, CLIP…) the `pipeline` measurement enables. The root
25342
+ * detector always runs.
25343
+ */
25344
+ steps: array(string().min(1)).default([]),
25345
+ /** Offered rate of one stream / session. */
25346
+ fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
25347
+ /** Hard deadline: the mode ends and the cluster is restored when it passes. */
25348
+ budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
25349
+ /** Keep the models the run downloaded (default: delete what was not installed before). */
25350
+ keepDownloadedModels: boolean().default(false),
25351
+ /** Start although the other nodes' capacity does not cover the sessions running now. */
25352
+ acceptInsufficientHeadroom: boolean().default(false)
25353
+ });
25354
+ var NodeBenchmarkRefusalSchema = object({
25355
+ kind: _enum([
25356
+ "benchmark-active",
25357
+ "node-offline",
25358
+ "unknown-device",
25359
+ "no-phase",
25360
+ "insufficient-headroom"
25361
+ ]),
25362
+ detail: string(),
25363
+ overridable: boolean()
25364
+ });
25365
+ /** A camera whose detection leaves the node for the run. */
25366
+ var NodeBenchmarkMovingCameraSchema = object({
25367
+ deviceId: number(),
25368
+ /** Placed on the node now (a standing attach or a running session). */
25369
+ placedOnNode: boolean(),
25370
+ /** A node pin naming this node, ignored for the run. */
25371
+ pinnedToNode: boolean()
25372
+ });
25373
+ /** A camera that cannot leave: no other node can obtain its frames. */
25374
+ var NodeBenchmarkStayingCameraSchema = object({
25375
+ deviceId: number(),
25376
+ reason: literal("only-frame-source")
25377
+ });
25378
+ var NodeBenchmarkPreflightSchema = object({
25379
+ nodeId: string(),
25380
+ online: boolean(),
25381
+ moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
25382
+ /** Keep running on the node during the run; the result is flagged contaminated. */
25383
+ staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
25384
+ estimatedDurationMs: number(),
25385
+ /** The run ends and the cluster is restored at the latest after this long. */
25386
+ budgetMs: number(),
25387
+ phases: array(NodeBenchmarkPhaseSchema).readonly(),
25388
+ steps: array(string()).readonly(),
25389
+ devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
25390
+ /** Parallel sessions the cluster runs now, and what the other nodes can carry. */
25391
+ headroom: object({
25392
+ sessionsNow: number(),
25393
+ otherNodesCapacitySessions: number().nullable()
25394
+ }),
25395
+ refusals: array(NodeBenchmarkRefusalSchema).readonly(),
25396
+ canStart: boolean()
25397
+ });
25398
+ /** Where the measuring runner is. */
25399
+ var NodeBenchProgressSchema = object({
25400
+ phase: _enum([
25401
+ "preparing",
25402
+ "device",
25403
+ "pipeline",
25404
+ "cleanup"
25405
+ ]),
25406
+ deviceKey: string().nullable(),
25407
+ modelId: string().nullable(),
25408
+ /** Streams (device) or sessions (pipeline) of the step running now. */
25409
+ load: number().nullable(),
25410
+ cellsDone: number(),
25411
+ cellsTotal: number(),
25412
+ message: string()
25413
+ });
25414
+ /** What limited a ramp. `none` = the ramp ran out of steps still passing. */
25415
+ var NodeBenchLimitSchema = _enum([
25416
+ "p95",
25417
+ "drops",
25418
+ "errors",
25419
+ "stall",
25420
+ "cpu",
25421
+ "ram",
25422
+ "none"
25423
+ ]);
25424
+ var NodeBenchRampStepSchema = object({
25425
+ load: number(),
25426
+ pass: boolean(),
25427
+ p95Ms: number(),
25428
+ dropRatio: number(),
25429
+ /** Completed frames per second over the accounted window. */
25430
+ fps: number(),
25431
+ cpuPct: number().nullable(),
25432
+ ramFreePct: number().nullable(),
25433
+ failReasons: array(string()).readonly()
25434
+ });
25435
+ var NodeBenchCellSchema = discriminatedUnion("phase", [object({
25436
+ phase: literal("device"),
25437
+ deviceKey: string(),
25438
+ modelId: string(),
25439
+ /** Single-stream latency (the K = 1 step). */
25440
+ p50Ms: number(),
25441
+ p95Ms: number(),
25442
+ p99Ms: number(),
25443
+ /** Frames per second sustained at the last passing step. */
25444
+ fps: number(),
25445
+ /** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
25446
+ kMax: number(),
25447
+ limitedBy: NodeBenchLimitSchema,
25448
+ /** First call (model load + warm-up). */
25449
+ warmupMs: number(),
25450
+ ramp: array(NodeBenchRampStepSchema).readonly()
25451
+ }), object({
25452
+ phase: literal("pipeline"),
25453
+ deviceKey: string(),
25454
+ modelId: string(),
25455
+ steps: array(string()).readonly(),
25456
+ /** Parallel sessions at the camera rate the node carried; 0 = not even one. */
25457
+ maxSessions: number(),
25458
+ limitedBy: NodeBenchLimitSchema,
25459
+ /** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
25460
+ stepsFired: array(string()).readonly(),
25461
+ warmupMs: number(),
25462
+ ramp: array(NodeBenchRampStepSchema).readonly()
25463
+ })]);
25464
+ /**
25465
+ * What a result was measured ON. A result whose fingerprint no longer matches
25466
+ * the node no longer beats the table.
25467
+ */
25468
+ var NodeBenchFingerprintSchema = object({
25469
+ pipelineVersion: string().nullable(),
25470
+ cpuModel: string().nullable(),
25471
+ ramGb: number().nullable(),
25472
+ os: string().nullable(),
25473
+ /** Per device: the pool the cells ran on (runtime + tuning). */
25474
+ pools: record(string(), object({
25475
+ runtime: string(),
25476
+ numWorkers: number(),
25477
+ concurrency: number(),
25478
+ batchMode: string()
25479
+ })).default({})
25480
+ });
25481
+ /** The frames the run used. */
25482
+ var NodeBenchClipSchema = object({
25483
+ /** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
25484
+ id: string(),
25485
+ revision: string().nullable(),
25486
+ frames: number(),
25487
+ width: number(),
25488
+ height: number()
25489
+ });
25490
+ var NodeBenchRunnerInputSchema = object({
25491
+ runId: string().min(1),
25492
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25493
+ phases: array(NodeBenchmarkPhaseSchema).min(1),
25494
+ /** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
25495
+ steps: array(string()).default([]),
25496
+ fpsPerStream: number().int().min(1).max(30),
25497
+ /** The runner stops on its own past this instant, whatever the hub does. */
25498
+ deadlineAtMs: number(),
25499
+ settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
25500
+ measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
25501
+ keepDownloadedModels: boolean().default(false)
25502
+ });
25503
+ var NodeBenchRunnerStateSchema = _enum([
25504
+ "running",
25505
+ "done",
25506
+ "failed",
25507
+ "aborted"
25508
+ ]);
25509
+ var NodeBenchRunnerStatusSchema = object({
25510
+ runId: string(),
25511
+ nodeId: string(),
25512
+ state: NodeBenchRunnerStateSchema,
25513
+ progress: NodeBenchProgressSchema.nullable(),
25514
+ /** Every finished cell so far — a run stopped half way keeps what it measured. */
25515
+ cells: array(NodeBenchCellSchema).readonly(),
25516
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25517
+ clip: NodeBenchClipSchema.nullable(),
25518
+ /** Cameras seen running on the node during the run (they share its pools). */
25519
+ activeCameraIds: array(number()).readonly(),
25520
+ /** Models the run downloaded and then deleted (not installed before). */
25521
+ deletedModels: array(string()).readonly(),
25522
+ error: string().nullable(),
25523
+ startedAtMs: number(),
25524
+ finishedAtMs: number().nullable()
25525
+ });
25526
+ var NodeBenchmarkStateSchema = _enum([
25527
+ "draining",
25528
+ "measuring",
25529
+ "restoring",
25530
+ "done",
25531
+ "failed",
25532
+ "aborted"
25533
+ ]);
25534
+ /** Why a run ended. */
25535
+ var NodeBenchmarkEndReasonSchema = _enum([
25536
+ "completed",
25537
+ "operator-abort",
25538
+ "deadline",
25539
+ "node-lost",
25540
+ "runner-lost",
25541
+ "hub-restart",
25542
+ "drain-timeout",
25543
+ "failed"
25544
+ ]);
25545
+ var NodeBenchmarkRunSchema = object({
25546
+ runId: string(),
25547
+ nodeId: string(),
25548
+ state: NodeBenchmarkStateSchema,
25549
+ plan: NodeBenchmarkPlanSchema,
25550
+ startedAtMs: number(),
25551
+ deadlineAtMs: number(),
25552
+ finishedAtMs: number().nullable(),
25553
+ endReason: NodeBenchmarkEndReasonSchema.nullable(),
25554
+ error: string().nullable(),
25555
+ /** Cameras moved off the node for the run. */
25556
+ moved: array(number()).readonly(),
25557
+ /** Cameras that stayed (their only frame source is the node). */
25558
+ staying: array(number()).readonly(),
25559
+ /** Something else ran on the node's pools during the run. */
25560
+ contaminated: boolean(),
25561
+ progress: NodeBenchProgressSchema.nullable(),
25562
+ resultIds: array(string()).readonly()
25563
+ });
25564
+ /** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
25565
+ var NodeBenchmarkStatusSchema = object({
25566
+ /** The node the cluster is in benchmark mode for; null = none. */
25567
+ modeNodeId: string().nullable(),
25568
+ run: NodeBenchmarkRunSchema.nullable()
25569
+ });
25570
+ /**
25571
+ * One stored measurement — the only authority Auto tune and the automatic
25572
+ * shares read measured capacity from. Written by the orchestrator when a run
25573
+ * ends, never by anyone else.
25574
+ */
25575
+ var NodeBenchmarkResultSchema = object({
25576
+ id: string(),
25577
+ runId: string(),
25578
+ nodeId: string(),
25579
+ cell: NodeBenchCellSchema,
25580
+ fpsPerStream: number(),
25581
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25582
+ clip: NodeBenchClipSchema.nullable(),
25583
+ /** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
25584
+ contaminated: boolean(),
25585
+ stayingCameras: array(number()).readonly(),
25586
+ /** The run ended early; the cell itself completed. */
25587
+ partialRun: boolean(),
25588
+ measuredAtMs: number()
25589
+ });
25590
+ var ListNodeBenchmarkResultsInputSchema = object({
25591
+ nodeId: string().optional(),
25592
+ deviceKey: string().optional()
25593
+ });
25594
+ /** A result with its standing today: does it still beat the table? */
25595
+ var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
25596
+ /** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
25597
+ standing: _enum([
25598
+ "fresh",
25599
+ "stale",
25600
+ "superseded"
25601
+ ]),
25602
+ staleWhy: _enum([
25603
+ "age",
25604
+ "runtime",
25605
+ "pool-tuning"
25606
+ ]).nullable()
25607
+ });
25608
+ object({
25609
+ runId: string(),
25610
+ nodeId: string(),
25611
+ startedAtMs: number(),
25612
+ deadlineAtMs: number(),
25613
+ plan: NodeBenchmarkPlanSchema,
25614
+ moved: array(number()).readonly(),
25615
+ staying: array(number()).readonly()
25616
+ });
25617
+ /** Candidate detectors per device, for the plan editor. */
25618
+ var NodeBenchmarkCandidatesSchema = object({
25619
+ nodeId: string(),
25620
+ reachable: boolean(),
25621
+ devices: array(object({
25622
+ deviceKey: string(),
25623
+ enabled: boolean(),
25624
+ available: boolean(),
25625
+ /** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
25626
+ suggested: array(string()).readonly(),
25627
+ /** Every root detector the device has a build for. */
25628
+ all: array(string()).readonly(),
25629
+ /** The model the device runs now, when pinned. */
25630
+ currentModelId: string().nullable()
25631
+ })).readonly(),
25632
+ /** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
25633
+ steps: array(object({
25634
+ id: string(),
25635
+ name: string(),
25636
+ slot: string()
25637
+ })).readonly()
25638
+ });
23808
25639
  object({
23809
25640
  activeCameras: number(),
23810
25641
  throttledCameras: number(),
@@ -24682,14 +26513,15 @@ var RunnerLocalLoadSchema = object({
24682
26513
  * Per-inference-device live load (multi-device C4). One entry per deviceKey
24683
26514
  * this runner currently has attached cameras on, so the orchestrator's second
24684
26515
  * `balance()` pass (over a node's devices) weights on real per-pool session
24685
- * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
24686
- * per device is 0 until the pool backlog gets a public accessor (follow-up).
26516
+ * counts. Empty on single-device / pre-multi-device runners. There is no
26517
+ * per-device queue depth: the inference pool's backlog has no accessor, and
26518
+ * a field that always read 0 was removed rather than shown as a measurement
26519
+ * (D762).
24687
26520
  */
24688
26521
  devices: array(object({
24689
26522
  deviceKey: string(),
24690
26523
  backend: string(),
24691
- attachedCameras: number(),
24692
- queueDepthTotal: number()
26524
+ attachedCameras: number()
24693
26525
  })).default([]),
24694
26526
  /** Hardware capability flags reported by this node. */
24695
26527
  hardware: object({
@@ -24892,7 +26724,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
24892
26724
  }), ParkedTrackFrameSchema.nullable()), method(object({
24893
26725
  deviceId: number(),
24894
26726
  trackId: string()
24895
- }), object({ released: number().int().nonnegative() }), { kind: "mutation" });
26727
+ }), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
26728
+ accepted: literal(true),
26729
+ runId: string()
26730
+ }), {
26731
+ kind: "mutation",
26732
+ auth: "admin"
26733
+ }), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
26734
+ kind: "mutation",
26735
+ auth: "admin"
26736
+ });
24896
26737
  var CameraPipelineConfigSchema = object({
24897
26738
  engine: PipelineEngineChoiceSchema.optional(),
24898
26739
  steps: array(PipelineStepInputSchema).readonly(),
@@ -24903,14 +26744,6 @@ var CameraPipelineConfigSchema = object({
24903
26744
  settings: record(string(), unknown()).readonly().optional()
24904
26745
  }).nullable().optional()
24905
26746
  });
24906
- var PipelineTemplateSchema = object({
24907
- id: string(),
24908
- name: string(),
24909
- description: string().optional(),
24910
- config: CameraPipelineConfigSchema,
24911
- createdAt: string(),
24912
- updatedAt: string()
24913
- });
24914
26747
  var DeviceStepConfigSchema = object({
24915
26748
  modelId: string().optional(),
24916
26749
  settings: record(string(), unknown()).optional(),
@@ -24984,9 +26817,10 @@ var CameraStepOverridePatchSchema = object({
24984
26817
  modelId: string().optional(),
24985
26818
  settings: record(string(), unknown()).readonly().optional()
24986
26819
  });
26820
+ var CameraStepSettingsSchema = record(string(), record(string(), unknown()).readonly());
24987
26821
  var CameraPipelineSettingsSchema = object({
24988
- pinnedAgentNodeId: string().optional(),
24989
26822
  stepToggles: record(string(), boolean()).optional(),
26823
+ stepSettings: CameraStepSettingsSchema.optional(),
24990
26824
  stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
24991
26825
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
24992
26826
  });
@@ -25019,7 +26853,10 @@ var PipelineAssignmentSchema = object({
25019
26853
  });
25020
26854
  /**
25021
26855
  * Per-agent load summary surfaced to the load balancer + dashboards.
25022
- * Aggregated from each runner's `getLocalLoad` cap call.
26856
+ * Aggregated from each runner's `getLocalLoad` cap call. In the
26857
+ * `getAgentLoad` report, a single-device node's default-pool sessions (no
26858
+ * `deviceKey`) are credited to its one eligible device in `load.devices` —
26859
+ * the default pool IS that device (D745); the balancer's census stays raw.
25023
26860
  */
25024
26861
  var AgentLoadSummarySchema = object({
25025
26862
  nodeId: string(),
@@ -25108,26 +26945,27 @@ var CameraBrokerStatusSchema = object({
25108
26945
  width: number(),
25109
26946
  height: number(),
25110
26947
  subscribers: number(),
25111
- inFps: number(),
25112
- outFps: number()
26948
+ /**
26949
+ * Encoded packets/s the broker receives from the camera. null when the
26950
+ * broker's stats read failed — unknown, never 0 (a 0 here reads as a stall).
26951
+ * There is no output rate: decoding runs in the session decode workers, not
26952
+ * in the broker, so the broker's own decoded-frame rate is 0 on every live
26953
+ * camera and is not served (D758).
26954
+ */
26955
+ inFps: number().nullable()
25113
26956
  })).readonly(),
25114
26957
  webrtcSessions: number(),
25115
26958
  rtspRestream: boolean()
25116
26959
  });
25117
- /** Shared-memory ring statistics within the decoder block. */
25118
- var CameraDecoderShmSchema = object({
25119
- framesWritten: number(),
25120
- getFrameHits: number(),
25121
- getFrameMisses: number(),
25122
- budgetMb: number()
25123
- });
25124
- /** Decoder block — null when the decoder stage is unreachable or inactive. */
25125
- var CameraDecoderStatusSchema = object({
25126
- nodeId: string(),
25127
- formats: array(string()).readonly(),
25128
- sessionCount: number(),
25129
- shm: CameraDecoderShmSchema
25130
- });
26960
+ /**
26961
+ * Decoder block — WHERE decode runs (co-located with the detection node by
26962
+ * construction); null when the camera has no detection node. It carries no
26963
+ * frame counter: the shared-memory plane whose counters it used to serve is
26964
+ * gone, and those fields read 0 forever. Whether frames actually flow is read
26965
+ * from `detection.actualFps` (frames delivered to and processed by the
26966
+ * detector), never from a counter nothing feeds.
26967
+ */
26968
+ var CameraDecoderStatusSchema = object({ nodeId: string() });
25131
26969
  /** Motion block — null when motion detection is not active for this device. */
25132
26970
  var CameraMotionStatusSchema = object({
25133
26971
  enabled: boolean(),
@@ -25484,12 +27322,6 @@ method(object({
25484
27322
  }), object({ success: literal(true) }), {
25485
27323
  kind: "mutation",
25486
27324
  auth: "admin"
25487
- }), method(object({
25488
- agentNodeId: string(),
25489
- detectWeight: number().positive().nullable()
25490
- }), object({ success: literal(true) }), {
25491
- kind: "mutation",
25492
- auth: "admin"
25493
27325
  }), method(object({
25494
27326
  agentNodeId: string(),
25495
27327
  detect: boolean().nullable().optional(),
@@ -25531,6 +27363,30 @@ method(object({
25531
27363
  }), {
25532
27364
  kind: "mutation",
25533
27365
  auth: "admin"
27366
+ }), method(AutoTuneOptionsSchema, AutoTunePlanSchema, { auth: "admin" }), method(AutoTuneApplyInputSchema, AutoTuneApplyResultSchema, {
27367
+ kind: "mutation",
27368
+ auth: "admin"
27369
+ }), method(LoadBalancingSharesInputSchema, object({ success: literal(true) }), {
27370
+ kind: "mutation",
27371
+ auth: "admin"
27372
+ }), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
27373
+ kind: "mutation",
27374
+ auth: "admin"
27375
+ }), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
27376
+ kind: literal("started"),
27377
+ runId: string()
27378
+ }), object({
27379
+ kind: literal("refused"),
27380
+ preflight: NodeBenchmarkPreflightSchema
27381
+ })]), {
27382
+ kind: "mutation",
27383
+ auth: "admin"
27384
+ }), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
27385
+ kind: "mutation",
27386
+ auth: "admin"
27387
+ }), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
27388
+ kind: "mutation",
27389
+ auth: "admin"
25534
27390
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
25535
27391
  deviceId: number(),
25536
27392
  addonId: string(),
@@ -25547,6 +27403,13 @@ method(object({
25547
27403
  }), object({ success: literal(true) }), {
25548
27404
  kind: "mutation",
25549
27405
  auth: "admin"
27406
+ }), method(object({
27407
+ deviceId: number(),
27408
+ addonId: string(),
27409
+ settings: record(string(), unknown()).nullable()
27410
+ }), object({ success: literal(true) }), {
27411
+ kind: "mutation",
27412
+ auth: "admin"
25550
27413
  }), method(object({
25551
27414
  deviceId: number(),
25552
27415
  agentNodeId: string(),
@@ -25570,25 +27433,7 @@ method(object({
25570
27433
  }), method(_void(), DiskReconcileJobSchema, {
25571
27434
  kind: "mutation",
25572
27435
  auth: "admin"
25573
- }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
25574
- name: string(),
25575
- description: string().optional(),
25576
- config: CameraPipelineConfigSchema
25577
- }), PipelineTemplateSchema, {
25578
- kind: "mutation",
25579
- auth: "admin"
25580
- }), method(object({
25581
- id: string(),
25582
- name: string().optional(),
25583
- description: string().optional(),
25584
- config: CameraPipelineConfigSchema.optional()
25585
- }), PipelineTemplateSchema, {
25586
- kind: "mutation",
25587
- auth: "admin"
25588
- }), method(object({ id: string() }), object({ success: literal(true) }), {
25589
- kind: "mutation",
25590
- auth: "admin"
25591
- });
27436
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" });
25592
27437
  /**
25593
27438
  * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
25594
27439
  * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
@@ -26178,7 +28023,19 @@ var SsoBridgeClaimsSchema = object({
26178
28023
  * editing a descriptor must not retroactively extend or shorten a link the
26179
28024
  * operator already consented to.
26180
28025
  */
26181
- refreshTtl: union([number().int().positive(), literal("never")]).optional()
28026
+ refreshTtl: union([number().int().positive(), literal("never")]).optional(),
28027
+ /**
28028
+ * Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
28029
+ * that was started from a signed-in user's "Link" button: the finish then
28030
+ * links this identity to the intent's user instead of signing anyone in.
28031
+ * The handle carries no user id — the hub resolves it, single-use.
28032
+ */
28033
+ linkIntent: string().optional(),
28034
+ /**
28035
+ * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
28036
+ * subject is unique only per issuer, so a link is bound to it.
28037
+ */
28038
+ issuer: string().optional()
26182
28039
  });
26183
28040
  method(object({
26184
28041
  claims: SsoBridgeClaimsSchema,
@@ -27808,8 +29665,6 @@ var WebrtcStreamChoiceSchema = object({
27808
29665
  ]).nullable(),
27809
29666
  /** Input FPS from the camera (null for adaptive). */
27810
29667
  inputFps: number().nullable(),
27811
- /** Decoded FPS (null for adaptive). */
27812
- decodeFps: number().nullable(),
27813
29668
  /** Bitrate in kbps (null for adaptive). */
27814
29669
  bitrateKbps: number().nullable()
27815
29670
  });
@@ -28086,7 +29941,22 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
28086
29941
  * field their hints were silently stripped by the schema and the
28087
29942
  * adaptive ladder started blind on the client's display size.
28088
29943
  */
28089
- hints: webrtcClientHintsSchema.optional()
29944
+ hints: webrtcClientHintsSchema.optional(),
29945
+ /**
29946
+ * Talk-back (D771): relay the PEER's audio to the device's speaker
29947
+ * through the `intercom` cap's push-talk triple. When `true` and the
29948
+ * offer lets the peer send audio, the answer's audio is `sendrecv`
29949
+ * and every inbound frame goes to `intercom.pushTalkAudio` for this
29950
+ * `deviceId`; absent/false answers `sendonly`, as for every viewer.
29951
+ *
29952
+ * TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
29953
+ * with `intercom`, when the linked user may control that camera. The
29954
+ * hub STRIPS it from every request-bound call (a browser), exactly as
29955
+ * it overwrites `relayOnly` — a viewer's talk permission is the
29956
+ * intercom cap's own surface (share tokens gate it there), and this
29957
+ * flag must not become a second door to the camera's speaker.
29958
+ */
29959
+ talkback: boolean().optional()
28090
29960
  }), object({
28091
29961
  sessionId: string(),
28092
29962
  sdpAnswer: string()
@@ -28388,6 +30258,59 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
28388
30258
  var RestartAddonResultSchema = unknown();
28389
30259
  var InstallPackageResultSchema = unknown();
28390
30260
  var ReloadPackagesResultSchema = unknown();
30261
+ /**
30262
+ * What an uninstall did on ONE node.
30263
+ * - `uninstalled` — removed: runner(s) stopped, caps gone, code deleted.
30264
+ * - `not-installed` — the node did not have it (nothing to do).
30265
+ * - `refused` — protected / bootstrap package; nothing touched.
30266
+ * - `failed` — attempted and did not complete; `error` says why.
30267
+ * - `pending-reconnect` — the node is OFFLINE: its record was pruned so the
30268
+ * back-fill never returns the package, and the stale-addon sweep removes the
30269
+ * copy when the node registers again (only once the hub no longer has it).
30270
+ */
30271
+ var UninstallNodeOutcomeSchema = _enum([
30272
+ "uninstalled",
30273
+ "not-installed",
30274
+ "refused",
30275
+ "failed",
30276
+ "pending-reconnect"
30277
+ ]);
30278
+ var UninstallNodeResultSchema = object({
30279
+ nodeId: string(),
30280
+ outcome: UninstallNodeOutcomeSchema,
30281
+ error: string().optional(),
30282
+ addonIds: array(string()).readonly(),
30283
+ runnersStopped: array(string()).readonly(),
30284
+ warnings: array(string()).readonly()
30285
+ });
30286
+ var UninstallPackageResultSchema = object({
30287
+ /** Every targeted node ended `uninstalled`, `not-installed` or `pending-reconnect`. */
30288
+ success: boolean(),
30289
+ packageName: string(),
30290
+ results: array(UninstallNodeResultSchema).readonly()
30291
+ });
30292
+ /**
30293
+ * `unreachable` lists online agents whose status read FAILED — absence from
30294
+ * `installations` is only "not installed" for a node that answered (D315).
30295
+ */
30296
+ var PackageInstallationsSchema = object({
30297
+ installations: array(object({
30298
+ packageName: string(),
30299
+ nodeId: string(),
30300
+ nodeName: string(),
30301
+ isHub: boolean(),
30302
+ isOnline: boolean(),
30303
+ version: string().nullable(),
30304
+ addonIds: array(string()).readonly(),
30305
+ source: _enum(["live", "recorded"]),
30306
+ /** The hub installs this package too. `false` on an agent row = an orphan. */
30307
+ onHub: boolean()
30308
+ })).readonly(),
30309
+ unreachable: array(object({
30310
+ nodeId: string(),
30311
+ error: string()
30312
+ })).readonly()
30313
+ });
28391
30314
  var BulkUpdateItemStatusSchema = _enum([
28392
30315
  "queued",
28393
30316
  "updating",
@@ -28470,10 +30393,14 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
28470
30393
  }), method(object({ packageName: string() }), InstallPackageResultSchema, {
28471
30394
  kind: "mutation",
28472
30395
  auth: "admin"
28473
- }), method(_void(), boolean()), method(_void(), array(unknown()).readonly()), method(object({ packageName: string() }), unknown(), {
30396
+ }), method(_void(), boolean()), method(_void(), array(unknown()).readonly()), method(object({
30397
+ packageName: string().min(1),
30398
+ nodeId: string().optional(),
30399
+ everywhere: boolean().optional()
30400
+ }), UninstallPackageResultSchema, {
28474
30401
  kind: "mutation",
28475
30402
  auth: "admin"
28476
- }), method(_void(), ReloadPackagesResultSchema, {
30403
+ }), method(object({ packageName: string().optional() }), PackageInstallationsSchema, { auth: "admin" }), method(_void(), ReloadPackagesResultSchema, {
28477
30404
  kind: "mutation",
28478
30405
  auth: "admin"
28479
30406
  }), method(object({ query: string().optional() }), array(SearchResultSchema)), method(object({ nodeId: string().optional() }), array(PackageUpdateSchema).readonly(), { auth: "admin" }), method(object({
@@ -30553,6 +32480,9 @@ var CreateIntegrationInputSchema = object({
30553
32480
  enabled: boolean().optional(),
30554
32481
  info: record(string(), unknown()).optional(),
30555
32482
  settings: record(string(), unknown()).optional(),
32483
+ /** Keys of `settings` the form's schema declares secret (by type) — kept in
32484
+ * the keychain, not the table (D787). */
32485
+ secretKeys: array(string()).optional(),
30556
32486
  skipRestart: boolean().optional()
30557
32487
  });
30558
32488
  var UpdateIntegrationInputSchema = object({
@@ -30576,7 +32506,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
30576
32506
  auth: "admin"
30577
32507
  }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
30578
32508
  id: string(),
30579
- settings: record(string(), unknown())
32509
+ settings: record(string(), unknown()),
32510
+ /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
32511
+ secretKeys: array(string()).optional()
30580
32512
  }), object({ success: boolean() }), {
30581
32513
  kind: "mutation",
30582
32514
  auth: "admin"
@@ -30906,7 +32838,7 @@ var GetConnectionEndpointsResultSchema = object({
30906
32838
  localPort: AdvertisedLocalPortSchema
30907
32839
  });
30908
32840
  /**
30909
- * The address flagged for notification links. `baseUrl: null` = AUTO, which
32841
+ * The address flagged for notification taps (`notificationTaps`). `baseUrl: null` = AUTO, which
30910
32842
  * since D709 is the CamStack app link; `resolved` reports the effective value,
30911
32843
  * so the UI can show it either way.
30912
32844
  */
@@ -30941,8 +32873,8 @@ var ViewerEndpointsSchema = object({
30941
32873
  });
30942
32874
  /**
30943
32875
  * DEPRECATED compatibility shape of `getHubAddresses` (D729 amendment, kept
30944
- * one release for addons built against it): `cluster` is the `agents` role,
30945
- * `browser` the `signIn` role; `override` is the flagged address.
32876
+ * for addons built against it): `cluster` is the `internal` role, `browser`
32877
+ * the `publicEndpoint` role; `override` is the flagged address.
30946
32878
  */
30947
32879
  var HubAddressSnapshotSchema = object({
30948
32880
  override: string().nullable(),
@@ -30958,15 +32890,11 @@ var HubAddressesSchema = object({
30958
32890
  browser: HubAddressSnapshotSchema
30959
32891
  });
30960
32892
  /**
30961
- * What an address is used for (`hub-address.ts`). `viewer` is many-valued;
30962
- * `notifications`, `agents` and `signIn` are carried by at most one address.
32893
+ * What an address is used for (`hub-address.ts`, D734). `appConnections` is
32894
+ * many-valued; `notificationTaps`, `publicEndpoint` and `internal` are carried
32895
+ * by at most one address.
30963
32896
  */
30964
- var HubAddressRoleSchema = _enum([
30965
- "viewer",
30966
- "notifications",
30967
- "agents",
30968
- "signIn"
30969
- ]);
32897
+ var HubAddressRoleSchema = _enum(HUB_ADDRESS_ROLES);
30970
32898
  var RoleSourceSchema = _enum([
30971
32899
  "flagged",
30972
32900
  "auto",
@@ -30980,8 +32908,8 @@ var HubAddressRoleResolutionSchema = object({
30980
32908
  resolved: string().nullable(),
30981
32909
  source: RoleSourceSchema
30982
32910
  });
30983
- var HubViewerResolutionSchema = object({
30984
- /** The addresses flagged `viewer`, or empty = automatic. */
32911
+ var HubAppConnectionsResolutionSchema = object({
32912
+ /** The addresses flagged `appConnections`, or empty = automatic. */
30985
32913
  flagged: array(string()).readonly(),
30986
32914
  /** What the apps race right now. */
30987
32915
  resolved: array(string()).readonly(),
@@ -31001,10 +32929,10 @@ var HubAddressBookSchema = object({
31001
32929
  eligible: array(HubAddressRoleSchema).readonly()
31002
32930
  })).readonly(),
31003
32931
  roles: object({
31004
- viewer: HubViewerResolutionSchema,
31005
- notifications: HubAddressRoleResolutionSchema,
31006
- agents: HubAddressRoleResolutionSchema,
31007
- signIn: HubAddressRoleResolutionSchema
32932
+ appConnections: HubAppConnectionsResolutionSchema,
32933
+ notificationTaps: HubAddressRoleResolutionSchema,
32934
+ internal: HubAddressRoleResolutionSchema,
32935
+ publicEndpoint: HubAddressRoleResolutionSchema
31008
32936
  }),
31009
32937
  /** The `hub=` an app link carries (D709), or null. */
31010
32938
  appLinkHub: string().nullable()
@@ -31052,7 +32980,7 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
31052
32980
  * tunnel always emits `https://` regardless. */
31053
32981
  scheme: _enum(["http", "https"]).optional(),
31054
32982
  /** Append the CamStack app link entry (`kind: 'app-link'`, D709) —
31055
- * an address notification links can be flagged with, not a hub
32983
+ * an address notification taps can be flagged with, not a hub
31056
32984
  * route. Default `false`: racers and rankers never see it. */
31057
32985
  includeAppLink: boolean().optional()
31058
32986
  }), 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({
@@ -36096,6 +38024,32 @@ var TotpStatusSchema = object({
36096
38024
  /** Null when no row exists OR the row is still pending confirmation. */
36097
38025
  confirmedAt: number().nullable()
36098
38026
  });
38027
+ /**
38028
+ * user-management — singleton capability for user accounts, API keys,
38029
+ * and scoped tokens.
38030
+ *
38031
+ * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
38032
+ * — the subset check on `setUserScopes` / `createScopedToken` is moot
38033
+ * because non-admins never reach these. If/when we open non-admin
38034
+ * delegation, structural caller-scope subset check goes inside the
38035
+ * provider.
38036
+ */
38037
+ var ExternalIdentitySchema = object({
38038
+ /** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
38039
+ provider: string(),
38040
+ /** The IdP's stable subject (`sub`) for this account. */
38041
+ subject: string(),
38042
+ /** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
38043
+ issuer: string(),
38044
+ userId: string(),
38045
+ /** What the IdP called the account at link time (username / email) — display only. */
38046
+ label: string().optional(),
38047
+ linkedAt: number()
38048
+ });
38049
+ var ExternalIdentityKeySchema = object({
38050
+ provider: string().min(1),
38051
+ subject: string().min(1)
38052
+ });
36099
38053
  method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
36100
38054
  kind: "mutation",
36101
38055
  auth: "admin",
@@ -36209,7 +38163,22 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
36209
38163
  userId: string(),
36210
38164
  username: string(),
36211
38165
  scopes: array(TokenScopeSchema)
36212
- }).nullable(), { access: "view" }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
38166
+ }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
38167
+ userId: string(),
38168
+ issuer: string()
38169
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
38170
+ userId: string(),
38171
+ issuer: string().min(1),
38172
+ label: string().optional()
38173
+ }), object({ success: literal(true) }), {
38174
+ kind: "mutation",
38175
+ auth: "admin",
38176
+ access: "create"
38177
+ }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
38178
+ kind: "mutation",
38179
+ auth: "admin",
38180
+ access: "delete"
38181
+ }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
36213
38182
  kind: "mutation",
36214
38183
  auth: "admin",
36215
38184
  access: "delete"
@@ -36601,6 +38570,16 @@ DeviceType.Camera, method(object({
36601
38570
  package: array(ZoneRuleSchema).readonly()
36602
38571
  });
36603
38572
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
38573
+ Object.freeze({
38574
+ person: .5,
38575
+ vehicle: .5,
38576
+ animal: .5
38577
+ });
38578
+ Object.freeze({
38579
+ person: .65,
38580
+ vehicle: .65,
38581
+ animal: .65
38582
+ });
36604
38583
  /**
36605
38584
  * Accessory device helpers — shared across drivers.
36606
38585
  *
@@ -36775,6 +38754,12 @@ Object.freeze({
36775
38754
  addonId: null,
36776
38755
  access: "view"
36777
38756
  },
38757
+ "addons.listInstallations": {
38758
+ capName: "addons",
38759
+ capScope: "system",
38760
+ addonId: null,
38761
+ access: "view"
38762
+ },
36778
38763
  "addons.listJobs": {
36779
38764
  capName: "addons",
36780
38765
  capScope: "system",
@@ -37957,90 +39942,18 @@ Object.freeze({
37957
39942
  addonId: null,
37958
39943
  access: "create"
37959
39944
  },
37960
- "decoder.createSession": {
37961
- capName: "decoder",
37962
- capScope: "system",
37963
- addonId: null,
37964
- access: "view"
37965
- },
37966
- "decoder.destroySession": {
37967
- capName: "decoder",
37968
- capScope: "system",
37969
- addonId: null,
37970
- access: "delete"
37971
- },
37972
- "decoder.getFrame": {
37973
- capName: "decoder",
37974
- capScope: "system",
37975
- addonId: null,
37976
- access: "view"
37977
- },
37978
39945
  "decoder.getInfo": {
37979
39946
  capName: "decoder",
37980
39947
  capScope: "system",
37981
39948
  addonId: null,
37982
39949
  access: "view"
37983
39950
  },
37984
- "decoder.getShmStats": {
37985
- capName: "decoder",
37986
- capScope: "system",
37987
- addonId: null,
37988
- access: "view"
37989
- },
37990
- "decoder.getStats": {
37991
- capName: "decoder",
37992
- capScope: "system",
37993
- addonId: null,
37994
- access: "view"
37995
- },
37996
- "decoder.listActiveSessions": {
37997
- capName: "decoder",
37998
- capScope: "system",
37999
- addonId: null,
38000
- access: "view"
38001
- },
38002
- "decoder.openStream": {
38003
- capName: "decoder",
38004
- capScope: "system",
38005
- addonId: null,
38006
- access: "view"
38007
- },
38008
- "decoder.pullFrames": {
38009
- capName: "decoder",
38010
- capScope: "system",
38011
- addonId: null,
38012
- access: "view"
38013
- },
38014
- "decoder.pullHandles": {
38015
- capName: "decoder",
38016
- capScope: "system",
38017
- addonId: null,
38018
- access: "view"
38019
- },
38020
- "decoder.pushPacket": {
38021
- capName: "decoder",
38022
- capScope: "system",
38023
- addonId: null,
38024
- access: "view"
38025
- },
38026
39951
  "decoder.reprobeHwaccel": {
38027
39952
  capName: "decoder",
38028
39953
  capScope: "system",
38029
39954
  addonId: null,
38030
39955
  access: "create"
38031
39956
  },
38032
- "decoder.supportsCodec": {
38033
- capName: "decoder",
38034
- capScope: "system",
38035
- addonId: null,
38036
- access: "view"
38037
- },
38038
- "decoder.updateConfig": {
38039
- capName: "decoder",
38040
- capScope: "system",
38041
- addonId: null,
38042
- access: "view"
38043
- },
38044
39957
  "detectionPipeline.applyDeviceSettingsPatch": {
38045
39958
  capName: "detection-pipeline",
38046
39959
  capScope: "device",
@@ -39307,6 +41220,90 @@ Object.freeze({
39307
41220
  addonId: null,
39308
41221
  access: "create"
39309
41222
  },
41223
+ "keychain.delete": {
41224
+ capName: "keychain",
41225
+ capScope: "system",
41226
+ addonId: null,
41227
+ access: "delete"
41228
+ },
41229
+ "keychain.getState": {
41230
+ capName: "keychain",
41231
+ capScope: "system",
41232
+ addonId: null,
41233
+ access: "view"
41234
+ },
41235
+ "keychain.listMeta": {
41236
+ capName: "keychain",
41237
+ capScope: "system",
41238
+ addonId: null,
41239
+ access: "view"
41240
+ },
41241
+ "keychain.put": {
41242
+ capName: "keychain",
41243
+ capScope: "system",
41244
+ addonId: null,
41245
+ access: "create"
41246
+ },
41247
+ "keychain.resolve": {
41248
+ capName: "keychain",
41249
+ capScope: "system",
41250
+ addonId: null,
41251
+ access: "view"
41252
+ },
41253
+ "keychainAdmin.deleteOrphans": {
41254
+ capName: "keychain-admin",
41255
+ capScope: "system",
41256
+ addonId: null,
41257
+ access: "delete"
41258
+ },
41259
+ "keychainAdmin.downloadRecoveryKey": {
41260
+ capName: "keychain-admin",
41261
+ capScope: "system",
41262
+ addonId: null,
41263
+ access: "create"
41264
+ },
41265
+ "keychainAdmin.listAudit": {
41266
+ capName: "keychain-admin",
41267
+ capScope: "system",
41268
+ addonId: null,
41269
+ access: "view"
41270
+ },
41271
+ "keychainAdmin.listSecrets": {
41272
+ capName: "keychain-admin",
41273
+ capScope: "system",
41274
+ addonId: null,
41275
+ access: "view"
41276
+ },
41277
+ "keychainAdmin.purgeRetiredKeys": {
41278
+ capName: "keychain-admin",
41279
+ capScope: "system",
41280
+ addonId: null,
41281
+ access: "delete"
41282
+ },
41283
+ "keychainAdmin.resetKeychain": {
41284
+ capName: "keychain-admin",
41285
+ capScope: "system",
41286
+ addonId: null,
41287
+ access: "delete"
41288
+ },
41289
+ "keychainAdmin.reveal": {
41290
+ capName: "keychain-admin",
41291
+ capScope: "system",
41292
+ addonId: null,
41293
+ access: "create"
41294
+ },
41295
+ "keychainAdmin.rotateMasterKey": {
41296
+ capName: "keychain-admin",
41297
+ capScope: "system",
41298
+ addonId: null,
41299
+ access: "create"
41300
+ },
41301
+ "keychainAdmin.status": {
41302
+ capName: "keychain-admin",
41303
+ capScope: "system",
41304
+ addonId: null,
41305
+ access: "view"
41306
+ },
39310
41307
  "lawnMowerControl.dock": {
39311
41308
  capName: "lawn-mower-control",
39312
41309
  capScope: "device",
@@ -40681,6 +42678,18 @@ Object.freeze({
40681
42678
  addonId: null,
40682
42679
  access: "create"
40683
42680
  },
42681
+ "pipelineAnalytics.addRetrainFrameFromRecording": {
42682
+ capName: "pipeline-analytics",
42683
+ capScope: "device",
42684
+ addonId: null,
42685
+ access: "create"
42686
+ },
42687
+ "pipelineAnalytics.addRetrainFramesToCollection": {
42688
+ capName: "pipeline-analytics",
42689
+ capScope: "device",
42690
+ addonId: null,
42691
+ access: "create"
42692
+ },
40684
42693
  "pipelineAnalytics.applyDeviceSettingsPatch": {
40685
42694
  capName: "pipeline-analytics",
40686
42695
  capScope: "device",
@@ -40729,12 +42738,24 @@ Object.freeze({
40729
42738
  addonId: null,
40730
42739
  access: "view"
40731
42740
  },
42741
+ "pipelineAnalytics.createRetrainCollection": {
42742
+ capName: "pipeline-analytics",
42743
+ capScope: "device",
42744
+ addonId: null,
42745
+ access: "create"
42746
+ },
40732
42747
  "pipelineAnalytics.deleteDeviceEvents": {
40733
42748
  capName: "pipeline-analytics",
40734
42749
  capScope: "device",
40735
42750
  addonId: null,
40736
42751
  access: "delete"
40737
42752
  },
42753
+ "pipelineAnalytics.deleteRetrainCollection": {
42754
+ capName: "pipeline-analytics",
42755
+ capScope: "device",
42756
+ addonId: null,
42757
+ access: "delete"
42758
+ },
40738
42759
  "pipelineAnalytics.deleteTracks": {
40739
42760
  capName: "pipeline-analytics",
40740
42761
  capScope: "device",
@@ -40939,6 +42960,24 @@ Object.freeze({
40939
42960
  addonId: null,
40940
42961
  access: "view"
40941
42962
  },
42963
+ "pipelineAnalytics.listRetrainAssistProfiles": {
42964
+ capName: "pipeline-analytics",
42965
+ capScope: "device",
42966
+ addonId: null,
42967
+ access: "view"
42968
+ },
42969
+ "pipelineAnalytics.listRetrainCollectionFrames": {
42970
+ capName: "pipeline-analytics",
42971
+ capScope: "device",
42972
+ addonId: null,
42973
+ access: "view"
42974
+ },
42975
+ "pipelineAnalytics.listRetrainCollections": {
42976
+ capName: "pipeline-analytics",
42977
+ capScope: "device",
42978
+ addonId: null,
42979
+ access: "view"
42980
+ },
40942
42981
  "pipelineAnalytics.listRetrainFrames": {
40943
42982
  capName: "pipeline-analytics",
40944
42983
  capScope: "device",
@@ -40987,6 +43026,12 @@ Object.freeze({
40987
43026
  addonId: null,
40988
43027
  access: "create"
40989
43028
  },
43029
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
43030
+ capName: "pipeline-analytics",
43031
+ capScope: "device",
43032
+ addonId: null,
43033
+ access: "create"
43034
+ },
40990
43035
  "pipelineAnalytics.pruneEvents": {
40991
43036
  capName: "pipeline-analytics",
40992
43037
  capScope: "device",
@@ -41041,6 +43086,18 @@ Object.freeze({
41041
43086
  addonId: null,
41042
43087
  access: "create"
41043
43088
  },
43089
+ "pipelineAnalytics.removeRetrainFrameFromCollection": {
43090
+ capName: "pipeline-analytics",
43091
+ capScope: "device",
43092
+ addonId: null,
43093
+ access: "delete"
43094
+ },
43095
+ "pipelineAnalytics.renameRetrainCollection": {
43096
+ capName: "pipeline-analytics",
43097
+ capScope: "device",
43098
+ addonId: null,
43099
+ access: "create"
43100
+ },
41044
43101
  "pipelineAnalytics.restageRetrainTrack": {
41045
43102
  capName: "pipeline-analytics",
41046
43103
  capScope: "device",
@@ -41071,6 +43128,12 @@ Object.freeze({
41071
43128
  addonId: null,
41072
43129
  access: "create"
41073
43130
  },
43131
+ "pipelineAnalytics.setRetrainFrameComplete": {
43132
+ capName: "pipeline-analytics",
43133
+ capScope: "device",
43134
+ addonId: null,
43135
+ access: "create"
43136
+ },
41074
43137
  "pipelineAnalytics.setTrackFlags": {
41075
43138
  capName: "pipeline-analytics",
41076
43139
  capScope: "device",
@@ -41107,6 +43170,12 @@ Object.freeze({
41107
43170
  addonId: null,
41108
43171
  access: "delete"
41109
43172
  },
43173
+ "pipelineAnalytics.writeRetrainArchive": {
43174
+ capName: "pipeline-analytics",
43175
+ capScope: "device",
43176
+ addonId: null,
43177
+ access: "create"
43178
+ },
41110
43179
  "pipelineExecutor.cacheFrameInPool": {
41111
43180
  capName: "pipeline-executor",
41112
43181
  capScope: "system",
@@ -41119,13 +43188,13 @@ Object.freeze({
41119
43188
  addonId: null,
41120
43189
  access: "delete"
41121
43190
  },
41122
- "pipelineExecutor.deleteModel": {
43191
+ "pipelineExecutor.clearModelBoundDeviceOverrides": {
41123
43192
  capName: "pipeline-executor",
41124
43193
  capScope: "system",
41125
43194
  addonId: null,
41126
43195
  access: "delete"
41127
43196
  },
41128
- "pipelineExecutor.deleteTemplate": {
43197
+ "pipelineExecutor.deleteModel": {
41129
43198
  capName: "pipeline-executor",
41130
43199
  capScope: "system",
41131
43200
  addonId: null,
@@ -41269,12 +43338,6 @@ Object.freeze({
41269
43338
  addonId: null,
41270
43339
  access: "view"
41271
43340
  },
41272
- "pipelineExecutor.listTemplates": {
41273
- capName: "pipeline-executor",
41274
- capScope: "system",
41275
- addonId: null,
41276
- access: "view"
41277
- },
41278
43341
  "pipelineExecutor.rearmInferenceDevice": {
41279
43342
  capName: "pipeline-executor",
41280
43343
  capScope: "system",
@@ -41299,12 +43362,6 @@ Object.freeze({
41299
43362
  addonId: null,
41300
43363
  access: "create"
41301
43364
  },
41302
- "pipelineExecutor.saveTemplate": {
41303
- capName: "pipeline-executor",
41304
- capScope: "system",
41305
- addonId: null,
41306
- access: "create"
41307
- },
41308
43365
  "pipelineExecutor.setVideoPipelineSteps": {
41309
43366
  capName: "pipeline-executor",
41310
43367
  capScope: "system",
@@ -41323,17 +43380,23 @@ Object.freeze({
41323
43380
  addonId: null,
41324
43381
  access: "create"
41325
43382
  },
41326
- "pipelineExecutor.updateTemplate": {
43383
+ "pipelineExecutor.validatePipeline": {
41327
43384
  capName: "pipeline-executor",
41328
43385
  capScope: "system",
41329
43386
  addonId: null,
43387
+ access: "view"
43388
+ },
43389
+ "pipelineOrchestrator.abortNodeBenchmark": {
43390
+ capName: "pipeline-orchestrator",
43391
+ capScope: "system",
43392
+ addonId: null,
41330
43393
  access: "create"
41331
43394
  },
41332
- "pipelineExecutor.validatePipeline": {
41333
- capName: "pipeline-executor",
43395
+ "pipelineOrchestrator.applyAutoTune": {
43396
+ capName: "pipeline-orchestrator",
41334
43397
  capScope: "system",
41335
43398
  addonId: null,
41336
- access: "view"
43399
+ access: "create"
41337
43400
  },
41338
43401
  "pipelineOrchestrator.applyDeviceSettingsPatch": {
41339
43402
  capName: "pipeline-orchestrator",
@@ -41353,7 +43416,7 @@ Object.freeze({
41353
43416
  addonId: null,
41354
43417
  access: "create"
41355
43418
  },
41356
- "pipelineOrchestrator.deleteTemplate": {
43419
+ "pipelineOrchestrator.deleteNodeBenchmarkResult": {
41357
43420
  capName: "pipeline-orchestrator",
41358
43421
  capScope: "system",
41359
43422
  addonId: null,
@@ -41449,6 +43512,12 @@ Object.freeze({
41449
43512
  addonId: null,
41450
43513
  access: "view"
41451
43514
  },
43515
+ "pipelineOrchestrator.getEffectiveShares": {
43516
+ capName: "pipeline-orchestrator",
43517
+ capScope: "system",
43518
+ addonId: null,
43519
+ access: "view"
43520
+ },
41452
43521
  "pipelineOrchestrator.getGlobalMetrics": {
41453
43522
  capName: "pipeline-orchestrator",
41454
43523
  capScope: "system",
@@ -41461,6 +43530,24 @@ Object.freeze({
41461
43530
  addonId: null,
41462
43531
  access: "view"
41463
43532
  },
43533
+ "pipelineOrchestrator.getNodeBenchmarkCandidates": {
43534
+ capName: "pipeline-orchestrator",
43535
+ capScope: "system",
43536
+ addonId: null,
43537
+ access: "view"
43538
+ },
43539
+ "pipelineOrchestrator.getNodeBenchmarkPreflight": {
43540
+ capName: "pipeline-orchestrator",
43541
+ capScope: "system",
43542
+ addonId: null,
43543
+ access: "view"
43544
+ },
43545
+ "pipelineOrchestrator.getNodeBenchmarkStatus": {
43546
+ capName: "pipeline-orchestrator",
43547
+ capScope: "system",
43548
+ addonId: null,
43549
+ access: "view"
43550
+ },
41464
43551
  "pipelineOrchestrator.getNodeInferenceDevices": {
41465
43552
  capName: "pipeline-orchestrator",
41466
43553
  capScope: "system",
@@ -41485,6 +43572,12 @@ Object.freeze({
41485
43572
  addonId: null,
41486
43573
  access: "view"
41487
43574
  },
43575
+ "pipelineOrchestrator.getPlacementStats": {
43576
+ capName: "pipeline-orchestrator",
43577
+ capScope: "system",
43578
+ addonId: null,
43579
+ access: "view"
43580
+ },
41488
43581
  "pipelineOrchestrator.getReconcileFromDiskStatus": {
41489
43582
  capName: "pipeline-orchestrator",
41490
43583
  capScope: "system",
@@ -41497,7 +43590,7 @@ Object.freeze({
41497
43590
  addonId: null,
41498
43591
  access: "view"
41499
43592
  },
41500
- "pipelineOrchestrator.listTemplates": {
43593
+ "pipelineOrchestrator.listNodeBenchmarkResults": {
41501
43594
  capName: "pipeline-orchestrator",
41502
43595
  capScope: "system",
41503
43596
  addonId: null,
@@ -41509,6 +43602,12 @@ Object.freeze({
41509
43602
  addonId: null,
41510
43603
  access: "create"
41511
43604
  },
43605
+ "pipelineOrchestrator.planAutoTune": {
43606
+ capName: "pipeline-orchestrator",
43607
+ capScope: "system",
43608
+ addonId: null,
43609
+ access: "view"
43610
+ },
41512
43611
  "pipelineOrchestrator.rebalance": {
41513
43612
  capName: "pipeline-orchestrator",
41514
43613
  capScope: "system",
@@ -41551,12 +43650,6 @@ Object.freeze({
41551
43650
  addonId: null,
41552
43651
  access: "create"
41553
43652
  },
41554
- "pipelineOrchestrator.saveTemplate": {
41555
- capName: "pipeline-orchestrator",
41556
- capScope: "system",
41557
- addonId: null,
41558
- access: "create"
41559
- },
41560
43653
  "pipelineOrchestrator.setAgentCapabilities": {
41561
43654
  capName: "pipeline-orchestrator",
41562
43655
  capScope: "system",
@@ -41569,12 +43662,6 @@ Object.freeze({
41569
43662
  addonId: null,
41570
43663
  access: "create"
41571
43664
  },
41572
- "pipelineOrchestrator.setAgentDetectWeight": {
41573
- capName: "pipeline-orchestrator",
41574
- capScope: "system",
41575
- addonId: null,
41576
- access: "create"
41577
- },
41578
43665
  "pipelineOrchestrator.setAgentInferenceDevices": {
41579
43666
  capName: "pipeline-orchestrator",
41580
43667
  capScope: "system",
@@ -41611,6 +43698,12 @@ Object.freeze({
41611
43698
  addonId: null,
41612
43699
  access: "create"
41613
43700
  },
43701
+ "pipelineOrchestrator.setCameraStepSettings": {
43702
+ capName: "pipeline-orchestrator",
43703
+ capScope: "system",
43704
+ addonId: null,
43705
+ access: "create"
43706
+ },
41614
43707
  "pipelineOrchestrator.setCameraStepToggle": {
41615
43708
  capName: "pipeline-orchestrator",
41616
43709
  capScope: "system",
@@ -41629,12 +43722,36 @@ Object.freeze({
41629
43722
  addonId: null,
41630
43723
  access: "create"
41631
43724
  },
43725
+ "pipelineOrchestrator.setLoadBalancingShares": {
43726
+ capName: "pipeline-orchestrator",
43727
+ capScope: "system",
43728
+ addonId: null,
43729
+ access: "create"
43730
+ },
41632
43731
  "pipelineOrchestrator.setPipelineDevicePin": {
41633
43732
  capName: "pipeline-orchestrator",
41634
43733
  capScope: "system",
41635
43734
  addonId: null,
41636
43735
  access: "create"
41637
43736
  },
43737
+ "pipelineOrchestrator.setShareSource": {
43738
+ capName: "pipeline-orchestrator",
43739
+ capScope: "system",
43740
+ addonId: null,
43741
+ access: "create"
43742
+ },
43743
+ "pipelineOrchestrator.startNodeBenchmark": {
43744
+ capName: "pipeline-orchestrator",
43745
+ capScope: "system",
43746
+ addonId: null,
43747
+ access: "create"
43748
+ },
43749
+ "pipelineOrchestrator.suggestShares": {
43750
+ capName: "pipeline-orchestrator",
43751
+ capScope: "system",
43752
+ addonId: null,
43753
+ access: "view"
43754
+ },
41638
43755
  "pipelineOrchestrator.unassignAudio": {
41639
43756
  capName: "pipeline-orchestrator",
41640
43757
  capScope: "system",
@@ -41647,8 +43764,8 @@ Object.freeze({
41647
43764
  addonId: null,
41648
43765
  access: "create"
41649
43766
  },
41650
- "pipelineOrchestrator.updateTemplate": {
41651
- capName: "pipeline-orchestrator",
43767
+ "pipelineRunner.abortNodeBench": {
43768
+ capName: "pipeline-runner",
41652
43769
  capScope: "system",
41653
43770
  addonId: null,
41654
43771
  access: "create"
@@ -41701,6 +43818,12 @@ Object.freeze({
41701
43818
  addonId: null,
41702
43819
  access: "view"
41703
43820
  },
43821
+ "pipelineRunner.getNodeBenchStatus": {
43822
+ capName: "pipeline-runner",
43823
+ capScope: "system",
43824
+ addonId: null,
43825
+ access: "view"
43826
+ },
41704
43827
  "pipelineRunner.getParkedTrackFrame": {
41705
43828
  capName: "pipeline-runner",
41706
43829
  capScope: "system",
@@ -41743,6 +43866,12 @@ Object.freeze({
41743
43866
  addonId: null,
41744
43867
  access: "create"
41745
43868
  },
43869
+ "pipelineRunner.startNodeBench": {
43870
+ capName: "pipeline-runner",
43871
+ capScope: "system",
43872
+ addonId: null,
43873
+ access: "create"
43874
+ },
41746
43875
  "plateGallery.assignPlate": {
41747
43876
  capName: "plate-gallery",
41748
43877
  capScope: "system",
@@ -43087,12 +45216,6 @@ Object.freeze({
43087
45216
  addonId: null,
43088
45217
  access: "view"
43089
45218
  },
43090
- "streamBroker.pullFrameHandles": {
43091
- capName: "stream-broker",
43092
- capScope: "system",
43093
- addonId: null,
43094
- access: "view"
43095
- },
43096
45219
  "streamBroker.regenerateRtspToken": {
43097
45220
  capName: "stream-broker",
43098
45221
  capScope: "system",
@@ -43159,12 +45282,6 @@ Object.freeze({
43159
45282
  addonId: null,
43160
45283
  access: "create"
43161
45284
  },
43162
- "streamBroker.subscribeFrames": {
43163
- capName: "stream-broker",
43164
- capScope: "system",
43165
- addonId: null,
43166
- access: "create"
43167
- },
43168
45285
  "streamBroker.unassignProfile": {
43169
45286
  capName: "stream-broker",
43170
45287
  capScope: "system",
@@ -43177,12 +45294,6 @@ Object.freeze({
43177
45294
  addonId: null,
43178
45295
  access: "create"
43179
45296
  },
43180
- "streamBroker.unsubscribeFrames": {
43181
- capName: "stream-broker",
43182
- capScope: "system",
43183
- addonId: null,
43184
- access: "create"
43185
- },
43186
45297
  "streamCatalog.getCatalog": {
43187
45298
  capName: "stream-catalog",
43188
45299
  capScope: "device",
@@ -43477,18 +45588,36 @@ Object.freeze({
43477
45588
  addonId: null,
43478
45589
  access: "delete"
43479
45590
  },
45591
+ "userManagement.findUserByExternalIdentity": {
45592
+ capName: "user-management",
45593
+ capScope: "system",
45594
+ addonId: null,
45595
+ access: "view"
45596
+ },
43480
45597
  "userManagement.getTotpStatus": {
43481
45598
  capName: "user-management",
43482
45599
  capScope: "system",
43483
45600
  addonId: null,
43484
45601
  access: "view"
43485
45602
  },
45603
+ "userManagement.linkExternalIdentity": {
45604
+ capName: "user-management",
45605
+ capScope: "system",
45606
+ addonId: null,
45607
+ access: "create"
45608
+ },
43486
45609
  "userManagement.listApiKeys": {
43487
45610
  capName: "user-management",
43488
45611
  capScope: "system",
43489
45612
  addonId: null,
43490
45613
  access: "view"
43491
45614
  },
45615
+ "userManagement.listExternalIdentities": {
45616
+ capName: "user-management",
45617
+ capScope: "system",
45618
+ addonId: null,
45619
+ access: "view"
45620
+ },
43492
45621
  "userManagement.listOauthSessions": {
43493
45622
  capName: "user-management",
43494
45623
  capScope: "system",
@@ -43567,6 +45696,12 @@ Object.freeze({
43567
45696
  addonId: null,
43568
45697
  access: "create"
43569
45698
  },
45699
+ "userManagement.unlinkExternalIdentity": {
45700
+ capName: "user-management",
45701
+ capScope: "system",
45702
+ addonId: null,
45703
+ access: "delete"
45704
+ },
43570
45705
  "userManagement.updateUser": {
43571
45706
  capName: "user-management",
43572
45707
  capScope: "system",
@@ -45696,11 +47831,6 @@ Object.freeze({
45696
47831
  form: "single",
45697
47832
  optional: false
45698
47833
  }],
45699
- "decoder.createSession": [{
45700
- name: "deviceId",
45701
- form: "single",
45702
- optional: true
45703
- }],
45704
47834
  "detectionPipeline.applyDeviceSettingsPatch": [{
45705
47835
  name: "deviceId",
45706
47836
  form: "single",
@@ -46671,6 +48801,11 @@ Object.freeze({
46671
48801
  form: "single",
46672
48802
  optional: false
46673
48803
  }],
48804
+ "pipelineAnalytics.addRetrainFrameFromRecording": [{
48805
+ name: "deviceId",
48806
+ form: "single",
48807
+ optional: false
48808
+ }],
46674
48809
  "pipelineAnalytics.applyDeviceSettingsPatch": [{
46675
48810
  name: "deviceId",
46676
48811
  form: "single",
@@ -46861,6 +48996,11 @@ Object.freeze({
46861
48996
  form: "single",
46862
48997
  optional: false
46863
48998
  }],
48999
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
49000
+ name: "deviceId",
49001
+ form: "single",
49002
+ optional: false
49003
+ }],
46864
49004
  "pipelineAnalytics.pruneEventsBefore": [{
46865
49005
  name: "deviceId",
46866
49006
  form: "single",
@@ -46911,6 +49051,11 @@ Object.freeze({
46911
49051
  form: "single",
46912
49052
  optional: false
46913
49053
  }],
49054
+ "pipelineAnalytics.setRetrainFrameComplete": [{
49055
+ name: "deviceId",
49056
+ form: "single",
49057
+ optional: false
49058
+ }],
46914
49059
  "pipelineAnalytics.setTrackFlags": [{
46915
49060
  name: "deviceId",
46916
49061
  form: "single",
@@ -46931,6 +49076,11 @@ Object.freeze({
46931
49076
  form: "single",
46932
49077
  optional: false
46933
49078
  }],
49079
+ "pipelineExecutor.clearModelBoundDeviceOverrides": [{
49080
+ name: "deviceIds",
49081
+ form: "array",
49082
+ optional: true
49083
+ }],
46934
49084
  "pipelineExecutor.runPipeline": [{
46935
49085
  name: "deviceId",
46936
49086
  form: "single",
@@ -47036,6 +49186,11 @@ Object.freeze({
47036
49186
  form: "single",
47037
49187
  optional: false
47038
49188
  }],
49189
+ "pipelineOrchestrator.setCameraStepSettings": [{
49190
+ name: "deviceId",
49191
+ form: "single",
49192
+ optional: false
49193
+ }],
47039
49194
  "pipelineOrchestrator.setCameraStepToggle": [{
47040
49195
  name: "deviceId",
47041
49196
  form: "single",
@@ -48956,10 +51111,11 @@ var MB = 1024 * 1024;
48956
51111
  /**
48957
51112
  * Google Home export — customActions catalog.
48958
51113
  *
48959
- * One entry. The settings form's `type: 'button'` field dispatches through the
48960
- * generic `api.addons.custom.mutate({ addonId, action, input })` channel, so a
48961
- * button here costs no capability, no codegen and no framework publish train —
48962
- * the catalog travels inside this addon's own bundle.
51114
+ * One entry. The settings form's `addon-action-button` dispatches through the
51115
+ * generic `api.addons.custom.mutate({ addonId, action, input })` channel and
51116
+ * shows the result under the button, so a button here costs no capability, no
51117
+ * codegen and no framework publish train — the catalog travels inside this
51118
+ * addon's own bundle. Admin-only: it writes this addon's settings.
48963
51119
  */
48964
51120
  var exportGoogleActions = defineCustomActions({
48965
51121
  /**
@@ -48975,8 +51131,13 @@ var exportGoogleActions = defineCustomActions({
48975
51131
  detectPublicHubUrl: customAction(object({}).optional(), object({
48976
51132
  publicHubUrl: string(),
48977
51133
  detectedPublicHubUrl: string(),
48978
- filled: boolean()
48979
- }), { kind: "mutation" }) });
51134
+ filled: boolean(),
51135
+ /** One sentence saying what happened, for the button. */
51136
+ summary: string()
51137
+ }), {
51138
+ kind: "mutation",
51139
+ auth: "admin"
51140
+ }) });
48980
51141
  //#endregion
48981
51142
  //#region src/google-home/trait-catalog.ts
48982
51143
  /**
@@ -50005,6 +52166,14 @@ var refreshPublicHubUrl = async (deps) => {
50005
52166
  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 } });
50006
52167
  return resolution;
50007
52168
  };
52169
+ /** What "Detect external address" did, in one sentence for the button. */
52170
+ function describeDetectResult(result) {
52171
+ const { publicHubUrl, detectedPublicHubUrl, filled } = result;
52172
+ if (filled) return `Filled in ${publicHubUrl}.`;
52173
+ 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.";
52174
+ if (detectedPublicHubUrl === publicHubUrl) return `Detected ${publicHubUrl}, already in use.`;
52175
+ return `Detected ${detectedPublicHubUrl}; your value ${publicHubUrl} was kept.`;
52176
+ }
50008
52177
  //#endregion
50009
52178
  //#region src/types.ts
50010
52179
  var DEFAULT_SETTINGS = {
@@ -50187,11 +52356,15 @@ var ExportGoogleAddon = class extends BaseAddon {
50187
52356
  persist: (patch) => this.updateGlobalSettings(patch),
50188
52357
  logger: this.ctx.logger
50189
52358
  });
50190
- return {
52359
+ const result = {
50191
52360
  publicHubUrl: resolution.publicHubUrl,
50192
52361
  detectedPublicHubUrl: resolution.detectedPublicHubUrl,
50193
52362
  filled: resolution.defaulted
50194
52363
  };
52364
+ return {
52365
+ ...result,
52366
+ summary: describeDetectResult(result)
52367
+ };
50195
52368
  }
50196
52369
  async onShutdown() {
50197
52370
  this.gateway = null;
@@ -50270,7 +52443,7 @@ var ExportGoogleAddon = class extends BaseAddon {
50270
52443
  globalSettingsSchema() {
50271
52444
  return this.schema({ sections: [{
50272
52445
  id: ADDON_ID,
50273
- title: "Google Home export",
52446
+ title: "Connection",
50274
52447
  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.",
50275
52448
  columns: 1,
50276
52449
  fields: [
@@ -50300,13 +52473,15 @@ var ExportGoogleAddon = class extends BaseAddon {
50300
52473
  ...buildPublicHubUrlNotice(this.publicHubUrlState())
50301
52474
  },
50302
52475
  {
50303
- type: "button",
52476
+ type: "addon-action-button",
52477
+ addonId: ADDON_ID,
50304
52478
  key: "__detect-public-hub-url",
50305
52479
  label: "External address",
50306
52480
  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.",
50307
52481
  buttonLabel: "Detect external address",
50308
52482
  action: "detectPublicHubUrl",
50309
- variant: "default"
52483
+ variant: "default",
52484
+ successMessage: "{summary}"
50310
52485
  }
50311
52486
  ]
50312
52487
  }] });