diff --git a/src/test/harness.ts b/src/test/harness.ts index c978588..3151275 100644 --- a/src/test/harness.ts +++ b/src/test/harness.ts @@ -12,6 +12,7 @@ import type { EventBus, DomainEvent } from '../events/types.js'; import { EventEmitterBus } from '../events/bus.js'; import type { AgentManager } from '../agent/types.js'; import { MockAgentManager, type MockAgentScenario } from '../agent/mock-manager.js'; +import type { PendingQuestion } from '../agent/types.js'; import type { WorktreeManager, Worktree, WorktreeDiff, MergeResult } from '../git/types.js'; import type { DispatchManager } from '../dispatch/types.js'; import { DefaultDispatchManager } from '../dispatch/manager.js'; @@ -190,6 +191,30 @@ export interface TestHarness { */ setAgentScenario(agentName: string, scenario: MockAgentScenario): void; + /** + * Convenience: Set agent to complete with done status. + */ + setAgentDone(agentName: string, result?: string): void; + + /** + * Convenience: Set agent to ask a question. + */ + setAgentQuestion( + agentName: string, + question: string, + options?: Array<{ label: string; description?: string }> + ): void; + + /** + * Convenience: Set agent to fail with unrecoverable error. + */ + setAgentError(agentName: string, error: string): void; + + /** + * Get pending question for an agent. + */ + getPendingQuestion(agentId: string): Promise; + /** * Get events by type. */ @@ -276,6 +301,24 @@ export function createTestHarness(): TestHarness { agentManager.setScenario(agentName, scenario); }, + setAgentDone: (agentName: string, result?: string) => { + agentManager.setScenario(agentName, { status: 'done', result }); + }, + + setAgentQuestion: ( + agentName: string, + question: string, + options?: Array<{ label: string; description?: string }> + ) => { + agentManager.setScenario(agentName, { status: 'question', question, options }); + }, + + setAgentError: (agentName: string, error: string) => { + agentManager.setScenario(agentName, { status: 'unrecoverable_error', error }); + }, + + getPendingQuestion: (agentId: string) => agentManager.getPendingQuestion(agentId), + getEventsByType: (type: string) => eventBus.getEventsByType(type), clearEvents: () => eventBus.clearEvents(),