/** * AgentConversationLog — Per-agent execution & dialogue history. * * Tracks every task execution, tool invocation, and token usage for each agent * so operators can click an agent in the topology and inspect its full history. * * @module AgentConversation */ /** A single turn / execution entry for an agent */ export interface AgentTurn { /** Auto-incrementing turn number for this agent */ turnNumber: number; /** ISO 8601 timestamp */ timestamp: string; /** Task instruction or message sent to the agent */ instruction: string; /** Truncated result (first 2000 chars of JSON) */ result?: string; /** Whether the execution succeeded */ success: boolean; /** Error code if failed */ errorCode?: string; /** Tokens consumed in this turn */ tokensUsed?: number; /** Execution wall-time in ms */ executionTimeMs?: number; /** Adapter framework that handled this turn */ adapter?: string; /** Retry attempts needed */ retryAttempts?: number; /** Quality gate outcome */ qualityDecision?: string; /** Correlation id linking to EventBus / ExplainabilityTracer */ correlationId?: string; /** Source agent that delegated this task */ sourceAgent?: string; /** Arbitrary metadata */ metadata?: Record; } /** Aggregate stats for one agent */ export interface AgentStats { totalTurns: number; successCount: number; failureCount: number; totalTokensUsed: number; totalExecutionTimeMs: number; averageExecutionTimeMs: number; lastActivityAt: string | null; } /** Full conversation record for one agent */ export interface AgentConversation { agentId: string; turns: AgentTurn[]; stats: AgentStats; } /** * Collects per-agent execution history. * * @example * ```ts * const log = new AgentConversationLog(); * log.recordTurn('agent-1', { * instruction: 'Summarize the document', * success: true, * tokensUsed: 450, * executionTimeMs: 1200, * }); * const conv = log.getConversation('agent-1'); * // conv.turns.length === 1 * // conv.stats.totalTokensUsed === 450 * ``` */ export declare class AgentConversationLog { private conversations; private maxTurnsPerAgent; constructor(options?: { maxTurnsPerAgent?: number; }); /** * Record a turn for an agent. Returns the assigned turn number. */ recordTurn(agentId: string, turn: Omit & { timestamp?: string; }): number; /** * Get the full conversation for an agent. */ getConversation(agentId: string): AgentConversation | null; /** * Get stats for an agent without copying all turns. */ getStats(agentId: string): AgentStats | null; /** * Get the most recent N turns for an agent. */ getRecentTurns(agentId: string, count: number): AgentTurn[]; /** * List all agent IDs that have recorded turns. */ listAgents(): string[]; /** * Clear the conversation history for a specific agent. */ clearAgent(agentId: string): void; /** * Clear all conversations. */ clear(): void; /** * Total number of turns across all agents. */ get totalTurns(): number; private computeStats; } //# sourceMappingURL=agent-conversation.d.ts.map