import { URI } from "../../../../../base/common/uri.js"; import { IAgentSessionsService } from "../agentSessions/agentSessionsService.service.js"; import { IChatService } from "../../common/chatService/chatService.service.js"; import { ILanguageModelChatMetadataAndIdentifier } from "../../common/languageModels.js"; import { ILanguageModelToolsService } from "../../common/tools/languageModelToolsService.service.js"; import { IVoiceDispatchResult, IVoiceModelReference, IVoiceToolCall } from "../../common/voiceClient/voiceClientService.js"; import { CancellationToken } from "../../../../../base/common/cancellation.js"; import { IVoiceToolDispatchService } from "./voiceToolDispatchService.service.js"; /** * Callbacks that require access to the chat widget or view state. * Implemented by the ChatViewPane to bridge UI concerns. */ export interface IVoiceToolDispatchDelegate { /** Accept input text in the current chat widget. Returns false if no widget available. */ acceptInput(text: string): boolean; /** Get the resource URI of the currently active session. */ getCurrentSessionResource(): Promise; /** Switch the view to a different session by resource URI. */ switchToSession(resource: URI): Promise; /** Resolve a session resource using the active frontend's authoritative session model. */ resolveSessionResource?(sessionIdOrLabel: string): Promise; /** Get session information from the active frontend's authoritative session model. */ getSessionInfo?(): Promise; /** Set the session all subsequent voice turns and actions belong to. */ setTargetSession(resource: URI, preserveVoice?: boolean): void; /** The explicit voice target, or the currently shown session when unpinned. */ getTargetSessionResource(): URI | undefined; /** Select a model in the currently shown voice input. */ selectModel(requestedModel: string): Promise; /** Get the set of auto-approved session resource strings. */ getAutoApprovedSessions(): Set; /** Mark all current sessions as auto-approved. */ addAllAutoApprovedSessions(): void; /** Remove a session from auto-approved set. */ removeAutoApprovedSession(resource: string): void; /** Trigger an auto-approve check cycle. */ triggerAutoApproveCheck(): void; } export interface IVoiceModelSelectionResult { readonly ok: boolean; readonly reason?: "no_input" | "model_not_found" | "ambiguous_model" | "selection_failed"; readonly selected_model?: IVoiceModelReference; readonly available_models?: readonly IVoiceModelReference[]; } /** Resolve only exact identifiers or unique normalized names; never guess among similar models. */ export declare function resolveVoiceModel(models: readonly ILanguageModelChatMetadataAndIdentifier[], requestedModel: string): IVoiceModelSelectionResult & { readonly identifier?: string; }; export declare class VoiceToolDispatchService implements IVoiceToolDispatchService { private readonly agentSessionsService; private readonly chatService; private readonly toolsService; readonly _serviceBrand: undefined; private _delegate; constructor(agentSessionsService: IAgentSessionsService, chatService: IChatService, toolsService: ILanguageModelToolsService); setDelegate(delegate: IVoiceToolDispatchDelegate): void; /** Get the action label for a tool call name. */ static getActionLabel(name: string): string; private get _agentModeOptions(); dispatchToolCall(toolCall: IVoiceToolCall): Promise; private _findSessionResource; private _showActionTarget; /** * Apply a backend-resolved response to the exact pending part it names. * * Routing is by `pending_id` + `request_id` with no fallback: the path this * replaces fell back to the focused session, so a spoken "yes" could approve * a prompt the user was not looking at. A response that cannot find its part * is reported as stale instead. Answer values are matched exactly; see * `resolveQuestionAnswers`. */ respondToSession(toolCall: IVoiceToolCall, token?: CancellationToken): Promise; private _applyResponse; private _resolvePlanReview; /** Resolve a coding session id to its chat model, never falling back to the focused session. */ private _resolveModelForResponse; /** * Fill in a question carousel exactly as the widget's own submit path does. * * A `skip` carries whatever the user answered before saying "skip", which on * an untouched form is nothing at all. That empty case is why skipping is its * own response type: an `answer` with zero answers is indistinguishable from * a backend that resolved nothing, and is correctly refused below. */ private _answerCarousel; private _gatherSessionInfo; /** * Resolve a coding_session_id (resource URI string) to an IAgentSession. * Falls back to the currently active session when id is missing/unknown. */ private _resolveSession; /** * Gather files touched + per-file insertions/deletions for a session. * Returns a JSON string keyed for the LLM follow-up to summarize. */ private _gatherSessionChanges; /** * Gather the last N user/assistant turns of a coding session — actual * conversation content, trimmed for spoken summarization. */ private _gatherSessionThread; /** Render a URI as a short relative-ish path for spoken summaries. */ private _formatPath; }