import type { AgentTemplate } from '../templates/types';
import type { FileProcessingState } from './handlers/tool/write-file';
import type { ToolName } from '@levelcode/common/tools/constants';
import type { LevelCodeToolCall } from '@levelcode/common/tools/list';
import type { AgentRuntimeDeps, AgentRuntimeScopedDeps } from '@levelcode/common/types/contracts/agent-runtime';
import type { Logger } from '@levelcode/common/types/contracts/logger';
import type { ToolMessage } from '@levelcode/common/types/messages/levelcode-message';
import type { PrintModeEvent } from '@levelcode/common/types/print-mode';
import type { AgentTemplateType, AgentState, Subgoal } from '@levelcode/common/types/session-state';
import type { CustomToolDefinitions, ProjectFileContext } from '@levelcode/common/util/file';
import type { ToolCallPart, ToolSet } from 'ai';
export type CustomToolCall = {
    toolName: string;
    input: Record<string, unknown>;
} & Omit<ToolCallPart, 'type'>;
export type ToolCallError = {
    toolName?: string;
    input: Record<string, unknown>;
    error: string;
} & Pick<LevelCodeToolCall, 'toolCallId'>;
export declare function parseRawToolCall<T extends ToolName = ToolName>(params: {
    rawToolCall: {
        toolName: T;
        toolCallId: string;
        input: Record<string, unknown>;
    };
}): LevelCodeToolCall<T> | ToolCallError;
export type ExecuteToolCallParams<T extends string = ToolName> = {
    toolName: T;
    input: Record<string, unknown>;
    autoInsertEndStepParam?: boolean;
    excludeToolFromMessageHistory?: boolean;
    agentContext: Record<string, Subgoal>;
    agentState: AgentState;
    agentStepId: string;
    ancestorRunIds: string[];
    agentTemplate: AgentTemplate;
    clientSessionId: string;
    fileContext: ProjectFileContext;
    fileProcessingState: FileProcessingState;
    fingerprintId: string;
    fromHandleSteps?: boolean;
    fullResponse: string;
    localAgentTemplates: Record<string, AgentTemplate>;
    logger: Logger;
    previousToolCallFinished: Promise<void>;
    prompt: string | undefined;
    repoId: string | undefined;
    repoUrl: string | undefined;
    runId: string;
    signal: AbortSignal;
    system: string;
    tools: ToolSet;
    toolCallId: string | undefined;
    toolCalls: (LevelCodeToolCall | CustomToolCall)[];
    toolResults: ToolMessage[];
    toolResultsToAddAfterStream: ToolMessage[];
    skipDirectResultPush?: boolean;
    userId: string | undefined;
    userInputId: string;
    fetch: typeof globalThis.fetch;
    onCostCalculated: (credits: number) => Promise<void>;
    onResponseChunk: (chunk: string | PrintModeEvent) => void;
} & AgentRuntimeDeps & AgentRuntimeScopedDeps;
export declare function executeToolCall<T extends ToolName>(params: ExecuteToolCallParams<T>): Promise<void>;
export declare function parseRawCustomToolCall(params: {
    customToolDefs: CustomToolDefinitions;
    rawToolCall: {
        toolName: string;
        toolCallId: string;
        input: Record<string, unknown>;
    };
    autoInsertEndStepParam?: boolean;
}): CustomToolCall | ToolCallError;
export declare function executeCustomToolCall(params: ExecuteToolCallParams<string>): Promise<void>;
/**
 * Checks if a tool name matches a spawnable agent and returns the transformed
 * spawn_agents input if so. Returns null if not an agent tool call.
 */
export declare function tryTransformAgentToolCall(params: {
    toolName: string;
    input: Record<string, unknown>;
    spawnableAgents: AgentTemplateType[];
}): {
    toolName: 'spawn_agents';
    input: Record<string, unknown>;
} | null;
