// Generated by dts-bundle-generator v9.5.1

import { Language, Parser, Query } from 'web-tree-sitter';
import { WebSocket as WebSocket$1 } from 'ws';
import { z } from 'zod/v4';
import { JSONSchema } from 'zod/v4/core';

export type JSONValue = null | string | number | boolean | JSONObject | JSONArray;
export declare const jsonValueSchema: z.ZodType<JSONValue>;
export declare const jsonObjectSchema: z.ZodType<JSONObject>;
export type JSONObject = {
	[key in string]: JSONValue;
};
export declare const jsonArraySchema: z.ZodType<JSONArray>;
export type JSONArray = JSONValue[];
declare const toolCallPartSchema: z.ZodObject<{
	type: z.ZodLiteral<"tool-call">;
	toolCallId: z.ZodString;
	toolName: z.ZodString;
	input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
	providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
	providerExecuted: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>;
type ToolCallPart = z.infer<typeof toolCallPartSchema>;
declare const toolResultOutputSchema: z.ZodDiscriminatedUnion<[
	z.ZodObject<{
		type: z.ZodLiteral<"json">;
		value: z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"media">;
		data: z.ZodString;
		mediaType: z.ZodString;
	}, z.core.$strip>
]>;
type ToolResultOutput = z.infer<typeof toolResultOutputSchema>;
declare const toolResultPartSchema: z.ZodObject<{
	type: z.ZodLiteral<"tool-result">;
	toolCallId: z.ZodString;
	toolName: z.ZodString;
	output: z.ZodArray<z.ZodDiscriminatedUnion<[
		z.ZodObject<{
			type: z.ZodLiteral<"json">;
			value: z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>;
		}, z.core.$strip>,
		z.ZodObject<{
			type: z.ZodLiteral<"media">;
			data: z.ZodString;
			mediaType: z.ZodString;
		}, z.core.$strip>
	]>>;
	providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
}, z.core.$strip>;
type ToolResultPart = z.infer<typeof toolResultPartSchema>;
declare const toolNames: readonly [
	"add_subgoal",
	"add_message",
	"browser_logs",
	"code_search",
	"create_plan",
	"end_turn",
	"find_files",
	"lookup_agent_info",
	"read_docs",
	"read_files",
	"run_file_change_hooks",
	"run_terminal_command",
	"set_messages",
	"set_output",
	"spawn_agents",
	"spawn_agents_async",
	"spawn_agent_inline",
	"str_replace",
	"think_deeply",
	"update_subgoal",
	"web_search",
	"write_file"
];
declare const publishedTools: readonly [
	"add_message",
	"code_search",
	"end_turn",
	"find_files",
	"lookup_agent_info",
	"read_docs",
	"read_files",
	"run_file_change_hooks",
	"run_terminal_command",
	"set_messages",
	"set_output",
	"spawn_agents",
	"str_replace",
	"think_deeply",
	"web_search",
	"write_file"
];
type ToolName = (typeof toolNames)[number];
type PublishedToolName = (typeof publishedTools)[number];
export type CustomToolDefinition<N extends string = string, Args extends any = any, Input extends any = any> = {
	toolName: N;
	zodSchema: z.ZodType<Args, Input>;
	inputJsonSchema: JSONSchema.BaseSchema;
	description: string;
	endsAgentStep: boolean;
	exampleInputs: Input[];
	execute: (params: Args) => Promise<ToolResultOutput[]>;
};
/**
 * Creates a CustomToolDefinition object
 *
 * @param toolName the name of the tool
 * @param inputSchema a Zod4 schema describing the input of the tool.
 * @param description a description of the tool to be passed to the LLM. This should describe what the tool does and when to use it.
 * @param endsAgentStep whether the tool ends the agent step. If `true`, this will be used as a "stop sequence" for the LLM. i.e. it will not be able to call any other tools after this one in a single step and must wait for the tool results. Used for tools that give more information to the LLM.
 * @param exampleInputs an array of example inputs for the tool.
 * @param execute what to do when the tool is called. Can be either a sync or async. Must return an array of {@linkcode ToolResultOutput}
 * @returns a {@linkcode CustomToolDefinition} object
 */
export declare function getCustomToolDefinition<TN extends string, Args extends any, Input extends any>({ toolName, inputSchema, description, endsAgentStep, exampleInputs, execute, }: {
	toolName: TN extends ToolName ? TN & {
		error: `Hi there. This is a message from the Codebuff team: You have used a custom tool where you needed to use overrideTools instead for name: ${TN}`;
	} : TN;
	inputSchema: z.ZodType<Args, Input>;
	description: string;
	endsAgentStep?: boolean;
	exampleInputs?: Input[];
	execute: (params: Args) => Promise<ToolResultOutput[]> | ToolResultOutput[];
}): CustomToolDefinition<TN, Args, Input>;
type ToolName$1 = "add_message" | "code_search" | "end_turn" | "find_files" | "lookup_agent_info" | "read_docs" | "read_files" | "run_file_change_hooks" | "run_terminal_command" | "set_messages" | "set_output" | "spawn_agents" | "str_replace" | "think_deeply" | "web_search" | "write_file";
interface ToolParamsMap {
	add_message: AddMessageParams;
	code_search: CodeSearchParams;
	end_turn: EndTurnParams;
	find_files: FindFilesParams;
	lookup_agent_info: LookupAgentInfoParams;
	read_docs: ReadDocsParams;
	read_files: ReadFilesParams;
	run_file_change_hooks: RunFileChangeHooksParams;
	run_terminal_command: RunTerminalCommandParams;
	set_messages: SetMessagesParams;
	set_output: SetOutputParams;
	spawn_agents: SpawnAgentsParams;
	str_replace: StrReplaceParams;
	think_deeply: ThinkDeeplyParams;
	web_search: WebSearchParams;
	write_file: WriteFileParams;
}
interface AddMessageParams {
	role: "user" | "assistant";
	content: string;
}
interface CodeSearchParams {
	/** The pattern to search for. */
	pattern: string;
	/** Optional ripgrep flags to customize the search (e.g., "-i" for case-insensitive, "-t ts" for TypeScript files only, "-A 3" for 3 lines after match, "-B 2" for 2 lines before match, "--type-not test" to exclude test files). */
	flags?: string;
	/** Optional working directory to search within, relative to the project root. Defaults to searching the entire project. */
	cwd?: string;
	/** Maximum number of results to return. Defaults to 30. */
	maxResults?: number;
}
interface EndTurnParams {
}
interface FindFilesParams {
	/** A brief natural language description of the files or the name of a function or class you are looking for. It's also helpful to mention a directory or two to look within. */
	prompt: string;
}
interface LookupAgentInfoParams {
	/** Agent ID (short local or full published format) */
	agentId: string;
}
interface ReadDocsParams {
	/** The library or framework name (e.g., "Next.js", "MongoDB", "React"). Use the official name as it appears in documentation if possible. Only public libraries available in Context7's database are supported, so small or private libraries may not be available. */
	libraryTitle: string;
	/** Specific topic to focus on (e.g., "routing", "hooks", "authentication") */
	topic: string;
	/** Optional maximum number of tokens to return. Defaults to 20000. Values less than 10000 are automatically increased to 10000. */
	max_tokens?: number;
}
interface ReadFilesParams {
	/** List of file paths to read. */
	paths: string[];
}
interface RunFileChangeHooksParams {
	/** List of file paths that were changed and should trigger file change hooks */
	files: string[];
}
interface RunTerminalCommandParams {
	/** CLI command valid for user's OS. */
	command: string;
	/** Either SYNC (waits, returns output) or BACKGROUND (runs in background). Default SYNC */
	process_type?: "SYNC" | "BACKGROUND";
	/** The working directory to run the command in. Default is the project root. */
	cwd?: string;
	/** Set to -1 for no timeout. Does not apply for BACKGROUND commands. Default 30 */
	timeout_seconds?: number;
}
interface SetMessagesParams {
	messages: any;
}
interface SetOutputParams {
}
interface SpawnAgentsParams {
	agents: {
		/** Agent to spawn */
		agent_type: string;
		/** Prompt to send to the agent */
		prompt?: string;
		/** Parameters object for the agent (if any) */
		params?: Record<string, any>;
	}[];
}
interface StrReplaceParams {
	/** The path to the file to edit. */
	path: string;
	/** Array of replacements to make. */
	replacements: {
		/** The string to replace. This must be an *exact match* of the string you want to replace, including whitespace and punctuation. */
		old: string;
		/** The string to replace the corresponding old string with. Can be empty to delete. */
		new: string;
		/** Whether to allow multiple replacements of old string. */
		allowMultiple?: boolean;
	}[];
}
interface ThinkDeeplyParams {
	/** Detailed step-by-step analysis. Initially keep each step concise (max ~5-7 words per step). */
	thought: string;
}
interface WebSearchParams {
	/** The search query to find relevant web content */
	query: string;
	/** Search depth - 'standard' for quick results, 'deep' for more comprehensive search. Default is 'standard'. */
	depth?: "standard" | "deep";
}
interface WriteFileParams {
	/** Path to the file relative to the **project root** */
	path: string;
	/** What the change is intended to do in only one sentence. */
	instructions: string;
	/** Edit snippet to apply to the file. */
	content: string;
}
type GetToolParams<T extends ToolName$1> = ToolParamsMap[T];
type JSONValue$1 = null | string | number | boolean | JSONObject$1 | JSONArray$1;
type JSONObject$1 = {
	[key: string]: JSONValue$1;
};
type JSONArray$1 = JSONValue$1[];
type JsonSchema = {
	type?: "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
	description?: string;
	properties?: Record<string, JsonSchema | boolean>;
	required?: string[];
	enum?: Array<string | number | boolean | null>;
	[k: string]: unknown;
};
type JsonObjectSchema = JsonSchema & {
	type: "object";
};
declare const toolResultOutputSchema$1: z.ZodDiscriminatedUnion<[
	z.ZodObject<{
		type: z.ZodLiteral<"json">;
		value: z.ZodType<JSONValue$1, unknown, z.core.$ZodTypeInternals<JSONValue$1, unknown>>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"media">;
		data: z.ZodString;
		mediaType: z.ZodString;
	}, z.core.$strip>
]>;
type ToolResultOutput$1 = z.infer<typeof toolResultOutputSchema$1>;
declare const messageSchema: z.ZodIntersection<z.ZodUnion<readonly [
	z.ZodIntersection<z.ZodObject<{
		role: z.ZodLiteral<"system">;
		content: z.ZodString;
	}, z.core.$strip>, z.ZodObject<{
		providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue$1, unknown, z.core.$ZodTypeInternals<JSONValue$1, unknown>>>>>;
		timeToLive: z.ZodOptional<z.ZodUnion<readonly [
			z.ZodLiteral<"agentStep">,
			z.ZodLiteral<"userPrompt">
		]>>;
		keepDuringTruncation: z.ZodOptional<z.ZodBoolean>;
	}, z.core.$strip>>,
	z.ZodIntersection<z.ZodObject<{
		role: z.ZodLiteral<"user">;
		content: z.ZodUnion<readonly [
			z.ZodString,
			z.ZodArray<z.ZodUnion<readonly [
				z.ZodObject<{
					type: z.ZodLiteral<"text">;
					text: z.ZodString;
					providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue$1, unknown, z.core.$ZodTypeInternals<JSONValue$1, unknown>>>>>;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"image">;
					image: z.ZodUnion<readonly [
						z.ZodUnion<readonly [
							z.ZodString,
							z.ZodCustom<Uint8Array, Uint8Array>,
							z.ZodCustom<ArrayBuffer, ArrayBuffer>,
							z.ZodCustom<Buffer, Buffer>
						]>,
						z.ZodCustom<URL, URL>
					]>;
					mediaType: z.ZodOptional<z.ZodString>;
					providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue$1, unknown, z.core.$ZodTypeInternals<JSONValue$1, unknown>>>>>;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"file">;
					data: z.ZodUnion<readonly [
						z.ZodUnion<readonly [
							z.ZodString,
							z.ZodCustom<Uint8Array, Uint8Array>,
							z.ZodCustom<ArrayBuffer, ArrayBuffer>,
							z.ZodCustom<Buffer, Buffer>
						]>,
						z.ZodCustom<URL, URL>
					]>;
					filename: z.ZodOptional<z.ZodString>;
					mediaType: z.ZodString;
					providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue$1, unknown, z.core.$ZodTypeInternals<JSONValue$1, unknown>>>>>;
				}, z.core.$strip>
			]>>
		]>;
	}, z.core.$strip>, z.ZodObject<{
		providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue$1, unknown, z.core.$ZodTypeInternals<JSONValue$1, unknown>>>>>;
		timeToLive: z.ZodOptional<z.ZodUnion<readonly [
			z.ZodLiteral<"agentStep">,
			z.ZodLiteral<"userPrompt">
		]>>;
		keepDuringTruncation: z.ZodOptional<z.ZodBoolean>;
	}, z.core.$strip>>,
	z.ZodIntersection<z.ZodObject<{
		role: z.ZodLiteral<"assistant">;
		content: z.ZodUnion<readonly [
			z.ZodString,
			z.ZodArray<z.ZodUnion<readonly [
				z.ZodObject<{
					type: z.ZodLiteral<"text">;
					text: z.ZodString;
					providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue$1, unknown, z.core.$ZodTypeInternals<JSONValue$1, unknown>>>>>;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"reasoning">;
					text: z.ZodString;
					providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue$1, unknown, z.core.$ZodTypeInternals<JSONValue$1, unknown>>>>>;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"tool-call">;
					toolCallId: z.ZodString;
					toolName: z.ZodString;
					input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
					providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue$1, unknown, z.core.$ZodTypeInternals<JSONValue$1, unknown>>>>>;
					providerExecuted: z.ZodOptional<z.ZodBoolean>;
				}, z.core.$strip>
			]>>
		]>;
	}, z.core.$strip>, z.ZodObject<{
		providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue$1, unknown, z.core.$ZodTypeInternals<JSONValue$1, unknown>>>>>;
		timeToLive: z.ZodOptional<z.ZodUnion<readonly [
			z.ZodLiteral<"agentStep">,
			z.ZodLiteral<"userPrompt">
		]>>;
		keepDuringTruncation: z.ZodOptional<z.ZodBoolean>;
	}, z.core.$strip>>,
	z.ZodIntersection<z.ZodObject<{
		role: z.ZodLiteral<"tool">;
		content: z.ZodObject<{
			type: z.ZodLiteral<"tool-result">;
			toolCallId: z.ZodString;
			toolName: z.ZodString;
			output: z.ZodArray<z.ZodDiscriminatedUnion<[
				z.ZodObject<{
					type: z.ZodLiteral<"json">;
					value: z.ZodType<JSONValue$1, unknown, z.core.$ZodTypeInternals<JSONValue$1, unknown>>;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"media">;
					data: z.ZodString;
					mediaType: z.ZodString;
				}, z.core.$strip>
			]>>;
			providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue$1, unknown, z.core.$ZodTypeInternals<JSONValue$1, unknown>>>>>;
		}, z.core.$strip>;
	}, z.core.$strip>, z.ZodObject<{
		providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue$1, unknown, z.core.$ZodTypeInternals<JSONValue$1, unknown>>>>>;
		timeToLive: z.ZodOptional<z.ZodUnion<readonly [
			z.ZodLiteral<"agentStep">,
			z.ZodLiteral<"userPrompt">
		]>>;
		keepDuringTruncation: z.ZodOptional<z.ZodBoolean>;
	}, z.core.$strip>>
]>, z.ZodObject<{
	providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue$1, unknown, z.core.$ZodTypeInternals<JSONValue$1, unknown>>>>>;
	timeToLive: z.ZodOptional<z.ZodUnion<readonly [
		z.ZodLiteral<"agentStep">,
		z.ZodLiteral<"userPrompt">
	]>>;
	keepDuringTruncation: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>>;
type Message = z.infer<typeof messageSchema>;
declare const mcpConfigSchema: z.ZodUnion<readonly [
	z.ZodObject<{
		type: z.ZodDefault<z.ZodEnum<{
			http: "http";
			sse: "sse";
		}>>;
		url: z.ZodString;
		params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
	}, z.core.$strict>,
	z.ZodObject<{
		type: z.ZodDefault<z.ZodLiteral<"stdio">>;
		command: z.ZodString;
		args: z.ZodDefault<z.ZodArray<z.ZodString>>;
		env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
		headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
	}, z.core.$strict>
]>;
type MCPConfig = z.input<typeof mcpConfigSchema>;
interface Logger {
	debug: (data: any, msg?: string) => void;
	info: (data: any, msg?: string) => void;
	warn: (data: any, msg?: string) => void;
	error: (data: any, msg?: string) => void;
}
/**
 * Codebuff Agent Type Definitions
 *
 * This file provides TypeScript type definitions for creating custom Codebuff agents.
 * Import these types in your agent files to get full type safety and IntelliSense.
 *
 * Usage in .agents/your-agent.ts:
 *   import { AgentDefinition, ToolName, ModelName } from './types/agent-definition'
 *
 *   const definition: AgentDefinition = {
 *     // ... your agent configuration with full type safety ...
 *   }
 *
 *   export default definition
 */
export interface AgentDefinition {
	/** Unique identifier for this agent. Must contain only lowercase letters, numbers, and hyphens, e.g. 'code-reviewer' */
	id: string;
	/** Version string (if not provided, will default to '0.0.1' and be bumped on each publish) */
	version?: string;
	/** Publisher ID for the agent. Must be provided if you want to publish the agent. */
	publisher?: string;
	/** Human-readable name for the agent */
	displayName: string;
	/** AI model to use for this agent. Can be any model in OpenRouter: https://openrouter.ai/models */
	model: ModelName;
	/**
	 * https://openrouter.ai/docs/use-cases/reasoning-tokens
	 * One of `max_tokens` or `effort` is required.
	 * If `exclude` is true, reasoning will be removed from the response. Default is false.
	 */
	reasoningOptions?: {
		enabled?: boolean;
		exclude?: boolean;
	} & ({
		max_tokens: number;
	} | {
		effort: "high" | "medium" | "low";
	});
	/** MCP servers by name. Names cannot contain `/`. */
	mcpServers?: Record<string, MCPConfig>;
	/**
	 * Tools this agent can use.
	 *
	 * By default, all tools are available from any specified MCP server. In
	 * order to limit the tools from a specific MCP server, add the tool name(s)
	 * in the format `'mcpServerName/toolName1'`, `'mcpServerName/toolName2'`,
	 * etc.
	 */
	toolNames?: (ToolName$2 | (string & {}))[];
	/** Other agents this agent can spawn, like 'codebuff/file-picker@0.0.1'.
	 *
	 * Use the fully qualified agent id from the agent store, including publisher and version: 'codebuff/file-picker@0.0.1'
	 * (publisher and version are required!)
	 *
	 * Or, use the agent id from a local agent file in your .agents directory: 'file-picker'.
	 */
	spawnableAgents?: string[];
	/** The input schema required to spawn the agent. Provide a prompt string and/or a params object or none.
	 * 80% of the time you want just a prompt string with a description:
	 * inputSchema: {
	 *   prompt: { type: 'string', description: 'A description of what info would be helpful to the agent' }
	 * }
	 */
	inputSchema?: {
		prompt?: {
			type: "string";
			description?: string;
		};
		params?: JsonObjectSchema;
	};
	/** Whether to include conversation history from the parent agent in context.
	 *
	 * Defaults to false.
	 * Use this if the agent needs to know all the previous messages in the conversation.
	 */
	includeMessageHistory?: boolean;
	/** How the agent should output a response to its parent (defaults to 'last_message')
	 *
	 * last_message: The last message from the agent, typically after using tools.
	 *
	 * all_messages: All messages from the agent, including tool calls and results.
	 *
	 * structured_output: Make the agent output a JSON object. Can be used with outputSchema or without if you want freeform json output.
	 */
	outputMode?: "last_message" | "all_messages" | "structured_output";
	/** JSON schema for structured output (when outputMode is 'structured_output') */
	outputSchema?: JsonObjectSchema;
	/** Prompt for when and why to spawn this agent. Include the main purpose and use cases.
	 *
	 * This field is key if the agent is intended to be spawned by other agents. */
	spawnerPrompt?: string;
	/** Background information for the agent. Fairly optional. Prefer using instructionsPrompt for agent instructions. */
	systemPrompt?: string;
	/** Instructions for the agent.
	 *
	 * IMPORTANT: Updating this prompt is the best way to shape the agent's behavior.
	 * This prompt is inserted after each user input. */
	instructionsPrompt?: string;
	/** Prompt inserted at each agent step.
	 *
	 * Powerful for changing the agent's behavior, but usually not necessary for smart models.
	 * Prefer instructionsPrompt for most instructions. */
	stepPrompt?: string;
	/** Programmatically step the agent forward and run tools.
	 *
	 * You can either yield:
	 * - A tool call object with toolName and input properties.
	 * - 'STEP' to run agent's model and generate one assistant message.
	 * - 'STEP_ALL' to run the agent's model until it uses the end_turn tool or stops includes no tool calls in a message.
	 *
	 * Or use 'return' to end the turn.
	 *
	 * Example 1:
	 * function* handleSteps({ agentState, prompt, params, logger }) {
	 *   logger.info('Starting file read process')
	 *   const { toolResult } = yield {
	 *     toolName: 'read_files',
	 *     input: { paths: ['file1.txt', 'file2.txt'] }
	 *   }
	 *   yield 'STEP_ALL'
	 *
	 *   // Optionally do a post-processing step here...
	 *   logger.info('Files read successfully, setting output')
	 *   yield {
	 *     toolName: 'set_output',
	 *     input: {
	 *       output: 'The files were read successfully.',
	 *     },
	 *   }
	 * }
	 *
	 * Example 2:
	 * handleSteps: function* ({ agentState, prompt, params, logger }) {
	 *   while (true) {
	 *     logger.debug('Spawning thinker agent')
	 *     yield {
	 *       toolName: 'spawn_agents',
	 *       input: {
	 *         agents: [
	 *         {
	 *           agent_type: 'thinker',
	 *           prompt: 'Think deeply about the user request',
	 *         },
	 *       ],
	 *     },
	 *   }
	 *   const { stepsComplete } = yield 'STEP'
	 *   if (stepsComplete) break
	 * }
	 * }
	 */
	handleSteps?: (context: AgentStepContext) => Generator<ToolCall | "STEP" | "STEP_ALL", void, {
		agentState: AgentState;
		toolResult: ToolResultOutput$1[] | undefined;
		stepsComplete: boolean;
	}>;
}
interface AgentState {
	agentId: string;
	runId: string;
	parentId: string | undefined;
	/** The agent's conversation history: messages from the user and the assistant. */
	messageHistory: Message[];
	/** The last value set by the set_output tool. This is a plain object or undefined if not set. */
	output: Record<string, any> | undefined;
}
interface AgentStepContext {
	agentState: AgentState;
	prompt?: string;
	params?: Record<string, any>;
	logger: Logger;
}
type ToolCall<T extends ToolName$2 = ToolName$2> = {
	[K in T]: {
		toolName: K;
		input: Tools.GetToolParams<K>;
		includeToolCall?: boolean;
	};
}[T];
type ModelName = "openai/gpt-5" | "openai/gpt-5-chat" | "openai/gpt-5-mini" | "openai/gpt-5-nano" | "anthropic/claude-sonnet-4" | "anthropic/claude-opus-4.1" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-preview-09-2025" | "google/gemini-2.5-flash-lite-preview-09-2025" | "x-ai/grok-4-07-09" | "x-ai/grok-4-fast:free" | "x-ai/grok-code-fast-1" | "qwen/qwen3-max" | "qwen/qwen3-coder-plus" | "qwen/qwen3-coder" | "qwen/qwen3-coder:nitro" | "qwen/qwen3-coder-flash" | "qwen/qwen3-235b-a22b-2507" | "qwen/qwen3-235b-a22b-2507:nitro" | "qwen/qwen3-235b-a22b-thinking-2507" | "qwen/qwen3-235b-a22b-thinking-2507:nitro" | "qwen/qwen3-30b-a3b" | "qwen/qwen3-30b-a3b:nitro" | "deepseek/deepseek-chat-v3-0324" | "deepseek/deepseek-chat-v3-0324:nitro" | "deepseek/deepseek-r1-0528" | "deepseek/deepseek-r1-0528:nitro" | "moonshotai/kimi-k2" | "moonshotai/kimi-k2:nitro" | "z-ai/glm-4.5" | "z-ai/glm-4.5:nitro" | (string & {});
type ToolName$2 = Tools.ToolName;
export declare const systemMessageSchema: z.ZodIntersection<z.ZodObject<{
	role: z.ZodLiteral<"system">;
	content: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
	providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
	timeToLive: z.ZodOptional<z.ZodUnion<readonly [
		z.ZodLiteral<"agentStep">,
		z.ZodLiteral<"userPrompt">
	]>>;
	keepDuringTruncation: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>>;
export type SystemMessage = z.infer<typeof systemMessageSchema>;
export declare const userMessageSchema: z.ZodIntersection<z.ZodObject<{
	role: z.ZodLiteral<"user">;
	content: z.ZodUnion<readonly [
		z.ZodString,
		z.ZodArray<z.ZodDiscriminatedUnion<[
			z.ZodObject<{
				type: z.ZodLiteral<"text">;
				text: z.ZodString;
				providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
			}, z.core.$strip>,
			z.ZodObject<{
				type: z.ZodLiteral<"image">;
				image: z.ZodUnion<readonly [
					z.ZodUnion<readonly [
						z.ZodString,
						z.ZodCustom<Uint8Array, Uint8Array>,
						z.ZodCustom<ArrayBuffer, ArrayBuffer>,
						z.ZodCustom<Buffer, Buffer>
					]>,
					z.ZodCustom<URL, URL>
				]>;
				mediaType: z.ZodOptional<z.ZodString>;
				providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
			}, z.core.$strip>,
			z.ZodObject<{
				type: z.ZodLiteral<"file">;
				data: z.ZodUnion<readonly [
					z.ZodUnion<readonly [
						z.ZodString,
						z.ZodCustom<Uint8Array, Uint8Array>,
						z.ZodCustom<ArrayBuffer, ArrayBuffer>,
						z.ZodCustom<Buffer, Buffer>
					]>,
					z.ZodCustom<URL, URL>
				]>;
				filename: z.ZodOptional<z.ZodString>;
				mediaType: z.ZodString;
				providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
			}, z.core.$strip>
		]>>
	]>;
}, z.core.$strip>, z.ZodObject<{
	providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
	timeToLive: z.ZodOptional<z.ZodUnion<readonly [
		z.ZodLiteral<"agentStep">,
		z.ZodLiteral<"userPrompt">
	]>>;
	keepDuringTruncation: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>>;
export type UserMessage = z.infer<typeof userMessageSchema>;
export declare const assistantMessageSchema: z.ZodIntersection<z.ZodObject<{
	role: z.ZodLiteral<"assistant">;
	content: z.ZodUnion<readonly [
		z.ZodString,
		z.ZodArray<z.ZodDiscriminatedUnion<[
			z.ZodObject<{
				type: z.ZodLiteral<"text">;
				text: z.ZodString;
				providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
			}, z.core.$strip>,
			z.ZodObject<{
				type: z.ZodLiteral<"reasoning">;
				text: z.ZodString;
				providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
			}, z.core.$strip>,
			z.ZodObject<{
				type: z.ZodLiteral<"tool-call">;
				toolCallId: z.ZodString;
				toolName: z.ZodString;
				input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
				providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
				providerExecuted: z.ZodOptional<z.ZodBoolean>;
			}, z.core.$strip>
		]>>
	]>;
}, z.core.$strip>, z.ZodObject<{
	providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
	timeToLive: z.ZodOptional<z.ZodUnion<readonly [
		z.ZodLiteral<"agentStep">,
		z.ZodLiteral<"userPrompt">
	]>>;
	keepDuringTruncation: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>>;
export type AssistantMessage = z.infer<typeof assistantMessageSchema>;
export declare const toolMessageSchema: z.ZodIntersection<z.ZodObject<{
	role: z.ZodLiteral<"tool">;
	content: z.ZodObject<{
		type: z.ZodLiteral<"tool-result">;
		toolCallId: z.ZodString;
		toolName: z.ZodString;
		output: z.ZodArray<z.ZodDiscriminatedUnion<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>;
			}, z.core.$strip>,
			z.ZodObject<{
				type: z.ZodLiteral<"media">;
				data: z.ZodString;
				mediaType: z.ZodString;
			}, z.core.$strip>
		]>>;
		providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
	}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
	providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
	timeToLive: z.ZodOptional<z.ZodUnion<readonly [
		z.ZodLiteral<"agentStep">,
		z.ZodLiteral<"userPrompt">
	]>>;
	keepDuringTruncation: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>>;
export type ToolMessage = z.infer<typeof toolMessageSchema>;
declare const messageSchema$1: z.ZodIntersection<z.ZodUnion<readonly [
	z.ZodIntersection<z.ZodObject<{
		role: z.ZodLiteral<"system">;
		content: z.ZodString;
	}, z.core.$strip>, z.ZodObject<{
		providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
		timeToLive: z.ZodOptional<z.ZodUnion<readonly [
			z.ZodLiteral<"agentStep">,
			z.ZodLiteral<"userPrompt">
		]>>;
		keepDuringTruncation: z.ZodOptional<z.ZodBoolean>;
	}, z.core.$strip>>,
	z.ZodIntersection<z.ZodObject<{
		role: z.ZodLiteral<"user">;
		content: z.ZodUnion<readonly [
			z.ZodString,
			z.ZodArray<z.ZodDiscriminatedUnion<[
				z.ZodObject<{
					type: z.ZodLiteral<"text">;
					text: z.ZodString;
					providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"image">;
					image: z.ZodUnion<readonly [
						z.ZodUnion<readonly [
							z.ZodString,
							z.ZodCustom<Uint8Array, Uint8Array>,
							z.ZodCustom<ArrayBuffer, ArrayBuffer>,
							z.ZodCustom<Buffer, Buffer>
						]>,
						z.ZodCustom<URL, URL>
					]>;
					mediaType: z.ZodOptional<z.ZodString>;
					providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"file">;
					data: z.ZodUnion<readonly [
						z.ZodUnion<readonly [
							z.ZodString,
							z.ZodCustom<Uint8Array, Uint8Array>,
							z.ZodCustom<ArrayBuffer, ArrayBuffer>,
							z.ZodCustom<Buffer, Buffer>
						]>,
						z.ZodCustom<URL, URL>
					]>;
					filename: z.ZodOptional<z.ZodString>;
					mediaType: z.ZodString;
					providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
				}, z.core.$strip>
			]>>
		]>;
	}, z.core.$strip>, z.ZodObject<{
		providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
		timeToLive: z.ZodOptional<z.ZodUnion<readonly [
			z.ZodLiteral<"agentStep">,
			z.ZodLiteral<"userPrompt">
		]>>;
		keepDuringTruncation: z.ZodOptional<z.ZodBoolean>;
	}, z.core.$strip>>,
	z.ZodIntersection<z.ZodObject<{
		role: z.ZodLiteral<"assistant">;
		content: z.ZodUnion<readonly [
			z.ZodString,
			z.ZodArray<z.ZodDiscriminatedUnion<[
				z.ZodObject<{
					type: z.ZodLiteral<"text">;
					text: z.ZodString;
					providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"reasoning">;
					text: z.ZodString;
					providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"tool-call">;
					toolCallId: z.ZodString;
					toolName: z.ZodString;
					input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
					providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
					providerExecuted: z.ZodOptional<z.ZodBoolean>;
				}, z.core.$strip>
			]>>
		]>;
	}, z.core.$strip>, z.ZodObject<{
		providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
		timeToLive: z.ZodOptional<z.ZodUnion<readonly [
			z.ZodLiteral<"agentStep">,
			z.ZodLiteral<"userPrompt">
		]>>;
		keepDuringTruncation: z.ZodOptional<z.ZodBoolean>;
	}, z.core.$strip>>,
	z.ZodIntersection<z.ZodObject<{
		role: z.ZodLiteral<"tool">;
		content: z.ZodObject<{
			type: z.ZodLiteral<"tool-result">;
			toolCallId: z.ZodString;
			toolName: z.ZodString;
			output: z.ZodArray<z.ZodDiscriminatedUnion<[
				z.ZodObject<{
					type: z.ZodLiteral<"json">;
					value: z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"media">;
					data: z.ZodString;
					mediaType: z.ZodString;
				}, z.core.$strip>
			]>>;
			providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
		}, z.core.$strip>;
	}, z.core.$strip>, z.ZodObject<{
		providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
		timeToLive: z.ZodOptional<z.ZodUnion<readonly [
			z.ZodLiteral<"agentStep">,
			z.ZodLiteral<"userPrompt">
		]>>;
		keepDuringTruncation: z.ZodOptional<z.ZodBoolean>;
	}, z.core.$strip>>
]>, z.ZodObject<{
	providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
	timeToLive: z.ZodOptional<z.ZodUnion<readonly [
		z.ZodLiteral<"agentStep">,
		z.ZodLiteral<"userPrompt">
	]>>;
	keepDuringTruncation: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>>;
type Message$1 = z.infer<typeof messageSchema$1>;
interface FileTreeNode {
	name: string;
	type: "file" | "directory";
	filePath: string;
	lastReadTime?: number;
	children?: FileTreeNode[];
}
declare const subgoalSchema: z.ZodObject<{
	objective: z.ZodOptional<z.ZodString>;
	status: z.ZodOptional<z.ZodEnum<{
		NOT_STARTED: "NOT_STARTED";
		IN_PROGRESS: "IN_PROGRESS";
		COMPLETE: "COMPLETE";
		ABORTED: "ABORTED";
	}>>;
	plan: z.ZodOptional<z.ZodString>;
	logs: z.ZodArray<z.ZodString>;
}, z.core.$strip>;
type Subgoal = z.infer<typeof subgoalSchema>;
declare const AgentStateSchema: z.ZodType<{
	agentId: string;
	agentType: AgentTemplateType | null;
	agentContext: Record<string, Subgoal>;
	ancestorRunIds: string[];
	runId?: string;
	subagents: AgentState$1[];
	childRunIds: string[];
	messageHistory: Message$1[];
	stepsRemaining: number;
	creditsUsed: number;
	directCreditsUsed: number;
	output?: Record<string, any>;
	parentId?: string;
}>;
type AgentState$1 = z.infer<typeof AgentStateSchema>;
declare const AgentOutputSchema: z.ZodDiscriminatedUnion<[
	z.ZodObject<{
		type: z.ZodLiteral<"structuredOutput">;
		value: z.ZodUnion<[
			z.ZodRecord<z.ZodString, z.ZodAny>,
			z.ZodNull
		]>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"lastMessage">;
		value: z.ZodAny;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"allMessages">;
		value: z.ZodArray<z.ZodAny>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"error">;
		message: z.ZodString;
	}, z.core.$strip>
]>;
type AgentOutput = z.infer<typeof AgentOutputSchema>;
declare const agentTemplateTypeSchema: z.ZodEnum<{
	ask: "ask";
	base: "base";
	base_lite: "base_lite";
	base_max: "base_max";
	base_experimental: "base_experimental";
	claude4_gemini_thinking: "claude4_gemini_thinking";
	superagent: "superagent";
	base_agent_builder: "base_agent_builder";
	planner: "planner";
	dry_run: "dry_run";
	thinker: "thinker";
	file_picker: "file_picker";
	file_explorer: "file_explorer";
	researcher: "researcher";
	reviewer: "reviewer";
	agent_builder: "agent_builder";
	example_programmatic: "example_programmatic";
}>;
type AgentTemplateType = z.infer<typeof agentTemplateTypeSchema> | (string & {});
declare const SessionStateSchema: z.ZodObject<{
	fileContext: z.ZodObject<{
		projectRoot: z.ZodString;
		cwd: z.ZodString;
		fileTree: z.ZodArray<z.ZodCustom<FileTreeNode, FileTreeNode>>;
		fileTokenScores: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
		tokenCallers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>>;
		knowledgeFiles: z.ZodRecord<z.ZodString, z.ZodString>;
		userKnowledgeFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
		agentTemplates: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
		customToolDefinitions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
			inputJsonSchema: z.ZodAny;
			endsAgentStep: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
			description: z.ZodOptional<z.ZodString>;
			exampleInputs: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>>>;
		}, z.core.$strip>>>;
		codebuffConfig: z.ZodOptional<z.ZodObject<{
			description: z.ZodOptional<z.ZodAny>;
			startupProcesses: z.ZodOptional<z.ZodArray<z.ZodObject<{
				name: z.ZodString;
				command: z.ZodString;
				cwd: z.ZodOptional<z.ZodString>;
				enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
				stdoutFile: z.ZodOptional<z.ZodString>;
				stderrFile: z.ZodOptional<z.ZodString>;
			}, z.core.$strip>>>;
			fileChangeHooks: z.ZodOptional<z.ZodArray<z.ZodObject<{
				name: z.ZodString;
				command: z.ZodString;
				cwd: z.ZodOptional<z.ZodString>;
				filePattern: z.ZodOptional<z.ZodString>;
				enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
			}, z.core.$strip>>>;
			maxAgentSteps: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
			baseAgent: z.ZodOptional<z.ZodString>;
			addedSpawnableAgents: z.ZodOptional<z.ZodArray<z.ZodString>>;
			removedSpawnableAgents: z.ZodOptional<z.ZodArray<z.ZodString>>;
			spawnableAgents: z.ZodOptional<z.ZodArray<z.ZodString>>;
		}, z.core.$loose>>;
		gitChanges: z.ZodObject<{
			status: z.ZodString;
			diff: z.ZodString;
			diffCached: z.ZodString;
			lastCommitMessages: z.ZodString;
		}, z.core.$strip>;
		changesSinceLastChat: z.ZodRecord<z.ZodString, z.ZodString>;
		shellConfigFiles: z.ZodRecord<z.ZodString, z.ZodString>;
		systemInfo: z.ZodObject<{
			platform: z.ZodString;
			shell: z.ZodString;
			nodeVersion: z.ZodString;
			arch: z.ZodString;
			homedir: z.ZodString;
			cpus: z.ZodNumber;
		}, z.core.$strip>;
	}, z.core.$strip>;
	mainAgentState: z.ZodType<{
		agentId: string;
		agentType: AgentTemplateType | null;
		agentContext: Record<string, Subgoal>;
		ancestorRunIds: string[];
		runId?: string;
		subagents: AgentState$1[];
		childRunIds: string[];
		messageHistory: Message$1[];
		stepsRemaining: number;
		creditsUsed: number;
		directCreditsUsed: number;
		output?: Record<string, any>;
		parentId?: string;
	}, unknown, z.core.$ZodTypeInternals<{
		agentId: string;
		agentType: AgentTemplateType | null;
		agentContext: Record<string, Subgoal>;
		ancestorRunIds: string[];
		runId?: string;
		subagents: AgentState$1[];
		childRunIds: string[];
		messageHistory: Message$1[];
		stepsRemaining: number;
		creditsUsed: number;
		directCreditsUsed: number;
		output?: Record<string, any>;
		parentId?: string;
	}, unknown>>;
}, z.core.$strip>;
type SessionState = z.infer<typeof SessionStateSchema>;
export type RunState = {
	sessionState: SessionState;
	output: AgentOutput;
};
export declare function initialSessionState(cwd: string | undefined, options: {
	projectFiles?: Record<string, string>;
	knowledgeFiles?: Record<string, string>;
	agentDefinitions?: AgentDefinition[];
	customToolDefinitions?: CustomToolDefinition[];
	maxAgentSteps?: number;
}): Promise<{
	fileContext: {
		projectRoot: string;
		cwd: string;
		fileTree: FileTreeNode[];
		fileTokenScores: Record<string, Record<string, number>>;
		knowledgeFiles: Record<string, string>;
		agentTemplates: Record<string, any>;
		customToolDefinitions: Record<string, {
			inputJsonSchema: any;
			endsAgentStep: boolean;
			description?: string | undefined;
			exampleInputs?: Record<string, any>[] | undefined;
		}>;
		gitChanges: {
			status: string;
			diff: string;
			diffCached: string;
			lastCommitMessages: string;
		};
		changesSinceLastChat: Record<string, string>;
		shellConfigFiles: Record<string, string>;
		systemInfo: {
			platform: string;
			shell: string;
			nodeVersion: string;
			arch: string;
			homedir: string;
			cpus: number;
		};
		tokenCallers?: Record<string, Record<string, string[]>> | undefined;
		userKnowledgeFiles?: Record<string, string> | undefined;
		codebuffConfig?: {
			[x: string]: unknown;
			maxAgentSteps: number;
			description?: any;
			startupProcesses?: {
				name: string;
				command: string;
				enabled: boolean;
				cwd?: string | undefined;
				stdoutFile?: string | undefined;
				stderrFile?: string | undefined;
			}[] | undefined;
			fileChangeHooks?: {
				name: string;
				command: string;
				enabled: boolean;
				cwd?: string | undefined;
				filePattern?: string | undefined;
			}[] | undefined;
			baseAgent?: string | undefined;
			addedSpawnableAgents?: string[] | undefined;
			removedSpawnableAgents?: string[] | undefined;
			spawnableAgents?: string[] | undefined;
		} | undefined;
	};
	mainAgentState: {
		agentId: string;
		agentType: AgentTemplateType | null;
		agentContext: Record<string, Subgoal>;
		ancestorRunIds: string[];
		runId?: string;
		subagents: AgentState$1[];
		childRunIds: string[];
		messageHistory: Message$1[];
		stepsRemaining: number;
		creditsUsed: number;
		directCreditsUsed: number;
		output?: Record<string, any>;
		parentId?: string;
	};
}>;
export declare function generateInitialRunState({ cwd, projectFiles, knowledgeFiles, agentDefinitions, customToolDefinitions, maxAgentSteps, }: {
	cwd: string;
	projectFiles?: Record<string, string>;
	knowledgeFiles?: Record<string, string>;
	agentDefinitions?: AgentDefinition[];
	customToolDefinitions?: CustomToolDefinition[];
	maxAgentSteps?: number;
}): Promise<RunState>;
export declare function withAdditionalMessage({ runState, message, }: {
	runState: RunState;
	message: Message$1;
}): RunState;
export declare function withMessageHistory({ runState, messages, }: {
	runState: RunState;
	messages: Message$1[];
}): RunState;
/**
 * Applies overrides to an existing session state, allowing specific fields to be updated
 * even when continuing from a previous run.
 */
export declare function applyOverridesToSessionState(cwd: string | undefined, baseSessionState: SessionState, overrides: {
	projectFiles?: Record<string, string>;
	knowledgeFiles?: Record<string, string>;
	agentDefinitions?: AgentDefinition[];
	customToolDefinitions?: CustomToolDefinition[];
	maxAgentSteps?: number;
}): Promise<SessionState>;
declare const $toolParams: {
	add_message: {
		toolName: "add_message";
		endsAgentStep: true;
		parameters: z.ZodObject<{
			role: z.ZodEnum<{
				user: "user";
				assistant: "assistant";
			}>;
			content: z.ZodString;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
		], null>;
	};
	add_subgoal: {
		toolName: "add_subgoal";
		endsAgentStep: false;
		parameters: z.ZodObject<{
			id: z.ZodString;
			objective: z.ZodString;
			status: z.ZodEnum<{
				NOT_STARTED: "NOT_STARTED";
				IN_PROGRESS: "IN_PROGRESS";
				COMPLETE: "COMPLETE";
				ABORTED: "ABORTED";
			}>;
			plan: z.ZodOptional<z.ZodString>;
			log: z.ZodOptional<z.ZodString>;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodObject<{
					message: z.ZodString;
				}, z.core.$strip>;
			}, z.core.$strip>
		], null>;
	};
	browser_logs: {
		toolName: "browser_logs";
		endsAgentStep: true;
		parameters: z.ZodObject<{
			type: z.ZodString;
			url: z.ZodString;
			waitUntil: z.ZodOptional<z.ZodEnum<{
				networkidle0: "networkidle0";
				load: "load";
				domcontentloaded: "domcontentloaded";
			}>>;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodObject<{
					success: z.ZodBoolean;
					error: z.ZodOptional<z.ZodString>;
					logs: z.ZodArray<z.ZodObject<{
						type: z.ZodEnum<{
							error: "error";
							debug: "debug";
							info: "info";
							warning: "warning";
							verbose: "verbose";
						}>;
						message: z.ZodString;
						timestamp: z.ZodNumber;
						location: z.ZodOptional<z.ZodString>;
						stack: z.ZodOptional<z.ZodString>;
						category: z.ZodOptional<z.ZodString>;
						level: z.ZodOptional<z.ZodNumber>;
						source: z.ZodDefault<z.ZodEnum<{
							tool: "tool";
							browser: "browser";
						}>>;
					}, z.core.$strip>>;
					logFilter: z.ZodOptional<z.ZodObject<{
						types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
							error: "error";
							debug: "debug";
							info: "info";
							warning: "warning";
							verbose: "verbose";
						}>>>;
						minLevel: z.ZodOptional<z.ZodNumber>;
						categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
					}, z.core.$strip>>;
					networkEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
						url: z.ZodString;
						method: z.ZodString;
						status: z.ZodOptional<z.ZodNumber>;
						errorText: z.ZodOptional<z.ZodString>;
						timestamp: z.ZodNumber;
					}, z.core.$strip>>>;
					metrics: z.ZodOptional<z.ZodObject<{
						loadTime: z.ZodNumber;
						memoryUsage: z.ZodNumber;
						jsErrors: z.ZodNumber;
						networkErrors: z.ZodNumber;
						ttfb: z.ZodOptional<z.ZodNumber>;
						lcp: z.ZodOptional<z.ZodNumber>;
						fcp: z.ZodOptional<z.ZodNumber>;
						domContentLoaded: z.ZodOptional<z.ZodNumber>;
						sessionDuration: z.ZodOptional<z.ZodNumber>;
					}, z.core.$strip>>;
					screenshots: z.ZodOptional<z.ZodObject<{
						pre: z.ZodOptional<z.ZodObject<{
							type: z.ZodLiteral<"image">;
							source: z.ZodObject<{
								type: z.ZodLiteral<"base64">;
								media_type: z.ZodLiteral<"image/jpeg">;
								data: z.ZodString;
							}, z.core.$strip>;
						}, z.core.$strip>>;
						post: z.ZodObject<{
							type: z.ZodLiteral<"image">;
							source: z.ZodObject<{
								type: z.ZodLiteral<"base64">;
								media_type: z.ZodLiteral<"image/jpeg">;
								data: z.ZodString;
							}, z.core.$strip>;
						}, z.core.$strip>;
					}, z.core.$strip>>;
				}, z.core.$strip>;
			}, z.core.$strip>
		], null>;
	};
	code_search: {
		toolName: "code_search";
		endsAgentStep: true;
		parameters: z.ZodObject<{
			pattern: z.ZodString;
			flags: z.ZodOptional<z.ZodString>;
			cwd: z.ZodOptional<z.ZodString>;
			maxResults: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodUnion<readonly [
					z.ZodObject<{
						stdout: z.ZodString;
						stderr: z.ZodOptional<z.ZodString>;
						exitCode: z.ZodOptional<z.ZodNumber>;
						message: z.ZodString;
					}, z.core.$strip>,
					z.ZodObject<{
						errorMessage: z.ZodString;
					}, z.core.$strip>
				]>;
			}, z.core.$strip>
		], null>;
	};
	create_plan: {
		toolName: "create_plan";
		endsAgentStep: false;
		parameters: z.ZodObject<{
			path: z.ZodString;
			plan: z.ZodString;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodUnion<readonly [
					z.ZodObject<{
						file: z.ZodString;
						message: z.ZodString;
						unifiedDiff: z.ZodString;
					}, z.core.$strip>,
					z.ZodObject<{
						file: z.ZodString;
						errorMessage: z.ZodString;
						patch: z.ZodOptional<z.ZodString>;
					}, z.core.$strip>
				]>;
			}, z.core.$strip>
		], null>;
	};
	end_turn: {
		toolName: "end_turn";
		endsAgentStep: true;
		parameters: z.ZodObject<{}, z.core.$strip>;
		outputs: z.ZodTuple<[
		], null>;
	};
	find_files: {
		toolName: "find_files";
		endsAgentStep: true;
		parameters: z.ZodObject<{
			prompt: z.ZodString;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodUnion<readonly [
					z.ZodArray<z.ZodUnion<readonly [
						z.ZodObject<{
							path: z.ZodString;
							content: z.ZodString;
							referencedBy: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
						}, z.core.$strip>,
						z.ZodObject<{
							path: z.ZodString;
							contentOmittedForLength: z.ZodLiteral<true>;
						}, z.core.$strip>
					]>>,
					z.ZodObject<{
						message: z.ZodString;
					}, z.core.$strip>
				]>;
			}, z.core.$strip>
		], null>;
	};
	lookup_agent_info: {
		toolName: "lookup_agent_info";
		endsAgentStep: false;
		parameters: z.ZodObject<{
			agentId: z.ZodString;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>;
			}, z.core.$strip>
		], null>;
	};
	read_docs: {
		toolName: "read_docs";
		endsAgentStep: true;
		parameters: z.ZodObject<{
			libraryTitle: z.ZodString;
			topic: z.ZodString;
			max_tokens: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodObject<{
					documentation: z.ZodString;
				}, z.core.$strip>;
			}, z.core.$strip>
		], null>;
	};
	read_files: {
		toolName: "read_files";
		endsAgentStep: true;
		parameters: z.ZodObject<{
			paths: z.ZodArray<z.ZodString>;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodArray<z.ZodUnion<readonly [
					z.ZodObject<{
						path: z.ZodString;
						content: z.ZodString;
						referencedBy: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
					}, z.core.$strip>,
					z.ZodObject<{
						path: z.ZodString;
						contentOmittedForLength: z.ZodLiteral<true>;
					}, z.core.$strip>
				]>>;
			}, z.core.$strip>
		], null>;
	};
	run_file_change_hooks: {
		toolName: "run_file_change_hooks";
		endsAgentStep: true;
		parameters: z.ZodObject<{
			files: z.ZodArray<z.ZodString>;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodArray<z.ZodUnion<readonly [
					z.ZodIntersection<z.ZodUnion<readonly [
						z.ZodObject<{
							command: z.ZodString;
							startingCwd: z.ZodOptional<z.ZodString>;
							message: z.ZodOptional<z.ZodString>;
							stderr: z.ZodOptional<z.ZodString>;
							stdout: z.ZodOptional<z.ZodString>;
							exitCode: z.ZodOptional<z.ZodNumber>;
						}, z.core.$strip>,
						z.ZodObject<{
							command: z.ZodString;
							startingCwd: z.ZodOptional<z.ZodString>;
							message: z.ZodOptional<z.ZodString>;
							stderr: z.ZodOptional<z.ZodString>;
							stdoutOmittedForLength: z.ZodLiteral<true>;
							exitCode: z.ZodOptional<z.ZodNumber>;
						}, z.core.$strip>,
						z.ZodObject<{
							command: z.ZodString;
							processId: z.ZodNumber;
							backgroundProcessStatus: z.ZodEnum<{
								error: "error";
								running: "running";
								completed: "completed";
							}>;
						}, z.core.$strip>,
						z.ZodObject<{
							command: z.ZodString;
							errorMessage: z.ZodString;
						}, z.core.$strip>
					]>, z.ZodObject<{
						hookName: z.ZodString;
					}, z.core.$strip>>,
					z.ZodObject<{
						errorMessage: z.ZodString;
					}, z.core.$strip>
				]>>;
			}, z.core.$strip>
		], null>;
	};
	run_terminal_command: {
		toolName: "run_terminal_command";
		endsAgentStep: true;
		parameters: z.ZodObject<{
			command: z.ZodString;
			process_type: z.ZodDefault<z.ZodEnum<{
				SYNC: "SYNC";
				BACKGROUND: "BACKGROUND";
			}>>;
			cwd: z.ZodOptional<z.ZodString>;
			timeout_seconds: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodUnion<readonly [
					z.ZodObject<{
						command: z.ZodString;
						startingCwd: z.ZodOptional<z.ZodString>;
						message: z.ZodOptional<z.ZodString>;
						stderr: z.ZodOptional<z.ZodString>;
						stdout: z.ZodOptional<z.ZodString>;
						exitCode: z.ZodOptional<z.ZodNumber>;
					}, z.core.$strip>,
					z.ZodObject<{
						command: z.ZodString;
						startingCwd: z.ZodOptional<z.ZodString>;
						message: z.ZodOptional<z.ZodString>;
						stderr: z.ZodOptional<z.ZodString>;
						stdoutOmittedForLength: z.ZodLiteral<true>;
						exitCode: z.ZodOptional<z.ZodNumber>;
					}, z.core.$strip>,
					z.ZodObject<{
						command: z.ZodString;
						processId: z.ZodNumber;
						backgroundProcessStatus: z.ZodEnum<{
							error: "error";
							running: "running";
							completed: "completed";
						}>;
					}, z.core.$strip>,
					z.ZodObject<{
						command: z.ZodString;
						errorMessage: z.ZodString;
					}, z.core.$strip>
				]>;
			}, z.core.$strip>
		], null>;
	};
	set_messages: {
		toolName: "set_messages";
		endsAgentStep: true;
		parameters: z.ZodObject<{
			messages: z.ZodAny;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
		], null>;
	};
	set_output: {
		toolName: "set_output";
		endsAgentStep: false;
		parameters: z.ZodObject<{}, z.core.$loose>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodObject<{
					message: z.ZodString;
				}, z.core.$strip>;
			}, z.core.$strip>
		], null>;
	};
	spawn_agents: {
		toolName: "spawn_agents";
		endsAgentStep: true;
		parameters: z.ZodObject<{
			agents: z.ZodArray<z.ZodObject<{
				agent_type: z.ZodString;
				prompt: z.ZodOptional<z.ZodString>;
				params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
			}, z.core.$strip>>;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodArray<z.ZodIntersection<z.ZodObject<{
					agentType: z.ZodString;
				}, z.core.$strip>, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
			}, z.core.$strip>
		], null>;
	};
	spawn_agents_async: {
		toolName: "spawn_agents_async";
		endsAgentStep: false;
		parameters: z.ZodObject<{
			agents: z.ZodArray<z.ZodObject<{
				agent_type: z.ZodString;
				prompt: z.ZodOptional<z.ZodString>;
				params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
			}, z.core.$strip>>;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodUnion<readonly [
					z.ZodArray<z.ZodDiscriminatedUnion<[
						z.ZodObject<{
							agentType: z.ZodString;
							success: z.ZodLiteral<true>;
							agentId: z.ZodString;
						}, z.core.$strip>,
						z.ZodObject<{
							agentType: z.ZodString;
							success: z.ZodLiteral<false>;
							errorMessage: z.ZodString;
						}, z.core.$strip>
					]>>,
					z.ZodArray<z.ZodIntersection<z.ZodObject<{
						agentType: z.ZodString;
					}, z.core.$strip>, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>
				]>;
			}, z.core.$strip>
		], null>;
	};
	spawn_agent_inline: {
		toolName: "spawn_agent_inline";
		endsAgentStep: true;
		parameters: z.ZodObject<{
			agent_type: z.ZodString;
			prompt: z.ZodOptional<z.ZodString>;
			params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
		], null>;
	};
	str_replace: {
		toolName: "str_replace";
		endsAgentStep: false;
		parameters: z.ZodObject<{
			path: z.ZodString;
			replacements: z.ZodArray<z.ZodObject<{
				old: z.ZodString;
				new: z.ZodString;
				allowMultiple: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
			}, z.core.$strip>>;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodUnion<readonly [
					z.ZodObject<{
						file: z.ZodString;
						message: z.ZodString;
						unifiedDiff: z.ZodString;
					}, z.core.$strip>,
					z.ZodObject<{
						file: z.ZodString;
						errorMessage: z.ZodString;
						patch: z.ZodOptional<z.ZodString>;
					}, z.core.$strip>
				]>;
			}, z.core.$strip>
		], null>;
	};
	think_deeply: {
		toolName: "think_deeply";
		endsAgentStep: false;
		parameters: z.ZodObject<{
			thought: z.ZodString;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
		], null>;
	};
	update_subgoal: {
		toolName: "update_subgoal";
		endsAgentStep: false;
		parameters: z.ZodObject<{
			id: z.ZodString;
			status: z.ZodOptional<z.ZodEnum<{
				NOT_STARTED: "NOT_STARTED";
				IN_PROGRESS: "IN_PROGRESS";
				COMPLETE: "COMPLETE";
				ABORTED: "ABORTED";
			}>>;
			plan: z.ZodOptional<z.ZodString>;
			log: z.ZodOptional<z.ZodString>;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodObject<{
					message: z.ZodString;
				}, z.core.$strip>;
			}, z.core.$strip>
		], null>;
	};
	web_search: {
		toolName: "web_search";
		endsAgentStep: true;
		parameters: z.ZodObject<{
			query: z.ZodString;
			depth: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
				standard: "standard";
				deep: "deep";
			}>>>;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodUnion<readonly [
					z.ZodObject<{
						result: z.ZodString;
					}, z.core.$strip>,
					z.ZodObject<{
						errorMessage: z.ZodString;
					}, z.core.$strip>
				]>;
			}, z.core.$strip>
		], null>;
	};
	write_file: {
		toolName: "write_file";
		endsAgentStep: false;
		parameters: z.ZodObject<{
			path: z.ZodString;
			instructions: z.ZodString;
			content: z.ZodString;
		}, z.core.$strip>;
		outputs: z.ZodTuple<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodUnion<readonly [
					z.ZodObject<{
						file: z.ZodString;
						message: z.ZodString;
						unifiedDiff: z.ZodString;
					}, z.core.$strip>,
					z.ZodObject<{
						file: z.ZodString;
						errorMessage: z.ZodString;
						patch: z.ZodOptional<z.ZodString>;
					}, z.core.$strip>
				]>;
			}, z.core.$strip>
		], null>;
	};
};
declare const additionalToolResultSchemas: {};
type ResultOnlyToolName = keyof typeof additionalToolResultSchemas;
type CodebuffToolOutput<T extends ToolName | ResultOnlyToolName = ToolName> = {
	[K in ToolName | ResultOnlyToolName]: K extends ToolName ? z.infer<(typeof $toolParams)[K]["outputs"]> : K extends ResultOnlyToolName ? z.infer<(typeof additionalToolResultSchemas)[K]["outputs"]> : never;
}[T];
type ClientToolName = (typeof clientToolNames)[number];
declare const clientToolCallSchema: z.ZodDiscriminatedUnion<[
	z.ZodObject<{
		toolName: z.ZodLiteral<"browser_logs">;
		input: z.ZodObject<{
			type: z.ZodString;
			url: z.ZodString;
			waitUntil: z.ZodOptional<z.ZodEnum<{
				networkidle0: "networkidle0";
				load: "load";
				domcontentloaded: "domcontentloaded";
			}>>;
		}, z.core.$strip>;
	}, z.core.$strip>,
	z.ZodObject<{
		toolName: z.ZodLiteral<"code_search">;
		input: z.ZodObject<{
			pattern: z.ZodString;
			flags: z.ZodOptional<z.ZodString>;
			cwd: z.ZodOptional<z.ZodString>;
			maxResults: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
		}, z.core.$strip>;
	}, z.core.$strip>,
	z.ZodObject<{
		toolName: z.ZodLiteral<"create_plan">;
		input: z.ZodObject<{
			type: z.ZodEnum<{
				file: "file";
				patch: "patch";
			}>;
			path: z.ZodString;
			content: z.ZodString;
		}, z.core.$strip>;
	}, z.core.$strip>,
	z.ZodObject<{
		toolName: z.ZodLiteral<"run_file_change_hooks">;
		input: z.ZodObject<{
			files: z.ZodArray<z.ZodString>;
		}, z.core.$strip>;
	}, z.core.$strip>,
	z.ZodObject<{
		toolName: z.ZodLiteral<"run_terminal_command">;
		input: z.ZodIntersection<z.ZodObject<{
			command: z.ZodString;
			process_type: z.ZodDefault<z.ZodEnum<{
				SYNC: "SYNC";
				BACKGROUND: "BACKGROUND";
			}>>;
			cwd: z.ZodOptional<z.ZodString>;
			timeout_seconds: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
		}, z.core.$strip>, z.ZodObject<{
			mode: z.ZodEnum<{
				user: "user";
				assistant: "assistant";
			}>;
		}, z.core.$strip>>;
	}, z.core.$strip>,
	z.ZodObject<{
		toolName: z.ZodLiteral<"str_replace">;
		input: z.ZodObject<{
			type: z.ZodEnum<{
				file: "file";
				patch: "patch";
			}>;
			path: z.ZodString;
			content: z.ZodString;
		}, z.core.$strip>;
	}, z.core.$strip>,
	z.ZodObject<{
		toolName: z.ZodLiteral<"write_file">;
		input: z.ZodObject<{
			type: z.ZodEnum<{
				file: "file";
				patch: "patch";
			}>;
			path: z.ZodString;
			content: z.ZodString;
		}, z.core.$strip>;
	}, z.core.$strip>
]>;
declare const clientToolNames: ("create_plan" | "browser_logs" | "code_search" | "run_file_change_hooks" | "run_terminal_command" | "str_replace" | "write_file")[];
type ClientToolCall<T extends ClientToolName = ClientToolName> = z.infer<typeof clientToolCallSchema> & {
	toolName: T;
} & Omit<ToolCallPart, "type">;
declare const printModeEventSchema: z.ZodDiscriminatedUnion<[
	z.ZodObject<{
		type: z.ZodLiteral<"download">;
		version: z.ZodString;
		status: z.ZodEnum<{
			complete: "complete";
			failed: "failed";
		}>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"error">;
		message: z.ZodString;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"finish">;
		agentId: z.ZodOptional<z.ZodString>;
		totalCost: z.ZodNumber;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"start">;
		agentId: z.ZodOptional<z.ZodString>;
		messageHistoryLength: z.ZodNumber;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"subagent_finish">;
		agentId: z.ZodString;
		displayName: z.ZodString;
		onlyChild: z.ZodBoolean;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"subagent_start">;
		agentId: z.ZodString;
		displayName: z.ZodString;
		onlyChild: z.ZodBoolean;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"text">;
		text: z.ZodString;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"tool_call">;
		toolCallId: z.ZodString;
		toolName: z.ZodString;
		input: z.ZodRecord<z.ZodString, z.ZodAny>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"tool_result">;
		toolCallId: z.ZodString;
		output: z.ZodArray<z.ZodDiscriminatedUnion<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>;
			}, z.core.$strip>,
			z.ZodObject<{
				type: z.ZodLiteral<"media">;
				data: z.ZodString;
				mediaType: z.ZodString;
			}, z.core.$strip>
		]>>;
	}, z.core.$strip>
]>;
type PrintModeEvent = z.infer<typeof printModeEventSchema>;
export type CodebuffClientOptions = {
	apiKey?: string;
	cwd?: string;
	projectFiles?: Record<string, string>;
	knowledgeFiles?: Record<string, string>;
	agentDefinitions?: AgentDefinition[];
	maxAgentSteps?: number;
	handleEvent?: (event: PrintModeEvent) => void | Promise<void>;
	handleStreamChunk?: (chunk: string) => void | Promise<void>;
	overrideTools?: Partial<{
		[K in ClientToolName & PublishedToolName]: (input: ClientToolCall<K>["input"]) => Promise<CodebuffToolOutput<K>>;
	} & {
		read_files: (input: {
			filePaths: string[];
		}) => Promise<Record<string, string | null>>;
	}>;
	customToolDefinitions?: CustomToolDefinition[];
};
export type RunOptions = {
	agent: string | AgentDefinition;
	prompt: string;
	params?: Record<string, any>;
	previousRun?: RunState;
	extraToolResults?: ToolResultPart[];
};
export declare function run({ apiKey, fingerprintId, cwd, projectFiles, knowledgeFiles, agentDefinitions, maxAgentSteps, handleEvent, handleStreamChunk, overrideTools, customToolDefinitions, agent, prompt, params, previousRun, extraToolResults, }: RunOptions & CodebuffClientOptions & {
	apiKey: string;
	fingerprintId: string;
}): Promise<RunState>;
export declare const dataContentSchema: z.ZodUnion<readonly [
	z.ZodString,
	z.ZodCustom<Uint8Array, Uint8Array>,
	z.ZodCustom<ArrayBuffer, ArrayBuffer>,
	z.ZodCustom<Buffer, Buffer>
]>;
export type DataContent = z.infer<typeof dataContentSchema>;
export interface LanguageConfig {
	extensions: string[];
	wasmFile: string;
	queryPathOrContent: string;
	parser?: Parser;
	query?: Query;
	language?: Language;
}
export interface RuntimeLanguageLoader {
	loadLanguage(wasmFile: string): Promise<Language>;
	initParser(): Promise<void>;
}
export declare const WASM_FILES: {
	readonly "tree-sitter-c-sharp.wasm": "tree-sitter-c-sharp.wasm";
	readonly "tree-sitter-cpp.wasm": "tree-sitter-cpp.wasm";
	readonly "tree-sitter-go.wasm": "tree-sitter-go.wasm";
	readonly "tree-sitter-java.wasm": "tree-sitter-java.wasm";
	readonly "tree-sitter-javascript.wasm": "tree-sitter-javascript.wasm";
	readonly "tree-sitter-python.wasm": "tree-sitter-python.wasm";
	readonly "tree-sitter-ruby.wasm": "tree-sitter-ruby.wasm";
	readonly "tree-sitter-rust.wasm": "tree-sitter-rust.wasm";
	readonly "tree-sitter-tsx.wasm": "tree-sitter-tsx.wasm";
	readonly "tree-sitter-typescript.wasm": "tree-sitter-typescript.wasm";
};
export declare const languageTable: LanguageConfig[];
/**
 * Set a custom WASM directory for loading tree-sitter WASM files.
 * This can be useful for custom packaging or deployment scenarios.
 */
