/** * Multi-Agent Orchestrator — 多角色编排引擎 * * 核心功能: * - 根据用户指令自动规划协作流程 * - 支持多种编排策略(顺序/并行/审阅循环/自适应) * - Agent 间消息传递 & 上下文共享 * - 审阅与打回机制 * - 事件驱动的进度反馈 */ import type { AgentCore } from "../agent.js"; import type { AgentRole, AgentMessage, CollaborationTask, OrchestratorConfig, OrchestratorEvent, OrchestrationStrategy } from "./types.js"; type EventListener = (event: OrchestratorEvent) => void; export declare class Orchestrator { private agent; private config; private roles; private messages; private tasks; private listeners; private msgCounter; constructor(agent: AgentCore, config?: Partial); /** 注册自定义角色 */ registerRole(role: AgentRole): void; /** 获取所有已注册角色 */ listRoles(): AgentRole[]; /** 获取角色 */ getRole(id: string): AgentRole | undefined; /** 监听事件 */ on(listener: EventListener): void; /** 移除监听器 */ off(listener: EventListener): void; private emit; /** 发送 Agent 间消息 */ private sendMessage; /** 获取消息历史 */ getMessages(taskId?: string): AgentMessage[]; /** * 执行协作任务 * 根据指令自动规划 → 分配角色 → 顺序执行 → 审阅循环 */ execute(instruction: string): Promise; /** 根据用户指令自动规划协作任务 */ private planTask; /** 根据任务类型生成阶段 */ private planPhases; /** 顺序执行 */ private executeSequential; /** 并行执行(无依赖的阶段并行) */ private executeParallel; /** 审阅循环(写手 → 编辑 → 可能打回 → 再写 → 编辑 → 通过 → 发布) */ private executeReviewLoop; /** 自适应编排(简化版,后续可接入 LLM) */ private executeAdaptive; /** 执行单个阶段 */ private executePhase; /** 注入上一阶段的输出作为当前阶段的输入 */ private injectPhaseInput; /** 展平对象用于工具参数 */ private flattenForTool; /** 拓扑排序:将阶段分层(用于并行执行) */ private topologicalSort; /** 获取任务状态 */ getTask(taskId: string): CollaborationTask | undefined; /** 获取所有任务 */ getAllTasks(): CollaborationTask[]; /** 获取编排器状态摘要 */ getStatus(): { roles: number; activeTasks: number; completedTasks: number; messages: number; strategy: OrchestrationStrategy; }; } export {}; //# sourceMappingURL=orchestrator.d.ts.map