@copilotkitnext/agent 1.51.5-next.0 → 1.51.5-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,9 +1,10 @@
1
- import { AbstractAgent, RunAgentInput, BaseEvent, Message } from '@ag-ui/client';
2
- import { LanguageModel, ToolChoice, ModelMessage, ToolSet } from 'ai';
3
- import { Observable } from 'rxjs';
4
- import { z } from 'zod';
5
- import { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
1
+ import { AbstractAgent, BaseEvent, Message, RunAgentInput } from "@ag-ui/client";
2
+ import { LanguageModel, ModelMessage, ToolChoice, ToolSet } from "ai";
3
+ import { Observable } from "rxjs";
4
+ import { z } from "zod";
5
+ import { StreamableHTTPClientTransportOptions } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
6
6
 
7
+ //#region src/index.d.ts
7
8
  /**
8
9
  * Properties that can be overridden by forwardedProps
9
10
  * These match the exact parameter names in streamText
@@ -21,35 +22,35 @@ type ModelSpecifier = string | LanguageModel;
21
22
  * MCP Client configuration for HTTP transport
22
23
  */
23
24
  interface MCPClientConfigHTTP {
24
- /**
25
- * Type of MCP client
26
- */
27
- type: "http";
28
- /**
29
- * URL of the MCP server
30
- */
31
- url: string;
32
- /**
33
- * Optional transport options for HTTP client
34
- */
35
- options?: StreamableHTTPClientTransportOptions;
25
+ /**
26
+ * Type of MCP client
27
+ */
28
+ type: "http";
29
+ /**
30
+ * URL of the MCP server
31
+ */
32
+ url: string;
33
+ /**
34
+ * Optional transport options for HTTP client
35
+ */
36
+ options?: StreamableHTTPClientTransportOptions;
36
37
  }
37
38
  /**
38
39
  * MCP Client configuration for SSE transport
39
40
  */
40
41
  interface MCPClientConfigSSE {
41
- /**
42
- * Type of MCP client
43
- */
44
- type: "sse";
45
- /**
46
- * URL of the MCP server
47
- */
48
- url: string;
49
- /**
50
- * Optional HTTP headers (e.g., for authentication)
51
- */
52
- headers?: Record<string, string>;
42
+ /**
43
+ * Type of MCP client
44
+ */
45
+ type: "sse";
46
+ /**
47
+ * URL of the MCP server
48
+ */
49
+ url: string;
50
+ /**
51
+ * Optional HTTP headers (e.g., for authentication)
52
+ */
53
+ headers?: Record<string, string>;
53
54
  }
54
55
  /**
55
56
  * MCP Client configuration
@@ -66,10 +67,10 @@ declare function resolveModel(spec: ModelSpecifier, apiKey?: string): LanguageMo
66
67
  * Tool definition for BuiltInAgent
67
68
  */
68
69
  interface ToolDefinition<TParameters extends z.ZodTypeAny = z.ZodTypeAny> {
69
- name: string;
70
- description: string;
71
- parameters: TParameters;
72
- execute: (args: z.infer<TParameters>) => Promise<unknown>;
70
+ name: string;
71
+ description: string;
72
+ parameters: TParameters;
73
+ execute: (args: z.infer<TParameters>) => Promise<unknown>;
73
74
  }
74
75
  /**
75
76
  * Define a tool for use with BuiltInAgent
@@ -80,17 +81,17 @@ interface ToolDefinition<TParameters extends z.ZodTypeAny = z.ZodTypeAny> {
80
81
  * @returns Tool definition
81
82
  */
82
83
  declare function defineTool<TParameters extends z.ZodTypeAny>(config: {
83
- name: string;
84
- description: string;
85
- parameters: TParameters;
86
- execute: (args: z.infer<TParameters>) => Promise<unknown>;
84
+ name: string;
85
+ description: string;
86
+ parameters: TParameters;
87
+ execute: (args: z.infer<TParameters>) => Promise<unknown>;
87
88
  }): ToolDefinition<TParameters>;
88
89
  /**
89
90
  * Options for converting AG-UI messages to Vercel AI SDK format
90
91
  */
91
92
  interface MessageConversionOptions {
92
- forwardSystemMessages?: boolean;
93
- forwardDeveloperMessages?: boolean;
93
+ forwardSystemMessages?: boolean;
94
+ forwardDeveloperMessages?: boolean;
94
95
  }
95
96
  /**
96
97
  * Converts AG-UI messages to Vercel AI SDK ModelMessage format
@@ -100,11 +101,11 @@ declare function convertMessagesToVercelAISDKMessages(messages: Message[], optio
100
101
  * JSON Schema type definition
101
102
  */
102
103
  interface JsonSchema {
103
- type: "object" | "string" | "number" | "integer" | "boolean" | "array";
104
- description?: string;
105
- properties?: Record<string, JsonSchema>;
106
- required?: string[];
107
- items?: JsonSchema;
104
+ type: "object" | "string" | "number" | "integer" | "boolean" | "array";
105
+ description?: string;
106
+ properties?: Record<string, JsonSchema>;
107
+ required?: string[];
108
+ items?: JsonSchema;
108
109
  }
109
110
  /**
110
111
  * Converts JSON Schema to Zod schema
@@ -119,112 +120,113 @@ declare function convertToolDefinitionsToVercelAITools(tools: ToolDefinition[]):
119
120
  * Configuration for BuiltInAgent
120
121
  */
121
122
  interface BuiltInAgentConfiguration {
122
- /**
123
- * The model to use
124
- */
125
- model: BuiltInAgentModel | LanguageModel;
126
- /**
127
- * API key for the model provider (OpenAI, Anthropic, Google)
128
- * If not provided, falls back to environment variables:
129
- * - OPENAI_API_KEY for OpenAI models
130
- * - ANTHROPIC_API_KEY for Anthropic models
131
- * - GOOGLE_API_KEY for Google models
132
- */
133
- apiKey?: string;
134
- /**
135
- * Maximum number of steps/iterations for tool calling (default: 1)
136
- */
137
- maxSteps?: number;
138
- /**
139
- * Tool choice setting - how tools are selected for execution (default: "auto")
140
- */
141
- toolChoice?: ToolChoice<Record<string, unknown>>;
142
- /**
143
- * Maximum number of tokens to generate
144
- */
145
- maxOutputTokens?: number;
146
- /**
147
- * Temperature setting (range depends on provider)
148
- */
149
- temperature?: number;
150
- /**
151
- * Nucleus sampling (topP)
152
- */
153
- topP?: number;
154
- /**
155
- * Top K sampling
156
- */
157
- topK?: number;
158
- /**
159
- * Presence penalty
160
- */
161
- presencePenalty?: number;
162
- /**
163
- * Frequency penalty
164
- */
165
- frequencyPenalty?: number;
166
- /**
167
- * Sequences that will stop the generation
168
- */
169
- stopSequences?: string[];
170
- /**
171
- * Seed for deterministic results
172
- */
173
- seed?: number;
174
- /**
175
- * Maximum number of retries
176
- */
177
- maxRetries?: number;
178
- /**
179
- * Prompt for the agent
180
- */
181
- prompt?: string;
182
- /**
183
- * List of properties that can be overridden by forwardedProps.
184
- */
185
- overridableProperties?: OverridableProperty[];
186
- /**
187
- * Optional list of MCP server configurations
188
- */
189
- mcpServers?: MCPClientConfig[];
190
- /**
191
- * Optional tools available to the agent
192
- */
193
- tools?: ToolDefinition[];
194
- /**
195
- * Forward system-role messages from input to the LLM.
196
- * Default: false
197
- */
198
- forwardSystemMessages?: boolean;
199
- /**
200
- * Forward developer-role messages from input to the LLM (as system messages).
201
- * Default: false
202
- */
203
- forwardDeveloperMessages?: boolean;
204
- /**
205
- * Provider-specific options passed to the model (e.g., OpenAI reasoningEffort).
206
- * Example: `{ openai: { reasoningEffort: "high" } }`
207
- */
208
- providerOptions?: Record<string, any>;
123
+ /**
124
+ * The model to use
125
+ */
126
+ model: BuiltInAgentModel | LanguageModel;
127
+ /**
128
+ * API key for the model provider (OpenAI, Anthropic, Google)
129
+ * If not provided, falls back to environment variables:
130
+ * - OPENAI_API_KEY for OpenAI models
131
+ * - ANTHROPIC_API_KEY for Anthropic models
132
+ * - GOOGLE_API_KEY for Google models
133
+ */
134
+ apiKey?: string;
135
+ /**
136
+ * Maximum number of steps/iterations for tool calling (default: 1)
137
+ */
138
+ maxSteps?: number;
139
+ /**
140
+ * Tool choice setting - how tools are selected for execution (default: "auto")
141
+ */
142
+ toolChoice?: ToolChoice<Record<string, unknown>>;
143
+ /**
144
+ * Maximum number of tokens to generate
145
+ */
146
+ maxOutputTokens?: number;
147
+ /**
148
+ * Temperature setting (range depends on provider)
149
+ */
150
+ temperature?: number;
151
+ /**
152
+ * Nucleus sampling (topP)
153
+ */
154
+ topP?: number;
155
+ /**
156
+ * Top K sampling
157
+ */
158
+ topK?: number;
159
+ /**
160
+ * Presence penalty
161
+ */
162
+ presencePenalty?: number;
163
+ /**
164
+ * Frequency penalty
165
+ */
166
+ frequencyPenalty?: number;
167
+ /**
168
+ * Sequences that will stop the generation
169
+ */
170
+ stopSequences?: string[];
171
+ /**
172
+ * Seed for deterministic results
173
+ */
174
+ seed?: number;
175
+ /**
176
+ * Maximum number of retries
177
+ */
178
+ maxRetries?: number;
179
+ /**
180
+ * Prompt for the agent
181
+ */
182
+ prompt?: string;
183
+ /**
184
+ * List of properties that can be overridden by forwardedProps.
185
+ */
186
+ overridableProperties?: OverridableProperty[];
187
+ /**
188
+ * Optional list of MCP server configurations
189
+ */
190
+ mcpServers?: MCPClientConfig[];
191
+ /**
192
+ * Optional tools available to the agent
193
+ */
194
+ tools?: ToolDefinition[];
195
+ /**
196
+ * Forward system-role messages from input to the LLM.
197
+ * Default: false
198
+ */
199
+ forwardSystemMessages?: boolean;
200
+ /**
201
+ * Forward developer-role messages from input to the LLM (as system messages).
202
+ * Default: false
203
+ */
204
+ forwardDeveloperMessages?: boolean;
205
+ /**
206
+ * Provider-specific options passed to the model (e.g., OpenAI reasoningEffort).
207
+ * Example: `{ openai: { reasoningEffort: "high" } }`
208
+ */
209
+ providerOptions?: Record<string, any>;
209
210
  }
210
211
  declare class BuiltInAgent extends AbstractAgent {
211
- private config;
212
- private abortController?;
213
- constructor(config: BuiltInAgentConfiguration);
214
- /**
215
- * Check if a property can be overridden by forwardedProps
216
- */
217
- canOverride(property: OverridableProperty): boolean;
218
- run(input: RunAgentInput): Observable<BaseEvent>;
219
- clone(): BuiltInAgent;
220
- abortRun(): void;
212
+ private config;
213
+ private abortController?;
214
+ constructor(config: BuiltInAgentConfiguration);
215
+ /**
216
+ * Check if a property can be overridden by forwardedProps
217
+ */
218
+ canOverride(property: OverridableProperty): boolean;
219
+ run(input: RunAgentInput): Observable<BaseEvent>;
220
+ clone(): BuiltInAgent;
221
+ abortRun(): void;
221
222
  }
222
223
  /**
223
224
  * @deprecated Use BuiltInAgent instead
224
225
  */
225
226
  declare class BasicAgent extends BuiltInAgent {
226
- constructor(config: BuiltInAgentConfiguration);
227
+ constructor(config: BuiltInAgentConfiguration);
227
228
  }
228
229
  type BasicAgentConfiguration = BuiltInAgentConfiguration;
229
-
230
- export { BasicAgent, type BasicAgentConfiguration, BuiltInAgent, type BuiltInAgentConfiguration, type BuiltInAgentModel, type MCPClientConfig, type MCPClientConfigHTTP, type MCPClientConfigSSE, type MessageConversionOptions, type ModelSpecifier, type OverridableProperty, type ToolDefinition, convertJsonSchemaToZodSchema, convertMessagesToVercelAISDKMessages, convertToolDefinitionsToVercelAITools, convertToolsToVercelAITools, defineTool, resolveModel };
230
+ //#endregion
231
+ export { BasicAgent, BasicAgentConfiguration, BuiltInAgent, BuiltInAgentConfiguration, BuiltInAgentModel, MCPClientConfig, MCPClientConfigHTTP, MCPClientConfigSSE, MessageConversionOptions, ModelSpecifier, OverridableProperty, ToolDefinition, convertJsonSchemaToZodSchema, convertMessagesToVercelAISDKMessages, convertToolDefinitionsToVercelAITools, convertToolsToVercelAITools, defineTool, resolveModel };
232
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;AAuDA;;KAAY,mBAAA;;;AAkBZ;KAAY,iBAAA;;;;KA8BA,cAAA,YAA0B,aAAA;;;;UAKrB,mBAAA;EAAA;;;EAIf,IAAA;EAAA;;;EAIA,GAAA;EAI8C;;AAMhD;EANE,OAAA,GAAU,oCAAA;AAAA;;;;UAMK,kBAAA;EAYL;;;EARV,IAAA;EAcyB;;;EAVzB,GAAA;EAkBc;;;EAdd,OAAA,GAAU,MAAA;AAAA;;;;KAMA,eAAA,GAAkB,mBAAA,GAAsB,kBAAA;;AAiFpD;;;;;iBAzEgB,YAAA,CACd,IAAA,EAAM,cAAA,EACN,MAAA,YACC,aAAA;;;;UAsEc,cAAA,qBACK,CAAA,CAAE,UAAA,GAAa,CAAA,CAAE,UAAA;EAErC,IAAA;EACA,WAAA;EACA,UAAA,EAAY,WAAA;EACZ,OAAA,GAAU,IAAA,EAAM,CAAA,CAAE,KAAA,CAAM,WAAA,MAAiB,OAAA;AAAA;;;;;;;;;iBAW3B,UAAA,qBAA+B,CAAA,CAAE,UAAA,CAAA,CAAY,MAAA;EAC3D,IAAA;EACA,WA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