export declare function setWasmDir(dir: string): void;
export declare function getWasmDir(): string | undefined;
export declare function findLanguageConfigByExtension(filePath: string): LanguageConfig | undefined;
export declare function createLanguageConfig(filePath: string, runtimeLoader: RuntimeLanguageLoader): Promise<LanguageConfig | undefined>;
export declare function getLanguageConfig(filePath: string): Promise<LanguageConfig | undefined>;
export declare const DEBUG_PARSING = false;
export interface TokenCallerMap {
	[filePath: string]: {
		[token: string]: string[];
	};
}
export interface FileTokenData {
	tokenScores: {
		[filePath: string]: {
			[token: string]: number;
		};
	};
	tokenCallers: TokenCallerMap;
}
export declare function getFileTokenScores(projectRoot: string, filePaths: string[], readFile?: (filePath: string) => string | null): Promise<FileTokenData>;
export declare function parseTokens(filePath: string, languageConfig: LanguageConfig, readFile?: (filePath: string) => string | null): {
	numLines: number;
	identifiers: string[];
	calls: string[];
};
export declare class CodebuffClient {
	options: CodebuffClientOptions & {
		apiKey: string;
		fingerprintId: string;
	};
	constructor(options: CodebuffClientOptions);
	/**
	 * Run a Codebuff agent with the specified options.
	 *
	 * @param agent - The agent to run. Use 'base' for the default agent, or specify a custom agent ID if you made your own agent config.
	 * @param prompt - The user prompt describing what you want the agent to do.
	 * @param params - (Optional) Additional parameters for the agent. Most agents don't use this, but some custom agents can take a JSON object as input in addition to the user prompt string.
	 * @param handleEvent - (Optional) Callback function that receives every event during execution (assistant messages, tool calls, etc.). This allows you to stream the agent's progress in real-time. We will likely add a token-by-token streaming callback in the future.
	 * @param previousRun - (Optional) JSON state returned from a previous run() call. Use this to continue a conversation or session with the agent, maintaining context from previous interactions.
	 * @param projectFiles - (Optional) All the files in your project as a plain JavaScript object. Keys should be the full path from your current directory to each file, and values should be the string contents of the file. Example: { "src/index.ts": "console.log('hi')" }. This helps Codebuff pick good source files for context.
	 * @param knowledgeFiles - (Optional) Knowledge files to inject into every run() call. Uses the same schema as projectFiles - keys are file paths and values are file contents. These files are added directly to the agent's context.
	 * @param agentDefinitions - (Optional) Array of custom agent definitions. Each object should satisfy the AgentDefinition type. You can input the agent's id field into the agent parameter to run that agent.
	 * @param customToolDefinitions - (Optional) Array of custom tool definitions that extend the agent's capabilities. Each tool definition includes a name, Zod schema for input validation, and a handler function. These tools can be called by the agent during execution.
	 * @param maxAgentSteps - (Optional) Maximum number of steps the agent can take before stopping. Use this as a safety measure in case your agent starts going off the rails. A reasonable number is around 20.
	 *
	 * @returns A Promise that resolves to a RunState JSON object which you can pass to a subsequent run() call to continue the run. Use result.output to get the agent's output.
	 */
	run(options: RunOptions & CodebuffClientOptions): Promise<RunState>;
}
declare const CLIENT_ACTION_SCHEMA: z.ZodDiscriminatedUnion<[
	z.ZodObject<{
		type: z.ZodLiteral<"prompt">;
		promptId: z.ZodString;
		prompt: z.ZodUnion<[
			z.ZodString,
			z.ZodUndefined
		]>;
		content: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [
			z.ZodObject<{
				type: z.ZodLiteral<"text">;
				text: z.ZodString;
				providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
			}, z.core.$strip>,
			z.ZodObject<{
				type: z.ZodLiteral<"image">;
				image: z.ZodUnion<readonly [
					z.ZodUnion<readonly [
						z.ZodString,
						z.ZodCustom<Uint8Array, Uint8Array>,
						z.ZodCustom<ArrayBuffer, ArrayBuffer>,
						z.ZodCustom<Buffer, Buffer>
					]>,
					z.ZodCustom<URL, URL>
				]>;
				mediaType: z.ZodOptional<z.ZodString>;
				providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
			}, z.core.$strip>
		]>>>;
		promptParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
		fingerprintId: z.ZodString;
		authToken: z.ZodOptional<z.ZodString>;
		costMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
			lite: "lite";
			normal: "normal";
			max: "max";
			experimental: "experimental";
			ask: "ask";
		}>>>;
		sessionState: z.ZodObject<{
			fileContext: z.ZodObject<{
				projectRoot: z.ZodString;
				cwd: z.ZodString;
				fileTree: z.ZodArray<z.ZodCustom<FileTreeNode, FileTreeNode>>;
				fileTokenScores: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
				tokenCallers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>>;
				knowledgeFiles: z.ZodRecord<z.ZodString, z.ZodString>;
				userKnowledgeFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
				agentTemplates: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
				customToolDefinitions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
					inputJsonSchema: z.ZodAny;
					endsAgentStep: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
					description: z.ZodOptional<z.ZodString>;
					exampleInputs: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>>>;
				}, z.core.$strip>>>;
				codebuffConfig: z.ZodOptional<z.ZodObject<{
					description: z.ZodOptional<z.ZodAny>;
					startupProcesses: z.ZodOptional<z.ZodArray<z.ZodObject<{
						name: z.ZodString;
						command: z.ZodString;
						cwd: z.ZodOptional<z.ZodString>;
						enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
						stdoutFile: z.ZodOptional<z.ZodString>;
						stderrFile: z.ZodOptional<z.ZodString>;
					}, z.core.$strip>>>;
					fileChangeHooks: z.ZodOptional<z.ZodArray<z.ZodObject<{
						name: z.ZodString;
						command: z.ZodString;
						cwd: z.ZodOptional<z.ZodString>;
						filePattern: z.ZodOptional<z.ZodString>;
						enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
					}, z.core.$strip>>>;
					maxAgentSteps: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
					baseAgent: z.ZodOptional<z.ZodString>;
					addedSpawnableAgents: z.ZodOptional<z.ZodArray<z.ZodString>>;
					removedSpawnableAgents: z.ZodOptional<z.ZodArray<z.ZodString>>;
					spawnableAgents: z.ZodOptional<z.ZodArray<z.ZodString>>;
				}, z.core.$loose>>;
				gitChanges: z.ZodObject<{
					status: z.ZodString;
					diff: z.ZodString;
					diffCached: z.ZodString;
					lastCommitMessages: z.ZodString;
				}, z.core.$strip>;
				changesSinceLastChat: z.ZodRecord<z.ZodString, z.ZodString>;
				shellConfigFiles: z.ZodRecord<z.ZodString, z.ZodString>;
				systemInfo: z.ZodObject<{
					platform: z.ZodString;
					shell: z.ZodString;
					nodeVersion: z.ZodString;
					arch: z.ZodString;
					homedir: z.ZodString;
					cpus: z.ZodNumber;
				}, z.core.$strip>;
			}, z.core.$strip>;
			mainAgentState: z.ZodType<{
				agentId: string;
				agentType: AgentTemplateType | null;
				agentContext: Record<string, Subgoal>;
				ancestorRunIds: string[];
				runId?: string;
				subagents: AgentState$1[];
				childRunIds: string[];
				messageHistory: Message$1[];
				stepsRemaining: number;
				creditsUsed: number;
				directCreditsUsed: number;
				output?: Record<string, any>;
				parentId?: string;
			}, unknown, z.core.$ZodTypeInternals<{
				agentId: string;
				agentType: AgentTemplateType | null;
				agentContext: Record<string, Subgoal>;
				ancestorRunIds: string[];
				runId?: string;
				subagents: AgentState$1[];
				childRunIds: string[];
				messageHistory: Message$1[];
				stepsRemaining: number;
				creditsUsed: number;
				directCreditsUsed: number;
				output?: Record<string, any>;
				parentId?: string;
			}, unknown>>;
		}, z.core.$strip>;
		toolResults: z.ZodArray<z.ZodObject<{
			type: z.ZodLiteral<"tool-result">;
			toolCallId: z.ZodString;
			toolName: z.ZodString;
			output: z.ZodArray<z.ZodDiscriminatedUnion<[
				z.ZodObject<{
					type: z.ZodLiteral<"json">;
					value: z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"media">;
					data: z.ZodString;
					mediaType: z.ZodString;
				}, z.core.$strip>
			]>>;
			providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
		}, z.core.$strip>>;
		model: z.ZodOptional<z.ZodString>;
		repoUrl: z.ZodOptional<z.ZodString>;
		agentId: z.ZodOptional<z.ZodString>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"read-files-response">;
		files: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [
			z.ZodString,
			z.ZodNull
		]>>;
		requestId: z.ZodOptional<z.ZodString>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"init">;
		fingerprintId: z.ZodString;
		authToken: z.ZodOptional<z.ZodString>;
		fileContext: z.ZodObject<{
			projectRoot: z.ZodString;
			cwd: z.ZodString;
			fileTree: z.ZodArray<z.ZodCustom<FileTreeNode, FileTreeNode>>;
			fileTokenScores: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
			tokenCallers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>>;
			knowledgeFiles: z.ZodRecord<z.ZodString, z.ZodString>;
			userKnowledgeFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
			agentTemplates: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
			customToolDefinitions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
				inputJsonSchema: z.ZodAny;
				endsAgentStep: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
				description: z.ZodOptional<z.ZodString>;
				exampleInputs: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>>>;
			}, z.core.$strip>>>;
			codebuffConfig: z.ZodOptional<z.ZodObject<{
				description: z.ZodOptional<z.ZodAny>;
				startupProcesses: z.ZodOptional<z.ZodArray<z.ZodObject<{
					name: z.ZodString;
					command: z.ZodString;
					cwd: z.ZodOptional<z.ZodString>;
					enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
					stdoutFile: z.ZodOptional<z.ZodString>;
					stderrFile: z.ZodOptional<z.ZodString>;
				}, z.core.$strip>>>;
				fileChangeHooks: z.ZodOptional<z.ZodArray<z.ZodObject<{
					name: z.ZodString;
					command: z.ZodString;
					cwd: z.ZodOptional<z.ZodString>;
					filePattern: z.ZodOptional<z.ZodString>;
					enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
				}, z.core.$strip>>>;
				maxAgentSteps: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
				baseAgent: z.ZodOptional<z.ZodString>;
				addedSpawnableAgents: z.ZodOptional<z.ZodArray<z.ZodString>>;
				removedSpawnableAgents: z.ZodOptional<z.ZodArray<z.ZodString>>;
				spawnableAgents: z.ZodOptional<z.ZodArray<z.ZodString>>;
			}, z.core.$loose>>;
			gitChanges: z.ZodObject<{
				status: z.ZodString;
				diff: z.ZodString;
				diffCached: z.ZodString;
				lastCommitMessages: z.ZodString;
			}, z.core.$strip>;
			changesSinceLastChat: z.ZodRecord<z.ZodString, z.ZodString>;
			shellConfigFiles: z.ZodRecord<z.ZodString, z.ZodString>;
			systemInfo: z.ZodObject<{
				platform: z.ZodString;
				shell: z.ZodString;
				nodeVersion: z.ZodString;
				arch: z.ZodString;
				homedir: z.ZodString;
				cpus: z.ZodNumber;
			}, z.core.$strip>;
		}, z.core.$strip>;
		repoUrl: z.ZodOptional<z.ZodString>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"tool-call-response">;
		requestId: z.ZodString;
		output: z.ZodArray<z.ZodDiscriminatedUnion<[
			z.ZodObject<{
				type: z.ZodLiteral<"json">;
				value: z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>;
			}, z.core.$strip>,
			z.ZodObject<{
				type: z.ZodLiteral<"media">;
				data: z.ZodString;
				mediaType: z.ZodString;
			}, z.core.$strip>
		]>>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"cancel-user-input">;
		authToken: z.ZodString;
		promptId: z.ZodString;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"mcp-tool-data">;
		requestId: z.ZodString;
		tools: z.ZodArray<z.ZodObject<{
			name: z.ZodString;
			description: z.ZodOptional<z.ZodString>;
			inputSchema: z.ZodObject<{
				type: z.ZodLiteral<"object">;
			}, z.core.$loose>;
		}, z.core.$strip>>;
	}, z.core.$strip>
]>;
type ClientActionAny = z.infer<typeof CLIENT_ACTION_SCHEMA>;
type ClientAction<T extends ClientActionAny["type"] = ClientActionAny["type"]> = Extract<ClientActionAny, {
	type: T;
}>;
declare const SERVER_ACTION_SCHEMA: z.ZodDiscriminatedUnion<[
	z.ZodObject<{
		type: z.ZodLiteral<"response-chunk">;
		userInputId: z.ZodString;
		chunk: z.ZodUnion<readonly [
			z.ZodString,
			z.ZodDiscriminatedUnion<[
				z.ZodObject<{
					type: z.ZodLiteral<"download">;
					version: z.ZodString;
					status: z.ZodEnum<{
						complete: "complete";
						failed: "failed";
					}>;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"error">;
					message: z.ZodString;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"finish">;
					agentId: z.ZodOptional<z.ZodString>;
					totalCost: z.ZodNumber;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"start">;
					agentId: z.ZodOptional<z.ZodString>;
					messageHistoryLength: z.ZodNumber;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"subagent_finish">;
					agentId: z.ZodString;
					displayName: z.ZodString;
					onlyChild: z.ZodBoolean;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"subagent_start">;
					agentId: z.ZodString;
					displayName: z.ZodString;
					onlyChild: z.ZodBoolean;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"text">;
					text: z.ZodString;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"tool_call">;
					toolCallId: z.ZodString;
					toolName: z.ZodString;
					input: z.ZodRecord<z.ZodString, z.ZodAny>;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"tool_result">;
					toolCallId: z.ZodString;
					output: z.ZodArray<z.ZodDiscriminatedUnion<[
						z.ZodObject<{
							type: z.ZodLiteral<"json">;
							value: z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>;
						}, z.core.$strip>,
						z.ZodObject<{
							type: z.ZodLiteral<"media">;
							data: z.ZodString;
							mediaType: z.ZodString;
						}, z.core.$strip>
					]>>;
				}, z.core.$strip>
			]>
		]>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"subagent-response-chunk">;
		userInputId: z.ZodString;
		agentId: z.ZodString;
		agentType: z.ZodString;
		chunk: z.ZodString;
		prompt: z.ZodOptional<z.ZodString>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"handlesteps-log-chunk">;
		userInputId: z.ZodString;
		agentId: z.ZodString;
		level: z.ZodEnum<{
			error: "error";
			debug: "debug";
			info: "info";
			warn: "warn";
		}>;
		data: z.ZodAny;
		message: z.ZodOptional<z.ZodString>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"prompt-response">;
		promptId: z.ZodString;
		sessionState: z.ZodObject<{
			fileContext: z.ZodObject<{
				projectRoot: z.ZodString;
				cwd: z.ZodString;
				fileTree: z.ZodArray<z.ZodCustom<FileTreeNode, FileTreeNode>>;
				fileTokenScores: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
				tokenCallers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>>;
				knowledgeFiles: z.ZodRecord<z.ZodString, z.ZodString>;
				userKnowledgeFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
				agentTemplates: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
				customToolDefinitions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
					inputJsonSchema: z.ZodAny;
					endsAgentStep: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
					description: z.ZodOptional<z.ZodString>;
					exampleInputs: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>>>;
				}, z.core.$strip>>>;
				codebuffConfig: z.ZodOptional<z.ZodObject<{
					description: z.ZodOptional<z.ZodAny>;
					startupProcesses: z.ZodOptional<z.ZodArray<z.ZodObject<{
						name: z.ZodString;
						command: z.ZodString;
						cwd: z.ZodOptional<z.ZodString>;
						enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
						stdoutFile: z.ZodOptional<z.ZodString>;
						stderrFile: z.ZodOptional<z.ZodString>;
					}, z.core.$strip>>>;
					fileChangeHooks: z.ZodOptional<z.ZodArray<z.ZodObject<{
						name: z.ZodString;
						command: z.ZodString;
						cwd: z.ZodOptional<z.ZodString>;
						filePattern: z.ZodOptional<z.ZodString>;
						enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
					}, z.core.$strip>>>;
					maxAgentSteps: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
					baseAgent: z.ZodOptional<z.ZodString>;
					addedSpawnableAgents: z.ZodOptional<z.ZodArray<z.ZodString>>;
					removedSpawnableAgents: z.ZodOptional<z.ZodArray<z.ZodString>>;
					spawnableAgents: z.ZodOptional<z.ZodArray<z.ZodString>>;
				}, z.core.$loose>>;
				gitChanges: z.ZodObject<{
					status: z.ZodString;
					diff: z.ZodString;
					diffCached: z.ZodString;
					lastCommitMessages: z.ZodString;
				}, z.core.$strip>;
				changesSinceLastChat: z.ZodRecord<z.ZodString, z.ZodString>;
				shellConfigFiles: z.ZodRecord<z.ZodString, z.ZodString>;
				systemInfo: z.ZodObject<{
					platform: z.ZodString;
					shell: z.ZodString;
					nodeVersion: z.ZodString;
					arch: z.ZodString;
					homedir: z.ZodString;
					cpus: z.ZodNumber;
				}, z.core.$strip>;
			}, z.core.$strip>;
			mainAgentState: z.ZodType<{
				agentId: string;
				agentType: AgentTemplateType | null;
				agentContext: Record<string, Subgoal>;
				ancestorRunIds: string[];
				runId?: string;
				subagents: AgentState$1[];
				childRunIds: string[];
				messageHistory: Message$1[];
				stepsRemaining: number;
				creditsUsed: number;
				directCreditsUsed: number;
				output?: Record<string, any>;
				parentId?: string;
			}, unknown, z.core.$ZodTypeInternals<{
				agentId: string;
				agentType: AgentTemplateType | null;
				agentContext: Record<string, Subgoal>;
				ancestorRunIds: string[];
				runId?: string;
				subagents: AgentState$1[];
				childRunIds: string[];
				messageHistory: Message$1[];
				stepsRemaining: number;
				creditsUsed: number;
				directCreditsUsed: number;
				output?: Record<string, any>;
				parentId?: string;
			}, unknown>>;
		}, z.core.$strip>;
		toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
			toolName: z.ZodString;
			toolCallId: z.ZodString;
			input: z.ZodRecord<z.ZodString, z.ZodAny>;
		}, z.core.$strip>>>;
		toolResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
			type: z.ZodLiteral<"tool-result">;
			toolCallId: z.ZodString;
			toolName: z.ZodString;
			output: z.ZodArray<z.ZodDiscriminatedUnion<[
				z.ZodObject<{
					type: z.ZodLiteral<"json">;
					value: z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>;
				}, z.core.$strip>,
				z.ZodObject<{
					type: z.ZodLiteral<"media">;
					data: z.ZodString;
					mediaType: z.ZodString;
				}, z.core.$strip>
			]>>;
			providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
		}, z.core.$strip>>>;
		output: z.ZodOptional<z.ZodDiscriminatedUnion<[
			z.ZodObject<{
				type: z.ZodLiteral<"structuredOutput">;
				value: z.ZodUnion<[
					z.ZodRecord<z.ZodString, z.ZodAny>,
					z.ZodNull
				]>;
			}, z.core.$strip>,
			z.ZodObject<{
				type: z.ZodLiteral<"lastMessage">;
				value: z.ZodAny;
			}, z.core.$strip>,
			z.ZodObject<{
				type: z.ZodLiteral<"allMessages">;
				value: z.ZodArray<z.ZodAny>;
			}, z.core.$strip>,
			z.ZodObject<{
				type: z.ZodLiteral<"error">;
				message: z.ZodString;
			}, z.core.$strip>
		]>>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"read-files">;
		filePaths: z.ZodArray<z.ZodString>;
		requestId: z.ZodString;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"tool-call-request">;
		userInputId: z.ZodString;
		requestId: z.ZodString;
		toolName: z.ZodString;
		input: z.ZodRecord<z.ZodString, z.ZodAny>;
		timeout: z.ZodOptional<z.ZodNumber>;
		mcpConfig: z.ZodOptional<z.ZodUnion<readonly [
			z.ZodObject<{
				type: z.ZodDefault<z.ZodEnum<{
					http: "http";
					sse: "sse";
				}>>;
				url: z.ZodString;
				params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
				headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
			}, z.core.$strict>,
			z.ZodObject<{
				type: z.ZodDefault<z.ZodLiteral<"stdio">>;
				command: z.ZodString;
				args: z.ZodDefault<z.ZodArray<z.ZodString>>;
				env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
			}, z.core.$strict>
		]>>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"init-response">;
		message: z.ZodOptional<z.ZodString>;
		agentNames: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
		usage: z.ZodNumber;
		remainingBalance: z.ZodNumber;
		balanceBreakdown: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
			free: "free";
			referral: "referral";
			purchase: "purchase";
			admin: "admin";
			organization: "organization";
		}>, z.ZodNumber>>;
		next_quota_reset: z.ZodNullable<z.ZodCoercedDate<unknown>>;
		autoTopupAdded: z.ZodOptional<z.ZodNumber>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"usage-response">;
		usage: z.ZodNumber;
		remainingBalance: z.ZodNumber;
		balanceBreakdown: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
			free: "free";
			referral: "referral";
			purchase: "purchase";
			admin: "admin";
			organization: "organization";
		}>, z.ZodNumber>>;
		next_quota_reset: z.ZodNullable<z.ZodCoercedDate<unknown>>;
		autoTopupAdded: z.ZodOptional<z.ZodNumber>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"message-cost-response">;
		promptId: z.ZodString;
		credits: z.ZodNumber;
		agentId: z.ZodOptional<z.ZodString>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"action-error">;
		message: z.ZodString;
		error: z.ZodOptional<z.ZodString>;
		remainingBalance: z.ZodOptional<z.ZodNumber>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"prompt-error">;
		userInputId: z.ZodString;
		message: z.ZodString;
		error: z.ZodOptional<z.ZodString>;
		remainingBalance: z.ZodOptional<z.ZodNumber>;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"request-reconnect">;
	}, z.core.$strip>,
	z.ZodObject<{
		type: z.ZodLiteral<"request-mcp-tool-data">;
		requestId: z.ZodString;
		mcpConfig: z.ZodUnion<readonly [
			z.ZodObject<{
				type: z.ZodDefault<z.ZodEnum<{
					http: "http";
					sse: "sse";
				}>>;
				url: z.ZodString;
				params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
				headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
			}, z.core.$strict>,
			z.ZodObject<{
				type: z.ZodDefault<z.ZodLiteral<"stdio">>;
				command: z.ZodString;
				args: z.ZodDefault<z.ZodArray<z.ZodString>>;
				env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
			}, z.core.$strict>
		]>;
		toolNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
	}, z.core.$strip>
]>;
type ServerActionAny = z.infer<typeof SERVER_ACTION_SCHEMA>;
type ServerAction<T extends ServerActionAny["type"] = ServerActionAny["type"]> = Extract<ServerActionAny, {
	type: T;
}>;
export type WebSocketHandlerOptions = {
	onWebsocketError?: (error: WebSocket$1.ErrorEvent) => void;
	onWebsocketReconnect?: () => void;
	onRequestReconnect?: () => Promise<void>;
	onResponseError?: (error: ServerAction<"action-error">) => Promise<void>;
	readFiles: (input: {
		filePaths: string[];
	}) => Promise<ClientAction<"read-files-response">["files"]>;
	handleToolCall: (action: ServerAction<"tool-call-request">) => Promise<Omit<ClientAction<"tool-call-response">, "type" | "requestId">>;
	onCostResponse?: (action: ServerAction<"message-cost-response">) => Promise<void>;
	onResponseChunk?: (action: ServerAction<"response-chunk">) => Promise<void>;
	onSubagentResponseChunk?: (action: ServerAction<"subagent-response-chunk">) => Promise<void>;
	onPromptResponse?: (action: ServerAction<"prompt-response">) => Promise<void>;
	onPromptError?: (action: ServerAction<"prompt-error">) => Promise<void>;
	apiKey: string;
};
export declare class WebSocketHandler {
	private cbWebSocket;
	private onRequestReconnect;
	private onResponseError;
	private readFiles;
	private handleToolCall;
	private onCostResponse;
	private onResponseChunk;
	private onSubagentResponseChunk;
	private onPromptResponse;
	private onPromptError;
	private apiKey;
	private isConnected;
	constructor({ onWebsocketError, onWebsocketReconnect, onRequestReconnect, onResponseError, readFiles, handleToolCall, onCostResponse, onResponseChunk, onSubagentResponseChunk, onPromptResponse, onPromptError, apiKey, }: WebSocketHandlerOptions);
	connect(): Promise<void>;
	reconnect(): void;
	close(): void;
	private setupSubscriptions;
	private getInputDefaultOptions;
	sendInput(action: Omit<ClientAction<"prompt">, keyof ReturnType<typeof WebSocketHandler.getInputDefaultOptions>>): void;
	cancelInput({ promptId }: {
		promptId: string;
	}): void;
}
/**
 * Get the path to the bundled ripgrep binary based on the current platform
 * @param importMetaUrl - import.meta.url from the calling module
 * @returns Path to the ripgrep binary
 */
