feat: add agent_metrics table schema and Drizzle migration
Adds the agentMetrics table to SQLite schema for storing pre-computed per-agent event counts (questions, subagents, compactions), enabling listForRadar to fetch one row per agent instead of scanning log chunks. Also fixes pre-existing Drizzle snapshot chain collision in meta/ (0035/0036 snapshots had wrong prevId due to parallel agent branches) to unblock drizzle-kit generate. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -513,6 +513,21 @@ export const agentLogChunks = sqliteTable('agent_log_chunks', {
|
||||
export type AgentLogChunk = InferSelectModel<typeof agentLogChunks>;
|
||||
export type NewAgentLogChunk = InferInsertModel<typeof agentLogChunks>;
|
||||
|
||||
// ============================================================================
|
||||
// AGENT METRICS
|
||||
// ============================================================================
|
||||
|
||||
export const agentMetrics = sqliteTable('agent_metrics', {
|
||||
agentId: text('agent_id').primaryKey(),
|
||||
questionsCount: integer('questions_count').notNull().default(0),
|
||||
subagentsCount: integer('subagents_count').notNull().default(0),
|
||||
compactionsCount: integer('compactions_count').notNull().default(0),
|
||||
updatedAt: integer('updated_at', { mode: 'timestamp' }).notNull(),
|
||||
});
|
||||
|
||||
export type AgentMetrics = InferSelectModel<typeof agentMetrics>;
|
||||
export type NewAgentMetrics = InferInsertModel<typeof agentMetrics>;
|
||||
|
||||
// ============================================================================
|
||||
// CONVERSATIONS (inter-agent communication)
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user