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,
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,
};

View File

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

View File

@@ -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 */

View File

@@ -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(),
});

View File

@@ -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(),
};