@camstack/addon-tailscale 1.2.118 → 1.2.120

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.
@@ -1,5 +1,7 @@
1
- require("node:crypto");
2
- //#region ../types/dist/event-category-BGmz_oxW.mjs
1
+ import * as fs from "node:fs/promises";
2
+ import * as os from "node:os";
3
+ import * as path from "node:path";
4
+ //#region ../types/dist/event-category-DaIZi00R.mjs
3
5
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4
6
  EventCategory["SystemBoot"] = "system.boot";
5
7
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -78,6 +80,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
78
80
  */
79
81
  EventCategory["AddonLoadFailed"] = "addon.load-failed";
80
82
  /**
83
+ * A keychain value was stored or removed (D787). Carries the ref, its
84
+ * owner and the new version — NEVER the value. A process holding the ref
85
+ * drops its cached copy and the owning `BaseAddon` re-resolves its config.
86
+ * Telemetry (D8): a process that misses it still revalidates by version.
87
+ */
88
+ EventCategory["KeychainChanged"] = "keychain.changed";
89
+ /**
81
90
  * Addon recovered from a previous failure. Emitted when an addon
82
91
  * transitions from `failed` back to `healthy` (typically via the
83
92
  * monitor's auto-retry loop, or after manual `addons.retryLoad`).
@@ -500,15 +509,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
500
509
  EventCategory["AgentWsDisconnected"] = "agent.ws.disconnected";
501
510
  EventCategory["AgentBackupActivated"] = "agent.backup.activated";
502
511
  EventCategory["OrchestrationSettingsUpdated"] = "orchestration.settings-updated";
503
- /**
504
- * Per-agent hwaccel preference changed (user override set, cleared, or
505
- * re-probed). Observability event — decoders pull the current pref at
506
- * `createSession`, so running sessions keep their current backend until
507
- * they rotate naturally (camera add/remove, stream restart). Future
508
- * work can wire a listener in stream-broker that force-rotates live
509
- * sessions; for now this event powers logs + admin-UI toast feedback.
510
- */
511
- EventCategory["PipelineAgentHwaccelChanged"] = "pipeline.agent-hwaccel-changed";
512
512
  EventCategory["MotionAnalysis"] = "detection.motion-analysis";
513
513
  /** All raw motion zones from CCL before minArea filter — for UI debug overlay. */
514
514
  EventCategory["MotionZonesRaw"] = "detection.motion-zones-raw";
@@ -5379,7 +5379,7 @@ var ZodIssueCode = {
5379
5379
  var ZodFirstPartyTypeKind;
5380
5380
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5381
5381
  //#endregion
5382
- //#region ../types/dist/sleep-DXKLNFvA.mjs
5382
+ //#region ../types/dist/sleep-Cr5YOk3m.mjs
5383
5383
  /**
5384
5384
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5385
5385
  * window to float samples (D455).
@@ -5458,6 +5458,97 @@ function buildAlawTable() {
5458
5458
  }
5459
5459
  buildUlawTable();
5460
5460
  buildAlawTable();
5461
+ /** Is this field's stored value a credential? */
5462
+ function isSecretConfigField(field) {
5463
+ if (field.type === "password") return true;
5464
+ return "secret" in field && field.secret === true;
5465
+ }
5466
+ /**
5467
+ * Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
5468
+ * by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
5469
+ */
5470
+ function isKeychainStoredField(field) {
5471
+ if (!isSecretConfigField(field)) return false;
5472
+ if (field.type === "textarea" && field.isJson === true) return false;
5473
+ return !("storage" in field && field.storage === "inline");
5474
+ }
5475
+ /**
5476
+ * What a settings blob holds where a secret used to be.
5477
+ *
5478
+ * A keychain-stored field never holds its value. It holds a self-describing
5479
+ * MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
5480
+ * code can mistake it for a credential and no form can send it to a camera as
5481
+ * a password. The empty state is `null` / absent, never `''`.
5482
+ *
5483
+ * The same shapes travel to and from the admin UI:
5484
+ *
5485
+ * - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
5486
+ * (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
5487
+ * value is set, never the value.
5488
+ * - write: an untouched field submits the view back unchanged (KEEP); a typed
5489
+ * value is a plain non-empty string (CHANGE); the Clear button submits
5490
+ * {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
5491
+ * are KEEP — an empty string is what a defaults-fallback pushes back, and
5492
+ * treating it as "clear" is how a save destroyed a stored credential before.
5493
+ *
5494
+ * Pure and browser-safe.
5495
+ */
5496
+ var SECRET_CLEAR = { $secretClear: true };
5497
+ /** The `'***'` token D634 redaction writes for non-admins. */
5498
+ var LEGACY_DEVICE_REDACTION = "***";
5499
+ function isRecord$1(value) {
5500
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5501
+ }
5502
+ function makeSecretMarker(ref) {
5503
+ return {
5504
+ $secret: ref,
5505
+ v: 1
5506
+ };
5507
+ }
5508
+ /** A stored marker: an object whose `$secret` is a non-empty string. */
5509
+ function isSecretMarker(value) {
5510
+ if (!isRecord$1(value)) return false;
5511
+ const ref = value["$secret"];
5512
+ return typeof ref === "string" && ref.length > 0;
5513
+ }
5514
+ function isSecretClear(value) {
5515
+ return isRecord$1(value) && value["$secretClear"] === true;
5516
+ }
5517
+ /**
5518
+ * The UI view of a stored secret field value: a marker becomes "set", inline
5519
+ * plaintext becomes "set (inline)", nothing becomes `null`. A value never
5520
+ * survives this function.
5521
+ */
5522
+ function toSecretFieldView(stored) {
5523
+ if (isSecretMarker(stored)) return {
5524
+ $secret: stored.$secret,
5525
+ v: 1,
5526
+ set: true
5527
+ };
5528
+ if (typeof stored === "string" && stored.length > 0) return {
5529
+ $secret: null,
5530
+ v: 1,
5531
+ set: true,
5532
+ inline: true
5533
+ };
5534
+ return null;
5535
+ }
5536
+ /**
5537
+ * Classify an incoming value for a secret path. Only a non-empty string that is
5538
+ * not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
5539
+ * Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
5540
+ * `undefined`, a redaction token, a non-string — keeps what is stored.
5541
+ */
5542
+ function classifySecretWrite(incoming) {
5543
+ if (isSecretClear(incoming)) return { kind: "clear" };
5544
+ if (typeof incoming !== "string") return { kind: "keep" };
5545
+ if (incoming.length === 0) return { kind: "keep" };
5546
+ if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
5547
+ return {
5548
+ kind: "set",
5549
+ value: incoming
5550
+ };
5551
+ }
5461
5552
  Object.fromEntries([
5462
5553
  {
5463
5554
  id: "overview",
@@ -5629,33 +5720,19 @@ Object.fromEntries([
5629
5720
  function isValuelessField(field) {
5630
5721
  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";
5631
5722
  }
5632
- /**
5633
- * Merge a `ConfigUISchema` with a raw `values` record into a
5634
- * `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
5635
- * before returning to the admin UI. Groups are walked recursively.
5636
- *
5637
- * For each leaf field:
5638
- * - structural fields (`separator`, `info`, `button`) pass through unchanged
5639
- * - other fields get `value = values[key] ?? field.default ?? null`
5640
- *
5641
- * Unknown keys in `values` (keys not declared in the schema) are silently
5642
- * ignored — they don't contribute to the output. Missing keys fall back to
5643
- * the schema default or `null`. This mirrors the old backend behaviour where
5644
- * `FormBuilder` rendered `values[key] ?? field.default`.
5645
- */
5646
- function hydrateSchema(schema, values) {
5723
+ function hydrateSchema(schema, values, options = {}) {
5647
5724
  return {
5648
5725
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
5649
5726
  sections: schema.sections.map((section) => ({
5650
5727
  ...section,
5651
- fields: section.fields.map((field) => hydrateField(field, values))
5728
+ fields: section.fields.map((field) => hydrateField(field, values, options))
5652
5729
  }))
5653
5730
  };
5654
5731
  }
5655
- function hydrateField(field, values) {
5732
+ function hydrateField(field, values, options) {
5656
5733
  if (isValuelessField(field)) return field;
5657
5734
  if (field.type === "group") {
5658
- const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
5735
+ const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
5659
5736
  return {
5660
5737
  ...field,
5661
5738
  fields: hydratedChildren
@@ -5664,7 +5741,7 @@ function hydrateField(field, values) {
5664
5741
  if (field.type === "sub-tabs") {
5665
5742
  const hydratedTabs = field.tabs.map((tab) => ({
5666
5743
  ...tab,
5667
- fields: tab.fields.map((child) => hydrateField(child, values))
5744
+ fields: tab.fields.map((child) => hydrateField(child, values, options))
5668
5745
  }));
5669
5746
  return {
5670
5747
  ...field,
@@ -5674,6 +5751,33 @@ function hydrateField(field, values) {
5674
5751
  const key = field.key;
5675
5752
  const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
5676
5753
  const defaultValue = field.default;
5754
+ const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
5755
+ if (isKeychainStoredField(field) && asView(storedValue)) return {
5756
+ ...field,
5757
+ value: toSecretFieldView(storedValue)
5758
+ };
5759
+ if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
5760
+ ...field,
5761
+ value: null
5762
+ };
5763
+ if (field.type === "editable-array" && Array.isArray(storedValue)) {
5764
+ const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
5765
+ if (secretItemKeys.length > 0) {
5766
+ const rows = storedValue.map((row) => {
5767
+ if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
5768
+ const out = { ...row };
5769
+ for (const k of secretItemKeys) {
5770
+ const v = Reflect.get(row, k);
5771
+ if (asView(v)) out[k] = toSecretFieldView(v);
5772
+ }
5773
+ return out;
5774
+ });
5775
+ return {
5776
+ ...field,
5777
+ value: rows
5778
+ };
5779
+ }
5780
+ }
5677
5781
  if (field.multiple) {
5678
5782
  const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
5679
5783
  const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
@@ -5916,6 +6020,431 @@ function projectStore(store, perNodeKeys, nodeId) {
5916
6020
  }
5917
6021
  return out;
5918
6022
  }
6023
+ var GLOBAL_SCOPE = { kind: "global" };
6024
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6025
+ function globalSecretScope() {
6026
+ return GLOBAL_SCOPE;
6027
+ }
6028
+ function encodeSegment(value) {
6029
+ return encodeURIComponent(value);
6030
+ }
6031
+ /**
6032
+ * The field path of a value inside an array item, addressed by the item's id:
6033
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6034
+ * `providers[authentik].clientSecret`.
6035
+ */
6036
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6037
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6038
+ }
6039
+ /** A write to a secret path could not be stored in the keychain, so it was refused. */
6040
+ var KeychainWriteRefusedError = class extends Error {
6041
+ fieldPath;
6042
+ constructor(fieldPath, cause) {
6043
+ super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
6044
+ this.fieldPath = fieldPath;
6045
+ this.name = "KeychainWriteRefusedError";
6046
+ }
6047
+ };
6048
+ var KEEP = { kind: "keep" };
6049
+ function isRecord(value) {
6050
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6051
+ }
6052
+ function defaultMintId() {
6053
+ return globalThis.crypto.randomUUID();
6054
+ }
6055
+ /** Every marker ref anywhere under `value`. */
6056
+ function collectSecretMarkerRefs(value, out = []) {
6057
+ if (isSecretMarker(value)) {
6058
+ out.push(value.$secret);
6059
+ return out;
6060
+ }
6061
+ if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6062
+ else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6063
+ return out;
6064
+ }
6065
+ async function storedValueEquals(secrets, marker, candidate) {
6066
+ const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
6067
+ return resolved?.kind === "value" && resolved.value === candidate;
6068
+ }
6069
+ async function writeLeaf(ctx, incoming, stored, fieldPath) {
6070
+ const intent = classifySecretWrite(incoming);
6071
+ const ref = ctx.secrets.ref(ctx.scope, fieldPath);
6072
+ const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
6073
+ if (intent.kind === "keep") return KEEP;
6074
+ if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
6075
+ if (intent.kind === "clear") {
6076
+ if (storedIsOurs) ctx.deletes.push(ref);
6077
+ return {
6078
+ kind: "value",
6079
+ value: null
6080
+ };
6081
+ }
6082
+ if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
6083
+ kind: "value",
6084
+ value: stored
6085
+ };
6086
+ try {
6087
+ await ctx.secrets.put(ref, intent.value);
6088
+ } catch (err) {
6089
+ throw new KeychainWriteRefusedError(fieldPath, err);
6090
+ }
6091
+ return {
6092
+ kind: "value",
6093
+ value: makeSecretMarker(ref)
6094
+ };
6095
+ }
6096
+ /** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
6097
+ function applyMember(out, key, result, storedParent) {
6098
+ if (result.kind === "value") {
6099
+ out[key] = result.value;
6100
+ return;
6101
+ }
6102
+ if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
6103
+ else delete out[key];
6104
+ }
6105
+ async function writeMembers(ctx, children, incoming, stored, pathOf) {
6106
+ const out = { ...incoming };
6107
+ for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
6108
+ return out;
6109
+ }
6110
+ function rowId(row, idKey) {
6111
+ const raw = row[idKey];
6112
+ if (typeof raw === "string" && raw.length > 0) return raw;
6113
+ if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
6114
+ return null;
6115
+ }
6116
+ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6117
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
6118
+ if (!Array.isArray(incoming)) {
6119
+ ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6120
+ return {
6121
+ kind: "value",
6122
+ value: incoming
6123
+ };
6124
+ }
6125
+ const storedById = /* @__PURE__ */ new Map();
6126
+ for (const row of storedRows) {
6127
+ const id = rowId(row, node.idKey);
6128
+ if (id !== null) storedById.set(id, row);
6129
+ }
6130
+ const kept = /* @__PURE__ */ new Set();
6131
+ const rows = [];
6132
+ for (const row of incoming) {
6133
+ if (!isRecord(row)) {
6134
+ rows.push(row);
6135
+ continue;
6136
+ }
6137
+ const id = rowId(row, node.idKey) ?? ctx.mintId();
6138
+ kept.add(id);
6139
+ const withId = {
6140
+ ...row,
6141
+ [node.idKey]: row[node.idKey] ?? id
6142
+ };
6143
+ if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
6144
+ const storedRow = storedById.get(id) ?? {};
6145
+ rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
6146
+ }
6147
+ for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
6148
+ return {
6149
+ kind: "value",
6150
+ value: rows
6151
+ };
6152
+ }
6153
+ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6154
+ switch (node.kind) {
6155
+ case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6156
+ case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6157
+ case "object": {
6158
+ if (!isRecord(incoming)) {
6159
+ if (incoming === void 0) return KEEP;
6160
+ ctx.deletes.push(...collectSecretMarkerRefs(stored));
6161
+ return {
6162
+ kind: "value",
6163
+ value: incoming
6164
+ };
6165
+ }
6166
+ const storedObj = isRecord(stored) ? stored : {};
6167
+ return {
6168
+ kind: "value",
6169
+ value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
6170
+ };
6171
+ }
6172
+ }
6173
+ }
6174
+ /** Split a perNode-scoped key (`key@nodeId`). */
6175
+ function splitNodeKey(key) {
6176
+ const at = key.indexOf("@");
6177
+ return at <= 0 ? {
6178
+ base: key,
6179
+ nodeId: null
6180
+ } : {
6181
+ base: key.slice(0, at),
6182
+ nodeId: key.slice(at + 1)
6183
+ };
6184
+ }
6185
+ /** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
6186
+ async function transformSecretWrite(input) {
6187
+ const deletes = [];
6188
+ const base = {
6189
+ secrets: input.secrets,
6190
+ mintId: input.mintId ?? defaultMintId,
6191
+ deletes,
6192
+ operatorWrite: input.operatorWrite === true
6193
+ };
6194
+ const out = {};
6195
+ for (const [key, incoming] of Object.entries(input.patch)) {
6196
+ const { base: baseKey, nodeId } = splitNodeKey(key);
6197
+ const node = input.tree.get(baseKey);
6198
+ if (node === void 0) {
6199
+ out[key] = incoming;
6200
+ continue;
6201
+ }
6202
+ const scope = nodeId !== null && nodeId.length > 0 ? {
6203
+ kind: "node",
6204
+ nodeId
6205
+ } : input.scope ?? globalSecretScope();
6206
+ const result = await writeNode({
6207
+ ...base,
6208
+ scope
6209
+ }, node, incoming, input.stored[key], baseKey);
6210
+ if (result.kind === "value") out[key] = result.value;
6211
+ }
6212
+ return {
6213
+ patch: out,
6214
+ afterWrite: async () => {
6215
+ if (deletes.length === 0) return { orphaned: [] };
6216
+ try {
6217
+ await input.secrets.delete([...new Set(deletes)]);
6218
+ return { orphaned: [] };
6219
+ } catch {
6220
+ return { orphaned: [...new Set(deletes)] };
6221
+ }
6222
+ }
6223
+ };
6224
+ }
6225
+ /**
6226
+ * Replace every marker in `value` with its keychain value. Returns the SAME
6227
+ * reference when there is no marker (no allocation, no keychain call).
6228
+ */
6229
+ async function resolveSecretMarkers(value, secrets) {
6230
+ const refs = collectSecretMarkerRefs(value);
6231
+ if (refs.length === 0) return {
6232
+ value,
6233
+ unresolved: []
6234
+ };
6235
+ const answers = await secrets.resolve(refs);
6236
+ const unresolved = [];
6237
+ for (const ref of new Set(refs)) {
6238
+ const answer = answers[ref];
6239
+ if (answer === void 0) unresolved.push({
6240
+ ref,
6241
+ reason: "not-initialized"
6242
+ });
6243
+ else if (answer.kind === "unavailable") unresolved.push({
6244
+ ref,
6245
+ reason: answer.reason
6246
+ });
6247
+ else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
6248
+ ref,
6249
+ reason: answer.kind
6250
+ });
6251
+ }
6252
+ const substitute = (v) => {
6253
+ if (isSecretMarker(v)) {
6254
+ const answer = answers[v.$secret];
6255
+ return answer?.kind === "value" ? {
6256
+ keep: true,
6257
+ value: answer.value
6258
+ } : {
6259
+ keep: false,
6260
+ value: void 0
6261
+ };
6262
+ }
6263
+ if (Array.isArray(v)) {
6264
+ const items = [];
6265
+ for (const item of v) {
6266
+ const s = substitute(item);
6267
+ if (s.keep) items.push(s.value);
6268
+ }
6269
+ return {
6270
+ keep: true,
6271
+ value: items
6272
+ };
6273
+ }
6274
+ if (isRecord(v)) {
6275
+ const out = {};
6276
+ for (const [k, child] of Object.entries(v)) {
6277
+ const s = substitute(child);
6278
+ if (s.keep) out[k] = s.value;
6279
+ }
6280
+ return {
6281
+ keep: true,
6282
+ value: out
6283
+ };
6284
+ }
6285
+ return {
6286
+ keep: true,
6287
+ value: v
6288
+ };
6289
+ };
6290
+ return {
6291
+ value: substitute(value).value,
6292
+ unresolved
6293
+ };
6294
+ }
6295
+ function touchesTree(tree, patch) {
6296
+ if (tree.size === 0) return false;
6297
+ for (const key of Object.keys(patch)) {
6298
+ const at = key.indexOf("@");
6299
+ if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
6300
+ }
6301
+ return false;
6302
+ }
6303
+ /** The blob as stored now; a failed read REFUSES the write instead of guessing. */
6304
+ async function readStoredAddonBlob(raw) {
6305
+ const threeWay = raw.readAddonStoreResult;
6306
+ if (threeWay === void 0) return raw.readAddonStore();
6307
+ const result = await threeWay.call(raw);
6308
+ if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
6309
+ return result.kind === "missing" ? {} : result.value;
6310
+ }
6311
+ function createSecretAwareSettings(raw, opts) {
6312
+ const chains = /* @__PURE__ */ new Map();
6313
+ const serialize = (key, fn) => {
6314
+ const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
6315
+ const tail = next.catch(() => void 0);
6316
+ chains.set(key, tail);
6317
+ tail.then(() => {
6318
+ if (chains.get(key) === tail) chains.delete(key);
6319
+ });
6320
+ return next;
6321
+ };
6322
+ const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
6323
+ if (!touchesTree(tree, patch)) return rawWrite(patch);
6324
+ return serialize(chainKey, async () => {
6325
+ const stored = await readStored();
6326
+ const result = await transformSecretWrite({
6327
+ tree,
6328
+ secrets: opts.secrets,
6329
+ patch,
6330
+ stored,
6331
+ ...scope !== void 0 ? { scope } : {},
6332
+ operatorWrite: opts.isOperatorWrite?.() === true
6333
+ });
6334
+ if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
6335
+ const { orphaned } = await result.afterWrite();
6336
+ if (orphaned.length > 0) opts.onOrphaned(orphaned);
6337
+ });
6338
+ };
6339
+ const wrapped = {
6340
+ writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
6341
+ writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
6342
+ kind: "device",
6343
+ deviceId
6344
+ }, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
6345
+ };
6346
+ return new Proxy(raw, { get(target, prop, receiver) {
6347
+ if (prop === "writeAddonStore") return wrapped.writeAddonStore;
6348
+ if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
6349
+ const value = Reflect.get(target, prop, receiver);
6350
+ return typeof value === "function" ? value.bind(target) : value;
6351
+ } });
6352
+ }
6353
+ /** The context the addon sees: identical, except that its settings writes are secret-aware. */
6354
+ function withSecretAwareSettings(context, opts) {
6355
+ const raw = context.settings;
6356
+ if (raw === void 0) return context;
6357
+ const settings = createSecretAwareSettings(raw, opts);
6358
+ return new Proxy(context, { get(target, prop, receiver) {
6359
+ if (prop === "settings") return settings;
6360
+ return Reflect.get(target, prop, receiver);
6361
+ } });
6362
+ }
6363
+ var LEAF = { kind: "leaf" };
6364
+ var DEFAULT_ITEM_ID_KEY = "id";
6365
+ function collectFields(fields, out) {
6366
+ for (const field of fields) {
6367
+ if (field.type === "group") {
6368
+ collectFields(field.fields, out);
6369
+ continue;
6370
+ }
6371
+ if (field.type === "sub-tabs") {
6372
+ for (const tab of field.tabs) collectFields(tab.fields, out);
6373
+ continue;
6374
+ }
6375
+ if (field.type === "editable-array") {
6376
+ const item = /* @__PURE__ */ new Map();
6377
+ for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
6378
+ if (item.size > 0) out.set(field.key, {
6379
+ kind: "array",
6380
+ idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
6381
+ item
6382
+ });
6383
+ continue;
6384
+ }
6385
+ if (!("key" in field) || typeof field.key !== "string") continue;
6386
+ if (isKeychainStoredField(field)) out.set(field.key, LEAF);
6387
+ }
6388
+ }
6389
+ /** The secret tree a settings schema declares. */
6390
+ function secretTreeFromSchema(schema) {
6391
+ const out = /* @__PURE__ */ new Map();
6392
+ if (schema === null) return out;
6393
+ for (const section of schema.sections) collectFields(section.fields, out);
6394
+ return out;
6395
+ }
6396
+ /** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
6397
+ function parseSecretStatePath(path) {
6398
+ const segments = [];
6399
+ for (const raw of path.split(".")) {
6400
+ const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
6401
+ if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
6402
+ segments.push(m[2] !== void 0 ? {
6403
+ key: m[1],
6404
+ idKey: m[2]
6405
+ } : { key: m[1] });
6406
+ }
6407
+ if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
6408
+ if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
6409
+ return segments;
6410
+ }
6411
+ function insert(into, segments) {
6412
+ const [head, ...rest] = segments;
6413
+ if (head === void 0) return;
6414
+ if (rest.length === 0) {
6415
+ into.set(head.key, LEAF);
6416
+ return;
6417
+ }
6418
+ const existing = into.get(head.key);
6419
+ if (head.idKey !== void 0) {
6420
+ const item = new Map(existing?.kind === "array" ? existing.item : []);
6421
+ insert(item, rest);
6422
+ into.set(head.key, {
6423
+ kind: "array",
6424
+ idKey: head.idKey,
6425
+ item
6426
+ });
6427
+ return;
6428
+ }
6429
+ const children = new Map(existing?.kind === "object" ? existing.children : []);
6430
+ insert(children, rest);
6431
+ into.set(head.key, {
6432
+ kind: "object",
6433
+ children
6434
+ });
6435
+ }
6436
+ /** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
6437
+ function mergeSecretStatePaths(tree, paths) {
6438
+ if (paths.length === 0) return tree;
6439
+ const out = new Map(tree);
6440
+ for (const path of paths) insert(out, parseSecretStatePath(path));
6441
+ return out;
6442
+ }
6443
+ /** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
6444
+ var SECRET_RETRY_FIRST_MS = 5e3;
6445
+ var SECRET_RETRY_MAX_MS = 5 * 6e4;
6446
+ /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
6447
+ var SECRET_CHANGE_DEBOUNCE_MS = 250;
5919
6448
  /**
5920
6449
  * Base class for CamStack addons. Eliminates settings boilerplate:
5921
6450
  *
@@ -5985,6 +6514,25 @@ var BaseAddon = class {
5985
6514
  settingsStoreReady = false;
5986
6515
  /** Default config values. Provided via constructor. */
5987
6516
  defaults;
6517
+ /**
6518
+ * Hidden-state paths that hold secrets (D787) — values the addon writes
6519
+ * itself (`updateGlobalSettings`, `state()`) that no form field declares.
6520
+ * Stored in the keychain exactly like a `password` field. Syntax:
6521
+ * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
6522
+ * (`key[<id field>]` addresses array items by id, never by index).
6523
+ */
6524
+ secretStatePaths = [];
6525
+ _addonSecretTree = null;
6526
+ _deviceSecretTree = null;
6527
+ /** Refs the last resolved config pointed at — a change to one re-resolves. */
6528
+ _configSecretRefs = /* @__PURE__ */ new Set();
6529
+ _unresolvedSecrets = [];
6530
+ _secretRetryTimer = null;
6531
+ _secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
6532
+ _secretChangeTimer = null;
6533
+ _secretChangeUnsub = null;
6534
+ /** >0 while an OPERATOR's settings write is being applied. */
6535
+ _operatorWriteDepth = 0;
5988
6536
  constructor(defaults) {
5989
6537
  this.defaults = defaults;
5990
6538
  this._config = { ...defaults };
@@ -6020,8 +6568,18 @@ var BaseAddon = class {
6020
6568
  return this._config;
6021
6569
  }
6022
6570
  async initialize(context) {
6023
- this._ctx = context;
6571
+ const secrets = context.secrets;
6572
+ this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
6573
+ secrets,
6574
+ addonTree: () => this.addonSecretTree(),
6575
+ deviceTree: () => this.deviceSecretTree(),
6576
+ onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
6577
+ isOperatorWrite: () => this._operatorWriteDepth > 0
6578
+ }) : context;
6024
6579
  await this.resolveConfig();
6580
+ if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
6581
+ if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
6582
+ });
6025
6583
  const result = await this.onInitialize();
6026
6584
  this.emitLifecycle(EventCategory.AddonStarted);
6027
6585
  const normalized = normalizeAddonInitResult(result);
@@ -6054,6 +6612,12 @@ var BaseAddon = class {
6054
6612
  */
6055
6613
  async onHubReachable() {}
6056
6614
  async shutdown() {
6615
+ this._secretChangeUnsub?.();
6616
+ this._secretChangeUnsub = null;
6617
+ if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
6618
+ if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
6619
+ this._secretRetryTimer = null;
6620
+ this._secretChangeTimer = null;
6057
6621
  this.emitLifecycle(EventCategory.AddonStopped);
6058
6622
  if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
6059
6623
  await this.onShutdown();
@@ -6132,7 +6696,7 @@ var BaseAddon = class {
6132
6696
  return hydrateSchema(schema, overlay ? {
6133
6697
  ...projected,
6134
6698
  ...overlay
6135
- } : projected);
6699
+ } : projected, { inlineSecretsAsViews: true });
6136
6700
  }
6137
6701
  /**
6138
6702
  * The integration-level view of this addon's settings: exactly the sections
@@ -6181,7 +6745,7 @@ var BaseAddon = class {
6181
6745
  return hydrateSchema({
6182
6746
  ...schema,
6183
6747
  sections
6184
- }, projected);
6748
+ }, projected, { inlineSecretsAsViews: true });
6185
6749
  }
6186
6750
  /**
6187
6751
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -6235,18 +6799,50 @@ var BaseAddon = class {
6235
6799
  value: result.value[key]
6236
6800
  };
6237
6801
  }
6802
+ /**
6803
+ * The OPERATOR's write — a settings form or an admin API call, dispatched by
6804
+ * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
6805
+ * the operator sends is stored as sent even when it equals a pre-keychain
6806
+ * inline value: the operator re-entering a password is a change, an addon
6807
+ * writing back what it read is not (D787).
6808
+ */
6809
+ async updateGlobalSettingsAsOperator(patch, nodeId) {
6810
+ this._operatorWriteDepth++;
6811
+ try {
6812
+ await this.applyGlobalPatch(patch, nodeId);
6813
+ } finally {
6814
+ this._operatorWriteDepth--;
6815
+ }
6816
+ }
6238
6817
  async updateGlobalSettings(patch, nodeId) {
6818
+ await this.applyGlobalPatch(patch, nodeId);
6819
+ }
6820
+ /**
6821
+ * REMOVE stored secrets — their keychain values and their markers (D787).
6822
+ *
6823
+ * Writing `''` to a secret field KEEPS what is stored (an empty string is
6824
+ * what a defaults fallback writes back, and it must never destroy a
6825
+ * credential), so code that means "forget this token" says so here. Without
6826
+ * a keychain (an older kernel) it writes `''`, as such code always did.
6827
+ */
6828
+ async clearSecrets(keys, nodeId) {
6829
+ const tree = this.addonSecretTree();
6830
+ const keychain = this._ctx?.secrets !== void 0;
6831
+ const patch = {};
6832
+ for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
6833
+ await this.applyGlobalPatch(patch, nodeId);
6834
+ }
6835
+ async applyGlobalPatch(barePatch, nodeId) {
6239
6836
  const keys = this.perNodeKeys();
6240
6837
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6241
6838
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6242
- const barePatch = patch;
6243
6839
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
6244
6840
  await this._ctx?.settings?.writeAddonStore(scoped);
6245
6841
  if (target !== localNode) return;
6246
6842
  await this.resolveConfig();
6247
6843
  await this.onConfigChanged();
6248
6844
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
6249
- this.maybeAutoRestart(patch, this.globalSettingsSchema());
6845
+ this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
6250
6846
  }
6251
6847
  /**
6252
6848
  * The set of field keys the global settings schema declares `perNode: true`
@@ -6271,7 +6867,7 @@ var BaseAddon = class {
6271
6867
  * time to return its response before the addon is torn down and
6272
6868
  * re-initialised by `AddonRegistryService.restartAddon`.
6273
6869
  */
6274
- maybeAutoRestart(patch, schema) {
6870
+ maybeAutoRestart(patchKeys, schema) {
6275
6871
  if (!schema) return;
6276
6872
  const restartKeys = /* @__PURE__ */ new Set();
6277
6873
  for (const section of schema.sections) for (const field of section.fields) {
@@ -6279,13 +6875,13 @@ var BaseAddon = class {
6279
6875
  if (field.requiresRestart) restartKeys.add(field.key);
6280
6876
  }
6281
6877
  if (restartKeys.size === 0) return;
6282
- if (!Object.keys(patch).some((k) => restartKeys.has(k))) return;
6878
+ if (!patchKeys.some((k) => restartKeys.has(k))) return;
6283
6879
  const ctx = this._ctx;
6284
6880
  if (!ctx) return;
6285
6881
  const addonId = ctx.id;
6286
6882
  setImmediate(() => {
6287
6883
  ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
6288
- ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: Object.keys(patch).filter((k) => restartKeys.has(k)) } });
6884
+ ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
6289
6885
  }).catch((err) => {
6290
6886
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
6291
6887
  });
@@ -6294,7 +6890,7 @@ var BaseAddon = class {
6294
6890
  async getDeviceSettings(deviceId) {
6295
6891
  const schema = this.deviceSettingsSchema();
6296
6892
  if (!schema) return { sections: [] };
6297
- return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
6893
+ return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
6298
6894
  }
6299
6895
  async updateDeviceSettings(deviceId, patch) {
6300
6896
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -6424,7 +7020,7 @@ var BaseAddon = class {
6424
7020
  * selection at boot (absent scoped key ⇒ the constructor default wins).
6425
7021
  */
6426
7022
  async resolveConfig() {
6427
- const stored = await this.readAddonStoreWithRetry();
7023
+ const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
6428
7024
  const perNode = this.perNodeKeys();
6429
7025
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
6430
7026
  const resolved = { ...this.defaults };
@@ -6449,7 +7045,7 @@ var BaseAddon = class {
6449
7045
  key,
6450
7046
  schema,
6451
7047
  fallback,
6452
- read: () => this.readAddonStoreWithRetry(),
7048
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
6453
7049
  write: async (patch) => {
6454
7050
  await this._ctx?.settings?.writeAddonStore(patch);
6455
7051
  },
@@ -6466,7 +7062,7 @@ var BaseAddon = class {
6466
7062
  key,
6467
7063
  schema,
6468
7064
  fallback,
6469
- read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
7065
+ read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
6470
7066
  write: async (patch) => {
6471
7067
  await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
6472
7068
  },
@@ -6478,6 +7074,70 @@ var BaseAddon = class {
6478
7074
  } })
6479
7075
  });
6480
7076
  }
7077
+ /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
7078
+ addonSecretTree() {
7079
+ this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
7080
+ return this._addonSecretTree;
7081
+ }
7082
+ deviceSecretTree() {
7083
+ this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7084
+ return this._deviceSecretTree;
7085
+ }
7086
+ /**
7087
+ * Secrets of this addon's stored config that could not be resolved on the
7088
+ * last read, with why. Non-empty means the addon is running WITHOUT them —
7089
+ * an addon whose function needs one should report itself degraded rather
7090
+ * than start on an empty credential.
7091
+ */
7092
+ get unresolvedSecrets() {
7093
+ return this._unresolvedSecrets;
7094
+ }
7095
+ /**
7096
+ * Substitute every keychain marker in a stored blob with its value. With no
7097
+ * keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
7098
+ * An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
7099
+ * value — and, when the cause can pass, retried with backoff. Nothing is
7100
+ * ever written back from here.
7101
+ */
7102
+ async resolveStoredSecrets(blob, trackForConfig = true) {
7103
+ const secrets = this._ctx?.secrets;
7104
+ if (secrets === void 0) return blob;
7105
+ const refs = collectSecretMarkerRefs(blob);
7106
+ if (trackForConfig) this._configSecretRefs = new Set(refs);
7107
+ if (refs.length === 0) {
7108
+ if (trackForConfig) this._unresolvedSecrets = [];
7109
+ return blob;
7110
+ }
7111
+ const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
7112
+ if (trackForConfig) {
7113
+ this._unresolvedSecrets = unresolved;
7114
+ if (unresolved.length > 0) {
7115
+ this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
7116
+ ref: u.ref,
7117
+ reason: u.reason
7118
+ })) } });
7119
+ if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
7120
+ this.scheduleSecretReresolve(this._secretRetryDelayMs);
7121
+ this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
7122
+ }
7123
+ } else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
7124
+ }
7125
+ return value;
7126
+ }
7127
+ /** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
7128
+ scheduleSecretReresolve(delayMs) {
7129
+ const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
7130
+ if (this[timerOf] !== null) return;
7131
+ const timer = setTimeout(() => {
7132
+ this[timerOf] = null;
7133
+ if (this._ctx === null) return;
7134
+ this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
7135
+ this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
7136
+ });
7137
+ }, delayMs);
7138
+ timer.unref?.();
7139
+ this[timerOf] = timer;
7140
+ }
6481
7141
  /**
6482
7142
  * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
6483
7143
  * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
@@ -6745,32 +7405,12 @@ object({
6745
7405
  audioCodec: string().optional(),
6746
7406
  metadata: record(string(), unknown()).readonly().optional()
6747
7407
  });
6748
- var EncodedPacketSchema = object({
6749
- type: _enum(["video", "audio"]),
6750
- data: _instanceof(Uint8Array),
6751
- pts: number(),
6752
- dts: number(),
6753
- keyframe: boolean(),
6754
- codec: string()
6755
- });
6756
- var DecodedFrameSchema = object({
6757
- data: _instanceof(Uint8Array),
6758
- width: number(),
6759
- height: number(),
6760
- format: _enum([
6761
- "jpeg",
6762
- "rgb",
6763
- "bgr",
6764
- "yuv420",
6765
- "gray"
6766
- ]),
6767
- timestamp: number()
6768
- });
6769
7408
  /**
6770
7409
  * Wire schema for `FrameHandle` — a zero-pixel, serialisable reference to a
6771
7410
  * frame in a shared-memory ring (Phase 5 / D9). Mirrors the `FrameHandle` TS
6772
- * interface in `interfaces/frame-handle.ts` field-for-field so a decoder cap
6773
- * method (`pullHandles`) can carry handles over tRPC / Moleculer.
7411
+ * interface in `interfaces/frame-handle.ts` field-for-field so a cap method
7412
+ * (the runner's native-crop and pipeline-executor inputs) can carry handles
7413
+ * over tRPC / Moleculer.
6774
7414
  *
6775
7415
  * The `satisfies` assertion below pins this schema to the interface: if a
6776
7416
  * field is added to / removed from `FrameHandle` without a matching schema
@@ -6796,50 +7436,6 @@ var FrameHandleSchema = object({
6796
7436
  slotCount: number().int().positive()
6797
7437
  });
6798
7438
  /**
6799
- * Pixel format a frame-handle subscriber can request from the broker
6800
- * (Phase 5 / D9). The packed, raster subset of `FrameFormat` — the formats a
6801
- * `frameSink: 'shm'` decoder session can write into a `FrameRing` slot.
6802
- * `jpeg` is excluded: a variable-length stream is not a fixed-stride ring
6803
- * payload, and no decoded-frame consumer requests it over the shm plane.
6804
- */
6805
- var FrameHandleFormatSchema = _enum([
6806
- "rgb",
6807
- "bgr",
6808
- "yuv420",
6809
- "gray"
6810
- ]);
6811
- /**
6812
- * Input for `stream-broker.subscribeFrames` (Phase 5 / D9). A consumer asks the
6813
- * broker for a `FrameHandle` stream of one `format`; the broker maintains one
6814
- * shared-memory ring per `(brokerId, format)` actually requested, so a `gray`
6815
- * subscriber (motion) and an `rgb` subscriber (detection) each read the format
6816
- * they asked for with no broker-side conversion.
6817
- */
6818
- var SubscribeFramesInputSchema = object({
6819
- brokerId: string(),
6820
- format: FrameHandleFormatSchema,
6821
- /**
6822
- * Optional reader-side cadence hint in frames per second. The broker does
6823
- * NOT throttle — latest-wins ring reads drop frames implicitly for a slow
6824
- * consumer. The value is echoed back in `SubscribeFramesResult.maxFps` so
6825
- * the consumer can pace its own `pullFrameHandles` polling.
6826
- */
6827
- maxFps: number().positive().optional(),
6828
- /** Short caller-identity tag (`motion`, `detection`, …) for diagnostics. */
6829
- tag: string().optional()
6830
- });
6831
- /**
6832
- * Result of `stream-broker.subscribeFrames`. The consumer then polls
6833
- * `pullFrameHandles({ subscriptionId, maxCount })` and feeds each returned
6834
- * `FrameHandle` to a `FrameRingReader`.
6835
- */
6836
- var SubscribeFramesResultSchema = object({
6837
- /** Opaque id the consumer passes to `pullFrameHandles` / `unsubscribeFrames`. */
6838
- subscriptionId: string(),
6839
- /** Reader-side cadence hint (frames/s) — echoes `SubscribeFramesInput.maxFps`. */
6840
- maxFps: number().nonnegative()
6841
- });
6842
- /**
6843
7439
  * Wire schema for a decoded audio chunk (Phase 5 / D9). Mirrors the
6844
7440
  * `DecodedAudioChunk` TS interface in `interfaces/stream-broker.ts`: PCM
6845
7441
  * sample bytes plus the track parameters a consumer needs to interpret them.
@@ -6847,8 +7443,8 @@ var SubscribeFramesResultSchema = object({
6847
7443
  * Audio chunks are tiny (a ~500ms AudioCodecSession window is a few KB of
6848
7444
  * Float32 PCM), so unlike video frames they ship their bytes INLINE over
6849
7445
  * tRPC / Moleculer — no shared-memory plane. `data` is typed `Uint8Array`
6850
- * (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
6851
- * / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
7446
+ * (the wire-serialisable supertype of `Buffer`); a `Buffer` is assignable to
7447
+ * it.
6852
7448
  */
