deviceagent

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package deviceagent implements the LAN-side SpeechKit device agent contract.

Index

Constants

View Source
const (
	ProtocolVersion = "speechkit.device_agent.v0"
)

Variables

View Source
var (
	ErrMissingServerURL          = errors.New("speechkit deviceagent: server_url is required")
	ErrMissingHomeAssistantURL   = errors.New("speechkit deviceagent: home_assistant_url is required")
	ErrMissingHomeAssistantToken = errors.New("speechkit deviceagent: home_assistant_token is required")
	ErrMissingAssistText         = errors.New("speechkit deviceagent: assist text is required")
)

Functions

This section is empty.

Types

type Agent

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

func New

func New(cfg Config) (*Agent, error)

func (*Agent) Publish

func (a *Agent) Publish(ctx context.Context, ev Event) error

func (*Agent) Register

func (a *Agent) Register(ctx context.Context) (*RegistrationAck, error)

func (*Agent) RunFakeAssistCycle

func (a *Agent) RunFakeAssistCycle(ctx context.Context, opts CycleOptions) (*CycleResult, error)

type AudioDevice

type AudioDevice struct {
	ID        string `json:"id"`
	Name      string `json:"name,omitempty"`
	Kind      string `json:"kind"` // microphone | speaker
	Transport string `json:"transport,omitempty"`
}

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"`
	LocalPairing  bool `json:"local_pairing"`
}

type Config

type Config struct {
	ServerURL          string
	ServerToken        string
	HomeAssistantURL   string
	HomeAssistantToken string
	HomeAssistantAgent string
	HTTPClient         *http.Client
	UserAgent          string
	Device             DeviceDescriptor
	Locale             string
}

type CycleOptions

type CycleOptions struct {
	SessionID string
	Text      string
	Locale    string
}

type CycleResult

type CycleResult struct {
	SessionID        string  `json:"session_id"`
	SpokenText       string  `json:"spoken_text"`
	HomeAssistantRaw string  `json:"home_assistant_raw,omitempty"`
	TTSProvider      string  `json:"tts_provider,omitempty"`
	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,omitempty"`
	CaptureDevice AudioDevice `json:"capture_device"`
	OutputDevice  AudioDevice `json:"output_device"`
	Wakeword      Wakeword    `json:"wakeword"`
}

type Event

type Event struct {
	Type          string            `json:"type"`
	Surface       string            `json:"surface"`
	Mode          string            `json:"mode"`
	SessionID     string            `json:"session_id,omitempty"`
	DeviceID      string            `json:"device_id"`
	RoomID        string            `json:"room_id,omitempty"`
	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 Health

type Health struct {
	Status       string `json:"status"`
	CaptureReady bool   `json:"capture_ready"`
	OutputReady  bool   `json:"output_ready"`
	WakeReady    bool   `json:"wake_ready"`
}

type Pairing

type Pairing struct {
	Status string `json:"status"`
	Method string `json:"method"`
}

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"`
	Pairing      Pairing          `json:"pairing"`
}

type RegistrationAck

type RegistrationAck struct {
	Status     string `json:"status"`
	PairingID  string `json:"pairing_id,omitempty"`
	ServerTime string `json:"server_time,omitempty"`
}

type Wakeword

type Wakeword struct {
	Enabled bool   `json:"enabled"`
	Phrase  string `json:"phrase,omitempty"`
	Backend string `json:"backend,omitempty"`
	Status  string `json:"status"`
}

Jump to

Keyboard shortcuts

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