import { z } from 'zod';
import { Logger, ILogObj } from 'tslog';

declare const VERSION: string;

/**
 * Phase types for Corbat-Coco
 */
/**
 * Project phases
 */
type Phase = "idle" | "converge" | "orchestrate" | "complete" | "output";
/**
 * Result of phase execution
 */
interface PhaseResult {
    phase: Phase;
    success: boolean;
    artifacts: PhaseArtifact[];
    error?: string;
    metrics?: PhaseMetrics;
}
/**
 * Artifact produced by a phase
 */
interface PhaseArtifact {
    type: ArtifactType;
    path: string;
    description: string;
}
/**
 * Types of artifacts
 */
type ArtifactType = "specification" | "architecture" | "adr" | "diagram" | "backlog" | "code" | "test" | "documentation" | "cicd" | "deployment";
/**
 * Phase execution metrics
 */
interface PhaseMetrics {
    startTime: Date;
    endTime: Date;
    durationMs: number;
    llmCalls: number;
    tokensUsed: number;
}
/**
 * Phase executor interface
 */
interface PhaseExecutor {
    name: string;
    description: string;
    /**
     * Check if the phase can start given current state
     */
    canStart(context: PhaseContext): boolean;
    /**
     * Execute the phase
     */
    execute(context: PhaseContext): Promise<PhaseResult>;
    /**
     * Check if the phase can complete
     */
    canComplete(context: PhaseContext): boolean;
    /**
     * Create a checkpoint for recovery
     */
    checkpoint(context: PhaseContext): Promise<PhaseCheckpoint>;
    /**
     * Restore from a checkpoint
     */
    restore(checkpoint: PhaseCheckpoint, context: PhaseContext): Promise<void>;
}
/**
 * Context passed to phase executors
 */
interface PhaseContext {
    projectPath: string;
    config: PhaseConfig;
    state: PhaseState;
    tools: PhaseTools;
    llm: LLMInterface;
}
/**
 * Phase-specific configuration
 */
interface PhaseConfig {
    quality: {
        minScore: number;
        minCoverage: number;
        maxIterations: number;
        convergenceThreshold: number;
    };
    timeouts: {
        phaseTimeout: number;
        taskTimeout: number;
        llmTimeout: number;
    };
}
/**
 * Phase state (what the phase has produced so far)
 */
interface PhaseState {
    artifacts: PhaseArtifact[];
    progress: number;
    checkpoint: PhaseCheckpoint | null;
}
/**
 * Tools available to phases
 */
interface PhaseTools {
    file: FileTools;
    bash: BashTools;
    git: GitTools;
    test: TestTools;
    quality: QualityTools;
}
/**
 * LLM interface for phases
 */
interface LLMInterface {
    chat(messages: Message$1[]): Promise<ChatResponse$1>;
    chatWithTools(messages: Message$1[], tools: ToolDefinition$2[]): Promise<ChatWithToolsResponse$1>;
}
/**
 * Phase checkpoint for recovery
 */
interface PhaseCheckpoint {
    phase: Phase;
    timestamp: Date;
    state: PhaseState;
    resumePoint: string;
}
interface FileTools {
    read(path: string): Promise<string>;
    write(path: string, content: string): Promise<void>;
    exists(path: string): Promise<boolean>;
    glob(pattern: string): Promise<string[]>;
}
interface BashTools {
    exec(command: string, options?: ExecOptions): Promise<ExecResult>;
}
interface GitTools {
    status(): Promise<GitStatus>;
    commit(message: string, files?: string[]): Promise<void>;
    push(): Promise<void>;
}
interface TestTools {
    run(pattern?: string): Promise<TestResult>;
    coverage(): Promise<CoverageResult>;
}
interface QualityTools {
    lint(files: string[]): Promise<LintResult>;
    complexity(files: string[]): Promise<ComplexityResult>;
    security(files: string[]): Promise<SecurityResult>;
}
interface Message$1 {
    role: "system" | "user" | "assistant";
    content: string;
}
interface ChatResponse$1 {
    content: string;
    usage: {
        inputTokens: number;
        outputTokens: number;
    };
}
interface ToolDefinition$2 {
    name: string;
    description: string;
    parameters: Record<string, unknown>;
}
interface ChatWithToolsResponse$1 extends ChatResponse$1 {
    toolCalls?: ToolCall$1[];
}
interface ToolCall$1 {
    name: string;
    arguments: Record<string, unknown>;
}
interface ExecOptions {
    cwd?: string;
    timeout?: number;
    env?: Record<string, string>;
}
interface ExecResult {
    stdout: string;
    stderr: string;
    exitCode: number;
}
interface GitStatus {
    branch: string;
    clean: boolean;
    staged: string[];
    unstaged: string[];
    untracked: string[];
}
interface TestResult {
    passed: number;
    failed: number;
    skipped: number;
    duration: number;
    failures: TestFailure[];
}
interface TestFailure {
    name: string;
    message: string;
    stack?: string;
}
interface CoverageResult {
    lines: number;
    branches: number;
    functions: number;
    statements: number;
}
interface LintResult {
    errors: number;
    warnings: number;
    issues: LintIssue[];
}
interface LintIssue {
    file: string;
    line: number;
    column: number;
    severity: "error" | "warning";
    message: string;
    rule: string;
}
interface ComplexityResult {
    averageComplexity: number;
    maxComplexity: number;
    files: FileComplexity[];
}
interface FileComplexity {
    file: string;
    complexity: number;
    functions: FunctionComplexity[];
}
interface FunctionComplexity {
    name: string;
    complexity: number;
    line: number;
}
interface SecurityResult {
    vulnerabilities: number;
    issues: SecurityIssue[];
}
interface SecurityIssue {
    severity: "critical" | "high" | "medium" | "low";
    type: string;
    message: string;
    file?: string;
    line?: number;
}

/**
 * Quality system types for Corbat-Coco
 */
/**
 * Multi-dimensional quality scores
 */
interface QualityScores {
    /**
     * Overall weighted score (0-100)
     */
    overall: number;
    /**
     * Individual dimension scores
     */
    dimensions: QualityDimensions;
    /**
     * Metadata
     */
    evaluatedAt: Date;
    evaluationDurationMs: number;
}
/**
 * Quality dimensions
 */
interface QualityDimensions {
    /**
     * Does the code work correctly? (tests pass, logic correct)
     */
    correctness: number;
    /**
     * Are all requirements met?
     */
    completeness: number;
    /**
     * Are edge cases handled?
     */
    robustness: number;
    /**
     * Is the code clear and understandable?
     */
    readability: number;
    /**
     * Is the code easy to modify?
     */
    maintainability: number;
    /**
     * Cyclomatic complexity score (inverted - higher is better)
     */
    complexity: number;
    /**
     * DRY score - code duplication (inverted - higher is better)
     */
    duplication: number;
    /**
     * Line and branch coverage
     */
    testCoverage: number;
    /**
     * Test meaningfulness and quality
     */
    testQuality: number;
    /**
     * Security vulnerability score (100 = no vulnerabilities)
     */
    security: number;
    /**
     * Documentation coverage
     */
    documentation: number;
    /**
     * Linting and style compliance
     */
    style: number;
}
/**
 * Quality thresholds
 */
interface QualityThresholds {
    /**
     * Minimum acceptable scores (must achieve to pass)
     */
    minimum: {
        overall: number;
        testCoverage: number;
        security: number;
    };
    /**
     * Target scores (excellent quality)
     */
    target: {
        overall: number;
        testCoverage: number;
    };
    /**
     * Convergence threshold (max score delta to consider converged)
     */
    convergenceThreshold: number;
    /**
     * Maximum iterations before forced completion
     */
    maxIterations: number;
    /**
     * Minimum iterations before checking convergence
     */
    minIterations: number;
}

/**
 * Main orchestrator interface
 */
interface Orchestrator {
    initialize(projectPath: string): Promise<void>;
    start(): Promise<void>;
    pause(): Promise<void>;
    resume(): Promise<void>;
    stop(): Promise<void>;
    getCurrentPhase(): Phase;
    transitionTo(phase: Phase): Promise<PhaseResult>;
    getState(): ProjectState;
    getProgress(): Progress;
    on<K extends keyof OrchestratorEvents>(event: K, handler: OrchestratorEvents[K]): void;
    off<K extends keyof OrchestratorEvents>(event: K, handler: OrchestratorEvents[K]): void;
}
/**
 * Orchestrator configuration
 */
interface OrchestratorConfig {
    projectPath: string;
    provider: {
        type: "anthropic" | "openai" | "gemini" | "kimi" | "kimi-code" | "lmstudio";
        apiKey?: string;
        model: string;
        maxTokens?: number;
    };
    quality: {
        minScore: number;
        minCoverage: number;
        maxIterations: number;
        convergenceThreshold: number;
    };
    persistence: {
        checkpointInterval: number;
        maxCheckpoints: number;
    };
}
/**
 * Project state
 */
interface ProjectState {
    id: string;
    name: string;
    path: string;
    createdAt: Date;
    updatedAt: Date;
    currentPhase: Phase;
    phaseHistory: PhaseTransition[];
    currentTask: TaskState | null;
    completedTasks: string[];
    pendingTasks: string[];
    lastScores: QualityScores | null;
    qualityHistory: QualityScores[];
    lastCheckpoint: CheckpointRef | null;
}
/**
 * Phase transition record
 */
interface PhaseTransition {
    from: Phase;
    to: Phase;
    timestamp: Date;
    reason: string;
}
/**
 * Current task state
 */
interface TaskState {
    id: string;
    title: string;
    iteration: number;
    startedAt: Date;
    scores: QualityScores[];
}
/**
 * Checkpoint reference
 */
interface CheckpointRef {
    id: string;
    timestamp: Date;
    phase: Phase;
    canResume: boolean;
}
/**
 * Progress information
 */
