@camstack/types 1.0.6 → 1.1.0

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.
@@ -182,8 +182,8 @@ export declare abstract class BaseAddon<TConfig extends object = Record<string,
182
182
  protected globalSettingsSchema(_cap?: string): ConfigUISchema | null;
183
183
  /** Override to provide device-level settings UI schema. */
184
184
  protected deviceSettingsSchema(): ConfigUISchema | null;
185
- getGlobalSettings(overlay?: Record<string, unknown>, cap?: string): Promise<ConfigUISchemaWithValues>;
186
- updateGlobalSettings(patch: Partial<TConfig>): Promise<void>;
185
+ getGlobalSettings(overlay?: Record<string, unknown>, cap?: string, _nodeId?: string): Promise<ConfigUISchemaWithValues | null>;
186
+ updateGlobalSettings(patch: Partial<TConfig>, _nodeId?: string): Promise<void>;
187
187
  /**
188
188
  * If any field in `patch` is marked `requiresRestart` in `schema`,
189
189
  * schedule an addon restart for the next tick. Deferred via
package/dist/addon.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-DnS0eJh_.js");
2
+ const require_sleep = require("./sleep-p-5TJ_dy.js");
3
3
  const require_err_msg = require("./err-msg-COpsHMw2.js");
4
4
  exports.BaseAddon = require_sleep.BaseAddon;
5
5
  exports.DATAPLANE_SECRET_HEADER = require_sleep.DATAPLANE_SECRET_HEADER;
package/dist/addon.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { A as ReadinessTimeoutError, D as parseJsonUnknown, N as scopeKey, O as DATAPLANE_SECRET_HEADER, S as asJsonObject, a as adminUiCapability, at as BaseAddon, ht as DisposerChain, i as deviceOpsCapability, k as ReadinessRegistry, lt as emitReadiness, mt as EventCategory, o as createDeviceProxy, ot as normalizeAddonInitResult, p as expandCapMethods, t as sleep, w as asString, y as DeviceType } from "./sleep-D7JeS58T.mjs";
1
+ import { A as ReadinessTimeoutError, D as parseJsonUnknown, N as scopeKey, O as DATAPLANE_SECRET_HEADER, S as asJsonObject, a as adminUiCapability, at as BaseAddon, ht as DisposerChain, i as deviceOpsCapability, k as ReadinessRegistry, lt as emitReadiness, mt as EventCategory, o as createDeviceProxy, ot as normalizeAddonInitResult, p as expandCapMethods, t as sleep, w as asString, y as DeviceType } from "./sleep-B1dKJAMJ.mjs";
2
2
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
3
3
  export { BaseAddon, DATAPLANE_SECRET_HEADER, DeviceType, DisposerChain, EventCategory, ReadinessRegistry, ReadinessTimeoutError, adminUiCapability, asJsonObject, asString, createDeviceProxy, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods, normalizeAddonInitResult, parseJsonUnknown, scopeKey, sleep };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Per-call node pinning for `ctx.api` capability calls.
3
+ *
4
+ * A capability call normally resolves to its DEFAULT provider — a `singleton`
5
+ * cap resolves to the hub, a device-scoped cap to the device's owning node. To
6
+ * query a SPECIFIC node's provider instead (e.g. a remote agent's own
7
+ * in-process `platform-probe` hardware, which the hub cannot probe), pin the
8
+ * call to that node.
9
+ *
10
+ * The nodeId rides OUT-OF-BAND in the tRPC call context (NOT in the validated
11
+ * method args), so capability method signatures stay `nodeId`-free — node
12
+ * targeting is a property of the CALL, not of the method. The transport lifts
13
+ * it from `op.context` onto the `CapCallInput.nodeId` field (`ipcParentLink`),
14
+ * and the hub parent's `onUnownedCall` passes it to the `CapRouteResolver`,
15
+ * which classifies a pinned agent node as `agent-child-forward`
16
+ * (`$agent-cap-fwd.forward` → the agent's in-process provider).
17
+ *
18
+ * Usage at a call site:
19
+ *
20
+ * await api.platformProbe.getCapabilities.query(undefined, nodePin(nodeId))
21
+ */
22
+ /** tRPC `op.context` key carrying a per-call node pin. */
23
+ export declare const CAP_NODE_PIN_CONTEXT_KEY = "__camstackNodePin";
24
+ /** The tRPC request-options shape produced by {@link nodePin}. */
25
+ export interface NodePinnedRequestOptions {
26
+ readonly context: Readonly<Record<string, string>>;
27
+ }
28
+ /**
29
+ * Build the tRPC request options that pin a single capability call to `nodeId`.
30
+ * Pass as the second argument to `.query(input, …)` / `.mutate(input, …)`.
31
+ */
32
+ export declare function nodePin(nodeId: string): NodePinnedRequestOptions;
33
+ /**
34
+ * Read a per-call node pin out of a tRPC `op.context` (transport side).
35
+ * Returns the pinned nodeId, or `undefined` when no pin is present.
36
+ */
37
+ export declare function readNodePin(context: unknown): string | undefined;
package/dist/index.d.ts CHANGED
@@ -108,6 +108,7 @@ export type * from './interfaces/alerts.js';
108
108
  export type * from './interfaces/queryable.js';
109
109
  export * from './enums/index.js';
110
110
  export * from './constants.js';
111
+ export * from './cap-call-context.js';
111
112
  export { parseJsonUnknown, parseJsonObject, parseJsonArray, asJsonObject, asJsonArray, asString, asNumber, asBoolean, } from './utils/json-safe.js';
112
113
  export { hfModelUrl } from './utils/hf-url.js';
113
114
  export { cosineSimilarity } from './utils/cosine-similarity.js';
@@ -181,3 +182,5 @@ export { RingBuffer } from './utils/ring-buffer.js';
181
182
  export { rectsToCells, cellsToRects, type NormRect } from './utils/privacy-grid-raster.js';
182
183
  export { sleep, sleepCancellable } from './utils/sleep.js';
183
184
  export { bindAddonActions } from './helpers/bind-addon-actions.js';
185
+ export { supportedRuntimes, runtimeDevices, defaultDeviceFor, modelFormatForRuntime, scoreRuntimes, } from './inference/runtime-capabilities.js';
186
+ export type { RuntimeId, DeviceOption } from './inference/runtime-capabilities.js';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-DnS0eJh_.js");
2
+ const require_sleep = require("./sleep-p-5TJ_dy.js");
3
3
  const require_err_msg = require("./err-msg-COpsHMw2.js");
4
4
  let zod = require("zod");
5
5
  //#region src/health/wiring-health.ts
@@ -1136,6 +1136,47 @@ var RUNTIME_DEFAULTS = {
1136
1136
  "auth.tokenExpiry": "24h"
1137
1137
  };
1138
1138
  //#endregion
1139
+ //#region src/cap-call-context.ts
1140
+ /**
1141
+ * Per-call node pinning for `ctx.api` capability calls.
1142
+ *
1143
+ * A capability call normally resolves to its DEFAULT provider — a `singleton`
1144
+ * cap resolves to the hub, a device-scoped cap to the device's owning node. To
1145
+ * query a SPECIFIC node's provider instead (e.g. a remote agent's own
1146
+ * in-process `platform-probe` hardware, which the hub cannot probe), pin the
1147
+ * call to that node.
1148
+ *
1149
+ * The nodeId rides OUT-OF-BAND in the tRPC call context (NOT in the validated
1150
+ * method args), so capability method signatures stay `nodeId`-free — node
1151
+ * targeting is a property of the CALL, not of the method. The transport lifts
1152
+ * it from `op.context` onto the `CapCallInput.nodeId` field (`ipcParentLink`),
1153
+ * and the hub parent's `onUnownedCall` passes it to the `CapRouteResolver`,
1154
+ * which classifies a pinned agent node as `agent-child-forward`
1155
+ * (`$agent-cap-fwd.forward` → the agent's in-process provider).
1156
+ *
1157
+ * Usage at a call site:
1158
+ *
1159
+ * await api.platformProbe.getCapabilities.query(undefined, nodePin(nodeId))
1160
+ */
1161
+ /** tRPC `op.context` key carrying a per-call node pin. */
1162
+ var CAP_NODE_PIN_CONTEXT_KEY = "__camstackNodePin";
1163
+ /**
1164
+ * Build the tRPC request options that pin a single capability call to `nodeId`.
1165
+ * Pass as the second argument to `.query(input, …)` / `.mutate(input, …)`.
1166
+ */
1167
+ function nodePin(nodeId) {
1168
+ return { context: { [CAP_NODE_PIN_CONTEXT_KEY]: nodeId } };
1169
+ }
1170
+ /**
1171
+ * Read a per-call node pin out of a tRPC `op.context` (transport side).
1172
+ * Returns the pinned nodeId, or `undefined` when no pin is present.
1173
+ */
1174
+ function readNodePin(context) {
1175
+ if (context === null || typeof context !== "object") return void 0;
1176
+ const value = Reflect.get(context, CAP_NODE_PIN_CONTEXT_KEY);
1177
+ return typeof value === "string" ? value : void 0;
1178
+ }
1179
+ //#endregion
1139
1180
  //#region src/utils/hf-url.ts
