import { Disposable } from "../../../base/common/lifecycle.js"; import type { ChannelFlowControl, ChannelReceiveLimits } from "./state/protocol/common/state.js"; import type { JsonRpcNotification } from "./state/sessionProtocol.js"; import { type IProtocolTransport } from "./state/sessionTransport.js"; export declare function validateChannelLimits(limits: ChannelReceiveLimits): void; export declare function readChannelFlowControl(value: unknown): ChannelFlowControl; /** Routes windowed subscriptions and fairly schedules bounded transport bursts. */ export declare class AgentHostChannelScheduler extends Disposable { private readonly _transport; private readonly _onError; private readonly _channels; private readonly _controls; private readonly _receiveControlBudget; private readonly _sendControlBudget; private _controlBytes; private _controlTimer; private _sendingControls; private _closed; private _timer; private _scheduled; private _burstBytes; private _cursor; constructor(_transport: IProtocolTransport, _onError: (error: Error) => void); add(channel: AgentHostChannelDelivery): void; clearControls(channel: string): void; remove(channel: AgentHostChannelDelivery): void; /** Ordinary subscriptions retain their existing unsubscribe path. */ checkControl(message: JsonRpcNotification): boolean; acceptMessage(message: JsonRpcNotification, controlChecked?: boolean): boolean; sendControl(message: JsonRpcNotification, onSend?: () => void): void; private _sendControls; private _fail; schedule(delay?: number): void; dispose(): void; } /** Connection-local delivery; the channel adapter owns snapshots, recovery, and error controls. */ export declare class AgentHostChannelDelivery extends Disposable { readonly channel: string; private _sendLimits; private readonly _receiveLimits; private readonly _transport; private readonly _scheduler; private readonly _accept; private readonly _onError; private readonly _maximumBufferedBytes; private readonly _outgoing; private readonly _received; private readonly _drains; private _queuedBytes; private _retainedBytes; private _sentBytes; private _peerConsumed; private _receivedBytes; private _consumedBytes; private _creditedBytes; private _fragments; private _error; private _creditTimer; private _creditPrompt; constructor(channel: string, _sendLimits: ChannelReceiveLimits, _receiveLimits: ChannelReceiveLimits, _transport: IProtocolTransport, _scheduler: AgentHostChannelScheduler, _accept: (message: JsonRpcNotification, release: () => void) => void, _onError: (error: Error) => void, _maximumBufferedBytes?: number); get maximumFrameBytes(): number; setSendLimits(limits: ChannelReceiveLimits): void; send(message: JsonRpcNotification): Promise; get canSend(): boolean; sendFrame(): number; accept(message: JsonRpcNotification, bytes: number): void; acceptCredit(consumedBytes: number): void; drain(): Promise; private _release; flushCredit(): void; fail(error: Error): void; dispose(): void; }