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
143 lines • 4.62 kB
TypeScript
/**
* @file agent-orchestrator.ts
* @description Multi-agent orchestration system for collaborative SDLC artifact generation
*
* Implements UC-004: Multi-Agent Documentation Generation
* - Coordinates multiple specialized agents (Primary Author + Reviewers)
* - Manages review cycles and feedback synthesis
* - Ensures comprehensive artifact quality through parallel review
* - Tracks orchestration state and agent progress
*
* @implements NFR-PERF-004: <30s artifact generation coordination
* @implements NFR-QUAL-001: 100% artifact completeness validation
*/
import { EventEmitter } from 'events';
export type AgentRole = 'primary-author' | 'reviewer' | 'synthesizer';
export type AgentType = 'architecture-designer' | 'requirements-analyst' | 'security-architect' | 'test-architect' | 'technical-writer' | 'documentation-synthesizer' | 'devops-engineer' | 'performance-engineer';
export type OrchestrationPhase = 'draft' | 'review' | 'synthesis' | 'complete' | 'failed';
export type ReviewStatus = 'approved' | 'approved-with-changes' | 'conditional' | 'rejected';
export interface AgentTask {
agentType: AgentType;
role: AgentRole;
description: string;
inputPaths: string[];
outputPath: string;
dependsOn?: string[];
timeout?: number;
}
export interface AgentResult {
taskId: string;
agentType: AgentType;
success: boolean;
outputPath: string;
duration: number;
error?: string;
}
export interface ReviewResult extends AgentResult {
status: ReviewStatus;
comments: ReviewComment[];
suggestions: string[];
}
export interface ReviewComment {
severity: 'critical' | 'major' | 'minor' | 'info';
section: string;
comment: string;
suggestedFix?: string;
}
export interface OrchestrationPlan {
artifactType: string;
workingDir: string;
primaryAuthor: AgentTask;
reviewers: AgentTask[];
synthesizer: AgentTask;
validation?: AgentTask;
timeout: number;
}
export interface OrchestrationResult {
plan: OrchestrationPlan;
phase: OrchestrationPhase;
draftResult?: AgentResult;
reviewResults: ReviewResult[];
synthesisResult?: AgentResult;
validationResult?: AgentResult;
finalArtifactPath?: string;
totalDuration: number;
success: boolean;
error?: string;
}
export interface OrchestrationOptions {
workingDir: string;
parallelReviews?: boolean;
requireAllApprovals?: boolean;
maxRetries?: number;
enableValidation?: boolean;
}
export declare class AgentOrchestrator extends EventEmitter {
private activeOrchestrations;
private orchestrationCounter;
constructor();
/**
* Generate a unique orchestration ID
*/
private generateOrchestrationId;
/**
* Create an orchestration plan for SAD generation
*/
createSADPlan(options: OrchestrationOptions): OrchestrationPlan;
/**
* Create an orchestration plan for ADR generation
*/
createADRPlan(options: OrchestrationOptions, decision: string): OrchestrationPlan;
/**
* Create an orchestration plan for Master Test Plan generation
*/
createTestPlanPlan(options: OrchestrationOptions): OrchestrationPlan;
/**
* Execute an orchestration plan
* This simulates agent execution - in production, this would dispatch to actual agent Task tool
*/
executeOrchestration(plan: OrchestrationPlan, options?: OrchestrationOptions): Promise<OrchestrationResult>;
/**
* Execute a single agent task (simulated)
* In production, this would call the Claude Code Task tool with appropriate subagent_type
*/
private executeAgentTask;
/**
* Execute a review task (simulated)
*/
private executeReviewTask;
/**
* Execute reviews sequentially
*/
private executeReviewsSequentially;
/**
* Generate mock review comments (for testing/simulation)
*/
private generateMockComments;
/**
* Generate mock suggestions (for testing/simulation)
*/
private generateMockSuggestions;
/**
* Get next ADR number from directory
*/
private getNextADRNumber;
/**
* Convert decision text to URL-friendly slug
*/
private slugify;
/**
* Delay helper for simulation
*/
private delay;
/**
* Get active orchestrations count
*/
getActiveOrchestrations(): Map<string, OrchestrationResult>;
/**
* Cancel an active orchestration
*/
cancelOrchestration(orchestrationId: string): boolean;
}
export default AgentOrchestrator;
//# sourceMappingURL=agent-orchestrator.d.ts.map