import { type ResolvedWorkforcePersonaContext, type WorkforcePersonaResolver, type WorkforcePersonaSendOptions, type WorkforcePersonaWriterMetadata } from './workforce-persona-writer.js';
export interface WorkforcePersonaRepairOptions {
    repoRoot: string;
    artifactPath: string;
    artifactContent: string;
    evidence: unknown;
    classification: unknown;
    debuggerResult: unknown;
    blocker?: unknown;
    failedStep?: string;
    previousRunId?: string;
    previousAttempts?: WorkforcePersonaRepairAttempt[];
    attempt: number;
    maxAttempts: number;
    timeoutSeconds?: number;
    installSkills?: boolean;
    installRoot?: string;
    tier?: string;
    env?: NodeJS.ProcessEnv;
    signal?: AbortSignal;
    onProgress?: WorkforcePersonaSendOptions['onProgress'];
    personaIntentCandidates?: readonly string[];
    resolver?: WorkforcePersonaResolver;
}
export interface WorkforcePersonaRepairAttempt {
    attempt: number;
    repairedArtifactPath: string;
    repairSummary: string;
    repairMode: string;
    personaRunId?: string;
    retryAttempt: number;
    outcome: {
        status: 'failed' | 'blocker' | 'error';
        failedStep?: string;
        blockerCode?: string;
        runId?: string;
        classification?: unknown;
        debuggerSummary?: string;
    };
}
export interface WorkforcePersonaRepairMetadata {
    personaId: string;
    tier: string;
    harness: string;
    model: string;
    promptDigest: string;
    warnings: string[];
    runId: string | null;
    source: ResolvedWorkforcePersonaContext['source'];
    selectedIntent: string;
    responseFormat: WorkforcePersonaWriterMetadata['responseFormat'];
    outputPath: string;
}
export interface WorkforcePersonaRepairResult {
    artifact: {
        content: string;
        metadata: Record<string, unknown>;
    };
    metadata: WorkforcePersonaRepairMetadata;
}
export declare function repairWorkflowWithWorkforcePersona(options: WorkforcePersonaRepairOptions): Promise<WorkforcePersonaRepairResult>;
export declare function buildWorkflowRepairPersonaTask(options: WorkforcePersonaRepairOptions): string;
/**
 * Returns a list of human-readable regression descriptions when the repaired
 * artifact has removed PR-shipping or substantive structure that the original
 * workflow declared. Empty array means "no regression detected" — repair is
 * safe to apply.
 *
 * Heuristics (all gate on what the ORIGINAL declared; we never add a new
 * requirement):
 * - PR-shipping primitives: if the original `import`s
 *   `@agent-relay/github-primitive` or references the identifiers
 *   `GitHubStepExecutor` / `createGitHubStep`, those must remain present in
 *   the repair. Stripping them turns a "ship the PR" workflow into a no-op
 *   stub, which is the exact regression this guard exists to prevent.
 * - Step count collapse: if the original had `N >= 4` `.step(...)` chain
 *   calls, the repair must keep at least `ceil(N / 2)`. A 20-step workflow
 *   "repaired" into 3 placeholder steps is overwhelmingly likely to be a
 *   misdiagnosis (the LLM bailed out and emitted a minimal scaffold) rather
 *   than a legitimate fix.
 * - Builder usage: the original's `workflow(...)` invocation must remain;
 *   a repair that replaces it with a different builder pattern is by
 *   definition rewriting, not repairing.
 *
 * **Source-Text Analysis (AGENTS.md):** every check inspects the parsed
 * TypeScript AST via `ts.createSourceFile` — imports come from
 * `ImportDeclaration.moduleSpecifier` (only real import statements count),
 * identifier references from `Identifier` node walks (only real symbol
 * references count), and step/workflow chain calls from `CallExpression`
 * nodes (only real call expressions count). This rules out both false
 * positives (a step `command` HEREDOC containing the literal text
 * `.step("foo")` inflating the count) AND false negatives (a repair
 * sneaking `// Removed createGitHubStep` past the check as a comment, or
 * embedding `"createGitHubStep"` inside a string literal it never invokes).
 *
 * Unparseable repairs are not silently accepted: if the repaired content
 * fails to parse cleanly enough for AST walks, every present-in-original
 * marker is flagged so the failure surfaces rather than coercing the
 * "no AST signal" case into "no regression detected."
 *
 * These guards are intentionally conservative — a healthy repair will
 * trivially satisfy all three. They only fire on the failure mode this PR
 * addresses (the LLM "simplifies" the workflow into a placeholder).
 */
export declare function detectWorkflowIntentRegressions(originalContent: string, repairedContent: string): string[];
