zone-rules
Zone rules capability — per-camera CRUD over the { arrays that decide how each pipeline stage uses the polygon zones.
Zone rules capability — per-camera CRUD over the { arrays that decide how each pipeline stage uses the polygon zones.
Hosted by addon-pipeline-orchestrator alongside the zones provider so the operator has a single hub-side source of truth for both geometry and behaviour. Per-stage rules are stored under the zoneRules.<stage> key in the orchestrator's per-device store and mirrored to the device-state slice <stage>-zone-rules on every mutation; consumer addons (analytics, motion-wasm, pipeline-executor) subscribe to that slice and refresh their gating without round-tripping the cap.
Sets are bulk-replace — the operator UI sends the new rule list wholesale, so reordering / batch enable-toggle / drag-drop CRUD lives naturally in the rule editor without per-rule mutation chatter.
At a glance
| Capability | zone-rules |
| Provided by | One addon provides it for every device and answers by device id. |
| Active providers per device | one |
| Device types | camera |
| Source | packages/types/src/capabilities/zone-rules.cap.ts |
Methods
Every method takes the device id (deviceId) to address the device; the input tables below list the other fields.
listRules
query
Read the full rule list for a given stage (empty when no rules are defined yet).
Input
| Field | Type | Required | Description |
|---|---|---|---|
stage | "motion" | "detection" | "package" | yes |
Output
({ id: string; name?: string; zoneIds: string[]; mode: "include" | "exclude"; classFilter?: string[]; overlapThreshold?: number; bboxInclusionPct?: number; preferMask?: boolean; enabled?: boolean; detectBySceneDifference…
setRules
mutation
Bulk-replace the rule list for one stage. The provider validates each entry against { thresholds in range) and rejects the whole patch if any entry is invalid — partial writes are a configuration footgun.
Input
| Field | Type | Required | Description |
|---|---|---|---|
stage | "motion" | "detection" | "package" | yes | |
rules | ({ id: string; name?: string; zoneIds: string[]; mode: "include" | "exclude"; classFilter?: string[]; overlapThreshold?: number; bboxInclusionPct?: number; preferMask?: boolean; enabled?: boolean; detectBySceneDifference… | yes |
Output
Nothing.
Runtime state
The state Dominevo keeps for each device with this capability, readable without calling the provider.
Runtime-state slice — every stage mirrored together so consumers see one reactive handle (device.state.zoneRules.value) instead of one per stage. Bulk-replace mutations on any stage write the full {motion, detection, package} shape, so subscribers always get the complete current set. Consumers that only care about one stage just read the matching property.
package backs the package-drop detector — a package zone is a ZoneRule on the 'package' stage referencing drawn polygons (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1). The orchestrator provider writes this stage as a first-class slice (Phase 4): every mutation mirrors the full {motion, detection, package} shape, so consumers read the current package rules directly off device.state.zoneRules.value.package.
| Field | Type | Required | Description |
|---|---|---|---|
motion | ({ id: string; name?: string; zoneIds: string[]; mode: "include" | "exclude"; classFilter?: string[]; overlapThreshold?: number; bboxInclusionPct?: number; preferMask?: boolean; enabled?: boolean; detectBySceneDifference… | yes | |
detection | ({ id: string; name?: string; zoneIds: string[]; mode: "include" | "exclude"; classFilter?: string[]; overlapThreshold?: number; bboxInclusionPct?: number; preferMask?: boolean; enabled?: boolean; detectBySceneDifference… | yes | |
package | ({ id: string; name?: string; zoneIds: string[]; mode: "include" | "exclude"; classFilter?: string[]; overlapThreshold?: number; bboxInclusionPct?: number; preferMask?: boolean; enabled?: boolean; detectBySceneDifference… | yes |