import { Disposable, IDisposable } from "../../../../base/common/lifecycle.js"; import { IObservable } from "../../../../base/common/observable.js"; import { URI } from "../../../../base/common/uri.js"; import { IAgentConnection } from "../../../../platform/agentHost/common/agentService.js"; import { IQuickInputService } from "../../../../platform/quickinput/common/quickInput.service.js"; import { ITerminalLogService } from "../../../../platform/terminal/common/terminal.service.js"; import { ITerminalInstance, ITerminalLocationOptions } from "./terminal.js"; import { ITerminalChatService } from "./terminal.service.js"; import { ITerminalService } from "./terminal.service.js"; import { ITerminalProfileService } from "../common/terminal.service.js"; import { IAgentHostTerminalService } from "./agentHostTerminalService.service.js"; export interface IAgentHostTerminalCreateOptions { /** Human-readable terminal name. */ readonly name?: string; /** Initial working directory. */ readonly cwd?: URI; /** Terminal location (panel, editor, split, etc.). */ readonly location?: ITerminalLocationOptions; } export interface IAgentHostEntry { /** Display name for the profile. */ readonly name: string; /** Address or identifier for the host. */ readonly address: string; /** Getter for the connection (may be lazily resolved). */ readonly getConnection: () => IAgentConnection | undefined; } export interface IAgentHostTerminalProfileInfo { readonly extensionIdentifier: string; readonly profileId: string; readonly title: string; readonly address: string; } export declare class AgentHostTerminalService extends Disposable implements IAgentHostTerminalService { private readonly _terminalService; private readonly _terminalChatService; private readonly _terminalProfileService; private readonly _quickInputService; private readonly _logService; readonly _serviceBrand: undefined; private readonly _entries; private readonly _usedHosts; private readonly _profileRegistrations; private readonly _profiles; readonly profiles: IObservable; private _defaultCwd; /** Revived terminal instances, keyed by terminal URI string. */ private readonly _revivedInstances; /** * Active AgentHostPty instances with their owning connection clientId, * keyed by terminal URI string. Used for reconnection scoping. */ private readonly _activePtys; /** The {@link _activePtys} key and connection of each agent host terminal, keyed by instance id. */ private readonly _instanceKeys; private readonly _pendingRevives; constructor(_terminalService: ITerminalService, _terminalChatService: ITerminalChatService, _terminalProfileService: ITerminalProfileService, _quickInputService: IQuickInputService, _logService: ITerminalLogService); registerEntry(entry: IAgentHostEntry): IDisposable; getProfileForConnection(address: string): IAgentHostTerminalProfileInfo | undefined; setDefaultCwd(cwd: URI | undefined): void; private _reconcile; private _registerProfile; createTerminalForEntry(address: string, options?: IAgentHostTerminalCreateOptions): Promise; createTerminal(connection: IAgentConnection, options?: IAgentHostTerminalCreateOptions): Promise; reviveTerminal(connection: IAgentConnection, terminalUri: URI, terminalToolSessionId: string): Promise; attachOutputTerminal(connection: IAgentConnection, terminalUri: URI, terminalToolSessionId: string): IDisposable; private _doReviveTerminal; /** Creates the registration that owns the pty produced for {@link key}. */ private _createPtyRegistration; /** * Ties the registration's lifetime to the terminal instance so the local * pty is disposed even on paths that never call `shutdown()`. */ private _registerInstancePtyCleanup; getAgentHostAddress(instance: ITerminalInstance): string | undefined; isCommandExecuting(instance: ITerminalInstance): boolean | undefined; markCommandPending(instance: ITerminalInstance): void; getCwd(instance: ITerminalInstance): { readonly initial: string; readonly current: string; } | undefined; private _getActivePty; reconnectTerminals(newConnection: IAgentConnection, oldClientId: string): Promise<{ recovered: number; total: number; }>; }