export type WorkflowRole = 'researcher' | 'implementer' | 'reviewer' | 'critic' | 'risk_checker' | 'final_approver' | 'bull_researcher' | 'bear_researcher'; export interface WorkflowStageTemplate { id: string; role: WorkflowRole; title: string; instruction: string; requiredFor: 'complex' | 'high_risk'; } export interface WorkflowTemplate { id: string; name: string; description: string; stages: WorkflowStageTemplate[]; } export interface WorkflowDecisionLog { task: string; agentName: string; role?: WorkflowRole | string; stage: string; recommendation: string; confidence: number; findings: string[]; risks: string[]; next_actions: string[]; } export interface StructuredAgentOutput { role?: WorkflowRole | string; summary?: string; findings: string[]; risks: string[]; recommendation: string; confidence: number; next_actions: string[]; rawContent?: string; } export interface WorkflowCheckpoint { id: string; stage: string; agentName?: string; status: 'started' | 'completed' | 'failed'; timestamp: number; summary?: string; /** 阶段恢复上下文(用于节点级续跑) */ context?: { task: string; priorOutputs: string[]; stageIndex: number; }; } /** 辩论输出结构(Bull/Bear Debate) */ export interface DebateOutput { topic: string; bull_arguments: string[]; bear_arguments: string[]; synthesis: string; unresolved_points: string[]; confidence: number; } export declare const DEFAULT_COMPLEX_WORKFLOW_TEMPLATE: WorkflowTemplate; export declare function getWorkflowTemplate(id?: string): WorkflowTemplate | undefined; export declare function getWorkflowRoleStage(role?: WorkflowRole | string): string; export declare function formatWorkflowTemplateForPrompt(template?: WorkflowTemplate): string; export declare function buildWorkflowDecisionMemory(log: WorkflowDecisionLog): string; /** * 从一次 workflow run 的 checkpoint 快照 + 主输出文本中提取决策记忆内容。 * * 纯函数,无 I/O 副作用。上层应用在 run 完成后调用此函数, * 将返回的内容写入各自的记忆存储(文件 / MySQL / 等)。 * * @param checkpoints 内核 RunRegistry 维护的 checkpoint 列表 * @param finalText 主运行收集到的完整输出文本 * @param userTask 用户原始输入(作为 decision log 的 task 字段) * @returns 决策记忆纯文本内容;若非 workflow 运行(无 checkpoint)返回 null */ export declare function extractWorkflowDecisionFromRun(checkpoints: WorkflowCheckpoint[], finalText: string, userTask: string): string | null; export declare function buildStructuredOutputInstruction(role?: WorkflowRole | string): string; export declare function wrapTaskWithWorkflowInstructions(task: string, role?: WorkflowRole | string): string; export declare function parseStructuredAgentOutput(content: string, fallbackRole?: WorkflowRole | string): StructuredAgentOutput; export declare function formatStructuredAgentOutput(agentName: string, output: StructuredAgentOutput, iterations?: number, toolSummary?: string[]): string; export declare function buildDebateInstructions(topic: string, context?: string): { bull: string; bear: string; }; export declare function formatDebateOutput(debate: DebateOutput): string; export declare function parseDebateOutput(bullOutput: StructuredAgentOutput, bearOutput: StructuredAgentOutput, topic: string): DebateOutput; //# sourceMappingURL=workflow.d.ts.map