import { VSBuffer } from "../../../base/common/buffer.js"; import { Disposable, IDisposable } from "../../../base/common/lifecycle.js"; import { AgentHostChannelScheduler } from "./agentHostChannelDelivery.js"; import type { ChannelFlowControl, ChannelReceiveLimits } from "./state/protocol/common/state.js"; import type { IProtocolTransport } from "./state/sessionTransport.js"; export declare const agentHostTcpMaxConnections = 256; export declare const agentHostTcpReceiveLimits: Readonly; /** Reserves opening/live sockets and application writes across their owning transport or host. */ export declare class AgentHostTcpBudget { private readonly _maximumConnections; private readonly _parent?; private _connections; private _pendingWriteBytes; constructor(_maximumConnections?: number, _parent?: AgentHostTcpBudget | undefined); reserveConnection(): IDisposable; reserveWrite(bytes: number): IDisposable; } export interface IAgentHostTcpConnection extends IDisposable { readonly resource: string; read(): Promise; write(data: VSBuffer): Promise; drain(): Promise; end(): Promise; close(): void; } /** A bounded pull stream. No queued bytes or writes survive transport loss. */ export declare class AgentHostTcpConnection extends Disposable implements IAgentHostTcpConnection { readonly resource: string; private readonly _isHost; private readonly _scheduler; private readonly _onClose; private readonly _budget; private readonly _delivery; private readonly _ready; private readonly _incoming; private _reader; private _writes; private _pendingBytes; private _pendingWrites; private _ended; private _sentEnd; private _receivedEnd; private _error; private _notifyFailure; private _chunkBytes; constructor(resource: string, flowControl: ChannelFlowControl, _isHost: boolean, transport: IProtocolTransport, _scheduler: AgentHostChannelScheduler, _onClose: (error: Error, notifyPeer: boolean) => void, _budget: AgentHostTcpBudget); get ready(): Promise; get ended(): boolean; private _getSendLimits; private _getChunkBytes; /** Host-side updates leave the socket, queues, half-close state, and counters intact. */ setPeerReceiveLimits(limits: ChannelReceiveLimits): void; sendSnapshot(fromSeq: number): Promise; private _accept; read(): Promise; write(data: VSBuffer): Promise; private _enqueue; drain(): Promise; end(): Promise; flushCredit(): void; fail(error: Error, notify?: boolean): void; private _failed; close(): void; dispose(): void; }