/** * Mission Executor Service * * Lightweight orchestration service for Mission autonomous execution. * Does NOT contain LLM logic — the agent runtime handles thinking * via the decompose-mission skill. This service handles: * * - Processing decomposition results (skill output → WorkItems) * - Mission lifecycle (start, pause, resume) * - Progress tracking (aggregate WorkItem statuses) * - Policy enforcement before creating tasks * * @module services/v3/mission-executor.service */ import { type Mission } from '../../types/v2/mission.types.js'; /** A single task from the decomposition skill output. */ export interface DecomposedTask { title: string; description: string; type: 'delegate' | 'review' | 'check'; priority: 'critical' | 'high' | 'medium' | 'low'; suggestedRole?: string; estimatedMinutes?: number; dependsOn?: string[]; /** Key Result this task contributes to (OKR linkage) */ krId?: string; /** How this task contributes to the KR */ krContribution?: 'direct' | 'indirect' | 'measurement'; } /** Decomposition result submitted by the decompose-mission skill. */ export interface DecompositionResult { missionId: string; phase: number; tasks: DecomposedTask[]; } /** Progress snapshot for a Mission. */ export interface MissionProgress { missionId: string; status: string; phase: number; totalTasks: number; completedTasks: number; runningTasks: number; queuedTasks: number; blockedTasks: number; failedTasks: number; progressPercent: number; totalCost: number; } export declare class MissionExecutorService { private static instance; private readonly logger; /** Track which phase each mission is on */ private missionPhases; private constructor(); static getInstance(): MissionExecutorService; static resetInstance(): void; /** * Process decomposition output from the decompose-mission skill. * Creates WorkItems in the TaskPool with dependency metadata. * * @param result - Decomposition result from the skill * @param mission - The parent Mission * @returns Created WorkItem IDs */ processDecomposition(result: DecompositionResult, mission: Mission): Promise; /** * Number of WorkItems already created for a mission during the current * UTC calendar day. Backs the `dailyItemLimit` gate. */ private countItemsCreatedToday; /** * Compute Mission progress from WorkItem statuses. * * @param missionId - The Mission to check * @returns Progress snapshot */ checkProgress(missionId: string): Promise; /** * Pause a Mission — freeze all queued tasks (prevent claiming). * Running tasks continue until completion. * * @param missionId - The Mission to pause */ pauseMission(missionId: string): Promise; /** * Resume a paused Mission — unfreeze scheduled tasks back to queued. * * @param missionId - The Mission to resume */ resumeMission(missionId: string): Promise; /** Result of a phase completion check. */ static readonly PHASE_RESULT: { readonly NOT_COMPLETE: "not_complete"; readonly ADVANCED: "advanced"; readonly GATE_PENDING: "gate_pending"; }; /** * Check if all WorkItems in the current phase are done/verified. * If complete, advance to next phase based on phaseGateApproval policy. * * @param missionId - Mission to check * @param phaseGateApproval - How phase transitions are approved * @returns Phase advancement result */ checkPhaseCompletion(missionId: string, phaseGateApproval?: 'none' | 'team_lead' | 'human'): Promise<{ result: string; phase: number; }>; /** * Cancel remaining queued/blocked tasks in current phase for replanning. * * @param missionId - Mission to replan * @returns Number of cancelled tasks */ cancelRemainingPhaseTasks(missionId: string): Promise; /** * Derive a human-readable mission status from WorkItem counts. */ private deriveMissionStatus; } //# sourceMappingURL=mission-executor.service.d.ts.map