/**
 * Aperant Framework v2 — Config schema types
 *
 * Defines the shape of `.aperant/config.json` — committed to git.
 * See: docs/frameworks/aperant-framework-spec.md Section 5.2, 5.3, 6.1
 */
/** Orchestration mode — how the framework delegates work across phases */
export type OrchestrationMode = 'auto' | 'agent-team' | 'sub-agents' | 'sequential';
/** Track-specific orchestration overrides — roundtable 2026-05-14 R7 */
export interface PerTrackOrchestrationConfig {
    /** QUICK track: small fix / typo / single-file edit. Default 'sequential'. */
    quick?: OrchestrationMode;
    /** STANDARD track: normal feature work. Default 'sequential' per R2. */
    standard?: OrchestrationMode;
    /** DEEP track: multi-package refactor, schema, security. Default 'auto'. */
    deep?: OrchestrationMode;
}
/** Orchestration preferences — how multi-agent workflows are executed */
export interface OrchestrationConfig {
    /** How pipeline phases are delegated (plan → execute → verify → review) */
    phase_delegation: OrchestrationMode;
    /** How multi-reviewer workflows run (apt:pr-review parallel reviewers) */
    review_mode: OrchestrationMode;
    /** How roundtable debates are orchestrated (apt:roundtable 10 agents) */
    debate_mode: OrchestrationMode;
    /**
     * Per-track phase_delegation overrides. When a `--track <quick|standard|deep>`
     * flag is passed to `apt-tools reconcile` AND `per_track[track]` is set, the
     * reconciler uses that value as the requested mode for `phase_delegation`.
     * When unset (the default), the resolver falls back to the global
     * `phase_delegation` field — backward-compatible.
     *
     * Initial defaults (roundtable 2026-05-14 R7):
     *   per_track.quick    = 'sequential'
     *   per_track.standard = 'sequential'  (R2 — verify uses de-anchored re-read)
     *   per_track.deep     = 'auto'        (R4 status quo, resolves to agent-team)
     *
     * Exit condition documented in REPORT.md: if STANDARD verify quality drops
     * >0.5 points across 10+ tasks, flip `per_track.standard` to `'sub-agents'`
     * (R3 — the named fallback).
     */
    per_track?: PerTrackOrchestrationConfig;
}
/** Capabilities reported by host-detect */
export interface HostCapabilities {
    sub_agents: boolean;
    agent_teams: boolean;
    worktrees: boolean;
    background_agents: boolean;
    /** Native structured question/prompt tool (Claude Code AskUserQuestion, Gemini ask_user, OpenCode question) */
    structured_prompts: boolean;
}
/** Result returned by the host-detect command */
export interface HostDetectResult {
    status: 'ok';
    command: 'host-detect';
    host: {
        cli: 'claude-code' | 'codex' | 'gemini-cli' | 'opencode' | 'pi' | 'unknown';
        version: string | null;
        capabilities: HostCapabilities;
    };
}
/** Glob-based risk classification for file paths */
export interface RiskMap {
    critical_paths: string[];
    elevated_paths: string[];
    safe_paths: string[];
}
/** Risk classification levels, ordered lowest to highest */
export type RiskClass = 'Safe' | 'Normal' | 'Elevated' | 'Critical' | 'Destructive';
/** Result of a risk-check command */
export interface RiskCheckResult {
    risk_class: RiskClass;
    matched_pattern: string | null;
    matched_paths: Array<{
        path: string;
        risk_class: RiskClass;
        matched_pattern: string | null;
    }>;
    operation_type: string | null;
}
/** Autonomy level configuration (0-3 scale) */
export interface AutonomyConfig {
    /** Default autonomy level: 0=Supervised, 1=Guided, 2=Autonomous, 3=YOLO */
    default: 0 | 1 | 2 | 3;
    /** Whether --yolo flag is allowed (level 3) */
    allow_yolo: boolean;
}
/** Grace mode for brownfield projects with no test infrastructure (G1 fix) */
export interface GraceMode {
    /** Whether grace mode is currently active */
    enabled: boolean;
    /** Number of tasks remaining before grace expires (starts at 5, per D-20) */
    tasks_remaining: number;
    /** Temporarily lowered Coverage threshold during grace (default: 3) */
    coverage_threshold_override: number;
}
/** Quality assurance thresholds and behavior */
export interface QAConfig {
    /** Minimum score (1-10) for "approved" verdict */
    approved_threshold: number;
    /** Minimum score (1-10) for "approved with notes" verdict */
    approved_with_notes_threshold: number;
    /** Require visual proof capture for UI changes */
    require_proof_for_ui: boolean;
    /** Max fix-verify iterations before failing */
    max_fix_iterations: number;
    /** Grace mode for zero-test projects — auto-expires after 5 tasks or test infra detected */
    grace?: GraceMode;
}
/** Detected or user-specified project archetype */
export type ProjectType = 'web-app' | 'api-service' | 'cli-tool' | 'library' | 'monorepo' | 'unknown';
/** Full v2 config schema — stored at .aperant/config.json */
export interface AperantConfig {
    version: number;
    project_type: ProjectType;
    autonomy: AutonomyConfig;
    qa: QAConfig;
    risk_map: RiskMap;
    verification: {
        open_report: boolean;
        report_formats: string[];
        evidence_capture: boolean;
        max_iterations: number;
        strict: boolean;
    };
    multi_model: {
        enabled?: boolean;
        gemini?: {
            enabled: boolean;
            model: string;
            api_key_env: string;
        };
        codex?: {
            enabled: boolean;
        };
        cross_verification?: {
            enabled: boolean;
            tools: string[];
        };
        video_review?: {
            enabled: boolean;
            model: string;
            api_key_env: string;
        };
    };
    pipeline: {
        skip_review: boolean;
        auto_branch: boolean;
        branch_prefix: string;
    };
    parallelization: {
        enabled: boolean;
        max_agents: number;
        use_worktrees: boolean;
    };
    preferences?: {
        date_format?: string;
        time_format?: string;
        task_index?: boolean;
        health_check?: {
            enabled: boolean;
            interval_minutes: number;
        };
        quick_task_post_verify?: 'ask' | 'always' | 'never';
    };
    /** Orchestration preferences — how multi-agent workflows are executed */
    orchestration?: OrchestrationConfig;
    /** Router behavior — deterministic fast path + optional LLM classifier */
    router?: RouterConfig;
    /** PR-review authorship + round budget (R4 + R5) */
    pr_review?: PrReviewConfig;
    /** Post-ship CI watcher — `/apt:watch-ci` (C28 / D-07) */
    ci_watch?: CiWatchConfig;
    /** TDD Iron Law — opt-in red-green-refactor enforcement (C3) */
    tdd?: TddConfig;
    /** Diagram skill defaults (apt:diagram) — render mode + MCP consent */
    diagram?: DiagramConfig;
    /** Sparring auto-fire — install-time consent (FRAMEWORK-RFC-001) */
    spar?: SparConfig;
}
/**
 * TDD Iron Law configuration (C3).
 *
 * When `iron_law` is true, the executor skill requires every subtask to
 * produce a failing-test commit BEFORE any implementation commit for that
 * subtask. Default (absent or false): TDD is a soft convention only.
 */
export interface TddConfig {
    /** When true, enforce test-first commit order per subtask */
    iron_law: boolean;
}
/**
 * Diagram skill configuration (apt:diagram v1).
 *
 * `mode` is the persisted default render mode — `file` writes a local
 * `.excalidraw` JSON, `mcp` dispatches to a live Excalidraw MCP canvas.
 * The skill's `--mode=...` invocation flag overrides this at call time.
 * Lives in the shared `.aperant/config.json` (team-shared policy).
 *
 * `mcpConsent` is the per-host consent record for MCP mode. Per
 * FRAMEWORK-AUDIT-001, this field is per-user state and is persisted to
 * the gitignored `.aperant/config.local.json` — NOT the shared
 * `config.json`. It surfaces on `DiagramConfig` because callers read the
 * MERGED config (via `loadMergedProjectConfig`); the optional `?` marks
 * that the field is absent until the user records a consent decision.
 * The same host does not re-prompt; a different host invalidates the
 * existing record and re-prompts.
 */
export interface DiagramConfig {
    /** Resolved default render mode (overridable per-call by --mode=...) */
    mode: 'file' | 'mcp';
    /** Per-host MCP consent record from config.local.json; absent until first decision */
    mcpConsent?: {
        host: string;
        decision: 'granted' | 'denied';
        grantedAt: string;
    } | null;
}
/** Per-host LLM provider settings for router Stage 2 classification */
export interface RouterLLMProviderConfig {
    /** CLI command to invoke (argv[0]). e.g. "claude", "codex", "gemini" */
    command: string;
    /** Model identifier passed to the CLI */
    model: string;
    /** Extra argv to append before the prompt (provider-specific) */
    args?: string[];
}
export interface RouterLLMConfig {
    /**
     * Reserved. The router itself no longer invokes a subprocess LLM for
     * classification — the host model classifies inline via `/apt` SKILL.md.
     * This block is kept so skills (e.g. apt-pr-review) can read per-host
     * provider configs from a stable config path.
     */
    enabled?: boolean;
    /** Per-host provider dispatch. Key matches detectHost().cli */
    providers: {
        'claude-code'?: RouterLLMProviderConfig;
        codex?: RouterLLMProviderConfig;
        'gemini-cli'?: RouterLLMProviderConfig;
        opencode?: RouterLLMProviderConfig;
    };
}
export interface RouterConfig {
    llm?: RouterLLMConfig;
}
/**
 * Sparring auto-fire configuration (FRAMEWORK-RFC-001).
 *
 * Per-device opt-in for pipeline-integrated `/apt:spar`. The three fields
 * land in `.aperant/config.local.json` (NOT shared `config.json`) — same
 * AUDIT-001 routing as `diagram.mcpConsent`. Reads MUST go through
 * `loadMergedProjectConfig(targetDir)`; writes MUST go through
 * `writeLocalConfigField(targetDir, dotPath, value)`.
 *
 * `enabled` is the master switch. When `true`, `/apt:run` auto-fires
 * `/apt:spar` per track: STANDARD = after plan, DEEP = after plan AND
 * execute. QUICK is hard-exempt (CLAUDE.md Fast Path Guarantee).
 *
 * `partner` records the user's chosen sparring partner CLI from the
 * install-time prompt, sourced from `apt-tools host-detect`'s
 * `host.partner_transports.<id>` availability map. Stored even when
 * `enabled: false` so a future opt-in preserves the choice.
 *
 * `hint` is the consent-OFF nudge surface. When `true`, framework prints
 * a one-line printed nudge at each pipeline stage success-end:
 *   `[apt] {stage} complete. /apt:spar available before next stage. (skill, not auto-fire)`
 * Default `false` (silent — opt-in to surface the reminder).
 */
export interface SparConfig {
    /** Master switch — true if user opted in at install (per-device, AUDIT-001) */
    enabled: boolean;
    /** Chosen partner CLI ID. Null until the user makes a first decision. */
    partner: 'codex' | 'claude' | 'gemini' | null;
    /** Optional printed-nudge surface when enabled is false. Default false. */
    hint?: boolean;
}
/** PR-review authorship mode — decides whether to auto-fix or just comment */
export type PrReviewAuthorshipMode = 'auto' | 'owned' | 'external';
/** Per-PR review configuration (R4 + R5) */
export interface PrReviewConfig {
    /** Hard cap on review rounds per PR (R5). Default: 4. */
    max_rounds?: number;
    /**
     * Global authorship override:
     *   'auto'     — detect via gh CLI (default)
     *   'owned'    — always treat reviewed PRs as owned (auto-fix + push)
     *   'external' — always comment instead of push
     */
    authorship_override?: PrReviewAuthorshipMode;
    /**
     * Per-PR authorship overrides keyed by 'pr-{N}'. Wins over
     * authorship_override when both are set. Written automatically when
     * the user resolves an 'unknown' authorship prompt.
     */
    authorship_overrides?: Record<string, 'owned' | 'external'>;
    /**
     * Post-ship hint policy. When /apt:ship successfully creates a PR, the
     * skill conditionally emits a tip suggesting `/apt:pr-review --pr {N}`
     * so the user can trigger a deep multi-agent review without having to
     * remember the command.
     *   'always' — print a one-line tip after shipping (the default)
     *   'ask'    — interactively prompt [Y/n]; Y invokes the review inline
     *   'never'  — silent; run /apt:pr-review manually if needed
     * Optional — when absent, apt-ship consumers treat it as 'always'.
     * Autonomy=3 (YOLO) degrades 'ask' to 'always' for one fewer prompt.
     */
    suggest_after_ship?: 'always' | 'ask' | 'never';
}
/**
 * Post-ship CI watcher config (C28 / D-07, D-08).
 *
 * `/apt:watch-ci` polls a freshly-shipped PR's CI on a recurring tick,
 * auto-fixes red checks from first red, pushes the fix, and reschedules
 * itself — bounded by a 5-attempt / 4h wall budget and a 10-trigger stop
 * matrix. See `.aperant/context/notes/framework-post-ship-ci-watcher.md`
 * for the locked D-01..D-08 decisions.
 */
export interface CiWatchConfig {
    /**
     * Post-ship arming policy controlled by `/apt:ship` Section 7.2:
     *   'auto'  — arm the watcher automatically (the default on cron-capable
     *             hosts: Claude Code, Pi). On non-cron hosts (Codex, Gemini,
     *             OpenCode, etc.) `auto` creates the state file but does not
     *             register a host cron; the user advances via `/apt:watch-ci
     *             --tick`.
     *   'ask'   — prompt `[Y/n]` after ship. Autonomy=3 degrades 'ask' → 'auto'
     *             for one fewer prompt in unattended chains.
     *   'never' — silent (the default on non-cron hosts).
     * Absent → ship hook derives the default from host capability.
     */
    after_ship?: 'auto' | 'ask' | 'never';
    /**
     * On all-green CI, auto-merge the PR via `gh pr merge --auto --squash`.
     * Default `false` — the watcher prints a merge hint and leaves the merge
     * decision to the user (matches the user's stated rhythm). Flip to `true`
     * once a calendar week of clean post-launch usage shows zero false-green
     * merges (D-08 kill criteria).
     */
    auto_merge_on_green?: boolean;
}
//# sourceMappingURL=config.d.ts.map