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 Pairingdeprecated
- type Registration
- type RegistrationAck
- type TTSRequest
- type TTSResponse
- type Wakeword
Constants ¶
View Source
const ( // ProtocolVersion is the legacy v0 constant retained for source // compatibility. New clients and servers must use CurrentProtocolVersion. // // Deprecated: v0 carries no server-owned pairing or authority guarantees. ProtocolVersion = "speechkit.device_agent.v0" // CurrentProtocolVersion is the only version emitted or accepted by the // credential-minimal local bridge. 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") // Deprecated compatibility errors. The v1 client never accepts HA // credentials or authority configuration from the device. ErrMissingHomeAssistantURL = errors.New("speechkit deviceagent: home_assistant_url is required") ErrMissingHomeAssistantToken = errors.New("speechkit deviceagent: home_assistant_token is required") ErrLegacyClientConfig = errors.New("speechkit deviceagent: legacy credential or transport configuration is forbidden") 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.51.1
type AssistResponse ¶ added in v0.51.1
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.51.1
type BridgeCapabilities struct {
HomeAssistant CapabilityState `json:"home_assistant"`
TTS CapabilityState `json:"tts"`
}
type BridgeError ¶ added in v0.51.1
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"`
// Deprecated: pairing readiness is attested by the server response and is
// never serialized from the device.
LocalPairing bool `json:"-"`
}
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.51.1
type Config ¶
type Config struct {
ServerURL string
// Deprecated: v1 authenticates only with PairingToken. Setting this field
// makes New fail closed.
ServerToken string
// Deprecated: Home Assistant authority and credentials are server-owned.
// Setting any of these fields makes New fail closed.
HomeAssistantURL string
HomeAssistantToken string
HomeAssistantAgent string
// Deprecated: v1 owns its redirect and local-dial policy. Supplying a
// custom client makes New fail closed.
HTTPClient *http.Client
PairingToken string
ExpectedServerInstanceID string
ExpectedPairingID string
UserAgent string
Device DeviceDescriptor
Capabilities Capabilities
Health Health
Locale string
}
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"`
// Deprecated: raw Home Assistant responses never cross the v1 boundary.
HomeAssistantRaw string `json:"-"`
}
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.51.1
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.51.1
type HTTPError struct {
Method string
Path string
StatusCode int
Envelope ErrorEnvelope
}
type Pairing
deprecated
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"`
// Deprecated: v1 never accepts device-asserted pairing state.
Pairing Pairing `json:"-"`
}
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.51.1
type TTSResponse ¶ added in v0.51.1
Click to show internal directories.
Click to hide internal directories.