execution

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2026 License: GPL-2.0, GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package execution provides Capability → Driver Command mapping for EAN 2.0.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AIAdapter

type AIAdapter struct {
	// contains filtered or unexported fields
}

AIAdapter bridges EAN Capability Invoke → ai_agent.Agent task pipeline. Create is always real (quota + mock/remote pipeline); optional wait polls until waiting_confirm / failed / cancelled or ctx deadline.

func NewAIAdapter

func NewAIAdapter(agent *ai_agent.Agent) *AIAdapter

NewAIAdapter wraps an existing Agent. agent must be non-nil.

func SharedAIAdapter

func SharedAIAdapter() *AIAdapter

SharedAIAdapter returns a process-wide default adapter (local mode Agent). Northbound MQTT/NATS runtimes use this when Server has not injected a custom Agent.

func (*AIAdapter) Agent

func (a *AIAdapter) Agent() *ai_agent.Agent

Agent exposes the underlying Agent (for Server reuse / settings Apply).

func (*AIAdapter) Execute

func (a *AIAdapter) Execute(ctx context.Context, cmd DriverCommand) (any, error)

Execute implements AICommandExecutor.

type AICommandExecutor

type AICommandExecutor interface {
	Execute(ctx context.Context, cmd DriverCommand) (any, error)
}

AICommandExecutor runs AI.* DriverCommands (protocol reverse / doc parse).

type CapabilityMapper

type CapabilityMapper struct {
	// contains filtered or unexported fields
}

CapabilityMapper maps EAN Capability Invokes to Driver Commands.

func NewCapabilityMapper

func NewCapabilityMapper(executor Executor) *CapabilityMapper

NewCapabilityMapper creates a mapper. executor may be nil (returns mapping only errors on execute).

func (*CapabilityMapper) Map

Map converts a Capability Invoke into a DriverCommand without executing it. For unified capabilities (unified=true), protocol may be empty — the DriverExecutor will auto-resolve it from the channel's Protocol field.

func (*CapabilityMapper) MapAndExecute

MapAndExecute implements capability.Mapper.

type DeviceScanner

type DeviceScanner interface {
	ScanDevice(ctx context.Context, channelID, deviceID string, params map[string]any) (any, error)
	ScanChannel(ctx context.Context, channelID string, params map[string]any) (any, error)
}

DeviceScanner is the optional ScanEngine browse path.

type DiagnosticsProvider

type DiagnosticsProvider interface {
	GetDeviceDiagnostics(deviceID string) map[string]any
}

DiagnosticsProvider is the optional diagnostics path.

type DriverCommand

type DriverCommand struct {
	Protocol string
	Command  string // ReadPoints | WritePoint | ScanDevices | GetDevicePoints | Diagnostics | AI.*
	Args     map[string]any
}

DriverCommand is the lower-level command produced by Capability mapping.

type DriverExecutor

type DriverExecutor struct {
	// contains filtered or unexported fields
}

DriverExecutor executes mapped DriverCommands against ShadowCore / ScanEngine / Driver via SouthboundManager (typically *core.ChannelManager). AI.* commands delegate to AIAdapter.

func NewDriverExecutor

func NewDriverExecutor(sb model.SouthboundManager) *DriverExecutor

NewDriverExecutor wires a real southbound backend. sb may be nil (Execute errors). AI commands require SetAI / NewWiredExecutor.

func NewWiredExecutor

func NewWiredExecutor(sb model.SouthboundManager) *DriverExecutor

NewWiredExecutor builds a DriverExecutor with SharedAIAdapter attached.

func (*DriverExecutor) Execute

func (e *DriverExecutor) Execute(ctx context.Context, cmd DriverCommand) (any, error)

Execute runs a DriverCommand on the real I/O path.

func (*DriverExecutor) SetAI

func (e *DriverExecutor) SetAI(ai AICommandExecutor)

SetAI attaches an AI command executor (protocol_reverse / doc_parse).

type Executor

type Executor interface {
	Execute(ctx context.Context, cmd DriverCommand) (any, error)
}

Executor executes a mapped DriverCommand against ScanEngine / Driver / AI adapters. Wiring to concrete southbound managers is intentionally deferred so the Capability Runtime can be brought up without changing ScanEngine hot paths.

type PointReader

type PointReader interface {
	ReadPoint(channelID, deviceID, pointID string) (model.Value, error)
}

PointReader is the optional live Driver read path (ChannelManager.ReadPoint).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL