/**
 * Ralph Prompt Utilities
 *
 * Prompts used by the Ralph plan → orchestrate → review loop:
 *   - buildPlannerPrompt:           initial planning OR re-planning from reviewer findings
 *   - buildOrchestratorPrompt:      spawn workers to execute the task list
 *   - buildInfraDiscoveryPrompts:   prompts for parallel sub-agent infrastructure discovery
 *   - buildReviewPrompt:            structured code review with injected changeset + discovery context
 *
 * Plus Zod schemas for structured output, parsing helpers for the reviewer
 * JSON output, and {@link formatReviewForReplan} which renders the merged
 * reviewer output as the markdown brief consumed by the next planner
 * iteration.
 */
import { z } from "zod";
/**
 * Caveman response-style directive injected into every Ralph prompt.
 *
 * Goal: shrink free-form prose across many loop iterations to cut tokens
 * without dropping technical substance. Carve-outs preserve every
 * machine-consumed contract (schemas, headers, enums, tool args, code).
 *
 * Placement: appended via {@link withCaveman} so each builder's strict
 * output-format block remains the final instruction the model reads.
 */
export declare const CAVEMAN_INSTRUCTION = "## Response Style \u2014 Terse Caveman\n\nRespond terse like smart caveman. All technical substance stay. Only fluff die.\n\n### Persistence\nACTIVE EVERY RESPONSE. No revert after many turns. No filler drift. Still active if unsure.\n\n### Rules\nDrop: articles (a/an/the), filler (just/really/basically/actually/simply), pleasantries (sure/certainly/of course/happy to), hedging. Fragments OK. Short synonyms (big not extensive, fix not \"implement a solution for\"). Technical terms exact. Code blocks unchanged. Errors quoted exact.\n\nPattern: `[thing] [action] [reason]. [next step].`\n\nNot: \"Sure! I'd be happy to help you with that. The issue you're experiencing is likely caused by...\"\nYes: \"Bug in auth middleware. Token expiry check use `<` not `<=`. Fix:\"\n\n### Intensity\nDrop articles, fragments OK, short synonyms.\n\nExample \u2014 \"Why React component re-render?\"\n\"New object ref each render. Inline object prop = new ref = re-render. Wrap in `useMemo`.\"\n\nExample \u2014 \"Explain database connection pooling.\"\n\"Pool reuse open DB connections. No new connection per request. Skip handshake overhead.\"\n\n### Auto-Clarity\nDrop caveman for: security warnings, irreversible action confirmations, multi-step sequences where fragment order risks misread, user asks to clarify or repeats question. Resume caveman after clear part done.\n\nExample \u2014 destructive op:\n> **Warning:** This will permanently delete all rows in the `users` table and cannot be undone.\n> ```sql\n> DROP TABLE users;\n> ```\n> Caveman resume. Verify backup exist first.\n\n### Boundaries \u2014 caveman MUST NOT touch\nCaveman compresses free-form prose only. Leave the following exactly as the prompt or schema specifies:\n\n- Code blocks, commit messages, PR descriptions: write normal.\n- Exact enum / literal strings the schema or prompt specifies (e.g. `\"patch is correct\"`, `\"patch is incorrect\"`, task statuses `pending` / `in_progress` / `completed` / `error`).\n- Required section headers and template scaffolding (e.g. `# Debugger Report`, `## Issues Identified`, RFC section names) \u2014 verbatim.\n- Tool names, tool arguments, JSON keys, schema field names.\n- File paths, URLs, command invocations, error text quoted from tools.\n- SQL, JSON, Markdown templates: compress prose inside, never the structure.\n- Task titles / descriptions persisted via task-management tools: keep them self-contained and unambiguous.\n- When the prompt says output ONLY a path / ONLY a fenced block / ONLY a JSON payload, obey that exactly \u2014 caveman does not override output contracts.";
/** Zod schema for a single review finding. */
export declare const ReviewFindingSchema: z.ZodObject<{
    title: z.ZodString;
    body: z.ZodString;
    confidence_score: z.ZodOptional<z.ZodNumber>;
    priority: z.ZodOptional<z.ZodNumber>;
    code_location: z.ZodOptional<z.ZodObject<{
        file_path: z.ZodString;
        line_range: z.ZodObject<{
            start: z.ZodNumber;
            end: z.ZodNumber;
        }, z.core.$strip>;
    }, z.core.$strip>>;
}, z.core.$strip>;
/** Zod schema for the full structured review output. */
export declare const ReviewResultSchema: z.ZodObject<{
    findings: z.ZodArray<z.ZodObject<{
        title: z.ZodString;
        body: z.ZodString;
        confidence_score: z.ZodOptional<z.ZodNumber>;
        priority: z.ZodOptional<z.ZodNumber>;
        code_location: z.ZodOptional<z.ZodObject<{
            file_path: z.ZodString;
            line_range: z.ZodObject<{
                start: z.ZodNumber;
                end: z.ZodNumber;
            }, z.core.$strip>;
        }, z.core.$strip>>;
    }, z.core.$strip>>;
    overall_correctness: z.ZodEnum<{
        "patch is correct": "patch is correct";
        "patch is incorrect": "patch is incorrect";
    }>;
    overall_explanation: z.ZodString;
    overall_confidence_score: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>;
/**
 * JSON Schema derived from the Zod schema — used by Claude and OpenCode SDKs.
 *
 * `target: "openapi-3.0"` drops the `$schema` draft URL that Zod stamps
 * by default. The Claude Agent SDK's validator silently drops
 * `structured_output` when that metadata field is present, so we emit
 * the OpenAPI-flavoured variant which matches the hand-written shape in
 * the SDK's structured-output guide.
 */
export declare const REVIEW_RESULT_JSON_SCHEMA: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
    findings: z.ZodArray<z.ZodObject<{
        title: z.ZodString;
        body: z.ZodString;
        confidence_score: z.ZodOptional<z.ZodNumber>;
        priority: z.ZodOptional<z.ZodNumber>;
        code_location: z.ZodOptional<z.ZodObject<{
            file_path: z.ZodString;
            line_range: z.ZodObject<{
                start: z.ZodNumber;
                end: z.ZodNumber;
            }, z.core.$strip>;
        }, z.core.$strip>>;
    }, z.core.$strip>>;
    overall_correctness: z.ZodEnum<{
        "patch is correct": "patch is correct";
        "patch is incorrect": "patch is incorrect";
    }>;
    overall_explanation: z.ZodString;
    overall_confidence_score: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>>;
/** Result from a reviewer stage with structured output support. */
export interface StructuredReviewResult {
    /** Parsed and filtered review from SDK structured output, or null if unavailable */
    structured: ReviewResult | null;
    /** Raw text output for fallback parsing and debugger input */
    raw: string;
}
/**
 * Merge two parallel reviewer results into one.
 *
 * Each SDK enforces {@link ReviewResultSchema} at the provider level (Claude
 * `outputFormat`, OpenCode `format: json_schema`, Copilot `defineTool`), so a
 * non-null `structured` is already a validated {@link ReviewResult}. When
 * either reviewer failed to produce validated output we propagate `null` —
 * {@link hasActionableFindings} then treats the raw response as actionable so
 * the loop keeps iterating instead of silently exiting on a missing reviewer.
 */
export declare function mergeReviewResults(a: StructuredReviewResult, b: StructuredReviewResult): StructuredReviewResult;
export interface PlannerContext {
    /** 1-indexed loop iteration. Iteration 1 = initial plan; >1 = re-plan. */
    iteration: number;
    /**
     * Markdown rendering of the previous iteration's merged reviewer
     * findings. Produced by {@link formatReviewForReplan}. The planner is
     * responsible for validating, deduping, and clustering findings into
     * shared root causes before revising the RFC — there is no separate
     * debugger stage.
     */
    reviewReport?: string;
}
/**
 * Build the planner prompt. The first iteration authors an RFC from the
 * original spec; subsequent iterations revise the RFC using the merged
 * reviewer findings from the previous loop iteration.
 *
 * The planner's deliverable is a filled-in Technical Design Document / RFC
 * rendered as markdown text; the orchestrator consumes the RFC as design
 * context.
 */
export declare function buildPlannerPrompt(spec: string, context?: PlannerContext): string;
export interface OrchestratorContext {
    /**
     * The planner's final assistant message. Under the RFC-based Ralph flow,
     * this is the authoritative design input — either an absolute path to a
     * pre-existing spec file or an inline RFC markdown document. The
     * orchestrator decomposes it into the task list using its SDK-specific
     * task-persistence tool (`TaskCreate` / `sql` / `todowrite`).
     */
    plannerNotes?: string;
}
/**
 * Build the orchestrator prompt. The orchestrator decomposes the planner's
 * design output (a spec path or inline RFC) into a task list using its
 * SDK-specific task-persistence tool, validates the dependency graph, and
 * spawns parallel workers.
 *
 * @param spec - The user's original specification. Used as context/fallback
 *   when the planner output is missing or ambiguous.
 * @param context - Planner handoff (the spec path or RFC markdown).
 */
export declare function buildOrchestratorPrompt(spec: string, context?: OrchestratorContext): string;
export interface CodeSimplifierContext {
    /** Optional planner output (RFC markdown or absolute path to spec). */
    plannerNotes?: string;
}
/**
 * Build the code-simplifier prompt. Run by the `code-simplifier` sub-agent
 * to inspect only the orchestrator's changes on the current branch and
 * refine them for clarity, consistency, and maintainability — without
 * altering functionality or test behaviour.
 *
 * @param spec - The user's original specification, used as context/fallback
 *   when planner output is missing or ambiguous.
 * @param context - Optional planner handoff (spec path or inline RFC markdown).
 */
export declare function buildCodeSimplifierPrompt(spec: string, context?: CodeSimplifierContext): string;
/** Prompts for the three parallel infrastructure-discovery sub-agents. */
export interface InfraDiscoveryPrompts {
    /** Prompt for the codebase-locator sub-agent. */
    locator: string;
    /** Prompt for the codebase-analyzer sub-agent. */
    analyzer: string;
    /** Prompt for the codebase-pattern-finder sub-agent. */
    patternFinder: string;
}
/**
 * Build prompts for three parallel sub-agent stages that discover the
 * repository's build, test, lint, and CI infrastructure. Each sub-agent
 * explores the codebase dynamically — no hard-coded file lists or patterns.
 *
 * Inspired by the deep-research-codebase workflow which dispatches
 * codebase-locator, codebase-analyzer, and codebase-pattern-finder
 * sub-agents in parallel for exploratory research.
 */
export declare function buildInfraDiscoveryPrompts(): InfraDiscoveryPrompts;
/** A single finding from the reviewer sub-agent. */
export interface ReviewFinding {
    title: string;
    body: string;
    confidence_score?: number;
    priority?: number;
    code_location?: {
        file_path: string;
        line_range: {
            start: number;
            end: number;
        };
    };
}
/** Parsed reviewer JSON output. */
export interface ReviewResult {
    findings: ReviewFinding[];
    overall_correctness: string;
    overall_explanation: string;
    overall_confidence_score?: number;
}
export interface ReviewContext {
    /**
     * Full branch changeset captured by {@link captureBranchChangeset}.
     * Contains diff stat, name-status, and uncommitted changes relative to
     * the parent branch — giving the reviewer complete visibility into every
     * change this branch introduces.
     */
    changeset: {
        baseBranch: string;
        diffStat: string;
        uncommitted: string;
        nameStatus: string;
        errors: string[];
    };
    /** 1-indexed loop iteration, used in the prompt header. */
    iteration?: number;
    /**
     * When true, instructs the reviewer to call the `submit_review` tool
     * instead of outputting JSON directly. Used by the Copilot SDK which
     * achieves structured output through tool definitions.
     */
    useSubmitTool?: boolean;
    /**
     * Raw output from the parallel infrastructure-discovery sub-agents
     * (codebase-locator, codebase-analyzer, codebase-pattern-finder).
     * When present, the reviewer uses this to identify and run the
     * repository's build/test/lint commands as part of verification.
     */
    discoveryContext?: string;
}
/**
 * Build the reviewer prompt. Injects a deterministic branch-relative
 * changeset so the reviewer sees every file this branch has touched —
 * both committed and uncommitted — without expensive tool calls.
 */
export declare function buildReviewPrompt(spec: string, context: ReviewContext): string;
export declare function filterActionable(parsed: {
    findings: ReviewFinding[];
    overall_correctness: string;
    overall_explanation?: string;
    overall_confidence_score?: number;
}): ReviewResult;
/**
 * Render the merged reviewer result as the markdown brief consumed by the
 * next iteration's planner.
 *
 * Findings are grouped by file path so the planner sees clusters of related
 * symptoms together (often a hint at a shared root cause). Within each
 * group findings are ordered by ascending priority (P0 first). The
 * `overall_explanation` is included verbatim so the planner has the
 * reviewers' overall narrative.
 *
 * When `parsed === null` (SDK validation failed) the raw transcript is
 * surfaced inside a clearly-labelled fenced block so the planner knows the
 * data is unstructured and must be investigated rather than trusted.
 */
export declare function formatReviewForReplan(parsed: ReviewResult | null, rawText: string): string;
//# sourceMappingURL=prompts.d.ts.map