Versions in this module Expand all Collapse all v0 v0.2.0 Jul 22, 2026 v0.1.0 Jul 22, 2026 Changes in this version + const DataPlaneBufferMS + const DecisionKindEndOfUtter + const DecisionKindIdleTimeout + const DecisionKindSilence + const DecisionKindSpeechStart + const DecisionKindTurnCap + const DecisionKindTurnEnd + const DecisionKindUtteranceCap + const DecisionParamEndSilence + const DecisionParamMaxSilence + const DecisionParamMaxTurn + const DecisionParamMaxUtterance + const DecisionParamSilenceThresh + const DecisionParamSpeechThresh + const DecisionParamTurnEndSilence + const DecisionTypeCap + const DecisionTypeSTTDispatch + const DecisionTypeSTTResult + const DecisionTypeVAD + const HarnessVersion + const MarkEchoGraceMS + const MaxSilenceMS + const MaxTurnMS + const MaxUtteranceMS + const MuLawFrameMS + const SampleRateHz + var AllSources = []InputSource + var AllStates = []SessionState + var FrameMS = MuLawFrameMS + func ComputeDepth(bufferMS, frameMS int) int + func EndSilenceWindows() int + func EventLogEnabled() bool + func MarkEchoTimeout(clip []byte) time.Duration + func NewSTTService(client *STTClient, input STTInput, output STTOutput) *sttService + func NewSileroDetector() (vadDetector, error) + func StartSTTService(ctx context.Context, svc *sttService) + func TransitionHandlerDefined(state SessionState, source InputSource) bool + func TurnEndSilenceWindows() int + func ValidateVAD() error + type BufferedChan struct + func NewBufferedChan[T any](depth int) *BufferedChan[T] + func (bc *BufferedChan[T]) Channel() <-chan T + func (bc *BufferedChan[T]) Recv(ctx context.Context) (T, error) + func (bc *BufferedChan[T]) Send(ctx context.Context, val T) error + type ControlEvent struct + CallSID string + Kind string + MarkName string + type ControlOutKind string + const ControlOutClear + const ControlOutMark + type ControlOutMessage struct + Kind ControlOutKind + MarkName string + type DatasetRow struct + EndSilenceMS int + HarnessVersion string + Label RowLabel + RecordingID string + Utterances []string + func RowsFromUtterances(recordingID string, recLabel RecordingLabel, utterances []string, ...) []DatasetRow + type DecisionEvent struct + AudioBytes int + AudioMS int + Effect string + Kind string + LatencyMS int + Param string + ParamValue any + Prob float32 + RequestID int + STTDurSec float64 + Seq int + SilenceCount int + Text string + Type string + type DecisionRecorder interface + Close func() error + Record func(ev DecisionEvent) + type FileDecisionRecorder struct + func NewFileDecisionRecorder(dir, streamSID, callSID, label string, cfg VADConfig, live io.Writer) *FileDecisionRecorder + func (r *FileDecisionRecorder) Close() error + func (r *FileDecisionRecorder) Record(ev DecisionEvent) + type InputSource int + const SourceIdleTimer + const SourceMarkEchoTimer + const SourceSTTResult + const SourceSimTurnTimer + const SourceTurnTimer + const SourceTwilioControl + const SourceTwilioData + const SourceUtteranceTimer + const SourceVADEvent + func (s InputSource) String() string + type Message struct + SessionID string + Text string + Transport TransportType + type ProdTurnSink struct + CallSID string + func (p *ProdTurnSink) OnEndOfUtterance() + func (p *ProdTurnSink) OnSpeechStart() + func (p *ProdTurnSink) OnTurnComplete(text string, trigger TurnTrigger) + type RecordingLabel string + const LabelCompleteTurn + const LabelDoneEnding + const LabelGreeting + const LabelHowAreYou + const LabelTruncated + type ReplayResult struct + Text string + func Replay(ctx context.Context, callSID string, audioStream io.Reader, ...) ([]ReplayResult, error) + type RowLabel string + const RowComplete + const RowIncomplete + type STTClient struct + func NewSTTClient(baseURL string) *STTClient + func (c *STTClient) Transcribe(ctx context.Context, id string, mulawBytes []byte) (STTResult, error) + type STTInput = ServiceInput[STTRequest] + type STTOutput = ServiceOutput[STTResult] + type STTPassKind string + const FullPass + type STTRequest struct + Audio []byte + Kind STTPassKind + RequestID int + SessionID string + type STTResult struct + Duration float64 + Kind STTPassKind + Language string + RequestID int + Segments []STTSegment + SessionID string + Text string + type STTRouter struct + func NewSTTRouter(results STTOutput) *STTRouter + func (r *STTRouter) Deregister(sessionID string, route STTOutput) + func (r *STTRouter) Register(sessionID string) STTOutput + func (r *STTRouter) Run(ctx context.Context) + type STTSegment struct + AvgLogprob float64 + End float64 + NoSpeechProb float64 + Start float64 + Text string + type ScoreReport struct + EndSilenceMS int + Outcomes map[VerifierOutcome]int + PromptFile string + RowCount int + func Score(ctx context.Context, promptFile string, rows []DatasetRow, endSilenceMS int, ...) (ScoreReport, error) + type ServiceInput interface + Channel func() <-chan T + Recv func(ctx context.Context) (T, error) + Send func(ctx context.Context, val T) error + type ServiceOutput interface + Channel func() <-chan T + Recv func(ctx context.Context) (T, error) + Send func(ctx context.Context, val T) error + type Session struct + CallSID string + History []Message + func NewSession(ctx context.Context, callSID string, opts ...SessionOption) *Session + func (s *Session) Close() + func (s *Session) Closed() <-chan struct{} + func (s *Session) Start() error + func (s *Session) State() SessionState + func (s *Session) TurnActive() bool + type SessionOption func(*Session) + func WithClock(after func(time.Duration) <-chan time.Time) SessionOption + func WithCloseFunc(f func()) SessionOption + func WithDecisionClock(now func() time.Time) SessionOption + func WithDecisionRecorder(r DecisionRecorder) SessionOption + func WithFileDecisionRecorderFromEnv(dir, streamSID, callSID, label string, cfg VADConfig, live io.Writer) SessionOption + func WithMaxSilenceMS(ms int) SessionOption + func WithMaxTurnMS(ms int) SessionOption + func WithMaxUtteranceMS(ms int) SessionOption + func WithSTTInput(in STTInput) SessionOption + func WithSTTOutput(out STTOutput) SessionOption + func WithSimTurnMS(ms int) SessionOption + func WithTranscriptAgentLabel(label string) SessionOption + func WithTranscriptOutput(dir, sid string, live io.Writer) SessionOption + func WithTurnEndPolicy(p TurnEndPolicy) SessionOption + func WithTurnSink(sink TurnSink) SessionOption + func WithTwilioControlInput(in TwilioControlPlaneInput) SessionOption + func WithTwilioControlOutput(out TwilioControlPlaneOutput) SessionOption + func WithTwilioDataInput(in TwilioDataPlaneInput) SessionOption + func WithTwilioDataOutput(out TwilioDataPlaneOutput) SessionOption + func WithVADConfig(cfg VADConfig) SessionOption + func WithVADEventObserver(f func(ev VADEvent, emitted bool)) SessionOption + func WithVADFactory(f func() (VADDetector, error)) SessionOption + type SessionState int + const StateAwaitingFullResult + const StateAwaitingMarkEcho + const StateClosed + const StateIdle + const StateListening + const StateSpeaking + const StateTerminating + func (s SessionState) String() string + type StopwordPolicy struct + func (StopwordPolicy) IsEndOfTurn(transcript string) bool + type TimerCompletion struct + Duration time.Duration + Name string + TimerID int + type TimerFacility struct + func NewTimerFacility(ctx context.Context) *TimerFacility + func NewTimerFacilityWithClock(ctx context.Context, after func(time.Duration) <-chan time.Time) *TimerFacility + func (tf *TimerFacility) Arm(ctx context.Context, name string, duration time.Duration) int + func (tf *TimerFacility) Cancel(name string) + func (tf *TimerFacility) Completions() <-chan TimerCompletion + func (tf *TimerFacility) IsCurrent(completion TimerCompletion) bool + type TransportType string + const TransportOutbound + const TransportSMS + const TransportVoice + type TurnEndPolicy interface + IsEndOfTurn func(transcript string) bool + type TurnSink interface + OnEndOfUtterance func() + OnSpeechStart func() + OnTurnComplete func(text string, trigger TurnTrigger) + type TurnTrigger string + const TriggerCallEnd + const TriggerIdleTimeout + const TriggerSilenceTurnEnd + const TriggerStopword + const TriggerTurnCap + const TriggerUtteranceCap + type TwilioControlPlaneInput = ServiceInput[ControlEvent] + type TwilioControlPlaneOutput = ServiceOutput[ControlOutMessage] + type TwilioDataPlaneInput = ServiceInput[[]byte] + type TwilioDataPlaneOutput = ServiceOutput[[]byte] + type VADClient struct + func NewVADClient(baseURL string) *VADClient + func (c *VADClient) Detector() func() (VADDetector, error) + type VADConfig = vadConfig + func DefaultVADConfig() VADConfig + type VADDetector = vadDetector + type VADEvent struct + Kind VADKind + Prob float32 + SessionID string + SilenceCount int + StreamWindowIndex int + VoicedCount int + WindowIndex int + type VADInput = ServiceOutput[[]byte] + type VADKind string + const VADEndOfUtterance + const VADSilence + const VADSpeech + const VADTurnEnd + type VADOutput = ServiceInput[VADEvent] + type Verifier func(ctx context.Context, promptFile string, row DatasetRow) (VerifierOutcome, error) + type VerifierOutcome string + const OutcomePartialAccepted + const OutcomeProceed + const OutcomeRepairFires + const OutcomeSpuriousRepair