import { z } from "zod"; import { Client } from "@modelcontextprotocol/sdk/client/index"; import { AgentGraphModel } from "../model/AgentGraphModel"; export interface ApiConfig { baseURL: string; apiKey: string; model: string; } export interface ToolInfo { type: "function"; function: { name: string; description?: string; parameters: z.ZodObject; }; _handler?: (args: any, context: { allTools: ToolInfo[]; agentOptions?: GraphAgentOptions; }) => Promise; _client?: Client; _originalName?: string; } export interface McpConfig { mcpServers: { [key: string]: { command: string; args?: string[]; env?: Record; }; }; } export interface AgentOptions { targetDir?: string; tools?: ToolInfo[]; extraSystemPrompt?: any; maxTokens?: number; verbose?: boolean; apiConfig?: ApiConfig; } export interface GraphAgentOptions extends AgentOptions { apiModel?: T; alwaysSystem?: boolean; recursionLimit?: number; /** 是否启用流式输出,默认 false */ stream?: boolean; filterTools?: (tool: ToolInfo) => boolean; } export interface CreateAgentOptions { apiKey: string; apiUrl: string; targetDir?: string; /** 是否启用流式输出,默认 false */ stream?: boolean; config?: GraphAgentOptions; }