export { B as BackendAdapterOptions, a as ChatEvent, C as ChatEventType, b as ChatId, f as ChatIdLike, c as ChatMessage, k as ChatMessageMetadata, l as ChatMessageStatus, e as ChatMiddleware, m as ChatMiddlewareContext, n as ChatRole, g as ChatSession, j as ChatSessionConfig, F as FilePart, I as IChatBackend, o as IChatProvider, d as IResumableBackend, p as MessagePart, M as MessageStatus, O as ObservableSession, P as PartStatus, q as ReasoningPart, h as RuntimeSendOptions, R as RuntimeStatus, S as SendMessageOptions, r as SessionInfo, s as SessionStatus, t as SourcePart, u as TextPart, v as ToolCallPart, T as ToolCallStatus, w as createChatId, x as createTextMessage, y as isObservableSession, i as isResumableBackend, z as toChatId } from '../types-ajANVzf7.js';
export { adaptAgentEvents, agentEventToChatEvent, fromAgentMessage, getMessageReasoning, getMessageText, getMessageToolCalls, isChatEvent, isChatMessage, isChatSession, isFilePart, isMessagePart, isReasoningPart, isSourcePart, isTextPart, isToolCallPart, toAgentMessage } from './core.js';
export { BackendAdapterFactory, BackendInfo, ChatRuntimeOptions, IChatClient, IChatRuntime, IProviderClient, RetryConfig, SelectionChangeCallback, StreamRetryConfig, createChatRuntime } from './runtime.js';
export { CreateSessionOptions, FileSessionStore, IChatSessionStore, ISessionReader, ISessionWriter, InMemorySessionStore, PaginatedMessages } from './sessions.js';
export { ChatError, ExponentialBackoffStrategy, classifyError, isRetryable, withRetry } from './errors.js';
export { B as BaseBackendAdapter, C as ClaudeChatAdapter, b as CopilotChatAdapter, I as InProcessChatTransport, V as VercelAIChatAdapter, f as WsChatTransport } from '../in-process-transport-C1JnJGVR.js';
export { I as IChatTransport, S as SSEChatTransport, s as streamToTransport } from '../transport-Ciap4PWK.js';
export { ContextStats, ContextWindowConfig, ContextWindowManager, ContextWindowResult, OverflowStrategy, estimateTokens } from './context.js';
export { MessageAccumulator } from './accumulator.js';
export { ChatEventBus, TypedEventEmitter } from './events.js';
export { I as IProviderStore, P as ProviderConfig } from '../provider-types-PTSlRPNB.js';
export { E as ErrorCode } from '../errors-C-so0M4t.js';
import '../agent-CW9XbmG_.js';
import 'zod';
import '../types-BxggH0Yh.js';
import '../errors-CmVvczxZ.js';
import './storage.js';
import '../backends-BSrsBYFn.js';

/**
 * Generic listener set utility for subscribe/notify patterns.
 *
 * Encapsulates the recurring pattern of:
 * - Set<callback> storage
 * - add(callback) → unsubscribe function
 * - notify(...args) with try/catch per listener
 * - clear() for disposal
 */
declare class ListenerSet<T extends (...args: any[]) => void> {
    private readonly _listeners;
    /** Add a listener. Returns an unsubscribe function. */
    add(callback: T): () => void;
    /** Notify all listeners with the given arguments. Errors are isolated per listener. */
    notify(...args: Parameters<T>): void;
    /** Remove all listeners. */
    clear(): void;
    /** Current number of listeners. */
    get size(): number;
}

/**
 * @witqq/agent-sdk - Stream Watchdog
 *
 * Activity-based timeout wrapper for async event streams.
 * Aborts the stream if no events arrive within a configurable inactivity window.
 * Timer resets on each received event.
 */
/** Stream watchdog configuration */
interface StreamWatchdogConfig {
    /** Maximum inactivity time in milliseconds before aborting the stream */
    timeoutMs: number;
    /** AbortSignal to link with (watchdog aborts when this signal fires) */
    signal?: AbortSignal;
}
/**
 * Wraps an async iterable with an activity timeout.
 * If no event arrives within `timeoutMs`, the stream is aborted with a ChatError.
 * The timer resets after each received event.
 *
 * Uses Promise.race() so even if the source iterator is stuck on an
 * unresolvable promise, the timeout fires and aborts iteration.
 *
 * @example
 * ```ts
 * const watched = withStreamWatchdog(adapter.streamMessage(session, msg), {
 *   timeoutMs: 30000,
 *   signal: abortController.signal,
 * });
 *
 * for await (const event of watched) {
 *   // Each event resets the 30s inactivity timer
 * }
 * ```
 */
declare function withStreamWatchdog<T>(source: AsyncIterable<T>, config: StreamWatchdogConfig): AsyncGenerator<T>;

export { ListenerSet, type StreamWatchdogConfig, withStreamWatchdog };
