/** * Workflow Integration Module * * Integrates Multi-Role Pattern workflow management with existing Cortex AI system * Uses existing role definitions from .cortex/roles/ directory * Adds workflow state management and handoff mechanisms */ import { CortexAI } from "./index.js"; /** * Workflow execution record */ export interface WorkflowExecution { id: string; roleId: string; status: "pending" | "in_progress" | "completed" | "failed"; startTime: string; endTime?: string; output?: string; deliverables: string[]; error?: string; } /** * Role definition interface for workflow execution */ export interface RoleDefinition { id: string; name: string; description: string; content: string; } /** * Handoff data structure for role communication */ export interface HandoffData { currentRole: string; previousRole?: string; context: Record; completedTasks: string[]; pendingTasks: string[]; deliverables: string[]; nextSteps: string[]; notes?: string; } /** * Workflow state management */ export interface WorkflowState { id: string; issueId?: string; issueTitle?: string; issueDescription?: string; currentRole: string; status: "pending" | "in_progress" | "completed" | "failed" | "blocked"; executions: WorkflowExecution[]; handoffData: HandoffData; createdAt: string; updatedAt: string; completedAt?: string; } /** * Workspace data structure for individual workflow */ export interface WorkspaceData { id: string; workflowId: string; handoffFile: string; prFile: string; createdAt: string; } /** * Workflow Manager integrated with Cortex AI */ export declare class WorkflowManager { private cortex; private projectRoot; private workflowsDir; private workspacesDir; private rolesDir; constructor(cortex: CortexAI, projectRoot: string); /** * Create new workflow for complex task */ createWorkflow(issueId: string, issueTitle: string, issueDescription: string): Promise; /** * Execute next step in workflow */ executeWorkflowStep(workflowId: string): Promise; /** * Get workflow state */ getWorkflowState(workflowId: string): Promise; /** * Select appropriate role based on current context */ private selectAppropriateRole; /** * Execute current role with context compression for long-horizon tasks */ private executeCurrentRole; /** * Compress workflow context for long-horizon tasks */ private compressWorkflowContext; /** * Execute specific role */ private executeRole; /** * Generate workspace hash for unique workspace identification */ private generateWorkspaceHash; /** * Get role definition from .cortex/roles */ private getRoleDefinition; /** * Parse role file content */ private parseRoleFile; /** * Build execution context for role */ private buildRoleExecutionContext; /** * Generate role response */ private generateRoleResponse; /** * Extract deliverables from response */ private extractDeliverables; /** * Check if workflow should continue */ private shouldContinueWorkflow; /** * Select next role */ private selectNextRole; /** * Initialize workspace files (handoff.md and pr.md) */ private initializeWorkspaceFiles; /** * Update handoff file in workspace */ private updateHandoffFile; /** * Generate PR documentation in workspace */ private generatePRDocumentation; /** * Format handoff content */ private formatHandoffContent; /** * Format PR content */ private formatPRContent; /** * Get project context */ private getProjectContext; /** * Save workflow state */ private saveWorkflowState; /** * Generate pending tasks */ private generatePendingTasks; /** * Generate next steps */ private generateNextSteps; /** * Get workspace information for a workflow */ getWorkspaceInfo(workflowId: string): Promise; /** * Generate handoff and PR files for a workflow */ generateWorkflowFiles(workflowId: string): Promise; /** * List all workspaces */ listWorkspaces(): Promise; /** * Record workflow experience */ private recordWorkflowExperience; } //# sourceMappingURL=workflow-integration.d.ts.map