/**
 * Shared task-domain result shapes for the operations layer.
 *
 * Defines types that are:
 *  - produced by core functions in `packages/core/src/tasks/`
 *  - consumed by the dispatch layer
 *  - exposed as `Result` types in `operations/tasks.ts`
 *
 * These types are the single source of truth for the wire-format shapes.
 * Core functions import them here (via `@cleocode/contracts`) rather than
 * defining inline interfaces.
 *
 * @module tasks
 * @task T1703 — Fill 20 Result=unknown stubs in operations/tasks.ts
 * @epic T1688
 */
import { z } from 'zod';
import type { TaskPriority, TaskStatus } from './task.js';
import type { TaskRecord } from './task-record.js';
/** Mutation bucket names shared by task create/update/delete result envelopes. @task T10608 */
export type TaskMutationBucket = 'created' | 'updated' | 'deleted';
/** Severity for non-fatal warnings emitted by task mutation preflights/results. @task T10608 */
export type TaskMutationWarningSeverity = 'info' | 'warning';
/**
 * Non-fatal warning surfaced by a task mutation.
 *
 * Warnings are structured so callers can distinguish partial-success hazards
 * from hard validation errors without string parsing.
 *
 * @task T10608
 */
export interface TaskMutationWarning {
    /** Stable machine-readable code, e.g. `duplicate_likely` or `cascade_delete`. */
    code: string;
    /** Human-readable explanation of the warning. */
    message: string;
    /** Warning severity. Defaults to `warning` when omitted by older producers. */
    severity?: TaskMutationWarningSeverity;
    /** Task ID associated with the warning, when known. */
    taskId?: string;
    /** Input field associated with the warning, when applicable. */
    field?: string;
    /** Batch input index associated with the warning, when applicable. */
    index?: number;
}
/**
 * Dry-run/preflight projection for task mutations.
 *
 * Counts are split by verb so `created`, `updated`, and `deleted` result
 * envelopes can all expose the same dry-run shape while preserving the older
 * operation-specific count names during migration.
 *
 * @task T10608
 */
export interface TaskMutationDryRunSummary {
    /** Always true for a dry-run projection. */
    dryRun: true;
    /** Number of entities that would be created by executing the mutation. */
    wouldCreate: number;
    /** Number of entities that would be updated by executing the mutation. */
    wouldUpdate: number;
    /** Number of entities that would be deleted by executing the mutation. */
    wouldDelete: number;
    /** Total affected entities across create/update/delete buckets. */
    wouldAffect: number;
    /** Number of specs/entities that passed preflight validation. */
    validatedCount: number;
    /** Rows durably inserted during dry-run; always 0. */
    insertedCount: 0;
    /** Rows durably updated during dry-run; always 0. */
    updatedCount: 0;
    /** Rows durably deleted during dry-run; always 0. */
    deletedCount: 0;
    /** Non-fatal preflight warnings. Empty when no warnings were emitted. */
    warnings: TaskMutationWarning[];
}
/**
 * Standard envelope appended to task mutation results.
 *
 * Existing operation-specific legacy fields (`task`, `deletedTask`, `changes`,
 * etc.) remain available, while new consumers can read the normalized buckets.
 *
 * @task T10608
 */