6853
7449
  var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
6854
7450
  var DecodedAudioChunkSchema = object({
@@ -6866,11 +7462,10 @@ var DecodedAudioChunkSchema = object({
6866
7462
  format: AudioChunkFormatSchema.optional()
6867
7463
  });
6868
7464
  /**
6869
- * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
6870
- * handle-free, ship-bytes-inline analogue of `subscribeFrames`: a consumer
6871
- * asks the broker for the decoded audio-chunk stream of one broker; the
6872
- * broker keeps a per-subscription bounded FIFO queue the consumer drains via
6873
- * `pullAudioChunks`.
7465
+ * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). Audio ships
7466
+ * its bytes inline: a consumer asks the broker for the decoded audio-chunk
7467
+ * stream of one broker; the broker keeps a per-subscription bounded FIFO queue
7468
+ * the consumer drains via `pullAudioChunks`.
6874
7469
  */
6875
7470
  var SubscribeAudioChunksInputSchema = object({
6876
7471
  brokerId: string(),
@@ -6901,9 +7496,7 @@ var BrokerStatsSchema = object({
6901
7496
  "stopped"
6902
7497
  ]),
6903
7498
  inputFps: number(),
6904
- decodeFps: number(),
6905
7499
  encodedSubscribers: number(),
6906
- decodedSubscribers: number(),
6907
7500
  uptimeMs: number(),
6908
7501
  bitrateKbps: number(),
6909
7502
  idrIntervalMs: number(),
@@ -6916,14 +7509,6 @@ var BrokerStatsSchema = object({
6916
7509
  preBufferMs: number(),
6917
7510
  preBufferPackets: number(),
6918
7511
  /**
6919
- * Moleculer node id of the decoder provider currently servicing this
6920
- * stream's decoded subscribers. `null` until the deferred decoder is
6921
- * created (no decoded clients yet, or codec not detected). Surfaces the
6922
- * runtime decoder placement so the UI can show "Decoder: <agent>" without
6923
- * a separate cap call per broker.
6924
- */
6925
- decoderNodeId: string().nullable(),
6926
- /**
6927
7512
  * Detected audio track parameters from the RTSP DESCRIBE / SDP. `null`
6928
7513
  * when the stream has no audio track or the broker is in cold start.
6929
7514
  * `supported = false` means the codec was detected but the local
@@ -10279,70 +10864,6 @@ var StorageLocationDeclarationSchema = object({
10279
10864
  "backup"
10280
10865
  ]).optional()
10281
10866
  });
10282
- var DecoderStatsSchema = object({
10283
- inputFps: number(),
10284
- outputFps: number(),
10285
- avgDecodeTimeMs: number(),
10286
- droppedFrames: number(),
10287
- /**
10288
- * Pull-mode adaptive-fps telemetry (optional — only pull sessions run the
10289
- * lag-driven controller; push sessions omit these). `lagMs` is the EWMA of
10290
- * the decoder's real-time drift (rising = falling behind live); `adaptiveFps`
10291
- * is the current lag-throttled emit rate (≤ `effectiveFps` ceiling).
10292
- */
10293
- lagMs: number().optional(),
10294
- effectiveFps: number().optional(),
10295
- adaptiveFps: number().optional()
10296
- });
10297
- var DecoderSessionConfigSchema = object({
10298
- codec: string(),
10299
- maxFps: number().default(0),
10300
- outputFormat: _enum([
10301
- "jpeg",
10302
- "rgb",
10303
- "bgr",
10304
- "yuv420",
10305
- "gray"
10306
- ]).default("jpeg"),
10307
- scale: number().default(1),
10308
- width: number().optional(),
10309
- height: number().optional(),
10310
- /**
10311
- * Identifier of the camera this decoder session serves. Optional
10312
- * because the cap is generic (any caller could request decode), but
10313
- * stream-broker passes it so decoder logs include `deviceId` for
10314
- * per-camera filtering when diagnosing failures (e.g. node-av
10315
- * sendPacket errors on a single hung camera).
10316
- */
10317
- deviceId: number().int().nonnegative().optional(),
10318
- /**
10319
- * Free-form tag for log scoping. Stream-broker uses
10320
- * `broker:<deviceId>/<profile>`. Decoder session logger surfaces it
10321
- * on every line so `grep tag=broker:5/high` filters one camera
10322
- * profile cleanly.
10323
- */
10324
- tag: string().optional(),
10325
- /**
10326
- * Where the session delivers decoded frames (Phase 5 / D9):
10327
- *
10328
- * - `'callback'` (default) — the legacy pixel path: decoded frames are
10329
- * buffered as `DecodedFrame`s and drained via `pullFrames`.
10330
- * - `'shm'` — the shared-memory frame plane: decoded frames are written
10331
- * into an OS shared-memory ring and drained as zero-pixel
10332
- * `FrameHandle`s via `pullHandles`. A session is one mode or the
10333
- * other — `pullFrames` returns nothing for an `'shm'` session and
10334
- * `pullHandles` returns nothing for a `'callback'` session.
10335
- */
10336
- frameSink: _enum(["callback", "shm"]).default("callback"),
10337
- /**
10338
- * Per-camera decoder DEBUG facility. When `true`, a pull-mode session emits
10339
- * a throttled (~1Hz) structured `decoder debug` line (effective/adaptive fps,
10340
- * real-time lag, dropped-frame delta, avg decode time, hwaccel). Mirrors the
10341
- * stream-broker's `streamingDebug` gate — off by default so production logs
10342
- * stay quiet and the emit path pays zero per-frame cost when disabled.
10343
- */
10344
- debug: boolean().optional()
10345
- });
10346
10867
  /**
10347
10868
  * Per-component log CHANNELS — the gate a hot path consults, and the registry
10348
10869
  * an addon declares its channels in.
@@ -10485,6 +11006,26 @@ var ClipSearchStrictnessSchema = _enum([
10485
11006
  "balanced",
10486
11007
  "strict"
10487
11008
  ]);
11009
+ /** Steps whose effect a root label can BE. */
11010
+ var LABEL_SUPPLY_STEP_IDS = [
11011
+ "animal-classifier",
11012
+ "vehicle-classifier",
11013
+ "package-detection"
11014
+ ];
11015
+ /** Steps whose box a root detection can BE. */
11016
+ var CROP_SUPPLY_STEP_IDS = ["plate-detection", "face-detection"];
11017
+ /**
11018
+ * Steps whose per-detection MASK a root detection can carry (D737). The live
11019
+ * mask step is `segmentation` — a frame-plane refiner that runs its own model
11020
+ * once per detection crop. (`instance-segmentation` is a dormant step id that
11021
+ * no camera tree carries.)
11022
+ */
11023
+ var MASK_SUPPLY_STEP_IDS = ["segmentation"];
11024
+ [
11025
+ ...LABEL_SUPPLY_STEP_IDS,
11026
+ ...CROP_SUPPLY_STEP_IDS,
11027
+ ...MASK_SUPPLY_STEP_IDS
11028
+ ];
10488
11029
  var MODEL_FORMATS = [
10489
11030
  "onnx",
10490
11031
  "coreml",
@@ -10513,7 +11054,53 @@ var ModelFormatEntrySchema = object({
10513
11054
  /** Multi-file payload (directory members or sibling files). */
10514
11055
  files: array(string()).readonly().optional(),
10515
11056
  /** Runtime(s) that can use this format. If omitted, inferred from ModelFormat key */
10516
- runtimes: array(_enum(["python"])).readonly().optional()
11057
+ runtimes: array(_enum(["python"])).readonly().optional(),
11058
+ /**
11059
+ * Content revision of the artefact, for one hosted OFF the CamStack mirror.
11060
+ * A format on the mirror leaves it unset: its revision (the sha256 of its
11061
+ * weight file) comes from the downloader's generated table, kept in step
11062
+ * with the mirror by `scripts/check-hosted-model-revisions.ts` (D744). A
11063
+ * node records the revision it downloaded next to the file
11064
+ * (`<file>.revision`); a copy with no record or a different one is stale
11065
+ * unless its weight file hashes to the revision, and a stale copy is
11066
+ * downloaded again, the old one serving until the new one is complete. No
11067
+ * revision at all ⇒ a file on disk is current, whatever it holds (D743).
11068
+ */
11069
+ revision: string().min(1).optional()
11070
+ });
11071
+ /**
11072
+ * What a node holds for one (model, format) (D746). `current` is a complete
11073
+ * copy at its catalog revision — exactly what `downloaded: true` means.
11074
+ * `stale` is bytes on disk that are not (yet) proven current under D743/D744:
11075
+ * no or a different revision record, or a missing sibling. `missing` is no
11076
+ * copy. `downloaded` alone folds `stale` into "not downloaded", which hid
11077
+ * reclaimable bytes and a copy about to be replaced.
11078
+ */
11079
+ var ModelOnDiskStateSchema = _enum([
11080
+ "current",
11081
+ "stale",
11082
+ "missing"
11083
+ ]);
11084
+ /**
11085
+ * The numeric precision of one format's BUILD (D746) — reported only when the
11086
+ * build states it (file-name token, an INT8 variant, an EdgeTPU compile, a
11087
+ * CamStack Core ML export). Absent means "not stated", never "fp32".
11088
+ */
11089
+ var ModelFormatPrecisionSchema = _enum([
11090
+ "fp32",
11091
+ "fp16",
11092
+ "int8"
11093
+ ]);
11094
+ /**
11095
+ * One format of one model as a node's `pipelineExecutor.getSchema` reports it.
11096
+ * `onDisk` / `precision` are optional for version skew: a runner that predates
11097
+ * them omits them, and a reader falls back to `downloaded`.
11098
+ */
11099
+ var PipelineModelFormatStatusSchema = object({
11100
+ downloaded: boolean(),
11101
+ sizeMB: number(),
11102
+ onDisk: ModelOnDiskStateSchema.optional(),
11103
+ precision: ModelFormatPrecisionSchema.optional()
10517
11104
  });
10518
11105
  /**
10519
11106
  * Extra file that must be downloaded alongside the model (e.g., labels JSON, dict.txt).
@@ -10617,6 +11204,46 @@ var ModelLicenseSchema = preprocess((value) => typeof value === "string" ? { wei
10617
11204
  /** True when the weights or their data forbid commercial use. */
10618
11205
  nonCommercial: boolean().optional()
10619
11206
  }));
11207
+ /**
11208
+ * One step a ROOT detector can supply from its own output (D730) — see
11209
+ * `ModelCatalogEntry.suppliesSteps`.
11210
+ *
11211
+ * - `label`: the root's raw class IS the step's answer. `labelToEffect` maps
11212
+ * the root's label to the step's vocabulary; `uncovered` is the vocabulary
11213
+ * the root cannot produce (shown as unavailable, never a blocker).
11214
+ * - `crop`: the root draws the box the step would have found (`license_plate`
11215
+ * for plate-detection, `face` for face-detection). The box becomes a detail
11216
+ * child of the `parentMacro` detection that contains it — never a track.
11217
+ * - `mask`: the root's decode emits an instance mask with every detection (a
11218
+ * YOLO26-seg root, D737) — the `segmentation` step's result, carried on the
11219
+ * detection in the shape that step produces. Derived from the model's
11220
+ * postprocessor on read, never stored by an import.
11221
+ */
11222
+ var RootStepSupplySchema = discriminatedUnion("kind", [
11223
+ object({
11224
+ kind: literal("label"),
11225
+ stepId: _enum(LABEL_SUPPLY_STEP_IDS),
11226
+ labelToEffect: record(string(), string()),
11227
+ uncovered: array(string()).readonly()
11228
+ }),
11229
+ object({
11230
+ kind: literal("crop"),
11231
+ stepId: _enum(CROP_SUPPLY_STEP_IDS),
11232
+ rootLabels: array(string()).readonly(),
11233
+ parentMacro: _enum(["vehicle", "person"]),
11234
+ childClass: _enum(["plate", "face"]),
11235
+ /**
11236
+ * The root's smaller input side, stamped on read by `rootSuppliesOf` from
11237
+ * the model entry — what a step's `minRootInputPx` gate judges. Never
11238
+ * stored by an import.
11239
+ */
11240
+ rootInputPx: number().int().positive().optional()
11241
+ }),
11242
+ object({
11243
+ kind: literal("mask"),
11244
+ stepId: _enum(MASK_SUPPLY_STEP_IDS)
11245
+ })
11246
+ ]);
10620
11247
  var ModelCatalogEntrySchema = object({
10621
11248
  id: string(),
10622
11249
  name: string(),
@@ -10682,6 +11309,35 @@ var ModelCatalogEntrySchema = object({
10682
11309
  */
10683
11310
  defaultConfidence: number().min(0).max(1).optional(),
10684
11311
  /**
11312
+ * Per-MODEL default of the per-class confidence floors (`minConfidence<Macro>`
11313
+ * on a detector step), keyed by macro class: `{ person: 0.45 }`. A class
11314
+ * absent here runs at the step slider's global default. The same row shape
11315
+ * the floor measurement produces (`model-floors.json`: modelId → floors), so
11316
+ * a measured table is copied in as-is. An operator override is bound to the
11317
+ * model it was made for and does not survive a model change (D738). A custom
11318
+ * / imported model may declare it; without it, the global defaults apply.
11319
+ */
11320
+ defaultClassFloors: record(string(), number().min(0).max(1)).optional(),
11321
+ /**
11322
+ * The inference precision this model's OpenVINO IR needs on an Intel GPU.
11323
+ * Absent ⇒ the device default (f16 on a GPU). Set to `'f32'` for an FP32 IR
11324
+ * that produces invalid output at f16 — measured 2026-10-07 for YOLO26
11325
+ * base IRs (`yolo26s`: 0 true / 146 false positives; `yolo26m*`: NaN
11326
+ * scores) on the Core Ultra iGPU and the N100. Threaded to the pool as
11327
+ * `PoolModelConfig.gpuInferencePrecision`; the pool sets
11328
+ * INFERENCE_PRECISION_HINT on a GPU only. Costs ~60% latency on the GPU.
11329
+ */
11330
+ gpuInferencePrecision: _enum(["f32", "f16"]).optional(),
11331
+ /**
11332
+ * ROOT detectors only: per supplied step (`animal-classifier`, …), the
11333
+ * minimum DETECTION score from which this root's own fine label (species,
11334
+ * vehicle type — D736 root supply) is taken (D741). Below it the detection
11335
+ * keeps its macro class without the fine label. `1` = never take it from
11336
+ * this root. Absent ⇒ no floor beyond the macro floor. The supplied step's
11337
+ * `minConfidence` slider, bound to the ROOT model, overrides it.
11338
+ */
11339
+ suppliedLabelFloors: record(string(), number().min(0).max(1)).optional(),
11340
+ /**
10685
11341
  * When true, the executor produces a landmark-aligned crop (similarity warp
10686
11342
  * onto the canonical template) before this step runs, instead of a plain
10687
11343
  * axis-aligned bbox crop. Required for face-recognition embedders (ArcFace):
@@ -10743,6 +11399,16 @@ var ModelCatalogEntrySchema = object({
10743
11399
  */
10744
11400
  classMap: DetectionCatalogClassMapSchema.optional(),
10745
11401
  /**
11402
+ * The pipeline steps this ROOT detector can supply from its own output
11403
+ * (D730): its labels name a step's effect (`deer` for `animal-classifier`)
11404
+ * or draw a step's box (`license_plate` for `plate-detection`). Computed at
11405
+ * import from THIS model's labelmap by `deriveRootSupplies`, never written
11406
+ * by hand and never assumed per family; a row without it is derived on read
11407
+ * (`rootSuppliesOf`). Whether a camera uses it is the step's own
11408
+ * `useRootModel` flag (`resolveRootSupply`).
11409
+ */
11410
+ suppliesSteps: array(RootStepSupplySchema).readonly().optional(),
11411
+ /**
10746
11412
  * The model's CLIP feature-space contract (text encoder, dimension, vector
10747
11413
  * index, token window, search floor) — see `clip-model.ts`. Present ONLY on a
10748
11414
  * CLIP image encoder; its absence is what "not a CLIP model" means to the
@@ -12344,13 +13010,6 @@ var BrokerRtspClientSchema = object({
12344
13010
  lastRtpAt: number(),
12345
13011
  bytesSent: number()
12346
13012
  });
12347
- var BrokerDecodedClientSchema = object({
12348
- tag: string(),
12349
- subscribedAt: number(),
12350
- maxFps: number(),
12351
- framesDelivered: number(),
12352
- framesDropped: number()
12353
- });
12354
13013
  var BrokerAudioClientSchema = object({
12355
13014
  tag: string(),
12356
13015
  subscribedAt: number(),
@@ -12442,7 +13101,6 @@ var BrokerEncodedClientSchema = object({
12442
13101
  });
12443
13102
  var BrokerClientsSchema = object({
12444
13103
  rtsp: array(BrokerRtspClientSchema).readonly(),
12445
- decoded: array(BrokerDecodedClientSchema).readonly(),
12446
13104
  audio: array(BrokerAudioClientSchema).readonly(),
12447
13105
  encoded: array(BrokerEncodedClientSchema).readonly(),
12448
13106
  pipeClients: number(),
@@ -12811,11 +13469,7 @@ method(object({
12811
13469
  auth: "admin"
12812
13470
  }), method(object({ brokerId: string() }), BrokerClientsSchema), method(object({
12813
13471
  brokerId: string(),
12814
- channel: _enum([
12815
- "rtsp",
12816
- "decoded",
12817
- "audio"
12818
- ]),
13472
+ channel: _enum(["rtsp", "audio"]),
12819
13473
  handle: string()
12820
13474
  }), object({ killed: boolean() }), {
12821
13475
  kind: "mutation",
@@ -12850,10 +13504,7 @@ method(object({
12850
13504
  }), method(SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, { kind: "mutation" }), method(object({
12851
13505
  subscriptionId: string(),
12852
13506
  maxCount: number().int().positive().default(8)
12853
- }), array(DecodedAudioChunkSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(SubscribeFramesInputSchema, SubscribeFramesResultSchema, { kind: "mutation" }), method(object({
12854
- subscriptionId: string(),
12855
- maxCount: number().int().positive().default(4)
12856
- }), array(FrameHandleSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(object({
13507
+ }), array(DecodedAudioChunkSchema).readonly()), method(object({ subscriptionId: string() }), object({ released: boolean() }), { kind: "mutation" }), method(object({
12857
13508
  brokerId: string(),
12858
13509
  seconds: number().min(0).max(30)
12859
13510
  }), _void(), {
@@ -14011,53 +14662,201 @@ id: union([string(), number()]) }), {
14011
14662
  auth: "admin"
14012
14663
  });
14013
14664
  /**
14014
- * shm ring usage stats for a `frameSink: 'shm'` decoder session —
14015
- * exposed via `decoder.getShmStats` so downstream consumers can
14016
- * observe ring pressure (slot count, byte budget, hit/miss ratio).
14665
+ * `keychain` — the hub's encrypted store of secret values (D787).
14666
+ *
14667
+ * Settings blobs never hold a secret: they hold a marker
14668
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
14669
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
14670
+ * is the OWNER's door to its own values: every method is owner-checked
14671
+ * against the CALLER, never against anything the caller claims.
14672
+ *
14673
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
14674
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
14675
+ * connection, the agent from its child's connection carried in
14676
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
14677
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
14678
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
14679
+ * identity against BUGS and misrouting, not against a malicious addon (every
14680
+ * runner is the same OS user): see the threat model in
14681
+ * `docs/design/2026-10-08-secrets-keychain.md`.
14682
+ *
14683
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
14684
+ * parses the input, so a session can never supply it, and the internal mount
14685
+ * floors every method to admin anyway (D240).
14686
+ *
14687
+ * Internal: addons reach it through `ctx.secrets`, never directly.
14017
14688
  */
14018
- var ShmRingStatsSchema = object({
14019
- sessionId: string(),
14020
- slotCount: number().int(),
14021
- slotByteLength: number().int(),
14022
- segmentBytes: number().int(),
14023
- budgetMb: number().int(),
14024
- framesWritten: number().int(),
14025
- getFrameHits: number().int(),
14026
- getFrameMisses: number().int()
14027
- });
14028
- method(object({ codec: string() }), boolean()), method(_void(), object({
14689
+ /** Why a value cannot be served right now. Never folded into "missing". */
14690
+ var KeychainUnavailableReasonSchema = _enum([
14691
+ "key-missing",
14692
+ "wrong-key",
14693
+ "key-file-unreadable",
14694
+ "store-unavailable",
14695
+ "not-initialized",
14696
+ "decrypt-failed"
14697
+ ]);
14698
+ var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
14699
+ state: literal("locked"),
14700
+ reason: KeychainUnavailableReasonSchema
14701
+ })]);
14702
+ var KeychainResolveEntrySchema = discriminatedUnion("kind", [
14703
+ object({
14704
+ kind: literal("value"),
14705
+ value: string(),
14706
+ version: number().int()
14707
+ }),
14708
+ object({ kind: literal("missing") }),
14709
+ object({
14710
+ kind: literal("unavailable"),
14711
+ reason: KeychainUnavailableReasonSchema
14712
+ }),
14713
+ object({ kind: literal("forbidden") })
14714
+ ]);
14715
+ var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
14716
+ /** Metadata of one stored value — never the value. */
14717
+ var KeychainSecretMetaSchema = object({
14718
+ ref: string(),
14719
+ owner: string(),
14720
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
14721
+ scope: string(),
14722
+ fieldPath: string(),
14723
+ version: number().int(),
14724
+ createdAt: number(),
14725
+ updatedAt: number(),
14726
+ /** `addon:<id>` | `user:<id>` | `system`. */
14727
+ updatedBy: string(),
14728
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
14729
+ lastReadAt: number().nullable()
14730
+ });
14731
+ var RefListSchema = array(string().min(1)).max(512);
14732
+ method(object({
14733
+ ref: string().min(1),
14734
+ value: string().min(1)
14735
+ }), object({
14736
+ ref: string(),
14737
+ version: number().int()
14738
+ }), {
14739
+ kind: "mutation",
14740
+ auth: "admin"
14741
+ }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
14742
+ kind: "mutation",
14743
+ auth: "admin"
14744
+ }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
14745
+ var KeychainKeySourceSchema = object({
14746
+ kind: _enum([
14747
+ "config-file",
14748
+ "previous-config-file",
14749
+ "platform",
14750
+ "default-file"
14751
+ ]),
14752
+ /** File sources only — a path is not a secret. */
14753
+ path: string().optional(),
14754
+ /**
14755
+ * True when a whole-volume backup of the data directory carries this key
14756
+ * next to the database it protects (the default file). The page warns.
14757
+ */
14758
+ sharesBackupWithDatabase: boolean()
14759
+ });
14760
+ var KeychainStatusSchema = object({
14761
+ keychain: KeychainStateSchema,
14762
+ /** The source of the master key in use; `null` while locked. */
14763
+ keySource: KeychainKeySourceSchema.nullable(),
14764
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
14765
+ configuredSource: KeychainKeySourceSchema,
14766
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
14767
+ fingerprint: string().nullable(),
14768
+ activeKeyId: string().nullable(),
14769
+ /**
14770
+ * The keychain unlocked with a NON-primary source: the configured primary
14771
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
14772
+ */
14773
+ rotationPending: boolean(),
14774
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
14775
+ retiredWraps: number().int(),
14776
+ recoveryKeyDownloadedAt: number().nullable(),
14777
+ secretCount: number().int()
14778
+ });
14779
+ /**
14780
+ * Whether a stored value is still pointed at by its owner's settings.
14781
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
14782
+ * never reported as an orphan (and never deleted as one).
14783
+ */
14784
+ var KeychainSecretUsageSchema = _enum([
14785
+ "in-use",
14786
+ "orphan",
14787
+ "unknown"
14788
+ ]);
14789
+ var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
14790
+ var KeychainAuditActionSchema = _enum([
14791
+ "put",
14792
+ "delete",
14793
+ "reveal",
14794
+ "rotate-master-key",
14795
+ "purge-retired-keys",
14796
+ "download-recovery-key",
14797
+ "delete-orphans",
14798
+ "reset",
14799
+ "initialize"
14800
+ ]);
14801
+ var KeychainAuditEntrySchema = object({
14802
+ id: string(),
14803
+ at: number(),
14804
+ action: KeychainAuditActionSchema,
14805
+ /** `addon:<id>` | `user:<id>` | `system`. */
14806
+ actor: string(),
14807
+ ref: string().nullable(),
14808
+ detail: string().nullable()
14809
+ });
14810
+ 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({
14811
+ value: string(),
14812
+ version: number().int()
14813
+ }), {
14814
+ kind: "mutation",
14815
+ auth: "admin",
14816
+ caller: "required"
14817
+ }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
14818
+ deleted: array(string()).readonly(),
14819
+ kept: array(object({
14820
+ ref: string(),
14821
+ usage: KeychainSecretUsageSchema
14822
+ })).readonly()
14823
+ }), {
14824
+ kind: "mutation",
14825
+ auth: "admin",
14826
+ caller: "required"
14827
+ }), method(object({}), object({
14828
+ fingerprint: string(),
14829
+ keySource: KeychainKeySourceSchema
14830
+ }), {
14831
+ kind: "mutation",
14832
+ auth: "admin",
14833
+ caller: "required"
14834
+ }), method(object({}), object({ purged: number().int() }), {
14835
+ kind: "mutation",
14836
+ auth: "admin",
14837
+ caller: "required"
14838
+ }), method(object({}), object({
14839
+ key: string(),
14840
+ fingerprint: string(),
14841
+ keySource: KeychainKeySourceSchema
14842
+ }), {
14843
+ kind: "mutation",
14844
+ auth: "admin",
14845
+ caller: "required"
14846
+ }), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
14847
+ archivedCollection: string().nullable(),
14848
+ archived: number().int()
14849
+ }), {
14850
+ kind: "mutation",
14851
+ auth: "admin",
14852
+ caller: "required"
14853
+ });
14854
+ method(_void(), object({
14029
14855
  id: string(),
14030
14856
  name: string(),
14031
- isPullMode: boolean().optional(),
14032
- priority: number().optional(),
14033
14857
  hwaccel: string().optional(),
14034
14858
  probedBestHwaccel: string().optional()
14035
- })), method(DecoderSessionConfigSchema, object({
14036
- sessionId: string(),
14037
- nodeId: string()
14038
- })), method(object({ sessionId: string() }), _void()), method(object({
14039
- sessionId: string(),
14040
- packet: EncodedPacketSchema
14041
- }), _void()), method(object({
14042
- sessionId: string(),
14043
- url: string()
14044
- }), _void()), method(object({
14045
- sessionId: string(),
14046
- maxCount: number().default(1),
14047
- waitMs: number().optional()
14048
- }), array(DecodedFrameSchema)), method(object({
14049
- sessionId: string(),
14050
- maxCount: number().default(1),
14051
- waitMs: number().optional()
14052
- }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
14053
- sessionId: string(),
14054
- config: DecoderSessionConfigSchema.partial()
14055
- }), _void()), method(object({ sessionId: string() }), DecoderStatsSchema), method(_void(), array(object({
14056
- sessionId: string(),
14057
- codec: string(),
14058
- outputFormat: string(),
14059
- createdAtMs: number()
14060
- })).readonly()), method(_void(), object({ backend: string() }), {
14859
+ })), method(_void(), object({ backend: string() }), {
14061
14860
  kind: "mutation",
14062
14861
  auth: "admin"
14063
14862
  });
