import type { ProfileId } from '../profiles/index.js';
import type { PreProcessorConfig } from '../services/context-preprocessor.js';
export type { CalibrationDriftEntry, SizingCategoryStats, CalibrationResult, CalibrationLesson, } from './velocity-calibration.js';
export type { TestStatus, TestResult, TestSummary, CoverageSummary, CoverageMetric, LintSeverity, LintIssue, LintSummary, EvidenceGenerationStatus, EvidenceGenerationResult, AllEvidenceResult, } from './qa-evidence.js';
export type { ProjectionScope, ProjectionConfidence, BudgetProjection, ProjectionOptions, } from './budget-projection.js';
export type { DashboardChartType, ChartDataPoint, DashboardData, DashboardOptions } from './dashboard.js';
export type { DiagramType, DiagramNodeShape, DiagramNode, DiagramEdge, DiagramLayoutDirection, AgentDiagramData, DiagramOutputFormat, MaxGraphNode, MaxGraphEdge, MaxGraphJson, } from './diagram.js';
export type { ReportSeverity, ReportFinding, ReportMetric, ReportRecommendation, ReportSection, AgentReportData, ReportOutputFormat, } from './report.js';
export type { ConsentLevel, RedactionRule, ExportFormat, ExportOptions, ExportResult, AuditEntry, } from './telemetry-export.js';
export declare const SUPPORTED_TOOLS: readonly ["cursor", "vscode", "codex", "claude", "agentforce", "windsurf", "jetbrains"];
export type SupportedTool = (typeof SUPPORTED_TOOLS)[number];
export type SetupAgentsWorkspaceMode = 'project' | 'advisory';
export type SetupAgentsProfileOwner = `setup-agents:${ProfileId}`;
export type SetupAgentsStateRecordKind = 'decision' | 'evidence' | 'handoff' | 'review';
export type SetupAgentsReviewStatus = 'pending' | 'approved' | 'blocked' | 'changes';
export type SetupAgentsEvidenceKind = 'command' | 'file' | 'screenshot' | 'trace' | 'report' | 'validation' | 'other';
export type SetupAgentsTaskStatus = 'open' | 'claimed' | 'done' | 'cancelled' | 'blocked' | 'deleted' | 'archived';
export type SetupAgentsTaskEvent = 'created' | 'claimed' | 'done' | 'cancelled' | 'blocked' | 'updated' | 'deleted' | 'archived';
export type SetupAgentsStateRecordBase = {
    id: string;
    kind: SetupAgentsStateRecordKind;
    createdAt: string;
    summary: string;
    taskIds: string[];
};
export type SetupAgentsEvidenceRecord = SetupAgentsStateRecordBase & {
    kind: 'evidence';
    owner?: SetupAgentsProfileOwner;
    evidenceKind: SetupAgentsEvidenceKind;
    command?: string;
    path?: string;
    exitCode?: number;
    details?: string;
};
export type SetupAgentsDecisionRecord = SetupAgentsStateRecordBase & {
    kind: 'decision';
    owner: SetupAgentsProfileOwner;
    rationale?: string;
    outcome?: string;
    alternatives?: string[];
    evidenceIds?: string[];
};
export type SetupAgentsHandoffRecord = SetupAgentsStateRecordBase & {
    kind: 'handoff';
    from: SetupAgentsProfileOwner;
    to: SetupAgentsProfileOwner;
    changedFiles?: string[];
    risks?: string[];
    nextActions?: string[];
    acceptanceCriteria?: string[];
    capabilitySignals?: string[];
    evidenceIds?: string[];
};
export type SetupAgentsReviewRecord = SetupAgentsStateRecordBase & {
    kind: 'review';
    status: SetupAgentsReviewStatus;
    requester: SetupAgentsProfileOwner;
    reviewer?: SetupAgentsProfileOwner;
    gates: string[];
    findings?: string;
    recommendation?: string;
    completedAt?: string;
    returnTarget?: WorkflowPhase;
    correctionIteration?: number;
};
export type SetupAgentsStateRecord = SetupAgentsEvidenceRecord | SetupAgentsDecisionRecord | SetupAgentsHandoffRecord | SetupAgentsReviewRecord;
export type SetupAgentsTaskRoles = {
    required: string[];
    optional: string[];
};
export type PhaseOverrideAction = 'skip' | 'add' | 'require-gate' | 'remove-gate';
export type PhaseOverride = {
    phase: WorkflowPhase;
    action: PhaseOverrideAction;
    reason?: string;
};
export type SetupAgentsTaskType = 'story' | 'epic' | 'subtask';
export type DecompositionVote = {
    voter: 'ba' | 'ta';
    verdict: 'proceed' | 'decompose';
    reason: string;
    suggestedSplits?: string[];
};
export type SetupAgentsTaskRecord = {
    id: string;
    kind: 'task';
    event: SetupAgentsTaskEvent;
    summary: string;
    status: SetupAgentsTaskStatus;
    owner?: SetupAgentsProfileOwner;
    mode?: SetupAgentsWorkspaceMode;
    roles?: SetupAgentsTaskRoles;
    declaredPhases?: WorkflowPhase[];
    phaseOverrides?: PhaseOverride[];
    type?: SetupAgentsTaskType;
    parentId?: string;
    decompositionVotes?: DecompositionVote[];
    reason?: string;
    createdAt: string;
    updatedAt: string;
    evidenceIds: string[];
};
export type CommandResult<T> = {
    record: T;
    file: string;
    cwd: string;
};
export type CommandListResult<T> = {
    records: T[];
    file: string;
    cwd: string;
};
export type SetupAgentsTaskCreateResult = CommandResult<SetupAgentsTaskRecord>;
export type SetupAgentsTaskListResult = CommandListResult<SetupAgentsTaskRecord>;
export type SetupAgentsTaskViewResult = CommandResult<SetupAgentsTaskRecord | undefined>;
export type SetupAgentsTaskClaimResult = CommandResult<SetupAgentsTaskRecord | undefined>;
export type SetupAgentsTaskDoneResult = CommandResult<SetupAgentsTaskRecord | undefined> & {
    writeBack?: SetupAgentsWriteBackResult;
};
export type SetupAgentsTaskUpdateResult = CommandResult<SetupAgentsTaskRecord>;
export type SetupAgentsTaskDeleteResult = CommandResult<SetupAgentsTaskRecord>;
export type SetupAgentsTaskArchiveResult = CommandResult<SetupAgentsTaskRecord>;
export type SetupAgentsEvidenceAddResult = CommandResult<SetupAgentsEvidenceRecord>;
export type SetupAgentsEvidenceListResult = CommandListResult<SetupAgentsEvidenceRecord>;
export type SetupAgentsDecisionAddResult = CommandResult<SetupAgentsDecisionRecord>;
export type SetupAgentsDecisionListResult = CommandListResult<SetupAgentsDecisionRecord>;
export type SetupAgentsHandoffCreateResult = CommandResult<SetupAgentsHandoffRecord>;
export type SetupAgentsHandoffListResult = CommandListResult<SetupAgentsHandoffRecord>;
export type SetupAgentsOrchestrationConfig = {
    enabled: boolean;
    engine: 'native';
    mode: SetupAgentsWorkspaceMode;
    profiles: ProfileId[];
};
export type SetupAgentsNotificationsConfig = {
    slack?: {
        webhookEnvVar?: string;
    };
    github?: {
        issueComment?: boolean;
    };
};
export type SetupAgentsReleaseCheckConfig = {
    checks?: Array<'npm-audit' | 'knip' | 'coverage' | 'secret-scan'>;
};
export type RuleOverride = {
    scope?: 'always' | 'auto-attach' | 'description';
    globs?: string[];
    claudeAlwaysImport?: boolean;
};
export type PhaseBudgetEnvelope = {
    phase?: WorkflowPhase;
    maxTokens?: number;
    maxCostCents?: number;
    maxRetries?: number;
    maxMinutes?: number;
};
export type SetupAgentsWorkspaceConfig = {
    version: string;
    mode: SetupAgentsWorkspaceMode;
    profiles: ProfileId[];
    tools: SupportedTool[];
    orchestration: SetupAgentsOrchestrationConfig;
    notifications?: SetupAgentsNotificationsConfig;
    releaseCheck?: SetupAgentsReleaseCheckConfig;
    remote?: {
        gistId?: string;
    };
    /** Per-profile overrides for Cursor scope and Claude import behavior. */
    ruleOverrides?: Partial<Record<ProfileId, RuleOverride>>;
    qualityContracts?: QualityContract[];
    budgetEnvelopes?: PhaseBudgetEnvelope[];
    domains?: DomainId[];
    /** Context pre-processor configuration for reducing large files in delegation packets. */
    contextPreProcessor?: PreProcessorConfig;
};
export type QualityContractMode = 'block' | 'escalate' | 'warn' | 'advisory';
export type PhaseRequiredField = {
    field: string;
    description: string;
};
export type DomainId = 'healthcare' | 'financial_services' | 'government' | 'defense' | 'education' | 'retail';
export type DomainEscalation = {
    domains: DomainId[];
    additionalChecks: string[];
    escalationLevel: 'info' | 'warning' | 'critical';
};
export type QualityContract = {
    role: string;
    requiredChecks: string[];
    mode: QualityContractMode;
    requiredFields?: PhaseRequiredField[];
    domainEscalation?: DomainEscalation;
};
export type WorkflowGateMode = 'none' | 'phase' | 'all';
export type WorkflowSizingLabel = 'xs' | 's' | 'm' | 'l' | 'xl';
export type WorkflowEstimateConfidence = 'low' | 'medium' | 'high';
export type WorkflowEstimateRecord = {
    id: string;
    storyId: string;
    sizingLabel: WorkflowSizingLabel;
    soloEstimateDays: number;
    aiUnguidedEstimateDays: number;
    aiGuidedDays?: number;
    confidence: WorkflowEstimateConfidence;
    declaredBy: string;
    declaredAt: string;
};
export type WorkflowBenchmarkActualSource = 'phase-timeline' | 'task-lifecycle' | null;
export type WorkflowBenchmarkResult = {
    storyId: string;
    sizingLabel: WorkflowSizingLabel;
    soloEstimateDays: number;
    aiUnguidedEstimateDays: number;
    aiGuidedDays: number | null;
    actualDays: number | null;
    actualSource: WorkflowBenchmarkActualSource;
    vsSoloPct: number | null;
    vsAiUnguidedPct: number | null;
    vsAiGuidedPct: number | null;
    qaIterations: number;
    evidenceCount: number;
    status: 'pending' | 'complete';
};
export type WorkflowBenchmarkSummary = {
    stories: WorkflowBenchmarkResult[];
    totalWithActuals: number;
    avgVsSoloPct: number | null;
    avgVsAiUnguidedPct: number | null;
    avgVsAiGuidedPct: number | null;
};
export type HistoricalEstimateStats = {
    count: number;
    medianSoloDays: number | null;
    medianAiGuidedDays: number | null;
    calibrationNote: string | null;
};
export type SetupAgentsWorkflowEstimateResult = CommandResult<WorkflowEstimateRecord> & {
    historicalStats?: HistoricalEstimateStats;
};
export type SetupAgentsWorkflowBenchmarkResult = {
    result?: WorkflowBenchmarkResult;
    summary?: WorkflowBenchmarkSummary;
    file: string;
    cwd: string;
};
export declare const WORKFLOW_PHASES: readonly ["pm", "ba", "architect", "ux", "developer", "security-review", "qa", "release"];
export type WorkflowPhase = (typeof WORKFLOW_PHASES)[number];
export type WorkflowPhaseStatus = 'pending' | 'running' | 'done' | 'blocked' | 'skipped' | 'awaiting_clarification';
export type WorkflowPhaseRecord = {
    phase: WorkflowPhase;
    status: WorkflowPhaseStatus;
    taskId: string;
    handoffId?: string;
    reviewIds?: string[];
    clarificationIds?: string[];
    startedAt: string;
    completedAt?: string;
    notes?: string;
};
export type WorkflowRunRecord = {
    id: string;
    storyId: string;
    gates: WorkflowGateMode;
    maxIterations: number;
    qaIterations: number;
    phases: WorkflowPhaseRecord[];
    status: 'running' | 'paused' | 'done' | 'failed';
    createdAt: string;
    updatedAt: string;
    rollbackReason?: string;
};
export type SetupAgentsWorkflowRunResult = {
    run: WorkflowRunRecord;
    file: string;
    cwd: string;
};
export type PhasePlanEntry = {
    phase: WorkflowPhase;
    profile: string;
    source: 'always' | 'role-required' | 'role-optional' | 'profile-trigger' | 'override-add' | 'declared';
    gateAfter: boolean;
    overrideApplied?: PhaseOverrideAction;
};
export type SetupAgentsWorkflowPhasePlanResult = {
    plan: PhasePlanEntry[];
    skipped: Array<{
        phase: WorkflowPhase;
        reason: string;
    }>;
    gates: string[];
    cwd: string;
};
export type PhaseInstructions = {
    phase: WorkflowPhase;
    instructionsDir: string;
    playbooks: Array<{
        filename: string;
        path: string;
        exists: boolean;
    }>;
};
export type SetupAgentsWorkflowPlaybooksResult = {
    phases: PhaseInstructions[];
    instructionsDir: string;
    cwd: string;
    scaffolded?: string[];
    skipped?: string[];
};
export type SetupAgentsEffortMode = 'ai_autonomous' | 'ai_supervised' | 'ai_calibration_baseline' | 'human_manual' | 'human_review';
export type TokenCost = {
    model: string;
    inputTokens: number;
    outputTokens: number;
    costUsd: number;
};
export type EffortEstimateRecord = {
    id: string;
    storyId: string;
    phase: WorkflowPhase;
    workMode: SetupAgentsEffortMode;
    actualMinutes: number | null;
    estimatedUnguidedMinutes: number | null;
    confidence: WorkflowEstimateConfidence;
    rationale: string;
    createdAt: string;
    tokenCost?: TokenCost;
};
export type TokenCostSummary = {
    totalCostUsd: number;
    byMode: Partial<Record<SetupAgentsEffortMode, {
        costUsd: number;
        phases: number;
    }>>;
    byStory: Record<string, number>;
};
export type EffortSummary = {
    storyId: string | null;
    byMode: Record<SetupAgentsEffortMode, number>;
    totalMinutes: number;
    autonomyPct: number | null;
    rulesMultiplier: number | null;
    tokenCost: TokenCostSummary | null;
};
export type SetupAgentsWorkflowTelemetryResult = {
    records: EffortEstimateRecord[];
    summary: EffortSummary;
    file: string;
    cwd: string;
};
export type WorkflowGateKind = 'transition' | 'mid-phase';
export type WorkflowPendingItem = {
    run: WorkflowRunRecord;
    pausedPhase: WorkflowPhase;
    nextPhase?: WorkflowPhase;
    reviewId: string;
    kind: WorkflowGateKind;
    approveCommand: string;
    resumeCommand: string;
};
export type SetupAgentsWorkflowPendingResult = {
    items: WorkflowPendingItem[];
    file: string;
    cwd: string;
};
export type SetupAgentsWorkflowGateResult = {
    reviewId: string;
    run: WorkflowRunRecord;
    file: string;
    cwd: string;
};
export type SetupAgentsReviewRequestResult = CommandResult<SetupAgentsReviewRecord>;
export type SetupAgentsReviewListResult = CommandListResult<SetupAgentsReviewRecord>;
export type SetupAgentsReviewCompleteResult = CommandResult<SetupAgentsReviewRecord>;
export type RulesHealthEntry = {
    profile: string;
    file: string;
    embeddedVersion: string | null;
    pluginVersion: string;
    stale: boolean;
};
export type PlaybookHealthEntry = {
    phase: string;
    file: string;
    exists: boolean;
};
export type DependencyHealthEntry = {
    id: string;
    label: string;
    installed: boolean;
    version?: string;
    optional: boolean;
};
export type SetupAgentsStatusResult = {
    openTasks: number;
    claimedTasks: number;
    doneTasks: number;
    pendingReviews: number;
    blockedHandoffs: number;
    missingEvidence: number;
    configFile: string | null;
    mode: SetupAgentsWorkspaceMode | null;
    profiles: string[];
    cwd: string;
    rulesHealth: RulesHealthEntry[];
    playbookHealth: PlaybookHealthEntry[];
    dependencyHealth: DependencyHealthEntry[];
};
export type SetupAgentsInitResult = {
    configFile: string;
    config: SetupAgentsWorkspaceConfig;
    written: boolean;
    cwd: string;
};
export type SetupLocalResult = {
    configured: string[];
    profiles: ProfileId[];
    localState?: {
        path: string;
        files: string[];
    };
    advisory?: {
        enabled: boolean;
        path: string;
        files: string[];
    };
    openOrchestra?: {
        enabled: boolean;
        status: 'available' | 'not-installed';
        path: string;
        files: string[];
        command: string;
        guidance: string;
    };
    cwd: string;
};
export type StaleRuleFile = {
    file: string;
    tool: SupportedTool;
    version: string | null;
    managedBlocks: boolean;
    updateMode: 'managed-blocks' | 'full-file';
    availableActions: Array<'check' | 'dry-run' | 'update'>;
};
/**
 * Lightweight Result type. Provides explicit success/failure handling
 * without exceptions. Mirrors the pattern in core/monad/result.ts (profiler).
 */
