@langwatch/scenario
    Preparing search index...

    Interface VoiceExecutorState

    interface VoiceExecutorState {
        audioPlaybackSink?: AudioPlaybackSink | null;
        onAudioChunk?: (chunk: AudioChunk) => void;
        onVoiceEvent?: (event: VoiceEvent) => void;
        voiceAudioCursor?: number | null;
        voiceBackgroundNoise?: VoiceBackgroundNoise;
        voiceConfig?: ResolvedVoiceConfig | null;
        voiceInterruptions?: InterruptionConfig;
        voiceLatency: LatencyMetrics | null;
        voiceRecording: VoiceRecording | null;
        voiceRecordingStartedAt: number | null;
        voiceTimeline: VoiceEvent[] | null;
    }

    Implemented by

    Index

    Properties

    audioPlaybackSink?: AudioPlaybackSink | null

    Live local-speaker playback sink. Populated by the executor when audioPlayback === true (per-run run({ voice: { audioPlayback } }) wins over module-global configure({ audioPlayback }) per ADR-002). Each agent/user audio chunk is fanned out here alongside the recording.

    undefined when audioPlayback is disabled; null after close() is called at the end of a run.

    onAudioChunk?: (chunk: AudioChunk) => void
    onVoiceEvent?: (event: VoiceEvent) => void
    voiceAudioCursor?: number | null

    Byte-accurate audio cursor in seconds — the cumulative PCM byte-duration of every segment recorded so far. Segments are laid end-to-end on this cursor (not on wall-clock) so a segment's endTime - startTime equals its true audio length and recording.duration equals the full.wav byte-duration — independent of in-process send latency (review M1). Latency is measured separately from the wall-clock marks the recorder keeps, so the response-time signal is preserved. undefined/null before the first segment (treated as 0).

    voiceBackgroundNoise?: VoiceBackgroundNoise

    Background ambience declared by backgroundNoise(source, volume). The audio-effects subsystem reads this when mixing user-simulator audio.

    voiceConfig?: ResolvedVoiceConfig | null

    The resolved per-run voice config (ADR-002, Gap #7). Populated at run start from cfg.voice via resolveVoiceConfig when at least one voice adapter is present. The judge's STT pass and the user-simulator's TTS pass read the resolved provider/knobs here — never a module global. null when the run has no voice config.

    voiceInterruptions?: InterruptionConfig

    Interruption configuration declared by voiceProceed({ interruptions }). The executor reads this at the top of each turn during proceed() and decides whether to fire a barge-in.

    voiceLatency: LatencyMetrics | null
    voiceRecording: VoiceRecording | null
    voiceRecordingStartedAt: number | null

    performance.now() (or equivalent monotonic clock) anchor in seconds.

    voiceTimeline: VoiceEvent[] | null