import { type KdControlFrame } from "./control-frame.ts"; import type { ActiveRun } from "./types.ts"; export interface KdCompiledWorkflowContext { status: string; controlFrame: KdControlFrame; userInput: string; modeGuidance: string; riskPolicy: string; budgetReport: string; workingSet: string; toolResults: string; actionCommits: string; writeTransactions: string; sourceAnchors: string; planReadiness: string; domainPlan: string; deepContext: string; runContext: string; recentEvents: string; requiredFacts: string; phaseArtifacts: string; questionFacts: string; projectContext: string; phaseGuidance: string; delegationGuidance?: string; } export interface KdContextBudget { runContextEntries: number; runContextEntryChars: number; ledgerEvents: number; phaseArtifactChars: number; projectContextChars: number; } export interface KdContextBudgetReport { focus: KdControlFrame["focus"]; limits: KdContextBudget; runContextEntries: { available: number; selected: number; truncated: boolean; }; ledgerEvents: { available: number; selected: number; truncated: boolean; }; phaseArtifacts: { phases: string[]; limitPerPhase: number; truncatedPhases: string[]; }; projectContext: { availableChars: number; selectedChars: number; truncated: boolean; generated: boolean; }; rationale: string; } export declare function compileWorkflowContext(cwd: string, run: ActiveRun, userText: string): KdCompiledWorkflowContext; export declare function formatRunContextEntries(run: ActiveRun, limit?: number, entryChars?: number): string; export declare function trimForPrompt(content: string, maxLength: number): string; export declare function contextBudgetForFocus(focus: KdControlFrame["focus"]): KdContextBudget; export declare function buildContextBudgetReport(cwd: string, run: ActiveRun, controlFrame: KdControlFrame, budget?: KdContextBudget, ledgerEventCount?: number, projectContext?: string | undefined): KdContextBudgetReport; export declare function formatContextBudgetReport(report: KdContextBudgetReport): string;