import { AgentTARS, AgentEventStream, AgioProviderImpl, ChatCompletionContentPart } from '@agent-tars/core'; import { EventStreamBridge } from '../utils/event-stream'; import type { AgentTARSServer } from '../server'; /** * Response type for agent query execution */ export interface AgentQueryResponse { success: boolean; result?: T; error?: { code: string; message: string; details?: Record; }; } /** * AgentSession - Represents a single agent execution context * * Responsible for: * - Managing an AgentTARS instance and its lifecycle * - Connecting agent events to clients via EventStreamBridge * - Handling queries and interactions with the agent * - Persisting events to storage * - Collecting AGIO monitoring events if configured */ export declare class AgentSession { private server; id: string; agent: AgentTARS; eventBridge: EventStreamBridge; private unsubscribe; private agioProvider?; constructor(server: AgentTARSServer, sessionId: string, agioProviderImpl?: AgioProviderImpl, workingDirectory?: string); /** * Get the current processing status of the agent * @returns Whether the agent is currently processing a request */ getProcessingStatus(): boolean; initialize(): Promise<{ storageUnsubscribe: () => void; }>; /** * Run a query and return a strongly-typed response * This version captures errors and returns structured response objects * @param query The query to process * @returns Structured response with success/error information */ runQuery(query: string | ChatCompletionContentPart[]): Promise; /** * Execute a streaming query with robust error handling * @param query The query to process in streaming mode * @returns AsyncIterable of events or error response */ runQueryStreaming(query: string | ChatCompletionContentPart[]): Promise>; /** * Create a synthetic event stream containing an error event * This allows streaming endpoints to handle errors gracefully */ private createErrorEventStream; /** * Abort the currently running query * @returns True if the agent was running and aborted successfully */ abortQuery(): Promise; cleanup(): Promise; } export default AgentSession; //# sourceMappingURL=AgentSession.d.ts.map