import type { ZodError, ZodType } from 'zod'; import type { Message } from '../types.js'; import { type Signal } from '../signal-block.js'; export type SubagentStatus = 'idle' | 'running' | 'succeeded' | 'failed' | 'cancelled'; export declare const STREAM_INCOMPLETE = "stream_incomplete"; export declare function isIncompleteStopReason(stopReason: string | undefined): boolean; export declare function annotateIfIncomplete(content: string, stopReason: string | undefined): string; export declare function incompleteToolResultFields(stopReason: string | undefined): { incomplete?: true; incompleteReason?: string; }; export interface SubagentToolCall { id: string; name: string; inputBytes?: number; } export interface SubagentToolResult { toolUseId: string; isError?: boolean; truncated?: boolean; sizeBytes?: number; } export interface SubagentTrace { toolCalls: SubagentToolCall[]; toolResults: SubagentToolResult[]; thinkingPresent: boolean; turnCount: number; usage?: { inputTokens?: number; outputTokens?: number; cacheReadTokens?: number; cacheCreationTokens?: number; }; } export declare function createEmptyTrace(): SubagentTrace; export interface SubagentResult { id: string; status: SubagentStatus; message?: Message; output?: T; error?: Error; schemaError?: ZodError; partialOutput?: T | string; completionPercent?: number; trace?: SubagentTrace; signal?: Signal; stopReason?: string; } export declare function buildResultFromMessage(id: string, status: SubagentStatus, message: Message, outputSchema: ZodType | undefined, trace?: SubagentTrace, stopReason?: string): SubagentResult; export declare function buildResultFromError(id: string, status: SubagentStatus, err: unknown, trace?: SubagentTrace, stopReason?: string): SubagentResult; export declare function describeFailure(result: Pick): string; export interface SubagentExecutionError extends Error { partialOutput?: unknown; subagentId?: string; } export declare function attachSubagentContext(err: Error, context: { partialOutput?: unknown; subagentId?: string; }): SubagentExecutionError;