/** * Types for the Escalation Pipeline. * * Python parity: praisonaiagents/escalation/types.py. Defines stages, * signals, configs, and results for progressive escalation. */ /** * Escalation stages for progressive execution. * * - Stage 0: Direct response - no tools, no planning, immediate answer * - Stage 1: Heuristic tools - use tools based on local signals, no extra LLM call * - Stage 2: Lightweight plan - single LLM call to create constrained plan * - Stage 3: Full autonomous - tools + subagents + verification + checkpoints * * Python parity: escalation/types.py:12 `EscalationStage(IntEnum)`. */ export declare enum EscalationStage { /** Direct response, no tools. */ DIRECT = 0, /** Heuristic tool selection. */ HEURISTIC = 1, /** Lightweight planning. */ PLANNED = 2, /** Full autonomous loop. */ AUTONOMOUS = 3 } /** The Python `stage.name` of a numeric stage ("DIRECT", ...). */ export declare function stageName(stage: EscalationStage): string; /** * Signals that indicate escalation may be needed. Detected without extra * LLM calls using heuristics. * * Python parity: escalation/types.py:27 `EscalationSignal(Enum)`. */ export declare enum EscalationSignal { /** Word count > threshold. */ LONG_PROMPT = "long_prompt", /** Contains analysis/design/etc keywords. */ COMPLEX_KEYWORDS = "complex_keywords", /** Multiple questions or steps implied. */ MULTI_STEP_INTENT = "multi_step_intent", /** Working in a code repository. */ REPO_CONTEXT = "repo_context", /** References specific files. */ FILE_REFERENCES = "file_references", /** Contains code to analyze/modify. */ CODE_BLOCKS = "code_blocks", /** User wants to modify files. */ EDIT_INTENT = "edit_intent", /** User wants to run tests. */ TEST_INTENT = "test_intent", /** User wants to build/compile. */ BUILD_INTENT = "build_intent", /** User wants to refactor code. */ REFACTOR_INTENT = "refactor_intent", /** Tool call failed. */ TOOL_FAILURE = "tool_failure", /** Result is unclear. */ AMBIGUOUS_RESULT = "ambiguous_result", /** Task not fully completed. */ INCOMPLETE_TASK = "incomplete_task", /** Simple factual question. */ SIMPLE_QUESTION = "simple_question", /** User asking for clarification. */ CLARIFICATION = "clarification", /** User acknowledging/thanking. */ ACKNOWLEDGMENT = "acknowledgment" } /** Constructor options for {@link EscalationConfig} (escalation/types.py:61-94). */ export interface EscalationConfigOptions { /** Words to trigger LONG_PROMPT (default 100). */ longPromptThreshold?: number; /** Keywords to trigger COMPLEX_KEYWORDS (default 2). */ complexKeywordThreshold?: number; /** Maximum steps in autonomous mode (default 20). */ maxSteps?: number; /** Maximum time for task, seconds (default 300). */ maxTimeSeconds?: number; /** Maximum tokens to use (default 100000). */ maxTokens?: number; /** Maximum tool calls (default 50). */ maxToolCalls?: number; /** Max tools in heuristic stage (default 3). */ heuristicMaxTools?: number; /** Max steps in planned stage (default 5). */ plannedMaxSteps?: number; /** Auto-escalate on signals (default true). */ autoEscalate?: boolean; /** Auto-de-escalate when resolved (default true). */ autoDeescalate?: boolean; /** Require approval for file writes (default true). */ requireApprovalForWrites?: boolean; /** Enable checkpoints for undo (default true). */ enableCheckpoints?: boolean; /** Max retries per step (default 3). */ maxRetries?: number; /** Max identical consecutive actions (default 3). */ maxIdenticalActions?: number; /** Backoff multiplier on retry (default 1.5). */ backoffFactor?: number; /** Use model router (default true). */ useRouter?: boolean; /** Try stronger model on failure (default true). */ escalateModelOnFailure?: boolean; } /** * Configuration for the escalation pipeline: thresholds, budgets, behavior. * * Python parity: escalation/types.py:61 `EscalationConfig`. */ export declare class EscalationConfig { longPromptThreshold: number; complexKeywordThreshold: number; maxSteps: number; maxTimeSeconds: number; maxTokens: number; maxToolCalls: number; heuristicMaxTools: number; plannedMaxSteps: number; autoEscalate: boolean; autoDeescalate: boolean; requireApprovalForWrites: boolean; enableCheckpoints: boolean; maxRetries: number; maxIdenticalActions: number; backoffFactor: number; useRouter: boolean; escalateModelOnFailure: boolean; constructor(options?: EscalationConfigOptions); } /** Accept either a built config or its options (TS convenience). */ export declare function toEscalationConfig(config: EscalationConfig | EscalationConfigOptions | null | undefined): EscalationConfig; /** Constructor options for {@link EscalationResult} (escalation/types.py:98-132). */ export interface EscalationResultOptions { response: string; success: boolean; initialStage: EscalationStage; finalStage: EscalationStage; /** (default 0) */ escalations?: number; /** (default 0) */ deescalations?: number; /** Signals detected (default []). */ signals?: EscalationSignal[]; /** (default 0) */ stepsTaken?: number; /** (default 0) */ toolCalls?: number; /** (default 0) */ tokensUsed?: number; /** (default 0.0) */ timeSeconds?: number; /** (default null) */ checkpointId?: string | null; /** (default []) */ filesModified?: string[]; /** (default []) */ errors?: string[]; /** (default []) */ warnings?: string[]; /** (default {}) */ metadata?: Record; } /** * Result of escalation pipeline execution: the response, metadata, and any * state changes. * * Python parity: escalation/types.py:98 `EscalationResult`. */ export declare class EscalationResult { response: string; success: boolean; initialStage: EscalationStage; finalStage: EscalationStage; escalations: number; deescalations: number; signals: EscalationSignal[]; stepsTaken: number; toolCalls: number; tokensUsed: number; timeSeconds: number; checkpointId: string | null; filesModified: string[]; errors: string[]; warnings: string[]; metadata: Record; constructor(options: EscalationResultOptions); /** Python parity: escalation/types.py:135 `was_escalated`. */ get wasEscalated(): boolean; /** Python parity: escalation/types.py:140 `was_deescalated`. */ get wasDeescalated(): boolean; } /** One entry of {@link StageContext.steps} (escalation/types.py:179). */ export interface StageStep { action: string; result: unknown; success: boolean; stage: string; } /** One entry of {@link StageContext.toolResults} (escalation/types.py:188). */ export interface StageToolResult { tool: string; args: Record; result: unknown; success: boolean; } /** Constructor options for {@link StageContext} (escalation/types.py:146-175). */ export interface StageContextOptions { stage: EscalationStage; prompt: string; /** (default empty set) */ signals?: Set | EscalationSignal[]; /** (default []) */ steps?: StageStep[]; /** (default []) */ toolResults?: StageToolResult[]; /** (default "") */ contextSummary?: string; /** (default empty set) */ filesRead?: Set | string[]; /** (default empty set) */ filesModified?: Set | string[]; /** (default 0) */ tokensUsed?: number; /** (default 0) */ toolCalls?: number; /** (default 0.0) */ timeElapsed?: number; /** (default []) */ checkpointIds?: string[]; /** (default null) */ sessionId?: string | null; } /** * Context passed between escalation stages. Maintains state across stage * transitions. * * Python parity: escalation/types.py:146 `StageContext`. */ export declare class StageContext { stage: EscalationStage; prompt: string; signals: Set; steps: StageStep[]; toolResults: StageToolResult[]; contextSummary: string; filesRead: Set; filesModified: Set; tokensUsed: number; toolCalls: number; timeElapsed: number; checkpointIds: string[]; sessionId: string | null; constructor(options: StageContextOptions); /** Python parity: escalation/types.py:177 `add_step(action, result, success=True)`. */ addStep(action: string, result: unknown, success?: boolean): void; /** Python parity: escalation/types.py:186 `add_tool_result(tool, args, result, success=True)`. */ addToolResult(tool: string, args: Record, result: unknown, success?: boolean): void; /** * Check if escalation is needed based on current state. * * Python parity: escalation/types.py:196 `should_escalate(config)`. */ shouldEscalate(config: EscalationConfig): boolean; /** * Check if de-escalation is appropriate. * * Python parity: escalation/types.py:212 `should_deescalate(config)`. */ shouldDeescalate(config: EscalationConfig): boolean; /** Python parity: escalation/types.py:228 `_has_complex_signals`. */ private hasComplexSignals; }