import { type ModelMessage, type LanguageModel, type PrepareStepFunction, type StepResult, type StopCondition, type UIMessageStreamWriter, type Tool, type ToolSet } from "ai"; import type { BudgetTracker } from "../utils/budget-tracking"; import { z } from "zod"; export interface TaskOutput { result: string; usage?: { input_tokens: number; output_tokens: number; }; duration_ms?: number; subagent?: string; description?: string; } export interface TaskError { error: string; subagent?: string; description?: string; duration_ms?: number; } declare const taskInputSchema: z.ZodObject<{ description: z.ZodString; prompt: z.ZodString; subagent_type: z.ZodString; system_prompt: z.ZodDefault>; tools: z.ZodDefault>>; }, z.core.$strip>; type TaskInput = z.infer; /** Event emitted for each step a subagent takes */ export interface SubagentStepEvent { subagentType: string; description: string; step: StepResult; } /** Data format for streamed subagent events (appears in message.parts as type: "data-subagent") */ export interface SubagentEventData { event: "start" | "tool-call" | "done" | "complete"; subagent: string; description: string; toolName?: string; args?: Record; messages?: ModelMessage[]; } export interface SubagentTypeConfig { /** Model to use for this subagent type */ model?: LanguageModel; /** System prompt for this subagent type */ systemPrompt?: string; /** Tool names this subagent can use (filters from parent tools) */ tools?: string[]; /** Additional tools only this subagent can use (merged with filtered tools) */ additionalTools?: ToolSet; /** Stop condition(s) for this subagent (default: stepCountIs(15)). Can be a single condition or array - stops when ANY condition is met. */ stopWhen?: StopCondition | StopCondition[]; /** Prepare step callback for dynamic control per step */ prepareStep?: PrepareStepFunction; /** Callback for each step this subagent takes */ onStepFinish?: (step: StepResult) => void | Promise; } export interface TaskToolConfig { /** Default model for subagents */ model: LanguageModel; /** All available tools that subagents can use */ tools: ToolSet; /** Configuration for each subagent type */ subagentTypes?: Record; /** Default stop condition(s) for subagents (default: stepCountIs(15)). Can be a single condition or array - stops when ANY condition is met. */ defaultStopWhen?: StopCondition | StopCondition[]; /** Default callback for each step any subagent takes */ defaultOnStepFinish?: (event: SubagentStepEvent) => void | Promise; /** Optional stream writer for real-time subagent activity (uses streamText instead of generateText) */ streamWriter?: UIMessageStreamWriter; /** Budget tracker — auto-wires stopWhen and onStepFinish for sub-agent cost tracking */ budget?: BudgetTracker; } export declare function createTaskTool(config: TaskToolConfig): Tool; export {};