/** * Tool Result Delegator * * Intercepts large tool results via the AfterToolHook mechanism, * stores the full result for optional recall, and replaces it * with a compact summary to conserve context tokens. */ import type { LLMProvider } from '../providers/types.js'; import type { AfterToolHook } from '../hooks/types.js'; import type { DelegationConfig, DelegationEvent } from './delegation-types.js'; import { DelegatedResultStore } from './delegated-result-store.js'; /** * Options for creating a ToolResultDelegator. */ export interface ToolResultDelegatorOptions { /** LLM provider for summarization (small/medium tier preferred) */ provider: LLMProvider; /** Delegation configuration (merged with defaults) */ config?: Partial; /** Event callback for delegation lifecycle events */ onEvent?: (event: DelegationEvent) => void; } /** * Core class that creates an AfterToolHook for auto-delegating large tool results. */ export declare class ToolResultDelegator { private readonly store; private readonly config; private readonly provider; private readonly onEvent?; constructor(options: ToolResultDelegatorOptions); /** * Returns an AfterToolHook to register with HooksManager. */ createHook(): AfterToolHook; /** * Perform the actual delegation (async path). */ private delegateResult; /** * Access the store (needed by recall_full_result tool). */ getStore(): DelegatedResultStore; /** * Get the resolved config for a specific tool. */ private getToolConfig; /** * Extractive summarization: first/last lines + prioritized structural markers. * No LLM cost, fast, preserves actual code signatures. */ private summarizeExtractive; /** * LLM-based summarization using the provider. * Returns null if the LLM call fails. */ private summarizeLLM; } /** * System prompt addition when delegation is enabled. * Append to the agent's system prompt. */ export declare const DELEGATION_SYSTEM_PROMPT: string;