import { Config, Task, Comment } from '../types';
import { TaskProvider } from '../providers';
import { AIRunner } from '../ai';
import { ReviewThread } from '../github';
import { AidevHooks, HookVM } from '../hooks';
export declare const DEFAULT_TRIGGER_WORD = "aidev-continue";
export declare function getPendingStatus(config: Config): string;
export declare function getOpenStatus(config: Config): string;
export declare function getInReviewStatus(config: Config): string;
/** Semantic status written when aidev starts implementing a task. */
export declare function getInProgressStatus(_config: Config): string;
export type RunFilter = 'all' | 'open' | 'pending' | 'review';
export interface SubTask {
    id: number | string;
    title: string;
    description: string;
    status: 'pending' | 'running' | 'done' | 'failed';
    attempts: number;
    lastError?: string;
}
export interface ThinkingTaskPlan {
    taskId: string;
    taskName: string;
    /** Short summary of the ticket goal for compact sub-task prompts (from analyze step). */
    taskSummary?: string;
    subtasks: SubTask[];
}
export declare function getRunSkipReason(status: string, filter: RunFilter, pendingStatus: string, openStatus?: string): string | null;
export declare function isThinkingTask(task: Task, config: Config): boolean;
export declare function isPlanningTask(task: Task, config: Config): boolean;
export interface PlanningSubtaskDraft {
    title: string;
    description: string;
    priority?: number;
}
export interface PlanningAnalysisResponse {
    clarification?: string;
    subtasks: PlanningSubtaskDraft[];
}
export declare function buildPlanningAnalysisPrompt(task: Task, context: string): string;
export declare function parsePlanningResponse(output: string): PlanningAnalysisResponse | null;
export declare function sortTasksByPriority(tasks: Task[]): Task[];
/** 30 days — stale `.aidev.task.json` / `.aidev.instructions.md` files are removed. Exported for tests. */
export declare const THINKING_ARTIFACT_MAX_AGE_MS: number;
/**
 * Removes thinking artifact files in `cwd` older than {@link THINKING_ARTIFACT_MAX_AGE_MS}.
 * Uses birth time when available, otherwise mtime (Linux often lacks birthtime).
 */
export declare function cleanupStaleThinkingArtifacts(cwd?: string, nowMs?: number): void;
export declare function writeTaskPlan(plan: ThinkingTaskPlan): void;
export declare function readTaskPlan(taskId: string): ThinkingTaskPlan | null;
export declare function formatSubtaskId(id: number | string): string;
export declare function subtaskDepth(id: number | string): number;
/** Max chars for ticket description when compact mode has no {@link ThinkingTaskPlan.taskSummary}. */
export declare const SUBTASK_PROMPT_COMPACT_DESCRIPTION_FALLBACK_MAX = 3000;
/** Max chars for archived instructions markdown in compact sub-task prompts. */
export declare const SUBTASK_PROMPT_COMPACT_INSTRUCTIONS_MAX = 8192;
export declare function truncateForSubtaskPrompt(text: string, maxLen: number): string;
export interface ThinkingSubtaskPromptOptions {
    /** Smaller prompt: concise goal + truncated plan; used when there are no human ticket comments or on AI retry. */
    compact: boolean;
}
export declare function buildThinkingSubtaskPrompt(subtask: SubTask, task: Task, plan: ThinkingTaskPlan, instructions: string, reviewContext: string | undefined, previousError: string | undefined, options: ThinkingSubtaskPromptOptions): string;
export declare function formatSubtaskList(plan: ThinkingTaskPlan): string;
export declare function runCommand(filter: RunFilter, config: Config, provider: TaskProvider, runners: AIRunner[], nonCodeProvider?: TaskProvider, hooks?: AidevHooks, vm?: HookVM, taskId?: string): Promise<void>;
export declare function isAidevComment(text: string, commentPrefix?: string): boolean;
/**
 * True when someone other than aidev spoke after an aidev message: there is a non-aidev
 * comment that has at least one earlier [aidev]-prefixed comment in the thread.
 * Ignores trailing aidev-only noise after the human (e.g. another bot post or sync).
 */
export declare function hasHumanReply(comments: Comment[], commentPrefix?: string): boolean;
/**
 * Returns true if the last comment contains the trigger word.
 * DEFAULT_TRIGGER_WORD ('aidev-continue') is always recognised regardless of
 * the configured triggerWord, so it works out-of-the-box without env config.
 */
export declare function hasTriggerWord(comments: Comment[], triggerWord: string): boolean;
export declare function checkNeedsClarification(task: Task, config: Config, provider: TaskProvider, runners: AIRunner[]): Promise<string | null>;
export declare function buildConflictResolutionPrompt(task: Task, conflictFiles: string[], context: string): string;
export declare function buildImplementPrompt(task: Task, context: string): string;
export declare function splitFailedSubtask(parentTask: Task, plan: ThinkingTaskPlan, failedSubtask: SubTask, runners: AIRunner[]): Promise<SubTask[] | null>;
export declare function implementPlanningTask(task: Task, config: Config, provider: TaskProvider, runners: AIRunner[], _hooks?: AidevHooks, _vm?: HookVM): Promise<void>;
/**
 * Attempts to create a PR via `gh` CLI. Falls back to a compare URL if gh is
 * unavailable or PR creation fails.
 */
export declare function buildPRBody(task: Task): string;
export declare function tryCreatePR(config: Config, branch: string, task: Task): string;
export declare function buildPRUrl(config: Config, branch: string): string;
export declare function buildCompletionComment(branch: string, prUrl: string, config: Config): string;
export declare function buildNonCodePrompt(task: Task, context: string): string;
export declare function buildNonCodeCompletionComment(config: Config, agentResponse?: string): string;
export declare function hasAidevComment(comments: Comment[], commentPrefix?: string): boolean;
export declare function filterAutomatedComments(comments: Comment[], commentPrefix?: string): Comment[];
export declare function hasHumanComment(comments: Comment[], commentPrefix?: string): boolean;
export interface NonCodeSubTaskResult {
    id: number | string;
    title: string;
    summary: string;
}
export declare function buildNonCodeAnalysisPrompt(task: Task, context: string): string;
export declare function buildNonCodeSubtaskPrompt(subtask: SubTask, task: Task, plan: ThinkingTaskPlan, previousResults: NonCodeSubTaskResult[], reviewContext: string | undefined): string;
export declare function buildNonCodeThinkingCompletionComment(config: Config): string;
export declare function parseReplyDirectives(output: string): Array<{
    threadId: string;
    body: string;
}>;
export declare function buildReviewPrompt(task: Task, threads: ReviewThread[]): string;
export declare function buildReviewCompletionComment(config: Config, resolvedCount: number, repliedCount: number): string;
//# sourceMappingURL=run.d.ts.map