/** * Prompt and payload observability utilities for Hive. * * Provides visibility into prompt/payload sizes to detect when * thresholds are exceeded, preventing silent truncation risks. */ /** * Metadata about prompt component sizes (in characters). */ export interface PromptMeta { /** Size of the plan content in characters */ planChars: number; /** Size of all context files combined in characters */ contextChars: number; /** Size of previous task summaries in characters */ previousTasksChars: number; /** Size of the task spec in characters */ specChars: number; /** Size of the final worker prompt in characters */ workerPromptChars: number; } /** * Metadata about the JSON payload. */ export interface PayloadMeta { /** Size of the full JSON payload in characters */ jsonPayloadChars: number; /** Whether the prompt is inlined in the payload */ promptInlined: boolean; /** Whether the prompt is referenced by file path */ promptReferencedByFile: boolean; } /** * Warning about threshold exceedance. */ export interface PromptWarning { /** Type of warning */ type: 'workerPromptSize' | 'jsonPayloadSize' | 'contextSize' | 'previousTasksSize' | 'planSize'; /** Severity level */ severity: 'info' | 'warning' | 'critical'; /** Human-readable message */ message: string; /** Current value */ currentValue: number; /** Threshold that was exceeded */ threshold: number; } /** * Configurable thresholds for warnings. */ export interface PromptThresholds { /** Max chars for worker prompt before warning (default: 100KB) */ workerPromptMaxChars: number; /** Max chars for JSON payload before warning (default: 150KB) */ jsonPayloadMaxChars: number; /** Max chars for context before warning (default: 50KB) */ contextMaxChars: number; /** Max chars for previous tasks before warning (default: 20KB) */ previousTasksMaxChars: number; /** Max chars for plan before warning (default: 30KB) */ planMaxChars?: number; } /** * Default thresholds for prompt/payload size warnings. * * These are conservative defaults based on typical LLM context limits * and tool output size restrictions. */ export declare const DEFAULT_THRESHOLDS: PromptThresholds; /** * Calculate metadata about prompt component sizes. */ export declare function calculatePromptMeta(inputs: { plan: string; context: string; previousTasks: string; spec: string; workerPrompt: string; }): PromptMeta; /** * Calculate metadata about the JSON payload. */ export declare function calculatePayloadMeta(inputs: { jsonPayload: string; promptInlined: boolean; promptReferencedByFile?: boolean; }): PayloadMeta; /** * Check for threshold exceedances and generate warnings. * * Returns an array of warnings. Empty array means all sizes are within limits. */ export declare function checkWarnings(promptMeta: PromptMeta, payloadMeta: PayloadMeta, thresholds?: Partial): PromptWarning[];