1140
1181
  function hfModelUrl(repo, path) {
1141
1182
  return `https://huggingface.co/${repo}/resolve/main/${path}`;
@@ -25051,7 +25092,7 @@ function maskUrlCredentials(rawUrl) {
25051
25092
  u.password = "";
25052
25093
  touched = true;
25053
25094
  }
25054
- for (const key of [...u.searchParams.keys()]) if (isCredentialParam(key)) {
25095
+ for (const key of Array.from(u.searchParams.keys())) if (isCredentialParam(key)) {
25055
25096
  u.searchParams.set(key, "***");
25056
25097
  touched = true;
25057
25098
  }
@@ -25115,8 +25156,8 @@ var RingBuffer = class {
25115
25156
  */
25116
25157
  function rectsToCells(rects, gridWidth, gridHeight) {
25117
25158
  const total = gridWidth * gridHeight;
25118
- if (total <= 0 || rects.length === 0) return new Array(Math.max(0, total)).fill(false);
25119
- const cells = new Array(total).fill(false);
25159
+ if (total <= 0 || rects.length === 0) return Array.from({ length: Math.max(0, total) }).fill(false);
25160
+ const cells = Array.from({ length: total }).fill(false);
25120
25161
  for (let row = 0; row < gridHeight; row++) for (let col = 0; col < gridWidth; col++) {
25121
25162
  const cx = (col + .5) / gridWidth;
25122
25163
  const cy = (row + .5) / gridHeight;
@@ -25143,7 +25184,7 @@ function rectsToCells(rects, gridWidth, gridHeight) {
25143
25184
  function cellsToRects(cells, gridWidth, gridHeight, maxRegions) {
25144
25185
  if (gridWidth <= 0 || gridHeight <= 0 || maxRegions <= 0) return [];
25145
25186
  const expected = gridWidth * gridHeight;
25146
- const grid = new Array(expected).fill(false);
25187
+ const grid = Array.from({ length: expected }).fill(false);
25147
25188
  const copyLen = Math.min(cells.length, expected);
25148
25189
  for (let i = 0; i < copyLen; i++) grid[i] = cells[i] === true;
25149
25190
  const blocks = [];
@@ -25225,6 +25266,164 @@ function bindAddonActions(api, addonId, catalog) {
25225
25266
  return out;
25226
25267
  }
25227
25268
  //#endregion
25269
+ //#region src/inference/runtime-capabilities.ts
25270
+ var AUTO = {
25271
+ value: "auto",
25272
+ label: "Auto"
25273
+ };
25274
+ var CPU = {
25275
+ value: "cpu",
25276
+ label: "CPU"
25277
+ };
25278
+ var RUNTIMES = [
25279
+ {
25280
+ id: "onnx",
25281
+ supports: () => true,
25282
+ devices: (hw) => {
25283
+ if (!hw) return [CPU];
25284
+ const out = [CPU];
25285
+ if (hw.gpu?.type === "nvidia") out.push({
25286
+ value: "cuda",
25287
+ label: "CUDA"
25288
+ });
25289
+ if (hw.npu?.type === "apple-ane") out.push({
25290
+ value: "coreml",
25291
+ label: "CoreML EP"
25292
+ });
25293
+ return out;
25294
+ },
25295
+ defaultDevice: "cpu"
25296
+ },
25297
+ {
25298
+ id: "openvino",
25299
+ supports: (hw) => hw?.arch === "x64" && hw.platform !== "darwin" && hw.gpu?.type === "intel",
25300
+ devices: (hw) => {
25301
+ if (!hw) return [AUTO];
25302
+ const out = [AUTO, CPU];
25303
+ if (hw.gpu?.type === "intel") out.push({
25304
+ value: "gpu",
25305
+ label: "GPU"
25306
+ });
25307
+ if (hw.npu?.type === "intel-npu") out.push({
25308
+ value: "npu",
25309
+ label: "NPU"
25310
+ });
25311
+ return out;
25312
+ },
25313
+ defaultDevice: "auto"
25314
+ },
25315
+ {
25316
+ id: "coreml",
25317
+ supports: (hw) => hw?.platform === "darwin",
25318
+ devices: (hw) => {
25319
+ const all = {
25320
+ value: "all",
25321
+ label: "All (ANE + GPU + CPU)"
25322
+ };
25323
+ if (!hw) return [all];
25324
+ const out = [all];
25325
+ if (hw.npu?.type === "apple-ane") out.push({
25326
+ value: "ane",
25327
+ label: "Apple Neural Engine"
25328
+ });
25329
+ out.push({
25330
+ value: "gpu",
25331
+ label: "GPU"
25332
+ }, CPU);
25333
+ return out;
25334
+ },
25335
+ defaultDevice: "all"
25336
+ }
25337
+ ];
25338
+ function def(id) {
25339
+ const d = RUNTIMES.find((r) => r.id === id);
25340
+ if (!d) throw new Error(`Unknown runtime: ${id}`);
25341
+ return d;
25342
+ }
25343
+ /**
25344
+ * Returns the list of supported runtime IDs for given hardware.
25345
+ * onnx is always included (universal floor); accelerators added when hw matches.
25346
+ */
25347
+ function supportedRuntimes(hw) {
25348
+ return RUNTIMES.filter((r) => r.supports(hw)).map((r) => r.id);
25349
+ }
25350
+ /**
25351
+ * Returns the device options for a given runtime and hardware probe.
25352
+ */
25353
+ function runtimeDevices(id, hw) {
25354
+ return def(id).devices(hw);
25355
+ }
25356
+ /**
25357
+ * Returns the default device string for a given runtime.
25358
+ * onnx → 'cpu', openvino → 'auto', coreml → 'all'
25359
+ */
25360
+ function defaultDeviceFor(id) {
25361
+ return def(id).defaultDevice;
25362
+ }
25363
+ /**
25364
+ * Returns the model format required for a given runtime.
25365
+ * Delegates to `formatForRuntime` from runtime-mapping.ts.
25366
+ */
25367
+ function modelFormatForRuntime(id) {
25368
+ return formatForRuntime(id);
25369
+ }
25370
+ /**
25371
+ * Scores all applicable inference backends for the given hardware.
25372
+ *
25373
+ * Rules (hardware-driven only — no Python import probes):
25374
+ * - coreml: score 95, darwin+arm64
25375
+ * - cuda: score 85, nvidia gpu
25376
+ * - openvino: score 90 if intel-npu present, else 80 if intel gpu
25377
+ * - cpu: score 50 (universal floor, always included)
25378
+ *
25379
+ * All hardware-matched entries are `available: true`.
25380
+ * Scores are sorted descending; `best` is the first available entry
25381
+ * (or last entry as fallback).
25382
+ */
25383
+ function scoreRuntimes(hw) {
25384
+ const scores = [];
25385
+ if (hw.platform === "darwin" && hw.arch === "arm64") scores.push({
25386
+ runtime: "python",
25387
+ backend: "coreml",
25388
+ format: "coreml",
25389
+ score: 95,
25390
+ reason: "Apple Neural Engine (Python CoreML)",
25391
+ available: true
25392
+ });
25393
+ if (hw.gpu?.type === "nvidia") scores.push({
25394
+ runtime: "python",
25395
+ backend: "cuda",
25396
+ format: "onnx",
25397
+ score: 85,
25398
+ reason: "NVIDIA CUDA (Python ONNX Runtime)",
25399
+ available: true
25400
+ });
25401
+ if (hw.gpu?.type === "intel") {
25402
+ const score = hw.npu?.type === "intel-npu" ? 90 : 80;
25403
+ scores.push({
25404
+ runtime: "python",
25405
+ backend: "openvino",
25406
+ format: "openvino",
25407
+ score,
25408
+ reason: "Intel OpenVINO",
25409
+ available: true
25410
+ });
25411
+ }
25412
+ scores.push({
25413
+ runtime: "python",
25414
+ backend: "cpu",
25415
+ format: "onnx",
25416
+ score: 50,
25417
+ reason: "CPU (Python ONNX Runtime)",
25418
+ available: true
25419
+ });
25420
+ const sorted = scores.toSorted((a, b) => b.score - a.score);
25421
+ return {
25422
+ scores: sorted,
25423
+ best: sorted.find((s) => s.available) ?? sorted[sorted.length - 1]
25424
+ };
25425
+ }
25426
+ //#endregion
25228
25427
  exports.ACCESSORY_LABEL = ACCESSORY_LABEL;
25229
25428
  exports.ALL_CAPABILITY_DEFINITIONS = ALL_CAPABILITY_DEFINITIONS;
25230
25429
  exports.APPLE_SA_TO_MACRO = APPLE_SA_TO_MACRO;
@@ -25316,6 +25515,7 @@ exports.CAM_PROFILE_ORDER = require_sleep.CAM_PROFILE_ORDER;
25316
25515
  exports.CAPABILITY_NAMES = CAPABILITY_NAMES;
25317
25516
  exports.CAPABILITY_ROUTER_KEYS = CAPABILITY_ROUTER_KEYS;
25318
25517
  exports.CAP_NAMES_WITH_STATUS = CAP_NAMES_WITH_STATUS;
25518
+ exports.CAP_NODE_PIN_CONTEXT_KEY = CAP_NODE_PIN_CONTEXT_KEY;
25319
25519
  exports.CAP_PROVIDER_KIND_MAP = CAP_PROVIDER_KIND_MAP;
25320
25520
  exports.COCO_80_LABELS = COCO_80_LABELS;
25321
25521
  exports.COCO_TO_MACRO = COCO_TO_MACRO;
@@ -25760,6 +25960,7 @@ exports.createSliceHandle = require_sleep.createSliceHandle;
25760
25960
  exports.createSystemProxy = createSystemProxy;
25761
25961
  exports.customAction = customAction;
25762
25962
  exports.decoderCapability = decoderCapability;
25963
+ exports.defaultDeviceFor = defaultDeviceFor;
25763
25964
  exports.defineCustomActions = defineCustomActions;
25764
25965
  exports.detectionPipelineCapability = detectionPipelineCapability;
25765
25966
  exports.deviceAdoptionCapability = deviceAdoptionCapability;
@@ -25831,6 +26032,7 @@ exports.meshNetworkCapability = meshNetworkCapability;
25831
26032
  exports.method = require_sleep.method;
25832
26033
  exports.metricsProviderCapability = metricsProviderCapability;
25833
26034
  exports.migrateConfigToBands = migrateConfigToBands;
26035
+ exports.modelFormatForRuntime = modelFormatForRuntime;
25834
26036
  exports.motionCapability = motionCapability;
25835
26037
  exports.motionDetectionCapability = motionDetectionCapability;
25836
26038
  exports.motionTriggerCapability = motionTriggerCapability;
@@ -25839,6 +26041,7 @@ exports.mqttBrokerCapability = mqttBrokerCapability;
25839
26041
  exports.nativeObjectDetectionCapability = nativeObjectDetectionCapability;
25840
26042
  exports.networkAccessCapability = networkAccessCapability;
25841
26043
  exports.networkQualityCapability = networkQualityCapability;
26044
+ exports.nodePin = nodePin;
25842
26045
  exports.nodesCapability = nodesCapability;
25843
26046
  exports.normalizeAddonInitResult = require_sleep.normalizeAddonInitResult;
25844
26047
  exports.normalizeUnit = normalizeUnit;
@@ -25868,6 +26071,7 @@ exports.privacyMaskCapability = privacyMaskCapability;
25868
26071
  exports.ptzAutotrackCapability = ptzAutotrackCapability;
25869
26072
  exports.ptzCapability = ptzCapability;
25870
26073
  exports.pythonScriptForBackend = pythonScriptForBackend;
26074
+ exports.readNodePin = readNodePin;
25871
26075
  exports.readinessKey = require_sleep.readinessKey;
25872
26076
  exports.rebootCapability = rebootCapability;
25873
26077
  exports.recordingCapability = recordingCapability;
@@ -25883,7 +26087,9 @@ exports.resolveModelFormat = resolveModelFormat;
25883
26087
  exports.resolveRunnerId = resolveRunnerId;
25884
26088
  exports.restreamerCapability = restreamerCapability;
25885
26089
  exports.runInferenceStep = runInferenceStep;
26090
+ exports.runtimeDevices = runtimeDevices;
25886
26091
  exports.scopeKey = require_sleep.scopeKey;
26092
+ exports.scoreRuntimes = scoreRuntimes;
25887
26093
  exports.scriptRunnerCapability = scriptRunnerCapability;
25888
26094
  exports.selectAssignedProfileSlots = require_sleep.selectAssignedProfileSlots;
25889
26095
  exports.setByPath = setByPath;
@@ -25904,6 +26110,7 @@ exports.streamParamsCapability = streamParamsCapability;
25904
26110
  exports.streamPixels = streamPixels;
25905
26111
  exports.streamQualityLabel = streamQualityLabel;
25906
26112
  exports.streamingEngineCapability = streamingEngineCapability;
26113
+ exports.supportedRuntimes = supportedRuntimes;
25907
26114
  exports.switchCapability = switchCapability;
25908
26115
  exports.synthesizeSourceInfo = synthesizeSourceInfo;
25909
26116
  exports.systemCapability = systemCapability;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as SubscribeFramesInputSchema, A as ReadinessTimeoutError, B as CameraStreamSchema, C as asNumber, D as parseJsonUnknown, E as parseJsonObject, F as BrokerStatusSchema, G as FrameHandleSchema, H as DecodedFrameSchema, I as CAM_PROFILE_ORDER, J as ProfileSlotStatusSchema, K as ProfileRtspEntrySchema, L as CamProfileSchema, M as readinessKey, N as scopeKey, O as DATAPLANE_SECRET_HEADER, P as BrokerStatsSchema, Q as SubscribeAudioChunksResultSchema, R as CamStreamKindSchema, S as asJsonObject, T as parseJsonArray, U as EncodedPacketSchema, V as DecodedAudioChunkSchema, W as FrameHandleFormatSchema, X as StreamSourceSchema, Y as StreamSourceEntrySchema, Z as SubscribeAudioChunksInputSchema, _ as DeviceFeature, a as adminUiCapability, at as BaseAddon, b as asBoolean, c as createMirrorSource, ct as createEvent, d as DEVICE_STATUS_METHOD, dt as WELL_KNOWN_TABS, et as SubscribeFramesResultSchema, f as event, ft as WELL_KNOWN_TAB_MAP, g as ChargingStatus, h as method, ht as DisposerChain, i as deviceOpsCapability, it as selectAssignedProfileSlots, j as emitDownForOwnedCaps, k as ReadinessRegistry, l as createSliceHandle, lt as emitReadiness, m as isDeviceConfigCap, mt as EventCategory, n as sleepCancellable, nt as makeSourceBrokerId, o as createDeviceProxy, ot as normalizeAddonInitResult, p as expandCapMethods, pt as hydrateSchema, q as ProfileSlotSchema, r as RawStateResultSchema, rt as parseProfileBrokerId, s as createLazyTrpcSource, st as createDurableState, t as sleep, tt as makeProfileBrokerId, u as DEVICE_SETTINGS_CONTRIBUTION_METHODS, ut as isEvent, v as DeviceRole, w as asString, x as asJsonArray, y as DeviceType, z as CamStreamResolutionSchema } from "./sleep-D7JeS58T.mjs";
1
+ import { $ as SubscribeFramesInputSchema, A as ReadinessTimeoutError, B as CameraStreamSchema, C as asNumber, D as parseJsonUnknown, E as parseJsonObject, F as BrokerStatusSchema, G as FrameHandleSchema, H as DecodedFrameSchema, I as CAM_PROFILE_ORDER, J as ProfileSlotStatusSchema, K as ProfileRtspEntrySchema, L as CamProfileSchema, M as readinessKey, N as scopeKey, O as DATAPLANE_SECRET_HEADER, P as BrokerStatsSchema, Q as SubscribeAudioChunksResultSchema, R as CamStreamKindSchema, S as asJsonObject, T as parseJsonArray, U as EncodedPacketSchema, V as DecodedAudioChunkSchema, W as FrameHandleFormatSchema, X as StreamSourceSchema, Y as StreamSourceEntrySchema, Z as SubscribeAudioChunksInputSchema, _ as DeviceFeature, a as adminUiCapability, at as BaseAddon, b as asBoolean, c as createMirrorSource, ct as createEvent, d as DEVICE_STATUS_METHOD, dt as WELL_KNOWN_TABS, et as SubscribeFramesResultSchema, f as event, ft as WELL_KNOWN_TAB_MAP, g as ChargingStatus, h as method, ht as DisposerChain, i as deviceOpsCapability, it as selectAssignedProfileSlots, j as emitDownForOwnedCaps, k as ReadinessRegistry, l as createSliceHandle, lt as emitReadiness, m as isDeviceConfigCap, mt as EventCategory, n as sleepCancellable, nt as makeSourceBrokerId, o as createDeviceProxy, ot as normalizeAddonInitResult, p as expandCapMethods, pt as hydrateSchema, q as ProfileSlotSchema, r as RawStateResultSchema, rt as parseProfileBrokerId, s as createLazyTrpcSource, st as createDurableState, t as sleep, tt as makeProfileBrokerId, u as DEVICE_SETTINGS_CONTRIBUTION_METHODS, ut as isEvent, v as DeviceRole, w as asString, x as asJsonArray, y as DeviceType, z as CamStreamResolutionSchema } from "./sleep-B1dKJAMJ.mjs";
2
2
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/health/wiring-health.ts
@@ -1135,6 +1135,47 @@ var RUNTIME_DEFAULTS = {
1135
1135
  "auth.tokenExpiry": "24h"
1136
1136
  };
1137
1137
  //#endregion
1138
+ //#region src/cap-call-context.ts
1139
+ /**
1140
+ * Per-call node pinning for `ctx.api` capability calls.
1141
+ *
1142
+ * A capability call normally resolves to its DEFAULT provider — a `singleton`
1143
+ * cap resolves to the hub, a device-scoped cap to the device's owning node. To
1144
+ * query a SPECIFIC node's provider instead (e.g. a remote agent's own
1145
+ * in-process `platform-probe` hardware, which the hub cannot probe), pin the
1146
+ * call to that node.
1147
+ *
1148
+ * The nodeId rides OUT-OF-BAND in the tRPC call context (NOT in the validated
1149
+ * method args), so capability method signatures stay `nodeId`-free — node
1150
+ * targeting is a property of the CALL, not of the method. The transport lifts
1151
+ * it from `op.context` onto the `CapCallInput.nodeId` field (`ipcParentLink`),
1152
+ * and the hub parent's `onUnownedCall` passes it to the `CapRouteResolver`,
1153
+ * which classifies a pinned agent node as `agent-child-forward`
1154
+ * (`$agent-cap-fwd.forward` → the agent's in-process provider).
1155
+ *
1156
+ * Usage at a call site:
1157
+ *
1158
+ * await api.platformProbe.getCapabilities.query(undefined, nodePin(nodeId))
1159
+ */
1160
+ /** tRPC `op.context` key carrying a per-call node pin. */
1161
+ var CAP_NODE_PIN_CONTEXT_KEY = "__camstackNodePin";
1162
+ /**
1163
+ * Build the tRPC request options that pin a single capability call to `nodeId`.
1164
+ * Pass as the second argument to `.query(input, …)` / `.mutate(input, …)`.
1165
+ */
1166
+ function nodePin(nodeId) {
1167
+ return { context: { [CAP_NODE_PIN_CONTEXT_KEY]: nodeId } };
1168
+ }
1169
+ /**
1170
+ * Read a per-call node pin out of a tRPC `op.context` (transport side).
1171
+ * Returns the pinned nodeId, or `undefined` when no pin is present.
1172
+ */
1173
+ function readNodePin(context) {
1174
+ if (context === null || typeof context !== "object") return void 0;
1175
+ const value = Reflect.get(context, CAP_NODE_PIN_CONTEXT_KEY);
1176
+ return typeof value === "string" ? value : void 0;
1177
+ }
1178
+ //#endregion
1138
1179
  //#region src/utils/hf-url.ts
1139
1180
  function hfModelUrl(repo, path) {
1140
1181
  return `https://huggingface.co/${repo}/resolve/main/${path}`;
@@ -25050,7 +25091,7 @@ function maskUrlCredentials(rawUrl) {
25050
25091
  u.password = "";
25051
25092
  touched = true;
25052
25093
  }
25053
- for (const key of [...u.searchParams.keys()]) if (isCredentialParam(key)) {
25094
+ for (const key of Array.from(u.searchParams.keys())) if (isCredentialParam(key)) {
25054
25095
  u.searchParams.set(key, "***");
25055
25096
  touched = true;
25056
25097
  }
@@ -25114,8 +25155,8 @@ var RingBuffer = class {
25114
25155
  */
25115
25156
  function rectsToCells(rects, gridWidth, gridHeight) {
25116
25157
  const total = gridWidth * gridHeight;
25117
- if (total <= 0 || rects.length === 0) return new Array(Math.max(0, total)).fill(false);
25118
- const cells = new Array(total).fill(false);
25158
+ if (total <= 0 || rects.length === 0) return Array.from({ length: Math.max(0, total) }).fill(false);
25159
+ const cells = Array.from({ length: total }).fill(false);
25119
25160
  for (let row = 0; row < gridHeight; row++) for (let col = 0; col < gridWidth; col++) {
25120
25161
  const cx = (col + .5) / gridWidth;
25121
25162
  const cy = (row + .5) / gridHeight;
@@ -25142,7 +25183,7 @@ function rectsToCells(rects, gridWidth, gridHeight) {
25142
25183
  function cellsToRects(cells, gridWidth, gridHeight, maxRegions) {
25143
25184
  if (gridWidth <= 0 || gridHeight <= 0 || maxRegions <= 0) return [];
25144
25185
  const expected = gridWidth * gridHeight;
25145
- const grid = new Array(expected).fill(false);
25186
+ const grid = Array.from({ length: expected }).fill(false);
25146
25187
  const copyLen = Math.min(cells.length, expected);
25147
25188
  for (let i = 0; i < copyLen; i++) grid[i] = cells[i] === true;
25148
25189
  const blocks = [];
@@ -25224,4 +25265,162 @@ function bindAddonActions(api, addonId, catalog) {
25224
25265
  return out;
25225
25266
  }
25226
25267
  //#endregion
25227
- export { ACCESSORY_LABEL, ALL_CAPABILITY_DEFINITIONS, APPLE_SA_TO_MACRO, AUDIO_BACKEND_CHOICES, AUDIO_MACRO_LABELS, AccessoriesStatusSchema, AccessoryKind, AddBrokerInputSchema, AddonAutoUpdateSchema, AddonListItemSchema, AddonPageDeclarationSchema, AddonPageInfoSchema, AdoptInputSchema as AdoptionAdoptInputSchema, AdoptResultSchema as AdoptionAdoptResultSchema, AdoptionFilterSchema, GetCandidateInputSchema as AdoptionGetCandidateInputSchema, ListCandidatesInputSchema as AdoptionListCandidatesInputSchema, ListCandidatesOutputSchema as AdoptionListCandidatesOutputSchema, ReleaseInputSchema as AdoptionReleaseInputSchema, AdoptionStatusSchema, AgentLoadSummarySchema, AirQualitySensorStatusSchema, AlarmArmModeSchema, AlarmPanelStatusSchema, AlarmStateSchema, AlertSchema, AlertSeveritySchema, AlertSourceSchema, AlertStatusSchema, AmbientLightSensorStatusSchema, ApiKeyRecordSchema, ApiKeySummarySchema, ArchiveEntrySchema, ArchiveManifestSchema, AudioAnalysisResultSchema, AudioAnalysisSettingsSchema, AudioChunkInputSchema, AudioClassSummarySchema, AudioClassificationLabelSchema, AudioClassificationResultSchema, AudioCodecInfoSchema, AudioDecodeSessionConfigSchema, AudioEncodeSchema, AudioEncodeSessionConfigSchema, AudioEncodedChunkSchema, AudioEventSchema, AudioLevelSchema, AudioMetricsHistoryPointSchema, AudioMetricsHistorySchema, AudioMetricsSnapshotSchema, AudioPcmChunkSchema, AuthResultSchema, AutoUpdateSettingsSchema, AutomationControlStatusSchema, AvailableIntegrationTypeSchema, BACKEND_TO_FORMAT, BATTERY_DEVICE_PROFILE, BackupDestinationInfoSchema, BackupEntrySchema, BaseAddon, BaseDevice, BaseDeviceProvider, BatteryStatusSchema, BinaryStatusSchema, BoundingBoxSchema, BrightnessStatusSchema, AddInputSchema as BrokerAddInputSchema, BrokerAudioClientSchema, BrokerClientsSchema, BrokerConnectionDetailsSchema, BrokerConsumerAttributionSchema, BrokerConsumerKindSchema, BrokerDecodedClientSchema, BrokerEncodedClientSchema, GetStateInputSchema as BrokerGetStateInputSchema, BrokerInfoSchema, BrokerProviderInfoSchema, PublishInputSchema as BrokerPublishInputSchema, RegistryStatusSchema as BrokerRegistryStatusSchema, BrokerRtspClientSchema, BrokerStatsSchema, BrokerStatusEnum, BrokerStatusSchema, SubscribeInputSchema as BrokerSubscribeInputSchema, SubscribeResultSchema as BrokerSubscribeResultSchema, TestConnectionResultSchema as BrokerTestConnectionResultSchema, UnsubscribeInputSchema as BrokerUnsubscribeInputSchema, CAM_PROFILE_ORDER, CAPABILITY_NAMES, CAPABILITY_ROUTER_KEYS, CAP_NAMES_WITH_STATUS, CAP_PROVIDER_KIND_MAP, COCO_80_LABELS, COCO_TO_MACRO, CamProfileSchema, CamStreamDescriptorSchema, CamStreamKindSchema, CamStreamResolutionSchema, CameraAssignmentStatusSchema, CameraAudioStatusSchema, CameraBrokerProfileSchema, CameraBrokerStatusSchema, CameraCredentialsSchema, CameraCredentialsStatusSchema, CameraDecoderShmSchema, CameraDecoderStatusSchema, CameraDetectionPhaseSchema, CameraDetectionProvisioningSchema, CameraDetectionProvisioningStateSchema, CameraDetectionStatusSchema, CameraMetricsSchema, CameraMetricsWithDeviceIdSchema, CameraMotionStatusSchema, CameraRecordingModeSchema, CameraRecordingStatusSchema, CameraSourceStatusSchema, CameraSourceStreamSchema, CameraStatusSchema, CameraStreamSchema, CandidateQueryFilterSchema, CapScopeSchema, CapabilityBindingsSchema, CarbonMonoxideStatusSchema, ChargingStatus, ClientNetworkStatsSchema, ClimateControlStatusSchema, ClipPlaybackSchema, ClipSchema, ClusterAddonNodeDeploymentSchema, ClusterAddonStatusEntrySchema, CollectionColumnSchema, CollectionIndexSchema, ColorStatusSchema, ConfigEntrySchema, ConfigSectionWithValuesSchema, ConfigTabDeclarationSchema, ConnectivityStatusSchema, ConsumableItemSchema, ConsumablesStatusSchema, ContactStatusSchema, ControlKindSchema, ControlStatusSchema, CoverStateSchema, CoverStatusSchema, CreateApiKeyInputSchema, CreateApiKeyResultSchema, CreateIntegrationInputSchema, CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, CreateUserInputSchema, CustomActionInputSchema, DATAPLANE_SECRET_HEADER, DEFAULT_ADDON_PLACEMENT, DEFAULT_AUDIO_ANALYZER_CONFIG, DEFAULT_DECODER_HWACCEL_CONFIG, DEFAULT_FEATURES, DEFAULT_RETENTION, DEVICE_CAP_NAMES, DEVICE_PROFILES, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATUS_METHOD, DEVICE_TYPE_INFO, DecodedAudioChunkSchema, DecodedFrameSchema, DecoderAssignmentSchema, DecoderSessionConfigSchema, DecoderStatsSchema, DeleteIntegrationResultSchema, DetectionSourceSchema, DetectorOutputSchema, DeviceConfig, DeviceDiscoveryStatusSchema, ExposeInputSchema as DeviceExportExposeInputSchema, DeviceExportStatusSchema, UnexposeInputSchema as DeviceExportUnexposeInputSchema, DeviceFeature, DeviceInfoSchema, DeviceNetworkStatsSchema, DeviceRole, DeviceRuntimeState, DeviceStatusSchema, DeviceType, DiscoveredChildDeviceSchema, DiscoveredChildStatusSchema, DiscoveredDeviceSchema, DisposerChain, DoorbellPressEventSchema, DoorbellStatusSchema, ElementConfigStore, EmbeddingInfoSchema, EmbeddingResultSchema, EncodeProfileSchema, EncodedPacketSchema, EnrichedWidgetMetadataSchema, EnumSensorDateTimeFormatSchema, EnumSensorStatusSchema, EventCategory, EventEmitterStatusSchema, EventFireSchema, EventItemSchema, EventKindSchema, EventSourceType, ExportSetupFieldSchema, ExportSetupSchema, ExposedDeviceSchema, ExposedResourceSchema, FanControlStatusSchema, FanDirectionSchema, FeatureManifestSchema, FeatureProbeStatusSchema, FloodStatusSchema, FrameHandleFormatSchema, FrameHandleSchema, FrameInputSchema, GasStatusSchema, GetStreamWithCodecInputSchema, GlobalMetricsSchema, HF_BASE_URL, HF_REPO, HWACCEL_OPTIONS, HealthStatusSchema, HistoryPointSchema, HistoryResolutionEnum, HumidifierStatusSchema, HumiditySensorStatusSchema, HvacModeSchema, ImageStatusSchema, InstalledPackageSchema, IntegrationLiteSchema, IntegrationWithStateSchema, IntercomAbilitySchema, IntercomStatusSchema, KNOWN_CAP_NAMES, LawnMowerActivitySchema, LawnMowerControlStatusSchema, LocateSegmentResultSchema, LocationStatSchema, LockControlStatusSchema, LockStateSchema, LogEntrySchema, LogLevelSchema, LogStreamEntrySchema, MACRO_LABELS, METHOD_ACCESS_MAP, MODEL_FORMATS, MaskGridDimsSchema, MaskGridShapeSchema, MaskLineShapeSchema, MaskPointSchema, MaskPolygonShapeSchema, MaskPolygonVerticesSchema, MaskRectShapeSchema, MaskShapeKindSchema, MaskShapeSchema, MediaFileSchema, MediaPlayerRepeatSchema, MediaPlayerStateSchema, MediaPlayerStatusSchema, MeshPeerSchema, MeshStatusSchema, MethodAccessSchema, MotionAnalysisResultSchema, MotionEventSchema, MotionOnMotionChangedDataSchema, MotionRegionSchema, MotionSourceEnum, MotionSourcesSchema, MotionStatusSchema, MotionTriggerRuntimeStateSchema, MotionTriggerStatusSchema, MotionZoneOptionsSchema, MotionZonePatchSchema, MotionZoneRegionSchema, MotionZoneStatusSchema, StatusSchema as MqttBrokerStatusSchema, NativeDetectionSchema, NativeObjectClassEnum, NativeObjectDetectionRuntimeStateSchema, NativeObjectDetectionStatusSchema, NetworkAccessStatusSchema, NetworkAddressSchema, NetworkEndpointSchema, NotificationHistoryEntrySchema, NotificationRuleSchema, NotificationSchema, NotifierStatusSchema, NumericSensorStatusSchema, OauthIntegrationDescriptorSchema, ObjectEventSchema, OrchestratorMetricsSchema, OsdOverlayKindEnum, OsdOverlayPatchSchema, OsdOverlaySchema, OsdPositionEnum, OsdStatusSchema, PIPELINE_FLOW_CAPABILITY_NAMES, PIPELINE_OWNER_CAPABILITY_NAMES, PROVIDER_KIND_CAP_NAMES, PYTHON_SCRIPT, PackageUpdateSchema, PackageVersionInfoSchema, PasskeySummarySchema, PcmSampleFormatSchema, PerScopeBreakdownSchema, PickStreamPreferencesSchema, PickStreamRequirementsSchema, PickedCamStreamSchema, PipelineAssignmentSchema, PipelineDefaultStepSchema, PipelineEngineChoiceSchema, PipelineRunResultBridge, PipelineStepInputSchema, PlaceholderReasonSchema, PolygonPointSchema, PowerMeterStatusSchema, PresenceStatusSchema, PressureSensorStatusSchema, PrivacyMaskOptionsSchema, PrivacyMaskPatchSchema, PrivacyMaskRegionSchema, PrivacyMaskShapeSchema, PrivacyMaskStatusSchema, ProfileRtspEntrySchema, ProfileSlotSchema, ProfileSlotStatusSchema, ProviderStatusSchema, PtzAutotrackRuntimeStateSchema, PtzAutotrackSettingsSchema, PtzAutotrackStatusSchema, PtzAutotrackTargetOptionSchema, PtzMoveCommandSchema, PtzPositionSchema, PtzPresetSchema, PtzStatusSchema, QueryFilterSchema, RECOGNITION_TYPES, RUNTIME_DEFAULTS, RUNTIME_TO_FORMAT, RawStateResultSchema, ReadSegmentBytesResultSchema, ReadinessRegistry, ReadinessTimeoutError, RecordingAvailabilitySchema, RecordingBandModeSchema, RecordingBandSchema, RecordingBandTriggersSchema, RecordingConfigSchema, RecordingDaysSchema, RecordingDeviceUsageSchema, RecordingLocationUsageSchema, RecordingManifestSchema, RecordingModeSchema, RecordingRangeSchema, RecordingRetentionSchema, RecordingRuleSchema, RecordingScheduleSchema, RecordingStatusSchema, RecordingStorageModeSchema, RecordingStorageUsageSchema, RecordingTriggersSchema, RecordingWeekdaySchema, RegisteredStreamSchema, ReportMotionInputSchema, RingBuffer, RtpSourceSchema, RtspRestreamEntrySchema, RunnerCameraConfigSchema, RunnerCameraDeviceUIFields, RunnerLocalLoadSchema, RunnerLocalMetricsSchema, SCOPE_PRESETS, SOURCE_INFO_METADATA_KEY, STREAM_PROFILE_META, STREAM_QUALITY_LABELS, SUB_DETECTION_TYPES, SYSTEM_CAP_NAMES, ScopedTokenSchema, ScopedTokenSummarySchema, ScriptRunnerStatusSchema, SearchResultSchema, SendEmailInputSchema, SendEmailResultSchema, SettingsPatchSchema, SettingsRecordSchema, SettingsSchemaWithValuesSchema, SettingsUpdateResultSchema, ShmRingStatsSchema, SmokeStatusSchema, SmtpStatusSchema, SnapshotImageSchema, SourceInfoSchema, SpatialDetectionSchema, SsoBridgeClaimsSchema, StartEmbeddedInputSchema, AbortUploadInputSchema as StorageAbortUploadInputSchema, BeginDownloadInputSchema as StorageBeginDownloadInputSchema, BeginDownloadResultSchema as StorageBeginDownloadResultSchema, BeginUploadInputSchema as StorageBeginUploadInputSchema, BeginUploadResultSchema as StorageBeginUploadResultSchema, EndDownloadInputSchema as StorageEndDownloadInputSchema, FinalizeUploadInputSchema as StorageFinalizeUploadInputSchema, StorageLocationDeclarationSchema, StorageLocationRefSchema, StorageLocationSchema, StorageLocationTypeSchema, ProviderInfoSchema as StorageProviderInfoSchema, ReadChunkInputSchema as StorageReadChunkInputSchema, TestLocationResultSchema as StorageTestLocationResultSchema, WriteChunkInputSchema as StorageWriteChunkInputSchema, StreamCodecSchema, StreamFormatSchema, StreamInfoSchema, StreamNetworkStatsSchema, StreamParamsOptionsSchema, StreamParamsStatusSchema, StreamProfileConfigSchema, StreamProfileOptionsSchema, StreamProfilePatchSchema, StreamProfileSchema, StreamSourceEntrySchema, StreamSourceSchema, SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, SubscribeFramesInputSchema, SubscribeFramesResultSchema, SwitchStatusSchema, SystemMetricsSchema, SystemMirror, TIMEZONES, TamperStatusSchema, TankStatusSchema, TemperatureSensorStatusSchema, TestConnectionResultSchema$1 as TestConnectionResultSchema, ToastSchema, TokenScopeSchema, TopologyNodeSchema, TopologyProcessSchema, TopologyServiceSchema, TrackSchema, TrackStateSchema, TrackedDetectionSchema, TurnServerSchema, BrokerInfoSchema$1 as UnifiedBrokerInfoSchema, UpdateIntegrationInputSchema, UpdateStatusSchema, UpdateUserInputSchema, UserRecordSchema, UserSummarySchema, VacuumControlStatusSchema, VacuumStateSchema, ValveStateSchema, ValveStatusSchema, VibrationStatusSchema, VideoEncodeSchema, WELL_KNOWN_TABS, WELL_KNOWN_TAB_MAP, WaterHeaterStatusSchema, WeatherStatusSchema, WebrtcStreamChoiceSchema, WebrtcStreamTargetSchema, WidgetHostEnum, WidgetMetadataSchema, WidgetRemoteSchema, WidgetSizeEnum, YAMNET_TO_MACRO, ZoneKindEnum, ZoneRuleModeEnum, ZoneRuleSchema, ZoneRuleStageEnum, ZoneRulesArraySchema, ZoneSchema, ZoneScopeBreakdownSchema, accessoriesCapability, accessoryStableId, addonPagesCapability, addonPagesSourceCapability, addonRoutesCapability, addonSettingsCapability, addonWidgetsCapability, addonWidgetsSourceCapability, addonsCapability, adminUiCapability, advancedNotifierCapability, airQualitySensorCapability, alarmPanelCapability, alertsCapability, ambientLightSensorCapability, applyTransform, asBoolean, asJsonArray, asJsonObject, asNumber, asString, audioAnalysisCapability, audioAnalyzerCapability, audioCodecCapability, audioMetricsCapability, authProviderCapability, autoAssignProfiles, automationControlCapability, backupCapability, batteryCapability, bestLocationMatch, binaryCapability, bindAddonActions, brightnessCapability, brokerCapability, buildAddonRouteProvider, buildStreamParamsConfigSchema, buttonCapability, cameraCredentialsCapability, cameraPipelineConfigCapability, cameraStreamsCapability, carbonMonoxideCapability, cellsToRects, classifyStream, classifyStreams, climateControlCapability, colorCapability, connectivityCapability, consumablesCapability, contactCapability, controlCapability, cosineSimilarity, coverCapability, createDeviceProxy, createDurableState, createEvent, createLazyTrpcSource, createMirrorSource, createRuntimeStateBridge, createSliceHandle, createSystemProxy, customAction, decoderCapability, defineCustomActions, detectionPipelineCapability, deviceAdoptionCapability, deviceCustomAction, deviceDiscoveryCapability, deviceExportCapability, deviceManagerCapability, deviceMatchesProfile, deviceOpsCapability, deviceProviderCapability, deviceStateCapability, deviceStatusCapability, doorbellCapability, embeddingEncoderCapability, emitDownForOwnedCaps, emitReadiness, encodeProfileFromStreamShape, enumSensorCapability, enumerateSchemaFields, errMsg, evaluateZoneRules, event, eventEmitterCapability, eventsCapability, expandCapMethods, extractSourceInfoFromMetadata, faceGalleryCapability, fanControlCapability, featureProbeCapability, filesystemBrowseCapability, findTimezone, floodCapability, formatForBackend, formatForRuntime, frameworkSwapConfirmSchema, frameworkSwapPackageSchema, gasCapability, getAudioMacroClassIds, getByPath, getCapsByProviderKind, hfModelUrl, humidifierCapability, humiditySensorCapability, hydrateSchema, imageCapability, integrationsCapability, intercomCapability, isAgentOnlyPlacement, isDeployableToAgent, isDeviceConfigCap, isEvent, jobKindSchema, lawnMowerControlCapability, lifecycleJobSchema, lifecycleJobScopeSchema, lifecycleJobStateSchema, lifecycleTaskSchema, localNetworkCapability, locationSimilarity, lockControlCapability, logDestinationCapability, makeProfileBrokerId, makeSourceBrokerId, mapAudioLabelToMacro, maskUrlCredentials, mediaPlayerCapability, mergeSourceInfo, meshNetworkCapability, method, metricsProviderCapability, migrateConfigToBands, motionCapability, motionDetectionCapability, motionTriggerCapability, motionZonesCapability, mqttBrokerCapability, nativeObjectDetectionCapability, networkAccessCapability, networkQualityCapability, nodesCapability, normalizeAddonInitResult, normalizeUnit, notificationOutputCapability, notifierCapability, numericSensorCapability, oauthIntegrationCapability, osdCapability, parseCameraStreamConfig, parseJsonArray, parseJsonObject, parseJsonUnknown, parseProfileBrokerId, parseStreamParamsFormPatch, pendingFrameworkSwapSchema, pickPreferredRtspEntry, pipelineAnalyticsCapability, pipelineExecutorCapability, pipelineOrchestratorCapability, pipelineRunnerCapability, plateGalleryCapability, platformProbeCapability, powerMeterCapability, presenceCapability, pressureSensorCapability, privacyMaskCapability, ptzAutotrackCapability, ptzCapability, pythonScriptForBackend, readinessKey, rebootCapability, recordingCapability, rectsToCells, requiresPython, resolveAddonExecution, resolveAddonGroup, resolveAddonPlacement, resolveAddonRuntime, resolveDetectionRuntime, resolveDeviceProfile, resolveModelFormat, resolveRunnerId, restreamerCapability, runInferenceStep, scopeKey, scriptRunnerCapability, selectAssignedProfileSlots, setByPath, settingsStoreCapability, sleep, sleepCancellable, smokeCapability, smtpProviderCapability, snapshotCapability, snapshotProviderCapability, ssoBridgeCapability, storageCapability, storageEvictableCapability, storageProviderCapability, streamBrokerCapability, streamCatalogCapability, streamParamsCapability, streamPixels, streamQualityLabel, streamingEngineCapability, switchCapability, synthesizeSourceInfo, systemCapability, tamperCapability, taskLogEntrySchema, taskPhaseSchema, taskTargetSchema, temperatureSensorCapability, toDeviceSummary, toStreamSourceEntry, toastCapability, turnProviderCapability, updateCapability, userManagementCapability, userPasskeysCapability, vacuumControlCapability, valveCapability, vibrationCapability, videoclipsCapability, waterHeaterCapability, weatherCapability, webrtcCapability, webrtcClientHintsSchema, webrtcSessionCapability, wiringAddonHealthSchema, wiringHealthSnapshotSchema, wiringNodeHealthSchema, wiringProbeKindSchema, wiringProbeResultSchema, zodEntriesToConfigUI, zoneAnalyticsCapability, zoneRulesCapability, zonesCapability };
25268
+ //#region src/inference/runtime-capabilities.ts
25269
+ var AUTO = {
25270
+ value: "auto",
25271
+ label: "Auto"
25272
+ };
25273
+ var CPU = {
25274
+ value: "cpu",
25275
+ label: "CPU"
25276
+ };
25277
+ var RUNTIMES = [
25278
+ {
25279
+ id: "onnx",
25280
+ supports: () => true,
25281
+ devices: (hw) => {
25282
+ if (!hw) return [CPU];
25283
+ const out = [CPU];
25284
+ if (hw.gpu?.type === "nvidia") out.push({
25285
+ value: "cuda",
25286
+ label: "CUDA"
25287
+ });
25288
+ if (hw.npu?.type === "apple-ane") out.push({
25289
+ value: "coreml",
25290
+ label: "CoreML EP"
25291
+ });
25292
+ return out;
25293
+ },
25294
+ defaultDevice: "cpu"
25295
+ },
25296
+ {
25297
+ id: "openvino",
25298
+ supports: (hw) => hw?.arch === "x64" && hw.platform !== "darwin" && hw.gpu?.type === "intel",
25299
+ devices: (hw) => {
25300
+ if (!hw) return [AUTO];
25301
+ const out = [AUTO, CPU];
25302
+ if (hw.gpu?.type === "intel") out.push({
25303
+ value: "gpu",
25304
+ label: "GPU"
25305
+ });
25306
+ if (hw.npu?.type === "intel-npu") out.push({
25307
+ value: "npu",
25308
+ label: "NPU"
25309
+ });
25310
+ return out;
25311
+ },
25312
+ defaultDevice: "auto"
25313
+ },
25314
+ {
25315
+ id: "coreml",
25316
+ supports: (hw) => hw?.platform === "darwin",
25317
+ devices: (hw) => {
25318
+ const all = {
25319
+ value: "all",
25320
+ label: "All (ANE + GPU + CPU)"
25321
+ };
25322
+ if (!hw) return [all];
25323
+ const out = [all];
25324
+ if (hw.npu?.type === "apple-ane") out.push({
25325
+ value: "ane",
25326
+ label: "Apple Neural Engine"
25327
+ });
25328
+ out.push({
25329
+ value: "gpu",
25330
+ label: "GPU"
25331
+ }, CPU);
25332
+ return out;
25333
+ },
25334
+ defaultDevice: "all"
25335
+ }
25336
+ ];
25337
+ function def(id) {
25338
+ const d = RUNTIMES.find((r) => r.id === id);
25339
+ if (!d) throw new Error(`Unknown runtime: ${id}`);
25340
+ return d;
25341
+ }
25342
+ /**
25343
+ * Returns the list of supported runtime IDs for given hardware.
25344
+ * onnx is always included (universal floor); accelerators added when hw matches.
25345
+ */
25346
+ function supportedRuntimes(hw) {
25347
+ return RUNTIMES.filter((r) => r.supports(hw)).map((r) => r.id);
25348
+ }
25349
+ /**
25350
+ * Returns the device options for a given runtime and hardware probe.
25351
+ */
25352
+ function runtimeDevices(id, hw) {
25353
+ return def(id).devices(hw);
25354
+ }
25355
+ /**
25356
+ * Returns the default device string for a given runtime.
25357
+ * onnx → 'cpu', openvino → 'auto', coreml → 'all'
25358
+ */
25359
+ function defaultDeviceFor(id) {
25360
+ return def(id).defaultDevice;
25361
+ }
25362
+ /**
25363
+ * Returns the model format required for a given runtime.
25364
+ * Delegates to `formatForRuntime` from runtime-mapping.ts.
25365
+ */
25366
+ function modelFormatForRuntime(id) {
25367
+ return formatForRuntime(id);
25368
+ }
25369
+ /**
25370
+ * Scores all applicable inference backends for the given hardware.
25371
+ *
25372
+ * Rules (hardware-driven only — no Python import probes):
25373
+ * - coreml: score 95, darwin+arm64
25374
+ * - cuda: score 85, nvidia gpu
25375
+ * - openvino: score 90 if intel-npu present, else 80 if intel gpu
25376
+ * - cpu: score 50 (universal floor, always included)
25377
+ *
25378
+ * All hardware-matched entries are `available: true`.
25379
+ * Scores are sorted descending; `best` is the first available entry
25380
+ * (or last entry as fallback).
25381
+ */
25382
+ function scoreRuntimes(hw) {
25383
+ const scores = [];
25384
+ if (hw.platform === "darwin" && hw.arch === "arm64") scores.push({
25385
+ runtime: "python",
25386
+ backend: "coreml",
25387
+ format: "coreml",
25388
+ score: 95,
25389
+ reason: "Apple Neural Engine (Python CoreML)",
25390
+ available: true
25391
+ });
25392
+ if (hw.gpu?.type === "nvidia") scores.push({
25393
+ runtime: "python",
25394
+ backend: "cuda",
25395
+ format: "onnx",
25396
+ score: 85,
25397
+ reason: "NVIDIA CUDA (Python ONNX Runtime)",
25398
+ available: true
25399
+ });
25400
+ if (hw.gpu?.type === "intel") {
25401
+ const score = hw.npu?.type === "intel-npu" ? 90 : 80;
25402
+ scores.push({
25403
+ runtime: "python",
25404
+ backend: "openvino",
25405
+ format: "openvino",
25406
+ score,
25407
+ reason: "Intel OpenVINO",
25408
+ available: true
25409
+ });
25410
+ }
25411
+ scores.push({
25412
+ runtime: "python",
25413
+ backend: "cpu",
25414
+ format: "onnx",
25415
+ score: 50,
25416
+ reason: "CPU (Python ONNX Runtime)",
25417
+ available: true
25418
+ });
25419
+ const sorted = scores.toSorted((a, b) => b.score - a.score);
25420
+ return {
25421
+ scores: sorted,
25422
+ best: sorted.find((s) => s.available) ?? sorted[sorted.length - 1]
25423
+ };
25424
+ }
25425
+ //#endregion
25426
+ export { ACCESSORY_LABEL, ALL_CAPABILITY_DEFINITIONS, APPLE_SA_TO_MACRO, AUDIO_BACKEND_CHOICES, AUDIO_MACRO_LABELS, AccessoriesStatusSchema, AccessoryKind, AddBrokerInputSchema, AddonAutoUpdateSchema, AddonListItemSchema, AddonPageDeclarationSchema, AddonPageInfoSchema, AdoptInputSchema as AdoptionAdoptInputSchema, AdoptResultSchema as AdoptionAdoptResultSchema, AdoptionFilterSchema, GetCandidateInputSchema as AdoptionGetCandidateInputSchema, ListCandidatesInputSchema as AdoptionListCandidatesInputSchema, ListCandidatesOutputSchema as AdoptionListCandidatesOutputSchema, ReleaseInputSchema as AdoptionReleaseInputSchema, AdoptionStatusSchema, AgentLoadSummarySchema, AirQualitySensorStatusSchema, AlarmArmModeSchema, AlarmPanelStatusSchema, AlarmStateSchema, AlertSchema, AlertSeveritySchema, AlertSourceSchema, AlertStatusSchema, AmbientLightSensorStatusSchema, ApiKeyRecordSchema, ApiKeySummarySchema, ArchiveEntrySchema, ArchiveManifestSchema, AudioAnalysisResultSchema, AudioAnalysisSettingsSchema, AudioChunkInputSchema, AudioClassSummarySchema, AudioClassificationLabelSchema, AudioClassificationResultSchema, AudioCodecInfoSchema, AudioDecodeSessionConfigSchema, AudioEncodeSchema, AudioEncodeSessionConfigSchema, AudioEncodedChunkSchema, AudioEventSchema, AudioLevelSchema, AudioMetricsHistoryPointSchema, AudioMetricsHistorySchema, AudioMetricsSnapshotSchema, AudioPcmChunkSchema, AuthResultSchema, AutoUpdateSettingsSchema, AutomationControlStatusSchema, AvailableIntegrationTypeSchema, BACKEND_TO_FORMAT, BATTERY_DEVICE_PROFILE, BackupDestinationInfoSchema, BackupEntrySchema, BaseAddon, BaseDevice, BaseDeviceProvider, BatteryStatusSchema, BinaryStatusSchema, BoundingBoxSchema, BrightnessStatusSchema, AddInputSchema as BrokerAddInputSchema, BrokerAudioClientSchema, BrokerClientsSchema, BrokerConnectionDetailsSchema, BrokerConsumerAttributionSchema, BrokerConsumerKindSchema, BrokerDecodedClientSchema, BrokerEncodedClientSchema, GetStateInputSchema as BrokerGetStateInputSchema, BrokerInfoSchema, BrokerProviderInfoSchema, PublishInputSchema as BrokerPublishInputSchema, RegistryStatusSchema as BrokerRegistryStatusSchema, BrokerRtspClientSchema, BrokerStatsSchema, BrokerStatusEnum, BrokerStatusSchema, SubscribeInputSchema as BrokerSubscribeInputSchema, SubscribeResultSchema as BrokerSubscribeResultSchema, TestConnectionResultSchema as BrokerTestConnectionResultSchema, UnsubscribeInputSchema as BrokerUnsubscribeInputSchema, CAM_PROFILE_ORDER, CAPABILITY_NAMES, CAPABILITY_ROUTER_KEYS, CAP_NAMES_WITH_STATUS, CAP_NODE_PIN_CONTEXT_KEY, CAP_PROVIDER_KIND_MAP, COCO_80_LABELS, COCO_TO_MACRO, CamProfileSchema, CamStreamDescriptorSchema, CamStreamKindSchema, CamStreamResolutionSchema, CameraAssignmentStatusSchema, CameraAudioStatusSchema, CameraBrokerProfileSchema, CameraBrokerStatusSchema, CameraCredentialsSchema, CameraCredentialsStatusSchema, CameraDecoderShmSchema, CameraDecoderStatusSchema, CameraDetectionPhaseSchema, CameraDetectionProvisioningSchema, CameraDetectionProvisioningStateSchema, CameraDetectionStatusSchema, CameraMetricsSchema, CameraMetricsWithDeviceIdSchema, CameraMotionStatusSchema, CameraRecordingModeSchema, CameraRecordingStatusSchema, CameraSourceStatusSchema, CameraSourceStreamSchema, CameraStatusSchema, CameraStreamSchema, CandidateQueryFilterSchema, CapScopeSchema, CapabilityBindingsSchema, CarbonMonoxideStatusSchema, ChargingStatus, ClientNetworkStatsSchema, ClimateControlStatusSchema, ClipPlaybackSchema, ClipSchema, ClusterAddonNodeDeploymentSchema, ClusterAddonStatusEntrySchema, CollectionColumnSchema, CollectionIndexSchema, ColorStatusSchema, ConfigEntrySchema, ConfigSectionWithValuesSchema, ConfigTabDeclarationSchema, ConnectivityStatusSchema, ConsumableItemSchema, ConsumablesStatusSchema, ContactStatusSchema, ControlKindSchema, ControlStatusSchema, CoverStateSchema, CoverStatusSchema, CreateApiKeyInputSchema, CreateApiKeyResultSchema, CreateIntegrationInputSchema, CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, CreateUserInputSchema, CustomActionInputSchema, DATAPLANE_SECRET_HEADER, DEFAULT_ADDON_PLACEMENT, DEFAULT_AUDIO_ANALYZER_CONFIG, DEFAULT_DECODER_HWACCEL_CONFIG, DEFAULT_FEATURES, DEFAULT_RETENTION, DEVICE_CAP_NAMES, DEVICE_PROFILES, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATUS_METHOD, DEVICE_TYPE_INFO, DecodedAudioChunkSchema, DecodedFrameSchema, DecoderAssignmentSchema, DecoderSessionConfigSchema, DecoderStatsSchema, DeleteIntegrationResultSchema, DetectionSourceSchema, DetectorOutputSchema, DeviceConfig, DeviceDiscoveryStatusSchema, ExposeInputSchema as DeviceExportExposeInputSchema, DeviceExportStatusSchema, UnexposeInputSchema as DeviceExportUnexposeInputSchema, DeviceFeature, DeviceInfoSchema, DeviceNetworkStatsSchema, DeviceRole, DeviceRuntimeState, DeviceStatusSchema, DeviceType, DiscoveredChildDeviceSchema, DiscoveredChildStatusSchema, DiscoveredDeviceSchema, DisposerChain, DoorbellPressEventSchema, DoorbellStatusSchema, ElementConfigStore, EmbeddingInfoSchema, EmbeddingResultSchema, EncodeProfileSchema, EncodedPacketSchema, EnrichedWidgetMetadataSchema, EnumSensorDateTimeFormatSchema, EnumSensorStatusSchema, EventCategory, EventEmitterStatusSchema, EventFireSchema, EventItemSchema, EventKindSchema, EventSourceType, ExportSetupFieldSchema, ExportSetupSchema, ExposedDeviceSchema, ExposedResourceSchema, FanControlStatusSchema, FanDirectionSchema, FeatureManifestSchema, FeatureProbeStatusSchema, FloodStatusSchema, FrameHandleFormatSchema, FrameHandleSchema, FrameInputSchema, GasStatusSchema, GetStreamWithCodecInputSchema, GlobalMetricsSchema, HF_BASE_URL, HF_REPO, HWACCEL_OPTIONS, HealthStatusSchema, HistoryPointSchema, HistoryResolutionEnum, HumidifierStatusSchema, HumiditySensorStatusSchema, HvacModeSchema, ImageStatusSchema, InstalledPackageSchema, IntegrationLiteSchema, IntegrationWithStateSchema, IntercomAbilitySchema, IntercomStatusSchema, KNOWN_CAP_NAMES, LawnMowerActivitySchema, LawnMowerControlStatusSchema, LocateSegmentResultSchema, LocationStatSchema, LockControlStatusSchema, LockStateSchema, LogEntrySchema, LogLevelSchema, LogStreamEntrySchema, MACRO_LABELS, METHOD_ACCESS_MAP, MODEL_FORMATS, MaskGridDimsSchema, MaskGridShapeSchema, MaskLineShapeSchema, MaskPointSchema, MaskPolygonShapeSchema, MaskPolygonVerticesSchema, MaskRectShapeSchema, MaskShapeKindSchema, MaskShapeSchema, MediaFileSchema, MediaPlayerRepeatSchema, MediaPlayerStateSchema, MediaPlayerStatusSchema, MeshPeerSchema, MeshStatusSchema, MethodAccessSchema, MotionAnalysisResultSchema, MotionEventSchema, MotionOnMotionChangedDataSchema, MotionRegionSchema, MotionSourceEnum, MotionSourcesSchema, MotionStatusSchema, MotionTriggerRuntimeStateSchema, MotionTriggerStatusSchema, MotionZoneOptionsSchema, MotionZonePatchSchema, MotionZoneRegionSchema, MotionZoneStatusSchema, StatusSchema as MqttBrokerStatusSchema, NativeDetectionSchema, NativeObjectClassEnum, NativeObjectDetectionRuntimeStateSchema, NativeObjectDetectionStatusSchema, NetworkAccessStatusSchema, NetworkAddressSchema, NetworkEndpointSchema, NotificationHistoryEntrySchema, NotificationRuleSchema, NotificationSchema, NotifierStatusSchema, NumericSensorStatusSchema, OauthIntegrationDescriptorSchema, ObjectEventSchema, OrchestratorMetricsSchema, OsdOverlayKindEnum, OsdOverlayPatchSchema, OsdOverlaySchema, OsdPositionEnum, OsdStatusSchema, PIPELINE_FLOW_CAPABILITY_NAMES, PIPELINE_OWNER_CAPABILITY_NAMES, PROVIDER_KIND_CAP_NAMES, PYTHON_SCRIPT, PackageUpdateSchema, PackageVersionInfoSchema, PasskeySummarySchema, PcmSampleFormatSchema, PerScopeBreakdownSchema, PickStreamPreferencesSchema, PickStreamRequirementsSchema, PickedCamStreamSchema, PipelineAssignmentSchema, PipelineDefaultStepSchema, PipelineEngineChoiceSchema, PipelineRunResultBridge, PipelineStepInputSchema, PlaceholderReasonSchema, PolygonPointSchema, PowerMeterStatusSchema, PresenceStatusSchema, PressureSensorStatusSchema, PrivacyMaskOptionsSchema, PrivacyMaskPatchSchema, PrivacyMaskRegionSchema, PrivacyMaskShapeSchema, PrivacyMaskStatusSchema, ProfileRtspEntrySchema, ProfileSlotSchema, ProfileSlotStatusSchema, ProviderStatusSchema, PtzAutotrackRuntimeStateSchema, PtzAutotrackSettingsSchema, PtzAutotrackStatusSchema, PtzAutotrackTargetOptionSchema, PtzMoveCommandSchema, PtzPositionSchema, PtzPresetSchema, PtzStatusSchema, QueryFilterSchema, RECOGNITION_TYPES, RUNTIME_DEFAULTS, RUNTIME_TO_FORMAT, RawStateResultSchema, ReadSegmentBytesResultSchema, ReadinessRegistry, ReadinessTimeoutError, RecordingAvailabilitySchema, RecordingBandModeSchema, RecordingBandSchema, RecordingBandTriggersSchema, RecordingConfigSchema, RecordingDaysSchema, RecordingDeviceUsageSchema, RecordingLocationUsageSchema, RecordingManifestSchema, RecordingModeSchema, RecordingRangeSchema, RecordingRetentionSchema, RecordingRuleSchema, RecordingScheduleSchema, RecordingStatusSchema, RecordingStorageModeSchema, RecordingStorageUsageSchema, RecordingTriggersSchema, RecordingWeekdaySchema, RegisteredStreamSchema, ReportMotionInputSchema, RingBuffer, RtpSourceSchema, RtspRestreamEntrySchema, RunnerCameraConfigSchema, RunnerCameraDeviceUIFields, RunnerLocalLoadSchema, RunnerLocalMetricsSchema, SCOPE_PRESETS, SOURCE_INFO_METADATA_KEY, STREAM_PROFILE_META, STREAM_QUALITY_LABELS, SUB_DETECTION_TYPES, SYSTEM_CAP_NAMES, ScopedTokenSchema, ScopedTokenSummarySchema, ScriptRunnerStatusSchema, SearchResultSchema, SendEmailInputSchema, SendEmailResultSchema, SettingsPatchSchema, SettingsRecordSchema, SettingsSchemaWithValuesSchema, SettingsUpdateResultSchema, ShmRingStatsSchema, SmokeStatusSchema, SmtpStatusSchema, SnapshotImageSchema, SourceInfoSchema, SpatialDetectionSchema, SsoBridgeClaimsSchema, StartEmbeddedInputSchema, AbortUploadInputSchema as StorageAbortUploadInputSchema, BeginDownloadInputSchema as StorageBeginDownloadInputSchema, BeginDownloadResultSchema as StorageBeginDownloadResultSchema, BeginUploadInputSchema as StorageBeginUploadInputSchema, BeginUploadResultSchema as StorageBeginUploadResultSchema, EndDownloadInputSchema as StorageEndDownloadInputSchema, FinalizeUploadInputSchema as StorageFinalizeUploadInputSchema, StorageLocationDeclarationSchema, StorageLocationRefSchema, StorageLocationSchema, StorageLocationTypeSchema, ProviderInfoSchema as StorageProviderInfoSchema, ReadChunkInputSchema as StorageReadChunkInputSchema, TestLocationResultSchema as StorageTestLocationResultSchema, WriteChunkInputSchema as StorageWriteChunkInputSchema, StreamCodecSchema, StreamFormatSchema, StreamInfoSchema, StreamNetworkStatsSchema, StreamParamsOptionsSchema, StreamParamsStatusSchema, StreamProfileConfigSchema, StreamProfileOptionsSchema, StreamProfilePatchSchema, StreamProfileSchema, StreamSourceEntrySchema, StreamSourceSchema, SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, SubscribeFramesInputSchema, SubscribeFramesResultSchema, SwitchStatusSchema, SystemMetricsSchema, SystemMirror, TIMEZONES, TamperStatusSchema, TankStatusSchema, TemperatureSensorStatusSchema, TestConnectionResultSchema$1 as TestConnectionResultSchema, ToastSchema, TokenScopeSchema, TopologyNodeSchema, TopologyProcessSchema, TopologyServiceSchema, TrackSchema, TrackStateSchema, TrackedDetectionSchema, TurnServerSchema, BrokerInfoSchema$1 as UnifiedBrokerInfoSchema, UpdateIntegrationInputSchema, UpdateStatusSchema, UpdateUserInputSchema, UserRecordSchema, UserSummarySchema, VacuumControlStatusSchema, VacuumStateSchema, ValveStateSchema, ValveStatusSchema, VibrationStatusSchema, VideoEncodeSchema, WELL_KNOWN_TABS, WELL_KNOWN_TAB_MAP, WaterHeaterStatusSchema, WeatherStatusSchema, WebrtcStreamChoiceSchema, WebrtcStreamTargetSchema, WidgetHostEnum, WidgetMetadataSchema, WidgetRemoteSchema, WidgetSizeEnum, YAMNET_TO_MACRO, ZoneKindEnum, ZoneRuleModeEnum, ZoneRuleSchema, ZoneRuleStageEnum, ZoneRulesArraySchema, ZoneSchema, ZoneScopeBreakdownSchema, accessoriesCapability, accessoryStableId, addonPagesCapability, addonPagesSourceCapability, addonRoutesCapability, addonSettingsCapability, addonWidgetsCapability, addonWidgetsSourceCapability, addonsCapability, adminUiCapability, advancedNotifierCapability, airQualitySensorCapability, alarmPanelCapability, alertsCapability, ambientLightSensorCapability, applyTransform, asBoolean, asJsonArray, asJsonObject, asNumber, asString, audioAnalysisCapability, audioAnalyzerCapability, audioCodecCapability, audioMetricsCapability, authProviderCapability, autoAssignProfiles, automationControlCapability, backupCapability, batteryCapability, bestLocationMatch, binaryCapability, bindAddonActions, brightnessCapability, brokerCapability, buildAddonRouteProvider, buildStreamParamsConfigSchema, buttonCapability, cameraCredentialsCapability, cameraPipelineConfigCapability, cameraStreamsCapability, carbonMonoxideCapability, cellsToRects, classifyStream, classifyStreams, climateControlCapability, colorCapability, connectivityCapability, consumablesCapability, contactCapability, controlCapability, cosineSimilarity, coverCapability, createDeviceProxy, createDurableState, createEvent, createLazyTrpcSource, createMirrorSource, createRuntimeStateBridge, createSliceHandle, createSystemProxy, customAction, decoderCapability, defaultDeviceFor, defineCustomActions, detectionPipelineCapability, deviceAdoptionCapability, deviceCustomAction, deviceDiscoveryCapability, deviceExportCapability, deviceManagerCapability, deviceMatchesProfile, deviceOpsCapability, deviceProviderCapability, deviceStateCapability, deviceStatusCapability, doorbellCapability, embeddingEncoderCapability, emitDownForOwnedCaps, emitReadiness, encodeProfileFromStreamShape, enumSensorCapability, enumerateSchemaFields, errMsg, evaluateZoneRules, event, eventEmitterCapability, eventsCapability, expandCapMethods, extractSourceInfoFromMetadata, faceGalleryCapability, fanControlCapability, featureProbeCapability, filesystemBrowseCapability, findTimezone, floodCapability, formatForBackend, formatForRuntime, frameworkSwapConfirmSchema, frameworkSwapPackageSchema, gasCapability, getAudioMacroClassIds, getByPath, getCapsByProviderKind, hfModelUrl, humidifierCapability, humiditySensorCapability, hydrateSchema, imageCapability, integrationsCapability, intercomCapability, isAgentOnlyPlacement, isDeployableToAgent, isDeviceConfigCap, isEvent, jobKindSchema, lawnMowerControlCapability, lifecycleJobSchema, lifecycleJobScopeSchema, lifecycleJobStateSchema, lifecycleTaskSchema, localNetworkCapability, locationSimilarity, lockControlCapability, logDestinationCapability, makeProfileBrokerId, makeSourceBrokerId, mapAudioLabelToMacro, maskUrlCredentials, mediaPlayerCapability, mergeSourceInfo, meshNetworkCapability, method, metricsProviderCapability, migrateConfigToBands, modelFormatForRuntime, motionCapability, motionDetectionCapability, motionTriggerCapability, motionZonesCapability, mqttBrokerCapability, nativeObjectDetectionCapability, networkAccessCapability, networkQualityCapability, nodePin, nodesCapability, normalizeAddonInitResult, normalizeUnit, notificationOutputCapability, notifierCapability, numericSensorCapability, oauthIntegrationCapability, osdCapability, parseCameraStreamConfig, parseJsonArray, parseJsonObject, parseJsonUnknown, parseProfileBrokerId, parseStreamParamsFormPatch, pendingFrameworkSwapSchema, pickPreferredRtspEntry, pipelineAnalyticsCapability, pipelineExecutorCapability, pipelineOrchestratorCapability, pipelineRunnerCapability, plateGalleryCapability, platformProbeCapability, powerMeterCapability, presenceCapability, pressureSensorCapability, privacyMaskCapability, ptzAutotrackCapability, ptzCapability, pythonScriptForBackend, readNodePin, readinessKey, rebootCapability, recordingCapability, rectsToCells, requiresPython, resolveAddonExecution, resolveAddonGroup, resolveAddonPlacement, resolveAddonRuntime, resolveDetectionRuntime, resolveDeviceProfile, resolveModelFormat, resolveRunnerId, restreamerCapability, runInferenceStep, runtimeDevices, scopeKey, scoreRuntimes, scriptRunnerCapability, selectAssignedProfileSlots, setByPath, settingsStoreCapability, sleep, sleepCancellable, smokeCapability, smtpProviderCapability, snapshotCapability, snapshotProviderCapability, ssoBridgeCapability, storageCapability, storageEvictableCapability, storageProviderCapability, streamBrokerCapability, streamCatalogCapability, streamParamsCapability, streamPixels, streamQualityLabel, streamingEngineCapability, supportedRuntimes, switchCapability, synthesizeSourceInfo, systemCapability, tamperCapability, taskLogEntrySchema, taskPhaseSchema, taskTargetSchema, temperatureSensorCapability, toDeviceSummary, toStreamSourceEntry, toastCapability, turnProviderCapability, updateCapability, userManagementCapability, userPasskeysCapability, vacuumControlCapability, valveCapability, vibrationCapability, videoclipsCapability, waterHeaterCapability, weatherCapability, webrtcCapability, webrtcClientHintsSchema, webrtcSessionCapability, wiringAddonHealthSchema, wiringHealthSnapshotSchema, wiringNodeHealthSchema, wiringProbeKindSchema, wiringProbeResultSchema, zodEntriesToConfigUI, zoneAnalyticsCapability, zoneRulesCapability, zonesCapability };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Hardware-driven inference runtime capabilities — SINGLE SOURCE OF TRUTH.
3
+ *
4
+ * Pure module: no I/O, no subprocess, no Python import.
5
+ * Consumed by both `platform-probe` (@camstack/system) and
6
+ * `detection-pipeline` (@camstack/addon-pipeline).
7
+ *
8
+ * Do NOT import from @camstack/system or @camstack/addon-pipeline.
9
+ */
10
+ import type { ModelFormat } from '../types/models.js';
11
+ import type { HardwareInfo, PlatformScore } from '../interfaces/platform.js';
12
+ export type RuntimeId = 'onnx' | 'openvino' | 'coreml';
13
+ export interface DeviceOption {
14
+ readonly value: string;
15
+ readonly label: string;
16
+ }
17
+ /**
18
+ * Returns the list of supported runtime IDs for given hardware.
19
+ * onnx is always included (universal floor); accelerators added when hw matches.
20
+ */
21
+ export declare function supportedRuntimes(hw: HardwareInfo | null): readonly RuntimeId[];
22
+ /**
23
+ * Returns the device options for a given runtime and hardware probe.
24
+ */
25
+ export declare function runtimeDevices(id: RuntimeId, hw: HardwareInfo | null): readonly DeviceOption[];
26
+ /**
27
+ * Returns the default device string for a given runtime.
28
+ * onnx → 'cpu', openvino → 'auto', coreml → 'all'
29
+ */
30
+ export declare function defaultDeviceFor(id: RuntimeId): string;
31
+ /**
32
+ * Returns the model format required for a given runtime.
33
+ * Delegates to `formatForRuntime` from runtime-mapping.ts.
34
+ */
35
+ export declare function modelFormatForRuntime(id: RuntimeId): ModelFormat;
36
+ interface ScoreRuntimesResult {
37
+ readonly scores: readonly PlatformScore[];
38
+ readonly best: PlatformScore;
39
+ }
40
+ /**
41
+ * Scores all applicable inference backends for the given hardware.
42
+ *
43
+ * Rules (hardware-driven only — no Python import probes):
44
+ * - coreml: score 95, darwin+arm64
45
+ * - cuda: score 85, nvidia gpu
46
+ * - openvino: score 90 if intel-npu present, else 80 if intel gpu
47
+ * - cpu: score 50 (universal floor, always included)
48
+ *
49
+ * All hardware-matched entries are `available: true`.
50
+ * Scores are sorted descending; `best` is the first available entry
51
+ * (or last entry as fallback).
52
+ */
53
+ export declare function scoreRuntimes(hw: HardwareInfo): ScoreRuntimesResult;
54
+ export {};
@@ -706,8 +706,8 @@ export interface ICamstackAddon {
706
706
  * consumed by override-mode UIs (benchmark) so cascade-aware
707
707
  * addons can re-derive dependent options without touching the
708
708
  * persisted store. */
709
- getGlobalSettings?(overlay?: Record<string, unknown>, cap?: string): Promise<ConfigUISchemaWithValues>;
710
- updateGlobalSettings?(patch: Record<string, unknown>): Promise<void>;
709
+ getGlobalSettings?(overlay?: Record<string, unknown>, cap?: string, nodeId?: string): Promise<ConfigUISchemaWithValues | null>;
710
+ updateGlobalSettings?(patch: Record<string, unknown>, nodeId?: string): Promise<void>;
711
711
  /** Level 2 — per-device settings (schema + values). Appears in
712
712
  * Device Overrides. */
713
713
  getDeviceSettings?(deviceId: number): Promise<ConfigUISchemaWithValues>;
@@ -1070,7 +1070,7 @@ var BaseAddon = class {
1070
1070
  deviceSettingsSchema() {
1071
1071
  return null;
1072
1072
  }
1073
- async getGlobalSettings(overlay, cap) {
1073
+ async getGlobalSettings(overlay, cap, _nodeId) {
1074
1074
  const schema = this.globalSettingsSchema(cap);
1075
1075
  if (!schema) return { sections: [] };
1076
1076
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
@@ -1079,7 +1079,7 @@ var BaseAddon = class {
1079
1079
  ...overlay
1080
1080
  } : raw);
1081
1081
  }
1082
- async updateGlobalSettings(patch) {
1082
+ async updateGlobalSettings(patch, _nodeId) {
1083
1083
  await this._ctx?.settings?.writeAddonStore(patch);
1084
1084
  await this.resolveConfig();
1085
1085
  await this.onConfigChanged();
@@ -1070,7 +1070,7 @@ var BaseAddon = class {
1070
1070
  deviceSettingsSchema() {
1071
1071
  return null;
1072
1072
  }
1073
- async getGlobalSettings(overlay, cap) {
1073
+ async getGlobalSettings(overlay, cap, _nodeId) {
1074
1074
  const schema = this.globalSettingsSchema(cap);
1075
1075
  if (!schema) return { sections: [] };
1076
1076
  const raw = await this._ctx?.settings?.readAddonStore() ?? {};
@@ -1079,7 +1079,7 @@ var BaseAddon = class {
1079
1079
  ...overlay
1080
1080
  } : raw);
1081
1081
  }
1082
- async updateGlobalSettings(patch) {
1082
+ async updateGlobalSettings(patch, _nodeId) {
1083
1083
  await this._ctx?.settings?.writeAddonStore(patch);
1084
1084
  await this.resolveConfig();
1085
1085
  await this.onConfigChanged();
@@ -8,9 +8,17 @@ export interface ModelFormatEntry {
8
8
  /** Whether this format is a directory bundle (e.g., .mlpackage) rather than a single file */
9
9
  readonly isDirectory?: boolean;
10
10
  /**
11
- * For directory formats: list of files relative to the directory root.
12
- * The downloader fetches each file from `{url}/{file}` and saves to `{modelDir}/{file}`.
13
- * If omitted for a directory format, the downloader probes HuggingFace API (slower).
11
+ * Multi-file format payload.
12
+ *
13
+ * - Directory formats (`isDirectory: true`, e.g. `.mlpackage`): files
14
+ * relative to the directory root — the downloader fetches each from
15
+ * `{url}/{file}` into `{modelDir}/{file}`. If omitted, it probes the
16
+ * HuggingFace API (slower).
17
+ * - Single-file formats (no `isDirectory`, e.g. OpenVINO IR): sibling
18
+ * files fetched from the SAME remote directory as `url` and stored flat
19
+ * alongside the main file — e.g. `['camstack-yolov9t.bin']` for the IR
20
+ * weights next to `camstack-yolov9t.xml`. Keeps the format convention in
21
+ * the catalog data instead of the downloader code.
14
22
  */
15
23
  readonly files?: readonly string[];
16
24
  /** Runtime(s) that can use this format. If omitted, inferred from ModelFormat key */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.0.6",
3
+ "version": "1.1.0",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",