/** * Log Chunk Repository Port Interface * * Port for agent log chunk persistence operations. * No FK to agents — chunks survive agent deletion. */ import type { AgentLogChunk } from '../schema.js'; export interface LogChunkRepository { insertChunk(data: { agentId: string; agentName: string; sessionNumber: number; content: string; }): Promise; findByAgentId(agentId: string): Promise[]>; /** * Batch-fetch chunks for multiple agent IDs in a single query. * Returns chunks ordered by createdAt ascending. * agentId field is included so results can be grouped by agent. */ findByAgentIds(agentIds: string[]): Promise<{ agentId: string; content: string; sessionNumber: number; createdAt: Date }[]>; deleteByAgentId(agentId: string): Promise; getSessionCount(agentId: string): Promise; /** * Batch-fetch pre-computed metrics for multiple agent IDs. * Returns one row per agent that has metrics. Agents with no * matching row in agent_metrics are omitted (not returned as zeros). */ findMetricsByAgentIds(agentIds: string[]): Promise<{ agentId: string; questionsCount: number; subagentsCount: number; compactionsCount: number; }[]>; }