@@ -14869,6 +15668,10 @@ var DeviceInfoSchema = object({
14869
15668
  isCamera: boolean(),
14870
15669
  /** Current config values — serializable snapshot */
14871
15670
  config: record(string(), unknown()),
15671
+ /** Paths inside `config` the device's schema declares secret (D783) —
15672
+ * what the non-admin redaction withholds. Paths, never values. Absent
15673
+ * when the owning runner has not reported them. */
15674
+ secretConfigPaths: array(string()).optional(),
14872
15675
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
14873
15676
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
14874
15677
  metadata: record(string(), unknown()).nullable().optional(),
@@ -15074,12 +15877,22 @@ var DeviceRegisterPayloadSchema = object({
15074
15877
  * call (workers re-register on init), so probe-driven updates
15075
15878
  * (e.g. PTZ flag flipping after the abilities probe) propagate. */
15076
15879
  features: array(string()).optional(),
15077
- config: record(string(), unknown())
15880
+ config: record(string(), unknown()),
15881
+ /** Config paths the device's own schema DECLARES secret
15882
+ * (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
15883
+ * `connection.password`). Re-published on every register; the non-admin
15884
+ * redaction withholds them at any depth (D783). Optional: an older runner
15885
+ * omits it and the keyword backstop applies. */
15886
+ secretConfigPaths: array(string()).optional()
15078
15887
  });
15079
15888
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
15080
15889
  var DevicePersistConfigPayloadSchema = object({
15081
15890
  deviceId: number(),
15082
- data: record(string(), unknown())
15891
+ data: record(string(), unknown()),
15892
+ /** The paths the device's schema declares secret (D783), when the caller
15893
+ * knows them — those values are kept in the keychain, not the blob (D787).
15894
+ * Absent: the paths the device last reported at `registerDevice` apply. */
15895
+ secretConfigPaths: array(string()).optional()
15083
15896
  });
15084
15897
  /** What a migration actually did, per switch. `unreachable` is a first-class
15085
15898
  * answer: a camera that could not be asked is not a camera that was silenced. */
@@ -15901,6 +16714,12 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
15901
16714
  kind: "mutation",
15902
16715
  auth: "admin"
15903
16716
  });
16717
+ var HUB_ADDRESS_ROLES = [
16718
+ "appConnections",
16719
+ "notificationTaps",
16720
+ "internal",
16721
+ "publicEndpoint"
16722
+ ];
15904
16723
  /**
15905
16724
  * Transport bounds for AI capability methods.
15906
16725
  *
@@ -16727,7 +17546,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
16727
17546
  icon: string().optional(),
16728
17547
  /** Addon-owned HTTP route the button navigates to (GET). */
16729
17548
  startUrl: string(),
16730
- stage: LoginStageEnum
17549
+ stage: LoginStageEnum,
17550
+ /**
17551
+ * The provider names an external identity a signed-in user can link to
17552
+ * their own account (D782): `auth.listLinkableProviders` /
17553
+ * `beginExternalLink` offer exactly the redirect methods that set this,
17554
+ * whatever their id. Absent / false — a login button only (magic-link).
17555
+ */
17556
+ linkable: boolean().optional()
16731
17557
  }),
