pdca
Version:
🎯 AI 驅動的 PDCA 多代理開發系統 - 智能循環控制 + 成本管理 + Token 優化 + 多 AI 引擎支援
133 lines • 3 kB
TypeScript
/**
* 增強型 PDCA 協調器
* 整合配置系統、循環控制器和成本管理
*/
import { EventEmitter } from 'events';
import type { ConfigLoadOptions } from '../types/config.js';
export interface EnhancedOrchestratorOptions {
sessionName?: string;
communicationDir?: string;
configOptions?: ConfigLoadOptions;
}
export interface TaskContext {
taskDescription: string;
sessionId: string;
startTime: Date;
workingDirectory: string;
}
export interface AgentResult {
agent: string;
success: boolean;
output: string;
tokensUsed: number;
qualityScore: number;
executionTime: number;
errors?: string[];
}
export declare class EnhancedOrchestrator extends EventEmitter {
private config;
private configLoader;
private loopController?;
private engineManager;
private selectedEngine?;
private communicationManager;
private sessionName;
private communicationDir;
private activeAgents;
private rl?;
constructor(options?: EnhancedOrchestratorOptions);
/**
* 初始化系統
*/
initialize(configOptions?: ConfigLoadOptions): Promise<void>;
/**
* 執行 PDCA 任務
*/
executeTask(taskDescription: string): Promise<void>;
/**
* 執行單次 PDCA 循環
*/
private executePDCACycle;
/**
* 決定要執行的代理
*/
private determineAgentsToRun;
/**
* 執行單個代理
*/
private executeAgent;
/**
* 初始化循環控制器
*/
private initializeLoopController;
/**
* 初始化 AI 引擎
*/
private initializeAIEngine;
/**
* 獲取代理配置
*/
private getAgentConfig;
/**
* 建構代理 prompt
*/
private buildAgentPrompt;
/**
* 執行 AI 引擎
*/
private executeAIEngine;
/**
* 評估輸出品質
*/
private evaluateOutputQuality;
/**
* 估算 token 使用量
*/
private estimateTokenUsage;
/**
* 計算改進幅度
*/
private calculateImprovement;
/**
* 詢問用戶決策
*/
private promptUserDecision;
/**
* 詢問用戶問題
*/
private askQuestion;
/**
* 設置 readline 介面
*/
private setupReadlineInterface;
/**
* 設置必要目錄
*/
private setupDirectories;
/**
* 顯示最終統計
*/
private displayFinalStatistics;
/**
* 停止系統
*/
stop(): Promise<void>;
/**
* 獲取系統狀態
*/
getStatus(): {
sessionId: string;
engine: string;
session: string;
activeAgents: string[];
statistics: {
totalIterations: number;
totalTokens: number;
totalCost: number;
averageQuality: number;
totalTime: number;
efficiency: number;
} | undefined;
};
}
//# sourceMappingURL=enhanced-orchestrator.d.ts.map