import { BaseMemory } from './memory/base.js'; import { AssistantMessage } from './backend/message.js'; import { Tool, BaseToolRunOptions, StringToolOutput, AnyTool, ToolOutput } from './tools/base.js'; import { FrameworkError } from './errors.js'; import { PromptTemplate } from './template.js'; import { m as ChatModelUsage, k as ChatModelToolChoice, i as ChatModelOutput } from './chat-CfTNfR60.js'; import { a as BaseAgentRunOptions } from './base-BjzyQ8k6.js'; import { ZodSchema, z } from 'zod'; import { ToolCallPart } from 'ai'; import { E as Emitter } from './emitter-kHxkUxco.js'; import { RunContext } from './context.js'; /** * Copyright 2025 © BeeAI a Series of LF Projects, LLC * SPDX-License-Identifier: Apache-2.0 */ interface ToolInvocationResult { msg: ToolCallPart; tool: AnyTool | null; input: unknown; output: ToolOutput; error: FrameworkError | null; } /** * Run a single tool with error handling */ declare function runTool(tools: AnyTool[], msg: ToolCallPart, context: Record): Promise; /** * Special tool for capturing final answers */ declare class FinalAnswerTool extends Tool { readonly name = "final_answer"; readonly description = "Sends the final answer to the user"; instructions?: string; customSchema: boolean; readonly emitter: Emitter; protected expectedOutput: string | ZodSchema | null; protected state: RequirementAgentRunState; constructor(expectedOutput: string | ZodSchema | null, state: RequirementAgentRunState); inputSchema(): ZodSchema; _run(input: any, _options: BaseToolRunOptions, _ctx: RunContext): Promise; } /** * Copyright 2025 © BeeAI a Series of LF Projects, LLC * SPDX-License-Identifier: Apache-2.0 */ declare const RequirementAgentSystemPromptInputSchema: z.ZodObject<{ role: z.ZodOptional; instructions: z.ZodOptional; notes: z.ZodOptional; finalAnswerName: z.ZodString; finalAnswerSchema: z.ZodOptional; finalAnswerInstructions: z.ZodOptional; tools: z.ZodArray; }, "strip", z.ZodTypeAny, { inputSchema: string; name: string; description: string; allowed: string; reason?: string | undefined; }, { inputSchema: string; name: string; description: string; allowed: string; reason?: string | undefined; }>, "many">; }, "strip", z.ZodTypeAny, { tools: { inputSchema: string; name: string; description: string; allowed: string; reason?: string | undefined; }[]; finalAnswerName: string; role?: string | undefined; instructions?: string | undefined; notes?: string | undefined; finalAnswerSchema?: string | undefined; finalAnswerInstructions?: string | undefined; }, { tools: { inputSchema: string; name: string; description: string; allowed: string; reason?: string | undefined; }[]; finalAnswerName: string; role?: string | undefined; instructions?: string | undefined; notes?: string | undefined; finalAnswerSchema?: string | undefined; finalAnswerInstructions?: string | undefined; }>; declare const RequirementAgentTaskPromptInputSchema: z.ZodObject<{ prompt: z.ZodString; context: z.ZodOptional; expectedOutput: z.ZodOptional; }, "strip", z.ZodTypeAny, { prompt: string; context?: string | undefined; expectedOutput?: string | undefined; }, { prompt: string; context?: string | undefined; expectedOutput?: string | undefined; }>; declare const RequirementAgentToolErrorPromptInputSchema: z.ZodObject<{ reason: z.ZodString; }, "strip", z.ZodTypeAny, { reason: string; }, { reason: string; }>; declare const RequirementAgentToolNoResultPromptInputSchema: z.ZodObject<{ toolCall: z.ZodObject<{ tool: z.ZodOptional; input: z.ZodUnknown; }, "strip", z.ZodTypeAny, { tool?: any; input?: unknown; }, { tool?: any; input?: unknown; }>; }, "strip", z.ZodTypeAny, { toolCall: { tool?: any; input?: unknown; }; }, { toolCall: { tool?: any; input?: unknown; }; }>; interface RequirementAgentTemplates { system: PromptTemplate; task: PromptTemplate; toolError: PromptTemplate; toolNoResult: PromptTemplate; } interface RequirementAgentRunStateStep { id: string; iteration: number; tool: AnyTool | null; input: unknown; output: ToolOutput; error: FrameworkError | null; } interface RequirementAgentRunState { answer: AssistantMessage | null; result: unknown; memory: BaseMemory; iteration: number; steps: RequirementAgentRunStateStep[]; usage: ChatModelUsage; } interface RequirementAgentOutput { result: AssistantMessage; memory: BaseMemory; state: RequirementAgentRunState; } interface RequirementAgentRequest { tools: AnyTool[]; allowedTools: AnyTool[]; reasonByTool: WeakMap; hiddenTools: AnyTool[]; toolChoice: ChatModelToolChoice; finalAnswer: FinalAnswerTool; canStop: boolean; } interface RequirementAgentExecutionConfig { maxRetriesPerStep?: number; totalMaxRetries?: number; maxIterations?: number; } interface RequirementAgentRunInput { prompt: string | null; context?: string; expectedOutput?: string | z.ZodSchema; } interface RequirementAgentRunOptions extends BaseAgentRunOptions { execution?: RequirementAgentExecutionConfig; } interface RequirementAgentCallbacks { start: (data: { state: RequirementAgentRunState; request: RequirementAgentRequest; }) => void; success: (data: { state: RequirementAgentRunState; response: ChatModelOutput; }) => void; finalAnswer: (data: { state: RequirementAgentRunState; output: string; delta: string; outputStructured: unknown; }) => void; } export { FinalAnswerTool as F, type RequirementAgentRunState as R, type ToolInvocationResult as T, type RequirementAgentRequest as a, RequirementAgentSystemPromptInputSchema as b, type RequirementAgentExecutionConfig as c, type RequirementAgentTemplates as d, type RequirementAgentRunInput as e, type RequirementAgentOutput as f, type RequirementAgentRunOptions as g, type RequirementAgentCallbacks as h, type RequirementAgentRunStateStep as i, RequirementAgentTaskPromptInputSchema as j, RequirementAgentToolErrorPromptInputSchema as k, RequirementAgentToolNoResultPromptInputSchema as l, runTool as r };