// engine/execution-plan/agent-execution-plan.ts
// SPEC-016a criterion 5: Agent-specific execution plan phases.
// Phases: agent_core, tools_integration, knowledge_ingestion, testing, deployment, monitoring.
import { generateAgentExecutionPhases, isAgentSpec } from '../agent-spec-generator.js';
export { isAgentSpec };
/**
 * Returns true if the spec needs agent execution phases.
 * Criteria 5: agent projects get specialized execution phases.
 */
export function needsAgentExecutionPlan(spec, knowledge) {
    if (isAgentSpec(spec)) {
        return true;
    }
    const agentSignals = ['@anthropic-ai/sdk', '@mastra/core', 'langgraph', 'crewai', 'autogen'];
    return knowledge.stack.some((s) => agentSignals.some((sig) => s.toLowerCase().includes(sig)));
}
/**
 * Generate agent execution plan phases.
 * Criteria 5: agent_core, tools_integration, knowledge_ingestion, testing, deployment, monitoring.
 */
export function generateAgentPlan(spec, knowledge) {
    const steps = generateAgentExecutionPhases(spec, knowledge, 1);
    const phaseNames = [
        'Agent Core',
        'Tools Integration',
        'Knowledge Ingestion',
        'Testing',
        'Deployment',
        'Monitoring',
    ];
    // Group steps into named phases (2, 2, 1, 1, 1, 1 steps per phase)
    const phaseBoundaries = [0, 2, 4, 5, 6, 7, 8];
    const phases = [];
    for (let i = 0; i < phaseNames.length; i++) {
        const start = phaseBoundaries[i] ?? 0;
        const end = phaseBoundaries[i + 1] ?? steps.length;
        const phaseSteps = steps.slice(start, end);
        if (phaseSteps.length > 0) {
            phases.push({
                name: phaseNames[i] ?? `Phase ${i + 1}`,
                steps: phaseSteps,
            });
        }
    }
    return phases;
}
//# sourceMappingURL=agent-execution-plan.js.map