16732
17558
  object({
16733
17559
  kind: literal("widget"),
@@ -18482,6 +19308,8 @@ var NcSystemEventKindSchema = _enum([
18482
19308
  "stream-offline",
18483
19309
  "node-online",
18484
19310
  "node-offline",
19311
+ "node-restarting",
19312
+ "node-updating",
18485
19313
  "node-inference-unavailable",
18486
19314
  "detection-blind",
18487
19315
  "addon-crash-loop",
@@ -20087,7 +20915,13 @@ var NcAlarmModeDelaysListSchema = array(object({
20087
20915
  * Absent = false (logged, not sent). Even when true it is not sent when that same sensor
20088
20916
  * is the one that starts the entry delay — the entry-delay notification already names it.
20089
20917
  */
20090
- notifySensorRewatched: boolean().optional()
20918
+ notifySensorRewatched: boolean().optional(),
20919
+ /**
20920
+ * D735: notify "ignored" when a sensor this arm bypassed really MOVED while armed (its own
20921
+ * change time is after the arm) and set nothing off. Absent = false (logged, not sent). A
20922
+ * re-sync, a recovery from `unavailable` or a duplicate is never announced, switch or not.
20923
+ */
20924
+ notifySensorIgnored: boolean().optional()
20091
20925
  })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
20092
20926
  var NcAlarmModeDelaysEditListSchema = array(object({
20093
20927
  mode: AlarmArmModeSchema,
@@ -20100,7 +20934,9 @@ var NcAlarmModeDelaysEditListSchema = array(object({
20100
20934
  /** D706: set the switch, or `null` to clear it (back to the default, false). */
20101
20935
  notifyDuringEntryDelay: boolean().nullable().optional(),
20102
20936
  /** D706: set the switch, or `null` to clear it (back to the default, false). */
20103
- notifySensorRewatched: boolean().nullable().optional()
20937
+ notifySensorRewatched: boolean().nullable().optional(),
20938
+ /** D735: set the switch, or `null` to clear it (back to the default, false). */
20939
+ notifySensorIgnored: boolean().nullable().optional()
20104
20940
  })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
20105
20941
  /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
20106
20942
  var NcAlarmNonBlockingEditSchema = object({
@@ -21078,8 +21914,8 @@ Object.freeze(Object.fromEntries([{
21078
21914
  var CLUSTER_STEP_SETTING_FIELDS = [{
21079
21915
  stepId: "face-embedding",
21080
21916
  key: "minLandmarkFaceSize",
21081
- label: "Min face size for recognition (detection px)",
21082
- 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.",
21917
+ label: "Min face size to embed (detection-frame px)",
21918
+ 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.",
21083
21919
  type: "slider",
21084
21920
  min: 0,
21085
21921
  max: 64,
@@ -22052,8 +22888,23 @@ var RetrainMacroClassSchema = _enum([
22052
22888
  ]);
22053
22889
  /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
22054
22890
  var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
22055
- /** Did a human draw this box, or did the assist propose it? */
22056
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
22891
+ /**
22892
+ * Where a box came from. A machine-sourced box is a DRAFT on the page until
22893
+ * the operator confirms it; once saved it keeps its source as provenance.
22894
+ *
22895
+ * - `operator` — drawn by hand.
22896
+ * - `assist` — proposed by a detector run on the copy (the camera's own
22897
+ * model, or a larger teacher model).
22898
+ * - `pipeline` — the box the live pipeline actually drew on that frame, read
22899
+ * back from the track store (never a re-run).
22900
+ * - `llm` — proposed by a vision-capable LLM profile.
22901
+ */
22902
+ var RetrainAnnotationSourceSchema = _enum([
22903
+ "operator",
22904
+ "assist",
22905
+ "pipeline",
22906
+ "llm"
22907
+ ]);
22057
22908
  /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
22058
22909
  var RetrainBboxSchema = object({
22059
22910
  x: number(),
@@ -22071,7 +22922,8 @@ var RetrainBboxSchema = object({
22071
22922
  */
22072
22923
  var RetrainAnnotationSchema = object({
22073
22924
  id: string(),
22074
- trackId: string(),
22925
+ /** The frame's track. Absent on a recording still, which has none. */
22926
+ trackId: string().optional(),
22075
22927
  deviceId: number(),
22076
22928
  /** The COPY in retrain storage — never the source track's media key. */
22077
22929
  mediaKey: string(),
@@ -22120,18 +22972,63 @@ var RetrainFrameCandidateSchema = object({
22120
22972
  * fail, whatever became of the original. */
22121
22973
  copied: boolean()
22122
22974
  });
22975
+ /**
22976
+ * One box the live pipeline drew on a copied frame — what a correction starts
22977
+ * from. Derived when the frame is listed, from the track store: the subject
22978
+ * box recorded on the source media row when there is one, else the track
22979
+ * position nearest the frame's capture time. Never stored as an annotation
22980
+ * until the operator confirms it.
22981
+ */
22982
+ var RetrainPipelineBoxSchema = object({
22983
+ /** Normalised `[0,1]` against the full frame. */
22984
+ bbox: RetrainBboxSchema,
22985
+ macroClass: RetrainMacroClassSchema,
22986
+ label: string().optional(),
22987
+ subLabel: string().optional(),
22988
+ /** The detection score of the position used, when it was recorded. */
22989
+ score: number().optional(),
22990
+ /** The root model that produced the track, when it was recorded. */
22991
+ modelId: string().optional(),
22992
+ trackId: string(),
22993
+ /** `subject-box`: recorded on this very frame. `position`: the track's
22994
+ * position nearest the capture time, `deltaMs` away. */
22995
+ basis: _enum(["subject-box", "position"]),
22996
+ deltaMs: number()
22997
+ });
22998
+ /**
22999
+ * Where a retrain frame came from: a TRACK's stored media (copy-on-select),
23000
+ * or the RECORDING at an instant — the frame a model saw nothing in has no
23001
+ * track at all.
23002
+ */
23003
+ var RetrainFrameOriginSchema = _enum(["track", "recording"]);
22123
23004
  /** A frame the dataset OWNS: bytes copied at selection time. */
22124
23005
  var RetrainFrameSchema = object({
22125
23006
  frameId: string(),
22126
23007
  deviceId: number(),
22127
- trackId: string(),
22128
- /** Provenance only. It may already point at nothing — that is expected. */
22129
- sourceMediaId: number().int(),
23008
+ origin: RetrainFrameOriginSchema,
23009
+ /** The track it was copied from. Absent on a recording still. */
23010
+ trackId: string().optional(),
23011
+ /** Provenance only. It may already point at nothing — that is expected.
23012
+ * Absent on a recording still. */
23013
+ sourceMediaId: number().int().optional(),
23014
+ /** A recording still: the playhead instant it was taken at. */
23015
+ epochMs: number().optional(),
22130
23016
  sourceKind: MediaFileKindEnum,
22131
23017
  sizeBytes: number().int(),
22132
23018
  width: number().int(),
22133
23019
  height: number().int(),
22134
- copiedAt: number()
23020
+ copiedAt: number(),
23021
+ /** When the CAMERA captured the frame. Absent on a copy taken before D785. */
23022
+ capturedAt: number().optional(),
23023
+ /** The operator's "every subject in this frame is boxed". Detector
23024
+ * evaluation keeps only complete frames: an unboxed subject would count as
23025
+ * a false positive. */
23026
+ complete: boolean(),
23027
+ /** The boxes the pipeline drew on this frame. Present on list answers;
23028
+ * empty when nothing the track store holds can be placed on it. */
23029
+ pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
23030
+ /** The named collections this frame belongs to. Present on list answers. */
23031
+ collectionIds: array(string()).readonly().optional()
22135
23032
  });
22136
23033
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
22137
23034
  var RetrainCopyRefusalSchema = _enum([
@@ -22152,6 +23049,53 @@ var RetrainFrameListSchema = object({
22152
23049
  /** What the page pre-selects — the native key frame when one survives. */
22153
23050
  autoPickMediaId: number().int().optional()
22154
23051
  });
23052
+ /**
23053
+ * Which frames an annotated export carries. Every field narrows; an empty
23054
+ * filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
23055
+ * list owned by whoever trains (the training orchestrator), so `frameIds` is
23056
+ * the primitive a version export uses; `batchId` re-selects what an earlier
23057
+ * export carried (`exportedInBatch`).
23058
+ */
23059
+ var RetrainExportFilterSchema = object({
23060
+ deviceIds: array(number()).optional(),
23061
+ frameIds: array(string()).max(2e4).optional(),
23062
+ /** Only frames in at least one of these named collections. */
23063
+ collectionIds: array(string()).max(200).optional(),
23064
+ batchId: string().optional(),
23065
+ /** Only frames the operator marked complete (all subjects boxed). */
23066
+ completeOnly: boolean().optional()
23067
+ });
23068
+ /**
23069
+ * `frames`: the full frame copies, boxes in `annotations.json`.
23070
+ * `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
23071
+ * convention — the classifier layout.
23072
+ */
23073
+ var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
23074
+ /**
23075
+ * Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
23076
+ * the archive, sent chunk by chunk. Covers a presigned PUT and a provider
23077
+ * addon's data-plane upload route alike. Headers are sent verbatim and never
23078
+ * logged.
23079
+ */
23080
+ var RetrainArchiveTargetSchema = object({
23081
+ kind: literal("http"),
23082
+ method: _enum(["PUT", "POST"]),
23083
+ url: string().url(),
23084
+ headers: record(string(), string()).optional()
23085
+ });
23086
+ var RetrainArchiveResultSchema = object({
23087
+ batchId: string(),
23088
+ frames: number().int(),
23089
+ crops: number().int(),
23090
+ annotations: number().int(),
23091
+ /** Frames planned but not shipped (unreadable copy, path too long). */
23092
+ missing: number().int(),
23093
+ bytes: number().int(),
23094
+ /** sha256 of the exact bytes sent. */
23095
+ sha256: string(),
23096
+ /** The target's HTTP status. */
23097
+ status: number().int()
23098
+ });
22155
23099
  /** What the operator asked the assist to look for. */
22156
23100
  var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
22157
23101
  kind: literal("package"),
@@ -22181,6 +23125,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
22181
23125
  reason: string(),
22182
23126
  detail: string().optional()
22183
23127
  })]);
23128
+ /** A named set over the retrain corpus — membership only, it owns no pixels. */
23129
+ var RetrainCollectionSchema = object({
23130
+ id: string(),
23131
+ name: string(),
23132
+ createdAt: number(),
23133
+ frameCount: number().int()
23134
+ });
23135
+ var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
23136
+ kind: literal("created"),
23137
+ collection: RetrainCollectionSchema
23138
+ }), object({
23139
+ kind: literal("refused"),
23140
+ reason: _enum(["empty-name", "duplicate-name"])
23141
+ })]);
23142
+ var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
23143
+ kind: literal("renamed"),
23144
+ collection: RetrainCollectionSchema
23145
+ }), object({
23146
+ kind: literal("refused"),
23147
+ reason: _enum([
23148
+ "empty-name",
23149
+ "duplicate-name",
23150
+ "unknown-collection"
23151
+ ])
23152
+ })]);
23153
+ /**
23154
+ * The outcome of adding the frame at a recording instant. Every refusal is
23155
+ * named: `still-unavailable` (not recording, a gap, or an undecodable frame —
23156
+ * `detail` says which), `still-busy` (the recorder is at its decode bound; try
23157
+ * again), `unreadable-image`, `write-failed`, `unknown-collection`.
23158
+ */
23159
+ var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
23160
+ kind: literal("added"),
23161
+ collectionId: string(),
23162
+ frame: RetrainFrameSchema,
23163
+ /** The moment was already in the dataset; nothing was decoded. */
23164
+ reused: boolean()
23165
+ }), object({
23166
+ kind: literal("refused"),
23167
+ reason: _enum([
23168
+ "unknown-collection",
23169
+ "still-unavailable",
23170
+ "still-busy",
23171
+ "unreadable-image",
23172
+ "write-failed"
23173
+ ]),
23174
+ detail: string().optional()
23175
+ })]);
23176
+ /** A vision LLM profile the AI assist may use, and where it sends the frame. */
23177
+ var RetrainAssistProfileSchema = object({
23178
+ id: string(),
23179
+ name: string(),
23180
+ model: string(),
23181
+ kind: string(),
23182
+ /** `true` when the frame would leave the house (a cloud vendor, or an
23183
+ * endpoint that is not on the local network). The page confirms each such
23184
+ * run, and the provider refuses one without `allowCloud`. */
23185
+ leavesHouse: boolean()
23186
+ });
23187
+ /** A box the AI assist proposed: a draft, plus the model's own reason. */
23188
+ var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
23189
+ /** What the AI assist said about a box that was already on the canvas. */
23190
+ var RetrainLlmReviewSchema = object({
23191
+ /** The `ref` the page sent the box under. */
23192
+ ref: string(),
23193
+ verdict: _enum([
23194
+ "confirmed",
23195
+ "wrong-class",
23196
+ "not-an-object",
23197
+ "uncertain"
23198
+ ]),
23199
+ suggestedClass: RetrainMacroClassSchema.optional(),
23200
+ reason: string()
23201
+ });
23202
+ /**
23203
+ * The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
23204
+ * model and its confidence) and reviews; items the model got wrong (a box off
23205
+ * the frame, an unasked class, an unknown ref) are dropped and counted in
23206
+ * `rejected`. A whole answer that is not the schema is `malformed-answer`.
23207
+ */
23208
+ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
23209
+ kind: literal("proposed"),
23210
+ profileId: string(),
23211
+ model: string(),
23212
+ /** The frame was sent outside the house for this answer. */
23213
+ leftHouse: boolean(),
23214
+ proposals: array(RetrainLlmProposalSchema).readonly(),
23215
+ reviews: array(RetrainLlmReviewSchema).readonly(),
23216
+ rejected: number().int()
23217
+ }), object({
23218
+ kind: literal("refused"),
23219
+ reason: _enum([
23220
+ "unknown-frame",
23221
+ "unreadable-frame",
23222
+ "unknown-profile",
23223
+ "profile-disabled",
23224
+ "no-vision",
23225
+ "cloud-not-confirmed",
23226
+ "llm-error",
23227
+ "malformed-answer"
23228
+ ]),
23229
+ detail: string().optional()
23230
+ })]);
22184
23231
  /** The outcome of a lifecycle move owned by the retrain page. */
22185
23232
  var RetrainTransitionResultSchema = object({
22186
23233
  trackId: string(),
@@ -22898,7 +23945,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22898
23945
  auth: "admin"
22899
23946
  }), method(object({
22900
23947
  deviceId: number(),
22901
- trackId: string(),
23948
+ trackId: string().optional(),
22902
23949
  frameId: string()
22903
23950
  }), object({
22904
23951
  removed: boolean(),
@@ -22915,7 +23962,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22915
23962
  auth: "admin"
22916
23963
  }), method(object({
22917
23964
  deviceId: number(),
22918
- trackId: string(),
23965
+ /** The frame's track, when it has one — checked against the frame. */
23966
+ trackId: string().optional(),
22919
23967
  frameId: string(),
22920
23968
  subject: RetrainAssistSubjectSchema,
22921
23969
  /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
@@ -22923,12 +23971,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22923
23971
  }), RetrainAssistResultSchema, {
22924
23972
  kind: "mutation",
22925
23973
  auth: "admin"
22926
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
23974
+ }), method(object({
23975
+ trackId: string().optional(),
23976
+ frameIds: array(string()).max(2e3).optional()
23977
+ }), array(RetrainAnnotationSchema).readonly(), {
22927
23978
  kind: "query",
22928
23979
  auth: "admin"
22929
23980
  }), method(object({
22930
23981
  deviceId: number(),
22931
- trackId: string(),
23982
+ /** The frame's track, when it has one — checked against the frame. */
23983
+ trackId: string().optional(),
22932
23984
  frameId: string(),
22933
23985
  annotations: array(RetrainAnnotationDraftSchema)
22934
23986
  }), array(RetrainAnnotationSchema).readonly(), {
@@ -22946,7 +23998,91 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22946
23998
  }), RetrainTransitionResultSchema, {
22947
23999
  kind: "mutation",
22948
24000
  auth: "admin"
22949
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
24001
+ }), method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string() }), {
24002
+ kind: "query",
24003
+ auth: "admin"
24004
+ }), method(object({
24005
+ deviceId: number(),
24006
+ trackId: string().optional(),
24007
+ frameId: string(),
24008
+ complete: boolean()
24009
+ }), RetrainFrameSchema, {
24010
+ kind: "mutation",
24011
+ auth: "admin"
24012
+ }), method(object({
24013
+ filter: RetrainExportFilterSchema,
24014
+ layout: RetrainExportLayoutSchema,
24015
+ target: RetrainArchiveTargetSchema
24016
+ }), RetrainArchiveResultSchema, {
24017
+ kind: "mutation",
24018
+ auth: "admin",
24019
+ timeoutMs: 60 * 6e4
24020
+ }), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
24021
+ kind: "query",
24022
+ auth: "admin"
24023
+ }), method(object({
24024
+ deviceId: number(),
24025
+ trackId: string().optional(),
24026
+ frameId: string(),
24027
+ profileId: string(),
24028
+ classes: array(RetrainMacroClassSchema).min(1),
24029
+ boxes: array(object({
24030
+ ref: string(),
24031
+ bbox: RetrainBboxSchema,
24032
+ macroClass: RetrainMacroClassSchema,
24033
+ label: string().optional()
24034
+ })).max(50),
24035
+ allowCloud: boolean()
24036
+ }), RetrainLlmAssistResultSchema, {
24037
+ kind: "mutation",
24038
+ auth: "admin",
24039
+ timeoutMs: 18e4
24040
+ }), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
24041
+ kind: "mutation",
24042
+ auth: "admin"
24043
+ }), method(object({}), array(RetrainCollectionSchema).readonly(), {
24044
+ kind: "query",
24045
+ auth: "admin"
24046
+ }), method(object({
24047
+ id: string(),
24048
+ name: string().max(120)
24049
+ }), RetrainCollectionRenameResultSchema, {
24050
+ kind: "mutation",
24051
+ auth: "admin"
24052
+ }), method(object({ id: string() }), object({
24053
+ deleted: boolean(),
24054
+ removedFrames: number().int()
24055
+ }), {
24056
+ kind: "mutation",
24057
+ auth: "admin"
24058
+ }), method(object({
24059
+ collectionId: string(),
24060
+ deviceId: number(),
24061
+ epochMs: number()
24062
+ }), AddRetrainFrameFromRecordingResultSchema, {
24063
+ kind: "mutation",
24064
+ auth: "admin",
24065
+ timeoutMs: 6e4
24066
+ }), method(object({
24067
+ collectionId: string(),
24068
+ frameIds: array(string()).min(1).max(500)
24069
+ }), object({
24070
+ added: number().int(),
24071
+ alreadyMember: number().int(),
24072
+ unknownFrameIds: array(string()).readonly()
24073
+ }), {
24074
+ kind: "mutation",
24075
+ auth: "admin"
24076
+ }), method(object({
24077
+ collectionId: string(),
24078
+ frameId: string()
24079
+ }), object({
24080
+ removed: boolean(),
24081
+ deletedFrame: boolean()
24082
+ }), {
24083
+ kind: "mutation",
24084
+ auth: "admin"
24085
+ }), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
22950
24086
  kind: "query",
22951
24087
  auth: "admin"
22952
24088
  }), method(object({
@@ -22999,6 +24135,34 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22999
24135
  timestamp: number()
23000
24136
  });
23001
24137
  /**
24138
+ * A root model's boxes standing in for one crop-kind step's own inference
24139
+ * (D730) — see `runPipeline.suppliedRoot`.
24140
+ */
24141
+ var SuppliedRootOutputSchema = object({
24142
+ stepId: string(),
24143
+ /** The root model that drew the boxes — stamped on the result. */
24144
+ modelId: string(),
24145
+ detections: array(object({
24146
+ /** `[x1, y1, x2, y2]` in the pixels of the call's image. */
24147
+ bbox: tuple([
24148
+ number(),
24149
+ number(),
24150
+ number(),
24151
+ number()
24152
+ ]),
24153
+ score: number(),
24154
+ /**
24155
+ * Five facial landmarks in the same pixels — a face the step's own
24156
+ * detector already re-found inside a root face box (D730), so its
24157
+ * embedder child aligns it exactly as it aligns any detected face.
24158
+ */
24159
+ landmarks: array(object({
24160
+ x: number(),
24161
+ y: number()
24162
+ })).optional()
24163
+ })).min(1)
24164
+ });
24165
+ /**
23002
24166
  * Reference to the frame's retained NATIVE surface + the parent crop's placement
23003
24167
  * within the frame, so the executor can re-cut a leaf child ROI at native
23004
24168
  * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
@@ -23046,7 +24210,7 @@ var FrameRefSchema = object({
23046
24210
  timestamp: number(),
23047
24211
  capturedAt: number().optional()
23048
24212
  });
23049
- var ModelFormatSchema$1 = _enum([
24213
+ var ModelFormatSchema$2 = _enum([
23050
24214
  "onnx",
23051
24215
  "coreml",
23052
24216
  "openvino",
@@ -23064,7 +24228,7 @@ var PipelineSlotSchema = _enum([
23064
24228
  var PipelineEngineChoiceSchema = object({
23065
24229
  runtime: literal("python"),
23066
24230
  backend: string(),
23067
- format: ModelFormatSchema$1,
24231
+ format: ModelFormatSchema$2,
23068
24232
  device: string().optional()
23069
24233
  });
23070
24234
  /**
@@ -23103,32 +24267,15 @@ var PipelineDefaultStepSchema = lazy(() => object({
23103
24267
  group: string().optional(),
23104
24268
  settings: record(string(), unknown()).optional()
23105
24269
  }));
23106
- var PipelineTemplateStepSchema = lazy(() => object({
23107
- addonId: string(),
23108
- enabled: boolean(),
23109
- modelId: string(),
23110
- children: array(PipelineTemplateStepSchema).readonly(),
23111
- settings: record(string(), unknown()).optional()
23112
- }));
23113
- var PipelineTemplateSchema$1 = object({
23114
- id: string(),
23115
- name: string(),
23116
- createdAt: string(),
23117
- updatedAt: string(),
23118
- engine: PipelineEngineChoiceSchema,
23119
- steps: array(PipelineTemplateStepSchema).readonly()
23120
- });
23121
24270
  var PipelineModelOptionSchema = object({
23122
24271
  id: string(),
23123
24272
  name: string(),
23124
- formats: record(string(), object({
23125
- downloaded: boolean(),
23126
- sizeMB: number()
23127
- })),
24273
+ formats: record(string(), PipelineModelFormatStatusSchema),
23128
24274
  group: ModelVariantGroupSchema.optional(),
23129
24275
  legacy: boolean().optional(),
23130
24276
  provider: ModelProviderIdSchema.optional(),
23131
- defaultConfidence: number().optional()
24277
+ defaultConfidence: number().optional(),
24278
+ suppliesSteps: array(RootStepSupplySchema).readonly().optional()
23132
24279
  });
23133
24280
  var ConfigFieldBridge = custom();
23134
24281
  var PipelineAddonSchemaSchema = object({
@@ -23290,6 +24437,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
23290
24437
  }), {
23291
24438
  kind: "mutation",
23292
24439
  auth: "admin"
24440
+ }), method(object({
24441
+ nodeId: string(),
24442
+ deviceIds: array(number()).readonly().optional(),
24443
+ dryRun: boolean()
24444
+ }), object({
24445
+ entries: array(object({
24446
+ deviceId: number(),
24447
+ keys: array(string()).readonly()
24448
+ })).readonly(),
24449
+ refused: array(object({
24450
+ deviceId: number(),
24451
+ reason: string()
24452
+ })).readonly()
24453
+ }), {
24454
+ kind: "mutation",
24455
+ auth: "admin"
23293
24456
  }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
23294
24457
  /** `<backend>:<device>`, e.g. `openvino:gpu`. */
23295
24458
  deviceKey: string(),
@@ -23315,22 +24478,14 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
23315
24478
  }), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(object({
23316
24479
  steps: array(PipelineStepInputSchema),
23317
24480
  deviceKey: string().optional()
23318
- }), PipelineValidationResultSchema), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
23319
- name: string(),
23320
- steps: array(PipelineTemplateStepSchema).readonly(),
23321
- engine: PipelineEngineChoiceSchema
23322
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
23323
- id: string(),
23324
- name: string().optional(),
23325
- steps: array(PipelineTemplateStepSchema).readonly().optional()
23326
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
24481
+ }), PipelineValidationResultSchema), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
23327
24482
  addonId: string(),
23328
24483
  modelId: string(),
23329
- format: ModelFormatSchema$1
24484
+ format: ModelFormatSchema$2
23330
24485
  }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
23331
24486
  addonId: string(),
23332
24487
  modelId: string(),
23333
- format: ModelFormatSchema$1
24488
+ format: ModelFormatSchema$2
23334
24489
  }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
23335
24490
  steps: array(PipelineStepInputSchema).min(1),
23336
24491
  frame: FrameInputSchema.optional(),
@@ -23396,7 +24551,16 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
23396
24551
  * `device-not-servable`), and nothing reaches the camera's live
23397
24552
  * trace stream. Absent ⇒ unchanged behaviour.
23398
24553
  */
23399
- replay: literal(true).optional()
24554
+ replay: literal(true).optional(),
24555
+ /**
24556
+ * Root-supplied detections for the tree's ROOT step (D730). Set by
24557
+ * `runDetailSubtree` when the camera's root model supplies a crop-kind
24558
+ * step (a Frigate+ `license_plate` for `plate-detection`): the step is
24559
+ * NOT inferred, these boxes are its output, and its children (the plate
24560
+ * reader) run on them through their own crop policy. Boxes are in the
24561
+ * PIXELS of the image this call carries. Absent ⇒ the root step runs.
24562
+ */
24563
+ suppliedRoot: SuppliedRootOutputSchema.optional()
23400
24564
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
23401
24565
  steps: array(PipelineStepInputSchema).min(1),
23402
24566
  frames: array(FrameInputSchema).min(1).max(255),
@@ -23478,6 +24642,763 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
23478
24642
  filename: string().optional(),
23479
24643
  settings: record(string(), unknown()).optional()
23480
24644
  }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
