Documentation
¶
Overview ¶
Package deviceagent implements the credential-minimal LAN-side SpeechKit device-agent client and its versioned wire contract.
Index ¶
- Constants
- Variables
- type Agent
- type AssistRequest
- type AssistResponse
- type AudioDevice
- type BridgeCapabilities
- type BridgeError
- type Capabilities
- type CapabilityState
- type Config
- type CycleOptions
- type CycleResult
- type DeviceDescriptor
- type ErrorEnvelope
- type Event
- type EventAck
- type HTTPError
- type Health
- type Registration
- type RegistrationAck
- type TTSRequest
- type TTSResponse
- type Wakeword
Constants ¶
View Source
const ( // CurrentProtocolVersion is the only version emitted or accepted by the // credential-minimal local bridge. The v0 protocol constant was removed // in v0.68.0; v0 clients never had server-owned pairing or authority // guarantees. CurrentProtocolVersion = "speechkit.device_agent.v1" CapabilityReady = "ready" CapabilityUnverified = "unverified" ServerInstanceHeader = "X-SpeechKit-Server-Instance-ID" )
Variables ¶
View Source
var ( ErrMissingServerURL = errors.New("speechkit deviceagent: server_url is required") ErrMissingPairingToken = errors.New("speechkit deviceagent: pairing_token is required") ErrPairingTokenTooShort = errors.New("speechkit deviceagent: pairing_token must contain at least 32 bytes") ErrPairingTokenInvalid = errors.New("speechkit deviceagent: pairing_token must be a bounded bearer credential") ErrMissingExpectedServerInstance = errors.New("speechkit deviceagent: expected_server_instance_id is required") ErrMissingExpectedPairingID = errors.New("speechkit deviceagent: expected_pairing_id is required") ErrMissingAssistText = errors.New("speechkit deviceagent: assist text is required") ErrMissingCommandID = errors.New("speechkit deviceagent: command_id is required") ErrServerIdentityMismatch = errors.New("speechkit deviceagent: server instance identity mismatch") ErrServerIdentityMissing = errors.New("speechkit deviceagent: server instance identity header is missing") ErrPairingIdentityMismatch = errors.New("speechkit deviceagent: pairing epoch identity mismatch") ErrAssistResponseMismatch = errors.New("speechkit deviceagent: assist response does not match the request") ErrResponseTooLarge = errors.New("speechkit deviceagent: server response exceeds the protocol limit") ErrInsecureServerTransport = errors.New("speechkit deviceagent: plaintext HTTP is allowed only for a loopback server") )
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
func (*Agent) RunFakeAssistCycle ¶
func (a *Agent) RunFakeAssistCycle(ctx context.Context, opts CycleOptions) (*CycleResult, error)
type AssistRequest ¶ added in v0.50.0
type AssistResponse ¶ added in v0.50.0
type AssistResponse struct {
Status string `json:"status"`
RequestID string `json:"request_id"`
ConversationID string `json:"conversation_id,omitempty"`
ResponseType string `json:"response_type,omitempty"`
Speech string `json:"speech,omitempty"`
ActionExecuted string `json:"action_executed"` // yes | no | unknown
Replayed bool `json:"replayed"`
ErrorCode string `json:"error_code,omitempty"`
ReasonCode string `json:"reason_code,omitempty"`
Retryable bool `json:"retryable"`
UserGuidance string `json:"user_guidance,omitempty"`
}
type AudioDevice ¶
type BridgeCapabilities ¶ added in v0.50.0
type BridgeCapabilities struct {
HomeAssistant CapabilityState `json:"home_assistant"`
TTS CapabilityState `json:"tts"`
}
type BridgeError ¶ added in v0.50.0
type Capabilities ¶
type Capabilities struct {
Dictation bool `json:"dictation"`
Assist bool `json:"assist"`
VoiceAgent bool `json:"voice_agent"`
WakewordLocal bool `json:"wakeword_local"`
TTS bool `json:"tts"`
BargeIn bool `json:"barge_in"`
}
Capabilities are device-reported facts. Pairing and server-side bridge readiness are deliberately absent: only the server can attest those.
type CapabilityState ¶ added in v0.50.0
type Config ¶
type Config struct {
ServerURL string
PairingToken string
ExpectedServerInstanceID string
ExpectedPairingID string
UserAgent string
Device DeviceDescriptor
Capabilities Capabilities
Health Health
Locale string
}
Config describes a v1 device agent. Authentication is PairingToken only; Home Assistant authority, credentials and the HTTP transport policy are server-owned and cannot be supplied by the device.
type CycleOptions ¶
type CycleResult ¶
type CycleResult struct {
RequestID string `json:"request_id"`
SessionID string `json:"session_id"`
SpokenText string `json:"spoken_text"`
ConversationID string `json:"conversation_id,omitempty"`
ResponseType string `json:"response_type,omitempty"`
TTSProvider string `json:"tts_provider,omitempty"`
Replayed bool `json:"replayed"`
Events []Event `json:"events"`
}
type DeviceDescriptor ¶
type DeviceDescriptor struct {
AgentID string `json:"agent_id"`
DeviceID string `json:"device_id"`
DisplayName string `json:"display_name,omitempty"`
RoomID string `json:"room_id"`
CaptureDevice AudioDevice `json:"capture_device"`
OutputDevice AudioDevice `json:"output_device"`
Wakeword Wakeword `json:"wakeword"`
}
type ErrorEnvelope ¶ added in v0.50.0
type ErrorEnvelope struct {
Error BridgeError `json:"error"`
}
type Event ¶
type Event struct {
Type string `json:"type"`
Surface string `json:"surface"`
Mode string `json:"mode"`
RequestID string `json:"request_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
DeviceID string `json:"device_id"`
RoomID string `json:"room_id"`
CapturePolicy string `json:"capture_policy,omitempty"`
Transport string `json:"transport,omitempty"`
Text string `json:"text,omitempty"`
SpeakText string `json:"speak_text,omitempty"`
ReasonCode string `json:"reason_code,omitempty"`
At time.Time `json:"at"`
Metadata map[string]string `json:"metadata,omitempty"`
}
type HTTPError ¶ added in v0.50.0
type HTTPError struct {
Method string
Path string
StatusCode int
Envelope ErrorEnvelope
}
type Registration ¶
type Registration struct {
Version string `json:"version"`
RegisteredAt time.Time `json:"registered_at"`
Device DeviceDescriptor `json:"device"`
Capabilities Capabilities `json:"capabilities"`
Health Health `json:"health"`
}
Registration is the device-asserted half of the v1 handshake. Pairing state is never part of it; the server attests pairing in RegistrationAck.
type RegistrationAck ¶
type RegistrationAck struct {
Status string `json:"status"`
PairingID string `json:"pairing_id"`
ServerInstanceID string `json:"server_instance_id"`
ServerTime string `json:"server_time,omitempty"`
Capabilities BridgeCapabilities `json:"capabilities"`
}
type TTSRequest ¶ added in v0.50.0
type TTSResponse ¶ added in v0.50.0
Click to show internal directories.
Click to hide internal directories.