companion

package
v0.40.7 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package companion provides small composers for hands-free SpeechKit hosts.

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingAssist = errors.New("speechkit companion: assist service is required")
View Source
var ErrMissingContext = errors.New("speechkit companion: context is required")
View Source
var ErrMissingRuntime = errors.New("speechkit companion: runtime is required")

Functions

This section is empty.

Types

type HandsFree

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

func NewHandsFree

func NewHandsFree(opts Options) (*HandsFree, error)

func (*HandsFree) Assist

func (h *HandsFree) Assist() speechkit.AssistService

func (*HandsFree) Events

func (h *HandsFree) Events() <-chan speechkit.Event

func (*HandsFree) HandleWake

func (h *HandsFree) HandleWake(ctx context.Context, ev wakeword.DetectionEvent) error

HandleWake publishes a wake event, forwards it to the optional downstream sink, and starts the configured hands-free target. Assist and Voice Agent can run without a visible UI; Dictation is UI-assisted and dispatches into the host command bus so the host can choose the text target and commit surface.

func (*HandsFree) ProcessAssist

ProcessAssist runs a one-shot Assist request through the configured service and, when TTS is present, synthesizes the spoken response.

func (*HandsFree) Runtime

func (h *HandsFree) Runtime() *speechkit.Runtime

func (*HandsFree) Start

func (h *HandsFree) Start(ctx context.Context) error

func (*HandsFree) Stop

func (h *HandsFree) Stop(ctx context.Context) error

func (*HandsFree) TTS

func (h *HandsFree) TTS() *tts.Service

func (*HandsFree) VoiceAgent

func (h *HandsFree) VoiceAgent() speechkit.VoiceAgentService

func (*HandsFree) WakeSink

func (h *HandsFree) WakeSink() wakeword.Sink

type HandsFreeTarget added in v0.40.7

type HandsFreeTarget string

HandsFreeTarget identifies which strict SpeechKit mode a hands-free activation should start. Hands-free is a capability layer, not a fourth SpeechKit mode.

const (
	// TargetAssist runs a one-shot Assist request and may synthesize spoken
	// output. This is the Siri/Alexa-style Voice-Companion path.
	TargetAssist HandsFreeTarget = "assist"
	// TargetVoiceAgent starts a realtime Voice Agent session for continuous
	// dialogue such as companion or game-moderator flows.
	TargetVoiceAgent HandsFreeTarget = "voice_agent"
	// TargetDictationUIAssisted starts Dictation through the host command bus.
	// It intentionally does not synthesize audio: text output still belongs to
	// a visible target or explicit commit surface owned by the host UI.
	TargetDictationUIAssisted HandsFreeTarget = "dictation_ui_assisted"
)

type Options

type Options struct {
	Runtime     *speechkit.Runtime
	TargetMode  HandsFreeTarget
	WakeSink    wakeword.Sink
	WakeRequest WakeRequestFunc
	Assist      speechkit.AssistService
	VoiceAgent  speechkit.VoiceAgentService
	TTS         *tts.Service
}

type WakeRequestFunc

WakeRequestFunc converts a wake detection into an Assist request. Hosts use it to attach their transcript/capture result to the framework composer.

Jump to

Keyboard shortcuts

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