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:
@@ -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,
|
||||
};
|
||||
|
||||
@@ -133,6 +133,7 @@ export class MockAgentManager implements AgentManager {
|
||||
sessionId,
|
||||
worktreeId,
|
||||
status: 'running',
|
||||
mode: options.mode ?? 'execute',
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
};
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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(),
|
||||
});
|
||||
|
||||
@@ -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(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user