import { IDisposable } from "../../../../base/common/lifecycle.js"; import { IObservable } from "../../../../base/common/observable.js"; import { IAgentConnection } from "../../../../platform/agentHost/common/agentService.js"; import { URI } from "../../../../sessions/sessions.web.main.internal.js"; import { IAgentHostTerminalProfileInfo, IAgentHostEntry, IAgentHostTerminalCreateOptions } from "./agentHostTerminalService.js"; import { ITerminalInstance } from "./terminal.js"; export declare const IAgentHostTerminalService: import("../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier; export interface IAgentHostTerminalService { readonly _serviceBrand: undefined; /** Observable list of registered agent host terminal profiles. */ readonly profiles: IObservable; /** * Ensures a named profile exists for the given address, expanding any * collapsed quickpick profile if needed. Returns the profile info, or * `undefined` if no entry is registered for the address. */ getProfileForConnection(address: string): IAgentHostTerminalProfileInfo | undefined; /** * Registers an agent host entry. The service reconciles entries into * terminal profiles automatically. Dispose the returned disposable to * remove the entry. */ registerEntry(entry: IAgentHostEntry): IDisposable; /** * Creates a new interactive terminal on the given agent host connection. */ createTerminal(connection: IAgentConnection, options?: IAgentHostTerminalCreateOptions): Promise; /** * Creates a terminal for the agent host registered at the given address, * resolving the connection from the registered entry. Returns `undefined` * if no entry is registered for the address. */ createTerminalForEntry(address: string, options?: IAgentHostTerminalCreateOptions): Promise; /** * Reconnects all active terminals that belonged to {@link oldClientId} * to a new agent host connection. Only terminals matching the old * client are touched — terminals from other hosts are left alone. */ reconnectTerminals(newConnection: IAgentConnection, oldClientId: string): Promise<{ recovered: number; total: number; }>; /** * Attaches to an existing server-side terminal by subscribing to its * state without creating a new process. */ reviveTerminal(connection: IAgentConnection, terminalUri: URI, terminalToolSessionId: string): Promise; /** Attach a non-pty output channel directly to chat without creating a terminal instance. */ attachOutputTerminal(connection: IAgentConnection, terminalUri: URI, terminalToolSessionId: string): IDisposable; /** * Sets the default cwd used by profile providers when no explicit cwd * is provided. Call with `undefined` to clear. */ setDefaultCwd(cwd: URI | undefined): void; /** * The address of the agent host a terminal runs on, or `undefined` when it * is not an agent host terminal or its host is no longer registered. */ getAgentHostAddress(instance: ITerminalInstance): string | undefined; /** * Whether a shell command is pending or executing in the given agent host * terminal. Returns `undefined` when the command state is unknown. */ isCommandExecuting(instance: ITerminalInstance): boolean | undefined; /** * Records that a command line is about to be submitted to the shell * prompt of the given agent host terminal, so that * {@link isCommandExecuting} reports it as busy until the shell reports * that the command started executing. */ markCommandPending(instance: ITerminalInstance): void; /** * The working directory the given agent host terminal started in and its * current one, as filesystem paths on the host. Returns `undefined` when * the terminal is not an agent host terminal. */ getCwd(instance: ITerminalInstance): { readonly initial: string; readonly current: string; } | undefined; }