24645
+ /**
24646
+ * The wire shapes of the Auto tune plan and apply (D745), used by the
24647
+ * `pipeline-orchestrator` cap. The recommender's own types
24648
+ * (`recommend.ts`) are the TS face of the same data; these
24649
+ * schemas are what crosses the cap boundary.
24650
+ */
24651
+ var ModelFormatSchema$1 = _enum(MODEL_FORMATS);
24652
+ /** The operator's range for it. */
24653
+ var MIN_SESSIONS_PER_DEVICE_RANGE = {
24654
+ min: 1,
24655
+ max: 8
24656
+ };
24657
+ var HardwareClassIdSchema = _enum([
24658
+ "intel-core-ultra",
24659
+ "intel-n-series",
24660
+ "apple-m-base",
24661
+ "apple-m-pro",
24662
+ "unknown"
24663
+ ]);
24664
+ var AcceleratorKindSchema = _enum([
24665
+ "intel-npu",
24666
+ "intel-igpu",
24667
+ "x86-cpu",
24668
+ "arm-cpu",
24669
+ "apple-ane",
24670
+ "coral"
24671
+ ]);
24672
+ var RecommendationReasonSchema = discriminatedUnion("kind", [
24673
+ object({
24674
+ kind: literal("capacity"),
24675
+ sessions: number(),
24676
+ minSessions: number()
24677
+ }),
24678
+ object({
24679
+ kind: literal("tie-faster"),
24680
+ over: string(),
24681
+ recallDelta: number()
24682
+ }),
24683
+ object({
24684
+ kind: literal("stepped-down"),
24685
+ from: string(),
24686
+ to: string(),
24687
+ limitedBy: string()
24688
+ }),
24689
+ object({
24690
+ kind: literal("no-fit-lightest"),
24691
+ sessions: number(),
24692
+ minSessions: number()
24693
+ }),
24694
+ object({
24695
+ kind: literal("derived-latency"),
24696
+ modelId: string()
24697
+ }),
24698
+ object({ kind: literal("cpu-device") }),
24699
+ object({ kind: literal("coral-untouched") }),
24700
+ object({ kind: literal("device-disabled") }),
24701
+ object({ kind: literal("device-unavailable") }),
24702
+ object({ kind: literal("node-offline") }),
24703
+ object({ kind: literal("no-hardware-facts") }),
24704
+ object({
24705
+ kind: literal("no-measured-data"),
24706
+ hardwareClass: HardwareClassIdSchema
24707
+ }),
24708
+ object({
24709
+ kind: literal("no-family-build"),
24710
+ format: ModelFormatSchema$1
24711
+ }),
24712
+ object({
24713
+ kind: literal("kept-custom-pin"),
24714
+ modelId: string(),
24715
+ deviceKey: string()
24716
+ })
24717
+ ]);
24718
+ /** Why a device is left exactly as it is, whatever the plan would pick (D786). */
24719
+ var KeptReasonSchema = _enum(["custom-pin"]);
24720
+ /**
24721
+ * Where a choice's latency came from (D791): this node's own benchmark
24722
+ * result, or the hardware-class table. Measured on the node beats the table.
24723
+ */
24724
+ var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
24725
+ kind: literal("node-benchmark"),
24726
+ resultId: string(),
24727
+ measuredAtMs: number()
24728
+ })]);
24729
+ var DeviceModelChoiceSchema = object({
24730
+ modelId: string(),
24731
+ p50Ms: number(),
24732
+ fps: number(),
24733
+ measured: boolean(),
24734
+ /** Absent on a plan from before D791 — read as the table. */
24735
+ source: LatencySourceSchema.optional(),
24736
+ /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
24737
+ capacitySessions: number(),
24738
+ personRecall: number()
24739
+ });
24740
+ var DeviceRecommendationSchema = object({
24741
+ deviceKey: string(),
24742
+ accelerator: AcceleratorKindSchema.nullable(),
24743
+ enabled: boolean(),
24744
+ available: boolean(),
24745
+ chosen: DeviceModelChoiceSchema.nullable(),
24746
+ /** Present when the device is kept as is: Apply writes nothing on it. */
24747
+ kept: KeptReasonSchema.optional(),
24748
+ reasons: array(RecommendationReasonSchema).readonly()
24749
+ });
24750
+ var NodeRecommendationSchema = object({
24751
+ nodeId: string(),
24752
+ reachable: boolean(),
24753
+ hardwareClass: HardwareClassIdSchema.nullable(),
24754
+ cpuModel: string().nullable(),
24755
+ skipped: boolean(),
24756
+ acceleratorModelId: string().nullable(),
24757
+ devices: array(DeviceRecommendationSchema).readonly(),
24758
+ reasons: array(RecommendationReasonSchema).readonly()
24759
+ });
24760
+ var ModelPinChangeSchema = object({
24761
+ stepId: string(),
24762
+ before: string().nullable(),
24763
+ after: string().nullable()
24764
+ });
24765
+ var NodeDeviceChangeSchema = object({
24766
+ nodeId: string(),
24767
+ deviceKey: string(),
24768
+ madeExplicit: boolean(),
24769
+ modelPins: array(ModelPinChangeSchema).readonly(),
24770
+ thresholds: array(object({
24771
+ stepId: string(),
24772
+ keys: array(string()).readonly()
24773
+ })).readonly()
24774
+ });
24775
+ var CameraOverrideClearSchema = object({
24776
+ deviceId: number(),
24777
+ source: _enum(["step-override", "wholesale"]),
24778
+ nodeId: string(),
24779
+ deviceKey: string().nullable(),
24780
+ stepId: string(),
24781
+ modelIdBefore: string().nullable(),
24782
+ keys: array(string()).readonly()
24783
+ });
24784
+ var DetectorStoreClearSchema = object({
24785
+ deviceId: number(),
24786
+ keys: array(string()).readonly()
24787
+ });
24788
+ var AutoTuneWarningSchema = discriminatedUnion("kind", [
24789
+ object({
24790
+ kind: literal("detector-store-cluster-wide"),
24791
+ skippedNodes: array(string()).readonly()
24792
+ }),
24793
+ object({
24794
+ kind: literal("detector-store-unreadable"),
24795
+ error: string()
24796
+ }),
24797
+ object({
24798
+ kind: literal("coral-enabled"),
24799
+ nodeId: string(),
24800
+ deviceKey: string()
24801
+ }),
24802
+ object({
24803
+ kind: literal("custom-pin-kept"),
24804
+ nodeId: string(),
24805
+ deviceKey: string().nullable(),
24806
+ deviceId: number().nullable(),
24807
+ modelId: string()
24808
+ }),
24809
+ object({
24810
+ kind: literal("custom-registry-unreadable"),
24811
+ error: string()
24812
+ })
24813
+ ]);
24814
+ var AutoTuneOptionsSchema = object({
24815
+ /** Share of each accelerator's throughput kept free (0.3–0.5). */
24816
+ headroom: number().min(.3).max(.5).default(.4),
24817
+ /**
24818
+ * The least number of parallel sessions every device must sustain at the
24819
+ * camera rate with the headroom kept free (D755). The most accurate model
24820
+ * that reaches it wins.
24821
+ */
24822
+ minSessionsPerDevice: number().int().min(MIN_SESSIONS_PER_DEVICE_RANGE.min).max(MIN_SESSIONS_PER_DEVICE_RANGE.max).default(2)
24823
+ });
24824
+ var AutoTunePlanSchema = object({
24825
+ /** Hash of everything the apply will write — the apply refuses a different one. */
24826
+ planHash: string(),
24827
+ family: literal("yolov9"),
24828
+ headroom: number(),
24829
+ minSessionsPerDevice: number(),
24830
+ /** The detection rate a session is counted at (the fastest camera running the pipeline root). */
24831
+ cameraFps: number(),
24832
+ generatedAt: number(),
24833
+ nodes: array(NodeRecommendationSchema).readonly(),
24834
+ nodeChanges: array(NodeDeviceChangeSchema).readonly(),
24835
+ cameraClears: array(CameraOverrideClearSchema).readonly(),
24836
+ detectorStoreClears: array(DetectorStoreClearSchema).readonly(),
24837
+ warnings: array(AutoTuneWarningSchema).readonly()
24838
+ });
24839
+ var AutoTuneApplyInputSchema = object({
24840
+ planHash: string(),
24841
+ headroom: number().min(.3).max(.5).default(.4),
24842
+ minSessionsPerDevice: number().int().min(MIN_SESSIONS_PER_DEVICE_RANGE.min).max(MIN_SESSIONS_PER_DEVICE_RANGE.max).default(2)
24843
+ });
24844
+ var AutoTunePhaseResultSchema = object({
24845
+ phase: _enum([
24846
+ "download",
24847
+ "camera-overrides",
24848
+ "detector-thresholds",
24849
+ "node-models",
24850
+ "redispatch"
24851
+ ]),
24852
+ ok: boolean(),
24853
+ detail: string()
24854
+ });
24855
+ var AutoTuneApplyResultSchema = discriminatedUnion("kind", [
24856
+ object({
24857
+ kind: literal("applied"),
24858
+ planHash: string(),
24859
+ phases: array(AutoTunePhaseResultSchema).readonly()
24860
+ }),
24861
+ object({
24862
+ kind: literal("aborted"),
24863
+ phases: array(AutoTunePhaseResultSchema).readonly()
24864
+ }),
24865
+ object({
24866
+ kind: literal("stale"),
24867
+ plan: AutoTunePlanSchema
24868
+ }),
24869
+ object({
24870
+ kind: literal("refused"),
24871
+ reason: _enum(["apply-in-progress"])
24872
+ })
24873
+ ]);
24874
+ /**
24875
+ * Wire shapes of the Load balancing surface (D748): the session placement
24876
+ * policy, the atomic share write, the observed placement statistics, the
24877
+ * hardware share suggestion and the stale device pins.
24878
+ */
24879
+ /**
24880
+ * How a new detection session picks its node and device.
24881
+ * - `least-loaded` — the historical rule: lowest `attached / weight`, a
24882
+ * constant node order at a tie (D37). An idle node always ties at 0, so a
24883
+ * weight only bites once a node already holds a session.
24884
+ * - `share` — the share of PARALLEL sessions is held to the weights, and a
24885
+ * full or drowning node yields to a free one (D748).
24886
+ */
24887
+ var SessionPlacementPolicySchema = _enum(["least-loaded", "share"]);
24888
+ var LoadBalancingSharesInputSchema = object({
24889
+ /** nodeId → share (> 0). A node left out keeps its weight. */
24890
+ nodes: record(string(), number().positive()).default({}),
24891
+ /** nodeId → deviceKey → share (> 0). A device left out keeps its weight. */
24892
+ devices: record(string(), record(string(), number().positive())).default({})
24893
+ });
24894
+ var PlacementStatsInputSchema = object({
24895
+ /** Window the observed shares are averaged over (default 1 h, max 24 h). */
24896
+ windowMs: number().int().min(6e4).max(1440 * 60 * 1e3).default(3600 * 1e3) });
24897
+ var PlacementDeviceStatsSchema = object({
24898
+ deviceKey: string(),
24899
+ /** Sessions running on this device now. */
24900
+ sessionsNow: number(),
24901
+ /** Sessions started on this device inside the window. */
24902
+ sessionsStarted: number(),
24903
+ /** Time-weighted share of the node's parallel sessions over the window (0–1); null = no session ran. */
24904
+ observedShare: number().nullable()
24905
+ });
24906
+ var PlacementNodeStatsSchema = object({
24907
+ nodeId: string(),
24908
+ sessionsNow: number(),
24909
+ sessionsStarted: number(),
24910
+ /** Time-weighted share of the cluster's parallel sessions over the window (0–1); null = none ran. */
24911
+ observedShare: number().nullable(),
24912
+ /** Most sessions this node ran at once inside the window. */
24913
+ peakSessions: number(),
24914
+ /** Sessions a share election handed elsewhere because this node was full or drowning. */
24915
+ yieldsAway: number(),
24916
+ devices: array(PlacementDeviceStatsSchema).readonly()
24917
+ });
24918
+ /** A camera's device pin that the session path cannot honour. */
24919
+ var StaleDevicePinSchema = object({
24920
+ deviceId: number(),
24921
+ deviceKey: string(),
24922
+ /** `disabled` — the key exists on some node but is not enabled anywhere; `absent` — no node has it. */
24923
+ reason: _enum(["disabled", "absent"])
24924
+ });
24925
+ var PlacementStatsSchema = object({
24926
+ policy: SessionPlacementPolicySchema,
24927
+ windowMs: number(),
24928
+ /** How much of the window was actually observed (the hub keeps it in memory). */
24929
+ observedForMs: number(),
24930
+ sessionsNow: number(),
24931
+ /** Most parallel sessions across the cluster inside the window. */
24932
+ clusterPeakSessions: number(),
24933
+ nodes: array(PlacementNodeStatsSchema).readonly(),
24934
+ stalePins: array(StaleDevicePinSchema).readonly()
24935
+ });
24936
+ /**
24937
+ * Where an automatic share's capacity comes from (D755).
24938
+ * - `hardware` — the static capacity of each device at its Auto tune model:
24939
+ * the measured latency table for the node's hardware class.
24940
+ * - `benchmark` — the node's own measured capacity (node benchmark results).
24941
+ * A node with no results falls back to `hardware`, and says so.
24942
+ */
24943
+ var CapacitySourceSchema = _enum(["hardware", "benchmark"]);
24944
+ /** Why a node under the `benchmark` source was sized from hardware instead. */
24945
+ var CapacityFallbackSchema = _enum(["no-benchmark-results", "partial-benchmark-results"]);
24946
+ var SuggestSharesInputSchema = object({
24947
+ headroom: number().min(.3).max(.5).default(.4),
24948
+ /** Default `hardware`. */
24949
+ source: CapacitySourceSchema.default("hardware")
24950
+ });
24951
+ var SuggestedDeviceShareSchema = object({
24952
+ deviceKey: string(),
24953
+ /** Share of the node (0–100, rounded). */
24954
+ share: number(),
24955
+ modelId: string().nullable(),
24956
+ /** Inferences per second at that model, from the measured table; null when sized by a benchmark. */
24957
+ fps: number().nullable(),
24958
+ /** False for a table cell derived from another chip; true for a measured cell or a benchmark. */
24959
+ measured: boolean(),
24960
+ /**
24961
+ * Advisory session cap: ⌊fps × (1 − headroom) / camera fps⌋ from the table,
24962
+ * or the benchmark's measured max sessions. Never enforced.
24963
+ */
24964
+ suggestedMaxSessions: number().nullable()
24965
+ });
24966
+ var SuggestedNodeShareSchema = object({
24967
+ nodeId: string(),
24968
+ /** Share of the cluster (0–100, rounded); null = node skipped (offline, unknown hardware). */
24969
+ share: number().nullable(),
24970
+ /** Parallel sessions the node sustains at the suggested models with the headroom kept free. */
24971
+ capacitySessions: number(),
24972
+ devices: array(SuggestedDeviceShareSchema).readonly(),
24973
+ skippedReason: string().nullable(),
24974
+ /** What this node's capacity was read from; null when the node is skipped. */
24975
+ capacitySource: CapacitySourceSchema.nullable(),
24976
+ /** Set when the `benchmark` source was asked for and this node used `hardware`. */
24977
+ capacityFallback: CapacityFallbackSchema.nullable()
24978
+ });
24979
+ var SuggestSharesResultSchema = object({
24980
+ headroom: number(),
24981
+ /** The source asked for; each node says what it actually used. */
24982
+ source: CapacitySourceSchema,
24983
+ /** Camera detection rate the capacity is counted in (the fastest camera's fps). */
24984
+ cameraFps: number(),
24985
+ /** The Auto tune capacity floor the models were picked at. */
24986
+ minSessionsPerDevice: number(),
24987
+ nodes: array(SuggestedNodeShareSchema).readonly()
24988
+ });
24989
+ /**
24990
+ * Where the node and device shares come from (D750, D755, D791).
24991
+ * - `benchmark` (default since D791) — each node's capacity as its own node
24992
+ * benchmark measured it; a node without fresh results is sized from
24993
+ * `hardware` and says so. Measured on the node beats the table.
24994
+ * - `hardware` — computed from each node's static capacity only (its
24995
+ * accelerators at their Auto tune models, from the latency table).
24996
+ * Both are recomputed whenever a node or device joins, leaves, is switched
24997
+ * on or off, changes model, or a benchmark result is written. No load input.
24998
+ * - `manual` — the operator's stored sliders.
24999
+ * Either way a node or device that cannot take sessions gives its share to
25000
+ * the others in proportion; the stored values are never rewritten for that.
25001
+ */
25002
+ var ShareSourceSchema = _enum([
25003
+ "hardware",
25004
+ "benchmark",
25005
+ "manual"
25006
+ ]);
25007
+ var SetShareSourceInputSchema = object({ source: ShareSourceSchema });
25008
+ object({
25009
+ nodes: record(string(), number()),
25010
+ devices: record(string(), record(string(), number()))
25011
+ });
25012
+ var EffectiveDeviceShareSchema = object({
25013
+ deviceKey: string(),
25014
+ /** Can take sessions now (enabled, available, can run the root). */
25015
+ eligible: boolean(),
25016
+ /** The share the source assigns, as a percentage of the node's devices. */
25017
+ configuredPct: number(),
25018
+ /** The share actually used, after an ineligible device's share went to the others. */
25019
+ effectivePct: number()
25020
+ });
25021
+ var EffectiveNodeShareSchema = object({
25022
+ nodeId: string(),
25023
+ eligible: boolean(),
25024
+ configuredPct: number(),
25025
+ effectivePct: number(),
25026
+ /** Automatic sources: what this node's share was computed from; null under `manual` or before the first answer. */
25027
+ capacitySource: CapacitySourceSchema.nullable(),
25028
+ /** Automatic `benchmark`: why this node used `hardware` instead. */
25029
+ capacityFallback: CapacityFallbackSchema.nullable(),
25030
+ devices: array(EffectiveDeviceShareSchema).readonly()
25031
+ });
25032
+ var EffectiveSharesSchema = object({
25033
+ source: ShareSourceSchema,
25034
+ policy: SessionPlacementPolicySchema,
25035
+ /** An automatic source with no computed answer yet: the stored sliders are used meanwhile. */
25036
+ autoPending: boolean(),
25037
+ /** When the automatic shares were last computed (ms epoch); null = never. */
25038
+ computedAt: number().nullable(),
25039
+ /** What made the system recompute them last. */
25040
+ trigger: string().nullable(),
25041
+ nodes: array(EffectiveNodeShareSchema).readonly(),
25042
+ /** The relative weights the election reads (before eligibility). */
25043
+ nodeWeights: record(string(), number()),
25044
+ deviceWeights: record(string(), record(string(), number()))
25045
+ });
25046
+ /**
25047
+ * Wire shapes of the node benchmark (D791): the operator's plan, the
25048
+ * preflight the confirmation shows, the run the orchestrator owns, what the
25049
+ * measuring runner reports, and the result rows Auto tune and the automatic
25050
+ * shares read.
25051
+ *
25052
+ * ONE node at a time, owned by the pipeline orchestrator. While a run is
25053
+ * active the cluster is in BENCHMARK MODE for that node: it is not a
25054
+ * detection candidate, camera pins naming it are ignored so its sessions move
25055
+ * elsewhere, and both come back when the mode ends — after a crash or a hub
25056
+ * restart too (a persisted manifest, reconciled against the registry).
25057
+ *
25058
+ * Two measurements, both on the node, driven by its own runner (frames never
25059
+ * cross a process at frame rate, D9):
25060
+ * - `device` — one accelerator × one candidate detector, root only, open
25061
+ * loop: how many streams at the camera rate it carries inside the frame
25062
+ * interval;
25063
+ * - `pipeline` — the chosen detector plus the operator's detail steps
25064
+ * (faces, plates, classifiers, CLIP…), on varied frames from the bench
25065
+ * clip: how many parallel sessions the node carries before latency, drops,
25066
+ * CPU, RAM or the event loop give out.
25067
+ */
25068
+ /** Defaults and bounds, one place. */
25069
+ var NODE_BENCHMARK_DEFAULTS = {
25070
+ fpsPerStream: 10,
25071
+ budgetMinutes: 45,
25072
+ minBudgetMinutes: 10,
25073
+ maxBudgetMinutes: 120,
25074
+ /** A result older than this no longer beats the table. */
25075
+ staleAfterDays: 30,
25076
+ /** Warm-in per ramp step (not accounted). */
25077
+ settleSec: 5,
25078
+ /** Accounted window per ramp step. */
25079
+ measureSec: 20,
25080
+ /** Longest the drain may take before the run is refused. */
25081
+ drainTimeoutSec: 120,
25082
+ /** Candidate models per device in one run. */
25083
+ maxModelsPerDevice: 6
25084
+ };
25085
+ /** The two measurements a run can make. */
25086
+ var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
25087
+ var NodeBenchmarkDevicePlanSchema = object({
25088
+ /** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
25089
+ deviceKey: string().min(1),
25090
+ /**
25091
+ * Root detector candidates for the `device` measurement, in the order
25092
+ * measured. The FIRST is the one the `pipeline` measurement runs.
25093
+ */
25094
+ modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
25095
+ });
25096
+ /** What the operator confirmed. */
25097
+ var NodeBenchmarkPlanSchema = object({
25098
+ nodeId: string().min(1),
25099
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25100
+ /** Which measurements run. At least one. */
25101
+ phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
25102
+ /**
25103
+ * Detail steps (catalog step ids under the root: faces, plates,
25104
+ * classifiers, CLIP…) the `pipeline` measurement enables. The root
25105
+ * detector always runs.
25106
+ */
25107
+ steps: array(string().min(1)).default([]),
25108
+ /** Offered rate of one stream / session. */
25109
+ fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
25110
+ /** Hard deadline: the mode ends and the cluster is restored when it passes. */
25111
+ budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
25112
+ /** Keep the models the run downloaded (default: delete what was not installed before). */
25113
+ keepDownloadedModels: boolean().default(false),
25114
+ /** Start although the other nodes' capacity does not cover the sessions running now. */
25115
+ acceptInsufficientHeadroom: boolean().default(false)
25116
+ });
25117
+ var NodeBenchmarkRefusalSchema = object({
25118
+ kind: _enum([
25119
+ "benchmark-active",
25120
+ "node-offline",
25121
+ "unknown-device",
25122
+ "no-phase",
25123
+ "insufficient-headroom"
25124
+ ]),
25125
+ detail: string(),
25126
+ overridable: boolean()
25127
+ });
25128
+ /** A camera whose detection leaves the node for the run. */
25129
+ var NodeBenchmarkMovingCameraSchema = object({
25130
+ deviceId: number(),
25131
+ /** Placed on the node now (a standing attach or a running session). */
25132
+ placedOnNode: boolean(),
25133
+ /** A node pin naming this node, ignored for the run. */
25134
+ pinnedToNode: boolean()
25135
+ });
25136
+ /** A camera that cannot leave: no other node can obtain its frames. */
25137
+ var NodeBenchmarkStayingCameraSchema = object({
25138
+ deviceId: number(),
25139
+ reason: literal("only-frame-source")
25140
+ });
25141
+ var NodeBenchmarkPreflightSchema = object({
25142
+ nodeId: string(),
25143
+ online: boolean(),
25144
+ moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
25145
+ /** Keep running on the node during the run; the result is flagged contaminated. */
25146
+ staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
25147
+ estimatedDurationMs: number(),
25148
+ /** The run ends and the cluster is restored at the latest after this long. */
25149
+ budgetMs: number(),
25150
+ phases: array(NodeBenchmarkPhaseSchema).readonly(),
25151
+ steps: array(string()).readonly(),
25152
+ devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
25153
+ /** Parallel sessions the cluster runs now, and what the other nodes can carry. */
25154
+ headroom: object({
25155
+ sessionsNow: number(),
25156
+ otherNodesCapacitySessions: number().nullable()
25157
+ }),
25158
+ refusals: array(NodeBenchmarkRefusalSchema).readonly(),
25159
+ canStart: boolean()
25160
+ });
25161
+ /** Where the measuring runner is. */
25162
+ var NodeBenchProgressSchema = object({
25163
+ phase: _enum([
25164
+ "preparing",
25165
+ "device",
25166
+ "pipeline",
25167
+ "cleanup"
25168
+ ]),
25169
+ deviceKey: string().nullable(),
25170
+ modelId: string().nullable(),
25171
+ /** Streams (device) or sessions (pipeline) of the step running now. */
25172
+ load: number().nullable(),
25173
+ cellsDone: number(),
25174
+ cellsTotal: number(),
25175
+ message: string()
25176
+ });
25177
+ /** What limited a ramp. `none` = the ramp ran out of steps still passing. */
25178
+ var NodeBenchLimitSchema = _enum([
25179
+ "p95",
25180
+ "drops",
25181
+ "errors",
25182
+ "stall",
25183
+ "cpu",
25184
+ "ram",
25185
+ "none"
25186
+ ]);
25187
+ var NodeBenchRampStepSchema = object({
25188
+ load: number(),
25189
+ pass: boolean(),
25190
+ p95Ms: number(),
25191
+ dropRatio: number(),
25192
+ /** Completed frames per second over the accounted window. */
25193
+ fps: number(),
25194
+ cpuPct: number().nullable(),
25195
+ ramFreePct: number().nullable(),
25196
+ failReasons: array(string()).readonly()
25197
+ });
25198
+ var NodeBenchCellSchema = discriminatedUnion("phase", [object({
25199
+ phase: literal("device"),
25200
+ deviceKey: string(),
25201
+ modelId: string(),
25202
+ /** Single-stream latency (the K = 1 step). */
25203
+ p50Ms: number(),
25204
+ p95Ms: number(),
25205
+ p99Ms: number(),
25206
+ /** Frames per second sustained at the last passing step. */
25207
+ fps: number(),
25208
+ /** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
25209
+ kMax: number(),
25210
+ limitedBy: NodeBenchLimitSchema,
25211
+ /** First call (model load + warm-up). */
25212
+ warmupMs: number(),
25213
+ ramp: array(NodeBenchRampStepSchema).readonly()
25214
+ }), object({
25215
+ phase: literal("pipeline"),
25216
+ deviceKey: string(),
25217
+ modelId: string(),
25218
+ steps: array(string()).readonly(),
25219
+ /** Parallel sessions at the camera rate the node carried; 0 = not even one. */
25220
+ maxSessions: number(),
25221
+ limitedBy: NodeBenchLimitSchema,
25222
+ /** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
25223
+ stepsFired: array(string()).readonly(),
25224
+ warmupMs: number(),
25225
+ ramp: array(NodeBenchRampStepSchema).readonly()
25226
+ })]);
25227
+ /**
25228
+ * What a result was measured ON. A result whose fingerprint no longer matches
25229
+ * the node no longer beats the table.
25230
+ */
25231
+ var NodeBenchFingerprintSchema = object({
25232
+ pipelineVersion: string().nullable(),
25233
+ cpuModel: string().nullable(),
25234
+ ramGb: number().nullable(),
25235
+ os: string().nullable(),
25236
+ /** Per device: the pool the cells ran on (runtime + tuning). */
25237
+ pools: record(string(), object({
25238
+ runtime: string(),
25239
+ numWorkers: number(),
25240
+ concurrency: number(),
25241
+ batchMode: string()
25242
+ })).default({})
25243
+ });
25244
+ /** The frames the run used. */
25245
+ var NodeBenchClipSchema = object({
25246
+ /** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
25247
+ id: string(),
25248
+ revision: string().nullable(),
25249
+ frames: number(),
25250
+ width: number(),
25251
+ height: number()
25252
+ });
25253
+ var NodeBenchRunnerInputSchema = object({
25254
+ runId: string().min(1),
25255
+ devices: array(NodeBenchmarkDevicePlanSchema).min(1),
25256
+ phases: array(NodeBenchmarkPhaseSchema).min(1),
25257
+ /** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
25258
+ steps: array(string()).default([]),
25259
+ fpsPerStream: number().int().min(1).max(30),
25260
+ /** The runner stops on its own past this instant, whatever the hub does. */
25261
+ deadlineAtMs: number(),
25262
+ settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
25263
+ measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
25264
+ keepDownloadedModels: boolean().default(false)
25265
+ });
25266
+ var NodeBenchRunnerStateSchema = _enum([
25267
+ "running",
25268
+ "done",
25269
+ "failed",
25270
+ "aborted"
25271
+ ]);
25272
+ var NodeBenchRunnerStatusSchema = object({
25273
+ runId: string(),
25274
+ nodeId: string(),
25275
+ state: NodeBenchRunnerStateSchema,
25276
+ progress: NodeBenchProgressSchema.nullable(),
25277
+ /** Every finished cell so far — a run stopped half way keeps what it measured. */
25278
+ cells: array(NodeBenchCellSchema).readonly(),
25279
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25280
+ clip: NodeBenchClipSchema.nullable(),
25281
+ /** Cameras seen running on the node during the run (they share its pools). */
25282
+ activeCameraIds: array(number()).readonly(),
25283
+ /** Models the run downloaded and then deleted (not installed before). */
25284
+ deletedModels: array(string()).readonly(),
25285
+ error: string().nullable(),
25286
+ startedAtMs: number(),
25287
+ finishedAtMs: number().nullable()
25288
+ });
25289
+ var NodeBenchmarkStateSchema = _enum([
25290
+ "draining",
25291
+ "measuring",
25292
+ "restoring",
25293
+ "done",
25294
+ "failed",
25295
+ "aborted"
25296
+ ]);
25297
+ /** Why a run ended. */
25298
+ var NodeBenchmarkEndReasonSchema = _enum([
25299
+ "completed",
25300
+ "operator-abort",
25301
+ "deadline",
25302
+ "node-lost",
25303
+ "runner-lost",
25304
+ "hub-restart",
25305
+ "drain-timeout",
25306
+ "failed"
25307
+ ]);
25308
+ var NodeBenchmarkRunSchema = object({
25309
+ runId: string(),
25310
+ nodeId: string(),
25311
+ state: NodeBenchmarkStateSchema,
25312
+ plan: NodeBenchmarkPlanSchema,
25313
+ startedAtMs: number(),
25314
+ deadlineAtMs: number(),
25315
+ finishedAtMs: number().nullable(),
25316
+ endReason: NodeBenchmarkEndReasonSchema.nullable(),
25317
+ error: string().nullable(),
25318
+ /** Cameras moved off the node for the run. */
25319
+ moved: array(number()).readonly(),
25320
+ /** Cameras that stayed (their only frame source is the node). */
25321
+ staying: array(number()).readonly(),
25322
+ /** Something else ran on the node's pools during the run. */
25323
+ contaminated: boolean(),
25324
+ progress: NodeBenchProgressSchema.nullable(),
25325
+ resultIds: array(string()).readonly()
25326
+ });
25327
+ /** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
25328
+ var NodeBenchmarkStatusSchema = object({
25329
+ /** The node the cluster is in benchmark mode for; null = none. */
25330
+ modeNodeId: string().nullable(),
25331
+ run: NodeBenchmarkRunSchema.nullable()
25332
+ });
25333
+ /**
25334
+ * One stored measurement — the only authority Auto tune and the automatic
25335
+ * shares read measured capacity from. Written by the orchestrator when a run
25336
+ * ends, never by anyone else.
25337
+ */
25338
+ var NodeBenchmarkResultSchema = object({
25339
+ id: string(),
25340
+ runId: string(),
25341
+ nodeId: string(),
25342
+ cell: NodeBenchCellSchema,
25343
+ fpsPerStream: number(),
25344
+ fingerprint: NodeBenchFingerprintSchema.nullable(),
25345
+ clip: NodeBenchClipSchema.nullable(),
25346
+ /** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
25347
+ contaminated: boolean(),
25348
+ stayingCameras: array(number()).readonly(),
25349
+ /** The run ended early; the cell itself completed. */
25350
+ partialRun: boolean(),
25351
+ measuredAtMs: number()
25352
+ });
25353
+ var ListNodeBenchmarkResultsInputSchema = object({
25354
+ nodeId: string().optional(),
25355
+ deviceKey: string().optional()
25356
+ });
25357
+ /** A result with its standing today: does it still beat the table? */
25358
+ var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
25359
+ /** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
25360
+ standing: _enum([
25361
+ "fresh",
25362
+ "stale",
25363
+ "superseded"
25364
+ ]),
25365
+ staleWhy: _enum([
25366
+ "age",
25367
+ "runtime",
25368
+ "pool-tuning"
25369
+ ]).nullable()
25370
+ });
25371
+ object({
25372
+ runId: string(),
25373
+ nodeId: string(),
25374
+ startedAtMs: number(),
25375
+ deadlineAtMs: number(),
25376
+ plan: NodeBenchmarkPlanSchema,
25377
+ moved: array(number()).readonly(),
25378
+ staying: array(number()).readonly()
25379
+ });
25380
+ /** Candidate detectors per device, for the plan editor. */
25381
+ var NodeBenchmarkCandidatesSchema = object({
25382
+ nodeId: string(),
25383
+ reachable: boolean(),
25384
+ devices: array(object({
25385
+ deviceKey: string(),
25386
+ enabled: boolean(),
25387
+ available: boolean(),
25388
+ /** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
25389
+ suggested: array(string()).readonly(),
25390
+ /** Every root detector the device has a build for. */
25391
+ all: array(string()).readonly(),
25392
+ /** The model the device runs now, when pinned. */
25393
+ currentModelId: string().nullable()
25394
+ })).readonly(),
25395
+ /** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
25396
+ steps: array(object({
25397
+ id: string(),
25398
+ name: string(),
25399
+ slot: string()
25400
+ })).readonly()
25401
+ });
23481
25402
  object({
23482
25403
  activeCameras: number(),
23483
25404
  throttledCameras: number(),
@@ -24355,14 +26276,15 @@ var RunnerLocalLoadSchema = object({
24355
26276
  * Per-inference-device live load (multi-device C4). One entry per deviceKey
24356
26277
  * this runner currently has attached cameras on, so the orchestrator's second
24357
26278
  * `balance()` pass (over a node's devices) weights on real per-pool session
24358
- * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
24359
- * per device is 0 until the pool backlog gets a public accessor (follow-up).
26279
+ * counts. Empty on single-device / pre-multi-device runners. There is no
26280
+ * per-device queue depth: the inference pool's backlog has no accessor, and
26281
+ * a field that always read 0 was removed rather than shown as a measurement
26282
+ * (D762).
24360
26283
  */
24361
26284
  devices: array(object({
24362
26285
  deviceKey: string(),
24363
26286
  backend: string(),
24364
- attachedCameras: number(),
24365
- queueDepthTotal: number()
26287
+ attachedCameras: number()
24366
26288
  })).default([]),
24367
26289
  /** Hardware capability flags reported by this node. */
24368
26290
  hardware: object({
@@ -24498,7 +26420,22 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
24498
26420
  */
24499
26421
  cropJpeg: string().optional(),
24500
26422
  parent: DetailParentSchema,
24501
- steps: array(string()).optional()
26423
+ steps: array(string()).optional(),
26424
+ /**
26425
+ * The camera's root model already drew this step's boxes (D730): a
26426
+ * `license_plate` inside the parent vehicle. The named step is NOT
26427
+ * inferred — these FRAME-space boxes are its output — and its
26428
+ * requested children (the plate reader) run on them. Absent ⇒ every
26429
+ * requested step infers as before.
26430
+ */
26431
+ supplied: object({
26432
+ stepId: string(),
26433
+ modelId: string(),
26434
+ boxes: array(object({
26435
+ bbox: NativeCropBboxSchema,
26436
+ score: number()
26437
+ })).min(1)
26438
+ }).optional()
24502
26439
  }), object({ details: array(DetailResultSchema) }).nullable(), { kind: "mutation" }), method(object({
24503
26440
  /** Catalog step id, e.g. `clip-embedding`. */
24504
26441
  stepId: string(),
@@ -24550,7 +26487,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
24550
26487
  }), ParkedTrackFrameSchema.nullable()), method(object({
24551
26488
  deviceId: number(),
24552
26489
  trackId: string()
24553
- }), object({ released: number().int().nonnegative() }), { kind: "mutation" });
26490
+ }), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
26491
+ accepted: literal(true),
26492
+ runId: string()
26493
+ }), {
26494
+ kind: "mutation",
26495
+ auth: "admin"
26496
+ }), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
26497
+ kind: "mutation",
26498
+ auth: "admin"
26499
+ });
24554
26500
  var CameraPipelineConfigSchema = object({
24555
26501
  engine: PipelineEngineChoiceSchema.optional(),
24556
26502
  steps: array(PipelineStepInputSchema).readonly(),
@@ -24561,14 +26507,6 @@ var CameraPipelineConfigSchema = object({
24561
26507
  settings: record(string(), unknown()).readonly().optional()
24562
26508
  }).nullable().optional()
24563
26509
  });
