feat(12-03): add decompose mode support to MockAgentManager
- Import TaskBreakdown from schema.ts - Add decompose_complete status to MockAgentScenario type - Update completeAgent() to handle decompose_complete scenarios - Emit agent:stopped with reason 'decompose_complete' for E2E testing
This commit is contained in:
@@ -16,7 +16,7 @@ import type {
|
|||||||
PendingQuestions,
|
PendingQuestions,
|
||||||
QuestionItem,
|
QuestionItem,
|
||||||
} from './types.js';
|
} from './types.js';
|
||||||
import type { Decision, PhaseBreakdown } from './schema.js';
|
import type { Decision, PhaseBreakdown, TaskBreakdown } from './schema.js';
|
||||||
import type {
|
import type {
|
||||||
EventBus,
|
EventBus,
|
||||||
AgentSpawnedEvent,
|
AgentSpawnedEvent,
|
||||||
@@ -30,10 +30,11 @@ import type {
|
|||||||
* Scenario configuration for mock agent behavior.
|
* Scenario configuration for mock agent behavior.
|
||||||
* Uses discriminated union on status to match agent output schema.
|
* Uses discriminated union on status to match agent output schema.
|
||||||
*
|
*
|
||||||
* Supports all three agent modes:
|
* Supports all four agent modes:
|
||||||
* - execute: done/questions/unrecoverable_error
|
* - execute: done/questions/unrecoverable_error
|
||||||
* - discuss: questions/context_complete/unrecoverable_error
|
* - discuss: questions/context_complete/unrecoverable_error
|
||||||
* - breakdown: questions/breakdown_complete/unrecoverable_error
|
* - breakdown: questions/breakdown_complete/unrecoverable_error
|
||||||
|
* - decompose: questions/decompose_complete/unrecoverable_error
|
||||||
*/
|
*/
|
||||||
export type MockAgentScenario =
|
export type MockAgentScenario =
|
||||||
// Execute mode statuses
|
// Execute mode statuses
|
||||||
@@ -66,6 +67,12 @@ export type MockAgentScenario =
|
|||||||
status: 'breakdown_complete';
|
status: 'breakdown_complete';
|
||||||
phases: PhaseBreakdown[];
|
phases: PhaseBreakdown[];
|
||||||
delay?: number;
|
delay?: number;
|
||||||
|
}
|
||||||
|
// Decompose mode status
|
||||||
|
| {
|
||||||
|
status: 'decompose_complete';
|
||||||
|
tasks: TaskBreakdown[];
|
||||||
|
delay?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -329,6 +336,30 @@ export class MockAgentManager implements AgentManager {
|
|||||||
this.eventBus.emit(event);
|
this.eventBus.emit(event);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'decompose_complete':
|
||||||
|
// Decompose mode completion - decomposed phase into tasks
|
||||||
|
record.result = {
|
||||||
|
success: true,
|
||||||
|
message: `Decomposed into ${scenario.tasks.length} tasks`,
|
||||||
|
};
|
||||||
|
record.info.status = 'idle';
|
||||||
|
record.info.updatedAt = new Date();
|
||||||
|
|
||||||
|
if (this.eventBus) {
|
||||||
|
const event: AgentStoppedEvent = {
|
||||||
|
type: 'agent:stopped',
|
||||||
|
timestamp: new Date(),
|
||||||
|
payload: {
|
||||||
|
agentId,
|
||||||
|
name: info.name,
|
||||||
|
taskId: info.taskId,
|
||||||
|
reason: 'decompose_complete',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
this.eventBus.emit(event);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user