- internal/plugin: Plugin/IoTProvider/ToolProvider/RAGProvider interfaces - internal/plugin: Registry with type-safe auto-detection, 11 tests - plugins/iot-mock: 8 simulated smart home devices, 11 tests - 63 total tests, build + vet clean
26 lines
824 B
Go
26 lines
824 B
Go
package plugin
|
|
|
|
import "context"
|
|
|
|
// IoTProvider is implemented by plugins that manage IoT devices.
|
|
// Only one IoTProvider can be active at a time.
|
|
type IoTProvider interface {
|
|
Plugin
|
|
|
|
// ListDevices returns all managed devices.
|
|
ListDevices(ctx context.Context) ([]Device, error)
|
|
|
|
// GetDevice returns a single device by ID.
|
|
GetDevice(ctx context.Context, id string) (*Device, error)
|
|
|
|
// SetDevice sets a property on a device (e.g., brightness=80).
|
|
SetDevice(ctx context.Context, id, field string, value any) error
|
|
|
|
// ToggleDevice toggles a device's power state.
|
|
ToggleDevice(ctx context.Context, id string) error
|
|
|
|
// SubscribeChanges returns a channel that emits device state changes.
|
|
// The channel is closed when the context is cancelled.
|
|
SubscribeChanges(ctx context.Context) (<-chan DeviceEvent, error)
|
|
}
|