24564
- var PipelineTemplateSchema = object({
24565
- id: string(),
24566
- name: string(),
24567
- description: string().optional(),
24568
- config: CameraPipelineConfigSchema,
24569
- createdAt: string(),
24570
- updatedAt: string()
24571
- });
24572
26510
  var DeviceStepConfigSchema = object({
24573
26511
  modelId: string().optional(),
24574
26512
  settings: record(string(), unknown()).optional(),
@@ -24642,9 +26580,10 @@ var CameraStepOverridePatchSchema = object({
24642
26580
  modelId: string().optional(),
24643
26581
  settings: record(string(), unknown()).readonly().optional()
24644
26582
  });
26583
+ var CameraStepSettingsSchema = record(string(), record(string(), unknown()).readonly());
24645
26584
  var CameraPipelineSettingsSchema = object({
24646
- pinnedAgentNodeId: string().optional(),
24647
26585
  stepToggles: record(string(), boolean()).optional(),
26586
+ stepSettings: CameraStepSettingsSchema.optional(),
24648
26587
  stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
24649
26588
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
24650
26589
  });
@@ -24677,7 +26616,10 @@ var PipelineAssignmentSchema = object({
24677
26616
  });
24678
26617
  /**
24679
26618
  * Per-agent load summary surfaced to the load balancer + dashboards.
24680
- * Aggregated from each runner's `getLocalLoad` cap call.
26619
+ * Aggregated from each runner's `getLocalLoad` cap call. In the
26620
+ * `getAgentLoad` report, a single-device node's default-pool sessions (no
26621
+ * `deviceKey`) are credited to its one eligible device in `load.devices` —
26622
+ * the default pool IS that device (D745); the balancer's census stays raw.
24681
26623
  */
24682
26624
  var AgentLoadSummarySchema = object({
24683
26625
  nodeId: string(),
@@ -24766,26 +26708,27 @@ var CameraBrokerStatusSchema = object({
24766
26708
  width: number(),
24767
26709
  height: number(),
24768
26710
  subscribers: number(),
24769
- inFps: number(),
24770
- outFps: number()
26711
+ /**
26712
+ * Encoded packets/s the broker receives from the camera. null when the
26713
+ * broker's stats read failed — unknown, never 0 (a 0 here reads as a stall).
26714
+ * There is no output rate: decoding runs in the session decode workers, not
26715
+ * in the broker, so the broker's own decoded-frame rate is 0 on every live
26716
+ * camera and is not served (D758).
26717
+ */
26718
+ inFps: number().nullable()
24771
26719
  })).readonly(),
24772
26720
  webrtcSessions: number(),
24773
26721
  rtspRestream: boolean()
24774
26722
  });
24775
- /** Shared-memory ring statistics within the decoder block. */
24776
- var CameraDecoderShmSchema = object({
24777
- framesWritten: number(),
24778
- getFrameHits: number(),
24779
- getFrameMisses: number(),
24780
- budgetMb: number()
24781
- });
24782
- /** Decoder block — null when the decoder stage is unreachable or inactive. */
24783
- var CameraDecoderStatusSchema = object({
24784
- nodeId: string(),
24785
- formats: array(string()).readonly(),
24786
- sessionCount: number(),
24787
- shm: CameraDecoderShmSchema
24788
- });
26723
+ /**
26724
+ * Decoder block — WHERE decode runs (co-located with the detection node by
26725
+ * construction); null when the camera has no detection node. It carries no
26726
+ * frame counter: the shared-memory plane whose counters it used to serve is
26727
+ * gone, and those fields read 0 forever. Whether frames actually flow is read
26728
+ * from `detection.actualFps` (frames delivered to and processed by the
26729
+ * detector), never from a counter nothing feeds.
26730
+ */
26731
+ var CameraDecoderStatusSchema = object({ nodeId: string() });
24789
26732
  /** Motion block — null when motion detection is not active for this device. */
24790
26733
  var CameraMotionStatusSchema = object({
24791
26734
  enabled: boolean(),
@@ -25142,12 +27085,6 @@ method(object({
25142
27085
  }), object({ success: literal(true) }), {
25143
27086
  kind: "mutation",
25144
27087
  auth: "admin"
25145
- }), method(object({
25146
- agentNodeId: string(),
25147
- detectWeight: number().positive().nullable()
25148
- }), object({ success: literal(true) }), {
25149
- kind: "mutation",
25150
- auth: "admin"
25151
27088
  }), method(object({
25152
27089
  agentNodeId: string(),
25153
27090
  detect: boolean().nullable().optional(),
@@ -25189,6 +27126,30 @@ method(object({
25189
27126
  }), {
25190
27127
  kind: "mutation",
25191
27128
  auth: "admin"
27129
+ }), method(AutoTuneOptionsSchema, AutoTunePlanSchema, { auth: "admin" }), method(AutoTuneApplyInputSchema, AutoTuneApplyResultSchema, {
27130
+ kind: "mutation",
27131
+ auth: "admin"
27132
+ }), method(LoadBalancingSharesInputSchema, object({ success: literal(true) }), {
27133
+ kind: "mutation",
27134
+ auth: "admin"
27135
+ }), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
27136
+ kind: "mutation",
27137
+ auth: "admin"
27138
+ }), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
27139
+ kind: literal("started"),
27140
+ runId: string()
27141
+ }), object({
27142
+ kind: literal("refused"),
27143
+ preflight: NodeBenchmarkPreflightSchema
27144
+ })]), {
27145
+ kind: "mutation",
27146
+ auth: "admin"
27147
+ }), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
27148
+ kind: "mutation",
27149
+ auth: "admin"
27150
+ }), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
27151
+ kind: "mutation",
27152
+ auth: "admin"
25192
27153
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
25193
27154
  deviceId: number(),
25194
27155
  addonId: string(),
@@ -25205,6 +27166,13 @@ method(object({
25205
27166
  }), object({ success: literal(true) }), {
25206
27167
  kind: "mutation",
25207
27168
  auth: "admin"
27169
+ }), method(object({
27170
+ deviceId: number(),
27171
+ addonId: string(),
27172
+ settings: record(string(), unknown()).nullable()
27173
+ }), object({ success: literal(true) }), {
27174
+ kind: "mutation",
27175
+ auth: "admin"
25208
27176
  }), method(object({
25209
27177
  deviceId: number(),
25210
27178
  agentNodeId: string(),
@@ -25228,25 +27196,7 @@ method(object({
25228
27196
  }), method(_void(), DiskReconcileJobSchema, {
25229
27197
  kind: "mutation",
25230
27198
  auth: "admin"
25231
- }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
25232
- name: string(),
25233
- description: string().optional(),
25234
- config: CameraPipelineConfigSchema
25235
- }), PipelineTemplateSchema, {
25236
- kind: "mutation",
25237
- auth: "admin"
25238
- }), method(object({
25239
- id: string(),
25240
- name: string().optional(),
25241
- description: string().optional(),
25242
- config: CameraPipelineConfigSchema.optional()
25243
- }), PipelineTemplateSchema, {
25244
- kind: "mutation",
25245
- auth: "admin"
25246
- }), method(object({ id: string() }), object({ success: literal(true) }), {
25247
- kind: "mutation",
25248
- auth: "admin"
25249
- });
27199
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" });
25250
27200
  /**
25251
27201
  * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
25252
27202
  * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
@@ -25836,7 +27786,19 @@ var SsoBridgeClaimsSchema = object({
25836
27786
  * editing a descriptor must not retroactively extend or shorten a link the
25837
27787
  * operator already consented to.
25838
27788
  */
25839
- refreshTtl: union([number().int().positive(), literal("never")]).optional()
27789
+ refreshTtl: union([number().int().positive(), literal("never")]).optional(),
27790
+ /**
27791
+ * Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
27792
+ * that was started from a signed-in user's "Link" button: the finish then
27793
+ * links this identity to the intent's user instead of signing anyone in.
27794
+ * The handle carries no user id — the hub resolves it, single-use.
27795
+ */
27796
+ linkIntent: string().optional(),
27797
+ /**
27798
+ * Verified `iss` of the id_token behind an OIDC login bridge (D782). A
27799
+ * subject is unique only per issuer, so a link is bound to it.
27800
+ */
27801
+ issuer: string().optional()
25840
27802
  });
25841
27803
  method(object({
25842
27804
  claims: SsoBridgeClaimsSchema,
@@ -27466,8 +29428,6 @@ var WebrtcStreamChoiceSchema = object({
27466
29428
  ]).nullable(),
27467
29429
  /** Input FPS from the camera (null for adaptive). */
27468
29430
  inputFps: number().nullable(),
27469
- /** Decoded FPS (null for adaptive). */
27470
- decodeFps: number().nullable(),
27471
29431
  /** Bitrate in kbps (null for adaptive). */
27472
29432
  bitrateKbps: number().nullable()
27473
29433
  });
@@ -27744,7 +29704,22 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
27744
29704
  * field their hints were silently stripped by the schema and the
27745
29705
  * adaptive ladder started blind on the client's display size.
27746
29706
  */
27747
- hints: webrtcClientHintsSchema.optional()
29707
+ hints: webrtcClientHintsSchema.optional(),
29708
+ /**
29709
+ * Talk-back (D771): relay the PEER's audio to the device's speaker
29710
+ * through the `intercom` cap's push-talk triple. When `true` and the
29711
+ * offer lets the peer send audio, the answer's audio is `sendrecv`
29712
+ * and every inbound frame goes to `intercom.pushTalkAudio` for this
29713
+ * `deviceId`; absent/false answers `sendonly`, as for every viewer.
29714
+ *
29715
+ * TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
29716
+ * with `intercom`, when the linked user may control that camera. The
29717
+ * hub STRIPS it from every request-bound call (a browser), exactly as
29718
+ * it overwrites `relayOnly` — a viewer's talk permission is the
29719
+ * intercom cap's own surface (share tokens gate it there), and this
29720
+ * flag must not become a second door to the camera's speaker.
29721
+ */
29722
+ talkback: boolean().optional()
27748
29723
  }), object({
27749
29724
  sessionId: string(),
27750
29725
  sdpAnswer: string()
@@ -27799,6 +29774,14 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
27799
29774
  */
27800
29775
  alive: boolean()
27801
29776
  })), method(object({
29777
+ deviceId: number().int().nonnegative(),
29778
+ sessionId: string(),
29779
+ downlinkMbps: number().nonnegative()
29780
+ }), object({
29781
+ outcome: _enum(["switching", "held"]),
29782
+ tier: CamProfileSchema.nullable(),
29783
+ reason: string()
29784
+ }), { kind: "mutation" }), method(object({
27802
29785
  deviceId: number().int().nonnegative(),
27803
29786
  sessionId: string()
27804
29787
  }), WebrtcSessionDebugSchema, { kind: "query" });
@@ -28038,6 +30021,59 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
28038
30021
  var RestartAddonResultSchema = unknown();
28039
30022
  var InstallPackageResultSchema = unknown();
28040
30023
  var ReloadPackagesResultSchema = unknown();
