Documentation
¶
Overview ¶
Package embodiment defines the provider-neutral body subsystem contract.
It models perceptions, body capabilities, provider-neutral actions, and the routing loop without registering LLM tools or touching hardware-specific code.
Index ¶
- Constants
- func BuildCognitionPrompt(percept Percept, decision GateDecision) string
- func BuildSystemPromptBlock(percept Percept, decision GateDecision) string
- func LooksLikePerceptPayload(provider string, payload map[string]any, knownBody bool) bool
- type ActionDispatcher
- type ActionKind
- type ActionRouter
- type AgentRuntime
- type BodyAction
- type Capability
- type Cognition
- type CognitionConfig
- type CognitionResult
- type Gate
- type GateConfig
- type GateDecision
- type GateMode
- type IngestResult
- type MCPToolCaller
- type MCPTransport
- type Modality
- type NormalizeOptions
- type Options
- type OwnerState
- type Percept
- type ProviderDescriptor
- type Registry
- type RouteResult
- type Router
- type Status
- type Subsystem
- func (s *Subsystem) IngestPayload(ctx context.Context, provider string, payload map[string]any) (IngestResult, error)
- func (s *Subsystem) IngestPercept(ctx context.Context, percept Percept) (IngestResult, error)
- func (s *Subsystem) KnownProvider(provider string) bool
- func (s *Subsystem) Start(ctx context.Context) error
- func (s *Subsystem) Status() Status
- func (s *Subsystem) Stop()
- type Transport
Constants ¶
View Source
const ( RouteReasonDelivered = "delivered" RouteReasonInvalidAction = "invalid_action" RouteReasonProviderDisabled = "provider_disabled" RouteReasonCapabilityNotSupported = "capability_not_supported" RouteReasonNoDispatcher = "no_dispatcher" RouteReasonDispatchFailed = "dispatch_failed" )
View Source
const ( GateReasonOwnerVoice = "owner_voice" GateReasonObservation = "observation" GateReasonExternal = "external" GateReasonDebounce = "debounce" GateReasonRateLimited = "rate_limited" GateReasonDisabled = "disabled" )
View Source
const ( CognitionReasonTriggered = "triggered" CognitionReasonSkipped = "skipped" CognitionReasonInFlight = "in_flight" )
Variables ¶
This section is empty.
Functions ¶
func BuildCognitionPrompt ¶
func BuildCognitionPrompt(percept Percept, decision GateDecision) string
func BuildSystemPromptBlock ¶
func BuildSystemPromptBlock(percept Percept, decision GateDecision) string
Types ¶
type ActionDispatcher ¶
type ActionDispatcher interface {
Dispatch(context.Context, ProviderDescriptor, BodyAction) error
}
type ActionKind ¶
type ActionKind string
const ( ActionSpeak ActionKind = "speak" ActionExpress ActionKind = "express" ActionMove ActionKind = "move" ActionLED ActionKind = "led" )
type ActionRouter ¶
type ActionRouter interface {
RouteAll(context.Context, []BodyAction, ProviderDescriptor) []RouteResult
}
type AgentRuntime ¶
type AgentRuntime interface {
Spawn(context.Context, agentruntime.SpawnRequest) (agentruntime.Run, error)
Wait(context.Context, string) (agentruntime.Run, error)
}
type BodyAction ¶
type BodyAction struct {
Kind ActionKind
Payload map[string]any
}
func ExtractBodyActions ¶
func ExtractBodyActions(response string) ([]BodyAction, error)
func NormalizeBodyAction ¶
func NormalizeBodyAction(action BodyAction) (BodyAction, error)
type Capability ¶
type Capability string
const ( CapabilityVision Capability = "vision" CapabilityHearing Capability = "hearing" CapabilitySpeech Capability = "speech" CapabilityExpression Capability = "expression" CapabilityMotion Capability = "motion" CapabilityLED Capability = "led" )
func RequiredCapability ¶
func RequiredCapability(kind ActionKind) (Capability, bool)
type Cognition ¶
type Cognition struct {
// contains filtered or unexported fields
}
func NewCognition ¶
func NewCognition(runtime AgentRuntime, cfg CognitionConfig) *Cognition
func (*Cognition) Trigger ¶
func (c *Cognition) Trigger(ctx context.Context, percept Percept, decision GateDecision) (CognitionResult, error)
type CognitionConfig ¶
type CognitionConfig struct {
DefaultSessionID string
DefaultAgent string
WaitTimeout time.Duration
ActionRouter ActionRouter
ProviderResolver func(string) (ProviderDescriptor, bool)
}
type CognitionResult ¶
type Gate ¶
type Gate struct {
// contains filtered or unexported fields
}
func NewGate ¶
func NewGate(cfg GateConfig) *Gate
func (*Gate) Decide ¶
func (g *Gate) Decide(percept Percept) GateDecision
type GateConfig ¶
type GateDecision ¶
type IngestResult ¶
type IngestResult struct {
Percept Percept `json:"percept"`
Decision GateDecision `json:"decision"`
CognitionResult CognitionResult `json:"cognition"`
}
type MCPToolCaller ¶
type MCPTransport ¶
type MCPTransport struct {
// contains filtered or unexported fields
}
func NewMCPTransport ¶
func NewMCPTransport(caller MCPToolCaller, logger zerolog.Logger) *MCPTransport
func (*MCPTransport) Dispatch ¶
func (t *MCPTransport) Dispatch(ctx context.Context, provider ProviderDescriptor, action BodyAction) error
type NormalizeOptions ¶
type Options ¶
type Options struct {
Runtime AgentRuntime
DefaultSessionID string
DefaultAgent string
Now func() time.Time
ActionDispatcher ActionDispatcher
}
type OwnerState ¶
type OwnerState string
const ( OwnerOwner OwnerState = "owner" OwnerStranger OwnerState = "stranger" OwnerUnknown OwnerState = "unknown" OwnerNone OwnerState = "none" )
type Percept ¶
type Percept struct {
ID string
Provider string
Modality Modality
Owner OwnerState
Summary string
Labels []string
MediaRef string
Trigger string
Salience float64
SessionID string
ThreadID string
IsSelfSensory bool
CapturedAt time.Time
Raw map[string]any
}
func NormalizePercept ¶
type ProviderDescriptor ¶
type ProviderDescriptor struct {
Name string
Capabilities []Capability
Enabled bool
Transport Transport
Endpoint string
}
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) CapabilitiesOf ¶
func (r *Registry) CapabilitiesOf(name string) []Capability
func (*Registry) Enabled ¶
func (r *Registry) Enabled() []ProviderDescriptor
func (*Registry) Register ¶
func (r *Registry) Register(desc ProviderDescriptor) error
type RouteResult ¶
type RouteResult struct {
Action BodyAction `json:"action"`
Provider string `json:"provider,omitempty"`
RequiredCapability Capability `json:"required_capability,omitempty"`
Delivered bool `json:"delivered"`
Dropped bool `json:"dropped"`
Reason string `json:"reason,omitempty"`
Error string `json:"error,omitempty"`
}
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) Route ¶
func (r *Router) Route(ctx context.Context, action BodyAction, provider ProviderDescriptor) RouteResult
func (*Router) RouteAll ¶
func (r *Router) RouteAll(ctx context.Context, actions []BodyAction, provider ProviderDescriptor) []RouteResult
type Status ¶
type Status struct {
Enabled bool
Providers []ProviderDescriptor
}
type Subsystem ¶
type Subsystem struct {
// contains filtered or unexported fields
}
func NewWithOptions ¶
func (*Subsystem) IngestPayload ¶
func (*Subsystem) IngestPercept ¶
func (*Subsystem) KnownProvider ¶
Click to show internal directories.
Click to hide internal directories.