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
This commit is contained in:
Lukas May
2026-01-31 19:03:42 +01:00
parent 768c4d265e
commit 91e57c66eb
5 changed files with 22 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ import type {
SpawnAgentOptions, SpawnAgentOptions,
AgentResult, AgentResult,
AgentStatus, AgentStatus,
AgentMode,
PendingQuestions, PendingQuestions,
} from './types.js'; } from './types.js';
import type { AgentRepository } from '../db/repositories/agent-repository.js'; import type { AgentRepository } from '../db/repositories/agent-repository.js';
@@ -453,6 +454,7 @@ export class ClaudeAgentManager implements AgentManager {
sessionId: string | null; sessionId: string | null;
worktreeId: string; worktreeId: string;
status: string; status: string;
mode: string;
createdAt: Date; createdAt: Date;
updatedAt: Date; updatedAt: Date;
}): AgentInfo { }): AgentInfo {
@@ -463,6 +465,7 @@ export class ClaudeAgentManager implements AgentManager {
sessionId: agent.sessionId, sessionId: agent.sessionId,
worktreeId: agent.worktreeId, worktreeId: agent.worktreeId,
status: agent.status as AgentStatus, status: agent.status as AgentStatus,
mode: agent.mode as AgentMode,
createdAt: agent.createdAt, createdAt: agent.createdAt,
updatedAt: agent.updatedAt, updatedAt: agent.updatedAt,
}; };

View File

@@ -133,6 +133,7 @@ export class MockAgentManager implements AgentManager {
sessionId, sessionId,
worktreeId, worktreeId,
status: 'running', status: 'running',
mode: options.mode ?? 'execute',
createdAt: now, createdAt: now,
updatedAt: now, updatedAt: now,
}; };

View File

@@ -7,6 +7,15 @@
export type AgentStatus = 'idle' | 'running' | 'waiting_for_input' | 'stopped' | 'crashed'; 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 * Options for spawning a new agent
*/ */
@@ -19,6 +28,8 @@ export interface SpawnAgentOptions {
prompt: string; prompt: string;
/** Optional working directory (defaults to worktree path) */ /** Optional working directory (defaults to worktree path) */
cwd?: string; cwd?: string;
/** Agent operation mode (defaults to 'execute') */
mode?: AgentMode;
} }
/** /**
@@ -37,6 +48,8 @@ export interface AgentInfo {
worktreeId: string; worktreeId: string;
/** Current status (waiting_for_input = paused on AskUserQuestion) */ /** Current status (waiting_for_input = paused on AskUserQuestion) */
status: AgentStatus; status: AgentStatus;
/** Current operation mode */
mode: AgentMode;
/** When the agent was created */ /** When the agent was created */
createdAt: Date; createdAt: Date;
/** Last activity timestamp */ /** Last activity timestamp */

View File

@@ -184,6 +184,9 @@ export const agents = sqliteTable('agents', {
}) })
.notNull() .notNull()
.default('idle'), .default('idle'),
mode: text('mode', { enum: ['execute', 'discuss', 'breakdown'] })
.notNull()
.default('execute'),
createdAt: integer('created_at', { mode: 'timestamp' }).notNull(), createdAt: integer('created_at', { mode: 'timestamp' }).notNull(),
updatedAt: integer('updated_at', { mode: 'timestamp' }).notNull(), updatedAt: integer('updated_at', { mode: 'timestamp' }).notNull(),
}); });

View File

@@ -64,6 +64,7 @@ function createMockAgentManager(
sessionId: null, sessionId: null,
worktreeId: 'worktree-test', worktreeId: 'worktree-test',
status: 'running', status: 'running',
mode: options.mode ?? 'execute',
createdAt: new Date(), createdAt: new Date(),
updatedAt: new Date(), updatedAt: new Date(),
}; };
@@ -88,6 +89,7 @@ function createIdleAgent(id: string, name: string): AgentInfo {
sessionId: 'session-abc', sessionId: 'session-abc',
worktreeId: 'worktree-xyz', worktreeId: 'worktree-xyz',
status: 'idle', status: 'idle',
mode: 'execute',
createdAt: new Date(), createdAt: new Date(),
updatedAt: new Date(), updatedAt: new Date(),
}; };