import type { Model } from "@earendil-works/pi-ai"; import { type AgentToolResult } from "@earendil-works/pi-coding-agent"; import type { AgentInvocation, IsolationMode, ThinkingLevel } from "../types.js"; import type { Theme } from "../ui/theme.js"; import { Text } from "../ui/tui-shim.js"; import type { ToolContext } from "./context.js"; type AgentResultLike = Pick, "content"> & { details?: unknown; }; type CommonSpawnOptions = { description: string; model: Model | undefined; maxTurns: number | undefined; isolated: boolean; inheritContext: boolean; thinking: ThinkingLevel | undefined; isolation: IsolationMode | undefined; invocation: AgentInvocation; }; /** * Format an agent tool result into a TUI Text block showing status, stats, and optional expanded output. * * @param result - The agent result containing `content` and optional `details` that drive the rendered output. * @param opts - Rendering options: `expanded` shows full (truncated) output lines, `isPartial` treats the result as streaming/partial. * @param theme - Theme used to style status, stats, and message lines. * @returns A `Text` instance containing the composed, styled representation of the agent result for TUI display. */ export declare function renderAgentResult(result: AgentResultLike, opts: { expanded: boolean; isPartial: boolean; }, theme: Theme): Text; /** * Map a CommonSpawnOptions object into the spawn API shape used by agent manager calls. * * @param input - Common spawn configuration (model, limits, isolation and invocation metadata) * @returns An object containing the normalized spawn fields: description, optional model, optional maxTurns, isolation flags, optional thinkingLevel, optional isolation mode, and the invocation metadata */ export declare function buildSpawnOptions(input: CommonSpawnOptions): { description: string; model?: Model; maxTurns?: number; isolated: boolean; inheritContext: boolean; thinkingLevel?: ThinkingLevel; isolation?: IsolationMode; invocation: AgentInvocation; }; /** * Decorates a callbacks object so `afterCreate` is invoked after its existing `onSessionCreated` handler. * * @param target - An object that may have an `onSessionCreated` callback to wrap * @param afterCreate - Callback to run with the session after the original handler (if any) has been called */ export declare function setupSessionCallbacks(target: { onSessionCreated?: (session: any) => void; }, afterCreate: (session: any) => void): void; /** * Register and return the "Agent" tool used to launch and control autonomous subagents. * * The returned tool exposes parameters to configure agent type, prompt, model, thinking level, max turns, background/foreground execution, resuming, isolation, scheduling (when enabled), and estimate-only queries; it renders calls/results with a custom TUI presentation and implements execution paths for estimates, scheduling, resuming, background spawning (with output-file streaming and batching), and foreground streaming with progress updates. * * @returns The tool definition object for the Agent tool, suitable for registration with the tool system. */ export declare function createAgentTool(ctx: ToolContext): import("@earendil-works/pi-coding-agent").ToolDefinition | undefined; prompt: import("@sinclair/typebox").TString; description: import("@sinclair/typebox").TString; subagent_type: import("@sinclair/typebox").TString; model: import("@sinclair/typebox").TOptional; thinking: import("@sinclair/typebox").TOptional; max_turns: import("@sinclair/typebox").TOptional; run_in_background: import("@sinclair/typebox").TOptional; resume: import("@sinclair/typebox").TOptional; isolated: import("@sinclair/typebox").TOptional; inherit_context: import("@sinclair/typebox").TOptional; estimate_only: import("@sinclair/typebox").TOptional; isolation: import("@sinclair/typebox").TOptional>; }>, unknown, any> & import("@earendil-works/pi-coding-agent").ToolDefinition; export {};