import { URI } from "../../../../../base/common/uri.js"; import { IAgentHostConnectionsService } from "../../../../../platform/agentHost/common/agentHostConnectionsService.service.js"; import { IAgentConnection } from "../../../../../platform/agentHost/common/agentService.js"; import { IAgentHostService } from "../../../../../platform/agentHost/common/agentService.service.js"; import { IRemoteAgentHostConnectionInfo } from "../../../../../platform/agentHost/common/remoteAgentHostService.js"; import { IRemoteAgentHostService } from "../../../../../platform/agentHost/common/remoteAgentHostService.service.js"; import { IConfigurationService } from "../../../../../platform/configuration/common/configuration.service.js"; import { IEnvironmentService } from "../../../../../platform/environment/common/environment.service.js"; import { IFileService } from "../../../../../platform/files/common/files.service.js"; import { ILogService } from "../../../../../platform/log/common/log.service.js"; import { IProductService } from "../../../../../platform/product/common/productService.service.js"; import { ITextModelService } from "../../../../../editor/common/services/resolverService.service.js"; import { IOutputService } from "../../../../services/output/common/output.service.js"; import { ICopilotHomeService } from "../../../../services/environment/common/copilotHomeService.js"; /** Bound the best-effort scan of Copilot SDK process logs. */ export declare const MAX_COPILOT_LOG_SCAN_FILES = 10; export declare const MAX_COPILOT_LOG_SCAN_FILE_SIZE: number; /** Default cap for the amount of text loaded into the inline raw-log viewer. */ export declare const DEFAULT_RAW_LOG_VIEW_CAP_BYTES: number; /** * A selected Copilot process log that can be read lazily. */ export interface ICopilotLogFile { readonly path: string; readonly resource: URI; readonly size: number; } /** * Discriminates the kind of agent-host log a {@link IAgentHostLogSource} * points at, so the viewer can pick the appropriate reader and syntax. */ export declare enum AgentHostLogSourceKind { /** The Copilot CLI `events.jsonl` model/conversation stream. */ Events = "events", /** The AHP JSON-RPC wire log, owned by the window or Mission Control host. */ WireLog = "wire", /** The Copilot SDK process logs under `/logs`. */ CliLog = "cliLog", /** A VS Code output channel (agent host process, renderer, shared). */ ProcessChannel = "processChannel", /** The remote machine's `agenthost.log`, downloaded on demand. */ RemoteProcessLog = "remoteProcessLog" } /** * Describes one raw log source available for an agent-host session. Descriptors * are cheap to enumerate; the actual (bounded) content is read lazily via * {@link readAgentHostLogSourceContent} when the user selects the source. */ export interface IAgentHostLogSource { readonly id: string; readonly label: string; readonly kind: AgentHostLogSourceKind; readonly isRemote: boolean; /** File resource for file-backed sources (events, wire log). */ readonly resource?: URI; /** Output channel id for channel-backed sources. */ readonly channelId?: string; /** Copilot logs directory + session id, for the lazy session-matched CLI log read. */ readonly cliLogs?: { readonly dir: URI; readonly rawSessionId: string; }; /** Remote connection for lazily downloading `agenthost.log`. */ readonly remoteConnection?: IRemoteAgentHostConnectionInfo; } /** Bag of services required to enumerate and read agent-host log sources. */ export interface IAgentHostLogSourceServices { readonly copilotHomeService: ICopilotHomeService; readonly agentHostService: IAgentHostService; readonly agentHostConnectionsService: IAgentHostConnectionsService; readonly remoteAgentHostService: IRemoteAgentHostService; readonly outputService: IOutputService; readonly fileService: IFileService; readonly textModelService: ITextModelService; readonly configurationService: IConfigurationService; readonly environmentService: IEnvironmentService; readonly productService: IProductService; readonly logService: ILogService; } /** Result of a bounded raw-log read. */ export interface IAgentHostLogContent { readonly text: string; /** Total size of the underlying source in bytes, when known. */ readonly totalBytes: number | undefined; /** True when only the tail of the source was loaded. */ readonly truncated: boolean; /** Full-fidelity resource to open in an editor, when the source is file-backed. */ readonly fileResource?: URI; } /** * Returns whether the session belongs to a local or remote agent host, independently of its provider. */ export declare function isAgentHostSession(resource: URI | undefined): boolean; /** * Resolves the remote agent-host connection that backs a given remote session * URI, or `undefined` for local/unknown sessions. */ export declare function getRemoteConnectionForSession(sessionResource: URI, connections: readonly IRemoteAgentHostConnectionInfo[]): IRemoteAgentHostConnectionInfo | undefined; /** * Enumerates the raw log sources available for a given agent-host session. * Cheap: performs at most a couple of directory stats and never reads file * contents. Returns an empty array for non-agent-host sessions. */ export declare function enumerateAgentHostLogSources(services: IAgentHostLogSourceServices, sessionResource: URI | undefined): Promise; /** * Reads the (bounded) content of a log source. File-backed sources are tailed * to at most `capBytes`; the returned {@link IAgentHostLogContent.fileResource} * lets callers offer an "open full file" affordance. */ export declare function readAgentHostLogSourceContent(source: IAgentHostLogSource, services: IAgentHostLogSourceServices, capBytes?: number): Promise; export declare function getAgentHostWireLogDirectory(connection: IAgentConnection): URI | undefined; export declare function listAgentHostWireLogFiles(fileService: IFileService, directory: URI, logId: string | undefined, logService: ILogService): Promise<{ resource: URI; name: string; mtime: number; size: number; }[]>; /** * Reads Copilot process logs selected for a session, or the newest log when * none mention the session id. Bounded by * {@link MAX_COPILOT_LOG_SCAN_FILES} and {@link MAX_COPILOT_LOG_SCAN_FILE_SIZE}. */ export declare function readCopilotLogsForSession(logsDir: URI, rawSessionId: string, fileService: IFileService, logService: ILogService): Promise<{ path: string; contents: string; }[]>; /** * Scans a bounded set of Copilot process logs for the session id, falling back * to the newest process log when no match can be found. */ export declare function findRelevantCopilotLogs(logsDir: URI, rawSessionId: string | undefined, fileService: IFileService, logService: ILogService): Promise; /** * Reads the remote agent host's `agenthost.log` from the remote machine via the * `vscode-agent-host://` filesystem proxy. The CLI launches the server with its * default data dir at `//data/logs//`, * so we list the logs directory and pick the most recent date-stamped folder. */ export declare function readRemoteAgentHostLog(connection: IRemoteAgentHostConnectionInfo, serverDataFolderName: string | undefined, fileService: IFileService): Promise;