import { type ProfileId } from '../profiles/index.js';
import type { WorkflowPhase } from '../types/index.js';
import { type PreProcessorConfig } from './context-preprocessor.js';
export type DelegationReference = {
    path: string;
    title: string;
    source: 'playbook' | 'skill' | 'doc';
};
export type TrimReport = {
    originalChars: number;
    finalChars: number;
    trimmedSections: Array<{
        section: 'evidence' | 'priorPhases' | 'decisions' | 'playbooks' | 'profileRules';
        removedItems: number;
        charsReclaimed: number;
    }>;
};
export type DelegationPacket = {
    taskId: string;
    runId: string;
    phase: WorkflowPhase;
    profile: ProfileId;
    profileRules: string | null;
    playbooks: string[];
    references: DelegationReference[];
    context: DelegationContext;
    expectedDeliverable: string;
    constraints: string[];
    trimReport?: TrimReport;
};
export type DelegationContext = {
    goal: string;
    decisions: DelegationDecision[];
    evidence: DelegationEvidence[];
    clarifications: DelegationClarification[];
    priorPhases: DelegationPhaseOutcome[];
    acceptanceCriteria: string[];
};
export type DelegationDecision = {
    id: string;
    owner: string;
    summary: string;
    rationale?: string;
};
export type DelegationEvidence = {
    id: string;
    owner: string;
    summary: string;
    kind: string;
};
export type DelegationClarification = {
    question: string;
    answer: string;
    fromRole: string;
    toRole: string;
};
export type DelegationPhaseOutcome = {
    phase: WorkflowPhase;
    status: string;
    profile: ProfileId;
};
export type SubAgentResponse = {
    type: 'deliverable';
    content: string;
    artifacts?: string[];
    tokenUsage?: ParsedTokenUsage;
} | {
    type: 'clarification';
    question: string;
    toRole?: string;
    options?: string[];
} | {
    type: 'blocked';
    reason: string;
};
export type ParsedTokenUsage = {
    inputTokens: number;
    outputTokens: number;
    model?: string;
    costUsd?: number;
};
export type BuildPacketOptions = {
    cwd: string;
    taskId: string;
    runId: string;
    phase: WorkflowPhase;
    goal: string;
    priorPhases?: DelegationPhaseOutcome[];
    runtimeTarget?: 'claude' | 'cursor' | 'codex' | 'generic';
    maxContextChars?: number;
    maxPlaybookChars?: number;
    totalBudgetChars?: number;
    includeTrimReport?: boolean;
    preProcessorConfig?: PreProcessorConfig;
};
export declare function buildDelegationPacket(options: BuildPacketOptions): Promise<DelegationPacket>;
export declare function estimatePacketChars(packet: DelegationPacket): number;
type ApplyBudgetOptions = {
    includeTrimReport?: boolean;
};
export declare function applyTotalBudget(packet: DelegationPacket, budget: number, options?: ApplyBudgetOptions): DelegationPacket;
export declare function renderPacketAsPrompt(packet: DelegationPacket): string;
export declare function parseSubAgentResponse(stdout: string, exitCode?: number): SubAgentResponse | null;
export declare function parseTokenUsage(stdout: string): ParsedTokenUsage | null;
export {};
