device-extension
device-extension — ONE place to see and author what a device is extended with by OTHER devices.
device-extension — ONE place to see and author what a device is extended with by OTHER devices.
A contract, not a store. Every slot (today one: linked-devices) is declared by the cap that owns the function and SERVED by the addon that already owns its store, over that store and its existing write path.
Its providers are the slot owners (today device-manager alone), and a device's sources are its bindings (step 0 of getBindings, derived, persisted nowhere).
listSlots— fan-out, concatenated. A provider that throws becomes ONEunreachablerow naming it, never an absence: "no extensions" is claimed only from an answer.listCandidates/setSlot— scalar, routed byslotRef(<source>:<slotId>). An unclaimed ref is refused by name.
The slot's value travels as the generated discriminated union (ExtensionSlotValue, keyed on slot), so a value under the wrong slot is a schema error before it reaches any owner.
Associations only. A slot LISTS other devices on its host. A host that GAINS a capability from other devices is a composition.
At a glance
| Capability | device-extension |
| Provided by | An addon wraps the device and provides it. It is bound to a device through the device bindings and can be bound automatically to compatible devices. |
| Active providers per device | several (every registered provider stays active) |
| Device types | camera |
| Device settings | Yes: its settings section on the device page is built from this capability's methods. |
| Source | packages/types/src/capabilities/device-extension.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 |
|---|---|---|---|
listSources | query | yes | default |
listSlots | query | yes | default |
listCandidates | query | yes | default |
setSlot | mutation | yes | admin |
listSources
query
Input
No fields besides deviceId.
Output
({ source: string; label: string; addonId?: string; availability: { state: "ok" } | { state: "unreachable"; reason: string } })[]
listSlots
query
Every slot this device is offered, read by each owner from its own store. A provider that throws is ONE unreachable row.
Input
No fields besides deviceId.
Output
({ state: "ok"; slotRef: string; slot: "linked-devices"; authority: string; activation: { state: "active" | "inactive" | "unknown"; authority: string; detail?: string } | null; value: { deviceIds: number[]; trackedDevice…
listCandidates
query
The devices the slot's editor may offer, suggestions pre-marked.
Input
| Field | Type | Required | Description |
|---|---|---|---|
slotRef | string | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
candidates | ({ deviceId: number; name: string; type: string; location: string | null; parentName: string | null; suggested: boolean; reason: string | null })[] | yes |
setSlot
mutation
Write one slot through its owner's EXISTING write path. The owner validates (a container is never a linked device, a camera is never its own source) and refuses by name before persisting.
Input
| Field | Type | Required | Description |
|---|---|---|---|
slotRef | string | yes | |
value | { deviceIds: number[]; trackedDeviceIds?: number[]; slot: "linked-devices" } | yes |
Output
What a write did. none — applied in place. host / parent — the owner reloaded the host (or, for an accessory child, its parent) because the write changed what the host REGISTERS. A slot never adds a capability to its host — that is a composition — so today's owners answer none.
| Field | Type | Required | Description |
|---|---|---|---|
applied | true | yes | |
reload | "none" | "host" | "parent" | yes |