import type { NestedToolCallRecord, NestedToolCalls, Usage } from "@bastani/pi-ai"; import type { AgentToolCall, AgentToolCallOutcome, AgentToolResult, AgentToolUpdateCallback } from "@earendil-works/pi-agent-core"; export declare const NESTED_CALL_LIMITS: { readonly maxCalls: 256; readonly maxArgumentBytesPerCall: number; readonly maxArgumentBytesTotal: number; readonly maxErrorChars: 500; }; export interface NestedCallSummary { calls: NestedToolCalls | undefined; usage: Usage | undefined; } /** Bounded session record. Tool output is deliberately not retained. */ export declare class NestedCallRecorder { private calls; private startedAt; private complete; private argumentBytes; private usage; start(toolCall: AgentToolCall): NestedToolCallRecord | undefined; finish(record: NestedToolCallRecord | undefined, isError: boolean, errorText: string): void; addUsage(usage: Usage): void; get totalUsage(): Usage | undefined; snapshot(): NestedToolCalls | undefined; } export interface NestedToolCallOptions { signal?: AbortSignal; onUpdate?: AgentToolUpdateCallback; } export type NestedToolExecutionEvent = { type: "tool_execution_start"; toolCallId: string; toolName: string; args: unknown; parentToolCallId: string; } | { type: "tool_execution_update"; toolCallId: string; toolName: string; args: unknown; partialResult: AgentToolResult; parentToolCallId: string; } | { type: "tool_execution_end"; toolCallId: string; toolName: string; result: AgentToolResult; isError: boolean; durationMs?: number; parentToolCallId: string; }; export interface NestedToolCallHost { runToolCall(toolCall: AgentToolCall, parentToolCallId: string, signal: AbortSignal | undefined, onUpdate: (partialResult: AgentToolResult) => Promise): Promise; emit(event: NestedToolExecutionEvent): Promise; } /** Nested execution retains Atomic's session scheduler rather than maintaining a competing lock. */ export declare class NestedToolCallRunner { private scopes; private host; constructor(host: NestedToolCallHost); execute(callerId: string, name: string, args: unknown, options?: NestedToolCallOptions): Promise; takeRecord(toolCallId: string): NestedCallSummary | undefined; clear(): void; } //# sourceMappingURL=nested-tool-calls.d.ts.map