aiwg
Version:
Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo
131 lines • 4.5 kB
TypeScript
/**
* MockAgentOrchestrator - Mock Claude Code multi-agent orchestration for isolated testing
*
* Simulates agent execution without real API calls, with support for:
* - Controllable responses and delays
* - Error injection for failure testing
* - Execution history tracking
* - Parallel agent simulation
*
* Satisfies NFR-TEST-004: <10% mismatch with real agent behavior
*/
export interface MockAgentBehavior {
/** Function to generate response based on prompt */
responseGenerator: (prompt: string) => string;
/** Optional delay in milliseconds to simulate processing time */
delay?: number;
/** Error rate (0-1) - probability of failure on each execution */
errorRate?: number;
}
export interface AgentRequest {
/** Type/role of the agent (e.g., 'security-architect', 'test-engineer') */
agentType: string;
/** Prompt/instructions for the agent */
prompt: string;
}
export interface AgentResponse {
/** Type/role of the agent that executed */
agentType: string;
/** Generated output from the agent */
output: string;
/** Execution time in milliseconds */
executionTime: number;
/** Error if execution failed */
error?: Error;
}
export interface AgentExecution {
/** Type/role of the agent */
agentType: string;
/** Prompt provided to the agent */
prompt: string;
/** Response from the agent (includes output and timing) */
response: AgentResponse;
/** Timestamp when execution started (epoch milliseconds) */
timestamp: number;
}
/**
* Mock orchestrator for multi-agent testing
* Provides realistic simulation of agent execution patterns
*/
export declare class MockAgentOrchestrator {
private registeredAgents;
private executionHistory;
private globalDelay;
private errorInjections;
private delayInjections;
/**
* Register a mock agent with defined behavior
* @param agentType - Agent identifier (e.g., 'security-architect')
* @param mockBehavior - Configuration for agent behavior
*/
registerAgent(agentType: string, mockBehavior: MockAgentBehavior): void;
/**
* Set global delay applied to all agent executions
* @param ms - Delay in milliseconds
*/
setGlobalDelay(ms: number): void;
/**
* Execute a single agent with given prompt
* @param agentType - Type of agent to execute
* @param prompt - Instructions for the agent
* @returns Promise resolving to agent response
* @throws Error if agent not registered or execution fails
*/
executeAgent(agentType: string, prompt: string): Promise<AgentResponse>;
/**
* Execute multiple agents in parallel
* @param agents - Array of agent requests to execute
* @returns Promise resolving to array of responses (in same order as requests)
*/
executeParallel(agents: AgentRequest[]): Promise<AgentResponse[]>;
/**
* Reset orchestrator state
* Clears execution history, injections, and global delay
* Does NOT clear registered agents
*/
reset(): void;
/**
* Get execution history
* @returns Array of all agent executions (chronological order)
*/
getExecutionHistory(): AgentExecution[];
/**
* Inject one-time error for next execution of specific agent
* @param agentType - Agent that should fail
* @param error - Error to throw on next execution
*/
injectError(agentType: string, error: Error): void;
/**
* Inject one-time delay for next execution of specific agent
* @param agentType - Agent to delay
* @param ms - Additional delay in milliseconds
*/
injectDelay(agentType: string, ms: number): void;
/**
* Get list of registered agent types
* @returns Array of registered agent type identifiers
*/
getRegisteredAgents(): string[];
/**
* Check if agent type is registered
* @param agentType - Agent identifier to check
* @returns True if agent is registered
*/
hasAgent(agentType: string): boolean;
/**
* Unregister an agent
* @param agentType - Agent to remove
* @returns True if agent was removed, false if not registered
*/
unregisterAgent(agentType: string): boolean;
/**
* Clear all registered agents
*/
clearAgents(): void;
/**
* Sleep utility for simulating delays
* @param ms - Milliseconds to sleep
*/
private sleep;
}
//# sourceMappingURL=agent-orchestrator.d.ts.map