device-ops
Each worker that hosts live IDevice instances auto-registers a native provider for this cap (per device) backed by its local DeviceRegistry.
Each worker that hosts live IDevice instances auto-registers a native provider for this cap (per device) backed by its local DeviceRegistry. Hub-side callers reach it transparently through ctx.fetchDevice(id).deviceOps.* — the DeviceProxy injects deviceId + nodeId and dispatches through the standard cap-router, so there's no parallel bridge path anymore.
The surface is intentionally small — every method corresponds to a single action on the live IDevice (or ICameraDevice for getStreamSources). Richer orchestration (enable/disable with integration plumbing, bulk updates) stays in the device-manager cap; device-ops is the per-device primitive the device-manager routes to.
At a glance
| Capability | device-ops |
| Provided by | The device's own driver provides it: each device registers its own provider. |
| Active providers per device | one |
| Device types | any (no device type declared) |
| Source | packages/types/src/capabilities/device-ops.cap.ts |
Methods
Every method takes the device id (deviceId) to address the device; the input tables below list the other fields.
| Method | Kind | Required of a provider | Access |
|---|---|---|---|
getStreamSources | query | yes | default |
getConfigEntries | query | yes | default |
setConfig | mutation | yes | admin |
runAction | mutation | yes | default |
removeDevice | mutation | yes | admin |
getSettingsSchema | query | yes | default |
getRawState | query | yes | protected |
getStreamSources
query
Return stream sources for camera-like devices. Non-camera devices return an empty array (the bridge did the same; preserved for compat).
Input
No fields besides deviceId.
Output
({ id: string; label: string; protocol: "rtsp" | "rtmp" | "annexb" | "http-mjpeg" | "webrtc" | "custom"; url?: string; resolution?: { width: number; height: number }; fps?: number; bitrate?: number; codec?: string; profi…
getConfigEntries
query
Return the device's config entries (key + current value). Used by the device-manager aggregator when reading the driver's schema+values.
Input
No fields besides deviceId.
Output
({ key: string; value: unknown })[]
setConfig
mutation
Bulk-apply a config patch via IDevice.config.setAll. Covers the updateConfig / setStreamProfileMap / enable-as-config paths from the old bridge.
Input
| Field | Type | Required | Description |
|---|---|---|---|
values | Record<string, unknown> | yes |
Output
Nothing.
runAction
mutation
Invoke a device custom action on a forked/remote device (the cross-process transport for IDevice.runDeviceAction). Mirrors setConfig — the device-manager calls this when the device is not hub-local.
Input
| Field | Type | Required | Description |
|---|---|---|---|
action | string | yes | |
input | unknown | yes |
Output
unknown
removeDevice
mutation
Invoke IDevice.removeDevice() so the driver can release resources (close sockets, stop background tasks, …). The device-manager still performs its own persistence cleanup before/after this call.
Admin: the driver-cleanup half of a deletion. The public path is deviceManager.removeDevice, which runs persistence cleanup too.
Input
No fields besides deviceId.
Output
Nothing.
getSettingsSchema
query
Build the ConfigUISchema (FormBuilder input shape) from the device's Zod config schema. Runs on the worker that owns the IDevice so the Zod types stay local (they're function references, not serializable). Returns a fully JSON-serializable schema with sections/fields the admin UI renders directly.
Needed because the hub-side device-manager.getSettingsSchema couldn't reach forked-worker devices — it had no registry entry and no cross-process lookup, so the UI silently rendered an empty settings panel for every worker-owned device.
Returns null when the device isn't found on this worker.
Input
No fields besides deviceId.
Output
unknown | null
getRawState
query
Opt-in: return the device's RAW upstream state (the provider's cached values) as a display-safe { source, data } blob. Returns null when the device exposes no raw state — the State panel hides its Raw toggle in that case. One-shot (read the provider's existing cache; no upstream round-trip).
Input
No fields besides deviceId.
Output
| Field | Type | Required | Description |
|---|---|---|---|
source | string | yes | |
data | Record<string, unknown> | yes |