From 31c449907d926f993c04a946ab38828d7e43e1ea Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Mar 2026 20:06:56 +0000 Subject: [PATCH 1/2] Initial plan From f51049ce4a22de3a27d5cb39d47018067e7a009a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Mar 2026 20:10:05 +0000 Subject: [PATCH 2/2] fix: use tryImport for ai in toClaudeAgentSdkTool to avoid static import crash Co-authored-by: glebedel <10488548+glebedel@users.noreply.github.com> --- src/tool.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/tool.ts b/src/tool.ts index 9412d1d..7b68082 100644 --- a/src/tool.ts +++ b/src/tool.ts @@ -1,4 +1,4 @@ -import { type JSONSchema7 as AISDKJSONSchema, jsonSchema } from 'ai'; +import type { JSONSchema7 as AISDKJSONSchema } from 'ai'; import type { Tool as AnthropicTool } from '@anthropic-ai/sdk/resources'; import type { McpSdkServerConfigWithInstance } from '@anthropic-ai/claude-agent-sdk'; import type { ChatCompletionFunctionTool } from 'openai/resources/chat/completions'; @@ -248,7 +248,12 @@ export class BaseTool { args: Record, ) => Promise<{ content: Array<{ type: 'text'; text: string }> }>; }> { - const inputSchema = jsonSchema(this.toJsonSchema()); + /** AI SDK is optional dependency, import only when needed */ + const ai = await tryImport( + 'ai', + `npm install ai (requires ${peerDependencies.ai})`, + ); + const inputSchema = ai.jsonSchema(this.toJsonSchema()); const execute = this.execute.bind(this); return {