import type { AgentEvent, AgentMessage } from "@earendil-works/pi-agent-core";
import type { AssistantMessage, Message } from "@earendil-works/pi-ai/compat";
import type { AgentSessionInternalSurface as AgentSession } from "./agent-session-methods.ts";
import { type AgentSessionEvent, type AgentSessionEventListener } from "./agent-session-types.ts";
export declare function _emit(this: AgentSession, event: AgentSessionEvent): void;
export declare function _emitQueueUpdate(this: AgentSession): void;
/** Internal handler for agent events - shared by subscribe and reconnect */
export declare function _handleAgentEvent(this: AgentSession, event: AgentEvent): void;
export declare function _createRetryPromiseForAgentEnd(this: AgentSession, event: AgentEvent): void;
export declare function _findLastAssistantInMessages(this: AgentSession, messages: AgentMessage[]): AssistantMessage | undefined;
export declare function _processAgentEvent(this: AgentSession, event: AgentEvent): Promise<void>;
export declare function _applyInterruptAbortMessage(this: AgentSession, event: AgentEvent): void;
export declare function _applyProviderErrorGuidance(this: AgentSession, event: AgentEvent): void;
/** Resolve the pending retry promise */
export declare function _resolveRetry(this: AgentSession): void;
/** Extract text content from a message */
export declare function _getUserMessageText(this: AgentSession, message: Message): string;
/** Find the last assistant message in agent state (including aborted ones) */
export declare function _findLastAssistantMessage(this: AgentSession): AssistantMessage | undefined;
export declare function _replaceMessageInPlace(this: AgentSession, target: AgentMessage, replacement: AgentMessage): void;
/** Emit extension events based on agent events */
export declare function _emitExtensionEvent(this: AgentSession, event: AgentEvent): Promise<void>;
/**
 * Subscribe to agent events.
 * Session persistence is handled internally (saves messages on message_end).
 * Multiple listeners can be added. Returns unsubscribe function for this listener.
 */
export declare function subscribe(this: AgentSession, listener: AgentSessionEventListener): () => void;
/**
 * Temporarily disconnect from agent events.
 * User listeners are preserved and will receive events again after resubscribe().
 * Used internally during operations that need to pause event processing.
 */
export declare function _disconnectFromAgent(this: AgentSession): void;
/**
 * Reconnect to agent events after _disconnectFromAgent().
 * Preserves all existing listeners.
 */
export declare function _reconnectToAgent(this: AgentSession): void;
/**
 * Remove all listeners and disconnect from agent.
 * Call this when completely done with the session.
 */
export declare function dispose(this: AgentSession): void;
/** Full agent state */
export declare const agentSessionEventsMethods: {
    _emit: typeof _emit;
    _emitQueueUpdate: typeof _emitQueueUpdate;
    _handleAgentEvent: typeof _handleAgentEvent;
    _createRetryPromiseForAgentEnd: typeof _createRetryPromiseForAgentEnd;
    _findLastAssistantInMessages: typeof _findLastAssistantInMessages;
    _processAgentEvent: typeof _processAgentEvent;
    _applyInterruptAbortMessage: typeof _applyInterruptAbortMessage;
    _applyProviderErrorGuidance: typeof _applyProviderErrorGuidance;
    _resolveRetry: typeof _resolveRetry;
    _getUserMessageText: typeof _getUserMessageText;
    _findLastAssistantMessage: typeof _findLastAssistantMessage;
    _replaceMessageInPlace: typeof _replaceMessageInPlace;
    _emitExtensionEvent: typeof _emitExtensionEvent;
    subscribe: typeof subscribe;
    _disconnectFromAgent: typeof _disconnectFromAgent;
    _reconnectToAgent: typeof _reconnectToAgent;
    dispose: typeof dispose;
};
//# sourceMappingURL=agent-session-events.d.ts.map