30024
+ /**
30025
+ * What an uninstall did on ONE node.
30026
+ * - `uninstalled` — removed: runner(s) stopped, caps gone, code deleted.
30027
+ * - `not-installed` — the node did not have it (nothing to do).
30028
+ * - `refused` — protected / bootstrap package; nothing touched.
30029
+ * - `failed` — attempted and did not complete; `error` says why.
30030
+ * - `pending-reconnect` — the node is OFFLINE: its record was pruned so the
30031
+ * back-fill never returns the package, and the stale-addon sweep removes the
30032
+ * copy when the node registers again (only once the hub no longer has it).
30033
+ */
30034
+ var UninstallNodeOutcomeSchema = _enum([
30035
+ "uninstalled",
30036
+ "not-installed",
30037
+ "refused",
30038
+ "failed",
30039
+ "pending-reconnect"
30040
+ ]);
30041
+ var UninstallNodeResultSchema = object({
30042
+ nodeId: string(),
30043
+ outcome: UninstallNodeOutcomeSchema,
30044
+ error: string().optional(),
30045
+ addonIds: array(string()).readonly(),
30046
+ runnersStopped: array(string()).readonly(),
30047
+ warnings: array(string()).readonly()
30048
+ });
30049
+ var UninstallPackageResultSchema = object({
30050
+ /** Every targeted node ended `uninstalled`, `not-installed` or `pending-reconnect`. */
30051
+ success: boolean(),
30052
+ packageName: string(),
30053
+ results: array(UninstallNodeResultSchema).readonly()
30054
+ });
30055
+ /**
30056
+ * `unreachable` lists online agents whose status read FAILED — absence from
30057
+ * `installations` is only "not installed" for a node that answered (D315).
30058
+ */
30059
+ var PackageInstallationsSchema = object({
30060
+ installations: array(object({
30061
+ packageName: string(),
30062
+ nodeId: string(),
30063
+ nodeName: string(),
30064
+ isHub: boolean(),
30065
+ isOnline: boolean(),
30066
+ version: string().nullable(),
30067
+ addonIds: array(string()).readonly(),
30068
+ source: _enum(["live", "recorded"]),
30069
+ /** The hub installs this package too. `false` on an agent row = an orphan. */
30070
+ onHub: boolean()
30071
+ })).readonly(),
30072
+ unreachable: array(object({
30073
+ nodeId: string(),
30074
+ error: string()
30075
+ })).readonly()
30076
+ });
28041
30077
  var BulkUpdateItemStatusSchema = _enum([
28042
30078
  "queued",
28043
30079
  "updating",
@@ -28120,10 +30156,14 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
28120
30156
  }), method(object({ packageName: string() }), InstallPackageResultSchema, {
28121
30157
  kind: "mutation",
28122
30158
  auth: "admin"
28123
- }), method(_void(), boolean()), method(_void(), array(unknown()).readonly()), method(object({ packageName: string() }), unknown(), {
30159
+ }), method(_void(), boolean()), method(_void(), array(unknown()).readonly()), method(object({
30160
+ packageName: string().min(1),
30161
+ nodeId: string().optional(),
30162
+ everywhere: boolean().optional()
30163
+ }), UninstallPackageResultSchema, {
28124
30164
  kind: "mutation",
28125
30165
  auth: "admin"
28126
- }), method(_void(), ReloadPackagesResultSchema, {
30166
+ }), method(object({ packageName: string().optional() }), PackageInstallationsSchema, { auth: "admin" }), method(_void(), ReloadPackagesResultSchema, {
28127
30167
  kind: "mutation",
28128
30168
  auth: "admin"
28129
30169
  }), method(object({ query: string().optional() }), array(SearchResultSchema)), method(object({ nodeId: string().optional() }), array(PackageUpdateSchema).readonly(), { auth: "admin" }), method(object({
@@ -30191,6 +32231,9 @@ var CreateIntegrationInputSchema = object({
30191
32231
  enabled: boolean().optional(),
30192
32232
  info: record(string(), unknown()).optional(),
30193
32233
  settings: record(string(), unknown()).optional(),
32234
+ /** Keys of `settings` the form's schema declares secret (by type) — kept in
32235
+ * the keychain, not the table (D787). */
32236
+ secretKeys: array(string()).optional(),
30194
32237
  skipRestart: boolean().optional()
30195
32238
  });
30196
32239
  var UpdateIntegrationInputSchema = object({
@@ -30214,7 +32257,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
30214
32257
  auth: "admin"
30215
32258
  }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
30216
32259
  id: string(),
30217
- settings: record(string(), unknown())
32260
+ settings: record(string(), unknown()),
32261
+ /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
32262
+ secretKeys: array(string()).optional()
30218
32263
  }), object({ success: boolean() }), {
30219
32264
  kind: "mutation",
30220
32265
  auth: "admin"
@@ -30474,7 +32519,8 @@ var ConnectionEndpointSchema = object({
30474
32519
  "lan-ipv6",
30475
32520
  "public",
30476
32521
  "loopback",
30477
- "app-link"
32522
+ "app-link",
32523
+ "custom"
30478
32524
  ]),
30479
32525
  /**
30480
32526
  * Originating-interface kind — `lan`/`wifi`/`docker`/`vpn`/`other`/
@@ -30543,7 +32589,7 @@ var GetConnectionEndpointsResultSchema = object({
30543
32589
  localPort: AdvertisedLocalPortSchema
30544
32590
  });
30545
32591
  /**
30546
- * The address flagged for notification links. `baseUrl: null` = AUTO, which
32592
+ * The address flagged for notification taps (`notificationTaps`). `baseUrl: null` = AUTO, which
30547
32593
  * since D709 is the CamStack app link; `resolved` reports the effective value,
30548
32594
  * so the UI can show it either way.
30549
32595
  */
@@ -30576,6 +32622,72 @@ var ViewerEndpointsSchema = object({
30576
32622
  /** What the ranking currently resolves to (may be empty if nothing is up). */
30577
32623
  resolved: array(string()).readonly()
30578
32624
  });
32625
+ /**
32626
+ * DEPRECATED compatibility shape of `getHubAddresses` (D729 amendment, kept
32627
+ * for addons built against it): `cluster` is the `internal` role, `browser`
32628
+ * the `publicEndpoint` role; `override` is the flagged address.
32629
+ */
32630
+ var HubAddressSnapshotSchema = object({
32631
+ override: string().nullable(),
32632
+ resolved: string().nullable(),
32633
+ source: _enum([
32634
+ "override",
32635
+ "auto",
32636
+ "none"
32637
+ ])
32638
+ });
32639
+ var HubAddressesSchema = object({
32640
+ cluster: HubAddressSnapshotSchema,
32641
+ browser: HubAddressSnapshotSchema
32642
+ });
32643
+ /**
32644
+ * What an address is used for (`hub-address.ts`, D734). `appConnections` is
32645
+ * many-valued; `notificationTaps`, `publicEndpoint` and `internal` are carried
32646
+ * by at most one address.
32647
+ */
32648
+ var HubAddressRoleSchema = _enum(HUB_ADDRESS_ROLES);
32649
+ var RoleSourceSchema = _enum([
32650
+ "flagged",
32651
+ "auto",
32652
+ "none"
32653
+ ]);
32654
+ /** One single-valued role: the flagged address, the one in use, and why. */
32655
+ var HubAddressRoleResolutionSchema = object({
32656
+ /** The address carrying the flag, or null = automatic. */
32657
+ flagged: string().nullable(),
32658
+ /** The address in use, or null when nothing qualifies (never loopback). */
32659
+ resolved: string().nullable(),
32660
+ source: RoleSourceSchema
32661
+ });
32662
+ var HubAppConnectionsResolutionSchema = object({
32663
+ /** The addresses flagged `appConnections`, or empty = automatic. */
32664
+ flagged: array(string()).readonly(),
32665
+ /** What the apps race right now. */
32666
+ resolved: array(string()).readonly(),
32667
+ source: RoleSourceSchema
32668
+ });
32669
+ var HubAddressBookSchema = object({
32670
+ rows: array(ConnectionEndpointSchema.extend({
32671
+ /** In the hub's detected palette right now. */
32672
+ detected: boolean(),
32673
+ /** Entered by the operator (removable). */
32674
+ custom: boolean(),
32675
+ /** The roles explicitly flagged on this address. */
32676
+ flags: array(HubAddressRoleSchema).readonly(),
32677
+ /** The roles this address serves right now — flagged or automatic. */
32678
+ inUse: array(HubAddressRoleSchema).readonly(),
32679
+ /** The roles this address may be flagged with. */
32680
+ eligible: array(HubAddressRoleSchema).readonly()
32681
+ })).readonly(),
32682
+ roles: object({
32683
+ appConnections: HubAppConnectionsResolutionSchema,
32684
+ notificationTaps: HubAddressRoleResolutionSchema,
32685
+ internal: HubAddressRoleResolutionSchema,
32686
+ publicEndpoint: HubAddressRoleResolutionSchema
32687
+ }),
32688
+ /** The `hub=` an app link carries (D709), or null. */
32689
+ appLinkHub: string().nullable()
32690
+ });
30579
32691
  var AllowedAddressesSchema = object({
30580
32692
  /**
30581
32693
  * Allowlist of interface addresses operators have explicitly opted
@@ -30619,10 +32731,27 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
30619
32731
  * tunnel always emits `https://` regardless. */
30620
32732
  scheme: _enum(["http", "https"]).optional(),
30621
32733
  /** Append the CamStack app link entry (`kind: 'app-link'`, D709) —
30622
- * an address notification links can be flagged with, not a hub
32734
+ * an address notification taps can be flagged with, not a hub
30623
32735
  * route. Default `false`: racers and rankers never see it. */
30624
32736
  includeAppLink: boolean().optional()
30625
- }), GetConnectionEndpointsResultSchema), method(_void(), NotificationEndpointSchema), method(object({ baseUrl: string().nullable() }), NotificationEndpointSchema, { kind: "mutation" }), method(_void(), ViewerEndpointsSchema), method(object({ baseUrls: array(string()).readonly() }), ViewerEndpointsSchema, { kind: "mutation" }), method(_void(), AllowedAddressesSchema), method(AllowedAddressesSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), AllowedAddressesSchema, { kind: "mutation" }), method(_void(), TlsStatusSchema), method(object({ reason: string().optional() }), TlsStatusSchema, {
32737
+ }), 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({
32738
+ baseUrl: string(),
32739
+ label: string().max(80)
32740
+ }), HubAddressBookSchema, {
32741
+ kind: "mutation",
32742
+ auth: "admin"
32743
+ }), method(object({ baseUrl: string() }), HubAddressBookSchema, {
32744
+ kind: "mutation",
32745
+ auth: "admin"
32746
+ }), method(object({
32747
+ role: HubAddressRoleSchema,
32748
+ baseUrl: string().nullable(),
32749
+ enabled: boolean(),
32750
+ acceptInsecureHttp: boolean().optional()
32751
+ }), HubAddressBookSchema, {
32752
+ kind: "mutation",
32753
+ auth: "admin"
32754
+ }), method(_void(), HubAddressesSchema), method(_void(), AllowedAddressesSchema), method(AllowedAddressesSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), AllowedAddressesSchema, { kind: "mutation" }), method(_void(), TlsStatusSchema), method(object({ reason: string().optional() }), TlsStatusSchema, {
30626
32755
  kind: "mutation",
30627
32756
  auth: "admin"
30628
32757
  }), method(object({
@@ -31073,7 +33202,8 @@ object({
31073
33202
  * writes this slice (not even a boot seed), and neither does the runner's
31074
33203
  * phase machine: its phase is "a session is attached" for every on-motion
31075
33204
  * session, not motion, and it now has its own `DetectionPhaseTransition`.
31076
- * A provider's `isDetected` answers from the hub's slice.
33205
+ * A provider's `isDetected` and `getStatus` answer from the hub's slice
33206
+ * (`hubMotionNativeProvider`).
31077
33207
  * - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
31078
33208
  * imports) — the provider pushes both edges itself, from the upstream
31079
33209
  * system's own state change. That is the sensor's own fact.
@@ -35699,6 +37829,32 @@ var TotpStatusSchema = object({
35699
37829
  /** Null when no row exists OR the row is still pending confirmation. */
35700
37830
  confirmedAt: number().nullable()
35701
37831
  });
37832
+ /**
37833
+ * user-management — singleton capability for user accounts, API keys,
37834
+ * and scoped tokens.
37835
+ *
37836
+ * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
37837
+ * — the subset check on `setUserScopes` / `createScopedToken` is moot
37838
+ * because non-admins never reach these. If/when we open non-admin
37839
+ * delegation, structural caller-scope subset check goes inside the
37840
+ * provider.
37841
+ */
37842
+ var ExternalIdentitySchema = object({
37843
+ /** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
37844
+ provider: string(),
37845
+ /** The IdP's stable subject (`sub`) for this account. */
37846
+ subject: string(),
37847
+ /** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
37848
+ issuer: string(),
37849
+ userId: string(),
37850
+ /** What the IdP called the account at link time (username / email) — display only. */
37851
+ label: string().optional(),
37852
+ linkedAt: number()
37853
+ });
37854
+ var ExternalIdentityKeySchema = object({
37855
+ provider: string().min(1),
37856
+ subject: string().min(1)
37857
+ });
35702
37858
  method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
35703
37859
  kind: "mutation",
35704
37860
  auth: "admin",
@@ -35812,7 +37968,22 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
35812
37968
  userId: string(),
35813
37969
  username: string(),
35814
37970
  scopes: array(TokenScopeSchema)
35815
- }).nullable(), { access: "view" }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
37971
+ }).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
37972
+ userId: string(),
37973
+ issuer: string()
37974
+ }).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
37975
+ userId: string(),
37976
+ issuer: string().min(1),
37977
+ label: string().optional()
37978
+ }), object({ success: literal(true) }), {
37979
+ kind: "mutation",
37980
+ auth: "admin",
37981
+ access: "create"
37982
+ }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
37983
+ kind: "mutation",
37984
+ auth: "admin",
37985
+ access: "delete"
37986
+ }), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
35816
37987
  kind: "mutation",
35817
37988
  auth: "admin",
35818
37989
  access: "delete"