export type Result<T, E = Error> = {
    ok: true;
    value: T;
} | {
    ok: false;
    error: E;
};
export declare const ok: <T>(value: T) => Result<T, never>;
export declare const err: <E>(error: E) => Result<never, E>;
export type WorkflowErrorCode = 'phase-not-running' | 'run-not-found' | 'phase-not-found' | 'max-iterations-exceeded' | 'clarification-not-found' | 'review-not-found';
export type WorkflowError = {
    code: WorkflowErrorCode;
    message: string;
};
export type SprintRecord = {
    id: string;
    sprintId: string;
    event: 'start' | 'close';
    startDate?: string;
    endDate?: string;
    capacityDays?: number;
    committedPoints?: number;
    actualPoints?: number;
    velocityPct?: number;
    avgVsSoloPct?: number | null;
    avgVsAiUnguidedPct?: number | null;
    createdAt: string;
};
export type VelocityLesson = {
    id: string;
    sprintId: string;
    role: string;
    biasDirection: 'over' | 'under';
    biasAvgPct: number;
    storySample: string[];
    createdAt: string;
};
export type ReleaseCheckResult = {
    name: string;
    status: 'pass' | 'warn' | 'fail';
    blocking: boolean;
    detail: string;
    evidenceId?: string;
};
export type ReleaseCheckReport = {
    taskId: string;
    checks: ReleaseCheckResult[];
    overallPass: boolean;
    runAt: string;
};
export type SetupAgentsReleaseCheckResult = {
    report: ReleaseCheckReport;
    cwd: string;
};
export type ClarificationStatus = 'open' | 'answered';
export type ClarificationToRole = 'po' | 'ta';
export type ClarificationRecord = {
    id: string;
    runId: string;
    storyId: string;
    fromRole: WorkflowPhase;
    toRole: ClarificationToRole;
    question: string;
    answer?: string;
    status: ClarificationStatus;
    createdAt: string;
    answeredAt?: string;
};
export type SetupAgentsClarifyResult = CommandResult<ClarificationRecord> & {
    run: WorkflowRunRecord;
};
export type SetupAgentsClarifyRespondResult = CommandResult<ClarificationRecord> & {
    run: WorkflowRunRecord;
};
export type SetupAgentsClarifyListResult = CommandListResult<ClarificationRecord>;
export type SetupAgentsVerifyResult = {
    tool: string | null;
    profiles: string[];
    probePrompt: string | null;
    hasRules: boolean;
    cwd: string;
};
export type SetupAgentsUpdateDocReferenceResult = {
    files: string[];
    profiles: string[];
    cwd: string;
};
export type SetupAgentsUpdateFetchRefsResult = {
    downloaded: string[];
    cached: string[];
    failed: string[];
    refsDir: string;
    cwd: string;
};
export type SetupAgentsWriteBackResult = {
    pushed: boolean;
    target: 'github' | 'jira';
    url: string | null;
    dryRun: boolean;
};
export type SetupAgentsWorkflowExecuteResult = {
    storyId: string;
    runtime: string;
    phases: Array<{
        phase: WorkflowPhase;
        status: 'done' | 'failed' | 'skipped';
        exitCode?: number;
    }>;
    dryRun: boolean;
    cwd: string;
};
export type OperationalLessonRecord = {
    id: string;
    operation: string;
    failedAction: string;
    errorSignature: string;
    phase: string;
    storyId: string;
    createdAt: string;
};
export type SetupAgentsWorkflowLessonsResult = {
    lessons: OperationalLessonRecord[];
    cwd: string;
};
export type SetupAgentsCanvasSyncResult = {
    synced: number;
    alreadyOk: number;
    orphansRemoved: number;
    cacheDir: string;
    dryRun: boolean;
    cwd: string;
};
export type SetupAgentsCanvasStatusResult = {
    canvases: Array<{
        name: string;
        state: 'symlink-ok' | 'symlink-wrong' | 'regular' | 'missing';
    }>;
    orphans: string[];
    cacheDir: string;
    cwd: string;
};
export type SetupAgentsCanvasCleanResult = {
    removed: string[];
    cacheDir: string;
    cwd: string;
};
export type DashboardHandoffEntry = {
    id: string;
    from: string;
    to: string;
    summary: string;
    createdAt: string;
    taskId: string | null;
};
export type SetupAgentsDashboardMetrics = {
    generatedAt: string;
    projectName: string;
    tasks: {
        total: number;
        done: number;
        claimed: number;
        open: number;
        cancelled: number;
    };
    effort: {
        manualHours: number;
        aiSupervisedHours: number;
        aiAutonomousHours: number;
        totalHours: number;
        aiRatioPct: number;
    };
    sizingEstimate: {
        totalSoloDays: number;
        totalAiUnguidedDays: number;
        storiesEstimated: number;
    } | null;
    tokenCost: TokenCostSummary | null;
    velocity: Record<string, number>;
    byProfile: Record<string, {
        total: number;
        done: number;
    }>;
    storyCycleTimes: Record<string, number>;
    phaseCycleTimes: Record<string, number>;
    recentHandoffs: DashboardHandoffEntry[];
    sizingEstimateDetails: WorkflowEstimateRecord[];
};
export type SetupAgentsDashboardResult = {
    metrics: SetupAgentsDashboardMetrics;
    outputPath: string | null;
    format: 'html' | 'json';
    cwd: string;
};
export type SpawnCapability = 'unsupported' | 'request-only' | 'parent-tool' | 'local-process';
export type SpawnRequest = {
    id: string;
    taskId: string;
    runId: string;
    phase: WorkflowPhase;
    role: string;
    adapterId: string;
    contextBundle: string;
    renderedPrompt: string;
    ownershipBoundaries: SpawnOwnershipBoundaries;
    outputContract: SpawnOutputContract;
    evidenceContract: SpawnEvidenceContract;
    queueMetadata: SpawnQueueMetadata;
    createdAt: string;
};
export type SpawnOwnershipBoundaries = {
    files: string[];
    readOnly: string[];
    forbidden: string[];
};
export type SpawnOutputContract = {
    expectedType: 'deliverable' | 'review' | 'evidence';
    schema?: string;
    maxTokens?: number;
};
export type SpawnEvidenceContract = {
    requiredTypes: string[];
    autoRecord: boolean;
};
export type SpawnQueueMetadata = {
    priority: number;
    maxConcurrent: number;
    maxPerTask: number;
    delegationDepth: number;
    maxDelegationDepth: number;
    contextBudgetTokens: number;
};
export type SpawnResult = {
    requestId: string;
    status: 'completed' | 'failed' | 'timeout' | 'rejected';
    sessionId?: string;
    agentId?: string;
    runtime: string;
    role: string;
    phase: WorkflowPhase;
    output?: string;
    artifacts?: string[];
    elapsedMs: number;
    closeStatus: 'success' | 'error' | 'timeout' | 'cancelled';
};
