import { Disposable } from "../../../base/common/lifecycle.js"; import { IProductConfiguration } from "../../../base/common/product.js"; import { URI } from "../../../base/common/uri.js"; import { IFileService } from "../../files/common/files.service.js"; import { ILogService } from "../../log/common/log.service.js"; export type AhpLogDirection = "c2s" | "s2c"; export interface IAhpJsonlLoggerOptions { readonly logsHome: URI; /** Stable identity shared by every transport connection to the same logical host. */ readonly logId: string; readonly connectionId: string; readonly transport: string; readonly maxFileSizeBytes?: number; readonly maxFiles?: number; readonly retention?: AhpJsonlLogRetention; readonly maxPendingBytes?: number; /** Cumulative budget shared by this process's loggers for logsHome, fixed by its first logger. */ readonly maxTotalSizeBytes?: number; /** Checked before serializing each message so host capture can follow live configuration. */ readonly isEnabled?: () => boolean; } export declare const AgentHostAhpJsonlLoggingEnvVar = "VSCODE_AGENT_HOST_AHP_JSONL_LOGGING"; export declare function isAhpJsonlLoggingEnabled(quality: IProductConfiguration["quality"], override?: string): boolean; /** Serializes writes and bounds a logical host's history across connection generations. */ export declare class AhpJsonlLogRetention { private readonly _options; private readonly _fileService; private readonly _logService; private readonly _writes; constructor(_options: { readonly logsHome: URI; readonly logId: string; readonly maxFiles: number; readonly maxSizeBytes: number; }, _fileService: IFileService, _logService: ILogService); run(write: () => Promise, currentResource: () => URI): Promise; } export declare class AhpJsonlLogger extends Disposable { private readonly _options; private readonly _fileService; private readonly _logService; private static readonly _budgets; private readonly _budget; private readonly _logReadRequests; private readonly _directory; private readonly _baseName; private readonly _maxFileSizeBytes; private readonly _maxFiles; private readonly _maxPendingBytes; private _currentFile; private _currentSize; private _segment; private _queue; private _pending; private _pendingBytes; private readonly _droppedEntries; private _drainScheduled; private _folderCreated; constructor(_options: IAhpJsonlLoggerOptions, _fileService: IFileService, _logService: ILogService); get resource(): URI; log(message: object, dir: AhpLogDirection, byteLength?: number): void; /** Avoids recording log contents or generating new log writes in response to watching those logs. */ private _isLogInspection; private _isLogResource; private _enqueue; flush(): Promise; private _scheduleDrain; private _drainPending; private _writeBuffers; private _enqueueDroppedEntries; private _rotate; private _resourceForSegment; private _getFileSize; } export declare function getAhpLogByteLength(text: string): number; /** Tests whether a JSONL filename belongs to the given logical Agent Host connection. */ export declare function isAhpLogFileFor(logId: string, name: string): boolean; export declare function stringifyAhpLogEntry(value: unknown): string;