@@ -36204,6 +38375,16 @@ DeviceType.Camera, method(object({
36204
38375
  package: array(ZoneRuleSchema).readonly()
36205
38376
  });
36206
38377
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
38378
+ Object.freeze({
38379
+ person: .5,
38380
+ vehicle: .5,
38381
+ animal: .5
38382
+ });
38383
+ Object.freeze({
38384
+ person: .65,
38385
+ vehicle: .65,
38386
+ animal: .65
38387
+ });
36207
38388
  /**
36208
38389
  * Accessory device helpers — shared across drivers.
36209
38390
  *
@@ -36378,6 +38559,12 @@ Object.freeze({
36378
38559
  addonId: null,
36379
38560
  access: "view"
36380
38561
  },
38562
+ "addons.listInstallations": {
38563
+ capName: "addons",
38564
+ capScope: "system",
38565
+ addonId: null,
38566
+ access: "view"
38567
+ },
36381
38568
  "addons.listJobs": {
36382
38569
  capName: "addons",
36383
38570
  capScope: "system",
@@ -37560,90 +39747,18 @@ Object.freeze({
37560
39747
  addonId: null,
37561
39748
  access: "create"
37562
39749
  },
37563
- "decoder.createSession": {
37564
- capName: "decoder",
37565
- capScope: "system",
37566
- addonId: null,
37567
- access: "view"
37568
- },
37569
- "decoder.destroySession": {
37570
- capName: "decoder",
37571
- capScope: "system",
37572
- addonId: null,
37573
- access: "delete"
37574
- },
37575
- "decoder.getFrame": {
37576
- capName: "decoder",
37577
- capScope: "system",
37578
- addonId: null,
37579
- access: "view"
37580
- },
37581
39750
  "decoder.getInfo": {
37582
39751
  capName: "decoder",
37583
39752
  capScope: "system",
37584
39753
  addonId: null,
37585
39754
  access: "view"
37586
39755
  },
37587
- "decoder.getShmStats": {
37588
- capName: "decoder",
37589
- capScope: "system",
37590
- addonId: null,
37591
- access: "view"
37592
- },
37593
- "decoder.getStats": {
37594
- capName: "decoder",
37595
- capScope: "system",
37596
- addonId: null,
37597
- access: "view"
37598
- },
37599
- "decoder.listActiveSessions": {
37600
- capName: "decoder",
37601
- capScope: "system",
37602
- addonId: null,
37603
- access: "view"
37604
- },
37605
- "decoder.openStream": {
37606
- capName: "decoder",
37607
- capScope: "system",
37608
- addonId: null,
37609
- access: "view"
37610
- },
37611
- "decoder.pullFrames": {
37612
- capName: "decoder",
37613
- capScope: "system",
37614
- addonId: null,
37615
- access: "view"
37616
- },
37617
- "decoder.pullHandles": {
37618
- capName: "decoder",
37619
- capScope: "system",
37620
- addonId: null,
37621
- access: "view"
37622
- },
37623
- "decoder.pushPacket": {
37624
- capName: "decoder",
37625
- capScope: "system",
37626
- addonId: null,
37627
- access: "view"
37628
- },
37629
39756
  "decoder.reprobeHwaccel": {
37630
39757
  capName: "decoder",
37631
39758
  capScope: "system",
37632
39759
  addonId: null,
37633
39760
  access: "create"
37634
39761
  },
37635
- "decoder.supportsCodec": {
37636
- capName: "decoder",
37637
- capScope: "system",
37638
- addonId: null,
37639
- access: "view"
37640
- },
37641
- "decoder.updateConfig": {
37642
- capName: "decoder",
37643
- capScope: "system",
37644
- addonId: null,
37645
- access: "view"
37646
- },
37647
39762
  "detectionPipeline.applyDeviceSettingsPatch": {
37648
39763
  capName: "detection-pipeline",
37649
39764
  capScope: "device",
@@ -38910,6 +41025,90 @@ Object.freeze({
38910
41025
  addonId: null,
38911
41026
  access: "create"
38912
41027
  },
41028
+ "keychain.delete": {
41029
+ capName: "keychain",
41030
+ capScope: "system",
41031
+ addonId: null,
41032
+ access: "delete"
41033
+ },
41034
+ "keychain.getState": {
41035
+ capName: "keychain",
41036
+ capScope: "system",
41037
+ addonId: null,
41038
+ access: "view"
41039
+ },
41040
+ "keychain.listMeta": {
41041
+ capName: "keychain",
41042
+ capScope: "system",
41043
+ addonId: null,
41044
+ access: "view"
41045
+ },
41046
+ "keychain.put": {
41047
+ capName: "keychain",
41048
+ capScope: "system",
41049
+ addonId: null,
41050
+ access: "create"
41051
+ },
41052
+ "keychain.resolve": {
41053
+ capName: "keychain",
41054
+ capScope: "system",
41055
+ addonId: null,
41056
+ access: "view"
41057
+ },
41058
+ "keychainAdmin.deleteOrphans": {
41059
+ capName: "keychain-admin",
41060
+ capScope: "system",
41061
+ addonId: null,
41062
+ access: "delete"
41063
+ },
41064
+ "keychainAdmin.downloadRecoveryKey": {
41065
+ capName: "keychain-admin",
41066
+ capScope: "system",
41067
+ addonId: null,
41068
+ access: "create"
41069
+ },
41070
+ "keychainAdmin.listAudit": {
41071
+ capName: "keychain-admin",
41072
+ capScope: "system",
41073
+ addonId: null,
41074
+ access: "view"
41075
+ },
41076
+ "keychainAdmin.listSecrets": {
41077
+ capName: "keychain-admin",
41078
+ capScope: "system",
41079
+ addonId: null,
41080
+ access: "view"
41081
+ },
41082
+ "keychainAdmin.purgeRetiredKeys": {
41083
+ capName: "keychain-admin",
41084
+ capScope: "system",
41085
+ addonId: null,
41086
+ access: "delete"
41087
+ },
41088
+ "keychainAdmin.resetKeychain": {
41089
+ capName: "keychain-admin",
41090
+ capScope: "system",
41091
+ addonId: null,
41092
+ access: "delete"
41093
+ },
41094
+ "keychainAdmin.reveal": {
41095
+ capName: "keychain-admin",
41096
+ capScope: "system",
41097
+ addonId: null,
41098
+ access: "create"
41099
+ },
41100
+ "keychainAdmin.rotateMasterKey": {
41101
+ capName: "keychain-admin",
41102
+ capScope: "system",
41103
+ addonId: null,
41104
+ access: "create"
41105
+ },
41106
+ "keychainAdmin.status": {
41107
+ capName: "keychain-admin",
41108
+ capScope: "system",
41109
+ addonId: null,
41110
+ access: "view"
41111
+ },
38913
41112
  "lawnMowerControl.dock": {
38914
41113
  capName: "lawn-mower-control",
38915
41114
  capScope: "device",
@@ -39132,12 +41331,24 @@ Object.freeze({
39132
41331
  addonId: null,
39133
41332
  access: "view"
39134
41333
  },
41334
+ "localNetwork.addCustomAddress": {
41335
+ capName: "local-network",
41336
+ capScope: "system",
41337
+ addonId: null,
41338
+ access: "create"
41339
+ },
39135
41340
  "localNetwork.downloadCa": {
39136
41341
  capName: "local-network",
39137
41342
  capScope: "system",
39138
41343
  addonId: null,
39139
41344
  access: "view"
39140
41345
  },
41346
+ "localNetwork.getAddresses": {
41347
+ capName: "local-network",
41348
+ capScope: "system",
41349
+ addonId: null,
41350
+ access: "view"
41351
+ },
39141
41352
  "localNetwork.getAllowedAddresses": {
39142
41353
  capName: "local-network",
39143
41354
  capScope: "system",
@@ -39150,6 +41361,12 @@ Object.freeze({
39150
41361
  addonId: null,
39151
41362
  access: "view"
39152
41363
  },
41364
+ "localNetwork.getHubAddresses": {
41365
+ capName: "local-network",
41366
+ capScope: "system",
41367
+ addonId: null,
41368
+ access: "view"
41369
+ },
39153
41370
  "localNetwork.getNotificationEndpoint": {
39154
41371
  capName: "local-network",
39155
41372
  capScope: "system",
@@ -39186,6 +41403,12 @@ Object.freeze({
39186
41403
  addonId: null,
39187
41404
  access: "create"
39188
41405
  },
41406
+ "localNetwork.removeCustomAddress": {
41407
+ capName: "local-network",
41408
+ capScope: "system",
41409
+ addonId: null,
41410
+ access: "delete"
41411
+ },
39189
41412
  "localNetwork.resetAllowlistToBestMatch": {
39190
41413
  capName: "local-network",
39191
41414
  capScope: "system",
@@ -39198,6 +41421,12 @@ Object.freeze({
39198
41421
  addonId: null,
39199
41422
  access: "create"
39200
41423
  },
41424
+ "localNetwork.setAddressRole": {
41425
+ capName: "local-network",
41426
+ capScope: "system",
41427
+ addonId: null,
41428
+ access: "create"
41429
+ },
39201
41430
  "localNetwork.setAllowedAddresses": {
39202
41431
  capName: "local-network",
39203
41432
  capScope: "system",
@@ -40254,6 +42483,18 @@ Object.freeze({
40254
42483
  addonId: null,
40255
42484
  access: "create"
40256
42485
  },
42486
+ "pipelineAnalytics.addRetrainFrameFromRecording": {
42487
+ capName: "pipeline-analytics",
42488
+ capScope: "device",
42489
+ addonId: null,
42490
+ access: "create"
42491
+ },
42492
+ "pipelineAnalytics.addRetrainFramesToCollection": {
42493
+ capName: "pipeline-analytics",
42494
+ capScope: "device",
42495
+ addonId: null,
42496
+ access: "create"
42497
+ },
40257
42498
  "pipelineAnalytics.applyDeviceSettingsPatch": {
40258
42499
  capName: "pipeline-analytics",
40259
42500
  capScope: "device",
@@ -40302,12 +42543,24 @@ Object.freeze({
40302
42543
  addonId: null,
40303
42544
  access: "view"
40304
42545
  },
42546
+ "pipelineAnalytics.createRetrainCollection": {
42547
+ capName: "pipeline-analytics",
42548
+ capScope: "device",
42549
+ addonId: null,
42550
+ access: "create"
42551
+ },
40305
42552
  "pipelineAnalytics.deleteDeviceEvents": {
40306
42553
  capName: "pipeline-analytics",
40307
42554
  capScope: "device",
40308
42555
  addonId: null,
40309
42556
  access: "delete"
40310
42557
  },
42558
+ "pipelineAnalytics.deleteRetrainCollection": {
42559
+ capName: "pipeline-analytics",
42560
+ capScope: "device",
42561
+ addonId: null,
42562
+ access: "delete"
42563
+ },
40311
42564
  "pipelineAnalytics.deleteTracks": {
40312
42565
  capName: "pipeline-analytics",
40313
42566
  capScope: "device",
@@ -40512,6 +42765,24 @@ Object.freeze({
40512
42765
  addonId: null,
40513
42766
  access: "view"
40514
42767
  },
42768
+ "pipelineAnalytics.listRetrainAssistProfiles": {
42769
+ capName: "pipeline-analytics",
42770
+ capScope: "device",
42771
+ addonId: null,
42772
+ access: "view"
42773
+ },
42774
+ "pipelineAnalytics.listRetrainCollectionFrames": {
42775
+ capName: "pipeline-analytics",
42776
+ capScope: "device",
42777
+ addonId: null,
42778
+ access: "view"
42779
+ },
42780
+ "pipelineAnalytics.listRetrainCollections": {
42781
+ capName: "pipeline-analytics",
42782
+ capScope: "device",
42783
+ addonId: null,
42784
+ access: "view"
42785
+ },
40515
42786
  "pipelineAnalytics.listRetrainFrames": {
40516
42787
  capName: "pipeline-analytics",
40517
42788
  capScope: "device",
@@ -40560,6 +42831,12 @@ Object.freeze({
40560
42831
  addonId: null,
40561
42832
  access: "create"
40562
42833
  },
42834
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
42835
+ capName: "pipeline-analytics",
42836
+ capScope: "device",
42837
+ addonId: null,
42838
+ access: "create"
42839
+ },
40563
42840
  "pipelineAnalytics.pruneEvents": {
40564
42841
  capName: "pipeline-analytics",
40565
42842
  capScope: "device",
@@ -40614,6 +42891,18 @@ Object.freeze({
40614
42891
  addonId: null,
40615
42892
  access: "create"
40616
42893
  },
42894
+ "pipelineAnalytics.removeRetrainFrameFromCollection": {
42895
+ capName: "pipeline-analytics",
42896
+ capScope: "device",
42897
+ addonId: null,
42898
+ access: "delete"
42899
+ },
42900
+ "pipelineAnalytics.renameRetrainCollection": {
42901
+ capName: "pipeline-analytics",
42902
+ capScope: "device",
42903
+ addonId: null,
42904
+ access: "create"
42905
+ },
40617
42906
  "pipelineAnalytics.restageRetrainTrack": {
40618
42907
  capName: "pipeline-analytics",
40619
42908
  capScope: "device",
@@ -40644,6 +42933,12 @@ Object.freeze({
40644
42933
  addonId: null,
40645
42934
  access: "create"
40646
42935
  },
42936
+ "pipelineAnalytics.setRetrainFrameComplete": {
42937
+ capName: "pipeline-analytics",
42938
+ capScope: "device",
42939
+ addonId: null,
42940
+ access: "create"
42941
+ },
40647
42942
  "pipelineAnalytics.setTrackFlags": {
40648
42943
  capName: "pipeline-analytics",
40649
42944
  capScope: "device",
@@ -40680,6 +42975,12 @@ Object.freeze({
40680
42975
  addonId: null,
40681
42976
  access: "delete"
40682
42977
  },
42978
+ "pipelineAnalytics.writeRetrainArchive": {
42979
+ capName: "pipeline-analytics",
42980
+ capScope: "device",
42981
+ addonId: null,
42982
+ access: "create"
42983
+ },
40683
42984
  "pipelineExecutor.cacheFrameInPool": {
40684
42985
  capName: "pipeline-executor",
40685
42986
  capScope: "system",
@@ -40692,13 +42993,13 @@ Object.freeze({
40692
42993
  addonId: null,
40693
42994
  access: "delete"
40694
42995
  },
40695
- "pipelineExecutor.deleteModel": {
42996
+ "pipelineExecutor.clearModelBoundDeviceOverrides": {
40696
42997
  capName: "pipeline-executor",
40697
42998
  capScope: "system",
40698
42999
  addonId: null,
40699
43000
  access: "delete"
40700
43001
  },
40701
- "pipelineExecutor.deleteTemplate": {
43002
+ "pipelineExecutor.deleteModel": {
40702
43003
  capName: "pipeline-executor",
40703
43004
  capScope: "system",
40704
43005
  addonId: null,
@@ -40842,12 +43143,6 @@ Object.freeze({
40842
43143
  addonId: null,
40843
43144
  access: "view"
40844
43145
  },
40845
- "pipelineExecutor.listTemplates": {
40846
- capName: "pipeline-executor",
40847
- capScope: "system",
40848
- addonId: null,
40849
- access: "view"
40850
- },
40851
43146
  "pipelineExecutor.rearmInferenceDevice": {
40852
43147
  capName: "pipeline-executor",
40853
43148
  capScope: "system",
@@ -40872,12 +43167,6 @@ Object.freeze({
40872
43167
  addonId: null,
40873
43168
  access: "create"
40874
43169
  },
40875
- "pipelineExecutor.saveTemplate": {
40876
- capName: "pipeline-executor",
40877
- capScope: "system",
40878
- addonId: null,
40879
- access: "create"
40880
- },
40881
43170
  "pipelineExecutor.setVideoPipelineSteps": {
40882
43171
  capName: "pipeline-executor",
40883
43172
  capScope: "system",
@@ -40896,17 +43185,23 @@ Object.freeze({
40896
43185
  addonId: null,
40897
43186
  access: "create"
40898
43187
  },
40899
- "pipelineExecutor.updateTemplate": {
43188
+ "pipelineExecutor.validatePipeline": {
40900
43189
  capName: "pipeline-executor",
40901
43190
  capScope: "system",
40902
43191
  addonId: null,
43192
+ access: "view"
43193
+ },
43194
+ "pipelineOrchestrator.abortNodeBenchmark": {
43195
+ capName: "pipeline-orchestrator",
43196
+ capScope: "system",
43197
+ addonId: null,
40903
43198
  access: "create"
40904
43199
  },
40905
- "pipelineExecutor.validatePipeline": {
40906
- capName: "pipeline-executor",
43200
+ "pipelineOrchestrator.applyAutoTune": {
43201
+ capName: "pipeline-orchestrator",
40907
43202
  capScope: "system",
40908
43203
  addonId: null,
40909
- access: "view"
43204
+ access: "create"
40910
43205
  },
40911
43206
  "pipelineOrchestrator.applyDeviceSettingsPatch": {
40912
43207
  capName: "pipeline-orchestrator",
@@ -40926,7 +43221,7 @@ Object.freeze({
40926
43221
  addonId: null,
40927
43222
  access: "create"
40928
43223
  },
40929
- "pipelineOrchestrator.deleteTemplate": {
43224
+ "pipelineOrchestrator.deleteNodeBenchmarkResult": {
40930
43225
  capName: "pipeline-orchestrator",
40931
43226
  capScope: "system",
40932
43227
  addonId: null,
@@ -41022,6 +43317,12 @@ Object.freeze({
41022
43317
  addonId: null,
41023
43318
  access: "view"
41024
43319
  },
43320
+ "pipelineOrchestrator.getEffectiveShares": {
43321
+ capName: "pipeline-orchestrator",
43322
+ capScope: "system",
43323
+ addonId: null,
43324
+ access: "view"
43325
+ },
41025
43326
  "pipelineOrchestrator.getGlobalMetrics": {
41026
43327
  capName: "pipeline-orchestrator",
41027
43328
  capScope: "system",
@@ -41034,6 +43335,24 @@ Object.freeze({
41034
43335
  addonId: null,
41035
43336
  access: "view"
41036
43337
  },
43338
+ "pipelineOrchestrator.getNodeBenchmarkCandidates": {
43339
+ capName: "pipeline-orchestrator",
43340
+ capScope: "system",
43341
+ addonId: null,
43342
+ access: "view"
43343
+ },
43344
+ "pipelineOrchestrator.getNodeBenchmarkPreflight": {
43345
+ capName: "pipeline-orchestrator",
43346
+ capScope: "system",
43347
+ addonId: null,
43348
+ access: "view"
43349
+ },
43350
+ "pipelineOrchestrator.getNodeBenchmarkStatus": {
43351
+ capName: "pipeline-orchestrator",
43352
+ capScope: "system",
43353
+ addonId: null,
43354
+ access: "view"
43355
+ },
41037
43356
  "pipelineOrchestrator.getNodeInferenceDevices": {
41038
43357
  capName: "pipeline-orchestrator",
41039
43358
  capScope: "system",
@@ -41058,6 +43377,12 @@ Object.freeze({
41058
43377
  addonId: null,
41059
43378
  access: "view"
41060
43379
  },
43380
+ "pipelineOrchestrator.getPlacementStats": {
43381
+ capName: "pipeline-orchestrator",
43382
+ capScope: "system",
43383
+ addonId: null,
43384
+ access: "view"
43385
+ },
41061
43386
  "pipelineOrchestrator.getReconcileFromDiskStatus": {
41062
43387
  capName: "pipeline-orchestrator",
41063
43388
  capScope: "system",
@@ -41070,7 +43395,7 @@ Object.freeze({
41070
43395
  addonId: null,
41071
43396
  access: "view"
41072
43397
  },
41073
- "pipelineOrchestrator.listTemplates": {
43398
+ "pipelineOrchestrator.listNodeBenchmarkResults": {
41074
43399
  capName: "pipeline-orchestrator",
41075
43400
  capScope: "system",
41076
43401
  addonId: null,
@@ -41082,6 +43407,12 @@ Object.freeze({
41082
43407
  addonId: null,
41083
43408
  access: "create"
41084
43409
  },
43410
+ "pipelineOrchestrator.planAutoTune": {
43411
+ capName: "pipeline-orchestrator",
43412
+ capScope: "system",
43413
+ addonId: null,
43414
+ access: "view"
43415
+ },
41085
43416
  "pipelineOrchestrator.rebalance": {
41086
43417
  capName: "pipeline-orchestrator",
41087
43418
  capScope: "system",
@@ -41124,12 +43455,6 @@ Object.freeze({
41124
43455
  addonId: null,
41125
43456
  access: "create"
41126
43457
  },
41127
- "pipelineOrchestrator.saveTemplate": {
41128
- capName: "pipeline-orchestrator",
41129
- capScope: "system",
41130
- addonId: null,
41131
- access: "create"
41132
- },
41133
43458
  "pipelineOrchestrator.setAgentCapabilities": {
41134
43459
  capName: "pipeline-orchestrator",
41135
43460
  capScope: "system",
@@ -41142,12 +43467,6 @@ Object.freeze({
41142
43467
  addonId: null,
41143
43468
  access: "create"
41144
43469
  },
41145
- "pipelineOrchestrator.setAgentDetectWeight": {
41146
- capName: "pipeline-orchestrator",
41147
- capScope: "system",
41148
- addonId: null,
41149
- access: "create"
41150
- },
41151
43470
  "pipelineOrchestrator.setAgentInferenceDevices": {
41152
43471
  capName: "pipeline-orchestrator",
41153
43472
  capScope: "system",
@@ -41184,6 +43503,12 @@ Object.freeze({
41184
43503
  addonId: null,
41185
43504
  access: "create"
41186
43505
  },
43506
+ "pipelineOrchestrator.setCameraStepSettings": {
43507
+ capName: "pipeline-orchestrator",
43508
+ capScope: "system",
43509
+ addonId: null,
43510
+ access: "create"
43511
+ },
41187
43512
  "pipelineOrchestrator.setCameraStepToggle": {
41188
43513
  capName: "pipeline-orchestrator",
41189
43514
  capScope: "system",
@@ -41202,12 +43527,36 @@ Object.freeze({
41202
43527
  addonId: null,
41203
43528
  access: "create"
41204
43529
  },
43530
+ "pipelineOrchestrator.setLoadBalancingShares": {
43531
+ capName: "pipeline-orchestrator",
43532
+ capScope: "system",
43533
+ addonId: null,
43534
+ access: "create"
43535
+ },
41205
43536
  "pipelineOrchestrator.setPipelineDevicePin": {
41206
43537
  capName: "pipeline-orchestrator",
41207
43538
  capScope: "system",
41208
43539
  addonId: null,
41209
43540
  access: "create"
41210
43541
  },
43542
+ "pipelineOrchestrator.setShareSource": {
43543
+ capName: "pipeline-orchestrator",
43544
+ capScope: "system",
43545
+ addonId: null,
43546
+ access: "create"
43547
+ },
43548
+ "pipelineOrchestrator.startNodeBenchmark": {
43549
+ capName: "pipeline-orchestrator",
43550
+ capScope: "system",
43551
+ addonId: null,
43552
+ access: "create"
43553
+ },
43554
+ "pipelineOrchestrator.suggestShares": {
43555
+ capName: "pipeline-orchestrator",
43556
+ capScope: "system",
43557
+ addonId: null,
43558
+ access: "view"
43559
+ },
41211
43560
  "pipelineOrchestrator.unassignAudio": {
41212
43561
  capName: "pipeline-orchestrator",
41213
43562
  capScope: "system",
@@ -41220,8 +43569,8 @@ Object.freeze({
41220
43569
  addonId: null,
41221
43570
  access: "create"
41222
43571
  },
41223
- "pipelineOrchestrator.updateTemplate": {
41224
- capName: "pipeline-orchestrator",
43572
+ "pipelineRunner.abortNodeBench": {
43573
+ capName: "pipeline-runner",
41225
43574
  capScope: "system",
41226
43575
  addonId: null,
41227
43576
  access: "create"
@@ -41274,6 +43623,12 @@ Object.freeze({
41274
43623
  addonId: null,
41275
43624
  access: "view"
41276
43625
  },
43626
+ "pipelineRunner.getNodeBenchStatus": {
43627
+ capName: "pipeline-runner",
43628
+ capScope: "system",
43629
+ addonId: null,
43630
+ access: "view"
43631
+ },
41277
43632
  "pipelineRunner.getParkedTrackFrame": {
41278
43633
  capName: "pipeline-runner",
41279
43634
  capScope: "system",
@@ -41316,6 +43671,12 @@ Object.freeze({
41316
43671
  addonId: null,
41317
43672
  access: "create"
41318
43673
  },
43674
+ "pipelineRunner.startNodeBench": {
43675
+ capName: "pipeline-runner",
43676
+ capScope: "system",
43677
+ addonId: null,
43678
+ access: "create"
43679
+ },
41319
43680
  "plateGallery.assignPlate": {
41320
43681
  capName: "plate-gallery",
41321
43682
  capScope: "system",
@@ -42660,12 +45021,6 @@ Object.freeze({
42660
45021
  addonId: null,
42661
45022
  access: "view"
42662
45023
  },
42663
- "streamBroker.pullFrameHandles": {
42664
- capName: "stream-broker",
42665
- capScope: "system",
42666
- addonId: null,
42667
- access: "view"
42668
- },
42669
45024
  "streamBroker.regenerateRtspToken": {
42670
45025
  capName: "stream-broker",
42671
45026
  capScope: "system",
@@ -42732,12 +45087,6 @@ Object.freeze({
42732
45087
  addonId: null,
42733
45088
  access: "create"
42734
45089
  },
42735
- "streamBroker.subscribeFrames": {
42736
- capName: "stream-broker",
42737
- capScope: "system",
42738
- addonId: null,
42739
- access: "create"
42740
- },
42741
45090
  "streamBroker.unassignProfile": {
42742
45091
  capName: "stream-broker",
42743
45092
  capScope: "system",
@@ -42750,12 +45099,6 @@ Object.freeze({
42750
45099
  addonId: null,
42751
45100
  access: "create"
42752
45101
  },
42753
- "streamBroker.unsubscribeFrames": {
42754
- capName: "stream-broker",
42755
- capScope: "system",
42756
- addonId: null,
42757
- access: "create"
42758
- },
42759
45102
  "streamCatalog.getCatalog": {
42760
45103
  capName: "stream-catalog",
42761
45104
  capScope: "device",
@@ -43050,18 +45393,36 @@ Object.freeze({
43050
45393
  addonId: null,
43051
45394
  access: "delete"
43052
45395
  },
45396
+ "userManagement.findUserByExternalIdentity": {
45397
+ capName: "user-management",
45398
+ capScope: "system",
45399
+ addonId: null,
45400
+ access: "view"
45401
+ },
43053
45402
  "userManagement.getTotpStatus": {
43054
45403
  capName: "user-management",
43055
45404
  capScope: "system",
43056
45405
  addonId: null,
43057
45406
  access: "view"
43058
45407
  },
45408
+ "userManagement.linkExternalIdentity": {
45409
+ capName: "user-management",
45410
+ capScope: "system",
45411
+ addonId: null,
45412
+ access: "create"
45413
+ },
43059
45414
  "userManagement.listApiKeys": {
43060
45415
  capName: "user-management",
43061
45416
  capScope: "system",
43062
45417
  addonId: null,
43063
45418
  access: "view"
43064
45419
  },
45420
+ "userManagement.listExternalIdentities": {
45421
+ capName: "user-management",
45422
+ capScope: "system",
45423
+ addonId: null,
45424
+ access: "view"
45425
+ },
43065
45426
  "userManagement.listOauthSessions": {
43066
45427
  capName: "user-management",
43067
45428
  capScope: "system",
@@ -43140,6 +45501,12 @@ Object.freeze({
43140
45501
  addonId: null,
43141
45502
  access: "create"
43142
45503
  },
45504
+ "userManagement.unlinkExternalIdentity": {
45505
+ capName: "user-management",
45506
+ capScope: "system",
45507
+ addonId: null,
45508
+ access: "delete"
45509
+ },
43143
45510
  "userManagement.updateUser": {
43144
45511
  capName: "user-management",
43145
45512
  capScope: "system",
@@ -43452,6 +45819,12 @@ Object.freeze({
43452
45819
  addonId: null,
43453
45820
  access: "create"
43454
45821
  },
45822
+ "webrtcSession.applyDownlinkProbe": {
45823
+ capName: "webrtc-session",
45824
+ capScope: "device",
45825
+ addonId: null,
45826
+ access: "create"
45827
+ },
43455
45828
  "webrtcSession.closeSession": {
43456
45829
  capName: "webrtc-session",
43457
45830
  capScope: "device",
@@ -45263,11 +47636,6 @@ Object.freeze({
45263
47636
  form: "single",
45264
47637
  optional: false
45265
47638
  }],
45266
- "decoder.createSession": [{
45267
- name: "deviceId",
45268
- form: "single",
45269
- optional: true
45270
- }],
45271
47639
  "detectionPipeline.applyDeviceSettingsPatch": [{
45272
47640
  name: "deviceId",
45273
47641
  form: "single",
@@ -46238,6 +48606,11 @@ Object.freeze({
46238
48606
  form: "single",
46239
48607
  optional: false
46240
48608
  }],
48609
+ "pipelineAnalytics.addRetrainFrameFromRecording": [{
48610
+ name: "deviceId",
48611
+ form: "single",
48612
+ optional: false
48613
+ }],
46241
48614
  "pipelineAnalytics.applyDeviceSettingsPatch": [{
46242
48615
  name: "deviceId",
46243
48616
  form: "single",
@@ -46428,6 +48801,11 @@ Object.freeze({
46428
48801
  form: "single",
46429
48802
  optional: false
46430
48803
  }],
48804
+ "pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
48805
+ name: "deviceId",
48806
+ form: "single",
48807
+ optional: false
48808
+ }],
46431
48809
  "pipelineAnalytics.pruneEventsBefore": [{
46432
48810
  name: "deviceId",
46433
48811
  form: "single",
@@ -46478,6 +48856,11 @@ Object.freeze({
46478
48856
  form: "single",
46479
48857
  optional: false
46480
48858
  }],
48859
+ "pipelineAnalytics.setRetrainFrameComplete": [{
48860
+ name: "deviceId",
48861
+ form: "single",
48862
+ optional: false
48863
+ }],
46481
48864
  "pipelineAnalytics.setTrackFlags": [{
46482
48865
  name: "deviceId",
46483
48866
  form: "single",
@@ -46498,6 +48881,11 @@ Object.freeze({
46498
48881
  form: "single",
46499
48882
  optional: false
46500
48883
  }],
48884
+ "pipelineExecutor.clearModelBoundDeviceOverrides": [{
48885
+ name: "deviceIds",
48886
+ form: "array",
48887
+ optional: true
48888
+ }],
46501
48889
  "pipelineExecutor.runPipeline": [{
46502
48890
  name: "deviceId",
46503
48891
  form: "single",
@@ -46603,6 +48991,11 @@ Object.freeze({
46603
48991
  form: "single",
46604
48992
  optional: false
46605
48993
  }],
48994
+ "pipelineOrchestrator.setCameraStepSettings": [{
48995
+ name: "deviceId",
48996
+ form: "single",
48997
+ optional: false
48998
+ }],
46606
48999
  "pipelineOrchestrator.setCameraStepToggle": [{
46607
49000
  name: "deviceId",
46608
49001
  form: "single",
@@ -47374,6 +49767,11 @@ Object.freeze({
47374
49767
  form: "single",
47375
49768
  optional: false
47376
49769
  }],
49770
+ "webrtcSession.applyDownlinkProbe": [{
49771
+ name: "deviceId",
49772
+ form: "single",
49773
+ optional: false
49774
+ }],
47377
49775
  "webrtcSession.closeSession": [{
47378
49776
  name: "deviceId",
47379
49777
  form: "single",
@@ -47603,6 +50001,8 @@ new Map(Object.entries({
47603
50001
  "detection-blind": "device-events",
47604
50002
  "node-online": "system",
47605
50003
  "node-offline": "system",
50004
+ "node-restarting": "system",
50005
+ "node-updating": "system",
47606
50006
  "node-inference-unavailable": "system",
47607
50007
  "addon-crash-loop": "system",
47608
50008
  "addon-update-available": "system",
@@ -47680,6 +50080,7 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
47680
50080
  kinds: [
47681
50081
  "node-offline",
47682
50082
  "node-online",
50083
+ "node-restarting",
47683
50084
  "node-inference-unavailable"
47684
50085
  ]
47685
50086
  },
@@ -47701,6 +50102,7 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
47701
50102
  label: "Server & container updates",
47702
50103
  kinds: [
47703
50104
  "server-update-available",
50105
+ "node-updating",
47704
50106
  "server-updated",
47705
50107
  "wrapper-update-available"
47706
50108
  ]
@@ -47848,6 +50250,7 @@ var STATE_SUMMARY_SECTION_VARS = [
47848
50250
  kinds: [
47849
50251
  "node-offline",
47850
50252
  "node-online",
50253
+ "node-restarting",
47851
50254
  "node-inference-unavailable"
47852
50255
  ]
47853
50256
  },
@@ -47869,6 +50272,7 @@ var STATE_SUMMARY_SECTION_VARS = [
47869
50272
  example: "server 1.2.377 → 1.2.378",
47870
50273
  kinds: [
47871
50274
  "server-update-available",
50275
+ "node-updating",
47872
50276
  "server-updated",
47873
50277
  "wrapper-update-available"
47874
50278
  ]
@@ -47901,7 +50305,7 @@ var STATE_SUMMARY_VARS = [
47901
50305
  {
47902
50306
  name: "summarySection",
47903
50307
  label: "Summary: this section",
47904
- description: "The section a per-section summary row is about (D698); on a summary sent as one message, every section it reports, comma-separated.",
50308
+ description: "The section a per-section summary row is about; on a summary sent as one message, every section it reports, comma-separated.",
47905
50309
  example: "Batterie scariche",
47906
50310
  group: "system",
47907
50311
  families: ["rule"],
@@ -48508,33 +50912,36 @@ DEFAULT_NATIVE_LEASE_SETTINGS.admission;
48508
50912
  var MB = 1024 * 1024;
48509
50913
  1024 * MB, 3072 * MB;
48510
50914
  //#endregion
48511
- Object.defineProperty(exports, "BOOT_RECOVERY_BACKOFF_MS", {
48512
- enumerable: true,
48513
- get: function() {
48514
- return BOOT_RECOVERY_BACKOFF_MS;
48515
- }
48516
- });
48517
- Object.defineProperty(exports, "BaseAddon", {
48518
- enumerable: true,
48519
- get: function() {
48520
- return BaseAddon;
48521
- }
48522
- });
48523
- Object.defineProperty(exports, "EventCategory", {
48524
- enumerable: true,
48525
- get: function() {
48526
- return EventCategory;
48527
- }
48528
- });
48529
- Object.defineProperty(exports, "meshNetworkCapability", {
48530
- enumerable: true,
48531
- get: function() {
48532
- return meshNetworkCapability;
48533
- }
48534
- });
48535
- Object.defineProperty(exports, "networkAccessCapability", {
48536
- enumerable: true,
48537
- get: function() {
48538
- return networkAccessCapability;
50915
+ //#region src/auth-key-file.ts
50916
+ /**
50917
+ * Hand the Tailscale auth key to `tailscale up` without putting it on argv
50918
+ * or in the environment (D783).
50919
+ *
50920
+ * The CLI accepts `--auth-key=file:<path>` and reads the key from that file.
50921
+ * The key is written owner-only (0600) into a fresh owner-only (0700) temp
50922
+ * dir, the flag is handed to `run`, and the dir is removed when `run`
50923
+ * settles — success or failure. Error text is passed through
50924
+ * {@link scrubSecret} so a `Command failed: …` message can never carry it.
50925
+ */
50926
+ var REDACTED = "‹redacted›";
50927
+ async function withAuthKeyFile(authKey, run) {
50928
+ const dir = await fs.mkdtemp(path.join(os.tmpdir(), "camstack-ts-"));
50929
+ try {
50930
+ await fs.chmod(dir, 448);
50931
+ const file = path.join(dir, "authkey");
50932
+ await fs.writeFile(file, authKey, { mode: 384 });
50933
+ return await run(`--auth-key=file:${file}`);
50934
+ } finally {
50935
+ await fs.rm(dir, {
50936
+ recursive: true,
50937
+ force: true
50938
+ });
48539
50939
  }
48540
- });
50940
+ }
50941
+ /** Replace every occurrence of `secret` in `text`. Empty secrets are a no-op. */
50942
+ function scrubSecret(text, secret) {
50943
+ if (!secret) return text;
50944
+ return text.split(secret).join(REDACTED);
50945
+ }
50946
+ //#endregion
50947
+ export { BOOT_RECOVERY_BACKOFF_MS as a, networkAccessCapability as i, withAuthKeyFile as n, BaseAddon as o, meshNetworkCapability as r, EventCategory as s, scrubSecret as t };