import { IObservable } from "../../../../base/common/observable.js"; import { URI } from "../../../../sessions/sessions.web.main.internal.js"; import { IVoicePlaybackEntry } from "@codingame/monaco-vscode-voice-service-override/vscode/vs/workbench/contrib/chat/common/voicePlaybackService"; export declare const IVoicePlaybackService: import("../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier; /** * Tracks voice playback state for chat sessions: which session is currently * speaking, and what the last played message was for each session. Used by * the agent sessions view to highlight the speaking row and to drive the * "Replay Last Played" action. * * Playback is reported by the voice agent webview through the workbench * commands `_chat.voicePlayback.notifyStart` / `_chat.voicePlayback.notifyEnd`. */ export interface IVoicePlaybackService { readonly _serviceBrand: undefined; /** * The session resource currently being spoken aloud, or `undefined` if * playback is generic (no session id from the backend) or stopped. */ readonly speakingSession: IObservable; /** * Increments whenever the per-session last-played map changes. Consumers * can subscribe via `read(reader)` to refresh state without us exposing * the underlying `ResourceMap`. */ readonly lastPlayedVersion: IObservable; /** * Increments whenever the set of sessions with a pending (deferred) voice * response changes. The agent sessions view subscribes to this to show a * pending-response indicator on the affected rows. */ readonly pendingResponseVersion: IObservable; /** * Records the start of a TTS playback. When `sessionResource` is undefined, * the audio is generic and no per-session state is updated. */ notifyPlaybackStart(sessionResource: URI | undefined, transcript: string | undefined): void; notifyPlaybackEnd(sessionResource: URI | undefined): void; getLastPlayed(sessionResource: URI): IVoicePlaybackEntry | undefined; hasLastPlayed(sessionResource: URI): boolean; /** * Marks whether a session has a voice response that arrived while the * session was not focused and is being held until the user focuses it. * Drives the pending-response indicator in the agent sessions view. */ setPendingResponse(sessionResource: URI, pending: boolean): void; hasPendingResponse(sessionResource: URI): boolean; /** * Replays the last played message for `sessionResource` by re-synthesizing * the saved transcript through the registered speech provider. Resolves * once playback completes (or immediately when there is nothing to replay * or no speech provider is available). */ replay(sessionResource: URI): Promise; /** * Stops any active playback for the given session (or all playback if * no session is specified). */ stop(sessionResource?: URI): void; }