export interface TaskMutationEnvelope<TCreated = TaskRecord[], TUpdated = TaskRecord[], TDeleted = TaskRecord[]> {
    /** Whether this was a preview-only mutation. */
    dryRun?: boolean;
    /** Created task records. Empty for update/delete-only mutations. */
    created: TCreated;
    /** Updated task records. Empty for create/delete-only mutations. */
    updated: TUpdated;
    /** Deleted task records. Empty for create/update-only mutations. */
    deleted: TDeleted;
    /** Total number of live rows/entities affected by the mutation. */
    affectedCount: number;
    /** Structured partial-success/preflight warnings. */
    mutationWarnings: TaskMutationWarning[];
    /** Standard dry-run projection. Present only for dry-run/preflight responses. */
    dryRunSummary?: TaskMutationDryRunSummary;
}
/** Zod schema for structured task mutation warnings. @task T10608 */
export declare const taskMutationWarningSchema: z.ZodObject<{
    code: z.ZodString;
    message: z.ZodString;
    severity: z.ZodOptional<z.ZodEnum<{
        info: "info";
        warning: "warning";
    }>>;
    taskId: z.ZodOptional<z.ZodString>;
    field: z.ZodOptional<z.ZodString>;
    index: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>;
/** Zod schema for the standardized task mutation dry-run/preflight summary. @task T10608 */
export declare const taskMutationDryRunSummarySchema: z.ZodObject<{
    dryRun: z.ZodLiteral<true>;
    wouldCreate: z.ZodNumber;
    wouldUpdate: z.ZodNumber;
    wouldDelete: z.ZodNumber;
    wouldAffect: z.ZodNumber;
    validatedCount: z.ZodNumber;
    insertedCount: z.ZodLiteral<0>;
    updatedCount: z.ZodLiteral<0>;
    deletedCount: z.ZodLiteral<0>;
    warnings: z.ZodArray<z.ZodObject<{
        code: z.ZodString;
        message: z.ZodString;
        severity: z.ZodOptional<z.ZodEnum<{
            info: "info";
            warning: "warning";
        }>>;
        taskId: z.ZodOptional<z.ZodString>;
        field: z.ZodOptional<z.ZodString>;
        index: z.ZodOptional<z.ZodNumber>;
    }, z.core.$strip>>;
}, z.core.$strip>;
/** Zod schema for the standardized task mutation envelope. @task T10608 */
export declare const taskMutationEnvelopeSchema: z.ZodObject<{
    dryRun: z.ZodOptional<z.ZodBoolean>;
    created: z.ZodArray<z.ZodObject<{
        id: z.ZodString;
    }, z.core.$loose>>;
    updated: z.ZodArray<z.ZodObject<{
        id: z.ZodString;
    }, z.core.$loose>>;
    deleted: z.ZodArray<z.ZodObject<{
        id: z.ZodString;
    }, z.core.$loose>>;
    affectedCount: z.ZodNumber;
    mutationWarnings: z.ZodArray<z.ZodObject<{
        code: z.ZodString;
        message: z.ZodString;
        severity: z.ZodOptional<z.ZodEnum<{
            info: "info";
            warning: "warning";
        }>>;
        taskId: z.ZodOptional<z.ZodString>;
        field: z.ZodOptional<z.ZodString>;
        index: z.ZodOptional<z.ZodNumber>;
    }, z.core.$strip>>;
    dryRunSummary: z.ZodOptional<z.ZodObject<{
        dryRun: z.ZodLiteral<true>;
        wouldCreate: z.ZodNumber;
        wouldUpdate: z.ZodNumber;
        wouldDelete: z.ZodNumber;
        wouldAffect: z.ZodNumber;
        validatedCount: z.ZodNumber;
        insertedCount: z.ZodLiteral<0>;
        updatedCount: z.ZodLiteral<0>;
        deletedCount: z.ZodLiteral<0>;
        warnings: z.ZodArray<z.ZodObject<{
            code: z.ZodString;
            message: z.ZodString;
            severity: z.ZodOptional<z.ZodEnum<{
                info: "info";
                warning: "warning";
            }>>;
            taskId: z.ZodOptional<z.ZodString>;
            field: z.ZodOptional<z.ZodString>;
            index: z.ZodOptional<z.ZodNumber>;
        }, z.core.$strip>>;
    }, z.core.$strip>>;
}, z.core.$strip>;
/**
 * RCASD-IVTR+C pipeline stage values valid for `TaskView.pipelineStage`.
 *
 * @task T1703
 */
export type TaskViewPipelineStage = 'research' | 'specification' | 'decomposition' | 'implementation' | 'validation' | 'testing' | 'release' | 'contribution';
/**
 * Canonical next-action tokens emitted by `TaskView.nextAction`.
 *
 * Consumers pattern-match on these to drive agent guidance without
 * duplicating the priority-ladder logic in core.
 *
 * @task T1703
 */
export type TaskViewNextAction = 'verify' | 'advance-lifecycle' | 'spawn-worker' | 'blocked-on-deps' | 'awaiting-children' | 'already-complete' | 'no-action';
/**
 * Lifecycle progress derived from `lifecycle_pipelines` + `lifecycle_stages`.
 *
 * All fields are empty / null when the task has no pipeline record.
 *
 * @task T1703
 */
export interface TaskViewLifecycleProgress {
    /** Stage names whose DB status is `completed`. */
    stagesCompleted: string[];
    /** Stage names whose DB status is `skipped`. */
    stagesSkipped: string[];
    /**
     * The pipeline's `currentStageId` resolved to a stage name, or `null` when
     * the task has no pipeline or the current stage has not been set.
     */
    currentStage: string | null;
}
/**
 * Verification gate status derived from `tasks.verification.gates`.
 *
 * Required gates are always present; `documented` is `undefined` when not recorded.
 *
 * @task T1703
 */
export interface TaskViewGatesStatus {
    /** Whether the `implemented` gate has passed. */
    implemented: boolean;
    /** Whether the `testsPassed` gate has passed. */
    testsPassed: boolean;
    /** Whether the `qaPassed` gate has passed. */
    qaPassed: boolean;
    /** Whether the `documented` gate has passed, or `undefined` if absent. */
    documented?: boolean;
}
/**
 * Direct-child rollup counts for the task (archived children excluded).
 *
 * @task T1703
 */
export interface TaskViewChildRollup {
    /** Total non-archived direct children. */
    total: number;
    /** Non-archived children with `status = 'done'`. */
    done: number;
    /** Non-archived children with `status = 'blocked'`. */
    blocked: number;
    /** Non-archived children with `status = 'active'`. */
    active: number;
}
/**
 * Canonical task view — the unified projection consumed by SDK, CLI, and REST.
 *
 * Produced exclusively by `computeTaskView` in core. All surfaces that
 * previously derived their own view of a task now go through this type so
 * they cannot disagree.
 *
 * @task T1703
 */
export interface TaskView {
    /** Task identifier (e.g. `T123`). */
    id: string;
    /** Task title. */
    title: string;
    /** Canonical execution status. Mirrors `tasks.status`. */
    status: TaskStatus;
    /**
     * RCASD-IVTR+C pipeline stage this task is parked on.
     * Reads `tasks.pipelineStage` directly. `null` when not yet assigned.
     */
    pipelineStage: string | null;
    /**
     * Lifecycle progress derived from `lifecycle_pipelines` / `lifecycle_stages`.
     * Empty default when the task has no pipeline record.
     */
    lifecycleProgress: TaskViewLifecycleProgress;
    /** Aggregated counts of non-archived direct children. */
    childRollup: TaskViewChildRollup;
    /**
     * Verification gate status derived from `tasks.verification`.
     * Defaults to all `false` when the task has no verification record.
     */
    gatesStatus: TaskViewGatesStatus;
    /**
     * Whether the task is ready to be marked complete.
     * True when: required gates all green AND no unresolved blocking deps AND
     * status is not already a terminal value.
     */
    readyToComplete: boolean;
    /**
     * Suggested next action for an agent working this task.
     * Derived via a priority ladder in `computeTaskView`.
     */
    nextAction: TaskViewNextAction;
}
export type CompletionCriterionKind = 'text' | 'evidence_bound' | 'child_task';
export type CompletionCriterionStatus = 'satisfied' | 'unsatisfied' | 'waived' | 'replaced';
export type CompletionBlockerReason = 'missing_evidence_binding' | 'child_not_done' | 'child_cancelled_requires_waiver' | 'child_replacement_not_done' | 'child_missing' | 'done_parent_stale';
/**
 * Explicit operator waiver for a child-task completion criterion. @task T10592
 *
 * Waivers are intentionally criterion-scoped: the same cancelled child may back
 * multiple parent criteria, and each criterion needs its own reason, actor, and
 * timestamp for auditable completion rollups.
 */
export interface CompletionCriterionWaiver {
    /** AC row id that is being waived. */
    criterionAcId: string;
    /** Child task id referenced by the waived AC row. */
    childTaskId: string;
    /** Human/operator rationale for accepting the cancelled child as waived. */
    reason: string;
    /** Actor that approved the waiver. */
    actor: string;
    /** ISO-8601 timestamp recording when the waiver was approved. */
    waivedAt: string;
}
/**
 * Explicit replacement policy for a child-task completion criterion. @task T10592
 *
 * Replacements only satisfy the original criterion when the replacement child is
 * itself done; otherwise the criterion remains unsatisfied with a replacement
 * blocker so rollups can distinguish replaced work from waived or satisfied work.
 */
export interface CompletionCriterionReplacement {
    /** AC row id whose original child requirement is replaced. */
    criterionAcId: string;
    /** Original child task id referenced by the AC row. */
    originalChildTaskId: string;
    /** Replacement child task id that must be done to satisfy this criterion. */
    replacementChildTaskId: string;
    /** Human/operator rationale for replacing the original child. */
    reason: string;
    /** Actor that approved the replacement. */
    actor: string;
    /** ISO-8601 timestamp recording when the replacement was approved. */
    replacedAt: string;
}
/** A typed per-AC completion evaluation row. @task T10591 */
export interface CompletionCriterionEvaluation {
    /** Stable AC row id from `task_acceptance_criteria.id`. */
    acId: string;
    /** Human alias derived from ordinal, e.g. AC1. */
    alias: string;
    /** Stored AC text. */
    text: string;
    /** Criteria kind from the AC table. */
    kind: CompletionCriterionKind;
    /** Whether this criterion is satisfied, unsatisfied, explicitly waived, or replaced. */
    status: CompletionCriterionStatus;
    /** Blocking reason when status is unsatisfied. */
    reason?: CompletionBlockerReason;
    /** Target child task id for child_task rows. */
    targetTaskId?: string;
    /** Observed child task status for child_task rows. */
    targetTaskStatus?: TaskStatus;
    /** Explicit waiver metadata when status is `waived`. */
    waiver?: CompletionCriterionWaiver;
    /** Explicit replacement metadata when a replacement policy applies. */
    replacement?: CompletionCriterionReplacement;
    /** Observed status of the replacement child task, when a replacement policy applies. */
    replacementTaskStatus?: TaskStatus;
    /** Number of evidence bindings attached to this AC. */
    evidenceBindings: number;
}
export type CompletionStaleReason = 'done_parent_has_unsatisfied_criteria';
/** Lifecycle/audit actions included in completion context packs. @task T10594 */
export type CompletionHistoryEventAction = 'task_completed' | 'task_reopened' | 'task_cancelled' | 'task_uncancelled' | 'task_reparented' | 'ac_projection_rebuilt';
/** Task relation bucket for an audit event carried by a completion context pack. @task T10594 */
export type CompletionHistoryEventRelation = 'self' | 'parent' | 'child' | 'sibling' | 'related';
/** Structured lifecycle/audit event available to completion evaluation. @task T10594 */
export interface CompletionHistoryEvent {
    id: string;
    timestamp: string;
    action: CompletionHistoryEventAction;
    taskId: string;
    relation: CompletionHistoryEventRelation;
    actor: string;
    details?: Record<string, unknown>;
    before?: Record<string, unknown>;
    after?: Record<string, unknown>;
}
/** Event counts precomputed for explainCompletion and machine consumers. @task T10594 */
export interface CompletionContextPackSummary {
    totalEvents: number;
    byAction: Record<CompletionHistoryEventAction, number>;
    byRelation: Record<CompletionHistoryEventRelation, number>;
    latestEventAt: string | null;
}
/** Bounded recent lifecycle context sourced from audit_log. @task T10594 */
export interface CompletionContextPack {
    taskId: string;
    generatedAt: string;
    source: 'audit_log';
    window: {
        limit: number;
        since?: string;
        relationDepth: number;
        relatedTaskIds: string[];
    };
    events: CompletionHistoryEvent[];
    summary: CompletionContextPackSummary;
}
/** Builder query controls for completion context packs. @task T10594 */
export interface CompletionContextPackOptions {
    limit?: number;
    since?: string;
    relationDepth?: number;
}
/** Contract-backed aggregate returned by `evaluateCompletion`. @task T10591 */
export interface CompletionEvaluation {
    taskId: string;
    taskStatus: TaskStatus;
    /** True only when there are no unsatisfied criteria and the parent is not stale. */
    ready: boolean;
    stale: boolean;
    staleReasons: CompletionStaleReason[];
    /** Optional bounded audit context used by explanation/evaluation consumers. @task T10594 */
    contextPack?: CompletionContextPack;
    satisfied: CompletionCriterionEvaluation[];
    unsatisfied: CompletionCriterionEvaluation[];
    waived: CompletionCriterionEvaluation[];
    replaced: CompletionCriterionEvaluation[];
    totals: {
        criteria: number;
        satisfied: number;
        unsatisfied: number;
        waived: number;
        replaced: number;
    };
}
/** Human-readable explanation generated from a CompletionEvaluation. @task T10591 */
export interface CompletionExplanation {
    taskId: string;
    ready: boolean;
    stale: boolean;
    summary: string;
    /** Recent lifecycle context referenced by the summary/blockers when available. @task T10594 */
    contextPack?: CompletionContextPack;
    blockers: CompletionCriterionEvaluation[];
}
/** Parameter contract for `tasks.completion.list`. @task T10607 */
export interface CompletionListParams {
    /** Task whose completion criteria should be listed. */
    taskId: string;
    /** Optional status filter for criteria rows. */
    status?: CompletionCriterionStatus;
    /** Optional criterion kind filter. */
    kind?: CompletionCriterionKind;
}
/** Result contract for `tasks.completion.list`. @task T10607 */
export interface CompletionListResult {
    taskId: string;
    criteria: CompletionCriterionEvaluation[];
    totals: CompletionEvaluation['totals'];
}
/** Parameter contract for `tasks.completion.evaluate`. @task T10607 */
export interface CompletionEvaluateParams extends CompletionContextPackOptions {
    /** Task whose completion readiness should be evaluated. */
    taskId: string;
    /** Include bounded audit context in the evaluation response. */
    includeContext?: boolean;
}
/** Result contract for `tasks.completion.evaluate`. @task T10607 */
export type CompletionEvaluateResult = CompletionEvaluation;
/** Parameter contract for `tasks.completion.explain`. @task T10607 */
export interface CompletionExplainParams extends CompletionEvaluateParams {
}
/** Result contract for `tasks.completion.explain`. @task T10607 */
export type CompletionExplainResult = CompletionExplanation;
/** Typed stale-projection error codes returned by `tasks.projection.repair`. @task T10607 */
export type CompletionProjectionRepairErrorCode = 'projection_not_stale' | 'criteria_missing' | 'binding_target_missing' | 'repair_conflict';
/** Stale completion-projection repair diagnostic. @task T10607 */
export interface CompletionProjectionRepairError {
    code: CompletionProjectionRepairErrorCode;
    message: string;
    taskId: string;
    acId?: string;
    evidenceAtomId?: string;
}
/** Parameter contract for `tasks.projection.repair`. @task T10607 */
export interface CompletionProjectionRepairParams {
    /** Task whose derived completion projection should be rebuilt/repaired. */
    taskId: string;
    /** Preview repair actions without writing projection state. */
    dryRun?: boolean;
}
/** Result contract for `tasks.projection.repair`. @task T10607 */
export interface CompletionProjectionRepairResult {
    taskId: string;
    repaired: boolean;
    dryRun: boolean;
    staleBefore: boolean;
    staleAfter: boolean;
    errors: CompletionProjectionRepairError[];
}
/** Zod schema for one typed AC completion-result row. @task T10607 */
export declare const completionCriterionEvaluationSchema: z.ZodObject<{
    acId: z.ZodString;
    alias: z.ZodString;
    text: z.ZodString;
    kind: z.ZodEnum<{
        text: "text";
        child_task: "child_task";
        evidence_bound: "evidence_bound";
    }>;
    status: z.ZodEnum<{
        waived: "waived";
        satisfied: "satisfied";
        unsatisfied: "unsatisfied";
        replaced: "replaced";
    }>;
    reason: z.ZodOptional<z.ZodEnum<{
        missing_evidence_binding: "missing_evidence_binding";
        child_not_done: "child_not_done";
        child_cancelled_requires_waiver: "child_cancelled_requires_waiver";
        child_replacement_not_done: "child_replacement_not_done";
        child_missing: "child_missing";
        done_parent_stale: "done_parent_stale";
    }>>;
    targetTaskId: z.ZodOptional<z.ZodString>;
    targetTaskStatus: z.ZodOptional<z.ZodEnum<{
        pending: "pending";
        cancelled: "cancelled";
        active: "active";
        blocked: "blocked";
        done: "done";
        archived: "archived";
        proposed: "proposed";
    }>>;
    waiver: z.ZodOptional<z.ZodObject<{
        criterionAcId: z.ZodString;
        childTaskId: z.ZodString;
        reason: z.ZodString;
        actor: z.ZodString;
        waivedAt: z.ZodString;
    }, z.core.$strip>>;
    replacement: z.ZodOptional<z.ZodObject<{
        criterionAcId: z.ZodString;
        originalChildTaskId: z.ZodString;
        replacementChildTaskId: z.ZodString;
        reason: z.ZodString;
        actor: z.ZodString;
        replacedAt: z.ZodString;
    }, z.core.$strip>>;
    replacementTaskStatus: z.ZodOptional<z.ZodEnum<{
        pending: "pending";
        cancelled: "cancelled";
        active: "active";
        blocked: "blocked";
        done: "done";
        archived: "archived";
        proposed: "proposed";
    }>>;
    evidenceBindings: z.ZodNumber;
}, z.core.$strip>;
/** Zod schema for unsatisfied completion criteria. @task T10607 */
export declare const unsatisfiedCompletionCriterionSchema: z.ZodObject<{
    acId: z.ZodString;
    alias: z.ZodString;
    text: z.ZodString;
    kind: z.ZodEnum<{
        text: "text";
        child_task: "child_task";
        evidence_bound: "evidence_bound";
    }>;
    targetTaskId: z.ZodOptional<z.ZodString>;
    targetTaskStatus: z.ZodOptional<z.ZodEnum<{
        pending: "pending";
        cancelled: "cancelled";
        active: "active";
        blocked: "blocked";
        done: "done";
        archived: "archived";
        proposed: "proposed";
    }>>;
    waiver: z.ZodOptional<z.ZodObject<{
        criterionAcId: z.ZodString;
        childTaskId: z.ZodString;
        reason: z.ZodString;
        actor: z.ZodString;
        waivedAt: z.ZodString;
    }, z.core.$strip>>;
    replacement: z.ZodOptional<z.ZodObject<{
        criterionAcId: z.ZodString;
        originalChildTaskId: z.ZodString;
        replacementChildTaskId: z.ZodString;
        reason: z.ZodString;
        actor: z.ZodString;
        replacedAt: z.ZodString;
    }, z.core.$strip>>;
    replacementTaskStatus: z.ZodOptional<z.ZodEnum<{
        pending: "pending";
        cancelled: "cancelled";
        active: "active";
        blocked: "blocked";
        done: "done";
        archived: "archived";
        proposed: "proposed";
    }>>;
    evidenceBindings: z.ZodNumber;
    status: z.ZodLiteral<"unsatisfied">;
    reason: z.ZodEnum<{
        missing_evidence_binding: "missing_evidence_binding";
        child_not_done: "child_not_done";
        child_cancelled_requires_waiver: "child_cancelled_requires_waiver";
        child_replacement_not_done: "child_replacement_not_done";
        child_missing: "child_missing";
        done_parent_stale: "done_parent_stale";
    }>;
}, z.core.$strip>;
/** Zod result contract for `tasks.completion.evaluate`. @task T10607 */
export declare const completionEvaluationSchema: z.ZodObject<{
    taskId: z.ZodString;
    taskStatus: z.ZodEnum<{
        pending: "pending";
        cancelled: "cancelled";
        active: "active";
        blocked: "blocked";
        done: "done";
        archived: "archived";
        proposed: "proposed";
    }>;
    ready: z.ZodBoolean;
    stale: z.ZodBoolean;
    staleReasons: z.ZodArray<z.ZodEnum<{
        done_parent_has_unsatisfied_criteria: "done_parent_has_unsatisfied_criteria";
    }>>;
    contextPack: z.ZodOptional<z.ZodType<CompletionContextPack, unknown, z.core.$ZodTypeInternals<CompletionContextPack, unknown>>>;
    satisfied: z.ZodArray<z.ZodObject<{
        acId: z.ZodString;
        alias: z.ZodString;
        text: z.ZodString;
        kind: z.ZodEnum<{
            text: "text";
            child_task: "child_task";
            evidence_bound: "evidence_bound";
        }>;
        status: z.ZodEnum<{
            waived: "waived";
            satisfied: "satisfied";
            unsatisfied: "unsatisfied";
            replaced: "replaced";
        }>;
        reason: z.ZodOptional<z.ZodEnum<{
            missing_evidence_binding: "missing_evidence_binding";
            child_not_done: "child_not_done";
            child_cancelled_requires_waiver: "child_cancelled_requires_waiver";
            child_replacement_not_done: "child_replacement_not_done";
            child_missing: "child_missing";
            done_parent_stale: "done_parent_stale";
        }>>;
        targetTaskId: z.ZodOptional<z.ZodString>;
        targetTaskStatus: z.ZodOptional<z.ZodEnum<{
            pending: "pending";
            cancelled: "cancelled";
            active: "active";
            blocked: "blocked";
            done: "done";
            archived: "archived";
            proposed: "proposed";
        }>>;
        waiver: z.ZodOptional<z.ZodObject<{
            criterionAcId: z.ZodString;
            childTaskId: z.ZodString;
            reason: z.ZodString;
            actor: z.ZodString;
            waivedAt: z.ZodString;
        }, z.core.$strip>>;
        replacement: z.ZodOptional<z.ZodObject<{
            criterionAcId: z.ZodString;
            originalChildTaskId: z.ZodString;
            replacementChildTaskId: z.ZodString;
            reason: z.ZodString;
            actor: z.ZodString;
            replacedAt: z.ZodString;
        }, z.core.$strip>>;
        replacementTaskStatus: z.ZodOptional<z.ZodEnum<{
            pending: "pending";
            cancelled: "cancelled";
            active: "active";
            blocked: "blocked";
            done: "done";
            archived: "archived";
            proposed: "proposed";
        }>>;
        evidenceBindings: z.ZodNumber;
    }, z.core.$strip>>;
    unsatisfied: z.ZodArray<z.ZodObject<{
        acId: z.ZodString;
        alias: z.ZodString;
        text: z.ZodString;
        kind: z.ZodEnum<{
            text: "text";
            child_task: "child_task";
            evidence_bound: "evidence_bound";
        }>;
        targetTaskId: z.ZodOptional<z.ZodString>;
        targetTaskStatus: z.ZodOptional<z.ZodEnum<{
            pending: "pending";
            cancelled: "cancelled";
            active: "active";
            blocked: "blocked";
            done: "done";
            archived: "archived";
            proposed: "proposed";
        }>>;
        waiver: z.ZodOptional<z.ZodObject<{
            criterionAcId: z.ZodString;
            childTaskId: z.ZodString;
            reason: z.ZodString;
            actor: z.ZodString;
            waivedAt: z.ZodString;
        }, z.core.$strip>>;
        replacement: z.ZodOptional<z.ZodObject<{
            criterionAcId: z.ZodString;
            originalChildTaskId: z.ZodString;
            replacementChildTaskId: z.ZodString;
            reason: z.ZodString;
            actor: z.ZodString;
            replacedAt: z.ZodString;
        }, z.core.$strip>>;
        replacementTaskStatus: z.ZodOptional<z.ZodEnum<{
            pending: "pending";
            cancelled: "cancelled";
            active: "active";
            blocked: "blocked";
            done: "done";
            archived: "archived";
            proposed: "proposed";
        }>>;
        evidenceBindings: z.ZodNumber;
        status: z.ZodLiteral<"unsatisfied">;
        reason: z.ZodEnum<{
            missing_evidence_binding: "missing_evidence_binding";
            child_not_done: "child_not_done";
            child_cancelled_requires_waiver: "child_cancelled_requires_waiver";
            child_replacement_not_done: "child_replacement_not_done";
            child_missing: "child_missing";
            done_parent_stale: "done_parent_stale";
        }>;
    }, z.core.$strip>>;
    waived: z.ZodArray<z.ZodObject<{
        acId: z.ZodString;
        alias: z.ZodString;
        text: z.ZodString;
        kind: z.ZodEnum<{
            text: "text";
            child_task: "child_task";
            evidence_bound: "evidence_bound";
        }>;
        status: z.ZodEnum<{
            waived: "waived";
            satisfied: "satisfied";
            unsatisfied: "unsatisfied";
            replaced: "replaced";
        }>;
        reason: z.ZodOptional<z.ZodEnum<{
            missing_evidence_binding: "missing_evidence_binding";
            child_not_done: "child_not_done";
            child_cancelled_requires_waiver: "child_cancelled_requires_waiver";
            child_replacement_not_done: "child_replacement_not_done";
            child_missing: "child_missing";
            done_parent_stale: "done_parent_stale";
        }>>;
        targetTaskId: z.ZodOptional<z.ZodString>;
        targetTaskStatus: z.ZodOptional<z.ZodEnum<{
            pending: "pending";
            cancelled: "cancelled";
            active: "active";
            blocked: "blocked";
            done: "done";
            archived: "archived";
            proposed: "proposed";
        }>>;
        waiver: z.ZodOptional<z.ZodObject<{
            criterionAcId: z.ZodString;
            childTaskId: z.ZodString;
            reason: z.ZodString;
            actor: z.ZodString;
            waivedAt: z.ZodString;
        }, z.core.$strip>>;
        replacement: z.ZodOptional<z.ZodObject<{
            criterionAcId: z.ZodString;
            originalChildTaskId: z.ZodString;
            replacementChildTaskId: z.ZodString;
            reason: z.ZodString;
            actor: z.ZodString;
            replacedAt: z.ZodString;
        }, z.core.$strip>>;
        replacementTaskStatus: z.ZodOptional<z.ZodEnum<{
            pending: "pending";
            cancelled: "cancelled";
            active: "active";
            blocked: "blocked";
            done: "done";
            archived: "archived";
            proposed: "proposed";
        }>>;
        evidenceBindings: z.ZodNumber;
    }, z.core.$strip>>;
    replaced: z.ZodArray<z.ZodObject<{
        acId: z.ZodString;
        alias: z.ZodString;
        text: z.ZodString;
        kind: z.ZodEnum<{
            text: "text";
            child_task: "child_task";
            evidence_bound: "evidence_bound";
        }>;
        status: z.ZodEnum<{
            waived: "waived";
            satisfied: "satisfied";
            unsatisfied: "unsatisfied";
            replaced: "replaced";
        }>;
        reason: z.ZodOptional<z.ZodEnum<{
            missing_evidence_binding: "missing_evidence_binding";
            child_not_done: "child_not_done";
            child_cancelled_requires_waiver: "child_cancelled_requires_waiver";
            child_replacement_not_done: "child_replacement_not_done";
            child_missing: "child_missing";
            done_parent_stale: "done_parent_stale";
        }>>;
        targetTaskId: z.ZodOptional<z.ZodString>;
        targetTaskStatus: z.ZodOptional<z.ZodEnum<{
            pending: "pending";
            cancelled: "cancelled";
            active: "active";
            blocked: "blocked";
            done: "done";
            archived: "archived";
            proposed: "proposed";
        }>>;
        waiver: z.ZodOptional<z.ZodObject<{
            criterionAcId: z.ZodString;
            childTaskId: z.ZodString;
            reason: z.ZodString;
            actor: z.ZodString;
            waivedAt: z.ZodString;
        }, z.core.$strip>>;
        replacement: z.ZodOptional<z.ZodObject<{
            criterionAcId: z.ZodString;
            originalChildTaskId: z.ZodString;
            replacementChildTaskId: z.ZodString;
            reason: z.ZodString;
            actor: z.ZodString;
            replacedAt: z.ZodString;
        }, z.core.$strip>>;
        replacementTaskStatus: z.ZodOptional<z.ZodEnum<{
            pending: "pending";
            cancelled: "cancelled";
            active: "active";
            blocked: "blocked";
            done: "done";
            archived: "archived";
            proposed: "proposed";
        }>>;
        evidenceBindings: z.ZodNumber;
    }, z.core.$strip>>;
    totals: z.ZodObject<{
        criteria: z.ZodNumber;
        satisfied: z.ZodNumber;
        unsatisfied: z.ZodNumber;
        waived: z.ZodNumber;
        replaced: z.ZodNumber;
    }, z.core.$strip>;
}, z.core.$strip>;
/** Zod result contract for `tasks.completion.explain`. @task T10607 */
export declare const completionExplanationSchema: z.ZodObject<{
    taskId: z.ZodString;
    ready: z.ZodBoolean;
    stale: z.ZodBoolean;
    summary: z.ZodString;
    contextPack: z.ZodOptional<z.ZodType<CompletionContextPack, unknown, z.core.$ZodTypeInternals<CompletionContextPack, unknown>>>;
    blockers: z.ZodArray<z.ZodObject<{
        acId: z.ZodString;
        alias: z.ZodString;
        text: z.ZodString;
        kind: z.ZodEnum<{
            text: "text";
            child_task: "child_task";
            evidence_bound: "evidence_bound";
        }>;
        status: z.ZodEnum<{
            waived: "waived";
            satisfied: "satisfied";
            unsatisfied: "unsatisfied";
            replaced: "replaced";
        }>;
        reason: z.ZodOptional<z.ZodEnum<{
            missing_evidence_binding: "missing_evidence_binding";
            child_not_done: "child_not_done";
            child_cancelled_requires_waiver: "child_cancelled_requires_waiver";
            child_replacement_not_done: "child_replacement_not_done";
            child_missing: "child_missing";
            done_parent_stale: "done_parent_stale";
        }>>;
        targetTaskId: z.ZodOptional<z.ZodString>;
        targetTaskStatus: z.ZodOptional<z.ZodEnum<{
            pending: "pending";
            cancelled: "cancelled";
            active: "active";
            blocked: "blocked";
            done: "done";
            archived: "archived";
            proposed: "proposed";
        }>>;
        waiver: z.ZodOptional<z.ZodObject<{
            criterionAcId: z.ZodString;
            childTaskId: z.ZodString;
            reason: z.ZodString;
            actor: z.ZodString;
            waivedAt: z.ZodString;
        }, z.core.$strip>>;
        replacement: z.ZodOptional<z.ZodObject<{
            criterionAcId: z.ZodString;
            originalChildTaskId: z.ZodString;
            replacementChildTaskId: z.ZodString;
            reason: z.ZodString;
            actor: z.ZodString;
            replacedAt: z.ZodString;
        }, z.core.$strip>>;
        replacementTaskStatus: z.ZodOptional<z.ZodEnum<{
            pending: "pending";
            cancelled: "cancelled";
            active: "active";
            blocked: "blocked";
            done: "done";
            archived: "archived";
            proposed: "proposed";
        }>>;
        evidenceBindings: z.ZodNumber;
    }, z.core.$strip>>;
}, z.core.$strip>;
/** Zod params for `tasks.completion.list`. @task T10607 */
export declare const completionListParamsSchema: z.ZodObject<{
    taskId: z.ZodString;
    status: z.ZodOptional<z.ZodEnum<{
        waived: "waived";
        satisfied: "satisfied";
        unsatisfied: "unsatisfied";
        replaced: "replaced";
    }>>;
    kind: z.ZodOptional<z.ZodEnum<{
        text: "text";
        child_task: "child_task";
        evidence_bound: "evidence_bound";
    }>>;
}, z.core.$strip>;
/** Zod result contract for `tasks.completion.list`. @task T10607 */
export declare const completionListResultSchema: z.ZodObject<{
    taskId: z.ZodString;
    criteria: z.ZodArray<z.ZodObject<{
        acId: z.ZodString;
        alias: z.ZodString;
        text: z.ZodString;
        kind: z.ZodEnum<{
            text: "text";
            child_task: "child_task";
            evidence_bound: "evidence_bound";
        }>;
        status: z.ZodEnum<{
            waived: "waived";
            satisfied: "satisfied";
            unsatisfied: "unsatisfied";
            replaced: "replaced";
        }>;
        reason: z.ZodOptional<z.ZodEnum<{
            missing_evidence_binding: "missing_evidence_binding";
            child_not_done: "child_not_done";
            child_cancelled_requires_waiver: "child_cancelled_requires_waiver";
            child_replacement_not_done: "child_replacement_not_done";
            child_missing: "child_missing";
            done_parent_stale: "done_parent_stale";
        }>>;
        targetTaskId: z.ZodOptional<z.ZodString>;
        targetTaskStatus: z.ZodOptional<z.ZodEnum<{
            pending: "pending";
            cancelled: "cancelled";
            active: "active";
            blocked: "blocked";
            done: "done";
            archived: "archived";
            proposed: "proposed";
        }>>;
        waiver: z.ZodOptional<z.ZodObject<{
            criterionAcId: z.ZodString;
            childTaskId: z.ZodString;
            reason: z.ZodString;
            actor: z.ZodString;
            waivedAt: z.ZodString;
        }, z.core.$strip>>;
        replacement: z.ZodOptional<z.ZodObject<{
            criterionAcId: z.ZodString;
            originalChildTaskId: z.ZodString;
            replacementChildTaskId: z.ZodString;
            reason: z.ZodString;
            actor: z.ZodString;
            replacedAt: z.ZodString;
        }, z.core.$strip>>;
        replacementTaskStatus: z.ZodOptional<z.ZodEnum<{
            pending: "pending";
            cancelled: "cancelled";
            active: "active";
            blocked: "blocked";
            done: "done";
            archived: "archived";
            proposed: "proposed";
        }>>;
        evidenceBindings: z.ZodNumber;
    }, z.core.$strip>>;
    totals: z.ZodObject<{
        criteria: z.ZodNumber;
        satisfied: z.ZodNumber;
        unsatisfied: z.ZodNumber;
        waived: z.ZodNumber;
        replaced: z.ZodNumber;
    }, z.core.$strip>;
}, z.core.$strip>;
/** Zod params for `tasks.completion.evaluate` and `tasks.completion.explain`. @task T10607 */
export declare const completionEvaluateParamsSchema: z.ZodObject<{
    taskId: z.ZodString;
    includeContext: z.ZodOptional<z.ZodBoolean>;
    limit: z.ZodOptional<z.ZodNumber>;
    since: z.ZodOptional<z.ZodString>;
    relationDepth: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>;
/** Zod params for `tasks.completion.explain`. @task T10607 */
export declare const completionExplainParamsSchema: z.ZodObject<{
    taskId: z.ZodString;
    includeContext: z.ZodOptional<z.ZodBoolean>;
    limit: z.ZodOptional<z.ZodNumber>;
    since: z.ZodOptional<z.ZodString>;
    relationDepth: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>;
/** Zod schema for typed stale-projection repair errors. @task T10607 */
export declare const completionProjectionRepairErrorSchema: z.ZodObject<{
    code: z.ZodEnum<{
        projection_not_stale: "projection_not_stale";
        criteria_missing: "criteria_missing";
        binding_target_missing: "binding_target_missing";
        repair_conflict: "repair_conflict";
    }>;
    message: z.ZodString;
    taskId: z.ZodString;
    acId: z.ZodOptional<z.ZodString>;
    evidenceAtomId: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
/** Zod params for `tasks.projection.repair`. @task T10607 */
export declare const completionProjectionRepairParamsSchema: z.ZodObject<{
    taskId: z.ZodString;
    dryRun: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>;
/** Zod result contract for `tasks.projection.repair`. @task T10607 */
export declare const completionProjectionRepairResultSchema: z.ZodObject<{
    taskId: z.ZodString;
    repaired: z.ZodBoolean;
    dryRun: z.ZodBoolean;
    staleBefore: z.ZodBoolean;
    staleAfter: z.ZodBoolean;
    errors: z.ZodArray<z.ZodObject<{
        code: z.ZodEnum<{
            projection_not_stale: "projection_not_stale";
            criteria_missing: "criteria_missing";
            binding_target_missing: "binding_target_missing";
            repair_conflict: "repair_conflict";
        }>;
        message: z.ZodString;
        taskId: z.ZodString;
        acId: z.ZodOptional<z.ZodString>;
        evidenceAtomId: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>;
}, z.core.$strip>;
/**
 * A single node in the flat task hierarchy tree returned by `tasks.tree`.
 *
 * Mirrors `FlatTreeNode` from `packages/core/src/tasks/task-ops.ts`.
 *
 * @task T1703
 */
export interface TaskTreeNode {
    /** Unique task identifier (e.g. "T001"). */
    id: string;
    /** Human-readable task title. */
    title: string;
    /** Current task status. */
    status: string;
    /** Task type classification. @defaultValue "task" */
    type?: string;
    /** Child nodes in the hierarchy tree. */
    children: TaskTreeNode[];
    /** Task priority level. @defaultValue "medium" */
    priority: TaskPriority;
    /** Direct dependency IDs for this task. */
    depends: string[];
    /** Open (unresolved) dependency IDs that are currently blocking this task. */
    blockedBy: string[];
    /**
     * Whether this task is immediately actionable.
     * True when `blockedBy` is empty AND status is `"pending"` or `"active"`.
     */
    ready: boolean;
    /**
     * Full transitive blocker chain. Only populated when `withBlockers` is
     * requested at tree-build time.
     * @defaultValue undefined
     */
    blockerChain?: string[];
    /**
     * Leaf-level blockers — the root-cause tasks that must be resolved first.
     * Only populated when `withBlockers` is requested at tree-build time.
     * @defaultValue undefined
     */
    leafBlockers?: string[];
}
/**
 * An in-progress epic returned by the plan operation.
 *
 * Mirrors `InProgressEpic` from `packages/core/src/tasks/plan.ts`.
 *
 * @task T1703
 */
export interface TaskPlanInProgressEpic {
    /** Epic task ID. */
    epicId: string;
    /** Epic title. */
    epicTitle: string;
    /** Number of active child tasks. */
    activeTasks: number;
    /** Completion percentage (0–100). */
    completionPercent: number;
}
/**
 * A ready task entry with leverage analysis returned by the plan operation.
 *
 * Mirrors `ReadyTask` from `packages/core/src/tasks/plan.ts`.
 *
 * @task T1703
 */
export interface TaskPlanReadyTask {
    /** Task identifier. */
    id: string;
    /** Task title. */
    title: string;
    /** Task priority. */
    priority: TaskPriority;
    /** Parent epic ID. */
    epicId: string;
    /** Leverage score (higher = more impactful). */
    leverage: number;
    /** Overall planning score. */
    score: number;
    /** Human-readable reasons this task is recommended. */
    reasons: string[];
}
/**
 * A blocked task entry returned by the plan operation.
 *
 * Mirrors `BlockedTask` from `packages/core/src/tasks/plan.ts`.
 *
 * @task T1703
 */
export interface TaskPlanBlockedTask {
    /** Task identifier. */
    id: string;
    /** Task title. */
    title: string;
    /** IDs of tasks blocking this task. */
    blockedBy: string[];
    /** Number of tasks this task is blocking. */
    blocksCount: number;
}
/**
 * An open bug entry returned by the plan operation.
 *
 * Mirrors `OpenBug` from `packages/core/src/tasks/plan.ts`.
 *
 * @task T1703
 */
export interface TaskPlanOpenBug {
    /** Task identifier. */
    id: string;
    /** Task title. */
    title: string;
    /** Task priority. */
    priority: TaskPriority;
    /** Parent epic ID. */
    epicId: string;
}
/**
 * Planning metrics summary.
 *
 * Mirrors `PlanMetrics` from `packages/core/src/tasks/plan.ts`.
 *
 * @task T1703
 */
export interface TaskPlanMetrics {
    /** Total number of epics. */
    totalEpics: number;
    /** Number of currently active epics. */
    activeEpics: number;
    /** Total number of tasks across all epics. */
    totalTasks: number;
    /** Number of tasks that are ready to work on. */
    actionable: number;
    /** Number of tasks that are blocked. */
    blocked: number;
    /** Number of open bug tasks. */
    openBugs: number;
    /** Average leverage score across actionable tasks. */
    avgLeverage: number;
}
/**
 * Composite planning view result returned by `tasks.plan`.
 *
 * Mirrors `PlanResult` from `packages/core/src/tasks/plan.ts`.
 *
 * @task T1703
 */
export interface TaskPlanResult {
    /** Epics currently being worked on. */
    inProgress: TaskPlanInProgressEpic[];
    /** Tasks ready to be started. */
    ready: TaskPlanReadyTask[];
    /** Tasks blocked by dependencies. */
    blocked: TaskPlanBlockedTask[];
    /** Open bug tasks. */
    openBugs: TaskPlanOpenBug[];
    /** Aggregate planning metrics. */
    metrics: TaskPlanMetrics;
}
/**
 * Label entry with task counts and status breakdown.
 *
 * Mirrors the private `LabelInfo` from `packages/core/src/tasks/labels.ts`.
 *
 * @task T1703
 */
export interface TaskLabelInfo {
    /** Label text. */
    label: string;
    /** Total number of tasks with this label. */
    count: number;
    /** Breakdown of task counts by status. */
    statuses: Record<string, number>;
}
/**
 * A single factor contributing to a task's complexity score.
 *
 * Mirrors `ComplexityFactor` from `packages/core/src/tasks/task-ops.ts`.
 *
 * @task T1703
 */
export interface TaskComplexityFactor {
    /** Factor name (e.g. "descriptionLength", "dependencyDepth"). */
    name: string;
    /** Numeric score contribution from this factor. */
    value: number;
    /** Human-readable explanation of the score. */
    detail: string;
}
/**
 * A compact task reference in dependency results.
 * Alias kept here for operations layer use.
 */
export interface TaskDependsRef {
    /** Task identifier. */
    id: string;
    /** Task title. */
    title: string;
    /** Current task status string. */
    status: string;
}
/**
 * Full result shape returned by `tasks.depends`.
 *
 * Mirrors the return of `coreTaskDepends` from `packages/core/src/tasks/task-ops.ts`.
 *
 * @task T1703
 */
export interface TaskDependsResult {
    /** The task ID whose dependencies were analyzed. */
    taskId: string;
    /** Direction of analysis: upstream | downstream | both. */
    direction: string;
    /** Tasks that this task depends on (upstream dependencies). */
    upstream: TaskDependsRef[];
    /** Tasks that depend on this task (downstream dependents). */
    downstream: TaskDependsRef[];
    /** Count of transitive unresolved dependencies. */
    unresolvedChain: number;
    /** Leaf-level blockers — root-cause tasks that must be resolved first. */
    leafBlockers: TaskDependsRef[];
    /** Whether all declared dependencies are in a terminal status. */
    allDepsReady: boolean;
    /** Optional hint for the next CLI command to run. @defaultValue undefined */
    hint?: string;
    /** Optional upstream dependency tree (only when `tree: true` was requested). @defaultValue undefined */
    upstreamTree?: TaskTreeNode[];
}
//# sourceMappingURL=tasks.d.ts.map