From 91e57c66eb72e0d3db2668a0a2519ae138302997 Mon Sep 17 00:00:00 2001 From: Lukas May Date: Sat, 31 Jan 2026 19:03:42 +0100 Subject: [PATCH] feat(11-01): add AgentMode type and database column - Add AgentMode type: 'execute' | 'discuss' | 'breakdown' - Add mode column to agents table with 'execute' default - Update SpawnAgentOptions to accept optional mode - Update AgentInfo interface to include mode field - Update ClaudeAgentManager.toAgentInfo to map mode - Fix MockAgentManager to include mode in spawn - Fix dispatch manager tests to include mode --- src/agent/manager.ts | 3 +++ src/agent/mock-manager.ts | 1 + src/agent/types.ts | 13 +++++++++++++ src/db/schema.ts | 3 +++ src/dispatch/manager.test.ts | 2 ++ 5 files changed, 22 insertions(+) diff --git a/src/agent/manager.ts b/src/agent/manager.ts index 9b017e2..fcbe7a7 100644 --- a/src/agent/manager.ts +++ b/src/agent/manager.ts @@ -13,6 +13,7 @@ import type { SpawnAgentOptions, AgentResult, AgentStatus, + AgentMode, PendingQuestions, } from './types.js'; import type { AgentRepository } from '../db/repositories/agent-repository.js'; @@ -453,6 +454,7 @@ export class ClaudeAgentManager implements AgentManager { sessionId: string | null; worktreeId: string; status: string; + mode: string; createdAt: Date; updatedAt: Date; }): AgentInfo { @@ -463,6 +465,7 @@ export class ClaudeAgentManager implements AgentManager { sessionId: agent.sessionId, worktreeId: agent.worktreeId, status: agent.status as AgentStatus, + mode: agent.mode as AgentMode, createdAt: agent.createdAt, updatedAt: agent.updatedAt, }; diff --git a/src/agent/mock-manager.ts b/src/agent/mock-manager.ts index b29ed40..c7ece4a 100644 --- a/src/agent/mock-manager.ts +++ b/src/agent/mock-manager.ts @@ -133,6 +133,7 @@ export class MockAgentManager implements AgentManager { sessionId, worktreeId, status: 'running', + mode: options.mode ?? 'execute', createdAt: now, updatedAt: now, }; diff --git a/src/agent/types.ts b/src/agent/types.ts index 1453cc9..ea665b4 100644 --- a/src/agent/types.ts +++ b/src/agent/types.ts @@ -7,6 +7,15 @@ export type AgentStatus = 'idle' | 'running' | 'waiting_for_input' | 'stopped' | 'crashed'; +/** + * Agent operation mode. + * + * - execute: Standard task execution (default) + * - discuss: Gather context through questions, output decisions + * - breakdown: Decompose initiative into phases + */ +export type AgentMode = 'execute' | 'discuss' | 'breakdown'; + /** * Options for spawning a new agent */ @@ -19,6 +28,8 @@ export interface SpawnAgentOptions { prompt: string; /** Optional working directory (defaults to worktree path) */ cwd?: string; + /** Agent operation mode (defaults to 'execute') */ + mode?: AgentMode; } /** @@ -37,6 +48,8 @@ export interface AgentInfo { worktreeId: string; /** Current status (waiting_for_input = paused on AskUserQuestion) */ status: AgentStatus; + /** Current operation mode */ + mode: AgentMode; /** When the agent was created */ createdAt: Date; /** Last activity timestamp */ diff --git a/src/db/schema.ts b/src/db/schema.ts index a5bc1b8..baf9a39 100644 --- a/src/db/schema.ts +++ b/src/db/schema.ts @@ -184,6 +184,9 @@ export const agents = sqliteTable('agents', { }) .notNull() .default('idle'), + mode: text('mode', { enum: ['execute', 'discuss', 'breakdown'] }) + .notNull() + .default('execute'), createdAt: integer('created_at', { mode: 'timestamp' }).notNull(), updatedAt: integer('updated_at', { mode: 'timestamp' }).notNull(), }); diff --git a/src/dispatch/manager.test.ts b/src/dispatch/manager.test.ts index 14195b2..a55de39 100644 --- a/src/dispatch/manager.test.ts +++ b/src/dispatch/manager.test.ts @@ -64,6 +64,7 @@ function createMockAgentManager( sessionId: null, worktreeId: 'worktree-test', status: 'running', + mode: options.mode ?? 'execute', createdAt: new Date(), updatedAt: new Date(), }; @@ -88,6 +89,7 @@ function createIdleAgent(id: string, name: string): AgentInfo { sessionId: 'session-abc', worktreeId: 'worktree-xyz', status: 'idle', + mode: 'execute', createdAt: new Date(), updatedAt: new Date(), };