interface Progress {
    phase: Phase;
    phaseProgress: number;
    overallProgress: number;
    sprint?: {
        id: string;
        tasksCompleted: number;
        tasksTotal: number;
        avgQuality: number;
    };
    task?: {
        id: string;
        title: string;
        iteration: number;
        currentScore: number;
    };
    startedAt: Date;
    estimatedCompletion?: Date;
}
/**
 * Orchestrator events
 */
interface OrchestratorEvents {
    "phase:start": (phase: Phase) => void;
    "phase:complete": (phase: Phase, result: PhaseResult) => void;
    "task:start": (taskId: string) => void;
    "task:iteration": (taskId: string, iteration: number, score: number) => void;
    "task:complete": (taskId: string, finalScore: number) => void;
    "checkpoint:created": (checkpointId: string) => void;
    error: (error: Error) => void;
}

/**
 * Create a new orchestrator instance
 */
declare function createOrchestrator(config: OrchestratorConfig): Orchestrator;

/**
 * Configuration schema for Corbat-Coco
 */

/**
 * Complete configuration schema
 */
declare const CocoConfigSchema: z.ZodObject<{
    project: z.ZodObject<{
        name: z.ZodString;
        version: z.ZodDefault<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>;
    provider: z.ZodDefault<z.ZodObject<{
        type: z.ZodDefault<z.ZodEnum<{
            anthropic: "anthropic";
            openai: "openai";
            gemini: "gemini";
            kimi: "kimi";
            "kimi-code": "kimi-code";
            lmstudio: "lmstudio";
            deepseek: "deepseek";
            mistral: "mistral";
            codex: "codex";
            ollama: "ollama";
            groq: "groq";
            openrouter: "openrouter";
            together: "together";
            huggingface: "huggingface";
        }>>;
        apiKey: z.ZodOptional<z.ZodString>;
        model: z.ZodDefault<z.ZodString>;
        maxTokens: z.ZodDefault<z.ZodNumber>;
        temperature: z.ZodDefault<z.ZodNumber>;
        timeout: z.ZodDefault<z.ZodNumber>;
    }, z.core.$strip>>;
    quality: z.ZodDefault<z.ZodObject<{
        minScore: z.ZodDefault<z.ZodNumber>;
        minCoverage: z.ZodDefault<z.ZodNumber>;
        maxIterations: z.ZodDefault<z.ZodNumber>;
        minIterations: z.ZodDefault<z.ZodNumber>;
        convergenceThreshold: z.ZodDefault<z.ZodNumber>;
        securityThreshold: z.ZodDefault<z.ZodNumber>;
    }, z.core.$strip>>;
    persistence: z.ZodDefault<z.ZodObject<{
        checkpointInterval: z.ZodDefault<z.ZodNumber>;
        maxCheckpoints: z.ZodDefault<z.ZodNumber>;
        retentionDays: z.ZodDefault<z.ZodNumber>;
        compressOldCheckpoints: z.ZodDefault<z.ZodBoolean>;
    }, z.core.$strip>>;
    stack: z.ZodOptional<z.ZodObject<{
        language: z.ZodEnum<{
            typescript: "typescript";
            python: "python";
            go: "go";
            rust: "rust";
            java: "java";
        }>;
        framework: z.ZodOptional<z.ZodString>;
        profile: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>;
    integrations: z.ZodOptional<z.ZodObject<{
        github: z.ZodOptional<z.ZodObject<{
            enabled: z.ZodDefault<z.ZodBoolean>;
            token: z.ZodOptional<z.ZodString>;
            repo: z.ZodOptional<z.ZodString>;
            createPRs: z.ZodDefault<z.ZodBoolean>;
            createIssues: z.ZodDefault<z.ZodBoolean>;
        }, z.core.$strip>>;
    }, z.core.$strip>>;
    mcp: z.ZodOptional<z.ZodObject<{
        enabled: z.ZodDefault<z.ZodBoolean>;
        configFile: z.ZodOptional<z.ZodString>;
        servers: z.ZodDefault<z.ZodArray<z.ZodObject<{
            name: z.ZodString;
            transport: z.ZodEnum<{
                stdio: "stdio";
                http: "http";
                sse: "sse";
            }>;
            command: z.ZodOptional<z.ZodString>;
            args: z.ZodOptional<z.ZodArray<z.ZodString>>;
            url: z.ZodOptional<z.ZodString>;
            env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
            auth: z.ZodOptional<z.ZodObject<{
                type: z.ZodEnum<{
                    apikey: "apikey";
                    oauth: "oauth";
                    bearer: "bearer";
                }>;
                token: z.ZodOptional<z.ZodString>;
                tokenEnv: z.ZodOptional<z.ZodString>;
                headerName: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>>;
            enabled: z.ZodDefault<z.ZodBoolean>;
            description: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>>>;
    }, z.core.$strip>>;
    tools: z.ZodOptional<z.ZodObject<{
        webSearch: z.ZodOptional<z.ZodObject<{
            engine: z.ZodDefault<z.ZodEnum<{
                duckduckgo: "duckduckgo";
                brave: "brave";
                serpapi: "serpapi";
            }>>;
            apiKey: z.ZodOptional<z.ZodString>;
            maxResults: z.ZodDefault<z.ZodNumber>;
        }, z.core.$strip>>;
        memory: z.ZodOptional<z.ZodObject<{
            maxMemories: z.ZodDefault<z.ZodNumber>;
            scope: z.ZodDefault<z.ZodEnum<{
                global: "global";
                project: "project";
                both: "both";
            }>>;
        }, z.core.$strip>>;
        checkpoint: z.ZodOptional<z.ZodObject<{
            maxCheckpoints: z.ZodDefault<z.ZodNumber>;
            useGitStash: z.ZodDefault<z.ZodBoolean>;
        }, z.core.$strip>>;
        semanticSearch: z.ZodOptional<z.ZodObject<{
            model: z.ZodDefault<z.ZodString>;
            chunkSize: z.ZodDefault<z.ZodNumber>;
            threshold: z.ZodDefault<z.ZodNumber>;
        }, z.core.$strip>>;
    }, z.core.$strip>>;
    ship: z.ZodOptional<z.ZodObject<{
        defaultBaseBranch: z.ZodDefault<z.ZodString>;
        autoDetectBump: z.ZodDefault<z.ZodBoolean>;
        squashMerge: z.ZodDefault<z.ZodBoolean>;
        deleteBranchAfterMerge: z.ZodDefault<z.ZodBoolean>;
        draftPr: z.ZodDefault<z.ZodBoolean>;
        ciCheckTimeoutMs: z.ZodDefault<z.ZodNumber>;
        ciCheckPollMs: z.ZodDefault<z.ZodNumber>;
    }, z.core.$strip>>;
    skills: z.ZodOptional<z.ZodObject<{
        enabled: z.ZodDefault<z.ZodBoolean>;
        globalDir: z.ZodOptional<z.ZodString>;
        projectDir: z.ZodOptional<z.ZodString>;
        autoActivate: z.ZodDefault<z.ZodBoolean>;
        maxActiveSkills: z.ZodDefault<z.ZodNumber>;
        disabled: z.ZodDefault<z.ZodArray<z.ZodString>>;
    }, z.core.$strip>>;
}, z.core.$strip>;
type CocoConfig = z.infer<typeof CocoConfigSchema>;

/**
 * Configuration loader for Corbat-Coco
 *
 * Supports hierarchical configuration with priority:
 * 1. Project config (<project>/.coco/config.json)
 * 2. Global config (~/.coco/config.json)
 * 3. Environment variables
 * 4. Built-in defaults
 */

/**
 * Load configuration from file with hierarchical fallback
 *
 * Priority order:
 * 1. Explicit configPath parameter
 * 2. Project config (<cwd>/.coco/config.json)
 * 3. Global config (~/.coco/config.json)
 * 4. Built-in defaults
 */
declare function loadConfig(configPath?: string): Promise<CocoConfig>;
/**
 * Save configuration to file
 *
 * @param config - Configuration to save
 * @param configPath - Path to save to (defaults to project config)
 * @param global - If true, saves to global config instead
 */
declare function saveConfig(config: CocoConfig, configPath?: string, global?: boolean): Promise<void>;
/**
 * Create default configuration
 */
declare function createDefaultConfig(projectName: string, language?: "typescript" | "python" | "go" | "rust" | "java"): CocoConfig;
/**
 * Check if configuration exists
 *
 * @param scope - "project" | "global" | "any" (default: "any")
 */
declare function configExists(configPath?: string, scope?: "project" | "global" | "any"): Promise<boolean>;

/**
 * Types for the CONVERGE phase
 *
 * This phase focuses on requirement discovery and specification generation
 */
/**
 * Discovery session state
 */
interface DiscoverySession {
    id: string;
    startedAt: Date;
    updatedAt: Date;
    status: DiscoveryStatus;
    /** Initial user input */
    initialInput: string;
    /** Conversation history */
    conversation: DiscoveryMessage[];
    /** Extracted requirements */
    requirements: Requirement[];
    /** Open questions */
    openQuestions: Question[];
    /** Clarifications received */
    clarifications: Clarification[];
    /** Assumptions made */
    assumptions: Assumption[];
    /** Technology decisions */
    techDecisions: TechDecision[];
}
/**
 * Discovery session status
 */
type DiscoveryStatus = "gathering" | "clarifying" | "refining" | "complete" | "spec_generated";
/**
 * Message in discovery conversation
 */
interface DiscoveryMessage {
    id: string;
    timestamp: Date;
    role: "user" | "assistant";
    content: string;
    /** Extracted data from this message */
    extracted?: {
        requirements?: string[];
        questions?: string[];
        decisions?: string[];
    };
}
/**
 * A requirement gathered from discovery
 */
interface Requirement {
    id: string;
    category: RequirementCategory;
    priority: RequirementPriority;
    title: string;
    description: string;
    /** Source message ID */
    sourceMessageId: string;
    /** Whether this is explicitly stated or inferred */
    explicit: boolean;
    /** Acceptance criteria */
    acceptanceCriteria?: string[];
    /** Related requirements */
    relatedTo?: string[];
    /** Status */
    status: "draft" | "confirmed" | "removed";
}
/**
 * Requirement categories
 */
type RequirementCategory = "functional" | "non_functional" | "technical" | "user_experience" | "integration" | "deployment" | "constraint";
/**
 * Requirement priority
 */
type RequirementPriority = "must_have" | "should_have" | "could_have" | "wont_have";
/**
 * A question to ask the user
 */
interface Question {
    id: string;
    category: QuestionCategory;
    question: string;
    context: string;
    importance: "critical" | "important" | "helpful";
    /** Default answer if user doesn't respond */
    defaultAnswer?: string;
    /** Suggested options */
    options?: string[];
    /** Whether this has been asked */
    asked: boolean;
    /** User's answer */
    answer?: string;
}
/**
 * Question categories
 */
type QuestionCategory = "clarification" | "expansion" | "decision" | "confirmation" | "scope" | "priority";
/**
 * A clarification received from user
 */
interface Clarification {
    questionId: string;
    answer: string;
    timestamp: Date;
    /** Requirements affected by this clarification */
    affectedRequirements: string[];
    /** New requirements created from this */
    newRequirements?: string[];
}
/**
 * An assumption made during discovery
 */
interface Assumption {
    id: string;
    category: string;
    statement: string;
    confidence: "high" | "medium" | "low";
    /** Whether user has confirmed this */
    confirmed: boolean;
    /** Impact if wrong */
    impactIfWrong: string;
}
/**
 * A technology decision
 */
interface TechDecision {
    id: string;
    area: TechArea;
    decision: string;
    alternatives: string[];
    rationale: string;
    /** Whether explicitly requested or recommended */
    explicit: boolean;
    /** Impact on other decisions */
    impact?: string[];
}
/**
 * Technology areas
 */
type TechArea = "language" | "framework" | "database" | "infrastructure" | "testing" | "ci_cd" | "monitoring" | "security";
/**
 * Generated specification document
 */
interface Specification {
    version: string;
    generatedAt: Date;
    /** Project overview */
    overview: ProjectOverview;
    /** All requirements organized */
    requirements: RequirementsSection;
    /** Technical specifications */
    technical: TechnicalSection;
    /** Assumptions and risks */
    assumptions: AssumptionsSection;
    /** Out of scope items */
    outOfScope: string[];
    /** Open questions (if any remain) */
    openQuestions: Question[];
}
/**
 * Project overview section
 */
interface ProjectOverview {
    name: string;
    description: string;
    goals: string[];
    targetUsers: string[];
    successCriteria: string[];
}
/**
 * Requirements section
 */
interface RequirementsSection {
    functional: Requirement[];
    nonFunctional: Requirement[];
    constraints: Requirement[];
}
/**
 * Technical specifications section
 */
interface TechnicalSection {
    stack: TechDecision[];
    architecture: string;
    integrations: string[];
    deployment: string;
}
/**
 * Assumptions section
 */
interface AssumptionsSection {
    confirmed: Assumption[];
    unconfirmed: Assumption[];
    risks: Risk[];
}
/**
 * A project risk
 */
interface Risk {
    id: string;
    description: string;
    probability: "high" | "medium" | "low";
    impact: "high" | "medium" | "low";
    mitigation: string;
}
/**
 * Discovery engine configuration
 */
interface DiscoveryConfig {
    /** Maximum questions to ask in a single round */
    maxQuestionsPerRound: number;
    /** Minimum requirements before proceeding */
    minRequirements: number;
    /** Whether to auto-confirm low-confidence assumptions */
    autoConfirmLowConfidence: boolean;
    /** Default language if not specified */
    defaultLanguage: "typescript" | "python" | "go" | "rust" | "java";
    /** Whether to generate diagrams in spec */
    includeDiagrams: boolean;
}
/**
 * Result of analyzing user input
 */
interface InputAnalysis {
    /** Detected project type */
    projectType: ProjectType;
    /** Complexity assessment */
    complexity: "simple" | "moderate" | "complex" | "enterprise";
    /** Completeness of input */
    completeness: number;
    /** Extracted requirements */
    requirements: Requirement[];
    /** Questions to ask */
    suggestedQuestions: Question[];
    /** Inferred assumptions */
    assumptions: Assumption[];
    /** Technology hints */
    techHints: Partial<TechDecision>[];
}
/**
 * Project types
 */
type ProjectType = "cli" | "api" | "web_app" | "library" | "service" | "full_stack" | "automation" | "unknown";

/**
 * LLM Provider types for Corbat-Coco
 */
/**
 * Message role
 */
type MessageRole = "system" | "user" | "assistant";
/**
 * Message content types
 */
type MessageContent = string | Array<TextContent | ImageContent | ToolUseContent | ToolResultContent>;
/**
 * Text content block
 */
interface TextContent {
    type: "text";
    text: string;
}
/**
 * Image content block
 */
interface ImageContent {
    type: "image";
    source: {
        type: "base64";
        media_type: string;
        data: string;
    };
}
/**
 * Tool use content block
 */
interface ToolUseContent {
    type: "tool_use";
    id: string;
    name: string;
    input: Record<string, unknown>;
}
/**
 * Tool result content block
 */
interface ToolResultContent {
    type: "tool_result";
    tool_use_id: string;
    content: string;
    is_error?: boolean;
}
/**
 * Chat message
 */
interface Message {
    role: MessageRole;
    content: MessageContent;
}
/**
 * Tool definition for LLM
 */
interface ToolDefinition$1 {
    name: string;
    description: string;
    input_schema: {
        type: "object";
        properties: Record<string, unknown>;
        required?: string[];
    };
}
/**
 * Tool call from LLM
 */
interface ToolCall {
    id: string;
    name: string;
    input: Record<string, unknown>;
}
/**
 * Chat options
 */
interface ChatOptions {
    model?: string;
    maxTokens?: number;
    temperature?: number;
    stopSequences?: string[];
    system?: string;
    timeout?: number;
    /** Abort signal to cancel in-flight requests */
    signal?: AbortSignal;
}
/**
 * Chat response
 */
interface ChatResponse {
    id: string;
    content: string;
    stopReason: "end_turn" | "max_tokens" | "stop_sequence" | "tool_use";
    usage: {
        inputTokens: number;
        outputTokens: number;
    };
    model: string;
}
/**
 * Chat with tools options
 */
interface ChatWithToolsOptions extends ChatOptions {
    tools: ToolDefinition$1[];
    toolChoice?: "auto" | "any" | {
        type: "tool";
        name: string;
    };
}
/**
 * Chat with tools response
 */
interface ChatWithToolsResponse extends ChatResponse {
    toolCalls: ToolCall[];
}
/**
 * Stream chunk
 */
interface StreamChunk {
    type: "text" | "tool_use_start" | "tool_use_delta" | "tool_use_end" | "done";
    text?: string;
    toolCall?: Partial<ToolCall>;
    stopReason?: "end_turn" | "max_tokens" | "stop_sequence" | "tool_use";
}
/**
 * LLM Provider interface
 */
interface LLMProvider {
    /**
     * Provider identifier
     */
    id: string;
    /**
     * Provider display name
     */
    name: string;
    /**
     * Initialize the provider
     */
    initialize(config: ProviderConfig): Promise<void>;
    /**
     * Send a chat message
     */
    chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
    /**
     * Send a chat message with tool use
     */
    chatWithTools(messages: Message[], options: ChatWithToolsOptions): Promise<ChatWithToolsResponse>;
    /**
     * Stream a chat response
     */
    stream(messages: Message[], options?: ChatOptions): AsyncIterable<StreamChunk>;
    /**
     * Stream a chat response with tool use
     */
    streamWithTools(messages: Message[], options: ChatWithToolsOptions): AsyncIterable<StreamChunk>;
    /**
     * Count tokens in text
     */
    countTokens(text: string): number;
    /**
     * Get context window size
     */
    getContextWindow(): number;
    /**
     * Check if provider is available
     */
    isAvailable(): Promise<boolean>;
}
/**
 * Provider configuration
 */
interface ProviderConfig {
    apiKey?: string;
    baseUrl?: string;
    model?: string;
    maxTokens?: number;
    temperature?: number;
    timeout?: number;
    /** Internal: flag to indicate using Google Cloud ADC */
    useADC?: boolean;
}

/**
 * Discovery Engine for the CONVERGE phase
 *
 * Handles requirement gathering through conversation with the user
 */

/**
 * Discovery Engine
 *
 * Manages the requirement discovery process through conversation
 */
declare class DiscoveryEngine {
    private session;
    private config;
    private llm;
    constructor(llm: LLMProvider, config?: Partial<DiscoveryConfig>);
    /**
     * Start a new discovery session
     */
    startSession(initialInput: string): Promise<DiscoverySession>;
    /**
     * Resume an existing session
     */
    resumeSession(session: DiscoverySession): void;
    /**
     * Get the current session
     */
    getSession(): DiscoverySession | null;
    /**
     * Analyze user input for requirements
     */
    analyzeInput(input: string): Promise<InputAnalysis>;
    /**
     * Process a user's answer to a question
     */
    processAnswer(questionId: string, answer: string): Promise<void>;
    /**
     * Generate follow-up questions based on current state
     */
    generateQuestions(): Promise<Question[]>;
    /**
     * Process a free-form message from the user
     */
    processMessage(message: string): Promise<{
        newRequirements: Requirement[];
        questions: Question[];
    }>;
    /**
     * Check if discovery is complete
     */
    isComplete(): boolean;
    /**
     * Get unanswered questions
     */
    getOpenQuestions(): Question[];
    /**
     * Get critical questions that must be answered
     */
    getCriticalQuestions(): Question[];
    /**
     * Mark discovery as complete
     */
    markComplete(): void;
    /**
     * Force complete with current requirements
     */
    forceComplete(): void;
    private addMessage;
    private applyAnalysis;
    private updateSessionStatus;
}
/**
 * Create a discovery engine with default configuration
 */
declare function createDiscoveryEngine(llm: LLMProvider, config?: Partial<DiscoveryConfig>): DiscoveryEngine;

/**
 * Types and configuration for the Specification Generator
 */
/**
 * Configuration for specification generation
 */
interface SpecificationConfig {
    /** Include mermaid diagrams */
    includeDiagrams: boolean;
    /** Maximum spec document length */
    maxLength: number;
    /** Include risk analysis */
    includeRisks: boolean;
    /** Output format */
    format: "markdown" | "json";
}
/**
 * Simplified specification format (for tests and simple use cases)
 */
interface SimpleSpec {
    name: string;
    description?: string;
    requirements?: {
        functional?: (string | {
            title?: string;
            description?: string;
        })[];
        nonFunctional?: (string | {
            title?: string;
            description?: string;
        })[];
    };
    assumptions?: string[];
    constraints?: string[];
}

/**
 * Specification Generator for the CONVERGE phase
 *
 * Generates comprehensive project specifications from discovered requirements
 */

/**
 * Specification Generator
 *
 * Creates comprehensive project specification documents
 */
declare class SpecificationGenerator {
    private llm;
    private config;
    constructor(llm: LLMProvider, config?: Partial<SpecificationConfig>);
    /**
     * Generate a specification from a discovery session
     */
    generate(session: DiscoverySession): Promise<Specification>;
    /**
     * Generate a markdown document from the specification
     * Supports both full Specification and simplified test format
     */
    toMarkdown(spec: Specification | SimpleSpec): string;
    /**
     * Generate a markdown document from the specification (alias for toMarkdown)
     */
    generateMarkdown(spec: Specification): string;
    /**
     * Generate JSON output
     */
    generateJSON(spec: Specification): string;
    private generateArchitecture;
}
/**
 * Create a specification generator with default configuration
 */
declare function createSpecificationGenerator(llm: LLMProvider, config?: Partial<SpecificationConfig>): SpecificationGenerator;

/**
 * Session Persistence for the CONVERGE phase
 *
 * Handles saving and loading discovery sessions for recovery
 */

/**
 * Session persistence manager
 */
declare class SessionPersistence {
    private paths;
    constructor(projectPath: string);
    /**
     * Ensure the persistence directory exists
     */
    ensureDir(): Promise<void>;
    /**
     * Save a discovery session
     */
    saveSession(session: DiscoverySession): Promise<void>;
    /**
     * Load a discovery session
     */
    loadSession(): Promise<DiscoverySession | null>;
    /**
     * Check if a session exists
     */
    hasSession(): Promise<boolean>;
    /**
     * Delete a session
     */
    deleteSession(): Promise<void>;
    /**
     * Save the specification markdown
     */
    saveSpecification(content: string): Promise<void>;
    /**
     * Load the specification markdown
     */
    loadSpecification(): Promise<string | null>;
    /**
     * Append a message to the conversation log
     */
    appendConversation(role: "user" | "assistant", content: string): Promise<void>;
    /**
     * Load the full conversation log
     */
    loadConversationLog(): Promise<Array<{
        timestamp: string;
        role: string;
        content: string;
    }>>;
    /**
     * Save a checkpoint
     */
    saveCheckpoint(checkpoint: ConvergeCheckpoint): Promise<void>;
    /**
     * Load a checkpoint
     */
    loadCheckpoint(): Promise<ConvergeCheckpoint | null>;
    /**
     * Clear all persisted data
     */
    clearAll(): Promise<void>;
    /**
     * Get the specification file path
     */
    getSpecPath(): string;
}
/**
 * Checkpoint data for CONVERGE phase
 */
interface ConvergeCheckpoint {
    /** Checkpoint ID */
    id: string;
    /** When the checkpoint was created */
    timestamp: Date;
    /** Current step in the converge process */
    step: ConvergeStep;
    /** Session ID being processed */
    sessionId: string;
    /** Progress percentage */
    progress: number;
    /** Whether spec has been generated */
    specGenerated: boolean;
    /** Metadata for resumption */
    metadata: Record<string, unknown>;
}
/**
 * Steps in the CONVERGE process
 */
type ConvergeStep = "init" | "discovery" | "clarification" | "refinement" | "spec_generation" | "complete";
/**
 * Session manager that combines persistence with session operations
 */
declare class SessionManager {
    private persistence;
    constructor(projectPath: string);
    /**
     * Get the persistence layer
     */
    getPersistence(): SessionPersistence;
    /**
     * Save session with automatic checkpoint
     */
    saveWithCheckpoint(session: DiscoverySession, step: ConvergeStep, progress: number): Promise<void>;
    /**
     * Resume from last checkpoint
     */
    resume(): Promise<{
        session: DiscoverySession;
        checkpoint: ConvergeCheckpoint;
    } | null>;
    /**
     * Check if can resume
     */
    canResume(): Promise<boolean>;
    /**
     * Get resume info without loading full session
     */
    getResumeInfo(): Promise<{
        sessionId: string;
        step: ConvergeStep;
        progress: number;
        timestamp: Date;
    } | null>;
    /**
     * Complete the session and save specification
     */
    complete(session: DiscoverySession, specMarkdown: string): Promise<void>;
}
/**
 * Create a session manager for a project
 */
declare function createSessionManager(projectPath: string): SessionManager;

/**
 * CONVERGE Phase Executor
 *
 * Orchestrates the discovery and specification process
 */

/**
 * CONVERGE phase configuration
 */
interface ConvergeConfig {
    /** Maximum rounds of questions */
    maxQuestionRounds: number;
    /** Maximum questions per round */
    maxQuestionsPerRound: number;
    /** Auto-proceed if no critical questions */
    autoProceed: boolean;
    /** Include diagrams in specification */
    includeDiagrams: boolean;
    /** Callback for user interaction */
    onUserInput?: (prompt: string, options?: string[]) => Promise<string>;
    /** Callback for progress updates */
    onProgress?: (step: ConvergeStep, progress: number, message: string) => void;
}
/**
 * CONVERGE Phase Executor
 *
 * Implements the PhaseExecutor interface for the CONVERGE phase
 */
declare class ConvergeExecutor implements PhaseExecutor {
    readonly name = "converge";
    readonly description = "Gather requirements and generate specification";
    private config;
    private discovery;
    private specGenerator;
    private sessionManager;
    private currentSession;
    private llm;
    constructor(config?: Partial<ConvergeConfig>);
    /**
     * Check if the phase can start
     */
    canStart(_context: PhaseContext): boolean;
    /**
     * Execute the CONVERGE phase
     */
    execute(context: PhaseContext): Promise<PhaseResult>;
    /**
     * Check if the phase can complete
     */
    canComplete(_context: PhaseContext): boolean;
    /**
     * Create a checkpoint for recovery
     */
    checkpoint(_context: PhaseContext): Promise<PhaseCheckpoint>;
    /**
     * Restore from a checkpoint
     */
    restore(_checkpoint: PhaseCheckpoint, context: PhaseContext): Promise<void>;
    private initialize;
    private createLLMAdapter;
    private runDiscoveryLoop;
    private askQuestion;
    private getUserInput;
    private reportProgress;
    private saveProgress;
    private getCurrentStep;
    private calculateProgress;
}
/**
 * Create a CONVERGE phase executor
 */
declare function createConvergeExecutor(config?: Partial<ConvergeConfig>): ConvergeExecutor;

/**
 * Task types for Corbat-Coco
 */

/**
 * Task in the backlog
 */
interface Task {
    id: string;
    storyId: string;
    title: string;
    description: string;
    type: TaskType;
    files: string[];
    dependencies: string[];
    estimatedComplexity: TaskComplexity;
    status: TaskStatus;
    assignedSprint?: string;
}
/**
 * Task types
 */
type TaskType = "feature" | "test" | "refactor" | "docs" | "infra" | "config";
/**
 * Task complexity levels
 */
type TaskComplexity = "trivial" | "simple" | "moderate" | "complex";
/**
 * Task status
 */
type TaskStatus = "pending" | "in_progress" | "completed" | "blocked" | "rolled_back";
/**
 * Version of a task (iteration snapshot)
 */
interface TaskVersion {
    version: number;
    timestamp: Date;
    /**
     * Files changed in this version
     */
    changes: TaskChanges;
    /**
     * Diffs for each changed file
     */
    diffs: FileDiff[];
    /**
     * Quality scores for this version
     */
    scores: QualityScores;
    /**
     * Test results
     */
    testResults: TaskTestResults;
    /**
     * Analysis and reasoning
     */
    analysis: TaskAnalysis;
}
/**
 * Changes made in a task version
 */
interface TaskChanges {
    filesCreated: string[];
    filesModified: string[];
    filesDeleted: string[];
}
/**
 * Diff for a single file
 */
interface FileDiff {
    file: string;
    diff: string;
    additions: number;
    deletions: number;
}
/**
 * Test results for a task version
 */
interface TaskTestResults {
    passed: number;
    failed: number;
    skipped: number;
    coverage: {
        lines: number;
        branches: number;
        functions: number;
    };
    failures: TestFailureInfo[];
}
/**
 * Information about a test failure
 */
interface TestFailureInfo {
    name: string;
    file: string;
    message: string;
    stack?: string;
}
/**
 * Analysis of a task version
 */
interface TaskAnalysis {
    /**
     * Issues found in this version
     */
    issuesFound: TaskIssue[];
    /**
     * Improvements applied from previous version
     */
    improvementsApplied: TaskImprovement[];
    /**
     * LLM reasoning for changes
     */
    reasoning: string;
    /**
     * Confidence level (0-100)
     */
    confidence: number;
}
/**
 * Issue found in task code
 */
interface TaskIssue {
    category: IssueCategory;
    severity: "critical" | "major" | "minor" | "info";
    message: string;
    file?: string;
    line?: number;
    suggestion?: string;
}
/**
 * Issue categories
 */
type IssueCategory = "correctness" | "completeness" | "robustness" | "readability" | "maintainability" | "performance" | "security" | "testing" | "documentation" | "style";
/**
 * Improvement made to task code
 */
interface TaskImprovement {
    category: IssueCategory;
    description: string;
    impact: "high" | "medium" | "low";
    scoreImpact: number;
}
/**
 * Complete history of a task
 */
interface TaskHistory {
    taskId: string;
    task: Task;
    versions: TaskVersion[];
    currentVersion: number;
    status: TaskStatus;
    /**
     * Metrics
     */
    metrics: TaskMetrics;
    /**
     * Final result (if completed)
     */
    finalResult?: TaskFinalResult;
}
/**
 * Task execution metrics
 */
interface TaskMetrics {
    totalIterations: number;
    totalTimeMs: number;
    llmCalls: number;
    tokensUsed: number;
    qualityProgression: number[];
    convergenceIteration?: number;
}
/**
 * Final result of completed task
 */
interface TaskFinalResult {
    completedAt: Date;
    finalScore: number;
    totalIterations: number;
    filesCreated: string[];
    filesModified: string[];
    converged: boolean;
    convergenceReason: string;
}
/**
 * Story (user story containing tasks)
 */
interface Story {
    id: string;
    epicId: string;
    title: string;
    asA: string;
    iWant: string;
    soThat: string;
    acceptanceCriteria: string[];
    tasks: string[];
    points: number;
    status: StoryStatus;
}
/**
 * Story status
 */
type StoryStatus = "backlog" | "ready" | "in_progress" | "review" | "done";
/**
 * Epic (collection of related stories)
 */
interface Epic {
    id: string;
    title: string;
    description: string;
    stories: string[];
    priority: 1 | 2 | 3 | 4 | 5;
    dependencies: string[];
    status: EpicStatus;
}
/**
 * Epic status
 */
type EpicStatus = "planned" | "in_progress" | "done";
/**
 * Sprint
 */
interface Sprint {
    id: string;
    name: string;
    goal: string;
    startDate: Date;
    endDate?: Date;
    stories: string[];
    status: SprintStatus;
    metrics?: SprintMetrics;
}
/**
 * Sprint status
 */
type SprintStatus = "planning" | "active" | "review" | "completed";
/**
 * Sprint metrics
 */
interface SprintMetrics {
    plannedPoints: number;
    completedPoints: number;
    tasksCompleted: number;
    tasksTotal: number;
    averageQuality: number;
    velocity: number;
}
/**
 * Backlog (all epics, stories, tasks)
 */
interface Backlog {
    epics: Epic[];
    stories: Story[];
    tasks: Task[];
    currentSprint: Sprint | null;
    completedSprints: Sprint[];
}

/**
 * Types for the ORCHESTRATE phase
 *
 * This phase focuses on architecture design, ADR creation, and backlog generation
 */

/**
 * Architecture document
 */
interface ArchitectureDoc {
    version: string;
    generatedAt: Date;
    /** High-level overview */
    overview: ArchitectureOverview;
    /** System components */
    components: Component[];
    /** Component relationships */
    relationships: Relationship[];
    /** Data models */
    dataModels: DataModel[];
    /** External integrations */
    integrations: Integration[];
    /** Diagrams */
    diagrams: ArchitectureDiagram[];
}
/**
 * Architecture overview
 */
interface ArchitectureOverview {
    pattern: ArchitecturePattern;
    description: string;
    principles: string[];
    qualityAttributes: QualityAttribute[];
}
/**
 * Architecture patterns
 */
type ArchitecturePattern = "layered" | "hexagonal" | "clean" | "microservices" | "event_driven" | "cqrs" | "modular_monolith" | "serverless";
/**
 * Quality attribute
 */
interface QualityAttribute {
    name: string;
    description: string;
    priority: "high" | "medium" | "low";
    tradeoffs?: string[];
}
/**
 * System component
 */
interface Component {
    id: string;
    name: string;
    type: ComponentType;
    description: string;
    responsibilities: string[];
    technology?: string;
    layer?: string;
    dependencies: string[];
}
/**
 * Component types
 */
type ComponentType = "service" | "controller" | "repository" | "adapter" | "port" | "domain" | "usecase" | "utility" | "external";
/**
 * Relationship between components
 */
interface Relationship {
    from: string;
    to: string;
    type: RelationshipType;
    description?: string;
}
/**
 * Relationship types
 */
type RelationshipType = "uses" | "implements" | "extends" | "depends" | "calls" | "publishes" | "subscribes";
/**
 * Data model
 */
interface DataModel {
    name: string;
    description: string;
    fields: DataField[];
    relationships: DataRelationship[];
}
/**
 * Data field
 */
interface DataField {
    name: string;
    type: string;
    required: boolean;
    description?: string;
}
/**
 * Data relationship
 */
interface DataRelationship {
    type: "one_to_one" | "one_to_many" | "many_to_many";
    target: string;
    description?: string;
}
/**
 * External integration
 */
interface Integration {
    name: string;
    type: IntegrationType;
    description: string;
    endpoint?: string;
    authentication?: string;
}
/**
 * Integration types
 */
type IntegrationType = "rest_api" | "graphql" | "grpc" | "database" | "message_queue" | "file_system" | "external_service";
/**
 * Architecture diagram
 */
interface ArchitectureDiagram {
    id: string;
    type: DiagramType;
    title: string;
    description: string;
    mermaid: string;
}
/**
 * Diagram types (C4 model + others)
 */
type DiagramType = "c4_context" | "c4_container" | "c4_component" | "c4_code" | "sequence" | "class" | "er" | "flowchart";
/**
 * Architecture Decision Record
 */
interface ADR {
    id: string;
    number: number;
    title: string;
    date: Date;
    status: ADRStatus;
    context: string;
    decision: string;
    consequences: ADRConsequences;
    alternatives?: Alternative[];
    references?: string[];
}
/**
 * ADR status
 */
type ADRStatus = "proposed" | "accepted" | "deprecated" | "superseded";
/**
 * ADR consequences
 */
interface ADRConsequences {
    positive: string[];
    negative: string[];
    neutral?: string[];
}
/**
 * Alternative considered in ADR
 */
interface Alternative {
    option: string;
    pros: string[];
    cons: string[];
    reason: string;
}
/**
 * Backlog generation result
 */
interface BacklogResult {
    backlog: Backlog;
    estimatedSprints: number;
    estimatedVelocity: number;
    warnings: string[];
}
/**
 * Sprint planning configuration
 */
interface SprintConfig {
    /** Sprint duration in days */
    sprintDuration: number;
    /** Target velocity (story points per sprint) */
    targetVelocity: number;
    /** Maximum stories per sprint */
    maxStoriesPerSprint: number;
    /** Include buffer for unexpected work */
    bufferPercentage: number;
}
/**
 * Task breakdown strategy
 */
type TaskBreakdownStrategy = "by_layer" | "by_feature" | "by_component" | "tdd" | "incremental";
/**
 * ORCHESTRATE phase configuration
 */
interface OrchestrateConfig {
    /** Generate C4 diagrams */
    generateC4Diagrams: boolean;
    /** Generate sequence diagrams */
    generateSequenceDiagrams: boolean;
    /** Number of ADRs to generate for key decisions */
    maxADRs: number;
    /** Sprint configuration */
    sprint: SprintConfig;
    /** Task breakdown strategy */
    breakdownStrategy: TaskBreakdownStrategy;
    /** Generate deployment docs */
    generateDeploymentDocs: boolean;
}

/**
 * Architecture Generator for the ORCHESTRATE phase
 *
 * Generates architecture documents, components, and diagrams
 */

/**
 * Architecture Generator
 */
declare class ArchitectureGenerator {
    private llm;
    private config;
    constructor(llm: LLMProvider, config: OrchestrateConfig);
    /**
     * Generate architecture from specification
     */
    generate(specification: Specification): Promise<ArchitectureDoc>;
    /**
     * Generate base architecture
     */
    private generateBaseArchitecture;
    /**
     * Generate C4 diagrams
     */
    private generateC4Diagrams;
    /**
     * Generate sequence diagrams
     */
    private generateSequenceDiagrams;
    /**
     * Generate fallback C4 diagrams if LLM fails
     */
    private generateFallbackC4Diagrams;
}
/**
 * Create an architecture generator
 */
declare function createArchitectureGenerator(llm: LLMProvider, config: OrchestrateConfig): ArchitectureGenerator;

/**
 * ADR Generator for the ORCHESTRATE phase
 *
 * Generates Architecture Decision Records
 */

/**
 * ADR Generator
 */
declare class ADRGenerator {
    private llm;
    private config;
    constructor(llm: LLMProvider, config: OrchestrateConfig);
    /**
     * Generate ADRs from architecture and specification
     */
    generate(architecture: ArchitectureDoc, specification: Specification): Promise<ADR[]>;
    /**
     * Parse a single ADR from LLM response
     */
    private parseADR;
}
/**
 * Create an ADR generator
 */
declare function createADRGenerator(llm: LLMProvider, config: OrchestrateConfig): ADRGenerator;

/**
 * Backlog Generator for the ORCHESTRATE phase
 *
 * Generates epics, stories, tasks, and sprint plans
 */

/**
 * Backlog Generator
 */
declare class BacklogGenerator {
    private llm;
    private config;
    constructor(llm: LLMProvider, config: OrchestrateConfig);
    /**
     * Generate complete backlog from architecture and specification
     */
    generate(architecture: ArchitectureDoc, specification: Specification): Promise<BacklogResult>;
    /**
     * Plan the first sprint from the backlog
     */
    planFirstSprint(backlog: Backlog): Promise<Sprint>;
    /**
     * Auto-select stories for a sprint based on priority and velocity
     */
    private autoSelectSprint;
    private parseEpics;
    private parseStories;
    private parseTasks;
    private normalizePoints;
}
/**
 * Create a backlog generator
 */
declare function createBacklogGenerator(llm: LLMProvider, config: OrchestrateConfig): BacklogGenerator;

/**
 * ORCHESTRATE Phase Executor
 *
 * Orchestrates the architecture design, ADR creation, and backlog generation
 */

/**
 * ORCHESTRATE phase executor
 */
declare class OrchestrateExecutor implements PhaseExecutor {
    readonly name = "orchestrate";
    readonly description = "Design architecture, create ADRs, and generate backlog";
    private config;
    constructor(config?: Partial<OrchestrateConfig>);
    /**
     * Check if the phase can start
     */
    canStart(_context: PhaseContext): boolean;
    /**
     * Execute the ORCHESTRATE phase
     */
    execute(context: PhaseContext): Promise<PhaseResult>;
    /**
     * Check if the phase can complete
     */
    canComplete(_context: PhaseContext): boolean;
    /**
     * Create a checkpoint
     */
    checkpoint(_context: PhaseContext): Promise<PhaseCheckpoint>;
    /**
     * Restore from checkpoint
     */
    restore(_checkpoint: PhaseCheckpoint, _context: PhaseContext): Promise<void>;
    private createLLMAdapter;
    private loadSpecification;
    private createMinimalSpec;
    private saveArchitecture;
    private saveADRs;
    private saveBacklog;
    private saveSprint;
    private saveDiagram;
}
/**
 * Create an ORCHESTRATE phase executor
 */
declare function createOrchestrateExecutor(config?: Partial<OrchestrateConfig>): OrchestrateExecutor;

/**
 * Types for the COMPLETE phase
 *
 * This phase focuses on task execution with quality iteration
 */

/**
 * Task execution result
 */
interface TaskExecutionResult {
    taskId: string;
    success: boolean;
    versions: TaskVersion[];
    finalScore: number;
    converged: boolean;
    iterations: number;
    error?: string;
}
/**
 * Task execution context
 */
interface TaskExecutionContext {
    task: Task;
    projectPath: string;
    sprint: Sprint;
    previousVersions: TaskVersion[];
    qualityConfig: QualityConfig;
}
/**
 * Quality configuration for iterations
 */
interface QualityConfig {
    /** Minimum acceptable score */
    minScore: number;
    /** Minimum coverage percentage */
    minCoverage: number;
    /** Maximum iterations before giving up */
    maxIterations: number;
    /** Score improvement threshold for convergence */
    convergenceThreshold: number;
    /** Minimum iterations before considering convergence */
    minConvergenceIterations: number;
}
/**
 * Code generation request
 */
interface CodeGenerationRequest {
    task: Task;
    context: string;
    previousCode?: string;
    feedback?: string;
    iteration: number;
}
/**
 * Code generation response
 */
interface CodeGenerationResponse {
    files: GeneratedFile[];
    explanation: string;
    confidence: number;
}
/**
 * Generated file
 */
interface GeneratedFile {
    path: string;
    content: string;
    action: "create" | "modify" | "delete";
}
/**
 * Code review result
 */
interface CodeReviewResult {
    passed: boolean;
    scores: QualityScores;
    issues: ReviewIssue[];
    suggestions: ReviewSuggestion[];
    testResults: TestExecutionResult;
}
/**
 * Review issue
 */
interface ReviewIssue {
    severity: "critical" | "major" | "minor" | "info";
    category: keyof QualityDimensions;
    message: string;
    file?: string;
    line?: number;
    suggestion?: string;
}
/**
 * Review suggestion
 */
interface ReviewSuggestion {
    type: "improvement" | "refactor" | "test" | "documentation";
    description: string;
    priority: "high" | "medium" | "low";
    impact: number;
}
/**
 * Test execution result
 */
interface TestExecutionResult {
    passed: number;
    failed: number;
    skipped: number;
    coverage: {
        lines: number;
        branches: number;
        functions: number;
        statements: number;
    };
    failures: TestFailureDetail[];
    duration: number;
}
/**
 * Test failure detail
 */
interface TestFailureDetail {
    name: string;
    file: string;
    message: string;
    stack?: string;
    expected?: string;
    actual?: string;
}
/**
 * Convergence check result
 */
interface ConvergenceCheck {
    converged: boolean;
    reason: string;
    scoreHistory: number[];
    improvement: number;
}
/**
 * COMPLETE phase configuration
 */
interface CompleteConfig {
    /** Quality configuration */
    quality: QualityConfig;
    /** Enable parallel task execution */
    parallelExecution: boolean;
    /** Maximum parallel tasks */
    maxParallelTasks: number;
    /** Save intermediate versions */
    saveVersions: boolean;
    /** Run tests after each iteration */
    runTestsEachIteration: boolean;
    /** Callback for progress updates */
    onProgress?: (progress: CompleteProgress) => void;
    /** Callback for user interaction */
    onUserInput?: (prompt: string) => Promise<string>;
}
/**
 * Progress update
 */
interface CompleteProgress {
    phase: "executing" | "reviewing" | "iterating" | "complete" | "blocked";
    sprintId: string;
    taskId?: string;
    taskTitle?: string;
    iteration?: number;
    currentScore?: number;
    tasksCompleted: number;
    tasksTotal: number;
    message: string;
}

/**
 * Code Generator for the COMPLETE phase
 *
 * Generates code based on task requirements
 */

/**
 * Code Generator
 */
declare class CodeGenerator {
    private llm;
    private maxValidationRetries;
    constructor(llm: LLMProvider);
    /**
     * Generate initial code for a task
     */
    generate(request: CodeGenerationRequest): Promise<CodeGenerationResponse>;
    /**
     * Improve existing code based on feedback
     */
    improve(currentCode: string, issues: Array<{
        severity: string;
        message: string;
        suggestion?: string;
    }>, suggestions: Array<{
        description: string;
        priority: string;
    }>, request: CodeGenerationRequest): Promise<CodeGenerationResponse>;
    /**
     * Validate generated files and auto-fix syntax errors
     */
    private validateAndFixFiles;
    /**
     * Fix syntax errors using LLM
     */
    private fixSyntaxErrors;
    /**
     * Generate tests for existing code
     */
    generateTests(codeToTest: string, targetCoverage: number, currentCoverage: {
        lines: number;
        branches: number;
        functions: number;
    }): Promise<GeneratedFile[]>;
    /**
     * Parse generation response from LLM
     */
    private parseGenerationResponse;
    /**
     * Parse improvement response from LLM
     */
    private parseImprovementResponse;
}
/**
 * Create a code generator
 */
declare function createCodeGenerator(llm: LLMProvider): CodeGenerator;

/**
 * Code Reviewer for the COMPLETE phase
 *
 * Reviews generated code and calculates quality scores
 */

/**
 * Code Reviewer
 */
declare class CodeReviewer {
    private llm;
    private config;
    constructor(llm: LLMProvider, config: QualityConfig);
    /**
     * Review code and generate quality scores
     */
    review(taskTitle: string, taskDescription: string, files: Array<{
        path: string;
        content: string;
    }>, testResults: TestExecutionResult): Promise<CodeReviewResult>;
    /**
     * Analyze test failures and suggest fixes
     */
    analyzeFailures(failures: Array<{
        name: string;
        message: string;
        stack?: string;
    }>, sourceCode: string): Promise<Array<{
        testName: string;
        rootCause: string;
        suggestedFix: string;
        confidence: number;
    }>>;
    /**
     * Check if review passes quality thresholds
     */
    checkPassed(scores: QualityScores): boolean;
    /**
     * Get critical issues from review
     */
    getCriticalIssues(issues: ReviewIssue[]): ReviewIssue[];
    /**
     * Get high-priority suggestions
     */
    getHighPrioritySuggestions(suggestions: ReviewSuggestion[]): ReviewSuggestion[];
    /**
     * Parse review response from LLM
     */
    private parseReviewResponse;
    /**
     * Normalize dimension scores
     */
    private normalizeDimensions;
    /**
     * Normalize a single score
     */
    private normalizeScore;
    /**
     * Calculate overall score from dimensions
     */
    private calculateOverallScore;
    /**
     * Normalize an issue
     */
    private normalizeIssue;
    /**
     * Normalize a suggestion
     */
    private normalizeSuggestion;
    /**
     * Normalize severity
     */
    private normalizeSeverity;
    /**
     * Normalize category
     */
    private normalizeCategory;
    /**
     * Normalize suggestion type
     */
    private normalizeSuggestionType;
    /**
     * Normalize priority
     */
    private normalizePriority;
    /**
     * Create a default failed review
     */
    private createDefaultReview;
}
/**
 * Create a code reviewer
 */
declare function createCodeReviewer(llm: LLMProvider, config: QualityConfig): CodeReviewer;

/**
 * Task Iterator for the COMPLETE phase
 *
 * Manages the quality convergence loop for tasks
 */

/**
 * Task Iterator
 *
 * Manages the generate-review-iterate cycle
 */
declare class TaskIterator {
    private generator;
    private reviewer;
    private config;
    private qualityEvaluator;
    constructor(llm: LLMProvider, config: QualityConfig, projectPath?: string);
    /**
     * Execute a task with quality iteration
     */
    execute(context: TaskExecutionContext, runTests: () => Promise<TestExecutionResult>, saveFiles: (files: GeneratedFile[]) => Promise<void>, onProgress?: (iteration: number, score: number) => void): Promise<TaskExecutionResult>;
    /**
     * Check if quality has converged
     */
    checkConvergence(scoreHistory: number[], review: CodeReviewResult, iteration: number): ConvergenceCheck;
    /**
     * Calculate improvement from score history
     */
    private calculateImprovement;
    /**
     * Build context string for code generation
     */
    private buildContext;
    /**
     * Build feedback string from review
     */
    private buildFeedback;
    /**
     * Convert files array to string
     */
    private filesToString;
    /**
     * Map QualityDimensions key to IssueCategory
     */
    private mapToIssueCategory;
    /**
     * Detect improvements by comparing current and previous review issues.
     * An improvement is an issue from the previous review that no longer appears
     * in the current review (resolved).
     */
    private detectImprovements;
    /**
     * Create a version snapshot
     */
    private createVersion;
}
/**
 * Create a task iterator
 */
declare function createTaskIterator(llm: LLMProvider, config: QualityConfig, projectPath?: string): TaskIterator;

/**
 * COMPLETE Phase Executor
 *
 * Orchestrates task execution with quality iteration
 */

declare class CompleteExecutor implements PhaseExecutor {
    readonly name = "complete";
    readonly description = "Execute tasks with quality iteration";
    private config;
    private iterator;
    private currentSprint;
    private backlog;
    private llmAdapter;
    private checkpointState;
    private completedTaskIds;
    constructor(config?: Partial<CompleteConfig>);
    /**
     * Check if the phase can start
     */
    canStart(_context: PhaseContext): boolean;
    /**
     * Execute the COMPLETE phase
     */
    execute(context: PhaseContext): Promise<PhaseResult>;
    /**
     * Check if the phase can complete
     */
    canComplete(_context: PhaseContext): boolean;
    /**
     * Create a checkpoint
     */
    checkpoint(context: PhaseContext): Promise<PhaseCheckpoint>;
    /**
     * Restore from checkpoint
     */
    restore(checkpoint: PhaseCheckpoint, context: PhaseContext): Promise<void>;
    /**
     * Calculate current progress (0-100)
     */
    private calculateProgress;
    /**
     * Execute a sprint with dependency checking, checkpointing, and parallel execution
     */
    private executeSprint;
    /**
     * Execute tasks sequentially (original behavior)
     */
    private executeTasksSequential;
    /**
     * Execute tasks in parallel batches based on dependencies
     */
    private executeTasksParallel;
    /**
     * Execute a single task
     */
    private executeTask;
    /**
     * Run tests for a task
     */
    private runTests;
    /**
     * Get tasks for a sprint, ordered by dependencies (topological sort)
     */
    private getSprintTasks;
    /**
     * Topological sort tasks by dependencies
     */
    private topologicalSort;
    /**
     * Check if task dependencies are satisfied
     */
    private areDependenciesSatisfied;
    /**
     * Report progress
     */
    private reportProgress;
    /**
     * Load backlog
     */
    private loadBacklog;
    /**
     * Load current sprint
     */
    private loadCurrentSprint;
    /**
     * Save sprint results
     */
    private saveSprintResults;
    /**
     * Generate results markdown
     */
    private generateResultsMarkdown;
}
/**
 * Create a COMPLETE phase executor
 */
declare function createCompleteExecutor(config?: Partial<CompleteConfig>): CompleteExecutor;

/**
 * Types for the OUTPUT phase
 *
 * This phase focuses on CI/CD generation, documentation, and deployment
 */
/**
 * CI/CD configuration
 */
interface CICDConfig {
    provider: CICDProvider;
    features: CICDFeatures;
    environments: Environment[];
    secrets: SecretReference[];
}
/**
 * CI/CD providers
 */
type CICDProvider = "github_actions" | "gitlab_ci" | "jenkins" | "circleci" | "azure_devops";
/**
 * CI/CD features to enable
 */
interface CICDFeatures {
    /** Run tests on push/PR */
    tests: boolean;
    /** Run linting */
    lint: boolean;
    /** Generate coverage reports */
    coverage: boolean;
    /** Build artifacts */
    build: boolean;
    /** Create releases */
    release: boolean;
    /** Deploy to environments */
    deploy: boolean;
    /** Security scanning */
    security: boolean;
    /** Dependency updates */
    dependabot: boolean;
}
/**
 * Deployment environment
 */
interface Environment {
    name: string;
    type: EnvironmentType;
    branch?: string;
    approvalRequired: boolean;
    secrets: string[];
}
/**
 * Environment types
 */
type EnvironmentType = "development" | "staging" | "production";
/**
 * Secret reference
 */
interface SecretReference {
    name: string;
    description: string;
    required: boolean;
}
/**
 * Generated CI/CD file
 */
interface CICDFile {
    path: string;
    content: string;
    description: string;
}
/**
 * Dockerfile configuration
 */
interface DockerConfig {
    baseImage: string;
    port?: number;
    buildArgs: Record<string, string>;
    envVars: Record<string, string>;
    stages: DockerStage[];
}
/**
 * Docker stage (multi-stage build)
 */
interface DockerStage {
    name: string;
    baseImage: string;
    commands: string[];
}
/**
 * Docker Compose configuration
 */
interface ComposeConfig {
    version: string;
    services: ComposeService[];
    networks: string[];
    volumes: string[];
}
/**
 * Docker Compose service
 */
interface ComposeService {
    name: string;
    image?: string;
    build?: string;
    ports: string[];
    environment: Record<string, string>;
    volumes: string[];
    dependsOn: string[];
}
/**
 * Documentation structure
 */
interface DocumentationSet {
    readme: string;
    contributing: string;
    changelog: string;
    api?: string;
    deployment?: string;
    development?: string;
}
/**
 * Release configuration
 */
interface ReleaseConfig {
    versioning: "semver" | "calver" | "custom";
    changelog: boolean;
    assets: string[];
    prerelease: boolean;
}
/**
 * OUTPUT phase configuration
 */
interface OutputConfig {
    /** CI/CD configuration */
    cicd: {
        provider: CICDProvider;
        features: Partial<CICDFeatures>;
    };
    /** Docker configuration */
    docker: {
        enabled: boolean;
        compose: boolean;
    };
    /** Documentation to generate */
    docs: {
        readme: boolean;
        contributing: boolean;
        changelog: boolean;
        api: boolean;
    };
    /** Release configuration */
    release: Partial<ReleaseConfig>;
}
/**
 * Project metadata for output generation
 */
interface ProjectMetadata {
    name: string;
    description: string;
    version: string;
    language: string;
    packageManager: string;
    testCommand: string;
    buildCommand: string;
    startCommand: string;
    author?: string;
    license?: string;
    repository?: string;
}

/**
 * CI/CD Generator for the OUTPUT phase
 *
 * Generates CI/CD configurations for various providers
 */

/**
 * CI/CD Generator
 */
declare class CICDGenerator {
    private metadata;
    private config;
    constructor(metadata: ProjectMetadata, config: CICDConfig);
    /**
     * Generate CI/CD files based on configuration
     */
    generate(): CICDFile[];
    /**
     * Generate GitHub Actions workflows
     */
    private generateGitHubActions;
    /**
     * Generate GitHub Actions CI workflow
     */
    private generateGitHubCI;
    /**
     * Generate GitHub Actions release workflow
     */
    private generateGitHubRelease;
    /**
     * Generate Dependabot configuration
     */
    private generateDependabot;
    /**
     * Generate GitLab CI
     */
    private generateGitLabCI;
}
/**
 * Create a CI/CD generator
 */
declare function createCICDGenerator(metadata: ProjectMetadata, config: CICDConfig): CICDGenerator;

/**
 * Docker Generator for the OUTPUT phase
 *
 * Generates Dockerfile and Docker Compose configurations
 */

/**
 * Docker Generator
 */
declare class DockerGenerator {
    private metadata;
    constructor(metadata: ProjectMetadata);
    /**
     * Generate Dockerfile
     */
    generateDockerfile(config?: Partial<DockerConfig>): string;
    /**
     * Generate Node.js Dockerfile (multi-stage)
     */
    private generateNodeDockerfile;
    /**
     * Generate Python Dockerfile
     */
    private generatePythonDockerfile;
    /**
     * Generate Go Dockerfile
     */
    private generateGoDockerfile;
    /**
     * Generate Docker Compose file
     */
    generateDockerCompose(_config?: Partial<ComposeConfig>): string;
    /**
     * Generate .dockerignore file
     */
    generateDockerignore(): string;
}
/**
 * Create a Docker generator
 */
declare function createDockerGenerator(metadata: ProjectMetadata): DockerGenerator;

/**
 * Documentation Generator for the OUTPUT phase
 *
 * Generates README, CONTRIBUTING, and other documentation
 */

/**
 * Documentation Generator
 */
declare class DocsGenerator {
    private metadata;
    constructor(metadata: ProjectMetadata);
    /**
     * Generate all documentation
     */
    generate(): DocumentationSet;
    /**
     * Generate README.md
     */
    generateReadme(): string;
    /**
     * Generate CONTRIBUTING.md
     */
    generateContributing(): string;
    /**
     * Generate CHANGELOG.md
     */
    generateChangelog(): string;
    /**
     * Generate API documentation
     */
    generateApiDocs(): string;
    /**
     * Generate deployment documentation
     */
    generateDeploymentDocs(): string;
    /**
     * Generate development documentation
     */
    generateDevelopmentDocs(): string;
}
/**
 * Create a documentation generator
 */
declare function createDocsGenerator(metadata: ProjectMetadata): DocsGenerator;

/**
 * OUTPUT Phase Executor
 *
 * Orchestrates CI/CD, Docker, and documentation generation
 */

/**
 * OUTPUT phase executor
 */
declare class OutputExecutor implements PhaseExecutor {
    readonly name = "output";
    readonly description = "Generate CI/CD, Docker, and documentation";
    private config;
    private generatedArtifacts;
    constructor(config?: Partial<OutputConfig>);
    /**
     * Deep merge configuration
     */
    private mergeConfig;
    /**
     * Check if the phase can start
     */
    canStart(context: PhaseContext): boolean;
    /**
     * Execute the OUTPUT phase
     */
    execute(context: PhaseContext): Promise<PhaseResult>;
    /**
     * Check if the phase can complete
     */
    canComplete(_context: PhaseContext): boolean;
    /**
     * Create a checkpoint
     */
    checkpoint(_context: PhaseContext): Promise<PhaseCheckpoint>;
    /**
     * Restore from checkpoint
     */
    restore(checkpoint: PhaseCheckpoint, _context: PhaseContext): Promise<void>;
    /**
     * Load project metadata from package.json
     */
    private loadMetadata;
    /**
     * Ensure directory exists
     */
    private ensureDir;
}
/**
 * Create an OUTPUT phase executor
 */
declare function createOutputExecutor(config?: Partial<OutputConfig>): OutputExecutor;

/**
 * Anthropic Claude provider for Corbat-Coco
 */

/**
 * Anthropic provider implementation
 */
declare class AnthropicProvider implements LLMProvider {
    readonly id: string;
    readonly name: string;
    private client;
    private config;
    private retryConfig;
    constructor(id?: string, name?: string);
    /**
     * Initialize the provider
     */
    initialize(config: ProviderConfig): Promise<void>;
    /**
     * Send a chat message
     */
    chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
    /**
     * Send a chat message with tool use
     */
    chatWithTools(messages: Message[], options: ChatWithToolsOptions): Promise<ChatWithToolsResponse>;
    /**
     * Stream a chat response
     */
    stream(messages: Message[], options?: ChatOptions): AsyncIterable<StreamChunk>;
    /**
     * Stream a chat response with tool use
     */
    streamWithTools(messages: Message[], options: ChatWithToolsOptions): AsyncIterable<StreamChunk>;
    /**
     * Count tokens (improved heuristic for Claude models)
     *
     * Claude uses a BPE tokenizer similar to GPT models. The average ratio varies:
     * - English text: ~4.5 characters per token
     * - Code: ~3.5 characters per token
     * - Whitespace-heavy: ~5 characters per token
     *
     * This heuristic analyzes the text to provide a better estimate.
     */
    countTokens(text: string): number;
    /**
     * Get context window size
     */
    getContextWindow(): number;
    /**
     * Check if provider is available
     */
    isAvailable(): Promise<boolean>;
    /**
     * Ensure client is initialized
     */
    private ensureInitialized;
    /**
     * Extract system prompt from messages array or options.
     *
     * The agent-loop passes the system message as the first element of the
     * messages array (role: "system"). convertMessages() strips it out because
     * Anthropic requires it as a top-level parameter — but all callers forgot
     * to also pass it via options.system. This helper bridges that gap.
     */
    private extractSystem;
    /**
     * Convert messages to Anthropic format
     */
    private convertMessages;
    /**
     * Convert message content to Anthropic format
     */
    private convertContent;
    /**
     * Convert tools to Anthropic format
     */
    private convertTools;
    /**
     * Convert tool choice to Anthropic format
     */
    private convertToolChoice;
    /**
     * Extract text content from response
     */
    private extractTextContent;
    /**
     * Extract tool calls from response
     */
    private extractToolCalls;
    /**
     * Map stop reason to our format
     */
    private mapStopReason;
    /**
     * Handle API errors
     */
    private handleError;
}
/**
 * Create an Anthropic provider
 */
declare function createAnthropicProvider(config?: ProviderConfig): AnthropicProvider;

/**
 * Error handling for Corbat-Coco
 * Custom error types with context and recovery information
 */
/**
 * Base error class for Corbat-Coco
 */
declare class CocoError extends Error {
    readonly code: string;
    readonly context: Record<string, unknown>;
    readonly recoverable: boolean;
    readonly suggestion?: string;
    constructor(message: string, options: {
        code: string;
        context?: Record<string, unknown>;
        recoverable?: boolean;
        suggestion?: string;
        cause?: Error;
    });
    /**
     * Convert to JSON for logging
     */
    toJSON(): Record<string, unknown>;
}
/**
 * Configuration error
 */
declare class ConfigError extends CocoError {
    readonly issues: ConfigIssue[];
    constructor(message: string, options?: {
        issues?: ConfigIssue[];
        configPath?: string;
        cause?: Error;
    });
    /**
     * Format issues as a readable string
     */
    formatIssues(): string;
}
interface ConfigIssue {
    path: string;
    message: string;
}
/**
 * Phase execution error
 */
declare class PhaseError extends CocoError {
    readonly phase: string;
    constructor(message: string, options: {
        phase: string;
        recoverable?: boolean;
        cause?: Error;
    });
}
/**
 * Task execution error
 */
declare class TaskError extends CocoError {
    readonly taskId: string;
    readonly iteration?: number;
    constructor(message: string, options: {
        taskId: string;
        iteration?: number;
        recoverable?: boolean;
        cause?: Error;
    });
}

/**
 * Provider exports for Corbat-Coco
 */

/**
 * Supported provider types
 */
type ProviderType = "anthropic" | "openai" | "codex" | "gemini" | "kimi" | "kimi-code" | "lmstudio" | "ollama" | "groq" | "openrouter" | "mistral" | "deepseek" | "together" | "huggingface" | "qwen";
/**
 * Create a provider by type
 */
declare function createProvider(type: ProviderType, config?: ProviderConfig): Promise<LLMProvider>;

/**
 * Tool Registry for Corbat-Coco
 * Central management of all available tools
 */

/**
 * Tool definition
 */
interface ToolDefinition<TInput = unknown, TOutput = unknown> {
    name: string;
    description: string;
    category: ToolCategory;
    parameters: z.ZodType<TInput, any, any>;
    execute: (params: TInput) => Promise<TOutput>;
}
/**
 * Tool categories
 */
type ToolCategory = "file" | "bash" | "git" | "test" | "quality" | "build" | "deploy" | "config" | "web" | "search" | "memory" | "document";
/**
 * Tool execution result
 */
interface ToolResult<T = unknown> {
    success: boolean;
    data?: T;
    error?: string;
    duration: number;
}
/**
 * Progress callback for long-running operations
 */
type ProgressCallback = (progress: ProgressInfo) => void;
/**
 * Progress information
 */
interface ProgressInfo {
    /** Current step or phase name */
    phase: string;
    /** Progress percentage (0-100), null if indeterminate */
    percent: number | null;
    /** Human-readable message */
    message?: string;
    /** Estimated time remaining in ms, null if unknown */
    estimatedTimeRemaining?: number | null;
    /** Additional metadata */
    metadata?: Record<string, unknown>;
}
/**
 * Options for tool execution
 */
interface ExecuteOptions {
    /** Progress callback for long operations */
    onProgress?: ProgressCallback;
    /** Abort signal for cancellation */
    signal?: AbortSignal;
}
/**
 * Tool registry
 */
declare class ToolRegistry {
    private tools;
    private logger;
    /**
     * Register a tool
     */
    register<TInput, TOutput>(tool: ToolDefinition<TInput, TOutput>): void;
    /**
     * Unregister a tool
     */
    unregister(name: string): boolean;
    /**
     * Get a tool by name
     */
    get<TInput = unknown, TOutput = unknown>(name: string): ToolDefinition<TInput, TOutput> | undefined;
    /**
     * Check if a tool exists
     */
    has(name: string): boolean;
    /**
     * Get all tools
     */
    getAll(): ToolDefinition[];
    /**
     * Get tools by category
     */
    getByCategory(category: ToolCategory): ToolDefinition[];
    /**
     * Execute a tool
     */
    execute<TInput, TOutput>(name: string, params: TInput, options?: ExecuteOptions): Promise<ToolResult<TOutput>>;
    /**
     * Get tool definitions for LLM (simplified format)
     */
    getToolDefinitionsForLLM(): Array<{
        name: string;
        description: string;
        input_schema: Record<string, unknown>;
    }>;
}
/**
 * Create a new tool registry
 */
declare function createToolRegistry(): ToolRegistry;

/**
 * Tool exports for Corbat-Coco
 */

declare function registerAllTools(registry: ToolRegistry): void;
/**
 * Create a registry with all tools registered
 */
declare function createFullToolRegistry(): ToolRegistry;

/**
 * Logging system for Corbat-Coco
 * Based on tslog with structured output
 */

/**
 * Log levels
 */
type LogLevel = "silly" | "trace" | "debug" | "info" | "warn" | "error" | "fatal";
/**
 * Logger configuration
 */
interface LoggerConfig {
    name: string;
    level: LogLevel;
    prettyPrint: boolean;
    logToFile: boolean;
    logDir?: string;
}
/**
 * Create a logger instance
 */
declare function createLogger(config?: Partial<LoggerConfig>): Logger<ILogObj>;

export { ADRGenerator, AnthropicProvider, ArchitectureGenerator, type Backlog, BacklogGenerator, CICDGenerator, type ChatOptions, type ChatResponse, type CocoConfig, CocoError, CodeGenerator, CodeReviewer, CompleteExecutor, ConfigError, ConvergeExecutor, DiscoveryEngine, DockerGenerator, DocsGenerator, type Epic, type LLMProvider, type Message, OrchestrateExecutor, type Orchestrator, type OrchestratorConfig, OutputExecutor, type Phase, type PhaseContext, PhaseError, type PhaseExecutor, type PhaseResult, type Progress, type ProjectState, type QualityDimensions, type QualityScores, type QualityThresholds, SessionManager, SpecificationGenerator, type Sprint, type Story, type Task, TaskError, type TaskHistory, TaskIterator, type TaskVersion, ToolRegistry, VERSION, configExists, createADRGenerator, createAnthropicProvider, createArchitectureGenerator, createBacklogGenerator, createCICDGenerator, createCodeGenerator, createCodeReviewer, createCompleteExecutor, createConvergeExecutor, createDefaultConfig, createDiscoveryEngine, createDockerGenerator, createDocsGenerator, createFullToolRegistry, createLogger, createOrchestrateExecutor, createOrchestrator, createOutputExecutor, createProvider, createSessionManager, createSpecificationGenerator, createTaskIterator, createToolRegistry, loadConfig, registerAllTools, saveConfig };
