@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/CHANGELOG.md +2 -0
- package/dist/index.cjs +611 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +232 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +146 -144
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +574 -672
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -12
- package/{tsup.config.ts → tsdown.config.ts} +4 -3
- package/dist/index.d.ts +0 -230
- package/dist/index.js +0 -724
- package/dist/index.js.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { AbstractAgent,
|
|
2
|
-
import { LanguageModel,
|
|
3
|
-
import { Observable } from
|
|
4
|
-
import { z } from
|
|
5
|
-
import { StreamableHTTPClientTransportOptions } from
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
93
|
-
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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
|
-
|
|
227
|
+
constructor(config: BuiltInAgentConfiguration);
|
|
227
228
|
}
|
|
228
229
|
type BasicAgentConfiguration = BuiltInAgentConfiguration;
|
|
229
|
-
|
|
230
|
-
export { BasicAgent,
|
|
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,WAAA;EACA,UAAA,EAAY,WAAA;EACZ,OAAA,GAAU,IAAA,EAAM,CAAA,CAAE,KAAA,CAAM,WAAA,MAAiB,OAAA;AAAA,IACvC,cAAA,CAAe,WAAA;;;;UA0CF,wBAAA;EACf,qBAAA;EACA,wBAAA;AAAA;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