export declare function getBundledRgPath(importMetaUrl?: string): string;
declare function changeFile(parameters: unknown, cwd: string): CodebuffToolOutput<"str_replace">;
declare function codeSearch({ projectPath, pattern, flags, cwd, maxResults, }: {
	projectPath: string;
	pattern: string;
	flags?: string;
	cwd?: string;
	maxResults?: number;
}): Promise<CodebuffToolOutput<"code_search">>;
declare function getFiles(filePaths: string[], cwd: string): Record<string, string | null>;
declare function runFileChangeHooks({ files, }: {
	files: string[];
}): Promise<CodebuffToolOutput<"run_file_change_hooks">>;
declare function runTerminalCommand({ command, process_type, cwd, timeout_seconds, }: {
	command: string;
	process_type: "SYNC" | "BACKGROUND";
	cwd: string;
	timeout_seconds: number;
}): Promise<CodebuffToolOutput<"run_terminal_command">>;
export declare const ToolHelpers: {
	runTerminalCommand: typeof runTerminalCommand;
	codeSearch: typeof codeSearch;
	getFiles: typeof getFiles;
	runFileChangeHooks: typeof runFileChangeHooks;
	changeFile: typeof changeFile;
};

declare namespace Tools {
	export { AddMessageParams, CodeSearchParams, EndTurnParams, FindFilesParams, GetToolParams, LookupAgentInfoParams, ReadDocsParams, ReadFilesParams, RunFileChangeHooksParams, RunTerminalCommandParams, SetMessagesParams, SetOutputParams, SpawnAgentsParams, StrReplaceParams, ThinkDeeplyParams, ToolName$1 as ToolName, ToolParamsMap, WebSearchParams, WriteFileParams };
}

export {
	Message$1 as Message,
	messageSchema$1 as messageSchema,
};

export {};
